move EnableVtkOutput to TypeTag-free parameter system

This commit is contained in:
Arne Morten Kvarving 2024-07-05 17:49:51 +02:00
parent 8a67f44793
commit c979eae201
17 changed files with 46 additions and 34 deletions

View File

@ -304,11 +304,6 @@ template<class TypeTag>
struct EnableStorageCache<TypeTag, Properties::TTag::FvBaseDiscretization> struct EnableStorageCache<TypeTag, Properties::TTag::FvBaseDiscretization>
{ static constexpr bool value = false; }; { static constexpr bool value = false; };
//! Enable the VTK output by default
template<class TypeTag>
struct EnableVtkOutput<TypeTag, Properties::TTag::FvBaseDiscretization>
{ static constexpr bool value = true; };
// do not use thermodynamic hints by default. If you enable this, make sure to also // 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... // enable the intensive quantity cache above to avoid getting an exception...
template<class TypeTag> template<class TypeTag>
@ -533,7 +528,7 @@ public:
Parameters::Register<Parameters::EnableGridAdaptation> Parameters::Register<Parameters::EnableGridAdaptation>
("Enable adaptive grid refinement/coarsening"); ("Enable adaptive grid refinement/coarsening");
Parameters::registerParam<TypeTag, Parameters::EnableVtkOutput> Parameters::Register<Parameters::EnableVtkOutput>
("Global switch for turning on writing VTK files"); ("Global switch for turning on writing VTK files");
Parameters::registerParam<TypeTag, Parameters::EnableThermodynamicHints> Parameters::registerParam<TypeTag, Parameters::EnableThermodynamicHints>
("Enable thermodynamic hints"); ("Enable thermodynamic hints");

View File

