Sriram, I had the following code structure in mind. Would it work? The only thing that both your and my code are missing is that if the caller provides a concrete edge that is invalid, the response is to merge the info from the valid edges or NULLPartEdge. We should have a check for this case.

  // Returns the given lattice above the node from the given analysis along the given departing edge
  Lattice* NodeState::getLatticeAbove(Analysis* analysis, PartEdgePtr departEdge, int latticeName) const
  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;
  }

  // We must get either a NULLPartEdge, a concrete edge or inEdgeFromAny
  assert(!departEdge || departEdge->target());

  // If the edge is inEdgeFromAny, query NULLPartEdge instead
  if(!departEdge || !departEdge->source()) departEdge = NULLPartEdge;

  retLattice = getLattice_ex(dfInfoAbove, analysis, departEdge, latticeName);

  // If we didn’t get a lattice at departEdge, merge the info along all the available edges and return that instead.
  // If departEdge is concrete and the info above is at NULLPartEdge, we’ll return that info
  // If departEdge is  NULLPartEdge or inEdgeFromAny, and the info above is stored separately among concrete edges, we merge their lattices
 // If departEdge is concrete and the above info is stored on concrete edges that do not include departEdge, we’ll also merge, although this should not happen in a valid analysis
 if(!retLattice) retLattice = meetLatticeMapInfo(dfInfoAbove, analysis, latticeName, true);

 if(nodeStateDebugLevel() >= 2) {
    dbg << "retLattice=" << (retLattice? retLattice->str() : "NULL") << endl;
  }
  return retLattice;

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:01 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);

The recursion on line 201 is necessary. Suppose if you have info on specific edges, you ask for info on part->inEdgeFromAny, getLattice_ex will return NULL on line 199. Calling getLattice_ex on line 201 instead would still return NULL. Now, recursing on the same function will invoke meetLatticeInfo on line 210.

—
Reply to this email directly or view it on GitHub<https://github.com/sriram87/edg4x-rose/pull/2/files#r7642744>.