diff --git a/CHANGELOG.md b/CHANGELOG.md index 2bce72088597..1365442a8764 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -21,6 +21,7 @@ - [[PR 868]](https://github.com/parthenon-hpc-lab/parthenon/pull/868) Add block-local face, edge, and nodal fields and allow for packing ### Changed (changing behavior/API/variables/...) +- [[PR 975]](https://github.com/parthenon-hpc-lab/parthenon/pull/975) Construct staged integrators via arbitrary name - [[PR 976]](https://github.com/parthenon-hpc-lab/parthenon/pull/976) Move UserWorkBeforeLoop to be after first output - [[PR 965]](https://github.com/parthenon-hpc-lab/parthenon/pull/965) Allow leading whitespace in input parameters - [[PR 926]](https://github.com/parthenon-hpc-lab/parthenon/pull/926) Internal refinement op registration diff --git a/src/time_integration/butcher_integrator.cpp b/src/time_integration/butcher_integrator.cpp index d90de479ec68..40096dd1eeba 100644 --- a/src/time_integration/butcher_integrator.cpp +++ b/src/time_integration/butcher_integrator.cpp @@ -36,8 +36,12 @@ namespace parthenon { * alpha_k = c_k * c_k = b_k */ -ButcherIntegrator::ButcherIntegrator(ParameterInput *pin) - : StagedIntegrator(pin->GetOrAddString("parthenon/time", "integrator", "rk2")) { + +//---------------------------------------------------------------------------------------- +//! \class ButcherIntegrator::ButcherIntegrator(const std::string &name) +//! \brief Constructs a ButcherIntegrator instance given a string (e.g., rk2, rk3..) + +ButcherIntegrator::ButcherIntegrator(const std::string &name) : StagedIntegrator(name) { if (name_ == "rk1") { nstages = nbuffers = 1; Resize_(nstages); @@ -219,6 +223,17 @@ ButcherIntegrator::ButcherIntegrator(ParameterInput *pin) } } +//---------------------------------------------------------------------------------------- +//! \class ButcherIntegrator::ButcherIntegrator(ParameterInput *pin) +//! \brief Constructs a ButcherIntegrator instance given ParameterInput *pin + +ButcherIntegrator::ButcherIntegrator(ParameterInput *pin) + : ButcherIntegrator(pin->GetOrAddString("parthenon/time", "integrator", "rk2")) {} + +//---------------------------------------------------------------------------------------- +//! \fn void ButcherIntegrator::Resize_(int nstages) +//! \brief Resizes ButcherIntegrator registers given a supplied integer nstages + void ButcherIntegrator::Resize_(int nstages) { a.resize(nstages); for (int i = 0; i < a.size(); ++i) { diff --git a/src/time_integration/low_storage_integrator.cpp b/src/time_integration/low_storage_integrator.cpp index ab874d98e050..d833ddd8ad20 100644 --- a/src/time_integration/low_storage_integrator.cpp +++ b/src/time_integration/low_storage_integrator.cpp @@ -43,8 +43,13 @@ namespace parthenon { * Stone et al., ApJS (2020) 249:4 * See equations 11 through 15. */ -LowStorageIntegrator::LowStorageIntegrator(ParameterInput *pin) - : StagedIntegrator(pin->GetOrAddString("parthenon/time", "integrator", "rk2")) { + +//---------------------------------------------------------------------------------------- +//! \class LowStorageIntegrator::LowStorageIntegrator(const std::string &name) +//! \brief Constructs a LowStorageIntegrator instance given a string (e.g., rk2, rk3..) + +LowStorageIntegrator::LowStorageIntegrator(const std::string &name) + : StagedIntegrator(name) { if (name_ == "rk1") { nstages = 1; nbuffers = 1; @@ -155,4 +160,11 @@ LowStorageIntegrator::LowStorageIntegrator(ParameterInput *pin) MakePeriodicNames_(stage_name, nstages); } +//---------------------------------------------------------------------------------------- +//! \class LowStorageIntegrator::LowStorageIntegrator(ParameterInput *pin) +//! \brief Constructs a LowStorageIntegrator instance given ParameterInput *pin + +LowStorageIntegrator::LowStorageIntegrator(ParameterInput *pin) + : LowStorageIntegrator(pin->GetOrAddString("parthenon/time", "integrator", "rk2")) {} + } // namespace parthenon diff --git a/src/time_integration/staged_integrator.hpp b/src/time_integration/staged_integrator.hpp index 0d22d7d85600..329f69bc294b 100644 --- a/src/time_integration/staged_integrator.hpp +++ b/src/time_integration/staged_integrator.hpp @@ -49,6 +49,7 @@ class StagedIntegrator { class LowStorageIntegrator : public StagedIntegrator { public: LowStorageIntegrator() = default; + explicit LowStorageIntegrator(const std::string &name); explicit LowStorageIntegrator(ParameterInput *pin); std::vector delta; std::vector beta; @@ -60,6 +61,7 @@ class LowStorageIntegrator : public StagedIntegrator { class ButcherIntegrator : public StagedIntegrator { public: ButcherIntegrator() = default; + explicit ButcherIntegrator(const std::string &name); explicit ButcherIntegrator(ParameterInput *pin); // TODO(JMM): Should I do a flat array with indexing instead? std::vector> a;