diff --git a/ApplicationCode/GeoMech/GeoMechDataModel/CMakeLists.txt b/ApplicationCode/GeoMech/GeoMechDataModel/CMakeLists.txt index ea414d52f1..533db76db7 100644 --- a/ApplicationCode/GeoMech/GeoMechDataModel/CMakeLists.txt +++ b/ApplicationCode/GeoMech/GeoMechDataModel/CMakeLists.txt @@ -16,7 +16,12 @@ add_library( ${PROJECT_NAME} RigGeoMechCaseData.h RigFemPartCollection.cpp RigFemPartCollection.h - + RigFemPartResults.h + RigFemPartResults.cpp + RigFemScalarResultFrames.h + RigFemScalarResultFrames.cpp + RigFemNativeStatCalc.h + RigFemNativeStatCalc.cpp ) target_link_libraries( ${PROJECT_NAME} LibCore ) \ No newline at end of file diff --git a/ApplicationCode/GeoMech/GeoMechDataModel/RigFemNativeStatCalc.cpp b/ApplicationCode/GeoMech/GeoMechDataModel/RigFemNativeStatCalc.cpp new file mode 100644 index 0000000000..5e8c8be505 --- /dev/null +++ b/ApplicationCode/GeoMech/GeoMechDataModel/RigFemNativeStatCalc.cpp @@ -0,0 +1,23 @@ +///////////////////////////////////////////////////////////////////////////////// +// +// 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 "RigFemNativeStatCalc.h" + diff --git a/ApplicationCode/GeoMech/GeoMechDataModel/RigFemNativeStatCalc.h b/ApplicationCode/GeoMech/GeoMechDataModel/RigFemNativeStatCalc.h new file mode 100644 index 0000000000..48a59ee3a8 --- /dev/null +++ b/ApplicationCode/GeoMech/GeoMechDataModel/RigFemNativeStatCalc.h @@ -0,0 +1,46 @@ +///////////////////////////////////////////////////////////////////////////////// +// +// 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 "RigStatisticsCalculator.h" +class RigFemScalarResultFrames; + +class RigFemNativeStatCalc : public RigStatisticsCalculator +{ +public: + RigFemNativeStatCalc(RigFemScalarResultFrames* cellResultsData); + + virtual void minMaxCellScalarValues(size_t timeStepIndex, double& min, double& max); + virtual void posNegClosestToZero(size_t timeStepIndex, double& pos, double& neg); + virtual void valueSumAndSampleCount(double& valueSum, size_t& sampleCount); + + virtual void addDataToHistogramCalculator(RigHistogramCalculator& histogramCalculator); + virtual size_t timeStepCount(); + +private: + RigFemScalarResultFrames* m_resultsData; +}; + + + diff --git a/ApplicationCode/GeoMech/GeoMechDataModel/RigFemPartResults.cpp b/ApplicationCode/GeoMech/GeoMechDataModel/RigFemPartResults.cpp new file mode 100644 index 0000000000..0509213336 --- /dev/null +++ b/ApplicationCode/GeoMech/GeoMechDataModel/RigFemPartResults.cpp @@ -0,0 +1,36 @@ +///////////////////////////////////////////////////////////////////////////////// +// +// 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. +// +///////////////////////////////////////////////////////////////////////////////// + +#include "RigFemPartResults.h" + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +RigFemPartResults::RigFemPartResults() +{ + +} + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +RigFemPartResults::~RigFemPartResults() +{ + +} diff --git a/ApplicationCode/GeoMech/GeoMechDataModel/RigFemPartResults.h b/ApplicationCode/GeoMech/GeoMechDataModel/RigFemPartResults.h new file mode 100644 index 0000000000..ae052f41f5 --- /dev/null +++ b/ApplicationCode/GeoMech/GeoMechDataModel/RigFemPartResults.h @@ -0,0 +1,63 @@ +///////////////////////////////////////////////////////////////////////////////// +// +// 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 "cvfObject.h" +#include "RigFemResultPosEnum.h" +#include +#include +#include + +#include "RigFemScalarResultFrames.h" + +//================================================================================================== +/// +//================================================================================================== + +class RigFemPartResults : public cvf::Object +{ +public: + RigFemPartResults(); + ~RigFemPartResults(); + + void initResultStages( const std::vector& stageNames); + + RigFemScalarResultFrames* createScalarResult( size_t stageIndex, + RigFemResultPosEnum resultPosType, + const std::string& fieldName, + const std::string& componentName, + const std::vector& frameTimes); + + RigFemScalarResultFrames* findScalarResult( size_t stageIndex, + RigFemResultPosEnum resultPosType, + const std::string& fieldName, + const std::string& componentName); + +private: + + struct RigAnalysisStage + { + std::string stageName; + std::map > > > resultSets; + }; + + std::vector m_femAnalysisStages; + +}; + diff --git a/ApplicationCode/GeoMech/GeoMechDataModel/RigFemResultPosEnum.h b/ApplicationCode/GeoMech/GeoMechDataModel/RigFemResultPosEnum.h new file mode 100644 index 0000000000..add7f3eed3 --- /dev/null +++ b/ApplicationCode/GeoMech/GeoMechDataModel/RigFemResultPosEnum.h @@ -0,0 +1,7 @@ +#pragma once + +enum RigFemResultPosEnum { + RIG_NODAL, + RIG_ELEMENT_NODAL, + RIG_INTEGRATION_POINT +}; diff --git a/ApplicationCode/GeoMech/GeoMechDataModel/RigFemScalarResultFrames.cpp b/ApplicationCode/GeoMech/GeoMechDataModel/RigFemScalarResultFrames.cpp new file mode 100644 index 0000000000..976ecb1935 --- /dev/null +++ b/ApplicationCode/GeoMech/GeoMechDataModel/RigFemScalarResultFrames.cpp @@ -0,0 +1,22 @@ +///////////////////////////////////////////////////////////////////////////////// +// +// 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 "RigFemScalarResultFrames.h" diff --git a/ApplicationCode/GeoMech/GeoMechDataModel/RigFemScalarResultFrames.h b/ApplicationCode/GeoMech/GeoMechDataModel/RigFemScalarResultFrames.h new file mode 100644 index 0000000000..cd024f8410 --- /dev/null +++ b/ApplicationCode/GeoMech/GeoMechDataModel/RigFemScalarResultFrames.h @@ -0,0 +1,47 @@ +///////////////////////////////////////////////////////////////////////////////// +// +// 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 "cvfObject.h" +#include + +//================================================================================================== +/// +//================================================================================================== +class RigStatisticsDataCache; + +class RigFemScalarResultFrames: public cvf::Object +{ +public: + RigFemScalarResultFrames(const std::vector& frameTimes); + virtual ~RigFemScalarResultFrames(); + + std::vector& frameData(size_t frameIndex); + size_t frameCount(); + + RigStatisticsDataCache* statistics(); + +private: + std::vector< std::vector > m_dataForEachFrame; + std::vector m_frameTimes; + + cvf::ref m_statistics; +}; + + diff --git a/ApplicationCode/GeoMech/GeoMechDataModel/RigGeoMechCaseData.cpp b/ApplicationCode/GeoMech/GeoMechDataModel/RigGeoMechCaseData.cpp index fdf7caee4d..2d57a5f8da 100644 --- a/ApplicationCode/GeoMech/GeoMechDataModel/RigGeoMechCaseData.cpp +++ b/ApplicationCode/GeoMech/GeoMechDataModel/RigGeoMechCaseData.cpp @@ -18,13 +18,19 @@ ///////////////////////////////////////////////////////////////////////////////// #include "RigGeoMechCaseData.h" +#include "RigFemPartCollection.h" +#include "RifGeoMechReaderInterface.h" + +#ifdef USE_ODB_API +#include "RifOdbReader.h" +#endif //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- -RigGeoMechCaseData::RigGeoMechCaseData() +RigGeoMechCaseData::RigGeoMechCaseData(const std::string& fileName) { - m_femParts = new RigFemPartCollection(); + m_geoMechCaseFileName = fileName; } //-------------------------------------------------------------------------------------------------- @@ -50,3 +56,92 @@ const RigFemPartCollection* RigGeoMechCaseData::femParts() const { return m_femParts.p(); } + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +bool RigGeoMechCaseData::openAndReadFemParts() +{ + +#ifdef USE_ODB_API + m_readerInterface = new RifOdbReader; +#endif + + if (m_readerInterface.notNull() && m_readerInterface->openFile(m_geoMechCaseFileName)) + { + m_femParts = new RigFemPartCollection(); + + if (m_readerInterface->readFemParts(m_femParts.p())) + { + // Initialize results containers + m_femPartResults.resize(m_femParts->partCount()); + std::vector stepNames = m_readerInterface->stepNames(); + for (int pIdx = 0; pIdx < m_femPartResults.size(); ++pIdx) + { + m_femPartResults[pIdx]->initResultStages(stepNames); + } + return true; + } + } + return false; +} + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +std::map > RigGeoMechCaseData::scalarFieldAndComponentNames(RigFemResultPosEnum resPos) +{ + std::map > fieldCompNames; + + if (m_readerInterface.notNull()) + { + if (resPos == RIG_NODAL) + { + fieldCompNames = m_readerInterface->scalarNodeFieldAndComponentNames(); + } + else if (resPos == RIG_ELEMENT_NODAL) + { + fieldCompNames = m_readerInterface->scalarElementNodeFieldAndComponentNames(); + } + else if (resPos == RIG_INTEGRATION_POINT) + { + fieldCompNames = m_readerInterface->scalarIntegrationPointFieldAndComponentNames(); + } + } + + return fieldCompNames; +} + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +RigFemScalarResultFrames* RigGeoMechCaseData::findOrLoadScalarResult(size_t partIndex, size_t stepIndex, + RigFemResultPosEnum resultPosType, + const std::string& fieldName, + const std::string& componentName) +{ + CVF_ASSERT(partIndex < m_femParts->partCount()); + + RigFemScalarResultFrames* frames = m_femPartResults[partIndex]->findScalarResult(stepIndex, resultPosType, fieldName, componentName); + if (frames) return frames; + + std::vector frameTimes = m_readerInterface->frameTimes(stepIndex); + frames = m_femPartResults[partIndex]->createScalarResult( stepIndex, resultPosType, fieldName, componentName, frameTimes); + + for (size_t fIdx = 0; fIdx < frameTimes.size(); ++fIdx) + { + std::vector* frameData = &(frames->frameData(fIdx)); + switch (resultPosType) + { + case RIG_NODAL: + m_readerInterface->readScalarNodeField(fieldName, componentName, partIndex, stepIndex, fIdx, frameData); + break; + case RIG_ELEMENT_NODAL: + //m_readerInterface->readScalarElementNodeField(fieldName, componentName, partIndex, stepIndex, fIdx, frameData); + break; + case RIG_INTEGRATION_POINT: + //m_readerInterface->readScalarIntegrationPointField(fieldName, componentName, partIndex, stepIndex, fIdx, frameData); + break; + } + } +} diff --git a/ApplicationCode/GeoMech/GeoMechDataModel/RigGeoMechCaseData.h b/ApplicationCode/GeoMech/GeoMechDataModel/RigGeoMechCaseData.h index bf98dbc879..2bf0995755 100644 --- a/ApplicationCode/GeoMech/GeoMechDataModel/RigGeoMechCaseData.h +++ b/ApplicationCode/GeoMech/GeoMechDataModel/RigGeoMechCaseData.h @@ -18,22 +18,41 @@ ///////////////////////////////////////////////////////////////////////////////// #pragma once +#include "cvfObject.h" +#include +#include +#include +#include "RigFemResultPosEnum.h" +#include "cvfCollection.h" +#include "RigFemPartResults.h" -#include "RigFemPartCollection.h" - +class RifGeoMechReaderInterface; +class RigFemPartCollection; +class RigFemScalarResultFrames; class RigGeoMechCaseData: public cvf::Object { public: - RigGeoMechCaseData(); + RigGeoMechCaseData(const std::string& fileName); ~RigGeoMechCaseData(); - RigFemPartCollection* femParts(); - const RigFemPartCollection* femParts() const; + bool openAndReadFemParts(); + + RigFemPartCollection* femParts(); + const RigFemPartCollection* femParts() const; + + std::map > scalarFieldAndComponentNames(RigFemResultPosEnum resPos); + std::vector stepNames(); + RigFemScalarResultFrames* findOrLoadScalarResult(size_t partIndex, + size_t stepIndex, + RigFemResultPosEnum resultPosType, + const std::string& fieldName, + const std::string& componentName); - private: - cvf::ref m_femParts; - + std::string m_geoMechCaseFileName; + cvf::ref m_femParts; + cvf::Collection m_femPartResults; + cvf::ref m_readerInterface; }; diff --git a/ApplicationCode/GeoMech/GeoMechDataModel/RigResultPositionEnum.h b/ApplicationCode/GeoMech/GeoMechDataModel/RigResultPositionEnum.h new file mode 100644 index 0000000000..e33e313ca6 --- /dev/null +++ b/ApplicationCode/GeoMech/GeoMechDataModel/RigResultPositionEnum.h @@ -0,0 +1,7 @@ +#pragma once + +enum RigFemResultPosEnum { + NODAL, + ELEMENT_NODAL, + INTEGRATION_POINT +}; diff --git a/ApplicationCode/GeoMech/GeoMechVisualization/RivFemPartGeometryGenerator.h b/ApplicationCode/GeoMech/GeoMechVisualization/RivFemPartGeometryGenerator.h index 14ea986bd2..bc985e5a65 100644 --- a/ApplicationCode/GeoMech/GeoMechVisualization/RivFemPartGeometryGenerator.h +++ b/ApplicationCode/GeoMech/GeoMechVisualization/RivFemPartGeometryGenerator.h @@ -43,6 +43,7 @@ public: cvf::ref createOutlineMeshDrawable(double creaseAngle); const std::vector& quadVerticesToNodeIdxMapping() const { return m_quadVerticesToNodeIdx;} + const std::vector& quadVerticesToGlobalElmNodeIdx() const { return m_quadVerticesToGlobalElmNodeIdx;} private: static cvf::ref diff --git a/ApplicationCode/GeoMech/GeoMechVisualization/RivFemPartPartMgr.cpp b/ApplicationCode/GeoMech/GeoMechVisualization/RivFemPartPartMgr.cpp index 2def2120bd..97dc74b5bc 100644 --- a/ApplicationCode/GeoMech/GeoMechVisualization/RivFemPartPartMgr.cpp +++ b/ApplicationCode/GeoMech/GeoMechVisualization/RivFemPartPartMgr.cpp @@ -47,6 +47,8 @@ #include "cvfStructGrid.h" #include "cvfUniform.h" #include "RifGeoMechReaderInterface.h" +#include "RigGeomechCaseData.h" +#include "RigFemScalarResultFrames.h" //-------------------------------------------------------------------------------------------------- @@ -219,20 +221,33 @@ void RivFemPartPartMgr::updateCellResultColor(size_t timeStepIndex, RimGeoMechRe { const cvf::ScalarMapper* mapper = cellResultSlot->legendConfig()->scalarMapper(); - RifGeoMechReaderInterface* reader = cellResultSlot->resultReaderInterface(); - std::vector resultValues; - reader->readScalarNodeField(cellResultSlot->resultFieldName().toStdString(), - cellResultSlot->resultComponentName().toStdString(), - m_gridIdx, 0, timeStepIndex, &resultValues); - const std::vector& vxToResultMapping = m_surfaceGenerator.quadVerticesToNodeIdxMapping(); - m_surfaceFacesTextureCoords->resize(vxToResultMapping.size()); + RigGeoMechCaseData* caseData = cellResultSlot->ownerCaseData(); + + if (!caseData) return; + + RigFemScalarResultFrames* scalarResults = caseData->findOrLoadScalarResult(m_gridIdx, 0, cellResultSlot->resultPositionType(), cellResultSlot->resultFieldName().toStdString(), cellResultSlot->resultComponentName().toStdString()); + std::vector& resultValues = scalarResults->frameData(timeStepIndex); + + const std::vector* vxToResultMapping = NULL; + + if (cellResultSlot->resultPositionType() == RIG_NODAL) + { + vxToResultMapping = &(m_surfaceGenerator.quadVerticesToNodeIdxMapping()); + } + else if ( cellResultSlot->resultPositionType() == RIG_ELEMENT_NODAL + || cellResultSlot->resultPositionType() == RIG_INTEGRATION_POINT) + { + vxToResultMapping = &(m_surfaceGenerator.quadVerticesToNodeIdxMapping()); + } + + m_surfaceFacesTextureCoords->resize(vxToResultMapping->size()); cvf::Vec2f* rawPtr = m_surfaceFacesTextureCoords->ptr(); #pragma omp parallel for schedule(dynamic) - for (int vxIdx = 0; vxIdx < vxToResultMapping.size(); ++vxIdx) + for (int vxIdx = 0; vxIdx < vxToResultMapping->size(); ++vxIdx) { - float resultValue = resultValues[vxToResultMapping[vxIdx]]; + float resultValue = resultValues[(*vxToResultMapping)[vxIdx]]; if (resultValue == HUGE_VAL || resultValue != resultValue) // a != a is true for NAN's { rawPtr[vxIdx][1] = 1.0f; diff --git a/ApplicationCode/ProjectDataModel/RimGeoMechCase.cpp b/ApplicationCode/ProjectDataModel/RimGeoMechCase.cpp index b5769f123e..513e3a372a 100644 --- a/ApplicationCode/ProjectDataModel/RimGeoMechCase.cpp +++ b/ApplicationCode/ProjectDataModel/RimGeoMechCase.cpp @@ -86,29 +86,9 @@ bool RimGeoMechCase::openGeoMechCase() return false; } + m_geoMechCaseData = new RigGeoMechCaseData(m_caseFileName().toStdString()); -#ifdef USE_ODB_API - m_readerInterface = new RifOdbReader; - - m_geoMechCaseData = new RigGeoMechCaseData; - if (m_readerInterface->readFemParts(m_caseFileName().toStdString(), m_geoMechCaseData->femParts())) - { - - // Todo: Default Results stuff, if needed - - return true; - } -#endif - - return false; - + return m_geoMechCaseData->openAndReadFemParts(); } -//-------------------------------------------------------------------------------------------------- -/// -//-------------------------------------------------------------------------------------------------- -RifGeoMechReaderInterface* RimGeoMechCase::readerInterface() -{ - return m_readerInterface.p(); -} diff --git a/ApplicationCode/ProjectDataModel/RimGeoMechCase.h b/ApplicationCode/ProjectDataModel/RimGeoMechCase.h index e1e21e6f62..067d89e619 100644 --- a/ApplicationCode/ProjectDataModel/RimGeoMechCase.h +++ b/ApplicationCode/ProjectDataModel/RimGeoMechCase.h @@ -40,23 +40,22 @@ public: RimGeoMechCase(void); virtual ~RimGeoMechCase(void); - void setFileName(const QString& fileName) {m_caseFileName = fileName;} - bool openGeoMechCase(); + void setFileName(const QString& fileName) {m_caseFileName = fileName;} + bool openGeoMechCase(); - RigGeoMechCaseData* geoMechData() { return m_geoMechCaseData.p(); } - const RigGeoMechCaseData* geoMechData() const { return m_geoMechCaseData.p(); } + RigGeoMechCaseData* geoMechData() { return m_geoMechCaseData.p(); } + const RigGeoMechCaseData* geoMechData() const { return m_geoMechCaseData.p(); } - RimGeoMechView* createAndAddReservoirView(); + RimGeoMechView* createAndAddReservoirView(); - virtual caf::PdmFieldHandle* userDescriptionField(); - RifGeoMechReaderInterface* readerInterface(); - // Fields: - caf::PdmField caseUserDescription; - caf::PdmPointersField geoMechViews; + // Fields: + caf::PdmField caseUserDescription; + caf::PdmPointersField geoMechViews; private: - cvf::ref m_geoMechCaseData; - caf::PdmField m_caseFileName; + virtual caf::PdmFieldHandle* userDescriptionField(); - cvf::ref m_readerInterface; +private: + cvf::ref m_geoMechCaseData; + caf::PdmField m_caseFileName; }; diff --git a/ApplicationCode/ProjectDataModel/RimGeoMechResultSlot.cpp b/ApplicationCode/ProjectDataModel/RimGeoMechResultSlot.cpp index c1b395545e..063a1ed37a 100644 --- a/ApplicationCode/ProjectDataModel/RimGeoMechResultSlot.cpp +++ b/ApplicationCode/ProjectDataModel/RimGeoMechResultSlot.cpp @@ -24,16 +24,17 @@ #include "RimGeoMechCase.h" #include "RifGeoMechReaderInterface.h" #include "cafPdmUiListEditor.h" +#include "RigGeoMechCaseData.h" namespace caf { template<> -void caf::AppEnum< RimGeoMechResultSlot::ResultPositionEnum >::setUp() +void caf::AppEnum< RigFemResultPosEnum >::setUp() { - addItem(RimGeoMechResultSlot::NODAL, "NODAL", "Nodal"); - addItem(RimGeoMechResultSlot::ELEMENT_NODAL, "ELEMENT_NODAL", "Element Nodal"); - addItem(RimGeoMechResultSlot::INTEGRATION_POINT,"INTEGRATION_POINT","Integration Point"); - setDefault(RimGeoMechResultSlot::NODAL); + addItem(RIG_NODAL, "NODAL", "Nodal"); + addItem(RIG_ELEMENT_NODAL, "ELEMENT_NODAL", "Element Nodal"); + addItem(RIG_INTEGRATION_POINT,"INTEGRATION_POINT","Integration Point"); + setDefault(RIG_NODAL); } } @@ -178,29 +179,15 @@ void RimGeoMechResultSlot::fieldChangedByUi(const caf::PdmFieldHandle* changedFi //-------------------------------------------------------------------------------------------------- std::map > RimGeoMechResultSlot::getResultMetaDataForUIFieldSetting() { - std::map > fieldCompNames; - RimGeoMechCase* gmCase = m_reservoirView->geoMechCase(); - if (gmCase) + if (gmCase && gmCase->geoMechData()) { - cvf::ref reader = gmCase->readerInterface(); - if (reader.notNull()) - { - if (m_resultPositionTypeUiField == NODAL) - { - fieldCompNames = reader->scalarNodeFieldAndComponentNames(); - } - else if (m_resultPositionTypeUiField == ELEMENT_NODAL) - { - fieldCompNames = reader->scalarElementNodeFieldAndComponentNames(); - } - else if (m_resultPositionTypeUiField == INTEGRATION_POINT) - { - fieldCompNames = reader->scalarIntegrationPointFieldAndComponentNames(); - } - } + return gmCase->geoMechData()->scalarFieldAndComponentNames(m_resultPositionTypeUiField()); + } + else + { + return std::map >() ; } - return fieldCompNames; } void RimGeoMechResultSlot::getUiAndResultVariableStringList(QStringList* uiNames, QStringList* variableNames, @@ -248,17 +235,7 @@ void RimGeoMechResultSlot::loadResult() //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- -RifGeoMechReaderInterface* RimGeoMechResultSlot::resultReaderInterface() +RigGeoMechCaseData* RimGeoMechResultSlot::ownerCaseData() { - if (m_reservoirView) - { - RimGeoMechCase* gmCase = m_reservoirView->geoMechCase(); - if (gmCase) - { - return gmCase->readerInterface(); - } - - } - - return NULL; + return m_reservoirView->geoMechCase()->geoMechData(); } diff --git a/ApplicationCode/ProjectDataModel/RimGeoMechResultSlot.h b/ApplicationCode/ProjectDataModel/RimGeoMechResultSlot.h index c68a82bcfa..98f22fcd27 100644 --- a/ApplicationCode/ProjectDataModel/RimGeoMechResultSlot.h +++ b/ApplicationCode/ProjectDataModel/RimGeoMechResultSlot.h @@ -23,11 +23,12 @@ #include "cafPdmObject.h" #include "cafPdmPointer.h" #include "cafAppEnum.h" +#include "RigFemResultPosEnum.h" class RimLegendConfig; class RimGeoMechView; class RifGeoMechReaderInterface; - +class RigGeoMechCaseData; //================================================================================================== /// /// @@ -41,22 +42,15 @@ public: virtual ~RimGeoMechResultSlot(void); void setReservoirView(RimGeoMechView* ownerReservoirView); - RifGeoMechReaderInterface* resultReaderInterface(); - - enum ResultPositionEnum { - NODAL, - ELEMENT_NODAL, - INTEGRATION_POINT - }; - - ResultPositionEnum resultPositionType() { return m_resultPositionType();} + RigGeoMechCaseData* ownerCaseData(); + + RigFemResultPosEnum resultPositionType() { return m_resultPositionType();} QString resultFieldName() { return m_resultFieldName();} QString resultComponentName() { return m_resultComponentName();} caf::PdmField legendConfig; - private: virtual QList calculateValueOptions(const caf::PdmFieldHandle* fieldNeedingOptions, bool * useOptionsOnly); @@ -70,11 +64,11 @@ private: virtual void initAfterRead(); void loadResult(); - caf::PdmField > m_resultPositionType; + caf::PdmField > m_resultPositionType; caf::PdmField m_resultFieldName; caf::PdmField m_resultComponentName; - caf::PdmField > m_resultPositionTypeUiField; + caf::PdmField > m_resultPositionTypeUiField; caf::PdmField m_resultVariableUiField; caf::PdmPointer m_reservoirView; diff --git a/ApplicationCode/ProjectDataModel/RimGeoMechView.cpp b/ApplicationCode/ProjectDataModel/RimGeoMechView.cpp index 81bf65bf6a..3f7bd82b6f 100644 --- a/ApplicationCode/ProjectDataModel/RimGeoMechView.cpp +++ b/ApplicationCode/ProjectDataModel/RimGeoMechView.cpp @@ -40,7 +40,7 @@ #include "RivGeoMechPartMgr.h" #include "RigGeoMechCaseData.h" #include "cvfqtUtils.h" - +#include "RigFemPartCollection.h" namespace caf { @@ -254,7 +254,7 @@ void RimGeoMechView::updateLegends() cellResult->legendConfig->setClosestToZeroValues(globalPosClosestToZero, globalNegClosestToZero, localPosClosestToZero, localNegClosestToZero); cellResult->legendConfig->setAutomaticRanges(globalMin, globalMax, localMin, localMax); #endif - caf::AppEnum resPosType = cellResult->resultPositionType(); + caf::AppEnum resPosType = cellResult->resultPositionType(); QString fieldName = cellResult->resultFieldName(); QString compName = cellResult->resultComponentName();