3 #ifndef DUNE_ISTL_OVERLAPPINGSCHWARZ_HH 4 #define DUNE_ISTL_OVERLAPPINGSCHWARZ_HH 10 #include <dune/common/dynmatrix.hh> 11 #include <dune/common/sllist.hh> 12 #include <dune/common/unused.hh> 35 template<
class M,
class X,
class TM,
class TD,
class TA>
36 class SeqOverlappingSchwarz;
41 template<
class I,
class S,
class D>
50 typedef typename AtomInitializer::Matrix
Matrix;
51 typedef typename Matrix::const_iterator
Iter;
52 typedef typename Matrix::row_type::const_iterator
CIter;
58 const IndexSet& indices,
59 const subdomain_vector& domains);
78 typedef std::map<size_type,size_type> Map;
79 typedef typename Map::iterator iterator;
80 typedef typename Map::const_iterator const_iterator;
84 void insert(size_type grow);
86 const_iterator find(size_type grow)
const;
88 iterator find(size_type grow);
92 const_iterator begin()
const;
96 const_iterator end()
const;
99 std::map<size_type,size_type> map_;
104 typedef typename InitializerList::iterator InitIterator;
105 typedef typename IndexSet::const_iterator IndexIteratur;
106 InitializerList* initializers;
107 const IndexSet *indices;
108 mutable std::vector<IndexMap> indexMaps;
109 const subdomain_vector& domains;
135 template<
class M,
class X,
class Y>
139 template<
class K,
int n,
class Al,
class X,
class Y>
157 void apply (DynamicVector<field_type>& v, DynamicVector<field_type>& d)
159 assert(v.size() > 0);
160 assert(v.size() == d.size());
161 assert(A.rows() <= v.size());
162 assert(A.cols() <= v.size());
163 size_t sz = A.rows();
167 v.resize(v.capacity());
168 d.resize(d.capacity());
181 size_t sz = rowset.size();
183 typedef typename S::const_iterator SIter;
185 for(SIter rowIdx = rowset.begin(), rowEnd=rowset.end();
186 rowIdx!= rowEnd; ++rowIdx, r++)
189 for(SIter colIdx = rowset.begin(), colEnd=rowset.end();
190 colIdx!= colEnd; ++colIdx, c++)
192 if (BCRS[*rowIdx].find(*colIdx) == BCRS[*rowIdx].
end())
194 for (
size_t i=0; i<n; i++)
196 for (
size_t j=0; j<n; j++)
198 A[r*n+i][c*n+j] = BCRS[*rowIdx][*colIdx][i][j];
208 template<
typename T,
bool tag>
216 template<
class K,
int n,
class Al,
class X,
class Y>
245 void resetIndexForNextDomain();
252 DynamicVector<K> & lhs();
259 DynamicVector<K> & rhs();
266 void relaxResult(field_type relax);
272 void operator()(
const size_type& domainIndex);
282 void assignResult(block_type& res);
288 const matrix_type*
mat;
291 DynamicVector<field_type> * rhs_;
294 DynamicVector<field_type> * lhs_;
302 std::size_t maxlength_;
305 #if HAVE_SUPERLU || HAVE_SUITESPARSE_UMFPACK 306 template<
template<
class>
class S,
int n,
int m,
typename T,
typename A>
324 const range_type& b, range_type& x);
335 void resetIndexForNextDomain();
353 void relaxResult(field_type relax);
359 void operator()(
const size_type& domain);
368 void assignResult(block_type& res);
374 const matrix_type*
mat;
386 std::size_t maxlength_;
389 #endif // HAVE_SUPERLU || HAVE_SUITESPARSE_UMFPACK 391 template<
class M,
class X,
class Y>
421 void resetIndexForNextDomain();
439 void relaxResult(field_type relax);
445 void operator()(
const size_type& domain);
454 void assignResult(block_type& res);
474 template<
class M,
class X,
class Y>
493 template<
class M,
class X,
class Y>
511 template<
typename S,
typename T>
515 template<
typename S,
typename T,
typename A,
int n>
521 void operator()(
const size_type& domain);
531 template<
typename S,
typename T>
535 template<
typename S,
typename T,
typename A,
int n>
541 void operator()(
const size_type& domain);
559 template<
typename T,
class X,
class S>
563 template<
class X,
class S>
569 template<
class X,
class S>
575 template<
class X,
class S>
592 template<
typename T1,
typename T2,
bool forward>
600 static solver_iterator
begin(solver_vector& sv)
605 static solver_iterator
end(solver_vector& sv)
609 static domain_iterator
begin(
const subdomain_vector& sv)
614 static domain_iterator
end(
const subdomain_vector& sv)
620 template<
typename T1,
typename T2>
628 static solver_iterator
begin(solver_vector& sv)
633 static solver_iterator
end(solver_vector& sv)
637 static domain_iterator
begin(
const subdomain_vector& sv)
642 static domain_iterator
end(
const subdomain_vector& sv)
662 static void apply(smoother& sm, range_type& v,
const range_type& b)
664 sm.template apply<true>(v, b);
668 template<
class M,
class X,
class TD,
class TA>
674 static void apply(smoother& sm, range_type& v,
const range_type& b)
676 sm.template apply<true>(v, b);
677 sm.template apply<false>(v, b);
681 template<
class T,
bool tag>
688 template<
class K,
int n,
class Al,
class X,
class Y>
692 template<
class RowToDomain,
class Solvers,
class SubDomains>
693 static std::size_t assembleLocalProblems(
const RowToDomain& rowToDomain,
const matrix_type&
mat,
694 Solvers& solvers,
const SubDomains& domains,
698 template<
template<
class>
class S,
typename T,
typename A,
int m,
int n>
702 template<
class RowToDomain,
class Solvers,
class SubDomains>
703 static std::size_t assembleLocalProblems(
const RowToDomain& rowToDomain,
const matrix_type&
mat,
704 Solvers& solvers,
const SubDomains& domains,
708 template<
class M,
class X,
class Y>
712 template<
class RowToDomain,
class Solvers,
class SubDomains>
713 static std::size_t assembleLocalProblems(
const RowToDomain& rowToDomain,
const matrix_type&
mat,
714 Solvers& solvers,
const SubDomains& domains,
718 template<
class M,
class X,
class Y>
723 template<
class M,
class X,
class Y>
779 typedef std::set<size_type, std::less<size_type>,
780 typename TA::template rebind<size_type>::other>
784 typedef std::vector<subdomain_type, typename TA::template rebind<subdomain_type>::other>
subdomain_vector;
787 typedef SLList<size_type, typename TA::template rebind<size_type>::other>
subdomain_list;
790 typedef std::vector<subdomain_list, typename TA::template rebind<subdomain_list>::other >
rowtodomain_vector;
796 typedef std::vector<slu, typename TA::template rebind<slu>::other>
slu_vector;
812 field_type relaxationFactor=1,
bool onTheFly_=
true);
826 field_type relaxationFactor=1,
bool onTheFly_=
true);
833 virtual void pre (X& x, X& b)
835 DUNE_UNUSED_PARAMETER(x);
836 DUNE_UNUSED_PARAMETER(b);
844 virtual void apply (X& v,
const X& d);
853 DUNE_UNUSED_PARAMETER(x);
856 template<
bool forward>
857 void apply(X& v,
const X& d);
868 subdomain_vector subDomains;
871 typename M::size_type maxlength;
878 template<
class I,
class S,
class D>
882 : initializers(&il), indices(&idx), indexMaps(il.size()), domains(domains_)
886 template<
class I,
class S,
class D>
889 typedef typename IndexSet::value_type::const_iterator iterator;
890 for(iterator domain=(*indices)[row.index()].begin(); domain != (*indices)[row.index()].end(); ++domain) {
891 (*initializers)[*domain].addRowNnz(row, domains[*domain]);
892 indexMaps[*domain].insert(row.index());
896 template<
class I,
class S,
class D>
899 for(
auto&& i: *initializers)
900 i.allocateMatrixStorage();
901 for(
auto&& i: *initializers)
905 template<
class I,
class S,
class D>
908 typedef typename IndexSet::value_type::const_iterator iterator;
909 for(iterator domain=(*indices)[row.index()].begin(); domain != (*indices)[row.index()].end(); ++domain) {
910 typename std::map<size_type,size_type>::const_iterator v = indexMaps[*domain].find(col.index());
911 if(v!= indexMaps[*domain].end()) {
912 (*initializers)[*domain].countEntries(indexMaps[*domain].find(col.index())->second);
917 template<
class I,
class S,
class D>
920 for(
auto&& i : *initializers)
924 template<
class I,
class S,
class D>
927 typedef typename IndexSet::value_type::const_iterator iterator;
928 for(iterator domain=(*indices)[row.index()].begin(); domain!= (*indices)[row.index()].end(); ++domain) {
929 typename std::map<size_type,size_type>::const_iterator v = indexMaps[*domain].find(col.index());
930 if(v!= indexMaps[*domain].end()) {
931 assert(indexMaps[*domain].end()!=indexMaps[*domain].find(row.index()));
932 (*initializers)[*domain].copyValue(col, indexMaps[*domain].find(row.index())->second,
938 template<
class I,
class S,
class D>
941 std::vector<IndexMap>().swap(indexMaps);
942 for(
auto&& i: *initializers)
946 template<
class I,
class S,
class D>
951 template<
class I,
class S,
class D>
954 assert(map_.find(grow)==map_.end());
955 map_.insert(std::make_pair(grow, row++));
958 template<
class I,
class S,
class D>
959 typename OverlappingSchwarzInitializer<I,S,D>::IndexMap::const_iterator
962 return map_.find(grow);
965 template<
class I,
class S,
class D>
966 typename OverlappingSchwarzInitializer<I,S,D>::IndexMap::iterator
969 return map_.find(grow);
972 template<
class I,
class S,
class D>
973 typename OverlappingSchwarzInitializer<I,S,D>::IndexMap::const_iterator
979 template<
class I,
class S,
class D>
980 typename OverlappingSchwarzInitializer<I,S,D>::IndexMap::iterator
986 template<
class I,
class S,
class D>
987 typename OverlappingSchwarzInitializer<I,S,D>::IndexMap::const_iterator
993 template<
class I,
class S,
class D>
994 typename OverlappingSchwarzInitializer<I,S,D>::IndexMap::iterator
1000 template<
class M,
class X,
class TM,
class TD,
class TA>
1003 :
mat(mat_), relax(relaxationFactor), onTheFly(fly)
1005 typedef typename rowtodomain_vector::const_iterator RowDomainIterator;
1006 typedef typename subdomain_list::const_iterator DomainIterator;
1007 #ifdef DUNE_ISTL_WITH_CHECKING 1008 assert(rowToDomain.size()==
mat.N());
1009 assert(rowToDomain.size()==
mat.M());
1011 for(RowDomainIterator iter=rowToDomain.begin(); iter != rowToDomain.end(); ++iter)
1012 assert(iter->size()>0);
1017 for(RowDomainIterator iter=rowToDomain.begin(); iter != rowToDomain.end(); ++iter)
1018 for(DomainIterator d=iter->begin(); d != iter->end(); ++d)
1019 domains=std::max(domains, *d);
1022 solvers.resize(domains);
1023 subDomains.resize(domains);
1027 for(RowDomainIterator iter=rowToDomain.begin(); iter != rowToDomain.end(); ++iter, ++row)
1028 for(DomainIterator d=iter->begin(); d != iter->end(); ++d)
1029 subDomains[*d].insert(row);
1031 #ifdef DUNE_ISTL_WITH_CHECKING 1033 typedef typename subdomain_vector::const_iterator iterator;
1034 for(iterator iter=subDomains.begin(); iter != subDomains.end(); ++iter) {
1035 typedef typename subdomain_type::const_iterator entry_iterator;
1036 Dune::dvverb<<
"domain "<<i++<<
":";
1037 for(entry_iterator entry = iter->begin(); entry != iter->end(); ++entry) {
1038 Dune::dvverb<<
" "<<*entry;
1040 Dune::dvverb<<std::endl;
1047 template<
class M,
class X,
class TM,
class TD,
class TA>
1052 :
mat(mat_), solvers(sd.size()), subDomains(sd), relax(relaxationFactor),
1055 typedef typename subdomain_vector::const_iterator DomainIterator;
1057 #ifdef DUNE_ISTL_WITH_CHECKING 1060 for(DomainIterator d=sd.begin(); d != sd.end(); ++d,++i) {
1062 assert(d->size()>0);
1063 typedef typename DomainIterator::value_type::const_iterator entry_iterator;
1064 Dune::dvverb<<
"domain "<<i<<
":";
1065 for(entry_iterator entry = d->begin(); entry != d->end(); ++entry) {
1066 Dune::dvverb<<
" "<<*entry;
1068 Dune::dvverb<<std::endl;
1078 for(DomainIterator domain=sd.begin(); domain != sd.end(); ++domain, ++domainId) {
1079 typedef typename subdomain_type::const_iterator iterator;
1080 for(iterator row=domain->begin(); row != domain->end(); ++row)
1081 rowToDomain[*row].push_back(domainId);
1097 template<
typename T,
typename A,
int n,
int m>
1100 template<
class Domain>
1108 template<
class K,
int n,
class Al,
class X,
class Y>
1109 template<
class RowToDomain,
class Solvers,
class SubDomains>
1112 assembleLocalProblems(
const RowToDomain& rowToDomain,
1115 const SubDomains& subDomains,
1118 DUNE_UNUSED_PARAMETER(onTheFly);
1119 DUNE_UNUSED_PARAMETER(rowToDomain);
1120 DUNE_UNUSED_PARAMETER(mat);
1121 DUNE_UNUSED_PARAMETER(solvers);
1122 typedef typename SubDomains::const_iterator DomainIterator;
1123 std::size_t maxlength = 0;
1127 for(DomainIterator domain=subDomains.begin(); domain!=subDomains.end(); ++domain)
1128 maxlength=std::max(maxlength, domain->size());
1134 #if HAVE_SUPERLU || HAVE_SUITESPARSE_UMFPACK 1135 template<
template<
class>
class S,
typename T,
typename A,
int m,
int n>
1136 template<
class RowToDomain,
class Solvers,
class SubDomains>
1140 const SubDomains& subDomains,
1143 typedef typename S<BCRSMatrix<FieldMatrix<T,m,n>,A> >::MatrixInitializer MatrixInitializer;
1144 typedef typename std::vector<MatrixInitializer>::iterator InitializerIterator;
1145 typedef typename SubDomains::const_iterator DomainIterator;
1146 typedef typename Solvers::iterator SolverIterator;
1147 std::size_t maxlength = 0;
1150 for(DomainIterator domain=subDomains.begin(); domain!=subDomains.end(); ++domain)
1151 maxlength=std::max(maxlength, domain->size());
1152 maxlength*=mat[0].
begin()->N();
1155 DomainIterator domain=subDomains.begin();
1158 std::vector<MatrixInitializer> initializers(subDomains.size());
1160 SolverIterator solver=solvers.begin();
1161 for(InitializerIterator initializer=initializers.begin(); initializer!=initializers.end();
1162 ++initializer, ++solver, ++domain) {
1166 *initializer=MatrixInitializer(solver->getInternalMatrix());
1171 RowToDomain, SubDomains> Initializer;
1173 Initializer initializer(initializers, rowToDomain, subDomains);
1177 for(
auto&& s: solvers)
1179 for (SolverIterator solverIt = solvers.begin(); solverIt != solvers.end(); ++solverIt)
1181 assert(solverIt->getInternalMatrix().N() == solverIt->getInternalMatrix().M());
1182 maxlength = std::max(maxlength, solverIt->getInternalMatrix().N());
1188 #endif // HAVE_SUPERLU || HAVE_SUITESPARSE_UMFPACK 1190 template<
class M,
class X,
class Y>
1191 template<
class RowToDomain,
class Solvers,
class SubDomains>
1195 const SubDomains& subDomains,
1198 DUNE_UNUSED_PARAMETER(rowToDomain);
1199 typedef typename SubDomains::const_iterator DomainIterator;
1200 typedef typename Solvers::iterator SolverIterator;
1201 std::size_t maxlength = 0;
1204 for(DomainIterator domain=subDomains.begin(); domain!=subDomains.end(); ++domain)
1205 maxlength=std::max(maxlength, domain->size());
1208 SolverIterator solver=solvers.begin();
1209 for(DomainIterator domain=subDomains.begin(); domain!=subDomains.end();
1210 ++domain, ++solver) {
1211 solver->setSubMatrix(mat, *domain);
1212 maxlength=std::max(maxlength, domain->size());
1221 template<
class M,
class X,
class TM,
class TD,
class TA>
1227 template<
class M,
class X,
class TM,
class TD,
class TA>
1228 template<
bool forward>
1244 Adder adder(v, x, assigner, relax);
1248 std::for_each(domain->begin(), domain->end(), assigner);
1249 assigner.resetIndexForNextDomain();
1253 sdsolver.setSubMatrix(
mat, *domain);
1255 sdsolver.apply(assigner.lhs(), assigner.rhs());
1257 solver->apply(assigner.lhs(), assigner.rhs());
1262 std::for_each(domain->begin(), domain->end(), adder);
1263 assigner.resetIndexForNextDomain();
1268 assigner.deallocate();
1271 template<
class K,
int n,
class Al,
class X,
class Y>
1274 const X& b_, Y& x_) :
1276 rhs_( new DynamicVector<
field_type>(maxlength, 42) ),
1277 lhs_( new DynamicVector<
field_type>(maxlength, -42) ),
1281 maxlength_(maxlength)
1284 template<
class K,
int n,
class Al,
class X,
class Y>
1286 OverlappingAssignerHelper< DynamicMatrixSubdomainSolver< BCRSMatrix< FieldMatrix<K,n,n>, Al>, X, Y >,
false>
1293 template<
class K,
int n,
class Al,
class X,
class Y>
1295 OverlappingAssignerHelper< DynamicMatrixSubdomainSolver< BCRSMatrix< FieldMatrix<K,n,n>, Al>, X, Y >,
false>
1296 ::resetIndexForNextDomain()
1301 template<
class K,
int n,
class Al,
class X,
class Y>
1303 OverlappingAssignerHelper< DynamicMatrixSubdomainSolver< BCRSMatrix< FieldMatrix<K,n,n>, Al>, X, Y >,
false>
1309 template<
class K,
int n,
class Al,
class X,
class Y>
1311 OverlappingAssignerHelper< DynamicMatrixSubdomainSolver< BCRSMatrix< FieldMatrix<K,n,n>, Al>, X, Y >,
false>
1317 template<
class K,
int n,
class Al,
class X,
class Y>
1319 OverlappingAssignerHelper< DynamicMatrixSubdomainSolver< BCRSMatrix< FieldMatrix<K,n,n>, Al>, X, Y >,
false>
1325 template<
class K,
int n,
class Al,
class X,
class Y>
1327 OverlappingAssignerHelper< DynamicMatrixSubdomainSolver< BCRSMatrix< FieldMatrix<K,n,n>, Al>, X, Y >,
false>
1334 assert(i<maxlength_);
1335 rhs()[i]=(*b)[domainIndex][j];
1342 for(col_iterator
col=(*
mat)[domainIndex].begin();
col!=(*mat)[domainIndex].end(); ++
col) {
1344 (*col).mv((*x)[
col.index()], tmp);
1347 assert(i<maxlength_);
1354 assert(i<maxlength_);
1355 rhs()[i]=(*b)[domainIndex][j];
1361 for(col_iterator
col=(*
mat)[domainIndex].begin();
col!=(*mat)[domainIndex].end(); ++
col) {
1363 rhs()[i]-=(*col)[j][k] * (*x)[
col.index()][k];
1370 template<
class K,
int n,
class Al,
class X,
class Y>
1372 OverlappingAssignerHelper< DynamicMatrixSubdomainSolver< BCRSMatrix< FieldMatrix<K,n,n>, Al>, X, Y >,
false>
1377 assert(i<maxlength_);
1382 #if HAVE_SUPERLU || HAVE_SUITESPARSE_UMFPACK 1384 template<
template<
class>
class S,
int n,
int m,
typename T,
typename A>
1392 x(&x_), i(0), maxlength_(maxlength)
1399 template<
template<
class>
class S,
int n,
int m,
typename T,
typename A>
1400 void OverlappingAssignerHelper<S<BCRSMatrix<FieldMatrix<T,n,m>,A> >,
true>::deallocate()
1406 template<
template<
class>
class S,
int n,
int m,
typename T,
typename A>
1407 void OverlappingAssignerHelper<S<BCRSMatrix<FieldMatrix<T,n,m>,A> >,
true>::operator()(
const size_type& domainIndex)
1413 assert(i<maxlength_);
1414 rhs_[i]=(*b)[domainIndex][j];
1422 for(col_iterator
col=(*
mat)[domainIndex].begin();
col!=(*mat)[domainIndex].end(); ++
col) {
1424 (*col).mv((*x)[
col.index()], tmp);
1427 assert(i<maxlength_);
1435 template<
template<
class>
class S,
int n,
int m,
typename T,
typename A>
1436 void OverlappingAssignerHelper<S<BCRSMatrix<FieldMatrix<T,n,m>,A> >,
true>::relaxResult(
field_type relax)
1439 assert(i<maxlength_);
1445 template<
template<
class>
class S,
int n,
int m,
typename T,
typename A>
1446 void OverlappingAssignerHelper<S<BCRSMatrix<FieldMatrix<T,n,m>,A> >,
true>::assignResult(
block_type& res)
1450 assert(i<maxlength_);
1455 template<
template<
class>
class S,
int n,
int m,
typename T,
typename A>
1456 void OverlappingAssignerHelper<S<BCRSMatrix<FieldMatrix<T,n,m>,A> >,
true>::resetIndexForNextDomain()
1461 template<
template<
class>
class S,
int n,
int m,
typename T,
typename A>
1462 typename OverlappingAssignerHelper<S<BCRSMatrix<FieldMatrix<T,n,m>,A> >,
true>
::field_type*
1463 OverlappingAssignerHelper<S<BCRSMatrix<FieldMatrix<T,n,m>,A> >,
true>::lhs()
1468 template<
template<
class>
class S,
int n,
int m,
typename T,
typename A>
1469 typename OverlappingAssignerHelper<S<BCRSMatrix<FieldMatrix<T,n,m>,A> >,
true>
::field_type*
1470 OverlappingAssignerHelper<S<BCRSMatrix<FieldMatrix<T,n,m>,A> >,
true>::rhs()
1475 #endif // HAVE_SUPERLU || HAVE_SUITESPARSE_UMFPACK 1477 template<
class M,
class X,
class Y>
1486 rhs_=
new Y(maxlength);
1487 lhs_ =
new X(maxlength);
1490 template<
class M,
class X,
class Y>
1497 template<
class M,
class X,
class Y>
1500 (*rhs_)[i]=(*b)[domainIndex];
1503 typedef typename matrix_type::ConstColIterator col_iterator;
1506 for(col_iterator
col=(*mat)[domainIndex].begin();
col!=(*mat)[domainIndex].end(); ++
col) {
1507 (*col).mmv((*x)[
col.index()], (*rhs_)[i]);
1513 template<
class M,
class X,
class Y>
1519 template<
class M,
class X,
class Y>
1525 template<
class M,
class X,
class Y>
1531 template<
class M,
class X,
class Y>
1537 template<
class M,
class X,
class Y>
1543 template<
typename S,
typename T,
typename A,
int n>
1548 : v(&v_), x(&x_), assigner(&assigner_), relax(relax_)
1551 template<
typename S,
typename T,
typename A,
int n>
1555 assigner->assignResult((*v)[domainIndex]);
1559 template<
typename S,
typename T,
typename A,
int n>
1560 void AdditiveAdder<S,BlockVector<FieldVector<T,n>,A> >::axpy()
1567 template<
typename S,
typename T,
typename A,
int n>
1572 : x(&x_), assigner(&assigner_), relax(relax_)
1574 DUNE_UNUSED_PARAMETER(v_);
1578 template<
typename S,
typename T,
typename A,
int n>
1579 void MultiplicativeAdder<S,BlockVector<FieldVector<T,n>,A> >::operator()(
const size_type& domainIndex)
1582 assigner->relaxResult(relax);
1583 assigner->assignResult((*x)[domainIndex]);
1587 template<
typename S,
typename T,
typename A,
int n>
1588 void MultiplicativeAdder<S,BlockVector<FieldVector<T,n>,A> >::axpy()
M matrix_type
Definition: overlappingschwarz.hh:395
Y & rhs()
Get the local right hand side.
Definition: overlappingschwarz.hh:1532
T smoother
Definition: overlappingschwarz.hh:659
void addRowNnz(const Iter &row)
Definition: overlappingschwarz.hh:887
SeqOverlappingSchwarz< M, X, SymmetricMultiplicativeSchwarzMode, TD, TA > smoother
Definition: overlappingschwarz.hh:671
S< BCRSMatrix< FieldMatrix< T, n, m >, A > >::range_type range_type
Definition: overlappingschwarz.hh:310
void countEntries(const Iter &row, const CIter &col) const
Definition: overlappingschwarz.hh:906
void relaxResult(field_type relax)
relax the result.
Definition: overlappingschwarz.hh:1514
X domain_type
The domain type of the preconditioner.
Definition: overlappingschwarz.hh:149
AtomInitializer::Matrix Matrix
Definition: overlappingschwarz.hh:50
D subdomain_vector
The vector type containing the subdomain to row index mapping.
Definition: overlappingschwarz.hh:46
Definition: overlappingschwarz.hh:532
range_type::block_type block_type
Definition: overlappingschwarz.hh:312
solver_vector::iterator solver_iterator
Definition: overlappingschwarz.hh:596
Classes for using SuperLU with ISTL matrices.
BCRSMatrix< FieldMatrix< K, n, n >, Al > matrix_type
Definition: overlappingschwarz.hh:220
solver_vector::reverse_iterator solver_iterator
Definition: overlappingschwarz.hh:624
Definition: allocator.hh:7
range_type::block_type block_type
Definition: overlappingschwarz.hh:223
Various local subdomain solvers based on ILU for SeqOverlappingSchwarz.
T1 solver_vector
Definition: overlappingschwarz.hh:595
matrix_type::size_type size_type
Definition: overlappingschwarz.hh:224
M::field_type field_type
Definition: overlappingschwarz.hh:397
A sparse block matrix with compressed row storage.
Definition: bcrsmatrix.hh:422
Classes for using UMFPack with ISTL matrices.
static domain_iterator end(const subdomain_vector &sv)
Definition: overlappingschwarz.hh:614
InitializerList::value_type AtomInitializer
Definition: overlappingschwarz.hh:49
OverlappingAssignerILUBase(std::size_t maxlength, const M &mat, const Y &b, X &x)
Constructor.
Definition: overlappingschwarz.hh:1478
Exact subdomain solver using ILU(p) with appropriate p.
Definition: ilusubdomainsolver.hh:74
void resetIndexForNextDomain()
Resets the local index to zero.
Definition: overlappingschwarz.hh:1538
subdomain_vector::const_reverse_iterator domain_iterator
Definition: overlappingschwarz.hh:626
static void apply(smoother &sm, range_type &v, const range_type &b)
Definition: overlappingschwarz.hh:662
template meta program for choosing how to add the correction.
Definition: overlappingschwarz.hh:560
smoother::range_type range_type
Definition: overlappingschwarz.hh:672
This file implements a vector space as a tensor product of a given vector space. The number of compon...
void calcColstart() const
Definition: overlappingschwarz.hh:918
std::vector< subdomain_type, typename TA::template rebind< subdomain_type >::other > subdomain_vector
The vector type containing the subdomain to row index mapping.
Definition: overlappingschwarz.hh:784
void copyValue(const Iter &row, const CIter &col) const
Definition: overlappingschwarz.hh:925
static domain_iterator begin(const subdomain_vector &sv)
Definition: overlappingschwarz.hh:637
Initializer for SuperLU Matrices representing the subdomains.
Definition: overlappingschwarz.hh:42
T2 subdomain_vector
Definition: overlappingschwarz.hh:625
IndexSet::size_type size_type
Definition: overlappingschwarz.hh:55
void setSubMatrix(const M &BCRS, S &rowset)
Set the data of the local problem.
Definition: overlappingschwarz.hh:179
static solver_iterator end(solver_vector &sv)
Definition: overlappingschwarz.hh:633
X & lhs()
Get the local left hand side.
Definition: overlappingschwarz.hh:1526
void allocate()
Definition: overlappingschwarz.hh:897
Definition: colcompmatrix.hh:160
Exact subdomain solver using Dune::DynamicMatrix<T>::solve.
Definition: overlappingschwarz.hh:136
std::set< size_type, std::less< size_type >, typename TA::template rebind< size_type >::other > subdomain_type
The type for the subdomain to row index mapping.
Definition: overlappingschwarz.hh:781
static domain_iterator end(const subdomain_vector &sv)
Definition: overlappingschwarz.hh:642
static domain_iterator begin(const subdomain_vector &sv)
Definition: overlappingschwarz.hh:609
Definition: overlappingschwarz.hh:1095
I InitializerList
Definition: overlappingschwarz.hh:48
Y range_type
The range type of the preconditioner.
Definition: overlappingschwarz.hh:151
void apply(DynamicVector< field_type > &v, DynamicVector< field_type > &d)
Apply the subdomain solver.
Definition: overlappingschwarz.hh:157
Tag that the tells the schwarz method to be additive.
Definition: overlappingschwarz.hh:115
matrix_type::size_type size_type
Definition: overlappingschwarz.hh:401
OverlappingAssignerHelper(std::size_t maxlength, const M &mat, const Y &b, X &x)
Constructor.
Definition: overlappingschwarz.hh:505
Definition: overlappingschwarz.hh:709
static int size(const Domain &d)
Definition: overlappingschwarz.hh:1101
K field_type
Definition: overlappingschwarz.hh:221
S IndexSet
Definition: overlappingschwarz.hh:54
row_type::ConstIterator ConstColIterator
Const iterator to the entries of a row.
Definition: bcrsmatrix.hh:700
Matrix & mat
Definition: matrixmatrix.hh:345
OverlappingAssignerHelper(std::size_t maxlength, const M &mat, const Y &b, X &x)
Constructor.
Definition: overlappingschwarz.hh:486
Define general preconditioner interface.
void deallocate()
Deallocates memory of the local vector.
Definition: overlappingschwarz.hh:1491
Definition: overlappingschwarz.hh:392
Definition: matrixutils.hh:25
Implementation of the BCRSMatrix class.
X domain_type
The domain type of the preconditioner.
Definition: overlappingschwarz.hh:752
Definition: overlappingschwarz.hh:209
BCRSMatrix< FieldMatrix< K, n, n >, Al > matrix_type
Definition: overlappingschwarz.hh:691
Sequential overlapping Schwarz preconditioner.
Definition: colcompmatrix.hh:157
virtual void pre(X &x, X &b)
Prepare the preconditioner.
Definition: overlappingschwarz.hh:833
static solver_iterator end(solver_vector &sv)
Definition: overlappingschwarz.hh:605
subdomain_vector::const_iterator domain_iterator
Definition: overlappingschwarz.hh:598
std::remove_const< M >::type rilu_type
Definition: overlappingschwarz.hh:147
virtual SolverCategory::Category category() const
Category of the preconditioner (see SolverCategory::Category)
Definition: overlappingschwarz.hh:860
TM Mode
The mode (additive or multiplicative) of the Schwarz method.
Definition: overlappingschwarz.hh:765
Helper template meta program for application of overlapping schwarz.
Definition: overlappingschwarz.hh:593
Definition: ilusubdomainsolver.hh:107
SeqOverlappingSchwarz(const matrix_type &mat, const subdomain_vector &subDomains, field_type relaxationFactor=1, bool onTheFly_=true)
Construct the overlapping Schwarz method.
Definition: overlappingschwarz.hh:1048
std::vector< subdomain_list, typename TA::template rebind< subdomain_list >::other > rowtodomain_vector
The vector type containing the row index to subdomain mapping.
Definition: overlappingschwarz.hh:790
SLList< size_type, typename TA::template rebind< size_type >::other > subdomain_list
The type for the row to subdomain mapping.
Definition: overlappingschwarz.hh:787
std::vector< slu, typename TA::template rebind< slu >::other > slu_vector
The vector type containing subdomain solvers.
Definition: overlappingschwarz.hh:796
void assignResult(block_type &res)
Assigns the block to the current local index. At the same time the local defect is calculated for the...
Definition: overlappingschwarz.hh:1520
Tag that tells the Schwarz method to be multiplicative and symmetric.
Definition: overlappingschwarz.hh:128
void copyToColCompMatrix(F &initializer, const MRS &mrs)
Definition: colcompmatrix.hh:428
matrix_type::size_type size_type
The return type of the size method.
Definition: overlappingschwarz.hh:773
A::size_type size_type
The type for the index access and the size.
Definition: bcrsmatrix.hh:457
Matrix::row_type::const_iterator CIter
Definition: overlappingschwarz.hh:52
smoother::range_type range_type
Definition: overlappingschwarz.hh:660
Iterator begin()
Get iterator to first row.
Definition: bcrsmatrix.hh:634
T1 solver_vector
Definition: overlappingschwarz.hh:623
range_type::field_type field_type
Definition: overlappingschwarz.hh:311
TA allocator
The allocator to use.
Definition: overlappingschwarz.hh:776
AdditiveAdder< S, X > Adder
Definition: overlappingschwarz.hh:566
Category
Definition: solvercategory.hh:21
Helper template meta program for application of overlapping schwarz.
Definition: overlappingschwarz.hh:657
X::field_type field_type
The field type of the preconditioner.
Definition: overlappingschwarz.hh:770
TD slu
The type for the subdomain solver in use.
Definition: overlappingschwarz.hh:793
static solver_iterator begin(solver_vector &sv)
Definition: overlappingschwarz.hh:628
Iterator end()
Get iterator to one beyond last row.
Definition: bcrsmatrix.hh:640
OverlappingSchwarzInitializer(InitializerList &il, const IndexSet &indices, const subdomain_vector &domains)
Definition: overlappingschwarz.hh:879
Col col
Definition: matrixmatrix.hh:349
A vector of blocks with memory management.
Definition: bvector.hh:316
K field_type
Definition: overlappingschwarz.hh:146
Tag that tells the Schwarz method to be multiplicative.
Definition: overlappingschwarz.hh:121
MultiplicativeAdder< S, X > Adder
Definition: overlappingschwarz.hh:572
X range_type
The range type of the preconditioner.
Definition: overlappingschwarz.hh:757
static void apply(smoother &sm, range_type &v, const range_type &b)
Definition: overlappingschwarz.hh:674
BCRSMatrix< FieldMatrix< T, m, n >, A > matrix_type
Definition: overlappingschwarz.hh:701
Matrix::const_iterator Iter
Definition: overlappingschwarz.hh:51
virtual void post(X &x)
Postprocess the preconditioner.
Definition: overlappingschwarz.hh:851
void operator()(const size_type &domain)
calculate one entry of the local defect.
Definition: overlappingschwarz.hh:1498
static solver_iterator begin(solver_vector &sv)
Definition: overlappingschwarz.hh:600
Category for sequential solvers.
Definition: solvercategory.hh:23
Base class for matrix free definition of preconditioners.
Definition: preconditioner.hh:30
std::remove_const< M >::type matrix_type
The matrix type the preconditioner is for.
Definition: overlappingschwarz.hh:145
M matrix_type
Definition: overlappingschwarz.hh:711
Y::block_type block_type
Definition: overlappingschwarz.hh:399
void createMatrix() const
Definition: overlappingschwarz.hh:939
A::size_type size_type
Definition: overlappingschwarz.hh:518
matrix_type::size_type size_type
Definition: overlappingschwarz.hh:314
M matrix_type
The type of the matrix to precondition.
Definition: overlappingschwarz.hh:747
T2 subdomain_vector
Definition: overlappingschwarz.hh:597
Y range_type
Definition: overlappingschwarz.hh:222
Templates characterizing the type of a solver.
A::size_type size_type
Definition: overlappingschwarz.hh:538
Definition: overlappingschwarz.hh:512
MultiplicativeAdder< S, X > Adder
Definition: overlappingschwarz.hh:578