From 8a5ac934c89031ee20319f77dd9c89dec03df5d8 Mon Sep 17 00:00:00 2001 From: CeetronResInsight Date: Tue, 15 Jan 2013 15:40:09 +0100 Subject: [PATCH] TP #3805: Fixed bug related to computation of SOIL based on SGAS/SWAT p4#: 20152 --- .../RigReservoirCellResults.cpp | 30 +++++++++---------- 1 file changed, 15 insertions(+), 15 deletions(-) diff --git a/ApplicationCode/ReservoirDataModel/RigReservoirCellResults.cpp b/ApplicationCode/ReservoirDataModel/RigReservoirCellResults.cpp index f8104b2f95..c06ebae5c8 100644 --- a/ApplicationCode/ReservoirDataModel/RigReservoirCellResults.cpp +++ b/ApplicationCode/ReservoirDataModel/RigReservoirCellResults.cpp @@ -380,20 +380,8 @@ void RigReservoirCellResults::loadOrComputeSOIL() if (soilResultGridIndex == cvf::UNDEFINED_SIZE_T) { - const std::vector< std::vector >* swat = NULL; - const std::vector< std::vector >* sgas = NULL; - size_t scalarIndexSWAT = findOrLoadScalarResult(RimDefines::DYNAMIC_NATIVE, "SWAT"); - if (scalarIndexSWAT != cvf::UNDEFINED_SIZE_T) - { - swat = &(cellScalarResults(scalarIndexSWAT)); - } - size_t scalarIndexSGAS = findOrLoadScalarResult(RimDefines::DYNAMIC_NATIVE, "SGAS"); - if (scalarIndexSGAS != cvf::UNDEFINED_SIZE_T) - { - sgas = &(cellScalarResults(scalarIndexSGAS)); - } // Early exit if none of SWAT or SGAS is present if (scalarIndexSWAT == cvf::UNDEFINED_SIZE_T && scalarIndexSGAS == cvf::UNDEFINED_SIZE_T) @@ -401,6 +389,20 @@ void RigReservoirCellResults::loadOrComputeSOIL() return; } + soilResultGridIndex = addEmptyScalarResult(RimDefines::DYNAMIC_NATIVE, "SOIL"); + + const std::vector< std::vector >* swat = NULL; + const std::vector< std::vector >* sgas = NULL; + if (scalarIndexSWAT != cvf::UNDEFINED_SIZE_T) + { + swat = &(cellScalarResults(scalarIndexSWAT)); + } + + if (scalarIndexSGAS != cvf::UNDEFINED_SIZE_T) + { + sgas = &(cellScalarResults(scalarIndexSGAS)); + } + size_t soilResultValueCount = 0; size_t soilTimeStepCount = 0; if (swat) @@ -417,7 +419,6 @@ void RigReservoirCellResults::loadOrComputeSOIL() soilTimeStepCount = qMax(soilTimeStepCount, sgasTimeStepCount); } - soilResultGridIndex = addEmptyScalarResult(RimDefines::DYNAMIC_NATIVE, "SOIL"); m_cellScalarResults[soilResultGridIndex].resize(soilTimeStepCount); std::vector< std::vector >& soil = cellScalarResults(soilResultGridIndex); @@ -427,9 +428,8 @@ void RigReservoirCellResults::loadOrComputeSOIL() { soil[timeStepIdx].resize(soilResultValueCount); - int idx = 0; #pragma omp parallel for - for (idx = 0; idx < static_cast(soilResultValueCount); idx++) + for (int idx = 0; idx < static_cast(soilResultValueCount); idx++) { double soilValue = 1.0; if (sgas)