本文整理汇总了C++中mpi::communicator::split方法的典型用法代码示例。如果您正苦于以下问题:C++ communicator::split方法的具体用法?C++ communicator::split怎么用?C++ communicator::split使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类mpi::communicator
的用法示例。
在下文中一共展示了communicator::split方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: world
Simulation3D::Simulation3D(double L_x, double L_y, double L_z,
double T,
unsigned int n_cells, unsigned int n_steps,
unsigned int procs_x, unsigned int procs_y, unsigned int procs_z,
unsigned int block_size,
std::string& dump_dir,
Simulation3DInitializer* init, mpi::communicator & world) :
world(world),
xLine(world.split(world.rank() / procs_x)),
yLine(world.split(world.rank() % procs_x + (world.rank() / (procs_x*procs_y)) * procs_x)),
zLine(world.split(world.rank() % (procs_x*procs_y))),
nSteps(n_steps),
currentStep(0),
dx(L_x/n_cells),
dy(L_y/n_cells),
dz(L_z/n_cells),
dt(T/n_steps),
blockSize(block_size),
preFactorX(LIGHTSPEED*dt/(2*dx)),
preFactorY(LIGHTSPEED*dt/(2*dy)),
preFactorZ(LIGHTSPEED*dt/(2*dz)),
E(new double[3*blockSize*blockSize*blockSize]),
B(new double[3*blockSize*blockSize*blockSize]),
tmp_field(new double[3*blockSize*blockSize*blockSize]),
rhsx(new double[blockSize*blockSize*blockSize]),
rhsy(new double[blockSize*blockSize*blockSize]),
rhsz(new double[blockSize*blockSize*blockSize]),
rhs_ptrs_x(new double*[blockSize*blockSize]),
rhs_ptrs_y(new double*[blockSize*blockSize]),
rhs_ptrs_z(new double*[blockSize*blockSize]),
dumpDir(dump_dir)
{
procsX = xLine.size();
procsY = yLine.size();
procsZ = zLine.size();
VacuumMatrixInitializer mat_init_x = VacuumMatrixInitializer(dx, dt, blockSize, determineBoundary(xLine));
VacuumMatrixInitializer mat_init_y = VacuumMatrixInitializer(dy, dt, blockSize, determineBoundary(yLine));
VacuumMatrixInitializer mat_init_z = VacuumMatrixInitializer(dz, dt, blockSize, determineBoundary(zLine));
VacuumCouplingInitializer coupling_init_x = VacuumCouplingInitializer(& mat_init_x, blockSize, xLine);
VacuumCouplingInitializer coupling_init_y = VacuumCouplingInitializer(& mat_init_y, blockSize, yLine);
VacuumCouplingInitializer coupling_init_z = VacuumCouplingInitializer(& mat_init_z, blockSize, zLine);
std::vector<AbstractMatrixInitializer*> mat_inits_x(blockSize*blockSize, & mat_init_x);
std::vector<AbstractMatrixInitializer*> mat_inits_y(blockSize*blockSize, & mat_init_y);
std::vector<AbstractMatrixInitializer*> mat_inits_z(blockSize*blockSize, & mat_init_z);
std::vector<AbstractCouplingInitializer*> coupling_inits_x(blockSize*blockSize, & coupling_init_x);
std::vector<AbstractCouplingInitializer*> coupling_inits_y(blockSize*blockSize, & coupling_init_y);
std::vector<AbstractCouplingInitializer*> coupling_inits_z(blockSize*blockSize, & coupling_init_z);
guardB = allocateGuardStorage();
guardE = allocateGuardStorage();
init->setOffsets(xLine, yLine, zLine);
initFields(init);
xUpdateRHSs = init->initCollection(mat_inits_x, coupling_inits_x, blockSize, xLine);
yUpdateRHSs = init->initCollection(mat_inits_y, coupling_inits_y, blockSize, yLine);
zUpdateRHSs = init->initCollection(mat_inits_z, coupling_inits_z, blockSize, zLine);
guardSendbuf = new double[3*blockSize*blockSize];
}