From 5b737e987fb8991676088a7b8657c57cb09a1164 Mon Sep 17 00:00:00 2001 From: Luke Roberts Date: Tue, 19 Nov 2024 18:06:38 -0700 Subject: [PATCH] add unique ids to staged solvers --- src/solvers/bicgstab_solver_stages.hpp | 5 +++-- src/solvers/cg_solver_stages.hpp | 3 ++- src/solvers/mg_solver_stages.hpp | 3 ++- 3 files changed, 7 insertions(+), 4 deletions(-) diff --git a/src/solvers/bicgstab_solver_stages.hpp b/src/solvers/bicgstab_solver_stages.hpp index 0ebd2875ca9c..58f759925b8c 100644 --- a/src/solvers/bicgstab_solver_stages.hpp +++ b/src/solvers/bicgstab_solver_stages.hpp @@ -58,7 +58,8 @@ class BiCGSTABSolverStages : public SolverBase { // Internal containers for solver which create deep copies of sol_fields std::string container_rhat0, container_v, container_h, container_s; std::string container_t, container_r, container_p, container_x, container_diag; - + + static inline std::size_t id{0}; public: BiCGSTABSolverStages(const std::string &container_base, const std::string &container_u, const std::string &container_rhs, ParameterInput *pin, @@ -70,7 +71,7 @@ class BiCGSTABSolverStages : public SolverBase { eqs_(eq_in) { FieldTL::IterateTypes( [this](auto t) { this->sol_fields.push_back(decltype(t)::name()); }); - std::string solver_id = "bicgstab"; + std::string solver_id = "bicgstab" + std::to_string(id++); container_rhat0 = solver_id + "_rhat0"; container_v = solver_id + "_v"; container_h = solver_id + "_h"; diff --git a/src/solvers/cg_solver_stages.hpp b/src/solvers/cg_solver_stages.hpp index e3b8aab58f15..e76b1e63a0a6 100644 --- a/src/solvers/cg_solver_stages.hpp +++ b/src/solvers/cg_solver_stages.hpp @@ -60,6 +60,7 @@ class CGSolverStages : public SolverBase { // Internal containers for solver which create deep copies of sol_fields std::string container_x, container_r, container_v, container_p; + static inline std::size_t id{0}; public: CGSolverStages(const std::string &container_base, const std::string &container_u, const std::string &container_rhs, ParameterInput *pin, @@ -71,7 +72,7 @@ class CGSolverStages : public SolverBase { eqs_(eq_in) { FieldTL::IterateTypes( [this](auto t) { this->sol_fields.push_back(decltype(t)::name()); }); - std::string solver_id = "cg"; + std::string solver_id = "cg" + std::to_string(id++); container_x = solver_id + "_x"; container_r = solver_id + "_r"; container_v = solver_id + "_v"; diff --git a/src/solvers/mg_solver_stages.hpp b/src/solvers/mg_solver_stages.hpp index cb4afed43831..25e4efb87473 100644 --- a/src/solvers/mg_solver_stages.hpp +++ b/src/solvers/mg_solver_stages.hpp @@ -52,6 +52,7 @@ namespace solvers { // associated with the type diag_t. This is used for Jacobi iteration. template class MGSolverStages : public SolverBase { + static inline std::size_t id{0}; public: using FieldTL = typename equations_t::IndependentVars; @@ -85,7 +86,7 @@ class MGSolverStages : public SolverBase { prolongator_(prol_in) { FieldTL::IterateTypes( [this](auto t) { this->sol_fields.push_back(decltype(t)::name()); }); - std::string solver_id = "mg"; + std::string solver_id = "mg" + std::to_string(id++); container_res_err = solver_id + "_res_err"; container_temp = solver_id + "_temp"; container_u0 = solver_id + "_u0";