3#ifndef DUNE_ISTL_ILUSUBDOMAINSOLVER_HH
4#define DUNE_ISTL_ILUSUBDOMAINSOLVER_HH
7#include <dune/common/typetraits.hh>
33 template<
class M,
class X,
class Y>
49 virtual void apply (X& v,
const Y& d) =0;
74 template<
class M,
class X,
class Y>
80 typedef typename std::remove_const<M>::type
rilu_type;
107 template<
class M,
class X,
class Y>
147 template<
class M,
class X,
class Y>
153 typedef typename M::size_type size_type;
154 typedef std::map<typename S::value_type,size_type> IndexMap;
155 typedef typename IndexMap::iterator IMIter;
157 IMIter guess = indexMap.begin();
158 size_type localIndex=0;
160 typedef typename S::const_iterator SIter;
161 for(SIter rowIdx = rowSet.begin(), rowEnd=rowSet.end();
162 rowIdx!= rowEnd; ++rowIdx, ++localIndex)
163 guess = indexMap.insert(guess,
164 std::make_pair(*rowIdx,localIndex));
168 ILU.setSize(rowSet.size(),rowSet.size());
169 ILU.setBuildMode(matrix_type::row_wise);
172 typedef typename matrix_type::CreateIterator CIter;
173 CIter rowCreator = ILU.createbegin();
174 std::size_t offset=0;
175 for(SIter rowIdx = rowSet.begin(), rowEnd=rowSet.end();
176 rowIdx!= rowEnd; ++rowIdx, ++rowCreator) {
179 guess = indexMap.begin();
181 for(
typename matrix_type::ConstColIterator
col=A[*rowIdx].begin(),
182 endcol=A[*rowIdx].end();
col != endcol; ++
col) {
184 guess = indexMap.find(
col.index());
185 if(guess!=indexMap.end()) {
187 rowCreator.insert(guess->second);
188 offset=std::max(offset,(std::size_t)std::abs((
int)(guess->second-rowCreator.index())));
195 typename matrix_type::iterator iluRow=ILU.begin();
197 for(SIter rowIdx = rowSet.begin(), rowEnd=rowSet.end();
198 rowIdx!= rowEnd; ++rowIdx, ++iluRow) {
201 typename matrix_type::ColIterator localCol=iluRow->begin();
202 for(
typename matrix_type::ConstColIterator
col=A[*rowIdx].begin(),
203 endcol=A[*rowIdx].end();
col != endcol; ++
col) {
205 guess = indexMap.find(
col.index());
206 if(guess!=indexMap.end()) {
217 template<
class M,
class X,
class Y>
221 this->copyToLocalMatrix(A,rowSet);
225 template<
class M,
class X,
class Y>
229 std::size_t offset=copyToLocalMatrix(A,rowSet);
230 RILU.setSize(rowSet.size(),rowSet.size(), (1+2*offset)*rowSet.size());
231 RILU.setBuildMode(matrix_type::row_wise);
Define general preconditioner interface.
A dynamic dense block matrix class.
std::size_t copyToLocalMatrix(const M &A, S &rowset)
Copy the local part of the global matrix to ILU.
Definition: ilusubdomainsolver.hh:149
void setSubMatrix(const M &A, S &rowset)
Set the data of the local problem.
Definition: ilusubdomainsolver.hh:227
void setSubMatrix(const M &A, S &rowset)
Set the data of the local problem.
Definition: ilusubdomainsolver.hh:219
Col col
Definition: matrixmatrix.hh:349
Definition: allocator.hh:9
void blockILUBacksolve(const M &A, X &v, const Y &d)
LU backsolve with stored inverse.
Definition: ilu.hh:93
void blockILU0Decomposition(M &A)
compute ILU decomposition of A. A is overwritten by its decomposition
Definition: ilu.hh:32
void blockILUDecomposition(const M &A, int n, M &ILU)
Definition: ilu.hh:166
base class encapsulating common algorithms of ILU0SubdomainSolver and ILUNSubdomainSolver.
Definition: ilusubdomainsolver.hh:34
matrix_type ILU
The ILU0 decomposition of the matrix, or the local matrix.
Definition: ilusubdomainsolver.hh:65
X domain_type
The domain type of the preconditioner.
Definition: ilusubdomainsolver.hh:39
virtual ~ILUSubdomainSolver()
Definition: ilusubdomainsolver.hh:51
Y range_type
The range type of the preconditioner.
Definition: ilusubdomainsolver.hh:41
std::remove_const< M >::type matrix_type
The matrix type the preconditioner is for.
Definition: ilusubdomainsolver.hh:37
virtual void apply(X &v, const Y &d)=0
Apply the subdomain solver.
Exact subdomain solver using ILU(p) with appropriate p.
Definition: ilusubdomainsolver.hh:76
X domain_type
The domain type of the preconditioner.
Definition: ilusubdomainsolver.hh:82
Y range_type
The range type of the preconditioner.
Definition: ilusubdomainsolver.hh:84
std::remove_const< M >::type rilu_type
Definition: ilusubdomainsolver.hh:80
std::remove_const< M >::type matrix_type
The matrix type the preconditioner is for.
Definition: ilusubdomainsolver.hh:79
void apply(X &v, const Y &d)
Apply the subdomain solver.
Definition: ilusubdomainsolver.hh:91
Definition: ilusubdomainsolver.hh:109
X domain_type
The domain type of the preconditioner.
Definition: ilusubdomainsolver.hh:115
std::remove_const< M >::type matrix_type
The matrix type the preconditioner is for.
Definition: ilusubdomainsolver.hh:112
std::remove_const< M >::type rilu_type
Definition: ilusubdomainsolver.hh:113
void apply(X &v, const Y &d)
Apply the subdomain solver.
Definition: ilusubdomainsolver.hh:123
Y range_type
The range type of the preconditioner.
Definition: ilusubdomainsolver.hh:117