当前位置: 首页>>代码示例>>C++>>正文


C++ EBIndexSpace类代码示例

本文整理汇总了C++中EBIndexSpace的典型用法代码示例。如果您正苦于以下问题:C++ EBIndexSpace类的具体用法?C++ EBIndexSpace怎么用?C++ EBIndexSpace使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


在下文中一共展示了EBIndexSpace类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: createRegularCellsFromParms

//-----------------------------------------------------------------------
void
EBAMRGodunovGeomFactory::
createRegularCellsFromParms(Box& a_coarsestDomain,
                            RealVect& a_coarsestDx,
                            Vector<int>& a_refRatios)
{
  // Retrieve grid data.
  Box finestDomain;
  int maxGridSize, maxCoarsenings;
  EBAMRGodunovGeomFactory::createRefinedDomainsFromParms(a_coarsestDomain,
                                                         finestDomain,
                                                         maxGridSize,
                                                         maxCoarsenings,
                                                         a_refRatios);

  // Retrieve basic geometric information.
  RealVect domainExtents;
  RealVect origin, finestDx;
  EBAMRGodunovGeomFactory::getBasicGeometry(domainExtents, origin,
                                            a_coarsestDx, finestDx,
                                            a_refRatios);

  // now define the regular geometry.
  AllRegularService regServ;
  EBIndexSpace* ebisPtr = Chombo_EBIS::instance();
  ebisPtr->define(finestDomain, origin, finestDx[0], regServ, maxGridSize,
                  maxCoarsenings);
}
开发者ID:rsnemmen,项目名称:Chombo,代码行数:29,代码来源:EBAMRGodunovGeomFactory.cpp

示例2: do_geo

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 );
}
开发者ID:rsnemmen,项目名称:Chombo,代码行数:58,代码来源:ldBaseIFFABTest.cpp

示例3: main

int
main(int argc, char** argv)
{

#ifdef CH_MPI
  MPI_Init(&argc, &argv);
#endif
  //begin forever present scoping trick
  {
    const char* in_file;
    if (argc < 2 || argv[1][0] == '-')
      {
        in_file = "ramp.inputs";
      }
    else
      {
        in_file = argv[1];
      }
    //parse input file
    ParmParse pp(0,NULL,NULL,in_file);
    int eekflag = 0;
    //define the geometry object.
    Box domain;
    eekflag =  makeGeometry(domain);
    if (eekflag != 0)
      {
        pout() << "non zero eek detected = " << eekflag << endl;
        MayDay::Error("problem in makeGeometry");
      }

    //check that total coarse vol = total fine vol
    //check that total coarse vol centroid = total fine vol centroid
    eekflag = checkCoarseAssortment(domain);

    if (eekflag != 0)
      {
        pout() << "checkCoarse: eek = " << eekflag << endl;
        MayDay::Error("problem in checkEBISL");
      }

    pout() << "pointCoarsening test passed" << endl;
  }//end scoping trick
  EBIndexSpace* ebisPtr = Chombo_EBIS::instance();
  ebisPtr->clear();
#ifdef CH_MPI
  MPI_Finalize();
#endif
  return 0;
}
开发者ID:rsnemmen,项目名称:Chombo,代码行数:49,代码来源:pointCoarseningTest.cpp

示例4: main

int
main(int argc, char** argv)
{

#ifdef CH_MPI
  MPI_Init(&argc, &argv);
#endif
  //begin scoping trick
  {

    int eekflag = 0;
    //define the geometry object.
    //need the new and delete because of
    //strong construction
    Box domain, coveredDomain;
    Real dx;
    //make the gometry.  this makes the first Chombo_EBIS
    //and defines it using a geometryservice
    eekflag =  makeGeometry(domain, dx, coveredDomain);
    if (eekflag != 0)
      {
        pout() << "non zero eek detected = " << eekflag << endl;
        MayDay::Error("problem in makeGeometry");
      }

    eekflag = checkIrregFabCopy(domain);
    if (eekflag != 0)
      {
        pout() << "non zero eek detected = " << eekflag << endl;
        MayDay::Error("problem in checkIrregFabCopy");
      }

    eekflag = checkRegularFabCopy(domain);
    if (eekflag != 0)
      {
        pout() << "non zero eek detected = " << eekflag << endl;
        MayDay::Error("problem in checkRegularFabCopy");
      }

    pout() << "fab copy test passed" << endl;
  }//end scoping trick
  EBIndexSpace* ebisPtr = Chombo_EBIS::instance();
  ebisPtr->clear();
#ifdef CH_MPI
  MPI_Finalize();
#endif
  return 0;
}
开发者ID:rsnemmen,项目名称:Chombo,代码行数:48,代码来源:ldfabCopyTest.cpp

