diff --git a/ApplicationCode/ReservoirDataModel/CMakeLists_files.cmake b/ApplicationCode/ReservoirDataModel/CMakeLists_files.cmake index 31552802cb..154b885bd0 100644 --- a/ApplicationCode/ReservoirDataModel/CMakeLists_files.cmake +++ b/ApplicationCode/ReservoirDataModel/CMakeLists_files.cmake @@ -14,6 +14,7 @@ ${CEE_CURRENT_LIST_DIR}RigResultAccessObject.h ${CEE_CURRENT_LIST_DIR}RigResultAccessObjectFactory.h ${CEE_CURRENT_LIST_DIR}RigAllGridCellsResultAccessObject.h ${CEE_CURRENT_LIST_DIR}RigActiveCellsResultAccessObject.h +${CEE_CURRENT_LIST_DIR}RigCellFaceResultAccessObject.h ${CEE_CURRENT_LIST_DIR}RigLocalGrid.h ${CEE_CURRENT_LIST_DIR}RigMainGrid.h ${CEE_CURRENT_LIST_DIR}RigReservoirBuilderMock.h @@ -37,6 +38,7 @@ ${CEE_CURRENT_LIST_DIR}RigResultAccessObject.cpp ${CEE_CURRENT_LIST_DIR}RigResultAccessObjectFactory.cpp ${CEE_CURRENT_LIST_DIR}RigAllGridCellsResultAccessObject.cpp ${CEE_CURRENT_LIST_DIR}RigActiveCellsResultAccessObject.cpp +${CEE_CURRENT_LIST_DIR}RigCellFaceResultAccessObject.cpp ${CEE_CURRENT_LIST_DIR}RigLocalGrid.cpp ${CEE_CURRENT_LIST_DIR}RigMainGrid.cpp ${CEE_CURRENT_LIST_DIR}RigReservoirBuilderMock.cpp diff --git a/ApplicationCode/ReservoirDataModel/RigActiveCellsResultAccessObject.h b/ApplicationCode/ReservoirDataModel/RigActiveCellsResultAccessObject.h index 1bcb18d66a..901fe90638 100644 --- a/ApplicationCode/ReservoirDataModel/RigActiveCellsResultAccessObject.h +++ b/ApplicationCode/ReservoirDataModel/RigActiveCellsResultAccessObject.h @@ -44,40 +44,3 @@ private: QString m_resultName; }; - -/* - -class CellFaceScalarDataAccess : public Object -{ -public: - virtual double cellFaceScalar(size_t cellIndex, cvf::StructGridInterface faceId) const = 0; -}; - -class PlainCellFaceScalarDataAccess : public CellFaceScalarDataAccess -{ -public: - PlainCellFaceScalarDataAccess() - { - cellEdgeDataAccessObjects.resize(6); - } - - void setDataAccessObjectForFace(cvf::StructGridInterface faceId, cvf::StructGridScalarDataAccess* dataAccessObject) - { - cellEdgeDataAccessObjects[faceId] = dataAccessObject; - } - - virtual double cellFaceScalar( size_t cellIndex, cvf::StructGridInterface faceId ) const - { - cvf::StructGridScalarDataAccess* dataAccessObj = cellEdgeDataAccessObjects[faceId]; - if (dataAccessObj != NULL) - { - return dataAccessObj->cellScalar(cellIndex); - } - - return HUGE_VAL; - } -private: - cvf::Collection cellEdgeDataAccessObjects; -}; - -*/ diff --git a/ApplicationCode/ReservoirDataModel/RigAllGridCellsResultAccessObject.h b/ApplicationCode/ReservoirDataModel/RigAllGridCellsResultAccessObject.h index c503960ef5..86eb65ecb5 100644 --- a/ApplicationCode/ReservoirDataModel/RigAllGridCellsResultAccessObject.h +++ b/ApplicationCode/ReservoirDataModel/RigAllGridCellsResultAccessObject.h @@ -43,39 +43,3 @@ private: }; -/* - -class CellFaceScalarDataAccess : public Object -{ -public: - virtual double cellFaceScalar(size_t cellIndex, cvf::StructGridInterface faceId) const = 0; -}; - -class PlainCellFaceScalarDataAccess : public CellFaceScalarDataAccess -{ -public: - PlainCellFaceScalarDataAccess() - { - cellEdgeDataAccessObjects.resize(6); - } - - void setDataAccessObjectForFace(cvf::StructGridInterface faceId, cvf::StructGridScalarDataAccess* dataAccessObject) - { - cellEdgeDataAccessObjects[faceId] = dataAccessObject; - } - - virtual double cellFaceScalar( size_t cellIndex, cvf::StructGridInterface faceId ) const - { - cvf::StructGridScalarDataAccess* dataAccessObj = cellEdgeDataAccessObjects[faceId]; - if (dataAccessObj != NULL) - { - return dataAccessObj->cellScalar(cellIndex); - } - - return HUGE_VAL; - } -private: - cvf::Collection cellEdgeDataAccessObjects; -}; - -*/ diff --git a/ApplicationCode/ReservoirDataModel/RigCaseData.cpp b/ApplicationCode/ReservoirDataModel/RigCaseData.cpp index 741dc86ee8..3b1dfebeca 100644 --- a/ApplicationCode/ReservoirDataModel/RigCaseData.cpp +++ b/ApplicationCode/ReservoirDataModel/RigCaseData.cpp @@ -496,7 +496,7 @@ cvf::ref RigCaseData::dataAccessObject(const Ri if (timeStepIndex != cvf::UNDEFINED_SIZE_T && scalarSetIndex != cvf::UNDEFINED_SIZE_T) { - cvf::ref dataAccess = RigResultAccessObjectFactory::createNativeDataAccessObject(this, grid->gridIndex(), porosityModel, timeStepIndex, scalarSetIndex); + cvf::ref dataAccess = RigResultAccessObjectFactory::TO_BE_DELETED_createNativeDataAccessObject(this, grid->gridIndex(), porosityModel, timeStepIndex, scalarSetIndex); return dataAccess; } diff --git a/ApplicationCode/ReservoirDataModel/RigCellFaceResultAccessObject.cpp b/ApplicationCode/ReservoirDataModel/RigCellFaceResultAccessObject.cpp new file mode 100644 index 0000000000..808d8b7708 --- /dev/null +++ b/ApplicationCode/ReservoirDataModel/RigCellFaceResultAccessObject.cpp @@ -0,0 +1,82 @@ +///////////////////////////////////////////////////////////////////////////////// +// +// Copyright (C) Statoil ASA, 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 "RigCellFaceResultAccessObject.h" + + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +RigCellFaceResultAccessObject::RigCellFaceResultAccessObject(const QString& resultName) + : m_resultName(resultName) +{ + m_resultAccessObjects.resize(6); +} + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +void RigCellFaceResultAccessObject::setDataAccessObjectForFace(cvf::StructGridInterface::FaceType faceId, RigResultAccessObject* resultAccessObject) +{ + m_resultAccessObjects[faceId] = resultAccessObject; +} + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +double RigCellFaceResultAccessObject::cellScalar(size_t localCellIndex) const +{ + + // TODO: How to handle when we get here? + CVF_ASSERT(false); + + return cvf::UNDEFINED_DOUBLE; +} + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +double RigCellFaceResultAccessObject::cellFaceScalar(size_t localCellIndex, cvf::StructGridInterface::FaceType faceId) const +{ + const RigResultAccessObject* resultAccessObj = m_resultAccessObjects.at(faceId); + if (resultAccessObj != NULL) + { + return resultAccessObj->cellFaceScalar(localCellIndex, faceId); + } + + return HUGE_VAL; +} + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +QString RigCellFaceResultAccessObject::resultName() const +{ + return m_resultName; +} + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +void RigCellFaceResultAccessObject::setCellScalar(size_t localCellIndex, double scalarValue) +{ + // TODO: How to handle when we get here? + CVF_ASSERT(false); + +} + diff --git a/ApplicationCode/ReservoirDataModel/RigCellFaceResultAccessObject.h b/ApplicationCode/ReservoirDataModel/RigCellFaceResultAccessObject.h new file mode 100644 index 0000000000..27afad5aea --- /dev/null +++ b/ApplicationCode/ReservoirDataModel/RigCellFaceResultAccessObject.h @@ -0,0 +1,45 @@ +///////////////////////////////////////////////////////////////////////////////// +// +// Copyright (C) Statoil ASA, 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 "RigResultAccessObject.h" + +#include "cvfCollection.h" + + +//================================================================================================== +/// +//================================================================================================== +class RigCellFaceResultAccessObject : public RigResultAccessObject +{ +public: + RigCellFaceResultAccessObject(const QString& resultName); + + void setDataAccessObjectForFace(cvf::StructGridInterface::FaceType faceId, RigResultAccessObject* resultAccessObject); + + virtual double cellScalar(size_t localCellIndex) const; + virtual double cellFaceScalar(size_t localCellIndex, cvf::StructGridInterface::FaceType faceId) const; + virtual QString resultName() const; + virtual void setCellScalar(size_t localCellIndex, double scalarValue); + +private: + cvf::Collection m_resultAccessObjects; + + QString m_resultName; +}; diff --git a/ApplicationCode/ReservoirDataModel/RigResultAccessObject.h b/ApplicationCode/ReservoirDataModel/RigResultAccessObject.h index caf9640931..8d723b567b 100644 --- a/ApplicationCode/ReservoirDataModel/RigResultAccessObject.h +++ b/ApplicationCode/ReservoirDataModel/RigResultAccessObject.h @@ -39,40 +39,3 @@ public: virtual void setCellScalar(size_t localCellIndex, double scalarValue) = 0; }; - -/* - -class CellFaceScalarDataAccess : public Object -{ -public: - virtual double cellFaceScalar(size_t cellIndex, cvf::StructGridInterface faceId) const = 0; -}; - -class PlainCellFaceScalarDataAccess : public CellFaceScalarDataAccess -{ -public: - PlainCellFaceScalarDataAccess() - { - cellEdgeDataAccessObjects.resize(6); - } - - void setDataAccessObjectForFace(cvf::StructGridInterface faceId, cvf::StructGridScalarDataAccess* dataAccessObject) - { - cellEdgeDataAccessObjects[faceId] = dataAccessObject; - } - - virtual double cellFaceScalar( size_t cellIndex, cvf::StructGridInterface faceId ) const - { - cvf::StructGridScalarDataAccess* dataAccessObj = cellEdgeDataAccessObjects[faceId]; - if (dataAccessObj != NULL) - { - return dataAccessObj->cellScalar(cellIndex); - } - - return HUGE_VAL; - } -private: - cvf::Collection cellEdgeDataAccessObjects; -}; - -*/ diff --git a/ApplicationCode/ReservoirDataModel/RigResultAccessObjectFactory.cpp b/ApplicationCode/ReservoirDataModel/RigResultAccessObjectFactory.cpp index e47a35e2d5..d093fca77b 100644 --- a/ApplicationCode/ReservoirDataModel/RigResultAccessObjectFactory.cpp +++ b/ApplicationCode/ReservoirDataModel/RigResultAccessObjectFactory.cpp @@ -146,7 +146,7 @@ public: //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- -cvf::ref RigResultAccessObjectFactory::createNativeDataAccessObject(RigCaseData* eclipseCase, +cvf::ref RigResultAccessObjectFactory::TO_BE_DELETED_createNativeDataAccessObject(RigCaseData* eclipseCase, size_t gridIndex, RifReaderInterface::PorosityModelResultType porosityModel, size_t timeStepIndex, diff --git a/ApplicationCode/ReservoirDataModel/RigResultAccessObjectFactory.h b/ApplicationCode/ReservoirDataModel/RigResultAccessObjectFactory.h index d19a8ff386..b50adc5240 100644 --- a/ApplicationCode/ReservoirDataModel/RigResultAccessObjectFactory.h +++ b/ApplicationCode/ReservoirDataModel/RigResultAccessObjectFactory.h @@ -28,8 +28,16 @@ class RigGridBase; class RigResultAccessObjectFactory { public: + + + + + + + + // TO BE DELETED static cvf::ref - createNativeDataAccessObject(RigCaseData* eclipseCase, + TO_BE_DELETED_createNativeDataAccessObject(RigCaseData* eclipseCase, size_t gridIndex, RifReaderInterface::PorosityModelResultType porosityModel, size_t timeStepIndex,