8#include <kernel/solver/base.hpp>
9#include <kernel/global/vector.hpp>
10#include <kernel/global/filter.hpp>
28 template<
typename Vector_,
typename Filter_>
51 template<
typename LocalVector_,
typename LocalFilter_,
typename Mirror_>
53 public SolverBase<Global::Vector<LocalVector_, Mirror_>>
90 _local_solver(local_solver),
92 _ignore_status(ignore_status)
112 std::shared_ptr<LocalSolverType> local_solver,
const GlobalFilterType& filter) :
114 _local_solver(local_solver),
116 _ignore_status(false)
118 auto ignore_status_p = section->
query(
"ignore_status");
119 if(ignore_status_p.second)
121 if(ignore_status_p.first.is_one_of(
"yes true"))
122 this->_ignore_status =
true;
123 else if(ignore_status_p.first.is_one_of(
"no false"))
124 this->_ignore_status =
false;
126 throw ParseError(section_name +
".ignore_status", ignore_status_p.first,
"yes/no or true/false");
136 void set_ignore_status(
bool ignore_status)
138 this->_ignore_status = ignore_status;
143 _local_solver->init_symbolic();
148 _local_solver->init_numeric();
153 _local_solver->done_numeric();
158 _local_solver->done_symbolic();
163 Statistics::add_solver_expression(std::make_shared<ExpressionStartSolve>(this->name()));
166 Statistics::add_solver_expression(std::make_shared<ExpressionCallPrecond>(this->name(), this->_local_solver->name()));
170 if(this->_ignore_status)
201 _filter.filter_cor(vec_cor);
205 Statistics::add_solver_expression(std::make_shared<ExpressionEndSolve>(this->name(), status, 0));
222 template<
typename LocalFilter_,
typename Mirror_>
228 (local_solver, filter);
249 template<
typename LocalFilter_,
typename Mirror_>
250 inline std::shared_ptr
264 (section_name, section, local_solver, filter);
#define XASSERT(expr)
Assertion macro definition.
void allreduce(const void *sendbuf, void *recvbuf, std::size_t count, const Datatype &datatype, const Operation &op) const
Blocking All-Reduce.
Global Filter wrapper class template.
Global vector wrapper class template.
void sync_1()
Performs a type-1 synchronization of the vector, i.e. averages all local DOF contributions.
const Dist::Comm * get_comm() const
Returns a const pointer to the internal communicator of the gate of the vector.
LocalVector_ & local()
Returns a reference to the internal local LAFEM vector object.
Class for parser related errors.
A class organizing a tree of key-value pairs.
std::pair< String, bool > query(String key_path) const
Queries a value by its key path.
Global::Filter< LocalFilter_, Mirror_ > GlobalFilterType
our global filter type
LocalVector_ LocalVectorType
our local vector type
SchwarzPrecond(const String §ion_name, const PropertyMap *section, std::shared_ptr< LocalSolverType > local_solver, const GlobalFilterType &filter)
Constructor using a PropertyMap.
virtual String name() const override
Returns the name of the solver.
virtual void init_numeric() override
Numeric initialization method.
bool _ignore_status
whether to ignore status codes of local solvers
SchwarzPrecond(std::shared_ptr< LocalSolverType > local_solver, const GlobalFilterType &filter, bool ignore_status=false)
Constructor.
virtual void done_symbolic() override
Symbolic finalization method.
virtual void init_symbolic() override
Symbolic initialization method.
virtual Status apply(GlobalVectorType &vec_cor, const GlobalVectorType &vec_def) override
Solver application method.
virtual void done_numeric() override
Numeric finalization method.
std::shared_ptr< LocalSolverType > _local_solver
our local solver object
SolverBase< LocalVector_ > LocalSolverType
the local solver interface
const GlobalFilterType & _filter
our global filter
Global::Vector< LocalVector_, Mirror_ > GlobalVectorType
our global vector type
SolverBase< Global::Vector< LocalVector_, Mirror_ > > BaseClass
base-class typedef
Schwarz preconditioner class template declaration.
Polymorphic solver interface.
String class implementation.
const Operation op_sum(MPI_SUM)
Operation wrapper for MPI_SUM.
bool status_success(Status status)
Status success check function.
Status
Solver status return codes enumeration.
@ success
solving successful (convergence criterion fulfilled)
@ aborted
premature abort (solver aborted due to internal errors or preconditioner failure)
std::shared_ptr< SchwarzPrecond< Global::Vector< typename LocalFilter_::VectorType, Mirror_ >, Global::Filter< LocalFilter_, Mirror_ > > > new_schwarz_precond(std::shared_ptr< SolverBase< typename LocalFilter_::VectorType > > local_solver, const Global::Filter< LocalFilter_, Mirror_ > &filter)
Creates a new SchwarzPrecond solver object.