Skip to content

Commit

Permalink
Less lambdas..
Browse files Browse the repository at this point in the history
  • Loading branch information
kriben committed Dec 15, 2023
1 parent 40cba85 commit 46480ab
Show file tree
Hide file tree
Showing 2 changed files with 42 additions and 29 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -87,45 +87,22 @@ void RimFaultReactivationDataAccessorStress::updateResultAccessor()
m_s11Frames = loadFrameLambda( femParts, getResultAddress( "ST", "S11" ) );
m_s22Frames = loadFrameLambda( femParts, getResultAddress( "ST", "S22" ) );

auto generateMds = []( const std::vector<cvf::Vec3d>& points )
{
CAF_ASSERT( points.size() >= 2 );

// Assume first at zero, all other points relative to that.
std::vector<double> mds = { 0.0 };
double sum = 0.0;
for ( size_t i = 1; i < points.size(); i++ )
{
sum += points[i - 1].pointDistance( points[i] );
mds.push_back( sum );
}
return mds;
};

auto [faultTopPosition, faultBottomPosition] = m_model->faultTopBottom();
auto faultNormal = m_model->faultNormal();
double distanceFromFault = 1.0;

RigFemPartCollection* geoMechPartCollection = m_geoMechCaseData->femParts();

{
cvf::Vec3d partATop = faultTopPosition + faultNormal * distanceFromFault;
cvf::Vec3d partASeabed( partATop.x(), partATop.y(), 0.0 );
cvf::Vec3d partABottom = faultBottomPosition + faultNormal * distanceFromFault;
cvf::Vec3d partAUnderburdenBottom( partABottom.x(), partABottom.y(), -10000.0 );
std::vector<cvf::Vec3d> faceAWellPoints = { partASeabed, partATop, partABottom, partAUnderburdenBottom };
m_faceAWellPath = new RigWellPath( faceAWellPoints, generateMds( faceAWellPoints ) );
m_partIndexA = getPartIndexFromPoint( *geoMechPartCollection, partATop );
std::vector<cvf::Vec3d> wellPoints = generateWellPoints( faultTopPosition, faultBottomPosition, faultNormal * distanceFromFault );
m_faceAWellPath = new RigWellPath( wellPoints, generateMds( wellPoints ) );
m_partIndexA = getPartIndexFromPoint( *geoMechPartCollection, wellPoints[1] );
}

{
cvf::Vec3d partBTop = faultTopPosition - faultNormal * distanceFromFault;
cvf::Vec3d partBSeabed( partBTop.x(), partBTop.y(), 0.0 );
cvf::Vec3d partBBottom = faultBottomPosition - faultNormal * distanceFromFault;
cvf::Vec3d partBUnderburdenBottom( partBBottom.x(), partBBottom.y(), -10000.0 );
std::vector<cvf::Vec3d> faceBWellPoints = { partBSeabed, partBTop, partBBottom, partBUnderburdenBottom };
m_faceBWellPath = new RigWellPath( faceBWellPoints, generateMds( faceBWellPoints ) );
m_partIndexB = getPartIndexFromPoint( *geoMechPartCollection, partBTop );
std::vector<cvf::Vec3d> wellPoints = generateWellPoints( faultTopPosition, faultBottomPosition, -faultNormal * distanceFromFault );
m_faceBWellPath = new RigWellPath( wellPoints, generateMds( wellPoints ) );
m_partIndexB = getPartIndexFromPoint( *geoMechPartCollection, wellPoints[1] );
}
}

Expand Down Expand Up @@ -415,3 +392,35 @@ void RimFaultReactivationDataAccessorStress::fillInMissingValues( const std::vec

RiaInterpolationTools::interpolateMissingValues( intersectionsZ, values );
}

//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
std::vector<double> RimFaultReactivationDataAccessorStress::generateMds( const std::vector<cvf::Vec3d>& points )
{
CAF_ASSERT( points.size() >= 2 );

// Assume first at zero, all other points relative to that.
std::vector<double> mds = { 0.0 };
double sum = 0.0;
for ( size_t i = 1; i < points.size(); i++ )
{
sum += points[i - 1].pointDistance( points[i] );
mds.push_back( sum );
}
return mds;
}

//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
std::vector<cvf::Vec3d> RimFaultReactivationDataAccessorStress::generateWellPoints( const cvf::Vec3d& faultTopPosition,
const cvf::Vec3d& faultBottomPosition,
const cvf::Vec3d& offset )
{
cvf::Vec3d faultTop = faultTopPosition + offset;
cvf::Vec3d seabed( faultTop.x(), faultTop.y(), 0.0 );
cvf::Vec3d faultBottom = faultBottomPosition + offset;
cvf::Vec3d underburdenBottom( faultBottom.x(), faultBottom.y(), -10000.0 );
return { seabed, faultTop, faultBottom, underburdenBottom };
}
Original file line number Diff line number Diff line change
Expand Up @@ -87,6 +87,10 @@ class RimFaultReactivationDataAccessorStress : public RimFaultReactivationDataAc
double gradient );
static void fillInMissingValues( const std::vector<cvf::Vec3d>& intersections, std::vector<double>& values, double gradient );

static std::vector<double> generateMds( const std::vector<cvf::Vec3d>& points );
static std::vector<cvf::Vec3d>
generateWellPoints( const cvf::Vec3d& faultTopPosition, const cvf::Vec3d& faultBottomPosition, const cvf::Vec3d& offset );

RimGeoMechCase* m_geoMechCase;
RimFaultReactivation::Property m_property;
double m_gradient;
Expand Down

0 comments on commit 46480ab

Please sign in to comment.