~ubuntu-branches/ubuntu/trusty/rheolef/trusty

« back to all changes in this revision

Viewing changes to skit/plib2/solver.cc

  • Committer: Package Import Robot
  • Author(s): Pierre Saramito
  • Date: 2012-04-06 09:12:21 UTC
  • mfrom: (1.1.5)
  • Revision ID: package-import@ubuntu.com-20120406091221-m58me99p1nxqui49
Tags: 6.0-1
* New upstream release 6.0 (major changes):
  - massively distributed and parallel support
  - full FEM characteristic method (Lagrange-Gakerkin method) support
  - enhanced users documentation 
  - source code supports g++-4.7 (closes: #667356)
* debian/control: dependencies for MPI distributed solvers added
* debian/rules: build commands simplified
* debian/librheolef-dev.install: man1/* to man9/* added
* debian/changelog: package description rewritted (closes: #661689)

Show diffs side-by-side

added added

removed removed

Lines of Context:
21
21
// direct solver interface
22
22
//
23
23
#include "rheolef/solver.h"
 
24
#include "solver_wrapper.h"
 
25
#include "solver_mumps.h"
 
26
#include "solver_trilinos_ifpack.h"
 
27
#include "solver_no_trilinos_ifpack.h"
24
28
#include "solver_pastix.h"
25
29
 
26
30
namespace rheolef {
27
31
 
28
32
template<class T, class M>
 
33
solver_rep<T,M>::solver_rep ()
 
34
 : _ptr(0)
 
35
{
 
36
}
 
37
template<class T, class M>
29
38
solver_rep<T,M>::solver_rep (const csr<T,M>& a, const solver_option_type& opt)
30
 
 : _ptr(new_macro(rep(a,opt)))
31
 
{
 
39
 : _ptr(0)
 
40
{
 
41
  typedef solver_wrapper_rep<T,M> rep;
 
42
  _ptr = new_macro (rep(a,opt));
 
43
}
 
44
template<class T, class M>
 
45
void
 
46
solver_rep<T,M>::build_lu (const csr<T,M>& a, const solver_option_type& opt)
 
47
{
 
48
#ifdef _RHEOLEF_HAVE_MUMPS
 
49
  typedef solver_mumps_rep<T,M> rep;
 
50
#elif defined(_RHEOLEF_HAVE_PASTIX)
 
51
  typedef solver_pastix_rep<T,M> rep;
 
52
  opt.iterative = 0;
 
53
#else // ! _RHEOLEF_HAVE_TRILINOS && !_RHEOLEF_HAVE_PASTIX
 
54
  typedef solver_no_trilinos_ifpack_rep<T,M> rep;
 
55
#endif // ! _RHEOLEF_HAVE_MUMPS
 
56
  if (_ptr) delete_macro (_ptr);
 
57
  _ptr = new_macro (rep(a,opt));
 
58
}
 
59
template<class T, class M>
 
60
void
 
61
solver_rep<T,M>::build_ilu (const csr<T,M>& a, const solver_option_type& opt)
 
62
{
 
63
#ifdef _RHEOLEF_HAVE_TRILINOS
 
64
  typedef solver_trilinos_ifpack_rep<T,M> rep;
 
65
#elif defined(_RHEOLEF_HAVE_PASTIX)
 
66
  typedef solver_pastix_rep<T,M> rep;
 
67
  opt.iterative = 1;
 
68
#else // ! _RHEOLEF_HAVE_TRILINOS && !_RHEOLEF_HAVE_PASTIX
 
69
  typedef solver_no_trilinos_ifpack_rep<T,M> rep;
 
70
#endif
 
71
  if (_ptr) delete_macro (_ptr);
 
72
  _ptr = new_macro (rep(a,opt));
32
73
}
33
74
template<class T, class M>
34
75
solver_rep<T,M>::~solver_rep ()
35
76
{
36
 
  delete_macro (_ptr);
 
77
  if (_ptr) delete_macro (_ptr);
 
78
  _ptr = 0;
37
79
}
38
80
template<class T, class M>
39
81
void 
43
85
}
44
86
template<class T, class M>
45
87
vec<T,M>
46
 
solver_rep<T,M>::solve (const vec<T,M>& b)
 
88
solver_rep<T,M>::solve (const vec<T,M>& b) const
47
89
{
48
90
  return _ptr->solve (b);
49
91
}
50
92
template<class T, class M>
51
93
vec<T,M>
52
 
solver_rep<T,M>::trans_solve (const vec<T,M>& b)
 
94
solver_rep<T,M>::trans_solve (const vec<T,M>& b) const
53
95
{
54
96
  return _ptr->trans_solve (b);
55
97
}