]> https://gitweb.dealii.org/ - dealii-svn.git/commitdiff
Implement block jacobi, simple version.
authorwolf <wolf@0785d39b-7218-0410-832d-ea1e28bc413d>
Thu, 1 Apr 2004 17:00:41 +0000 (17:00 +0000)
committerwolf <wolf@0785d39b-7218-0410-832d-ea1e28bc413d>
Thu, 1 Apr 2004 17:00:41 +0000 (17:00 +0000)
git-svn-id: https://svn.dealii.org/trunk@8947 0785d39b-7218-0410-832d-ea1e28bc413d

deal.II/lac/include/lac/petsc_precondition.h
deal.II/lac/source/petsc_precondition.cc

index 939ae226a27148e8214dcbd31b1def09db483bf5..b39f97448c8beb8bdd0982e398cd4df0687a9667 100644 (file)
@@ -143,6 +143,51 @@ namespace PETScWrappers
 
       
 
+/**
+ * A class that implements the interface to use the PETSc Block Jacobi
+ * preconditioner.
+ *
+ * @author Wolfgang Bangerth, 2004
+ */
+  class PreconditionBlockJacobi : public PreconditionerBase
+  {
+    public:
+                                       /**
+                                        * Standardized data struct to
+                                        * pipe additional flags to the
+                                        * preconditioner.
+                                        */      
+      struct AdditionalData
+      {};
+
+                                       /**
+                                        * Constructor. Take the matrix which
+                                        * is used to form the preconditioner,
+                                        * and additional flags if there are
+                                        * any.
+                                        */
+      PreconditionBlockJacobi (const MatrixBase     &matrix,
+                               const AdditionalData &additional_data = AdditionalData());
+      
+    protected:
+                                       /**
+                                        * Store a copy of the flags for this
+                                        * particular preconditioner.
+                                        */
+      const AdditionalData additional_data;
+
+                                       /**
+                                        * Function that takes a Krylov
+                                        * Subspace Preconditioner context
+                                        * object, and sets the type of
+                                        * preconditioner that is appropriate
+                                        * for the present class.
+                                        */
+      virtual void set_preconditioner_type (PC &pc) const;      
+  };
+
+      
+
 /**
  * A class that implements the interface to use the PETSc SOR
  * preconditioner.
index 90fe59203e41c5d6daaa851f1d571662dee13bfe..a060c7e20b6a65d28254595eb10dab1d421e2a8f 100644 (file)
@@ -63,6 +63,29 @@ namespace PETScWrappers
   }
   
 
+/* ----------------- PreconditionJacobi -------------------- */
+
+
+  PreconditionBlockJacobi::
+  PreconditionBlockJacobi (const MatrixBase     &matrix,
+                           const AdditionalData &additional_data)
+                  :
+                  PreconditionerBase (matrix),
+                  additional_data (additional_data)
+  {}
+
+  
+  void
+  PreconditionBlockJacobi::set_preconditioner_type (PC &pc) const
+  {
+                                     // set the right type for the
+                                     // preconditioner
+    int ierr;
+    ierr = PCSetType (pc, const_cast<char *>(PCBJACOBI));
+    AssertThrow (ierr == 0, ExcPETScError(ierr));
+  }
+  
+
 /* ----------------- PreconditionSOR -------------------- */
 
   PreconditionSOR::AdditionalData::

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.