2018-07-03 01:42:31 -05:00
|
|
|
/////////////////////////////////////////////////////////////////////////////////
|
|
|
|
//
|
2019-01-09 08:21:38 -06:00
|
|
|
// Copyright (C) 2018- Equinor ASA
|
2019-09-06 03:40:57 -05:00
|
|
|
//
|
2018-07-03 01:42:31 -05:00
|
|
|
// 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.
|
2019-09-06 03:40:57 -05:00
|
|
|
//
|
2018-07-03 01:42:31 -05:00
|
|
|
// 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.
|
2019-09-06 03:40:57 -05:00
|
|
|
//
|
|
|
|
// See the GNU General Public License at <http://www.gnu.org/licenses/gpl.html>
|
2018-07-03 01:42:31 -05:00
|
|
|
// for more details.
|
|
|
|
//
|
|
|
|
/////////////////////////////////////////////////////////////////////////////////
|
|
|
|
|
2018-06-27 10:22:08 -05:00
|
|
|
#include "RimModeledWellPath.h"
|
2018-07-03 01:42:31 -05:00
|
|
|
|
2020-02-24 08:42:23 -06:00
|
|
|
#include "RicfCommandObject.h"
|
2018-07-02 07:51:17 -05:00
|
|
|
#include "RimProject.h"
|
2019-09-06 03:40:57 -05:00
|
|
|
#include "RimWellPathGeometryDef.h"
|
2018-07-02 07:51:17 -05:00
|
|
|
|
2018-07-03 01:42:31 -05:00
|
|
|
#include "RigWellPath.h"
|
|
|
|
|
2018-09-12 06:18:48 -05:00
|
|
|
#include "RiaCompletionTypeCalculationScheduler.h"
|
2019-10-15 04:30:06 -05:00
|
|
|
#include "RifTextDataTableFormatter.h"
|
2019-11-26 04:35:21 -06:00
|
|
|
#include "RimExtrudedCurveIntersection.h"
|
2019-09-06 03:40:57 -05:00
|
|
|
#include "RimPlotCurve.h"
|
2018-09-12 06:18:48 -05:00
|
|
|
#include "RimWellPath.h"
|
|
|
|
#include "RimWellPathFracture.h"
|
2019-09-06 03:40:57 -05:00
|
|
|
#include "RimWellPathFractureCollection.h"
|
2020-09-07 06:59:30 -05:00
|
|
|
|
|
|
|
#include "cafPdmFieldScriptingCapability.h"
|
2019-09-06 03:40:57 -05:00
|
|
|
#include "cafPdmUiTreeOrdering.h"
|
2018-06-27 10:22:08 -05:00
|
|
|
|
2020-02-24 08:42:23 -06:00
|
|
|
CAF_PDM_SOURCE_INIT( RimModeledWellPath, "ModeledWellPath" );
|
2018-06-27 10:22:08 -05:00
|
|
|
|
|
|
|
//--------------------------------------------------------------------------------------------------
|
2019-09-06 03:40:57 -05:00
|
|
|
///
|
2018-06-27 10:22:08 -05:00
|
|
|
//--------------------------------------------------------------------------------------------------
|
2018-06-28 02:00:34 -05:00
|
|
|
RimModeledWellPath::RimModeledWellPath()
|
2018-06-27 10:22:08 -05:00
|
|
|
{
|
2020-09-07 06:59:30 -05:00
|
|
|
CAF_PDM_InitScriptableObject( "Modeled Well Path",
|
2020-03-03 03:43:07 -06:00
|
|
|
":/EditableWell.png",
|
|
|
|
"",
|
|
|
|
"A Well Path created interactively in ResInsight" );
|
2018-06-27 10:22:08 -05:00
|
|
|
|
2020-09-07 06:59:30 -05:00
|
|
|
CAF_PDM_InitScriptableFieldWithScriptKeywordNoDefault( &m_geometryDefinition,
|
|
|
|
"WellPathGeometryDef",
|
|
|
|
"WellPathGeometry",
|
|
|
|
"Trajectory",
|
|
|
|
"",
|
|
|
|
"",
|
|
|
|
"" );
|
2018-06-27 10:22:08 -05:00
|
|
|
m_geometryDefinition = new RimWellPathGeometryDef;
|
2021-01-04 04:09:01 -06:00
|
|
|
m_geometryDefinition->changed.connect( this, &RimModeledWellPath::onGeometryDefinitionChanged );
|
2018-07-04 10:01:40 -05:00
|
|
|
|
2018-11-06 03:38:07 -06:00
|
|
|
// Required, as these settings are set in RimWellPath()
|
2019-09-06 03:40:57 -05:00
|
|
|
m_name.uiCapability()->setUiReadOnly( false );
|
2020-11-04 07:38:44 -06:00
|
|
|
m_name.uiCapability()->setUiHidden( false );
|
2019-09-06 03:40:57 -05:00
|
|
|
m_name.xmlCapability()->setIOReadable( true );
|
|
|
|
m_name.xmlCapability()->setIOWritable( true );
|
2018-06-27 10:22:08 -05:00
|
|
|
}
|
|
|
|
|
|
|
|
//--------------------------------------------------------------------------------------------------
|
2019-09-06 03:40:57 -05:00
|
|
|
///
|
2018-06-27 10:22:08 -05:00
|
|
|
//--------------------------------------------------------------------------------------------------
|
2020-02-12 04:13:38 -06:00
|
|
|
RimModeledWellPath::~RimModeledWellPath()
|
|
|
|
{
|
|
|
|
}
|
2018-06-27 10:22:08 -05:00
|
|
|
|
2018-07-02 09:55:32 -05:00
|
|
|
//--------------------------------------------------------------------------------------------------
|
2019-09-06 03:40:57 -05:00
|
|
|
///
|
2018-07-02 09:55:32 -05:00
|
|
|
//--------------------------------------------------------------------------------------------------
|
|
|
|
void RimModeledWellPath::createWellPathGeometry()
|
|
|
|
{
|
2019-09-06 03:40:57 -05:00
|
|
|
this->setWellPathGeometry( m_geometryDefinition->createWellPathGeometry().p() );
|
2018-07-02 09:55:32 -05:00
|
|
|
}
|
|
|
|
|
2018-07-02 07:51:17 -05:00
|
|
|
//--------------------------------------------------------------------------------------------------
|
2019-09-06 03:40:57 -05:00
|
|
|
///
|
2018-07-02 07:51:17 -05:00
|
|
|
//--------------------------------------------------------------------------------------------------
|
|
|
|
void RimModeledWellPath::updateWellPathVisualization()
|
|
|
|
{
|
2019-09-06 03:40:57 -05:00
|
|
|
this->setWellPathGeometry( m_geometryDefinition->createWellPathGeometry().p() );
|
|
|
|
|
2018-08-29 10:33:58 -05:00
|
|
|
std::vector<RimPlotCurve*> refferingCurves;
|
2019-09-06 03:40:57 -05:00
|
|
|
this->objectsWithReferringPtrFieldsOfType( refferingCurves );
|
2018-08-29 10:33:58 -05:00
|
|
|
|
2019-09-06 03:40:57 -05:00
|
|
|
for ( auto curve : refferingCurves )
|
2018-08-29 10:33:58 -05:00
|
|
|
{
|
2019-09-06 03:40:57 -05:00
|
|
|
curve->loadDataAndUpdate( false );
|
2018-08-29 10:33:58 -05:00
|
|
|
}
|
2018-09-12 06:18:48 -05:00
|
|
|
|
|
|
|
for ( auto fracture : this->fractureCollection()->activeFractures() )
|
|
|
|
{
|
|
|
|
fracture->loadDataAndUpdate();
|
|
|
|
}
|
|
|
|
|
2019-11-26 04:35:21 -06:00
|
|
|
std::vector<RimExtrudedCurveIntersection*> refferingIntersections;
|
2019-09-06 03:40:57 -05:00
|
|
|
this->objectsWithReferringPtrFieldsOfType( refferingIntersections );
|
2018-09-12 06:18:48 -05:00
|
|
|
|
2019-09-06 03:40:57 -05:00
|
|
|
for ( auto intersection : refferingIntersections )
|
2018-09-12 06:18:48 -05:00
|
|
|
{
|
|
|
|
intersection->rebuildGeometryAndScheduleCreateDisplayModel();
|
|
|
|
}
|
|
|
|
|
|
|
|
RimProject* proj;
|
2019-09-06 03:40:57 -05:00
|
|
|
this->firstAncestorOrThisOfTypeAsserted( proj );
|
2018-09-12 06:18:48 -05:00
|
|
|
proj->scheduleCreateDisplayModelAndRedrawAllViews();
|
|
|
|
}
|
|
|
|
|
|
|
|
//--------------------------------------------------------------------------------------------------
|
2019-09-06 03:40:57 -05:00
|
|
|
///
|
2018-09-12 06:18:48 -05:00
|
|
|
//--------------------------------------------------------------------------------------------------
|
|
|
|
void RimModeledWellPath::scheduleUpdateOfDependentVisualization()
|
|
|
|
{
|
|
|
|
RiaCompletionTypeCalculationScheduler::instance()->scheduleRecalculateCompletionTypeAndRedrawAllViews();
|
2018-07-02 07:51:17 -05:00
|
|
|
}
|
|
|
|
|
2018-08-29 09:03:31 -05:00
|
|
|
//--------------------------------------------------------------------------------------------------
|
2019-09-06 03:40:57 -05:00
|
|
|
///
|
2018-08-29 09:03:31 -05:00
|
|
|
//--------------------------------------------------------------------------------------------------
|
2018-11-06 04:23:19 -06:00
|
|
|
RimWellPathGeometryDef* RimModeledWellPath::geometryDefinition() const
|
2018-08-29 09:03:31 -05:00
|
|
|
{
|
|
|
|
return m_geometryDefinition;
|
|
|
|
}
|
|
|
|
|
2018-09-26 05:38:53 -05:00
|
|
|
//--------------------------------------------------------------------------------------------------
|
2019-09-06 03:40:57 -05:00
|
|
|
///
|
2018-09-26 05:38:53 -05:00
|
|
|
//--------------------------------------------------------------------------------------------------
|
|
|
|
QString RimModeledWellPath::wellPlanText()
|
|
|
|
{
|
2019-09-06 03:40:57 -05:00
|
|
|
QString planText;
|
|
|
|
QTextStream qtxtStream( &planText );
|
2018-09-26 05:38:53 -05:00
|
|
|
|
2019-10-15 04:30:06 -05:00
|
|
|
RifTextDataTableFormatter formatter( qtxtStream );
|
2019-01-18 07:55:12 -06:00
|
|
|
formatter.setUnlimitedDataRowWidth();
|
2019-09-06 03:40:57 -05:00
|
|
|
formatter.setTableRowPrependText( "" );
|
|
|
|
formatter.setTableRowLineAppendText( "" );
|
2018-09-26 05:38:53 -05:00
|
|
|
|
2019-10-15 04:30:06 -05:00
|
|
|
std::vector<RifTextDataTableColumn> tableHeader;
|
2020-11-09 06:44:29 -06:00
|
|
|
std::vector<QString> columns = { "MDRKB", "CL", "Inc", "Azi", "TVDMSL", "NS", "EW", "Dogleg", "Build", "Turn" };
|
2020-04-15 01:40:12 -05:00
|
|
|
for ( QString column : columns )
|
|
|
|
{
|
|
|
|
tableHeader.push_back(
|
|
|
|
RifTextDataTableColumn( column,
|
|
|
|
RifTextDataTableDoubleFormatting( RifTextDataTableDoubleFormat::RIF_FLOAT, 2 ) ) );
|
|
|
|
}
|
|
|
|
|
2019-09-06 03:40:57 -05:00
|
|
|
formatter.header( tableHeader );
|
|
|
|
|
2020-04-15 01:40:12 -05:00
|
|
|
double mdrkbAtFirstTarget = m_geometryDefinition->mdAtFirstTarget() + m_geometryDefinition->airGap();
|
2019-09-06 03:40:57 -05:00
|
|
|
if ( m_geometryDefinition )
|
2018-09-26 05:38:53 -05:00
|
|
|
{
|
|
|
|
std::vector<RiaWellPlanCalculator::WellPlanSegment> wellPlan = m_geometryDefinition->wellPlan();
|
2019-09-06 03:40:57 -05:00
|
|
|
for ( const auto& segment : wellPlan )
|
2018-09-26 05:38:53 -05:00
|
|
|
{
|
2019-09-06 03:40:57 -05:00
|
|
|
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 );
|
2018-09-26 05:38:53 -05:00
|
|
|
formatter.rowCompleted();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
formatter.tableCompleted();
|
|
|
|
|
|
|
|
return planText;
|
|
|
|
}
|
|
|
|
|
2018-06-27 10:22:08 -05:00
|
|
|
//--------------------------------------------------------------------------------------------------
|
2019-09-06 03:40:57 -05:00
|
|
|
///
|
2018-06-27 10:22:08 -05:00
|
|
|
//--------------------------------------------------------------------------------------------------
|
2019-09-06 03:40:57 -05:00
|
|
|
void RimModeledWellPath::defineUiTreeOrdering( caf::PdmUiTreeOrdering& uiTreeOrdering, QString uiConfigName )
|
2018-06-27 10:22:08 -05:00
|
|
|
{
|
2019-09-06 03:40:57 -05:00
|
|
|
uiTreeOrdering.add( m_geometryDefinition() );
|
|
|
|
RimWellPath::defineUiTreeOrdering( uiTreeOrdering, uiConfigName );
|
2018-06-27 10:22:08 -05:00
|
|
|
}
|
2020-11-04 07:38:44 -06:00
|
|
|
|
|
|
|
//--------------------------------------------------------------------------------------------------
|
|
|
|
///
|
|
|
|
//--------------------------------------------------------------------------------------------------
|
|
|
|
void RimModeledWellPath::defineUiOrdering( QString uiConfigName, caf::PdmUiOrdering& uiOrdering )
|
|
|
|
{
|
|
|
|
uiOrdering.add( &m_name );
|
|
|
|
RimWellPath::defineUiOrdering( uiConfigName, uiOrdering );
|
|
|
|
}
|
2021-01-04 04:09:01 -06:00
|
|
|
|
|
|
|
//--------------------------------------------------------------------------------------------------
|
|
|
|
///
|
|
|
|
//--------------------------------------------------------------------------------------------------
|
|
|
|
void RimModeledWellPath::onGeometryDefinitionChanged( const caf::SignalEmitter* emitter, bool fullUpdate )
|
|
|
|
{
|
|
|
|
updateWellPathVisualization();
|
|
|
|
if ( fullUpdate )
|
|
|
|
{
|
|
|
|
scheduleUpdateOfDependentVisualization();
|
|
|
|
}
|
|
|
|
}
|