3 #ifndef DUNE_ISTL_ILUSUBDOMAIN_HH
4 #define DUNE_ISTL_ILUSUBDOMAIN_HH
7 #include<dune/common/typetraits.hh>
32 template<
class M,
class X,
class Y>
48 virtual void apply (X& v,
const Y& d) =0;
73 template<
class M,
class X,
class Y>
106 template<
class M,
class X,
class Y>
146 template<
class M,
class X,
class Y>
152 typedef typename M::size_type size_type;
153 typedef std::map<typename S::value_type,size_type> IndexMap;
154 typedef typename IndexMap::iterator IMIter;
156 IMIter guess = indexMap.begin();
157 size_type localIndex=0;
159 typedef typename S::const_iterator SIter;
160 for(SIter rowIdx = rowSet.begin(), rowEnd=rowSet.end();
161 rowIdx!= rowEnd; ++rowIdx, ++localIndex)
162 guess = indexMap.insert(guess,
163 std::make_pair(*rowIdx,localIndex));
167 ILU.setSize(rowSet.size(),rowSet.size());
168 ILU.setBuildMode(matrix_type::row_wise);
171 typedef typename matrix_type::CreateIterator CIter;
172 CIter rowCreator = ILU.createbegin();
173 typedef typename S::const_iterator RIter;
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);