/// Execute a data processor over several MultiGrid3D void executeDataProcessor( DataProcessorGenerator3D const& generator, std::vector<MultiGrid3D*> multiGrids, plint referenceLevel ) { if(multiGrids.empty()) return; for (plint iLevel=0; iLevel<(plint)multiGrids[0]->getNumLevels(); ++iLevel) { std::auto_ptr<DataProcessorGenerator3D> localGenerator(generator.clone()); int dxScale = (int)referenceLevel - (int)iLevel; int dtScale = dxScale; // TODO: here, we assume convective scaling; general case should be considered. plint boxRescaleFactor = util::roundToInt(util::twoToThePowerPlint(std::abs(referenceLevel-iLevel))); if (dxScale < 0) // if we go to a coarser grid localGenerator->divide(boxRescaleFactor); else // otherwise we go to a finer grid localGenerator->multiply(boxRescaleFactor); localGenerator->setscale(dxScale,dtScale); std::vector<MultiBlock3D*> localBlocks(multiGrids.size()); for (plint iBlock=0; iBlock<(plint)localBlocks.size(); ++iBlock) { localBlocks[iBlock] = &multiGrids[iBlock]->getComponent(iLevel); } executeDataProcessor(*localGenerator, localBlocks); } }
MultiBlock3D::ProcessorStorage3D::ProcessorStorage3D ( DataProcessorGenerator3D const& generator_, std::vector<MultiBlock3D*> const& multiBlocks_, plint level_ ) : generator(generator_.clone()), multiBlockIds(multiBlocks_.size()), level(level_) { for(pluint iBlock=0; iBlock<multiBlockIds.size(); ++iBlock) { multiBlockIds[iBlock] = multiBlocks_[iBlock]->getId(); } }