Commit 5fcd3ff2 authored by Martin Schneider's avatar Martin Schneider Committed by Timo Koch
Browse files

[fix][cakegrid] Case of having multiple intervals

For the case that multiple values, i.e. r0 < r1 < r2
are specified, the calculation of number of positions was wrong
parent 7593ed2d
......@@ -160,9 +160,10 @@ public:
using std::pow;
for (int dimIdx = 0; dimIdx < dim; dimIdx++)
{
std::size_t numGlobalPositions = 0;
// Each grid direction is subdivided into (numCells + 1) points
std::size_t numGlobalPositions = 1;
for (int zoneIdx = 0; zoneIdx < cells[dimIdx].size(); ++zoneIdx)
numGlobalPositions += cells[dimIdx][zoneIdx] + 1;
numGlobalPositions += cells[dimIdx][zoneIdx];
globalPositions[dimIdx].resize(numGlobalPositions);
std::size_t posIdx = 0;
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment