]> https://gitweb.dealii.org/ - dealii-svn.git/commitdiff
Added a preconditioner class for the LU decomposition provided by PetSC.
authoroliver <oliver@0785d39b-7218-0410-832d-ea1e28bc413d>
Mon, 26 Jul 2004 14:42:04 +0000 (14:42 +0000)
committeroliver <oliver@0785d39b-7218-0410-832d-ea1e28bc413d>
Mon, 26 Jul 2004 14:42:04 +0000 (14:42 +0000)
Works only for single processor machines.

git-svn-id: https://svn.dealii.org/trunk@9519 0785d39b-7218-0410-832d-ea1e28bc413d

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

index 447191e0a89e17eb1dea8a43c0efcc4ecd545e3f..510fad9603b2206cb74ae70e07badb92b08d2709 100644 (file)
@@ -511,8 +511,67 @@ namespace PETScWrappers
       virtual void set_preconditioner_type (PC &pc) const;      
   };
 
+
+
+/**
+ * A class that implements the interface to use the PETSc LU
+ * preconditioner. The LU decomposition is only implemented for single
+ * processor machines. It should provide a convenient interface to
+ * another direct solver.
+ *
+ * @ingroup PETScWrappers
+ * @author Oliver Kayser-Herold, 2004
+ */
+  class PreconditionLU : public PreconditionerBase
+  {
+    public:
+                                       /**
+                                        * Standardized data struct to
+                                        * pipe additional flags to the
+                                        * preconditioner.
+                                        */      
+      struct AdditionalData
+      {
+                                           /**
+                                            * Constructor. 
+                                            */
+          AdditionalData ();
+      };
+
+                                       /**
+                                        * Constructor. Take the matrix which
+                                        * is used to form the preconditioner,
+                                        * and additional flags if there are
+                                        * any.
+                                        *
+                                        * We specify the (default) value to
+                                        * the constructor call in the default
+                                        * argument because otherwise gcc 2.95
+                                        * generates a compiler fault.
+                                        */
+      PreconditionLU (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;      
+  };
+
 }
 
+
 #endif // DEAL_II_USE_PETSC
 
 /*----------------------------   petsc_precondition.h     ---------------------------*/
index 7fedb96742525c9ed39d7b3653fc69b92f624581..836d439622850bb956e26811a140a6fb165a395d 100644 (file)
@@ -256,6 +256,33 @@ namespace PETScWrappers
   }
   
 
+/* ----------------- PreconditionLU -------------------- */
+
+  PreconditionLU::AdditionalData::
+  AdditionalData ()
+  {}
+
+  
+  
+  PreconditionLU::PreconditionLU (const MatrixBase     &matrix,
+                                 const AdditionalData &additional_data)
+                  :
+                  PreconditionerBase (matrix),
+                  additional_data (additional_data)
+  {}
+
+  
+  void
+  PreconditionLU::set_preconditioner_type (PC &pc) const
+  {
+                                     // set the right type for the
+                                     // preconditioner
+    int ierr;
+    ierr = PCSetType (pc, const_cast<char *>(PCLU));
+    AssertThrow (ierr == 0, ExcPETScError(ierr));
+  }
+  
+
 }
 
 #else

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.