本文整理汇总了C++中ParallelComm::addSubdomain方法的典型用法代码示例。如果您正苦于以下问题:C++ ParallelComm::addSubdomain方法的具体用法?C++ ParallelComm::addSubdomain怎么用?C++ ParallelComm::addSubdomain使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ParallelComm
的用法示例。
在下文中一共展示了ParallelComm::addSubdomain方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: SweepSubdomains
/**
Perform full parallel sweep algorithm on subset of subdomains.
*/
void SweepSubdomains (std::vector<int> subdomain_list, Grid_Data *grid_data, bool block_jacobi)
{
// Create a new sweep communicator object
ParallelComm *comm = NULL;
if(block_jacobi){
comm = new BlockJacobiComm(grid_data);
}
else {
comm = new SweepComm(grid_data);
}
// Add all subdomains in our list
for(int i = 0;i < subdomain_list.size();++ i){
int sdom_id = subdomain_list[i];
comm->addSubdomain(sdom_id, grid_data->subdomains[sdom_id]);
}
/* Loop until we have finished all of our work */
while(comm->workRemaining()){
// Get a list of subdomains that have met dependencies
std::vector<int> sdom_ready = comm->readySubdomains();
int backlog = sdom_ready.size();
// Run top of list
if(backlog > 0){
int sdom_id = sdom_ready[0];
Subdomain &sdom = grid_data->subdomains[sdom_id];
// Clear boundary conditions
for(int dim = 0;dim < 3;++ dim){
if(sdom.upwind[dim].subdomain_id == -1){
sdom.plane_data[dim]->clear(0.0);
}
}
{
BLOCK_TIMER(grid_data->timing, Sweep_Kernel);
// Perform subdomain sweep
grid_data->kernel->sweep(&sdom);
}
// Mark as complete (and do any communication)
comm->markComplete(sdom_id);
}
}
delete comm;
}