From: Markus Buerg Date: Fri, 28 Jan 2011 16:30:59 +0000 (+0000) Subject: Fixed interface for MUMPS. X-Git-Tag: v8.0.0~4427 X-Git-Url: https://gitweb.dealii.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=63f8edf20d8c59727546e7cd9f5f00195dc22e52;p=dealii.git Fixed interface for MUMPS. git-svn-id: https://svn.dealii.org/trunk@23269 0785d39b-7218-0410-832d-ea1e28bc413d --- diff --git a/deal.II/include/deal.II/lac/sparse_direct.h b/deal.II/include/deal.II/lac/sparse_direct.h index 22f5060d62..a2fcb6d0c5 100644 --- a/deal.II/include/deal.II/lac/sparse_direct.h +++ b/deal.II/include/deal.II/lac/sparse_direct.h @@ -19,17 +19,14 @@ #include #include #include +#include #include #include #include -#ifdef DEAL_II_USE_MUMPS -# include -# include -#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 control; }; - /** - * This class provides an interface to the parallel sparse direct - * solver MUMPS. 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 this link). + * 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 MUMPS exists on your - * system and was detected during configuration of - * deal.II. + * @note This class only exists if support for MUMPS was enabled during configure + * and if the MUMPS library was + * configured. If you do nothing at the time you configure deal.II, then + * this class will simply not work. * *

Instantiations

* @@ -1287,65 +1278,50 @@ class SparseDirectUMFPACK : public Subscriptor * SparseMatrix, BlockSparseMatrix, and * BlockSparseMatrix. * - * @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 - * initialize () 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 - * matrix and right-hand side - * vector to the solver. - */ - template - void initialize (const Matrix& matrix, - const Vector & vector); - - /** - * A function in which the linear system is - * solved and the solution vector is copied - * into the given vector. - */ - void solve (Vector& 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 + * matrix and right-hand side vector to the solver. + */ + template + void initialize (const Matrix& matrix, const Vector& vector); + +/** + * Here the actual work is done. The linear system is solved and the solution + * vector is copied into the given vector vector. + */ + void solve (Vector& vector); + + /** + * Exception + */ + DeclException0 (ExcInitializeAlreadyCalled); }; DEAL_II_NAMESPACE_CLOSE -#endif // __deal2__sparse_direct_h +#endif diff --git a/deal.II/source/lac/sparse_direct.cc b/deal.II/source/lac/sparse_direct.cc index a1e9b2111a..cd193f6213 100644 --- a/deal.II/source/lac/sparse_direct.cc +++ b/deal.II/source/lac/sparse_direct.cc @@ -15,6 +15,7 @@ #include #include #include +#include #include #include #include @@ -1988,7 +1989,7 @@ void SparseDirectMUMPS::solve (Vector& vector) // Copy solution into the given vector if (Utilities::System::get_this_mpi_process (MPI_COMM_WORLD) == 0) { - for (unsigned int i=0; i