From 069b65a635949b0a21f50dbf0fe06d40faf4b771 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Atgeirr=20Fl=C3=B8=20Rasmussen?= Date: Wed, 19 Oct 2016 13:49:06 +0200 Subject: [PATCH] Add option to enable logging (default true). This makes it possible to avoid logging from this class in a parallel setting. --- opm/core/props/rock/RockCompressibility.cpp | 19 ++++++++++--------- opm/core/props/rock/RockCompressibility.hpp | 3 ++- 2 files changed, 12 insertions(+), 10 deletions(-) diff --git a/opm/core/props/rock/RockCompressibility.cpp b/opm/core/props/rock/RockCompressibility.cpp index f84125f0..36d28abe 100644 --- a/opm/core/props/rock/RockCompressibility.cpp +++ b/opm/core/props/rock/RockCompressibility.cpp @@ -42,7 +42,8 @@ namespace Opm } RockCompressibility::RockCompressibility(const Opm::Deck& deck, - const Opm::EclipseState& eclipseState) + const Opm::EclipseState& eclipseState, + const bool is_io_rank) : pref_(0.0), rock_comp_(0.0) { @@ -63,14 +64,14 @@ namespace Opm } else if (deck.hasKeyword("ROCK")) { const auto& rockKeyword = deck.getKeyword("ROCK"); if (rockKeyword.size() != 1) { - // here it would be better not to use std::cout directly but to add the - // warning to some "warning list"... - OpmLog::warning("Can only handle a single region in ROCK (" - + std::to_string(rockKeyword.size()) - + " regions specified)." - + " Ignoring all except for the first.\n" - + "In file " + rockKeyword.getFileName() - + ", line " + std::to_string(rockKeyword.getLineNumber()) + "\n"); + if (is_io_rank) { + OpmLog::warning("Can only handle a single region in ROCK (" + + std::to_string(rockKeyword.size()) + + " regions specified)." + + " Ignoring all except for the first.\n" + + "In file " + rockKeyword.getFileName() + + ", line " + std::to_string(rockKeyword.getLineNumber()) + "\n"); + } } pref_ = rockKeyword.getRecord(0).getItem("PREF").getSIDouble(0); diff --git a/opm/core/props/rock/RockCompressibility.hpp b/opm/core/props/rock/RockCompressibility.hpp index 675733aa..771521dc 100644 --- a/opm/core/props/rock/RockCompressibility.hpp +++ b/opm/core/props/rock/RockCompressibility.hpp @@ -36,7 +36,8 @@ namespace Opm /// Construct from input deck. /// Looks for the keywords ROCK and ROCKTAB. RockCompressibility(const Opm::Deck& deck, - const Opm::EclipseState& eclipseState); + const Opm::EclipseState& eclipseState, + const bool is_io_rank = true); /// Construct from parameters. /// Accepts the following parameters (with defaults).