Refactor: Extract methods for creating well paths and extractors.

This commit is contained in:
Kristian Bendiksen 2024-01-05 10:58:24 +01:00 committed by jonjenssen
parent 33c24a219c
commit 45c32a4ebb
3 changed files with 52 additions and 23 deletions

View File

@ -75,25 +75,9 @@ void RimFaultReactivationDataAccessorPorePressure::updateResultAccessor()
m_resultAccessor =
RigResultAccessorFactory::createFromResultAddress( m_caseData, 0, RiaDefines::PorosityModelType::MATRIX_MODEL, m_timeStep, resVarAddress );
auto [faultTopPosition, faultBottomPosition] = m_model->faultTopBottom();
auto faultNormal = m_model->faultNormal();
double distanceFromFault = 1.0;
for ( auto gridPart : m_model->allGridParts() )
{
double sign = m_model->normalPointsAt() == gridPart ? 1.0 : -1.0;
std::vector<cvf::Vec3d> wellPoints =
RimFaultReactivationDataAccessorWellLogExtraction::generateWellPoints( faultTopPosition,
faultBottomPosition,
sign * faultNormal * distanceFromFault );
cvf::ref<RigWellPath> wellPath =
new RigWellPath( wellPoints, RimFaultReactivationDataAccessorWellLogExtraction::generateMds( wellPoints ) );
m_wellPaths[gridPart] = wellPath;
std::string errorName = "fault reactivation data access";
cvf::ref<RigEclipseWellLogExtractor> extractor = new RigEclipseWellLogExtractor( m_caseData, wellPath.p(), errorName );
m_extractors[gridPart] = extractor;
}
auto [wellPaths, extractors] = RimFaultReactivationDataAccessorWellLogExtraction::createEclipseWellPathExtractors( *m_model, *m_caseData );
m_wellPaths = wellPaths;
m_extractors = extractors;
}
//--------------------------------------------------------------------------------------------------

View File

@ -22,6 +22,7 @@
#include "RiaInterpolationTools.h"
#include "RiaLogging.h"
#include "RigEclipseWellLogExtractor.h"
#include "RigFaultReactivationModel.h"
#include "RigFemAddressDefines.h"
#include "RigFemPartCollection.h"
@ -62,9 +63,9 @@ RimFaultReactivationDataAccessorWellLogExtraction::~RimFaultReactivationDataAcce
///
//--------------------------------------------------------------------------------------------------
std::pair<double, cvf::Vec3d> RimFaultReactivationDataAccessorWellLogExtraction::calculatePorBar( const std::vector<cvf::Vec3d>& intersections,
std::vector<double>& values,
const cvf::Vec3d& position,
double gradient )
std::vector<double>& values,
const cvf::Vec3d& position,
double gradient )
{
// Fill in missing values
fillInMissingValues( intersections, values, gradient );
@ -98,7 +99,7 @@ std::pair<double, cvf::Vec3d> RimFaultReactivationDataAccessorWellLogExtraction:
///
//--------------------------------------------------------------------------------------------------
std::pair<int, int> RimFaultReactivationDataAccessorWellLogExtraction::findIntersectionsForTvd( const std::vector<cvf::Vec3d>& intersections,
double tvd )
double tvd )
{
int topIdx = -1;
int bottomIdx = -1;
@ -243,3 +244,36 @@ std::vector<double> RimFaultReactivationDataAccessorWellLogExtraction::generateM
}
return mds;
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
std::pair<std::map<RimFaultReactivation::GridPart, cvf::ref<RigWellPath>>, std::map<RimFaultReactivation::GridPart, cvf::ref<RigEclipseWellLogExtractor>>>
RimFaultReactivationDataAccessorWellLogExtraction::createEclipseWellPathExtractors( const RigFaultReactivationModel& model,
RigEclipseCaseData& eclipseCaseData )
{
auto [faultTopPosition, faultBottomPosition] = model.faultTopBottom();
auto faultNormal = model.faultNormal();
double distanceFromFault = 1.0;
std::map<RimFaultReactivation::GridPart, cvf::ref<RigWellPath>> wellPaths;
std::map<RimFaultReactivation::GridPart, cvf::ref<RigEclipseWellLogExtractor>> extractors;
for ( auto gridPart : model.allGridParts() )
{
double sign = model.normalPointsAt() == gridPart ? 1.0 : -1.0;
std::vector<cvf::Vec3d> wellPoints =
RimFaultReactivationDataAccessorWellLogExtraction::generateWellPoints( faultTopPosition,
faultBottomPosition,
sign * faultNormal * distanceFromFault );
cvf::ref<RigWellPath> wellPath =
new RigWellPath( wellPoints, RimFaultReactivationDataAccessorWellLogExtraction::generateMds( wellPoints ) );
wellPaths[gridPart] = wellPath;
std::string errorName = "fault reactivation data access";
cvf::ref<RigEclipseWellLogExtractor> extractor = new RigEclipseWellLogExtractor( &eclipseCaseData, wellPath.p(), errorName );
extractors[gridPart] = extractor;
}
return { wellPaths, extractors };
}

View File

@ -21,8 +21,14 @@
#include "RimFaultReactivationDataAccessor.h"
#include "RimFaultReactivationEnums.h"
#include "cvfObject.h"
#include <vector>
class RigWellPath;
class RigEclipseWellLogExtractor;
class RigEclipseCaseData;
//==================================================================================================
///
///
@ -35,6 +41,11 @@ public:
static std::pair<double, cvf::Vec3d>
calculatePorBar( const std::vector<cvf::Vec3d>& intersections, std::vector<double>& values, const cvf::Vec3d& position, double gradient );
static std::pair<std::map<RimFaultReactivation::GridPart, cvf::ref<RigWellPath>>,
std::map<RimFaultReactivation::GridPart, cvf::ref<RigEclipseWellLogExtractor>>>
createEclipseWellPathExtractors( const RigFaultReactivationModel& model, RigEclipseCaseData& eclipseCaseData );
static std::vector<cvf::Vec3d>
generateWellPoints( const cvf::Vec3d& faultTopPosition, const cvf::Vec3d& faultBottomPosition, const cvf::Vec3d& offset );