mirror of
https://github.com/OPM/ResInsight.git
synced 2025-02-25 18:55:39 -06:00
Support for copying GeoMech case settings using new input (#6471)
* Support copy and replace geomech case, to support importing another data file, but keep the view setup * Make sure surfaces and intersections get updated with the correct separate result, too * Simplify/refactor code * Better naming
This commit is contained in:
@@ -19,7 +19,14 @@
|
||||
|
||||
#include "RimGeoMechModels.h"
|
||||
|
||||
#include "RiaLogging.h"
|
||||
|
||||
#include "RimGeoMechCase.h"
|
||||
#include "RimGeoMechView.h"
|
||||
#include "RimGridView.h"
|
||||
#include "RimIntersectionCollection.h"
|
||||
#include "RimIntersectionResultDefinition.h"
|
||||
#include "RimIntersectionResultsDefinitionCollection.h"
|
||||
|
||||
CAF_PDM_SOURCE_INIT( RimGeoMechModels, "ResInsightGeoMechModels" );
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
@@ -29,8 +36,8 @@ RimGeoMechModels::RimGeoMechModels( void )
|
||||
{
|
||||
CAF_PDM_InitObject( "Geomechanical Models", ":/GeoMechCases48x48.png", "", "" );
|
||||
|
||||
CAF_PDM_InitFieldNoDefault( &cases, "Cases", "", "", "", "" );
|
||||
cases.uiCapability()->setUiHidden( true );
|
||||
CAF_PDM_InitFieldNoDefault( &m_cases, "Cases", "", "", "", "" );
|
||||
m_cases.uiCapability()->setUiHidden( true );
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
@@ -38,5 +45,74 @@ RimGeoMechModels::RimGeoMechModels( void )
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
RimGeoMechModels::~RimGeoMechModels( void )
|
||||
{
|
||||
cases.deleteAllChildObjects();
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
std::vector<RimGeoMechCase*> RimGeoMechModels::cases() const
|
||||
{
|
||||
return m_cases.childObjects();
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimGeoMechModels::addCase( RimGeoMechCase* thecase )
|
||||
{
|
||||
m_cases.push_back( thecase );
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimGeoMechModels::removeCase( RimGeoMechCase* thecase )
|
||||
{
|
||||
m_cases.removeChildObject( thecase );
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
RimGeoMechCase* RimGeoMechModels::copyCase( RimGeoMechCase* thecase, const QString& newInputFileName )
|
||||
{
|
||||
std::vector<RimGeoMechCase*> newcases;
|
||||
|
||||
RimGeoMechCase* copy = thecase->createCopy( newInputFileName );
|
||||
if ( !copy )
|
||||
{
|
||||
RiaLogging::warning( "Could not create a copy of the geomech case" + thecase->caseUserDescription() +
|
||||
" using the new input file " + newInputFileName );
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
m_cases.push_back( copy );
|
||||
|
||||
copy->resolveReferencesRecursively();
|
||||
|
||||
copy->updateConnectedEditors();
|
||||
this->updateConnectedEditors();
|
||||
|
||||
for ( auto riv : copy->views() )
|
||||
{
|
||||
RimGridView* rgv = dynamic_cast<RimGridView*>( riv );
|
||||
if ( rgv )
|
||||
{
|
||||
rgv->loadDataAndUpdate();
|
||||
rgv->scheduleCreateDisplayModelAndRedraw();
|
||||
rgv->intersectionCollection()->scheduleCreateDisplayModelAndRedraw2dIntersectionViews();
|
||||
|
||||
for ( auto coll : rgv->separateIntersectionResultsCollection()->intersectionResultsDefinitions() )
|
||||
{
|
||||
coll->update2dIntersectionViews();
|
||||
}
|
||||
|
||||
for ( auto coll : rgv->separateSurfaceResultsCollection()->intersectionResultsDefinitions() )
|
||||
{
|
||||
coll->update2dIntersectionViews();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return copy;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user