16 #ifndef _ISTL_SOLPARAMS_H
17 #define _ISTL_SOLPARAMS_H
20 #include <dune/common/version.hh>
21 #include <dune/istl/operators.hh>
22 #include <dune/istl/solvercategory.hh>
52 Dune::SolverCategory::Category
category()
const
53 {
return Dune::SolverCategory::sequential; }
60 const std::string& schurType);
67 void pre(ISTL::Vec& x, ISTL::Vec& b)
override;
72 void apply(ISTL::Vec& v,
const ISTL::Vec& d)
override;
75 void post(ISTL::Vec& x)
override;
78 std::unique_ptr<ISTL::Preconditioner>&
getBlockPre(
size_t block)
100 static void extractBlock(ISTL::Mat& B,
const ISTL::Mat& A,
101 const std::set<int>& eqs_row,
102 const std::set<int>& eqs_col,
103 const std::map<int,int>& eqs_col_g2l);
110 std::vector<std::unique_ptr<ISTL::Preconditioner>>
blockPre;
111 std::vector<std::unique_ptr<ISTL::Operator>>
blockOp;
138 template<
class M,
class X,
class Y,
class C>
139 class OverlappingSchwarzOperator :
public Dune::AssembledLinearOperator<M,X,Y>
146 using matrix_type =
M;
151 using domain_type = X;
156 using range_type = Y;
158 using field_type =
typename X::field_type;
163 using communication_type = C;
166 Dune::SolverCategory::Category category()
const
167 {
return Dune::SolverCategory::sequential; }
176 OverlappingSchwarzOperator (
const matrix_type& A,
const communication_type& com)
177 : _A_(A), communication(com)
181 void apply (
const X& x, Y& y)
const override
185 communication.addOwnerOverlapToAll(y,y);
189 void applyscaleadd (field_type alpha,
const X& x, Y& y)
const override
192 _A_.usmv(alpha, x, y2);
194 communication.addOwnerOverlapToAll(y2,y);
198 const matrix_type& getmat ()
const override
204 const matrix_type& _A_;
205 const communication_type& communication;
208 using ParMatrixAdapter =
209 OverlappingSchwarzOperator<ISTL::Mat,
212 Dune::OwnerOverlapCopyCommunication<int,int>>;
238 std::tuple<std::unique_ptr<ISTL::InverseOperator>,
239 std::unique_ptr<ISTL::Preconditioner>,
240 std::unique_ptr<ISTL::Operator>>
255 std::unique_ptr<ISTL::InverseOperator>* solver);
static SystemMatrix * M
Pointer to coefficient matrix B.
Definition: EigSolver.C:92
Class containing domain decomposition related partitioning.
Definition: DomainDecomposition.h:38
Class for ISTL solver parameters.
Definition: ISTLSolParams.h:225
const LinSolParams & get() const
Obtain linear solver parameters.
Definition: ISTLSolParams.h:244
ISTL::Preconditioner * setupPCInternal(ISTL::Mat &A, ISTL::Operator &op, size_t block, std::unique_ptr< ISTL::InverseOperator > *solver)
Internal helper function for setting up a preconditioner.
Definition: ISTLSolParams.C:385
ISTLSolParams(const LinSolParams &spar, const ProcessAdm &padm)
Constructor.
Definition: ISTLSolParams.h:230
const LinSolParams & solParams
Reference to linear solver parameters.
Definition: ISTLSolParams.h:257
std::tuple< std::unique_ptr< ISTL::InverseOperator >, std::unique_ptr< ISTL::Preconditioner >, std::unique_ptr< ISTL::Operator > > setupPC(ISTL::Mat &A)
Setup solver and preconditioner.
Definition: ISTLSolParams.C:465
const ProcessAdm & adm
Reference to process administrator.
Definition: ISTLSolParams.h:258
Definition: ISTLSolParams.h:49
Dune::SolverCategory::Category category() const
The category the preconditioner is part of.
Definition: ISTLSolParams.h:52
std::vector< std::unique_ptr< ISTL::Operator > > blockOp
The matrix adaptors for the blocks.
Definition: ISTLSolParams.h:111
ISTL::Operator & getBlockOp(size_t block)
Obtain matrix adaptor for a block matrix.
Definition: ISTLSolParams.h:90
ISTL::Mat & getBlock(size_t block)
Obtain reference to a block matrix.
Definition: ISTLSolParams.h:84
void apply(ISTL::Vec &v, const ISTL::Vec &d) override
Applies the preconditioner.
Definition: ISTLSolParams.C:82
const DomainDecomposition & dd
Domain decomposition.
Definition: ISTLSolParams.h:113
static void subtractMatrices(ISTL::Mat &A, const ISTL::Mat &B, const ISTL::Mat &C)
Find A = B - C.
Definition: ISTLSolParams.C:168
std::vector< std::unique_ptr< ISTL::Preconditioner > > blockPre
The preconditioners.
Definition: ISTLSolParams.h:110
~BlockPreconditioner() override
Destructor.
Definition: ISTLSolParams.h:63
void pre(ISTL::Vec &x, ISTL::Vec &b) override
Preprocess preconditioner.
Definition: ISTLSolParams.C:58
std::vector< ISTL::Mat > blocks
Matrix blocks.
Definition: ISTLSolParams.h:112
void post(ISTL::Vec &x) override
Post-process function.
Definition: ISTLSolParams.C:106
BlockPreconditioner(const ISTL::Mat &A, const DomainDecomposition &dd_, const std::string &schurType)
Constructor.
Definition: ISTLSolParams.C:27
static void extractBlock(ISTL::Mat &B, const ISTL::Mat &A, const std::set< int > &eqs_row, const std::set< int > &eqs_col, const std::map< int, int > &eqs_col_g2l)
Build block from block equations.
Definition: ISTLSolParams.C:125
std::unique_ptr< ISTL::Preconditioner > & getBlockPre(size_t block)
Obtain reference to a block preconditioner.
Definition: ISTLSolParams.h:78
Class for linear solver parameters.
Definition: LinSolParams.h:67
Class for administration of MPI processes in IFEM library.
Definition: ProcessAdm.h:33
@ ISTL
Sparse matrices / Dune solver.
Definition: LinAlgenums.h:28