From c979eae2017682996d57512a60093ef8c09024d4 Mon Sep 17 00:00:00 2001 From: Arne Morten Kvarving Date: Fri, 5 Jul 2024 17:49:51 +0200 Subject: [PATCH] move EnableVtkOutput to TypeTag-free parameter system --- .../common/fvbasediscretization.hh | 7 +------ .../discretization/common/fvbaseparameters.hh | 17 ++++++++--------- .../discretization/common/fvbaseproblem.hh | 2 +- opm/models/io/vtkblackoilenergymodule.hh | 6 ++++-- opm/models/io/vtkblackoilmicpmodule.hh | 6 ++++-- opm/models/io/vtkblackoilmodule.hh | 3 ++- opm/models/io/vtkblackoilpolymermodule.hh | 6 ++++-- opm/models/io/vtkblackoilsolventmodule.hh | 6 ++++-- opm/models/io/vtkcompositionmodule.hh | 3 ++- opm/models/io/vtkdiffusionmodule.hh | 3 ++- opm/models/io/vtkdiscretefracturemodule.hh | 3 ++- opm/models/io/vtkenergymodule.hh | 3 ++- opm/models/io/vtkmultiphasemodule.hh | 3 ++- opm/models/io/vtkphasepresencemodule.hh | 3 ++- opm/models/io/vtkprimaryvarsmodule.hh | 3 ++- opm/models/io/vtkptflashmodule.hh | 3 ++- opm/models/io/vtktemperaturemodule.hh | 3 ++- 17 files changed, 46 insertions(+), 34 deletions(-) diff --git a/opm/models/discretization/common/fvbasediscretization.hh b/opm/models/discretization/common/fvbasediscretization.hh index 190748026..21b31bf6d 100644 --- a/opm/models/discretization/common/fvbasediscretization.hh +++ b/opm/models/discretization/common/fvbasediscretization.hh @@ -304,11 +304,6 @@ template struct EnableStorageCache { static constexpr bool value = false; }; -//! Enable the VTK output by default -template -struct EnableVtkOutput -{ static constexpr bool value = true; }; - // do not use thermodynamic hints by default. If you enable this, make sure to also // enable the intensive quantity cache above to avoid getting an exception... template @@ -533,7 +528,7 @@ public: Parameters::Register ("Enable adaptive grid refinement/coarsening"); - Parameters::registerParam + Parameters::Register ("Global switch for turning on writing VTK files"); Parameters::registerParam ("Enable thermodynamic hints"); diff --git a/opm/models/discretization/common/fvbaseparameters.hh b/opm/models/discretization/common/fvbaseparameters.hh index 22dacce31..175385fe3 100644 --- a/opm/models/discretization/common/fvbaseparameters.hh +++ b/opm/models/discretization/common/fvbaseparameters.hh @@ -53,6 +53,14 @@ struct EnableAsyncVtkOutput { static constexpr bool value = true; }; */ struct EnableGridAdaptation { static constexpr bool value = false; }; +/*! + * \brief Global switch to enable or disable the writing of VTK output files + * + * If writing VTK files is disabled, then the WriteVtk$FOO options do + * not have any effect... + */ +struct EnableVtkOutput { static constexpr bool value = true; }; + /*! * \brief The directory to which simulation output ought to be written to. */ @@ -61,15 +69,6 @@ struct OutputDir { static constexpr auto value = ""; }; //! \brief Number of threads per process. struct ThreadsPerProcess { static constexpr int value = 1; }; -/*! - * \brief Global switch to enable or disable the writing of VTK output files - * - * If writing VTK files is disabled, then the WriteVtk$FOO options do - * not have any effect... - */ -template -struct EnableVtkOutput { using type = Properties::UndefinedProperty; }; - /*! * \brief Specify the maximum size of a time integration [s]. * diff --git a/opm/models/discretization/common/fvbaseproblem.hh b/opm/models/discretization/common/fvbaseproblem.hh index d697b0c13..1bd01e993 100644 --- a/opm/models/discretization/common/fvbaseproblem.hh +++ b/opm/models/discretization/common/fvbaseproblem.hh @@ -812,7 +812,7 @@ protected: private: bool enableVtkOutput_() const - { return Parameters::get(); } + { return Parameters::Get(); } //! Returns the implementation of the problem (i.e. static polymorphism) Implementation& asImp_() diff --git a/opm/models/io/vtkblackoilenergymodule.hh b/opm/models/io/vtkblackoilenergymodule.hh index 0ce68f4ad..a72a100c2 100644 --- a/opm/models/io/vtkblackoilenergymodule.hh +++ b/opm/models/io/vtkblackoilenergymodule.hh @@ -141,8 +141,9 @@ public: */ void allocBuffers() { - if (!Parameters::get()) + if (!Parameters::Get()) { return; + } if (!enableEnergy) return; @@ -163,8 +164,9 @@ public: */ void processElement(const ElementContext& elemCtx) { - if (!Parameters::get()) + if (!Parameters::Get()) { return; + } if (!enableEnergy) return; diff --git a/opm/models/io/vtkblackoilmicpmodule.hh b/opm/models/io/vtkblackoilmicpmodule.hh index ebb95e54a..9c22e96e6 100644 --- a/opm/models/io/vtkblackoilmicpmodule.hh +++ b/opm/models/io/vtkblackoilmicpmodule.hh @@ -148,8 +148,9 @@ public: */ void allocBuffers() { - if (!Parameters::get()) + if (!Parameters::Get()) { return; + } if (!enableMICP) return; @@ -172,8 +173,9 @@ public: */ void processElement(const ElementContext& elemCtx) { - if (!Parameters::get()) + if (!Parameters::Get()) { return; + } if (!enableMICP) return; diff --git a/opm/models/io/vtkblackoilmodule.hh b/opm/models/io/vtkblackoilmodule.hh index 75ed870cd..6ec841f12 100644 --- a/opm/models/io/vtkblackoilmodule.hh +++ b/opm/models/io/vtkblackoilmodule.hh @@ -249,8 +249,9 @@ public: */ void processElement(const ElementContext& elemCtx) { - if (!Parameters::get()) + if (!Parameters::Get()) { return; + } for (unsigned dofIdx = 0; dofIdx < elemCtx.numPrimaryDof(/*timeIdx=*/0); ++dofIdx) { const auto& fs = elemCtx.intensiveQuantities(dofIdx, /*timeIdx=*/0).fluidState(); diff --git a/opm/models/io/vtkblackoilpolymermodule.hh b/opm/models/io/vtkblackoilpolymermodule.hh index 96024d089..31942f59f 100644 --- a/opm/models/io/vtkblackoilpolymermodule.hh +++ b/opm/models/io/vtkblackoilpolymermodule.hh @@ -160,8 +160,9 @@ public: */ void allocBuffers() { - if (!Parameters::get()) + if (!Parameters::Get()) { return; + } if (!enablePolymer) return; @@ -186,8 +187,9 @@ public: */ void processElement(const ElementContext& elemCtx) { - if (!Parameters::get()) + if (!Parameters::Get()) { return; + } if (!enablePolymer) return; diff --git a/opm/models/io/vtkblackoilsolventmodule.hh b/opm/models/io/vtkblackoilsolventmodule.hh index 6707c2ddc..3b4c5adea 100644 --- a/opm/models/io/vtkblackoilsolventmodule.hh +++ b/opm/models/io/vtkblackoilsolventmodule.hh @@ -150,8 +150,9 @@ public: */ void allocBuffers() { - if (!Parameters::get()) + if (!Parameters::Get()) { return; + } if (!enableSolvent) return; @@ -174,8 +175,9 @@ public: */ void processElement(const ElementContext& elemCtx) { - if (!Parameters::get()) + if (!Parameters::Get()) { return; + } if (!enableSolvent) return; diff --git a/opm/models/io/vtkcompositionmodule.hh b/opm/models/io/vtkcompositionmodule.hh index ce92e7913..f062032a3 100644 --- a/opm/models/io/vtkcompositionmodule.hh +++ b/opm/models/io/vtkcompositionmodule.hh @@ -191,8 +191,9 @@ public: { using Toolbox = MathToolbox; - if (!Parameters::get()) + if (!Parameters::Get()) { return; + } for (unsigned i = 0; i < elemCtx.numPrimaryDof(/*timeIdx=*/0); ++i) { unsigned I = elemCtx.globalSpaceIndex(i, /*timeIdx=*/0); diff --git a/opm/models/io/vtkdiffusionmodule.hh b/opm/models/io/vtkdiffusionmodule.hh index 0515e285c..023fd8a27 100644 --- a/opm/models/io/vtkdiffusionmodule.hh +++ b/opm/models/io/vtkdiffusionmodule.hh @@ -147,8 +147,9 @@ public: */ void processElement(const ElementContext& elemCtx) { - if (!Parameters::get()) + if (!Parameters::Get()) { return; + } for (unsigned i = 0; i < elemCtx.numPrimaryDof(/*timeIdx=*/0); ++i) { unsigned I = elemCtx.globalSpaceIndex(i, /*timeIdx=*/0); diff --git a/opm/models/io/vtkdiscretefracturemodule.hh b/opm/models/io/vtkdiscretefracturemodule.hh index 1d8f2e5a9..785e2715e 100644 --- a/opm/models/io/vtkdiscretefracturemodule.hh +++ b/opm/models/io/vtkdiscretefracturemodule.hh @@ -210,8 +210,9 @@ public: */ void processElement(const ElementContext& elemCtx) { - if (!Parameters::get()) + if (!Parameters::Get()) { return; + } const auto& fractureMapper = elemCtx.simulator().vanguard().fractureMapper(); diff --git a/opm/models/io/vtkenergymodule.hh b/opm/models/io/vtkenergymodule.hh index 868dc873d..411c12798 100644 --- a/opm/models/io/vtkenergymodule.hh +++ b/opm/models/io/vtkenergymodule.hh @@ -162,8 +162,9 @@ public: */ void processElement(const ElementContext& elemCtx) { - if (!Parameters::get()) + if (!Parameters::Get()) { return; + } for (unsigned i = 0; i < elemCtx.numPrimaryDof(/*timeIdx=*/0); ++i) { unsigned I = elemCtx.globalSpaceIndex(i, /*timeIdx=*/0); diff --git a/opm/models/io/vtkmultiphasemodule.hh b/opm/models/io/vtkmultiphasemodule.hh index 5417b19e4..881135211 100644 --- a/opm/models/io/vtkmultiphasemodule.hh +++ b/opm/models/io/vtkmultiphasemodule.hh @@ -273,8 +273,9 @@ public: */ void processElement(const ElementContext& elemCtx) { - if (!Parameters::get()) + if (!Parameters::Get()) { return; + } const auto& problem = elemCtx.problem(); for (unsigned i = 0; i < elemCtx.numPrimaryDof(/*timeIdx=*/0); ++i) { diff --git a/opm/models/io/vtkphasepresencemodule.hh b/opm/models/io/vtkphasepresencemodule.hh index 9a62eaf4c..37bec49a3 100644 --- a/opm/models/io/vtkphasepresencemodule.hh +++ b/opm/models/io/vtkphasepresencemodule.hh @@ -106,8 +106,9 @@ public: */ void processElement(const ElementContext& elemCtx) { - if (!Parameters::get()) + if (!Parameters::Get()) { return; + } for (unsigned i = 0; i < elemCtx.numPrimaryDof(/*timeIdx=*/0); ++i) { // calculate the phase presence diff --git a/opm/models/io/vtkprimaryvarsmodule.hh b/opm/models/io/vtkprimaryvarsmodule.hh index 4c06212e1..1bc02d2d7 100644 --- a/opm/models/io/vtkprimaryvarsmodule.hh +++ b/opm/models/io/vtkprimaryvarsmodule.hh @@ -131,8 +131,9 @@ public: */ void processElement(const ElementContext& elemCtx) { - if (!Parameters::get()) + if (!Parameters::Get()) { return; + } const auto& elementMapper = elemCtx.model().elementMapper(); unsigned elemIdx = static_cast(elementMapper.index(elemCtx.element())); diff --git a/opm/models/io/vtkptflashmodule.hh b/opm/models/io/vtkptflashmodule.hh index c0baad6e5..f8b9758c1 100644 --- a/opm/models/io/vtkptflashmodule.hh +++ b/opm/models/io/vtkptflashmodule.hh @@ -131,8 +131,9 @@ public: { using Toolbox = MathToolbox; - if (!Parameters::get()) + if (!Parameters::Get()) { return; + } for (unsigned i = 0; i < elemCtx.numPrimaryDof(/*timeIdx=*/0); ++i) { unsigned I = elemCtx.globalSpaceIndex(i, /*timeIdx=*/0); diff --git a/opm/models/io/vtktemperaturemodule.hh b/opm/models/io/vtktemperaturemodule.hh index 28ff584d3..d001569ed 100644 --- a/opm/models/io/vtktemperaturemodule.hh +++ b/opm/models/io/vtktemperaturemodule.hh @@ -112,8 +112,9 @@ public: { using Toolbox = MathToolbox; - if (!Parameters::get()) + if (!Parameters::Get()) { return; + } for (unsigned i = 0; i < elemCtx.numPrimaryDof(/*timeIdx=*/0); ++i) { unsigned I = elemCtx.globalSpaceIndex(i, /*timeIdx=*/0);