示例5: main

int
main(int argc,char **argv)
{
#ifdef CH_MPI
  MPI_Init(&argc, &argv);
#endif

  // begin forever present scoping trick
  {
    const char* in_file;
    if (argc < 2 || argv[1][0] == '-')
      {
        in_file = "correct12.inputs";
      }
    else
      {
        in_file = argv[1];
      }
    //parse input file
    ParmParse pp(0,NULL,NULL,in_file);
    Box domain;
    int eekflag = 0;
    eekflag =  makeGeometry(domain);
    if (eekflag != 0)
      {
        pout() << "non zero eek detected = " << eekflag << endl;
        MayDay::Error("problem in makeGeometry");
      }

    eekflag = checkCorrection(domain);
    if (eekflag != 0)
      {
        pout() << "checkCorrection: eek = " << eekflag << endl;
        MayDay::Error("problem in checkCorrection");
      }
    pout() << "correct1d2d test passed" << endl;
  } // end scoping trick

  EBIndexSpace* ebisPtr = Chombo_EBIS::instance();
  ebisPtr->clear();

#ifdef CH_MPI
  MPI_Finalize();
#endif

  return 0;
}
开发者ID:rsnemmen,项目名称:Chombo,代码行数:47,代码来源:correct1d2dTest.cpp

示例6: main

int
main(int a_argc, char* a_argv[])
{
#ifdef CH_MPI
  MPI_Init(&a_argc,&a_argv);
  // registerDebugger();
  // setChomboMPIErrorHandler();
#endif
  {
    // Check for an input file
    char* inFile = NULL;

    EBDebugPoint::s_ivd = IntVect(D_DECL(16,45,0));
    if (a_argc > 1)
      {
        inFile = a_argv[1];
      }
    else
      {
        pout() << "Usage: <executable name> <inputfile>" << endl;
        pout() << "No input file specified" << endl;
        return -1;
      }
    // Parse the command line and the input file (if any)
    ParmParse pp(a_argc-2,a_argv+2,NULL,inFile);

    Box coarsestDomain;
    RealVect dx;
    // run amrGodunov
    godunovGeometry(coarsestDomain, dx);

    amrGodunov(coarsestDomain, dx);

    EBIndexSpace* ebisPtr = Chombo_EBIS::instance();
    ebisPtr->clear();

  } //scoping trick

#ifdef CH_MPI
  pout() << "dumping timers" << endl;
  CH_TIMER_REPORT();
  dumpmemoryatexit();
  MPI_Finalize();
#endif
  pout() << "Done." << endl;
}
开发者ID:rsnemmen,项目名称:Chombo,代码行数:46,代码来源:navierDriver.cpp

示例7: main

int main(int argc, char* argv[])
{
#ifdef CH_MPI
  MPI_Init(&argc, &argv);
#endif
  // Scoping trick
  {
#ifdef CH_MPI
    MPI_Barrier(Chombo_MPI::comm);
#endif

    if (argc < 2)
      {
        cerr << " usage " << argv[0] << " <input_file_name> " << endl;
        exit(0);
      }

    char* inFile = argv[1];
    ParmParse pp(argc-2,argv+2,NULL,inFile);

    PoissonParameters params;

    //read params from file
    getPoissonParameters(params);

    //define geometry from given params
    definePoissonGeometry(params);



    //solve the stinking problem and output everything
    solve(params);

    EBIndexSpace* ebisPtr = Chombo_EBIS::instance();
    ebisPtr->clear();

  }
  // End scoping trick

#ifdef CH_MPI
  CH_TIMER_REPORT();
  dumpmemoryatexit();
  MPI_Finalize();
#endif
}
开发者ID:dtgraves,项目名称:EBAMRCNS,代码行数:45,代码来源:nwoViscousDriver.cpp

示例8: main

