1%%%%%%%%%%%%%%%%%%%
2% XLiFE++ is an extended library of finite elements written in C++
3%     Copyright (C) 2014  Lunéville, Eric; Kielbasiewicz, Nicolas; Lafranche, Yvon; Nguyen, Manh-Ha; Chambeyron, Colin
4%
5%     This program is free software: you can redistribute it and/or modify
6%     it under the terms of the GNU General Public License as published by
7%     the Free Software Foundation, either version 3 of the License, or
8%     (at your option) any later version.
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%     You should have received a copy of the GNU General Public License
14%     along with this program.  If not, see <http://www.gnu.org/licenses/>.
15%%%%%%%%%%%%%%%%%%%
16
17\section{The {\classtitle IterativeSolver} class}
18
19As the base class of all other solver classes, the {\class IterativeSolver} provides some basic properties and methods for all descendants.
20\vspace{.1cm}
21\begin{lstlisting}
22class IterativeSolver
23{
24  public:
25    //! Constructor by name
26    IterativeSolver(const String&, const Number vb = 0);
27    //! Full constructor
28    IterativeSolver(const String&, const Number maxOfIt,
29                    const Real eps, const Number vb = 0, const bool prec = true);
30    //! Destructor
31    virtual ~IterativeSolver();
32    //! Iterative solver name for documentation purposes
33    String name() { return name_; }
34    //! Reset Solver
35    void resetSolver();
36  protected:
37    //!  Define a default value for the maximum number of iterations
38    Number maximumOfIterations(const size_t nbRows);
39    //!  Define a default value for krylov dimension
40    Number krylovDimension(Number kd, const size_t nbRows)
41    ...
42\end{lstlisting}
43\vspace{.1cm}
44
45A solver object can be constructed in several ways: With default values or with user-input values.
46Information of solver can be printed out with some auxiliary functions.
47\vspace{.1cm}
48\begin{lstlisting}[]
49    void printHeader(const size_t) const;
50    void printHeader(const size_t, const String&) const;
51    void printHeader(const size_t, const Real) const;
52    void printHeader(const size_t, const Number) const;
53    void printHeader(const size_t, const Number, const String&) const;
54    void printOutput() const;
55    void printIteration() const;
56\end{lstlisting}
57\vspace{.1cm}
58
59In order to avoid invalid cast from complex to real and vice versa, some inline functions are provided.
60\vspace{.1cm}
61\begin{lstlisting}[deletekeywords={[3] x, y}]
62inline void assign(Real& x, const Real& y) { x = y; }
63inline void assign(Complex& x, const Real& y) { x = y; }
64inline void assign(Complex& x, const Complex& y) { x = y; }
65inline void assign(Real& x, const Complex& y) { x = y.real(); }
66\end{lstlisting}
67\vspace{.1cm}
68\displayInfos{library=solvers, header=IterativeSolver.hpp, implementation=IterativeSolver.cpp, test={test\_BicgSolver.hpp, test\_BicgStabSolver.hpp, test\_CgSolver.hpp, test\_CgsSolver.hpp, test\_GmresSolver.hpp, test\_QmrSolver.hpp, test\_SorSolver.hpp, test\_SsorSolver.hpp}, header dep={Preconditioner.hpp, config.h, utils.h}}
69