src/Boundary/SphericalBoundary.cc
//------------------------------------------------------------------------------
// Update the state of the current ghost nodes (correcting their positions
// and H tensors.)
//------------------------------------------------------------------------------
Update the state of the current ghost nodes (correcting their positions
and H tensors.)
Update the state of the current ghost nodes ( correcting their positions and H tensors . )
void
SphericalBoundary::
updateGhostNodes(NodeList<Dim<3> >& nodeList) {
  REQUIRE(mGhostPositions.fieldForNodeList(nodeList) < mGhostPositions.end());
  const BoundaryNodes& boundaryNodes = accessBoundaryNodes(nodeList);
  const vector<int>& controlNodes = boundaryNodes.controlNodes;
  const vector<int>& ghostNodes = boundaryNodes.ghostNodes;
  Field<Dim<3>, vector<Vector> >& ghostPositions = **(mGhostPositions.fieldForNodeList(nodeList));
  Field<Dimension, Vector>& position = nodeList.positions();
  CHECK(controlNodes.size() == ghostNodes.size());
  vector<int>::const_iterator controlItr = controlNodes.begin();
  vector<int>::const_iterator ghostItr = ghostNodes.begin();
  for (auto i = 0u; i != nodeList.numInternalNodes(); ++i) {
    const double ri = position(i).magnitude();
    CHECK(ghostPositions(i).size() > 0);
    for (vector<Vector>::iterator ghostPositionItr = ghostPositions(i).begin();
         ghostPositionItr != ghostPositions(i).end();
         ++ghostPositionItr, ++controlItr, ++ghostItr) {
      CHECK(controlItr < controlNodes.end());
      CHECK(ghostItr < ghostNodes.end());
      CHECK(*controlItr == (int)i);
      CHECK(*ghostItr >= (int)nodeList.firstGhostNode() && *ghostItr < (int)nodeList.numNodes());
      const double rj = ghostPositionItr->magnitude();
      *ghostPositionItr *= ri*rj/(rj*rj + 1.0e-50);
      position(*ghostItr) = *ghostPositionItr;
    }
  }
  CHECK(controlItr == controlNodes.end());
  CHECK(ghostItr == ghostNodes.end());
  Field<Dimension, SymTensor>& H = nodeList.Hfield();
  applyGhostBoundary(H);
}
void SphericalBoundary :: updateGhostNodes ( NodeList < Dim < 3 > > & nodeList ) { REQUIRE ( mGhostPositions . fieldForNodeList ( nodeList ) < mGhostPositions . end ( ) ) ; const BoundaryNodes & boundaryNodes = accessBoundaryNodes ( nodeList ) ; const vector < int > & controlNodes = boundaryNodes . controlNodes ; const vector < int > & ghostNodes = boundaryNodes . ghostNodes ; Field < Dim < 3 > , vector < Vector > > & ghostPositions = * * ( mGhostPositions . fieldForNodeList ( nodeList ) ) ; Field < Dimension , Vector > & position = nodeList . positions ( ) ; CHECK ( controlNodes . size ( ) == ghostNodes . size ( ) ) ; vector < int > :: const_iterator controlItr = controlNodes . begin ( ) ; vector < int > :: const_iterator ghostItr = ghostNodes . begin ( ) ; for ( auto i = 0u ; i != nodeList . numInternalNodes ( ) ; ++ i ) { const double ri = position ( i ) . magnitude ( ) ; CHECK ( ghostPositions ( i ) . size ( ) > 0 ) ; for ( vector < Vector > :: iterator ghostPositionItr = ghostPositions ( i ) . begin ( ) ; ghostPositionItr != ghostPositions ( i ) . end ( ) ; ++ ghostPositionItr , ++ controlItr , ++ ghostItr ) { CHECK ( controlItr < controlNodes . end ( ) ) ; CHECK ( ghostItr < ghostNodes . end ( ) ) ; CHECK ( * controlItr == ( int ) i ) ; CHECK ( * ghostItr >= ( int ) nodeList . firstGhostNode ( ) && * ghostItr < ( int ) nodeList . numNodes ( ) ) ; const double rj = ghostPositionItr -> magnitude ( ) ; * ghostPositionItr *= ri * rj / ( rj * rj + 1.0e-50 ) ; position ( * ghostItr ) = * ghostPositionItr ; } } CHECK ( controlItr == controlNodes . end ( ) ) ; CHECK ( ghostItr == ghostNodes . end ( ) ) ; Field < Dimension , SymTensor > & H = nodeList . Hfield ( ) ; applyGhostBoundary ( H ) ; }
Update the state of the current ghost nodes (correcting their positions
and H tensors.)
Update the state of the current ghost nodes ( correcting their positions and H tensors . )
// Get the control and ghost nodes for this NodeList. // The field of ghost positions for this NodeList. // Get the positions for this NodeList. // Update the positions, forcing the ghost nodes to exist at the // same radius as their control nodes. // We can use the normal ghost boundary enforcement to update the // H's of the ghost nodes. //   // Update the neighbor information. //   nodeList.neighbor().updateNodes(); // (ghostNodes);