Minor refactor: extract method extracting values.

This commit is contained in:
Kristian Bendiksen 2024-01-05 12:57:39 +01:00 committed by jonjenssen
parent 45c32a4ebb
commit f81dcbd2dc
3 changed files with 32 additions and 13 deletions

View File

@ -103,22 +103,11 @@ double RimFaultReactivationDataAccessorPorePressure::valueAtPosition( const cvf:
CAF_ASSERT( m_extractors.find( gridPart ) != m_extractors.end() );
auto extractor = m_extractors.find( gridPart )->second;
// Extract values along well path
std::vector<double> values;
extractor->curveData( m_resultAccessor.p(), &values );
auto intersections = extractor->intersections();
CAF_ASSERT( m_wellPaths.find( gridPart ) != m_wellPaths.end() );
auto wellPath = m_wellPaths.find( gridPart )->second;
// Insert top of overburden point
intersections.insert( intersections.begin(), wellPath->wellPathPoints().front() );
values.insert( values.begin(), std::numeric_limits<double>::infinity() );
// Insert bottom of underburden point
intersections.push_back( wellPath->wellPathPoints().back() );
values.push_back( std::numeric_limits<double>::infinity() );
auto [values, intersections] =
RimFaultReactivationDataAccessorWellLogExtraction::extractValuesAndIntersections( *m_resultAccessor.p(), *extractor.p(), *wellPath );
auto [value, pos] =
RimFaultReactivationDataAccessorWellLogExtraction::calculatePorBar( intersections, values, position, m_defaultPorePressureGradient );

View File

@ -277,3 +277,28 @@ std::pair<std::map<RimFaultReactivation::GridPart, cvf::ref<RigWellPath>>, std::
return { wellPaths, extractors };
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
std::pair<std::vector<double>, std::vector<cvf::Vec3d>>
RimFaultReactivationDataAccessorWellLogExtraction::extractValuesAndIntersections( const RigResultAccessor& resultAccessor,
RigEclipseWellLogExtractor& extractor,
const RigWellPath& wellPath )
{
// Extract values along well path
std::vector<double> values;
extractor.curveData( &resultAccessor, &values );
auto intersections = extractor.intersections();
// Insert top of overburden point
intersections.insert( intersections.begin(), wellPath.wellPathPoints().front() );
values.insert( values.begin(), std::numeric_limits<double>::infinity() );
// Insert bottom of underburden point
intersections.push_back( wellPath.wellPathPoints().back() );
values.push_back( std::numeric_limits<double>::infinity() );
return { values, intersections };
}

View File

@ -28,6 +28,7 @@
class RigWellPath;
class RigEclipseWellLogExtractor;
class RigEclipseCaseData;
class RigResultAccessor;
//==================================================================================================
///
@ -51,6 +52,10 @@ public:
static std::vector<double> generateMds( const std::vector<cvf::Vec3d>& points );
static std::pair<std::vector<double>, std::vector<cvf::Vec3d>> extractValuesAndIntersections( const RigResultAccessor& resultAccessor,
RigEclipseWellLogExtractor& extractor,
const RigWellPath& wellPath );
protected:
static std::pair<int, int> findIntersectionsForTvd( const std::vector<cvf::Vec3d>& intersections, double tvd );
static std::pair<int, int> findOverburdenAndUnderburdenIndex( const std::vector<double>& values );