mirror of
https://github.com/OPM/ResInsight.git
synced 2025-02-25 18:55:39 -06:00
#7400 Refactor: Extract methods for replacing values.
This commit is contained in:
parent
f6fe69ba45
commit
8ce620323e
@ -105,11 +105,7 @@ bool RimStimPlanModelWellLogCalculator::calculate( RiaDefines::CurveProperty cur
|
|||||||
|
|
||||||
if ( strategy == RimStimPlanModel::MissingValueStrategy::DEFAULT_VALUE )
|
if ( strategy == RimStimPlanModel::MissingValueStrategy::DEFAULT_VALUE )
|
||||||
{
|
{
|
||||||
QString resultVariable = stimPlanModel->eclipseResultVariable( curveProperty );
|
if ( !replaceMissingValuesWithDefault( curveProperty, stimPlanModel, values ) )
|
||||||
|
|
||||||
// Input properties must use first time step
|
|
||||||
int replacementTimeStep = 0;
|
|
||||||
if ( !replaceMissingValuesWithDefault( curveProperty, stimPlanModel, replacementTimeStep, resultVariable, values ) )
|
|
||||||
{
|
{
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
@ -120,24 +116,10 @@ bool RimStimPlanModelWellLogCalculator::calculate( RiaDefines::CurveProperty cur
|
|||||||
}
|
}
|
||||||
else if ( strategy == RimStimPlanModel::MissingValueStrategy::OTHER_CURVE_PROPERTY )
|
else if ( strategy == RimStimPlanModel::MissingValueStrategy::OTHER_CURVE_PROPERTY )
|
||||||
{
|
{
|
||||||
// Get the missing data from other curve
|
if ( !replaceMissingValuesWithOtherProperty( curveProperty, stimPlanModel, timeStep, values ) )
|
||||||
RiaDefines::CurveProperty replacementProperty =
|
|
||||||
stimPlanModel->getDefaultPropertyForMissingValues( curveProperty );
|
|
||||||
|
|
||||||
std::vector<double> initialValues;
|
|
||||||
std::vector<double> initialMds;
|
|
||||||
std::vector<double> initialTvds;
|
|
||||||
double initialRkbDiff = -1.0;
|
|
||||||
calculate( replacementProperty, stimPlanModel, timeStep, initialValues, initialMds, initialTvds, initialRkbDiff );
|
|
||||||
|
|
||||||
if ( initialValues.empty() )
|
|
||||||
{
|
{
|
||||||
RiaLogging::error( QString( "Empty replacement data found for fracture model curve." ) );
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
CVF_ASSERT( values.size() == initialValues.size() );
|
|
||||||
replaceMissingValues( values, initialValues );
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -427,8 +409,6 @@ bool RimStimPlanModelWellLogCalculator::extractValuesForProperty( RiaDefines::Cu
|
|||||||
//--------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------
|
||||||
bool RimStimPlanModelWellLogCalculator::replaceMissingValuesWithDefault( RiaDefines::CurveProperty curveProperty,
|
bool RimStimPlanModelWellLogCalculator::replaceMissingValuesWithDefault( RiaDefines::CurveProperty curveProperty,
|
||||||
const RimStimPlanModel* stimPlanModel,
|
const RimStimPlanModel* stimPlanModel,
|
||||||
int timeStep,
|
|
||||||
const QString& resultVariable,
|
|
||||||
std::vector<double>& values ) const
|
std::vector<double>& values ) const
|
||||||
|
|
||||||
{
|
{
|
||||||
@ -446,11 +426,16 @@ bool RimStimPlanModelWellLogCalculator::replaceMissingValuesWithDefault( RiaDefi
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Input properties must use first time step
|
||||||
|
int replacementTimeStep = 0;
|
||||||
|
|
||||||
|
QString resultVariable = stimPlanModel->eclipseResultVariable( curveProperty );
|
||||||
|
|
||||||
// Try to locate a backup accessor (e.g. PORO_1 for PORO)
|
// Try to locate a backup accessor (e.g. PORO_1 for PORO)
|
||||||
cvf::ref<RigResultAccessor> backupResAcc = findMissingValuesAccessor( eclipseCase->eclipseCaseData(),
|
cvf::ref<RigResultAccessor> backupResAcc = findMissingValuesAccessor( eclipseCase->eclipseCaseData(),
|
||||||
eclipseCase->inputPropertyCollection(),
|
eclipseCase->inputPropertyCollection(),
|
||||||
0,
|
0,
|
||||||
timeStep,
|
replacementTimeStep,
|
||||||
resultVariable );
|
resultVariable );
|
||||||
|
|
||||||
if ( backupResAcc.notNull() )
|
if ( backupResAcc.notNull() )
|
||||||
@ -500,3 +485,28 @@ bool RimStimPlanModelWellLogCalculator::replaceMissingValuesWithDefault( RiaDefi
|
|||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool RimStimPlanModelWellLogCalculator::replaceMissingValuesWithOtherProperty( RiaDefines::CurveProperty curveProperty,
|
||||||
|
const RimStimPlanModel* stimPlanModel,
|
||||||
|
int timeStep,
|
||||||
|
std::vector<double>& values ) const
|
||||||
|
{
|
||||||
|
// Get the missing data from other curve
|
||||||
|
RiaDefines::CurveProperty replacementProperty = stimPlanModel->getDefaultPropertyForMissingValues( curveProperty );
|
||||||
|
|
||||||
|
std::vector<double> initialValues;
|
||||||
|
std::vector<double> initialMds;
|
||||||
|
std::vector<double> initialTvds;
|
||||||
|
double initialRkbDiff = -1.0;
|
||||||
|
calculate( replacementProperty, stimPlanModel, timeStep, initialValues, initialMds, initialTvds, initialRkbDiff );
|
||||||
|
|
||||||
|
if ( initialValues.empty() )
|
||||||
|
{
|
||||||
|
RiaLogging::error( QString( "Empty replacement data found for fracture model curve." ) );
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
CVF_ASSERT( values.size() == initialValues.size() );
|
||||||
|
replaceMissingValues( values, initialValues );
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
@ -81,9 +81,12 @@ protected:
|
|||||||
double& rkbDiff ) const;
|
double& rkbDiff ) const;
|
||||||
|
|
||||||
bool replaceMissingValuesWithDefault( RiaDefines::CurveProperty curveProperty,
|
bool replaceMissingValuesWithDefault( RiaDefines::CurveProperty curveProperty,
|
||||||
|
const RimStimPlanModel* stimPlanModel,
|
||||||
|
std::vector<double>& values ) const;
|
||||||
|
|
||||||
|
bool replaceMissingValuesWithOtherProperty( RiaDefines::CurveProperty curveProperty,
|
||||||
const RimStimPlanModel* stimPlanModel,
|
const RimStimPlanModel* stimPlanModel,
|
||||||
int timeStep,
|
int timeStep,
|
||||||
const QString& resultVariable,
|
|
||||||
std::vector<double>& values ) const;
|
std::vector<double>& values ) const;
|
||||||
|
|
||||||
RimStimPlanModelCalculator* m_stimPlanModelCalculator;
|
RimStimPlanModelCalculator* m_stimPlanModelCalculator;
|
||||||
|
Loading…
Reference in New Issue
Block a user