rheolef  6.5
solver.cc
Go to the documentation of this file.
1 #include "rheolef/solver.h"
2 #include "solver_wrapper.h"
3 #include "solver_umfpack.h"
4 #include "solver_mumps.h"
7 #include "solver_pastix.h"
8 
9 namespace rheolef {
10 
11 template<class T, class M>
13  : _ptr(0)
14 {
15 }
16 template<class T, class M>
18  : _ptr(0)
19 {
21  _ptr = new_macro (rep(a,opt));
22 }
23 template<class T, class M>
24 void
26 {
27 #ifdef _RHEOLEF_HAVE_UMFPACK
28  if (a.dis_ext_nnz() == 0) {
29  // diagonal bloc per process => use umfpack
31  if (_ptr) delete_macro (_ptr);
32  _ptr = new_macro (rep(a,opt));
33  return;
34  }
35 #endif // _RHEOLEF_HAVE_UMFPACK
36 #ifdef _RHEOLEF_HAVE_MUMPS
37  typedef solver_mumps_rep<T,M> rep;
38 #elif defined(_RHEOLEF_HAVE_PASTIX)
39  typedef solver_pastix_rep<T,M> rep;
40  opt.iterative = 0;
41 #else // ! _RHEOLEF_HAVE_TRILINOS && !_RHEOLEF_HAVE_PASTIX
42  typedef solver_no_trilinos_ifpack_rep<T,M> rep;
43 #endif // ! _RHEOLEF_HAVE_MUMPS
44  if (_ptr) delete_macro (_ptr);
45  _ptr = new_macro (rep(a,opt));
46 }
47 template<class T, class M>
48 void
50 {
51 #ifdef _RHEOLEF_HAVE_TRILINOS
53 #elif defined(_RHEOLEF_HAVE_PASTIX)
54  typedef solver_pastix_rep<T,M> rep;
55  opt.iterative = 1;
56 #else // ! _RHEOLEF_HAVE_TRILINOS && !_RHEOLEF_HAVE_PASTIX
57  typedef solver_no_trilinos_ifpack_rep<T,M> rep;
58 #endif
59  if (_ptr) delete_macro (_ptr);
60  _ptr = new_macro (rep(a,opt));
61 }
62 template<class T, class M>
64 {
65  if (_ptr) delete_macro (_ptr);
66  _ptr = 0;
67 }
68 template<class T, class M>
69 void
71 {
72  _ptr->update_values (a);
73 }
74 template<class T, class M>
77 {
78  return _ptr->solve (b);
79 }
80 template<class T, class M>
83 {
84  return _ptr->trans_solve (b);
85 }
86 template class solver_rep<Float,sequential>;
87 
88 #ifdef _RHEOLEF_HAVE_MPI
89 template class solver_rep<Float,distributed>;
90 #endif // _RHEOLEF_HAVE_MPI
91 
92 } // namespace rheolef
93