MCPcopy Create free account
hub / github.com/RenderKit/ospray / computeGrid

Function computeGrid

modules/mpi/tutorials/ospMPIDistribTutorialSpheres.cpp:161–175  ·  view source on GitHub ↗

Compute an X x Y x Z grid to have 'num' grid cells, only gives a nice grid for numbers with even factors since we don't search for factors of the number, we just try dividing by two

Source from the content-addressed store, hash-verified

159// only gives a nice grid for numbers with even factors since
160// we don't search for factors of the number, we just try dividing by two
161vec3i computeGrid(int num)
162{
163 vec3i grid(1);
164 int axis = 0;
165 int divisor = 0;
166 while (computeDivisor(num, divisor)) {
167 grid[axis] *= divisor;
168 num /= divisor;
169 axis = (axis + 1) % 3;
170 }
171 if (num != 1) {
172 grid[axis] *= num;
173 }
174 return grid;
175}
176
177cpp::Instance makeLocalSpheres(
178 const int mpiRank, const int mpiWorldSize, box3f &bounds)

Callers 1

makeLocalSpheresFunction · 0.70

Calls 1

computeDivisorFunction · 0.70

Tested by

no test coverage detected