#6234 Fracture Model: add template to enable data sharing.

This commit is contained in:
Kristian Bendiksen
2020-09-22 15:53:17 +02:00
parent c325dce252
commit 851e245f83
25 changed files with 1101 additions and 213 deletions

View File

@@ -14,6 +14,7 @@ ${CMAKE_CURRENT_LIST_DIR}/RicNewWellPathFractureAtPosFeature.h
${CMAKE_CURRENT_LIST_DIR}/RicNewWellPathFractureFeature.h
${CMAKE_CURRENT_LIST_DIR}/RicNewFractureModelFeature.h
${CMAKE_CURRENT_LIST_DIR}/RicNewWellPathFractureModelAtPosFeature.h
${CMAKE_CURRENT_LIST_DIR}/RicNewFractureModelTemplateFeature.h
${CMAKE_CURRENT_LIST_DIR}/RicCreateMultipleFracturesFeature.h
${CMAKE_CURRENT_LIST_DIR}/RicCreateMultipleFracturesOptionItemUi.h
@@ -37,6 +38,7 @@ ${CMAKE_CURRENT_LIST_DIR}/RicNewWellPathFractureAtPosFeature.cpp
${CMAKE_CURRENT_LIST_DIR}/RicNewWellPathFractureFeature.cpp
${CMAKE_CURRENT_LIST_DIR}/RicNewFractureModelFeature.cpp
${CMAKE_CURRENT_LIST_DIR}/RicNewWellPathFractureModelAtPosFeature.cpp
${CMAKE_CURRENT_LIST_DIR}/RicNewFractureModelTemplateFeature.cpp
${CMAKE_CURRENT_LIST_DIR}/RicCreateMultipleFracturesFeature.cpp
${CMAKE_CURRENT_LIST_DIR}/RicCreateMultipleFracturesOptionItemUi.cpp

View File

