lib/src/EBTools/EBIndexSpace.cpp
// Recursively find all VoFs connected to "a_curVoF" and number them
// "a_curNum".  This works on a single EBCellFAB.  "a_lastVoF" is used to
// avoid recursing back to the VoF that generated the call to this routine.
// For the first call, "a_lastVoF" should equal "a_curVoF" since this allows
// recursion using all faces.
Recursively find all VoFs connected to "a_curVoF" and number them
"a_curNum".  This works on a single EBCellFAB.  "a_lastVoF" is used to
avoid recursing back to the VoF that generated the call to this routine.
For the first call, "a_lastVoF" should equal "a_curVoF" since this allows
recursion using all faces.
Recursively find all VoFs connected to " a_curVoF " and number them " a_curNum " . This works on a single EBCellFAB . " a_lastVoF " is used to avoid recursing back to the VoF that generated the call to this routine . For the first call " a_lastVoF " should equal " a_curVoF " since this allows recursion using all faces .
bool EBIndexSpace::setAllConnectedVoFs(Real&               a_totalVolFrac,
                                       EBCellFAB&          a_curEBCellFAB,
                                       const EBGraph&      a_curEBGraph,
                                       const EBISBox&      a_curEBISBox,
                                       const VolIndex&     a_curVoF,
                                       const VolIndex&     a_lastVoF,
                                       const unsigned int& a_curNum)
{
  bool foundNewVoF = false;
  a_totalVolFrac = 0.0;
  int comp = 0;
  if (a_curEBCellFAB(a_curVoF,comp) == -1.0)
  {
    foundNewVoF = true;
    a_curEBCellFAB(a_curVoF,comp) = a_curNum;
    a_totalVolFrac += a_curEBISBox.volFrac(a_curVoF);
    for (int idir = 0; idir < SpaceDim; idir++)
    {
      for (SideIterator sit; sit.ok(); ++sit)
      {
        const Side::LoHiSide& curSide = sit();
        const Vector<FaceIndex> faces = a_curEBISBox.getFaces(a_curVoF,idir,curSide);
        for (int iface = 0; iface < faces.size(); iface++)
        {
          const FaceIndex& face = faces[iface];
          const VolIndex& nextVoF = face.getVoF(curSide);
          if (nextVoF.cellIndex() >= 0 && nextVoF != a_lastVoF)
          {
            Real totalVolFrac;
            setAllConnectedVoFs(totalVolFrac,
                                a_curEBCellFAB,
                                a_curEBGraph,
                                a_curEBISBox,
                                nextVoF,
                                a_curVoF,
                                a_curNum);
            a_totalVolFrac += totalVolFrac;
          }
        }
      }
    }
  }
  return foundNewVoF;
}
bool EBIndexSpace :: setAllConnectedVoFs ( Real & a_totalVolFrac , EBCellFAB & a_curEBCellFAB , const EBGraph & a_curEBGraph , const EBISBox & a_curEBISBox , const VolIndex & a_curVoF , const VolIndex & a_lastVoF , const unsigned int & a_curNum ) { bool foundNewVoF = false ; a_totalVolFrac = 0.0 ; int comp = 0 ; if ( a_curEBCellFAB ( a_curVoF , comp ) == -1.0 ) { foundNewVoF = true ; a_curEBCellFAB ( a_curVoF , comp ) = a_curNum ; a_totalVolFrac += a_curEBISBox . volFrac ( a_curVoF ) ; for ( int idir = 0 ; idir < SpaceDim ; idir ++ ) { for ( SideIterator sit ; sit . ok ( ) ; ++ sit ) { const Side :: LoHiSide & curSide = sit ( ) ; const Vector < FaceIndex > faces = a_curEBISBox . getFaces ( a_curVoF , idir , curSide ) ; for ( int iface = 0 ; iface < faces . size ( ) ; iface ++ ) { const FaceIndex & face = faces [ iface ] ; const VolIndex & nextVoF = face . getVoF ( curSide ) ; if ( nextVoF . cellIndex ( ) >= 0 && nextVoF != a_lastVoF ) { Real totalVolFrac ; setAllConnectedVoFs ( totalVolFrac , a_curEBCellFAB , a_curEBGraph , a_curEBISBox , nextVoF , a_curVoF , a_curNum ) ; a_totalVolFrac += totalVolFrac ; } } } } } return foundNewVoF ; }
Recursively find all VoFs connected to "a_curVoF" and number them
"a_curNum".
Recursively find all VoFs connected to " a_curVoF " and number them " a_curNum " .