From d3eec3445feca8faf630fb75a09f534b80b7224f Mon Sep 17 00:00:00 2001 From: Magne Sjaastad Date: Thu, 23 Mar 2017 13:58:32 +0100 Subject: [PATCH] #1357 Added access function to return time step vector with most time steps --- .../ProjectDataModel/RimGridTimeHistoryCurve.cpp | 4 ++-- .../ReservoirDataModel/RigCaseCellResultsData.cpp | 15 +++++++++++++-- .../ReservoirDataModel/RigCaseCellResultsData.h | 1 + 3 files changed, 16 insertions(+), 4 deletions(-) diff --git a/ApplicationCode/ProjectDataModel/RimGridTimeHistoryCurve.cpp b/ApplicationCode/ProjectDataModel/RimGridTimeHistoryCurve.cpp index 101e623b88..464357dd3d 100644 --- a/ApplicationCode/ProjectDataModel/RimGridTimeHistoryCurve.cpp +++ b/ApplicationCode/ProjectDataModel/RimGridTimeHistoryCurve.cpp @@ -176,7 +176,7 @@ std::vector RimGridTimeHistoryCurve::yValues() const RimReservoirCellResultsStorage* cellResStorage = m_eclipseResultDefinition->currentGridCellResults(); RigCaseCellResultsData* cellResultsData = cellResStorage->cellResults(); - std::vector timeStepDates = cellResultsData->timeStepDates(m_eclipseResultDefinition->scalarResultIndex()); + std::vector timeStepDates = cellResultsData->timeStepDates(); values = RigTimeHistoryResultAccessor::timeHistoryValues(eclTopItem->eclipseCase()->eclipseCaseData(), m_eclipseResultDefinition(), gridIndex, cellIndex, timeStepDates.size()); } @@ -371,7 +371,7 @@ std::vector RimGridTimeHistoryCurve::timeStepValues() const RimReservoirCellResultsStorage* cellResStorage = m_eclipseResultDefinition->currentGridCellResults(); RigCaseCellResultsData* cellResultsData = cellResStorage->cellResults(); - std::vector timeStepDates = cellResultsData->timeStepDates(m_eclipseResultDefinition->scalarResultIndex()); + std::vector timeStepDates = cellResultsData->timeStepDates(); for (QDateTime dt : timeStepDates) { diff --git a/ApplicationCode/ReservoirDataModel/RigCaseCellResultsData.cpp b/ApplicationCode/ReservoirDataModel/RigCaseCellResultsData.cpp index 6caea4c8e6..eddd5f422d 100644 --- a/ApplicationCode/ReservoirDataModel/RigCaseCellResultsData.cpp +++ b/ApplicationCode/ReservoirDataModel/RigCaseCellResultsData.cpp @@ -403,12 +403,23 @@ QDateTime RigCaseCellResultsData::timeStepDate(size_t scalarResultIndex, size_t //-------------------------------------------------------------------------------------------------- std::vector RigCaseCellResultsData::timeStepDates(size_t scalarResultIndex) const { - if (scalarResultIndex < m_resultInfos.size() ) - return m_resultInfos[scalarResultIndex].m_timeStepDates; + if (scalarResultIndex < m_resultInfos.size()) + return m_resultInfos[scalarResultIndex].m_timeStepDates; else return std::vector(); } +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +std::vector RigCaseCellResultsData::timeStepDates() const +{ + size_t scalarResWithMostTimeSteps = cvf::UNDEFINED_SIZE_T; + maxTimeStepCount(&scalarResWithMostTimeSteps); + + return timeStepDates(scalarResWithMostTimeSteps); +} + //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- diff --git a/ApplicationCode/ReservoirDataModel/RigCaseCellResultsData.h b/ApplicationCode/ReservoirDataModel/RigCaseCellResultsData.h index 7dddb6eb0e..89839fc59d 100644 --- a/ApplicationCode/ReservoirDataModel/RigCaseCellResultsData.h +++ b/ApplicationCode/ReservoirDataModel/RigCaseCellResultsData.h @@ -73,6 +73,7 @@ public: bool isUsingGlobalActiveIndex(size_t scalarResultIndex) const; bool hasFlowDiagUsableFluxes() const; + std::vector timeStepDates() const; QDateTime timeStepDate(size_t scalarResultIndex, size_t timeStepIndex) const; std::vector timeStepDates(size_t scalarResultIndex) const; int reportStepNumber(size_t scalarResultIndex, size_t timeStepIndex) const;