This commit is contained in:
Jørgen Herje
2023-05-05 15:28:57 +02:00
parent 1f85c1e611
commit 254cd196f9
7 changed files with 238 additions and 2 deletions
@@ -9,6 +9,7 @@ set(SOURCE_GROUP_HEADER_FILES
${CMAKE_CURRENT_LIST_DIR}/RimGeoMechContourMapViewCollection.h
${CMAKE_CURRENT_LIST_DIR}/RimGeoMechPartCollection.h
${CMAKE_CURRENT_LIST_DIR}/RimGeoMechPart.h
${CMAKE_CURRENT_LIST_DIR}/RimGeoMechFaultReactivationResult.h
)
set(SOURCE_GROUP_SOURCE_FILES
@@ -22,6 +23,7 @@ set(SOURCE_GROUP_SOURCE_FILES
${CMAKE_CURRENT_LIST_DIR}/RimGeoMechContourMapViewCollection.cpp
${CMAKE_CURRENT_LIST_DIR}/RimGeoMechPartCollection.cpp
${CMAKE_CURRENT_LIST_DIR}/RimGeoMechPart.cpp
${CMAKE_CURRENT_LIST_DIR}/RimGeoMechFaultReactivationResult.cpp
)
list(APPEND CODE_HEADER_FILES ${SOURCE_GROUP_HEADER_FILES})
@@ -0,0 +1,172 @@
/////////////////////////////////////////////////////////////////////////////////
//
// Copyright (C) 2023- 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 "RimGeoMechFaultReactivationResult.h"
#include "RiaApplication.h"
#include "RimGeoMechCase.h"
#include "RimGeoMechView.h"
#include "RimGridView.h"
#include "RimIntersectionCollection.h"
#include "RimModeledWellPath.h"
#include "RimWellPathGeometryDef.h"
#include "RimOilField.h"
#include "RimProject.h"
#include "RimWellPathCollection.h"
#include "cafPdmFieldScriptingCapability.h"
#include "cafPdmObjectScriptingCapability.h"
#include "cafPdmUiPushButtonEditor.h"
CAF_PDM_SOURCE_INIT( RimGeoMechFaultReactivationResult, "RimGeoMechFaultReactivationResult" );
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
RimGeoMechFaultReactivationResult::RimGeoMechFaultReactivationResult()
{
// TODO: Update icon
CAF_PDM_InitObject( "Fault Reactivation Result", ":/GeoMechCase24x24.png" );
CAF_PDM_InitFieldNoDefault( &m_intersection, "Intersection", "Intersection" );
CAF_PDM_InitField( &m_wellDistanceFromIntersection, "FaceDistanceFromIntersection", 0.0, "Face Distance From Intersection" );
CAF_PDM_InitField( &m_wellWidthOutsideIntersection, "FaceWidthOutsideIntersection", 0.0, "Face Width Outside Intersection" );
CAF_PDM_InitFieldNoDefault( &m_createFaultReactivationResult, "CreateReactivationResult", "" );
caf::PdmUiPushButtonEditor::configureEditorForField( &m_createFaultReactivationResult );
setDeletable( false );
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
RimGeoMechFaultReactivationResult::~RimGeoMechFaultReactivationResult()
{
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
QList<caf::PdmOptionItemInfo> RimGeoMechFaultReactivationResult::calculateValueOptions( const caf::PdmFieldHandle* fieldNeedingOptions )
{
QList<caf::PdmOptionItemInfo> options;
if ( fieldNeedingOptions == &m_intersection )
{
RimGridView* activeView = RiaApplication::instance()->activeGridView();
if ( !activeView || !activeView->intersectionCollection() ) return options;
for ( auto* intersection : activeView->intersectionCollection()->intersections() )
{
// Only utilize polyline intersections?
if ( intersection && intersection->type() == RimExtrudedCurveIntersection::CrossSectionEnum::CS_POLYLINE )
options.push_back( caf::PdmOptionItemInfo( intersection->name(), intersection ) );
}
}
return options;
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RimGeoMechFaultReactivationResult::defineUiOrdering( QString uiConfigName, caf::PdmUiOrdering& uiOrdering )
{
caf::PdmUiGroup* group = uiOrdering.addNewGroup( "Fault Reactivation Result" );
group->add( &m_intersection );
group->add( &m_wellDistanceFromIntersection );
group->add( &m_wellWidthOutsideIntersection );
group->add( &m_createFaultReactivationResult );
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RimGeoMechFaultReactivationResult::fieldChangedByUi( const caf::PdmFieldHandle* changedField,
const QVariant& oldValue,
const QVariant& newValue )
{
if ( changedField == &m_createFaultReactivationResult && m_intersection() )
{
// Using first two points from first polyline
const auto polyLines = m_intersection()->polyLines();
if ( polyLines.size() != 1 || polyLines[0].size() != 2 ) return;
const std::vector<cvf::Vec3d> wellPoints = { polyLines[0][0], polyLines[0][1] };
RimModeledWellPath* faceAWellPath = new RimModeledWellPath;
RimModeledWellPath* faceBWellPath = new RimModeledWellPath;
auto* faceAWellPathGeometryDef = faceAWellPath->geometryDefinition();
auto* faceBWellPathGeometryDef = faceBWellPath->geometryDefinition();
if ( !faceAWellPathGeometryDef || !faceBWellPathGeometryDef ) return;
faceAWellPath->setName( "Fault Face A Well" );
faceBWellPath->setName( "Fault Face B Well" );
faceAWellPathGeometryDef->createAndInsertTargets( wellPoints );
faceBWellPathGeometryDef->createAndInsertTargets( wellPoints );
faceAWellPathGeometryDef->setUseAutoGeneratedTargetAtSeaLevel( false );
faceBWellPathGeometryDef->setUseAutoGeneratedTargetAtSeaLevel( false );
faceAWellPath->createWellPathGeometry();
faceBWellPath->createWellPathGeometry();
RimWellPathCollection* wellPathCollection = RimProject::current()->activeOilField()->wellPathCollection();
if ( wellPathCollection )
{
wellPathCollection->addWellPath( faceAWellPath );
wellPathCollection->addWellPath( faceBWellPath );
wellPathCollection->uiCapability()->updateConnectedEditors();
RimProject::current()->scheduleCreateDisplayModelAndRedrawAllViews();
}
// Add well paths to internal storage?
// Apply m_wellDistanceFromIntersection and m_wellWidthOutsideIntersection for adjustement of well paths
// Find vector normal onto intersection plane, i.e. cross product of z-axis and wellpath angle
// Create vector from first and last point in well paths/ wellPoints and use w/ z-axis to create normal vector with cross product
}
// if ( changedField == objectToggleField() )
//{
// RimGeoMechView* ownerView;
// firstAncestorOrThisOfType( ownerView );
// if ( ownerView ) ownerView->scheduleCreateDisplayModelAndRedraw();
// }
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RimGeoMechFaultReactivationResult::defineEditorAttribute( const caf::PdmFieldHandle* field,
QString uiConfigName,
caf::PdmUiEditorAttribute* attribute )
{
if ( field == &m_createFaultReactivationResult )
{
caf::PdmUiPushButtonEditorAttribute* attrib = dynamic_cast<caf::PdmUiPushButtonEditorAttribute*>( attribute );
if ( attrib )
{
attrib->m_buttonText = "Apply";
}
}
}
@@ -0,0 +1,54 @@
/////////////////////////////////////////////////////////////////////////////////
//
// Copyright (C) 2023- 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 "RimCheckableNamedObject.h"
#include "RimExtrudedCurveIntersection.h"
#include "RimIntersectionResultsDefinitionCollection.h"
#include "cafPdmField.h"
#include "cafPdmObject.h"
#include "cafPdmPtrField.h"
#include "cvfVector3.h"
#include <vector>
class RimGeoMechFaultReactivationResult : public caf::PdmObject
{
CAF_PDM_HEADER_INIT;
public:
RimGeoMechFaultReactivationResult();
~RimGeoMechFaultReactivationResult() override;
private:
QList<caf::PdmOptionItemInfo> calculateValueOptions( const caf::PdmFieldHandle* fieldNeedingOptions ) override;
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:
caf::PdmPtrField<RimExtrudedCurveIntersection*> m_intersection;
caf::PdmField<bool> m_createFaultReactivationResult;
// TODO: Remove "well" from name?
caf::PdmField<double> m_wellDistanceFromIntersection; // To move wells to each side of intersection
caf::PdmField<double> m_wellWidthOutsideIntersection; // To stretch well points outside intersection
};
@@ -37,6 +37,7 @@
#include "RimEclipseView.h"
#include "RimGeoMechCase.h"
#include "RimGeoMechCellColors.h"
#include "RimGeoMechFaultReactivationResult.h"
#include "RimGeoMechPart.h"
#include "RimGeoMechPartCollection.h"
#include "RimGeoMechPropertyFilterCollection.h"
@@ -98,6 +99,9 @@ RimGeoMechView::RimGeoMechView()
m_tensorResults = new RimTensorResults();
m_tensorResults.uiCapability()->setUiTreeHidden( true );
CAF_PDM_InitFieldNoDefault( &m_faultReactivationResult, "FaultReactivationResult", "Fault Reactivation Result" );
m_faultReactivationResult = new RimGeoMechFaultReactivationResult();
CAF_PDM_InitFieldNoDefault( &m_propertyFilterCollection, "PropertyFilters", "Property Filters" );
m_propertyFilterCollection = new RimGeoMechPropertyFilterCollection();
m_propertyFilterCollection.uiCapability()->setUiTreeHidden( true );
@@ -132,6 +136,7 @@ RimGeoMechView::~RimGeoMechView()
delete m_tensorResults;
delete cellResult;
delete m_propertyFilterCollection;
delete m_faultReactivationResult;
}
//--------------------------------------------------------------------------------------------------
@@ -1051,6 +1056,7 @@ void RimGeoMechView::defineUiTreeOrdering( caf::PdmUiTreeOrdering& uiTreeOrderin
uiTreeOrdering.add( m_tensorResults() );
uiTreeOrdering.add( m_cellFilterCollection() );
uiTreeOrdering.add( m_propertyFilterCollection() );
uiTreeOrdering.add( m_faultReactivationResult() );
addRequiredUiTreeObjects( uiTreeOrdering );
@@ -37,6 +37,7 @@ class Rim3dOverlayInfoConfig;
class RimCellRangeFilterCollection;
class RimGeoMechCase;
class RimGeoMechCellColors;
class RimGeoMechFaultReactivationResult;
class RimGeoMechPartCollection;
class RimGeoMechPropertyFilterCollection;
class RimGeoMechResultDefinition;
@@ -150,6 +151,7 @@ private:
caf::PdmChildField<RimTensorResults*> m_tensorResults;
caf::PdmChildField<RimGeoMechPropertyFilterCollection*> m_propertyFilterCollection;
caf::PdmChildField<RimGeoMechFaultReactivationResult*> m_faultReactivationResult;
caf::PdmPointer<RimGeoMechPropertyFilterCollection> m_overridePropertyFilterCollection;
caf::PdmChildField<RimGeoMechPartCollection*> m_partsCollection;
caf::PdmPointer<RimGeoMechCase> m_geomechCase;
@@ -236,7 +236,7 @@ void RimWellPathGeometryDef::setFixedMeasuredDepths( const std::vector<double>&
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
std::vector<RimWellPathTarget*> RimWellPathGeometryDef::createTargets( const std::vector<cvf::Vec3d>& points )
std::vector<RimWellPathTarget*> RimWellPathGeometryDef::createAndInsertTargets( const std::vector<cvf::Vec3d>& points )
{
CAF_ASSERT( points.size() >= 2u );
@@ -66,7 +66,7 @@ public:
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::vector<RimWellPathTarget*> createAndInsertTargets( const std::vector<cvf::Vec3d>& points );
std::pair<RimWellPathTarget*, RimWellPathTarget*> findActiveTargetsAroundInsertionPoint( const RimWellPathTarget* targetToInsertBefore );