Improve MSW export including multi lateral wells

Based on branch https://github.com/OPM/ResInsight/tree/system-msw-refactor

- Move completion settings to property of well path
- Rename to RimFishbones
- Export implicit COMPSEGS for fishbones main bore
- Add valve for each branch
- Increase version number to be able to handle import of legacy project files
This commit is contained in:
Magne Sjaastad 2021-02-26 14:27:59 +01:00
parent 5415a8c42d
commit 8bab748fa6
104 changed files with 3250 additions and 3203 deletions

View File

@ -28,8 +28,8 @@ bool RiaProjectFileVersionTools::isCandidateVersionNewerThanOther( const QString
{
int candidateMajorVersion = 0;
int candidateMinorVersion = 0;
int candidatePatchNumber = 0;
int candidateDevelopmentId = 0;
int candidatePatchNumber = -1;
int candidateDevelopmentId = -1;
RiaProjectFileVersionTools::decodeVersionString( candidateProjectFileVersion,
&candidateMajorVersion,
@ -39,8 +39,8 @@ bool RiaProjectFileVersionTools::isCandidateVersionNewerThanOther( const QString
int majorVersion = 0;
int minorVersion = 0;
int patchNumber = 0;
int developmentId = 0;
int patchNumber = -1;
int developmentId = -1;
RiaProjectFileVersionTools::decodeVersionString( projectFileVersion,
&majorVersion,
@ -120,11 +120,17 @@ bool RiaProjectFileVersionTools::isCandidateNewerThanOther( int candidateMajorVe
return ( candidateMinorVersion > otherMinorVersion );
}
// Early exit if a patch number is undefined
if ( candidatePatchNumber == -1 || otherPatchNumber == -1 ) return false;
if ( candidatePatchNumber != otherPatchNumber )
{
return ( candidatePatchNumber > otherPatchNumber );
}
// Early exit if a development number is undefined
if ( candidateDevelopmentId == -1 && otherDevelopmentId == -1 ) return false;
if ( candidateDevelopmentId != otherDevelopmentId )
{
return ( candidateDevelopmentId > otherDevelopmentId );

View File

@ -86,6 +86,37 @@ QString RiaTextStringTools::commonRoot( const QStringList& stringList )
return root;
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
QString RiaTextStringTools::commonSuffix( const QStringList& stringList )
{
QString suffix;
if ( !stringList.isEmpty() )
{
suffix = stringList.back();
for ( const auto& item : stringList )
{
if ( suffix.length() > item.length() )
{
suffix = suffix.right( item.length() );
}
for ( int i = 0; i < suffix.length(); i++ )
{
int suffixIndex = suffix.length() - i - 1;
int itemIndex = item.length() - i - 1;
if ( suffix[suffixIndex] != item[itemIndex] )
{
suffix = suffix.right( i );
break;
}
}
}
}
return suffix;
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------

View File

@ -29,5 +29,6 @@ namespace RiaTextStringTools
bool compare( const QString& expected, const QString& actual );
QString trimAndRemoveDoubleSpaces( const QString& s );
QString commonRoot( const QStringList& stringList );
QString commonSuffix( const QStringList& stringList );
QString trimNonAlphaNumericCharacters( const QString& s );
} // namespace RiaTextStringTools

View File

@ -81,7 +81,7 @@ void RiaPolyArcLineSampler::sampleSegment( cvf::Vec3d t1, cvf::Vec3d p1, cvf::Ve
CVF_ASSERT( p1p2.lengthSquared() > 1e-20 );
if ( cvf::GeometryTools::getAngle( t1, p1p2 ) < 1e-5 )
if ( cvf::GeometryTools::getAngle( t1, p1p2 ) < 1e-5 || p1p2.length() < m_maxSamplingsInterval )
{
sampleLine( p1, p2, endTangent );
}

View File

@ -26,8 +26,8 @@
#include "RimEclipseCase.h"
#include "RimEclipseCaseCollection.h"
#include "RimFishbones.h"
#include "RimFishbonesCollection.h"
#include "RimFishbonesMultipleSubs.h"
#include "RimOilField.h"
#include "RimProject.h"
#include "RimWellPath.h"

View File

@ -25,8 +25,8 @@
#include "RigWellPath.h"
#include "RimFishbones.h"
#include "RimFishbonesCollection.h"
#include "RimFishbonesMultipleSubs.h"
#include "RimWellPath.h"
#include "cafSelectionManager.h"
@ -67,38 +67,35 @@ void RicExportFishbonesLateralsFeature::onActionTriggered( bool isChecked )
auto exportFile = EXP::openFileForExport( folder, fileName );
auto stream = EXP::createOutputFileStream( *exportFile );
for ( RimFishbonesMultipleSubs* fishbone : wellPath->fishbonesCollection()->activeFishbonesSubs() )
for ( RimFishbones* fishbone : wellPath->fishbonesCollection()->activeFishbonesSubs() )
{
const QString fishboneName = fishbone->generatedName();
for ( auto& sub : fishbone->installedLateralIndices() )
for ( const auto& [subIndex, lateralIndex] : fishbone->installedLateralIndices() )
{
for ( size_t lateralIndex : sub.lateralIndices )
std::vector<std::pair<cvf::Vec3d, double>> coordsAndMD =
fishbone->coordsAndMDForLateral( subIndex, lateralIndex );
std::vector<cvf::Vec3d> lateralCoords;
std::vector<double> lateralMDs;
lateralCoords.reserve( coordsAndMD.size() );
lateralMDs.reserve( coordsAndMD.size() );
for ( auto& coordMD : coordsAndMD )
{
std::vector<std::pair<cvf::Vec3d, double>> coordsAndMD =
fishbone->coordsAndMDForLateral( sub.subIndex, lateralIndex );
std::vector<cvf::Vec3d> lateralCoords;
std::vector<double> lateralMDs;
lateralCoords.reserve( coordsAndMD.size() );
lateralMDs.reserve( coordsAndMD.size() );
for ( auto& coordMD : coordsAndMD )
{
lateralCoords.push_back( coordMD.first );
lateralMDs.push_back( coordMD.second );
}
RigWellPath geometry( lateralCoords, lateralMDs );
// Pad with "0" to get a total of two characters defining the sub index text
QString subIndexText = QString( "%1" ).arg( sub.subIndex, 2, 10, QChar( '0' ) );
QString lateralName =
QString( "%1_%2_Sub%3_Lat%4" ).arg( wellPath->name() ).arg( fishboneName ).arg( subIndexText ).arg( lateralIndex );
EXP::writeWellPathGeometryToStream( *stream, geometry, lateralName, mdStepSize, false, 0.0, false );
lateralCoords.push_back( coordMD.first );
lateralMDs.push_back( coordMD.second );
}
RigWellPath geometry( lateralCoords, lateralMDs );
// Pad with "0" to get a total of two characters defining the sub index text
QString subIndexText = QString( "%1" ).arg( subIndex, 2, 10, QChar( '0' ) );
QString lateralName =
QString( "%1_%2_Sub%3_Lat%4" ).arg( wellPath->name() ).arg( fishboneName ).arg( subIndexText ).arg( lateralIndex );
EXP::writeWellPathGeometryToStream( *stream, geometry, lateralName, mdStepSize, false, 0.0, false );
}
}

View File

@ -21,8 +21,8 @@
#include "RicNewFishbonesSubsFeature.h"
#include "WellPathCommands/RicWellPathsUnitSystemSettingsImpl.h"
#include "RimFishbones.h"
#include "RimFishbonesCollection.h"
#include "RimFishbonesMultipleSubs.h"
#include "RimProject.h"
#include "RimWellPath.h"
@ -48,7 +48,7 @@ void RicNewFishbonesSubsAtMeasuredDepthFeature::onActionTriggered( bool isChecke
if ( !RicWellPathsUnitSystemSettingsImpl::ensureHasUnitSystem( wellPath ) ) return;
RimFishbonesMultipleSubs* obj = new RimFishbonesMultipleSubs;
RimFishbones* obj = new RimFishbones;
wellPath->fishbonesCollection()->appendFishbonesSubs( obj );
obj->setMeasuredDepthAndCount( wellPathSelItem->m_measuredDepth, 12.5, 13 );

View File

@ -25,9 +25,9 @@
#include "RigWellPath.h"
#include "Rim3dView.h"
#include "RimFishboneWellPathCollection.h"
#include "RimFishbones.h"
#include "RimFishbonesCollection.h"
#include "RimFishbonesMultipleSubs.h"
#include "RimImportedFishboneLateralsCollection.h"
#include "RimProject.h"
#include "RimWellPathCollection.h"
#include "RimWellPathCompletions.h"
@ -55,10 +55,10 @@ void RicNewFishbonesSubsFeature::onActionTriggered( bool isChecked )
fishbonesCollection->firstAncestorOrThisOfTypeAsserted( wellPath );
if ( !RicWellPathsUnitSystemSettingsImpl::ensureHasUnitSystem( wellPath ) ) return;
RimFishbonesMultipleSubs* obj = new RimFishbonesMultipleSubs;
RimFishbones* obj = new RimFishbones;
fishbonesCollection->appendFishbonesSubs( obj );
double wellPathTipMd = wellPath->endMD();
double wellPathTipMd = wellPath->uniqueEndMD();
if ( wellPathTipMd != HUGE_VAL )
{
double startMd = wellPathTipMd - 150 - 100;

View File

@ -20,7 +20,7 @@
#include "WellPathCommands/RicWellPathsUnitSystemSettingsImpl.h"
#include "RimFishbonesMultipleSubs.h"
#include "RimFishbones.h"
#include "RimPerforationCollection.h"
#include "RimPerforationInterval.h"
#include "RimProject.h"

View File

@ -55,6 +55,7 @@ void RicNewPerforationIntervalFeature::onActionTriggered( bool isChecked )
if ( !RicWellPathsUnitSystemSettingsImpl::ensureHasUnitSystem( wellPath ) ) return;
RimPerforationInterval* perforationInterval = new RimPerforationInterval;
perforationInterval->setStartAndEndMD( wellPath->uniqueStartMD(), wellPath->uniqueEndMD() );
perforationCollection->appendPerforation( perforationInterval );

View File

@ -19,7 +19,7 @@
#include "WellPathCommands/RicWellPathsUnitSystemSettingsImpl.h"
#include "RimFishbonesMultipleSubs.h"
#include "RimFishbones.h"
#include "RimPerforationCollection.h"
#include "RimPerforationInterval.h"
#include "RimProject.h"

View File

@ -20,8 +20,8 @@
#include "RiaApplication.h"
#include "RimFishboneWellPathCollection.h"
#include "RimFishbonesCollection.h"
#include "RimImportedFishboneLateralsCollection.h"
#include "RimProject.h"
#include "RimWellPath.h"
#include "RimWellPathCollection.h"
@ -55,7 +55,7 @@ bool RicWellPathImportCompletionsFileFeature::isCommandEnabled()
//--------------------------------------------------------------------------------------------------
void RicWellPathImportCompletionsFileFeature::onActionTriggered( bool isChecked )
{
RimFishboneWellPathCollection* fishbonesWellPathCollection =
RimImportedFishboneLateralsCollection* fishbonesWellPathCollection =
RicWellPathImportCompletionsFileFeature::selectedWellPathCollection();
CVF_ASSERT( fishbonesWellPathCollection );
@ -100,7 +100,7 @@ void RicWellPathImportCompletionsFileFeature::setupActionLook( QAction* actionTo
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
RimFishboneWellPathCollection* RicWellPathImportCompletionsFileFeature::selectedWellPathCollection()
RimImportedFishboneLateralsCollection* RicWellPathImportCompletionsFileFeature::selectedWellPathCollection()
{
RimFishbonesCollection* objToFind = nullptr;
caf::PdmUiItem* pdmUiItem = caf::SelectionManager::instance()->selectedItem();

View File

@ -20,7 +20,7 @@
#include "cafCmdFeature.h"
class RimFishboneWellPathCollection;
class RimImportedFishboneLateralsCollection;
//==================================================================================================
///
@ -36,5 +36,5 @@ protected:
void setupActionLook( QAction* actionToSetup ) override;
private:
static RimFishboneWellPathCollection* selectedWellPathCollection();
static RimImportedFishboneLateralsCollection* selectedWellPathCollection();
};

View File

@ -11,10 +11,12 @@ ${CMAKE_CURRENT_LIST_DIR}/RicCaseAndFileExportSettingsUi.h
${CMAKE_CURRENT_LIST_DIR}/RicExportFractureCompletionsImpl.h
${CMAKE_CURRENT_LIST_DIR}/RicExportCompletionsForVisibleWellPathsFeature.h
${CMAKE_CURRENT_LIST_DIR}/RicExportCompletionsForVisibleSimWellsFeature.h
${CMAKE_CURRENT_LIST_DIR}/RicMswBranch.h
${CMAKE_CURRENT_LIST_DIR}/RicMswCompletions.h
${CMAKE_CURRENT_LIST_DIR}/RicMswExportInfo.h
${CMAKE_CURRENT_LIST_DIR}/RicMswItem.h
${CMAKE_CURRENT_LIST_DIR}/RicMswSegment.h
${CMAKE_CURRENT_LIST_DIR}/RicMswSubSegment.h
${CMAKE_CURRENT_LIST_DIR}/RicMswSegmentCellIntersection.h
${CMAKE_CURRENT_LIST_DIR}/RicMswValveAccumulators.h
${CMAKE_CURRENT_LIST_DIR}/RicWellPathFractureTextReportFeatureImpl.h
${CMAKE_CURRENT_LIST_DIR}/RicWellPathFractureReportItem.h
@ -34,10 +36,12 @@ ${CMAKE_CURRENT_LIST_DIR}/RicCaseAndFileExportSettingsUi.cpp
${CMAKE_CURRENT_LIST_DIR}/RicExportFractureCompletionsImpl.cpp
${CMAKE_CURRENT_LIST_DIR}/RicExportCompletionsForVisibleWellPathsFeature.cpp
${CMAKE_CURRENT_LIST_DIR}/RicExportCompletionsForVisibleSimWellsFeature.cpp
${CMAKE_CURRENT_LIST_DIR}/RicMswBranch.cpp
${CMAKE_CURRENT_LIST_DIR}/RicMswCompletions.cpp
${CMAKE_CURRENT_LIST_DIR}/RicMswExportInfo.cpp
${CMAKE_CURRENT_LIST_DIR}/RicMswItem.cpp
${CMAKE_CURRENT_LIST_DIR}/RicMswSegment.cpp
${CMAKE_CURRENT_LIST_DIR}/RicMswSubSegment.cpp
${CMAKE_CURRENT_LIST_DIR}/RicMswSegmentCellIntersection.cpp
${CMAKE_CURRENT_LIST_DIR}/RicMswValveAccumulators.cpp
${CMAKE_CURRENT_LIST_DIR}/RicWellPathFractureTextReportFeatureImpl.cpp
${CMAKE_CURRENT_LIST_DIR}/RicWellPathFractureReportItem.cpp

View File

@ -406,7 +406,7 @@ std::map<int, std::vector<std::pair<QString, QString>>>
double currentWellPressure = 0.0;
RicExportFractureCompletionsImpl::
getWellPressuresAndInitialProductionTimeStepFromSummaryData( caseToApply,
wellPath->completions()->wellNameForExport(),
wellPath->completionSettings()->wellNameForExport(),
0,
&initialWellProductionTimeStep,
&initialWellPressure,

View File

@ -155,5 +155,10 @@ std::vector<RimWellPath*> RicExportCompletionsForVisibleWellPathsFeature::visibl
std::set<RimWellPath*> uniqueWellPaths( wellPaths.begin(), wellPaths.end() );
wellPaths.assign( uniqueWellPaths.begin(), uniqueWellPaths.end() );
wellPaths.erase( std::remove_if( wellPaths.begin(),
wellPaths.end(),
[]( auto wellPath ) { return !wellPath->isTopLevelWellPath(); } ),
wellPaths.end() );
return wellPaths;
}

View File

@ -30,9 +30,9 @@
#include "RicWellPathExportMswCompletionsImpl.h"
#include "RimEclipseCase.h"
#include "RimFishboneWellPathCollection.h"
#include "RimFishbones.h"
#include "RimFishbonesCollection.h"
#include "RimFishbonesMultipleSubs.h"
#include "RimImportedFishboneLateralsCollection.h"
#include "RimPerforationCollection.h"
#include "RimProject.h"
#include "RimWellPath.h"

View File

@ -23,7 +23,7 @@
#include "cafCmdFeature.h"
class RimFishbonesCollection;
class RimFishbonesMultipleSubs;
class RimFishbones;
class RimWellPath;
//==================================================================================================

View File

@ -84,7 +84,7 @@ std::vector<RigCompletionData> RicExportFractureCompletionsImpl::generateCompdat
}
return generateCompdatValues( caseToApply,
wellPath->completions()->wellNameForExport(),
wellPath->completionSettings()->wellNameForExport(),
wellPath->wellPathGeometry(),
fracturesAlongWellPath,
fractureDataForReport,

View File

@ -19,7 +19,10 @@
#include "RicFishbonesTransmissibilityCalculationFeatureImp.h"
#include "RicExportCompletionDataSettingsUi.h"
#include "RicMswBranch.h"
#include "RicMswCompletions.h"
#include "RicMswExportInfo.h"
#include "RicMswSegment.h"
#include "RicWellPathExportCompletionDataFeatureImpl.h"
#include "RicWellPathExportMswCompletionsImpl.h"
@ -31,10 +34,10 @@
#include "RigWellPathIntersectionTools.h"
#include "RigWellLogExtractor.h"
#include "RimFishboneWellPath.h"
#include "RimFishboneWellPathCollection.h"
#include "RimFishbones.h"
#include "RimFishbonesCollection.h"
#include "RimFishbonesMultipleSubs.h"
#include "RimImportedFishboneLaterals.h"
#include "RimImportedFishboneLateralsCollection.h"
#include "RimWellPath.h"
#include "RimWellPathCompletions.h"
@ -134,7 +137,7 @@ std::vector<RigCompletionData>
continue;
}
RigCompletionData completion( wellPath->completions()->wellNameForExport(),
RigCompletionData completion( wellPath->completionSettings()->wellNameForExport(),
RigCompletionDataGridCell( globalCellIndex, settings.caseToApply->mainGrid() ),
wellBorePart.intersectionWithWellMeasuredDepth );
completion.setSecondOrderingValue( wellBorePart.lateralIndex );
@ -206,34 +209,50 @@ void RicFishbonesTransmissibilityCalculationFeatureImp::findFishboneLateralsWell
// Generate data
const RigEclipseCaseData* caseData = settings.caseToApply()->eclipseCaseData();
RicMswExportInfo exportInfo =
RicWellPathExportMswCompletionsImpl::generateFishbonesMswExportInfo( settings.caseToApply(), wellPath, false );
RiaDefines::EclipseUnitSystem unitSystem = caseData->unitsType();
bool isMainBore = false;
auto mswParameters = wellPath->completionSettings()->mswParameters();
RiaDefines::EclipseUnitSystem unitSystem = caseData->unitsType();
for ( std::shared_ptr<RicMswSegment> location : exportInfo.segments() )
RicMswExportInfo exportInfo( wellPath,
unitSystem,
wellPath->fishbonesCollection()->startMD(),
mswParameters->lengthAndDepth().text(),
mswParameters->pressureDrop().text() );
exportInfo.setLinerDiameter( mswParameters->linerDiameter( unitSystem ) );
exportInfo.setRoughnessFactor( mswParameters->roughnessFactor( unitSystem ) );
RicWellPathExportMswCompletionsImpl::generateFishbonesMswExportInfo( settings.caseToApply(),
wellPath,
0.0,
{},
false,
&exportInfo,
exportInfo.mainBoreBranch() );
bool isMainBore = false;
for ( auto segment : exportInfo.mainBoreBranch()->segments() )
{
for ( std::shared_ptr<RicMswCompletion> completion : location->completions() )
for ( auto completion : segment->completions() )
{
for ( std::shared_ptr<RicMswSubSegment> segment : completion->subSegments() )
for ( auto completionSegment : completion->segments() )
{
for ( std::shared_ptr<RicMswSubSegmentCellIntersection> intersection : segment->intersections() )
for ( std::shared_ptr<RicMswSegmentCellIntersection> intersection : completionSegment->intersections() )
{
double diameter = location->holeDiameter();
double diameter = segment->holeDiameter();
QString completionMetaData =
( location->label() +
QString( ": Sub: %1 Lateral: %2" ).arg( location->subIndex() ).arg( completion->index() ) );
( segment->label() +
QString( ": Sub: %1 Lateral: %2" ).arg( segment->subIndex() ).arg( completion->index() ) );
WellBorePartForTransCalc wellBorePart = WellBorePartForTransCalc( intersection->lengthsInCell(),
diameter / 2.0,
location->skinFactor(),
segment->skinFactor(),
isMainBore,
completionMetaData );
wellBorePart.intersectionWithWellMeasuredDepth = location->endMD();
wellBorePart.intersectionWithWellMeasuredDepth = segment->endMD();
wellBorePart.lateralIndex = completion->index();
wellBorePart.setSourcePdmObject( location->sourcePdmObject() );
wellBorePart.setSourcePdmObject( segment->sourcePdmObject() );
wellBorePartsInCells[intersection->globalCellIndex()].push_back( wellBorePart );
}
@ -293,7 +312,8 @@ void RicFishbonesTransmissibilityCalculationFeatureImp::findFishboneImportedLate
double holeRadius = wellPath->fishbonesCollection()->wellPathCollection()->holeDiameter( unitSystem ) / 2.0;
double skinFactor = wellPath->fishbonesCollection()->wellPathCollection()->skinFactor();
for ( const RimFishboneWellPath* fishbonesPath : wellPath->fishbonesCollection()->wellPathCollection()->wellPaths() )
for ( const RimImportedFishboneLaterals* fishbonesPath :
wellPath->fishbonesCollection()->wellPathCollection()->wellPaths() )
{
if ( !fishbonesPath->isChecked() )
{
@ -336,7 +356,7 @@ void RicFishbonesTransmissibilityCalculationFeatureImp::appendMainWellBoreParts(
double holeRadius,
double startMeasuredDepth,
double endMeasuredDepth,
const RimFishbonesMultipleSubs* fishbonesDefinitions )
const RimFishbones* fishbonesDefinitions )
{
if ( !wellPath ) return;
if ( !wellPath->wellPathGeometry() ) return;
@ -355,7 +375,7 @@ void RicFishbonesTransmissibilityCalculationFeatureImp::appendMainWellBoreParts(
for ( const auto& cellIntersectionInfo : intersectedCellsIntersectionInfo )
{
QString completionMetaData = wellPath->completions()->wellNameForExport() + " main bore";
QString completionMetaData = wellPath->completionSettings()->wellNameForExport() + " main bore";
WellBorePartForTransCalc wellBorePart = WellBorePartForTransCalc( cellIntersectionInfo.intersectionLengthsInCellCS,
holeRadius,
skinFactor,

View File

@ -26,7 +26,7 @@
class RigCompletionData;
class RimWellPath;
class RimFishbonesMultipleSubs;
class RimFishbones;
class RicExportCompletionDataSettingsUi;
class RigEclipseCaseData;
@ -60,5 +60,5 @@ private:
double holeRadius,
double startMeasuredDepth,
double endMeasuredDepth,
const RimFishbonesMultipleSubs* fishbonesDefinitions );
const RimFishbones* fishbonesDefinitions );
};

View File

@ -1,164 +1,182 @@
/////////////////////////////////////////////////////////////////////////////////
//
// Copyright (C) 2018 Equinor ASA
//
// ResInsight is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// ResInsight is distributed in the hope that it will be useful, but WITHOUT ANY
// WARRANTY; without even the implied warranty of MERCHANTABILITY or
// FITNESS FOR A PARTICULAR PURPOSE.
//
// See the GNU General Public License at <http://www.gnu.org/licenses/gpl.html>
// for more details.
//
/////////////////////////////////////////////////////////////////////////////////
#include "RicMswBranch.h"
#include "RicMswSubSegment.h"
#include "RicMswCompletions.h"
#include "RicMswSegment.h"
#include "RimWellPath.h"
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
RicMswSubSegmentCellIntersection::RicMswSubSegmentCellIntersection( const QString& gridName,
size_t globalCellIndex,
const cvf::Vec3st& gridLocalCellIJK,
const cvf::Vec3d& lengthsInCell )
: m_gridName( gridName )
, m_globalCellIndex( globalCellIndex )
, m_gridLocalCellIJK( gridLocalCellIJK )
, m_lengthsInCell( lengthsInCell )
RicMswBranch::RicMswBranch( const QString& label, const RimWellPath* wellPath, double initialMD, double initialTVD )
: RicMswItem( label )
, m_initialMD( initialMD )
, m_initialTVD( initialTVD )
, m_branchNumber( -1 )
, m_wellPath( wellPath )
{
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
const QString& RicMswSubSegmentCellIntersection::gridName() const
void RicMswBranch::addSegment( std::unique_ptr<RicMswSegment> segment )
{
return m_gridName;
m_segments.push_back( std::move( segment ) );
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
size_t RicMswSubSegmentCellIntersection::globalCellIndex() const
void RicMswBranch::insertAfterSegment( const RicMswSegment* insertAfter, std::unique_ptr<RicMswSegment> insertItem )
{
return m_globalCellIndex;
auto it = std::find_if( m_segments.begin(), m_segments.end(), [insertAfter]( auto& item ) {
return item.get() == insertAfter;
} );
m_segments.insert( it, std::move( insertItem ) );
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
cvf::Vec3st RicMswSubSegmentCellIntersection::gridLocalCellIJK() const
void RicMswBranch::sortSegments()
{
return m_gridLocalCellIJK;
std::stable_sort( m_segments.begin(),
m_segments.end(),
[]( const std::unique_ptr<RicMswSegment>& lhs, const std::unique_ptr<RicMswSegment>& rhs ) {
return *lhs < *rhs;
} );
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
const cvf::Vec3d& RicMswSubSegmentCellIntersection::lengthsInCell() const
const RimWellPath* RicMswBranch::wellPath() const
{
return m_lengthsInCell;
return m_wellPath;
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
RicMswSubSegment::RicMswSubSegment( double startMD, double endMD, double startTVD, double endTVD )
: m_startMD( startMD )
, m_endMD( endMD )
, m_startTVD( startTVD )
, m_endTVD( endTVD )
, m_segmentNumber( -1 )
double RicMswBranch::startMD() const
{
return m_initialMD;
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
double RicMswSubSegment::startMD() const
double RicMswBranch::startTVD() const
{
return m_startMD;
return m_initialTVD;
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
double RicMswSubSegment::endMD() const
double RicMswBranch::endMD() const
{
return m_endMD;
if ( !m_segments.empty() )
{
return m_segments.back()->endMD();
}
return m_initialMD;
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
double RicMswSubSegment::deltaMD() const
double RicMswBranch::endTVD() const
{
return m_endMD - m_startMD;
if ( !m_segments.empty() )
{
return m_segments.back()->endTVD();
}
return m_initialTVD;
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
double RicMswSubSegment::startTVD() const
int RicMswBranch::branchNumber() const
{
return m_startTVD;
return m_branchNumber;
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
double RicMswSubSegment::endTVD() const
void RicMswBranch::setBranchNumber( int branchNumber )
{
return m_endTVD;
m_branchNumber = branchNumber;
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
double RicMswSubSegment::deltaTVD() const
std::vector<const RicMswSegment*> RicMswBranch::segments() const
{
return m_endTVD - m_startTVD;
std::vector<const RicMswSegment*> allSegments;
for ( const auto& segment : m_segments )
{
allSegments.push_back( segment.get() );
}
return allSegments;
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
int RicMswSubSegment::segmentNumber() const
std::vector<RicMswSegment*> RicMswBranch::segments()
{
return m_segmentNumber;
std::vector<RicMswSegment*> allSegments;
for ( auto& segment : m_segments )
{
allSegments.push_back( segment.get() );
}
return allSegments;
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RicMswSubSegment::setSegmentNumber( int segmentNumber )
size_t RicMswBranch::segmentCount() const
{
m_segmentNumber = segmentNumber;
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RicMswSubSegment::addIntersection( std::shared_ptr<RicMswSubSegmentCellIntersection> intersection )
{
m_intersections.push_back( intersection );
return m_segments.size();
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
const std::vector<std::shared_ptr<RicMswSubSegmentCellIntersection>>& RicMswSubSegment::intersections() const
std::vector<const RicMswBranch*> RicMswBranch::branches() const
{
return m_intersections;
std::vector<const RicMswBranch*> branches;
for ( const auto& branch : m_branches )
{
branches.push_back( branch.get() );
}
return branches;
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
std::vector<std::shared_ptr<RicMswSubSegmentCellIntersection>>& RicMswSubSegment::intersections()
std::vector<RicMswBranch*> RicMswBranch::branches()
{
return m_intersections;
std::vector<RicMswBranch*> branches;
for ( auto& branch : m_branches )
{
branches.push_back( branch.get() );
}
return branches;
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RicMswBranch::addChildBranch( std::unique_ptr<RicMswBranch> branch )
{
m_branches.push_back( std::move( branch ) );
}

View File

@ -0,0 +1,73 @@
/////////////////////////////////////////////////////////////////////////////////
//
// Copyright (C) 2021- Equinor ASA
//
// ResInsight is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// ResInsight is distributed in the hope that it will be useful, but WITHOUT ANY
// WARRANTY; without even the implied warranty of MERCHANTABILITY or
// FITNESS FOR A PARTICULAR PURPOSE.
//
// See the GNU General Public License at <http://www.gnu.org/licenses/gpl.html>
// for more details.
//
/////////////////////////////////////////////////////////////////////////////////
#pragma once
#include "RicMswItem.h"
#include "RicMswSegment.h"
#include "cafPdmPointer.h"
#include <memory>
#include <vector>
class RimWellPath;
class RicMswCompletion;
class RicMswSegment;
class RicMswBranch : public RicMswItem
{
public:
RicMswBranch( const QString& label, const RimWellPath* wellPath, double initialMD = 0.0, double initialTVD = 0.0 );
virtual ~RicMswBranch() = default;
void addSegment( std::unique_ptr<RicMswSegment> segment );
void insertAfterSegment( const RicMswSegment* insertAfter, std::unique_ptr<RicMswSegment> segment );
void sortSegments();
const RimWellPath* wellPath() const;
double startMD() const override;
double startTVD() const override;
double endMD() const override;
double endTVD() const override;
int branchNumber() const;
void setBranchNumber( int branchNumber );
std::vector<const RicMswSegment*> segments() const;
std::vector<RicMswSegment*> segments();
size_t segmentCount() const;
std::vector<const RicMswBranch*> branches() const;
std::vector<RicMswBranch*> branches();
void addChildBranch( std::unique_ptr<RicMswBranch> branch );
private:
double m_initialMD;
double m_initialTVD;
int m_branchNumber;
std::vector<std::unique_ptr<RicMswSegment>> m_segments;
std::vector<std::unique_ptr<RicMswBranch>> m_branches;
const RimWellPath* m_wellPath;
};

View File

@ -18,27 +18,22 @@
#include "RicMswCompletions.h"
#include "RicMswSubSegment.h"
#include "RicMswSegmentCellIntersection.h"
#include "RimWellPathValve.h"
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
RicMswCompletion::RicMswCompletion( const QString& label, size_t index /* = cvf::UNDEFINED_SIZE_T */, int branchNumber /*= 0*/ )
: m_label( label )
RicMswCompletion::RicMswCompletion( const QString& label,
const RimWellPath* wellPath,
double startMD,
double startTVD,
size_t index /* = cvf::UNDEFINED_SIZE_T */ )
: RicMswBranch( label, wellPath, startMD, startTVD )
, m_index( index )
, m_branchNumber( branchNumber )
{
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
const QString& RicMswCompletion::label() const
{
return m_label;
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
@ -50,58 +45,12 @@ size_t RicMswCompletion::index() const
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
int RicMswCompletion::branchNumber() const
{
return m_branchNumber;
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RicMswCompletion::setBranchNumber( int branchNumber )
{
m_branchNumber = branchNumber;
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RicMswCompletion::addSubSegment( std::shared_ptr<RicMswSubSegment> subSegment )
{
m_subSegments.push_back( subSegment );
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
std::vector<std::shared_ptr<RicMswSubSegment>>& RicMswCompletion::subSegments()
{
return m_subSegments;
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
const std::vector<std::shared_ptr<RicMswSubSegment>>& RicMswCompletion::subSegments() const
{
return m_subSegments;
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RicMswCompletion::setLabel( const QString& label )
{
m_label = label;
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
RicMswFracture::RicMswFracture( const QString& label,
size_t index /*= cvf::UNDEFINED_SIZE_T*/,
int branchNumber /*= cvf::UNDEFINED_INT*/ )
: RicMswCompletion( label, index, branchNumber )
RicMswFracture::RicMswFracture( const QString& label,
const RimWellPath* wellPath,
double startMD,
double startTVD,
size_t index /*= cvf::UNDEFINED_SIZE_T*/ )
: RicMswCompletion( label, wellPath, startMD, startTVD, index )
{
}
@ -116,10 +65,12 @@ RigCompletionData::CompletionType RicMswFracture::completionType() const
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
RicMswPerforation::RicMswPerforation( const QString& label,
size_t index /*= cvf::UNDEFINED_SIZE_T*/,
int branchNumber /*= cvf::UNDEFINED_INT*/ )
: RicMswCompletion( label, index, branchNumber )
RicMswPerforation::RicMswPerforation( const QString& label,
const RimWellPath* wellPath,
double startMD,
double startTVD,
size_t index /*= cvf::UNDEFINED_SIZE_T*/ )
: RicMswCompletion( label, wellPath, startMD, startTVD, index )
{
}
@ -134,8 +85,12 @@ RigCompletionData::CompletionType RicMswPerforation::completionType() const
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
RicMswValve::RicMswValve( const QString& label, const RimWellPathValve* wellPathValve )
: RicMswCompletion( label )
RicMswValve::RicMswValve( const QString& label,
const RimWellPath* wellPath,
double startMD,
double startTVD,
const RimWellPathValve* wellPathValve )
: RicMswCompletion( label, wellPath, startMD, startTVD )
, m_wellPathValve( wellPathValve )
, m_valid( false )
{
@ -168,8 +123,41 @@ void RicMswValve::setIsValid( bool valid )
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
RicMswWsegValve::RicMswWsegValve( const QString& label, const RimWellPathValve* wellPathValve )
: RicMswValve( label, wellPathValve )
std::unique_ptr<RicMswValve> RicMswValve::createExportValve( const QString& label,
const RimWellPath* wellPath,
double startMD,
double startTVD,
const RimWellPathValve* wellPathValve )
{
std::unique_ptr<RicMswValve> outletValve;
if ( wellPathValve->componentType() == RiaDefines::WellPathComponentType::ICD )
{
outletValve = std::make_unique<RicMswPerforationICD>( label, wellPath, startMD, startTVD, wellPathValve );
}
else if ( wellPathValve->componentType() == RiaDefines::WellPathComponentType::ICV )
{
outletValve = std::make_unique<RicMswPerforationICV>( label, wellPath, startMD, startTVD, wellPathValve );
}
else if ( wellPathValve->componentType() == RiaDefines::WellPathComponentType::AICD )
{
outletValve = std::make_unique<RicMswPerforationAICD>( label, wellPath, startMD, startTVD, wellPathValve );
}
else
{
CAF_ASSERT( false && "Valve needs to be either an ICD, ICVF or AICD" );
}
return outletValve;
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
RicMswWsegValve::RicMswWsegValve( const QString& label,
const RimWellPath* wellPath,
double startMD,
double startTVD,
const RimWellPathValve* wellPathValve )
: RicMswValve( label, wellPath, startMD, startTVD, wellPathValve )
, m_flowCoefficient( 0.0 )
, m_area( 0.0 )
{
@ -210,8 +198,12 @@ void RicMswWsegValve::setArea( double icdArea )
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
RicMswFishbonesICD::RicMswFishbonesICD( const QString& label, const RimWellPathValve* wellPathValve )
: RicMswWsegValve( label, wellPathValve )
RicMswFishbonesICD::RicMswFishbonesICD( const QString& label,
const RimWellPath* wellPath,
double startMD,
double startTVD,
const RimWellPathValve* wellPathValve )
: RicMswWsegValve( label, wellPath, startMD, startTVD, wellPathValve )
{
setIsValid( true );
}
@ -227,8 +219,12 @@ RigCompletionData::CompletionType RicMswFishbonesICD::completionType() const
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
RicMswPerforationICD::RicMswPerforationICD( const QString& label, const RimWellPathValve* wellPathValve )
: RicMswWsegValve( label, wellPathValve )
RicMswPerforationICD::RicMswPerforationICD( const QString& label,
const RimWellPath* wellPath,
double startMD,
double startTVD,
const RimWellPathValve* wellPathValve )
: RicMswWsegValve( label, wellPath, startMD, startTVD, wellPathValve )
{
}
@ -243,8 +239,12 @@ RigCompletionData::CompletionType RicMswPerforationICD::completionType() const
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
RicMswPerforationICV::RicMswPerforationICV( const QString& label, const RimWellPathValve* wellPathValve )
: RicMswWsegValve( label, wellPathValve )
RicMswPerforationICV::RicMswPerforationICV( const QString& label,
const RimWellPath* wellPath,
double startMD,
double startTVD,
const RimWellPathValve* wellPathValve )
: RicMswWsegValve( label, wellPath, startMD, startTVD, wellPathValve )
{
setIsValid( true );
}
@ -260,8 +260,12 @@ RigCompletionData::CompletionType RicMswPerforationICV::completionType() const
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
RicMswPerforationAICD::RicMswPerforationAICD( const QString& label, const RimWellPathValve* wellPathValve )
: RicMswValve( label, wellPathValve )
RicMswPerforationAICD::RicMswPerforationAICD( const QString& label,
const RimWellPath* wellPath,
double startMD,
double startTVD,
const RimWellPathValve* wellPathValve )
: RicMswValve( label, wellPath, startMD, startTVD, wellPathValve )
, m_deviceOpen( false )
, m_length( 0.0 )
, m_flowScalingFactor( 0.0 )

View File

@ -17,7 +17,7 @@
/////////////////////////////////////////////////////////////////////////////////
#pragma once
#include "RicMswSubSegment.h"
#include "RicMswBranch.h"
#include "RigCompletionData.h"
@ -33,38 +33,31 @@ class RimWellPathValve;
//==================================================================================================
///
//==================================================================================================
class RicMswCompletion
class RicMswCompletion : public RicMswBranch
{
public:
RicMswCompletion( const QString& label, size_t index = cvf::UNDEFINED_SIZE_T, int branchNumber = cvf::UNDEFINED_INT );
RicMswCompletion( const QString& label,
const RimWellPath* wellPath,
double startMD,
double startTVD,
size_t index = cvf::UNDEFINED_SIZE_T );
virtual RigCompletionData::CompletionType completionType() const = 0;
const QString& label() const;
size_t index() const;
int branchNumber() const;
void setBranchNumber( int branchNumber );
void addSubSegment( std::shared_ptr<RicMswSubSegment> subSegment );
std::vector<std::shared_ptr<RicMswSubSegment>>& subSegments();
const std::vector<std::shared_ptr<RicMswSubSegment>>& subSegments() const;
void setLabel( const QString& label );
size_t index() const;
private:
QString m_label;
size_t m_index;
int m_branchNumber;
std::vector<std::shared_ptr<RicMswSubSegment>> m_subSegments;
size_t m_index;
};
class RicMswFishbones : public RicMswCompletion
{
public:
RicMswFishbones( const QString& label, size_t index = cvf::UNDEFINED_SIZE_T, int branchNumber = cvf::UNDEFINED_INT )
: RicMswCompletion( label, index, branchNumber )
RicMswFishbones( const QString& label,
const RimWellPath* wellPath,
double startMD,
double startTVD,
size_t index = cvf::UNDEFINED_SIZE_T )
: RicMswCompletion( label, wellPath, startMD, startTVD, index )
{
}
@ -77,7 +70,11 @@ public:
class RicMswFracture : public RicMswCompletion
{
public:
RicMswFracture( const QString& label, size_t index = cvf::UNDEFINED_SIZE_T, int branchNumber = cvf::UNDEFINED_INT );
RicMswFracture( const QString& label,
const RimWellPath* wellPath,
double startMD,
double startTVD,
size_t index = cvf::UNDEFINED_SIZE_T );
RigCompletionData::CompletionType completionType() const override;
};
@ -87,7 +84,11 @@ public:
class RicMswPerforation : public RicMswCompletion
{
public:
RicMswPerforation( const QString& label, size_t index = cvf::UNDEFINED_SIZE_T, int branchNumber = cvf::UNDEFINED_INT );
RicMswPerforation( const QString& label,
const RimWellPath* wellPath,
double startMD,
double startTVD,
size_t index = cvf::UNDEFINED_SIZE_T );
RigCompletionData::CompletionType completionType() const override;
};
@ -97,7 +98,11 @@ public:
class RicMswValve : public RicMswCompletion
{
public:
RicMswValve( const QString& label, const RimWellPathValve* wellPathValve );
RicMswValve( const QString& label,
const RimWellPath* wellPath,
double startMD,
double startTVD,
const RimWellPathValve* wellPathValve );
virtual ~RicMswValve() {}
@ -106,6 +111,12 @@ public:
bool isValid() const;
void setIsValid( bool valid );
static std::unique_ptr<RicMswValve> createExportValve( const QString& label,
const RimWellPath* wellPath,
double startMD,
double startTVD,
const RimWellPathValve* wellPathValve );
private:
bool m_valid;
const RimWellPathValve* m_wellPathValve;
@ -117,7 +128,11 @@ private:
class RicMswWsegValve : public RicMswValve
{
public:
RicMswWsegValve( const QString& label, const RimWellPathValve* wellPathValve );
RicMswWsegValve( const QString& label,
const RimWellPath* wellPath,
double startMD,
double startTVD,
const RimWellPathValve* wellPathValve );
double flowCoefficient() const;
double area() const;
@ -135,7 +150,11 @@ private:
class RicMswFishbonesICD : public RicMswWsegValve
{
public:
RicMswFishbonesICD( const QString& label, const RimWellPathValve* wellPathValve );
RicMswFishbonesICD( const QString& label,
const RimWellPath* wellPath,
double startMD,
double startTVD,
const RimWellPathValve* wellPathValve );
RigCompletionData::CompletionType completionType() const override;
};
@ -145,7 +164,11 @@ public:
class RicMswPerforationICD : public RicMswWsegValve
{
public:
RicMswPerforationICD( const QString& label, const RimWellPathValve* wellPathValve );
RicMswPerforationICD( const QString& label,
const RimWellPath* wellPath,
double startMD,
double startTVD,
const RimWellPathValve* wellPathValve );
RigCompletionData::CompletionType completionType() const override;
};
@ -155,7 +178,11 @@ public:
class RicMswPerforationICV : public RicMswWsegValve
{
public:
RicMswPerforationICV( const QString& label, const RimWellPathValve* wellPathValve );
RicMswPerforationICV( const QString& label,
const RimWellPath* wellPath,
double startMD,
double startTVD,
const RimWellPathValve* wellPathValve );
RigCompletionData::CompletionType completionType() const override;
};
@ -165,7 +192,11 @@ public:
class RicMswPerforationAICD : public RicMswValve
{
public:
RicMswPerforationAICD( const QString& label, const RimWellPathValve* wellPathValve );
RicMswPerforationAICD( const QString& label,
const RimWellPath* wellPath,
double startMD,
double startTVD,
const RimWellPathValve* wellPathValve );
RigCompletionData::CompletionType completionType() const override;
bool isOpen() const;

View File

@ -36,15 +36,18 @@ RicMswExportInfo::RicMswExportInfo( const RimWellPath* wellPath,
double initialMD,
const QString& lengthAndDepthText,
const QString& pressureDropText )
: m_wellPath( wellPath )
, m_initialMD( initialMD )
, m_unitSystem( unitSystem )
: m_unitSystem( unitSystem )
, m_topWellBoreVolume( RicMswExportInfo::defaultDoubleValue() )
, m_linerDiameter( RimMswCompletionParameters::defaultLinerDiameter( unitSystem ) )
, m_roughnessFactor( RimMswCompletionParameters::defaultRoughnessFactor( unitSystem ) )
, m_lengthAndDepthText( lengthAndDepthText )
, m_pressureDropText( pressureDropText )
, m_hasSubGridIntersections( false )
, m_mainBoreBranch(
std::make_unique<RicMswBranch>( "Main Stem",
wellPath,
initialMD,
-wellPath->wellPathGeometry()->interpolatedPointAlongWellPath( initialMD ).z() ) )
{
}
@ -72,48 +75,6 @@ void RicMswExportInfo::setHasSubGridIntersections( bool subGridIntersections )
m_hasSubGridIntersections = subGridIntersections;
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RicMswExportInfo::addSegment( std::shared_ptr<RicMswSegment> location )
{
m_segments.push_back( location );
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RicMswExportInfo::sortSegments()
{
std::sort( m_segments.begin(),
m_segments.end(),
[]( std::shared_ptr<RicMswSegment> lhs, std::shared_ptr<RicMswSegment> rhs ) { return *lhs < *rhs; } );
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
const RimWellPath* RicMswExportInfo::wellPath() const
{
return m_wellPath;
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
double RicMswExportInfo::initialMD() const
{
return m_initialMD;
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
double RicMswExportInfo::initialTVD() const
{
return -m_wellPath->wellPathGeometry()->interpolatedPointAlongWellPath( m_initialMD ).z();
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
@ -181,15 +142,15 @@ double RicMswExportInfo::defaultDoubleValue()
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
const std::vector<std::shared_ptr<RicMswSegment>>& RicMswExportInfo::segments() const
const RicMswBranch* RicMswExportInfo::mainBoreBranch() const
{
return m_segments;
return m_mainBoreBranch.get();
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
std::vector<std::shared_ptr<RicMswSegment>>& RicMswExportInfo::segments()
RicMswBranch* RicMswExportInfo::mainBoreBranch()
{
return m_segments;
return m_mainBoreBranch.get();
}

View File

@ -20,6 +20,7 @@
#include "RiaDefines.h"
#include "RicMswBranch.h"
#include "RicMswSegment.h"
#include <QString>
@ -27,7 +28,7 @@
#include <memory>
class RimWellPath;
class RimFishbonesMultipleSubs;
class RimFishbones;
//==================================================================================================
///
@ -45,13 +46,7 @@ public:
void setRoughnessFactor( double roughnessFactor );
void setHasSubGridIntersections( bool subGridIntersections );
void addSegment( std::shared_ptr<RicMswSegment> location );
void sortSegments();
const RimWellPath* wellPath() const;
RiaDefines::EclipseUnitSystem unitSystem() const;
double initialMD() const;
double initialTVD() const;
double topWellBoreVolume() const;
double linerDiameter() const;
double roughnessFactor() const;
@ -60,13 +55,11 @@ public:
bool hasSubGridIntersections() const;
static double defaultDoubleValue();
const std::vector<std::shared_ptr<RicMswSegment>>& segments() const;
std::vector<std::shared_ptr<RicMswSegment>>& segments();
const RicMswBranch* mainBoreBranch() const;
RicMswBranch* mainBoreBranch();
private:
const RimWellPath* m_wellPath;
RiaDefines::EclipseUnitSystem m_unitSystem;
double m_initialMD;
double m_topWellBoreVolume;
double m_linerDiameter;
double m_roughnessFactor;
@ -74,5 +67,5 @@ private:
QString m_pressureDropText;
bool m_hasSubGridIntersections;
std::vector<std::shared_ptr<RicMswSegment>> m_segments;
std::unique_ptr<RicMswBranch> m_mainBoreBranch;
};

View File

@ -0,0 +1,49 @@
#include "RicMswItem.h"
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
RicMswItem::RicMswItem( const QString& label )
: m_label( label )
{
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
QString RicMswItem::label() const
{
return m_label;
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RicMswItem::setLabel( const QString& label )
{
m_label = label;
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
double RicMswItem::deltaMD() const
{
return endMD() - startMD();
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
double RicMswItem::deltaTVD() const
{
return endTVD() - startTVD();
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
bool RicMswItem::operator<( const RicMswItem& rhs ) const
{
return startMD() < rhs.startMD();
}

View File

@ -1,6 +1,6 @@
/////////////////////////////////////////////////////////////////////////////////
//
// Copyright (C) 2020- Equinor ASA
// Copyright (C) 2021- Equinor ASA
//
// ResInsight is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
@ -15,7 +15,29 @@
// for more details.
//
/////////////////////////////////////////////////////////////////////////////////
#pragma once
#include "RimWellPathGeometryDefInterface.h"
#include <QString>
CAF_PDM_XML_ABSTRACT_SOURCE_INIT( RimWellPathGeometryDefInterface, "WellPathGeometryDefInterface" );
class RicMswItem
{
public:
RicMswItem( const QString& label );
virtual ~RicMswItem() = default;
QString label() const;
void setLabel( const QString& label );
virtual double startMD() const = 0;
virtual double endMD() const = 0;
double deltaMD() const;
virtual double startTVD() const = 0;
virtual double endTVD() const = 0;
double deltaTVD() const;
bool operator<( const RicMswItem& rhs ) const;
protected:
QString m_label;
};

View File

@ -15,9 +15,9 @@
// for more details.
//
/////////////////////////////////////////////////////////////////////////////////
#include "RicMswSegment.h"
#include "RicMswCompletions.h"
#include "RicMswExportInfo.h"
#include <cafPdmBase.h>
@ -33,7 +33,7 @@ RicMswSegment::RicMswSegment( const QString& label,
double endTVD,
size_t subIndex,
int segmentNumber /*= -1*/ )
: m_label( label )
: RicMswItem( label )
, m_startMD( startMD )
, m_endMD( endMD )
, m_startTVD( startTVD )
@ -49,14 +49,6 @@ RicMswSegment::RicMswSegment( const QString& label,
{
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
QString RicMswSegment::label() const
{
return m_label;
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
@ -73,38 +65,6 @@ double RicMswSegment::endMD() const
return m_endMD;
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RicMswSegment::setOutputMD( double outputMD )
{
m_outputMD = outputMD;
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
double RicMswSegment::outputMD() const
{
return m_outputMD;
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
double RicMswSegment::length() const
{
return m_endMD - m_startMD;
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
double RicMswSegment::deltaMD() const
{
return m_endMD - m_startMD;
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
@ -121,6 +81,22 @@ double RicMswSegment::endTVD() const
return m_endTVD;
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RicMswSegment::setOutputMD( double outputMD )
{
m_outputMD = outputMD;
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
double RicMswSegment::outputMD() const
{
return m_outputMD;
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
@ -137,14 +113,6 @@ double RicMswSegment::outputTVD() const
return m_outputTVD;
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
double RicMswSegment::deltaTVD() const
{
return m_endTVD - m_startTVD;
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
@ -196,17 +164,27 @@ int RicMswSegment::segmentNumber() const
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
const std::vector<std::shared_ptr<RicMswCompletion>>& RicMswSegment::completions() const
std::vector<const RicMswCompletion*> RicMswSegment::completions() const
{
return m_completions;
std::vector<const RicMswCompletion*> allCompletions;
for ( const auto& completion : m_completions )
{
allCompletions.push_back( completion.get() );
}
return allCompletions;
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
std::vector<std::shared_ptr<RicMswCompletion>>& RicMswSegment::completions()
std::vector<RicMswCompletion*> RicMswSegment::completions()
{
return m_completions;
std::vector<RicMswCompletion*> allCompletions;
for ( auto& completion : m_completions )
{
allCompletions.push_back( completion.get() );
}
return allCompletions;
}
//--------------------------------------------------------------------------------------------------
@ -260,24 +238,51 @@ void RicMswSegment::setSegmentNumber( int segmentNumber )
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RicMswSegment::addCompletion( std::shared_ptr<RicMswCompletion> completion )
void RicMswSegment::addCompletion( std::unique_ptr<RicMswCompletion> completion )
{
m_completions.push_back( completion );
m_completions.push_back( std::move( completion ) );
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RicMswSegment::removeCompletion( std::shared_ptr<RicMswCompletion> completion )
std::unique_ptr<RicMswCompletion> RicMswSegment::removeCompletion( RicMswCompletion* completion )
{
std::unique_ptr<RicMswCompletion> removedCompletion;
for ( auto it = m_completions.begin(); it != m_completions.end(); ++it )
{
if ( ( *it ) == completion )
if ( it->get() == completion )
{
removedCompletion = std::move( *it );
m_completions.erase( it );
break;
}
}
return removedCompletion;
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RicMswSegment::addIntersection( std::shared_ptr<RicMswSegmentCellIntersection> intersection )
{
m_intersections.push_back( intersection );
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
const std::vector<std::shared_ptr<RicMswSegmentCellIntersection>>& RicMswSegment::intersections() const
{
return m_intersections;
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
std::vector<std::shared_ptr<RicMswSegmentCellIntersection>>& RicMswSegment::intersections()
{
return m_intersections;
}
//--------------------------------------------------------------------------------------------------
@ -295,11 +300,3 @@ const caf::PdmObject* RicMswSegment::sourcePdmObject() const
{
return m_sourcePdmObject;
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
bool RicMswSegment::operator<( const RicMswSegment& rhs ) const
{
return startMD() < rhs.startMD();
}

View File

@ -17,16 +17,21 @@
/////////////////////////////////////////////////////////////////////////////////
#pragma once
#include "RicMswCompletions.h"
#include "RicMswItem.h"
#include "RicMswSegmentCellIntersection.h"
#include <cafPdmPointer.h>
#include "cafPdmObject.h"
#include "cafPdmPointer.h"
#include "cvfMath.h"
#include <memory>
class RicMswCompletion;
//==================================================================================================
///
//==================================================================================================
class RicMswSegment
class RicMswSegment : public RicMswItem
{
public:
RicMswSegment( const QString& label,
@ -37,20 +42,16 @@ public:
size_t subIndex = cvf::UNDEFINED_SIZE_T,
int segmentNumber = -1 );
QString label() const;
double startMD() const override;
double endMD() const override;
double startTVD() const override;
double endTVD() const override;
double startMD() const;
double endMD() const;
void setOutputMD( double outputMD );
double outputMD() const;
double length() const;
double deltaMD() const;
double startTVD() const;
double endTVD() const;
void setOutputTVD( double outputTVD );
double outputTVD() const;
double deltaTVD() const;
double effectiveDiameter() const;
double holeDiameter() const;
@ -60,8 +61,8 @@ public:
size_t subIndex() const;
int segmentNumber() const;
const std::vector<std::shared_ptr<RicMswCompletion>>& completions() const;
std::vector<std::shared_ptr<RicMswCompletion>>& completions();
std::vector<const RicMswCompletion*> completions() const;
std::vector<RicMswCompletion*> completions();
void setLabel( const QString& label );
void setEffectiveDiameter( double effectiveDiameter );
@ -69,31 +70,38 @@ public:
void setOpenHoleRoughnessFactor( double roughnessFactor );
void setSkinFactor( double skinFactor );
void setSegmentNumber( int segmentNumber );
void addCompletion( std::shared_ptr<RicMswCompletion> completion );
void removeCompletion( std::shared_ptr<RicMswCompletion> completion );
void addCompletion( std::unique_ptr<RicMswCompletion> completion );
std::unique_ptr<RicMswCompletion> removeCompletion( RicMswCompletion* completion );
void addIntersection( std::shared_ptr<RicMswSegmentCellIntersection> intersection );
const std::vector<std::shared_ptr<RicMswSegmentCellIntersection>>& intersections() const;
std::vector<std::shared_ptr<RicMswSegmentCellIntersection>>& intersections();
void setSourcePdmObject( const caf::PdmObject* object );
const caf::PdmObject* sourcePdmObject() const;
bool operator<( const RicMswSegment& rhs ) const;
private:
QString m_label;
double m_startMD;
double m_endMD;
double m_startTVD;
double m_endTVD;
double m_startMD;
double m_endMD;
double m_startTVD;
double m_endTVD;
double m_outputMD;
double m_outputTVD;
double m_effectiveDiameter;
double m_holeDiameter;
double m_openHoleRoughnessFactor;
double m_skinFactor;
double m_effectiveDiameter;
double m_holeDiameter;
double m_openHoleRoughnessFactor;
double m_skinFactor;
size_t m_subIndex;
int m_segmentNumber;
std::vector<std::shared_ptr<RicMswCompletion>> m_completions;
std::vector<std::unique_ptr<RicMswCompletion>> m_completions;
std::vector<std::shared_ptr<RicMswSegmentCellIntersection>> m_intersections;
caf::PdmPointer<caf::PdmObject> m_sourcePdmObject;
};

View File

@ -0,0 +1,65 @@
/////////////////////////////////////////////////////////////////////////////////
//
// Copyright (C) 2018 Equinor ASA
//
// ResInsight is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// ResInsight is distributed in the hope that it will be useful, but WITHOUT ANY
// WARRANTY; without even the implied warranty of MERCHANTABILITY or
// FITNESS FOR A PARTICULAR PURPOSE.
//
// See the GNU General Public License at <http://www.gnu.org/licenses/gpl.html>
// for more details.
//
/////////////////////////////////////////////////////////////////////////////////
#include "RicMswSegmentCellIntersection.h"
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
RicMswSegmentCellIntersection::RicMswSegmentCellIntersection( const QString& gridName,
size_t globalCellIndex,
const cvf::Vec3st& gridLocalCellIJK,
const cvf::Vec3d& lengthsInCell )
: m_gridName( gridName )
, m_globalCellIndex( globalCellIndex )
, m_gridLocalCellIJK( gridLocalCellIJK )
, m_lengthsInCell( lengthsInCell )
{
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
const QString& RicMswSegmentCellIntersection::gridName() const
{
return m_gridName;
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
size_t RicMswSegmentCellIntersection::globalCellIndex() const
{
return m_globalCellIndex;
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
cvf::Vec3st RicMswSegmentCellIntersection::gridLocalCellIJK() const
{
return m_gridLocalCellIJK;
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
const cvf::Vec3d& RicMswSegmentCellIntersection::lengthsInCell() const
{
return m_lengthsInCell;
}

View File

@ -26,10 +26,10 @@
//==================================================================================================
///
//==================================================================================================
class RicMswSubSegmentCellIntersection
class RicMswSegmentCellIntersection
{
public:
RicMswSubSegmentCellIntersection( const QString& gridName, // Pass in empty string for main grid
RicMswSegmentCellIntersection( const QString& gridName, // Pass in empty string for main grid
size_t globalCellIndex,
const cvf::Vec3st& gridLocalCellIJK,
const cvf::Vec3d& lengthsInCell );
@ -44,35 +44,3 @@ private:
cvf::Vec3st m_gridLocalCellIJK;
cvf::Vec3d m_lengthsInCell;
};
//==================================================================================================
///
//==================================================================================================
class RicMswSubSegment
{
public:
RicMswSubSegment( double startMD, double endMD, double startTVD, double endTVD );
double startMD() const;
double endMD() const;
double deltaMD() const;
double startTVD() const;
double endTVD() const;
double deltaTVD() const;
int segmentNumber() const;
void setSegmentNumber( int segmentNumber );
void addIntersection( std::shared_ptr<RicMswSubSegmentCellIntersection> intersection );
const std::vector<std::shared_ptr<RicMswSubSegmentCellIntersection>>& intersections() const;
std::vector<std::shared_ptr<RicMswSubSegmentCellIntersection>>& intersections();
private:
double m_startMD;
double m_endMD;
double m_startTVD;
double m_endTVD;
int m_segmentNumber;
std::vector<std::shared_ptr<RicMswSubSegmentCellIntersection>> m_intersections;
};

View File

@ -27,7 +27,7 @@
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
RicMswICDAccumulator::RicMswICDAccumulator( std::shared_ptr<RicMswValve> valve, RiaDefines::EclipseUnitSystem unitSystem )
RicMswICDAccumulator::RicMswICDAccumulator( RicMswValve* valve, RiaDefines::EclipseUnitSystem unitSystem )
: RicMswValveAccumulator( valve, unitSystem )
, m_areaSum( 0.0 )
{
@ -70,7 +70,7 @@ bool RicMswICDAccumulator::accumulateValveParameters( const RimWellPathValve* we
//--------------------------------------------------------------------------------------------------
void RicMswICDAccumulator::applyToSuperValve()
{
std::shared_ptr<RicMswWsegValve> icd = std::dynamic_pointer_cast<RicMswWsegValve>( m_valve );
auto icd = dynamic_cast<RicMswWsegValve*>( m_valve );
CVF_ASSERT( icd );
if ( m_coefficientCalculator.validAggregatedWeight() && m_valid )
@ -84,7 +84,7 @@ void RicMswICDAccumulator::applyToSuperValve()
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
RicMswAICDAccumulator::RicMswAICDAccumulator( std::shared_ptr<RicMswValve> valve, RiaDefines::EclipseUnitSystem unitSystem )
RicMswAICDAccumulator::RicMswAICDAccumulator( RicMswValve* valve, RiaDefines::EclipseUnitSystem unitSystem )
: RicMswValveAccumulator( valve, unitSystem )
, m_deviceOpen( false )
, m_accumulatedLength( 0.0 )
@ -145,8 +145,8 @@ bool RicMswAICDAccumulator::accumulateValveParameters( const RimWellPathValve* w
//--------------------------------------------------------------------------------------------------
void RicMswAICDAccumulator::applyToSuperValve()
{
const double eps = 1.0e-8;
std::shared_ptr<RicMswPerforationAICD> aicd = std::dynamic_pointer_cast<RicMswPerforationAICD>( m_valve );
const double eps = 1.0e-8;
auto aicd = dynamic_cast<RicMswPerforationAICD*>( m_valve );
if ( aicd && m_valid && m_accumulatedLength > eps )
{

View File

@ -22,7 +22,6 @@
#include "RimWellPathAicdParameters.h"
#include <array>
#include <memory>
class RimWellPathValve;
class RicMswValve;
@ -33,7 +32,7 @@ class RicMswValve;
class RicMswValveAccumulator
{
public:
RicMswValveAccumulator( std::shared_ptr<RicMswValve> valve, RiaDefines::EclipseUnitSystem unitSystem )
RicMswValveAccumulator( RicMswValve* valve, RiaDefines::EclipseUnitSystem unitSystem )
: m_valve( valve )
, m_unitSystem( unitSystem )
, m_valid( false )
@ -44,10 +43,10 @@ public:
double perforationCompsegsLength ) = 0;
virtual void applyToSuperValve() = 0;
std::shared_ptr<RicMswValve> superValve() const { return m_valve; }
RicMswValve* superValve() const { return m_valve; }
protected:
std::shared_ptr<RicMswValve> m_valve;
RicMswValve* m_valve;
RiaDefines::EclipseUnitSystem m_unitSystem;
bool m_valid;
};
@ -58,7 +57,7 @@ protected:
class RicMswICDAccumulator : public RicMswValveAccumulator
{
public:
RicMswICDAccumulator( std::shared_ptr<RicMswValve> valve, RiaDefines::EclipseUnitSystem unitSystem );
RicMswICDAccumulator( RicMswValve* valve, RiaDefines::EclipseUnitSystem unitSystem );
bool accumulateValveParameters( const RimWellPathValve* wellPathValve,
double overlapLength,
double perforationCompsegsLength ) override;
@ -75,7 +74,7 @@ private:
class RicMswAICDAccumulator : public RicMswValveAccumulator
{
public:
RicMswAICDAccumulator( std::shared_ptr<RicMswValve> valve, RiaDefines::EclipseUnitSystem unitSystem );
RicMswAICDAccumulator( RicMswValve* valve, RiaDefines::EclipseUnitSystem unitSystem );
bool accumulateValveParameters( const RimWellPathValve* wellPathValve,
double overlapLength,
double perforationCompsegsLength ) override;

View File

@ -25,7 +25,7 @@
#include "RicExportFeatureImpl.h"
#include "RimDialogData.h"
#include "RimFishbonesMultipleSubs.h"
#include "RimFishbones.h"
#include "RimPerforationInterval.h"
#include "RimProject.h"
#include "RimSimWellFracture.h"
@ -87,10 +87,10 @@ void RicWellPathExportCompletionDataFeature::prepareExportSettingsAndExportCompl
if ( exportSettings->folder().isEmpty() ) exportSettings->folder = defaultDir;
std::vector<RimSimWellFracture*> simWellFractures;
std::vector<RimWellPathFracture*> wellPathFractures;
std::vector<RimFishbonesMultipleSubs*> wellPathFishbones;
std::vector<RimPerforationInterval*> wellPathPerforations;
std::vector<RimSimWellFracture*> simWellFractures;
std::vector<RimWellPathFracture*> wellPathFractures;
std::vector<RimFishbones*> wellPathFishbones;
std::vector<RimPerforationInterval*> wellPathPerforations;
for ( auto s : simWells )
{
@ -222,5 +222,10 @@ std::vector<RimWellPath*> RicWellPathExportCompletionDataFeature::selectedWellPa
}
}
wellPaths.erase( std::remove_if( wellPaths.begin(),
wellPaths.end(),
[]( auto wellPath ) { return !wellPath->isTopLevelWellPath(); } ),
wellPaths.end() );
return wellPaths;
}

View File

@ -51,8 +51,8 @@
#include "RigWellPathIntersectionTools.h"
#include "RimFileWellPath.h"
#include "RimFishbones.h"
#include "RimFishbonesCollection.h"
#include "RimFishbonesMultipleSubs.h"
#include "RimFractureTemplate.h"
#include "RimNonDarcyPerforationParameters.h"
#include "RimPerforationCollection.h"
@ -298,7 +298,7 @@ void RicWellPathExportCompletionDataFeatureImpl::exportCompletions( const std::v
std::vector<RicWellPathFractureReportItem> reportItemsForWell;
for ( const auto& fracItem : fractureDataReportItems )
{
if ( fracItem.wellPathNameForExport() == wellPath->completions()->wellNameForExport() )
if ( fracItem.wellPathNameForExport() == wellPath->completionSettings()->wellNameForExport() )
{
reportItemsForWell.push_back( fracItem );
}
@ -353,7 +353,8 @@ void RicWellPathExportCompletionDataFeatureImpl::exportCompletions( const std::v
std::vector<RicWellPathFractureReportItem> reportItemsForWell;
for ( const auto& fracItem : fractureDataReportItems )
{
if ( fracItem.wellPathNameForExport() == wellPath->completions()->wellNameForExport() )
if ( fracItem.wellPathNameForExport() ==
wellPath->completionSettings()->wellNameForExport() )
{
reportItemsForWell.push_back( fracItem );
}
@ -688,7 +689,7 @@ void RicWellPathExportCompletionDataFeatureImpl::exportWellPathFractureReport(
{
for ( const auto& reportItem : sortedReportItems )
{
if ( reportItem.wellPathNameForExport() == wellPath->completions()->wellNameForExport() )
if ( reportItem.wellPathNameForExport() == wellPath->completionSettings()->wellNameForExport() )
{
wellPathsSet.insert( wellPath );
}
@ -749,22 +750,22 @@ void RicWellPathExportCompletionDataFeatureImpl::exportWelspecsToFile( RimEclips
// Export
for ( const auto wellPath : wellPathSet )
{
auto rimCompletions = wellPath->completions();
auto ijIntersection = wellPathUpperGridIntersectionIJ( gridCase, wellPath );
auto completionSettings = wellPath->completionSettings();
auto ijIntersection = wellPathUpperGridIntersectionIJ( gridCase, wellPath );
formatter.add( rimCompletions->wellNameForExport() )
.add( rimCompletions->wellGroupNameForExport() )
formatter.add( completionSettings->wellNameForExport() )
.add( completionSettings->wellGroupNameForExport() )
.addOneBasedCellIndex( ijIntersection.second.x() )
.addOneBasedCellIndex( ijIntersection.second.y() )
.add( rimCompletions->referenceDepthForExport() )
.add( rimCompletions->wellTypeNameForExport() )
.add( rimCompletions->drainageRadiusForExport() )
.add( rimCompletions->gasInflowEquationForExport() )
.add( rimCompletions->automaticWellShutInForExport() )
.add( rimCompletions->allowWellCrossFlowForExport() )
.add( rimCompletions->wellBoreFluidPVTForExport() )
.add( rimCompletions->hydrostaticDensityForExport() )
.add( rimCompletions->fluidInPlaceRegionForExport() )
.add( completionSettings->referenceDepthForExport() )
.add( completionSettings->wellTypeNameForExport() )
.add( completionSettings->drainageRadiusForExport() )
.add( completionSettings->gasInflowEquationForExport() )
.add( completionSettings->automaticWellShutInForExport() )
.add( completionSettings->allowWellCrossFlowForExport() )
.add( completionSettings->wellBoreFluidPVTForExport() )
.add( completionSettings->hydrostaticDensityForExport() )
.add( completionSettings->fluidInPlaceRegionForExport() )
.rowCompleted();
}
@ -839,22 +840,22 @@ void RicWellPathExportCompletionDataFeatureImpl::exportWelspeclToFile(
std::tie( measuredDepth, ijIntersection, lgrName ) = itemWithLowestMD;
auto rimCompletions = wellPath->completions();
auto completionSettings = wellPath->completionSettings();
formatter.add( rimCompletions->wellNameForExport() )
.add( rimCompletions->wellGroupNameForExport() )
formatter.add( completionSettings->wellNameForExport() )
.add( completionSettings->wellGroupNameForExport() )
.add( lgrName )
.addOneBasedCellIndex( ijIntersection.x() )
.addOneBasedCellIndex( ijIntersection.y() )
.add( rimCompletions->referenceDepthForExport() )
.add( rimCompletions->wellTypeNameForExport() )
.add( rimCompletions->drainageRadiusForExport() )
.add( rimCompletions->gasInflowEquationForExport() )
.add( rimCompletions->automaticWellShutInForExport() )
.add( rimCompletions->allowWellCrossFlowForExport() )
.add( rimCompletions->wellBoreFluidPVTForExport() )
.add( rimCompletions->hydrostaticDensityForExport() )
.add( rimCompletions->fluidInPlaceRegionForExport() )
.add( completionSettings->referenceDepthForExport() )
.add( completionSettings->wellTypeNameForExport() )
.add( completionSettings->drainageRadiusForExport() )
.add( completionSettings->gasInflowEquationForExport() )
.add( completionSettings->automaticWellShutInForExport() )
.add( completionSettings->allowWellCrossFlowForExport() )
.add( completionSettings->wellBoreFluidPVTForExport() )
.add( completionSettings->hydrostaticDensityForExport() )
.add( completionSettings->fluidInPlaceRegionForExport() )
.rowCompleted();
}
}
@ -1190,7 +1191,7 @@ std::vector<RigCompletionData> RicWellPathExportCompletionDataFeatureImpl::gener
bool cellIsActive = activeCellInfo->isActive( cell.globCellIndex );
if ( !cellIsActive ) continue;
RigCompletionData completion( wellPath->completions()->wellNameForExport(),
RigCompletionData completion( wellPath->completionSettings()->wellNameForExport(),
RigCompletionDataGridCell( cell.globCellIndex,
settings.caseToApply->mainGrid() ),
cell.startMD );

View File

@ -38,7 +38,7 @@ class RigCell;
class RigEclipseCaseData;
class RigMainGrid;
class RimEclipseCase;
class RimFishbonesMultipleSubs;
class RimFishbones;
class RimSimWellInView;
class RimPerforationInterval;
class RimWellPath;

View File

@ -88,7 +88,7 @@ const RimWellPath* RicWellPathExportCompletionsFileTools::findWellPathFromExport
for ( const auto wellPath : allWellPaths )
{
if ( wellPath->completions()->wellNameForExport() == wellNameForExport ) return wellPath;
if ( wellPath->completionSettings()->wellNameForExport() == wellNameForExport ) return wellPath;
}
return nullptr;
}

View File

@ -17,16 +17,21 @@
/////////////////////////////////////////////////////////////////////////////////
#pragma once
#include "RicMswBranch.h"
#include "RicMswCompletions.h"
#include "RicMswExportInfo.h"
#include "RicMswSegment.h"
#include "RigCompletionData.h"
#include <gsl/gsl>
#include <set>
class RicExportCompletionDataSettingsUi;
class RifTextDataTableFormatter;
class RigActiveCellInfo;
class RimEclipseCase;
class RimFishbonesMultipleSubs;
class RimFishbones;
class RimPerforationInterval;
class RimWellPath;
class RimWellPathValve;
@ -40,6 +45,24 @@ class QFile;
class RicWellPathExportMswCompletionsImpl
{
private:
class CvfVec3stComparator
{
public:
bool operator()( const cvf::Vec3st& lhs, const cvf::Vec3st& rhs ) const
{
if ( lhs.z() == rhs.z() )
{
if ( lhs.y() == rhs.y() )
{
return lhs.x() < rhs.x();
}
return lhs.y() < rhs.y();
}
return lhs.z() < rhs.z();
}
};
public:
static void exportWellSegmentsForAllCompletions( const RicExportCompletionDataSettingsUi& exportSettings,
const std::vector<RimWellPath*>& wellPaths );
@ -57,15 +80,23 @@ public:
const RimWellPath* wellPath,
int timeStep );
static RicMswExportInfo generateFishbonesMswExportInfo( const RimEclipseCase* caseToApply,
const RimWellPath* wellPath,
bool enableSegmentSplitting );
static void generateFishbonesMswExportInfo( const RimEclipseCase* caseToApply,
const RimWellPath* wellPath,
double initialMD,
const std::vector<WellPathCellIntersectionInfo>& cellIntersections,
bool enableSegmentSplitting,
gsl::not_null<RicMswExportInfo*> exportInfo,
gsl::not_null<RicMswBranch*> branch );
private:
static RicMswExportInfo generateFishbonesMswExportInfo( const RimEclipseCase* caseToApply,
const RimWellPath* wellPath,
const std::vector<RimFishbonesMultipleSubs*>& fishbonesSubs,
bool enableSegmentSplitting );
static void generateFishbonesMswExportInfo( const RimEclipseCase* caseToApply,
const RimWellPath* wellPath,
double initialMD,
const std::vector<WellPathCellIntersectionInfo>& cellIntersections,
const std::vector<RimFishbones*>& fishbonesSubs,
bool enableSegmentSplitting,
gsl::not_null<RicMswExportInfo*> exportInfo,
gsl::not_null<RicMswBranch*> branch );
static RicMswExportInfo generateFracturesMswExportInfo( RimEclipseCase* caseToApply, const RimWellPath* wellPath );
@ -73,14 +104,17 @@ private:
const RimWellPath* wellPath,
const std::vector<RimWellPathFracture*>& fractures );
static RicMswExportInfo
generatePerforationsMswExportInfo( RimEclipseCase* eclipseCase,
const RimWellPath* wellPath,
int timeStep,
const std::vector<const RimPerforationInterval*>& perforationIntervals );
static bool generatePerforationsMswExportInfo( RimEclipseCase* eclipseCase,
const RimWellPath* wellPath,
int timeStep,
double initialMD,
const std::vector<WellPathCellIntersectionInfo>& cellIntersections,
gsl::not_null<RicMswExportInfo*> exportInfo,
gsl::not_null<RicMswBranch*> branch );
static std::vector<WellPathCellIntersectionInfo>
generateCellSegments( const RimEclipseCase* eclipseCase, const RimWellPath* wellPath, double& initialMD );
static std::vector<WellPathCellIntersectionInfo> generateCellSegments( const RimEclipseCase* eclipseCase,
const RimWellPath* wellPath,
gsl::not_null<double*> initialMD );
static std::vector<WellPathCellIntersectionInfo>
filterIntersections( const std::vector<WellPathCellIntersectionInfo>& intersections,
@ -89,46 +123,52 @@ private:
gsl::not_null<const RimEclipseCase*> eclipseCase );
static void generateWelsegsTable( RifTextDataTableFormatter& formatter,
const RicMswExportInfo& exportInfo,
RicMswExportInfo& exportInfo,
double maxSegmentLength );
static void writeMainBoreWelsegsSegment( std::shared_ptr<RicMswSegment> segment,
std::shared_ptr<RicMswSegment> previousSegment,
RifTextDataTableFormatter& formatter,
const RicMswExportInfo& exportInfo,
double maxSegmentLength,
int* segmentNumber );
static void writeValveWelsegsSegment( std::shared_ptr<RicMswSegment> segment,
std::shared_ptr<RicMswValve> valve,
RifTextDataTableFormatter& formatter,
const RicMswExportInfo& exportInfo,
double maxSegmentLength,
int* segmentNumber );
static void writeCompletionWelsegsSegment( std::shared_ptr<RicMswSegment> segment,
std::shared_ptr<RicMswCompletion> completion,
RifTextDataTableFormatter& formatter,
const RicMswExportInfo& exportInfo,
double maxSegmentLength,
int* segmentNumber );
static void writeWelsegsSegmentsRecursively( RifTextDataTableFormatter& formatter,
RicMswExportInfo& exportInfo,
gsl::not_null<RicMswBranch*> branch,
gsl::not_null<int*> segmentNumber,
double maxSegmentLength,
RicMswSegment* connectedToSegment = nullptr );
static void generateWelsegsSegments( RifTextDataTableFormatter& formatter,
const RicMswExportInfo& exportInfo,
const std::set<RigCompletionData::CompletionType>& exportCompletionTypes,
double maxSegmentLength,
int* segmentNumber );
static void generateWelsegsCompletionCommentHeader( RifTextDataTableFormatter& formatter,
RigCompletionData::CompletionType completionType );
static void generateCompsegTables( RifTextDataTableFormatter& formatter, const RicMswExportInfo& exportInfo );
static void writeWelsegsSegment( RicMswSegment* segment,
const RicMswSegment* previousSegment,
RifTextDataTableFormatter& formatter,
RicMswExportInfo& exportInfo,
double maxSegmentLength,
gsl::not_null<RicMswBranch*> branch,
int* segmentNumber );
static void writeValveWelsegsSegment( const RicMswSegment* outletSegment,
RicMswValve* valve,
RifTextDataTableFormatter& formatter,
RicMswExportInfo& exportInfo,
double maxSegmentLength,
int* segmentNumber );
static void writeCompletionWelsegsSegments( gsl::not_null<const RicMswSegment*> outletSegment,
gsl::not_null<const RicMswCompletion*> completion,
RifTextDataTableFormatter& formatter,
RicMswExportInfo& exportInfo,
double maxSegmentLength,
int* segmentNumber );
static void writeWelsegsCompletionCommentHeader( RifTextDataTableFormatter& formatter,
RigCompletionData::CompletionType completionType );
static void generateCompsegTables( RifTextDataTableFormatter& formatter, RicMswExportInfo& exportInfo );
static void generateCompsegTable( RifTextDataTableFormatter& formatter,
const RicMswExportInfo& exportInfo,
RicMswExportInfo& exportInfo,
gsl::not_null<const RicMswBranch*> branch,
bool exportSubGridIntersections,
const std::set<RigCompletionData::CompletionType>& exportCompletionTypes );
const std::set<RigCompletionData::CompletionType>& exportCompletionTypes,
gsl::not_null<bool*> headerGenerated,
gsl::not_null<std::set<cvf::Vec3st, CvfVec3stComparator>*> intersectedCells );
static void generateCompsegHeader( RifTextDataTableFormatter& formatter,
const RicMswExportInfo& exportInfo,
RicMswExportInfo& exportInfo,
RigCompletionData::CompletionType completionType,
bool exportSubGridIntersections );
static void generateWsegvalvTable( RifTextDataTableFormatter& formatter, const RicMswExportInfo& exportInfo );
static void generateWsegAicdTable( RifTextDataTableFormatter& formatter, const RicMswExportInfo& exportInfo );
static void generateWsegvalvTable( RifTextDataTableFormatter& formatter, RicMswExportInfo& exportInfo );
static void generateWsegAicdTable( RifTextDataTableFormatter& formatter, RicMswExportInfo& exportInfo );
static std::pair<double, double>
calculateOverlapWithActiveCells( double startMD,
@ -137,67 +177,73 @@ private:
const RigActiveCellInfo* activeCellInfo );
private:
typedef std::vector<std::shared_ptr<RicMswSegment>> MainBoreSegments;
typedef std::map<std::shared_ptr<RicMswCompletion>, std::vector<const RimWellPathValve*>> ValveContributionMap;
static std::vector<std::pair<double, double>>
createSubSegmentMDPairs( double startMD, double endMD, double maxSegmentLength );
static MainBoreSegments
createMainBoreSegmentsForPerforations( const std::vector<WellPathCellIntersectionInfo>& cellSegmentIntersections,
const std::vector<const RimPerforationInterval*>& perforationIntervals,
const RimWellPath* wellPath,
int timeStep,
RimEclipseCase* eclipseCase,
bool* foundSubGridIntersections );
static void createWellPathSegments( gsl::not_null<RicMswBranch*> branch,
const std::vector<WellPathCellIntersectionInfo>& cellSegmentIntersections,
const std::vector<const RimPerforationInterval*>& perforationIntervals,
const RimWellPath* wellPath,
int timeStep,
const RimEclipseCase* eclipseCase,
bool* foundSubGridIntersections );
static void createValveCompletions( std::vector<std::shared_ptr<RicMswSegment>>& mainBoreSegments,
static void createValveCompletions( gsl::not_null<RicMswBranch*> branch,
const std::vector<const RimPerforationInterval*>& perforationIntervals,
const RimWellPath* wellPath,
RiaDefines::EclipseUnitSystem unitSystem );
static void
assignValveContributionsToSuperICDsOrAICDs( const std::vector<std::shared_ptr<RicMswSegment>>& mainBoreSegments,
assignValveContributionsToSuperICDsOrAICDs( gsl::not_null<RicMswBranch*> branch,
const std::vector<const RimPerforationInterval*>& perforationIntervals,
const std::vector<WellPathCellIntersectionInfo>& wellPathIntersections,
const RigActiveCellInfo* activeCellInfo,
RiaDefines::EclipseUnitSystem unitSystem );
static void moveIntersectionsToICVs( const std::vector<std::shared_ptr<RicMswSegment>>& mainBoreSegments,
const std::vector<const RimPerforationInterval*>& perforationIntervals,
RiaDefines::EclipseUnitSystem unitSystem );
static void moveIntersectionsToICVs( gsl::not_null<RicMswBranch*> branch,
const std::vector<const RimPerforationInterval*>& perforationIntervals,
RiaDefines::EclipseUnitSystem unitSystem );
static void moveIntersectionsToSuperICDsOrAICDs( MainBoreSegments mainBoreSegments );
static void moveIntersectionsToSuperICDsOrAICDs( gsl::not_null<RicMswBranch*> branch );
static void assignFishbonesLateralIntersections( const RimEclipseCase* caseToApply,
const RimWellPath* wellPath,
const RimFishbonesMultipleSubs* fishbonesSubs,
std::shared_ptr<RicMswSegment> segment,
bool* foundSubGridIntersections,
double maxSegmentLength );
static void assignFishbonesLateralIntersections( const RimEclipseCase* caseToApply,
const RimWellPath* wellPath,
const RimFishbones* fishbonesSubs,
gsl::not_null<RicMswSegment*> segment,
bool* foundSubGridIntersections,
double maxSegmentLength );
static void assignFractureCompletionsToCellSegment( const RimEclipseCase* caseToApply,
const RimWellPath* wellPath,
const RimWellPathFracture* fracture,
const std::vector<RigCompletionData>& completionData,
std::shared_ptr<RicMswSegment> segment,
gsl::not_null<RicMswSegment*> segment,
bool* foundSubGridIntersections );
static std::vector<RigCompletionData>
generatePerforationIntersections( gsl::not_null<const RimWellPath*> wellPath,
gsl::not_null<const RimPerforationInterval*> perforationInterval,
int timeStep,
gsl::not_null<RimEclipseCase*> eclipseCase );
gsl::not_null<const RimEclipseCase*> eclipseCase );
static void assignPerforationIntersections( const std::vector<RigCompletionData>& completionData,
std::shared_ptr<RicMswCompletion> perforationCompletion,
gsl::not_null<RicMswCompletion*> perforationCompletion,
const WellPathCellIntersectionInfo& cellIntInfo,
double overlapStart,
double overlapEnd,
bool* foundSubGridIntersections );
static void
assignBranchNumbers( const RimEclipseCase* caseToApply, std::shared_ptr<RicMswSegment> segment, int* branchNum );
static void assignBranchNumbers( const RimEclipseCase* caseToApply, RicMswExportInfo* exportInfo );
static void assignBranchNumbersToPerforations( const RimEclipseCase* caseToApply,
gsl::not_null<RicMswSegment*> segment,
gsl::not_null<int*> branchNumber );
static void assignBranchNumbersToOtherCompletions( const RimEclipseCase* caseToApply,
gsl::not_null<RicMswSegment*> segment,
gsl::not_null<int*> branchNumber );
static void assignBranchNumbersToBranch( const RimEclipseCase* caseToApply,
RicMswExportInfo* exportInfo,
gsl::not_null<RicMswBranch*> branch,
gsl::not_null<int*> branchNumber );
static double tvdFromMeasuredDepth( gsl::not_null<const RimWellPath*> wellPath, double measuredDepth );
};

View File

@ -253,7 +253,7 @@ QString RicWellPathFractureTextReportFeatureImpl::createWellFileLocationText( co
auto fileWellPath = dynamic_cast<RimFileWellPath*>( wellPath );
if ( fileWellPath )
{
formatter.add( wellPath->completions()->wellNameForExport() );
formatter.add( wellPath->completionSettings()->wellNameForExport() );
formatter.add( fileWellPath->filePath() );
formatter.rowCompleted();
}
@ -564,7 +564,7 @@ QString RicWellPathFractureTextReportFeatureImpl::createFractureInstancesText(
fracture->firstAncestorOrThisOfType( wellPath );
if ( wellPath )
{
wellName = wellPath->completions()->wellNameForExport();
wellName = wellPath->completionSettings()->wellNameForExport();
}
formatter.add( wellName );

View File

@ -48,7 +48,7 @@
#include "RiuPlotMainWindow.h"
#include "RimFishbonesMultipleSubs.h"
#include "RimFishbones.h"
#include "RimPerforationInterval.h"
#include "RimWellPathFracture.h"
@ -236,7 +236,7 @@ QString completionName( const caf::PdmObject* object )
{
auto perf = dynamic_cast<const RimPerforationInterval*>( object );
auto frac = dynamic_cast<const RimFracture*>( object );
auto fish = dynamic_cast<const RimFishbonesMultipleSubs*>( object );
auto fish = dynamic_cast<const RimFishbones*>( object );
QString name;
if ( perf )

View File

@ -118,7 +118,7 @@ void RicNewWellPathFractureFeature::onActionTriggered( bool isChecked )
RimWellPath* wellPath = nullptr;
fractureColl->firstAncestorOrThisOfTypeAsserted( wellPath );
double defaultMeasuredDepth = 0.0f;
double defaultMeasuredDepth = wellPath->uniqueStartMD();
RicNewWellPathFractureFeature::addFracture( wellPath, defaultMeasuredDepth );
}

View File

@ -22,7 +22,6 @@
#include "RicWellTarget3dEditor.h"
#include "RimWellPathGeometryDef.h"
#include "RimWellPathLateralGeometryDef.h"
#include "RimWellPathTarget.h"
#include "cafPickEventHandler.h"
@ -56,7 +55,7 @@ RicWellPathGeometry3dEditor::~RicWellPathGeometry3dEditor()
//--------------------------------------------------------------------------------------------------
void RicWellPathGeometry3dEditor::configureAndUpdateUi( const QString& uiConfigName )
{
RimWellPathGeometryDefInterface* geomDef = dynamic_cast<RimWellPathGeometryDefInterface*>( this->pdmObject() );
RimWellPathGeometryDef* geomDef = dynamic_cast<RimWellPathGeometryDef*>( this->pdmObject() );
for ( auto targetEditor : m_targetEditors )
{

View File

@ -24,7 +24,6 @@
#include "RimCase.h"
#include "RimModeledWellPath.h"
#include "RimWellPathGeometryDef.h"
#include "RimWellPathLateralGeometryDef.h"
#include "RimWellPathTarget.h"
#include "RiuViewer.h"
@ -86,7 +85,7 @@ void RicWellTarget3dEditor::configureAndUpdateUi( const QString& uiConfigName )
return;
}
RimWellPathGeometryDefInterface* geomDef;
RimWellPathGeometryDef* geomDef;
target->firstAncestorOrThisOfTypeAsserted( geomDef );
target->m_targetType.uiCapability()->addFieldEditor( this );
@ -153,7 +152,7 @@ void RicWellTarget3dEditor::slotUpdated( const cvf::Vec3d& origin, const cvf::Ve
cvf::ref<caf::DisplayCoordTransform> dispXf = view->displayCoordTransform();
RimWellPathGeometryDefInterface* geomDef;
RimWellPathGeometryDef* geomDef;
target->firstAncestorOrThisOfTypeAsserted( geomDef );
cvf::Vec3d domainOrigin = dispXf->transformToDomainCoord( origin ) - geomDef->anchorPointXyz();

View File

@ -34,7 +34,6 @@
#include "RimModeledWellPath.h"
#include "RimWellPath.h"
#include "RimWellPathGeometryDef.h"
#include "RimWellPathLateralGeometryDef.h"
#include "RimWellPathTarget.h"
#include "RiuViewerCommands.h"
@ -56,8 +55,7 @@
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
RicCreateWellTargetsPickEventHandler::RicCreateWellTargetsPickEventHandler(
gsl::not_null<RimWellPathGeometryDefInterface*> wellGeometryDef )
RicCreateWellTargetsPickEventHandler::RicCreateWellTargetsPickEventHandler( gsl::not_null<RimWellPathGeometryDef*> wellGeometryDef )
: m_geometryToAddTargetsTo( wellGeometryDef )
{
}
@ -97,55 +95,94 @@ bool RicCreateWellTargetsPickEventHandler::handle3dPickEvent( const Ric3dPickEve
cvf::Vec3d targetPointInDomain = cvf::Vec3d::ZERO;
// If clicked on an other well path, snap target point to well path center line
auto firstPickItem = eventObject.m_pickItemInfos.front();
auto firstPickItem = eventObject.m_pickItemInfos.front();
auto wellPathSourceInfo = dynamic_cast<const RivWellPathSourceInfo*>( firstPickItem.sourceInfo() );
auto intersectionPointInDomain =
rimView->displayCoordTransform()->transformToDomainCoord( firstPickItem.globalPickedPoint() );
bool doSetAzimuthAndInclination = false;
double azimuth = 0.0;
double inclination = 0.0;
double azimuth = std::numeric_limits<double>::infinity();
double inclination = std::numeric_limits<double>::infinity();
auto wellPathSourceInfo = dynamic_cast<const RivWellPathSourceInfo*>( firstPickItem.sourceInfo() );
if ( isValidWellPathSourceObject( wellPathSourceInfo ) )
if ( wellPathSourceInfo && wellPathSourceInfo->wellPath() && wellPathSourceInfo->wellPath()->wellPathGeometry() )
{
calculateWellPathGeometryAtPickPoint( firstPickItem,
wellPathSourceInfo,
intersectionPointInDomain,
&targetPointInDomain,
&azimuth,
&inclination );
auto wellPathGeometry = wellPathSourceInfo->wellPath()->wellPathGeometry();
targetPointInDomain =
wellPathSourceInfo->closestPointOnCenterLine( firstPickItem.faceIdx(), intersectionPointInDomain );
double md = wellPathSourceInfo->measuredDepth( firstPickItem.faceIdx(), intersectionPointInDomain );
doSetAzimuthAndInclination = calculateAzimuthAndInclinationAtMd( md, wellPathGeometry, &azimuth, &inclination );
double rkbDiff = wellPathGeometry->rkbDiff();
if ( m_geometryToAddTargetsTo->airGap() == 0.0 && rkbDiff != std::numeric_limits<double>::infinity() )
{
m_geometryToAddTargetsTo->setAirGap( rkbDiff );
}
}
else if ( isGridSourceObject( firstPickItem.sourceInfo() ) )
{
targetPointInDomain = calculateGridPickPoint( rimView, firstPickItem, intersectionPointInDomain );
targetPointInDomain = intersectionPointInDomain;
doSetAzimuthAndInclination = false;
cvf::Vec3d domainRayOrigin =
rimView->displayCoordTransform()->transformToDomainCoord( firstPickItem.globalRayOrigin() );
cvf::Vec3d domainRayEnd = targetPointInDomain + ( targetPointInDomain - domainRayOrigin );
cvf::Vec3d hexElementIntersection =
findHexElementIntersection( rimView, firstPickItem, domainRayOrigin, domainRayEnd );
CVF_TIGHT_ASSERT( !hexElementIntersection.isUndefined() );
if ( !hexElementIntersection.isUndefined() )
{
targetPointInDomain = hexElementIntersection;
}
}
else
{
targetPointInDomain = intersectionPointInDomain;
targetPointInDomain = intersectionPointInDomain;
doSetAzimuthAndInclination = false;
}
if ( auto wellPathGeometryDef = dynamic_cast<RimWellPathGeometryDef*>( m_geometryToAddTargetsTo.p() );
wellPathGeometryDef )
if ( !m_geometryToAddTargetsTo->firstActiveTarget() )
{
addNewTargetToModeledWellPath( firstPickItem,
wellPathGeometryDef,
intersectionPointInDomain,
targetPointInDomain,
azimuth,
inclination );
m_geometryToAddTargetsTo->setReferencePointXyz( targetPointInDomain );
if ( wellPathSourceInfo )
{
double mdAtFirstTarget =
wellPathSourceInfo->measuredDepth( firstPickItem.faceIdx(), intersectionPointInDomain );
RimModeledWellPath* modeledWellPath = dynamic_cast<RimModeledWellPath*>( wellPathSourceInfo->wellPath() );
if ( modeledWellPath )
{
mdAtFirstTarget += modeledWellPath->geometryDefinition()->mdAtFirstTarget();
}
m_geometryToAddTargetsTo->setMdAtFirstTarget( mdAtFirstTarget );
}
}
else if ( auto wellPathLateralGeometryDef =
dynamic_cast<RimWellPathLateralGeometryDef*>( m_geometryToAddTargetsTo.p() );
wellPathLateralGeometryDef )
cvf::Vec3d referencePoint = m_geometryToAddTargetsTo->anchorPointXyz();
cvf::Vec3d relativeTagetPoint = targetPointInDomain - referencePoint;
RimWellPathTarget* newTarget = new RimWellPathTarget;
if ( doSetAzimuthAndInclination )
{
addNewTargetToModeledWellPathLateral( firstPickItem,
wellPathLateralGeometryDef,
intersectionPointInDomain,
targetPointInDomain,
azimuth,
inclination );
newTarget->setAsPointXYZAndTangentTarget( cvf::Vec3d( relativeTagetPoint.x(),
relativeTagetPoint.y(),
relativeTagetPoint.z() ),
azimuth,
inclination );
}
else
{
newTarget->setAsPointTargetXYD(
cvf::Vec3d( relativeTagetPoint.x(), relativeTagetPoint.y(), -relativeTagetPoint.z() ) );
}
m_geometryToAddTargetsTo->insertTarget( nullptr, newTarget );
m_geometryToAddTargetsTo->updateConnectedEditors();
m_geometryToAddTargetsTo->updateWellPathVisualization( true );
return true; // Todo: See if we really should eat the event instead
}
@ -206,155 +243,6 @@ bool RicCreateWellTargetsPickEventHandler::calculateAzimuthAndInclinationAtMd( d
return false;
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
bool RicCreateWellTargetsPickEventHandler::calculateWellPathGeometryAtPickPoint(
const RiuPickItemInfo& pickItem,
gsl::not_null<const RivWellPathSourceInfo*> wellPathSourceInfo,
const cvf::Vec3d& intersectionPointInDomain,
gsl::not_null<cvf::Vec3d*> targetPointInDomain,
gsl::not_null<double*> azimuth,
gsl::not_null<double*> inclination ) const
{
*targetPointInDomain = wellPathSourceInfo->closestPointOnCenterLine( pickItem.faceIdx(), intersectionPointInDomain );
bool doSetAzimuthAndInclination = false;
auto wellPathGeometry = wellPathSourceInfo->wellPath()->wellPathGeometry();
if ( wellPathGeometry )
{
double md = wellPathSourceInfo->measuredDepth( pickItem.faceIdx(), intersectionPointInDomain );
doSetAzimuthAndInclination = calculateAzimuthAndInclinationAtMd( md, wellPathGeometry, azimuth, inclination );
double rkbDiff = wellPathGeometry->rkbDiff();
auto wellPathGeometryDef = dynamic_cast<RimWellPathGeometryDef*>( m_geometryToAddTargetsTo.p() );
if ( wellPathGeometryDef && wellPathGeometryDef->airGap() == 0.0 &&
rkbDiff != std::numeric_limits<double>::infinity() )
{
wellPathGeometryDef->setAirGap( rkbDiff );
}
}
return doSetAzimuthAndInclination;
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
cvf::Vec3d RicCreateWellTargetsPickEventHandler::calculateGridPickPoint( gsl::not_null<const Rim3dView*> rimView,
const RiuPickItemInfo& pickItem,
const cvf::Vec3d& intersectionPointInDomain ) const
{
auto targetPointInDomain = intersectionPointInDomain;
cvf::Vec3d domainRayOrigin = rimView->displayCoordTransform()->transformToDomainCoord( pickItem.globalRayOrigin() );
cvf::Vec3d domainRayEnd = targetPointInDomain + ( targetPointInDomain - domainRayOrigin );
cvf::Vec3d hexElementIntersection = findHexElementIntersection( rimView, pickItem, domainRayOrigin, domainRayEnd );
CVF_TIGHT_ASSERT( !hexElementIntersection.isUndefined() );
if ( !hexElementIntersection.isUndefined() )
{
targetPointInDomain = hexElementIntersection;
}
return targetPointInDomain;
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RicCreateWellTargetsPickEventHandler::addNewTargetToModeledWellPath( const RiuPickItemInfo& pickItem,
gsl::not_null<RimWellPathGeometryDef*> wellPathGeometryDef,
const cvf::Vec3d& intersectionPointInDomain,
const cvf::Vec3d& targetPointInDomain,
double azimuth,
double inclination )
{
if ( !m_geometryToAddTargetsTo->firstActiveTarget() )
{
wellPathGeometryDef->setReferencePointXyz( targetPointInDomain );
auto wellPathSourceInfo = dynamic_cast<const RivWellPathSourceInfo*>( pickItem.sourceInfo() );
if ( wellPathSourceInfo )
{
double mdAtFirstTarget = wellPathSourceInfo->measuredDepth( pickItem.faceIdx(), intersectionPointInDomain );
RimModeledWellPath* modeledWellPath = dynamic_cast<RimModeledWellPath*>( wellPathSourceInfo->wellPath() );
if ( modeledWellPath )
{
mdAtFirstTarget += modeledWellPath->geometryDefinition()->mdAtFirstTarget();
}
wellPathGeometryDef->setMdAtFirstTarget( mdAtFirstTarget );
}
}
cvf::Vec3d referencePoint = wellPathGeometryDef->anchorPointXyz();
cvf::Vec3d relativeTargetPoint = targetPointInDomain - referencePoint;
RimWellPathTarget* newTarget = new RimWellPathTarget;
bool doSetAzimuthAndInclination = azimuth != std::numeric_limits<double>::infinity() &&
inclination != std::numeric_limits<double>::infinity();
if ( doSetAzimuthAndInclination )
{
newTarget->setAsPointXYZAndTangentTarget( relativeTargetPoint, azimuth, inclination );
}
else
{
newTarget->setAsPointTargetXYD(
cvf::Vec3d( relativeTargetPoint.x(), relativeTargetPoint.y(), -relativeTargetPoint.z() ) );
}
m_geometryToAddTargetsTo->insertTarget( nullptr, newTarget );
m_geometryToAddTargetsTo->updateConnectedEditors();
m_geometryToAddTargetsTo->updateWellPathVisualization( false );
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RicCreateWellTargetsPickEventHandler::addNewTargetToModeledWellPathLateral(
const RiuPickItemInfo& pickItem,
gsl::not_null<RimWellPathLateralGeometryDef*> wellPathLateralGeometryDef,
const cvf::Vec3d& intersectionPointInDomain,
const cvf::Vec3d& targetPointInDomain,
double azimuth,
double inclination )
{
auto wellPathSourceInfo = dynamic_cast<const RivWellPathSourceInfo*>( pickItem.sourceInfo() );
if ( wellPathSourceInfo )
{
double mdAtConnection = wellPathSourceInfo->measuredDepth( pickItem.faceIdx(), intersectionPointInDomain );
wellPathLateralGeometryDef->setParentGeometry( wellPathSourceInfo->wellPath()->wellPathGeometry() );
wellPathLateralGeometryDef->setMdAtConnection( mdAtConnection );
}
cvf::Vec3d referencePoint = wellPathLateralGeometryDef->anchorPointXyz();
cvf::Vec3d relativeTargetPoint = targetPointInDomain - referencePoint;
RimWellPathTarget* newTarget = new RimWellPathTarget;
bool doSetAzimuthAndInclination = azimuth != std::numeric_limits<double>::infinity() &&
inclination != std::numeric_limits<double>::infinity();
if ( doSetAzimuthAndInclination )
{
newTarget->setAsPointXYZAndTangentTarget( cvf::Vec3d( relativeTargetPoint.x(),
relativeTargetPoint.y(),
relativeTargetPoint.z() ),
azimuth,
inclination );
}
else
{
newTarget->setAsPointTargetXYD(
cvf::Vec3d( relativeTargetPoint.x(), relativeTargetPoint.y(), -relativeTargetPoint.z() ) );
}
m_geometryToAddTargetsTo->insertTarget( nullptr, newTarget );
m_geometryToAddTargetsTo->updateConnectedEditors();
m_geometryToAddTargetsTo->updateWellPathVisualization( false );
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
@ -368,18 +256,10 @@ bool RicCreateWellTargetsPickEventHandler::isGridSourceObject( const cvf::Object
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
bool RicCreateWellTargetsPickEventHandler::isValidWellPathSourceObject( const RivWellPathSourceInfo* wellPathSourceInfo )
{
return wellPathSourceInfo && wellPathSourceInfo->wellPath() && wellPathSourceInfo->wellPath()->wellPathGeometry();
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
cvf::Vec3d RicCreateWellTargetsPickEventHandler::findHexElementIntersection( gsl::not_null<const Rim3dView*> view,
const RiuPickItemInfo& pickItem,
const cvf::Vec3d& domainRayOrigin,
const cvf::Vec3d& domainRayEnd )
cvf::Vec3d RicCreateWellTargetsPickEventHandler::findHexElementIntersection( gsl::not_null<Rim3dView*> view,
const RiuPickItemInfo& pickItem,
const cvf::Vec3d& domainRayOrigin,
const cvf::Vec3d& domainRayEnd )
{
auto sourceInfo = dynamic_cast<const RivSourceInfo*>( pickItem.sourceInfo() );
auto femSourceInfo = dynamic_cast<const RivFemPickSourceInfo*>( pickItem.sourceInfo() );
@ -393,7 +273,7 @@ cvf::Vec3d RicCreateWellTargetsPickEventHandler::findHexElementIntersection( gsl
{
cellIndex = sourceInfo->m_cellFaceFromTriangleMapper->cellIndex( pickItem.faceIdx() );
const RimEclipseView* eclipseView = dynamic_cast<const RimEclipseView*>( view.get() );
RimEclipseView* eclipseView = dynamic_cast<RimEclipseView*>( view.get() );
if ( eclipseView && eclipseView->mainGrid() )
{
RigGridBase* hitGrid = eclipseView->mainGrid()->gridByIndex( gridIndex );
@ -408,11 +288,11 @@ cvf::Vec3d RicCreateWellTargetsPickEventHandler::findHexElementIntersection( gsl
{
size_t elementIndex = femSourceInfo->triangleToElmMapper()->elementIndex( pickItem.faceIdx() );
const RimGeoMechView* geoMechView = dynamic_cast<const RimGeoMechView*>( view.get() );
RimGeoMechView* geoMechView = dynamic_cast<RimGeoMechView*>( view.get() );
if ( geoMechView && geoMechView->femParts() )
{
const RigFemPart* femPart = geoMechView->femParts()->part( femPartIndex );
RigElementType elType = femPart->elementType( elementIndex );
RigFemPart* femPart = geoMechView->femParts()->part( femPartIndex );
RigElementType elType = femPart->elementType( elementIndex );
if ( elType == HEX8 || elType == HEX8P )
{

View File

@ -24,12 +24,8 @@
#include <gsl/gsl>
class RimWellPathGeometryDefInterface;
class RigWellPath;
class RiuPickItemInfo;
class RivWellPathSourceInfo;
class RimWellPathGeometryDef;
class RimWellPathLateralGeometryDef;
class RigWellPath;
//==================================================================================================
///
@ -37,7 +33,7 @@ class RimWellPathLateralGeometryDef;
class RicCreateWellTargetsPickEventHandler : public Ric3dViewPickEventHandler
{
public:
RicCreateWellTargetsPickEventHandler( gsl::not_null<RimWellPathGeometryDefInterface*> wellGeometryDef );
RicCreateWellTargetsPickEventHandler( gsl::not_null<RimWellPathGeometryDef*> wellGeometryDef );
~RicCreateWellTargetsPickEventHandler();
void registerAsPickEventHandler() override;
@ -51,38 +47,13 @@ private:
gsl::not_null<const RigWellPath*> wellPathGeometry,
double* azimuth,
double* inclination ) const;
bool calculateWellPathGeometryAtPickPoint( const RiuPickItemInfo& pickItem,
gsl::not_null<const RivWellPathSourceInfo*> sourceInfo,
const cvf::Vec3d& intersectionPointInDomain,
gsl::not_null<cvf::Vec3d*> targetPointInDomain,
gsl::not_null<double*> azimuth,
gsl::not_null<double*> inclination ) const;
cvf::Vec3d calculateGridPickPoint( gsl::not_null<const Rim3dView*> rimView,
const RiuPickItemInfo& pickItem,
const cvf::Vec3d& intersectionPointInDomain ) const;
void addNewTargetToModeledWellPath( const RiuPickItemInfo& pickItem,
gsl::not_null<RimWellPathGeometryDef*> wellPathGeometryDef,
const cvf::Vec3d& intersectionPointInDomain,
const cvf::Vec3d& targetPointInDomain,
double azimuth,
double inclination );
void addNewTargetToModeledWellPathLateral( const RiuPickItemInfo& pickItem,
gsl::not_null<RimWellPathLateralGeometryDef*> wellPathLateralGeometryDef,
const cvf::Vec3d& intersectionPointInDomain,
const cvf::Vec3d& targetPointInDomain,
double azimuth,
double inclination );
static bool isGridSourceObject( const cvf::Object* object );
static bool isValidWellPathSourceObject( const RivWellPathSourceInfo* sourceInfo );
static cvf::Vec3d findHexElementIntersection( gsl::not_null<const Rim3dView*> view,
const RiuPickItemInfo& pickItem,
const cvf::Vec3d& domainRayOrigin,
const cvf::Vec3d& domainRayEnd );
static cvf::Vec3d findHexElementIntersection( gsl::not_null<Rim3dView*> view,
const RiuPickItemInfo& pickItem,
const cvf::Vec3d& domainRayOrigin,
const cvf::Vec3d& domainRayEnd );
private:
caf::PdmPointer<RimWellPathGeometryDefInterface> m_geometryToAddTargetsTo;
caf::PdmPointer<RimWellPathGeometryDef> m_geometryToAddTargetsTo;
};

View File

@ -20,15 +20,16 @@
#include "WellPathCommands/RicWellPathsUnitSystemSettingsImpl.h"
#include "RigWellPath.h"
#include "RimFishbones.h"
#include "RimFishbonesCollection.h"
#include "RimFishbonesMultipleSubs.h"
#include "RimModeledWellPathLateral.h"
#include "RimModeledWellPath.h"
#include "RimOilField.h"
#include "RimProject.h"
#include "RimWellPath.h"
#include "RimWellPathCollection.h"
#include "RimWellPathGeometryDef.h"
#include "RimWellPathGroup.h"
#include "RimWellPathLateralGeometryDef.h"
#include "RimWellPathTarget.h"
#include "Riu3DMainWindowTools.h"
#include "Riu3dSelectionManager.h"
@ -74,18 +75,17 @@ void RicNewWellPathLateralAtDepthFeature::onActionTriggered( bool isChecked )
if ( wellPathCollection )
{
auto newModeledWellPath = new RimModeledWellPathLateral();
auto newModeledWellPath = new RimModeledWellPath();
auto [pointVector, measuredDepths] =
wellPath->wellPathGeometry()->clippedPointSubset( wellPath->wellPathGeometry()->measuredDepths().front(),
wellPathSelItem->m_measuredDepth );
if ( pointVector.size() < 2u ) return;
newModeledWellPath->geometryDefinition()->setParentGeometry( wellPath->wellPathGeometry() );
newModeledWellPath->geometryDefinition()->setMdAtConnection( wellPathSelItem->m_measuredDepth );
newModeledWellPath->geometryDefinition()->createTargetAtConnectionPoint(
pointVector[pointVector.size() - 1u] - pointVector[pointVector.size() - 2u] );
newModeledWellPath->geometryDefinition()->setMdAtFirstTarget( measuredDepths.back() );
newModeledWellPath->geometryDefinition()->setUseAutoGeneratedTargetAtSeaLevel( false );
newModeledWellPath->geometryDefinition()->setFixedWellPathPoints( pointVector );
newModeledWellPath->geometryDefinition()->setFixedMeasuredDepths( measuredDepths );
newModeledWellPath->setName( wellPath->name() + QString( " md=%1" ).arg( wellPathSelItem->m_measuredDepth ) );
newModeledWellPath->geometryDefinition()->enableTargetPointPicking( true );
newModeledWellPath->createWellPathGeometry();
if ( wellPathGroup )

View File

@ -20,7 +20,7 @@
#include "RigWellPath.h"
#include "RimFishbonesMultipleSubs.h"
#include "RimFishbones.h"
#include "RimWellPath.h"
#include "RivObjectSourceInfo.h"
@ -37,7 +37,7 @@
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
RivFishbonesSubsPartMgr::RivFishbonesSubsPartMgr( RimFishbonesMultipleSubs* subs )
RivFishbonesSubsPartMgr::RivFishbonesSubsPartMgr( RimFishbones* subs )
: m_rimFishbonesSubs( subs )
{
}
@ -90,20 +90,16 @@ void RivFishbonesSubsPartMgr::buildParts( const caf::DisplayCoordTransform* disp
RivPipeGeometryGenerator geoGenerator;
for ( auto& sub : m_rimFishbonesSubs->installedLateralIndices() )
for ( const auto& [subIndex, lateralIndex] : m_rimFishbonesSubs->installedLateralIndices() )
{
for ( size_t lateralIndex : sub.lateralIndices )
{
std::vector<cvf::Vec3d> lateralDomainCoords =
m_rimFishbonesSubs->coordsForLateral( sub.subIndex, lateralIndex );
std::vector<cvf::Vec3d> lateralDomainCoords = m_rimFishbonesSubs->coordsForLateral( subIndex, lateralIndex );
std::vector<cvf::Vec3d> displayCoords = displayCoordTransform->transformToDisplayCoords( lateralDomainCoords );
std::vector<cvf::Vec3d> displayCoords = displayCoordTransform->transformToDisplayCoords( lateralDomainCoords );
geoGenerator.cylinderWithCenterLineParts( &m_parts,
displayCoords,
m_rimFishbonesSubs->fishbonesColor(),
wellPath->combinedScaleFactor() * characteristicCellSize * 0.5 );
}
geoGenerator.cylinderWithCenterLineParts( &m_parts,
displayCoords,
m_rimFishbonesSubs->fishbonesColor(),
wellPath->combinedScaleFactor() * characteristicCellSize * 0.5 );
}
cvf::ref<RivObjectSourceInfo> objectSourceInfo = new RivObjectSourceInfo( m_rimFishbonesSubs );

View File

@ -40,7 +40,7 @@ namespace caf
class DisplayCoordTransform;
}
class RimFishbonesMultipleSubs;
class RimFishbones;
//--------------------------------------------------------------------------------------------------
///
@ -48,7 +48,7 @@ class RimFishbonesMultipleSubs;
class RivFishbonesSubsPartMgr : public cvf::Object
{
public:
RivFishbonesSubsPartMgr( RimFishbonesMultipleSubs* subs );
RivFishbonesSubsPartMgr( RimFishbones* subs );
~RivFishbonesSubsPartMgr() override;
void appendGeometryPartsToModel( cvf::ModelBasicList* model,
@ -60,6 +60,6 @@ private:
void buildParts( const caf::DisplayCoordTransform* displayCoordTransform, double characteristicCellSize );
private:
caf::PdmPointer<RimFishbonesMultipleSubs> m_rimFishbonesSubs;
cvf::Collection<cvf::Part> m_parts;
caf::PdmPointer<RimFishbones> m_rimFishbonesSubs;
cvf::Collection<cvf::Part> m_parts;
};

View File

@ -30,10 +30,10 @@
#include "Rim3dWellLogCurveCollection.h"
#include "RimEclipseCase.h"
#include "RimEclipseView.h"
#include "RimFishboneWellPath.h"
#include "RimFishboneWellPathCollection.h"
#include "RimFishbones.h"
#include "RimFishbonesCollection.h"
#include "RimFishbonesMultipleSubs.h"
#include "RimImportedFishboneLaterals.h"
#include "RimImportedFishboneLateralsCollection.h"
#include "RimPerforationCollection.h"
#include "RimPerforationInterval.h"
#include "RimRegularLegendConfig.h"
@ -371,10 +371,10 @@ void RivWellPathPartMgr::appendImportedFishbonesToModel( cvf::ModelBasicList*
{
if ( !m_rimWellPath || !m_rimWellPath->fishbonesCollection()->wellPathCollection()->isChecked() ) return;
RivPipeGeometryGenerator geoGenerator;
std::vector<RimFishboneWellPath*> fishbonesWellPaths;
RivPipeGeometryGenerator geoGenerator;
std::vector<RimImportedFishboneLaterals*> fishbonesWellPaths;
m_rimWellPath->descendantsIncludingThisOfType( fishbonesWellPaths );
for ( RimFishboneWellPath* fbWellPath : fishbonesWellPaths )
for ( RimImportedFishboneLaterals* fbWellPath : fishbonesWellPaths )
{
if ( !fbWellPath->isChecked() ) continue;
@ -745,10 +745,13 @@ void RivWellPathPartMgr::buildWellPathParts( const caf::DisplayCoordTransform* d
m_centerLinePart->setEffect( eff.p() );
}
// Generate label with well-path name
// Generate label with well-path name at a position that is slightly offset towards the end of the well path
// This is to avoid overlap between well path laterals.
cvf::Vec3d textPosition = cvfCoords->get( 0 );
cvf::Vec3d tangent = ( cvfCoords->get( cvfCoords->size() - 1 ) - cvfCoords->get( 0 ) ).getNormalized();
textPosition.z() += 2.2 * characteristicCellSize;
textPosition += tangent * 2.2 * characteristicCellSize;
if ( wellPathCollection->showWellPathLabel() && m_rimWellPath->showWellPathLabel() && !m_rimWellPath->name().isEmpty() )
{

View File

@ -0,0 +1 @@
Checks: 'google-readability-braces-around-statements,google-readability-casting,google-readability-function-size,google-readability-namespace-comments,google-readability-todo,modernize-avoid-bind,modernize-avoid-c-arrays,modernize-concat-nested-namespaces,modernize-deprecated-headers,modernize-deprecated-ios-base-aliases,modernize-loop-convert,modernize-make-shared,modernize-make-unique,modernize-pass-by-value,modernize-raw-string-literal,modernize-redundant-void-arg,modernize-replace-auto-ptr,modernize-replace-random-shuffle,modernize-return-braced-init-list,modernize-shrink-to-fit,modernize-unary-static-assert,modernize-use-auto,modernize-use-bool-literals,modernize-use-default-member-init,modernize-use-emplace,modernize-use-equals-default,modernize-use-equals-delete,modernize-use-noexcept,modernize-use-nullptr,modernize-use-override,modernize-use-transparent-functors,modernize-use-uncaught-exceptions,modernize-use-using,readability-avoid-const-params-in-decls,readability-braces-around-statements,readability-const-return-type,readability-container-size-empty,readability-deleted-default,readability-delete-null-pointer,readability-else-after-return,readability-function-size,readability-identifier-naming,readability-implicit-bool-conversion,readability-inconsistent-declaration-parameter-name,readability-isolate-declaration,readability-magic-numbers,readability-misleading-indentation,readability-misplaced-array-index,readability-named-parameter,readability-non-const-parameter,readability-redundant-control-flow,readability-redundant-declaration,readability-redundant-function-ptr-dereference,readability-redundant-member-init,readability-redundant-smartptr-get,readability-redundant-string-cstr,readability-redundant-string-init,readability-simplify-boolean-expr,readability-simplify-subscript-expr,readability-static-accessed-through-instance,readability-static-definition-in-anonymous-namespace,readability-string-compare,readability-uniqueptr-delete-release,readability-uppercase-literal-suffix'

View File

@ -23,13 +23,10 @@ ${CMAKE_CURRENT_LIST_DIR}/RimWellPath.h
${CMAKE_CURRENT_LIST_DIR}/RimWellPathGroup.h
${CMAKE_CURRENT_LIST_DIR}/RimFileWellPath.h
${CMAKE_CURRENT_LIST_DIR}/RimModeledWellPath.h
${CMAKE_CURRENT_LIST_DIR}/RimModeledWellPathLateral.h
${CMAKE_CURRENT_LIST_DIR}/RimWellMeasurement.h
${CMAKE_CURRENT_LIST_DIR}/RimWellMeasurementCollection.h
${CMAKE_CURRENT_LIST_DIR}/RimWellMeasurementFilePath.h
${CMAKE_CURRENT_LIST_DIR}/RimWellPathGeometryDefInterface.h
${CMAKE_CURRENT_LIST_DIR}/RimWellPathGeometryDef.h
${CMAKE_CURRENT_LIST_DIR}/RimWellPathLateralGeometryDef.h
${CMAKE_CURRENT_LIST_DIR}/RimWellPathAttribute.h
${CMAKE_CURRENT_LIST_DIR}/RimWellPathAttributeCollection.h
${CMAKE_CURRENT_LIST_DIR}/RimWellPathCollection.h
@ -193,13 +190,10 @@ ${CMAKE_CURRENT_LIST_DIR}/RimWellPath.cpp
${CMAKE_CURRENT_LIST_DIR}/RimWellPathGroup.cpp
${CMAKE_CURRENT_LIST_DIR}/RimFileWellPath.cpp
${CMAKE_CURRENT_LIST_DIR}/RimModeledWellPath.cpp
${CMAKE_CURRENT_LIST_DIR}/RimModeledWellPathLateral.cpp
${CMAKE_CURRENT_LIST_DIR}/RimWellMeasurement.cpp
${CMAKE_CURRENT_LIST_DIR}/RimWellMeasurementCollection.cpp
${CMAKE_CURRENT_LIST_DIR}/RimWellMeasurementFilePath.cpp
${CMAKE_CURRENT_LIST_DIR}/RimWellPathGeometryDefInterface.cpp
${CMAKE_CURRENT_LIST_DIR}/RimWellPathGeometryDef.cpp
${CMAKE_CURRENT_LIST_DIR}/RimWellPathLateralGeometryDef.cpp
${CMAKE_CURRENT_LIST_DIR}/RimWellPathAttribute.cpp
${CMAKE_CURRENT_LIST_DIR}/RimWellPathAttributeCollection.cpp
${CMAKE_CURRENT_LIST_DIR}/RimWellPathCollection.cpp

View File

@ -0,0 +1 @@
Checks: 'google-readability-braces-around-statements,google-readability-casting,google-readability-function-size,google-readability-namespace-comments,google-readability-todo,modernize-avoid-bind,modernize-avoid-c-arrays,modernize-concat-nested-namespaces,modernize-deprecated-headers,modernize-deprecated-ios-base-aliases,modernize-loop-convert,modernize-make-shared,modernize-make-unique,modernize-pass-by-value,modernize-raw-string-literal,modernize-redundant-void-arg,modernize-replace-auto-ptr,modernize-replace-random-shuffle,modernize-return-braced-init-list,modernize-shrink-to-fit,modernize-unary-static-assert,modernize-use-auto,modernize-use-bool-literals,modernize-use-default-member-init,modernize-use-emplace,modernize-use-equals-default,modernize-use-equals-delete,modernize-use-noexcept,modernize-use-nullptr,modernize-use-override,modernize-use-transparent-functors,modernize-use-uncaught-exceptions,modernize-use-using,readability-avoid-const-params-in-decls,readability-braces-around-statements,readability-const-return-type,readability-container-size-empty,readability-deleted-default,readability-delete-null-pointer,readability-else-after-return,readability-function-size,readability-identifier-naming,readability-implicit-bool-conversion,readability-inconsistent-declaration-parameter-name,readability-isolate-declaration,readability-magic-numbers,readability-misleading-indentation,readability-misplaced-array-index,readability-named-parameter,readability-non-const-parameter,readability-redundant-control-flow,readability-redundant-declaration,readability-redundant-function-ptr-dereference,readability-redundant-member-init,readability-redundant-smartptr-get,readability-redundant-string-cstr,readability-redundant-string-init,readability-simplify-boolean-expr,readability-simplify-subscript-expr,readability-static-accessed-through-instance,readability-static-definition-in-anonymous-namespace,readability-string-compare,readability-uniqueptr-delete-release,readability-uppercase-literal-suffix'

View File

@ -2,13 +2,14 @@
set (SOURCE_GROUP_HEADER_FILES
${CMAKE_CURRENT_LIST_DIR}/RimCompletionCellIntersectionCalc.h
${CMAKE_CURRENT_LIST_DIR}/RimFishbonesCollection.h
${CMAKE_CURRENT_LIST_DIR}/RimFishbonesMultipleSubs.h
${CMAKE_CURRENT_LIST_DIR}/RimFishbones.h
${CMAKE_CURRENT_LIST_DIR}/RimFishbonesPipeProperties.h
${CMAKE_CURRENT_LIST_DIR}/RimFishboneWellPath.h
${CMAKE_CURRENT_LIST_DIR}/RimFishboneWellPathCollection.h
${CMAKE_CURRENT_LIST_DIR}/RimPerforationCollection.h
${CMAKE_CURRENT_LIST_DIR}/RimPerforationInterval.h
${CMAKE_CURRENT_LIST_DIR}/RimWellPathCompletions.h
${CMAKE_CURRENT_LIST_DIR}/RimWellPathCompletionSettings.h
${CMAKE_CURRENT_LIST_DIR}/RimEllipseFractureTemplate.h
${CMAKE_CURRENT_LIST_DIR}/RimFracture.h
${CMAKE_CURRENT_LIST_DIR}/RimFractureContainment.h
@ -38,13 +39,14 @@ ${CMAKE_CURRENT_LIST_DIR}/RimWellPathAicdParameters.h
set (SOURCE_GROUP_SOURCE_FILES
${CMAKE_CURRENT_LIST_DIR}/RimCompletionCellIntersectionCalc.cpp
${CMAKE_CURRENT_LIST_DIR}/RimFishbonesCollection.cpp
${CMAKE_CURRENT_LIST_DIR}/RimFishbonesMultipleSubs.cpp
${CMAKE_CURRENT_LIST_DIR}/RimFishbones.cpp
${CMAKE_CURRENT_LIST_DIR}/RimFishbonesPipeProperties.cpp
${CMAKE_CURRENT_LIST_DIR}/RimFishboneWellPath.cpp
${CMAKE_CURRENT_LIST_DIR}/RimFishboneWellPathCollection.cpp
${CMAKE_CURRENT_LIST_DIR}/RimImportedFishboneLaterals.cpp
${CMAKE_CURRENT_LIST_DIR}/RimImportedFishboneLateralsCollection.cpp
${CMAKE_CURRENT_LIST_DIR}/RimPerforationCollection.cpp
${CMAKE_CURRENT_LIST_DIR}/RimPerforationInterval.cpp
${CMAKE_CURRENT_LIST_DIR}/RimWellPathCompletions.cpp
${CMAKE_CURRENT_LIST_DIR}/RimWellPathCompletionSettings.cpp
${CMAKE_CURRENT_LIST_DIR}/RimEllipseFractureTemplate.cpp
${CMAKE_CURRENT_LIST_DIR}/RimFracture.cpp
${CMAKE_CURRENT_LIST_DIR}/RimFractureContainment.cpp

View File

@ -16,7 +16,7 @@
//
/////////////////////////////////////////////////////////////////////////////////
#include "RimFishbonesMultipleSubs.h"
#include "RimFishbones.h"
#include "RiaColorTables.h"
#include "RiaEclipseUnitTools.h"
@ -38,33 +38,34 @@
#include <cmath>
#include <cstdlib>
#include <random>
CAF_PDM_SOURCE_INIT( RimFishbonesMultipleSubs, "FishbonesMultipleSubs" );
CAF_PDM_SOURCE_INIT( RimFishbones, "FishbonesMultipleSubs" );
namespace caf
{
template <>
void AppEnum<RimFishbonesMultipleSubs::LocationType>::setUp()
void AppEnum<RimFishbones::LocationType>::setUp()
{
addItem( RimFishbonesMultipleSubs::FB_SUB_COUNT_END, "FB_SUB_COUNT", "Start/End/Number of Subs" );
addItem( RimFishbonesMultipleSubs::FB_SUB_SPACING_END, "FB_SUB_SPACING", "Start/End/Spacing" );
addItem( RimFishbonesMultipleSubs::FB_SUB_USER_DEFINED, "FB_SUB_CUSTOM", "User Specification" );
setDefault( RimFishbonesMultipleSubs::FB_SUB_COUNT_END );
addItem( RimFishbones::FB_SUB_COUNT_END, "FB_SUB_COUNT", "Start/End/Number of Subs" );
addItem( RimFishbones::FB_SUB_SPACING_END, "FB_SUB_SPACING", "Start/End/Spacing" );
addItem( RimFishbones::FB_SUB_USER_DEFINED, "FB_SUB_CUSTOM", "User Specification" );
setDefault( RimFishbones::FB_SUB_COUNT_END );
}
template <>
void AppEnum<RimFishbonesMultipleSubs::LateralsOrientationType>::setUp()
void AppEnum<RimFishbones::LateralsOrientationType>::setUp()
{
addItem( RimFishbonesMultipleSubs::FB_LATERAL_ORIENTATION_FIXED, "FB_LATERAL_ORIENTATION_FIXED", "Fixed Angle" );
addItem( RimFishbonesMultipleSubs::FB_LATERAL_ORIENTATION_RANDOM, "FB_LATERAL_ORIENTATION_RANDOM", "Random Angle" );
setDefault( RimFishbonesMultipleSubs::FB_LATERAL_ORIENTATION_RANDOM );
addItem( RimFishbones::FB_LATERAL_ORIENTATION_FIXED, "FB_LATERAL_ORIENTATION_FIXED", "Fixed Angle" );
addItem( RimFishbones::FB_LATERAL_ORIENTATION_RANDOM, "FB_LATERAL_ORIENTATION_RANDOM", "Random Angle" );
setDefault( RimFishbones::FB_LATERAL_ORIENTATION_RANDOM );
}
} // namespace caf
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
RimFishbonesMultipleSubs::RimFishbonesMultipleSubs()
RimFishbones::RimFishbones()
{
CAF_PDM_InitObject( "FishbonesMultipleSubs", ":/FishBoneGroup16x16.png", "", "" );
@ -72,7 +73,7 @@ RimFishbonesMultipleSubs::RimFishbonesMultipleSubs()
m_isActive.uiCapability()->setUiHidden( true );
CAF_PDM_InitFieldNoDefault( &m_name, "Name", "Name", "", "", "" );
m_name.registerGetMethod( this, &RimFishbonesMultipleSubs::generatedName );
m_name.registerGetMethod( this, &RimFishbones::generatedName );
m_name.uiCapability()->setUiReadOnly( true );
m_name.xmlCapability()->setIOWritable( false );
@ -163,14 +164,14 @@ RimFishbonesMultipleSubs::RimFishbonesMultipleSubs()
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
RimFishbonesMultipleSubs::~RimFishbonesMultipleSubs()
RimFishbones::~RimFishbones()
{
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
bool RimFishbonesMultipleSubs::isActive() const
bool RimFishbones::isActive() const
{
return m_isActive;
}
@ -178,10 +179,10 @@ bool RimFishbonesMultipleSubs::isActive() const
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
QString RimFishbonesMultipleSubs::generatedName() const
QString RimFishbones::generatedName() const
{
caf::PdmChildArrayField<RimFishbonesMultipleSubs*>* container =
dynamic_cast<caf::PdmChildArrayField<RimFishbonesMultipleSubs*>*>( this->parentField() );
caf::PdmChildArrayField<RimFishbones*>* container =
dynamic_cast<caf::PdmChildArrayField<RimFishbones*>*>( this->parentField() );
CVF_ASSERT( container );
size_t index = container->index( this );
@ -191,7 +192,7 @@ QString RimFishbonesMultipleSubs::generatedName() const
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RimFishbonesMultipleSubs::setMeasuredDepthAndCount( double startMD, double spacing, int subCount )
void RimFishbones::setMeasuredDepthAndCount( double startMD, double spacing, int subCount )
{
double endMD = startMD + spacing * subCount;
m_valveLocations->initFields( RimMultipleValveLocations::VALVE_SPACING, startMD, endMD, spacing, subCount, {} );
@ -203,7 +204,7 @@ void RimFishbonesMultipleSubs::setMeasuredDepthAndCount( double startMD, double
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
double RimFishbonesMultipleSubs::measuredDepth( size_t subIndex ) const
double RimFishbones::measuredDepth( size_t subIndex ) const
{
return m_valveLocations->measuredDepth( subIndex );
}
@ -211,7 +212,7 @@ double RimFishbonesMultipleSubs::measuredDepth( size_t subIndex ) const
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
double RimFishbonesMultipleSubs::rotationAngle( size_t index ) const
double RimFishbones::rotationAngle( size_t index ) const
{
if ( m_subsOrientationMode == FB_LATERAL_ORIENTATION_FIXED )
{
@ -228,7 +229,7 @@ double RimFishbonesMultipleSubs::rotationAngle( size_t index ) const
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
double RimFishbonesMultipleSubs::exitAngle() const
double RimFishbones::exitAngle() const
{
return m_lateralExitAngle;
}
@ -236,7 +237,7 @@ double RimFishbonesMultipleSubs::exitAngle() const
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
double RimFishbonesMultipleSubs::buildAngle() const
double RimFishbones::buildAngle() const
{
return m_lateralBuildAngle;
}
@ -244,7 +245,7 @@ double RimFishbonesMultipleSubs::buildAngle() const
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
double RimFishbonesMultipleSubs::tubingDiameter( RiaDefines::EclipseUnitSystem unitSystem ) const
double RimFishbones::tubingDiameter( RiaDefines::EclipseUnitSystem unitSystem ) const
{
RimWellPath* wellPath;
firstAncestorOrThisOfTypeAsserted( wellPath );
@ -277,7 +278,7 @@ double RimFishbonesMultipleSubs::tubingDiameter( RiaDefines::EclipseUnitSystem u
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
double RimFishbonesMultipleSubs::effectiveDiameter( RiaDefines::EclipseUnitSystem unitSystem ) const
double RimFishbones::effectiveDiameter( RiaDefines::EclipseUnitSystem unitSystem ) const
{
double innerRadius = tubingDiameter( unitSystem ) / 2;
double outerRadius = holeDiameter( unitSystem ) / 2;
@ -294,7 +295,7 @@ double RimFishbonesMultipleSubs::effectiveDiameter( RiaDefines::EclipseUnitSyste
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
double RimFishbonesMultipleSubs::openHoleRoughnessFactor( RiaDefines::EclipseUnitSystem unitSystem ) const
double RimFishbones::openHoleRoughnessFactor( RiaDefines::EclipseUnitSystem unitSystem ) const
{
RimWellPath* wellPath;
firstAncestorOrThisOfTypeAsserted( wellPath );
@ -314,7 +315,7 @@ double RimFishbonesMultipleSubs::openHoleRoughnessFactor( RiaDefines::EclipseUni
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
double RimFishbonesMultipleSubs::icdOrificeDiameter( RiaDefines::EclipseUnitSystem unitSystem ) const
double RimFishbones::icdOrificeDiameter( RiaDefines::EclipseUnitSystem unitSystem ) const
{
RimWellPath* wellPath;
firstAncestorOrThisOfTypeAsserted( wellPath );
@ -324,7 +325,7 @@ double RimFishbonesMultipleSubs::icdOrificeDiameter( RiaDefines::EclipseUnitSyst
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
double RimFishbonesMultipleSubs::icdFlowCoefficient() const
double RimFishbones::icdFlowCoefficient() const
{
return m_icdFlowCoefficient();
}
@ -332,7 +333,7 @@ double RimFishbonesMultipleSubs::icdFlowCoefficient() const
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
size_t RimFishbonesMultipleSubs::icdCount() const
size_t RimFishbones::icdCount() const
{
return m_icdCount();
}
@ -340,7 +341,7 @@ size_t RimFishbonesMultipleSubs::icdCount() const
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
std::vector<double> RimFishbonesMultipleSubs::lateralLengths() const
std::vector<double> RimFishbones::lateralLengths() const
{
QStringList items = m_lateralLength().split( ' ' );
double currentLength = 0.0;
@ -367,7 +368,7 @@ std::vector<double> RimFishbonesMultipleSubs::lateralLengths() const
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RimFishbonesMultipleSubs::geometryUpdated()
void RimFishbones::geometryUpdated()
{
computeRotationAngles();
computeSubLateralIndices();
@ -384,7 +385,7 @@ void RimFishbonesMultipleSubs::geometryUpdated()
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
std::vector<cvf::Vec3d> RimFishbonesMultipleSubs::coordsForLateral( size_t subIndex, size_t lateralIndex ) const
std::vector<cvf::Vec3d> RimFishbones::coordsForLateral( size_t subIndex, size_t lateralIndex ) const
{
std::vector<std::pair<cvf::Vec3d, double>> coordsAndMD =
m_rigFishbonesGeometry->coordsForLateral( subIndex, lateralIndex );
@ -401,8 +402,7 @@ std::vector<cvf::Vec3d> RimFishbonesMultipleSubs::coordsForLateral( size_t subIn
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
std::vector<std::pair<cvf::Vec3d, double>> RimFishbonesMultipleSubs::coordsAndMDForLateral( size_t subIndex,
size_t lateralIndex ) const
std::vector<std::pair<cvf::Vec3d, double>> RimFishbones::coordsAndMDForLateral( size_t subIndex, size_t lateralIndex ) const
{
return m_rigFishbonesGeometry->coordsForLateral( subIndex, lateralIndex );
}
@ -410,7 +410,7 @@ std::vector<std::pair<cvf::Vec3d, double>> RimFishbonesMultipleSubs::coordsAndMD
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RimFishbonesMultipleSubs::recomputeLateralLocations()
void RimFishbones::recomputeLateralLocations()
{
computeRangesAndLocations();
computeRotationAngles();
@ -419,7 +419,7 @@ void RimFishbonesMultipleSubs::recomputeLateralLocations()
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RimFishbonesMultipleSubs::setUnitSystemSpecificDefaults()
void RimFishbones::setUnitSystemSpecificDefaults()
{
RimWellPath* wellPath;
firstAncestorOrThisOfType( wellPath );
@ -450,7 +450,7 @@ void RimFishbonesMultipleSubs::setUnitSystemSpecificDefaults()
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
RiaDefines::WellPathComponentType RimFishbonesMultipleSubs::componentType() const
RiaDefines::WellPathComponentType RimFishbones::componentType() const
{
return RiaDefines::WellPathComponentType::FISHBONES;
}
@ -458,7 +458,7 @@ RiaDefines::WellPathComponentType RimFishbonesMultipleSubs::componentType() cons
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
QString RimFishbonesMultipleSubs::componentLabel() const
QString RimFishbones::componentLabel() const
{
return generatedName();
}
@ -466,7 +466,7 @@ QString RimFishbonesMultipleSubs::componentLabel() const
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
QString RimFishbonesMultipleSubs::componentTypeLabel() const
QString RimFishbones::componentTypeLabel() const
{
return "Fishbones";
}
@ -474,7 +474,7 @@ QString RimFishbonesMultipleSubs::componentTypeLabel() const
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
cvf::Color3f RimFishbonesMultipleSubs::defaultComponentColor() const
cvf::Color3f RimFishbones::defaultComponentColor() const
{
return fishbonesColor();
}
@ -482,7 +482,7 @@ cvf::Color3f RimFishbonesMultipleSubs::defaultComponentColor() const
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
double RimFishbonesMultipleSubs::startMD() const
double RimFishbones::startMD() const
{
double measuredDepth = 0.0;
if ( !m_valveLocations->valveLocations().empty() )
@ -496,7 +496,7 @@ double RimFishbonesMultipleSubs::startMD() const
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
double RimFishbonesMultipleSubs::endMD() const
double RimFishbones::endMD() const
{
double measuredDepth = 0.0;
if ( !m_valveLocations->valveLocations().empty() )
@ -510,9 +510,7 @@ double RimFishbonesMultipleSubs::endMD() const
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RimFishbonesMultipleSubs::fieldChangedByUi( const caf::PdmFieldHandle* changedField,
const QVariant& oldValue,
const QVariant& newValue )
void RimFishbones::fieldChangedByUi( const caf::PdmFieldHandle* changedField, const QVariant& oldValue, const QVariant& newValue )
{
if ( changedField == &m_subsOrientationMode )
{
@ -530,7 +528,7 @@ void RimFishbonesMultipleSubs::fieldChangedByUi( const caf::PdmFieldHandle* chan
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
caf::PdmFieldHandle* RimFishbonesMultipleSubs::userDescriptionField()
caf::PdmFieldHandle* RimFishbones::userDescriptionField()
{
return &m_name;
}
@ -538,7 +536,7 @@ caf::PdmFieldHandle* RimFishbonesMultipleSubs::userDescriptionField()
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
caf::PdmFieldHandle* RimFishbonesMultipleSubs::objectToggleField()
caf::PdmFieldHandle* RimFishbones::objectToggleField()
{
return &m_isActive;
}
@ -546,7 +544,7 @@ caf::PdmFieldHandle* RimFishbonesMultipleSubs::objectToggleField()
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RimFishbonesMultipleSubs::computeRangesAndLocations()
void RimFishbones::computeRangesAndLocations()
{
m_valveLocations->computeRangesAndLocations();
geometryUpdated();
@ -555,7 +553,7 @@ void RimFishbonesMultipleSubs::computeRangesAndLocations()
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RimFishbonesMultipleSubs::defineUiOrdering( QString uiConfigName, caf::PdmUiOrdering& uiOrdering )
void RimFishbones::defineUiOrdering( QString uiConfigName, caf::PdmUiOrdering& uiOrdering )
{
{
RimWellPath* wellPath;
@ -637,7 +635,7 @@ void RimFishbonesMultipleSubs::defineUiOrdering( QString uiConfigName, caf::PdmU
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RimFishbonesMultipleSubs::initAfterRead()
void RimFishbones::initAfterRead()
{
initValveLocationFromLegacyData();
@ -651,20 +649,17 @@ void RimFishbonesMultipleSubs::initAfterRead()
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
cvf::BoundingBox RimFishbonesMultipleSubs::boundingBoxInDomainCoords() const
cvf::BoundingBox RimFishbones::boundingBoxInDomainCoords() const
{
cvf::BoundingBox bb;
for ( auto& sub : installedLateralIndices() )
for ( const auto& [subIndex, lateralIndex] : installedLateralIndices() )
{
for ( size_t lateralIndex : sub.lateralIndices )
{
std::vector<cvf::Vec3d> coords = coordsForLateral( sub.subIndex, lateralIndex );
std::vector<cvf::Vec3d> coords = coordsForLateral( subIndex, lateralIndex );
for ( auto c : coords )
{
bb.add( c );
}
for ( const auto& c : coords )
{
bb.add( c );
}
}
@ -674,7 +669,7 @@ cvf::BoundingBox RimFishbonesMultipleSubs::boundingBoxInDomainCoords() const
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
bool RimFishbonesMultipleSubs::isEnabled() const
bool RimFishbones::isEnabled() const
{
RimFishbonesCollection* collection;
this->firstAncestorOrThisOfTypeAsserted( collection );
@ -685,13 +680,13 @@ bool RimFishbonesMultipleSubs::isEnabled() const
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RimFishbonesMultipleSubs::computeRotationAngles()
void RimFishbones::computeRotationAngles()
{
std::vector<double> vals;
for ( size_t i = 0; i < m_valveLocations->valveLocations().size(); i++ )
{
vals.push_back( RimFishbonesMultipleSubs::randomValueFromRange( 0, 360 ) );
vals.push_back( RimFishbones::randomValueFromRange( 0, 360 ) );
}
m_installationRotationAngles = vals;
@ -700,56 +695,39 @@ void RimFishbonesMultipleSubs::computeRotationAngles()
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RimFishbonesMultipleSubs::computeSubLateralIndices()
void RimFishbones::computeSubLateralIndices()
{
m_subLateralIndices.clear();
std::vector<SubAndLateralIndex> subLateralCandidates;
for ( size_t subIndex = 0; subIndex < m_valveLocations->valveLocations().size(); ++subIndex )
{
SubLateralIndex subLateralIndex;
subLateralIndex.subIndex = subIndex;
for ( int lateralIndex = 0; lateralIndex < m_lateralCountPerSub(); ++lateralIndex )
{
subLateralIndex.lateralIndices.push_back( lateralIndex );
subLateralCandidates.push_back( std::make_pair( subIndex, lateralIndex ) );
}
m_subLateralIndices.push_back( subLateralIndex );
}
std::mt19937 randomEngine( m_randomSeed() );
std::shuffle( subLateralCandidates.begin(), subLateralCandidates.end(), randomEngine );
double numLaterals = static_cast<double>( m_valveLocations->valveLocations().size() * m_lateralCountPerSub );
int numToRemove = static_cast<int>( std::round( ( 1 - m_lateralInstallSuccessFraction ) * numLaterals ) );
srand( m_randomSeed() );
while ( numToRemove > 0 )
{
int subIndexToRemove;
do
{
subIndexToRemove = rand() % m_subLateralIndices.size();
} while ( m_subLateralIndices[subIndexToRemove].lateralIndices.empty() );
int lateralIndexToRemove = rand() % m_subLateralIndices[subIndexToRemove].lateralIndices.size();
m_subLateralIndices[subIndexToRemove].lateralIndices.erase(
m_subLateralIndices[subIndexToRemove].lateralIndices.begin() + lateralIndexToRemove );
--numToRemove;
}
m_subLateralIndices =
std::vector<SubAndLateralIndex>( subLateralCandidates.begin(), subLateralCandidates.begin() + numLaterals );
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
int RimFishbonesMultipleSubs::randomValueFromRange( int min, int max )
int RimFishbones::randomValueFromRange( int min, int max )
{
// See http://www.cplusplus.com/reference/cstdlib/rand/
int range = abs( max - min );
int randomNumberInRange = rand() % range;
int randomValue = min + randomNumberInRange;
return randomValue;
std::default_random_engine generator;
std::uniform_int_distribution<int> distribution( min, max );
return distribution( generator );
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RimFishbonesMultipleSubs::initialiseObsoleteFields()
void RimFishbones::initialiseObsoleteFields()
{
CAF_PDM_InitField( &m_subsLocationMode_OBSOLETE,
"SubsLocationMode",
@ -785,7 +763,7 @@ void RimFishbonesMultipleSubs::initialiseObsoleteFields()
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RimFishbonesMultipleSubs::initValveLocationFromLegacyData()
void RimFishbones::initValveLocationFromLegacyData()
{
RimMultipleValveLocations::LocationType locationType = RimMultipleValveLocations::VALVE_UNDEFINED;
if ( m_subsLocationMode_OBSOLETE() == FB_SUB_COUNT_END )

View File

@ -43,21 +43,13 @@ class RimMultipleValveLocations;
///
///
//==================================================================================================
struct SubLateralIndex
{
size_t subIndex;
std::vector<size_t> lateralIndices;
};
//==================================================================================================
///
///
//==================================================================================================
class RimFishbonesMultipleSubs : public caf::PdmObject, public Rim3dPropertiesInterface, public RimWellPathComponentInterface
class RimFishbones : public caf::PdmObject, public Rim3dPropertiesInterface, public RimWellPathComponentInterface
{
CAF_PDM_HEADER_INIT;
public:
using SubAndLateralIndex = std::pair<size_t, size_t>;
enum LocationType
{
FB_SUB_COUNT_END,
@ -73,8 +65,8 @@ public:
};
public:
RimFishbonesMultipleSubs();
~RimFishbonesMultipleSubs() override;
RimFishbones();
~RimFishbones() override;
bool isActive() const;
QString generatedName() const;
@ -102,7 +94,7 @@ public:
void geometryUpdated();
const std::vector<SubLateralIndex>& installedLateralIndices() const { return m_subLateralIndices; };
const std::vector<SubAndLateralIndex>& installedLateralIndices() const { return m_subLateralIndices; };
std::vector<cvf::Vec3d> coordsForLateral( size_t subIndex, size_t lateralIndex ) const;
std::vector<std::pair<cvf::Vec3d, double>> coordsAndMDForLateral( size_t subIndex, size_t lateralIndex ) const;
void recomputeLateralLocations();
@ -173,7 +165,7 @@ private:
caf::PdmField<uint> m_randomSeed;
std::unique_ptr<RigFisbonesGeometry> m_rigFishbonesGeometry;
std::vector<SubLateralIndex> m_subLateralIndices;
std::vector<SubAndLateralIndex> m_subLateralIndices;
// Moved to RimMultipleValveLocations
caf::PdmField<caf::AppEnum<LocationType>> m_subsLocationMode_OBSOLETE;

View File

@ -24,8 +24,8 @@
#include "RigWellPath.h"
#include "RimFishboneWellPathCollection.h"
#include "RimFishbonesMultipleSubs.h"
#include "RimFishbones.h"
#include "RimImportedFishboneLateralsCollection.h"
#include "RimProject.h"
#include "RimWellPath.h"
@ -46,21 +46,22 @@ RimFishbonesCollection::RimFishbonesCollection()
nameField()->uiCapability()->setUiHidden( true );
this->setName( "Fishbones" );
CAF_PDM_InitFieldNoDefault( &m_fishbonesSubs, "FishbonesSubs", "fishbonesSubs", "", "", "" );
CAF_PDM_InitFieldNoDefault( &m_fishbones, "FishbonesSubs", "fishbonesSubs", "", "", "" );
m_fishbonesSubs.uiCapability()->setUiHidden( true );
m_fishbones.uiCapability()->setUiHidden( true );
CAF_PDM_InitFieldNoDefault( &m_wellPathCollection, "WellPathCollection", "Imported Laterals", "", "", "" );
m_wellPathCollection = new RimFishboneWellPathCollection;
m_wellPathCollection = new RimImportedFishboneLateralsCollection;
m_wellPathCollection.uiCapability()->setUiHidden( true );
CAF_PDM_InitField( &m_startMD, "StartMD", HUGE_VAL, "Start MD", "", "", "" );
CAF_PDM_InitField( &m_mainBoreDiameter, "MainBoreDiameter", 0.216, "Main Bore Diameter", "", "", "" );
CAF_PDM_InitField( &m_skinFactor, "MainBoreSkinFactor", 0., "Main Bore Skin Factor [0..1]", "", "", "" );
CAF_PDM_InitFieldNoDefault( &m_mswParameters, "MswParameters", "Multi Segment Well Parameters", "", "", "" );
m_mswParameters = new RimMswCompletionParameters( false );
m_mswParameters.uiCapability()->setUiTreeHidden( true );
m_mswParameters.uiCapability()->setUiTreeChildrenHidden( true );
CAF_PDM_InitFieldNoDefault( &m_mswParameters_OBSOLETE, "MswParameters", "Multi Segment Well Parameters", "", "", "" );
m_mswParameters_OBSOLETE = new RimMswCompletionParameters( false );
m_mswParameters_OBSOLETE.uiCapability()->setUiTreeHidden( true );
m_mswParameters_OBSOLETE.uiCapability()->setUiTreeChildrenHidden( true );
m_mswParameters_OBSOLETE.xmlCapability()->setIOWritable( false );
manuallyModifiedStartMD = false;
// Moved to RimMswCompletionParameters and obsoleted
@ -77,7 +78,7 @@ RimFishbonesCollection::RimFishbonesCollection()
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
RimFishboneWellPathCollection* RimFishbonesCollection::wellPathCollection() const
RimImportedFishboneLateralsCollection* RimFishbonesCollection::wellPathCollection() const
{
CVF_ASSERT( m_wellPathCollection );
@ -135,8 +136,6 @@ void RimFishbonesCollection::defineUiOrdering( QString uiConfigName, caf::PdmUiO
wellGroup->add( &m_startMD );
wellGroup->add( &m_mainBoreDiameter );
wellGroup->add( &m_skinFactor );
caf::PdmUiGroup* mswGroup = uiOrdering.addNewGroup( "Multi Segment Well Options" );
m_mswParameters->uiOrdering( uiConfigName, *mswGroup );
uiOrdering.skipRemainingFields( true );
}
@ -147,29 +146,29 @@ void RimFishbonesCollection::initAfterRead()
{
if ( m_linerDiameter_OBSOLETE() != m_linerDiameter_OBSOLETE.defaultValue() )
{
m_mswParameters->setLinerDiameter( m_linerDiameter_OBSOLETE() );
m_mswParameters_OBSOLETE->setLinerDiameter( m_linerDiameter_OBSOLETE() );
}
if ( m_roughnessFactor_OBSOLETE() != m_roughnessFactor_OBSOLETE.defaultValue() )
{
m_mswParameters->setRoughnessFactor( m_roughnessFactor_OBSOLETE() );
m_mswParameters_OBSOLETE->setRoughnessFactor( m_roughnessFactor_OBSOLETE() );
}
if ( m_pressureDrop_OBSOLETE() != m_pressureDrop_OBSOLETE.defaultValue() )
{
m_mswParameters->setPressureDrop( m_pressureDrop_OBSOLETE() );
m_mswParameters_OBSOLETE->setPressureDrop( m_pressureDrop_OBSOLETE() );
}
if ( m_lengthAndDepth_OBSOLETE() != m_lengthAndDepth_OBSOLETE.defaultValue() )
{
m_mswParameters->setLengthAndDepth( m_lengthAndDepth_OBSOLETE() );
m_mswParameters_OBSOLETE->setLengthAndDepth( m_lengthAndDepth_OBSOLETE() );
}
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RimFishbonesCollection::appendFishbonesSubs( RimFishbonesMultipleSubs* subs )
void RimFishbonesCollection::appendFishbonesSubs( RimFishbones* subs )
{
subs->fishbonesColor = nextFishbonesColor();
m_fishbonesSubs.push_back( subs );
m_fishbones.push_back( subs );
subs->setUnitSystemSpecificDefaults();
subs->recomputeLateralLocations();
@ -178,17 +177,17 @@ void RimFishbonesCollection::appendFishbonesSubs( RimFishbonesMultipleSubs* subs
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
const RimMswCompletionParameters* RimFishbonesCollection::mswParameters() const
bool RimFishbonesCollection::hasFishbones() const
{
return m_mswParameters;
return !m_fishbones.empty();
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
std::vector<RimFishbonesMultipleSubs*> RimFishbonesCollection::activeFishbonesSubs() const
std::vector<RimFishbones*> RimFishbonesCollection::activeFishbonesSubs() const
{
std::vector<RimFishbonesMultipleSubs*> active;
std::vector<RimFishbones*> active;
if ( isChecked() )
{
@ -207,9 +206,9 @@ std::vector<RimFishbonesMultipleSubs*> RimFishbonesCollection::activeFishbonesSu
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
std::vector<RimFishbonesMultipleSubs*> RimFishbonesCollection::allFishbonesSubs() const
std::vector<RimFishbones*> RimFishbonesCollection::allFishbonesSubs() const
{
return m_fishbonesSubs.childObjects();
return m_fishbones.childObjects();
}
//--------------------------------------------------------------------------------------------------
@ -231,7 +230,7 @@ cvf::Color3f RimFishbonesCollection::nextFishbonesColor() const
QColor qFishbonesColor;
int newIndex = static_cast<int>( m_fishbonesSubs.size() );
int newIndex = static_cast<int>( m_fishbones.size() );
if ( qWellPathColor.lightnessF() < 0.5 )
{
@ -252,15 +251,15 @@ void RimFishbonesCollection::recalculateStartMD()
{
double minStartMD = HUGE_VAL;
for ( const RimFishbonesMultipleSubs* sub : m_fishbonesSubs() )
for ( const RimFishbones* sub : m_fishbones() )
{
for ( auto& index : sub->installedLateralIndices() )
for ( const auto& subAndLateralIndex : sub->installedLateralIndices() )
{
minStartMD = std::min( minStartMD, sub->measuredDepth( index.subIndex ) - 13.0 );
minStartMD = std::min( minStartMD, sub->measuredDepth( subAndLateralIndex.first ) - 13.0 );
}
}
for ( const RimFishboneWellPath* wellPath : m_wellPathCollection->wellPaths() )
for ( const RimImportedFishboneLaterals* wellPath : m_wellPathCollection->wellPaths() )
{
if ( wellPath->measuredDepths().size() > 0 )
{
@ -282,6 +281,21 @@ double RimFishbonesCollection::startMD() const
return m_startMD;
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
double RimFishbonesCollection::endMD() const
{
double endMD = m_startMD;
if ( !m_fishbones.empty() )
{
auto lastFishbone = m_fishbones.childObjects().back();
CVF_ASSERT( lastFishbone );
endMD = lastFishbone->endMD();
}
return endMD;
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
@ -322,5 +336,4 @@ void RimFishbonesCollection::setUnitSystemSpecificDefaults()
m_wellPathCollection->setUnitSystemSpecificDefaults();
}
m_mswParameters->setUnitSystemSpecificDefaults();
}

View File

@ -29,8 +29,8 @@
#include "cvfColor3.h"
class RimFishbonesMultipleSubs;
class RimFishboneWellPathCollection;
class RimFishbones;
class RimImportedFishboneLateralsCollection;
//==================================================================================================
//
@ -44,15 +44,16 @@ class RimFishbonesCollection : public RimCheckableNamedObject
public:
RimFishbonesCollection();
RimFishboneWellPathCollection* wellPathCollection() const;
void appendFishbonesSubs( RimFishbonesMultipleSubs* subs );
const RimMswCompletionParameters* mswParameters() const;
RimImportedFishboneLateralsCollection* wellPathCollection() const;
void appendFishbonesSubs( RimFishbones* subs );
std::vector<RimFishbonesMultipleSubs*> activeFishbonesSubs() const;
std::vector<RimFishbonesMultipleSubs*> allFishbonesSubs() const;
bool hasFishbones() const;
std::vector<RimFishbones*> activeFishbonesSubs() const;
std::vector<RimFishbones*> allFishbonesSubs() const;
void recalculateStartMD();
double startMD() const;
double endMD() const;
double mainBoreSkinFactor() const { return m_skinFactor; }
double mainBoreDiameter( RiaDefines::EclipseUnitSystem unitSystem ) const;
void setUnitSystemSpecificDefaults();
@ -66,18 +67,18 @@ private:
cvf::Color3f nextFishbonesColor() const;
private:
caf::PdmChildArrayField<RimFishbonesMultipleSubs*> m_fishbonesSubs;
caf::PdmChildField<RimFishboneWellPathCollection*> m_wellPathCollection;
caf::PdmChildArrayField<RimFishbones*> m_fishbones;
caf::PdmChildField<RimImportedFishboneLateralsCollection*> m_wellPathCollection;
caf::PdmField<double> m_startMD;
caf::PdmField<double> m_skinFactor;
caf::PdmField<double> m_mainBoreDiameter;
caf::PdmChildField<RimMswCompletionParameters*> m_mswParameters;
bool manuallyModifiedStartMD;
caf::PdmField<double> m_startMD;
caf::PdmField<double> m_skinFactor;
caf::PdmField<double> m_mainBoreDiameter;
bool manuallyModifiedStartMD;
caf::PdmField<double> m_linerDiameter_OBSOLETE;
caf::PdmField<double> m_roughnessFactor_OBSOLETE;
caf::PdmField<RimMswCompletionParameters::PressureDropEnum> m_pressureDrop_OBSOLETE;
caf::PdmField<RimMswCompletionParameters::LengthAndDepthEnum> m_lengthAndDepth_OBSOLETE;
caf::PdmChildField<RimMswCompletionParameters*> m_mswParameters_OBSOLETE;
};

View File

@ -17,19 +17,19 @@
//
/////////////////////////////////////////////////////////////////////////////////
#include "RimFishboneWellPath.h"
#include "RimImportedFishboneLaterals.h"
#include "RimProject.h"
#include "cafPdmUiListEditor.h"
#include "cafPdmUiTextEditor.h"
CAF_PDM_SOURCE_INIT( RimFishboneWellPath, "WellPathCompletion" );
CAF_PDM_SOURCE_INIT( RimImportedFishboneLaterals, "WellPathCompletion" );
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
RimFishboneWellPath::RimFishboneWellPath()
RimImportedFishboneLaterals::RimImportedFishboneLaterals()
{
CAF_PDM_InitObject( "WellPathCompletion", ":/FishBoneLateralFromFile16x16.png", "", "" );
CAF_PDM_InitFieldNoDefault( &m_coordinates, "Coordinates", "Coordinates", "", "", "" );
@ -41,7 +41,7 @@ RimFishboneWellPath::RimFishboneWellPath()
userDescriptionField()->uiCapability()->setUiHidden( true );
CAF_PDM_InitFieldNoDefault( &m_displayCoordinates, "DisplayCoordinates", "Coordinates", "", "", "" );
m_displayCoordinates.registerGetMethod( this, &RimFishboneWellPath::displayCoordinates );
m_displayCoordinates.registerGetMethod( this, &RimImportedFishboneLaterals::displayCoordinates );
m_displayCoordinates.uiCapability()->setUiReadOnly( true );
m_displayCoordinates.uiCapability()->setUiEditorTypeName( caf::PdmUiTextEditor::uiEditorTypeName() );
m_displayCoordinates.uiCapability()->setUiLabelPosition( caf::PdmUiItemInfo::LabelPosType::TOP );
@ -52,14 +52,14 @@ RimFishboneWellPath::RimFishboneWellPath()
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
RimFishboneWellPath::~RimFishboneWellPath()
RimImportedFishboneLaterals::~RimImportedFishboneLaterals()
{
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RimFishboneWellPath::setCoordinates( std::vector<cvf::Vec3d> coordinates )
void RimImportedFishboneLaterals::setCoordinates( std::vector<cvf::Vec3d> coordinates )
{
m_coordinates = coordinates;
}
@ -67,7 +67,7 @@ void RimFishboneWellPath::setCoordinates( std::vector<cvf::Vec3d> coordinates )
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RimFishboneWellPath::setMeasuredDepths( std::vector<double> measuredDepths )
void RimImportedFishboneLaterals::setMeasuredDepths( std::vector<double> measuredDepths )
{
m_measuredDepths = measuredDepths;
}
@ -75,9 +75,9 @@ void RimFishboneWellPath::setMeasuredDepths( std::vector<double> measuredDepths
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RimFishboneWellPath::fieldChangedByUi( const caf::PdmFieldHandle* changedField,
const QVariant& oldValue,
const QVariant& newValue )
void RimImportedFishboneLaterals::fieldChangedByUi( const caf::PdmFieldHandle* changedField,
const QVariant& oldValue,
const QVariant& newValue )
{
RimProject* proj;
this->firstAncestorOrThisOfType( proj );
@ -87,7 +87,7 @@ void RimFishboneWellPath::fieldChangedByUi( const caf::PdmFieldHandle* changedFi
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RimFishboneWellPath::defineUiOrdering( QString uiConfigName, caf::PdmUiOrdering& uiOrdering )
void RimImportedFishboneLaterals::defineUiOrdering( QString uiConfigName, caf::PdmUiOrdering& uiOrdering )
{
uiOrdering.add( &m_displayCoordinates );
}
@ -95,7 +95,7 @@ void RimFishboneWellPath::defineUiOrdering( QString uiConfigName, caf::PdmUiOrde
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
QString RimFishboneWellPath::displayCoordinates() const
QString RimImportedFishboneLaterals::displayCoordinates() const
{
CVF_ASSERT( m_coordinates().size() == m_measuredDepths().size() );

View File

@ -40,13 +40,13 @@
///
///
//==================================================================================================
class RimFishboneWellPath : public RimCheckableNamedObject
class RimImportedFishboneLaterals : public RimCheckableNamedObject
{
CAF_PDM_HEADER_INIT;
public:
RimFishboneWellPath();
~RimFishboneWellPath() override;
RimImportedFishboneLaterals();
~RimImportedFishboneLaterals() override;
void defineUiOrdering( QString uiConfigName, caf::PdmUiOrdering& uiOrdering ) override;
void fieldChangedByUi( const caf::PdmFieldHandle* changedField, const QVariant& oldValue, const QVariant& newValue ) override;

View File

@ -17,11 +17,11 @@
//
/////////////////////////////////////////////////////////////////////////////////
#include "RimFishboneWellPathCollection.h"
#include "RimImportedFishboneLateralsCollection.h"
#include "Rim3dView.h"
#include "RimFishboneWellPath.h"
#include "RimFishbonesCollection.h"
#include "RimImportedFishboneLaterals.h"
#include "RimProject.h"
#include "RigWellPath.h"
@ -30,12 +30,14 @@
#include "Riu3DMainWindowTools.h"
CAF_PDM_SOURCE_INIT( RimFishboneWellPathCollection, "WellPathCompletionCollection" );
// The more general term WellPathCompletionCollection was unfortunately used in this more specific case of fishbones
// In order to preserve compatibility, the old keyword is kept as an alias, but could be removed in the future.
CAF_PDM_SOURCE_INIT( RimImportedFishboneLateralsCollection, "FishboneWellPathCollection", "WellPathCompletionCollection" );
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
RimFishboneWellPathCollection::RimFishboneWellPathCollection()
RimImportedFishboneLateralsCollection::RimImportedFishboneLateralsCollection()
{
CAF_PDM_InitObject( "WellPathCompletions", ":/FishBoneGroupFromFile16x16.png", "", "" );
@ -55,7 +57,7 @@ RimFishboneWellPathCollection::RimFishboneWellPathCollection()
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RimFishboneWellPathCollection::importCompletionsFromFile( const QStringList& filePaths )
void RimImportedFishboneLateralsCollection::importCompletionsFromFile( const QStringList& filePaths )
{
RifWellPathImporter wellPathImporter;
@ -66,7 +68,7 @@ void RimFishboneWellPathCollection::importCompletionsFromFile( const QStringList
for ( size_t i = 0; i < wellDataCount; ++i )
{
RifWellPathImporter::WellData wellData = wellPathImporter.readWellData( filePath, i );
RimFishboneWellPath* wellCompletion = new RimFishboneWellPath();
RimImportedFishboneLaterals* wellCompletion = new RimImportedFishboneLaterals();
wellCompletion->setName( wellData.m_name );
wellCompletion->setCoordinates( wellData.m_wellPathGeometry->uniqueWellPathPoints() );
wellCompletion->setMeasuredDepths( wellData.m_wellPathGeometry->uniqueMeasuredDepths() );
@ -85,9 +87,9 @@ void RimFishboneWellPathCollection::importCompletionsFromFile( const QStringList
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RimFishboneWellPathCollection::fieldChangedByUi( const caf::PdmFieldHandle* changedField,
const QVariant& oldValue,
const QVariant& newValue )
void RimImportedFishboneLateralsCollection::fieldChangedByUi( const caf::PdmFieldHandle* changedField,
const QVariant& oldValue,
const QVariant& newValue )
{
RimProject* proj;
this->firstAncestorOrThisOfTypeAsserted( proj );
@ -97,11 +99,11 @@ void RimFishboneWellPathCollection::fieldChangedByUi( const caf::PdmFieldHandle*
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
std::vector<const RimFishboneWellPath*> RimFishboneWellPathCollection::wellPaths() const
std::vector<const RimImportedFishboneLaterals*> RimImportedFishboneLateralsCollection::wellPaths() const
{
std::vector<const RimFishboneWellPath*> paths;
std::vector<const RimImportedFishboneLaterals*> paths;
for ( const RimFishboneWellPath* path : m_wellPaths )
for ( const RimImportedFishboneLaterals* path : m_wellPaths )
{
paths.push_back( path );
}
@ -112,7 +114,7 @@ std::vector<const RimFishboneWellPath*> RimFishboneWellPathCollection::wellPaths
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RimFishboneWellPathCollection::setUnitSystemSpecificDefaults()
void RimImportedFishboneLateralsCollection::setUnitSystemSpecificDefaults()
{
m_pipeProperties->setUnitSystemSpecificDefaults();
}
@ -120,7 +122,7 @@ void RimFishboneWellPathCollection::setUnitSystemSpecificDefaults()
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RimFishboneWellPathCollection::defineUiOrdering( QString uiConfigName, caf::PdmUiOrdering& uiOrdering )
void RimImportedFishboneLateralsCollection::defineUiOrdering( QString uiConfigName, caf::PdmUiOrdering& uiOrdering )
{
caf::PdmUiGroup* wellPropertiesGroup = uiOrdering.addNewGroup( "Well Properties" );
m_pipeProperties->uiOrdering( uiConfigName, *wellPropertiesGroup );
@ -129,7 +131,7 @@ void RimFishboneWellPathCollection::defineUiOrdering( QString uiConfigName, caf:
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RimFishboneWellPathCollection::appendCompletion( RimFishboneWellPath* completion )
void RimImportedFishboneLateralsCollection::appendCompletion( RimImportedFishboneLaterals* completion )
{
m_wellPaths.push_back( completion );

View File

@ -20,8 +20,8 @@
#pragma once
#include "RimCheckableNamedObject.h"
#include "RimFishboneWellPath.h"
#include "RimFishbonesPipeProperties.h"
#include "RimImportedFishboneLaterals.h"
#include "RiaDefines.h"
@ -35,19 +35,19 @@
//
//
//==================================================================================================
class RimFishboneWellPathCollection : public RimCheckableNamedObject
class RimImportedFishboneLateralsCollection : public RimCheckableNamedObject
{
CAF_PDM_HEADER_INIT;
public:
RimFishboneWellPathCollection();
RimImportedFishboneLateralsCollection();
void importCompletionsFromFile( const QStringList& filePaths );
void fieldChangedByUi( const caf::PdmFieldHandle* changedField, const QVariant& oldValue, const QVariant& newValue ) override;
std::vector<const RimFishboneWellPath*> wellPaths() const;
double holeDiameter( RiaDefines::EclipseUnitSystem unitSystem ) const
std::vector<const RimImportedFishboneLaterals*> wellPaths() const;
double holeDiameter( RiaDefines::EclipseUnitSystem unitSystem ) const
{
return m_pipeProperties->holeDiameter( unitSystem );
}
@ -59,9 +59,9 @@ protected:
void defineUiOrdering( QString uiConfigName, caf::PdmUiOrdering& uiOrdering ) override;
private:
void appendCompletion( RimFishboneWellPath* completion );
void appendCompletion( RimImportedFishboneLaterals* completion );
private:
caf::PdmChildArrayField<RimFishboneWellPath*> m_wellPaths;
caf::PdmChildField<RimFishbonesPipeProperties*> m_pipeProperties;
caf::PdmChildArrayField<RimImportedFishboneLaterals*> m_wellPaths;
caf::PdmChildField<RimFishbonesPipeProperties*> m_pipeProperties;
};

View File

@ -102,6 +102,33 @@ RimMswCompletionParameters::~RimMswCompletionParameters()
{
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
bool RimMswCompletionParameters::isDefault() const
{
return m_refMDType() == ReferenceMDEnum() && m_refMD() == m_refMD.defaultValue() &&
m_linerDiameter() == m_linerDiameter.defaultValue() &&
m_roughnessFactor() == m_roughnessFactor.defaultValue() && m_pressureDrop == PressureDropEnum() &&
m_enforceMaxSegmentLength() == m_enforceMaxSegmentLength.defaultValue() &&
m_maxSegmentLength() == m_maxSegmentLength.defaultValue();
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
RimMswCompletionParameters& RimMswCompletionParameters::operator=( const RimMswCompletionParameters& rhs )
{
m_refMDType = rhs.m_refMDType();
m_refMD = rhs.m_refMD();
m_linerDiameter = rhs.m_linerDiameter();
m_roughnessFactor = rhs.m_roughnessFactor();
m_pressureDrop = rhs.m_pressureDrop();
m_enforceMaxSegmentLength = rhs.m_enforceMaxSegmentLength();
m_maxSegmentLength = rhs.m_maxSegmentLength();
return *this;
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------

View File

@ -54,6 +54,9 @@ public:
RimMswCompletionParameters( bool enableReferenceDepth = true );
~RimMswCompletionParameters() override;
bool isDefault() const;
RimMswCompletionParameters& operator=( const RimMswCompletionParameters& rhs );
ReferenceMDType referenceMDType() const;
double manualReferenceMD() const;
double linerDiameter( RiaDefines::EclipseUnitSystem unitSystem ) const;

View File

@ -22,7 +22,7 @@
#include "RiaEclipseUnitTools.h"
#include "RimFishbonesMultipleSubs.h"
#include "RimFishbones.h"
#include "RimPerforationInterval.h"
#include "RimWellPath.h"
#include "RimWellPathValve.h"
@ -356,8 +356,8 @@ void RimMultipleValveLocations::fieldChangedByUi( const caf::PdmFieldHandle* cha
{
if ( parentCompletion )
{
RimFishbonesMultipleSubs* fishbones = dynamic_cast<RimFishbonesMultipleSubs*>( parentCompletion );
RimWellPathValve* valve = dynamic_cast<RimWellPathValve*>( parentCompletion );
RimFishbones* fishbones = dynamic_cast<RimFishbones*>( parentCompletion );
RimWellPathValve* valve = dynamic_cast<RimWellPathValve*>( parentCompletion );
if ( fishbones )
{
fishbones->recomputeLateralLocations();

View File

@ -60,10 +60,10 @@ RimPerforationCollection::RimPerforationCollection()
CAF_PDM_InitFieldNoDefault( &m_perforations, "Perforations", "Perforations", "", "", "" );
m_perforations.uiCapability()->setUiHidden( true );
CAF_PDM_InitFieldNoDefault( &m_mswParameters, "MswParameters", "Multi Segment Well Parameters", "", "", "" );
m_mswParameters = new RimMswCompletionParameters;
m_mswParameters.uiCapability()->setUiTreeHidden( true );
m_mswParameters.uiCapability()->setUiTreeChildrenHidden( true );
CAF_PDM_InitFieldNoDefault( &m_mswParameters_OBSOLETE, "MswParameters", "Multi Segment Well Parameters", "", "", "" );
m_mswParameters_OBSOLETE = new RimMswCompletionParameters;
m_mswParameters_OBSOLETE.uiCapability()->setUiTreeHidden( true );
m_mswParameters_OBSOLETE.uiCapability()->setUiTreeChildrenHidden( true );
CAF_PDM_InitFieldNoDefault( &m_nonDarcyParameters, "NonDarcyParameters", "Non-Darcy Parameters", "", "", "" );
m_nonDarcyParameters = new RimNonDarcyPerforationParameters();
@ -82,9 +82,9 @@ RimPerforationCollection::~RimPerforationCollection()
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
const RimMswCompletionParameters* RimPerforationCollection::mswParameters() const
bool RimPerforationCollection::hasPerforations() const
{
return m_mswParameters;
return !m_perforations.empty();
}
//--------------------------------------------------------------------------------------------------
@ -95,14 +95,6 @@ const RimNonDarcyPerforationParameters* RimPerforationCollection::nonDarcyParame
return m_nonDarcyParameters;
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RimPerforationCollection::setUnitSystemSpecificDefaults()
{
m_mswParameters->setUnitSystemSpecificDefaults();
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
@ -190,7 +182,7 @@ std::vector<const RimPerforationInterval*> RimPerforationCollection::activePerfo
void RimPerforationCollection::defineUiOrdering( QString uiConfigName, caf::PdmUiOrdering& uiOrdering )
{
caf::PdmUiGroup* mswGroup = uiOrdering.addNewGroup( "Multi Segment Well Options" );
m_mswParameters->uiOrdering( uiConfigName, *mswGroup );
m_mswParameters_OBSOLETE->uiOrdering( uiConfigName, *mswGroup );
m_nonDarcyParameters->uiOrdering( uiConfigName, uiOrdering );
uiOrdering.skipRemainingFields( true );
}
@ -212,4 +204,4 @@ void RimPerforationCollection::fieldChangedByUi( const caf::PdmFieldHandle* chan
{
proj->scheduleCreateDisplayModelAndRedrawAllViews();
}
}
}

View File

@ -50,9 +50,8 @@ public:
RimPerforationCollection();
~RimPerforationCollection() override;
const RimMswCompletionParameters* mswParameters() const;
bool hasPerforations() const;
const RimNonDarcyPerforationParameters* nonDarcyParameters() const;
void setUnitSystemSpecificDefaults();
void appendPerforation( RimPerforationInterval* perforation );
std::vector<const RimPerforationInterval*> perforations() const;
std::vector<const RimPerforationInterval*> activePerforations() const;
@ -65,6 +64,7 @@ private:
private:
caf::PdmChildArrayField<RimPerforationInterval*> m_perforations;
caf::PdmChildField<RimMswCompletionParameters*> m_mswParameters;
caf::PdmChildField<RimNonDarcyPerforationParameters*> m_nonDarcyParameters;
caf::PdmChildField<RimMswCompletionParameters*> m_mswParameters_OBSOLETE;
};

View File

@ -0,0 +1,377 @@
/////////////////////////////////////////////////////////////////////////////////
//
// Copyright (C) 2021- Equinor ASA
//
// ResInsight is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// ResInsight is distributed in the hope that it will be useful, but WITHOUT ANY
// WARRANTY; without even the implied warranty of MERCHANTABILITY or
// FITNESS FOR A PARTICULAR PURPOSE.
//
// See the GNU General Public License at <http://www.gnu.org/licenses/gpl.html>
// for more details.
//
/////////////////////////////////////////////////////////////////////////////////
#include "RimWellPathCompletionSettings.h"
#include "RiaStdStringTools.h"
#include "RimMswCompletionParameters.h"
#include "cafPdmDoubleStringValidator.h"
#include "cafPdmUiLineEditor.h"
#include "cafPdmUiOrdering.h"
#include "cafPdmUiTreeOrdering.h"
namespace caf
{
template <>
void RimWellPathCompletionSettings::WellTypeEnum::setUp()
{
addItem( RimWellPathCompletionSettings::OIL, "OIL", "Oil" );
addItem( RimWellPathCompletionSettings::GAS, "GAS", "Gas" );
addItem( RimWellPathCompletionSettings::WATER, "WATER", "Water" );
addItem( RimWellPathCompletionSettings::LIQUID, "LIQUID", "Liquid" );
setDefault( RimWellPathCompletionSettings::OIL );
}
template <>
void RimWellPathCompletionSettings::GasInflowEnum::setUp()
{
addItem( RimWellPathCompletionSettings::STANDARD_EQ, "STD", "Standard" );
addItem( RimWellPathCompletionSettings::RUSSELL_GOODRICH, "R-G", "Russell-Goodrich" );
addItem( RimWellPathCompletionSettings::DRY_GAS_PSEUDO_PRESSURE, "P-P", "Dry Gas Pseudo-Pressure" );
addItem( RimWellPathCompletionSettings::GENERALIZED_PSEUDO_PRESSURE, "GPP", "Generalized Pseudo-Pressure" );
setDefault( RimWellPathCompletionSettings::STANDARD_EQ );
}
template <>
void RimWellPathCompletionSettings::AutomaticWellShutInEnum::setUp()
{
addItem( RimWellPathCompletionSettings::ISOLATE_FROM_FORMATION, "SHUT", "Isolate from Formation" );
addItem( RimWellPathCompletionSettings::STOP_ABOVE_FORMATION, "STOP", "Stop above Formation" );
setDefault( RimWellPathCompletionSettings::STOP_ABOVE_FORMATION );
}
template <>
void RimWellPathCompletionSettings::HydrostaticDensityEnum::setUp()
{
addItem( RimWellPathCompletionSettings::SEGMENTED, "SEG", "Segmented" );
addItem( RimWellPathCompletionSettings::AVERAGED, "AVG", "Averaged" );
setDefault( RimWellPathCompletionSettings::SEGMENTED );
}
} // namespace caf
CAF_PDM_SOURCE_INIT( RimWellPathCompletionSettings, "WellPathCompletionSettings" );
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
RimWellPathCompletionSettings::RimWellPathCompletionSettings()
{
CAF_PDM_InitObject( "Completion Settings", ":/CompletionsSymbol16x16.png", "", "" );
CAF_PDM_InitField( &m_wellNameForExport, "WellNameForExport", QString(), "Well Name", "", "", "" );
m_wellNameForExport.uiCapability()->setUiEditorTypeName( caf::PdmUiLineEditor::uiEditorTypeName() );
CAF_PDM_InitField( &m_wellGroupName, "WellGroupNameForExport", QString(), "Well Group Name", "", "", "" );
CAF_PDM_InitField( &m_referenceDepth, "ReferenceDepthForExport", QString(), "Reference Depth for BHP", "", "", "" );
CAF_PDM_InitFieldNoDefault( &m_preferredFluidPhase, "WellTypeForExport", "Preferred Fluid Phase", "", "", "" );
CAF_PDM_InitField( &m_drainageRadiusForPI, "DrainageRadiusForPI", QString( "0.0" ), "Drainage Radius for PI", "", "", "" );
CAF_PDM_InitFieldNoDefault( &m_gasInflowEquation, "GasInflowEq", "Gas Inflow Equation", "", "", "" );
CAF_PDM_InitFieldNoDefault( &m_automaticWellShutIn, "AutoWellShutIn", "Automatic well shut-in", "", "", "" );
CAF_PDM_InitField( &m_allowWellCrossFlow, "AllowWellCrossFlow", true, "Allow Well Cross-Flow", "", "", "" );
CAF_PDM_InitField( &m_wellBoreFluidPVTTable, "WellBoreFluidPVTTable", 0, "Wellbore Fluid PVT table", "", "", "" );
CAF_PDM_InitFieldNoDefault( &m_hydrostaticDensity, "HydrostaticDensity", "Hydrostatic Density", "", "", "" );
CAF_PDM_InitField( &m_fluidInPlaceRegion, "FluidInPlaceRegion", 0, "Fluid In-Place Region", "", "", "" );
CAF_PDM_InitFieldNoDefault( &m_mswParameters, "MswParameters", "Multi Segment Well Parameters", "", "", "" );
m_mswParameters = new RimMswCompletionParameters( false );
m_mswParameters.uiCapability()->setUiTreeHidden( true );
m_mswParameters.uiCapability()->setUiTreeChildrenHidden( true );
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
RimWellPathCompletionSettings::RimWellPathCompletionSettings( const RimWellPathCompletionSettings& rhs )
: RimWellPathCompletionSettings()
{
*this = rhs;
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
RimWellPathCompletionSettings& RimWellPathCompletionSettings::operator=( const RimWellPathCompletionSettings& rhs )
{
m_wellNameForExport = rhs.m_wellNameForExport;
m_wellGroupName = rhs.m_wellGroupName;
m_referenceDepth = rhs.m_referenceDepth;
m_preferredFluidPhase = rhs.m_preferredFluidPhase;
m_drainageRadiusForPI = rhs.m_drainageRadiusForPI;
m_gasInflowEquation = rhs.m_gasInflowEquation;
m_automaticWellShutIn = rhs.m_automaticWellShutIn;
m_allowWellCrossFlow = rhs.m_allowWellCrossFlow;
m_wellBoreFluidPVTTable = rhs.m_wellBoreFluidPVTTable;
m_hydrostaticDensity = rhs.m_hydrostaticDensity;
m_fluidInPlaceRegion = rhs.m_fluidInPlaceRegion;
return *this;
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RimWellPathCompletionSettings::setWellNameForExport( const QString& name )
{
auto n = name;
m_wellNameForExport = n.remove( ' ' );
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RimWellPathCompletionSettings::updateWellPathNameHasChanged( const QString& newWellPathName,
const QString& previousWellPathName )
{
if ( m_wellNameForExport().isEmpty() || m_wellNameForExport == previousWellPathName )
{
m_wellNameForExport = newWellPathName;
}
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
QString RimWellPathCompletionSettings::wellNameForExport() const
{
return formatStringForExport( m_wellNameForExport() );
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
QString RimWellPathCompletionSettings::wellGroupNameForExport() const
{
return formatStringForExport( m_wellGroupName, "1*" );
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
QString RimWellPathCompletionSettings::referenceDepthForExport() const
{
std::string refDepth = m_referenceDepth.v().toStdString();
if ( RiaStdStringTools::isNumber( refDepth, '.' ) )
{
return m_referenceDepth.v();
}
return "1*";
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
QString RimWellPathCompletionSettings::wellTypeNameForExport() const
{
switch ( m_preferredFluidPhase.v() )
{
case OIL:
return "OIL";
case GAS:
return "GAS";
case WATER:
return "WATER";
case LIQUID:
return "LIQ";
}
return "";
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
QString RimWellPathCompletionSettings::drainageRadiusForExport() const
{
return m_drainageRadiusForPI();
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
QString RimWellPathCompletionSettings::gasInflowEquationForExport() const
{
return m_gasInflowEquation().text();
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
QString RimWellPathCompletionSettings::automaticWellShutInForExport() const
{
return m_automaticWellShutIn().text();
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
QString RimWellPathCompletionSettings::allowWellCrossFlowForExport() const
{
return m_allowWellCrossFlow() ? "YES" : "NO";
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
QString RimWellPathCompletionSettings::wellBoreFluidPVTForExport() const
{
return QString( "%1" ).arg( m_wellBoreFluidPVTTable() );
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
QString RimWellPathCompletionSettings::hydrostaticDensityForExport() const
{
return m_hydrostaticDensity().text();
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
QString RimWellPathCompletionSettings::fluidInPlaceRegionForExport() const
{
return QString( "%1" ).arg( m_fluidInPlaceRegion() );
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RimWellPathCompletionSettings::setUnitSystemSpecificDefaults()
{
m_mswParameters->setUnitSystemSpecificDefaults();
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
const RimMswCompletionParameters* RimWellPathCompletionSettings::mswParameters() const
{
return m_mswParameters();
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
RimMswCompletionParameters* RimWellPathCompletionSettings::mswParameters()
{
return m_mswParameters();
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
QRegExp RimWellPathCompletionSettings::wellNameForExportRegExp()
{
QRegExp rx( "[\\w\\-\\_]{1,8}" );
return rx;
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RimWellPathCompletionSettings::defineUiOrdering( QString uiConfigName, caf::PdmUiOrdering& uiOrdering )
{
caf::PdmUiGroup* compExportGroup = uiOrdering.addNewGroup( "Completion Export Parameters" );
compExportGroup->add( &m_wellNameForExport );
compExportGroup->add( &m_wellGroupName );
compExportGroup->add( &m_referenceDepth );
compExportGroup->add( &m_preferredFluidPhase );
compExportGroup->add( &m_drainageRadiusForPI );
compExportGroup->add( &m_gasInflowEquation );
compExportGroup->add( &m_automaticWellShutIn );
compExportGroup->add( &m_allowWellCrossFlow );
compExportGroup->add( &m_wellBoreFluidPVTTable );
compExportGroup->add( &m_hydrostaticDensity );
compExportGroup->add( &m_fluidInPlaceRegion );
caf::PdmUiGroup* mswGroup = uiOrdering.addNewGroup( "Multi Segment Well Options" );
m_mswParameters->uiOrdering( uiConfigName, *mswGroup );
uiOrdering.skipRemainingFields( true );
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RimWellPathCompletionSettings::fieldChangedByUi( const caf::PdmFieldHandle* changedField,
const QVariant& oldValue,
const QVariant& newValue )
{
if ( changedField == &m_referenceDepth )
{
if ( !RiaStdStringTools::isNumber( m_referenceDepth.v().toStdString(), '.' ) )
{
if ( !RiaStdStringTools::isNumber( m_referenceDepth.v().toStdString(), ',' ) )
{
// Remove invalid input text
m_referenceDepth = "";
}
else
{
// Wrong decimal sign entered, replace , by .
auto text = m_referenceDepth.v();
m_referenceDepth = text.replace( ',', '.' );
}
}
}
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RimWellPathCompletionSettings::defineEditorAttribute( const caf::PdmFieldHandle* field,
QString uiConfigName,
caf::PdmUiEditorAttribute* attribute )
{
caf::PdmUiLineEditorAttribute* lineEditorAttr = dynamic_cast<caf::PdmUiLineEditorAttribute*>( attribute );
if ( field == &m_wellNameForExport && lineEditorAttr )
{
QRegExpValidator* validator = new QRegExpValidator( nullptr );
validator->setRegExp( wellNameForExportRegExp() );
lineEditorAttr->validator = validator;
}
else if ( field == &m_drainageRadiusForPI && lineEditorAttr )
{
caf::PdmDoubleStringValidator* validator = new caf::PdmDoubleStringValidator( "1*" );
lineEditorAttr->validator = validator;
}
else if ( field == &m_wellBoreFluidPVTTable && lineEditorAttr )
{
// Positive integer
QIntValidator* validator = new QIntValidator( 0, std::numeric_limits<int>::max(), nullptr );
lineEditorAttr->validator = validator;
}
else if ( field == &m_fluidInPlaceRegion && lineEditorAttr )
{
// Any integer
QIntValidator* validator =
new QIntValidator( -std::numeric_limits<int>::max(), std::numeric_limits<int>::max(), nullptr );
lineEditorAttr->validator = validator;
}
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
QString RimWellPathCompletionSettings::formatStringForExport( const QString& text, const QString& defaultValue ) const
{
if ( text.isEmpty() ) return defaultValue;
if ( text.contains( ' ' ) ) return QString( "'%1'" ).arg( text );
return text;
}

View File

@ -0,0 +1,117 @@
/////////////////////////////////////////////////////////////////////////////////
//
// Copyright (C) 2021- Equinor ASA
//
// ResInsight is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// ResInsight is distributed in the hope that it will be useful, but WITHOUT ANY
// WARRANTY; without even the implied warranty of MERCHANTABILITY or
// FITNESS FOR A PARTICULAR PURPOSE.
//
// See the GNU General Public License at <http://www.gnu.org/licenses/gpl.html>
// for more details.
//
/////////////////////////////////////////////////////////////////////////////////
#pragma once
#include "cafPdmChildField.h"
#include "cafPdmField.h"
#include "cafPdmObject.h"
class RimMswCompletionParameters;
class RimWellPathCompletionsLegacy;
class RimWellPathCompletionSettings : public caf::PdmObject
{
CAF_PDM_HEADER_INIT;
public:
enum WellType
{
OIL,
GAS,
WATER,
LIQUID
};
typedef caf::AppEnum<WellType> WellTypeEnum;
enum GasInflowEquation
{
STANDARD_EQ,
RUSSELL_GOODRICH,
DRY_GAS_PSEUDO_PRESSURE,
GENERALIZED_PSEUDO_PRESSURE
};
typedef caf::AppEnum<GasInflowEquation> GasInflowEnum;
enum AutomaticWellShutIn
{
ISOLATE_FROM_FORMATION,
STOP_ABOVE_FORMATION
};
typedef caf::AppEnum<AutomaticWellShutIn> AutomaticWellShutInEnum;
enum HydrostaticDensity
{
SEGMENTED,
AVERAGED
};
typedef caf::AppEnum<HydrostaticDensity> HydrostaticDensityEnum;
public:
RimWellPathCompletionSettings();
RimWellPathCompletionSettings( const RimWellPathCompletionSettings& rhs );
RimWellPathCompletionSettings& operator=( const RimWellPathCompletionSettings& rhs );
void setWellNameForExport( const QString& name );
void updateWellPathNameHasChanged( const QString& newWellPathName, const QString& previousWellPathName );
QString wellNameForExport() const;
QString wellGroupNameForExport() const;
QString referenceDepthForExport() const;
QString wellTypeNameForExport() const;
QString drainageRadiusForExport() const;
QString gasInflowEquationForExport() const;
QString automaticWellShutInForExport() const;
QString allowWellCrossFlowForExport() const;
QString wellBoreFluidPVTForExport() const;
QString hydrostaticDensityForExport() const;
QString fluidInPlaceRegionForExport() const;
void setUnitSystemSpecificDefaults();
const RimMswCompletionParameters* mswParameters() const;
RimMswCompletionParameters* mswParameters();
static QRegExp wellNameForExportRegExp();
protected:
void defineUiOrdering( QString uiConfigName, caf::PdmUiOrdering& uiOrdering ) override;
void fieldChangedByUi( const caf::PdmFieldHandle* changedField, const QVariant& oldValue, const QVariant& newValue ) override;
void defineEditorAttribute( const caf::PdmFieldHandle* field,
QString uiConfigName,
caf::PdmUiEditorAttribute* attribute ) override;
private:
QString formatStringForExport( const QString& text, const QString& defaultText = "" ) const;
private:
friend class RimWellPathCompletions;
caf::PdmField<QString> m_wellNameForExport;
caf::PdmField<QString> m_wellGroupName;
caf::PdmField<QString> m_referenceDepth;
caf::PdmField<WellTypeEnum> m_preferredFluidPhase;
caf::PdmField<QString> m_drainageRadiusForPI;
caf::PdmField<GasInflowEnum> m_gasInflowEquation;
caf::PdmField<AutomaticWellShutInEnum> m_automaticWellShutIn;
caf::PdmField<bool> m_allowWellCrossFlow;
caf::PdmField<int> m_wellBoreFluidPVTTable;
caf::PdmField<HydrostaticDensityEnum> m_hydrostaticDensity;
caf::PdmField<int> m_fluidInPlaceRegion;
caf::PdmChildField<RimMswCompletionParameters*> m_mswParameters;
};

View File

@ -20,13 +20,15 @@
#include "RiaStdStringTools.h"
#include "RimFishboneWellPathCollection.h"
#include "RimFishbones.h"
#include "RimFishbonesCollection.h"
#include "RimFishbonesMultipleSubs.h"
#include "RimImportedFishboneLateralsCollection.h"
#include "RimPerforationCollection.h"
#include "RimPerforationInterval.h"
#include "RimProject.h"
#include "RimStimPlanModel.h"
#include "RimStimPlanModelCollection.h"
#include "RimWellPath.h"
#include "RimWellPathComponentInterface.h"
#include "RimWellPathFracture.h"
#include "RimWellPathFractureCollection.h"
@ -39,58 +41,8 @@
#include "cafPdmUiLineEditor.h"
#include "cafPdmUiTreeOrdering.h"
#include <QRegExpValidator>
#include <cmath>
//--------------------------------------------------------------------------------------------------
/// Internal constants
//--------------------------------------------------------------------------------------------------
#define DOUBLE_INF std::numeric_limits<double>::infinity()
namespace caf
{
template <>
void RimWellPathCompletions::WellTypeEnum::setUp()
{
addItem( RimWellPathCompletions::OIL, "OIL", "Oil" );
addItem( RimWellPathCompletions::GAS, "GAS", "Gas" );
addItem( RimWellPathCompletions::WATER, "WATER", "Water" );
addItem( RimWellPathCompletions::LIQUID, "LIQUID", "Liquid" );
setDefault( RimWellPathCompletions::OIL );
}
template <>
void RimWellPathCompletions::GasInflowEnum::setUp()
{
addItem( RimWellPathCompletions::STANDARD_EQ, "STD", "Standard" );
addItem( RimWellPathCompletions::RUSSELL_GOODRICH, "R-G", "Russell-Goodrich" );
addItem( RimWellPathCompletions::DRY_GAS_PSEUDO_PRESSURE, "P-P", "Dry Gas Pseudo-Pressure" );
addItem( RimWellPathCompletions::GENERALIZED_PSEUDO_PRESSURE, "GPP", "Generalized Pseudo-Pressure" );
setDefault( RimWellPathCompletions::STANDARD_EQ );
}
template <>
void RimWellPathCompletions::AutomaticWellShutInEnum::setUp()
{
addItem( RimWellPathCompletions::ISOLATE_FROM_FORMATION, "SHUT", "Isolate from Formation" );
addItem( RimWellPathCompletions::STOP_ABOVE_FORMATION, "STOP", "Stop above Formation" );
setDefault( RimWellPathCompletions::STOP_ABOVE_FORMATION );
}
template <>
void RimWellPathCompletions::HydrostaticDensityEnum::setUp()
{
addItem( RimWellPathCompletions::SEGMENTED, "SEG", "Segmented" );
addItem( RimWellPathCompletions::AVERAGED, "AVG", "Averaged" );
setDefault( RimWellPathCompletions::SEGMENTED );
}
} // namespace caf
CAF_PDM_SOURCE_INIT( RimWellPathCompletions, "WellPathCompletions" );
//--------------------------------------------------------------------------------------------------
@ -116,19 +68,34 @@ RimWellPathCompletions::RimWellPathCompletions()
m_stimPlanModelCollection = new RimStimPlanModelCollection;
m_stimPlanModelCollection.uiCapability()->setUiHidden( true );
CAF_PDM_InitField( &m_wellNameForExport, "WellNameForExport", QString(), "Well Name", "", "", "" );
m_wellNameForExport.uiCapability()->setUiEditorTypeName( caf::PdmUiLineEditor::uiEditorTypeName() );
CAF_PDM_InitField( &m_wellGroupName, "WellGroupNameForExport", QString(), "Well Group Name", "", "", "" );
CAF_PDM_InitField( &m_referenceDepth, "ReferenceDepthForExport", QString(), "Reference Depth for BHP", "", "", "" );
CAF_PDM_InitField( &m_preferredFluidPhase, "WellTypeForExport", WellTypeEnum(), "Preferred Fluid Phase", "", "", "" );
CAF_PDM_InitField( &m_drainageRadiusForPI, "DrainageRadiusForPI", QString( "0.0" ), "Drainage Radius for PI", "", "", "" );
CAF_PDM_InitFieldNoDefault( &m_gasInflowEquation, "GasInflowEq", "Gas Inflow Equation", "", "", "" );
CAF_PDM_InitFieldNoDefault( &m_automaticWellShutIn, "AutoWellShutIn", "Automatic well shut-in", "", "", "" );
CAF_PDM_InitField( &m_allowWellCrossFlow, "AllowWellCrossFlow", true, "Allow Well Cross-Flow", "", "", "" );
CAF_PDM_InitField( &m_wellBoreFluidPVTTable, "WellBoreFluidPVTTable", 0, "Wellbore Fluid PVT table", "", "", "" );
CAF_PDM_InitFieldNoDefault( &m_hydrostaticDensity, "HydrostaticDensity", "Hydrostatic Density", "", "", "" );
CAF_PDM_InitField( &m_fluidInPlaceRegion, "FluidInPlaceRegion", 0, "Fluid In-Place Region", "", "", "" );
CAF_PDM_InitField( &m_wellNameForExport_OBSOLETE, "WellNameForExport", QString(), "Well Name", "", "", "" );
m_wellNameForExport_OBSOLETE.xmlCapability()->setIOWritable( false );
CAF_PDM_InitField( &m_wellGroupName_OBSOLETE, "WellGroupNameForExport", QString(), "Well Group Name", "", "", "" );
m_wellGroupName_OBSOLETE.xmlCapability()->setIOWritable( false );
CAF_PDM_InitField( &m_referenceDepth_OBSOLETE, "ReferenceDepthForExport", QString(), "Reference Depth for BHP", "", "", "" );
m_referenceDepth_OBSOLETE.xmlCapability()->setIOWritable( false );
CAF_PDM_InitFieldNoDefault( &m_preferredFluidPhase_OBSOLETE, "WellTypeForExport", "Preferred Fluid Phase", "", "", "" );
m_preferredFluidPhase_OBSOLETE.xmlCapability()->setIOWritable( false );
CAF_PDM_InitField( &m_drainageRadiusForPI_OBSOLETE,
"DrainageRadiusForPI",
QString( "0.0" ),
"Drainage Radius for PI",
"",
"",
"" );
m_drainageRadiusForPI_OBSOLETE.xmlCapability()->setIOWritable( false );
CAF_PDM_InitFieldNoDefault( &m_gasInflowEquation_OBSOLETE, "GasInflowEq", "Gas Inflow Equation", "", "", "" );
m_gasInflowEquation_OBSOLETE.xmlCapability()->setIOWritable( false );
CAF_PDM_InitFieldNoDefault( &m_automaticWellShutIn_OBSOLETE, "AutoWellShutIn", "Automatic well shut-in", "", "", "" );
m_automaticWellShutIn_OBSOLETE.xmlCapability()->setIOWritable( false );
CAF_PDM_InitField( &m_allowWellCrossFlow_OBSOLETE, "AllowWellCrossFlow", true, "Allow Well Cross-Flow", "", "", "" );
m_allowWellCrossFlow_OBSOLETE.xmlCapability()->setIOWritable( false );
CAF_PDM_InitField( &m_wellBoreFluidPVTTable_OBSOLETE, "WellBoreFluidPVTTable", 0, "Wellbore Fluid PVT table", "", "", "" );
m_wellBoreFluidPVTTable_OBSOLETE.xmlCapability()->setIOWritable( false );
CAF_PDM_InitFieldNoDefault( &m_hydrostaticDensity_OBSOLETE, "HydrostaticDensity", "Hydrostatic Density", "", "", "" );
m_hydrostaticDensity_OBSOLETE.xmlCapability()->setIOWritable( false );
CAF_PDM_InitField( &m_fluidInPlaceRegion_OBSOLETE, "FluidInPlaceRegion", 0, "Fluid In-Place Region", "", "", "" );
m_fluidInPlaceRegion_OBSOLETE.xmlCapability()->setIOWritable( false );
}
//--------------------------------------------------------------------------------------------------
@ -151,75 +118,6 @@ RimPerforationCollection* RimWellPathCompletions::perforationCollection() const
return m_perforationCollection;
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RimWellPathCompletions::setWellNameForExport( const QString& name )
{
auto n = name;
m_wellNameForExport = n.remove( ' ' );
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RimWellPathCompletions::updateWellPathNameHasChanged( const QString& newWellPathName,
const QString& previousWellPathName )
{
if ( m_wellNameForExport == previousWellPathName )
{
m_wellNameForExport = newWellPathName;
}
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
QString RimWellPathCompletions::wellNameForExport() const
{
return formatStringForExport( m_wellNameForExport() );
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
QString RimWellPathCompletions::wellGroupNameForExport() const
{
return formatStringForExport( m_wellGroupName, "1*" );
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
QString RimWellPathCompletions::referenceDepthForExport() const
{
std::string refDepth = m_referenceDepth.v().toStdString();
if ( RiaStdStringTools::isNumber( refDepth, '.' ) )
{
return m_referenceDepth.v();
}
return "1*";
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
QString RimWellPathCompletions::wellTypeNameForExport() const
{
switch ( m_preferredFluidPhase.v() )
{
case OIL:
return "OIL";
case GAS:
return "GAS";
case WATER:
return "WATER";
case LIQUID:
return "LIQ";
}
return "";
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
@ -250,6 +148,30 @@ std::vector<RimWellPathValve*> RimWellPathCompletions::valves() const
return allValves;
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
std::vector<RimWellPathFracture*> RimWellPathCompletions::allFractures() const
{
if ( m_fractureCollection->isChecked() )
{
return m_fractureCollection->allFractures();
}
return {};
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
std::vector<RimWellPathFracture*> RimWellPathCompletions::activeFractures() const
{
if ( m_fractureCollection->isChecked() )
{
return m_fractureCollection->activeFractures();
}
return {};
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
@ -257,15 +179,15 @@ std::vector<const RimWellPathComponentInterface*> RimWellPathCompletions::allCom
{
std::vector<const RimWellPathComponentInterface*> completions;
for ( const RimWellPathFracture* fracture : fractureCollection()->allFractures() )
for ( const RimWellPathFracture* fracture : m_fractureCollection->allFractures() )
{
completions.push_back( fracture );
}
for ( const RimFishbonesMultipleSubs* fishbones : fishbonesCollection()->allFishbonesSubs() )
for ( const RimFishbones* fishbones : m_fishbonesCollection->allFishbonesSubs() )
{
completions.push_back( fishbones );
}
for ( const RimPerforationInterval* perforation : perforationCollection()->perforations() )
for ( const RimPerforationInterval* perforation : m_perforationCollection->perforations() )
{
completions.push_back( perforation );
}
@ -284,70 +206,14 @@ std::vector<const RimWellPathComponentInterface*> RimWellPathCompletions::allCom
//--------------------------------------------------------------------------------------------------
bool RimWellPathCompletions::hasCompletions() const
{
if ( !fractureCollection()->allFractures().empty() || !stimPlanModelCollection()->allStimPlanModels().empty() )
if ( !m_fractureCollection->allFractures().empty() || !m_stimPlanModelCollection->allStimPlanModels().empty() )
{
return true;
}
return !fishbonesCollection()->allFishbonesSubs().empty() ||
!fishbonesCollection()->wellPathCollection()->wellPaths().empty() ||
!perforationCollection()->perforations().empty();
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
QString RimWellPathCompletions::drainageRadiusForExport() const
{
return m_drainageRadiusForPI();
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
QString RimWellPathCompletions::gasInflowEquationForExport() const
{
return m_gasInflowEquation().text();
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
QString RimWellPathCompletions::automaticWellShutInForExport() const
{
return m_automaticWellShutIn().text();
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
QString RimWellPathCompletions::allowWellCrossFlowForExport() const
{
return m_allowWellCrossFlow() ? "YES" : "NO";
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
QString RimWellPathCompletions::wellBoreFluidPVTForExport() const
{
return QString( "%1" ).arg( m_wellBoreFluidPVTTable() );
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
QString RimWellPathCompletions::hydrostaticDensityForExport() const
{
return m_hydrostaticDensity().text();
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
QString RimWellPathCompletions::fluidInPlaceRegionForExport() const
{
return QString( "%1" ).arg( m_fluidInPlaceRegion() );
return !m_fishbonesCollection->allFishbonesSubs().empty() ||
!m_fishbonesCollection->wellPathCollection()->wellPaths().empty() ||
!m_perforationCollection->perforations().empty();
}
//--------------------------------------------------------------------------------------------------
@ -356,17 +222,6 @@ QString RimWellPathCompletions::fluidInPlaceRegionForExport() const
void RimWellPathCompletions::setUnitSystemSpecificDefaults()
{
m_fishbonesCollection->setUnitSystemSpecificDefaults();
m_fractureCollection->setUnitSystemSpecificDefaults();
m_perforationCollection->setUnitSystemSpecificDefaults();
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
QRegExp RimWellPathCompletions::wellNameForExportRegExp()
{
QRegExp rx( "[\\w\\-\\_]{1,8}" );
return rx;
}
//--------------------------------------------------------------------------------------------------
@ -374,18 +229,7 @@ QRegExp RimWellPathCompletions::wellNameForExportRegExp()
//--------------------------------------------------------------------------------------------------
void RimWellPathCompletions::defineUiOrdering( QString uiConfigName, caf::PdmUiOrdering& uiOrdering )
{
caf::PdmUiGroup* compExportGroup = uiOrdering.addNewGroup( "Completion Export Parameters" );
compExportGroup->add( &m_wellNameForExport );
compExportGroup->add( &m_wellGroupName );
compExportGroup->add( &m_referenceDepth );
compExportGroup->add( &m_preferredFluidPhase );
compExportGroup->add( &m_drainageRadiusForPI );
compExportGroup->add( &m_gasInflowEquation );
compExportGroup->add( &m_automaticWellShutIn );
compExportGroup->add( &m_allowWellCrossFlow );
compExportGroup->add( &m_wellBoreFluidPVTTable );
compExportGroup->add( &m_hydrostaticDensity );
compExportGroup->add( &m_fluidInPlaceRegion );
uiOrdering.skipRemainingFields( true );
}
//--------------------------------------------------------------------------------------------------
@ -395,23 +239,23 @@ void RimWellPathCompletions::defineUiTreeOrdering( caf::PdmUiTreeOrdering& uiTre
{
uiTreeOrdering.skipRemainingChildren( true );
if ( !perforationCollection()->perforations().empty() )
if ( !m_perforationCollection->perforations().empty() )
{
uiTreeOrdering.add( &m_perforationCollection );
}
if ( !fishbonesCollection()->allFishbonesSubs().empty() ||
!fishbonesCollection()->wellPathCollection()->wellPaths().empty() )
if ( !m_fishbonesCollection->allFishbonesSubs().empty() ||
!m_fishbonesCollection->wellPathCollection()->wellPaths().empty() )
{
uiTreeOrdering.add( &m_fishbonesCollection );
}
if ( !fractureCollection()->allFractures().empty() )
if ( !m_fractureCollection->allFractures().empty() )
{
uiTreeOrdering.add( &m_fractureCollection );
}
if ( !stimPlanModelCollection()->allStimPlanModels().empty() )
if ( !m_stimPlanModelCollection->allStimPlanModels().empty() )
{
uiTreeOrdering.add( &m_stimPlanModelCollection );
}
@ -420,69 +264,32 @@ void RimWellPathCompletions::defineUiTreeOrdering( caf::PdmUiTreeOrdering& uiTre
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RimWellPathCompletions::fieldChangedByUi( const caf::PdmFieldHandle* changedField,
const QVariant& oldValue,
const QVariant& newValue )
void RimWellPathCompletions::initAfterRead()
{
if ( changedField == &m_referenceDepth )
if ( RimProject::current()->isProjectFileVersionEqualOrOlderThan( "2020.10.1.2" ) )
{
if ( !RiaStdStringTools::isNumber( m_referenceDepth.v().toStdString(), '.' ) )
{
if ( !RiaStdStringTools::isNumber( m_referenceDepth.v().toStdString(), ',' ) )
{
// Remove invalid input text
m_referenceDepth = "";
}
else
{
// Wrong decimal sign entered, replace , by .
auto text = m_referenceDepth.v();
m_referenceDepth = text.replace( ',', '.' );
}
}
}
std::vector<RimWellPath*> wellPathHierarchy;
this->allAncestorsOrThisOfType( wellPathHierarchy );
RimWellPath* topLevelWellPath = wellPathHierarchy.back();
auto settings = topLevelWellPath->completionSettings();
applyToSettings( settings );
};
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RimWellPathCompletions::defineEditorAttribute( const caf::PdmFieldHandle* field,
QString uiConfigName,
caf::PdmUiEditorAttribute* attribute )
void RimWellPathCompletions::applyToSettings( gsl::not_null<RimWellPathCompletionSettings*> settings )
{
caf::PdmUiLineEditorAttribute* lineEditorAttr = dynamic_cast<caf::PdmUiLineEditorAttribute*>( attribute );
if ( field == &m_wellNameForExport && lineEditorAttr )
{
QRegExpValidator* validator = new QRegExpValidator( nullptr );
validator->setRegExp( wellNameForExportRegExp() );
lineEditorAttr->validator = validator;
}
else if ( field == &m_drainageRadiusForPI && lineEditorAttr )
{
caf::PdmDoubleStringValidator* validator = new caf::PdmDoubleStringValidator( "1*" );
lineEditorAttr->validator = validator;
}
else if ( field == &m_wellBoreFluidPVTTable && lineEditorAttr )
{
// Positive integer
QIntValidator* validator = new QIntValidator( 0, std::numeric_limits<int>::max(), nullptr );
lineEditorAttr->validator = validator;
}
else if ( field == &m_fluidInPlaceRegion && lineEditorAttr )
{
// Any integer
QIntValidator* validator =
new QIntValidator( -std::numeric_limits<int>::max(), std::numeric_limits<int>::max(), nullptr );
lineEditorAttr->validator = validator;
}
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
QString RimWellPathCompletions::formatStringForExport( const QString& text, const QString& defaultValue ) const
{
if ( text.isEmpty() ) return defaultValue;
if ( text.contains( ' ' ) ) return QString( "'%1'" ).arg( text );
return text;
settings->m_wellNameForExport = m_wellNameForExport_OBSOLETE;
settings->m_referenceDepth = m_referenceDepth_OBSOLETE;
settings->m_preferredFluidPhase = m_preferredFluidPhase_OBSOLETE;
settings->m_drainageRadiusForPI = m_drainageRadiusForPI_OBSOLETE;
settings->m_gasInflowEquation = m_gasInflowEquation_OBSOLETE;
settings->m_automaticWellShutIn = m_automaticWellShutIn_OBSOLETE;
settings->m_allowWellCrossFlow = m_allowWellCrossFlow_OBSOLETE;
settings->m_wellBoreFluidPVTTable = m_wellBoreFluidPVTTable_OBSOLETE;
settings->m_hydrostaticDensity = m_hydrostaticDensity_OBSOLETE;
settings->m_fluidInPlaceRegion = m_fluidInPlaceRegion_OBSOLETE;
}

View File

@ -18,16 +18,21 @@
#pragma once
#include "RimWellPathCompletionSettings.h"
#include "cafPdmChildField.h"
#include "cafPdmField.h"
#include "cafPdmObject.h"
#include "gsl/gsl"
class RimFishbonesCollection;
class RimPerforationCollection;
class RimWellPathFractureCollection;
class RimWellPathComponentInterface;
class RimWellPathValve;
class RimStimPlanModelCollection;
class RimWellPathComponentInterface;
class RimWellPathFracture;
class RimWellPathFractureCollection;
class RimWellPathValve;
//==================================================================================================
///
@ -37,38 +42,6 @@ class RimWellPathCompletions : public caf::PdmObject
{
CAF_PDM_HEADER_INIT;
enum WellType
{
OIL,
GAS,
WATER,
LIQUID
};
typedef caf::AppEnum<WellType> WellTypeEnum;
enum GasInflowEquation
{
STANDARD_EQ,
RUSSELL_GOODRICH,
DRY_GAS_PSEUDO_PRESSURE,
GENERALIZED_PSEUDO_PRESSURE
};
typedef caf::AppEnum<GasInflowEquation> GasInflowEnum;
enum AutomaticWellShutIn
{
ISOLATE_FROM_FORMATION,
STOP_ABOVE_FORMATION
};
typedef caf::AppEnum<AutomaticWellShutIn> AutomaticWellShutInEnum;
enum HydrostaticDensity
{
SEGMENTED,
AVERAGED
};
typedef caf::AppEnum<HydrostaticDensity> HydrostaticDensityEnum;
public:
RimWellPathCompletions();
@ -76,39 +49,22 @@ public:
RimPerforationCollection* perforationCollection() const;
RimWellPathFractureCollection* fractureCollection() const;
RimStimPlanModelCollection* stimPlanModelCollection() const;
std::vector<RimWellPathValve*> valves() const;
std::vector<const RimWellPathComponentInterface*> allCompletions() const;
bool hasCompletions() const;
void setUnitSystemSpecificDefaults();
void setWellNameForExport( const QString& name );
void updateWellPathNameHasChanged( const QString& newWellPathName, const QString& previousWellPathName );
QString wellNameForExport() const;
QString wellGroupNameForExport() const;
QString referenceDepthForExport() const;
QString wellTypeNameForExport() const;
bool hasCompletions() const;
QString drainageRadiusForExport() const;
QString gasInflowEquationForExport() const;
QString automaticWellShutInForExport() const;
QString allowWellCrossFlowForExport() const;
QString wellBoreFluidPVTForExport() const;
QString hydrostaticDensityForExport() const;
QString fluidInPlaceRegionForExport() const;
void setUnitSystemSpecificDefaults();
static QRegExp wellNameForExportRegExp();
std::vector<RimWellPathValve*> valves() const;
std::vector<RimWellPathFracture*> allFractures() const;
std::vector<RimWellPathFracture*> activeFractures() const;
protected:
void defineUiOrdering( QString uiConfigName, caf::PdmUiOrdering& uiOrdering ) override;
void defineUiTreeOrdering( caf::PdmUiTreeOrdering& uiTreeOrdering, QString uiConfigName ) override;
void fieldChangedByUi( const caf::PdmFieldHandle* changedField, const QVariant& oldValue, const QVariant& newValue ) override;
void defineEditorAttribute( const caf::PdmFieldHandle* field,
QString uiConfigName,
caf::PdmUiEditorAttribute* attribute ) override;
void initAfterRead() override;
private:
QString formatStringForExport( const QString& text, const QString& defaultText = "" ) const;
void applyToSettings( gsl::not_null<RimWellPathCompletionSettings*> settings );
private:
caf::PdmChildField<RimFishbonesCollection*> m_fishbonesCollection;
@ -116,16 +72,20 @@ private:
caf::PdmChildField<RimWellPathFractureCollection*> m_fractureCollection;
caf::PdmChildField<RimStimPlanModelCollection*> m_stimPlanModelCollection;
caf::PdmField<QString> m_wellNameForExport;
caf::PdmField<QString> m_wellGroupName;
private:
/////////////////////
// OBSOLETE FIELDS //
/////////////////////
caf::PdmField<QString> m_wellNameForExport_OBSOLETE;
caf::PdmField<QString> m_wellGroupName_OBSOLETE;
caf::PdmField<QString> m_referenceDepth;
caf::PdmField<WellTypeEnum> m_preferredFluidPhase;
caf::PdmField<QString> m_drainageRadiusForPI;
caf::PdmField<GasInflowEnum> m_gasInflowEquation;
caf::PdmField<AutomaticWellShutInEnum> m_automaticWellShutIn;
caf::PdmField<bool> m_allowWellCrossFlow;
caf::PdmField<int> m_wellBoreFluidPVTTable;
caf::PdmField<HydrostaticDensityEnum> m_hydrostaticDensity;
caf::PdmField<int> m_fluidInPlaceRegion;
caf::PdmField<QString> m_referenceDepth_OBSOLETE;
caf::PdmField<RimWellPathCompletionSettings::WellTypeEnum> m_preferredFluidPhase_OBSOLETE;
caf::PdmField<QString> m_drainageRadiusForPI_OBSOLETE;
caf::PdmField<RimWellPathCompletionSettings::GasInflowEnum> m_gasInflowEquation_OBSOLETE;
caf::PdmField<RimWellPathCompletionSettings::AutomaticWellShutInEnum> m_automaticWellShutIn_OBSOLETE;
caf::PdmField<bool> m_allowWellCrossFlow_OBSOLETE;
caf::PdmField<int> m_wellBoreFluidPVTTable_OBSOLETE;
caf::PdmField<RimWellPathCompletionSettings::HydrostaticDensityEnum> m_hydrostaticDensity_OBSOLETE;
caf::PdmField<int> m_fluidInPlaceRegion_OBSOLETE;
};

View File

@ -38,10 +38,10 @@ RimWellPathFractureCollection::RimWellPathFractureCollection( void )
setName( "Fractures" );
nameField()->uiCapability()->setUiHidden( true );
CAF_PDM_InitFieldNoDefault( &m_mswParameters, "MswParameters", "Multi Segment Well Parameters", "", "", "" );
m_mswParameters = new RimMswCompletionParameters;
m_mswParameters.uiCapability()->setUiTreeHidden( true );
m_mswParameters.uiCapability()->setUiTreeChildrenHidden( true );
CAF_PDM_InitFieldNoDefault( &m_mswParameters_OBSOLETE, "MswParameters", "Multi Segment Well Parameters", "", "", "" );
m_mswParameters_OBSOLETE = new RimMswCompletionParameters;
m_mswParameters_OBSOLETE.uiCapability()->setUiTreeHidden( true );
m_mswParameters_OBSOLETE.uiCapability()->setUiTreeChildrenHidden( true );
CAF_PDM_InitField( &m_refMDType_OBSOLETE, "RefMDType", std::numeric_limits<int>::max(), "Reference MD", "", "", "" );
CAF_PDM_InitField( &m_refMD_OBSOLETE, "RefMD", std::numeric_limits<double>::infinity(), "", "", "", "" );
@ -59,9 +59,9 @@ RimWellPathFractureCollection::~RimWellPathFractureCollection()
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
const RimMswCompletionParameters* RimWellPathFractureCollection::mswParameters() const
bool RimWellPathFractureCollection::hasFractures() const
{
return m_mswParameters;
return !m_fractures.empty();
}
//--------------------------------------------------------------------------------------------------
@ -80,14 +80,6 @@ void RimWellPathFractureCollection::deleteFractures()
m_fractures.deleteAllChildObjects();
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RimWellPathFractureCollection::setUnitSystemSpecificDefaults()
{
m_mswParameters->setUnitSystemSpecificDefaults();
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
@ -122,8 +114,6 @@ std::vector<RimWellPathFracture*> RimWellPathFractureCollection::activeFractures
//--------------------------------------------------------------------------------------------------
void RimWellPathFractureCollection::defineUiOrdering( QString uiConfigName, caf::PdmUiOrdering& uiOrdering )
{
caf::PdmUiGroup* mswGroup = uiOrdering.addNewGroup( "Multi Segment Well Options" );
m_mswParameters->uiOrdering( uiConfigName, *mswGroup );
uiOrdering.skipRemainingFields( true );
}
@ -151,12 +141,12 @@ void RimWellPathFractureCollection::initAfterRead()
{
if ( m_refMDType_OBSOLETE() != std::numeric_limits<int>::max() )
{
m_mswParameters->setReferenceMDType( (RimMswCompletionParameters::ReferenceMDType)m_refMDType_OBSOLETE() );
m_mswParameters_OBSOLETE->setReferenceMDType( (RimMswCompletionParameters::ReferenceMDType)m_refMDType_OBSOLETE() );
}
if ( m_refMD_OBSOLETE() != std::numeric_limits<double>::infinity() )
{
m_mswParameters->setManualReferenceMD( m_refMD_OBSOLETE() );
m_mswParameters_OBSOLETE->setManualReferenceMD( m_refMD_OBSOLETE() );
}
}

View File

@ -42,10 +42,9 @@ public:
RimWellPathFractureCollection( void );
~RimWellPathFractureCollection( void ) override;
const RimMswCompletionParameters* mswParameters() const;
void addFracture( RimWellPathFracture* fracture );
void deleteFractures();
void setUnitSystemSpecificDefaults();
bool hasFractures() const;
void addFracture( RimWellPathFracture* fracture );
void deleteFractures();
std::vector<RimWellPathFracture*> allFractures() const;
std::vector<RimWellPathFracture*> activeFractures() const;
@ -59,9 +58,10 @@ private:
void initAfterRead() override;
private:
caf::PdmChildArrayField<RimWellPathFracture*> m_fractures;
caf::PdmChildField<RimMswCompletionParameters*> m_mswParameters;
caf::PdmChildArrayField<RimWellPathFracture*> m_fractures;
caf::PdmField<int> m_refMDType_OBSOLETE;
caf::PdmField<double> m_refMD_OBSOLETE;
caf::PdmChildField<RimMswCompletionParameters*> m_mswParameters_OBSOLETE;
};

View File

@ -452,6 +452,7 @@ QList<caf::PdmOptionItemInfo> RimWellPathValve::calculateValueOptions( const caf
RimProject* project = nullptr;
this->firstAncestorOrThisOfTypeAsserted( project );
std::vector<RimValveTemplate*> allTemplates = project->allValveTemplates();
for ( RimValveTemplate* valveTemplate : allTemplates )
{
@ -484,8 +485,11 @@ void RimWellPathValve::fieldChangedByUi( const caf::PdmFieldHandle* changedField
}
RimPerforationInterval* perfInterval;
this->firstAncestorOrThisOfTypeAsserted( perfInterval );
perfInterval->updateAllReferringTracks();
this->firstAncestorOrThisOfType( perfInterval );
if ( perfInterval )
{
perfInterval->updateAllReferringTracks();
}
RimProject* proj;
this->firstAncestorOrThisOfTypeAsserted( proj );
@ -509,35 +513,37 @@ void RimWellPathValve::defineUiOrdering( QString uiConfigName, caf::PdmUiOrderin
uiOrdering.add( &m_createValveTemplate, false );
}
if ( componentType() == RiaDefines::WellPathComponentType::ICV ||
componentType() == RiaDefines::WellPathComponentType::ICD )
if ( uiConfigName != "TemplateOnly" )
{
if ( componentType() == RiaDefines::WellPathComponentType::ICV )
if ( componentType() == RiaDefines::WellPathComponentType::ICV ||
componentType() == RiaDefines::WellPathComponentType::ICD )
{
RimWellPath* wellPath;
firstAncestorOrThisOfType( wellPath );
if ( wellPath )
if ( componentType() == RiaDefines::WellPathComponentType::ICV )
{
if ( wellPath->unitSystem() == RiaDefines::EclipseUnitSystem::UNITS_METRIC )
RimWellPath* wellPath;
firstAncestorOrThisOfType( wellPath );
if ( wellPath )
{
m_measuredDepth.uiCapability()->setUiName( "Measured Depth [m]" );
}
else if ( wellPath->unitSystem() == RiaDefines::EclipseUnitSystem::UNITS_FIELD )
{
m_measuredDepth.uiCapability()->setUiName( "Measured Depth [ft]" );
if ( wellPath->unitSystem() == RiaDefines::EclipseUnitSystem::UNITS_METRIC )
{
m_measuredDepth.uiCapability()->setUiName( "Measured Depth [m]" );
}
else if ( wellPath->unitSystem() == RiaDefines::EclipseUnitSystem::UNITS_FIELD )
{
m_measuredDepth.uiCapability()->setUiName( "Measured Depth [ft]" );
}
}
uiOrdering.add( &m_measuredDepth, { true, 3, 1 } );
}
uiOrdering.add( &m_measuredDepth, { true, 3, 1 } );
}
if ( componentType() == RiaDefines::WellPathComponentType::ICD ||
componentType() == RiaDefines::WellPathComponentType::AICD )
{
caf::PdmUiGroup* group = uiOrdering.addNewGroup( "Multiple Valve Locations" );
m_multipleValveLocations->uiOrdering( uiConfigName, *group );
}
}
if ( componentType() == RiaDefines::WellPathComponentType::ICD ||
componentType() == RiaDefines::WellPathComponentType::AICD )
{
caf::PdmUiGroup* group = uiOrdering.addNewGroup( "Multiple Valve Locations" );
m_multipleValveLocations->uiOrdering( uiConfigName, *group );
}
if ( m_valveTemplate() != nullptr )
{
caf::PdmUiGroup* group = uiOrdering.addNewGroup( "Parameters from Template" );

View File

@ -65,9 +65,8 @@
#include "RimEnsembleCurveSetCollection.h"
#include "RimExtrudedCurveIntersection.h"
#include "RimFaultInView.h"
#include "RimFishboneWellPathCollection.h"
#include "RimFishbones.h"
#include "RimFishbonesCollection.h"
#include "RimFishbonesMultipleSubs.h"
#include "RimFlowCharacteristicsPlot.h"
#include "RimFlowDiagSolution.h"
#include "RimFlowPlotCollection.h"
@ -88,6 +87,7 @@
#include "RimGridCrossPlotCollection.h"
#include "RimGridCrossPlotDataSet.h"
#include "RimIdenticalGridCaseGroup.h"
#include "RimImportedFishboneLateralsCollection.h"
#include "RimIntersectionCollection.h"
#include "RimIntersectionResultDefinition.h"
#include "RimIntersectionResultsDefinitionCollection.h"
@ -391,6 +391,10 @@ caf::CmdFeatureMenuBuilder RimContextCommandBuilder::commandsFromSelection()
menuBuilder << "RicShowWellPlanFeature";
}
}
else if ( dynamic_cast<RimImportedFishboneLateralsCollection*>( firstUiItem ) )
{
appendImportMenu( menuBuilder );
}
else if ( dynamic_cast<RimWellPathCompletions*>( firstUiItem ) )
{
menuBuilder.subMenuStart( "Create Completions", QIcon( ":/CompletionsSymbol16x16.png" ) );
@ -413,9 +417,8 @@ caf::CmdFeatureMenuBuilder RimContextCommandBuilder::commandsFromSelection()
menuBuilder.addSeparator();
appendExportCompletions( menuBuilder );
}
else if ( dynamic_cast<RimFishbonesCollection*>( firstUiItem ) ||
dynamic_cast<RimFishbonesMultipleSubs*>( firstUiItem ) ||
dynamic_cast<RimFishboneWellPathCollection*>( firstUiItem ) )
else if ( dynamic_cast<RimFishbonesCollection*>( firstUiItem ) || dynamic_cast<RimFishbones*>( firstUiItem ) ||
dynamic_cast<RimImportedFishboneLateralsCollection*>( firstUiItem ) )
{
menuBuilder << "RicNewFishbonesSubsFeature";
appendExportCompletions( menuBuilder );

View File

@ -1,233 +0,0 @@
/////////////////////////////////////////////////////////////////////////////////
//
// Copyright (C) 2020- Equinor ASA
//
// ResInsight is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// ResInsight is distributed in the hope that it will be useful, but WITHOUT ANY
// WARRANTY; without even the implied warranty of MERCHANTABILITY or
// FITNESS FOR A PARTICULAR PURPOSE.
//
// See the GNU General Public License at <http://www.gnu.org/licenses/gpl.html>
// for more details.
//
/////////////////////////////////////////////////////////////////////////////////
#include "RimModeledWellPathLateral.h"
#include "RiaCompletionTypeCalculationScheduler.h"
#include "RicfCommandObject.h"
#include "RifTextDataTableFormatter.h"
#include "RigWellPath.h"
#include "RimProject.h"
#include "RimWellPathGroup.h"
#include "RimWellPathLateralGeometryDef.h"
#include "RimExtrudedCurveIntersection.h"
#include "RimPlotCurve.h"
#include "RimWellPath.h"
#include "RimWellPathFracture.h"
#include "RimWellPathFractureCollection.h"
#include "cafPdmFieldScriptingCapability.h"
#include "cafPdmUiTreeOrdering.h"
CAF_PDM_SOURCE_INIT( RimModeledWellPathLateral, "ModeledWellPathLateral" );
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
RimModeledWellPathLateral::RimModeledWellPathLateral()
{
CAF_PDM_InitScriptableObject( "Modeled Well Path Lateral",
":/EditableWell.png",
"",
"A Well Path Lateral created interactively" );
CAF_PDM_InitScriptableFieldWithScriptKeywordNoDefault( &m_geometryDefinition,
"WellPathLateralGeometryDef",
"WellPathLateralGeometry",
"Trajectory",
"",
"",
"" );
m_geometryDefinition = new RimWellPathLateralGeometryDef;
m_geometryDefinition->changed.connect( this, &RimModeledWellPathLateral::onGeometryDefinitionChanged );
CAF_PDM_InitFieldNoDefault( &m_lateralName, "LateralName", "Lateral Name", "", "", "" );
m_lateralName.registerGetMethod( this, &RimModeledWellPathLateral::createName );
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
RimModeledWellPathLateral::~RimModeledWellPathLateral()
{
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RimModeledWellPathLateral::createWellPathGeometry()
{
this->setWellPathGeometry( m_geometryDefinition->createWellPathGeometry().p() );
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RimModeledWellPathLateral::updateWellPathVisualization()
{
this->setWellPathGeometry( m_geometryDefinition->createWellPathGeometry().p() );
std::vector<RimPlotCurve*> refferingCurves;
this->objectsWithReferringPtrFieldsOfType( refferingCurves );
for ( auto curve : refferingCurves )
{
curve->loadDataAndUpdate( false );
}
for ( auto fracture : this->fractureCollection()->activeFractures() )
{
fracture->loadDataAndUpdate();
}
std::vector<RimExtrudedCurveIntersection*> refferingIntersections;
this->objectsWithReferringPtrFieldsOfType( refferingIntersections );
for ( auto intersection : refferingIntersections )
{
intersection->rebuildGeometryAndScheduleCreateDisplayModel();
}
RimProject* proj;
this->firstAncestorOrThisOfTypeAsserted( proj );
proj->scheduleCreateDisplayModelAndRedrawAllViews();
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RimModeledWellPathLateral::scheduleUpdateOfDependentVisualization()
{
RiaCompletionTypeCalculationScheduler::instance()->scheduleRecalculateCompletionTypeAndRedrawAllViews();
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
RimWellPathLateralGeometryDef* RimModeledWellPathLateral::geometryDefinition() const
{
return m_geometryDefinition;
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
QString RimModeledWellPathLateral::wellPlanText()
{
QString planText;
QTextStream qtxtStream( &planText );
RifTextDataTableFormatter formatter( qtxtStream );
formatter.setUnlimitedDataRowWidth();
formatter.setTableRowPrependText( "" );
formatter.setTableRowLineAppendText( "" );
std::vector<RifTextDataTableColumn> tableHeader;
std::vector<QString> columns = { "MDRKB", "CL", "Inc", "Azi", "TVDMSL", "NS", "EW", "Dogleg", "Build", "Turn" };
for ( QString column : columns )
{
tableHeader.push_back(
RifTextDataTableColumn( column,
RifTextDataTableDoubleFormatting( RifTextDataTableDoubleFormat::RIF_FLOAT, 2 ) ) );
}
formatter.header( tableHeader );
double mdrkbAtFirstTarget = m_geometryDefinition->mdAtConnection() + parentGroup()->airGap();
if ( m_geometryDefinition )
{
std::vector<RiaWellPlanCalculator::WellPlanSegment> wellPlan = m_geometryDefinition->wellPlan();
for ( const auto& segment : wellPlan )
{
formatter.add( segment.MD + mdrkbAtFirstTarget );
formatter.add( segment.CL );
formatter.add( segment.inc );
formatter.add( segment.azi );
formatter.add( segment.TVD );
formatter.add( segment.NS );
formatter.add( segment.EW );
formatter.add( segment.dogleg );
formatter.add( segment.build );
formatter.add( segment.turn );
formatter.rowCompleted();
}
}
formatter.tableCompleted();
return planText;
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
const RimWellPathGroup* RimModeledWellPathLateral::parentGroup() const
{
const RimWellPathGroup* group = nullptr;
this->firstAncestorOrThisOfTypeAsserted( group );
return group;
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RimModeledWellPathLateral::defineUiTreeOrdering( caf::PdmUiTreeOrdering& uiTreeOrdering, QString uiConfigName )
{
uiTreeOrdering.add( m_geometryDefinition() );
RimWellPath::defineUiTreeOrdering( uiTreeOrdering, uiConfigName );
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RimModeledWellPathLateral::defineUiOrdering( QString uiConfigName, caf::PdmUiOrdering& uiOrdering )
{
uiOrdering.add( &m_name );
RimWellPath::defineUiOrdering( uiConfigName, uiOrdering );
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RimModeledWellPathLateral::onGeometryDefinitionChanged( const caf::SignalEmitter* emitter, bool fullUpdate )
{
updateWellPathVisualization();
if ( fullUpdate )
{
scheduleUpdateOfDependentVisualization();
}
updateConnectedEditors();
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
caf::PdmFieldHandle* RimModeledWellPathLateral::userDescriptionField()
{
return &m_lateralName;
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
QString RimModeledWellPathLateral::createName() const
{
return QString( "%1 [branch md=%2]" ).arg( parentGroup()->createGroupName() ).arg( m_geometryDefinition->mdAtConnection() );
}

View File

@ -1,55 +0,0 @@
/////////////////////////////////////////////////////////////////////////////////
//
// Copyright (C) 2020- Equinor ASA
//
// ResInsight is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// ResInsight is distributed in the hope that it will be useful, but WITHOUT ANY
// WARRANTY; without even the implied warranty of MERCHANTABILITY or
// FITNESS FOR A PARTICULAR PURPOSE.
//
// See the GNU General Public License at <http://www.gnu.org/licenses/gpl.html>
// for more details.
//
/////////////////////////////////////////////////////////////////////////////////
#pragma once
#include "RimWellPath.h"
#include "cafPdmChildField.h"
#include "cafPdmProxyValueField.h"
class RimWellPathTarget;
class RimWellPath;
class RimWellPathGroup;
class RimWellPathLateralGeometryDef;
class RimModeledWellPathLateral : public RimWellPath
{
CAF_PDM_HEADER_INIT;
public:
RimModeledWellPathLateral();
~RimModeledWellPathLateral() override;
void createWellPathGeometry();
void updateWellPathVisualization();
void scheduleUpdateOfDependentVisualization();
RimWellPathLateralGeometryDef* geometryDefinition() const;
QString wellPlanText();
private:
const RimWellPathGroup* parentGroup() const;
void defineUiTreeOrdering( caf::PdmUiTreeOrdering& uiTreeOrdering, QString uiConfigName ) override;
void defineUiOrdering( QString uiConfigName, caf::PdmUiOrdering& uiOrdering ) override;
void onGeometryDefinitionChanged( const caf::SignalEmitter* emitter, bool fullUpdate );
caf::PdmFieldHandle* userDescriptionField() override;
QString createName() const;
caf::PdmChildField<RimWellPathLateralGeometryDef*> m_geometryDefinition;
caf::PdmProxyValueField<QString> m_lateralName;
};

View File

@ -49,8 +49,8 @@
#include "RimColorLegendItem.h"
#include "RimEclipseCase.h"
#include "RimEclipseResultDefinition.h"
#include "RimFishbones.h"
#include "RimFishbonesCollection.h"
#include "RimFishbonesMultipleSubs.h"
#include "RimGeoMechCase.h"
#include "RimMainPlotCollection.h"
#include "RimPerforationCollection.h"

View File

@ -34,8 +34,10 @@
#include "Rim3dWellLogCurve.h"
#include "Rim3dWellLogCurveCollection.h"
#include "RimFishbonesMultipleSubs.h"
#include "RimFishbones.h"
#include "RimFishbonesCollection.h"
#include "RimMainPlotCollection.h"
#include "RimPerforationCollection.h"
#include "RimProject.h"
#include "RimStimPlanModelCollection.h"
#include "RimTools.h"
@ -44,6 +46,7 @@
#include "RimWellLogPlotCollection.h"
#include "RimWellPathAttributeCollection.h"
#include "RimWellPathCollection.h"
#include "RimWellPathCompletionSettings.h"
#include "RimWellPathCompletions.h"
#include "RimWellPathFracture.h"
#include "RimWellPathFractureCollection.h"
@ -108,6 +111,9 @@ RimWellPath::RimWellPath()
m_completions = new RimWellPathCompletions;
m_completions.uiCapability()->setUiTreeHidden( true );
CAF_PDM_InitFieldNoDefault( &m_completionSettings, "CompletionSettings", "Completion Settings", "", "", "" );
m_completionSettings = new RimWellPathCompletionSettings;
CAF_PDM_InitFieldNoDefault( &m_wellLogFiles, "WellLogFiles", "Well Log Files", "", "", "" );
m_wellLogFiles.uiCapability()->setUiTreeHidden( true );
@ -274,6 +280,22 @@ const RimWellPathCompletions* RimWellPath::completions() const
return m_completions();
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
const RimWellPathCompletionSettings* RimWellPath::completionSettings() const
{
return m_completionSettings();
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
RimWellPathCompletionSettings* RimWellPath::completionSettings()
{
return m_completionSettings();
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
@ -395,7 +417,7 @@ void RimWellPath::fieldChangedByUi( const caf::PdmFieldHandle* changedField, con
{
QString previousName = oldValue.toString();
QString newName = newValue.toString();
m_completions->updateWellPathNameHasChanged( newName, previousName );
m_completionSettings->updateWellPathNameHasChanged( newName, previousName );
}
else
{
@ -454,6 +476,33 @@ QList<caf::PdmOptionItemInfo> RimWellPath::calculateValueOptions( const caf::Pdm
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RimWellPath::initAfterRead()
{
if ( RimProject::current()->isProjectFileVersionEqualOrOlderThan( "2020.10.1" ) )
{
if ( isTopLevelWellPath() && m_completionSettings->mswParameters()->isDefault() )
{
std::vector<const RimMswCompletionParameters*> allExistingMswParameters;
descendantsOfType( allExistingMswParameters );
for ( auto mswParameters : allExistingMswParameters )
{
if ( !mswParameters->isDefault() )
{
*( m_completionSettings->mswParameters() ) = *mswParameters;
break;
}
}
if ( m_completionSettings->wellNameForExport().isEmpty() )
{
m_completionSettings->setWellNameForExport( name() );
}
}
}
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------- -----------------------------
QString RimWellPath::name() const
{
return m_name();
@ -461,12 +510,12 @@ QString RimWellPath::name() const
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
//--------------------------------------------------------------------- -----------------------------
void RimWellPath::setName( const QString& name )
{
setNameNoUpdateOfExportName( name );
m_completions->setWellNameForExport( name );
m_completionSettings->setWellNameForExport( name );
}
//--------------------------------------------------------------------------------------------------
@ -622,9 +671,29 @@ void RimWellPath::defineUiTreeOrdering( caf::PdmUiTreeOrdering& uiTreeOrdering,
{
uiTreeOrdering.add( &m_wellLogFiles );
if ( m_completions->hasCompletions() )
if ( isTopLevelWellPath() && !allCompletionsRecursively().empty() )
{
uiTreeOrdering.add( m_completions() );
if ( completionSettings() )
{
uiTreeOrdering.add( completionSettings() );
}
}
if ( m_completions->fishbonesCollection()->hasFishbones() )
{
uiTreeOrdering.add( m_completions->fishbonesCollection() );
}
if ( m_completions->fractureCollection()->hasFractures() )
{
uiTreeOrdering.add( m_completions->fractureCollection() );
}
if ( m_completions->perforationCollection()->hasPerforations() )
{
uiTreeOrdering.add( m_completions->perforationCollection() );
}
if ( m_completions->stimPlanModelCollection()->hasStimPlanModels() )
{
uiTreeOrdering.add( m_completions->stimPlanModelCollection() );
}
if ( m_3dWellLogCurves->has3dWellLogCurves() )
@ -640,6 +709,23 @@ void RimWellPath::defineUiTreeOrdering( caf::PdmUiTreeOrdering& uiTreeOrdering,
uiTreeOrdering.skipRemainingChildren( true );
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RimWellPath::copyCompletionSettings( RimWellPath* from, RimWellPath* to )
{
if ( !from->m_completionSettings ) return;
if ( !to->m_completionSettings )
{
to->m_completionSettings = new RimWellPathCompletionSettings( *from->m_completionSettings() );
}
else
{
*( to->m_completionSettings() ) = *( from->m_completionSettings() );
}
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
@ -692,6 +778,7 @@ void RimWellPath::setUnitSystem( RiaDefines::EclipseUnitSystem unitSystem )
m_unitSystem = unitSystem;
m_completions->setUnitSystemSpecificDefaults();
m_completionSettings->setUnitSystemSpecificDefaults();
}
//--------------------------------------------------------------------------------------------------
@ -877,6 +964,24 @@ Rim3dWellLogCurveCollection* RimWellPath::rim3dWellLogCurveCollection() const
return m_3dWellLogCurves();
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
std::vector<const RimWellPathComponentInterface*> RimWellPath::allCompletionsRecursively() const
{
std::vector<const RimWellPathComponentInterface*> allCompletions;
std::vector<const RimWellPathCompletions*> completionCollections;
this->descendantsOfType( completionCollections );
for ( auto collection : completionCollections )
{
std::vector<const RimWellPathComponentInterface*> completions = collection->allCompletions();
allCompletions.insert( allCompletions.end(), completions.begin(), completions.end() );
}
return allCompletions;
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
@ -926,3 +1031,29 @@ void RimWellPath::onChildDeleted( caf::PdmChildArrayFieldHandle* childArray
{
updateConnectedEditors();
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
bool RimWellPath::isTopLevelWellPath() const
{
return this == topLevelWellPath();
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
RimWellPath* RimWellPath::topLevelWellPath() const
{
std::vector<RimWellPath*> wellPathHierarchy;
this->allAncestorsOrThisOfType( wellPathHierarchy );
RimWellPath* wellPath = wellPathHierarchy.back();
return wellPath;
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RimWellPath::updateAfterAddingToWellPathGroup()
{
}

View File

@ -48,12 +48,12 @@ class RigWellPathFormations;
class RimProject;
class RimWellLogFile;
class RimFractureTemplateCollection;
class RimFishboneWellPathCollection;
class RimStimPlanModelCollection;
class RimFishbonesCollection;
class RimPerforationCollection;
class RimWellPathAttributeCollection;
class RimWellPathCompletions;
class RimWellPathCompletionSettings;
class RimWellPathFractureCollection;
class Rim3dWellLogCurve;
@ -76,9 +76,9 @@ public:
RimWellPath();
~RimWellPath() override;
QString name() const;
void setName( const QString& name );
void setNameNoUpdateOfExportName( const QString& name );
virtual QString name() const;
void setName( const QString& name );
void setNameNoUpdateOfExportName( const QString& name );
const QString associatedSimulationWellName() const;
int associatedSimulationWellBranch() const;
@ -118,7 +118,11 @@ public:
void add3dWellLogCurve( Rim3dWellLogCurve* rim3dWellLogCurve );
Rim3dWellLogCurveCollection* rim3dWellLogCurveCollection() const;
const RimWellPathCompletions* completions() const;
std::vector<const RimWellPathComponentInterface*> allCompletionsRecursively() const;
const RimWellPathCompletions* completions() const;
const RimWellPathCompletionSettings* completionSettings() const;
RimWellPathCompletionSettings* completionSettings();
RimFishbonesCollection* fishbonesCollection();
const RimFishbonesCollection* fishbonesCollection() const;
RimPerforationCollection* perforationIntervalCollection();
@ -150,6 +154,10 @@ public:
void onChildDeleted( caf::PdmChildArrayFieldHandle* childArray,
std::vector<caf::PdmObjectHandle*>& referringObjects ) override;
bool isTopLevelWellPath() const;
RimWellPath* topLevelWellPath() const;
void updateAfterAddingToWellPathGroup();
protected:
// Override PdmObject
@ -159,9 +167,12 @@ protected:
void fieldChangedByUi( const caf::PdmFieldHandle* changedField, const QVariant& oldValue, const QVariant& newValue ) override;
QList<caf::PdmOptionItemInfo> calculateValueOptions( const caf::PdmFieldHandle* fieldNeedingOptions,
bool* useOptionsOnly ) override;
void initAfterRead() override;
void defineUiOrdering( QString uiConfigName, caf::PdmUiOrdering& uiOrdering ) override;
void defineUiTreeOrdering( caf::PdmUiTreeOrdering& uiTreeOrdering, QString uiConfigName ) override;
static void copyCompletionSettings( RimWellPath* from, RimWellPath* to );
// Fields
protected:
caf::PdmProxyValueField<double> m_airGap;
@ -185,6 +196,7 @@ private:
caf::PdmChildArrayField<RimWellLogFile*> m_wellLogFiles;
caf::PdmChildField<Rim3dWellLogCurveCollection*> m_3dWellLogCurves;
caf::PdmChildField<RimWellPathCompletionSettings*> m_completionSettings;
caf::PdmChildField<RimWellPathCompletions*> m_completions;
caf::PdmChildField<RimWellPathAttributeCollection*> m_wellPathAttributes;

View File

@ -28,6 +28,9 @@
#include "RiaTextStringTools.h"
#include "RiaWellNameComparer.h"
#include "RifWellPathFormationsImporter.h"
#include "RifWellPathImporter.h"
#include "RigEclipseCaseData.h"
#include "RigMainGrid.h"
#include "RigWellPath.h"
@ -35,6 +38,8 @@
#include "RimEclipseCase.h"
#include "RimEclipseCaseCollection.h"
#include "RimEclipseView.h"
#include "RimFileWellPath.h"
#include "RimModeledWellPath.h"
#include "RimOilField.h"
#include "RimPerforationCollection.h"
#include "RimProject.h"
@ -43,11 +48,10 @@
#include "RimWellLogFile.h"
#include "RimWellMeasurementCollection.h"
#include "RimWellPath.h"
#include "RimWellPathCompletionSettings.h"
#include "RimWellPathGroup.h"
#include "Riu3DMainWindowTools.h"
#include "RifWellPathFormationsImporter.h"
#include "RifWellPathImporter.h"
#include "Riu3DMainWindowTools.h"
#include "cafPdmUiEditorHandle.h"
#include "cafPdmUiTreeOrdering.h"
@ -57,8 +61,6 @@
#include <QFileInfo>
#include <QString>
#include "RimFileWellPath.h"
#include "RimModeledWellPath.h"
#include <cmath>
#include <fstream>
@ -260,10 +262,13 @@ void RimWellPathCollection::loadDataAndUpdate()
}
progress.incrementProgress();
}
for ( auto group : topLevelGroups() )
{
group->createWellPathGeometry();
group->completionSettings()->setWellNameForExport( group->createGroupName() );
}
this->sortWellsByName();
}
@ -655,12 +660,22 @@ void RimWellPathCollection::groupWellPaths( const std::vector<RimWellPath*>& wel
if ( automaticGrouping )
{
for ( auto wellPath : allWellPaths() )
bool detachedGroup = true;
while ( detachedGroup )
{
if ( dynamic_cast<RimWellPathGroup*>( wellPath ) )
detachedGroup = false;
// Detach may end up removing multiple groups, which could interfere with iteration of this loop
// So do only one and break
for ( auto wellPath : allWellPaths() )
{
auto existingGroupPaths = detachWellPaths( { wellPath } );
detachedWellPaths.insert( detachedWellPaths.end(), existingGroupPaths.begin(), existingGroupPaths.end() );
if ( dynamic_cast<RimWellPathGroup*>( wellPath ) )
{
auto newlyDetachedPaths = detachWellPaths( { wellPath } );
detachedWellPaths.insert( detachedWellPaths.end(), newlyDetachedPaths.begin(), newlyDetachedPaths.end() );
detachedGroup = true;
break;
}
}
}
}
@ -854,7 +869,7 @@ RimWellPathGroup* RimWellPathCollection::findOrCreateWellPathGroup( gsl::not_nul
auto wellPathGeometry = wellPath->wellPathGeometry();
if ( !wellPathGeometry ) return nullptr;
const double eps = 1.0e-3;
const double eps = 1.0e-2;
std::map<RimWellPath*, double> wellPathsWithCommonGeometry;
for ( auto existingWellPath : wellPathsToGroup )

View File

@ -93,6 +93,9 @@ RimWellPathGeometryDef::RimWellPathGeometryDef()
m_autoTargetAtSeaLevel = new RimWellPathTarget;
m_autoTargetAtSeaLevel->setEnabled( false );
CAF_PDM_InitFieldNoDefault( &m_fixedWellPathPoints, "FixedWellPathPoints", "", "", "", "" );
CAF_PDM_InitFieldNoDefault( &m_fixedMeasuredDepths, "FixedMeasuredDepths", "", "", "", "" );
CAF_PDM_InitField( &m_pickPointsEnabled, "m_pickPointsEnabled", false, "", "", "", "" );
caf::PdmUiPushButtonEditor::configureEditorForField( &m_pickPointsEnabled );
}
@ -156,6 +159,40 @@ void RimWellPathGeometryDef::setMdAtFirstTarget( double md )
m_mdAtFirstTarget = md;
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RimWellPathGeometryDef::setFixedWellPathPoints( const std::vector<cvf::Vec3d>& points )
{
m_fixedWellPathPoints = points;
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RimWellPathGeometryDef::setFixedMeasuredDepths( const std::vector<double>& mds )
{
m_fixedMeasuredDepths = mds;
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
std::vector<RimWellPathTarget*> RimWellPathGeometryDef::createTargets( const std::vector<cvf::Vec3d>& points )
{
CAF_ASSERT( points.size() >= 2u );
std::vector<RimWellPathTarget*> appendedTargets;
for ( size_t i = 0; i < points.size(); ++i )
{
auto target = appendTarget();
target->setAsPointTargetXYZ( points[i] );
appendedTargets.push_back( target );
}
return appendedTargets;
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
@ -168,14 +205,22 @@ cvf::ref<RigWellPath> RimWellPathGeometryDef::createWellPathGeometry()
updateTargetAtSeaLevel();
}
std::vector<cvf::Vec3d> wellPathPoints = m_fixedWellPathPoints;
std::vector<double> measuredDepths = m_fixedMeasuredDepths;
RiaLineArcWellPathCalculator wellPathCalculator = lineArcWellPathCalculator();
if ( wellPathCalculator.lineArcEndpoints().size() < 2 ) return wellPathGeometry;
RiaPolyArcLineSampler arcLineSampler( wellPathCalculator.startTangent(), wellPathCalculator.lineArcEndpoints() );
auto [wellPathPoints, measuredDepths] = arcLineSampler.sampledPointsAndMDs( 30, false );
if ( wellPathCalculator.lineArcEndpoints().size() >= 2 )
{
RiaPolyArcLineSampler arcLineSampler( wellPathCalculator.startTangent(), wellPathCalculator.lineArcEndpoints() );
auto [sampledWellPathPoints, sampledMeasuredDepths] = arcLineSampler.sampledPointsAndMDs( 30, false );
wellPathPoints.insert( wellPathPoints.end(), sampledWellPathPoints.begin(), sampledWellPathPoints.end() );
double startMD = measuredDepths.empty() ? 0.0 : measuredDepths.back();
for ( auto md : sampledMeasuredDepths )
{
measuredDepths.push_back( md + startMD );
}
}
wellPathGeometry->setWellPathPoints( wellPathPoints );
wellPathGeometry->setMeasuredDepths( measuredDepths );

View File

@ -17,8 +17,6 @@
/////////////////////////////////////////////////////////////////////////////////
#pragma once
#include "RimWellPathGeometryDefInterface.h"
#include "RiaLineArcWellPathCalculator.h"
#include "RiaWellPlanCalculator.h"
@ -38,7 +36,7 @@ class RicCreateWellTargetsPickEventHandler;
class RigWellPath;
class RimWellPathGeometryDef : public RimWellPathGeometryDefInterface
class RimWellPathGeometryDef : public caf::PdmObject
{
CAF_PDM_HEADER_INIT;
@ -49,7 +47,7 @@ public:
RimWellPathGeometryDef();
~RimWellPathGeometryDef() override;
cvf::Vec3d anchorPointXyz() const override;
cvf::Vec3d anchorPointXyz() const;
void setReferencePointXyz( const cvf::Vec3d& refPointXyz );
double airGap() const;
@ -57,21 +55,26 @@ public:
double mdAtFirstTarget() const;
void setMdAtFirstTarget( double mdrkb );
void setFixedWellPathPoints( const std::vector<cvf::Vec3d>& points );
void setFixedMeasuredDepths( const std::vector<double>& mds );
std::vector<RimWellPathTarget*> createTargets( const std::vector<cvf::Vec3d>& points);
std::pair<RimWellPathTarget*, RimWellPathTarget*>
findActiveTargetsAroundInsertionPoint( const RimWellPathTarget* targetToInsertBefore );
cvf::ref<RigWellPath> createWellPathGeometry() override;
void insertTarget( const RimWellPathTarget* targetToInsertBefore, RimWellPathTarget* targetToInsert ) override;
void deleteTarget( RimWellPathTarget* targetTodelete ) override;
void deleteAllTargets() override;
RimWellPathTarget* appendTarget() override;
cvf::ref<RigWellPath> createWellPathGeometry();
void insertTarget( const RimWellPathTarget* targetToInsertBefore, RimWellPathTarget* targetToInsert );
void deleteTarget( RimWellPathTarget* targetTodelete );
void deleteAllTargets();
RimWellPathTarget* appendTarget();
const RimWellPathTarget* firstActiveTarget() const override;
const RimWellPathTarget* lastActiveTarget() const override;
std::vector<RimWellPathTarget*> activeWellTargets() const override;
const RimWellPathTarget* firstActiveTarget() const;
const RimWellPathTarget* lastActiveTarget() const;
std::vector<RimWellPathTarget*> activeWellTargets() const;
void enableTargetPointPicking( bool isEnabling ) override;
void updateWellPathVisualization( bool fullUpdate ) override;
void enableTargetPointPicking( bool isEnabling );
void updateWellPathVisualization( bool fullUpdate );
void setUseAutoGeneratedTargetAtSeaLevel( bool autoGenerate );
@ -111,6 +114,8 @@ private:
caf::PdmField<bool> m_useAutoGeneratedTargetAtSeaLevel;
caf::PdmChildField<RimWellPathTarget*> m_autoTargetAtSeaLevel;
caf::PdmField<bool> m_pickPointsEnabled;
caf::PdmField<std::vector<cvf::Vec3d>> m_fixedWellPathPoints;
caf::PdmField<std::vector<double>> m_fixedMeasuredDepths;
std::shared_ptr<RicCreateWellTargetsPickEventHandler> m_pickTargetsEventHandler;
};

View File

@ -1,53 +0,0 @@
/////////////////////////////////////////////////////////////////////////////////
//
// Copyright (C) 2020- Equinor ASA
//
// ResInsight is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// ResInsight is distributed in the hope that it will be useful, but WITHOUT ANY
// WARRANTY; without even the implied warranty of MERCHANTABILITY or
// FITNESS FOR A PARTICULAR PURPOSE.
//
// See the GNU General Public License at <http://www.gnu.org/licenses/gpl.html>
// for more details.
//
/////////////////////////////////////////////////////////////////////////////////
#pragma once
#include "cafPdmObject.h"
#include "cvfObject.h"
#include "cvfVector3.h"
class RimWellPath;
class RimWellPathTarget;
class RicCreateWellTargetsPickEventHandler;
class RiaLineArcWellPathCalculator;
class RigWellPath;
class RimWellPathGeometryDefInterface : public caf::PdmObject
{
CAF_PDM_HEADER_INIT;
public:
virtual cvf::ref<RigWellPath> createWellPathGeometry() = 0;
virtual cvf::Vec3d anchorPointXyz() const = 0;
virtual void insertTarget( const RimWellPathTarget* targetToInsertBefore, RimWellPathTarget* targetToInsert ) = 0;
virtual void deleteTarget( RimWellPathTarget* targetTodelete ) = 0;
virtual void deleteAllTargets() = 0;
virtual RimWellPathTarget* appendTarget() = 0;
virtual const RimWellPathTarget* firstActiveTarget() const = 0;
virtual const RimWellPathTarget* lastActiveTarget() const = 0;
virtual void enableTargetPointPicking( bool isEnabling ) = 0;
virtual std::vector<RimWellPathTarget*> activeWellTargets() const = 0;
virtual void updateWellPathVisualization( bool fullUpdate ) = 0;
private:
virtual RiaLineArcWellPathCalculator lineArcWellPathCalculator() const = 0;
};

View File

@ -19,7 +19,11 @@
#include "RiaTextStringTools.h"
#include "RigWellPath.h"
#include "RimModeledWellPathLateral.h"
#include "RimModeledWellPath.h"
#include "RimWellPathCompletionSettings.h"
#include "RimWellPathCompletions.h"
#include "RimWellPathValve.h"
#include "cafPdmFieldScriptingCapability.h"
#include "cafPdmObjectScriptingCapability.h"
@ -43,15 +47,41 @@ RimWellPathGroup::RimWellPathGroup()
"A Group of Well Paths" );
CAF_PDM_InitScriptableFieldNoDefault( &m_childWellPaths, "ChildWellPaths", "Child Well Paths", "", "", "" );
CAF_PDM_InitScriptableFieldNoDefault( &m_groupName, "GroupName", "Group Name", "", "", "" );
CAF_PDM_InitScriptableField( &m_addValveAtConnection,
"AddValveAtConnection",
false,
"Add Outlet Valve for Branches",
"",
"Should an outlet valve be added to branches for MSW export?",
"" );
CAF_PDM_InitScriptableFieldNoDefault( &m_valve, "Valve", "Branch Outlet Valve", "", "", "" );
m_valve = new RimWellPathValve;
m_groupName.registerGetMethod( this, &RimWellPathGroup::createGroupName );
m_groupName.uiCapability()->setUiReadOnly( true );
setWellPathGeometry( new RigWellPath );
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
QString RimWellPathGroup::name() const
{
return m_groupName();
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RimWellPathGroup::addChildWellPath( RimWellPath* wellPath )
{
if ( m_childWellPaths.empty() && isTopLevelWellPath() && wellPath->completions()->hasCompletions() )
{
RimWellPath::copyCompletionSettings( wellPath, this );
}
if ( !this->wellPathGeometry()->wellPathPoints().empty() )
{
m_childWellPaths.push_back( wellPath );
@ -65,6 +95,7 @@ void RimWellPathGroup::addChildWellPath( RimWellPath* wellPath )
setWellPathGeometry( geometryCopy.p() );
m_childWellPaths.push_back( wellPath );
}
wellPath->nameChanged.connect( this, &RimWellPathGroup::onChildNameChanged );
updateAllRequiredEditors();
@ -100,11 +131,19 @@ bool RimWellPathGroup::hasChildWellPath( RimWellPath* wellPath )
void RimWellPathGroup::removeChildWellPath( RimWellPath* wellPath )
{
m_childWellPaths.removeChildObject( wellPath );
RimWellPath::copyCompletionSettings( this, wellPath );
if ( auto geometry = wellPath->wellPathGeometry(); geometry )
{
geometry->setUniqueStartIndex( 0u );
geometry->setUniqueStartAndEndIndex( 0u, std::numeric_limits<size_t>::max() );
}
createWellPathGeometry();
if ( isTopLevelWellPath() )
{
completionSettings()->setWellNameForExport( m_groupName() );
}
updateAllRequiredEditors();
}
@ -136,15 +175,22 @@ void RimWellPathGroup::createWellPathGeometry()
}
if ( wellPathGeometries().empty() ) return;
auto commonGeometry = RigWellPath::commonGeometry( wellPathGeometries() );
auto commonGeometry = RigWellPath::commonGeometry( wellPathGeometries() );
size_t childStartIndex = 0u;
size_t commonSize = commonGeometry->wellPathPoints().size();
if ( commonSize > 0u ) childStartIndex = commonSize - 1u;
setWellPathGeometry( commonGeometry.p() );
wellPathGeometry()->setUniqueStartAndEndIndex( wellPathGeometry()->uniqueStartIndex(), childStartIndex );
for ( auto wellPath : m_childWellPaths )
{
size_t startIndex = 0u;
size_t commonSize = commonGeometry->wellPathPoints().size();
if ( commonSize > 0u ) startIndex = commonSize - 1u;
wellPath->wellPathGeometry()->setUniqueStartIndex( startIndex );
if ( auto lateral = dynamic_cast<RimModeledWellPath*>( wellPath.p() ); lateral )
{
lateral->createWellPathGeometry();
}
wellPath->wellPathGeometry()->setUniqueStartAndEndIndex( childStartIndex, std::numeric_limits<size_t>::max() );
}
setWellPathGeometry( commonGeometry.p() );
}
//--------------------------------------------------------------------------------------------------
@ -152,6 +198,8 @@ void RimWellPathGroup::createWellPathGeometry()
//--------------------------------------------------------------------------------------------------
void RimWellPathGroup::defineUiTreeOrdering( caf::PdmUiTreeOrdering& uiTreeOrdering, QString uiConfigName )
{
RimWellPath::defineUiTreeOrdering( uiTreeOrdering, uiConfigName );
for ( auto child : m_childWellPaths() )
{
if ( child )
@ -159,6 +207,7 @@ void RimWellPathGroup::defineUiTreeOrdering( caf::PdmUiTreeOrdering& uiTreeOrder
uiTreeOrdering.add( child );
}
}
uiTreeOrdering.skipRemainingChildren( true );
}
@ -170,6 +219,40 @@ caf::PdmFieldHandle* RimWellPathGroup::userDescriptionField()
return &m_groupName;
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RimWellPathGroup::initAfterRead()
{
if ( isTopLevelWellPath() )
{
completionSettings()->setWellNameForExport( createGroupName() );
}
for ( auto wellPath : m_childWellPaths )
{
wellPath->nameChanged.connect( this, &RimWellPathGroup::onChildNameChanged );
}
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RimWellPathGroup::defineUiOrdering( QString uiConfigName, caf::PdmUiOrdering& uiOrdering )
{
uiOrdering.add( &m_groupName );
if ( !isTopLevelWellPath() )
{
auto valveGroup = uiOrdering.addNewGroup( "Valve Settings" );
valveGroup->add( &m_addValveAtConnection );
if ( m_addValveAtConnection )
{
m_valve->uiOrdering( "TemplateOnly", *valveGroup );
}
}
uiOrdering.skipRemainingFields( true );
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
@ -178,7 +261,10 @@ std::vector<const RigWellPath*> RimWellPathGroup::wellPathGeometries() const
std::vector<const RigWellPath*> allGeometries;
for ( const auto child : m_childWellPaths() )
{
allGeometries.push_back( child->wellPathGeometry() );
if ( child->wellPathGeometry() )
{
allGeometries.push_back( child->wellPathGeometry() );
}
}
return allGeometries;
}
@ -193,36 +279,72 @@ QString RimWellPathGroup::createGroupName() const
this->descendantsOfType( descendantWellPaths );
for ( auto wellPath : descendantWellPaths )
{
if ( !dynamic_cast<RimWellPathGroup*>( wellPath ) && !dynamic_cast<RimModeledWellPathLateral*>( wellPath ) )
if ( wellPath )
{
allNames.push_back( wellPath->name() );
bool groupOrLateral = dynamic_cast<RimWellPathGroup*>( wellPath ) ||
dynamic_cast<RimModeledWellPath*>( wellPath );
if ( !groupOrLateral )
{
allNames.push_back( wellPath->name() );
}
}
}
QString commonName = RiaTextStringTools::commonRoot( allNames );
QString trimmedCommonName = RiaTextStringTools::trimNonAlphaNumericCharacters( commonName );
QString commonRoot = RiaTextStringTools::commonRoot( allNames );
QString trimmedCommonRoot = RiaTextStringTools::trimNonAlphaNumericCharacters( commonRoot );
for ( auto& name : allNames )
{
name.remove( commonRoot );
}
QString commonSuffix = RiaTextStringTools::commonSuffix( allNames );
QString trimmedCommonSuffix = RiaTextStringTools::trimNonAlphaNumericCharacters( commonSuffix );
QStringList branchNames;
for ( auto& name : allNames )
{
name.remove( commonName );
name.remove( commonSuffix );
name = RiaTextStringTools::trimNonAlphaNumericCharacters( name );
name = name.simplified();
if ( !name.isEmpty() ) branchNames.push_back( name );
if ( !name.isEmpty() )
{
branchNames.push_back( name );
}
}
QString fullName = trimmedCommonName;
QString fullName = trimmedCommonRoot;
if ( !branchNames.isEmpty() )
{
fullName += QString( "(%1)" ).arg( branchNames.join( ", " ) );
fullName += QString( "%1" ).arg( branchNames.join( "" ) );
}
fullName += trimmedCommonSuffix;
QString nameWithoutSpaces = fullName;
nameWithoutSpaces.remove( ' ' );
if ( nameWithoutSpaces.length() > 8 ) fullName = trimmedCommonRoot + trimmedCommonSuffix;
return fullName;
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
const RimWellPathValve* RimWellPathGroup::outletValve() const
{
return m_addValveAtConnection() && m_valve() && m_valve->valveTemplate() ? m_valve() : nullptr;
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RimWellPathGroup::onChildNameChanged( const caf::SignalEmitter* emitter )
{
updateConnectedEditors();
if ( isTopLevelWellPath() )
{
completionSettings()->setWellNameForExport( createGroupName() );
}
}
//--------------------------------------------------------------------------------------------------
@ -275,9 +397,9 @@ void RimWellPathGroup::makeMoreLevelsIfNecessary()
}
if ( anyNonTrivialBranches )
{
size_t startIndex = 0u;
size_t commonSize = wellPathGeometry()->wellPathPoints().size();
if ( commonSize > 0u ) startIndex = commonSize - 1u;
size_t childStartIndex = 0u;
size_t commonSize = wellPathGeometry()->wellPathPoints().size();
if ( commonSize > 0u ) childStartIndex = commonSize - 1u;
for ( const auto& firstDeviationAndWellPaths : branches )
{
@ -289,7 +411,8 @@ void RimWellPathGroup::makeMoreLevelsIfNecessary()
{
m_childWellPaths().removeChildObject( wellPath );
newGroup->addChildWellPath( wellPath );
newGroup->wellPathGeometry()->setUniqueStartIndex( startIndex );
newGroup->wellPathGeometry()->setUniqueStartAndEndIndex( childStartIndex,
std::numeric_limits<size_t>::max() );
}
m_childWellPaths().push_back( newGroup );
}

View File

@ -19,6 +19,10 @@
#include "RimWellPath.h"
#include "cafPdmChildField.h"
class RimWellPathValve;
#include <QString>
class RimWellPathGroup : public RimWellPath
@ -29,6 +33,8 @@ class RimWellPathGroup : public RimWellPath
public:
RimWellPathGroup();
QString name() const override;
void addChildWellPath( RimWellPath* wellPath );
std::vector<RimWellPath*> childWellPaths() const;
size_t childWellpathCount() const;
@ -40,9 +46,14 @@ public:
void makeMoreLevelsIfNecessary();
QString createGroupName() const;
const RimWellPathValve* outletValve() const;
protected:
void defineUiTreeOrdering( caf::PdmUiTreeOrdering& uiTreeOrdering, QString uiConfigName );
void defineUiTreeOrdering( caf::PdmUiTreeOrdering& uiTreeOrdering, QString uiConfigName ) override;
caf::PdmFieldHandle* userDescriptionField() override;
void initAfterRead() override;
void defineUiOrdering( QString uiConfigName, caf::PdmUiOrdering& uiOrdering ) override;
private:
std::vector<const RigWellPath*> wellPathGeometries() const;
@ -51,5 +62,7 @@ private:
private:
caf::PdmChildArrayField<RimWellPath*> m_childWellPaths;
caf::PdmField<bool> m_addValveAtConnection;
caf::PdmChildField<RimWellPathValve*> m_valve;
caf::PdmProxyValueField<QString> m_groupName;
};

View File

@ -1,542 +0,0 @@
/////////////////////////////////////////////////////////////////////////////////
//
// Copyright (C) 2020- Equinor ASA
//
// ResInsight is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// ResInsight is distributed in the hope that it will be useful, but WITHOUT ANY
// WARRANTY; without even the implied warranty of MERCHANTABILITY or
// FITNESS FOR A PARTICULAR PURPOSE.
//
// See the GNU General Public License at <http://www.gnu.org/licenses/gpl.html>
// for more details.
//
/////////////////////////////////////////////////////////////////////////////////
#include "RimWellPathLateralGeometryDef.h"
#include "WellPathCommands/PointTangentManipulator/RicWellPathGeometry3dEditor.h"
#include "WellPathCommands/RicCreateWellTargetsPickEventHandler.h"
#include "RiaFieldHandleTools.h"
#include "RiaJCurveCalculator.h"
#include "RiaLogging.h"
#include "RiaOffshoreSphericalCoords.h"
#include "RiaPolyArcLineSampler.h"
#include "RiaSCurveCalculator.h"
#include "RigWellPath.h"
#include "RimModeledWellPath.h"
#include "RimProject.h"
#include "RimWellPathGroup.h"
#include "RimWellPathTarget.h"
#include "RiuViewerCommands.h"
#include "cafCmdFeatureMenuBuilder.h"
#include "cafPdmFieldScriptingCapabilityCvfVec3d.h"
#include "cafPdmObjectScriptingCapability.h"
#include "cafPdmUiDoubleSliderEditor.h"
#include "cafPdmUiDoubleValueEditor.h"
#include "cafPdmUiLineEditor.h"
#include "cafPdmUiPushButtonEditor.h"
#include "cafPdmUiTableViewEditor.h"
#include "cafPdmUiTreeOrdering.h"
#include "cvfGeometryTools.h"
CAF_PDM_SOURCE_INIT( RimWellPathLateralGeometryDef, "WellPathLateralGeometryDef", "WellPathLateralGeometry" );
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
std::vector<RiaLineArcWellPathCalculator::WellTarget> createTargetsFromPoints( const std::vector<cvf::Vec3d>& points )
{
CAF_ASSERT( points.size() >= 2u );
std::vector<RiaLineArcWellPathCalculator::WellTarget> targets;
for ( size_t i = 0; i < points.size(); ++i )
{
cvf::Vec3d tangent;
if ( i < points.size() - 1u )
{
tangent = points[i + 1] - points[i];
}
else if ( i > 0u )
{
tangent = points[i] - points[i - 1];
}
RiaOffshoreSphericalCoords sphericalCoords( tangent );
RiaLineArcWellPathCalculator::WellTarget target =
{ points[i], true, sphericalCoords.azi(), sphericalCoords.inc(), 0.0, 0.0 };
targets.push_back( target );
}
return targets;
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
RimWellPathLateralGeometryDef::RimWellPathLateralGeometryDef()
: changed( this )
, m_pickTargetsEventHandler( new RicCreateWellTargetsPickEventHandler( this ) )
{
CAF_PDM_InitScriptableObjectWithNameAndComment( "Well Targets",
":/WellTargets.png",
"",
"",
"WellPathLateralGeometry",
"Class containing the geometry of a modeled Well Path Lateral" );
this->setUi3dEditorTypeName( RicWellPathGeometry3dEditor::uiEditorTypeName() );
CAF_PDM_InitScriptableField( &m_connectionMdOnParentWellPath, "MdAtConnection", 0.0, "MD at Well Path Connection", "", "", "" );
m_connectionMdOnParentWellPath.uiCapability()->setUiEditorTypeName( caf::PdmUiDoubleSliderEditor::uiEditorTypeName() );
// Temporarily disable changing of MD. It doesn't work right without also altering angles.
m_connectionMdOnParentWellPath.uiCapability()->setUiReadOnly( true );
CAF_PDM_InitScriptableFieldNoDefault( &m_wellTargets, "WellPathTargets", "Well Targets", "", "", "" );
m_wellTargets.uiCapability()->setUiEditorTypeName( caf::PdmUiTableViewEditor::uiEditorTypeName() );
m_wellTargets.uiCapability()->setUiTreeChildrenHidden( true );
m_wellTargets.uiCapability()->setUiLabelPosition( caf::PdmUiItemInfo::TOP );
m_wellTargets.uiCapability()->setCustomContextMenuEnabled( true );
CAF_PDM_InitField( &m_pickPointsEnabled, "m_pickPointsEnabled", false, "", "", "", "" );
caf::PdmUiPushButtonEditor::configureEditorForField( &m_pickPointsEnabled );
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
RimWellPathLateralGeometryDef::~RimWellPathLateralGeometryDef()
{
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
double RimWellPathLateralGeometryDef::mdAtConnection() const
{
return m_connectionMdOnParentWellPath;
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RimWellPathLateralGeometryDef::setMdAtConnection( double md )
{
m_connectionMdOnParentWellPath = md;
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
cvf::Vec3d RimWellPathLateralGeometryDef::anchorPointXyz() const
{
CAF_ASSERT( m_parentGeometry.notNull() );
return m_parentGeometry->interpolatedPointAlongWellPath( m_connectionMdOnParentWellPath );
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RimWellPathLateralGeometryDef::createTargetAtConnectionPoint( const cvf::Vec3d& tangent )
{
auto target = appendTarget();
target->setAsPointXYZAndTangentTarget( cvf::Vec3d::ZERO, tangent );
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RimWellPathLateralGeometryDef::setParentGeometry( const RigWellPath* parentGeometry )
{
m_parentGeometry = parentGeometry;
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
cvf::ref<RigWellPath> RimWellPathLateralGeometryDef::createWellPathGeometry()
{
CAF_ASSERT( m_parentGeometry.notNull() );
cvf::ref<RigWellPath> wellPathLateralGeometry = new RigWellPath;
RiaLineArcWellPathCalculator wellPathCalculator = lineArcWellPathCalculator();
auto [allWellPathPoints, allMeasuredDepths] =
m_parentGeometry->clippedPointSubset( m_parentGeometry->measuredDepths().front(), m_connectionMdOnParentWellPath );
auto originalSize = allWellPathPoints.size();
if ( wellPathCalculator.lineArcEndpoints().size() >= 2 )
{
RiaPolyArcLineSampler arcLineSampler( wellPathCalculator.startTangent(), wellPathCalculator.lineArcEndpoints() );
auto [wellPathPoints, measuredDepths] = arcLineSampler.sampledPointsAndMDs( 30, false );
allWellPathPoints.insert( allWellPathPoints.end(), wellPathPoints.begin(), wellPathPoints.end() );
std::transform( measuredDepths.begin(),
measuredDepths.end(),
std::back_inserter( allMeasuredDepths ),
[this]( double md ) { return md + this->m_connectionMdOnParentWellPath; } );
}
wellPathLateralGeometry->setWellPathPoints( allWellPathPoints );
wellPathLateralGeometry->setMeasuredDepths( allMeasuredDepths );
wellPathLateralGeometry->setUniqueStartIndex( originalSize );
return wellPathLateralGeometry;
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
std::vector<RiaWellPlanCalculator::WellPlanSegment> RimWellPathLateralGeometryDef::wellPlan() const
{
RiaLineArcWellPathCalculator wellPathCalculator = lineArcWellPathCalculator();
RiaWellPlanCalculator wpCalc( wellPathCalculator.startTangent(), wellPathCalculator.lineArcEndpoints() );
return wpCalc.wellPlan();
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RimWellPathLateralGeometryDef::updateWellPathVisualization( bool fullUpdate )
{
changed.send( fullUpdate );
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
std::pair<RimWellPathTarget*, RimWellPathTarget*>
RimWellPathLateralGeometryDef::findActiveTargetsAroundInsertionPoint( const RimWellPathTarget* targetToInsertBefore )
{
RimWellPathTarget* before = nullptr;
RimWellPathTarget* after = nullptr;
bool foundTarget = false;
for ( const auto& wt : m_wellTargets )
{
if ( wt == targetToInsertBefore )
{
foundTarget = true;
}
if ( wt->isEnabled() && !after && foundTarget ) after = wt;
if ( wt->isEnabled() && !foundTarget ) before = wt;
}
return { before, after };
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RimWellPathLateralGeometryDef::insertTarget( const RimWellPathTarget* targetToInsertBefore,
RimWellPathTarget* targetToInsert )
{
size_t index = m_wellTargets.index( targetToInsertBefore );
if ( index < m_wellTargets.size() )
m_wellTargets.insert( index, targetToInsert );
else
m_wellTargets.push_back( targetToInsert );
targetToInsert->moved.connect( this, &RimWellPathLateralGeometryDef::onTargetMoved );
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RimWellPathLateralGeometryDef::deleteTarget( RimWellPathTarget* targetTodelete )
{
m_wellTargets.removeChildObject( targetTodelete );
delete targetTodelete;
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RimWellPathLateralGeometryDef::deleteAllTargets()
{
m_wellTargets.deleteAllChildObjects();
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
RimWellPathTarget* RimWellPathLateralGeometryDef::appendTarget()
{
RimWellPathTarget* wellPathTarget = nullptr;
auto targets = m_wellTargets.childObjects();
if ( targets.empty() )
{
wellPathTarget = new RimWellPathTarget;
}
else
{
wellPathTarget = dynamic_cast<RimWellPathTarget*>(
targets.back()->xmlCapability()->copyByXmlSerialization( caf::PdmDefaultObjectFactory::instance() ) );
}
if ( wellPathTarget )
{
m_wellTargets.push_back( wellPathTarget );
}
wellPathTarget->moved.connect( this, &RimWellPathLateralGeometryDef::onTargetMoved );
return wellPathTarget;
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
const RimWellPathTarget* RimWellPathLateralGeometryDef::firstActiveTarget() const
{
for ( const RimWellPathTarget* target : m_wellTargets )
{
if ( target->isEnabled() )
{
return target;
}
}
return nullptr;
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
const RimWellPathTarget* RimWellPathLateralGeometryDef::lastActiveTarget() const
{
if ( !m_wellTargets.size() ) return nullptr;
for ( int tIdx = static_cast<int>( m_wellTargets.size() - 1 ); tIdx >= 0; --tIdx )
{
if ( m_wellTargets[tIdx]->isEnabled() )
{
return m_wellTargets[tIdx];
}
}
return nullptr;
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RimWellPathLateralGeometryDef::enableTargetPointPicking( bool isEnabling )
{
m_pickPointsEnabled = isEnabling;
this->updateConnectedEditors();
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RimWellPathLateralGeometryDef::fieldChangedByUi( const caf::PdmFieldHandle* changedField,
const QVariant& oldValue,
const QVariant& newValue )
{
if ( changedField == &m_pickPointsEnabled )
{
this->updateConnectedEditors();
}
updateWellPathVisualization( false );
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RimWellPathLateralGeometryDef::defineUiOrdering( QString uiConfigName, caf::PdmUiOrdering& uiOrdering )
{
uiOrdering.add( &m_connectionMdOnParentWellPath );
uiOrdering.add( &m_wellTargets );
uiOrdering.add( &m_pickPointsEnabled );
uiOrdering.skipRemainingFields( true );
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RimWellPathLateralGeometryDef::defineUiTreeOrdering( caf::PdmUiTreeOrdering& uiTreeOrdering, QString uiConfigName )
{
uiTreeOrdering.skipRemainingChildren( true );
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RimWellPathLateralGeometryDef::initAfterRead()
{
RimWellPathGroup* group = nullptr;
this->firstAncestorOrThisOfTypeAsserted( group );
this->setParentGeometry( group->wellPathGeometry() );
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
std::vector<RimWellPathTarget*> RimWellPathLateralGeometryDef::activeWellTargets() const
{
std::vector<RimWellPathTarget*> active;
for ( const auto& wt : m_wellTargets )
{
if ( wt->targetType() != RimWellPathTarget::LATERAL_ANCHOR_POINT_MD && wt->isEnabled() )
{
active.push_back( wt );
}
}
return active;
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
RiaLineArcWellPathCalculator RimWellPathLateralGeometryDef::lineArcWellPathCalculator() const
{
std::vector<RiaLineArcWellPathCalculator::WellTarget> targetDatas;
auto [pointVector, measuredDepths] = m_parentGeometry->clippedPointSubset( 0.0, m_connectionMdOnParentWellPath );
cvf::Vec3d connectionPoint = anchorPointXyz();
auto N = pointVector.size();
if ( N >= 2u )
{
targetDatas =
createTargetsFromPoints( { pointVector[N - 2] - connectionPoint, pointVector[N - 1] - connectionPoint } );
}
std::vector<RimWellPathTarget*> activeTargets = activeWellTargets();
for ( auto wellTarget : activeTargets )
{
targetDatas.push_back( wellTarget->wellTargetData() );
}
RiaLineArcWellPathCalculator wellPathCalculator( connectionPoint, targetDatas );
const std::vector<RiaLineArcWellPathCalculator::WellTargetStatus>& targetStatuses =
wellPathCalculator.targetStatuses();
for ( size_t tIdx = 0; tIdx < activeTargets.size(); ++tIdx )
{
activeTargets[tIdx]->flagRadius1AsIncorrect( targetStatuses[tIdx].isRadius1Editable, false, 0 );
activeTargets[tIdx]->flagRadius2AsIncorrect( targetStatuses[tIdx].isRadius2Editable, false, 0 );
if ( targetStatuses[tIdx].hasDerivedTangent )
{
activeTargets[tIdx]->setDerivedTangent( targetStatuses[tIdx].resultAzimuth,
targetStatuses[tIdx].resultInclination );
}
if ( targetStatuses[tIdx].hasOverriddenRadius1 )
{
activeTargets[tIdx]->flagRadius1AsIncorrect( targetStatuses[tIdx].isRadius1Editable,
true,
targetStatuses[tIdx].resultRadius1 );
}
if ( targetStatuses[tIdx].hasOverriddenRadius2 )
{
activeTargets[tIdx]->flagRadius2AsIncorrect( targetStatuses[tIdx].isRadius2Editable,
true,
targetStatuses[tIdx].resultRadius2 );
}
}
return wellPathCalculator;
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RimWellPathLateralGeometryDef::onTargetMoved( const caf::SignalEmitter* moved, bool fullUpdate )
{
changed.send( fullUpdate );
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RimWellPathLateralGeometryDef::defineCustomContextMenu( const caf::PdmFieldHandle* fieldNeedingMenu,
QMenu* menu,
QWidget* fieldEditorWidget )
{
caf::CmdFeatureMenuBuilder menuBuilder;
menuBuilder << "RicNewWellPathListTargetFeature";
menuBuilder << "Separator";
menuBuilder << "RicDeleteWellPathTargetFeature";
menuBuilder.appendToMenu( menu );
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RimWellPathLateralGeometryDef::defineEditorAttribute( const caf::PdmFieldHandle* field,
QString uiConfigName,
caf::PdmUiEditorAttribute* attribute )
{
if ( field == &m_pickPointsEnabled )
{
caf::PdmUiPushButtonEditorAttribute* pbAttribute = dynamic_cast<caf::PdmUiPushButtonEditorAttribute*>( attribute );
if ( pbAttribute )
{
if ( !m_pickPointsEnabled )
{
pbAttribute->m_buttonText = "Start Picking Targets";
}
else
{
pbAttribute->m_buttonText = "Stop Picking Targets";
}
}
}
else if ( field = &m_connectionMdOnParentWellPath )
{
auto myAttr = dynamic_cast<caf::PdmUiDoubleSliderEditorAttribute*>( attribute );
if ( myAttr )
{
myAttr->m_minimum = m_parentGeometry->uniqueMeasuredDepths().front();
myAttr->m_maximum = m_parentGeometry->uniqueMeasuredDepths().back();
}
}
else if ( field == &m_wellTargets )
{
auto tvAttribute = dynamic_cast<caf::PdmUiTableViewEditorAttribute*>( attribute );
if ( tvAttribute )
{
tvAttribute->resizePolicy = caf::PdmUiTableViewEditorAttribute::RESIZE_TO_FIT_CONTENT;
if ( m_pickPointsEnabled )
{
tvAttribute->baseColor.setRgb( 255, 220, 255 );
tvAttribute->alwaysEnforceResizePolicy = true;
}
}
}
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RimWellPathLateralGeometryDef::defineObjectEditorAttribute( QString uiConfigName, caf::PdmUiEditorAttribute* attribute )
{
RicWellPathGeometry3dEditorAttribute* attrib = dynamic_cast<RicWellPathGeometry3dEditorAttribute*>( attribute );
if ( attrib )
{
attrib->pickEventHandler = m_pickTargetsEventHandler;
attrib->enablePicking = m_pickPointsEnabled;
}
}

View File

@ -1,107 +0,0 @@
/////////////////////////////////////////////////////////////////////////////////
//
// Copyright (C) 2020- Equinor ASA
//
// ResInsight is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// ResInsight is distributed in the hope that it will be useful, but WITHOUT ANY
// WARRANTY; without even the implied warranty of MERCHANTABILITY or
// FITNESS FOR A PARTICULAR PURPOSE.
//
// See the GNU General Public License at <http://www.gnu.org/licenses/gpl.html>
// for more details.
//
/////////////////////////////////////////////////////////////////////////////////
#pragma once
#include "RimWellPathGeometryDefInterface.h"
#include "RiaLineArcWellPathCalculator.h"
#include "RiaWellPlanCalculator.h"
#include "cafAppEnum.h"
#include "cafPdmChildArrayField.h"
#include "cafPdmChildField.h"
#include "cafPdmField.h"
#include "cafPdmFieldCvfVec3d.h"
#include "cafPdmObject.h"
#include "cafPdmPtrField.h"
#include "cvfObject.h"
class RimWellPath;
class RimWellPathTarget;
class RicCreateWellTargetsPickEventHandler;
class RigWellPath;
class RimWellPathLateralGeometryDef : public RimWellPathGeometryDefInterface
{
CAF_PDM_HEADER_INIT;
public:
caf::Signal<bool> changed;
public:
RimWellPathLateralGeometryDef();
~RimWellPathLateralGeometryDef() override;
double mdAtConnection() const;
void setMdAtConnection( double mdrkb );
cvf::Vec3d anchorPointXyz() const override;
void createTargetAtConnectionPoint( const cvf::Vec3d& tangent );
void setParentGeometry( const RigWellPath* parentGeometry );
cvf::ref<RigWellPath> createWellPathGeometry();
void updateWellPathVisualization( bool fullUpdate );
std::pair<RimWellPathTarget*, RimWellPathTarget*>
findActiveTargetsAroundInsertionPoint( const RimWellPathTarget* targetToInsertBefore );
void insertTarget( const RimWellPathTarget* targetToInsertBefore, RimWellPathTarget* targetToInsert );
void deleteTarget( RimWellPathTarget* targetTodelete );
void deleteAllTargets();
RimWellPathTarget* appendTarget();
const RimWellPathTarget* firstActiveTarget() const;
const RimWellPathTarget* lastActiveTarget() const;
void enableTargetPointPicking( bool isEnabling );
std::vector<RiaWellPlanCalculator::WellPlanSegment> wellPlan() const;
std::vector<RimWellPathTarget*> activeWellTargets() const;
protected:
void defineCustomContextMenu( const caf::PdmFieldHandle* fieldNeedingMenu, QMenu* menu, QWidget* fieldEditorWidget ) override;
void defineEditorAttribute( const caf::PdmFieldHandle* field,
QString uiConfigName,
caf::PdmUiEditorAttribute* attribute ) override;
void defineObjectEditorAttribute( QString uiConfigName, caf::PdmUiEditorAttribute* attribute ) override;
private:
void fieldChangedByUi( const caf::PdmFieldHandle* changedField, const QVariant& oldValue, const QVariant& newValue ) override;
void defineUiOrdering( QString uiConfigName, caf::PdmUiOrdering& uiOrdering ) override;
void defineUiTreeOrdering( caf::PdmUiTreeOrdering& uiTreeOrdering, QString uiConfigName ) override;
void initAfterRead() override;
RiaLineArcWellPathCalculator lineArcWellPathCalculator() const;
void onTargetMoved( const caf::SignalEmitter* moved, bool fullUpdate );
private:
caf::PdmField<double> m_connectionMdOnParentWellPath;
caf::PdmChildArrayField<RimWellPathTarget*> m_wellTargets;
caf::PdmField<bool> m_pickPointsEnabled;
std::shared_ptr<RicCreateWellTargetsPickEventHandler> m_pickTargetsEventHandler;
cvf::cref<RigWellPath> m_parentGeometry;
};

View File

@ -23,7 +23,6 @@
#include "RigWellPath.h"
#include "RimModeledWellPath.h"
#include "RimModeledWellPathLateral.h"
#include "RimWellPath.h"
#include "RimWellPathGeometryDef.h"
@ -41,7 +40,6 @@ void caf::AppEnum<RimWellPathTarget::TargetTypeEnum>::setUp()
{
addItem( RimWellPathTarget::POINT_AND_TANGENT, "POINT_AND_TANGENT", "Point and Tangent" );
addItem( RimWellPathTarget::POINT, "POINT", "Point" );
addItem( RimWellPathTarget::LATERAL_ANCHOR_POINT_MD, "LATERAL_ANCHOR_POINT_MD", "Lateral Anchor Point MD" );
setDefault( RimWellPathTarget::POINT_AND_TANGENT );
}
} // namespace caf
@ -57,6 +55,8 @@ RimWellPathTarget::RimWellPathTarget()
, m_isFullUpdateEnabled( true )
{
CAF_PDM_InitField( &m_isEnabled, "IsEnabled", true, "", "", "", "" );
CAF_PDM_InitField( &m_isLocked, "IsLocked", false, "", "", "", "" );
m_isLocked.uiCapability()->setUiHidden( true );
// m_targetType.uiCapability()->setUiHidden(true);
CAF_PDM_InitFieldNoDefault( &m_targetPoint, "TargetPoint", "Point", "", "", "" );
CAF_PDM_InitField( &m_dogleg1, "Dogleg1", 3.0, "DL in", "", "[deg/30m]", "" );
@ -68,10 +68,8 @@ RimWellPathTarget::RimWellPathTarget()
CAF_PDM_InitField( &m_azimuth, "Azimuth", 0.0, "Azi(deg)", "", "", "" );
CAF_PDM_InitField( &m_inclination, "Inclination", 0.0, "Inc(deg)", "", "", "" );
CAF_PDM_InitField( &m_lateralMDConnection, "LateralMD", 0.0, "Lateral Anchor Point MD", "", "", "" );
CAF_PDM_InitFieldNoDefault( &m_parentWellPath, "ParentWellPath", "Parent Well Path", "", "", "" );
m_lateralMDConnection.uiCapability()->setUiHidden( true );
m_parentWellPath.uiCapability()->setUiHidden( true );
}
@ -109,6 +107,17 @@ void RimWellPathTarget::setAsPointTargetXYD( const cvf::Vec3d& point )
m_inclination = 0.0;
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RimWellPathTarget::setAsPointTargetXYZ( const cvf::Vec3d& point )
{
m_targetType = POINT;
m_targetPoint = cvf::Vec3d( point.x(), point.y(), -point.z() );
m_azimuth = 0.0;
m_inclination = 0.0;
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
@ -129,16 +138,6 @@ void RimWellPathTarget::setAsPointXYZAndTangentTarget( const cvf::Vec3d& point,
m_inclination = cvf::Math::toDegrees( inclination );
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RimWellPathTarget::setAsLateralMDConnection( RimWellPath* wellPath, double md )
{
m_targetType = LATERAL_ANCHOR_POINT_MD;
m_parentWellPath.setValue( wellPath );
m_lateralMDConnection = md;
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
@ -181,16 +180,9 @@ RimWellPathTarget::TargetTypeEnum RimWellPathTarget::targetType() const
//--------------------------------------------------------------------------------------------------
cvf::Vec3d RimWellPathTarget::targetPointXYZ() const
{
if ( m_targetType != LATERAL_ANCHOR_POINT_MD )
{
cvf::Vec3d xyzPoint( m_targetPoint() );
xyzPoint.z() = -xyzPoint.z();
return xyzPoint;
}
else
{
return m_parentWellPath->wellPathGeometry()->interpolatedPointAlongWellPath( m_lateralMDConnection );
}
cvf::Vec3d xyzPoint( m_targetPoint() );
xyzPoint.z() = -xyzPoint.z();
return xyzPoint;
}
//--------------------------------------------------------------------------------------------------
@ -202,12 +194,6 @@ double RimWellPathTarget::azimuth() const
{
return cvf::Math::toRadians( m_azimuth );
}
else if ( m_targetType() == LATERAL_ANCHOR_POINT_MD )
{
auto tangent = m_parentWellPath->wellPathGeometry()->tangentAlongWellPath( m_lateralMDConnection );
RiaOffshoreSphericalCoords sphericalCoords( tangent );
return cvf::Math::toRadians( sphericalCoords.azi() );
}
else
{
return std::numeric_limits<double>::infinity();
@ -223,12 +209,6 @@ double RimWellPathTarget::inclination() const
{
return cvf::Math::toRadians( m_inclination );
}
else if ( m_targetType() == LATERAL_ANCHOR_POINT_MD )
{
auto tangent = m_parentWellPath->wellPathGeometry()->tangentAlongWellPath( m_lateralMDConnection );
RiaOffshoreSphericalCoords sphericalCoords( tangent );
return cvf::Math::toRadians( sphericalCoords.inc() );
}
else
{
return std::numeric_limits<double>::infinity();
@ -240,11 +220,6 @@ double RimWellPathTarget::inclination() const
//--------------------------------------------------------------------------------------------------
cvf::Vec3d RimWellPathTarget::tangent() const
{
if ( m_targetType() == LATERAL_ANCHOR_POINT_MD )
{
return m_parentWellPath->wellPathGeometry()->tangentAlongWellPath( m_lateralMDConnection );
}
double aziRad = cvf::Math::toRadians( m_azimuth );
double incRad = cvf::Math::toRadians( m_inclination );
@ -426,7 +401,7 @@ void RimWellPathTarget::defineUiOrdering( QString uiConfigName, caf::PdmUiOrderi
{
m_hasTangentConstraintUiField = ( m_targetType == POINT_AND_TANGENT );
if ( m_isEnabled() )
if ( m_isEnabled() && !m_isLocked() )
{
m_hasTangentConstraintUiField.uiCapability()->setUiReadOnly( false );
m_targetType.uiCapability()->setUiReadOnly( false );
@ -453,4 +428,9 @@ void RimWellPathTarget::defineUiOrdering( QString uiConfigName, caf::PdmUiOrderi
m_dogleg2.uiCapability()->setUiReadOnly( true );
m_hasTangentConstraintUiField.uiCapability()->setUiReadOnly( true );
}
if ( m_isLocked )
{
m_isEnabled.uiCapability()->setUiReadOnly( true );
}
}

View File

@ -43,9 +43,9 @@ public:
bool isEnabled() const;
void setAsPointTargetXYD( const cvf::Vec3d& point );
void setAsPointTargetXYZ( const cvf::Vec3d& point);
void setAsPointXYZAndTangentTarget( const cvf::Vec3d& point, const cvf::Vec3d& tangent );
void setAsPointXYZAndTangentTarget( const cvf::Vec3d& point, double azimuth, double inclination );
void setAsLateralMDConnection( RimWellPath* wellPath, double md );
void setDerivedTangent( double azimuth, double inclination );
RiaLineArcWellPathCalculator::WellTarget wellTargetData();
@ -53,8 +53,7 @@ public:
enum TargetTypeEnum
{
POINT_AND_TANGENT,
POINT,
LATERAL_ANCHOR_POINT_MD
POINT
};
TargetTypeEnum targetType() const;
cvf::Vec3d targetPointXYZ() const;
@ -82,6 +81,7 @@ private:
void enableFullUpdate( bool enable );
bool m_isFullUpdateEnabled;
caf::PdmField<bool> m_isEnabled;
caf::PdmField<bool> m_isLocked;
caf::PdmField<caf::AppEnum<TargetTypeEnum>> m_targetType;
caf::PdmField<cvf::Vec3d> m_targetPoint;
caf::PdmField<double> m_azimuth;
@ -90,6 +90,5 @@ private:
caf::PdmField<double> m_dogleg2;
caf::PdmField<bool> m_hasTangentConstraintUiField;
caf::PdmField<double> m_lateralMDConnection;
caf::PdmPtrField<RimWellPath*> m_parentWellPath;
};

View File

@ -48,6 +48,14 @@ RimStimPlanModelCollection::~RimStimPlanModelCollection()
{
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
bool RimStimPlanModelCollection::hasStimPlanModels() const
{
return !m_stimPlanModels.empty();
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------

View File

@ -38,6 +38,7 @@ public:
RimStimPlanModelCollection( void );
~RimStimPlanModelCollection( void ) override;
bool hasStimPlanModels() const;
void addStimPlanModel( RimStimPlanModel* fracture );
void deleteStimPlanModels();

View File

@ -171,7 +171,7 @@ double RigEclipseToStimPlanCalculator::areaWeightedMatrixPermeability() const
}
}
return calc.weightedMean();
return calc.validAggregatedWeight() ? calc.weightedMean() : 0.0;
}
//--------------------------------------------------------------------------------------------------
@ -230,7 +230,7 @@ double RigEclipseToStimPlanCalculator::areaWeightedConductivity() const
calc.addValueAndWeight( singleCellCalc.second.fractureCell().getConductivityValue(), cellArea );
}
return calc.weightedMean();
return calc.validAggregatedWeight() ? calc.weightedMean() : 0.0;
}
//--------------------------------------------------------------------------------------------------

View File

@ -18,7 +18,7 @@
#include "RigFishbonesGeometry.h"
#include "RimFishbonesMultipleSubs.h"
#include "RimFishbones.h"
#include "RigWellPath.h"
#include "RimWellPath.h"
@ -28,7 +28,7 @@
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
RigFisbonesGeometry::RigFisbonesGeometry( RimFishbonesMultipleSubs* fishbonesSub )
RigFisbonesGeometry::RigFisbonesGeometry( RimFishbones* fishbonesSub )
: m_fishbonesSub( fishbonesSub )
{
}
@ -40,19 +40,12 @@ std::vector<std::pair<cvf::Vec3d, double>> RigFisbonesGeometry::coordsForLateral
{
CVF_ASSERT( lateralIndex < m_fishbonesSub->lateralLengths().size() );
bool found = false;
for ( auto& sub : m_fishbonesSub->installedLateralIndices() )
{
if ( sub.subIndex == subIndex )
{
auto it = std::find( sub.lateralIndices.begin(), sub.lateralIndices.end(), lateralIndex );
if ( it != sub.lateralIndices.end() )
{
found = true;
break;
}
}
}
const auto& subAndLateralIndices = m_fishbonesSub->installedLateralIndices();
bool found = std::find( subAndLateralIndices.begin(),
subAndLateralIndices.end(),
std::make_pair( subIndex, lateralIndex ) ) != subAndLateralIndices.end();
CVF_ASSERT( found );
cvf::Vec3d position;

View File

@ -25,7 +25,7 @@
#include <vector>
class RimFishbonesMultipleSubs;
class RimFishbones;
//==================================================================================================
///
@ -34,7 +34,7 @@ class RimFishbonesMultipleSubs;
class RigFisbonesGeometry
{
public:
explicit RigFisbonesGeometry( RimFishbonesMultipleSubs* fishbonesSub );
explicit RigFisbonesGeometry( RimFishbones* fishbonesSub );
std::vector<std::pair<cvf::Vec3d, double>> coordsForLateral( size_t subIndex, size_t lateralIndex ) const;
@ -54,5 +54,5 @@ private:
static cvf::Vec3d closestMainAxis( const cvf::Vec3d& vec );
private:
caf::PdmPointer<RimFishbonesMultipleSubs> m_fishbonesSub;
caf::PdmPointer<RimFishbones> m_fishbonesSub;
};

View File

@ -31,7 +31,8 @@ RigWellPath::RigWellPath()
: cvf::Object()
, m_hasDatumElevation( false )
, m_datumElevation( 0.0 )
, m_startIndex( 0u )
, m_uniqueStartIndex( 0u )
, m_uniqueEndIndex( std::numeric_limits<size_t>::max() )
, objectBeingDeleted( this )
{
}
@ -45,9 +46,11 @@ RigWellPath::RigWellPath( const RigWellPath& rhs )
, m_measuredDepths( rhs.m_measuredDepths )
, m_hasDatumElevation( rhs.m_hasDatumElevation )
, m_datumElevation( rhs.m_datumElevation )
, m_startIndex( rhs.m_startIndex )
, m_uniqueStartIndex( rhs.m_uniqueStartIndex )
, m_uniqueEndIndex( rhs.m_uniqueEndIndex )
, objectBeingDeleted( this )
{
CVF_ASSERT( m_wellPathPoints.size() == m_measuredDepths.size() );
}
//--------------------------------------------------------------------------------------------------
@ -59,9 +62,11 @@ RigWellPath::RigWellPath( const std::vector<cvf::Vec3d>& wellPathPoints, const s
, m_measuredDepths( measuredDepths )
, m_hasDatumElevation( false )
, m_datumElevation( 0.0 )
, m_startIndex( 0u )
, m_uniqueStartIndex( 0u )
, m_uniqueEndIndex( std::numeric_limits<size_t>::max() )
, objectBeingDeleted( this )
{
CVF_ASSERT( m_wellPathPoints.size() == m_measuredDepths.size() );
}
//--------------------------------------------------------------------------------------------------
@ -69,14 +74,19 @@ RigWellPath::RigWellPath( const std::vector<cvf::Vec3d>& wellPathPoints, const s
//--------------------------------------------------------------------------------------------------
RigWellPath& RigWellPath::operator=( const RigWellPath& rhs )
{
m_wellPathPoints = rhs.m_wellPathPoints;
m_measuredDepths = rhs.m_measuredDepths;
m_wellPathPoints = rhs.m_wellPathPoints;
m_measuredDepths = rhs.m_measuredDepths;
CVF_ASSERT( m_wellPathPoints.size() == m_measuredDepths.size() );
m_hasDatumElevation = rhs.m_hasDatumElevation;
m_datumElevation = rhs.m_datumElevation;
m_startIndex = rhs.m_startIndex;
m_uniqueStartIndex = rhs.m_uniqueStartIndex;
m_uniqueEndIndex = rhs.m_uniqueEndIndex;
return *this;
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
RigWellPath::~RigWellPath()
{
objectBeingDeleted.send();
@ -179,7 +189,7 @@ double RigWellPath::rkbDiff() const
}
// If measured depth is zero, use the z-value of the well path points
if ( m_wellPathPoints.size() > 0 && m_measuredDepths.size() > 0 )
if ( !m_wellPathPoints.empty() && !m_measuredDepths.empty() )
{
double epsilon = 1e-3;
@ -189,7 +199,8 @@ double RigWellPath::rkbDiff() const
return diff;
}
else if ( cvf::Math::abs( m_wellPathPoints[0].z() ) < epsilon )
if ( cvf::Math::abs( m_wellPathPoints[0].z() ) < epsilon )
{
return m_measuredDepths[0]; // Assume a vertical drop before the first md point.
}
@ -254,6 +265,9 @@ cvf::Vec3d
return interpolatedVector;
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
cvf::Vec3d
RigWellPath::interpolatedPointAlongWellPath( double measuredDepth,
double* horizontalLengthAlongWellToStartClipPoint /*= nullptr*/ ) const
@ -272,7 +286,8 @@ cvf::Vec3d RigWellPath::tangentAlongWellPath( double measuredDepth ) const
{
return ( m_wellPathPoints[1] - m_wellPathPoints[0] ).getNormalized();
}
else if ( measuredDepth >= m_measuredDepths.back() )
if ( measuredDepth >= m_measuredDepths.back() )
{
auto N = m_measuredDepths.size();
return ( m_wellPathPoints[N - 1] - m_wellPathPoints[N - 2] ).getNormalized();
@ -421,10 +436,9 @@ cvf::ref<RigWellPath> RigWellPath::commonGeometry( const std::vector<const RigWe
{
const double eps = 1.0e-3;
if ( allGeometries.empty() )
return nullptr;
else if ( allGeometries.size() == 1u )
return cvf::ref<RigWellPath>( new RigWellPath( *allGeometries.front() ) );
if ( allGeometries.empty() ) return nullptr;
if ( allGeometries.size() == 1u ) return cvf::ref<RigWellPath>( new RigWellPath( *allGeometries.front() ) );
const RigWellPath* firstGeometry = allGeometries.front();
@ -459,9 +473,12 @@ cvf::ref<RigWellPath> RigWellPath::commonGeometry( const std::vector<const RigWe
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RigWellPath::setUniqueStartIndex( size_t uniqueStartIndex )
void RigWellPath::setUniqueStartAndEndIndex( size_t uniqueStartIndex, size_t uniqueEndIndex )
{
m_startIndex = uniqueStartIndex;
if ( m_measuredDepths.empty() ) return;
m_uniqueStartIndex = std::clamp( uniqueStartIndex, (size_t)0u, m_measuredDepths.size() - 1u );
m_uniqueEndIndex = std::clamp( uniqueEndIndex, m_uniqueStartIndex, m_measuredDepths.size() - 1u );
}
//--------------------------------------------------------------------------------------------------
@ -469,7 +486,15 @@ void RigWellPath::setUniqueStartIndex( size_t uniqueStartIndex )
//--------------------------------------------------------------------------------------------------
size_t RigWellPath::uniqueStartIndex() const
{
return m_startIndex;
return m_uniqueStartIndex;
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
size_t RigWellPath::uniqueEndIndex() const
{
return std::clamp( m_uniqueEndIndex, m_uniqueStartIndex, m_measuredDepths.size() - 1u );
}
//--------------------------------------------------------------------------------------------------
@ -477,7 +502,8 @@ size_t RigWellPath::uniqueStartIndex() const
//--------------------------------------------------------------------------------------------------
std::vector<cvf::Vec3d> RigWellPath::uniqueWellPathPoints() const
{
return std::vector<cvf::Vec3d>( m_wellPathPoints.begin() + m_startIndex, m_wellPathPoints.end() );
return std::vector<cvf::Vec3d>( m_wellPathPoints.begin() + uniqueStartIndex(),
m_wellPathPoints.begin() + uniqueEndIndex() + 1u );
}
//--------------------------------------------------------------------------------------------------
@ -485,7 +511,8 @@ std::vector<cvf::Vec3d> RigWellPath::uniqueWellPathPoints() const
//--------------------------------------------------------------------------------------------------
std::vector<double> RigWellPath::uniqueMeasuredDepths() const
{
return std::vector<double>( m_measuredDepths.begin() + m_startIndex, m_measuredDepths.end() );
return std::vector<double>( m_measuredDepths.begin() + m_uniqueStartIndex,
m_measuredDepths.begin() + uniqueEndIndex() + 1u );
}
//--------------------------------------------------------------------------------------------------

View File

@ -72,8 +72,9 @@ public:
double identicalTubeLength( const RigWellPath& otherWellPathGeometry ) const;
static cvf::ref<RigWellPath> commonGeometry( const std::vector<const RigWellPath*>& allGeometries );
void setUniqueStartIndex( size_t uniqueStartIndex );
void setUniqueStartAndEndIndex( size_t uniqueStartIndex, size_t uniqueEndIndex );
size_t uniqueStartIndex() const;
size_t uniqueEndIndex() const;
std::vector<cvf::Vec3d> uniqueWellPathPoints() const;
std::vector<double> uniqueMeasuredDepths() const;
@ -95,5 +96,6 @@ private:
bool m_hasDatumElevation;
double m_datumElevation;
size_t m_startIndex;
size_t m_uniqueStartIndex;
size_t m_uniqueEndIndex;
};

Some files were not shown because too many files have changed in this diff Show More