mirror of
https://github.com/OPM/ResInsight.git
synced 2026-10-26 15:10:22 -05:00
Migrate all assert macros in ApplicationLibCode to CAF_ASSERT and remove every use of cvfAssert.h. CVF_ASSERT is replaced one to one. CVF_TIGHT_ASSERT is also replaced by CAF_ASSERT, which is semantically exact: CVF_ENABLE_TIGHT_ASSERTS is 1 only under _DEBUG, and that is what CAF_ASSERT now does. The two CVF_FAIL_MSG sites become CAF_ASSERT( false && "message" ), preserving the message with the idiom already used elsewhere in the code base. Counts before and after: CVF_ASSERT 1044 to 0, CVF_TIGHT_ASSERT 66 to 0, CVF_FAIL_MSG 2 to 0, cvfAssert.h references 154 to 0. Include handling: files that included cvfAssert.h directly now include cafAssert.h instead, includes left dead by the migration are removed, and files that were relying on cvfAssert.h transitively get an explicit cafAssert.h. Files that reach cafAssert.h through another caf header are left unchanged; a missing include here is a compile error, not a silently disabled assert. ResultStatisticsCache links only LibCore and therefore had no path to cafAssert.h. Add the cafPdmCore directory as a private include path rather than linking the library, since cafAssert.h is header only. Note that this stops these asserts from firing in Release and RelWithDebInfo, where CVF_ASSERT was previously active.
362 lines
14 KiB
C++
362 lines
14 KiB
C++
/////////////////////////////////////////////////////////////////////////////////
|
|
//
|
|
// Copyright (C) 2017 Statoil 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 "RimWellPathCompletions.h"
|
|
|
|
#include "RiaStdStringTools.h"
|
|
|
|
#include "RimFishbones.h"
|
|
#include "RimFishbonesCollection.h"
|
|
#include "RimMswSegment.h"
|
|
#include "RimMswSegmentCollection.h"
|
|
#include "RimPerforationCollection.h"
|
|
#include "RimPerforationInterval.h"
|
|
#include "RimProject.h"
|
|
#include "RimStimPlanModel.h"
|
|
#include "RimStimPlanModelCollection.h"
|
|
#include "RimValveCollection.h"
|
|
#include "RimWellPath.h"
|
|
#include "RimWellPathComponentInterface.h"
|
|
#include "RimWellPathFracture.h"
|
|
#include "RimWellPathFractureCollection.h"
|
|
#include "RimWellPathValve.h"
|
|
|
|
#include "cafAssert.h"
|
|
|
|
#include "cafPdmDoubleStringValidator.h"
|
|
#include "cafPdmFieldScriptingCapability.h"
|
|
#include "cafPdmObjectScriptingCapability.h"
|
|
#include "cafPdmUiDoubleValueEditor.h"
|
|
#include "cafPdmUiLineEditor.h"
|
|
#include "cafPdmUiTreeOrdering.h"
|
|
|
|
#include <cmath>
|
|
|
|
CAF_PDM_SOURCE_INIT( RimWellPathCompletions, "WellPathCompletions" );
|
|
|
|
//--------------------------------------------------------------------------------------------------
|
|
///
|
|
//--------------------------------------------------------------------------------------------------
|
|
RimWellPathCompletions::RimWellPathCompletions()
|
|
{
|
|
CAF_PDM_InitScriptableObject( "Completions", ":/CompletionsSymbol16x16.png" );
|
|
|
|
CAF_PDM_InitScriptableFieldNoDefault( &m_perforationCollection, "Perforations", "Perforations" );
|
|
m_perforationCollection = new RimPerforationCollection;
|
|
|
|
CAF_PDM_InitScriptableFieldNoDefault( &m_valveCollection, "Valves", "Valves" );
|
|
m_valveCollection = new RimValveCollection();
|
|
|
|
CAF_PDM_InitScriptableFieldNoDefault( &m_fishbonesCollection, "Fishbones", "Fishbones" );
|
|
m_fishbonesCollection = new RimFishbonesCollection;
|
|
|
|
CAF_PDM_InitFieldNoDefault( &m_fractureCollection, "Fractures", "Fractures" );
|
|
m_fractureCollection = new RimWellPathFractureCollection;
|
|
|
|
CAF_PDM_InitFieldNoDefault( &m_stimPlanModelCollection, "StimPlanModels", "StimPlan Models" );
|
|
m_stimPlanModelCollection = new RimStimPlanModelCollection;
|
|
|
|
CAF_PDM_InitFieldNoDefault( &m_mswSegmentCollection, "MswSegments", "MSW Segments" );
|
|
m_mswSegmentCollection = new RimMswSegmentCollection;
|
|
|
|
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 );
|
|
}
|
|
|
|
//--------------------------------------------------------------------------------------------------
|
|
///
|
|
//--------------------------------------------------------------------------------------------------
|
|
RimFishbonesCollection* RimWellPathCompletions::fishbonesCollection() const
|
|
{
|
|
CAF_ASSERT( m_fishbonesCollection );
|
|
|
|
return m_fishbonesCollection;
|
|
}
|
|
|
|
//--------------------------------------------------------------------------------------------------
|
|
///
|
|
//--------------------------------------------------------------------------------------------------
|
|
RimPerforationCollection* RimWellPathCompletions::perforationCollection() const
|
|
{
|
|
CAF_ASSERT( m_perforationCollection );
|
|
|
|
return m_perforationCollection;
|
|
}
|
|
|
|
//--------------------------------------------------------------------------------------------------
|
|
///
|
|
//--------------------------------------------------------------------------------------------------
|
|
RimValveCollection* RimWellPathCompletions::valveCollection() const
|
|
{
|
|
CAF_ASSERT( m_valveCollection );
|
|
|
|
return m_valveCollection;
|
|
}
|
|
|
|
//--------------------------------------------------------------------------------------------------
|
|
///
|
|
//--------------------------------------------------------------------------------------------------
|
|
RimWellPathFractureCollection* RimWellPathCompletions::fractureCollection() const
|
|
{
|
|
CAF_ASSERT( m_fractureCollection );
|
|
|
|
return m_fractureCollection;
|
|
}
|
|
|
|
//--------------------------------------------------------------------------------------------------
|
|
///
|
|
//--------------------------------------------------------------------------------------------------
|
|
RimStimPlanModelCollection* RimWellPathCompletions::stimPlanModelCollection() const
|
|
{
|
|
CAF_ASSERT( m_stimPlanModelCollection );
|
|
|
|
return m_stimPlanModelCollection;
|
|
}
|
|
|
|
//--------------------------------------------------------------------------------------------------
|
|
///
|
|
//--------------------------------------------------------------------------------------------------
|
|
RimMswSegmentCollection* RimWellPathCompletions::mswSegmentCollection() const
|
|
{
|
|
return m_mswSegmentCollection;
|
|
}
|
|
|
|
//--------------------------------------------------------------------------------------------------
|
|
///
|
|
//--------------------------------------------------------------------------------------------------
|
|
std::vector<RimWellPathValve*> RimWellPathCompletions::valves() const
|
|
{
|
|
return descendantsIncludingThisOfType<RimWellPathValve>();
|
|
}
|
|
|
|
//--------------------------------------------------------------------------------------------------
|
|
///
|
|
//--------------------------------------------------------------------------------------------------
|
|
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 {};
|
|
}
|
|
|
|
//--------------------------------------------------------------------------------------------------
|
|
///
|
|
//--------------------------------------------------------------------------------------------------
|
|
std::vector<RimWellPathComponentInterface*> RimWellPathCompletions::allCompletionsNoConst() const
|
|
{
|
|
std::vector<RimWellPathComponentInterface*> completions;
|
|
|
|
for ( RimWellPathFracture* fracture : m_fractureCollection->allFractures() )
|
|
{
|
|
completions.push_back( fracture );
|
|
}
|
|
for ( RimFishbones* fishbones : m_fishbonesCollection->allFishbonesSubs() )
|
|
{
|
|
completions.push_back( fishbones );
|
|
}
|
|
for ( RimPerforationInterval* perforation : m_perforationCollection->perforationsNoConst() )
|
|
{
|
|
completions.push_back( perforation );
|
|
}
|
|
|
|
std::vector<RimWellPathValve*> allValves = valves();
|
|
for ( RimWellPathValve* valve : allValves )
|
|
{
|
|
completions.push_back( valve );
|
|
}
|
|
|
|
if ( m_mswSegmentCollection && m_mswSegmentCollection->isChecked() )
|
|
{
|
|
for ( const RimMswSegment* segment : m_mswSegmentCollection->segments() )
|
|
{
|
|
completions.push_back( const_cast<RimMswSegment*>( segment ) );
|
|
}
|
|
}
|
|
|
|
return completions;
|
|
}
|
|
|
|
//--------------------------------------------------------------------------------------------------
|
|
///
|
|
//--------------------------------------------------------------------------------------------------
|
|
std::vector<const RimWellPathComponentInterface*> RimWellPathCompletions::allCompletions() const
|
|
{
|
|
std::vector<const RimWellPathComponentInterface*> completions;
|
|
|
|
for ( const RimWellPathFracture* fracture : m_fractureCollection->allFractures() )
|
|
{
|
|
completions.push_back( fracture );
|
|
}
|
|
for ( const RimFishbones* fishbones : m_fishbonesCollection->allFishbonesSubs() )
|
|
{
|
|
completions.push_back( fishbones );
|
|
}
|
|
for ( const RimPerforationInterval* perforation : m_perforationCollection->perforations() )
|
|
{
|
|
completions.push_back( perforation );
|
|
}
|
|
|
|
std::vector<RimWellPathValve*> allValves = valves();
|
|
for ( const RimWellPathValve* valve : allValves )
|
|
{
|
|
completions.push_back( valve );
|
|
}
|
|
|
|
if ( m_mswSegmentCollection && m_mswSegmentCollection->isChecked() )
|
|
{
|
|
for ( const RimMswSegment* segment : m_mswSegmentCollection->segments() )
|
|
{
|
|
completions.push_back( segment );
|
|
}
|
|
}
|
|
|
|
return completions;
|
|
}
|
|
|
|
//--------------------------------------------------------------------------------------------------
|
|
///
|
|
//--------------------------------------------------------------------------------------------------
|
|
bool RimWellPathCompletions::hasCompletions() const
|
|
{
|
|
if ( !m_fractureCollection->allFractures().empty() || !m_stimPlanModelCollection->allStimPlanModels().empty() )
|
|
{
|
|
return true;
|
|
}
|
|
|
|
return !m_fishbonesCollection->allFishbonesSubs().empty() || !m_perforationCollection->perforations().empty() ||
|
|
m_valveCollection->hasValves();
|
|
}
|
|
|
|
//--------------------------------------------------------------------------------------------------
|
|
///
|
|
//--------------------------------------------------------------------------------------------------
|
|
void RimWellPathCompletions::setUnitSystemSpecificDefaults()
|
|
{
|
|
m_fishbonesCollection->setUnitSystemSpecificDefaults();
|
|
}
|
|
|
|
//--------------------------------------------------------------------------------------------------
|
|
///
|
|
//--------------------------------------------------------------------------------------------------
|
|
void RimWellPathCompletions::defineUiOrdering( QString uiConfigName, caf::PdmUiOrdering& uiOrdering )
|
|
{
|
|
uiOrdering.skipRemainingFields( true );
|
|
}
|
|
|
|
//--------------------------------------------------------------------------------------------------
|
|
///
|
|
//--------------------------------------------------------------------------------------------------
|
|
void RimWellPathCompletions::defineUiTreeOrdering( caf::PdmUiTreeOrdering& uiTreeOrdering, QString uiConfigName )
|
|
{
|
|
uiTreeOrdering.skipRemainingChildren( true );
|
|
|
|
if ( m_valveCollection->hasValves() )
|
|
{
|
|
uiTreeOrdering.add( &m_valveCollection );
|
|
}
|
|
|
|
if ( m_perforationCollection->hasPerforations() )
|
|
{
|
|
uiTreeOrdering.add( &m_perforationCollection );
|
|
}
|
|
|
|
if ( !m_fishbonesCollection->allFishbonesSubs().empty() )
|
|
{
|
|
uiTreeOrdering.add( &m_fishbonesCollection );
|
|
}
|
|
|
|
if ( !m_fractureCollection->allFractures().empty() )
|
|
{
|
|
uiTreeOrdering.add( &m_fractureCollection );
|
|
}
|
|
|
|
if ( !m_stimPlanModelCollection->allStimPlanModels().empty() )
|
|
{
|
|
uiTreeOrdering.add( &m_stimPlanModelCollection );
|
|
}
|
|
|
|
if ( m_mswSegmentCollection && m_mswSegmentCollection->hasSegments() )
|
|
{
|
|
uiTreeOrdering.add( &m_mswSegmentCollection );
|
|
}
|
|
}
|
|
|
|
//--------------------------------------------------------------------------------------------------
|
|
///
|
|
//--------------------------------------------------------------------------------------------------
|
|
void RimWellPathCompletions::initAfterRead()
|
|
{
|
|
if ( RimProject::current()->isProjectFileVersionEqualOrOlderThan( "2020.10.1.2" ) )
|
|
{
|
|
std::vector<RimWellPath*> wellPathHierarchy = allAncestorsOrThisOfType<RimWellPath>();
|
|
RimWellPath* topLevelWellPath = wellPathHierarchy.back();
|
|
auto settings = topLevelWellPath->completionSettings();
|
|
|
|
applyToSettings( settings );
|
|
};
|
|
}
|
|
|
|
//--------------------------------------------------------------------------------------------------
|
|
///
|
|
//--------------------------------------------------------------------------------------------------
|
|
void RimWellPathCompletions::applyToSettings( RimWellPathCompletionSettings* settings )
|
|
{
|
|
settings->m_wellNameForExport = m_wellNameForExport_OBSOLETE;
|
|
settings->m_preferredFluidPhase = m_preferredFluidPhase_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;
|
|
}
|