suanPan
Solver.h
Go to the documentation of this file.
1 /*******************************************************************************
2  * Copyright (C) 2017-2024 Theodore Chang
3  *
4  * This program is free software: you can redistribute it and/or modify
5  * it under the terms of the GNU General Public License as published by
6  * the Free Software Foundation, either version 3 of the License, or
7  * (at your option) any later version.
8  *
9  * This program is distributed in the hope that it will be useful,
10  * but WITHOUT ANY WARRANTY; without even the implied warranty of
11  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12  * GNU General Public License for more details.
13  *
14  * You should have received a copy of the GNU General Public License
15  * along with this program. If not, see <http://www.gnu.org/licenses/>.
16  ******************************************************************************/
30 #ifndef SOLVER_H
31 #define SOLVER_H
32 
33 #include <Domain/Tag.h>
34 
35 class Converger;
36 class Integrator;
37 
38 class Solver : public Tag {
39  shared_ptr<Converger> converger = nullptr;
40  shared_ptr<Integrator> modifier = nullptr;
41 
42  double step_amplifier = 1.0;
43 
44 public:
45  explicit Solver(unsigned = 0);
46  Solver(const Solver&) = default;
47  Solver(Solver&&) = default;
48  Solver& operator=(const Solver&) = delete;
49  Solver& operator=(Solver&&) = delete;
50  ~Solver() override = default;
51 
52  virtual int initialize();
53 
54  virtual int analyze() = 0;
55 
56  virtual void set_step_size(double) {}
57 
58  void set_step_amplifier(double);
59  [[nodiscard]] double get_step_amplifier() const;
60 
61  void set_converger(const shared_ptr<Converger>&);
62  [[nodiscard]] const shared_ptr<Converger>& get_converger() const;
63 
64  void set_integrator(const shared_ptr<Integrator>&);
65  [[nodiscard]] const shared_ptr<Integrator>& get_integrator() const;
66 
67  [[nodiscard]] bool constant_matrix() const;
68 };
69 
70 #endif
71 
The Converger class handles converger test to indicate if the iteration converges according to variou...
Definition: Converger.h:44
The Integrator class is basically a wrapper of the DomainBase class with regard to some status changi...
Definition: Integrator.h:51
A Solver class defines solvers used in analysis.
Definition: Solver.h:38
Solver(const Solver &)=default
virtual void set_step_size(double)
Definition: Solver.h:56
const shared_ptr< Integrator > & get_integrator() const
Definition: Solver.cpp:51
~Solver() override=default
const shared_ptr< Converger > & get_converger() const
Definition: Solver.cpp:47
void set_step_amplifier(double)
Definition: Solver.cpp:41
Solver & operator=(Solver &&)=delete
double get_step_amplifier() const
Definition: Solver.cpp:43
virtual int initialize()
Definition: Solver.cpp:27
bool constant_matrix() const
Definition: Solver.cpp:53
virtual int analyze()=0
Solver & operator=(const Solver &)=delete
Solver(Solver &&)=default
void set_integrator(const shared_ptr< Integrator > &)
Definition: Solver.cpp:49
Solver(unsigned=0)
Definition: Solver.cpp:24
void set_converger(const shared_ptr< Converger > &)
Definition: Solver.cpp:45
A base Tag class.
Definition: Tag.h:38