int
main(int argc, char** argv)
{
  //This test is an attempt to test linearization
  //of eb data holders directly

  int eekflag;
#ifdef CH_MPI
  MPI_Init(&argc, &argv);
#endif
  //begin forever present scoping trick
  {
    // registerDebugger();

    // Set up some geometry.
    Box domain;
    Real dx;
    EBISLayout ebisl;
    DisjointBoxLayout dbl;

    do_geo( dbl, ebisl, domain, dx );


    eekflag = testIFFAB( dbl, ebisl, domain, dx );
    if (eekflag != 0)
      {
        pout() << "IFFAB exhange linearization test failed " << endl;
        return eekflag;
      }
    EBIndexSpace* ebisPtr = Chombo_EBIS::instance();
    ebisPtr->clear();

  }//end scoping trick
#ifdef CH_MPI
  MPI_Finalize();
#endif
  pout() << "IFFAB exchange linearization tests passed "<< endl;
  return eekflag;
}
开发者ID:rsnemmen,项目名称:Chombo,代码行数:39,代码来源:ldBaseIFFABTest.cpp

示例9: main

int
main(int a_argc, char* a_argv[])
{
#ifdef CH_MPI
    MPI_Init(&a_argc,&a_argv);
    {
        // setChomboMPIErrorHandler();
#endif
        // Check for an input file
        const char* inFile = "sphere.inputs";

        ParmParse pp(0,NULL,NULL,inFile);

        divergenceTest();

        EBIndexSpace* ebisPtr = Chombo_EBIS::instance();
        ebisPtr->clear();
#ifdef CH_MPI
    }
    MPI_Finalize();
#endif
}
开发者ID:rsnemmen,项目名称:Chombo,代码行数:22,代码来源:levelDivTest.cpp

示例10: createSphericalCavityFromParms

//-----------------------------------------------------------------------
void
EBAMRGodunovGeomFactory::
createSphericalCavityFromParms(Box& a_coarsestDomain,
                               RealVect& a_coarsestDx,
                               Vector<int>& a_refRatios)
{
  // Retrieve grid data.
  Box finestDomain;
  int maxGridSize, maxCoarsenings;
  EBAMRGodunovGeomFactory::createRefinedDomainsFromParms(a_coarsestDomain,
                                                         finestDomain,
                                                         maxGridSize,
                                                         maxCoarsenings,
                                                         a_refRatios);

  // Retrieve basic geometric information.
  RealVect domainExtents;
  RealVect origin, finestDx;
  EBAMRGodunovGeomFactory::getBasicGeometry(domainExtents, origin,
                                            a_coarsestDx, finestDx,
                                            a_refRatios);

  // now define the cavity.
  ParmParse pp;
  vector<Real> x0(SpaceDim);
  pp.getarr("sphere_center",x0, 0, SpaceDim);
  RealVect sphereCenter;
  for (int i = 0; i < SpaceDim; ++i)
    sphereCenter[i] = x0[i];
  Real sphereRadius;
  pp.get("sphere_radius", sphereRadius);
  SphereIF sphereIF(sphereRadius, sphereCenter, true);
  int verbosity = 0;
  GeometryShop workshop(sphereIF,verbosity,finestDx);
  EBIndexSpace* ebisPtr = Chombo_EBIS::instance();
  ebisPtr->define(finestDomain, origin, finestDx[0], workshop, maxGridSize,
                  maxCoarsenings);
}
开发者ID:rsnemmen,项目名称:Chombo,代码行数:39,代码来源:EBAMRGodunovGeomFactory.cpp

示例11: do_geo

void do_geo( Box &domain, Real &dx )
{
  int N = 10;
  Real xdom = 1.0;

  dx = xdom/N;
  const IntVect hi = (N-1)*IntVect::Unit;
  domain=  Box(IntVect::Zero, hi);

  int updir=1;
  int indv=0;
  Real start = 0.5;
  Real slope = tan( M_PI/6.0 );

  RealVect normal = RealVect::Zero;
  normal[updir] = 1.0;
  normal[indv] = -slope;

  RealVect point = RealVect::Zero;
  point[updir] = -slope*start;

  bool normalInside = true;

  PlaneIF myramp(normal,point,normalInside);

  RealVect vectDx = RealVect::Unit;
  vectDx *= dx;

  GeometryShop mygeom( myramp, 0, vectDx );

  RealVect origin = RealVect::Zero;

  EBIndexSpace *ebisPtr = Chombo_EBIS::instance();

  ebisPtr->define(domain, origin, dx, mygeom);

  return;
}
开发者ID:rsnemmen,项目名称:Chombo,代码行数:38,代码来源:linearizationTest.cpp

示例12: outside

