3#ifndef DUNE_ISTL_PARDISO_HH
4#define DUNE_ISTL_PARDISO_HH
11extern "C" void pardisoinit(
void *,
int *,
int *,
int *,
double *,
int *);
13extern "C" void pardiso(
void *,
int *,
int *,
int *,
int *,
int *,
14 double *,
int *,
int *,
int *,
int *,
int *,
15 int *,
double *,
double *,
int *,
double *);
24 template<
class M,
class X,
class Y>
25 class SeqPardiso :
public Preconditioner<X,Y> {
28 typedef M matrix_type;
30 typedef X domain_type;
34 typedef typename X::field_type field_type;
36 typedef typename M::RowIterator RowIterator;
37 typedef typename M::ColIterator ColIterator;
50 SeqPardiso (
const M& A)
63 RowIterator endi = A_.end();
64 for (RowIterator i = A_.begin(); i != endi; ++i)
66 ColIterator endj = (*i).end();
67 for (ColIterator j = (*i).begin(); j != endj; ++j) {
69 DUNE_THROW(NotImplemented,
"SeqPardiso: column blocksize != 1.");
74 std::cout <<
"dimension = " << n_ <<
", number of nonzeros = " << nnz << std::endl;
81 for (RowIterator i = A_.begin(); i != endi; ++i)
83 ia_[i.index()] = count+1;
84 ColIterator endj = (*i).end();
85 for (ColIterator j = (*i).begin(); j != endj; ++j) {
87 ja_[count] = j.index()+1;
94 pardisoinit(pt_, &mtype_, &solver_, iparm_, dparm_, &error_);
99 iparm_[2] = num_procs_;
101 pardiso(pt_, &maxfct_, &mnum_, &mtype_, &phase,
102 &n_, a_, ia_, ja_, &idum, &nrhs_,
103 iparm_, &msglvl_, &ddum, &ddum, &error_, dparm_);
106 DUNE_THROW(MathError,
"Constructor SeqPardiso: Factorization failed. Error code " << error_);
108 std::cout <<
"Constructor SeqPardiso: Factorization completed." << std::endl;
116 virtual void pre (X& x, Y& b) {}
123 virtual void apply (X& v,
const Y& d)
132 for (
int i = 0; i < n_; i++) {
137 pardiso(pt_, &maxfct_, &mnum_, &mtype_, &phase,
138 &n_, a_, ia_, ja_, &idum, &nrhs_,
139 iparm_, &msglvl_, b, x, &error_, dparm_);
142 DUNE_THROW(MathError,
"SeqPardiso.apply: Backsolve failed. Error code " << error_);
144 for (
int i = 0; i < n_; i++)
147 std::cout <<
"SeqPardiso: Backsolve completed." << std::endl;
155 virtual void post (X& x) {}
163 pardiso(pt_, &maxfct_, &mnum_, &mtype_, &phase,
164 &n_, &ddum, ia_, ja_, &idum, &nrhs_,
165 iparm_, &msglvl_, &ddum, &ddum, &error_, dparm_);
190 template<
class M,
class X,
class Y>
191 struct IsDirectSolver<SeqPardiso<M,X,Y> >
#define DUNE_THROW(E, m)
Definition: exceptions.hh:216
Dune namespace.
Definition: alignment.hh:11
Define general preconditioner interface.
Templates characterizing the type of a solver.
@ sequential
Category for sequential solvers.
Definition: solvercategory.hh:21