|
10 | 10 | // license in this material to reproduce, prepare derivative works, distribute copies to
|
11 | 11 | // the public, perform publicly and display publicly, and to permit others to do so.
|
12 | 12 | //========================================================================================
|
13 |
| -#ifndef SOLVERS_CG_SOLVER_STAGES_HPP_ |
14 |
| -#define SOLVERS_CG_SOLVER_STAGES_HPP_ |
| 13 | +#ifndef SOLVERS_CG_SOLVER_HPP_ |
| 14 | +#define SOLVERS_CG_SOLVER_HPP_ |
15 | 15 |
|
16 | 16 | #include <cstdio>
|
17 | 17 | #include <limits>
|
|
24 | 24 | #include "interface/meshblock_data.hpp"
|
25 | 25 | #include "interface/state_descriptor.hpp"
|
26 | 26 | #include "kokkos_abstraction.hpp"
|
27 |
| -#include "solvers/mg_solver_stages.hpp" |
| 27 | +#include "solvers/mg_solver.hpp" |
28 | 28 | #include "solvers/solver_base.hpp"
|
29 | 29 | #include "solvers/solver_utils.hpp"
|
30 | 30 | #include "tasks/tasks.hpp"
|
@@ -79,18 +79,19 @@ class CGSolver : public SolverBase {
|
79 | 79 | std::string container_x, container_r, container_v, container_p;
|
80 | 80 |
|
81 | 81 | static inline std::size_t id{0};
|
| 82 | + |
82 | 83 | public:
|
83 | 84 | CGSolver(const std::string &container_base, const std::string &container_u,
|
84 |
| - const std::string &container_rhs, ParameterInput *pin, |
85 |
| - const std::string &input_block, const equations &eq_in = equations()) |
| 85 | + const std::string &container_rhs, ParameterInput *pin, |
| 86 | + const std::string &input_block, const equations &eq_in = equations()) |
86 | 87 | : preconditioner(container_base, container_u, container_rhs, pin, input_block,
|
87 | 88 | eq_in),
|
88 | 89 | container_base(container_base), container_u(container_u),
|
89 | 90 | container_rhs(container_rhs), params_(pin, input_block), iter_counter(0),
|
90 | 91 | eqs_(eq_in) {
|
91 | 92 | FieldTL::IterateTypes(
|
92 | 93 | [this](auto t) { this->sol_fields.push_back(decltype(t)::name()); });
|
93 |
| - std::string solver_id = "cg" + std::to_string(id++); |
| 94 | + std::string solver_id = "cg" + std::to_string(id++); |
94 | 95 | container_x = solver_id + "_x";
|
95 | 96 | container_r = solver_id + "_r";
|
96 | 97 | container_v = solver_id + "_v";
|
@@ -146,8 +147,8 @@ class CGSolver : public SolverBase {
|
146 | 147 | if (params_.print_per_step && Globals::my_rank == 0) {
|
147 | 148 | initialize = tl.AddTask(
|
148 | 149 | TaskQualifier::once_per_region, initialize, "print to screen",
|
149 |
| - [&](CGSolver *solver, std::shared_ptr<Real> res_tol, |
150 |
| - bool relative_residual, Mesh *pm) { |
| 150 | + [&](CGSolver *solver, std::shared_ptr<Real> res_tol, bool relative_residual, |
| 151 | + Mesh *pm) { |
151 | 152 | Real tol = relative_residual
|
152 | 153 | ? *res_tol * std::sqrt(solver->rhs2.val / pm->GetTotalCells())
|
153 | 154 | : *res_tol;
|
@@ -240,8 +241,8 @@ class CGSolver : public SolverBase {
|
240 | 241 |
|
241 | 242 | auto check = itl.AddTask(
|
242 | 243 | TaskQualifier::completion, get_res | correct_x, "completion",
|
243 |
| - [](CGSolver *solver, Mesh *pmesh, int max_iter, |
244 |
| - std::shared_ptr<Real> res_tol, bool relative_residual) { |
| 244 | + [](CGSolver *solver, Mesh *pmesh, int max_iter, std::shared_ptr<Real> res_tol, |
| 245 | + bool relative_residual) { |
245 | 246 | Real rms_res = std::sqrt(solver->residual.val / pmesh->GetTotalCells());
|
246 | 247 | solver->final_residual = rms_res;
|
247 | 248 | solver->final_iteration = solver->iter_counter;
|
@@ -278,4 +279,4 @@ class CGSolver : public SolverBase {
|
278 | 279 | } // namespace solvers
|
279 | 280 | } // namespace parthenon
|
280 | 281 |
|
281 |
| -#endif // SOLVERS_CG_SOLVER_STAGES_HPP_ |
| 282 | +#endif // SOLVERS_CG_SOLVER_HPP_ |
0 commit comments