From 9c6e9b3715350f53ae3098a798530286453f7ade Mon Sep 17 00:00:00 2001 From: Markus Blatt Date: Tue, 20 Jun 2017 11:57:47 +0200 Subject: [PATCH] Use option output to activate or (partly) deactivate output to files. Possible values are none, log, and all. The first does not do any logging to files. The second does log to files but does not create and log to the DEBUG file. The latter uses all possible files. --- opm/autodiff/FlowMainEbos.hpp | 33 ++++++++++++++++++++++++++++++--- 1 file changed, 30 insertions(+), 3 deletions(-) diff --git a/opm/autodiff/FlowMainEbos.hpp b/opm/autodiff/FlowMainEbos.hpp index 5163c54ac..901bf6713 100755 --- a/opm/autodiff/FlowMainEbos.hpp +++ b/opm/autodiff/FlowMainEbos.hpp @@ -63,6 +63,15 @@ namespace Opm // The FlowMain class is the ebos based black-oil simulator. class FlowMainEbos { + enum FileOutputValue{ + //! \brief No output to files. + OUTPUT_NONE = 0, + //! \brief Output only to log files not DEBUG. + OUTPUT_LOG_ONLY = 1, + //! \brief Output to all files. + OUTPUT_ALL = 3 + }; + public: typedef TTAG(EclFlowProblem) TypeTag; typedef typename GET_PROP(TypeTag, MaterialLaw)::EclMaterialLawManager MaterialLawManager; @@ -232,7 +241,24 @@ namespace Opm // Throws std::runtime_error if failed to create (if requested) output dir. void setupOutput() { - output_to_files_ = output_cout_ && param_.getDefault("output", true); + std::string output = param_.getDefault("output", std::string("all")); + static std::map string2OutputEnum = + { {"none", OUTPUT_NONE }, + {"false", OUTPUT_LOG_ONLY }, + {"log", OUTPUT_LOG_ONLY }, + {"all" , OUTPUT_ALL }, + {"true" , OUTPUT_ALL }}; + auto converted = string2OutputEnum.find(output); + if ( converted != string2OutputEnum.end() ) + { + output_ = string2OutputEnum[output]; + } + else + { + std::cerr<<"Value "< OUTPUT_NONE; // Setup output directory. auto& ioConfig = eclState().getIOConfig(); @@ -284,7 +310,7 @@ namespace Opm logFile_ = logFileStream.str(); - if( ! param_.getDefault("no_prt_log", false) ) + if( output_ > OUTPUT_NONE) { std::shared_ptr prtLog = std::make_shared(logFile_ , Log::NoDebugMessageTypes, false, output_cout_); OpmLog::addBackend( "ECLIPSEPRTLOG" , prtLog ); @@ -292,7 +318,7 @@ namespace Opm prtLog->setMessageFormatter(std::make_shared(false)); } - if( ! param_.getDefault("no_debug_log", false) ) + if( output_ > OUTPUT_LOG_ONLY ) { std::string debugFile = debugFileStream.str(); std::shared_ptr debugLog = std::make_shared(debugFile, Log::DefaultMessageTypes, false, output_cout_); @@ -916,6 +942,7 @@ namespace Opm std::unique_ptr ebosSimulator_; int mpi_rank_ = 0; bool output_cout_ = false; + FileOutputValue output_ = OUTPUT_ALL; bool must_distribute_ = false; ParameterGroup param_; bool output_to_files_ = false;