Improved result accessor factory

Moved clamping of time step to zero for static results into factory
This commit is contained in:
Magne Sjaastad 2015-12-09 09:17:13 +01:00
parent e9b18e05fe
commit 28a0e1107c
6 changed files with 46 additions and 36 deletions

View File

@ -126,17 +126,10 @@ void RivCrossSectionPartMgr::updateCellResultColor(size_t timeStepIndex)
}
else
{
size_t adjustedTimeStepIndex = timeStepIndex;
if (cellResultColors->hasStaticResult())
{
adjustedTimeStepIndex = 0;
}
resultAccessor = RigResultAccessorFactory::createResultAccessor(cellResultColors->reservoirView()->eclipseCase()->reservoirData(),
0,
RigCaseCellResultsData::convertFromProjectModelPorosityModel(cellResultColors->porosityModel()),
adjustedTimeStepIndex,
cellResultColors->resultVariable());
timeStepIndex,
cellResultColors);
}
RivCrossSectionPartMgr::calculateEclipseTextureCoordinates(m_crossSectionFacesTextureCoords.p(),

View File

@ -785,20 +785,11 @@ void RivReservoirViewPartMgr::computePropertyVisibility(cvf::UByteArray* cellVis
const double lowerBound = propertyFilter->lowerBound();
const double upperBound = propertyFilter->upperBound();
size_t adjustedTimeStepIndex = timeStepIndex;
// Set time step to zero for static results
if (propertyFilter->resultDefinition()->hasStaticResult())
{
adjustedTimeStepIndex = 0;
}
const RimCellFilter::FilterModeType filterType = propertyFilter->filterMode();
RifReaderInterface::PorosityModelResultType porosityModel = RigCaseCellResultsData::convertFromProjectModelPorosityModel(propertyFilter->resultDefinition()->porosityModel());
RigCaseData* eclipseCase = propFilterColl->reservoirView()->eclipseCase()->reservoirData();
cvf::ref<RigResultAccessor> resultAccessor = RigResultAccessorFactory::createResultAccessor(eclipseCase, grid->gridIndex(), porosityModel, adjustedTimeStepIndex, propertyFilter->resultDefinition->resultVariable(), propertyFilter->resultDefinition->resultType());
cvf::ref<RigResultAccessor> resultAccessor = RigResultAccessorFactory::createResultAccessor(eclipseCase, grid->gridIndex(), timeStepIndex, propertyFilter->resultDefinition());
CVF_ASSERT(resultAccessor.notNull());
//#pragma omp parallel for schedule(dynamic)

View File

@ -39,13 +39,7 @@ RivTextureCoordsCreator::RivTextureCoordsCreator(RimEclipseCellColors* cellResul
m_quadMapper = quadMapper;
CVF_ASSERT(quadMapper && eclipseCase );
size_t resTimeStepIdx = timeStepIndex;
if (cellResultColors->hasStaticResult()) resTimeStepIdx = 0;
RifReaderInterface::PorosityModelResultType porosityModel = RigCaseCellResultsData::convertFromProjectModelPorosityModel(cellResultColors->porosityModel());
m_resultAccessor = RigResultAccessorFactory::createResultAccessor(eclipseCase, gridIndex, porosityModel, resTimeStepIdx, cellResultColors->resultVariable());
m_resultAccessor = RigResultAccessorFactory::createResultAccessor(eclipseCase, gridIndex, timeStepIndex, cellResultColors);
cvf::ref<RigPipeInCellEvaluator> pipeInCellEval = new RigPipeInCellEvaluator(cellResultColors->reservoirView()->wellCollection()->isWellPipesVisible(timeStepIndex),
eclipseCase->gridCellToWellIndex(gridIndex));

View File

@ -213,14 +213,11 @@ void RimWellLogExtractionCurve::updatePlotData()
tvDepthValues = eclExtractor->trueVerticalDepth();
}
RifReaderInterface::PorosityModelResultType porosityModel = RigCaseCellResultsData::convertFromProjectModelPorosityModel(m_eclipseResultDefinition->porosityModel());
m_eclipseResultDefinition->loadResult();
cvf::ref<RigResultAccessor> resAcc = RigResultAccessorFactory::createResultAccessor(
eclipseCase->reservoirData(), 0,
porosityModel,
eclipseCase->reservoirData(),
0,
m_timeStep,
m_eclipseResultDefinition->resultVariable());
m_eclipseResultDefinition);
if (resAcc.notNull())
{

View File

@ -30,6 +30,8 @@
#include "RigMainGrid.h"
#include "RigResultAccessor.h"
#include "RimEclipseResultDefinition.h"
#include "cvfAssert.h"
#include "cvfBase.h"
#include "cvfLibCore.h"
@ -145,7 +147,34 @@ cvf::ref<RigResultAccessor> RigResultAccessorFactory::createResultAccessor(RigCa
return NULL;
}
return createResultAccessor(eclipseCase, gridIndex, porosityModel, timeStepIndex, scalarSetIndex);
size_t adjustedTimeStepIndex = timeStepIndex;
if (resultType == RimDefines::STATIC_NATIVE)
{
adjustedTimeStepIndex = 0;
}
return createResultAccessor(eclipseCase, gridIndex, porosityModel, adjustedTimeStepIndex, scalarSetIndex);
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
cvf::ref<RigResultAccessor> RigResultAccessorFactory::createResultAccessor(RigCaseData* eclipseCase, size_t gridIndex, size_t timeStepIndex, RimEclipseResultDefinition* resultDefinition)
{
RifReaderInterface::PorosityModelResultType porosityModel = RigCaseCellResultsData::convertFromProjectModelPorosityModel(resultDefinition->porosityModel());
resultDefinition->loadResult();
size_t adjustedTimeStepIndex = timeStepIndex;
if (resultDefinition->hasStaticResult())
{
adjustedTimeStepIndex = 0;
}
return RigResultAccessorFactory::createResultAccessor(
eclipseCase, 0,
porosityModel,
adjustedTimeStepIndex,
resultDefinition->resultVariable());
}
//--------------------------------------------------------------------------------------------------

View File

@ -21,14 +21,23 @@
#include "RifReaderInterface.h"
#include "RigResultAccessor.h"
#include "RimDefines.h"
class RigActiveCellInfo;
class RigGridBase;
class RimEclipseResultDefinition;
class RigResultAccessorFactory
{
public:
static cvf::ref<RigResultAccessor>
createResultAccessor(RigCaseData* eclipseCase,
size_t gridIndex,
size_t timeStepIndex,
RimEclipseResultDefinition* resultDefinition);
static cvf::ref<RigResultAccessor>
createResultAccessor(RigCaseData* eclipseCase,
size_t gridIndex,
@ -51,8 +60,6 @@ public:
size_t timeStepIndex,
size_t resultIndex);
private:
static cvf::ref<RigResultAccessor>
createNativeResultAccessor(RigCaseData* eclipseCase,
@ -61,7 +68,6 @@ private:
size_t timeStepIndex,
const QString& resultName);
};