mirror of
https://github.com/OPM/ResInsight.git
synced 2025-02-25 18:55:39 -06:00
Fault Reactivation Assessment implementation (ref issue #7321)
This commit is contained in:
@@ -2,11 +2,17 @@
|
||||
set (SOURCE_GROUP_HEADER_FILES
|
||||
${CMAKE_CURRENT_LIST_DIR}/RimFaultInView.h
|
||||
${CMAKE_CURRENT_LIST_DIR}/RimFaultInViewCollection.h
|
||||
${CMAKE_CURRENT_LIST_DIR}/RimFaultRASettings.h
|
||||
${CMAKE_CURRENT_LIST_DIR}/RimFaultRAPreprocSettings.h
|
||||
${CMAKE_CURRENT_LIST_DIR}/RimFaultRAPostprocSettings.h
|
||||
)
|
||||
|
||||
set (SOURCE_GROUP_SOURCE_FILES
|
||||
${CMAKE_CURRENT_LIST_DIR}/RimFaultInView.cpp
|
||||
${CMAKE_CURRENT_LIST_DIR}/RimFaultInViewCollection.cpp
|
||||
${CMAKE_CURRENT_LIST_DIR}/RimFaultRASettings.cpp
|
||||
${CMAKE_CURRENT_LIST_DIR}/RimFaultRAPreprocSettings.cpp
|
||||
${CMAKE_CURRENT_LIST_DIR}/RimFaultRAPostprocSettings.cpp
|
||||
)
|
||||
|
||||
list(APPEND CODE_HEADER_FILES
|
||||
|
@@ -27,8 +27,10 @@
|
||||
#include "RigMainGrid.h"
|
||||
|
||||
#include "RimEclipseCase.h"
|
||||
#include "RimEclipseInputCase.h"
|
||||
#include "RimEclipseView.h"
|
||||
#include "RimFaultInView.h"
|
||||
#include "RimFaultRASettings.h"
|
||||
#include "RimIntersectionCollection.h"
|
||||
|
||||
#include "RiuMainWindow.h"
|
||||
@@ -36,6 +38,7 @@
|
||||
#include "cafAppEnum.h"
|
||||
#include "cafPdmFieldCvfColor.h"
|
||||
#include "cafPdmFieldCvfMat4d.h"
|
||||
#include "cafPdmUiTreeOrdering.h"
|
||||
|
||||
namespace caf
|
||||
{
|
||||
@@ -89,6 +92,14 @@ RimFaultInViewCollection::RimFaultInViewCollection()
|
||||
|
||||
CAF_PDM_InitFieldNoDefault( &faults, "Faults", "Faults", "", "", "" );
|
||||
faults.uiCapability()->setUiHidden( true );
|
||||
|
||||
CAF_PDM_InitField( &m_enableFaultRA, "EnableFaultRA", false, "Enable Fault RA", "", "", "" );
|
||||
m_enableFaultRA.uiCapability()->setUiHidden( true );
|
||||
m_enableFaultRA.uiCapability()->setUiReadOnly( true );
|
||||
|
||||
CAF_PDM_InitFieldNoDefault( &m_faultRASettings, "FaultRASettings", "Reactivation Assessment Settings", "", "", "" );
|
||||
m_faultRASettings = new RimFaultRASettings();
|
||||
m_faultRASettings.uiCapability()->setUiHidden( true );
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
@@ -217,8 +228,6 @@ void RimFaultInViewCollection::syncronizeFaults()
|
||||
}
|
||||
}
|
||||
|
||||
// Find faults with
|
||||
|
||||
std::vector<caf::PdmPointer<RimFaultInView>> newFaults;
|
||||
|
||||
// Find corresponding fault from data model, or create a new
|
||||
@@ -297,6 +306,19 @@ void RimFaultInViewCollection::defineUiOrdering( QString uiConfigName, caf::PdmU
|
||||
uiOrderingFaults( uiConfigName, uiOrdering );
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimFaultInViewCollection::defineUiTreeOrdering( caf::PdmUiTreeOrdering& uiTreeOrdering, QString uiConfigName )
|
||||
{
|
||||
RimEclipseInputCase* inputCase = nullptr;
|
||||
this->firstAncestorOrThisOfType( inputCase );
|
||||
if ( ( inputCase != nullptr ) && m_enableFaultRA() )
|
||||
{
|
||||
uiTreeOrdering.add( &m_faultRASettings );
|
||||
}
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
@@ -325,3 +347,27 @@ void RimFaultInViewCollection::setShowFaultsOutsideFilter( bool show )
|
||||
{
|
||||
m_showFaultsOutsideFilters = show;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
RimFaultRASettings* RimFaultInViewCollection::faultRASettings() const
|
||||
{
|
||||
return m_faultRASettings();
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
bool RimFaultInViewCollection::faultRAEnabled() const
|
||||
{
|
||||
return m_enableFaultRA();
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimFaultInViewCollection::enableFaultRA( bool enable )
|
||||
{
|
||||
m_enableFaultRA = enable;
|
||||
}
|
||||
|
@@ -33,6 +33,7 @@
|
||||
|
||||
class RimEclipseView;
|
||||
class RimFaultInView;
|
||||
class RimFaultRASettings;
|
||||
|
||||
//==================================================================================================
|
||||
///
|
||||
@@ -61,6 +62,10 @@ public:
|
||||
bool isShowingFaultsAndFaultsOutsideFilters() const;
|
||||
void setShowFaultsOutsideFilter( bool show );
|
||||
|
||||
RimFaultRASettings* faultRASettings() const;
|
||||
bool faultRAEnabled() const;
|
||||
void enableFaultRA( bool enable );
|
||||
|
||||
caf::PdmField<bool> showFaultFaces;
|
||||
caf::PdmField<bool> showOppositeFaultFaces;
|
||||
|
||||
@@ -81,9 +86,15 @@ public:
|
||||
private:
|
||||
void fieldChangedByUi( const caf::PdmFieldHandle* changedField, const QVariant& oldValue, const QVariant& newValue ) override;
|
||||
caf::PdmFieldHandle* objectToggleField() override;
|
||||
void defineUiOrdering( QString uiConfigName, caf::PdmUiOrdering& uiOrdering ) override;
|
||||
RimEclipseView* parentView() const;
|
||||
|
||||
void defineUiOrdering( QString uiConfigName, caf::PdmUiOrdering& uiOrdering ) override;
|
||||
void defineUiTreeOrdering( caf::PdmUiTreeOrdering& uiTreeOrdering, QString uiConfigName = "" ) override;
|
||||
|
||||
RimEclipseView* parentView() const;
|
||||
|
||||
private:
|
||||
caf::PdmField<bool> m_showFaultsOutsideFilters;
|
||||
|
||||
caf::PdmChildField<RimFaultRASettings*> m_faultRASettings;
|
||||
caf::PdmField<bool> m_enableFaultRA;
|
||||
};
|
||||
|
@@ -0,0 +1,90 @@
|
||||
/////////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// 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 "RimFaultRAPostprocSettings.h"
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
RimFaultRAPostprocSettings::RimFaultRAPostprocSettings()
|
||||
{
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
RimFaultRAPostprocSettings::~RimFaultRAPostprocSettings()
|
||||
{
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimFaultRAPostprocSettings::setBaseDirectory( QString baseDir )
|
||||
{
|
||||
m_baseDir = baseDir + "/base_dir";
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimFaultRAPostprocSettings::setStepsToLoad( std::list<int> steps )
|
||||
{
|
||||
m_steps.clear();
|
||||
m_steps.insert( m_steps.begin(), steps.begin(), steps.end() );
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
std::list<int>& RimFaultRAPostprocSettings::stepsToLoad()
|
||||
{
|
||||
return m_steps;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
QString RimFaultRAPostprocSettings::postprocParameterFilename() const
|
||||
{
|
||||
return m_baseDir + "/post_processing.json";
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
QString RimFaultRAPostprocSettings::databaseDirectory() const
|
||||
{
|
||||
return m_baseDir;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
QString RimFaultRAPostprocSettings::macrisCalcCalibPath() const
|
||||
{
|
||||
return m_baseDir + "/MacrisCalcCalibration.sqlite3";
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
QString RimFaultRAPostprocSettings::macrisCalcPath() const
|
||||
{
|
||||
return m_baseDir + "/MacrisCalcResult.sqlite3";
|
||||
}
|
@@ -0,0 +1,43 @@
|
||||
/////////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// 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.
|
||||
//
|
||||
/////////////////////////////////////////////////////////////////////////////////
|
||||
#pragma once
|
||||
|
||||
#include <list>
|
||||
|
||||
#include <QString>
|
||||
|
||||
class RimFaultRAPostprocSettings
|
||||
{
|
||||
public:
|
||||
RimFaultRAPostprocSettings();
|
||||
~RimFaultRAPostprocSettings();
|
||||
|
||||
void setBaseDirectory( QString baseDir );
|
||||
void setStepsToLoad( std::list<int> steps );
|
||||
|
||||
std::list<int>& stepsToLoad();
|
||||
|
||||
QString postprocParameterFilename() const;
|
||||
QString databaseDirectory() const;
|
||||
QString macrisCalcCalibPath() const;
|
||||
QString macrisCalcPath() const;
|
||||
|
||||
protected:
|
||||
QString m_baseDir;
|
||||
std::list<int> m_steps;
|
||||
};
|
@@ -0,0 +1,427 @@
|
||||
/////////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// 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 "RimFaultRAPreprocSettings.h"
|
||||
|
||||
#include "RiaApplication.h"
|
||||
#include "RiaPreferences.h"
|
||||
#include "RimEclipseResultCase.h"
|
||||
#include "RimGeoMechCase.h"
|
||||
#include "RimProject.h"
|
||||
#include "RimTools.h"
|
||||
|
||||
#include "cafPdmFieldScriptingCapability.h"
|
||||
#include "cafPdmObjectScriptingCapability.h"
|
||||
#include "cafPdmUiComboBoxEditor.h"
|
||||
|
||||
#include <QDir>
|
||||
#include <QFileInfo>
|
||||
|
||||
CAF_PDM_SOURCE_INIT( RimFaultRAPreprocSettings, "RimFaultRAPreprocSettings" );
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
RimFaultRAPreprocSettings::RimFaultRAPreprocSettings()
|
||||
{
|
||||
CAF_PDM_InitObject( "Fault RA Preproc Settings", ":/fault_react_24x24.png", "", "" );
|
||||
|
||||
CAF_PDM_InitField( &m_startTimestepEclipse, "StartTimeStepEclipse", 0, "Start Time Step", "", "", "" );
|
||||
m_startTimestepEclipse.uiCapability()->setUiEditorTypeName( caf::PdmUiComboBoxEditor::uiEditorTypeName() );
|
||||
CAF_PDM_InitField( &m_endTimestepEclipse, "EndTimeStepEclipse", 0, "End Time Step", "", "", "" );
|
||||
m_endTimestepEclipse.uiCapability()->setUiEditorTypeName( caf::PdmUiComboBoxEditor::uiEditorTypeName() );
|
||||
|
||||
CAF_PDM_InitField( &m_startTimestepGeoMech, "StartTimeStepGeoMech", 0, "Start Time Step", "", "", "" );
|
||||
m_startTimestepGeoMech.uiCapability()->setUiEditorTypeName( caf::PdmUiComboBoxEditor::uiEditorTypeName() );
|
||||
CAF_PDM_InitField( &m_endTimestepGeoMech, "EndTimeStepGeoMech", 0, "End Time Step", "", "", "" );
|
||||
m_endTimestepGeoMech.uiCapability()->setUiEditorTypeName( caf::PdmUiComboBoxEditor::uiEditorTypeName() );
|
||||
|
||||
CAF_PDM_InitFieldNoDefault( &m_eclipseCase, "EclipseCase", "Eclipse Case", "", "", "" );
|
||||
m_eclipseCase.setValue( nullptr );
|
||||
|
||||
CAF_PDM_InitFieldNoDefault( &m_geomechCase, "GeomechCase", "GeoMech Case", "", "", "" );
|
||||
m_geomechCase.setValue( nullptr );
|
||||
|
||||
CAF_PDM_InitFieldNoDefault( &m_baseDir, "BaseDir", "Output Directory", "", "", "" );
|
||||
m_baseDir.uiCapability()->setUiReadOnly( true );
|
||||
|
||||
CAF_PDM_InitField( &m_cleanBaseDir, "CleanBaseDir", false, "Clean Output Directory", "", "", "" );
|
||||
CAF_PDM_InitField( &m_smoothEclipseData, "SmoothEclipseData", false, "Smooth Eclipse Data", "", "", "" );
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
RimFaultRAPreprocSettings::~RimFaultRAPreprocSettings()
|
||||
{
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimFaultRAPreprocSettings::fieldChangedByUi( const caf::PdmFieldHandle* changedField,
|
||||
const QVariant& oldValue,
|
||||
const QVariant& newValue )
|
||||
{
|
||||
if ( ( changedField == &m_eclipseCase ) && ( m_startTimestepEclipse == m_endTimestepEclipse ) )
|
||||
{
|
||||
m_endTimestepEclipse = m_eclipseCase()->timeStepStrings().size() - 1;
|
||||
}
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimFaultRAPreprocSettings::defineEditorAttribute( const caf::PdmFieldHandle* field,
|
||||
QString uiConfigName,
|
||||
caf::PdmUiEditorAttribute* attribute )
|
||||
{
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimFaultRAPreprocSettings::defineUiOrdering( QString uiConfigName, caf::PdmUiOrdering& uiOrdering )
|
||||
{
|
||||
if ( m_geomechCase() )
|
||||
{
|
||||
auto geomechGroup = uiOrdering.addNewGroup( "GeoMechanical Model" );
|
||||
geomechGroup->add( &m_geomechCase );
|
||||
geomechGroup->add( &m_startTimestepGeoMech );
|
||||
geomechGroup->add( &m_endTimestepGeoMech );
|
||||
}
|
||||
|
||||
auto eclipseGroup = uiOrdering.addNewGroup( "Eclipse Model" );
|
||||
eclipseGroup->add( &m_eclipseCase );
|
||||
eclipseGroup->add( &m_smoothEclipseData );
|
||||
eclipseGroup->add( &m_startTimestepEclipse );
|
||||
eclipseGroup->add( &m_endTimestepEclipse );
|
||||
|
||||
auto outputGroup = uiOrdering.addNewGroup( "Output Settings" );
|
||||
outputGroup->add( &m_baseDir );
|
||||
outputGroup->add( &m_cleanBaseDir );
|
||||
|
||||
uiOrdering.skipRemainingFields( true );
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
QList<caf::PdmOptionItemInfo>
|
||||
RimFaultRAPreprocSettings::calculateValueOptions( const caf::PdmFieldHandle* fieldNeedingOptions, bool* useOptionsOnly )
|
||||
{
|
||||
QList<caf::PdmOptionItemInfo> options;
|
||||
|
||||
if ( fieldNeedingOptions == &m_eclipseCase )
|
||||
{
|
||||
RimTools::eclipseCaseOptionItems( &options );
|
||||
}
|
||||
else if ( fieldNeedingOptions == &m_geomechCase )
|
||||
{
|
||||
RimTools::geoMechCaseOptionItems( &options );
|
||||
}
|
||||
|
||||
if ( m_geomechCase() )
|
||||
{
|
||||
if ( fieldNeedingOptions == &m_startTimestepGeoMech )
|
||||
{
|
||||
RimTools::timeStepsForCase( m_geomechCase, &options );
|
||||
}
|
||||
else if ( fieldNeedingOptions == &m_endTimestepGeoMech )
|
||||
{
|
||||
RimTools::timeStepsForCase( m_geomechCase, &options );
|
||||
}
|
||||
}
|
||||
|
||||
if ( m_eclipseCase() )
|
||||
{
|
||||
if ( fieldNeedingOptions == &m_startTimestepEclipse )
|
||||
{
|
||||
RimTools::timeStepsForCase( m_eclipseCase, &options );
|
||||
}
|
||||
else if ( fieldNeedingOptions == &m_endTimestepEclipse )
|
||||
{
|
||||
RimTools::timeStepsForCase( m_eclipseCase, &options );
|
||||
}
|
||||
}
|
||||
|
||||
return options;
|
||||
}
|
||||
|
||||
RimCase* RimFaultRAPreprocSettings::startCase() const
|
||||
{
|
||||
if ( m_geomechCase() ) return m_geomechCase();
|
||||
return m_eclipseCase();
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
int RimFaultRAPreprocSettings::startTimeStepEclipseIndex() const
|
||||
{
|
||||
return m_startTimestepEclipse();
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
QString RimFaultRAPreprocSettings::startTimeStepEclipse() const
|
||||
{
|
||||
if ( m_eclipseCase() )
|
||||
{
|
||||
if ( ( m_startTimestepEclipse >= 0 ) && ( m_startTimestepEclipse <= m_eclipseCase->timeStepStrings().size() ) )
|
||||
return m_eclipseCase->timeStepStrings()[m_startTimestepEclipse];
|
||||
}
|
||||
return "";
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
int RimFaultRAPreprocSettings::endTimeStepEclipseIndex() const
|
||||
{
|
||||
return m_endTimestepEclipse();
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
QString RimFaultRAPreprocSettings::endTimeStepEclipse() const
|
||||
{
|
||||
if ( m_eclipseCase() )
|
||||
{
|
||||
if ( ( m_endTimestepEclipse >= 0 ) && ( m_endTimestepEclipse <= m_eclipseCase->timeStepStrings().size() ) )
|
||||
return m_eclipseCase->timeStepStrings()[m_endTimestepEclipse];
|
||||
}
|
||||
return "";
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
QString RimFaultRAPreprocSettings::eclipseCaseFilename() const
|
||||
{
|
||||
if ( m_eclipseCase ) return m_eclipseCase->gridFileName();
|
||||
return "";
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
int RimFaultRAPreprocSettings::startTimeStepGeoMechIndex() const
|
||||
{
|
||||
return m_startTimestepGeoMech();
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
QString RimFaultRAPreprocSettings::startTimeStepGeoMech() const
|
||||
{
|
||||
if ( m_geomechCase() )
|
||||
{
|
||||
if ( ( m_startTimestepGeoMech >= 0 ) && ( m_startTimestepGeoMech <= m_geomechCase->timeStepStrings().size() ) )
|
||||
return m_geomechCase->timeStepStrings()[m_startTimestepEclipse];
|
||||
}
|
||||
return "";
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
int RimFaultRAPreprocSettings::endTimeStepGeoMechIndex() const
|
||||
{
|
||||
return m_endTimestepGeoMech();
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
QString RimFaultRAPreprocSettings::endTimeStepGeoMech() const
|
||||
{
|
||||
if ( m_geomechCase() )
|
||||
{
|
||||
if ( ( m_endTimestepGeoMech >= 0 ) && ( m_endTimestepGeoMech <= m_geomechCase->timeStepStrings().size() ) )
|
||||
return m_geomechCase->timeStepStrings()[m_endTimestepGeoMech];
|
||||
}
|
||||
return "";
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
QString RimFaultRAPreprocSettings::geomechCaseFilename() const
|
||||
{
|
||||
if ( m_geomechCase ) return m_geomechCase->gridFileName();
|
||||
return "";
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
QString RimFaultRAPreprocSettings::preprocParameterFilename() const
|
||||
{
|
||||
return m_baseDir + "/tmp/pre_processing.json";
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
QString RimFaultRAPreprocSettings::outputBaseDirectory() const
|
||||
{
|
||||
return m_baseDir();
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
bool RimFaultRAPreprocSettings::cleanBaseDirectory() const
|
||||
{
|
||||
return m_cleanBaseDir();
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
bool RimFaultRAPreprocSettings::smoothEclipseData() const
|
||||
{
|
||||
return m_smoothEclipseData();
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimFaultRAPreprocSettings::setGeoMechCase( RimGeoMechCase* geomechCase )
|
||||
{
|
||||
m_geomechCase = geomechCase;
|
||||
if ( geomechCase ) m_endTimestepGeoMech = geomechCase->timeStepStrings().size() - 1;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
RimGeoMechCase* RimFaultRAPreprocSettings::geoMechCase() const
|
||||
{
|
||||
return m_geomechCase();
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimFaultRAPreprocSettings::setEclipseCase( RimEclipseResultCase* eclipseCase )
|
||||
{
|
||||
m_eclipseCase = eclipseCase;
|
||||
if ( eclipseCase ) m_endTimestepEclipse = eclipseCase->timeStepStrings().size() - 1;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
RimEclipseCase* RimFaultRAPreprocSettings::eclipseCase() const
|
||||
{
|
||||
return m_eclipseCase();
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimFaultRAPreprocSettings::setOutputBaseDirectory( QString baseDir )
|
||||
{
|
||||
m_baseDir = baseDir;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
QString RimFaultRAPreprocSettings::outputEclipseFilename() const
|
||||
{
|
||||
QString retval = outputEclipseDirectory();
|
||||
retval += QDir::separator();
|
||||
|
||||
QFileInfo fi( eclipseCaseFilename() );
|
||||
retval += fi.baseName() + "_RI.GRDECL";
|
||||
|
||||
return retval;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
QString RimFaultRAPreprocSettings::outputEclipseDirectory() const
|
||||
{
|
||||
QString retval = m_baseDir;
|
||||
retval += "/Eclipse";
|
||||
|
||||
return retval;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
QString RimFaultRAPreprocSettings::outputAbaqusDirectory() const
|
||||
{
|
||||
QString retval = m_baseDir;
|
||||
retval += "/Abaqus";
|
||||
|
||||
return retval;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
QStringList RimFaultRAPreprocSettings::preprocParameterList() const
|
||||
{
|
||||
QStringList retlist;
|
||||
retlist << preprocParameterFilename();
|
||||
return retlist;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
QStringList RimFaultRAPreprocSettings::macrisPrepareParameterList() const
|
||||
{
|
||||
QStringList retlist;
|
||||
|
||||
retlist << "prepare";
|
||||
|
||||
retlist << "-o";
|
||||
|
||||
retlist << outputEclipseDirectory();
|
||||
|
||||
if ( m_smoothEclipseData )
|
||||
{
|
||||
retlist << "-ds";
|
||||
}
|
||||
else
|
||||
{
|
||||
retlist << "-d";
|
||||
}
|
||||
|
||||
retlist << m_eclipseCase()->gridFileName();
|
||||
|
||||
return retlist;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
bool RimFaultRAPreprocSettings::geoMechSelected() const
|
||||
{
|
||||
return m_geomechCase.value() != nullptr;
|
||||
}
|
@@ -0,0 +1,93 @@
|
||||
/////////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// 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.
|
||||
//
|
||||
/////////////////////////////////////////////////////////////////////////////////
|
||||
#pragma once
|
||||
|
||||
#include "cafPdmField.h"
|
||||
#include "cafPdmObject.h"
|
||||
#include "cafPdmPtrField.h"
|
||||
|
||||
class RimEclipseResultCase;
|
||||
class RimEclipseCase;
|
||||
class RimGeoMechCase;
|
||||
class RimCase;
|
||||
|
||||
class RimFaultRAPreprocSettings : public caf::PdmObject
|
||||
{
|
||||
CAF_PDM_HEADER_INIT;
|
||||
|
||||
public:
|
||||
RimFaultRAPreprocSettings();
|
||||
~RimFaultRAPreprocSettings() override;
|
||||
|
||||
void setGeoMechCase( RimGeoMechCase* geomechCase );
|
||||
RimGeoMechCase* geoMechCase() const;
|
||||
|
||||
void setEclipseCase( RimEclipseResultCase* eclipseCase );
|
||||
RimEclipseCase* eclipseCase() const;
|
||||
|
||||
void setOutputBaseDirectory( QString baseDir );
|
||||
QString outputBaseDirectory() const;
|
||||
|
||||
int startTimeStepGeoMechIndex() const;
|
||||
QString startTimeStepGeoMech() const;
|
||||
int endTimeStepGeoMechIndex() const;
|
||||
QString endTimeStepGeoMech() const;
|
||||
|
||||
int startTimeStepEclipseIndex() const;
|
||||
QString startTimeStepEclipse() const;
|
||||
int endTimeStepEclipseIndex() const;
|
||||
QString endTimeStepEclipse() const;
|
||||
|
||||
QString eclipseCaseFilename() const;
|
||||
QString geomechCaseFilename() const;
|
||||
bool cleanBaseDirectory() const;
|
||||
bool smoothEclipseData() const;
|
||||
|
||||
bool geoMechSelected() const;
|
||||
|
||||
QString preprocParameterFilename() const;
|
||||
QString outputEclipseFilename() const;
|
||||
QString outputEclipseDirectory() const;
|
||||
|
||||
QString outputAbaqusDirectory() const;
|
||||
|
||||
QStringList preprocParameterList() const;
|
||||
QStringList macrisPrepareParameterList() const;
|
||||
|
||||
protected:
|
||||
void fieldChangedByUi( const caf::PdmFieldHandle* changedField, const QVariant& oldValue, const QVariant& newValue ) override;
|
||||
void defineUiOrdering( QString uiConfigName, caf::PdmUiOrdering& uiOrdering ) override;
|
||||
void defineEditorAttribute( const caf::PdmFieldHandle* field,
|
||||
QString uiConfigName,
|
||||
caf::PdmUiEditorAttribute* attribute ) override;
|
||||
|
||||
QList<caf::PdmOptionItemInfo> calculateValueOptions( const caf::PdmFieldHandle* fieldNeedingOptions,
|
||||
bool* useOptionsOnly ) override;
|
||||
|
||||
RimCase* startCase() const;
|
||||
|
||||
caf::PdmField<int> m_startTimestepEclipse;
|
||||
caf::PdmField<int> m_endTimestepEclipse;
|
||||
caf::PdmField<int> m_startTimestepGeoMech;
|
||||
caf::PdmField<int> m_endTimestepGeoMech;
|
||||
caf::PdmPtrField<RimEclipseResultCase*> m_eclipseCase;
|
||||
caf::PdmField<bool> m_smoothEclipseData;
|
||||
caf::PdmPtrField<RimGeoMechCase*> m_geomechCase;
|
||||
caf::PdmField<QString> m_baseDir;
|
||||
caf::PdmField<bool> m_cleanBaseDir;
|
||||
};
|
@@ -0,0 +1,598 @@
|
||||
/////////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// 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 "RimFaultRASettings.h"
|
||||
#include "RimFaultRAPreprocSettings.h"
|
||||
|
||||
#include "RiaApplication.h"
|
||||
#include "RiaPreferencesGeoMech.h"
|
||||
#include "RimDoubleParameter.h"
|
||||
#include "RimEclipseCase.h"
|
||||
#include "RimEclipseInputCase.h"
|
||||
#include "RimEclipseResultCase.h"
|
||||
#include "RimGenericParameter.h"
|
||||
#include "RimGeoMechCase.h"
|
||||
#include "RimIntegerParameter.h"
|
||||
#include "RimParameterGroup.h"
|
||||
#include "RimProject.h"
|
||||
#include "RimStringParameter.h"
|
||||
#include "RimTools.h"
|
||||
|
||||
#include "RifParameterXmlReader.h"
|
||||
|
||||
#include "cafPdmFieldScriptingCapability.h"
|
||||
#include "cafPdmObjectScriptingCapability.h"
|
||||
#include "cafPdmUiComboBoxEditor.h"
|
||||
#include "cafPdmUiTableViewEditor.h"
|
||||
|
||||
CAF_PDM_SOURCE_INIT( RimFaultRASettings, "RimFaultRASettings" );
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
RimFaultRASettings::RimFaultRASettings()
|
||||
{
|
||||
CAF_PDM_InitObject( "Reactivation Assessment Settings", ":/fault_react_24x24.png", "", "" );
|
||||
|
||||
CAF_PDM_InitFieldNoDefault( &m_eclipseCase, "EclipseCase", "Eclipse Case", "", "", "" );
|
||||
m_eclipseCase.uiCapability()->setUiReadOnly( true );
|
||||
|
||||
CAF_PDM_InitFieldNoDefault( &m_geomechCase, "GeomechCase", "GeoMech Case", "", "", "" );
|
||||
m_geomechCase.uiCapability()->setUiReadOnly( true );
|
||||
|
||||
CAF_PDM_InitFieldNoDefault( &m_eclipseFRAGeneratedCase, "EclipseFRACase", "Eclipse FRA Case", "", "", "" );
|
||||
m_eclipseFRAGeneratedCase.uiCapability()->setUiReadOnly( true );
|
||||
|
||||
CAF_PDM_InitFieldNoDefault( &m_baseDir, "BaseDir", "Working Directory", "", "", "" );
|
||||
m_baseDir.uiCapability()->setUiReadOnly( true );
|
||||
|
||||
CAF_PDM_InitField( &m_startTimestepEclipse, "StartTimeStepEclipse", 0, "Start Time Step", "", "", "" );
|
||||
m_startTimestepEclipse.uiCapability()->setUiEditorTypeName( caf::PdmUiComboBoxEditor::uiEditorTypeName() );
|
||||
CAF_PDM_InitField( &m_endTimestepEclipse, "EndTimeStepEclipse", 0, "End Time Step", "", "", "" );
|
||||
m_endTimestepEclipse.uiCapability()->setUiEditorTypeName( caf::PdmUiComboBoxEditor::uiEditorTypeName() );
|
||||
|
||||
CAF_PDM_InitField( &m_startTimestepGeoMech, "StartTimeStepGeoMech", 0, "Start Time Step", "", "", "" );
|
||||
m_startTimestepGeoMech.uiCapability()->setUiEditorTypeName( caf::PdmUiComboBoxEditor::uiEditorTypeName() );
|
||||
m_startTimestepGeoMech.uiCapability()->setUiReadOnly( true );
|
||||
CAF_PDM_InitField( &m_endTimestepGeoMech, "EndTimeStepGeoMech", 0, "End Time Step", "", "", "" );
|
||||
m_endTimestepGeoMech.uiCapability()->setUiEditorTypeName( caf::PdmUiComboBoxEditor::uiEditorTypeName() );
|
||||
m_endTimestepGeoMech.uiCapability()->setUiReadOnly( true );
|
||||
|
||||
CAF_PDM_InitFieldNoDefault( &m_basicParameters, "BasicParameters", "Basic Processing Parameters", ":/Bullet.png", "", "" );
|
||||
CAF_PDM_InitFieldNoDefault( &m_advancedParameters,
|
||||
"AdvancedParameters",
|
||||
"Advanced Processing Parameters",
|
||||
":/Bullet.png",
|
||||
"",
|
||||
"" );
|
||||
|
||||
CAF_PDM_InitFieldNoDefault( &m_basicParametersRI, "BasicParametersRI", "Basic ResInsight Parameters", "", "", "" );
|
||||
CAF_PDM_InitFieldNoDefault( &m_advancedParametersRI, "AdvancedParametersRI", "Advanced ResInsight Parameters", "", "", "" );
|
||||
setupResInsightParameters();
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
RimFaultRASettings::~RimFaultRASettings()
|
||||
{
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
QList<caf::PdmOptionItemInfo> RimFaultRASettings::calculateValueOptions( const caf::PdmFieldHandle* fieldNeedingOptions,
|
||||
bool* useOptionsOnly )
|
||||
{
|
||||
QList<caf::PdmOptionItemInfo> options;
|
||||
|
||||
if ( fieldNeedingOptions == &m_eclipseCase )
|
||||
{
|
||||
RimTools::eclipseCaseOptionItems( &options );
|
||||
}
|
||||
else if ( fieldNeedingOptions == &m_geomechCase )
|
||||
{
|
||||
RimTools::geoMechCaseOptionItems( &options );
|
||||
}
|
||||
|
||||
if ( m_geomechCase() )
|
||||
{
|
||||
if ( fieldNeedingOptions == &m_startTimestepGeoMech )
|
||||
{
|
||||
RimTools::timeStepsForCase( m_geomechCase, &options );
|
||||
}
|
||||
else if ( fieldNeedingOptions == &m_endTimestepGeoMech )
|
||||
{
|
||||
RimTools::timeStepsForCase( m_geomechCase, &options );
|
||||
}
|
||||
}
|
||||
|
||||
if ( m_eclipseCase() )
|
||||
{
|
||||
if ( fieldNeedingOptions == &m_startTimestepEclipse )
|
||||
{
|
||||
RimTools::timeStepsForCase( m_eclipseCase(), &options );
|
||||
}
|
||||
else if ( fieldNeedingOptions == &m_endTimestepEclipse )
|
||||
{
|
||||
RimTools::timeStepsForCase( m_eclipseCase(), &options );
|
||||
}
|
||||
}
|
||||
|
||||
return options;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimFaultRASettings::defineUiOrdering( QString uiConfigName, caf::PdmUiOrdering& uiOrdering )
|
||||
{
|
||||
uiOrdering.add( &m_baseDir );
|
||||
auto eclipseGroup = uiOrdering.addNewGroup( "Eclipse Time Steps" );
|
||||
eclipseGroup->add( &m_startTimestepEclipse );
|
||||
eclipseGroup->add( &m_endTimestepEclipse );
|
||||
|
||||
if ( m_geomechCase() != nullptr )
|
||||
{
|
||||
auto geomechGroup = uiOrdering.addNewGroup( "GeoMech Time Steps" );
|
||||
geomechGroup->add( &m_startTimestepGeoMech );
|
||||
geomechGroup->add( &m_endTimestepGeoMech );
|
||||
}
|
||||
uiOrdering.skipRemainingFields( true );
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
QString RimFaultRASettings::eclipseCaseFilename() const
|
||||
{
|
||||
if ( m_eclipseCase ) return m_eclipseCase->gridFileName();
|
||||
return "";
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
RimEclipseCase* RimFaultRASettings::eclipseCase() const
|
||||
{
|
||||
return m_eclipseCase;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
RimEclipseInputCase* RimFaultRASettings::eclipseFRAGeneratedCase() const
|
||||
{
|
||||
return m_eclipseFRAGeneratedCase;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
QString RimFaultRASettings::geomechCaseFilename() const
|
||||
{
|
||||
if ( m_geomechCase ) return m_geomechCase->gridFileName();
|
||||
return "";
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
RimGeoMechCase* RimFaultRASettings::geomechCase() const
|
||||
{
|
||||
return m_geomechCase;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
QString RimFaultRASettings::basicCalcParameterFilename() const
|
||||
{
|
||||
return m_baseDir + "/calc_parameters.xml";
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
QString RimFaultRASettings::advancedCalcParameterFilename() const
|
||||
{
|
||||
return m_baseDir + "/calib_parameters.xml";
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
QString RimFaultRASettings::outputBaseDirectory() const
|
||||
{
|
||||
return m_baseDir();
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimFaultRASettings::setGeoMechCase( RimGeoMechCase* geomechCase )
|
||||
{
|
||||
m_geomechCase = geomechCase;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimFaultRASettings::setOutputBaseDirectory( QString baseDir )
|
||||
{
|
||||
m_baseDir = baseDir;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimFaultRASettings::initFromPreprocSettings( RimFaultRAPreprocSettings* preprocSettings,
|
||||
RimEclipseInputCase* eclipseCase )
|
||||
{
|
||||
m_geomechCase = preprocSettings->geoMechCase();
|
||||
m_eclipseCase = preprocSettings->eclipseCase();
|
||||
m_eclipseFRAGeneratedCase = eclipseCase;
|
||||
m_baseDir = preprocSettings->outputBaseDirectory();
|
||||
m_startTimestepEclipse = preprocSettings->startTimeStepEclipseIndex();
|
||||
m_endTimestepEclipse = preprocSettings->endTimeStepEclipseIndex();
|
||||
m_startTimestepGeoMech = preprocSettings->startTimeStepGeoMechIndex();
|
||||
m_endTimestepGeoMech = preprocSettings->endTimeStepGeoMechIndex();
|
||||
|
||||
QString errorText;
|
||||
|
||||
RifParameterXmlReader basicreader( RiaPreferencesGeoMech::current()->geomechFRADefaultBasicXML() );
|
||||
if ( !basicreader.parseFile( errorText ) ) return;
|
||||
|
||||
m_basicParameters.clear();
|
||||
for ( auto group : basicreader.parameterGroups() )
|
||||
{
|
||||
m_basicParameters.push_back( group );
|
||||
}
|
||||
|
||||
if ( geomechCase() != nullptr )
|
||||
{
|
||||
RifParameterXmlReader advreader( RiaPreferencesGeoMech::current()->geomechFRADefaultAdvXML() );
|
||||
if ( !advreader.parseFile( errorText ) ) return;
|
||||
|
||||
m_advancedParameters.clear();
|
||||
for ( auto group : advreader.parameterGroups() )
|
||||
{
|
||||
m_advancedParameters.push_back( group );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
int RimFaultRASettings::startTimeStepEclipseIndex() const
|
||||
{
|
||||
return m_startTimestepEclipse();
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
QString RimFaultRASettings::startTimeStepEclipse() const
|
||||
{
|
||||
if ( m_eclipseCase() )
|
||||
{
|
||||
if ( ( m_startTimestepEclipse >= 0 ) && ( m_startTimestepEclipse <= m_eclipseCase->timeStepStrings().size() ) )
|
||||
return m_eclipseCase->timeStepStrings()[m_startTimestepEclipse];
|
||||
}
|
||||
return "";
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
int RimFaultRASettings::endTimeStepEclipseIndex() const
|
||||
{
|
||||
return m_endTimestepEclipse();
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
QString RimFaultRASettings::endTimeStepEclipse() const
|
||||
{
|
||||
if ( m_eclipseCase() )
|
||||
{
|
||||
if ( ( m_endTimestepEclipse >= 0 ) && ( m_endTimestepEclipse <= m_eclipseCase->timeStepStrings().size() ) )
|
||||
return m_eclipseCase->timeStepStrings()[m_endTimestepEclipse];
|
||||
}
|
||||
return "";
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
int RimFaultRASettings::startTimeStepGeoMechIndex() const
|
||||
{
|
||||
return m_startTimestepGeoMech();
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
QString RimFaultRASettings::startTimeStepGeoMech() const
|
||||
{
|
||||
if ( m_geomechCase() )
|
||||
{
|
||||
if ( ( m_startTimestepGeoMech >= 0 ) && ( m_startTimestepGeoMech <= m_geomechCase->timeStepStrings().size() ) )
|
||||
return m_geomechCase->timeStepStrings()[m_startTimestepEclipse];
|
||||
}
|
||||
return "";
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
int RimFaultRASettings::endTimeStepGeoMechIndex() const
|
||||
{
|
||||
return m_endTimestepGeoMech();
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
QString RimFaultRASettings::endTimeStepGeoMech() const
|
||||
{
|
||||
if ( m_geomechCase() )
|
||||
{
|
||||
if ( ( m_endTimestepGeoMech >= 0 ) && ( m_endTimestepGeoMech <= m_geomechCase->timeStepStrings().size() ) )
|
||||
return m_geomechCase->timeStepStrings()[m_endTimestepGeoMech];
|
||||
}
|
||||
return "";
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimFaultRASettings::setEclipseTimeStepIndexes( int start, int stop )
|
||||
{
|
||||
m_startTimestepEclipse = start;
|
||||
m_endTimestepEclipse = stop;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimFaultRASettings::setGeomechTimeStepIndexes( int start, int stop )
|
||||
{
|
||||
m_startTimestepGeoMech = start;
|
||||
m_endTimestepGeoMech = stop;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
std::list<RimGenericParameter*> RimFaultRASettings::basicParameters( int faultID )
|
||||
{
|
||||
m_basicParametersRI->setParameterValue( "eclipse_input_grid", eclipseCaseFilename() );
|
||||
m_basicParametersRI->setParameterValue( "faultid", faultID );
|
||||
|
||||
std::list<RimGenericParameter*> retlist;
|
||||
|
||||
for ( auto& p : m_basicParametersRI->parameters() )
|
||||
{
|
||||
retlist.push_back( p );
|
||||
}
|
||||
|
||||
for ( auto& group : m_basicParameters.childObjects() )
|
||||
{
|
||||
for ( auto& p : group->parameters() )
|
||||
{
|
||||
retlist.push_back( p );
|
||||
}
|
||||
}
|
||||
|
||||
return retlist;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
std::list<RimGenericParameter*> RimFaultRASettings::advancedParameters( int faultID )
|
||||
{
|
||||
m_advancedParametersRI->setParameterValue( "eclipse_loadstep_start", startTimeStepEclipse() );
|
||||
m_advancedParametersRI->setParameterValue( "eclipse_loadstep_end", m_endTimestepEclipse() );
|
||||
m_advancedParametersRI->setParameterValue( "faultid_calibration", faultID );
|
||||
m_advancedParametersRI->setParameterValue( "abaqus_elastic_properties", elasticPropertiesFilename() );
|
||||
m_advancedParametersRI->setParameterValue( "abaqus_stress_start", stressStartFilename() );
|
||||
m_advancedParametersRI->setParameterValue( "abaqus_stress_end", stressEndFilename() );
|
||||
|
||||
std::list<RimGenericParameter*> retlist;
|
||||
|
||||
for ( auto& p : m_advancedParametersRI->parameters() )
|
||||
{
|
||||
retlist.push_back( p );
|
||||
}
|
||||
|
||||
for ( auto& group : m_advancedParameters.childObjects() )
|
||||
{
|
||||
for ( auto& p : group->parameters() )
|
||||
{
|
||||
retlist.push_back( p );
|
||||
}
|
||||
}
|
||||
|
||||
return retlist;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimFaultRASettings::setupResInsightParameters()
|
||||
{
|
||||
m_basicParametersRI = new RimParameterGroup();
|
||||
m_basicParametersRI->setName( "ResInsight Basic" );
|
||||
m_basicParametersRI->addParameter( "eclipse_input_grid", "" );
|
||||
m_basicParametersRI->addParameter( "faultid", -1 );
|
||||
|
||||
m_advancedParametersRI = new RimParameterGroup();
|
||||
m_advancedParametersRI->setName( "ResInsight Advanced" );
|
||||
m_advancedParametersRI->addParameter( "abaqus_elastic_properties", "" );
|
||||
m_advancedParametersRI->addParameter( "abaqus_stress_start", "" );
|
||||
m_advancedParametersRI->addParameter( "abaqus_stress_end", "" );
|
||||
m_advancedParametersRI->addParameter( "faultid_calibration", -1 );
|
||||
m_advancedParametersRI->addParameter( "eclipse_loadstep_start", "" );
|
||||
m_advancedParametersRI->addParameter( "eclipse_loadstep_end", "" );
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
QString RimFaultRASettings::elasticPropertiesFilename() const
|
||||
{
|
||||
return m_baseDir + "/Abaqus/ELASTIC_TABLE_res.inp";
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
QString RimFaultRASettings::stressStartFilename() const
|
||||
{
|
||||
QString filename = QString( "/%1/%2_%3_stress.rpt" ).arg( "Abaqus", geomechCase()->uiName(), startTimeStepGeoMech() );
|
||||
return m_baseDir + filename;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
QString RimFaultRASettings::stressEndFilename() const
|
||||
{
|
||||
QString filename = QString( "/%1/%2_%3_stress.rpt" ).arg( "Abaqus", geomechCase()->uiName(), endTimeStepGeoMech() );
|
||||
return m_baseDir + filename;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
QString RimFaultRASettings::basicMacrisDatabase() const
|
||||
{
|
||||
return m_baseDir + "/MacrisCalcResult.sqlite3";
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
QString RimFaultRASettings::advancedMacrisDatabase() const
|
||||
{
|
||||
return m_baseDir + "/MacrisCalcCalibration.sqlite3";
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
QString RimFaultRASettings::loadStepStart() const
|
||||
{
|
||||
QString retval = QString( "PRESSURE_%1" ).arg( startTimeStepEclipseIndex(), 2, 10, QChar( '0' ) );
|
||||
return retval;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
QString RimFaultRASettings::loadStepEnd() const
|
||||
{
|
||||
QString retval = QString( "PRESSURE_%1" ).arg( endTimeStepEclipseIndex(), 2, 10, QChar( '0' ) );
|
||||
return retval;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
QString RimFaultRASettings::basicParameterXMLFilename( int faultID ) const
|
||||
{
|
||||
QString retval = m_baseDir;
|
||||
retval += QString( "/tmp/calculate_%1.xml" ).arg( faultID, 3, 10, QChar( '0' ) );
|
||||
return retval;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
QString RimFaultRASettings::advancedParameterXMLFilename( int faultID ) const
|
||||
{
|
||||
QString retval = m_baseDir;
|
||||
retval += QString( "/tmp/calibrate_%1.xml" ).arg( faultID, 3, 10, QChar( '0' ) );
|
||||
return retval;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
QString RimFaultRASettings::postprocParameterFilename( int faultID ) const
|
||||
{
|
||||
QString retval = m_baseDir;
|
||||
retval += QString( "/tmp/postproc_%1.json" ).arg( faultID, 3, 10, QChar( '0' ) );
|
||||
return retval;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
QStringList RimFaultRASettings::basicMacrisParameters( int faultID ) const
|
||||
{
|
||||
QStringList retlist;
|
||||
|
||||
retlist << "calculate";
|
||||
retlist << basicCalcParameterFilename();
|
||||
retlist << m_baseDir();
|
||||
retlist << "-i";
|
||||
retlist << loadStepStart();
|
||||
retlist << loadStepEnd();
|
||||
|
||||
return retlist;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
QStringList RimFaultRASettings::advancedMacrisParameters( int faultID ) const
|
||||
{
|
||||
QStringList retlist;
|
||||
|
||||
retlist << "calibrate";
|
||||
retlist << basicCalcParameterFilename();
|
||||
retlist << advancedCalcParameterFilename();
|
||||
retlist << m_baseDir();
|
||||
|
||||
return retlist;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
QStringList RimFaultRASettings::postprocParameters( int faultID ) const
|
||||
{
|
||||
QStringList retlist;
|
||||
|
||||
retlist << postprocParameterFilename( faultID );
|
||||
|
||||
return retlist;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
QString RimFaultRASettings::tsurfOutputDirectory() const
|
||||
{
|
||||
return m_baseDir + "/tsurf";
|
||||
}
|
116
ApplicationLibCode/ProjectDataModel/Faults/RimFaultRASettings.h
Normal file
116
ApplicationLibCode/ProjectDataModel/Faults/RimFaultRASettings.h
Normal file
@@ -0,0 +1,116 @@
|
||||
/////////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// 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.
|
||||
//
|
||||
/////////////////////////////////////////////////////////////////////////////////
|
||||
#pragma once
|
||||
|
||||
#include "cafPdmChildArrayField.h"
|
||||
#include "cafPdmField.h"
|
||||
#include "cafPdmObject.h"
|
||||
#include "cafPdmPtrField.h"
|
||||
|
||||
#include <list>
|
||||
#include <string>
|
||||
|
||||
class RimEclipseInputCase;
|
||||
class RimEclipseCase;
|
||||
class RimGeoMechCase;
|
||||
class RimParameterGroup;
|
||||
class RimFaultRAPreprocSettings;
|
||||
class RimGenericParameter;
|
||||
|
||||
class RimFaultRASettings : public caf::PdmObject
|
||||
{
|
||||
CAF_PDM_HEADER_INIT;
|
||||
|
||||
public:
|
||||
RimFaultRASettings();
|
||||
~RimFaultRASettings() override;
|
||||
|
||||
void initFromPreprocSettings( RimFaultRAPreprocSettings* preprocsettings, RimEclipseInputCase* eclipseCase );
|
||||
|
||||
void setGeoMechCase( RimGeoMechCase* geomechCase );
|
||||
RimGeoMechCase* geomechCase() const;
|
||||
QString geomechCaseFilename() const;
|
||||
|
||||
RimEclipseInputCase* eclipseFRAGeneratedCase() const;
|
||||
RimEclipseCase* eclipseCase() const;
|
||||
QString eclipseCaseFilename() const;
|
||||
|
||||
void setOutputBaseDirectory( QString baseDir );
|
||||
QString outputBaseDirectory() const;
|
||||
|
||||
QString basicCalcParameterFilename() const;
|
||||
QString advancedCalcParameterFilename() const;
|
||||
|
||||
int startTimeStepGeoMechIndex() const;
|
||||
QString startTimeStepGeoMech() const;
|
||||
int endTimeStepGeoMechIndex() const;
|
||||
QString endTimeStepGeoMech() const;
|
||||
|
||||
void setEclipseTimeStepIndexes( int start, int stop );
|
||||
void setGeomechTimeStepIndexes( int start, int stop );
|
||||
|
||||
int startTimeStepEclipseIndex() const;
|
||||
QString startTimeStepEclipse() const;
|
||||
QString loadStepStart() const;
|
||||
int endTimeStepEclipseIndex() const;
|
||||
QString endTimeStepEclipse() const;
|
||||
QString loadStepEnd() const;
|
||||
|
||||
std::list<RimGenericParameter*> basicParameters( int faultID );
|
||||
std::list<RimGenericParameter*> advancedParameters( int faultID );
|
||||
|
||||
QString elasticPropertiesFilename() const;
|
||||
QString stressStartFilename() const;
|
||||
QString stressEndFilename() const;
|
||||
QString basicMacrisDatabase() const;
|
||||
QString advancedMacrisDatabase() const;
|
||||
|
||||
QString basicParameterXMLFilename( int faultID ) const;
|
||||
QString advancedParameterXMLFilename( int faultID ) const;
|
||||
QString postprocParameterFilename( int faultID ) const;
|
||||
|
||||
QStringList basicMacrisParameters( int faultID ) const;
|
||||
QStringList advancedMacrisParameters( int faultID ) const;
|
||||
QStringList postprocParameters( int faultID ) const;
|
||||
|
||||
QString tsurfOutputDirectory() const;
|
||||
|
||||
protected:
|
||||
void defineUiOrdering( QString uiConfigName, caf::PdmUiOrdering& uiOrdering ) override;
|
||||
QList<caf::PdmOptionItemInfo> calculateValueOptions( const caf::PdmFieldHandle* fieldNeedingOptions,
|
||||
bool* useOptionsOnly ) override;
|
||||
|
||||
private:
|
||||
void setupResInsightParameters();
|
||||
|
||||
private:
|
||||
caf::PdmPtrField<RimEclipseInputCase*> m_eclipseFRAGeneratedCase;
|
||||
caf::PdmPtrField<RimEclipseCase*> m_eclipseCase;
|
||||
caf::PdmPtrField<RimGeoMechCase*> m_geomechCase;
|
||||
caf::PdmField<QString> m_baseDir;
|
||||
|
||||
caf::PdmField<int> m_startTimestepEclipse;
|
||||
caf::PdmField<int> m_endTimestepEclipse;
|
||||
caf::PdmField<int> m_startTimestepGeoMech;
|
||||
caf::PdmField<int> m_endTimestepGeoMech;
|
||||
|
||||
caf::PdmChildArrayField<RimParameterGroup*> m_basicParameters;
|
||||
caf::PdmChildArrayField<RimParameterGroup*> m_advancedParameters;
|
||||
caf::PdmPtrField<RimParameterGroup*> m_basicParametersRI;
|
||||
caf::PdmPtrField<RimParameterGroup*> m_advancedParametersRI;
|
||||
};
|
@@ -0,0 +1,26 @@
|
||||
|
||||
set (SOURCE_GROUP_HEADER_FILES
|
||||
${CMAKE_CURRENT_LIST_DIR}/RimGenericParameter.h
|
||||
${CMAKE_CURRENT_LIST_DIR}/RimDoubleParameter.h
|
||||
${CMAKE_CURRENT_LIST_DIR}/RimIntegerParameter.h
|
||||
${CMAKE_CURRENT_LIST_DIR}/RimStringParameter.h
|
||||
${CMAKE_CURRENT_LIST_DIR}/RimParameterGroup.h
|
||||
)
|
||||
|
||||
set (SOURCE_GROUP_SOURCE_FILES
|
||||
${CMAKE_CURRENT_LIST_DIR}/RimGenericParameter.cpp
|
||||
${CMAKE_CURRENT_LIST_DIR}/RimDoubleParameter.cpp
|
||||
${CMAKE_CURRENT_LIST_DIR}/RimIntegerParameter.cpp
|
||||
${CMAKE_CURRENT_LIST_DIR}/RimStringParameter.cpp
|
||||
${CMAKE_CURRENT_LIST_DIR}/RimParameterGroup.cpp
|
||||
)
|
||||
|
||||
list(APPEND CODE_HEADER_FILES
|
||||
${SOURCE_GROUP_HEADER_FILES}
|
||||
)
|
||||
|
||||
list(APPEND CODE_SOURCE_FILES
|
||||
${SOURCE_GROUP_SOURCE_FILES}
|
||||
)
|
||||
|
||||
source_group( "ProjectDataModel\\Parameters" FILES ${SOURCE_GROUP_HEADER_FILES} ${SOURCE_GROUP_SOURCE_FILES} ${CMAKE_CURRENT_LIST_DIR}/CMakeLists_files.cmake )
|
@@ -0,0 +1,78 @@
|
||||
/////////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// 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 "RimDoubleParameter.h"
|
||||
|
||||
#include "cafPdmFieldScriptingCapability.h"
|
||||
#include "cafPdmObjectScriptingCapability.h"
|
||||
#include "cafPdmUiCheckBoxEditor.h"
|
||||
#include "cafPdmUiLineEditor.h"
|
||||
|
||||
#include <cmath>
|
||||
|
||||
CAF_PDM_SOURCE_INIT( RimDoubleParameter, "DoubleParameter" );
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
RimDoubleParameter::RimDoubleParameter()
|
||||
{
|
||||
CAF_PDM_InitField( &m_value, "Value", 0.0, "Value", "", "", "" );
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
RimDoubleParameter::~RimDoubleParameter()
|
||||
{
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimDoubleParameter::setValue( double value )
|
||||
{
|
||||
m_value = value;
|
||||
setValid( true );
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimDoubleParameter::setValue( QString value )
|
||||
{
|
||||
bool bOk = false;
|
||||
m_value = value.toDouble( &bOk );
|
||||
setValid( bOk );
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
QVariant RimDoubleParameter::variantValue() const
|
||||
{
|
||||
return QVariant( m_value() );
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
QString RimDoubleParameter::stringValue() const
|
||||
{
|
||||
return QString::number( m_value() );
|
||||
}
|
@@ -0,0 +1,47 @@
|
||||
/////////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// 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.
|
||||
//
|
||||
/////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#pragma once
|
||||
|
||||
#include "cafPdmField.h"
|
||||
#include "cafPdmObject.h"
|
||||
|
||||
#include <QString>
|
||||
|
||||
#include "RimGenericParameter.h"
|
||||
|
||||
//==================================================================================================
|
||||
///
|
||||
///
|
||||
//==================================================================================================
|
||||
class RimDoubleParameter : public RimGenericParameter
|
||||
{
|
||||
CAF_PDM_HEADER_INIT;
|
||||
|
||||
public:
|
||||
RimDoubleParameter();
|
||||
~RimDoubleParameter() override;
|
||||
|
||||
void setValue( double value );
|
||||
void setValue( QString value ) override;
|
||||
QVariant variantValue() const override;
|
||||
QString stringValue() const override;
|
||||
|
||||
private:
|
||||
caf::PdmField<double> m_value;
|
||||
};
|
@@ -0,0 +1,145 @@
|
||||
/////////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// 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 "RimGenericParameter.h"
|
||||
|
||||
#include "RiuGuiTheme.h"
|
||||
|
||||
#include "cafPdmFieldScriptingCapability.h"
|
||||
#include "cafPdmObjectScriptingCapability.h"
|
||||
#include "cafPdmUiCheckBoxEditor.h"
|
||||
#include "cafPdmUiLineEditor.h"
|
||||
|
||||
#include <cmath>
|
||||
|
||||
CAF_PDM_ABSTRACT_SOURCE_INIT( RimGenericParameter, "GenericParameter" );
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
RimGenericParameter::RimGenericParameter()
|
||||
{
|
||||
CAF_PDM_InitObject( "Parameter", ":/Bullet.png", "", "" );
|
||||
|
||||
CAF_PDM_InitField( &m_name, "Name", QString(), "Name", "", "", "" );
|
||||
m_name.uiCapability()->setUiReadOnly( true );
|
||||
m_name.uiCapability()->setUiHidden( true );
|
||||
|
||||
CAF_PDM_InitField( &m_label, "Label", QString(), "Name", "", "", "" );
|
||||
m_label.uiCapability()->setUiReadOnly( true );
|
||||
m_label.uiCapability()->setUiContentTextColor( RiuGuiTheme::getColorByVariableName( "textColor" ) );
|
||||
|
||||
CAF_PDM_InitField( &m_description, "Description", QString(), "Description", "", "", "" );
|
||||
m_description.uiCapability()->setUiReadOnly( true );
|
||||
m_description.uiCapability()->setUiHidden( true );
|
||||
|
||||
CAF_PDM_InitField( &m_advanced, "Advanced", false, "Advanced", "", "", "" );
|
||||
m_advanced.uiCapability()->setUiReadOnly( true );
|
||||
m_advanced.uiCapability()->setUiHidden( true );
|
||||
|
||||
CAF_PDM_InitField( &m_valid, "Valid", false, "Valid", "", "", "" );
|
||||
m_valid.uiCapability()->setUiReadOnly( true );
|
||||
m_valid.uiCapability()->setUiHidden( true );
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
RimGenericParameter::~RimGenericParameter()
|
||||
{
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimGenericParameter::setName( QString name )
|
||||
{
|
||||
m_name = name;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimGenericParameter::setLabel( QString labelText )
|
||||
{
|
||||
m_label = labelText;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimGenericParameter::setDescription( QString description )
|
||||
{
|
||||
m_description = description;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimGenericParameter::setAdvanced( bool isAdvanced )
|
||||
{
|
||||
m_advanced = isAdvanced;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
bool RimGenericParameter::isAdvanced() const
|
||||
{
|
||||
return m_advanced();
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
bool RimGenericParameter::isValid() const
|
||||
{
|
||||
return m_valid();
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimGenericParameter::setValid( bool valid )
|
||||
{
|
||||
m_valid = valid;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
QString RimGenericParameter::name() const
|
||||
{
|
||||
return m_name();
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
QString RimGenericParameter::label() const
|
||||
{
|
||||
return m_label();
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
QString RimGenericParameter::description() const
|
||||
{
|
||||
return m_description();
|
||||
}
|
@@ -0,0 +1,62 @@
|
||||
/////////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// 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.
|
||||
//
|
||||
/////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#pragma once
|
||||
|
||||
#include "cafPdmField.h"
|
||||
#include "cafPdmObject.h"
|
||||
|
||||
#include <QString>
|
||||
|
||||
//==================================================================================================
|
||||
///
|
||||
///
|
||||
//==================================================================================================
|
||||
class RimGenericParameter : public caf::PdmObject
|
||||
{
|
||||
CAF_PDM_HEADER_INIT;
|
||||
|
||||
public:
|
||||
RimGenericParameter();
|
||||
~RimGenericParameter() override;
|
||||
|
||||
void setName( QString name );
|
||||
void setLabel( QString labelText );
|
||||
void setDescription( QString description );
|
||||
void setAdvanced( bool isAdvanced = false );
|
||||
|
||||
virtual void setValue( QString value ) = 0;
|
||||
virtual QVariant variantValue() const = 0;
|
||||
virtual QString stringValue() const = 0;
|
||||
|
||||
QString name() const;
|
||||
QString label() const;
|
||||
QString description() const;
|
||||
bool isAdvanced() const;
|
||||
bool isValid() const;
|
||||
|
||||
protected:
|
||||
void setValid( bool valid );
|
||||
|
||||
private:
|
||||
caf::PdmField<QString> m_name;
|
||||
caf::PdmField<QString> m_label;
|
||||
caf::PdmField<QString> m_description;
|
||||
caf::PdmField<bool> m_advanced;
|
||||
caf::PdmField<bool> m_valid;
|
||||
};
|
@@ -0,0 +1,78 @@
|
||||
/////////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// 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 "RimIntegerParameter.h"
|
||||
|
||||
#include "cafPdmFieldScriptingCapability.h"
|
||||
#include "cafPdmObjectScriptingCapability.h"
|
||||
#include "cafPdmUiCheckBoxEditor.h"
|
||||
#include "cafPdmUiLineEditor.h"
|
||||
|
||||
#include <cmath>
|
||||
|
||||
CAF_PDM_SOURCE_INIT( RimIntegerParameter, "IntegerParameter" );
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
RimIntegerParameter::RimIntegerParameter()
|
||||
{
|
||||
CAF_PDM_InitField( &m_value, "Value", 0, "Value", "", "", "" );
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
RimIntegerParameter::~RimIntegerParameter()
|
||||
{
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimIntegerParameter::setValue( QString value )
|
||||
{
|
||||
bool bOk = false;
|
||||
m_value = value.toInt( &bOk );
|
||||
setValid( bOk );
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimIntegerParameter::setValue( int value )
|
||||
{
|
||||
m_value = value;
|
||||
setValid( true );
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
QVariant RimIntegerParameter::variantValue() const
|
||||
{
|
||||
return QVariant( m_value() );
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
QString RimIntegerParameter::stringValue() const
|
||||
{
|
||||
return QString::number( m_value() );
|
||||
}
|
@@ -0,0 +1,47 @@
|
||||
/////////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// 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.
|
||||
//
|
||||
/////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#pragma once
|
||||
|
||||
#include "cafPdmField.h"
|
||||
#include "cafPdmObject.h"
|
||||
|
||||
#include <QString>
|
||||
|
||||
#include "RimGenericParameter.h"
|
||||
|
||||
//==================================================================================================
|
||||
///
|
||||
///
|
||||
//==================================================================================================
|
||||
class RimIntegerParameter : public RimGenericParameter
|
||||
{
|
||||
CAF_PDM_HEADER_INIT;
|
||||
|
||||
public:
|
||||
RimIntegerParameter();
|
||||
~RimIntegerParameter() override;
|
||||
|
||||
void setValue( int value );
|
||||
void setValue( QString value ) override;
|
||||
QVariant variantValue() const override;
|
||||
QString stringValue() const override;
|
||||
|
||||
private:
|
||||
caf::PdmField<int> m_value;
|
||||
};
|
@@ -0,0 +1,229 @@
|
||||
/////////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// 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 "RimParameterGroup.h"
|
||||
|
||||
#include "cafPdmFieldScriptingCapability.h"
|
||||
#include "cafPdmObjectScriptingCapability.h"
|
||||
#include "cafPdmUiTableViewEditor.h"
|
||||
|
||||
#include "RimDoubleParameter.h"
|
||||
#include "RimGenericParameter.h"
|
||||
#include "RimIntegerParameter.h"
|
||||
#include "RimStringParameter.h"
|
||||
|
||||
#include <cmath>
|
||||
|
||||
CAF_PDM_SOURCE_INIT( RimParameterGroup, "ParameterGroup" );
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
RimParameterGroup::RimParameterGroup()
|
||||
{
|
||||
CAF_PDM_InitObject( "Parameter Group", ":/Bullet.png", "", "" );
|
||||
uiCapability()->setUiTreeChildrenHidden( true );
|
||||
|
||||
CAF_PDM_InitFieldNoDefault( &m_parameters, "Parameters", "Parameters", "", "", "" );
|
||||
m_parameters.uiCapability()->setUiEditorTypeName( caf::PdmUiTableViewEditor::uiEditorTypeName() );
|
||||
m_parameters.uiCapability()->setUiLabelPosition( caf::PdmUiItemInfo::HIDDEN );
|
||||
m_parameters.uiCapability()->setCustomContextMenuEnabled( true );
|
||||
m_parameters.uiCapability()->setUiTreeChildrenHidden( true );
|
||||
|
||||
CAF_PDM_InitFieldNoDefault( &m_name, "Name", "Name", "", "", "" );
|
||||
m_name.uiCapability()->setUiHidden( true );
|
||||
m_name.uiCapability()->setUiReadOnly( true );
|
||||
|
||||
CAF_PDM_InitFieldNoDefault( &m_showExpanded, "Expanded", "Expanded", "", "", "" );
|
||||
m_name.uiCapability()->setUiHidden( true );
|
||||
m_name.uiCapability()->setUiReadOnly( true );
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
RimParameterGroup::~RimParameterGroup()
|
||||
{
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
caf::PdmFieldHandle* RimParameterGroup::userDescriptionField()
|
||||
{
|
||||
return &m_name;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimParameterGroup::addParameter( RimGenericParameter* parameter )
|
||||
{
|
||||
m_parameters.push_back( parameter );
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimParameterGroup::addParameter( QString name, int value )
|
||||
{
|
||||
RimIntegerParameter* p = new RimIntegerParameter();
|
||||
p->setName( name );
|
||||
p->setLabel( name );
|
||||
p->setValue( value );
|
||||
|
||||
m_parameters.push_back( p );
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimParameterGroup::addParameter( QString name, QString value )
|
||||
{
|
||||
RimStringParameter* p = new RimStringParameter();
|
||||
p->setName( name );
|
||||
p->setLabel( name );
|
||||
p->setValue( value );
|
||||
|
||||
m_parameters.push_back( p );
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimParameterGroup::addParameter( QString name, double value )
|
||||
{
|
||||
RimDoubleParameter* p = new RimDoubleParameter();
|
||||
p->setName( name );
|
||||
p->setLabel( name );
|
||||
p->setValue( value );
|
||||
|
||||
m_parameters.push_back( p );
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimParameterGroup::appendParametersToList( std::list<RimGenericParameter*>& parameterList )
|
||||
{
|
||||
for ( auto p : m_parameters() )
|
||||
{
|
||||
parameterList.push_back( p );
|
||||
}
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimParameterGroup::defineEditorAttribute( const caf::PdmFieldHandle* field,
|
||||
QString uiConfigName,
|
||||
caf::PdmUiEditorAttribute* attribute )
|
||||
{
|
||||
if ( field == &m_parameters )
|
||||
{
|
||||
auto tvAttribute = dynamic_cast<caf::PdmUiTableViewEditorAttribute*>( attribute );
|
||||
if ( tvAttribute )
|
||||
{
|
||||
tvAttribute->resizePolicy = caf::PdmUiTableViewEditorAttribute::RESIZE_TO_FILL_CONTAINER;
|
||||
tvAttribute->alwaysEnforceResizePolicy = true;
|
||||
tvAttribute->minimumHeight = 300;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimParameterGroup::defineUiOrdering( QString uiConfigName, caf::PdmUiOrdering& uiOrdering )
|
||||
{
|
||||
auto group = uiOrdering.addNewGroup( name() );
|
||||
group->add( &m_parameters );
|
||||
|
||||
uiOrdering.skipRemainingFields( true );
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimParameterGroup::setName( QString name )
|
||||
{
|
||||
m_name = name;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimParameterGroup::setExpanded( bool expand )
|
||||
{
|
||||
m_showExpanded = expand;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
bool RimParameterGroup::isExpanded() const
|
||||
{
|
||||
return m_showExpanded;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
QString RimParameterGroup::name() const
|
||||
{
|
||||
return m_name;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
std::vector<RimGenericParameter*> RimParameterGroup::parameters() const
|
||||
{
|
||||
return m_parameters.childObjects();
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimParameterGroup::setParameterValue( QString name, int value )
|
||||
{
|
||||
setParameterValue( name, QString::number( value ) );
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimParameterGroup::setParameterValue( QString name, double value )
|
||||
{
|
||||
setParameterValue( name, QString::number( value ) );
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimParameterGroup::setParameterValue( QString name, QString value )
|
||||
{
|
||||
for ( auto& p : m_parameters.childObjects() )
|
||||
{
|
||||
if ( p->name() == name )
|
||||
{
|
||||
p->setValue( value );
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
@@ -0,0 +1,72 @@
|
||||
/////////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// 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.
|
||||
//
|
||||
/////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#pragma once
|
||||
|
||||
#include "cafPdmChildArrayField.h"
|
||||
#include "cafPdmField.h"
|
||||
#include "cafPdmObject.h"
|
||||
|
||||
#include <QString>
|
||||
#include <vector>
|
||||
|
||||
class RimGenericParameter;
|
||||
|
||||
//==================================================================================================
|
||||
///
|
||||
///
|
||||
//==================================================================================================
|
||||
class RimParameterGroup : public caf::PdmObject
|
||||
{
|
||||
CAF_PDM_HEADER_INIT;
|
||||
|
||||
public:
|
||||
RimParameterGroup();
|
||||
~RimParameterGroup() override;
|
||||
|
||||
void addParameter( RimGenericParameter* p );
|
||||
void addParameter( QString name, int value );
|
||||
void addParameter( QString name, QString value );
|
||||
void addParameter( QString name, double value );
|
||||
|
||||
void appendParametersToList( std::list<RimGenericParameter*>& parameterList );
|
||||
|
||||
void setName( QString name );
|
||||
void setExpanded( bool expand );
|
||||
|
||||
void setParameterValue( QString name, int value );
|
||||
void setParameterValue( QString name, QString value );
|
||||
void setParameterValue( QString name, double value );
|
||||
|
||||
bool isExpanded() const;
|
||||
QString name() const;
|
||||
|
||||
std::vector<RimGenericParameter*> parameters() const;
|
||||
|
||||
private:
|
||||
void defineEditorAttribute( const caf::PdmFieldHandle* field,
|
||||
QString uiConfigName,
|
||||
caf::PdmUiEditorAttribute* attribute ) override;
|
||||
void defineUiOrdering( QString uiConfigName, caf::PdmUiOrdering& uiOrdering ) override;
|
||||
caf::PdmFieldHandle* userDescriptionField() override;
|
||||
|
||||
private:
|
||||
caf::PdmChildArrayField<RimGenericParameter*> m_parameters;
|
||||
caf::PdmField<bool> m_showExpanded;
|
||||
caf::PdmField<QString> m_name;
|
||||
};
|
@@ -0,0 +1,68 @@
|
||||
/////////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// 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 "RimStringParameter.h"
|
||||
|
||||
#include "cafPdmFieldScriptingCapability.h"
|
||||
#include "cafPdmObjectScriptingCapability.h"
|
||||
#include "cafPdmUiCheckBoxEditor.h"
|
||||
#include "cafPdmUiLineEditor.h"
|
||||
|
||||
#include <cmath>
|
||||
|
||||
CAF_PDM_SOURCE_INIT( RimStringParameter, "StringParameter" );
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
RimStringParameter::RimStringParameter()
|
||||
{
|
||||
CAF_PDM_InitField( &m_value, "Value", QString(), "Value", "", "", "" );
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
RimStringParameter::~RimStringParameter()
|
||||
{
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimStringParameter::setValue( QString value )
|
||||
{
|
||||
m_value = value;
|
||||
setValid( true );
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
QVariant RimStringParameter::variantValue() const
|
||||
{
|
||||
return QVariant( m_value() );
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
QString RimStringParameter::stringValue() const
|
||||
{
|
||||
return m_value();
|
||||
}
|
@@ -0,0 +1,46 @@
|
||||
/////////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// 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.
|
||||
//
|
||||
/////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#pragma once
|
||||
|
||||
#include "cafPdmField.h"
|
||||
#include "cafPdmObject.h"
|
||||
|
||||
#include <QString>
|
||||
|
||||
#include "RimGenericParameter.h"
|
||||
|
||||
//==================================================================================================
|
||||
///
|
||||
///
|
||||
//==================================================================================================
|
||||
class RimStringParameter : public RimGenericParameter
|
||||
{
|
||||
CAF_PDM_HEADER_INIT;
|
||||
|
||||
public:
|
||||
RimStringParameter();
|
||||
~RimStringParameter() override;
|
||||
|
||||
void setValue( QString value ) override;
|
||||
QVariant variantValue() const override;
|
||||
QString stringValue() const override;
|
||||
|
||||
private:
|
||||
caf::PdmField<QString> m_value;
|
||||
};
|
@@ -0,0 +1,24 @@
|
||||
|
||||
set (SOURCE_GROUP_HEADER_FILES
|
||||
${CMAKE_CURRENT_LIST_DIR}/RimProcess.h
|
||||
${CMAKE_CURRENT_LIST_DIR}/RimProcessMonitor.h
|
||||
)
|
||||
|
||||
set (SOURCE_GROUP_SOURCE_FILES
|
||||
${CMAKE_CURRENT_LIST_DIR}/RimProcess.cpp
|
||||
${CMAKE_CURRENT_LIST_DIR}/RimProcessMonitor.cpp
|
||||
)
|
||||
|
||||
list(APPEND CODE_HEADER_FILES
|
||||
${SOURCE_GROUP_HEADER_FILES}
|
||||
)
|
||||
|
||||
list(APPEND CODE_SOURCE_FILES
|
||||
${SOURCE_GROUP_SOURCE_FILES}
|
||||
)
|
||||
|
||||
list(APPEND COMMAND_QT_MOC_HEADERS
|
||||
${CMAKE_CURRENT_LIST_DIR}/RimProcessMonitor.h
|
||||
)
|
||||
|
||||
source_group( "ProjectDataModel\\ProcessControl" FILES ${SOURCE_GROUP_HEADER_FILES} ${SOURCE_GROUP_SOURCE_FILES} ${CMAKE_CURRENT_LIST_DIR}/CMakeLists_files.cmake )
|
@@ -0,0 +1,210 @@
|
||||
/////////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// 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 "RimProcess.h"
|
||||
|
||||
#include "RiaLogging.h"
|
||||
#include "RimProcessMonitor.h"
|
||||
|
||||
#include "cafPdmFieldCapability.h"
|
||||
|
||||
#include <QProcess>
|
||||
|
||||
CAF_PDM_SOURCE_INIT( RimProcess, "RimProcess" );
|
||||
|
||||
int RimProcess::m_nextProcessId = 1;
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
RimProcess::RimProcess()
|
||||
{
|
||||
int defId = m_nextProcessId++;
|
||||
m_monitor = new RimProcessMonitor( defId );
|
||||
|
||||
CAF_PDM_InitObject( "ResInsight Process", ":/Erase.png", "", "" );
|
||||
|
||||
CAF_PDM_InitFieldNoDefault( &m_command, "Command", "Command", "", "", "" );
|
||||
m_command.uiCapability()->setUiReadOnly( true );
|
||||
|
||||
CAF_PDM_InitFieldNoDefault( &m_description, "Description", "Description", "", "", "" );
|
||||
m_description.uiCapability()->setUiReadOnly( true );
|
||||
|
||||
CAF_PDM_InitField( &m_id, "ID", defId, "ID", "", "", "" );
|
||||
m_id.uiCapability()->setUiReadOnly( true );
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
RimProcess::~RimProcess()
|
||||
{
|
||||
delete m_monitor;
|
||||
}
|
||||
|
||||
caf::PdmFieldHandle* RimProcess::userDescriptionField()
|
||||
{
|
||||
return &m_description;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimProcess::addParameter( QString paramStr )
|
||||
{
|
||||
m_arguments << paramStr.trimmed();
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimProcess::setParameters( QStringList parameterList )
|
||||
{
|
||||
m_arguments.clear();
|
||||
for ( int i = 0; i < parameterList.size(); i++ )
|
||||
{
|
||||
addParameter( parameterList[i] );
|
||||
}
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimProcess::setCommand( QString cmdStr )
|
||||
{
|
||||
m_command = cmdStr;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimProcess::setDescription( QString desc )
|
||||
{
|
||||
m_description = desc;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
QString RimProcess::command() const
|
||||
{
|
||||
return m_command;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
QStringList RimProcess::parameters() const
|
||||
{
|
||||
return m_arguments;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
int RimProcess::ID() const
|
||||
{
|
||||
return m_id;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
bool RimProcess::execute()
|
||||
{
|
||||
QProcess* proc = new QProcess();
|
||||
QString cmd = commandLine();
|
||||
|
||||
RiaLogging::info( QString( "Start process %1: %2" ).arg( m_id ).arg( cmd ) );
|
||||
|
||||
QObject::connect( proc,
|
||||
SIGNAL( finished( int, QProcess::ExitStatus ) ),
|
||||
m_monitor,
|
||||
SLOT( finished( int, QProcess::ExitStatus ) ) );
|
||||
QObject::connect( proc, SIGNAL( readyReadStandardOutput() ), m_monitor, SLOT( readyReadStandardOutput() ) );
|
||||
QObject::connect( proc, SIGNAL( readyReadStandardError() ), m_monitor, SLOT( readyReadStandardError() ) );
|
||||
QObject::connect( proc, SIGNAL( started() ), m_monitor, SLOT( started() ) );
|
||||
|
||||
bool retval = false;
|
||||
|
||||
proc->start( cmd );
|
||||
if ( proc->waitForStarted( -1 ) )
|
||||
{
|
||||
while ( !proc->waitForFinished( 500 ) )
|
||||
{
|
||||
QApplication::processEvents( QEventLoop::ExcludeUserInputEvents );
|
||||
}
|
||||
retval = ( proc->exitCode() == 0 );
|
||||
}
|
||||
else
|
||||
{
|
||||
RiaLogging::error( QString( "Failed to start process %1." ).arg( m_id ) );
|
||||
}
|
||||
|
||||
proc->deleteLater();
|
||||
|
||||
return retval;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
bool RimProcess::needsCommandInterpreter() const
|
||||
{
|
||||
#ifdef WIN32
|
||||
if ( m_command.value().isNull() ) return false;
|
||||
return m_command.value().endsWith( ".cmd", Qt::CaseInsensitive ) ||
|
||||
m_command.value().endsWith( ".bat", Qt::CaseInsensitive );
|
||||
#endif
|
||||
return false;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
QString RimProcess::commandLine() const
|
||||
{
|
||||
QString cmdline;
|
||||
|
||||
if ( needsCommandInterpreter() )
|
||||
{
|
||||
cmdline += "cmd.exe /c ";
|
||||
}
|
||||
|
||||
cmdline += handleSpaces( m_command );
|
||||
|
||||
for ( int i = 0; i < m_arguments.size(); i++ )
|
||||
{
|
||||
cmdline += " ";
|
||||
cmdline += handleSpaces( m_arguments[i] );
|
||||
}
|
||||
|
||||
return cmdline;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
QString RimProcess::handleSpaces( QString arg ) const
|
||||
{
|
||||
if ( arg.contains( " " ) && !arg.startsWith( "\"" ) )
|
||||
{
|
||||
return QString( "\"" + arg + "\"" );
|
||||
}
|
||||
return arg;
|
||||
}
|
@@ -0,0 +1,64 @@
|
||||
/////////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// 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.
|
||||
//
|
||||
/////////////////////////////////////////////////////////////////////////////////
|
||||
#pragma once
|
||||
|
||||
#include "cafPdmField.h"
|
||||
#include "cafPdmObject.h"
|
||||
|
||||
#include <QProcess>
|
||||
#include <QString>
|
||||
#include <QStringList>
|
||||
|
||||
class RimProcessMonitor;
|
||||
|
||||
class RimProcess : public caf::PdmObject
|
||||
{
|
||||
CAF_PDM_HEADER_INIT;
|
||||
|
||||
public:
|
||||
RimProcess();
|
||||
~RimProcess() override;
|
||||
|
||||
void setDescription( QString desc );
|
||||
void setCommand( QString cmdStr );
|
||||
void addParameter( QString paramStr );
|
||||
void setParameters( QStringList parameterList );
|
||||
|
||||
QString commandLine() const;
|
||||
|
||||
QString command() const;
|
||||
QStringList parameters() const;
|
||||
int ID() const;
|
||||
|
||||
bool execute();
|
||||
|
||||
protected:
|
||||
caf::PdmFieldHandle* userDescriptionField() override;
|
||||
|
||||
private:
|
||||
bool needsCommandInterpreter() const;
|
||||
QString handleSpaces( QString argument ) const;
|
||||
|
||||
caf::PdmField<QString> m_command;
|
||||
QStringList m_arguments;
|
||||
caf::PdmField<QString> m_description;
|
||||
caf::PdmField<int> m_id;
|
||||
|
||||
static int m_nextProcessId;
|
||||
RimProcessMonitor* m_monitor;
|
||||
};
|
@@ -0,0 +1,113 @@
|
||||
/////////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// 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 "RimProcessMonitor.h"
|
||||
|
||||
#include "RiaLogging.h"
|
||||
|
||||
#include <QProcess>
|
||||
#include <QtCore/QtCore>
|
||||
|
||||
RimProcessMonitor::RimProcessMonitor( int processId )
|
||||
: QObject( nullptr )
|
||||
, m_processId( processId )
|
||||
{
|
||||
}
|
||||
|
||||
QString RimProcessMonitor::addPrefix( QString message )
|
||||
{
|
||||
return QString( "Process %1: %2" ).arg( m_processId ).arg( message );
|
||||
}
|
||||
|
||||
void RimProcessMonitor::error( QProcess::ProcessError error )
|
||||
{
|
||||
QString errorStr;
|
||||
|
||||
switch ( error )
|
||||
{
|
||||
case QProcess::FailedToStart:
|
||||
errorStr = "Failed to start";
|
||||
break;
|
||||
case QProcess::Crashed:
|
||||
errorStr = "Crashed";
|
||||
break;
|
||||
case QProcess::Timedout:
|
||||
errorStr = "Timed out";
|
||||
break;
|
||||
case QProcess::ReadError:
|
||||
errorStr = "Read error";
|
||||
break;
|
||||
case QProcess::WriteError:
|
||||
errorStr = "Write error";
|
||||
break;
|
||||
case QProcess::UnknownError:
|
||||
default:
|
||||
errorStr = "Unknown";
|
||||
break;
|
||||
}
|
||||
|
||||
RiaLogging::error( addPrefix( errorStr ) );
|
||||
}
|
||||
|
||||
void RimProcessMonitor::finished( int exitCode, QProcess::ExitStatus exitStatus )
|
||||
{
|
||||
QString finishStr;
|
||||
switch ( exitStatus )
|
||||
{
|
||||
case QProcess::NormalExit:
|
||||
finishStr = QString( "Normal exit, code %1" ).arg( exitCode );
|
||||
break;
|
||||
case QProcess::CrashExit:
|
||||
default:
|
||||
finishStr = QString( "Crash exit, code %1" ).arg( exitCode );
|
||||
break;
|
||||
}
|
||||
|
||||
RiaLogging::debug( addPrefix( finishStr ) );
|
||||
}
|
||||
|
||||
void RimProcessMonitor::readyReadStandardError()
|
||||
{
|
||||
QProcess* p = (QProcess*)sender();
|
||||
p->setReadChannel( QProcess::StandardError );
|
||||
while ( p->canReadLine() )
|
||||
{
|
||||
QString line = p->readLine();
|
||||
line = line.trimmed();
|
||||
if ( line.size() == 0 ) continue;
|
||||
RiaLogging::error( addPrefix( line ) );
|
||||
}
|
||||
}
|
||||
|
||||
void RimProcessMonitor::readyReadStandardOutput()
|
||||
{
|
||||
QProcess* p = (QProcess*)sender();
|
||||
p->setReadChannel( QProcess::StandardOutput );
|
||||
while ( p->canReadLine() )
|
||||
{
|
||||
QString line = p->readLine();
|
||||
line = line.trimmed();
|
||||
if ( line.size() == 0 ) continue;
|
||||
RiaLogging::info( addPrefix( line ) );
|
||||
}
|
||||
}
|
||||
|
||||
void RimProcessMonitor::started()
|
||||
{
|
||||
RiaLogging::debug( addPrefix( "Started" ) );
|
||||
}
|
@@ -0,0 +1,42 @@
|
||||
/////////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// 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.
|
||||
//
|
||||
/////////////////////////////////////////////////////////////////////////////////
|
||||
#pragma once
|
||||
|
||||
#include <QObject>
|
||||
#include <QProcess>
|
||||
|
||||
class RimProcessMonitor : public QObject
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
explicit RimProcessMonitor( int processId );
|
||||
|
||||
signals:
|
||||
|
||||
public slots:
|
||||
void error( QProcess::ProcessError error );
|
||||
void finished( int exitCode, QProcess::ExitStatus exitStatus );
|
||||
void readyReadStandardError();
|
||||
void readyReadStandardOutput();
|
||||
void started();
|
||||
|
||||
private:
|
||||
QString addPrefix( QString message );
|
||||
int m_processId;
|
||||
};
|
@@ -56,6 +56,7 @@
|
||||
#include "RimEclipseInputProperty.h"
|
||||
#include "RimEclipsePropertyFilter.h"
|
||||
#include "RimEclipsePropertyFilterCollection.h"
|
||||
#include "RimEclipseResultCase.h"
|
||||
#include "RimEclipseStatisticsCase.h"
|
||||
#include "RimEclipseView.h"
|
||||
#include "RimElasticProperties.h"
|
||||
@@ -66,6 +67,7 @@
|
||||
#include "RimEnsembleFractureStatisticsCollection.h"
|
||||
#include "RimExtrudedCurveIntersection.h"
|
||||
#include "RimFaultInView.h"
|
||||
#include "RimFaultInViewCollection.h"
|
||||
#include "RimFishbones.h"
|
||||
#include "RimFishbonesCollection.h"
|
||||
#include "RimFlowCharacteristicsPlot.h"
|
||||
@@ -269,6 +271,13 @@ caf::CmdFeatureMenuBuilder RimContextCommandBuilder::commandsFromSelection()
|
||||
menuBuilder << "Separator";
|
||||
menuBuilder << "RicCopyReferencesToClipboardFeature";
|
||||
menuBuilder << "Separator";
|
||||
#ifdef USE_ODB_API
|
||||
if ( dynamic_cast<RimEclipseResultCase*>( firstUiItem ) )
|
||||
{
|
||||
menuBuilder << "RicNewFaultReactAssessmentFeature";
|
||||
menuBuilder << "Separator";
|
||||
}
|
||||
#endif
|
||||
}
|
||||
else if ( dynamic_cast<RimGridInfoCollection*>( firstUiItem ) )
|
||||
{
|
||||
@@ -286,6 +295,8 @@ caf::CmdFeatureMenuBuilder RimContextCommandBuilder::commandsFromSelection()
|
||||
menuBuilder << "Separator";
|
||||
menuBuilder << "RicGeoMechCopyCaseFeature";
|
||||
menuBuilder << "Separator";
|
||||
menuBuilder << "RicNewFaultReactAssessmentFeature";
|
||||
menuBuilder << "Separator";
|
||||
}
|
||||
else if ( dynamic_cast<RimIdenticalGridCaseGroup*>( firstUiItem ) )
|
||||
{
|
||||
@@ -1115,6 +1126,19 @@ caf::CmdFeatureMenuBuilder RimContextCommandBuilder::commandsFromSelection()
|
||||
else if ( dynamic_cast<RimFaultInView*>( firstUiItem ) )
|
||||
{
|
||||
menuBuilder << "RicExportFaultsFeature";
|
||||
#ifdef USE_ODB_API
|
||||
menuBuilder.subMenuStart( "Reactivation Assessment" );
|
||||
menuBuilder << "RicRunBasicFaultReactAssessmentFeature";
|
||||
menuBuilder << "RicRunAdvFaultReactAssessmentFeature";
|
||||
menuBuilder.subMenuEnd();
|
||||
}
|
||||
else if ( dynamic_cast<RimFaultInViewCollection*>( firstUiItem ) )
|
||||
{
|
||||
menuBuilder.subMenuStart( "Reactivation Assessment" );
|
||||
menuBuilder << "RicRunBasicFaultReactAssessmentFeature";
|
||||
menuBuilder << "RicRunAdvFaultReactAssessmentFeature";
|
||||
menuBuilder.subMenuEnd();
|
||||
#endif
|
||||
}
|
||||
else if ( dynamic_cast<RimSimWellInView*>( firstUiItem ) )
|
||||
{
|
||||
|
@@ -1071,6 +1071,21 @@ RimEclipseCase* RimProject::eclipseCaseFromGridFileName( const QString& gridFile
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
RimEclipseCase* RimProject::eclipseCaseFromCaseId( const int caseId ) const
|
||||
{
|
||||
for ( RimEclipseCase* eclCase : eclipseCases() )
|
||||
{
|
||||
if ( eclCase->caseId() == caseId )
|
||||
{
|
||||
return eclCase;
|
||||
}
|
||||
}
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
|
@@ -166,6 +166,7 @@ public:
|
||||
|
||||
std::vector<RimEclipseCase*> eclipseCases() const;
|
||||
RimEclipseCase* eclipseCaseFromGridFileName( const QString& gridFileName ) const;
|
||||
RimEclipseCase* eclipseCaseFromCaseId( const int caseId ) const;
|
||||
|
||||
std::vector<QString> simulationWellNames() const;
|
||||
|
||||
|
@@ -1013,6 +1013,14 @@ bool RimRegularLegendConfig::showLegend() const
|
||||
return m_showLegend;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimRegularLegendConfig::setShowLegend( bool show )
|
||||
{
|
||||
m_showLegend = show;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
|
@@ -154,6 +154,7 @@ public:
|
||||
const cvf::ScalarMapper* scalarMapper() const { return m_currentScalarMapper.p(); }
|
||||
|
||||
bool showLegend() const;
|
||||
void setShowLegend( bool show );
|
||||
|
||||
const caf::TitledOverlayFrame* titledOverlayFrame() const override;
|
||||
caf::TitledOverlayFrame* titledOverlayFrame() override;
|
||||
|
@@ -25,14 +25,18 @@
|
||||
#include "RimGridCaseSurface.h"
|
||||
#include "RimGridView.h"
|
||||
#include "RimProject.h"
|
||||
#include "RimRegularLegendConfig.h"
|
||||
#include "RimSurface.h"
|
||||
#include "RimSurfaceInView.h"
|
||||
#include "RimSurfaceResultDefinition.h"
|
||||
|
||||
#include "cafPdmFieldReorderCapability.h"
|
||||
|
||||
#include "cafPdmFieldScriptingCapability.h"
|
||||
#include "cafPdmObjectScriptingCapability.h"
|
||||
|
||||
#include "QFile"
|
||||
|
||||
CAF_PDM_SOURCE_INIT( RimSurfaceCollection, "SurfaceCollection" );
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
@@ -107,7 +111,7 @@ void RimSurfaceCollection::addSurface( RimSurface* surface )
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
RimSurface* RimSurfaceCollection::importSurfacesFromFiles( const QStringList& fileNames )
|
||||
RimSurface* RimSurfaceCollection::importSurfacesFromFiles( const QStringList& fileNames, bool showLegend /* = true */ )
|
||||
{
|
||||
size_t newSurfCount = 0;
|
||||
size_t existingSurfCount = m_surfaces().size();
|
||||
@@ -144,7 +148,7 @@ RimSurface* RimSurfaceCollection::importSurfacesFromFiles( const QStringList& fi
|
||||
|
||||
this->updateConnectedEditors();
|
||||
|
||||
updateViews( surfacesToLoad );
|
||||
updateViews( surfacesToLoad, showLegend );
|
||||
|
||||
if ( newSurfCount > 0 && !m_surfaces.empty() )
|
||||
{
|
||||
@@ -265,7 +269,7 @@ void RimSurfaceCollection::loadData()
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimSurfaceCollection::updateViews( const std::vector<RimSurface*>& surfsToReload )
|
||||
void RimSurfaceCollection::updateViews( const std::vector<RimSurface*>& surfsToReload, bool showLegend /* = true */ )
|
||||
{
|
||||
RimProject* proj = RimProject::current();
|
||||
|
||||
@@ -289,6 +293,7 @@ void RimSurfaceCollection::updateViews( const std::vector<RimSurface*>& surfsToR
|
||||
for ( auto surfInView : surfsInView )
|
||||
{
|
||||
surfInView->clearGeometry();
|
||||
surfInView->surfaceResultDefinition()->legendConfig()->setShowLegend( showLegend );
|
||||
|
||||
RimGridView* gridView;
|
||||
surfInView->firstAncestorOrThisOfType( gridView );
|
||||
@@ -351,6 +356,34 @@ void RimSurfaceCollection::removeSurface( RimSurface* surface )
|
||||
m_surfaces.removeChildObject( surface );
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimSurfaceCollection::removeMissingFileSurfaces()
|
||||
{
|
||||
// get the existing surfaces
|
||||
std::list<RimFileSurface*> missingSurfaces;
|
||||
|
||||
// check if a filesurface references a file no longer present
|
||||
for ( auto& surface : surfaces() )
|
||||
{
|
||||
RimFileSurface* fileSurface = dynamic_cast<RimFileSurface*>( surface );
|
||||
if ( fileSurface == nullptr ) continue;
|
||||
|
||||
QString filename = fileSurface->surfaceFilePath();
|
||||
if ( !QFile::exists( filename ) )
|
||||
{
|
||||
missingSurfaces.push_back( fileSurface );
|
||||
}
|
||||
}
|
||||
|
||||
// remove all surfaces with a missing input file
|
||||
for ( auto& surface : missingSurfaces )
|
||||
{
|
||||
removeSurface( surface );
|
||||
}
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
@@ -446,3 +479,18 @@ bool RimSurfaceCollection::containsSurface()
|
||||
}
|
||||
return containsSurface;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
bool RimSurfaceCollection::containsFileSurface( QString filename )
|
||||
{
|
||||
for ( auto& surface : surfaces() )
|
||||
{
|
||||
RimFileSurface* fileSurface = dynamic_cast<RimFileSurface*>( surface );
|
||||
if ( fileSurface == nullptr ) continue;
|
||||
if ( fileSurface->surfaceFilePath() == filename ) return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
@@ -36,7 +36,7 @@ public:
|
||||
void addSurface( RimSurface* surface );
|
||||
void setAsTopmostFolder();
|
||||
|
||||
RimSurface* importSurfacesFromFiles( const QStringList& fileNames );
|
||||
RimSurface* importSurfacesFromFiles( const QStringList& fileNames, bool showLegend = true );
|
||||
RimSurface* addGridCaseSurface( RimCase* sourceCase );
|
||||
RimSurface* copySurfaces( std::vector<RimSurface*> surfaces );
|
||||
RimSurface* addSurfacesAtIndex( int index, std::vector<RimSurface*> surfaces );
|
||||
@@ -44,15 +44,17 @@ public:
|
||||
void addSubCollection( RimSurfaceCollection* collection );
|
||||
RimSurfaceCollection* getSubCollection( const QString name );
|
||||
|
||||
bool containsFileSurface( QString filename );
|
||||
bool containsSurface();
|
||||
|
||||
void reloadSurfaces( std::vector<RimSurface*> surfaces );
|
||||
void removeSurface( RimSurface* surface );
|
||||
void removeMissingFileSurfaces();
|
||||
|
||||
void loadData();
|
||||
|
||||
void updateViews();
|
||||
void updateViews( const std::vector<RimSurface*>& surfsToReload );
|
||||
void updateViews( const std::vector<RimSurface*>& surfsToReload, bool showLegend = true );
|
||||
|
||||
void onChildDeleted( caf::PdmChildArrayFieldHandle* childArray,
|
||||
std::vector<caf::PdmObjectHandle*>& referringObjects ) override;
|
||||
|
Reference in New Issue
Block a user