9#include <kernel/solver/base.hpp> 
   10#include <kernel/lafem/saddle_point_matrix.hpp> 
   11#include <kernel/lafem/tuple_filter.hpp> 
   12#include <kernel/lafem/tuple_vector.hpp> 
   13#include <kernel/lafem/tuple_mirror.hpp> 
   14#include <kernel/global/matrix.hpp> 
   15#include <kernel/global/vector.hpp> 
   16#include <kernel/global/filter.hpp> 
   75    template<
typename MatrixA_, 
typename MatrixB_, 
typename MatrixD_, 
typename FilterV_, 
typename FilterP_>
 
   77      public SolverBase<LAFEM::TupleVector<typename MatrixB_::VectorTypeL, typename MatrixD_::VectorTypeL> >
 
   97      const MatrixA_& _matrix_a;
 
   98      const MatrixB_& _matrix_b;
 
   99      const MatrixD_& _matrix_d;
 
  102      const FilterP_& _filter_p;
 
  140        const MatrixA_& matrix_a,
 
  141        const MatrixB_& matrix_b,
 
  142        const MatrixD_& matrix_d,
 
  143        const FilterV_& filter_v,
 
  144        const FilterP_& filter_p,
 
  145        std::shared_ptr<SolverA> solver_a,
 
  146        std::shared_ptr<SolverS> solver_s,
 
  148        bool auto_init_s = 
true) :
 
  159        XASSERTM(solver_a != 
nullptr, 
"A-solver must be given");
 
  160        XASSERTM(solver_s != 
nullptr, 
"S-solver must be given");
 
  185          _vec_tmp_p = _matrix_d.create_vector_l();
 
  226        Statistics::add_solver_expression(std::make_shared<ExpressionStartSolve>(this->
name()));
 
  229        VectorTypeP& tmp_p = this->_vec_tmp_p;
 
  232        const VectorTypeV& rhs_v = vec_def.template at<0>();
 
  233        const VectorTypeP& rhs_p = vec_def.template at<1>();
 
  240          Statistics::add_solver_expression(std::make_shared<ExpressionCallUzawaA>(this->
name(), this->_solver_a->name()));
 
  243            Statistics::add_solver_expression(std::make_shared<ExpressionEndSolve>(this->
name(), 
Status::aborted, 0));
 
  248          Statistics::add_solver_expression(std::make_shared<ExpressionCallUzawaS>(this->
name(), this->_solver_s->name()));
 
  251            Statistics::add_solver_expression(std::make_shared<ExpressionEndSolve>(this->
name(), 
Status::aborted, 0));
 
  256          Statistics::add_solver_expression(std::make_shared<ExpressionEndSolve>(this->
name(), 
Status::success, 0));
 
  261          Statistics::add_solver_expression(std::make_shared<ExpressionCallUzawaA>(this->
name(), this->_solver_a->name()));
 
  264            Statistics::add_solver_expression(std::make_shared<ExpressionEndSolve>(this->
name(), 
Status::aborted, 0));
 
  269          this->_matrix_d.apply(tmp_p, sol_v, rhs_p, -
DataType(1));
 
  272          this->_filter_p.filter_def(tmp_p);
 
  275          Statistics::add_solver_expression(std::make_shared<ExpressionCallUzawaS>(this->
name(), this->_solver_s->name()));
 
  278            Statistics::add_solver_expression(std::make_shared<ExpressionEndSolve>(this->
name(), 
Status::aborted, 0));
 
  283          Statistics::add_solver_expression(std::make_shared<ExpressionEndSolve>(this->
name(), 
Status::success, 0));
 
  288          Statistics::add_solver_expression(std::make_shared<ExpressionCallUzawaS>(this->
name(), this->_solver_s->name()));
 
  291            Statistics::add_solver_expression(std::make_shared<ExpressionEndSolve>(this->
name(), 
Status::aborted, 0));
 
  296          this->_matrix_b.apply(tmp_v, sol_p, rhs_v, -
DataType(1));
 
  299          this->_filter_v.filter_def(tmp_v);
 
  302          Statistics::add_solver_expression(std::make_shared<ExpressionCallUzawaA>(this->
name(), this->_solver_a->name()));
 
  305            Statistics::add_solver_expression(std::make_shared<ExpressionEndSolve>(this->
name(), 
Status::aborted, 0));
 
  310          Statistics::add_solver_expression(std::make_shared<ExpressionEndSolve>(this->
name(), 
Status::success, 0));
 
  317          Statistics::add_solver_expression(std::make_shared<ExpressionCallUzawaA>(this->
name(), this->_solver_a->name()));
 
  320            Statistics::add_solver_expression(std::make_shared<ExpressionEndSolve>(this->
name(), 
Status::aborted, 0));
 
  325          this->_matrix_d.apply(tmp_p, sol_v, rhs_p, -
DataType(1));
 
  328          this->_filter_p.filter_def(tmp_p);
 
  331          Statistics::add_solver_expression(std::make_shared<ExpressionCallUzawaS>(this->
name(), this->_solver_s->name()));
 
  334            Statistics::add_solver_expression(std::make_shared<ExpressionEndSolve>(this->
name(), 
Status::aborted, 0));
 
  339          this->_matrix_b.apply(tmp_v, sol_p, rhs_v, -
DataType(1));
 
  342          this->_filter_v.filter_def(tmp_v);
 
  345          Statistics::add_solver_expression(std::make_shared<ExpressionCallUzawaA>(this->
name(), this->_solver_a->name()));
 
  348            Statistics::add_solver_expression(std::make_shared<ExpressionEndSolve>(this->
name(), 
Status::aborted, 0));
 
  353          Statistics::add_solver_expression(std::make_shared<ExpressionEndSolve>(this->
name(), 
Status::success, 0));
 
  358        Statistics::add_solver_expression(std::make_shared<ExpressionEndSolve>(this->
name(), 
Status::aborted, 0));
 
  369      typename MatrixA_, 
