From 8dc2eed3c030df7992bece1e4de9f456e21ce742 Mon Sep 17 00:00:00 2001 From: Magne Sjaastad Date: Mon, 25 Aug 2014 13:20:58 +0200 Subject: [PATCH] Moved loading of dependent datasets --- .../RimReservoirCellResultsStorage.cpp | 31 +++++++++++++++++-- .../ProjectDataModel/RimResultDefinition.cpp | 27 +--------------- 2 files changed, 30 insertions(+), 28 deletions(-) diff --git a/ApplicationCode/ProjectDataModel/RimReservoirCellResultsStorage.cpp b/ApplicationCode/ProjectDataModel/RimReservoirCellResultsStorage.cpp index 3f22bee88d..27454e2b69 100644 --- a/ApplicationCode/ProjectDataModel/RimReservoirCellResultsStorage.cpp +++ b/ApplicationCode/ProjectDataModel/RimReservoirCellResultsStorage.cpp @@ -230,7 +230,6 @@ size_t RimReservoirCellResultsStorage::findOrLoadScalarResultForTimeStep(RimDefi if (type == RimDefines::DYNAMIC_NATIVE && resultName.toUpper() == "SOIL") { size_t soilScalarResultIndex = m_cellResults->findScalarResultIndex(type, resultName); - if (!isDataPresent(soilScalarResultIndex)) { computeSOILForTimeStep(timeStepIndex); } @@ -297,7 +296,28 @@ size_t RimReservoirCellResultsStorage::findOrLoadScalarResult(RimDefines::Result size_t scalarResultIndex = m_cellResults->findScalarResultIndex(type, resultName); if (scalarResultIndex == cvf::UNDEFINED_SIZE_T) return cvf::UNDEFINED_SIZE_T; - + // Load dependency data sets + + if (type == RimDefines::STATIC_NATIVE) + { + if (resultName == RimDefines::combinedTransmissibilityResultName()) + { + this->findOrLoadScalarResult(type, "TRANX"); + this->findOrLoadScalarResult(type, "TRANY"); + this->findOrLoadScalarResult(type, "TRANZ"); + } + else if (resultName == RimDefines::combinedMultResultName()) + { + this->findOrLoadScalarResult(type, "MULTX"); + this->findOrLoadScalarResult(type, "MULTX-"); + this->findOrLoadScalarResult(type, "MULTY"); + this->findOrLoadScalarResult(type, "MULTY-"); + this->findOrLoadScalarResult(type, "MULTZ"); + this->findOrLoadScalarResult(type, "MULTZ-"); + } + } + + if (isDataPresent(scalarResultIndex)) { return scalarResultIndex; @@ -424,6 +444,13 @@ void RimReservoirCellResultsStorage::computeSOILForTimeStep(size_t timeStepIndex size_t soilResultScalarIndex = m_cellResults->findScalarResultIndex(RimDefines::DYNAMIC_NATIVE, "SOIL"); m_cellResults->cellScalarResults(soilResultScalarIndex).resize(soilTimeStepCount); + + if (m_cellResults->cellScalarResults(soilResultScalarIndex, timeStepIndex).size() > 0) + { + // Data is computed and allocated, nothing more to do + return; + } + m_cellResults->cellScalarResults(soilResultScalarIndex, timeStepIndex).resize(soilResultValueCount); diff --git a/ApplicationCode/ProjectDataModel/RimResultDefinition.cpp b/ApplicationCode/ProjectDataModel/RimResultDefinition.cpp index fa4fbd1d3c..5c8507d041 100644 --- a/ApplicationCode/ProjectDataModel/RimResultDefinition.cpp +++ b/ApplicationCode/ProjectDataModel/RimResultDefinition.cpp @@ -196,32 +196,7 @@ void RimResultDefinition::loadResult() RimReservoirCellResultsStorage* gridCellResults = this->currentGridCellResults(); if (gridCellResults) { - if (m_resultType() == RimDefines::STATIC_NATIVE) - { - if (m_resultVariable().compare(RimDefines::combinedTransmissibilityResultName(), Qt::CaseInsensitive) == 0) - { - gridCellResults->findOrLoadScalarResult(m_resultType(), "TRANX"); - gridCellResults->findOrLoadScalarResult(m_resultType(), "TRANY"); - gridCellResults->findOrLoadScalarResult(m_resultType(), "TRANZ"); - } - else if (m_resultVariable().compare(RimDefines::combinedMultResultName(), Qt::CaseInsensitive) == 0) - { - gridCellResults->findOrLoadScalarResult(m_resultType(), "MULTX"); - gridCellResults->findOrLoadScalarResult(m_resultType(), "MULTX-"); - gridCellResults->findOrLoadScalarResult(m_resultType(), "MULTY"); - gridCellResults->findOrLoadScalarResult(m_resultType(), "MULTY-"); - gridCellResults->findOrLoadScalarResult(m_resultType(), "MULTZ"); - gridCellResults->findOrLoadScalarResult(m_resultType(), "MULTZ-"); - } - else - { - gridCellResults->findOrLoadScalarResult(m_resultType(), m_resultVariable); - } - } - else - { - gridCellResults->findOrLoadScalarResult(m_resultType(), m_resultVariable); - } + gridCellResults->findOrLoadScalarResult(m_resultType(), m_resultVariable); } updateFieldVisibility();