diff --git a/ApplicationCode/ReservoirDataModel/CMakeLists_files.cmake b/ApplicationCode/ReservoirDataModel/CMakeLists_files.cmake index 78e6bbc52a..06835f0e32 100644 --- a/ApplicationCode/ReservoirDataModel/CMakeLists_files.cmake +++ b/ApplicationCode/ReservoirDataModel/CMakeLists_files.cmake @@ -16,6 +16,7 @@ ${CEE_CURRENT_LIST_DIR}RigAllGridCellsResultAccessor.h ${CEE_CURRENT_LIST_DIR}RigActiveCellsResultAccessor.h ${CEE_CURRENT_LIST_DIR}RigCellEdgeResultAccessor.h ${CEE_CURRENT_LIST_DIR}RigCombTransResultAccessor.h +${CEE_CURRENT_LIST_DIR}RigCombMultResultAccessor.h ${CEE_CURRENT_LIST_DIR}RigResultModifier.h ${CEE_CURRENT_LIST_DIR}RigResultModifierFactory.h ${CEE_CURRENT_LIST_DIR}RigLocalGrid.h @@ -48,6 +49,7 @@ ${CEE_CURRENT_LIST_DIR}RigAllGridCellsResultAccessor.cpp ${CEE_CURRENT_LIST_DIR}RigActiveCellsResultAccessor.cpp ${CEE_CURRENT_LIST_DIR}RigCellEdgeResultAccessor.cpp ${CEE_CURRENT_LIST_DIR}RigCombTransResultAccessor.cpp +${CEE_CURRENT_LIST_DIR}RigCombMultResultAccessor.cpp ${CEE_CURRENT_LIST_DIR}RigResultModifierFactory.cpp ${CEE_CURRENT_LIST_DIR}RigLocalGrid.cpp ${CEE_CURRENT_LIST_DIR}RigMainGrid.cpp diff --git a/ApplicationCode/ReservoirDataModel/RigCombMultResultAccessor.cpp b/ApplicationCode/ReservoirDataModel/RigCombMultResultAccessor.cpp new file mode 100644 index 0000000000..fc6917ab96 --- /dev/null +++ b/ApplicationCode/ReservoirDataModel/RigCombMultResultAccessor.cpp @@ -0,0 +1,142 @@ +///////////////////////////////////////////////////////////////////////////////// +// +// 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 "RigCombMultResultAccessor.h" + +#include "RigGridBase.h" + +#include + + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +RigCombMultResultAccessor::RigCombMultResultAccessor(const RigGridBase* grid) + : m_grid(grid) +{ +} + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +void RigCombMultResultAccessor::setMultResultAccessors( + RigResultAccessor* multXPosAccessor, RigResultAccessor* multXNegAccessor, + RigResultAccessor* multYPosAccessor, RigResultAccessor* multYNegAccessor, + RigResultAccessor* multZPosAccessor, RigResultAccessor* multZNegAccessor) +{ + m_multXPosAccessor = multXPosAccessor; + m_multXNegAccessor = multXNegAccessor; + m_multYPosAccessor = multYPosAccessor; + m_multYNegAccessor = multYNegAccessor; + m_multZPosAccessor = multZPosAccessor; + m_multZNegAccessor = multZNegAccessor; +} + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +double RigCombMultResultAccessor::cellScalar(size_t gridLocalCellIndex) const +{ + CVF_TIGHT_ASSERT(false); + + return HUGE_VAL; +} + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +double RigCombMultResultAccessor::cellFaceScalar(size_t gridLocalCellIndex, cvf::StructGridInterface::FaceType faceId) const +{ + size_t i, j, k, neighborGridCellIdx; + m_grid->ijkFromCellIndex(gridLocalCellIndex, &i, &j, &k); + + double faceScalarThisCell = nativeMultScalar(gridLocalCellIndex, faceId); + + double faceScalarNeighborCell = 1.0; + if (m_grid->cellIJKNeighbor(i, j, k, faceId, &neighborGridCellIdx)) + { + faceScalarNeighborCell = nativeMultScalar(neighborGridCellIdx, cvf::StructGridInterface::oppositeFace(faceId)); + } + + return faceScalarThisCell * faceScalarNeighborCell; +} + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +double RigCombMultResultAccessor::nativeMultScalar(size_t gridLocalCellIndex, cvf::StructGridInterface::FaceType faceId) const +{ + double faceScalar = 1.0; + + switch (faceId) + { + case cvf::StructGridInterface::POS_I: + { + if (m_multXPosAccessor.notNull()) + { + faceScalar = m_multXPosAccessor->cellScalar(gridLocalCellIndex); + } + break; + } + case cvf::StructGridInterface::NEG_I: + { + if (m_multXNegAccessor.notNull()) + { + faceScalar = m_multXNegAccessor->cellScalar(gridLocalCellIndex); + } + break; + } + + case cvf::StructGridInterface::POS_J: + { + if (m_multYPosAccessor.notNull()) + { + faceScalar = m_multYPosAccessor->cellScalar(gridLocalCellIndex); + } + break; + } + case cvf::StructGridInterface::NEG_J: + { + if (m_multYNegAccessor.notNull()) + { + faceScalar = m_multYNegAccessor->cellScalar(gridLocalCellIndex); + } + break; + } + + case cvf::StructGridInterface::POS_K: + { + if (m_multZPosAccessor.notNull()) + { + faceScalar = m_multZPosAccessor->cellScalar(gridLocalCellIndex); + } + break; + } + case cvf::StructGridInterface::NEG_K: + { + if (m_multZNegAccessor.notNull()) + { + faceScalar = m_multZNegAccessor->cellScalar(gridLocalCellIndex); + } + break; + } + } + + return faceScalar; +} + diff --git a/ApplicationCode/ReservoirDataModel/RigCombMultResultAccessor.h b/ApplicationCode/ReservoirDataModel/RigCombMultResultAccessor.h new file mode 100644 index 0000000000..b24604f7a3 --- /dev/null +++ b/ApplicationCode/ReservoirDataModel/RigCombMultResultAccessor.h @@ -0,0 +1,59 @@ +///////////////////////////////////////////////////////////////////////////////// +// +// 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 "RigResultAccessor.h" + +#include "cvfCollection.h" + +class RigGridBase; + + +//================================================================================================== +/// +//================================================================================================== +class RigCombMultResultAccessor : public RigResultAccessor +{ +public: + RigCombMultResultAccessor(const RigGridBase* grid); + + void setMultResultAccessors( + RigResultAccessor* multXPosAccessor, + RigResultAccessor* multXNegAccessor, + RigResultAccessor* multYPosAccessor, + RigResultAccessor* multYNegAccessor, + RigResultAccessor* multZPosAccessor, + RigResultAccessor* multZNegAccessor); + + virtual double cellScalar(size_t gridLocalCellIndex) const; + virtual double cellFaceScalar(size_t gridLocalCellIndex, cvf::StructGridInterface::FaceType faceId) const; + +private: + double nativeMultScalar(size_t gridLocalCellIndex, cvf::StructGridInterface::FaceType faceId) const; + +private: + cvf::ref m_multXPosAccessor; + cvf::ref m_multXNegAccessor; + cvf::ref m_multYPosAccessor; + cvf::ref m_multYNegAccessor; + cvf::ref m_multZPosAccessor; + cvf::ref m_multZNegAccessor; + + const RigGridBase* m_grid; +};