typename MatrixB_, 
typename MatrixD_,
 
  370      typename FilterV_, 
typename FilterP_,
 
  371      typename MirrorV_, 
typename MirrorP_>
 
  374        Global::Matrix<MatrixA_, MirrorV_, MirrorV_>,
 
  383            typename MatrixB_::VectorTypeL,
 
  384            typename MatrixD_::VectorTypeL>,
 
  401      typedef typename GlobalVectorType::DataType 
DataType;
 
  412      typedef typename MatrixB_::VectorTypeL LocalVectorTypeV;
 
  413      typedef typename MatrixD_::VectorTypeL LocalVectorTypeP;
 
  444        std::shared_ptr<SolverA> solver_a,
 
  445        std::shared_ptr<SolverS> solver_s,
 
  447        bool auto_init_s = 
true 
  526      virtual Status apply(GlobalVectorType& vec_cor, 
const GlobalVectorType& vec_def)
 override 
  528        Statistics::add_solver_expression(std::make_shared<ExpressionStartSolve>(this->
name()));
 
  530        _vec_rhs_v.
local().copy(vec_def.local().template at<0>());
 
  531        _vec_rhs_p.
local().copy(vec_def.local().template at<1>());
 
  538          Statistics::add_solver_expression(std::make_shared<ExpressionCallUzawaA>(this->
name(), this->_solver_a->name()));
 
  541            Statistics::add_solver_expression(std::make_shared<ExpressionEndSolve>(this->
name(), 
Status::aborted, 0));
 
  546          Statistics::add_solver_expression(std::make_shared<ExpressionCallUzawaS>(this->
name(), this->_solver_s->name()));
 
  549            Statistics::add_solver_expression(std::make_shared<ExpressionEndSolve>(this->
name(), 
Status::aborted, 0));
 
  558          Statistics::add_solver_expression(std::make_shared<ExpressionCallUzawaA>(this->
name(), this->_solver_a->name()));
 
  561            Statistics::add_solver_expression(std::make_shared<ExpressionEndSolve>(this->
name(), 
Status::aborted, 0));
 
  566          _matrix_d.
apply(_vec_def_p, _vec_sol_v, _vec_rhs_p, -
DataType(1));
 
  569          _filter_p.filter_def(_vec_def_p);
 
  572          Statistics::add_solver_expression(std::make_shared<ExpressionCallUzawaS>(this->
name(), this->_solver_s->name()));
 
  575            Statistics::add_solver_expression(std::make_shared<ExpressionEndSolve>(this->
name(), 
Status::aborted, 0));
 
  584          Statistics::add_solver_expression(std::make_shared<ExpressionCallUzawaS>(this->
name(), this->_solver_s->name()));
 
  587            Statistics::add_solver_expression(std::make_shared<ExpressionEndSolve>(this->
name(), 
Status::aborted, 0));
 
  592          _matrix_b.
