mirror of
https://github.com/OPM/ResInsight.git
synced 2026-10-26 07:00:17 -05:00
Update OPM Flow Job Preferences (#13172)
* Add job settings, with default settings in preferences. * Move opm flow settings to separate preferences tab * Add warning/error detection add display count next to progress * Adjust size of preference window
This commit is contained in:
15 files changed
+472
-52
No files matched your search
@@ -487,7 +487,9 @@ void RiaPreferences::defineUiOrdering( QString uiConfigName, caf::PdmUiOrdering&
|
||||
scriptGroup->add( &scriptDirectories );
|
||||
scriptGroup->add( &m_maxScriptFoldersDepth );
|
||||
scriptGroup->add( &scriptEditorExecutable );
|
||||
|
||||
}
|
||||
else if ( uiConfigName == RiaPreferences::tabNameOpmFlow() )
|
||||
{
|
||||
m_opmPreferences()->appendItems( uiOrdering );
|
||||
}
|
||||
#ifdef USE_ODB_API
|
||||
@@ -664,6 +666,14 @@ QString RiaPreferences::tabNameScripting()
|
||||
return "Scripting";
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
QString RiaPreferences::tabNameOpmFlow()
|
||||
{
|
||||
return "OPM Flow";
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
@@ -708,6 +718,7 @@ QStringList RiaPreferences::tabNames()
|
||||
names << tabNameSummary();
|
||||
names << tabNamePlotting();
|
||||
names << tabNameScripting();
|
||||
names << tabNameOpmFlow();
|
||||
#ifdef USE_ODB_API
|
||||
names << tabNameGeomech();
|
||||
#endif
|
||||
|
||||
@@ -172,6 +172,7 @@ private:
|
||||
static QString tabNameScripting();
|
||||
static QString tabNameSystem();
|
||||
static QString tabNameImportExport();
|
||||
static QString tabNameOpmFlow();
|
||||
|
||||
static double defaultMarginSize( QPageSize::PageSizeId pageSizeId );
|
||||
|
||||
|
||||
@@ -22,6 +22,9 @@
|
||||
#include "RiaPreferences.h"
|
||||
#include "RiaWslTools.h"
|
||||
|
||||
#include "Jobs/RimOpmFlowJobSettings.h"
|
||||
|
||||
#include "cafPdmUiCheckBoxEditor.h"
|
||||
#include "cafPdmUiComboBoxEditor.h"
|
||||
#include "cafPdmUiFilePathEditor.h"
|
||||
|
||||
@@ -32,20 +35,25 @@ CAF_PDM_SOURCE_INIT( RiaPreferencesOpm, "RiaPreferencesOpm" );
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
RiaPreferencesOpm::RiaPreferencesOpm()
|
||||
{
|
||||
CAF_PDM_InitFieldNoDefault( &m_opmFlowCommand, "opmFlowCommand", "Opm Flow Command to run" );
|
||||
CAF_PDM_InitFieldNoDefault( &m_opmFlowCommand, "opmFlowCommand", "Path to OPM Flow executable" );
|
||||
m_opmFlowCommand.uiCapability()->setUiEditorTypeName( caf::PdmUiFilePathEditor::uiEditorTypeName() );
|
||||
m_opmFlowCommand.uiCapability()->setUiLabelPosition( caf::PdmUiItemInfo::TOP );
|
||||
|
||||
CAF_PDM_InitField( &m_useWsl, "useWsl", false, "Use WSL to run Opm Flow" );
|
||||
CAF_PDM_InitField( &m_useMpi, "useMpi", false, "Use MPI to run Opm Flow" );
|
||||
CAF_PDM_InitField( &m_mpiProcesses, "mpiProcesses", 4, "Number of MPI processes to use" );
|
||||
CAF_PDM_InitField( &m_useWsl, "useWsl", false, "Use WSL to run OPM Flow" );
|
||||
CAF_PDM_InitField( &m_useMpi, "useMpi", false, "Enable MPI" );
|
||||
|
||||
CAF_PDM_InitField( &m_mpirunCommand, "mpirunCommand", QString( "/usr/bin/mpirun" ), "Path to mpirun command" );
|
||||
CAF_PDM_InitField( &m_mpirunCommand, "mpirunCommand", QString( "/usr/bin/mpirun" ), "Path to mpirun executable" );
|
||||
m_mpirunCommand.uiCapability()->setUiEditorTypeName( caf::PdmUiFilePathEditor::uiEditorTypeName() );
|
||||
m_mpirunCommand.uiCapability()->setUiLabelPosition( caf::PdmUiItemInfo::TOP );
|
||||
|
||||
CAF_PDM_InitFieldNoDefault( &m_wslDistribution, "wslDistribution", "WSL Distribution to use:" );
|
||||
m_wslDistribution.uiCapability()->setUiEditorTypeName( caf::PdmUiComboBoxEditor::uiEditorTypeName() );
|
||||
|
||||
CAF_PDM_InitFieldNoDefault( &m_jobSettings, "JobSettings", "OPM Flow Job Settings" );
|
||||
m_jobSettings = new RimOpmFlowJobSettings();
|
||||
m_jobSettings.uiCapability()->setUiTreeChildrenHidden( true );
|
||||
|
||||
caf::PdmUiNativeCheckBoxEditor::configureFieldForEditor( &m_useWsl );
|
||||
caf::PdmUiNativeCheckBoxEditor::configureFieldForEditor( &m_useMpi );
|
||||
|
||||
m_availableWslDists = RiaWslTools::wslDistributionList();
|
||||
if ( !m_availableWslDists.isEmpty() ) m_wslDistribution = m_availableWslDists.at( 0 );
|
||||
}
|
||||
@@ -63,7 +71,7 @@ RiaPreferencesOpm* RiaPreferencesOpm::current()
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RiaPreferencesOpm::appendItems( caf::PdmUiOrdering& uiOrdering )
|
||||
{
|
||||
caf::PdmUiGroup* opmGrp = uiOrdering.addNewGroup( "Opm Flow Settings" );
|
||||
caf::PdmUiGroup* opmGrp = uiOrdering.addNewGroup( "General Settings" );
|
||||
opmGrp->add( &m_opmFlowCommand );
|
||||
auto wslCmd = RiaWslTools::wslCommand();
|
||||
if ( !wslCmd.isEmpty() )
|
||||
@@ -78,9 +86,11 @@ void RiaPreferencesOpm::appendItems( caf::PdmUiOrdering& uiOrdering )
|
||||
opmGrp->add( &m_useMpi );
|
||||
if ( m_useMpi() )
|
||||
{
|
||||
opmGrp->add( &m_mpiProcesses );
|
||||
opmGrp->add( &m_mpirunCommand );
|
||||
}
|
||||
|
||||
auto cmdGrp = uiOrdering.addNewGroup( "Default Command Line Settings" );
|
||||
m_jobSettings->uiOrdering( cmdGrp );
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
@@ -159,7 +169,7 @@ bool RiaPreferencesOpm::useMpi() const
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
int RiaPreferencesOpm::mpiProcesses() const
|
||||
RimOpmFlowJobSettings* RiaPreferencesOpm::createDefaultJobSettings() const
|
||||
{
|
||||
return std::max( 1, m_mpiProcesses() );
|
||||
return m_jobSettings->clone();
|
||||
}
|
||||
@@ -21,6 +21,8 @@
|
||||
#include "cafPdmField.h"
|
||||
#include "cafPdmObject.h"
|
||||
|
||||
class RimOpmFlowJobSettings;
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
@@ -41,19 +43,20 @@ public:
|
||||
QStringList wslOptions() const;
|
||||
bool useWsl() const;
|
||||
bool useMpi() const;
|
||||
int mpiProcesses() const;
|
||||
QString mpirunCommand() const;
|
||||
|
||||
RimOpmFlowJobSettings* createDefaultJobSettings() const;
|
||||
|
||||
protected:
|
||||
QList<caf::PdmOptionItemInfo> calculateValueOptions( const caf::PdmFieldHandle* fieldNeedingOptions ) override;
|
||||
|
||||
private:
|
||||
caf::PdmField<QString> m_opmFlowCommand;
|
||||
caf::PdmField<bool> m_useWsl;
|
||||
caf::PdmField<QString> m_wslDistribution;
|
||||
caf::PdmField<bool> m_useMpi;
|
||||
caf::PdmField<int> m_mpiProcesses;
|
||||
caf::PdmField<QString> m_mpirunCommand;
|
||||
caf::PdmField<QString> m_opmFlowCommand;
|
||||
caf::PdmField<bool> m_useWsl;
|
||||
caf::PdmField<QString> m_wslDistribution;
|
||||
caf::PdmField<bool> m_useMpi;
|
||||
caf::PdmField<QString> m_mpirunCommand;
|
||||
caf::PdmChildField<RimOpmFlowJobSettings*> m_jobSettings;
|
||||
|
||||
QStringList m_availableWslDists;
|
||||
};
|
||||
Reference in new issue
Block a user