From 55512db6a0837fd36d43b76531d40c6d881e6415 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jacob=20St=C3=B8ren?= Date: Fri, 8 May 2015 10:34:57 +0200 Subject: [PATCH] Introduced RigFemResultAddress Breaks build, possibly. Intermediate chek-in --- .../GeoMechDataModel/RigFemPartResults.cpp | 13 ++--- .../GeoMechDataModel/RigFemPartResults.h | 11 ++-- .../GeoMechDataModel/RigFemResultAddress.h | 58 +++++++++++++++++++ .../RivFemPartPartMgr.cpp | 7 ++- .../ProjectDataModel/RimGeoMechResultSlot.cpp | 5 +- .../ProjectDataModel/RimGeoMechResultSlot.h | 5 +- 6 files changed, 81 insertions(+), 18 deletions(-) create mode 100644 ApplicationCode/GeoMech/GeoMechDataModel/RigFemResultAddress.h diff --git a/ApplicationCode/GeoMech/GeoMechDataModel/RigFemPartResults.cpp b/ApplicationCode/GeoMech/GeoMechDataModel/RigFemPartResults.cpp index 848677f7a4..2b1844c6f9 100644 --- a/ApplicationCode/GeoMech/GeoMechDataModel/RigFemPartResults.cpp +++ b/ApplicationCode/GeoMech/GeoMechDataModel/RigFemPartResults.cpp @@ -18,6 +18,7 @@ ///////////////////////////////////////////////////////////////////////////////// #include "RigFemPartResults.h" +#include "RigFemResultAddress.h" //-------------------------------------------------------------------------------------------------- /// @@ -52,13 +53,11 @@ void RigFemPartResults::initResultStages(const std::vector& stageNa /// //-------------------------------------------------------------------------------------------------- RigFemScalarResultFrames* RigFemPartResults::createScalarResult(size_t stageIndex, - RigFemResultPosEnum resultPosType, - const std::string& fieldName, - const std::string& componentName, + const RigFemResultAddress& resVarAddr, const std::vector& frameTimes) { RigFemScalarResultFrames * resFrames = new RigFemScalarResultFrames(frameTimes); - m_femAnalysisStages[stageIndex].resultSets[resultPosType][fieldName][componentName] = resFrames; + m_femAnalysisStages[stageIndex].resultSets[resVarAddr] = resFrames; return resFrames; } @@ -66,9 +65,7 @@ RigFemScalarResultFrames* RigFemPartResults::createScalarResult(size_t stageInde /// //-------------------------------------------------------------------------------------------------- RigFemScalarResultFrames* RigFemPartResults::findScalarResult(size_t stageIndex, - RigFemResultPosEnum resultPosType, - const std::string& fieldName, - const std::string& componentName) + const RigFemResultAddress& resVarAddr) { - return m_femAnalysisStages[stageIndex].resultSets[resultPosType][fieldName][componentName].p(); + return m_femAnalysisStages[stageIndex].resultSets[resVarAddr].p(); } diff --git a/ApplicationCode/GeoMech/GeoMechDataModel/RigFemPartResults.h b/ApplicationCode/GeoMech/GeoMechDataModel/RigFemPartResults.h index ae052f41f5..ce2de4c366 100644 --- a/ApplicationCode/GeoMech/GeoMechDataModel/RigFemPartResults.h +++ b/ApplicationCode/GeoMech/GeoMechDataModel/RigFemPartResults.h @@ -25,6 +25,7 @@ #include #include "RigFemScalarResultFrames.h" +#include "RigFemResultAddress.h" //================================================================================================== /// @@ -39,22 +40,18 @@ public: void initResultStages( const std::vector& stageNames); RigFemScalarResultFrames* createScalarResult( size_t stageIndex, - RigFemResultPosEnum resultPosType, - const std::string& fieldName, - const std::string& componentName, + const RigFemResultAddress& resVarAddr, const std::vector& frameTimes); RigFemScalarResultFrames* findScalarResult( size_t stageIndex, - RigFemResultPosEnum resultPosType, - const std::string& fieldName, - const std::string& componentName); + const RigFemResultAddress& resVarAddr); private: struct RigAnalysisStage { std::string stageName; - std::map > > > resultSets; + std::map > resultSets; }; std::vector m_femAnalysisStages; diff --git a/ApplicationCode/GeoMech/GeoMechDataModel/RigFemResultAddress.h b/ApplicationCode/GeoMech/GeoMechDataModel/RigFemResultAddress.h new file mode 100644 index 0000000000..370828c66c --- /dev/null +++ b/ApplicationCode/GeoMech/GeoMechDataModel/RigFemResultAddress.h @@ -0,0 +1,58 @@ +///////////////////////////////////////////////////////////////////////////////// +// +// Copyright (C) 2015- Statoil ASA +// Copyright (C) 2015- Ceetron Solutions AS +// +// ResInsight is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// ResInsight is distributed in the hope that it will be useful, but WITHOUT ANY +// WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. +// +// See the GNU General Public License at +// for more details. +// +///////////////////////////////////////////////////////////////////////////////// + +#pragma once + +#include "RigFemResultPosEnum.h" +#include + +//================================================================================================== +/// +//================================================================================================== + +class RigFemResultAddress +{ +public: +RigFemResultAddress(RigFemResultPosEnum resPosType, + const std::string& aFieldName, + const std::string& aComponentName) + : resultPosType(resPosType), fieldName(aFieldName), componentName(aComponentName) + {} + + RigFemResultPosEnum resultPosType; + std::string fieldName; + std::string componentName; + + bool operator< (const RigFemResultAddress& other ) const + { + if (resultPosType != other.resultPosType) + { + return (resultPosType < other.resultPosType); + } + + if (fieldName != other.fieldName) + { + return (fieldName < other.fieldName); + } + + return (componentName < other.componentName); + } +}; + + diff --git a/ApplicationCode/GeoMech/GeoMechVisualization/RivFemPartPartMgr.cpp b/ApplicationCode/GeoMech/GeoMechVisualization/RivFemPartPartMgr.cpp index 97dc74b5bc..c4a57a35db 100644 --- a/ApplicationCode/GeoMech/GeoMechVisualization/RivFemPartPartMgr.cpp +++ b/ApplicationCode/GeoMech/GeoMechVisualization/RivFemPartPartMgr.cpp @@ -225,8 +225,13 @@ void RivFemPartPartMgr::updateCellResultColor(size_t timeStepIndex, RimGeoMechRe RigGeoMechCaseData* caseData = cellResultSlot->ownerCaseData(); if (!caseData) return; + caf::AppEnum resPosType = cellResultSlot->resultPositionType(); + QString fieldName = cellResultSlot->resultFieldName(); + QString compName = cellResultSlot->resultComponentName(); - RigFemScalarResultFrames* scalarResults = caseData->findOrLoadScalarResult(m_gridIdx, 0, cellResultSlot->resultPositionType(), cellResultSlot->resultFieldName().toStdString(), cellResultSlot->resultComponentName().toStdString()); + RigFemResultAddress resVarAddress(resPosType, fieldName.toStdString(), compName.toStdString()); + + RigFemScalarResultFrames* scalarResults = caseData->findOrLoadScalarResult(m_gridIdx, 0, resVarAddress); std::vector& resultValues = scalarResults->frameData(timeStepIndex); const std::vector* vxToResultMapping = NULL; diff --git a/ApplicationCode/ProjectDataModel/RimGeoMechResultSlot.cpp b/ApplicationCode/ProjectDataModel/RimGeoMechResultSlot.cpp index 063a1ed37a..5885f9820c 100644 --- a/ApplicationCode/ProjectDataModel/RimGeoMechResultSlot.cpp +++ b/ApplicationCode/ProjectDataModel/RimGeoMechResultSlot.cpp @@ -169,7 +169,10 @@ void RimGeoMechResultSlot::fieldChangedByUi(const caf::PdmFieldHandle* changedFi // Todo: Read results into cache ? - if (m_reservoirView) m_reservoirView->createDisplayModelAndRedraw(); + if (m_reservoirView) + { + m_reservoirView->createDisplayModelAndRedraw(); + } } } diff --git a/ApplicationCode/ProjectDataModel/RimGeoMechResultSlot.h b/ApplicationCode/ProjectDataModel/RimGeoMechResultSlot.h index 98f22fcd27..a2128acb5f 100644 --- a/ApplicationCode/ProjectDataModel/RimGeoMechResultSlot.h +++ b/ApplicationCode/ProjectDataModel/RimGeoMechResultSlot.h @@ -24,6 +24,7 @@ #include "cafPdmPointer.h" #include "cafAppEnum.h" #include "RigFemResultPosEnum.h" +#include "RigFemResultAddress.h" class RimLegendConfig; class RimGeoMechView; @@ -43,7 +44,9 @@ public: void setReservoirView(RimGeoMechView* ownerReservoirView); RigGeoMechCaseData* ownerCaseData(); - + + RigFemResultAddress resultAddress() { return RigFemResultAddress(resultPositionType(), resultFieldName().toStdString(), resultComponentName().toStdString());} + RigFemResultPosEnum resultPositionType() { return m_resultPositionType();} QString resultFieldName() { return m_resultFieldName();} QString resultComponentName() { return m_resultComponentName();}