mirror of
https://github.com/OPM/ResInsight.git
synced 2025-01-07 14:43:10 -06:00
Added ResultAccessObject for combined transmissibility
This commit is contained in:
parent
cba742d44c
commit
57494c4bfe
@ -15,6 +15,7 @@ ${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}RigCombTransResultAccessObject.h
|
||||
${CEE_CURRENT_LIST_DIR}RigLocalGrid.h
|
||||
${CEE_CURRENT_LIST_DIR}RigMainGrid.h
|
||||
${CEE_CURRENT_LIST_DIR}RigReservoirBuilderMock.h
|
||||
@ -39,6 +40,7 @@ ${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}RigCombTransResultAccessObject.cpp
|
||||
${CEE_CURRENT_LIST_DIR}RigLocalGrid.cpp
|
||||
${CEE_CURRENT_LIST_DIR}RigMainGrid.cpp
|
||||
${CEE_CURRENT_LIST_DIR}RigReservoirBuilderMock.cpp
|
||||
|
@ -18,6 +18,8 @@
|
||||
|
||||
#include "RigCellFaceResultAccessObject.h"
|
||||
|
||||
#include <cmath>
|
||||
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
|
@ -0,0 +1,157 @@
|
||||
/////////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// 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 <http://www.gnu.org/licenses/gpl.html>
|
||||
// for more details.
|
||||
//
|
||||
/////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#include "RigCombTransResultAccessObject.h"
|
||||
|
||||
#include "RigGridBase.h"
|
||||
|
||||
#include <cmath>
|
||||
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
RigCombTransResultAccessObject::RigCombTransResultAccessObject(const RigGridBase* grid, const QString& resultName)
|
||||
: m_grid(grid),
|
||||
m_resultName(resultName)
|
||||
{
|
||||
m_resultAccessObjects.resize(6);
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RigCombTransResultAccessObject::setDataAccessObjectForFace(cvf::StructGridInterface::FaceType faceId, RigResultAccessObject* resultAccessObject)
|
||||
{
|
||||
m_resultAccessObjects[faceId] = resultAccessObject;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
double RigCombTransResultAccessObject::cellScalar(size_t localCellIndex) const
|
||||
{
|
||||
|
||||
// TODO: How to handle when we get here?
|
||||
CVF_ASSERT(false);
|
||||
|
||||
return cvf::UNDEFINED_DOUBLE;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
double RigCombTransResultAccessObject::cellFaceScalar(size_t localCellIndex, cvf::StructGridInterface::FaceType faceId) const
|
||||
{
|
||||
switch (faceId)
|
||||
{
|
||||
case cvf::StructGridInterface::POS_I:
|
||||
{
|
||||
const RigResultAccessObject* resultAccessObj = m_resultAccessObjects.at(cvf::StructGridInterface::POS_I);
|
||||
if (resultAccessObj)
|
||||
{
|
||||
return resultAccessObj->cellScalar(localCellIndex);
|
||||
}
|
||||
}
|
||||
break;
|
||||
case cvf::StructGridInterface::NEG_I:
|
||||
{
|
||||
const RigResultAccessObject* resultAccessObj = m_resultAccessObjects.at(cvf::StructGridInterface::POS_I);
|
||||
if (resultAccessObj)
|
||||
{
|
||||
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);
|
||||
}
|
||||
}
|
||||
}
|
||||
break;
|
||||
case cvf::StructGridInterface::POS_J:
|
||||
{
|
||||
const RigResultAccessObject* resultAccessObj = m_resultAccessObjects.at(cvf::StructGridInterface::POS_J);
|
||||
if (resultAccessObj)
|
||||
{
|
||||
return resultAccessObj->cellScalar(localCellIndex);
|
||||
}
|
||||
}
|
||||
break;
|
||||
case cvf::StructGridInterface::NEG_J:
|
||||
{
|
||||
const RigResultAccessObject* resultAccessObj = m_resultAccessObjects.at(cvf::StructGridInterface::POS_J);
|
||||
if (resultAccessObj)
|
||||
{
|
||||
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);
|
||||
}
|
||||
}
|
||||
}
|
||||
break;
|
||||
case cvf::StructGridInterface::POS_K:
|
||||
{
|
||||
const RigResultAccessObject* resultAccessObj = m_resultAccessObjects.at(cvf::StructGridInterface::POS_K);
|
||||
if (resultAccessObj)
|
||||
{
|
||||
return resultAccessObj->cellScalar(localCellIndex);
|
||||
}
|
||||
}
|
||||
break;
|
||||
case cvf::StructGridInterface::NEG_K:
|
||||
{
|
||||
const RigResultAccessObject* resultAccessObj = m_resultAccessObjects.at(cvf::StructGridInterface::POS_K);
|
||||
if (resultAccessObj)
|
||||
{
|
||||
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);
|
||||
}
|
||||
}
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
return HUGE_VAL;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
QString RigCombTransResultAccessObject::resultName() const
|
||||
{
|
||||
return m_resultName;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RigCombTransResultAccessObject::setCellScalar(size_t localCellIndex, double scalarValue)
|
||||
{
|
||||
// TODO: How to handle when we get here?
|
||||
CVF_ASSERT(false);
|
||||
|
||||
}
|
||||
|
@ -0,0 +1,48 @@
|
||||
/////////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// 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 <http://www.gnu.org/licenses/gpl.html>
|
||||
// for more details.
|
||||
//
|
||||
/////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#pragma once
|
||||
|
||||
#include "RigResultAccessObject.h"
|
||||
|
||||
#include "cvfCollection.h"
|
||||
|
||||
class RigGridBase;
|
||||
|
||||
|
||||
//==================================================================================================
|
||||
///
|
||||
//==================================================================================================
|
||||
class RigCombTransResultAccessObject : public RigResultAccessObject
|
||||
{
|
||||
public:
|
||||
RigCombTransResultAccessObject(const RigGridBase* grid, 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<RigResultAccessObject> m_resultAccessObjects;
|
||||
|
||||
const RigGridBase* m_grid;
|
||||
QString m_resultName;
|
||||
};
|
@ -37,7 +37,6 @@
|
||||
|
||||
class RigMainGrid;
|
||||
class RigCell;
|
||||
class RigGridScalarDataAccess;
|
||||
class RigActiveCellInfo;
|
||||
|
||||
class RigGridBase : public cvf::StructGridInterface
|
||||
|
@ -18,6 +18,10 @@
|
||||
|
||||
#include "RigResultAccessObjectFactory.h"
|
||||
|
||||
#include "RigResultAccessObject.h"
|
||||
#include "RigActiveCellsResultAccessObject.h"
|
||||
#include "RigAllGridCellsResultAccessObject.h"
|
||||
|
||||
#include "cvfLibCore.h"
|
||||
#include "cvfBase.h"
|
||||
#include "cvfObject.h"
|
||||
@ -29,6 +33,84 @@
|
||||
#include "RigGridBase.h"
|
||||
#include "RigCaseData.h"
|
||||
#include <math.h>
|
||||
#include "RigCombTransResultAccessObject.h"
|
||||
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
cvf::ref<RigResultAccessObject> RigResultAccessObjectFactory::createNativeDataAccessObject(RigCaseData* eclipseCase,
|
||||
size_t gridIndex,
|
||||
RifReaderInterface::PorosityModelResultType porosityModel,
|
||||
size_t timeStepIndex,
|
||||
QString& uiResultName)
|
||||
{
|
||||
CVF_ASSERT(gridIndex < eclipseCase->gridCount());
|
||||
CVF_ASSERT(eclipseCase);
|
||||
CVF_ASSERT(eclipseCase->results(porosityModel));
|
||||
CVF_ASSERT(eclipseCase->activeCellInfo(porosityModel));
|
||||
|
||||
RigGridBase *grid = eclipseCase->grid(gridIndex);
|
||||
|
||||
if (!eclipseCase || !eclipseCase->results(porosityModel) || !eclipseCase->activeCellInfo(porosityModel))
|
||||
{
|
||||
return NULL;
|
||||
}
|
||||
|
||||
size_t scalarSetIndex = eclipseCase->results(porosityModel)->findScalarResultIndex(uiResultName);
|
||||
if (scalarSetIndex == cvf::UNDEFINED_SIZE_T)
|
||||
{
|
||||
return NULL;
|
||||
}
|
||||
|
||||
std::vector< std::vector<double> >& scalarSetResults = eclipseCase->results(porosityModel)->cellScalarResults(scalarSetIndex);
|
||||
|
||||
// A generated result with a generated results for a subset of time steps, will end up with a result container with less entries than time steps
|
||||
// See RiaSetGridProperty command in RiaPropertyDataCommands
|
||||
//
|
||||
// Some functions requires a valid data access object to be present, these might be rewritten to avoid this dummy object always returning HUGE_VAL
|
||||
if (timeStepIndex >= scalarSetResults.size())
|
||||
{
|
||||
return NULL;
|
||||
}
|
||||
|
||||
std::vector<double>* resultValues = NULL;
|
||||
if (timeStepIndex < scalarSetResults.size())
|
||||
{
|
||||
resultValues = &(scalarSetResults[timeStepIndex]);
|
||||
}
|
||||
|
||||
bool useGlobalActiveIndex = eclipseCase->results(porosityModel)->isUsingGlobalActiveIndex(scalarSetIndex);
|
||||
if (useGlobalActiveIndex)
|
||||
{
|
||||
cvf::ref<RigResultAccessObject> object = new RigActiveCellsResultAccessObject(grid, resultValues, eclipseCase->activeCellInfo(porosityModel), uiResultName);
|
||||
return object;
|
||||
}
|
||||
else
|
||||
{
|
||||
cvf::ref<RigResultAccessObject> object = new RigAllGridCellsResultAccessObject(grid, resultValues, uiResultName);
|
||||
return object;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
// Rest of this file is to be deleted
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
@ -196,3 +278,63 @@ cvf::ref<cvf::StructGridScalarDataAccess> RigResultAccessObjectFactory::TO_BE_DE
|
||||
}
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
cvf::ref<RigResultAccessObject> RigResultAccessObjectFactory::createResultAccessObject(RigCaseData* eclipseCase,
|
||||
size_t gridIndex,
|
||||
RifReaderInterface::PorosityModelResultType porosityModel,
|
||||
size_t timeStepIndex,
|
||||
QString& uiResultName)
|
||||
{
|
||||
CVF_ASSERT(gridIndex < eclipseCase->gridCount());
|
||||
CVF_ASSERT(eclipseCase);
|
||||
CVF_ASSERT(eclipseCase->results(porosityModel));
|
||||
CVF_ASSERT(eclipseCase->activeCellInfo(porosityModel));
|
||||
|
||||
RigGridBase* grid = eclipseCase->grid(gridIndex);
|
||||
|
||||
// Ternary
|
||||
if (uiResultName == RimDefines::ternarySaturationResultName())
|
||||
{
|
||||
return NULL;
|
||||
}
|
||||
else if (uiResultName == RimDefines::combinedTransmissibilityResultName())
|
||||
{
|
||||
// TODO
|
||||
// Taken from RivTransmissibilityColorMapper::updateCombinedTransmissibilityTextureCoordinates
|
||||
//
|
||||
|
||||
cvf::ref<RigCombTransResultAccessObject> cellFaceAccessObject = new RigCombTransResultAccessObject(grid, uiResultName);
|
||||
|
||||
{
|
||||
cvf::ref<RigResultAccessObject> nativeAccessObject = RigResultAccessObjectFactory::createNativeDataAccessObject(eclipseCase, gridIndex, porosityModel, timeStepIndex, QString("TRANX"));
|
||||
if (nativeAccessObject.notNull())
|
||||
{
|
||||
cellFaceAccessObject->setDataAccessObjectForFace(cvf::StructGridInterface::POS_I, nativeAccessObject.p());
|
||||
}
|
||||
}
|
||||
|
||||
{
|
||||
cvf::ref<RigResultAccessObject> nativeAccessObject = RigResultAccessObjectFactory::createNativeDataAccessObject(eclipseCase, gridIndex, porosityModel, timeStepIndex, QString("TRANY"));
|
||||
if (nativeAccessObject.notNull())
|
||||
{
|
||||
cellFaceAccessObject->setDataAccessObjectForFace(cvf::StructGridInterface::POS_J, nativeAccessObject.p());
|
||||
}
|
||||
}
|
||||
|
||||
{
|
||||
cvf::ref<RigResultAccessObject> nativeAccessObject = RigResultAccessObjectFactory::createNativeDataAccessObject(eclipseCase, gridIndex, porosityModel, timeStepIndex, QString("TRANZ"));
|
||||
if (nativeAccessObject.notNull())
|
||||
{
|
||||
cellFaceAccessObject->setDataAccessObjectForFace(cvf::StructGridInterface::POS_K, nativeAccessObject.p());
|
||||
}
|
||||
}
|
||||
|
||||
return cellFaceAccessObject;
|
||||
}
|
||||
|
||||
|
||||
return NULL;
|
||||
}
|
||||
|
||||
|
@ -24,24 +24,37 @@
|
||||
|
||||
class RigActiveCellInfo;
|
||||
class RigGridBase;
|
||||
class RigResultAccessObject;
|
||||
|
||||
class RigResultAccessObjectFactory
|
||||
{
|
||||
public:
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
static cvf::ref<RigResultAccessObject>
|
||||
createResultAccessObject(RigCaseData* eclipseCase,
|
||||
size_t gridIndex,
|
||||
RifReaderInterface::PorosityModelResultType porosityModel,
|
||||
size_t timeStepIndex,
|
||||
QString& uiResultName);
|
||||
|
||||
|
||||
// TO BE DELETED
|
||||
static cvf::ref<cvf::StructGridScalarDataAccess>
|
||||
TO_BE_DELETED_createNativeDataAccessObject(RigCaseData* eclipseCase,
|
||||
size_t gridIndex,
|
||||
RifReaderInterface::PorosityModelResultType porosityModel,
|
||||
size_t timeStepIndex,
|
||||
size_t scalarSetIndex);
|
||||
size_t gridIndex,
|
||||
RifReaderInterface::PorosityModelResultType porosityModel,
|
||||
size_t timeStepIndex,
|
||||
size_t scalarSetIndex);
|
||||
|
||||
|
||||
private:
|
||||
static cvf::ref<RigResultAccessObject>
|
||||
createNativeDataAccessObject(RigCaseData* eclipseCase,
|
||||
size_t gridIndex,
|
||||
RifReaderInterface::PorosityModelResultType porosityModel,
|
||||
size_t timeStepIndex,
|
||||
QString& resultName);
|
||||
|
||||
|
||||
};
|
||||
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user