Make ILU decomposition faster by following the comment in the
- innermost loop (about the better use of the index j).
\ No newline at end of file
+ innermost loop (about the better use of the index j).
+
+Change in-class defined SolverSelector functions out-of-class to
+ conform to general style guide. (Ralf?)
\ No newline at end of file
* };
* \end{verbatim}
*
+ *
* \subsection{AdditionalData}
+ *
* Several solvers need additional data, like the damping parameter #omega# of the
- * #SolverRichardson# class or the maximum number of tmp vectors of the #SolverGMRES#.
+ * #SolverRichardson# class or the maximum number of temporary vectors of the #SolverGMRES#.
* To have a standardized constructor for each solver class the #struct AdditionalData#
- * has been introduced to each solver class. Some solver needs no additional data, like
- * the SolverCG or SolverBicgstab. For these solvers the struct #AdditionalData# is empty
- * and the calling
- * of the constructor has not change as a default #AdditionalData# is set by default.
+ * has been introduced to each solver class. Some solvers need no additional data, like
+ * #SolverCG# or #SolverBicgstab#. For these solvers the struct #AdditionalData# is empty
+ * and calling the constructor may be done without giving the additional structure as
+ * an argument as a default #AdditionalData# is set by default.
*
* Now the generating of a solver looks like
* \begin{verbatim}
* // CG with default AdditionalData
* SolverCG solver_cg (solver_control, vector_memory);
* \end{verbatim}
+ *
+ * Using a unified constructor parameter list for all solvers was introduced when the
+ * #SolverSelector# class was written; the unified interface enabled us to use this
+ * class unchanged even if the number of types of parameters to a certain solver
+ * changes and it is still possible in a simple way to give these additional data to
+ * the #SolverSelector# object for each solver which it may use.
+ *
+ * @author Wolfgang Bangerth, Guido Kanschat, Ralf Hartmann, 1997, 1998, 1999
*/
template <class Matrix, class Vector>
class Solver
/**
* Bicgstab algorithm by van der Vorst.
*
- * The use of the #AdditionalData# struct is described in the #solver#
- * base class.
+ * Like all other solver classes, this class has a local structure called
+ * #AdditionalData# which is used to pass additional parameters to the
+ * solver, like damping parameters or the number of temporary vectors. We
+ * use this additional structure instead of passing these values directly
+ * to the constructor because this makes the use of the #SolverSelector# and
+ * other classes much easier and guarantees that these will continue to
+ * work even if number or type of the additional parameters for a certain
+ * solver changes.
+ *
+ * However, since the BiCGStab method does not need additional data, the respective
+ * structure is empty and does not offer any functionality. The constructor
+ * has a default argument, so you may call it without the additional
+ * parameter.
*/
template<class Matrix, class Vector>
class SolverBicgstab //<Matrix,Vector>
/**
* Preconditioned cg method.
- * @author Original implementation by G. Kanschat, R. Becker and F.-T. Suttmeier, reworking and documentation by Wolfgang Bangerth
*
- * The use of the #AdditionalData# struct is described in the #solver#
- * base class.
+ * Like all other solver classes, this class has a local structure called
+ * #AdditionalData# which is used to pass additional parameters to the
+ * solver, like damping parameters or the number of temporary vectors. We
+ * use this additional structure instead of passing these values directly
+ * to the constructor because this makes the use of the #SolverSelector# and
+ * other classes much easier and guarantees that these will continue to
+ * work even if number or type of the additional parameters for a certain
+ * solver changes.
+ *
+ * However, since the CG method does not need additional data, the respective
+ * structure is empty and does not offer any functionality. The constructor
+ * has a default argument, so you may call it without the additional
+ * parameter.
+ *
+ *
+ * @author Original implementation by G. Kanschat, R. Becker and F.-T. Suttmeier, reworking and documentation by Wolfgang Bangerth
*/
template<class Matrix, class Vector>
class SolverCG : public Solver<Matrix,Vector>
* computational speed against memory. One of the few other
* possibilities is to use a good preconditioner.
*
- * The use of the #AdditionalData# struct is described in the #solver#
- * base class.
+ * Like all other solver classes, this class has a local structure called
+ * #AdditionalData# which is used to pass additional parameters to the
+ * solver, like damping parameters or the number of temporary vectors. We
+ * use this additional structure instead of passing these values directly
+ * to the constructor because this makes the use of the #SolverSelector# and
+ * other classes much easier and guarantees that these will continue to
+ * work even if number or type of the additional parameters for a certain
+ * solver changes.
+ *
+ * For the GMRes method, the #AdditionalData# structure contains the number
+ * of temporary vectors as commented upon above. By default, the number
+ * of these vectors is set to 30.
*
* @author Wolfgang Bangerth
*/
*/
struct AdditionalData
{
+ /**
+ * Constructor. By default,
+ * set the number of temporary
+ * vectors to 30.
+ */
AdditionalData(const unsigned int max_n_tmp_vectors=30):
- max_n_tmp_vectors(max_n_tmp_vectors) {};
+ max_n_tmp_vectors(max_n_tmp_vectors)
+ {};
/**
* Maximum number of
* Implementation of the richardson iteration method. The stopping criterion
* is the norm of the residual.
*
- * The use of the #AdditionalData# struct is described in the #solver#
- * base class.
+ * Like all other solver classes, this class has a local structure called
+ * #AdditionalData# which is used to pass additional parameters to the
+ * solver, like damping parameters or the number of temporary vectors. We
+ * use this additional structure instead of passing these values directly
+ * to the constructor because this makes the use of the #SolverSelector# and
+ * other classes much easier and guarantees that these will continue to
+ * work even if number or type of the additional parameters for a certain
+ * solver changes.
+ *
+ * For the Richardson method, the additional data is the damping parameter,
+ * which is the only content of the #AdditionalData# structure. By default,
+ * the constructor of the structure sets it to one.
*
* @author Ralf Hartmann
*/
*/
struct AdditionalData
{
+ /**
+ * Constructor. By default,
+ * set the damping parameter
+ * to one.
+ */
AdditionalData(double omega=1):
- omega(omega) {};
+ omega(omega)
+ {};
/**
* Relaxation parameter.
#include <lac/solver_richardson.h>
#include <lac/precondition.h>
+
+
/**
* By calling the #solve# function of this #SolverSelector#, it selects
* the #solve# function of that #Solver# that was specified in the constructor
};
+
/* --------------------- Inline and template functions ------------------- */
VectorMemory<Vector> &vector_memory) :
solver_name(solver_name),
control(&control),
- vector_memory(&vector_memory) {}
+ vector_memory(&vector_memory)
+{};
+
+
-
template <class Matrix, class Vector>
SolverSelector<Matrix, Vector>::~SolverSelector()
-{}
+{};
Assert(false,ExcSolverDoesNotExist(solver_name));
return Solver<Matrix,Vector>::breakdown;
-}
+};
string SolverSelector<Matrix, Vector>::get_solver_names()
{
return "richardson|cg|bicgstab|gmres";
-}
+};
/*---------------------------- solver_selector.h ---------------------------*/