mirror of
https://github.com/OPM/ResInsight.git
synced 2025-02-25 18:55:39 -06:00
#9323 Thermal Fracture: add python methods for importing fracture template.
Fixes #9323.
This commit is contained in:
@@ -20,12 +20,13 @@
|
||||
#include "FractureCommands/RicFractureNameGenerator.h"
|
||||
#include "FractureCommands/RicNewStimPlanFractureTemplateFeature.h"
|
||||
#include "FractureCommands/RicNewStimPlanModelFeature.h"
|
||||
#include "FractureCommands/RicNewThermalFractureTemplateFeature.h"
|
||||
|
||||
#include "RimEclipseCase.h"
|
||||
#include "RimFractureTemplate.h"
|
||||
|
||||
#include "RimFractureTemplateCollection.h"
|
||||
#include "RimStimPlanFractureTemplate.h"
|
||||
#include "RimThermalFractureTemplate.h"
|
||||
|
||||
#include "cafPdmAbstractFieldScriptingCapability.h"
|
||||
#include "cafPdmFieldScriptingCapability.h"
|
||||
@@ -78,3 +79,52 @@ std::unique_ptr<caf::PdmObjectHandle> RimcFractureTemplateCollection_appendFract
|
||||
{
|
||||
return std::unique_ptr<caf::PdmObjectHandle>( new RimStimPlanFractureTemplate );
|
||||
}
|
||||
|
||||
CAF_PDM_OBJECT_METHOD_SOURCE_INIT( RimFractureTemplateCollection,
|
||||
RimcFractureTemplateCollection_appendThermalFractureTemplate,
|
||||
"AppendThermalFractureTemplate" );
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
RimcFractureTemplateCollection_appendThermalFractureTemplate::RimcFractureTemplateCollection_appendThermalFractureTemplate(
|
||||
caf::PdmObjectHandle* self )
|
||||
: caf::PdmObjectMethod( self )
|
||||
{
|
||||
CAF_PDM_InitObject( "Create Fracture Template", "", "", "Create a new Thermal Fracture Template" );
|
||||
CAF_PDM_InitScriptableFieldNoDefault( &m_filePath, "FilePath", "", "", "", "File Path to Thermal Fracture CSV File" );
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
caf::PdmObjectHandle* RimcFractureTemplateCollection_appendThermalFractureTemplate::execute()
|
||||
{
|
||||
RimFractureTemplateCollection* fractureTemplateCollection = self<RimFractureTemplateCollection>();
|
||||
|
||||
bool reuseExistingTemplatesWithMatchingNames = false;
|
||||
auto newTemplates =
|
||||
RicNewThermalFractureTemplateFeature::createNewTemplatesFromFiles( { m_filePath },
|
||||
reuseExistingTemplatesWithMatchingNames );
|
||||
|
||||
if ( newTemplates.empty() ) return nullptr;
|
||||
|
||||
fractureTemplateCollection->updateAllRequiredEditors();
|
||||
return newTemplates[0];
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
bool RimcFractureTemplateCollection_appendThermalFractureTemplate::resultIsPersistent() const
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
std::unique_ptr<caf::PdmObjectHandle> RimcFractureTemplateCollection_appendThermalFractureTemplate::defaultResult() const
|
||||
{
|
||||
return std::unique_ptr<caf::PdmObjectHandle>( new RimThermalFractureTemplate );
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user