Files
ResInsight/ApplicationLibCode/ProjectDataModelCommands/RimcFractureTemplateCollection.cpp
T
Magne Sjaastad 544e9eedd9 Improve spell checker using codespell
* Configures automated spell checking with codespell
Adds GitHub workflows and configuration files for automated spell checking using `codespell`.

This includes:
- A workflow for checking pull requests and preventing new typos
- A workflow for automatically fixing typos in the main codebase
- Configuration files for `codespell` to ignore specific terms and file types
- Documentation on how to use and configure the spell checking workflows.

* Corrects minor spelling and grammar errors.
2025-11-19 10:25:32 +01:00

113 lines
5.2 KiB
C++

/////////////////////////////////////////////////////////////////////////////////
//
// Copyright (C) 2021- 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 "RimcFractureTemplateCollection.h"
#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"
CAF_PDM_OBJECT_METHOD_SOURCE_INIT( RimFractureTemplateCollection,
RimcFractureTemplateCollection_appendFractureTemplate,
"AppendFractureTemplate" );
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
RimcFractureTemplateCollection_appendFractureTemplate::RimcFractureTemplateCollection_appendFractureTemplate( caf::PdmObjectHandle* self )
: caf::PdmObjectCreationMethod( self )
{
CAF_PDM_InitObject( "Create Fracture Template", "", "", "Create a new StimPlan Fracture Template" );
CAF_PDM_InitScriptableFieldNoDefault( &m_filePath, "FilePath", "", "", "", "File Path to StimPlan Contour File" );
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
std::expected<caf::PdmObjectHandle*, QString> RimcFractureTemplateCollection_appendFractureTemplate::execute()
{
RimFractureTemplateCollection* stimPlanModelTemplateCollection = self<RimFractureTemplateCollection>();
bool reuseExistingTemplatesWithMatchingNames = false;
auto newTemplates =
RicNewStimPlanFractureTemplateFeature::createNewTemplatesFromFiles( { m_filePath }, reuseExistingTemplatesWithMatchingNames );
if ( newTemplates.empty() ) return nullptr;
stimPlanModelTemplateCollection->updateAllRequiredEditors();
return newTemplates[0];
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
QString RimcFractureTemplateCollection_appendFractureTemplate::classKeywordReturnedType() const
{
return RimStimPlanFractureTemplate::classKeywordStatic();
}
CAF_PDM_OBJECT_METHOD_SOURCE_INIT( RimFractureTemplateCollection,
RimcFractureTemplateCollection_appendThermalFractureTemplate,
"AppendThermalFractureTemplate" );
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
RimcFractureTemplateCollection_appendThermalFractureTemplate::RimcFractureTemplateCollection_appendThermalFractureTemplate( caf::PdmObjectHandle* self )
: caf::PdmObjectCreationMethod( 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" );
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
std::expected<caf::PdmObjectHandle*, QString> 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];
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
QString RimcFractureTemplateCollection_appendThermalFractureTemplate::classKeywordReturnedType() const
{
return RimThermalFractureTemplate::classKeywordStatic();
}