apply(_vec_def_v, _vec_sol_p, _vec_rhs_v, -
DataType(1));
 
  598          Statistics::add_solver_expression(std::make_shared<ExpressionCallUzawaA>(this->
name(), this->_solver_a->name()));
 
  601            Statistics::add_solver_expression(std::make_shared<ExpressionEndSolve>(this->
name(), 
Status::aborted, 0));
 
  612          Statistics::add_solver_expression(std::make_shared<ExpressionCallUzawaA>(this->
name(), this->_solver_a->name()));
 
  615            Statistics::add_solver_expression(std::make_shared<ExpressionEndSolve>(this->
name(), 
Status::aborted, 0));
 
  620          _matrix_d.
apply(_vec_def_p, _vec_sol_v, _vec_rhs_p, -
DataType(1));
 
  623          _filter_p.filter_def(_vec_def_p);
 
  626          Statistics::add_solver_expression(std::make_shared<ExpressionCallUzawaS>(this->
name(), this->_solver_s->name()));
 
  629            Statistics::add_solver_expression(std::make_shared<ExpressionEndSolve>(this->
name(), 
Status::aborted, 0));
 
  634          _matrix_b.
apply(_vec_def_v, _vec_sol_p, _vec_rhs_v, -
DataType(1));
 
  640          Statistics::add_solver_expression(std::make_shared<ExpressionCallUzawaA>(this->
name(), this->_solver_a->name()));
 
  643            Statistics::add_solver_expression(std::make_shared<ExpressionEndSolve>(this->
name(), 
Status::aborted, 0));
 
  652        vec_cor.local().template at<0>().copy(_vec_sol_v.
local());
 
  653        vec_cor.local().template at<1>().copy(_vec_sol_p.
local());
 
  656        Statistics::add_solver_expression(std::make_shared<ExpressionEndSolve>(this->
name(), 
Status::success, 0));
 
  685    template<
typename MatrixA_, 
typename MatrixB_, 
typename MatrixD_, 
typename FilterV_, 
typename FilterP_>
 
  686    inline std::shared_ptr<UzawaPrecond<MatrixA_, MatrixB_, MatrixD_, FilterV_, FilterP_>> 
new_uzawa_precond(
 
  687      const MatrixA_& matrix_a, 
const MatrixB_& matrix_b, 
const MatrixD_& matrix_d,
 
  688      const FilterV_& filter_v, 
const FilterP_& filter_p,
 
  692      bool auto_init_s = 
true)
 
  694      return std::make_shared<UzawaPrecond<MatrixA_, MatrixB_, MatrixD_, FilterV_, FilterP_>>
 
  695        (matrix_a, matrix_b, matrix_d, filter_v, filter_p, solver_a, solver_s, type, auto_init_s);
 
