Skip to content

Commit

Permalink
add unique ids to staged solvers
Browse files Browse the repository at this point in the history
  • Loading branch information
lroberts36 committed Nov 20, 2024
1 parent 456be28 commit 5b737e9
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 4 deletions.
5 changes: 3 additions & 2 deletions src/solvers/bicgstab_solver_stages.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand All @@ -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";
Expand Down
3 changes: 2 additions & 1 deletion src/solvers/cg_solver_stages.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand All @@ -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";
Expand Down
3 changes: 2 additions & 1 deletion src/solvers/mg_solver_stages.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,7 @@ namespace solvers {
// associated with the type diag_t. This is used for Jacobi iteration.
template <class equations_t, class prolongator_t = ProlongationBlockInteriorDefault>
class MGSolverStages : public SolverBase {
static inline std::size_t id{0};
public:
using FieldTL = typename equations_t::IndependentVars;

Expand Down Expand Up @@ -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";
Expand Down

0 comments on commit 5b737e9

Please sign in to comment.