mirror of
https://github.com/OPM/ResInsight.git
synced 2025-02-25 18:55:39 -06:00
Add Well paths to other well paths
This commit is contained in:
@@ -361,6 +361,14 @@ double RimWellPath::endMD() const
|
||||
return std::numeric_limits<double>::infinity();
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimWellPath::addChildWellPath( RimWellPath* wellPath )
|
||||
{
|
||||
m_childWellPaths.push_back( wellPath );
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
@@ -631,6 +639,9 @@ void RimWellPath::defineUiTreeOrdering( caf::PdmUiTreeOrdering& uiTreeOrdering,
|
||||
uiTreeOrdering.add( m_wellPathAttributes() );
|
||||
}
|
||||
|
||||
for ( auto child : m_childWellPaths() )
|
||||
uiTreeOrdering.add( child );
|
||||
|
||||
uiTreeOrdering.skipRemainingChildren( true );
|
||||
}
|
||||
|
||||
|
||||
@@ -96,6 +96,8 @@ public:
|
||||
double startMD() const override;
|
||||
double endMD() const override;
|
||||
|
||||
void addChildWellPath( RimWellPath* wellPath );
|
||||
|
||||
void addWellLogFile( RimWellLogFile* logFileInfo );
|
||||
void deleteWellLogFile( RimWellLogFile* logFileInfo );
|
||||
void detachWellLogFile( RimWellLogFile* logFileInfo );
|
||||
@@ -184,6 +186,8 @@ private:
|
||||
caf::PdmChildField<RimWellPathCompletions*> m_completions;
|
||||
caf::PdmChildField<RimWellPathAttributeCollection*> m_wellPathAttributes;
|
||||
|
||||
caf::PdmChildArrayField<RimWellPath*> m_childWellPaths;
|
||||
|
||||
private:
|
||||
static size_t simulationWellBranchCount( const QString& simWellName );
|
||||
|
||||
@@ -195,6 +199,4 @@ private:
|
||||
// Obsolete fields
|
||||
|
||||
caf::PdmChildField<RimWellLogFile*> m_wellLogFile_OBSOLETE;
|
||||
|
||||
caf::PdmChildArrayField<RimWellPath*> m_childWellPaths;
|
||||
};
|
||||
|
||||
@@ -263,9 +263,17 @@ std::vector<RimWellPath*> RimWellPathCollection::addWellPaths( QStringList fileP
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimWellPathCollection::addWellPath( RimWellPath* wellPath )
|
||||
void RimWellPathCollection::addWellPath( gsl::not_null<RimWellPath*> wellPath )
|
||||
{
|
||||
auto mainWellPath = findSuitableParentWellPath( wellPath );
|
||||
if ( mainWellPath )
|
||||
{
|
||||
mainWellPath->addChildWellPath( wellPath );
|
||||
}
|
||||
else
|
||||
{
|
||||
m_wellPaths.push_back( wellPath );
|
||||
}
|
||||
m_mostRecentlyUpdatedWellPath = wellPath;
|
||||
}
|
||||
|
||||
@@ -648,6 +656,33 @@ void RimWellPathCollection::sortWellsByName()
|
||||
std::sort( m_wellPaths.begin(), m_wellPaths.end(), lessWellPath );
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
RimWellPath* RimWellPathCollection::findSuitableParentWellPath( gsl::not_null<const RimWellPath*> wellPath ) const
|
||||
{
|
||||
auto wellPathGeometry = wellPath->wellPathGeometry();
|
||||
if ( !wellPathGeometry ) return nullptr;
|
||||
|
||||
std::vector<RimWellPath*> allWellPaths;
|
||||
descendantsOfType( allWellPaths );
|
||||
|
||||
const double eps = 1.0e-4;
|
||||
double maxIdenticalTubeLength = 0.0;
|
||||
RimWellPath* maxIdenticalWellPath = nullptr;
|
||||
|
||||
for ( auto existingWellPath : allWellPaths )
|
||||
{
|
||||
double identicalTubeLength = existingWellPath->wellPathGeometry()->identicalTubeLength( *wellPathGeometry );
|
||||
if ( identicalTubeLength > maxIdenticalTubeLength && identicalTubeLength > eps )
|
||||
{
|
||||
maxIdenticalTubeLength = identicalTubeLength;
|
||||
maxIdenticalWellPath = existingWellPath;
|
||||
}
|
||||
}
|
||||
return maxIdenticalWellPath;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
|
||||
@@ -34,6 +34,8 @@
|
||||
|
||||
#include "cvfObject.h"
|
||||
|
||||
#include <gsl/gsl>
|
||||
|
||||
#include <memory>
|
||||
|
||||
class RifWellPathImporter;
|
||||
@@ -103,7 +105,7 @@ public:
|
||||
RimWellPath* wellPathByName( const QString& wellPathName ) const;
|
||||
RimWellPath* tryFindMatchingWellPath( const QString& wellName ) const;
|
||||
void addWellPaths( const std::vector<RimWellPath*> incomingWellPaths );
|
||||
void addWellPath( RimWellPath* wellPath );
|
||||
void addWellPath( gsl::not_null<RimWellPath*> wellPath );
|
||||
|
||||
std::vector<RimWellLogFile*> addWellLogs( const QStringList& filePaths, QStringList* errorMessages );
|
||||
void addWellPathFormations( const QStringList& filePaths );
|
||||
@@ -132,6 +134,8 @@ private:
|
||||
void readAndAddWellPaths( std::vector<RimFileWellPath*>& wellPathArray );
|
||||
void sortWellsByName();
|
||||
|
||||
RimWellPath* findSuitableParentWellPath( gsl::not_null<const RimWellPath*> wellPath ) const;
|
||||
|
||||
RiaEclipseUnitTools::UnitSystemType findUnitSystemForWellPath( const RimWellPath* wellPath );
|
||||
|
||||
std::unique_ptr<RifWellPathImporter> m_wellPathImporter;
|
||||
|
||||
@@ -341,6 +341,36 @@ void RigWellPath::twoClosestPoints( const cvf::Vec3d& position, cvf::Vec3d* p1,
|
||||
}
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
double RigWellPath::identicalTubeLength( const RigWellPath& other ) const
|
||||
{
|
||||
const double eps = 1.0e-8;
|
||||
|
||||
size_t minimumVertices = std::min( m_wellPathPoints.size(), other.wellPathPoints().size() );
|
||||
if ( minimumVertices < 2u ) return 0.0;
|
||||
|
||||
size_t minimumSegments = minimumVertices - 1u;
|
||||
|
||||
double identicalMD = 0.0;
|
||||
for ( size_t segmentIndex = 0; segmentIndex < minimumSegments; ++segmentIndex )
|
||||
{
|
||||
size_t vIndex1 = segmentIndex;
|
||||
size_t vIndex2 = segmentIndex + 1u;
|
||||
if ( ( m_wellPathPoints[vIndex1] - other.wellPathPoints()[vIndex1] ).length() < eps &&
|
||||
( m_wellPathPoints[vIndex2] - other.wellPathPoints()[vIndex2] ).length() < eps )
|
||||
{
|
||||
identicalMD = m_measuredDepths[vIndex2];
|
||||
}
|
||||
else
|
||||
{
|
||||
break;
|
||||
}
|
||||
}
|
||||
return identicalMD;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
|
||||
@@ -68,6 +68,7 @@ public:
|
||||
|
||||
double wellPathAzimuthAngle( const cvf::Vec3d& position ) const;
|
||||
void twoClosestPoints( const cvf::Vec3d& position, cvf::Vec3d* p1, cvf::Vec3d* p2 ) const;
|
||||
double identicalTubeLength( const RigWellPath& otherWellPathGeometry ) const;
|
||||
|
||||
std::pair<std::vector<cvf::Vec3d>, std::vector<double>>
|
||||
clippedPointSubset( double startMD, double endMD, double* horizontalLengthAlongWellToStartClipPoint = nullptr ) const;
|
||||
|
||||
Reference in New Issue
Block a user