#include <fe/fe.h>
#include <base/quadrature.h>
#include <lac/vector.h>
+#include <lac/precondition.h>
#include <lac/solver_cg.h>
#include <lac/vector_memory.h>
PrimitiveVectorMemory<Vector<double> > memory;
SolverCG<SparseMatrix<double>,Vector<double> > cg(control,memory);
+ PreconditionRelaxation<SparseMatrix<double>, Vector<double> >
+ prec(system_matrix,
+ &SparseMatrix<double>::template precondition_SSOR<double>,
+ 1.2);
+
// solve
- cg.solve (system_matrix, solution, right_hand_side);
+ cg.solve (system_matrix, solution, right_hand_side, prec);
// distribute solution
constraints.distribute (solution);
};
#include <numerics/matrices.h>
#include <lac/vector.h>
#include <lac/sparsematrix.h>
+#include <lac/precondition.h>
#include <lac/solver_cg.h>
#include <lac/vector_memory.h>
PrimitiveVectorMemory<Vector<double> > memory;
SolverCG<SparseMatrix<double>,Vector<double> > cg(control,memory);
+ PreconditionRelaxation<SparseMatrix<double>, Vector<double> >
+ prec(mass_matrix,
+ &SparseMatrix<double>::template precondition_SSOR<double>,
+ 1.2);
// solve
- cg.solve (mass_matrix, vec, tmp);
+ cg.solve (mass_matrix, vec, tmp, prec);
// distribute solution
constraints.distribute (vec);
PrimitiveVectorMemory<Vector<double> > memory;
SolverCG<SparseMatrix<double>,Vector<double> > cg(control,memory);
+ PreconditionRelaxation<SparseMatrix<double>, Vector<double> >
+ prec(mass_matrix,
+ &SparseMatrix<double>::template precondition_SSOR<double>,
+ 1.2);
// solve
- cg.solve (mass_matrix, boundary_projection, rhs);
+ cg.solve (mass_matrix, boundary_projection, rhs, prec);
// fill in boundary values
for (unsigned int i=0; i<dof_to_boundary_mapping.size(); ++i)
-/*---------------------------- solver_pcg.h ---------------------------*/
+/*---------------------------- solver_cg.h ---------------------------*/
/* $Id$ */
-#ifndef __solver_pcg_H
-#define __solver_pcg_H
-/*---------------------------- solver_pcg.h ---------------------------*/
+#ifndef __solver_cg_H
+#define __solver_cg_H
+/*---------------------------- solver_cg.h ---------------------------*/
* @author Original implementation by G. Kanschat, R. Becker and F.-T. Suttmeier, reworking and documentation by Wolfgang Bangerth
*/
template<class Matrix, class Vector>
-class SolverPCG : public Solver<Matrix,Vector>
+class SolverCG : public Solver<Matrix,Vector>
{
public:
/**
* Constructor.
*/
- SolverPCG (SolverControl &cn, VectorMemory<Vector> &mem) :
+ SolverCG (SolverControl &cn, VectorMemory<Vector> &mem) :
Solver<Matrix,Vector>(cn,mem) {};
/**
template<class Matrix, class Vector>
-double SolverPCG<Matrix,Vector>::criterion()
+double SolverCG<Matrix,Vector>::criterion()
{
return sqrt(res2);
};
template<class Matrix, class Vector>
template<class Preconditioner>
Solver<Matrix,Vector>::ReturnState
-SolverPCG<Matrix,Vector>::solve (const Matrix &A,
+SolverCG<Matrix,Vector>::solve (const Matrix &A,
Vector &x,
const Vector &b,
const Preconditioner& precondition)
{
SolverControl::State conv=SolverControl::iterate;
+
+ deallog.push("cg");
// Memory allocation
Vr = memory.alloc();
-/*---------------------------- solver_pcg.h ---------------------------*/
-/* end of #ifndef __solver_pcg_H */
+/*---------------------------- solver_cg.h ---------------------------*/
+/* end of #ifndef __solver_cg_H */
#endif
-/*---------------------------- solver_pcg.h ---------------------------*/
+/*---------------------------- solver_cg.h ---------------------------*/
* @author Ralf Hartmann
*/
template<class Matrix, class Vector>
-class SolverRichardson : public Solver<Matrix, Vector> {
+class SolverRichardson : public Solver<Matrix, Vector>
+{
public:
/**
* Constructor.
const Vector<double> &,
const Vector<double> &) const;
-template void SparseMatrix<float>::precondition (Vector<float> &,
- const Vector<float> &) const;
-template void SparseMatrix<float>::precondition (Vector<double> &,
- const Vector<double> &) const;
-
template void SparseMatrix<float>::precondition_SSOR (Vector<float> &,
const Vector<float> &,
float) const;
const Vector<double> &,
const Vector<double> &) const;
-template void SparseMatrix<double>::precondition (Vector<float> &,
- const Vector<float> &) const;
-template void SparseMatrix<double>::precondition (Vector<double> &,
- const Vector<double> &) const;
-
template void SparseMatrix<double>::precondition_SSOR (Vector<float> &,
const Vector<float> &,
double) const;
#include <lac/vector.h>
#include <lac/vector_memory.h>
#include <lac/solver_control.h>
-#include <lac/solver_pcg.h>
-#include <lac/solver_pgmres.h>
+#include <lac/solver_cg.h>
+#include <lac/solver_gmres.h>
#include <lac/solver_bicgstab.h>
#include <lac/solver_richardson.h>
#include <lac/precondition.h>
{
PrimitiveVectorMemory<VECTOR > mem;
SolverControl control(100, 1.e-5, true);
- SolverPCG<MATRIX, VECTOR > cg(control, mem);
+ SolverCG<MATRIX, VECTOR > cg(control, mem);
SolverGMRES<MATRIX, VECTOR > gmres(control, mem,20);
SolverBicgstab<MATRIX, VECTOR > bicgstab(control, mem);
SolverRichardson<MATRIX, VECTOR > rich(control, mem);