MCPcopy Create free account
hub / github.com/SeisSol/SeisSol / CubeGenerator

Method CubeGenerator

src/Geometry/CubeGenerator.cpp:78–181  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

76} // anonymous namespace
77
78seissol::geometry::CubeGenerator::CubeGenerator(
79 int rank,
80 int nProcs,
81 const std::string& meshFile,
82 const seissol::initializer::parameters::CubeGeneratorParameters& cubeParams)
83 : seissol::geometry::MeshReader(rank), // init base class
84 rank(rank), nProcs(nProcs) {
85 // get cubeGenerator parameters
86 const unsigned int cubeMinX = cubeParams.cubeMinX;
87 const unsigned int cubeMaxX = cubeParams.cubeMaxX;
88 const unsigned int cubeMinY = cubeParams.cubeMinY;
89 const unsigned int cubeMaxY = cubeParams.cubeMaxY;
90 const unsigned int cubeMinZ = cubeParams.cubeMinZ;
91 const unsigned int cubeMaxZ = cubeParams.cubeMaxZ;
92 const unsigned int cubeX = cubeParams.cubeX;
93 const unsigned int cubeY = cubeParams.cubeY;
94 const unsigned int cubeZ = cubeParams.cubeZ;
95 const unsigned int cubePx = cubeParams.cubePx;
96 const unsigned int cubePy = cubeParams.cubePy;
97 const unsigned int cubePz = cubeParams.cubePz;
98 const double cubeScale = cubeParams.cubeS;
99 const double cubeScaleX = cubeParams.cubeSx;
100 const double cubeScaleY = cubeParams.cubeSy;
101 const double cubeScaleZ = cubeParams.cubeSz;
102 const double cubeTx = cubeParams.cubeTx;
103 const double cubeTy = cubeParams.cubeTy;
104 const double cubeTz = cubeParams.cubeTz;
105
106 if (cubePx > 1 && (cubeMinX == 6 || cubeMaxX == 6 || cubeMinY == 6 || cubeMaxY == 6 ||
107 cubeMinZ == 6 || cubeMaxZ == 6)) {
108 logWarning(rank)
109 << "Atleast one boundary condition is set to 6 (periodic boundary), currently leading "
110 "to incorrect results when using more than 1 MPI process";
111 }
112
113 // create additional variables necessary for cubeGenerator()
114 const std::array<unsigned int, 4> numCubes = {cubeX, cubeY, cubeZ, cubeX * cubeY * cubeZ};
115 const std::array<unsigned int, 4> numPartitions = {
116 cubePx, cubePy, cubePz, cubePx * cubePy * cubePz};
117
118 // check input arguments
119 for (int i = 0; i < 3; i++) {
120 if (numCubes[i] < 2) {
121 logError() << "Number of cubes in" << dim2str(i) << "dimension must be at least 2";
122 }
123 if (numCubes[i] % numPartitions[i] != 0) {
124 logError() << "Number of cubes in" << dim2str(i) << "dimension can not be distribute to"
125 << numPartitions[i] << "partitions";
126 }
127 if ((numCubes[i] / numPartitions[i]) % 2 != 0) {
128 logError() << "Number of cubes per partition in" << dim2str(i)
129 << "dimension must be a multiple of 2";
130 }
131 // check if numCubes is multiple of numPartitions, should only fail in numPartitions[0]
132 if (numCubes[i] % numPartitions[i] != 0) {
133 logError() << "Number of cubes in" << dim2str(i)
134 << "dimenstion must be a multiple of number of threads/processes ="
135 << numPartitions[i];

Callers

nothing calls this directly

Calls 1

dim2strFunction · 0.70

Tested by

no test coverage detected