Skip to content

Commit 2bc8818

Browse files
committed
Merge pull request #187 from psychocoderHPC/topic-cleanMySimulation
clean hard coded 3D asserts
2 parents 7d0e1cb + 1b3a42c commit 2bc8818

1 file changed

Lines changed: 7 additions & 11 deletions

File tree

src/picongpu/include/simulationControl/MySimulation.hpp

Lines changed: 7 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -453,24 +453,20 @@ class MySimulation : public SimulationHelper<simDim>
453453
template<uint32_t DIM>
454454
void checkGridConfiguration(DataSpace<DIM> globalGridSize, GridLayout<DIM>)
455455
{
456+
457+
for(uint32_t i=0;i<simDim;++i)
458+
{
456459
// global size must a devisor of supercell size
457460
// note: this is redundant, while using the local condition below
458461

459-
assert(globalGridSize.x() % MappingDesc::SuperCellSize::x == 0);
460-
assert(globalGridSize.y() % MappingDesc::SuperCellSize::y == 0);
461-
assert(globalGridSize.z() % MappingDesc::SuperCellSize::z == 0);
462-
462+
assert(globalGridSize[i] % MappingDesc::SuperCellSize::getDataSpace()[i] == 0);
463463
// local size must a devisor of supercell size
464-
assert(gridSizeLocal[0] % MappingDesc::SuperCellSize::x == 0);
465-
assert(gridSizeLocal[1] % MappingDesc::SuperCellSize::y == 0);
466-
assert(gridSizeLocal[2] % MappingDesc::SuperCellSize::z == 0);
467-
464+
assert(gridSizeLocal[i] % MappingDesc::SuperCellSize::getDataSpace()[i] == 0);
468465
// local size must be at least 3 supercells (1x core + 2x border)
469466
// note: size of border = guard_size (in supercells)
470467
// \todo we have to add the guard_x/y/z for modified supercells here
471-
assert((uint32_t) gridSizeLocal[0] / MappingDesc::SuperCellSize::x >= 3 * GUARD_SIZE);
472-
assert((uint32_t) gridSizeLocal[1] / MappingDesc::SuperCellSize::y >= 3 * GUARD_SIZE);
473-
assert((uint32_t) gridSizeLocal[2] / MappingDesc::SuperCellSize::z >= 3 * GUARD_SIZE);
468+
assert( (uint32_t) gridSizeLocal[i] / MappingDesc::SuperCellSize::getDataSpace()[i] >= 3 * GUARD_SIZE);
469+
}
474470
}
475471

476472

0 commit comments

Comments
 (0)