3#ifndef DUNE_ISTL_PARDISO_HH
4#define DUNE_ISTL_PARDISO_HH
12#define F77_FUNC(func) func
14#define F77_FUNC(func) func ## _
20extern "C" int F77_FUNC(pardisoinit)
21 (
void *,
int *,
int *);
23extern "C" int F77_FUNC(pardiso)
24 (
void *,
int *,
int *,
int *,
int *,
int *,
25 double *,
int *,
int *,
int *,
int *,
int *,
26 int *,
double *,
double *,
int *);
36 template<
class M,
class X,
class Y>
48 typedef typename M::RowIterator RowIterator;
49 typedef typename M::ColIterator ColIterator;
77 RowIterator endi = A_.end();
78 for (RowIterator i = A_.begin(); i != endi; ++i)
80 if (A_.rowdim(i.index()) != 1)
82 ColIterator endj = (*i).end();
83 for (ColIterator j = (*i).begin(); j != endj; ++j) {
84 if (A_.coldim(j.index()) != 1)
90 std::cout <<
"dimension = " << n_ <<
", number of nonzeros = " << nnz << std::endl;
97 for (RowIterator i = A_.begin(); i != endi; ++i)
99 ia_[i.index()] = count+1;
100 ColIterator endj = (*i).end();
101 for (ColIterator j = (*i).begin(); j != endj; ++j) {
103 ja_[count] = j.index()+1;
110 F77_FUNC(pardisoinit) (pt_, &mtype_, iparm_);
115 iparm_[2] = num_procs_;
117 F77_FUNC(pardiso) (pt_, &maxfct_, &mnum_, &mtype_, &phase,
118 &n_, a_, ia_, ja_, &idum, &nrhs_,
119 iparm_, &msglvl_, &ddum, &ddum, &error_);
122 DUNE_THROW(
MathError,
"Constructor SeqPardiso: Factorization failed. Error code " << error_);
124 std::cout <<
"Constructor SeqPardiso: Factorization completed." << std::endl;
136 virtual void pre (X& x, Y& b) {}
143 virtual void apply (X& v,
const Y& d)
153 for (
int i = 0; i < n_; i++) {
158 F77_FUNC(pardiso) (pt_, &maxfct_, &mnum_, &mtype_, &phase,
159 &n_, a_, ia_, ja_, &idum, &nrhs_,
160 iparm_, &msglvl_, b, x, &error_);
165 for (
int i = 0; i < n_; i++)
168 std::cout <<
"SeqPardiso: Backsolve completed." << std::endl;
186 F77_FUNC(pardiso) (pt_, &maxfct_, &mnum_, &mtype_, &phase,
187 &n_, &ddum, ia_, ja_, &idum, &nrhs_,
188 iparm_, &msglvl_, &ddum, &ddum, &error_);
212 template<
class M,
class X,
class Y>
213 struct IsDirectSolver<SeqPardiso<M,X,Y> >
Default exception class for mathematical errors.
Definition: exceptions.hh:266
Default exception for dummy implementations.
Definition: exceptions.hh:288
Base class for matrix free definition of preconditioners.
Definition: preconditioner.hh:26
The sequential Pardiso preconditioner.
Definition: pardiso.hh:37
virtual void post(X &x)
Clean up.
Definition: pardiso.hh:177
@ category
The category the preconditioner is part of.
Definition: pardiso.hh:54
virtual void pre(X &x, Y &b)
Prepare the preconditioner.
Definition: pardiso.hh:136
X domain_type
The domain type of the preconditioner.
Definition: pardiso.hh:42
virtual void apply(X &v, const Y &d)
Apply the preconditioner.
Definition: pardiso.hh:143
M matrix_type
The matrix type the preconditioner is for.
Definition: pardiso.hh:40
SeqPardiso(const M &A)
Constructor.
Definition: pardiso.hh:62
Y range_type
The range type of the preconditioner.
Definition: pardiso.hh:44
X::field_type field_type
The field type of the preconditioner.
Definition: pardiso.hh:46
#define DUNE_THROW(E, m)
Definition: exceptions.hh:243
Dune namespace.
Definition: alignment.hh:10
Define general preconditioner interface.
Templates characterizing the type of a solver.
@ sequential
Category for sequential solvers.
Definition: solvercategory.hh:21