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

Function computeGrid

modules/mpi/tutorials/ospMPIDistributedExamples.cpp:167–181  ·  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

165// only gives a nice grid for numbers with even factors since
166// we don't search for factors of the number, we just try dividing by two
167vec3i computeGrid(int num)
168{
169 vec3i grid(1);
170 int axis = 0;
171 int divisor = 0;
172 while (computeDivisor(num, divisor)) {
173 grid[axis] *= divisor;
174 num /= divisor;
175 axis = (axis + 1) % 3;
176 }
177 if (num != 1) {
178 grid[axis] *= num;
179 }
180 return grid;
181}

Callers 1

mainFunction · 0.70

Calls 1

computeDivisorFunction · 0.70

Tested by

no test coverage detected