void do_geo(DisjointBoxLayout& a_dbl, EBISLayout & a_ebisl, Box & a_domain, Real & a_dx ) { //define grids int len = 32; int mid = len/2; Real xdom = 1.0; a_dx = xdom/len; const IntVect hi = (len-1)*IntVect::Unit; a_domain= Box(IntVect::Zero, hi); Vector<Box> boxes(4); Vector<int> procs(4); boxes[0] = Box(IntVect(D_DECL(0 , 0, 0)), IntVect(D_DECL(mid-1, mid-1, len-1))); boxes[1] = Box(IntVect(D_DECL(0 ,mid, 0)), IntVect(D_DECL(mid-1, len-1, len-1))); boxes[2] = Box(IntVect(D_DECL(mid, 0, 0)), IntVect(D_DECL(len-1, mid-1, len-1))); boxes[3] = Box(IntVect(D_DECL(mid,mid, 0)), IntVect(D_DECL(len-1, len-1, len-1))); LoadBalance(procs, boxes); /** int loProc = 0; int hiProc = numProc() -1; procs[0] = loProc; procs[1] = hiProc; procs[2] = loProc; procs[3] = hiProc; **/ a_dbl = DisjointBoxLayout(boxes, procs); //define geometry RealVect rampNormal = RealVect::Zero; rampNormal[0] = -0.5; rampNormal[1] = 0.866025404; Real rampAlpha = -0.0625; RealVect rampPoint = RealVect::Zero; rampPoint[0] = rampAlpha / rampNormal[0]; bool inside = true; PlaneIF ramp(rampNormal,rampPoint,inside); RealVect vectDx = RealVect::Unit; vectDx *= a_dx; GeometryShop mygeom( ramp, 0, vectDx ); RealVect origin = RealVect::Zero; EBIndexSpace *ebisPtr = Chombo_EBIS::instance(); ebisPtr->define(a_domain, origin, a_dx, mygeom); //fill layout ebisPtr->fillEBISLayout(a_ebisl, a_dbl, a_domain, 4 ); }
int main(int argc, char** argv) { //This test is an attempt to test linearization //of eb data holders directly int eekflag=0; #ifdef CH_MPI MPI_Init(&argc, &argv); #endif //begin forever present scoping trick { //registerDebugger(); // Set up some geometry. Box domain; Real dx; do_geo( domain, dx ); Vector<Box> boxes(1, domain); Vector<int> procs(1, 0); // Make a layout for the space. DisjointBoxLayout dbl(boxes, procs); // Fill in the layout with the geometrical info. EBISLayout ebisl; EBIndexSpace *ebisPtr = Chombo_EBIS::instance(); ebisPtr->fillEBISLayout(ebisl, dbl, domain, 1 ); // Define the leveldata for my one and only level. DataIterator dit = dbl.dataIterator(); for ( dit.begin(); dit.ok(); ++dit ) { eekflag = testIVFAB(ebisl[dit()], dbl.get(dit())); if (eekflag != 0) { pout() << "IVFAB linearization test failed " << endl; return eekflag; } eekflag = testIFFAB(ebisl[dit()], dbl.get(dit())); if (eekflag != 0) { pout() << "IFFAB linearization test failed " << endl; return eekflag; } eekflag = testEBCellFAB(ebisl[dit()], dbl.get(dit())); if (eekflag != 0) { pout() << "EBCellFAB linearization test failed " << endl; return eekflag; } eekflag = testEBFaceFAB(ebisl[dit()], dbl.get(dit())); if (eekflag != 0) { pout() << "EBFaceFAB linearization test failed " << endl; return eekflag; } eekflag = testEBFluxFAB(ebisl[dit()], dbl.get(dit())); if (eekflag != 0) { pout() << "EBFluxFAB linearization test failed " << endl; return eekflag; } } ebisPtr->clear(); }//end scoping trick pout() << "linearization tests passed "<< endl; #ifdef CH_MPI MPI_Finalize(); #endif return eekflag; }