mirror of
https://github.com/OPM/ResInsight.git
synced 2025-02-25 18:55:39 -06:00
Added overload to result accessor factory
This commit is contained in:
parent
77c8edf348
commit
f023ec98e8
@ -36,6 +36,69 @@
|
|||||||
#include "RigCombTransResultAccessor.h"
|
#include "RigCombTransResultAccessor.h"
|
||||||
|
|
||||||
|
|
||||||
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
///
|
||||||
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
cvf::ref<RigResultAccessor> RigResultAccessorFactory::createResultAccessor(RigCaseData* eclipseCase,
|
||||||
|
size_t gridIndex,
|
||||||
|
RifReaderInterface::PorosityModelResultType porosityModel,
|
||||||
|
size_t timeStepIndex,
|
||||||
|
const 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 (uiResultName == RimDefines::combinedTransmissibilityResultName())
|
||||||
|
{
|
||||||
|
cvf::ref<RigCombTransResultAccessor> cellFaceAccessObject = new RigCombTransResultAccessor(grid);
|
||||||
|
|
||||||
|
cvf::ref<RigResultAccessor> xTransAccessor = RigResultAccessorFactory::createNativeResultAccessor(eclipseCase, gridIndex, porosityModel, timeStepIndex, "TRANX");
|
||||||
|
cvf::ref<RigResultAccessor> yTransAccessor = RigResultAccessorFactory::createNativeResultAccessor(eclipseCase, gridIndex, porosityModel, timeStepIndex, "TRANY");
|
||||||
|
cvf::ref<RigResultAccessor> zTransAccessor = RigResultAccessorFactory::createNativeResultAccessor(eclipseCase, gridIndex, porosityModel, timeStepIndex, "TRANZ");
|
||||||
|
|
||||||
|
cellFaceAccessObject->setTransResultAccessors(xTransAccessor.p(), yTransAccessor.p(), zTransAccessor.p());
|
||||||
|
|
||||||
|
return cellFaceAccessObject;
|
||||||
|
}
|
||||||
|
|
||||||
|
return RigResultAccessorFactory::createNativeResultAccessor(eclipseCase, gridIndex, porosityModel, timeStepIndex, uiResultName);
|
||||||
|
}
|
||||||
|
|
||||||
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
///
|
||||||
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
cvf::ref<RigResultAccessor> RigResultAccessorFactory::createResultAccessor(RigCaseData* eclipseCase,
|
||||||
|
size_t gridIndex,
|
||||||
|
RifReaderInterface::PorosityModelResultType porosityModel,
|
||||||
|
size_t timeStepIndex,
|
||||||
|
const QString& uiResultName,
|
||||||
|
RimDefines::ResultCatType resultType)
|
||||||
|
{
|
||||||
|
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(resultType, uiResultName);
|
||||||
|
if (scalarSetIndex == cvf::UNDEFINED_SIZE_T)
|
||||||
|
{
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
|
||||||
|
return createResultAccessor(eclipseCase, gridIndex, porosityModel, timeStepIndex, scalarSetIndex);
|
||||||
|
}
|
||||||
|
|
||||||
//--------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------
|
||||||
/// This function must be harmonized with RigResultModifierFactory::createResultModifier()
|
/// This function must be harmonized with RigResultModifierFactory::createResultModifier()
|
||||||
//--------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------
|
||||||
@ -63,64 +126,46 @@ cvf::ref<RigResultAccessor> RigResultAccessorFactory::createNativeResultAccessor
|
|||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
std::vector< std::vector<double> >& scalarSetResults = eclipseCase->results(porosityModel)->cellScalarResults(scalarSetIndex);
|
return createResultAccessor(eclipseCase, gridIndex, porosityModel, timeStepIndex, scalarSetIndex);
|
||||||
|
|
||||||
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<RigResultAccessor> object = new RigActiveCellsResultAccessor(grid, resultValues, eclipseCase->activeCellInfo(porosityModel));
|
|
||||||
return object;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
cvf::ref<RigResultAccessor> object = new RigAllGridCellsResultAccessor(grid, resultValues);
|
|
||||||
return object;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
//--------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------
|
||||||
///
|
///
|
||||||
//--------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------
|
||||||
cvf::ref<RigResultAccessor> RigResultAccessorFactory::createResultAccessor(RigCaseData* eclipseCase,
|
cvf::ref<RigResultAccessor> RigResultAccessorFactory::createResultAccessor(RigCaseData* eclipseCase,
|
||||||
size_t gridIndex,
|
size_t gridIndex,
|
||||||
RifReaderInterface::PorosityModelResultType porosityModel,
|
RifReaderInterface::PorosityModelResultType porosityModel,
|
||||||
size_t timeStepIndex,
|
size_t timeStepIndex,
|
||||||
const QString& uiResultName)
|
size_t resultIndex)
|
||||||
{
|
{
|
||||||
CVF_ASSERT(gridIndex < eclipseCase->gridCount());
|
if (!eclipseCase) return NULL;
|
||||||
CVF_ASSERT(eclipseCase);
|
|
||||||
CVF_ASSERT(eclipseCase->results(porosityModel));
|
|
||||||
CVF_ASSERT(eclipseCase->activeCellInfo(porosityModel));
|
|
||||||
|
|
||||||
RigGridBase* grid = eclipseCase->grid(gridIndex);
|
RigGridBase* grid = eclipseCase->grid(gridIndex);
|
||||||
|
if (!grid) return NULL;
|
||||||
|
|
||||||
if (uiResultName == RimDefines::combinedTransmissibilityResultName())
|
std::vector< std::vector<double> >& scalarSetResults = eclipseCase->results(porosityModel)->cellScalarResults(resultIndex);
|
||||||
{
|
if (timeStepIndex >= scalarSetResults.size())
|
||||||
cvf::ref<RigCombTransResultAccessor> cellFaceAccessObject = new RigCombTransResultAccessor(grid);
|
{
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
|
||||||
cvf::ref<RigResultAccessor> xTransAccessor = RigResultAccessorFactory::createNativeResultAccessor(eclipseCase, gridIndex, porosityModel, timeStepIndex, "TRANX");
|
std::vector<double>* resultValues = NULL;
|
||||||
cvf::ref<RigResultAccessor> yTransAccessor = RigResultAccessorFactory::createNativeResultAccessor(eclipseCase, gridIndex, porosityModel, timeStepIndex, "TRANY");
|
if (timeStepIndex < scalarSetResults.size())
|
||||||
cvf::ref<RigResultAccessor> zTransAccessor = RigResultAccessorFactory::createNativeResultAccessor(eclipseCase, gridIndex, porosityModel, timeStepIndex, "TRANZ");
|
{
|
||||||
|
resultValues = &(scalarSetResults[timeStepIndex]);
|
||||||
|
}
|
||||||
|
|
||||||
cellFaceAccessObject->setTransResultAccessors(xTransAccessor.p(), yTransAccessor.p(), zTransAccessor.p());
|
bool useGlobalActiveIndex = eclipseCase->results(porosityModel)->isUsingGlobalActiveIndex(resultIndex);
|
||||||
|
if (useGlobalActiveIndex)
|
||||||
return cellFaceAccessObject;
|
{
|
||||||
}
|
cvf::ref<RigResultAccessor> object = new RigActiveCellsResultAccessor(grid, resultValues, eclipseCase->activeCellInfo(porosityModel));
|
||||||
|
return object;
|
||||||
return RigResultAccessorFactory::createNativeResultAccessor(eclipseCase, gridIndex, porosityModel, timeStepIndex, uiResultName);
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
cvf::ref<RigResultAccessor> object = new RigAllGridCellsResultAccessor(grid, resultValues);
|
||||||
|
return object;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -18,9 +18,10 @@
|
|||||||
|
|
||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
#include "cvfStructGridScalarDataAccess.h"
|
|
||||||
#include "RifReaderInterface.h"
|
#include "RifReaderInterface.h"
|
||||||
|
#include "RimDefines.h"
|
||||||
|
|
||||||
|
#include "cvfStructGridScalarDataAccess.h"
|
||||||
|
|
||||||
class RigActiveCellInfo;
|
class RigActiveCellInfo;
|
||||||
class RigGridBase;
|
class RigGridBase;
|
||||||
@ -36,6 +37,14 @@ public:
|
|||||||
size_t timeStepIndex,
|
size_t timeStepIndex,
|
||||||
const QString& uiResultName);
|
const QString& uiResultName);
|
||||||
|
|
||||||
|
static cvf::ref<RigResultAccessor>
|
||||||
|
createResultAccessor(RigCaseData* eclipseCase,
|
||||||
|
size_t gridIndex,
|
||||||
|
RifReaderInterface::PorosityModelResultType porosityModel,
|
||||||
|
size_t timeStepIndex,
|
||||||
|
const QString& uiResultName,
|
||||||
|
RimDefines::ResultCatType resultType);
|
||||||
|
|
||||||
|
|
||||||
// TO BE DELETED
|
// TO BE DELETED
|
||||||
static cvf::ref<cvf::StructGridScalarDataAccess>
|
static cvf::ref<cvf::StructGridScalarDataAccess>
|
||||||
@ -54,6 +63,12 @@ private:
|
|||||||
size_t timeStepIndex,
|
size_t timeStepIndex,
|
||||||
const QString& resultName);
|
const QString& resultName);
|
||||||
|
|
||||||
|
static cvf::ref<RigResultAccessor>
|
||||||
|
createResultAccessor(RigCaseData* eclipseCase,
|
||||||
|
size_t gridIndex,
|
||||||
|
RifReaderInterface::PorosityModelResultType porosityModel,
|
||||||
|
size_t timeStepIndex,
|
||||||
|
size_t resultIndex);
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user