int
EBRestart::makeGeometry(EBIndexSpace&                a_ebIndexSpace,
                        const EBRestart::GeomParams& a_geomParams)
{
  int eekflag = 0;
  SphereIF outside(a_geomParams.radius, a_geomParams.center, false);

  RealVect vectDx = RealVect::Unit;
  vectDx *= a_geomParams.dx;

  GeometryShop workshop(outside,0,vectDx);

  workshop.m_phase = 0;

  ProblemDomain pdomain( a_geomParams.domain );
  a_ebIndexSpace.define(pdomain,
                        a_geomParams.origin,
                        a_geomParams.dx,
                        workshop);

  return eekflag;
}
开发者ID:rsnemmen,项目名称:Chombo,代码行数:22,代码来源:restart.cpp

示例13: main

int main (int argc, char** argv)
{
#ifdef CH_MPI
  MPI_Init(&argc,&argv);
#endif

  // Begin forever present scoping trick
  {
    const char* in_file = "plane.inputs";

    if (argc > 1)
    {
      in_file = argv[1];
    }

    // Parse input file
    ParmParse pp(0,NULL,NULL,in_file);

    Box domain;
    RealVect origin;
    Real dx;

    BaseIF* implicit;

    // Make geometry
    implicit = makeGeometry(domain,origin,dx);

    // Make grids
    DisjointBoxLayout grids;
    makeLayout(grids,domain);

    // Create ebislayout
    int nghost = 0;
    EBISLayout ebisl;
    makeEBISL(ebisl,grids,domain,nghost);

    // Make a LevelData
    int nComps = 1;

    IntVect ghost = IntVect::Unit;
    ghost *= nghost;

    RefCountedPtr<DataFactory<EBCellFAB> > rcpFactory(new EBCellFactory(ebisl));
    LevelData<EBCellFAB> level(grids,nComps,ghost,*rcpFactory);

    // Put some data in the data holders
    fillData(level,origin,dx,*implicit);

    // Done with this object
    delete implicit;

    // Write the data and the EB out
    const char* basename = "plane";

    char name[1000];
    sprintf(name,"%s%dd.hdf5",basename,SpaceDim);
#ifdef CH_USE_HDF5
    writeEBLevelname(&level,name);
#endif
  } // End scoping trick

  // Clean up
  EBIndexSpace* ebisPtr = Chombo_EBIS::instance();
  ebisPtr->clear();

  CH_TIMER_REPORT();

#ifdef CH_MPI
  MPI_Finalize();
#endif

  return 0;
}
开发者ID:rsnemmen,项目名称:Chombo,代码行数:73,代码来源:plane.cpp

示例14: makeGeometry

BaseIF* makeGeometry(Box&      a_domain,
                     RealVect& a_origin,
                     Real&     a_dx)
{
  RealVect point;
  RealVect normal;
  bool     normalRegular;

  // parse input file
  ParmParse pp;

  Vector<int> n_cell(SpaceDim);
  pp.getarr("n_cell",n_cell,0,SpaceDim);

 CH_assert(n_cell.size() == SpaceDim);

  IntVect lo = IntVect::Zero;
  IntVect hi;

  for (int ivec = 0; ivec < SpaceDim; ivec++)
  {
    if (n_cell[ivec] <= 0)
    {
      pout() << "Bogus number of cells input = " << n_cell[ivec];
      exit(1);
    }

    hi[ivec] = n_cell[ivec] - 1;
  }

  a_domain.setSmall(lo);
  a_domain.setBig(hi);

  Vector<Real> prob_lo(SpaceDim,1.0);
  Real prob_hi;

  pp.getarr("prob_lo",prob_lo,0,SpaceDim);
  pp.get("prob_hi",prob_hi);

  a_dx = (prob_hi-prob_lo[0])/n_cell[0];

  for (int idir = 0; idir < SpaceDim; idir++)
  {
    a_origin[idir] = prob_lo[idir];
  }

  // ParmParse doesn't get RealVects, so work-around with Vector<Real>
  Vector<Real> vectorCenter;
  pp.getarr("point",vectorCenter,0,SpaceDim);

  for (int idir = 0; idir < SpaceDim; idir++)
  {
    point[idir] = vectorCenter[idir];
  }

  Vector<Real> vectorNormal;
  pp.getarr("normal",vectorNormal,0,SpaceDim);

  for (int idir = 0; idir < SpaceDim; idir++)
  {
    normal[idir] = vectorNormal[idir];
  }

  // Parm Parse doesn't get bools, so work-around with int
  int intInsideRegular;
  pp.get("normalRegular",intInsideRegular);

  if (intInsideRegular != 0) normalRegular = true;
  if (intInsideRegular == 0) normalRegular = false;

  PlaneIF implicit(normal,point,normalRegular);

  RealVect vectDx = RealVect::Unit;
  vectDx *= a_dx;

  GeometryShop workshop(implicit,0,vectDx);

  // This generates the new EBIS
  EBIndexSpace* ebisPtr = Chombo_EBIS::instance();
  ebisPtr->define(a_domain,a_origin,a_dx,workshop);

  return implicit.newImplicitFunction();
}
开发者ID:rsnemmen,项目名称:Chombo,代码行数:83,代码来源:plane.cpp