@ -53,6 +53,14 @@ struct EnableAsyncVtkOutput { static constexpr bool value = true; };
*/ */
struct EnableGridAdaptation { static constexpr bool value = false; }; 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. * \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. //! \brief Number of threads per process.
struct ThreadsPerProcess { static constexpr int value = 1; }; 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<class TypeTag, class MyTypeTag>
struct EnableVtkOutput { using type = Properties::UndefinedProperty; };
/*! /*!
* \brief Specify the maximum size of a time integration [s]. * \brief Specify the maximum size of a time integration [s].
* *

View File

@ -812,7 +812,7 @@ protected:
private: private:
bool enableVtkOutput_() const bool enableVtkOutput_() const
{ return Parameters::get<TypeTag, Parameters::EnableVtkOutput>(); } { return Parameters::Get<Parameters::EnableVtkOutput>(); }
//! Returns the implementation of the problem (i.e. static polymorphism) //! Returns the implementation of the problem (i.e. static polymorphism)
Implementation& asImp_() Implementation& asImp_()

View File

@ -141,8 +141,9 @@ public:
*/ */
void allocBuffers() void allocBuffers()
{ {
if (!Parameters::get<TypeTag, Parameters::EnableVtkOutput>()) if (!Parameters::Get<Parameters::EnableVtkOutput>()) {
return; return;
}
if (!enableEnergy) if (!enableEnergy)
return; return;
@ -163,8 +164,9 @@ public:
*/ */
void processElement(const ElementContext& elemCtx) void processElement(const ElementContext& elemCtx)
{ {
if (!Parameters::get<TypeTag, Parameters::EnableVtkOutput>()) if (!Parameters::Get<Parameters::EnableVtkOutput>()) {
return; return;
}
if (!enableEnergy) if (!enableEnergy)
return; return;

View File

@ -148,8 +148,9 @@ public:
*/ */
void allocBuffers() void allocBuffers()
{ {
if (!Parameters::get<TypeTag, Parameters::EnableVtkOutput>()) if (!Parameters::Get<Parameters::EnableVtkOutput>()) {
return; return;
}
if (!enableMICP) if (!enableMICP)
return; return;
@ -172,8 +173,9 @@ public:
*/ */
void processElement(const ElementContext& elemCtx) void processElement(const ElementContext& elemCtx)
{ {
if (!Parameters::get<TypeTag, Parameters::EnableVtkOutput>()) if (!Parameters::Get<Parameters::EnableVtkOutput>()) {
return; return;
}
if (!enableMICP) if (!enableMICP)
return; return;

View File

@ -249,8 +249,9 @@ public:
*/ */
void processElement(const ElementContext& elemCtx) void processElement(const ElementContext& elemCtx)
{ {
if (!Parameters::get<TypeTag, Parameters::EnableVtkOutput>()) if (!Parameters::Get<Parameters::EnableVtkOutput>()) {
return; return;
}
for (unsigned dofIdx = 0; dofIdx < elemCtx.numPrimaryDof(/*timeIdx=*/0); ++dofIdx) { for (unsigned dofIdx = 0; dofIdx < elemCtx.numPrimaryDof(/*timeIdx=*/0); ++dofIdx) {
const auto& fs = elemCtx.intensiveQuantities(dofIdx, /*timeIdx=*/0).fluidState(); const auto& fs = elemCtx.intensiveQuantities(dofIdx, /*timeIdx=*/0).fluidState();

View File

@ -160,8 +160,9 @@ public:
*/ */
void allocBuffers() void allocBuffers()
{ {
if (!Parameters::get<TypeTag, Parameters::EnableVtkOutput>()) if (!Parameters::Get<Parameters::EnableVtkOutput>()) {
return; return;
}
if (!enablePolymer) if (!enablePolymer)
return; return;
@ -186,8 +187,9 @@ public:
*/ */
void processElement(const ElementContext& elemCtx) void processElement(const ElementContext& elemCtx)
{ {
if (!Parameters::get<TypeTag, Parameters::EnableVtkOutput>()) if (!Parameters::Get<Parameters::EnableVtkOutput>()) {
return; return;
}
if (!enablePolymer) if (!enablePolymer)
return; return;

View File

@ -150,8 +150,9 @@ public:
*/ */
void allocBuffers() void allocBuffers()
{ {
if (!Parameters::get<TypeTag, Parameters::EnableVtkOutput>()) if (!Parameters::Get<Parameters::EnableVtkOutput>()) {
return; return;
}
if (!enableSolvent) if (!enableSolvent)
return; return;
@ -174,8 +175,9 @@ public:
*/ */
void processElement(const ElementContext& elemCtx) void processElement(const ElementContext& elemCtx)
{ {
if (!Parameters::get<TypeTag, Parameters::EnableVtkOutput>()) if (!Parameters::Get<Parameters::EnableVtkOutput>()) {
return; return;
}
if (!enableSolvent) if (!enableSolvent)
return; return;

View File

@ -191,8 +191,9 @@ public:
{ {
using Toolbox = MathToolbox<Evaluation>; using Toolbox = MathToolbox<Evaluation>;
if (!Parameters::get<TypeTag, Parameters::EnableVtkOutput>()) if (!Parameters::Get<Parameters::EnableVtkOutput>()) {
return; return;
}
for (unsigned i = 0; i < elemCtx.numPrimaryDof(/*timeIdx=*/0); ++i) { for (unsigned i = 0; i < elemCtx.numPrimaryDof(/*timeIdx=*/0); ++i) {
unsigned I = elemCtx.globalSpaceIndex(i, /*timeIdx=*/0); unsigned I = elemCtx.globalSpaceIndex(i, /*timeIdx=*/0);

View File

@ -147,8 +147,9 @@ public:
*/ */
void processElement(const ElementContext& elemCtx) void processElement(const ElementContext& elemCtx)
{ {
if (!Parameters::get<TypeTag, Parameters::EnableVtkOutput>()) if (!Parameters::Get<Parameters::EnableVtkOutput>()) {
return; return;
}
for (unsigned i = 0; i < elemCtx.numPrimaryDof(/*timeIdx=*/0); ++i) { for (unsigned i = 0; i < elemCtx.numPrimaryDof(/*timeIdx=*/0); ++i) {
unsigned I = elemCtx.globalSpaceIndex(i, /*timeIdx=*/0); unsigned I = elemCtx.globalSpaceIndex(i, /*timeIdx=*/0);

View File

@ -210,8 +210,9 @@ public:
*/ */
void processElement(const ElementContext& elemCtx) void processElement(const ElementContext& elemCtx)
{ {
if (!Parameters::get<TypeTag, Parameters::EnableVtkOutput>()) if (!Parameters::Get<Parameters::EnableVtkOutput>()) {
return; return;
}
const auto& fractureMapper = elemCtx.simulator().vanguard().fractureMapper(); const auto& fractureMapper = elemCtx.simulator().vanguard().fractureMapper();

View File

@ -162,8 +162,9 @@ public:
*/ */
void processElement(const ElementContext& elemCtx) void processElement(const ElementContext& elemCtx)
{ {
if (!Parameters::get<TypeTag, Parameters::EnableVtkOutput>()) if (!Parameters::Get<Parameters::EnableVtkOutput>()) {
return; return;
}
for (unsigned i = 0; i < elemCtx.numPrimaryDof(/*timeIdx=*/0); ++i) { for (unsigned i = 0; i < elemCtx.numPrimaryDof(/*timeIdx=*/0); ++i) {
unsigned I = elemCtx.globalSpaceIndex(i, /*timeIdx=*/0); unsigned I = elemCtx.globalSpaceIndex(i, /*timeIdx=*/0);

View File

@ -273,8 +273,9 @@ public:
*/ */
void processElement(const ElementContext& elemCtx) void processElement(const ElementContext& elemCtx)
{ {
if (!Parameters::get<TypeTag, Parameters::EnableVtkOutput>()) if (!Parameters::Get<Parameters::EnableVtkOutput>()) {
return; return;
}
const auto& problem = elemCtx.problem(); const auto& problem = elemCtx.problem();
for (unsigned i = 0; i < elemCtx.numPrimaryDof(/*timeIdx=*/0); ++i) { for (unsigned i = 0; i < elemCtx.numPrimaryDof(/*timeIdx=*/0); ++i) {

View File

@ -106,8 +106,9 @@ public:
*/ */
void processElement(const ElementContext& elemCtx) void processElement(const ElementContext& elemCtx)
{ {
if (!Parameters::get<TypeTag, Parameters::EnableVtkOutput>()) if (!Parameters::Get<Parameters::EnableVtkOutput>()) {
return; return;
}
for (unsigned i = 0; i < elemCtx.numPrimaryDof(/*timeIdx=*/0); ++i) { for (unsigned i = 0; i < elemCtx.numPrimaryDof(/*timeIdx=*/0); ++i) {
// calculate the phase presence // calculate the phase presence

View File

@ -131,8 +131,9 @@ public:
*/ */
void processElement(const ElementContext& elemCtx) void processElement(const ElementContext& elemCtx)
{ {
if (!Parameters::get<TypeTag, Parameters::EnableVtkOutput>()) if (!Parameters::Get<Parameters::EnableVtkOutput>()) {
return; return;
}
const auto& elementMapper = elemCtx.model().elementMapper(); const auto& elementMapper = elemCtx.model().elementMapper();
unsigned elemIdx = static_cast<unsigned>(elementMapper.index(elemCtx.element())); unsigned elemIdx = static_cast<unsigned>(elementMapper.index(elemCtx.element()));

View File

@ -131,8 +131,9 @@ public:
{ {
using Toolbox = MathToolbox<Evaluation>; using Toolbox = MathToolbox<Evaluation>;
if (!Parameters::get<TypeTag, Parameters::EnableVtkOutput>()) if (!Parameters::Get<Parameters::EnableVtkOutput>()) {
return; return;
}
for (unsigned i = 0; i < elemCtx.numPrimaryDof(/*timeIdx=*/0); ++i) { for (unsigned i = 0; i < elemCtx.numPrimaryDof(/*timeIdx=*/0); ++i) {
unsigned I = elemCtx.globalSpaceIndex(i, /*timeIdx=*/0); unsigned I = elemCtx.globalSpaceIndex(i, /*timeIdx=*/0);

View File

@ -112,8 +112,9 @@ public:
{ {
using Toolbox = MathToolbox<Evaluation>; using Toolbox = MathToolbox<Evaluation>;
if (!Parameters::get<TypeTag, Parameters::EnableVtkOutput>()) if (!Parameters::Get<Parameters::EnableVtkOutput>()) {
return; return;
}
for (unsigned i = 0; i < elemCtx.numPrimaryDof(/*timeIdx=*/0); ++i) { for (unsigned i = 0; i < elemCtx.numPrimaryDof(/*timeIdx=*/0); ++i) {
unsigned I = elemCtx.globalSpaceIndex(i, /*timeIdx=*/0); unsigned I = elemCtx.globalSpaceIndex(i, /*timeIdx=*/0);