mirror of
https://github.com/OPM/ResInsight.git
synced 2025-02-25 18:55:39 -06:00
#6232 Add python api for creating fracture model.
This commit is contained in:
parent
1e42a2f690
commit
a79b794eab
@ -46,21 +46,22 @@ CAF_CMD_SOURCE_INIT( RicNewFractureModelFeature, "RicNewFractureModelFeature" );
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RicNewFractureModelFeature::addFractureModel( RimWellPath* wellPath, RimWellPathCollection* wellPathCollection )
|
||||
RimFractureModel* RicNewFractureModelFeature::addFractureModel( RimWellPath* wellPath,
|
||||
RimWellPathCollection* wellPathCollection )
|
||||
{
|
||||
CVF_ASSERT( wellPath );
|
||||
|
||||
if ( !RicWellPathsUnitSystemSettingsImpl::ensureHasUnitSystem( wellPath ) ) return;
|
||||
if ( !RicWellPathsUnitSystemSettingsImpl::ensureHasUnitSystem( wellPath ) ) return nullptr;
|
||||
|
||||
RimFractureModelCollection* fractureModelCollection = wellPath->fractureModelCollection();
|
||||
CVF_ASSERT( fractureModelCollection );
|
||||
|
||||
RimFractureModel* fractureModel = new RimFractureModel();
|
||||
fractureModelCollection->addFractureModel( fractureModel );
|
||||
|
||||
RimOilField* oilfield = nullptr;
|
||||
fractureModelCollection->firstAncestorOrThisOfType( oilfield );
|
||||
if ( !oilfield ) return;
|
||||
if ( !oilfield ) return nullptr;
|
||||
|
||||
RimFractureModel* fractureModel = new RimFractureModel();
|
||||
fractureModelCollection->addFractureModel( fractureModel );
|
||||
|
||||
QString fractureModelName = RicFractureNameGenerator::nameForNewFractureModel();
|
||||
fractureModel->setName( fractureModelName );
|
||||
@ -82,6 +83,7 @@ void RicNewFractureModelFeature::addFractureModel( RimWellPath* wellPath, RimWel
|
||||
}
|
||||
|
||||
Riu3DMainWindowTools::selectAsCurrentItem( fractureModel );
|
||||
return fractureModel;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
|
@ -20,6 +20,7 @@
|
||||
|
||||
#include "cafCmdFeature.h"
|
||||
|
||||
class RimFractureModel;
|
||||
class RimFractureModelCollection;
|
||||
class RimWellPath;
|
||||
class RimWellPathCollection;
|
||||
@ -32,7 +33,7 @@ class RicNewFractureModelFeature : public caf::CmdFeature
|
||||
CAF_CMD_HEADER_INIT;
|
||||
|
||||
public:
|
||||
static void addFractureModel( RimWellPath* wellPath, RimWellPathCollection* wellPathCollection );
|
||||
static RimFractureModel* addFractureModel( RimWellPath* wellPath, RimWellPathCollection* wellPathCollection );
|
||||
|
||||
protected:
|
||||
void onActionTriggered( bool isChecked ) override;
|
||||
|
@ -829,3 +829,13 @@ void RimFractureModel::updateReferringPlots()
|
||||
if ( modelPlot ) modelPlot->loadDataAndUpdate();
|
||||
}
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimFractureModel::setMD( double md )
|
||||
{
|
||||
m_MD = md;
|
||||
updatePositionFromMeasuredDepth();
|
||||
updateThicknessDirection();
|
||||
}
|
||||
|
@ -55,6 +55,8 @@ public:
|
||||
RimFractureModel( void );
|
||||
~RimFractureModel( void ) override;
|
||||
|
||||
void setMD( double md );
|
||||
|
||||
cvf::Vec3d anchorPosition() const;
|
||||
cvf::Vec3d thicknessDirection() const;
|
||||
|
||||
|
@ -4,6 +4,7 @@ ${CMAKE_CURRENT_LIST_DIR}/RimcSummaryPlotCollection.h
|
||||
${CMAKE_CURRENT_LIST_DIR}/RimcSummaryCase.h
|
||||
${CMAKE_CURRENT_LIST_DIR}/RimcSummaryResampleData.h
|
||||
${CMAKE_CURRENT_LIST_DIR}/RimcProject.h
|
||||
${CMAKE_CURRENT_LIST_DIR}/RimcFractureModelCollection.h
|
||||
|
||||
${CMAKE_CURRENT_LIST_DIR}/RimcDataContainerDouble.h
|
||||
${CMAKE_CURRENT_LIST_DIR}/RimcDataContainerString.h
|
||||
@ -15,6 +16,7 @@ ${CMAKE_CURRENT_LIST_DIR}/RimcSummaryPlotCollection.cpp
|
||||
${CMAKE_CURRENT_LIST_DIR}/RimcSummaryCase.cpp
|
||||
${CMAKE_CURRENT_LIST_DIR}/RimcSummaryResampleData.cpp
|
||||
${CMAKE_CURRENT_LIST_DIR}/RimcProject.cpp
|
||||
${CMAKE_CURRENT_LIST_DIR}/RimcFractureModelCollection.cpp
|
||||
|
||||
${CMAKE_CURRENT_LIST_DIR}/RimcDataContainerDouble.cpp
|
||||
${CMAKE_CURRENT_LIST_DIR}/RimcDataContainerString.cpp
|
||||
|
@ -0,0 +1,83 @@
|
||||
/////////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// 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 "RimcFractureModelCollection.h"
|
||||
|
||||
#include "FractureCommands/RicNewFractureModelFeature.h"
|
||||
|
||||
#include "RimFractureModel.h"
|
||||
#include "RimFractureModelCollection.h"
|
||||
#include "RimWellPath.h"
|
||||
#include "RimWellPathCollection.h"
|
||||
|
||||
#include "cafPdmFieldIOScriptability.h"
|
||||
#include "cafPdmFieldScriptability.h"
|
||||
|
||||
CAF_PDM_OBJECT_METHOD_SOURCE_INIT( RimFractureModelCollection,
|
||||
RimcFractureModelCollection_newFractureModel,
|
||||
"NewFractureModel" );
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
RimcFractureModelCollection_newFractureModel::RimcFractureModelCollection_newFractureModel( caf::PdmObjectHandle* self )
|
||||
: caf::PdmObjectMethod( self )
|
||||
{
|
||||
CAF_PDM_InitObject( "Create Fracture Model", "", "", "Create a new Fracture Model" );
|
||||
CAF_PDM_InitScriptableFieldWithIONoDefault( &m_wellPath, "WellPath", "", "", "", "Well Path" );
|
||||
CAF_PDM_InitScriptableFieldWithIONoDefault( &m_md, "MeasuredDepth", "", "", "", "Measured Depth" );
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
caf::PdmObjectHandle* RimcFractureModelCollection_newFractureModel::execute()
|
||||
{
|
||||
RimFractureModel* newFractureModel = nullptr;
|
||||
if ( m_wellPath )
|
||||
{
|
||||
RimFractureModelCollection* fractureModelCollection = self<RimFractureModelCollection>();
|
||||
RimWellPathCollection* wellPathCollection = nullptr;
|
||||
fractureModelCollection->firstAncestorOrThisOfTypeAsserted( wellPathCollection );
|
||||
|
||||
newFractureModel = RicNewFractureModelFeature::addFractureModel( m_wellPath, wellPathCollection );
|
||||
}
|
||||
|
||||
if ( newFractureModel )
|
||||
{
|
||||
newFractureModel->setMD( m_md() );
|
||||
self<RimFractureModelCollection>()->updateAllRequiredEditors();
|
||||
}
|
||||
|
||||
return newFractureModel;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
bool RimcFractureModelCollection_newFractureModel::resultIsPersistent() const
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
std::unique_ptr<caf::PdmObjectHandle> RimcFractureModelCollection_newFractureModel::defaultResult() const
|
||||
{
|
||||
return std::unique_ptr<caf::PdmObjectHandle>( new RimFractureModel );
|
||||
}
|
@ -0,0 +1,49 @@
|
||||
/////////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// 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 "RimFractureModelCollection.h"
|
||||
|
||||
#include "cafPdmField.h"
|
||||
#include "cafPdmObjectHandle.h"
|
||||
#include "cafPdmObjectMethod.h"
|
||||
#include "cafPdmPtrArrayField.h"
|
||||
#include "cafPdmPtrField.h"
|
||||
|
||||
class RimFractureModelCollection;
|
||||
class RimWellPath;
|
||||
|
||||
//==================================================================================================
|
||||
///
|
||||
//==================================================================================================
|
||||
class RimcFractureModelCollection_newFractureModel : public caf::PdmObjectMethod
|
||||
{
|
||||
CAF_PDM_HEADER_INIT;
|
||||
|
||||
public:
|
||||
RimcFractureModelCollection_newFractureModel( caf::PdmObjectHandle* self );
|
||||
|
||||
caf::PdmObjectHandle* execute();
|
||||
bool resultIsPersistent() const override;
|
||||
std::unique_ptr<PdmObjectHandle> defaultResult() const override;
|
||||
|
||||
private:
|
||||
caf::PdmPtrField<RimWellPath*> m_wellPath;
|
||||
caf::PdmField<double> m_md;
|
||||
};
|
Loading…
Reference in New Issue
Block a user