mirror of
https://github.com/OPM/ResInsight.git
synced 2025-02-25 18:55:39 -06:00
#7452 Refactor: Extract method
This commit is contained in:
@@ -120,20 +120,16 @@ bool RimStimPlanModelPressureCalculator::extractValuesForProperty( RiaDefines::C
|
||||
std::vector<double> staticMeasuredDepthValues;
|
||||
std::vector<double> faciesValues;
|
||||
|
||||
{
|
||||
std::vector<double> dummyValues;
|
||||
double dummyRkbDiff;
|
||||
if ( !RimStimPlanModelWellLogCalculator::extractValuesForProperty( RiaDefines::CurveProperty::FACIES,
|
||||
stimPlanModel,
|
||||
timeStep,
|
||||
faciesValues,
|
||||
staticMeasuredDepthValues,
|
||||
staticTvDepthValues,
|
||||
dummyRkbDiff ) )
|
||||
rkbDiff ) )
|
||||
{
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
RiaDefines::CurveProperty pressureCurveProperty = curveProperty;
|
||||
if ( curveProperty == RiaDefines::CurveProperty::PRESSURE_GRADIENT )
|
||||
@@ -164,6 +160,62 @@ bool RimStimPlanModelPressureCalculator::extractValuesForProperty( RiaDefines::C
|
||||
|
||||
if ( staticTvDepthValues.size() != tvDepthValues.size() )
|
||||
{
|
||||
auto [tvds, mds, results] =
|
||||
interpolateMissingValues( staticTvDepthValues, staticMeasuredDepthValues, measuredDepthValues, values );
|
||||
tvDepthValues = tvds;
|
||||
measuredDepthValues = mds;
|
||||
values = results;
|
||||
}
|
||||
|
||||
if ( curveProperty == RiaDefines::CurveProperty::INITIAL_PRESSURE )
|
||||
{
|
||||
bool hasMissingValues = std::find( values.begin(), values.end(), std::numeric_limits<double>::infinity() ) !=
|
||||
values.end();
|
||||
if ( hasMissingValues )
|
||||
{
|
||||
if ( !interpolateInitialPressureByEquilibrationRegion( curveProperty,
|
||||
stimPlanModel,
|
||||
timeStep,
|
||||
measuredDepthValues,
|
||||
tvDepthValues,
|
||||
values ) )
|
||||
{
|
||||
RiaLogging::error( "Pressure interpolation by equilibration region failed." );
|
||||
}
|
||||
}
|
||||
}
|
||||
else if ( curveProperty == RiaDefines::CurveProperty::PRESSURE_GRADIENT )
|
||||
{
|
||||
std::vector<double> initialPressureValues = values;
|
||||
values.clear();
|
||||
if ( !interpolatePressureDifferenceByEquilibrationRegion( curveProperty,
|
||||
stimPlanModel,
|
||||
timeStep,
|
||||
measuredDepthValues,
|
||||
tvDepthValues,
|
||||
initialPressureValues,
|
||||
values ) )
|
||||
{
|
||||
RiaLogging::error( "Pressure interpolation by equilibration region failed." );
|
||||
}
|
||||
}
|
||||
else if ( curveProperty == RiaDefines::CurveProperty::PRESSURE )
|
||||
{
|
||||
if ( !handleFaciesWithInitialPressure( stimPlanModel, timeStep, faciesValues, values ) )
|
||||
{
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
std::tuple<std::vector<double>, std::vector<double>, std::vector<double>>
|
||||
RimStimPlanModelPressureCalculator::interpolateMissingValues( const std::vector<double>& staticTvDepthValues,
|
||||
const std::vector<double>& staticMeasuredDepthValues,
|
||||
const std::vector<double>& measuredDepthValues,
|
||||
const std::vector<double>& values )
|
||||
{
|
||||
// Populate the original tvds/mds with interpolated values
|
||||
std::vector<double> tvds;
|
||||
std::vector<double> mds;
|
||||
@@ -224,52 +276,7 @@ bool RimStimPlanModelPressureCalculator::extractValuesForProperty( RiaDefines::C
|
||||
mds.push_back( md );
|
||||
}
|
||||
|
||||
tvDepthValues = tvds;
|
||||
measuredDepthValues = mds;
|
||||
values = results;
|
||||
}
|
||||
|
||||
if ( curveProperty == RiaDefines::CurveProperty::INITIAL_PRESSURE )
|
||||
{
|
||||
bool hasMissingValues = std::find( values.begin(), values.end(), std::numeric_limits<double>::infinity() ) !=
|
||||
values.end();
|
||||
if ( hasMissingValues )
|
||||
{
|
||||
if ( !interpolateInitialPressureByEquilibrationRegion( curveProperty,
|
||||
stimPlanModel,
|
||||
timeStep,
|
||||
measuredDepthValues,
|
||||
tvDepthValues,
|
||||
values ) )
|
||||
{
|
||||
RiaLogging::error( "Pressure interpolation by equilibration region failed." );
|
||||
}
|
||||
}
|
||||
}
|
||||
else if ( curveProperty == RiaDefines::CurveProperty::PRESSURE_GRADIENT )
|
||||
{
|
||||
std::vector<double> initialPressureValues = values;
|
||||
values.clear();
|
||||
if ( !interpolatePressureDifferenceByEquilibrationRegion( curveProperty,
|
||||
stimPlanModel,
|
||||
timeStep,
|
||||
measuredDepthValues,
|
||||
tvDepthValues,
|
||||
initialPressureValues,
|
||||
values ) )
|
||||
{
|
||||
RiaLogging::error( "Pressure interpolation by equilibration region failed." );
|
||||
}
|
||||
}
|
||||
else if ( curveProperty == RiaDefines::CurveProperty::PRESSURE )
|
||||
{
|
||||
if ( !handleFaciesWithInitialPressure( stimPlanModel, timeStep, faciesValues, values ) )
|
||||
{
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
return true;
|
||||
return std::make_tuple( tvds, mds, results );
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
@@ -326,6 +333,9 @@ bool RimStimPlanModelPressureCalculator::extractPressureDataFromTable( RiaDefine
|
||||
return true;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
std::set<int> RimStimPlanModelPressureCalculator::findUniqueValues( const std::vector<double>& values )
|
||||
{
|
||||
std::set<int> res;
|
||||
|
||||
@@ -78,6 +78,12 @@ protected:
|
||||
const std::vector<double>& faciesValues,
|
||||
std::vector<double>& values ) const;
|
||||
|
||||
static std::tuple<std::vector<double>, std::vector<double>, std::vector<double>>
|
||||
interpolateMissingValues( const std::vector<double>& staticTvDepthValues,
|
||||
const std::vector<double>& staticMeasuredDepthValues,
|
||||
const std::vector<double>& measuredDepthValues,
|
||||
const std::vector<double>& values );
|
||||
|
||||
typedef std::pair<double, double> DepthValuePair;
|
||||
typedef std::vector<DepthValuePair> DepthValuePairVector;
|
||||
typedef std::map<int, DepthValuePairVector> EqlNumToDepthValuePairMap;
|
||||
|
||||
Reference in New Issue
Block a user