From 4d1d2215c29c257708a9f4d65f5f924e380121d6 Mon Sep 17 00:00:00 2001 From: Magne Sjaastad Date: Mon, 25 Aug 2014 10:31:36 +0200 Subject: [PATCH] Fixed memory allocation issues when computing SOIL --- .../RimReservoirCellResultsStorage.cpp | 17 +++++------------ 1 file changed, 5 insertions(+), 12 deletions(-) diff --git a/ApplicationCode/ProjectDataModel/RimReservoirCellResultsStorage.cpp b/ApplicationCode/ProjectDataModel/RimReservoirCellResultsStorage.cpp index 62e8a444ed..3f22bee88d 100644 --- a/ApplicationCode/ProjectDataModel/RimReservoirCellResultsStorage.cpp +++ b/ApplicationCode/ProjectDataModel/RimReservoirCellResultsStorage.cpp @@ -419,19 +419,12 @@ void RimReservoirCellResultsStorage::computeSOILForTimeStep(size_t timeStepIndex } } - size_t soilResultScalarIndex = m_cellResults->findScalarResultIndex(RimDefines::DYNAMIC_NATIVE, "SOIL"); - if (m_cellResults->cellScalarResults(soilResultScalarIndex, timeStepIndex).size() == 0) - { -// // Set this result to be calculated -// m_cellResults->setMustBeCalculated(soilResultScalarIndex); -// -// m_cellResults->cellScalarResults(soilResultScalarIndex).resize(soilTimeStepCount); -// for (size_t timeStepIdx = 0; timeStepIdx < soilTimeStepCount; timeStepIdx++) -// { - m_cellResults->cellScalarResults(soilResultScalarIndex, timeStepIndex).resize(soilResultValueCount); -// } - } + // Make sure memory is allocated for the new SOIL results + + size_t soilResultScalarIndex = m_cellResults->findScalarResultIndex(RimDefines::DYNAMIC_NATIVE, "SOIL"); + m_cellResults->cellScalarResults(soilResultScalarIndex).resize(soilTimeStepCount); + m_cellResults->cellScalarResults(soilResultScalarIndex, timeStepIndex).resize(soilResultValueCount); std::vector* swatForTimeStep = NULL;