#define XASSERTM(expr, msg)
Assertion macro definition with custom message.
Global Filter wrapper class template.
Global gate implementation.
Global Matrix wrapper class template.
VectorTypeL create_vector_l() const
Creates and returns a new L-compatible global vector object.
void apply(VectorTypeL &r, const VectorTypeR &x) const
Performs a matrix-vector multiplication: r <- A*x.
Global vector wrapper class template.
LocalVector_ & local()
Returns a reference to the internal local LAFEM vector object.
void clear()
Clears the underlying vector.
Saddle-Point matrix meta class template.
TupleVector meta-filter class template.
TupleVector meta-mirror class template.
Variadic TupleVector class template.
Polymorphic solver interface.
virtual void init_symbolic()
Symbolic initialization method.
virtual void init_numeric()
Numeric initialization method.
virtual void done_symbolic()
Symbolic finalization method.
virtual void done_numeric()
Numeric finalization method.
FEAT::Solver::UzawaPrecond< Global::Matrix< MatrixA_, MirrorV_, MirrorV_ >, Global::Matrix< MatrixB_, MirrorV_, MirrorP_ >, Global::Matrix< MatrixD_, MirrorP_, MirrorV_ >, Global::Filter< FilterV_, MirrorV_ >, Global::Filter< FilterP_, MirrorP_ > >::init_symbolic virtual void init_symbolic() override
Symbolic initialization method.
FEAT::Solver::UzawaPrecond< Global::Matrix< MatrixA_, MirrorV_, MirrorV_ >, Global::Matrix< MatrixB_, MirrorV_, MirrorP_ >, Global::Matrix< MatrixD_, MirrorP_, MirrorV_ >, Global::Filter< FilterV_, MirrorV_ >, Global::Filter< FilterP_, MirrorP_ > >::name virtual String name() const override
Returns a descriptive string.
FEAT::Solver::UzawaPrecond< Global::Matrix< MatrixA_, MirrorV_, MirrorV_ >, Global::Matrix< MatrixB_, MirrorV_, MirrorP_ >, Global::Matrix< MatrixD_, MirrorP_, MirrorV_ >, Global::Filter< FilterV_, MirrorV_ >, Global::Filter< FilterP_, MirrorP_ > >::done_symbolic virtual void done_symbolic() override
Symbolic finalization method.
FEAT::Solver::UzawaPrecond< Global::Matrix< MatrixA_, MirrorV_, MirrorV_ >, Global::Matrix< MatrixB_, MirrorV_, MirrorP_ >, Global::Matrix< MatrixD_, MirrorP_, MirrorV_ >, Global::Filter< FilterV_, MirrorV_ >, Global::Filter< FilterP_, MirrorP_ > >::done_numeric virtual void done_numeric() override
Numeric finalization method.
FEAT::Solver::UzawaPrecond< Global::Matrix< MatrixA_, MirrorV_, MirrorV_ >, Global::Matrix< MatrixB_, MirrorV_, MirrorP_ >, Global::Matrix< MatrixD_, MirrorP_, MirrorV_ >, Global::Filter< FilterV_, MirrorV_ >, Global::Filter< FilterP_, MirrorP_ > >::init_numeric virtual void init_numeric() override
Numeric initialization method.
virtual void done_symbolic() override
Symbolic finalization method.
UzawaPrecond(const MatrixA_ &matrix_a, const MatrixB_ &matrix_b, const MatrixD_ &matrix_d, const FilterV_ &filter_v, const FilterP_ &filter_p, std::shared_ptr< SolverA > solver_a, std::shared_ptr< SolverS > solver_s, UzawaType type=UzawaType::diagonal, bool auto_init_s=true)
Constructs a Uzawa preconditioner.
MatrixA_::DataType DataType
our data type
VectorTypeV _vec_tmp_v
a temporary defect vector
LAFEM::TupleVector< VectorTypeV, VectorTypeP > VectorType
system vector type
UzawaType _uzawa_type
our Uzawa type
SolverBase< VectorTypeP > SolverS
S-block solver type.
const FilterV_ & _filter_v
our system filter
virtual String name() const override
Returns a descriptive string.
SolverBase< VectorType > BaseClass
base-class typedef
std::shared_ptr< SolverA > _solver_a
our A-block solver
MatrixD_::VectorTypeL VectorTypeP
pressure vector type
MatrixB_::VectorTypeL VectorTypeV
velocity vector type
virtual void init_numeric() override
Numeric initialization method.
std::shared_ptr< SolverS > _solver_s
our S-block solver
virtual void init_symbolic() override
Symbolic initialization method.
virtual void done_numeric() override
Numeric finalization method.
const bool _auto_init_s
auto-initialize of S-solver
SolverBase< VectorTypeV > SolverA
A-block solver type.
String class implementation.
bool status_success(Status status)
Status success check function.
std::shared_ptr< UzawaPrecond< MatrixA_, MatrixB_, MatrixD_, FilterV_, FilterP_ > > new_uzawa_precond(const MatrixA_ &matrix_a, const MatrixB_ &matrix_b, const MatrixD_ &matrix_d, const FilterV_ &filter_v, const FilterP_ &filter_p, std::shared_ptr< SolverBase< typename MatrixB_::VectorTypeL > > solver_a, std::shared_ptr< SolverBase< typename MatrixD_::VectorTypeL > > solver_s, UzawaType type=UzawaType::diagonal, bool auto_init_s=true)
Creates a new UzawaPrecond solver object.
UzawaType
Uzawa preconditioner type.
@ upper
upper-diagonal Uzawa preconditioner
@ lower
lower-diagonal Uzawa preconditioner
@ diagonal
diagonal Uzawa preconditioner
@ full
full Uzawa preconditioner
Status
Solver status return codes enumeration.
@ success
solving successful (convergence criterion fulfilled)
@ aborted
premature abort (solver aborted due to internal errors or preconditioner failure)