Bugfix : Allocate max timestep count when receiving data from Octave

This commit is contained in:
Magne Sjaastad 2014-08-28 09:54:34 +02:00
parent ffbfb8bdf0
commit 103a9f4018

View File

@ -416,6 +416,9 @@ public:
if (scalarResultIndex != cvf::UNDEFINED_SIZE_T)
{
scalarResultFrames = &(rimCase->results(m_porosityModelEnum)->cellResults()->cellScalarResults(scalarResultIndex));
size_t timeStepCount = rimCase->results(m_porosityModelEnum)->cellResults()->maxTimeStepCount();
scalarResultFrames->resize(timeStepCount);
m_currentScalarIndex = scalarResultIndex;
m_currentPropertyName = propertyName;
}
@ -484,17 +487,6 @@ public:
return true;
}
// Resize the result container to be able to receive timesteps at the specified timestep idices
std::vector<size_t>::iterator maxTimeStepIt = std::max_element(m_requestedTimesteps.begin(), m_requestedTimesteps.end());
CVF_ASSERT(maxTimeStepIt != m_requestedTimesteps.end());
size_t maxTimeStepIdx = (*maxTimeStepIt);
if (scalarResultFrames->size() <= maxTimeStepIdx)
{
scalarResultFrames->resize(maxTimeStepIdx+1);
}
m_currentReservoir = rimCase;
m_scalarResultsToAdd = scalarResultFrames;
@ -778,6 +770,9 @@ public:
if (scalarResultIndex != cvf::UNDEFINED_SIZE_T)
{
scalarResultFrames = &(rimCase->results(m_porosityModelEnum)->cellResults()->cellScalarResults(scalarResultIndex));
size_t timeStepCount = rimCase->results(m_porosityModelEnum)->cellResults()->maxTimeStepCount();
scalarResultFrames->resize(timeStepCount);
m_currentScalarIndex = scalarResultIndex;
m_currentPropertyName = propertyName;
}
@ -834,17 +829,6 @@ public:
return true;
}
// Resize the result container to be able to receive time steps at the specified time step indices
std::vector<size_t>::iterator maxTimeStepIt = std::max_element(m_requestedTimesteps.begin(), m_requestedTimesteps.end());
CVF_ASSERT(maxTimeStepIt != m_requestedTimesteps.end());
size_t maxTimeStepIdx = (*maxTimeStepIt);
if (scalarResultFrames->size() <= maxTimeStepIdx)
{
scalarResultFrames->resize(maxTimeStepIdx+1);
}
m_currentReservoir = rimCase;
m_scalarResultsToAdd = scalarResultFrames;