]> https://gitweb.dealii.org/ - dealii-svn.git/commitdiff
cleanup
authorguido <guido@0785d39b-7218-0410-832d-ea1e28bc413d>
Mon, 26 Apr 1999 21:27:27 +0000 (21:27 +0000)
committerguido <guido@0785d39b-7218-0410-832d-ea1e28bc413d>
Mon, 26 Apr 1999 21:27:27 +0000 (21:27 +0000)
git-svn-id: https://svn.dealii.org/trunk@1212 0785d39b-7218-0410-832d-ea1e28bc413d

deal.II/deal.II/source/numerics/base.cc
deal.II/deal.II/source/numerics/vectors.cc
deal.II/lac/include/lac/solver_cg.h
deal.II/lac/include/lac/solver_richardson.h
deal.II/lac/source/sparse_matrix.cc
tests/lac/solver.cc

index 387be6b1c5139bea0222ac302867a9ea211ed571..509ff3b5dc164623c0f7f2580589fdc9acdd909e 100644 (file)
@@ -13,6 +13,7 @@
 #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>
 
@@ -140,8 +141,13 @@ void ProblemBase<dim>::solve () {
   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);
 };
index bc6767ce412b485ba9ca23d792b5435a0ea81056..283957f62ccf02261a737635ca645f136c0870d3 100644 (file)
@@ -17,6 +17,7 @@
 #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>
 
@@ -203,8 +204,12 @@ void VectorTools<dim>::project (const DoFHandler<dim>    &dof,
   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);
@@ -410,8 +415,12 @@ VectorTools<dim>::project_boundary_values (const DoFHandler<dim>    &dof,
   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)
index 30d2ff731c16fc27905deaac139fe2b39c0363c5..98ad4891b0d57c9765ed725f1096b509ae95ad7d 100644 (file)
@@ -1,8 +1,8 @@
-/*----------------------------   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) {};
 
                                     /**
@@ -71,7 +71,7 @@ class SolverPCG : public Solver<Matrix,Vector>
  
 
 template<class Matrix, class Vector>
-double SolverPCG<Matrix,Vector>::criterion()
+double SolverCG<Matrix,Vector>::criterion()
 {
   return sqrt(res2);
 };
@@ -81,12 +81,14 @@ double SolverPCG<Matrix,Vector>::criterion()
 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();
@@ -172,7 +174,7 @@ SolverPCG<Matrix,Vector>::solve (const Matrix &A,
 
 
 
-/*----------------------------   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     ---------------------------*/
index 2ccca467a8cf27492f0edd84d48bc8f61da5aed9..b4b2e8e41db9a2c3f5ed13992c7e34629f0e01e3 100644 (file)
@@ -19,7 +19,8 @@
  * @author Ralf Hartmann
  */
 template<class Matrix, class Vector>
-class SolverRichardson : public Solver<Matrix, Vector> {
+class SolverRichardson : public Solver<Matrix, Vector>
+{
   public:
                                     /**
                                      * Constructor.
index e52db7de6fd0c3f794917113d72199d442b30830..a3e52b2f113be64867db9815de66778ee104bfb0 100644 (file)
@@ -505,11 +505,6 @@ template double SparseMatrix<float>::residual (Vector<double> &,
                                               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;
@@ -568,11 +563,6 @@ template double SparseMatrix<double>::residual (Vector<double> &,
                                                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;
index 0ca3ec959d62be5303be321d45d3b8c0f83e78e7..a70a6c478749617e26ba805c2fb3515d9f5ec567 100644 (file)
@@ -9,8 +9,8 @@
 #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>
@@ -22,7 +22,7 @@ main()
 {
   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);

In the beginning the Universe was created. This has made a lot of people very angry and has been widely regarded as a bad move.

Douglas Adams


Typeset in Trocchi and Trocchi Bold Sans Serif.