5#ifndef DUNE_ISTL_ILUSUBDOMAINSOLVER_HH 
    6#define DUNE_ISTL_ILUSUBDOMAINSOLVER_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;
 
   95      ILU::blockILUBacksolve(this->
ILU,v,d);
 
  109  template<
class M, 
class X, 
class Y>
 
  110  class ILUNSubdomainSolver
 
  111    : 
public ILUSubdomainSolver<M,X,Y>{
 
  114    typedef typename std::remove_const<M>::type matrix_type;
 
  115    typedef typename std::remove_const<M>::type rilu_type;
 
  117    typedef X domain_type;
 
  119    typedef Y range_type;
 
  125    void apply (X& v, 
const Y& d)
 
  127      ILU::blockILUBacksolve(RILU,v,d);
 
  138    void setSubMatrix(
const M& A, S& rowset);
 
  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);
 
  224    ILU::blockILU0Decomposition(this->ILU);
 
  227  template<
class M, 
class X, 
class Y>
 
  229  void ILUNSubdomainSolver<M,X,Y>::setSubMatrix(
const M& A, S& rowSet)
 
  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);
 
  234    ILU::blockILUDecomposition(this->ILU, (offset+1)/2, RILU);
 
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 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
 
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
 
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.
 
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:221
 
A dynamic dense block matrix class.
 
Dune namespace.
Definition: alignedallocator.hh:13
 
Define general preconditioner interface.
 
Traits for type conversions and type information.