]> https://gitweb.dealii.org/ - dealii.git/commitdiff
Fixed interface for MUMPS.
authorMarkus Buerg <buerg@math.tamu.edu>
Fri, 28 Jan 2011 16:30:59 +0000 (16:30 +0000)
committerMarkus Buerg <buerg@math.tamu.edu>
Fri, 28 Jan 2011 16:30:59 +0000 (16:30 +0000)
git-svn-id: https://svn.dealii.org/trunk@23269 0785d39b-7218-0410-832d-ea1e28bc413d

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

index 22f5060d62be4e96aa997412247f93529540fbcd..a2fcb6d0c56338efd0034050798860d578235ff1 100644 (file)
 #include <base/exceptions.h>
 #include <base/subscriptor.h>
 #include <base/thread_management.h>
+#include <dmumps_c.h>
 #include <lac/vector.h>
 #include <lac/sparse_matrix.h>
 #include <lac/block_sparse_matrix.h>
 
-#ifdef DEAL_II_USE_MUMPS
-#  include <base/utilities.h>
-#  include <dmumps_c.h>
-#endif 
-
 DEAL_II_NAMESPACE_OPEN
 
+
 /**
  * This class provides an interface to the sparse direct solver MA27
  * from the Harwell Subroutine Library. MA27 is a direct solver
@@ -358,17 +355,14 @@ class SparseDirectMA27 : public Subscriptor
                                      * Exception
                                      */
     DeclException0 (ExcInitializeAlreadyCalled);
-
                                     /**
                                      * Exception
                                      */
     DeclException0 (ExcFactorizeNotCalled);
-
                                     /**
                                      * Exception
                                      */
     DeclException0 (ExcDifferentSparsityPatterns);
-
                                     /**
                                      * Exception
                                      */
@@ -828,17 +822,14 @@ class SparseDirectMA47 : public Subscriptor
                                      * Exception
                                      */
     DeclException0 (ExcInitializeAlreadyCalled);
-
                                     /**
                                      * Exception
                                      */
     DeclException0 (ExcFactorizeNotCalled);
-
                                     /**
                                      * Exception
                                      */
     DeclException0 (ExcCantFactorizeAgain);
-
                                     /**
                                      * Exception
                                      */
@@ -1268,18 +1259,18 @@ class SparseDirectUMFPACK : public Subscriptor
     std::vector<double> control;
 };
 
-
 /**
- * This class provides an interface to the parallel sparse direct
- * solver <a href="http://mumps.enseeiht.fr">MUMPS</a>. MUMPS is
- * direct method based on a multifrontal approach, which performs a
- * direct LU factorization. The matrix coming in may have either
- * symmetric or nonsymmetric sparsity pattern.
+ * This class provides an interface to the parallel sparse direct solver
+ * MUMPS (see <a href="http://mumps.enseeiht.fr">this link</a>).
+ * MUMPS is direct method based on a multifrontal approach, which
+ * performs a direct LU factorization. Matrices may have symmetric or
+ * unsymmetrix sparsity patterns, and may have unsymmetric entries.
  *
- * @note This class is useable if and only if a working installation
- * of <a href="http://mumps.enseeiht.fr">MUMPS</a> exists on your
- * system and was detected during configuration of
- * <code>deal.II</code>.
+ * @note This class only exists if support for <a
+ * href="http://mumps.enseeiht.fr">MUMPS</a> was enabled during configure
+ * and if the <a href="http://mumps.enseeiht.fr">MUMPS</a> library was
+ * configured. If you do nothing at the time you configure deal.II, then
+ * this class will simply not work.
  *
  * <h4>Instantiations</h4>
  *
@@ -1287,65 +1278,50 @@ class SparseDirectUMFPACK : public Subscriptor
  * SparseMatrix<float>, BlockSparseMatrix<double>, and
  * BlockSparseMatrix<float>.
  *
- * @author Markus Buerg, 2010
+ * @author Markus BΓΌrg, 2010
  */
-class SparseDirectMUMPS 
-{
- private:
-  
-#ifdef DEAL_II_USE_MUMPS
-  DMUMPS_STRUC_C id;
-#endif // DEAL_II_USE_MUMPS
-
-  double       *a;
-  double       *rhs;
-  unsigned int *irn;
-  unsigned int *jcn;
-  unsigned int  n;
-  unsigned int  nz;
-
-                        /**
-                        * Flags storing whether the function
-                        * <tt>initialize ()</tt> has already been
-                        * called.
-                        */
-  bool initialize_called;  
-
- public:
-
-                        /**
-                        * Constructor
-                        */
-  SparseDirectMUMPS ();
-  
-                        /**
-                        * Destructor
-                        */
-  ~SparseDirectMUMPS ();
-
-                        /**
-                         * Exception
-                         */
-  DeclException0 (ExcInitializeAlreadyCalled);
-  
-                        /**
-                         * This function initializes a MUMPS instance
-                        * and hands over the system's matrix
-                        * <tt>matrix</tt> and right-hand side
-                        * <tt>vector</tt> to the solver.
-                        */
-  template <class Matrix>
-    void initialize (const Matrix& matrix, 
-                    const Vector<double>      & vector);
-  
-                        /**
-                         * A function in which the linear system is
-                        * solved and the solution vector is copied
-                        * into the given <tt>vector</tt>.
-                        */      
-  void solve (Vector<double>& vector);
+class SparseDirectMUMPS {
+   private:
+      bool initialize_called;
+      DMUMPS_STRUC_C id;
+      double *a;
+      double *rhs;
+      int *irn;
+      int *jcn;
+      int n;
+      int nz;
+
+   public:
+   
+/**
+ * Constructor
+ */
+      SparseDirectMUMPS ();
+      
+/**
+ * Destructor
+ */
+      ~SparseDirectMUMPS ();
+
+/**
+ * This function initializes a MUMPS instance and hands over the system's matrix
+ * <tt>matrix</tt> and right-hand side <tt>vector</tt> to the solver.
+ */
+      template<class Matrix>
+      void initialize (const Matrix& matrix, const Vector<double>& vector);
+      
+/**
+ * Here the actual work is done. The linear system is solved and the solution
+ * vector is copied into the given vector <tt>vector</tt>.
+ */      
+      void solve (Vector<double>& vector);
+ /**
+  * Exception
+  */
+    DeclException0 (ExcInitializeAlreadyCalled);
 };
 
 DEAL_II_NAMESPACE_CLOSE
 
-#endif // __deal2__sparse_direct_h
+#endif
index a1e9b2111a410799aa0ebdb65f135bdcea197d52..cd193f62136884fef39969197db52c72c937569c 100644 (file)
@@ -15,6 +15,7 @@
 #include <lac/sparse_direct.h>
 #include <base/memory_consumption.h>
 #include <base/thread_management.h>
+#include <base/utilities.h>
 #include <lac/sparse_matrix.h>
 #include <lac/block_sparse_matrix.h>
 #include <lac/vector.h>
@@ -1988,7 +1989,7 @@ void SparseDirectMUMPS::solve (Vector<double>& vector)
                         // Copy solution into the given vector
   if (Utilities::System::get_this_mpi_process (MPI_COMM_WORLD) == 0) 
     {
-      for (unsigned int i=0; i<n; ++i)
+      for (int i=0; i<n; ++i)
        vector(i) = rhs[i];
       
       delete[] a;

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.