Refactored the Damaris command line functionality so that commandline arguments are accessed where they are needed in the DamarisKeywords() method

This commit is contained in:
josh bowden
2023-09-24 22:23:31 +02:00
parent bb38c57b1b
commit c7c4bffa7c
6 changed files with 85 additions and 77 deletions

View File

@@ -239,41 +239,9 @@ void Main::setupDamaris(const std::string& outputDir )
if (!outputDir.empty()) {
ensureOutputDirExists(outputDir);
}
bool enableDamarisOutputCollective = true ;
bool saveToDamarisHDF5 = true ;
std::string damarisPythonFilename = "" ;
std::string damarisPythonParaviewFilename = "" ;
std::string damarisSimName = "" ; // empty defaults to opm-sim-<magic_number>
std::string damarisLogLevel = "info" ;
int nDamarisCores = 1 ;
int nDamarisNodes = 0 ;
long shmemSizeBytes = 536870912 ;
enableDamarisOutputCollective = EWOMS_GET_PARAM(PreTypeTag, bool, EnableDamarisOutputCollective) ;
saveToDamarisHDF5 = EWOMS_GET_PARAM(PreTypeTag, bool, DamarisSaveToHdf);
damarisPythonFilename = EWOMS_GET_PARAM(PreTypeTag, std::string, DamarisPythonScript);
damarisPythonParaviewFilename = EWOMS_GET_PARAM(PreTypeTag, std::string, DamarisPythonParaviewScript);
damarisSimName = EWOMS_GET_PARAM(PreTypeTag, std::string, DamarisSimName);
nDamarisCores = EWOMS_GET_PARAM(PreTypeTag, int, DamarisDedicatedCores);
nDamarisNodes = EWOMS_GET_PARAM(PreTypeTag, int, DamarisDedicatedNodes);
shmemSizeBytes = EWOMS_GET_PARAM(PreTypeTag, long, DamarisSharedMemeorySizeBytes);
damarisLogLevel = EWOMS_GET_PARAM(PreTypeTag, std::string, DamarisLogLevel);
std::map<std::string, std::string> find_replace_map ;
find_replace_map = Opm::DamarisOutput::DamarisKeywords(EclGenericVanguard::comm(),
outputDir,
enableDamarisOutputCollective,
saveToDamarisHDF5,
nDamarisCores,
nDamarisNodes,
shmemSizeBytes,
damarisPythonFilename,
damarisSimName,
damarisLogLevel,
damarisPythonParaviewFilename
);
find_replace_map = Opm::DamarisOutput::DamarisKeywords(EclGenericVanguard::comm(), outputDir);
// By default EnableDamarisOutputCollective is true so all simulation results will
// be written into one single file for each iteration using Parallel HDF5.

View File

@@ -72,9 +72,7 @@
#include <opm/simulators/utils/ParallelEclipseState.hpp>
#endif
#if HAVE_DAMARIS
#include <opm/simulators/utils/DamarisKeywords.hpp>
#endif
#include <cassert>
#include <cstdlib>
@@ -98,6 +96,10 @@ struct FlowEarlyBird {
} // namespace Opm::Properties
#if HAVE_DAMARIS
#include <opm/simulators/utils/DamarisKeywords.hpp>
#endif
namespace Opm {
namespace Action { class State; }