lib/test/AMRTools/refluxEdgeTest.cpp
//  computes curl of face-centered data
computes curl of face-centered data
computes curl of face - centered data
void computeCurlEdge(FArrayBox& a_curl,
                     const FArrayBox& a_data,
                     const Box& a_gridBox,
                     const Real a_dx,
                     const int a_curlComp,
                     Real a_edgeComp)
{
  Real oneOnDx = 1.0/a_dx;
  int dir1;
  int dir2;
  if ((SpaceDim == 2) || (a_curlComp == 2))
    {
      dir1 = 0;
      dir2 = 1;
    }
  else if (a_curlComp == 0)
    {
      dir1= 1;
      dir2= 2;
    }
  else if (a_curlComp == 1)
    {
      dir1=2;
      dir2=0;
    }
  else
    {
      MayDay::Error("ComputeCurl -- bad direction");
    }
  IntVect ii1(IntVect::Zero);
  ii1[dir1] = 1;
  IntVect ii2(IntVect::Zero);
  ii2[dir2] = 1;
  BoxIterator bit(a_gridBox);
  for (bit.begin(); bit.ok(); ++bit)
    {
      IntVect iv = bit();
      Real thisCurl;
      if (a_edgeComp == dir1)
        {
          IntVect iv2 = iv + ii2;
          thisCurl =  oneOnDx*(a_data(iv2, 0) - a_data(iv,0));
          a_curl(iv) -= thisCurl;
        }
      else if (a_edgeComp == dir2)
        {
          IntVect iv1 = iv + ii1;
          thisCurl = oneOnDx*(a_data(iv1, 0) - a_data(iv,0));
          a_curl(iv,0) += thisCurl;
        }
    } 
}
void computeCurlEdge ( FArrayBox & a_curl , const FArrayBox & a_data , const Box & a_gridBox , const Real a_dx , const int a_curlComp , Real a_edgeComp ) { Real oneOnDx = 1.0 / a_dx ; int dir1 ; int dir2 ; if ( ( SpaceDim == 2 ) || ( a_curlComp == 2 ) ) { dir1 = 0 ; dir2 = 1 ; } else if ( a_curlComp == 0 ) { dir1 = 1 ; dir2 = 2 ; } else if ( a_curlComp == 1 ) { dir1 = 2 ; dir2 = 0 ; } else { MayDay :: Error ( " " ) ; } IntVect ii1 ( IntVect :: Zero ) ; ii1 [ dir1 ] = 1 ; IntVect ii2 ( IntVect :: Zero ) ; ii2 [ dir2 ] = 1 ; BoxIterator bit ( a_gridBox ) ; for ( bit . begin ( ) ; bit . ok ( ) ; ++ bit ) { IntVect iv = bit ( ) ; Real thisCurl ; if ( a_edgeComp == dir1 ) { IntVect iv2 = iv + ii2 ; thisCurl = oneOnDx * ( a_data ( iv2 , 0 ) - a_data ( iv , 0 ) ) ; a_curl ( iv ) -= thisCurl ; } else if ( a_edgeComp == dir2 ) { IntVect iv1 = iv + ii1 ; thisCurl = oneOnDx * ( a_data ( iv1 , 0 ) - a_data ( iv , 0 ) ) ; a_curl ( iv , 0 ) += thisCurl ; } } }
computes curl of face-centered data
computes curl of face - centered data
// ::: since this is edge-centered, difference is between // ::: i+1 and i //Real oneOnDx = 1.0/a_dx; // end loop over cells