本文整理汇总了C++中DisjointBoxLayout::define方法的典型用法代码示例。如果您正苦于以下问题:C++ DisjointBoxLayout::define方法的具体用法?C++ DisjointBoxLayout::define怎么用?C++ DisjointBoxLayout::define使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类DisjointBoxLayout
的用法示例。
在下文中一共展示了DisjointBoxLayout::define方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: Max
int
makeLayout(DisjointBoxLayout& a_dbl,
const Box& a_domain)
{
ParmParse pp;
int eekflag= 0;
int ipieces;
ipieces = Max(ipieces, 1);
int maxsize;
pp.get("maxboxsize",maxsize);
Vector<Box> vbox(1, a_domain);
domainSplit(a_domain, vbox, maxsize);
if (eekflag != 0)
{
pout() << "problem in domainsplit" << endl;
return eekflag;
}
Vector<int> procAssign;
eekflag = LoadBalance(procAssign,vbox);
if (eekflag != 0)
{
pout() << "problem in loadbalance" << endl;
return eekflag;
}
a_dbl.define(vbox, procAssign);
return eekflag;
}
示例2: meshRefObj
int
makeLayout(DisjointBoxLayout& a_dbl,
const Box& a_domainFine)
{
//set up mesh refine object
ParmParse pp;
int eekflag= 0;
int maxsize;
pp.get("maxboxsize",maxsize);
int bufferSize = 1;
int blockFactor = 2;
Real fillrat = 0.75;
Box domainCoar = coarsen(a_domainFine, 2);
Vector<int> refRat(2,2);
BRMeshRefine meshRefObj(domainCoar, refRat, fillrat,
blockFactor, bufferSize, maxsize);
Vector<Vector<Box> > oldMeshes(2);
oldMeshes[0] = Vector<Box>(1, domainCoar);
oldMeshes[1] = Vector<Box>(1, a_domainFine);
//set up coarse tags
int nc = domainCoar.size(0);
int nmi = nc/2;//16
int nqu = nc/4;//8
int ntf = (nc*3)/4; //24
int nte = (nc*3)/8; //12
int nfe = (nc*5)/8; //20
#if (CH_SPACEDIM ==2)
Box boxf1(IntVect(0, nqu), IntVect(nmi-1,ntf-1));
Box boxf2(IntVect(nmi,nte), IntVect(ntf-1,nfe-1));
Box boxf3(IntVect(nqu,0 ), IntVect(nfe-1,nqu-1));
Box boxf4(IntVect(nfe,nqu), IntVect(nc -1,nte-1));
#else
Box boxf1(IntVect(0, nqu,nqu), IntVect(nmi-1,ntf-1,ntf-1));
Box boxf2(IntVect(nmi,nte,nte), IntVect(ntf-1,nfe-1,nfe-1));
Box boxf3(IntVect(nqu,0,0 ), IntVect(nfe-1,nqu-1,nqu-1));
Box boxf4(IntVect(nfe,nqu,nqu), IntVect(nc -1,nte-1,nte-1));
#endif
IntVectSet tags;
tags |= boxf1;
tags |= boxf2;
tags |= boxf3;
tags |= boxf4;
int baseLevel = 0;
int topLevel = 0;
Vector<Vector<Box> > newMeshes;
meshRefObj.regrid(newMeshes, tags, baseLevel,
topLevel, oldMeshes);
const Vector<Box>& vbox = newMeshes[1];
Vector<int> procAssign;
eekflag = LoadBalance(procAssign,vbox);
if (eekflag != 0) return eekflag;
a_dbl.define(vbox, procAssign);
return eekflag;
}
示例3: mesher
int
makeLayoutPart(DisjointBoxLayout& a_dbl,
const Box& a_domainCoarsest)
{
// Vector<int> vecRefRat(2, 2);
ParmParse pp;
int eekflag= 0;
int blockFactor, bufferSize, maxSize;
Real fillRat;
pp.get("block_factor", blockFactor);
pp.get("buffer_size", bufferSize);
pp.get("maxboxsize", maxSize);
pp.get("fill_ratio", fillRat);
int nlevels = 2;
Vector<int> vecRefRat(nlevels);
pp.getarr("ref_ratio", vecRefRat,0,nlevels);
BRMeshRefine mesher(a_domainCoarsest, vecRefRat,
fillRat, blockFactor, bufferSize, maxSize);
int topLevel = 0;
int baseLevel = 0;
//tags at base level
IntVectSet tags;
eekflag = makeTags(tags, a_domainCoarsest);
if (eekflag < 0) return eekflag;
Vector<Vector<Box> > oldMeshes(nlevels);
oldMeshes[0] = Vector<Box>(1, a_domainCoarsest);
Box finerDomain = a_domainCoarsest;
for (int ilev = 1; ilev < nlevels; ilev++)
{
finerDomain.refine(vecRefRat[ilev]);
oldMeshes[ilev] = Vector<Box>(1, finerDomain);
}
Vector<Vector<Box> > newMeshes;
mesher.regrid(newMeshes, tags, baseLevel, topLevel, oldMeshes);
Vector<int> procAssign;
eekflag = LoadBalance(procAssign, newMeshes[1]);
if (eekflag != 0) return eekflag;
a_dbl.define(newMeshes[1], procAssign);
int iverbose;
pp.get("verbose", iverbose);
if (iverbose == 1)
{
pout() << "the grids coarser domain= " << a_domainCoarsest
<< " = " << a_dbl << endl;
}
return eekflag;
}
示例4: meshRefObj
int
makeLayout(DisjointBoxLayout& a_dbl,
const Box& a_domainFine)
{
//set up mesh refine object
ParmParse pp;
int eekflag= 0;
int maxsize;
pp.get("maxboxsize",maxsize);
int bufferSize = 2;
int blockFactor = 8;
Real fillrat = 0.7;
Box domainCoar = coarsen(a_domainFine, 2);
Vector<int> refRat(2,2);
BRMeshRefine meshRefObj(domainCoar, refRat, fillrat,
blockFactor, bufferSize, maxsize);
Vector<Vector<Box> > oldMeshes(2);
oldMeshes[0] = Vector<Box>(1, domainCoar);
oldMeshes[1] = Vector<Box>(1, a_domainFine);
//set up coarse tags
int nc = domainCoar.size(0);
Box halfBox = domainCoar;
halfBox.growHi(0, -nc/2);
IntVectSet tags(halfBox);
int baseLevel = 0;
int topLevel = 0;
Vector<Vector<Box> > newMeshes;
meshRefObj.regrid(newMeshes, tags, baseLevel,
topLevel, oldMeshes);
const Vector<Box>& vbox = newMeshes[1];
Vector<int> procAssign;
eekflag = LoadBalance(procAssign,vbox);
if (eekflag != 0) return eekflag;
a_dbl.define(vbox, procAssign);
return eekflag;
}
示例5: ghostVect
int
main(int argc ,char *argv[] )
{
#ifdef CH_MPI
MPI_Init(&argc, &argv);
#endif
int status = 0;
// Make this test pass automatically if DIM > 3, to avoid FAIL message.
if (SpaceDim <= 3)
{
parseTestOptions(argc, argv);
// establish periodic domain -- first multiply periodic in all directions
int baseDomainSize = 8;
int numGhost = 2;
IntVect ghostVect(numGhost*IntVect::Unit);
Box baseDomBox(IntVect::Zero, (baseDomainSize-1)*IntVect::Unit);
ProblemDomain baseDomain(baseDomBox);
// set periodic in all directions
for (int dir=0; dir<SpaceDim; dir++)
{
baseDomain.setPeriodic(dir, true);
}
{
// QuadCFInterp test
int nRef = 2;
ProblemDomain fineDomain(baseDomain);
fineDomain.refine(nRef);
const Box domainBox = baseDomain.domainBox();
Vector<Box> crseBoxes(1, domainBox);
Vector<int> crseProcAssign(1,0);
DisjointBoxLayout crseGrids(crseBoxes, crseProcAssign, baseDomain);
// note the lack of ghost cells on the base level
LevelData<FArrayBox> crseData(crseGrids, 1, IntVect::Zero);
Real dxCrse = 1.0/(baseDomainSize);
Real dxFine = dxCrse/nRef;
initData(crseData, dxCrse);
#if (CH_SPACEDIM == 1)
Vector<Box> fineBoxes(2);
Vector<int> fineProcAssign(2);
fineBoxes[0] = Box(IntVect::Zero, 5*IntVect::Unit);
fineBoxes[1] = Box(IntVect(D_DECL6(6,10,10,6,10,0)), IntVect(D_DECL6(11,15,15,11,15,15)));
#else
// try multiple boxes for fine level
Vector<Box> fineBoxes(4);
Vector<int> fineProcAssign(4);
fineBoxes[0] = Box(IntVect::Zero, 9*IntVect::Unit);
fineBoxes[1] = Box(IntVect(D_DECL6(6,10,10,6,10,0)), IntVect(D_DECL6(11,15,15,11,15,15)));
// this box should fail the disjointness test
//fineBoxes[1] = Box(IntVect(D_DECL(7,10,10)), 17*IntVect::Unit);
fineBoxes[2] = Box(IntVect(D_DECL6(12,2,0,12,2,0)), IntVect(D_DECL6(15,7,7,15,7,7)));
fineBoxes[3] = Box(IntVect(D_DECL6(12,12,0,12,12,0)), 15*IntVect::Unit);
#endif
int loadbalancestatus = LoadBalance(fineProcAssign, fineBoxes);
CH_assert (loadbalancestatus == 0);
DisjointBoxLayout fineGrids;
fineGrids.define(fineBoxes, fineProcAssign, fineDomain);
LevelData<FArrayBox> fineData(fineGrids, 1, ghostVect);
// set these to a bogus value to start with
DataIterator fineDit = fineData.dataIterator();
for (fineDit.begin(); fineDit.ok(); ++fineDit)
{
fineData[fineDit()].setVal(1.0e9);
}
FineInterp interpolator(fineGrids, 1, nRef, fineDomain);
// turn on fine-data averaging even though it's unnecessary
// since this is a test (so we'd like to know if it's broken)
bool averageFineData = true;
interpolator.interpToFine(fineData, crseData, averageFineData);
// now fill in ghost cells
QuadCFInterp filler(fineGrids, &crseGrids, dxFine, nRef, 1,
fineDomain);
filler.coarseFineInterp(fineData, crseData);
}
{
// fineInterp near boundary test
int numLev = 3;
Vector<int> nRefVect(numLev);
nRefVect[0] = 4;
nRefVect[1] = 2;
nRefVect[2] = -1;
Vector<Real> dxVect(numLev);
//.........这里部分代码省略.........
示例6: meshRefObj
int
makeLayouts(DisjointBoxLayout& a_dblCoar,
DisjointBoxLayout& a_dblFine,
const Box& a_domainCoar,
const Box& a_domainFine)
{
//set up mesh refine object
int eekflag= 0;
Vector<Box> vboxCoar;
Vector<Box> vboxFine;
#if 1
ParmParse pp;
int maxsize;
pp.get("maxboxsize",maxsize);
int bufferSize = 1;
int blockFactor = 2;
Real fillrat = 0.75;
Vector<int> refRat(2,2);
BRMeshRefine meshRefObj(a_domainCoar, refRat, fillrat,
blockFactor, bufferSize, maxsize);
Vector<Vector<Box> > oldMeshes(2);
oldMeshes[0] = Vector<Box>(1, a_domainCoar);
oldMeshes[1] = Vector<Box>(1, a_domainFine);
//set up coarse tags
int nc = a_domainCoar.size(0);
int nmi = nc/2;//16
int nqu = nc/4;//8
int ntf = (nc*3)/4; //24
int nte = (nc*3)/8; //12
int nfe = (nc*5)/8; //20
#if (CH_SPACEDIM ==2)
Box boxf1(IntVect(0, nqu), IntVect(nmi-1,ntf-1));
Box boxf2(IntVect(nmi,nte), IntVect(ntf-1,nfe-1));
Box boxf3(IntVect(nqu,0 ), IntVect(nfe-1,nqu-1));
Box boxf4(IntVect(nfe,nqu), IntVect(nc -1,nte-1));
// Box boxf5(IntVect(nqu,nqu), IntVect(ntf-1,ntf-1));
#else
Box boxf1(IntVect(0, nqu,nqu), IntVect(nmi-1,ntf-1,ntf-1));
Box boxf2(IntVect(nmi,nte,nte), IntVect(ntf-1,nfe-1,nfe-1));
Box boxf3(IntVect(nqu,0,0 ), IntVect(nfe-1,nqu-1,nqu-1));
Box boxf4(IntVect(nfe,nqu,nqu), IntVect(nc -1,nte-1,nte-1));
// Box boxf5(IntVect(nqu,nqu), IntVect(ntf-1,ntf-1))
#endif
IntVectSet tags;
tags |= boxf1;
tags |= boxf2;
tags |= boxf3;
tags |= boxf4;
// tags |= boxf5;
int baseLevel = 0;
int topLevel = 0;
Vector<Vector<Box> > newMeshes;
meshRefObj.regrid(newMeshes, tags, baseLevel,
topLevel, oldMeshes);
vboxCoar = newMeshes[0];
vboxFine = newMeshes[1];
#else
vboxCoar = Vector<Box>(1, a_domainCoar);
Box shrunkFine = a_domainFine;
int nc = Max(a_domainCoar.size(0)/4, 2);
shrunkFine.grow(-nc);
vboxFine = Vector<Box>(1, shrunkFine);
#endif
Vector<int> procAssignFine, procAssignCoar;
eekflag = LoadBalance(procAssignFine,vboxFine);
if (eekflag != 0) return eekflag;
eekflag = LoadBalance(procAssignCoar,vboxCoar);
if (eekflag != 0) return eekflag;
a_dblFine.define(vboxFine, procAssignFine);
a_dblCoar.define(vboxCoar, procAssignCoar);
return eekflag;
}
示例7: meshRefObj
int
EBAMRTestCommon::
makeHalfLayouts(DisjointBoxLayout& a_gridsFine,
EBISLayout& a_ebislFine,
DisjointBoxLayout& a_gridsCoar,
EBISLayout& a_ebislCoar,
const Box& a_domainFine,
const Box& a_domainCoar,
int a_refrat,
int a_halfDir
)
{
//set up mesh refine object
ParmParse pp;
int eekflag= 0;
int maxsize;
pp.get("maxboxsize",maxsize);
int bufferSize = 2;
int blockFactor = 8;
Real fillrat = 0.7;
Vector<int> refRat(2,2);
BRMeshRefine meshRefObj(a_domainCoar, refRat, fillrat,
blockFactor, bufferSize, maxsize);
Vector<Vector<Box> > oldMeshes(2);
oldMeshes[0] = Vector<Box>(1, a_domainCoar);
oldMeshes[1] = Vector<Box>(1, a_domainFine);
//set up coarse tags
int nc = a_domainCoar.size(a_halfDir);
Box halfBox = a_domainCoar;
halfBox.growHi(a_halfDir, -nc/2);
IntVectSet tags(halfBox);
int baseLevel = 0;
int topLevel = 0;
Vector<Vector<Box> > newMeshes;
meshRefObj.regrid(newMeshes, tags, baseLevel,
topLevel, oldMeshes);
const Vector<Box>& vboxFine = newMeshes[1];
Vector<int> procAssign;
eekflag = LoadBalance(procAssign,vboxFine);
if (eekflag != 0) return eekflag;
a_gridsFine.define(vboxFine, procAssign);
//make the coarse grids completely cover the domain
Vector<Box> vboxCoar;
domainSplit(a_domainCoar, vboxCoar, maxsize);
eekflag = LoadBalance(procAssign,vboxCoar);
a_gridsCoar.define(vboxCoar, procAssign);
///create ebislayout
int nghost = 4;
eekflag = makeEBISL(a_ebislFine, a_gridsFine, a_domainFine, nghost);
if (eekflag != 0) return eekflag;
eekflag = makeEBISL(a_ebislCoar, a_gridsCoar, a_domainCoar, nghost);
if (eekflag != 0) return eekflag;
return eekflag;
}