static void addOneParticle(ParticlesClass& parClass, MappingDesc cellDescription, DataSpace<simDim> globalCell) { const SubGrid<simDim>& subGrid = Environment<simDim>::get().SubGrid(); const DataSpace<simDim> globalTopLeft = subGrid.getLocalDomain().offset; const DataSpace<simDim> localSimulationArea = subGrid.getLocalDomain().size; DataSpace<simDim> localParCell = globalCell - globalTopLeft; for (int i = 0; i < (int) simDim; ++i) { //chek if particle is in the simulation area if (localParCell[i] < 0 || localParCell[i] >= localSimulationArea[i]) return; } //calculate supercell DataSpace<simDim> localSuperCell = (localParCell / MappingDesc::SuperCellSize::toRT()); DataSpace<simDim> cellInSuperCell = localParCell - (localSuperCell * MappingDesc::SuperCellSize::toRT()); //add garding blocks to supercell localSuperCell = localSuperCell + cellDescription.getGuardingSuperCells(); __cudaKernel(kernelAddOneParticle) (1, 1) (parClass.getDeviceParticlesBox(), localSuperCell, cellInSuperCell); parClass.fillAllGaps(); std::cout << "Wait for add particle" << std::endl; __getTransactionEvent().waitForFinished(); }
static void addOneParticle(ParticlesClass& parClass, MappingDesc cellDescription, DataSpace<DIM3> globalCell) { PMACC_AUTO(simBox, SubGrid<simDim>::getInstance().getSimulationBox()); const DataSpace<DIM3> globalTopLeft = simBox.getGlobalOffset(); const DataSpace<DIM3> localSimulationArea = simBox.getLocalSize(); DataSpace<DIM3> localParCell = globalCell - globalTopLeft; for (int i = 0; i < (int) DIM3; ++i) { //chek if particle is in the simulation area if (localParCell[i] < 0 || localParCell[i] >= localSimulationArea[i]) return; } //calculate supercell DataSpace<DIM3> localSuperCell = (localParCell / MappingDesc::SuperCellSize::getDataSpace()); DataSpace<DIM3> cellInSuperCell = localParCell - (localSuperCell * MappingDesc::SuperCellSize::getDataSpace()); //add garding blocks to supercell localSuperCell = localSuperCell + cellDescription.getGuardingSuperCells(); __cudaKernel(kernelAddOneParticle) (1, 1) (parClass.getDeviceParticlesBox(), localSuperCell, cellInSuperCell); parClass.fillAllGaps(); std::cout << "Wait for add particle" << std::endl; __getTransactionEvent().waitForFinished(); }