You can check in getLattice_ex. If you’re given a non-NULL edge that can’t be found in the map, abort.

Greg Bronevetsky
Lawrence Livermore National Lab
(925) 424-5756
bronevetsky@llnl.gov<mailto:bronevetsky@llnl.gov>
http://greg.bronevetsky.com

From: Sriram Aananthakrishnan [mailto:notifications@github.com]
Sent: Wednesday, November 13, 2013 2:36 PM
To: sriram87/edg4x-rose
Cc: bronevet
Subject: Re: [edg4x-rose] Fuse state access (#2)


In projects/fuse/src/state/nodeState.C:

> +  Lattice* retLattice;

> +  scope reg("NodeState::getLatticeAbove", scope::medium, attrGE("nodeStateDebugLevel", 2));

> +  if(nodeStateDebugLevel() >= 2) {

> +    dbg << "analysis=" << dynamic_cast<ComposedAnalysis*>(analysis)->str()

> +        << ", PartEdge=" << (departEdge? departEdge->str() : "NULL")

> +        << ", latticeName=" << latticeName << endl;

> +  }

> +

> +  // if the departEdge is not NULLPartEdge

> +  // assert that we always get specific edge or inEdgeFromAny

> +  // if the info is not available query for info on NULLPartEdge

> +  if(departEdge) {

> +    assert(departEdge->target());

> +    retLattice = getLattice_ex(dfInfoAbove, analysis, departEdge, latticeName);

> +    if(!retLattice) {

> +      retLattice = getLatticeAbove(analysis, NULLPartEdge, latticeName);

I see what you did here. Setting this,
if(!departEdge || !departEdge->source()) departEdge = NULLPartEdge;
will eliminate the need for recursion. It simplifies the function. I will rewrite it based on your suggestion.

I'm not sure how I would check if the edge given to me is invalid. But you are right, this should not happen in valid analysis.

—
Reply to this email directly or view it on GitHub<https://github.com/sriram87/edg4x-rose/pull/2/files#r7643845>.