00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020 #ifndef SELDON_FILE_MUMPS_HXX
00021
00022
00023 extern "C"
00024 {
00025 #include "dmumps_c.h"
00026 #include "zmumps_c.h"
00027
00028
00029
00030 #ifndef SELDON_WITH_MPI
00031 #include "mpi.h"
00032 #endif
00033
00034 }
00035
00036 namespace Seldon
00037 {
00038 template<class T>
00039 class TypeMumps
00040 {
00041 };
00042
00043
00045 template<>
00046 class TypeMumps<double>
00047 {
00048 public :
00049 typedef DMUMPS_STRUC_C data;
00050 typedef double* pointer;
00051 };
00052
00053
00055 template<>
00056 class TypeMumps<complex<double> >
00057 {
00058 public :
00059 typedef ZMUMPS_STRUC_C data;
00060 typedef mumps_double_complex* pointer;
00061 };
00062
00063
00065 template<class T>
00066 class MatrixMumps
00067 {
00068 protected :
00069 int rank;
00070 int type_ordering;
00071
00072 typename TypeMumps<T>::data struct_mumps;
00074 typedef typename TypeMumps<T>::pointer pointer;
00075 int print_level;
00076 bool out_of_core;
00077 #ifdef SELDON_WITH_MPI
00078 MPI_Group single_group;
00079 MPI_Comm single_comm;
00080 #endif
00081 IVect num_row_glob, num_col_glob;
00082 bool new_communicator;
00083
00084
00085 void CallMumps();
00086 template<class MatrixSparse>
00087 void InitMatrix(const MatrixSparse&, bool dist = false);
00088
00089 public :
00090 MatrixMumps();
00091 ~MatrixMumps();
00092
00093 void Clear();
00094
00095 void SelectOrdering(int num_ordering);
00096
00097 void HideMessages();
00098 void ShowMessages();
00099
00100 void EnableOutOfCore();
00101 void DisableOutOfCore();
00102
00103 int GetInfoFactorization() const;
00104
00105 template<class Prop, class Storage, class Allocator>
00106 void FindOrdering(Matrix<T, Prop, Storage, Allocator> & mat,
00107 IVect& numbers, bool keep_matrix = false);
00108
00109 template<class Prop, class Storage, class Allocator>
00110 void FactorizeMatrix(Matrix<T, Prop, Storage, Allocator> & mat,
00111 bool keep_matrix = false);
00112
00113 template<class Prop, class Storage, class Allocator>
00114 void PerformAnalysis(Matrix<T, Prop, Storage, Allocator> & mat);
00115
00116 template<class Prop, class Storage, class Allocator>
00117 void PerformFactorization(Matrix<T, Prop, Storage, Allocator> & mat);
00118
00119 template<class Prop1, class Storage1, class Allocator1,
00120 class Prop2, class Storage2, class Allocator2>
00121 void GetSchurMatrix(Matrix<T, Prop1, Storage1, Allocator1>& mat,
00122 const IVect& num,
00123 Matrix<T, Prop2, Storage2, Allocator2> & mat_schur,
00124 bool keep_matrix = false);
00125
00126 template<class Allocator2>
00127 void Solve(Vector<T, VectFull, Allocator2>& x);
00128
00129 template<class Allocator2, class Transpose_status>
00130 void Solve(const Transpose_status& TransA,
00131 Vector<T, VectFull, Allocator2>& x);
00132
00133 template<class Allocator2, class Transpose_status, class Prop>
00134 void Solve(const Transpose_status& TransA,
00135 Matrix<T, Prop, ColMajor, Allocator2>& x);
00136
00137 #ifdef SELDON_WITH_MPI
00138 template<class Prop, class Allocator>
00139 void FactorizeDistributedMatrix(Matrix<T, General,
00140 ColSparse, Allocator> & mat,
00141 const Prop& sym, const IVect& glob_number,
00142 bool keep_matrix = false);
00143
00144 template<class Alloc1, class Alloc2, class Alloc3, class Tint>
00145 void FactorizeDistributedMatrix(Vector<int, VectFull, Alloc1>&,
00146 Vector<int, VectFull, Alloc2>&,
00147 Vector<T, VectFull, Alloc3>&,
00148 const Vector<Tint>& glob_number,
00149 bool sym, bool keep_matrix = false);
00150
00151 template<class Allocator2, class Transpose_status>
00152 void SolveDistributed(const Transpose_status& TransA,
00153 Vector<T, VectFull, Allocator2>& x,
00154 const IVect& glob_num);
00155
00156 template<class Allocator2>
00157 void SolveDistributed(Vector<T, VectFull, Allocator2>& x, const IVect& );
00158
00159 #endif
00160
00161 };
00162
00163 }
00164
00165 #define SELDON_FILE_MUMPS_HXX
00166 #endif
00167
00168
00169