1#ifndef DUNE_FEM_MISC_UMFPACK_HH
2#define DUNE_FEM_MISC_UMFPACK_HH
10#if HAVE_SUITESPARSE_UMFPACK
13#include <dune/fem/misc/double.hh>
23 struct UMFPackMethodChooser {};
27 struct UMFPackMethodChooser< double >
29 template<
class... A >
30 static void defaults ( A ... args )
32 umfpack_dl_defaults( args ... );
34 template<
class ... A >
35 static void free_numeric ( A ... args )
37 umfpack_dl_free_numeric( args ... );
39 template<
class ... A >
40 static void free_symbolic ( A ... args )
42 umfpack_dl_free_symbolic( args ... );
44 template<
class ... A >
45 static int load_numeric ( A ... args )
47 return umfpack_dl_load_numeric( args ... );
49 template<
class ... A >
50 static void numeric ( A ... args )
52 umfpack_dl_numeric( args ... );
54 template<
class ... A >
55 static void report_info ( A ... args )
57 umfpack_dl_report_info( args ... );
59 template<
class ... A >
60 static void report_status ( A ... args )
62 umfpack_dl_report_status( args ... );
64 template<
class ... A >
65 static int save_numeric ( A ... args )
67 return umfpack_di_save_numeric( args ... );
69 template<
class ... A >
70 static void solve ( A ... args )
72 umfpack_dl_solve( args ... );
74 template<
class ... A >
75 static void symbolic ( A ... args )
77 umfpack_dl_symbolic( args ... );
82 struct UMFPackMethodChooser<
std::complex< double > >
84 template<
class ... A >
85 static void defaults ( A ... args )
87 umfpack_zi_defaults( args ... );
89 template<
class ... A >
90 static void free_numeric ( A ... args )
92 umfpack_zi_free_numeric( args ... );
94 template<
class ... A >
95 static void free_symbolic ( A ... args )
97 umfpack_zi_free_symbolic( args ... );
99 template<
class ... A >
100 static int load_numeric ( A ... args )
102 return umfpack_zi_load_numeric( args ... );
104 template<
class ... A >
105 static void numeric (
const int *cs,
const int *ri,
const double *val, A ... args )
107 umfpack_zi_numeric( cs, ri, val,
nullptr, args ... );
109 template<
class ... A >
110 static void report_info ( A ... args )
112 umfpack_zi_report_info( args ... );
114 template<
class ... A >
115 static void report_status ( A ... args )
117 umfpack_zi_report_status( args ... );
119 template<
class ... A >
120 static int save_numeric ( A ... args )
122 return umfpack_zi_save_numeric( args ... );
124 template<
class ... A >
125 static void solve (
int m,
const int *cs,
const int *ri, std::complex< double > *val,
double *x,
const double *b, A ... args )
127 const double *cval =
reinterpret_cast< const double *
>(val);
128 umfpack_zi_solve( m, cs, ri, cval,
nullptr, x,
nullptr, b,
nullptr, args ... );
130 template<
class ... A >
131 static void symbolic (
int m,
int n,
const int *cs,
const int *ri,
const double *val, A ... args )
133 umfpack_zi_symbolic( m, n, cs, ri, val,
nullptr, args ... );
139 struct UMFPackMethodChooser< Fem::Double >
141 template<
class... A >
142 static void defaults ( A ... args )
144 umfpack_di_defaults( args ... );
146 template<
class ... A >
147 static void free_numeric ( A ... args )
149 umfpack_di_free_numeric( args ... );
151 template<
class ... A >
152 static void free_symbolic ( A ... args )
154 umfpack_di_free_symbolic( args ... );
156 template<
class ... A >
157 static int load_numeric ( A ... args )
159 return umfpack_di_load_numeric( args ... );
161 template<
class ... A >
162 static void numeric ( A ... args )
164 umfpack_di_numeric( args ... );
166 template<
class ... A >
167 static void report_info ( A ... args )
169 umfpack_di_report_info( args ... );
171 template<
class ... A >
172 static void report_status ( A ... args )
174 umfpack_di_report_status( args ... );
176 template<
class ... A >
177 static int save_numeric ( A ... args )
179 return umfpack_di_save_numeric( args ... );
181 template<
class ... A >
182 static void symbolic ( A ... args )
184 umfpack_di_symbolic( args ... );
186 static void numeric (
const int *Ap,
const int *Ai,
const double *Ax,
void* Symbolic,
void **Numeric,
187 const double Control[ UMFPACK_CONTROL],
double Info[ UMFPACK_INFO] )
189 umfpack_di_numeric( Ap, Ai, Ax, Symbolic, Numeric, Control, Info );
190 Fem::FlOpCounter< Fem::Double >::instance() += Info[ UMFPACK_FLOPS ];
193 static void solve (
int m,
const int *cs,
const int *ri,
const Fem::Double *val, Fem::Double *x,
const Fem::Double *b,
194 void *Numeric,
const double Control[ UMFPACK_CONTROL ],
double Info[ UMFPACK_INFO ] )
196 umfpack_di_solve( m, cs, ri,
reinterpret_cast< const double *
>(val),
197 reinterpret_cast< double *
>( x ),
reinterpret_cast< const double *
>( b ), Numeric, Control, Info );
198 Fem::FlOpCounter< Fem::Double >::instance() += Info[ UMFPACK_SOLVE_FLOPS ];
Classes for using UMFPack with ISTL matrices.
Dune namespace.
Definition: alignedallocator.hh:13