@@ -0,0 +1,73 @@
/////////////////////////////////////////////////////////////////////////////////
//
// 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 "RicNewFractureModelTemplateFeature.h"
#include "RimCompletionTemplateCollection.h"
#include "RimFractureModelTemplate.h"
#include "RimFractureModelTemplateCollection.h"
#include "RimOilField.h"
#include "RimProject.h"
#include "Riu3DMainWindowTools.h"
#include "cafSelectionManager.h"
#include "cvfAssert.h"
#include <QAction>
CAF_CMD_SOURCE_INIT( RicNewFractureModelTemplateFeature, "RicNewFractureModelTemplateFeature" );
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RicNewFractureModelTemplateFeature::onActionTriggered( bool isChecked )
{
RimProject* project = RimProject::current();
CVF_ASSERT( project );
RimOilField* oilfield = project->activeOilField();
if ( !oilfield ) return;
RimFractureModelTemplateCollection* fracModColl =
oilfield->completionTemplateCollection->fractureModelTemplateCollection();
if ( !fracModColl ) return;
RimFractureModelTemplate* fractureModelTemplate = new RimFractureModelTemplate;
fracModColl->addFractureModelTemplate( fractureModelTemplate );
fracModColl->updateConnectedEditors();
Riu3DMainWindowTools::selectAsCurrentItem( fractureModelTemplate );
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RicNewFractureModelTemplateFeature::setupActionLook( QAction* actionToSetup )
{
actionToSetup->setIcon( QIcon( ":/FractureTemplate16x16.png" ) );
actionToSetup->setText( "New Fracture Model Template" );
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
bool RicNewFractureModelTemplateFeature::isCommandEnabled()
{
return true;
}

View File

@@ -0,0 +1,36 @@
/////////////////////////////////////////////////////////////////////////////////
//
// 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 "cafCmdFeature.h"
#include <vector>
//==================================================================================================
///
//==================================================================================================
class RicNewFractureModelTemplateFeature : public caf::CmdFeature
{
CAF_CMD_HEADER_INIT;
protected:
void onActionTriggered( bool isChecked ) override;
void setupActionLook( QAction* actionToSetup ) override;
bool isCommandEnabled() override;
};

View File

@@ -21,7 +21,7 @@
#include "RiaLogging.h"
#include "RimElasticProperties.h"
#include "RimFractureModel.h"
#include "RimFractureModelTemplate.h"
#include "RifCsvUserDataParser.h"
#include "RifElasticPropertiesReader.h"
@@ -35,8 +35,8 @@
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RicElasticPropertiesImportTools::importElasticPropertiesFromFile( const QString& filePath,
RimFractureModel* fractureModel )
void RicElasticPropertiesImportTools::importElasticPropertiesFromFile( const QString& filePath,
RimFractureModelTemplate* fractureModelTemplate )
{
RifCsvUserDataFileParser csvParser( filePath );
QString separator = csvParser.tryDetermineCellSeparator();
@@ -110,6 +110,6 @@ void RicElasticPropertiesImportTools::importElasticPropertiesFromFile( const QSt
}
rimElasticProperties->setFilePath( filePath );
fractureModel->setElasticProperties( rimElasticProperties );
fractureModel->updateConnectedEditors();
fractureModelTemplate->setElasticProperties( rimElasticProperties );
fractureModelTemplate->updateConnectedEditors();
}

View File

@@ -20,7 +20,7 @@
#include <QString>
class RimFractureModel;
class RimFractureModelTemplate;
//--------------------------------------------------------------------------------------------------
///
@@ -28,7 +28,7 @@ class RimFractureModel;
class RicElasticPropertiesImportTools
{
public:
static void importElasticPropertiesFromFile( const QString& filePath, RimFractureModel* fractureModel );
static void importElasticPropertiesFromFile( const QString& filePath, RimFractureModelTemplate* fractureModelTemplate );
private:
// Hidden to avoid instantiation

View File

@@ -28,7 +28,7 @@
#include "RimColorLegendCollection.h"
#include "RimColorLegendItem.h"
#include "RimFaciesProperties.h"
#include "RimFractureModel.h"
#include "RimFractureModelTemplate.h"
#include "RimProject.h"
#include "RifColorLegendData.h"
@@ -39,9 +39,9 @@
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RicFaciesPropertiesImportTools::importFaciesPropertiesFromFile( const QString& filePath,
RimFractureModel* fractureModel,
bool createColorLegend )
void RicFaciesPropertiesImportTools::importFaciesPropertiesFromFile( const QString& filePath,
RimFractureModelTemplate* fractureModelTemplate,
bool createColorLegend )
{
if ( filePath.isEmpty() ) return;
@@ -56,7 +56,7 @@ void RicFaciesPropertiesImportTools::importFaciesPropertiesFromFile( const QStri
return;
}
RimFaciesProperties* faciesProperties = fractureModel->faciesProperties();
RimFaciesProperties* faciesProperties = fractureModelTemplate->faciesProperties();
if ( !faciesProperties )
{
faciesProperties = new RimFaciesProperties;
@@ -99,7 +99,8 @@ void RicFaciesPropertiesImportTools::importFaciesPropertiesFromFile( const QStri
faciesProperties->setFilePath( filePath );
fractureModel->setFaciesProperties( faciesProperties );
fractureModelTemplate->setFaciesProperties( faciesProperties );
fractureModelTemplate->updateConnectedEditors();
}
//--------------------------------------------------------------------------------------------------

View File

@@ -19,7 +19,7 @@
#pragma once
class RimColorLegend;
class RimFractureModel;
class RimFractureModelTemplate;
namespace cvf
{
@@ -34,9 +34,9 @@ class QString;
class RicFaciesPropertiesImportTools
{
public:
static void importFaciesPropertiesFromFile( const QString& filePath,
RimFractureModel* fractureModel,
bool createColorLegend = false );
static void importFaciesPropertiesFromFile( const QString& filePath,
RimFractureModelTemplate* fractureModelTemplate,
bool createColorLegend = false );
private:
static int computeEditDistance( const QString& a, const QString& b );

View File

@@ -22,7 +22,7 @@
#include "RicElasticPropertiesImportTools.h"
#include "RimFractureModel.h"
#include "RimFractureModelTemplate.h"
#include "Riu3DMainWindowTools.h"
#include "RiuFileDialogTools.h"
@@ -47,8 +47,9 @@ bool RicImportElasticPropertiesFeature::isCommandEnabled()
//--------------------------------------------------------------------------------------------------
void RicImportElasticPropertiesFeature::onActionTriggered( bool isChecked )
{
RimFractureModel* fractureModel = caf::SelectionManager::instance()->selectedItemAncestorOfType<RimFractureModel>();
if ( !fractureModel ) return;
RimFractureModelTemplate* fractureModelTemplate =
caf::SelectionManager::instance()->selectedItemAncestorOfType<RimFractureModelTemplate>();
if ( !fractureModelTemplate ) return;
// Open dialog box to select files
RiaApplication* app = RiaApplication::instance();
@@ -63,7 +64,7 @@ void RicImportElasticPropertiesFeature::onActionTriggered( bool isChecked )
// Remember the path to next time
app->setLastUsedDialogDirectory( "STIMPLAN_DIR", QFileInfo( filePath ).absolutePath() );
RicElasticPropertiesImportTools::importElasticPropertiesFromFile( filePath, fractureModel );
RicElasticPropertiesImportTools::importElasticPropertiesFromFile( filePath, fractureModelTemplate );
}
//--------------------------------------------------------------------------------------------------

View File

@@ -25,7 +25,7 @@
#include "RicFaciesPropertiesImportTools.h"
#include "RimFractureModel.h"
#include "RimFractureModelTemplate.h"
#include "cafSelectionManager.h"
@@ -47,8 +47,9 @@ bool RicImportFaciesFeature::isCommandEnabled()
//--------------------------------------------------------------------------------------------------
void RicImportFaciesFeature::onActionTriggered( bool isChecked )
{
RimFractureModel* fractureModel = caf::SelectionManager::instance()->selectedItemAncestorOfType<RimFractureModel>();
if ( !fractureModel ) return;
RimFractureModelTemplate* fractureModelTemplate =
caf::SelectionManager::instance()->selectedItemAncestorOfType<RimFractureModelTemplate>();
if ( !fractureModelTemplate ) return;
RiaApplication* app = RiaApplication::instance();
QString defaultDir = app->lastUsedDialogDirectoryWithFallbackToProjectFolder( "STIMPLAN_DIR" );
@@ -66,7 +67,7 @@ void RicImportFaciesFeature::onActionTriggered( bool isChecked )
app->setLastUsedDialogDirectory( "STIMPLAN_DIR", QFileInfo( fileName ).absolutePath() );
bool createColorLegend = true;
RicFaciesPropertiesImportTools::importFaciesPropertiesFromFile( fileName, fractureModel, createColorLegend );
RicFaciesPropertiesImportTools::importFaciesPropertiesFromFile( fileName, fractureModelTemplate, createColorLegend );
}
//--------------------------------------------------------------------------------------------------