diff --git a/opm/simulators/flow/DamarisWriter.hpp b/opm/simulators/flow/DamarisWriter.hpp index 22a7af7be..6b3eff833 100644 --- a/opm/simulators/flow/DamarisWriter.hpp +++ b/opm/simulators/flow/DamarisWriter.hpp @@ -163,7 +163,7 @@ public: (simulator, this->eclIO_->finalSummaryConfig(), this->collectOnIORank_); } - wanted_vars_set_ = Opm::DamarisOutput::getSetOfIncludedVariables(); + wanted_vars_set_ = DamarisOutput::getSetOfIncludedVariables(); } /*! diff --git a/opm/simulators/flow/Main.cpp b/opm/simulators/flow/Main.cpp index e5edfa04f..3abc4c07d 100644 --- a/opm/simulators/flow/Main.cpp +++ b/opm/simulators/flow/Main.cpp @@ -286,7 +286,6 @@ void Main::setupVanguard() #if HAVE_DAMARIS void Main::setupDamaris(const std::string& outputDir ) { - typedef Properties::TTag::FlowEarlyBird PreTypeTag; if (!outputDir.empty()) { ensureOutputDirExists(outputDir); } @@ -294,7 +293,7 @@ void Main::setupDamaris(const std::string& outputDir ) //const auto find_replace_map; //const auto find_replace_map = Opm::DamarisOutput::DamarisKeywords(EclGenericVanguard::comm(), outputDir); std::map find_replace_map; - find_replace_map = Opm::DamarisOutput::getDamarisKeywords(FlowGenericVanguard::comm(), outputDir); + find_replace_map = DamarisOutput::getDamarisKeywords(FlowGenericVanguard::comm(), outputDir); // By default EnableDamarisOutputCollective is true so all simulation results will // be written into one single file for each iteration using Parallel HDF5. diff --git a/opm/simulators/utils/DamarisKeywords.cpp b/opm/simulators/utils/DamarisKeywords.cpp index 87fe8310a..6c17fa0ae 100644 --- a/opm/simulators/utils/DamarisKeywords.cpp +++ b/opm/simulators/utils/DamarisKeywords.cpp @@ -47,8 +47,7 @@ and defaults are set in opm/simulators/flow/FlowProblemProperties.hpp */ -namespace Opm::DamarisOutput -{ +namespace Opm::DamarisOutput { bool FileExists(const std::string& filename_in, const Parallel::Communication& comm) @@ -258,4 +257,50 @@ DamarisSettings::getKeywords([[maybe_unused]] const Parallel::Communication& com return damaris_keywords; } +std::map +getDamarisKeywords(const Parallel::Communication& comm, const std::string& OutputDir) +{ + DamarisSettings settings; + // Get all of the Damaris keywords (except for --enable-damaris, + // which is used in simulators/flow/Main.hpp) + // These command line arguments are defined in opm/simulators/flow/DamarisWriter.hpp and + // defaults are set in opm/simulators/flow/FlowProblemProperties.hpp + settings.enableDamarisOutputCollective_ = Parameters::Get(); + settings.saveMeshToHDF5_ = Parameters::Get(); + settings.saveToDamarisHDF5_ = Parameters::Get(); + settings.pythonFilename_ = Parameters::Get(); + settings.paraviewPythonFilename_ = Parameters::Get(); + settings.damarisSimName_ = Parameters::Get(); + settings.nDamarisCores_ = Parameters::Get(); + settings.nDamarisNodes_ = Parameters::Get(); + settings.shmemSizeBytes_ = Parameters::Get(); + settings.shmemName_ = Parameters::Get(); + settings.damarisLogLevel_ = Parameters::Get(); + settings.damarisDaskFile_ = Parameters::Get(); + + return settings.getKeywords(comm, OutputDir); +} + +std::unordered_set +getSetOfIncludedVariables() +{ + std::unordered_set resuset ; + std::string tstr; + // The --damaris-limit-variables command line option (defaults to empty string) + std::string damarisLimitVars = Parameters::Get(); + std::stringstream ss(damarisLimitVars); + + // Use while loop to check the getline() function condition. + while (std::getline(ss, tstr, ',')) { + //remove whitespace + std::string::iterator end_pos = std::remove(tstr.begin(), tstr.end(), ' '); + tstr.erase(end_pos, tstr.end()); + // place in set (no duplicates possible in set and no empty string) + if (tstr != "") { + resuset.insert(tstr) ; + } + } + return resuset; +} + } // namespace Opm::DamarisOutput diff --git a/opm/simulators/utils/DamarisKeywords.hpp b/opm/simulators/utils/DamarisKeywords.hpp index ca6c04a95..10c7ae913 100644 --- a/opm/simulators/utils/DamarisKeywords.hpp +++ b/opm/simulators/utils/DamarisKeywords.hpp @@ -88,53 +88,10 @@ struct DamarisSettings * * N.B. This needs to be called before damaris_init() */ -template std::map -getDamarisKeywords(const Parallel::Communication& comm, const std::string& OutputDir) -{ - DamarisSettings settings; - // Get all of the Damaris keywords (except for --enable-damaris, - // which is used in simulators/flow/Main.hpp) - // These command line arguments are defined in opm/simulators/flow/DamarisWriter.hpp and - // defaults are set in opm/simulators/flow/FlowProblemProperties.hpp - settings.enableDamarisOutputCollective_ = Parameters::Get(); - settings.saveMeshToHDF5_ = Parameters::Get(); - settings.saveToDamarisHDF5_ = Parameters::Get(); - settings.pythonFilename_ = Parameters::Get(); - settings.paraviewPythonFilename_ = Parameters::Get(); - settings.damarisSimName_ = Parameters::Get(); - settings.nDamarisCores_ = Parameters::Get(); - settings.nDamarisNodes_ = Parameters::Get(); - settings.shmemSizeBytes_ = Parameters::Get(); - settings.shmemName_ = Parameters::Get(); - settings.damarisLogLevel_ = Parameters::Get(); - settings.damarisDaskFile_ = Parameters::Get(); +getDamarisKeywords(const Parallel::Communication& comm, const std::string& OutputDir); - return settings.getKeywords(comm, OutputDir); -} - -template -std::unordered_set -getSetOfIncludedVariables(void) -{ - std::unordered_set resuset ; - std::string tstr; - // The --damaris-limit-variables command line option (defaults to empty string) - std::string damarisLimitVars = Parameters::Get(); - std::stringstream ss(damarisLimitVars); - - // Use while loop to check the getline() function condition. - while (std::getline(ss, tstr, ',')) { - //remove whitespace - std::string::iterator end_pos = std::remove(tstr.begin(), tstr.end(), ' '); - tstr.erase(end_pos, tstr.end()); - // place in set (no duplicates possible in set and no empty string) - if (tstr != "") { - resuset.insert(tstr) ; - } - } - return resuset; -} +std::unordered_set getSetOfIncludedVariables(); } // namespace Opm::DamarisOutput