示例15: makeGeometry

int makeGeometry(Box& a_domain)
{
  Real dx;
  RealVect origin;
  int eekflag =  0;
  //parse input file
  ParmParse pp;

  Vector<int> n_cell(SpaceDim);
  pp.getarr("n_cell",n_cell,0,SpaceDim);

  CH_assert(n_cell.size() == SpaceDim);
  IntVect lo = IntVect::Zero;
  IntVect hi;
  for (int ivec = 0; ivec < SpaceDim; ivec++)
    {
      if (n_cell[ivec] <= 0)
        {
          pout() << " bogus number of cells input = " << n_cell[ivec];
          return(-1);
        }
      hi[ivec] = n_cell[ivec] - 1;
    }

  a_domain.setSmall(lo);
  a_domain.setBig(hi);

  Vector<Real> prob_lo(SpaceDim, 1.0);
  Real prob_hi;
  pp.getarr("prob_lo",prob_lo,0,SpaceDim);
  pp.get("prob_hi",prob_hi);
  dx = (prob_hi-prob_lo[0])/n_cell[0];
  RealVect dxVect = dx*RealVect::Unit;
  for (int idir = 0; idir < SpaceDim; idir++)
    {
      origin[idir] = prob_lo[idir];
    }
  int verbosity = 0;
  int whichgeom;
  pp.get("which_geom",whichgeom);
  EBIndexSpace* ebisPtr = Chombo_EBIS::instance();

  if (whichgeom == 0)
    {
      //allregular
      pout() << "all regular geometry" << endl;
      AllRegularService regserv;
      ebisPtr->define(a_domain, origin, dx, regserv);
    }
  else if (whichgeom == 1)
    {
      pout() << "ramp geometry" << endl;
      int upDir;
      int indepVar;
      Real startPt;
      Real slope;
      pp.get("up_dir",upDir);
      pp.get("indep_var",indepVar);
      pp.get("start_pt", startPt);
      pp.get("ramp_slope", slope);

      RealVect normal = RealVect::Zero;
      normal[upDir] = 1.0;
      normal[indepVar] = -slope;

      RealVect point = RealVect::Zero;
      point[upDir] = -slope*startPt;

      bool normalInside = true;

      PlaneIF ramp(normal,point,normalInside);

      GeometryShop workshop(ramp,verbosity,dxVect);
      //this generates the new EBIS
      ebisPtr->define(a_domain, origin, dx, workshop);
    }
  else if (whichgeom == 5)
    {
      pout() << "sphere geometry" << endl;
      vector<Real> sphere_center(SpaceDim);
      pp.getarr("sphere_center",sphere_center, 0, SpaceDim);
      RealVect sphereCenter;
      for (int idir = 0; idir < SpaceDim; idir++)
        {
          sphereCenter[idir] = sphere_center[idir];
        }
      Real sphereRadius;
      pp.get("sphere_radius", sphereRadius);

      bool     insideRegular = false;
      SphereIF implicit(sphereRadius,sphereCenter,insideRegular);
      GeometryShop workshop(implicit,verbosity,dxVect);
      //this generates the new EBIS
      ebisPtr->define(a_domain, origin, dx, workshop);
    }
  else if (whichgeom == 13)
    {
      pout() << "rhodonea geometry" << endl;
      vector<Real> tmp(SpaceDim);
      pp.getarr("rhodonea_center", tmp, 0, SpaceDim);
//.........这里部分代码省略.........
开发者ID:rsnemmen,项目名称:Chombo,代码行数:101,代码来源:correct1d2dTest.cpp


注:本文中的EBIndexSpace类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。