5 #ifndef DUNE_ISTL_ILUSUBDOMAINSOLVER_HH
6 #define DUNE_ISTL_ILUSUBDOMAINSOLVER_HH
9 #include <dune/common/typetraits.hh>
35 template<
class M,
class X,
class Y>
51 virtual void apply (X& v,
const Y& d) =0;
76 template<
class M,
class X,
class Y>
82 typedef typename std::remove_const<M>::type
rilu_type;
109 template<
class M,
class X,
class Y>
149 template<
class M,
class X,
class Y>
155 typedef typename M::size_type size_type;
156 typedef std::map<typename S::value_type,size_type> IndexMap;
157 typedef typename IndexMap::iterator IMIter;
159 IMIter guess = indexMap.begin();
160 size_type localIndex=0;
162 typedef typename S::const_iterator SIter;
163 for(SIter rowIdx = rowSet.begin(), rowEnd=rowSet.end();
164 rowIdx!= rowEnd; ++rowIdx, ++localIndex)
165 guess = indexMap.insert(guess,
166 std::make_pair(*rowIdx,localIndex));
170 ILU.setSize(rowSet.size(),rowSet.size());
171 ILU.setBuildMode(matrix_type::row_wise);
174 typedef typename matrix_type::CreateIterator CIter;
175 CIter rowCreator = ILU.createbegin();
176 std::size_t offset=0;
177 for(SIter rowIdx = rowSet.begin(), rowEnd=rowSet.end();
178 rowIdx!= rowEnd; ++rowIdx, ++rowCreator) {
181 guess = indexMap.begin();
183 for(
typename matrix_type::ConstColIterator
col=A[*rowIdx].begin(),
184 endcol=A[*rowIdx].end();
col != endcol; ++
col) {
186 guess = indexMap.find(
col.index());
187 if(guess!=indexMap.end()) {
189 rowCreator.insert(guess->second);
190 offset=std::max(offset,(std::size_t)std::abs((
int)(guess->second-rowCreator.index())));
197 typename matrix_type::iterator iluRow=ILU.begin();
199 for(SIter rowIdx = rowSet.begin(), rowEnd=rowSet.end();
200 rowIdx!= rowEnd; ++rowIdx, ++iluRow) {
203 typename matrix_type::ColIterator localCol=iluRow->begin();
204 for(
typename matrix_type::ConstColIterator
col=A[*rowIdx].begin(),
205 endcol=A[*rowIdx].end();
col != endcol; ++
col) {
207 guess = indexMap.find(
col.index());
208 if(guess!=indexMap.end()) {
219 template<
class M,
class X,
class Y>
223 this->copyToLocalMatrix(A,rowSet);
227 template<
class M,
class X,
class Y>
231 std::size_t offset=copyToLocalMatrix(A,rowSet);
232 RILU.setSize(rowSet.size(),rowSet.size(), (1+2*offset)*rowSet.size());
233 RILU.setBuildMode(matrix_type::row_wise);
A dynamic dense block matrix class.
Define general preconditioner interface.
std::size_t copyToLocalMatrix(const M &A, S &rowset)
Copy the local part of the global matrix to ILU.
Definition: ilusubdomainsolver.hh:151
void setSubMatrix(const M &A, S &rowset)
Set the data of the local problem.
Definition: ilusubdomainsolver.hh:229
void setSubMatrix(const M &A, S &rowset)
Set the data of the local problem.
Definition: ilusubdomainsolver.hh:221
Col col
Definition: matrixmatrix.hh:351
Definition: allocator.hh:11
void blockILUBacksolve(const M &A, X &v, const Y &d)
LU backsolve with stored inverse.
Definition: ilu.hh:94
void blockILU0Decomposition(M &A)
compute ILU decomposition of A. A is overwritten by its decomposition
Definition: ilu.hh:33
void blockILUDecomposition(const M &A, int n, M &ILU)
Definition: ilu.hh:167
base class encapsulating common algorithms of ILU0SubdomainSolver and ILUNSubdomainSolver.
Definition: ilusubdomainsolver.hh:36
matrix_type ILU
The ILU0 decomposition of the matrix, or the local matrix.
Definition: ilusubdomainsolver.hh:67
X domain_type
The domain type of the preconditioner.
Definition: ilusubdomainsolver.hh:41
virtual ~ILUSubdomainSolver()
Definition: ilusubdomainsolver.hh:53
Y range_type
The range type of the preconditioner.
Definition: ilusubdomainsolver.hh:43
std::remove_const< M >::type matrix_type
The matrix type the preconditioner is for.
Definition: ilusubdomainsolver.hh:39
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:78
X domain_type
The domain type of the preconditioner.
Definition: ilusubdomainsolver.hh:84
Y range_type
The range type of the preconditioner.
Definition: ilusubdomainsolver.hh:86
std::remove_const< M >::type rilu_type
Definition: ilusubdomainsolver.hh:82
std::remove_const< M >::type matrix_type
The matrix type the preconditioner is for.
Definition: ilusubdomainsolver.hh:81
void apply(X &v, const Y &d)
Apply the subdomain solver.
Definition: ilusubdomainsolver.hh:93
Definition: ilusubdomainsolver.hh:111
X domain_type
The domain type of the preconditioner.
Definition: ilusubdomainsolver.hh:117
std::remove_const< M >::type matrix_type
The matrix type the preconditioner is for.
Definition: ilusubdomainsolver.hh:114
std::remove_const< M >::type rilu_type
Definition: ilusubdomainsolver.hh:115
void apply(X &v, const Y &d)
Apply the subdomain solver.
Definition: ilusubdomainsolver.hh:125
Y range_type
The range type of the preconditioner.
Definition: ilusubdomainsolver.hh:119