From 5382122094aafdb7a60833e3dca7ac424eb7a666 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jacob=20St=C3=B8ren?= Date: Thu, 7 Aug 2014 15:30:12 +0200 Subject: [PATCH] Trimmed CombTransResultAccessor interface setTransResultAccessors --- .../RigCombTransResultAccessor.cpp | 49 +++++++++---------- .../RigCombTransResultAccessor.h | 11 +++-- .../RigResultAccessorFactory.cpp | 39 +++------------ .../RigResultAccessorFactory.h | 4 +- 4 files changed, 39 insertions(+), 64 deletions(-) diff --git a/ApplicationCode/ReservoirDataModel/RigCombTransResultAccessor.cpp b/ApplicationCode/ReservoirDataModel/RigCombTransResultAccessor.cpp index af7b992e7f..2e67ac5b6f 100644 --- a/ApplicationCode/ReservoirDataModel/RigCombTransResultAccessor.cpp +++ b/ApplicationCode/ReservoirDataModel/RigCombTransResultAccessor.cpp @@ -29,18 +29,21 @@ RigCombTransResultAccessor::RigCombTransResultAccessor(const RigGridBase* grid) : m_grid(grid) { - m_resultAccessObjects.resize(6); + } //-------------------------------------------------------------------------------------------------- /// Only sensible to provide the positive values, as the negative ones will never be used. /// The negative faces gets their value from the neighbor cell in that direction //-------------------------------------------------------------------------------------------------- -void RigCombTransResultAccessor::setDataAccessObjectForFace(cvf::StructGridInterface::FaceType faceId, RigResultAccessor* resultAccessObject) -{ - CVF_ASSERT(faceId == cvf::StructGridInterface::POS_I || faceId == cvf::StructGridInterface::POS_J || faceId == cvf::StructGridInterface::POS_K ); +void RigCombTransResultAccessor::setTransResultAccessors(RigResultAccessor* xTransAccessor, + RigResultAccessor* yTransAccessor, + RigResultAccessor* zTransAccessor) - m_resultAccessObjects[faceId] = resultAccessObject; +{ + m_xTransAccessor = xTransAccessor; + m_yTransAccessor = yTransAccessor; + m_zTransAccessor = zTransAccessor; } //-------------------------------------------------------------------------------------------------- @@ -48,11 +51,9 @@ void RigCombTransResultAccessor::setDataAccessObjectForFace(cvf::StructGridInter //-------------------------------------------------------------------------------------------------- double RigCombTransResultAccessor::cellScalar(size_t localCellIndex) const { + CVF_TIGHT_ASSERT(false); - // TODO: How to handle when we get here? - CVF_ASSERT(false); - - return cvf::UNDEFINED_DOUBLE; + return HUGE_VAL; } //-------------------------------------------------------------------------------------------------- @@ -64,72 +65,66 @@ double RigCombTransResultAccessor::cellFaceScalar(size_t localCellIndex, cvf::St { case cvf::StructGridInterface::POS_I: { - const RigResultAccessor* resultAccessObj = m_resultAccessObjects.at(cvf::StructGridInterface::POS_I); - if (resultAccessObj) + if (m_xTransAccessor.notNull()) { - return resultAccessObj->cellScalar(localCellIndex); + return m_xTransAccessor->cellScalar(localCellIndex); } } break; case cvf::StructGridInterface::NEG_I: { - const RigResultAccessor* resultAccessObj = m_resultAccessObjects.at(cvf::StructGridInterface::POS_I); - if (resultAccessObj) + if (m_xTransAccessor.notNull()) { size_t i, j, k, neighborGridCellIdx; m_grid->ijkFromCellIndex(localCellIndex, &i, &j, &k); if (m_grid->cellIJKNeighbor(i, j, k, cvf::StructGridInterface::NEG_I, &neighborGridCellIdx)) { - return resultAccessObj->cellScalar(neighborGridCellIdx); + return m_xTransAccessor->cellScalar(neighborGridCellIdx); } } } break; case cvf::StructGridInterface::POS_J: { - const RigResultAccessor* resultAccessObj = m_resultAccessObjects.at(cvf::StructGridInterface::POS_J); - if (resultAccessObj) + if (m_yTransAccessor.notNull()) { - return resultAccessObj->cellScalar(localCellIndex); + return m_yTransAccessor->cellScalar(localCellIndex); } } break; case cvf::StructGridInterface::NEG_J: { - const RigResultAccessor* resultAccessObj = m_resultAccessObjects.at(cvf::StructGridInterface::POS_J); - if (resultAccessObj) + if (m_yTransAccessor.notNull()) { size_t i, j, k, neighborGridCellIdx; m_grid->ijkFromCellIndex(localCellIndex, &i, &j, &k); if (m_grid->cellIJKNeighbor(i, j, k, cvf::StructGridInterface::NEG_J, &neighborGridCellIdx)) { - return resultAccessObj->cellScalar(neighborGridCellIdx); + return m_yTransAccessor->cellScalar(neighborGridCellIdx); } } } break; case cvf::StructGridInterface::POS_K: { - const RigResultAccessor* resultAccessObj = m_resultAccessObjects.at(cvf::StructGridInterface::POS_K); - if (resultAccessObj) + if (m_zTransAccessor.notNull()) { - return resultAccessObj->cellScalar(localCellIndex); + return m_zTransAccessor->cellScalar(localCellIndex); } } break; case cvf::StructGridInterface::NEG_K: { - const RigResultAccessor* resultAccessObj = m_resultAccessObjects.at(cvf::StructGridInterface::POS_K); - if (resultAccessObj) + if (m_zTransAccessor.notNull()) { size_t i, j, k, neighborGridCellIdx; m_grid->ijkFromCellIndex(localCellIndex, &i, &j, &k); if (m_grid->cellIJKNeighbor(i, j, k, cvf::StructGridInterface::NEG_K, &neighborGridCellIdx)) { - return resultAccessObj->cellScalar(neighborGridCellIdx); + return m_zTransAccessor->cellScalar(neighborGridCellIdx); } } } diff --git a/ApplicationCode/ReservoirDataModel/RigCombTransResultAccessor.h b/ApplicationCode/ReservoirDataModel/RigCombTransResultAccessor.h index 6a7a0b5cda..fe9b89128f 100644 --- a/ApplicationCode/ReservoirDataModel/RigCombTransResultAccessor.h +++ b/ApplicationCode/ReservoirDataModel/RigCombTransResultAccessor.h @@ -33,13 +33,18 @@ class RigCombTransResultAccessor : public RigResultAccessor public: RigCombTransResultAccessor(const RigGridBase* grid); - void setDataAccessObjectForFace(cvf::StructGridInterface::FaceType faceId, RigResultAccessor* resultAccessObject); + void setTransResultAccessors(RigResultAccessor* xTransAccessor, + RigResultAccessor* yTransAccessor, + RigResultAccessor* zTransAccessor); virtual double cellScalar(size_t localCellIndex) const; virtual double cellFaceScalar(size_t localCellIndex, cvf::StructGridInterface::FaceType faceId) const; private: - cvf::Collection m_resultAccessObjects; - + + cvf::ref m_xTransAccessor; + cvf::ref m_yTransAccessor; + cvf::ref m_zTransAccessor; + const RigGridBase* m_grid; }; diff --git a/ApplicationCode/ReservoirDataModel/RigResultAccessorFactory.cpp b/ApplicationCode/ReservoirDataModel/RigResultAccessorFactory.cpp index 66096010cd..ff735d47a9 100644 --- a/ApplicationCode/ReservoirDataModel/RigResultAccessorFactory.cpp +++ b/ApplicationCode/ReservoirDataModel/RigResultAccessorFactory.cpp @@ -43,7 +43,7 @@ cvf::ref RigResultAccessorFactory::createNativeResultAccessor size_t gridIndex, RifReaderInterface::PorosityModelResultType porosityModel, size_t timeStepIndex, - QString& uiResultName) + const QString& uiResultName) { CVF_ASSERT(gridIndex < eclipseCase->gridCount()); CVF_ASSERT(eclipseCase); @@ -102,7 +102,7 @@ cvf::ref RigResultAccessorFactory::createResultAccessor(RigCa size_t gridIndex, RifReaderInterface::PorosityModelResultType porosityModel, size_t timeStepIndex, - QString& uiResultName) + const QString& uiResultName) { CVF_ASSERT(gridIndex < eclipseCase->gridCount()); CVF_ASSERT(eclipseCase); @@ -118,38 +118,13 @@ cvf::ref RigResultAccessorFactory::createResultAccessor(RigCa } else if (uiResultName == RimDefines::combinedTransmissibilityResultName()) { - // TODO - // Taken from RivTransmissibilityColorMapper::updateCombinedTransmissibilityTextureCoordinates - // - cvf::ref cellFaceAccessObject = new RigCombTransResultAccessor(grid); - { - QString resultName = "TRANX"; - cvf::ref nativeAccessObject = RigResultAccessorFactory::createNativeResultAccessor(eclipseCase, gridIndex, porosityModel, timeStepIndex, resultName); - if (nativeAccessObject.notNull()) - { - cellFaceAccessObject->setDataAccessObjectForFace(cvf::StructGridInterface::POS_I, nativeAccessObject.p()); - } - } - - { - QString resultName = "TRANY"; - cvf::ref nativeAccessObject = RigResultAccessorFactory::createNativeResultAccessor(eclipseCase, gridIndex, porosityModel, timeStepIndex, resultName); - if (nativeAccessObject.notNull()) - { - cellFaceAccessObject->setDataAccessObjectForFace(cvf::StructGridInterface::POS_J, nativeAccessObject.p()); - } - } - - { - QString resultName = "TRANZ"; - cvf::ref nativeAccessObject = RigResultAccessorFactory::createNativeResultAccessor(eclipseCase, gridIndex, porosityModel, timeStepIndex, resultName); - if (nativeAccessObject.notNull()) - { - cellFaceAccessObject->setDataAccessObjectForFace(cvf::StructGridInterface::POS_K, nativeAccessObject.p()); - } - } + cvf::ref xTransAccessor = RigResultAccessorFactory::createNativeResultAccessor(eclipseCase, gridIndex, porosityModel, timeStepIndex, "TRANX"); + cvf::ref yTransAccessor = RigResultAccessorFactory::createNativeResultAccessor(eclipseCase, gridIndex, porosityModel, timeStepIndex, "TRANY"); + cvf::ref zTransAccessor = RigResultAccessorFactory::createNativeResultAccessor(eclipseCase, gridIndex, porosityModel, timeStepIndex, "TRANZ"); + + cellFaceAccessObject->setTransResultAccessors(xTransAccessor.p(), yTransAccessor.p(), zTransAccessor.p()); return cellFaceAccessObject; } diff --git a/ApplicationCode/ReservoirDataModel/RigResultAccessorFactory.h b/ApplicationCode/ReservoirDataModel/RigResultAccessorFactory.h index 8a6ca4bd89..6a4a414865 100644 --- a/ApplicationCode/ReservoirDataModel/RigResultAccessorFactory.h +++ b/ApplicationCode/ReservoirDataModel/RigResultAccessorFactory.h @@ -34,7 +34,7 @@ public: size_t gridIndex, RifReaderInterface::PorosityModelResultType porosityModel, size_t timeStepIndex, - QString& uiResultName); + const QString& uiResultName); // TO BE DELETED @@ -52,7 +52,7 @@ private: size_t gridIndex, RifReaderInterface::PorosityModelResultType porosityModel, size_t timeStepIndex, - QString& resultName); + const QString& resultName); };