9#include <kernel/solver/base.hpp>
48 inline std::ostream& operator<<(std::ostream& os,
MultiGridCycle cycle)
90 is.setstate(std::ios_base::failbit);
128 typename SystemMatrix_,
129 typename SystemFilter_,
130 typename TransferOperator_>
229 typename SystemMatrix_,
230 typename SystemFilter_,
231 typename TransferOperator_>
283 std::shared_ptr<SolverType> crs_solver)
327 std::shared_ptr<SolverType> smooth_pre,
328 std::shared_ptr<SolverType> smooth_post,
329 std::shared_ptr<SolverType> smooth_peak,
330 std::shared_ptr<SolverType> crs_solver =
nullptr)
392 typename SystemMatrix_,
393 typename SystemFilter_,
394 typename TransferOperator_>
414 typename SystemMatrix_,
415 typename SystemFilter_,
416 typename TransferOperator_>
421 friend class MultiGrid<SystemMatrix_, SystemFilter_, TransferOperator_>;
468 explicit LevelInfo(std::shared_ptr<LevelType> lvl) :
484 _push_solver(
level->get_coarse_solver().get());
485 _push_solver(
level->get_smoother_pre().get());
486 _push_solver(
level->get_smoother_post().get());
487 _push_solver(
level->get_smoother_peak().get());
491 (*it)->init_symbolic();
497 vec_rhs = matrix.create_vector_r();
498 vec_sol = matrix.create_vector_r();
499 vec_def = matrix.create_vector_r();
500 vec_cor = matrix.create_vector_r();
501 vec_tmp = matrix.create_vector_r();
515 (*it)->done_symbolic();
522 (*it)->init_numeric();
529 (*it)->done_numeric();
535 if(solver ==
nullptr)
566 return _levels.at(std::size_t(lvl));
634 std::shared_ptr<SolverType> coarse_solver)
636 push_level(std::make_shared<StdLevelType>(system_matrix, system_filter, coarse_solver));
679 std::shared_ptr<SolverType> smoother_pre,
680 std::shared_ptr<SolverType> smoother_post,
681 std::shared_ptr<SolverType> smoother_peak,
682 std::shared_ptr<SolverType> coarse_solver =
nullptr
685 push_level(std::make_shared<StdLevelType>(system_matrix, system_filter, transfer_operator,
686 smoother_pre, smoother_post, smoother_peak, coarse_solver));
721 return *(
_levels.at(std::size_t(lvl)).level);
728 return *(
_levels.at(std::size_t(lvl)).level);
884 return _levels.at(std::size_t(lvl)).time_smooth;
907 return _levels.at(std::size_t(lvl)).time_coarse;
930 return _levels.at(std::size_t(lvl)).time_defect;
948 t += li.time_transfer;
953 return _levels.at(std::size_t(lvl)).time_transfer;
979 typename SystemMatrix_,
980 typename SystemFilter_,
981 typename TransferOperator_>
983 public SolverBase<typename SystemMatrix_::VectorTypeR>
1074 XASSERTM(_crs_level < _hierarchy->size_virtual(),
"invalid coarse level");
1131 XASSERTM(_crs_level < _hierarchy->size_virtual(),
"invalid coarse level");
1179 XASSERTM(
_hierarchy->have_symbolic(),
"init_symbolic() of multigrid hierarchy was not called yet");
1182 const std::size_t num_lvls =
_hierarchy->size_virtual();
1188 _toes.resize(num_lvls, 0.0);
1238 XASSERTM(
_hierarchy->have_numeric(),
"init_numeric() of multigrid hierarchy was not called yet");
1270 Statistics::add_solver_expression(std::make_shared<ExpressionStartSolve>(this->
name()));
1273 for(std::size_t i(0); i < std::size_t(
_hierarchy->size_virtual()); ++i)
1290 lvl_top.
vec_rhs.copy(vec_def);
1310 Statistics::add_solver_expression(std::make_shared<ExpressionEndSolve>(this->
name(),
Status::aborted, 1));
1316 vec_cor.copy(lvl_top.vec_sol);
1319 for(std::size_t i(0); i < std::size_t(
_hierarchy->size_virtual()); ++i)
1321 Statistics::add_solver_expression(std::make_shared<ExpressionLevelTimings>(this->
name(),
Index(i),
1327 Statistics::add_solver_expression(std::make_shared<ExpressionEndSolve>(this->
name(),
Status::success, 1));
1380 if(last_level >
Index(0))
1446 for(std::size_t i(
_top_level); i <= std::size_t(last_level); ++i)
1453 const int num_cgs = 1 << (last_level -
_top_level);
1456 for(
int cgs(1); cgs < num_cgs; ++cgs)
1460 std::size_t peak_lvl = std::size_t(last_level);
1479 for(std::size_t i = std::size_t(last_level-1); i > peak_lvl; --i)
1508 for(std::size_t i(last_level); i > std::size_t(
_top_level); )
1511 XASSERTM(this->_counters[i] == 1,
"W-cycle sanity check failed: invalid counters");
1532 double mpi_exec_reduction_start(Statistics::get_time_mpi_execute_reduction());
1533 double mpi_exec_blas2_start(Statistics::get_time_mpi_execute_blas2());
1534 double mpi_exec_blas3_start(Statistics::get_time_mpi_execute_blas3());
1535 double mpi_exec_collective_start(Statistics::get_time_mpi_execute_collective());
1536 double mpi_wait_start_reduction(Statistics::get_time_mpi_wait_reduction());
1537 double mpi_wait_start_blas2(Statistics::get_time_mpi_wait_blas2());
1538 double mpi_wait_start_blas3(Statistics::get_time_mpi_wait_blas3());
1539 double mpi_wait_start_collective(Statistics::get_time_mpi_wait_collective());
1548 std::shared_ptr<SolverType> coarse_solver = lvl_crs.
level->get_coarse_solver();
1554 Statistics::add_solver_expression(std::make_shared<ExpressionCallCoarseSolver>(this->
name(), coarse_solver->name()));
1561 lvl_crs.vec_sol.copy(lvl_crs.
vec_rhs);
1564 system_filter.filter_cor(lvl_crs.vec_sol);
1569 double mpi_exec_reduction_stop(Statistics::get_time_mpi_execute_reduction());
1570 double mpi_exec_blas2_stop(Statistics::get_time_mpi_execute_blas2());
1571 double mpi_exec_blas3_stop(Statistics::get_time_mpi_execute_blas3());
1572 double mpi_exec_collective_stop(Statistics::get_time_mpi_execute_collective());
1573 double mpi_wait_stop_reduction(Statistics::get_time_mpi_wait_reduction());
1574 double mpi_wait_stop_blas2(Statistics::get_time_mpi_wait_blas2());
1575 double mpi_wait_stop_blas3(Statistics::get_time_mpi_wait_blas3());
1576 double mpi_wait_stop_collective(Statistics::get_time_mpi_wait_collective());
1595 const MatrixType& system_matrix = lvl.level->get_system_matrix();
1596 const FilterType& system_filter = lvl.level->get_system_filter();
1600 Statistics::add_solver_expression(std::make_shared<ExpressionCallSmoother>(this->
name(), smoother.name()));
1601 smoother.apply(lvl.vec_cor, lvl.vec_def);
1607 system_filter.filter_cor(lvl.vec_cor);
1610 lvl.vec_sol.axpy(lvl.vec_cor);
1614 system_matrix.apply(lvl.vec_def, lvl.vec_sol, lvl.vec_rhs, -
DataType(1));
1618 system_filter.filter_def(lvl.vec_def);
1633 double mpi_exec_reduction_start(Statistics::get_time_mpi_execute_reduction());
1634 double mpi_exec_blas2_start(Statistics::get_time_mpi_execute_blas2());
1635 double mpi_exec_blas3_start(Statistics::get_time_mpi_execute_blas3());
1636 double mpi_exec_collective_start(Statistics::get_time_mpi_execute_collective());
1637 double mpi_wait_start_reduction(Statistics::get_time_mpi_wait_reduction());
1638 double mpi_wait_start_blas2(Statistics::get_time_mpi_wait_blas2());
1639 double mpi_wait_start_blas3(Statistics::get_time_mpi_wait_blas3());
1640 double mpi_wait_start_collective(Statistics::get_time_mpi_wait_collective());
1651 system_matrix.apply(lvl.vec_def, lvl.vec_sol, lvl.
vec_rhs, -
DataType(1));
1655 system_filter.filter_def(lvl.vec_def);
1658 std::shared_ptr<SolverType> smoother_peak = lvl.
level->get_smoother_peak();
1664 if(!this->_apply_smooth_def(cur_lvl, *smoother_peak))
1671 std::shared_ptr<SolverType> smoother_pre = lvl.
level->get_smoother_pre();
1672 std::shared_ptr<SolverType> smoother_post = lvl.
level->get_smoother_post();
1674 if((smoother_pre) && (!this->_apply_smooth_def(cur_lvl, *smoother_pre)))
1676 if((smoother_post) && (!this->_apply_smooth_def(cur_lvl, *smoother_post)))
1682 double mpi_exec_reduction_stop(Statistics::get_time_mpi_execute_reduction());
1683 double mpi_exec_blas2_stop(Statistics::get_time_mpi_execute_blas2());
1684 double mpi_exec_blas3_stop(Statistics::get_time_mpi_execute_blas3());
1685 double mpi_exec_collective_stop(Statistics::get_time_mpi_execute_collective());
1686 double mpi_wait_stop_reduction(Statistics::get_time_mpi_wait_reduction());
1687 double mpi_wait_stop_blas2(Statistics::get_time_mpi_wait_blas2());
1688 double mpi_wait_stop_blas3(Statistics::get_time_mpi_wait_blas3());
1689 double mpi_wait_stop_collective(Statistics::get_time_mpi_wait_collective());
1690 _mpi_execs_reduction.at(std::size_t(cur_lvl)) += mpi_exec_reduction_stop - mpi_exec_reduction_start;
1691 _mpi_execs_blas2.at(std::size_t(cur_lvl)) += mpi_exec_blas2_stop - mpi_exec_blas2_start;
1692 _mpi_execs_blas3.at(std::size_t(cur_lvl)) += mpi_exec_blas3_stop - mpi_exec_blas3_start;
1693 _mpi_execs_collective.at(std::size_t(cur_lvl)) += mpi_exec_collective_stop - mpi_exec_collective_start;
1694 _mpi_waits_reduction.at(std::size_t(cur_lvl)) += mpi_wait_stop_reduction - mpi_wait_start_reduction;
1695 _mpi_waits_blas2.at(std::size_t(cur_lvl)) += mpi_wait_stop_blas2 - mpi_wait_start_blas2;
1696 _mpi_waits_blas3.at(std::size_t(cur_lvl)) += mpi_wait_stop_blas3 - mpi_wait_start_blas3;
1697 _mpi_waits_collective.at(std::size_t(cur_lvl)) += mpi_wait_stop_collective - mpi_wait_start_collective;
1716 for(
Index i(cur_lvl); i < last_level; ++i)
1719 double mpi_exec_reduction_start(Statistics::get_time_mpi_execute_reduction());
1720 double mpi_exec_blas2_start(Statistics::get_time_mpi_execute_blas2());
1721 double mpi_exec_blas3_start(Statistics::get_time_mpi_execute_blas3());
1722 double mpi_exec_collective_start(Statistics::get_time_mpi_execute_collective());
1723 double mpi_wait_start_reduction(Statistics::get_time_mpi_wait_reduction());
1724 double mpi_wait_start_blas2(Statistics::get_time_mpi_wait_blas2());
1725 double mpi_wait_start_blas3(Statistics::get_time_mpi_wait_blas3());
1726 double mpi_wait_start_collective(Statistics::get_time_mpi_wait_collective());
1736 std::shared_ptr<SolverType> smoother = lvl_f.
level->get_smoother_pre();
1743 if(cur_smooth || (i > cur_lvl))
1750 Statistics::add_solver_expression(std::make_shared<ExpressionCallSmoother>(this->
name(), smoother->name()));
1751 smoother->apply(lvl_f.vec_sol, lvl_f.
vec_rhs);
1758 system_matrix.apply(lvl_f.vec_def, lvl_f.vec_sol, lvl_f.
vec_rhs, -
DataType(1));
1764 lvl_f.vec_sol.format();
1767 lvl_f.vec_def.copy(lvl_f.
vec_rhs);
1772 system_filter_f.filter_def(lvl_f.vec_def);
1776 XASSERTM(transfer_operator !=
nullptr,
"transfer operator is missing");
1779 bool break_loop =
false;
1782 if(transfer_operator->is_ghost())
1786 transfer_operator->rest_send(lvl_f.vec_def);
1799 transfer_operator->rest(lvl_f.vec_def, lvl_c.
vec_rhs);
1803 system_filter_c.filter_def(lvl_c.
vec_rhs);
1808 double mpi_exec_reduction_stop(Statistics::get_time_mpi_execute_reduction());
1809 double mpi_exec_blas2_stop(Statistics::get_time_mpi_execute_blas2());
1810 double mpi_exec_blas3_stop(Statistics::get_time_mpi_execute_blas3());
1811 double mpi_exec_collective_stop(Statistics::get_time_mpi_execute_collective());
1812 double mpi_wait_stop_reduction(Statistics::get_time_mpi_wait_reduction());
1813 double mpi_wait_stop_blas2(Statistics::get_time_mpi_wait_blas2());
1814 double mpi_wait_stop_blas3(Statistics::get_time_mpi_wait_blas3());
1815 double mpi_wait_stop_collective(Statistics::get_time_mpi_wait_collective());
1817 _mpi_execs_blas2.at((
size_t)i) += mpi_exec_blas2_stop - mpi_exec_blas2_start;
1818 _mpi_execs_blas3.at((
size_t)i) += mpi_exec_blas3_stop - mpi_exec_blas3_start;
1821 _mpi_waits_blas2.at((
size_t)i) += mpi_wait_stop_blas2 - mpi_wait_start_blas2;
1822 _mpi_waits_blas3.at((
size_t)i) += mpi_wait_stop_blas3 - mpi_wait_start_blas3;
1848 for(
Index i(last_level); i > cur_lvl;)
1852 double mpi_exec_reduction_start(Statistics::get_time_mpi_execute_reduction());
1853 double mpi_exec_blas2_start(Statistics::get_time_mpi_execute_blas2());
1854 double mpi_exec_blas3_start(Statistics::get_time_mpi_execute_blas3());
1855 double mpi_exec_collective_start(Statistics::get_time_mpi_execute_collective());
1856 double mpi_wait_start_reduction(Statistics::get_time_mpi_wait_reduction());
1857 double mpi_wait_start_blas2(Statistics::get_time_mpi_wait_blas2());
1858 double mpi_wait_start_blas3(Statistics::get_time_mpi_wait_blas3());
1859 double mpi_wait_start_collective(Statistics::get_time_mpi_wait_collective());
1866 XASSERTM(transfer_operator !=
nullptr,
"transfer operator is missing");
1869 if(transfer_operator->is_ghost())
1873 transfer_operator->prol_recv(lvl_f.vec_cor);
1883 transfer_operator->prol(lvl_f.vec_cor, lvl_c.vec_sol);
1892 system_filter_f.filter_cor(lvl_f.vec_cor);
1902 system_matrix.apply(lvl_f.vec_tmp, lvl_f.vec_cor);
1906 system_filter_f.filter_def(lvl_f.vec_tmp);
1912 omega_cgc = lvl_f.vec_def.dot(lvl_f.vec_cor)
1913 / lvl_f.vec_tmp.dot(lvl_f.vec_cor);
1917 omega_cgc = lvl_f.vec_def.dot(lvl_f.vec_tmp)
1918 / lvl_f.vec_tmp.dot(lvl_f.vec_tmp);
1928 lvl_f.vec_sol.axpy(lvl_f.vec_cor, omega_cgc);
1931 std::shared_ptr<SolverType> smoother = lvl_f.
level->get_smoother_post();
1934 if(smoother && (cur_smooth || (i > cur_lvl)))
1953 lvl_f.vec_def.axpy(lvl_f.vec_tmp, -omega_cgc);
1959 system_matrix.apply(lvl_f.vec_def, lvl_f.vec_sol, lvl_f.
vec_rhs, -
DataType(1));
1963 system_filter_f.filter_def(lvl_f.vec_def);
1967 Statistics::add_solver_expression(std::make_shared<ExpressionCallSmoother>(this->
name(), smoother->name()));
1969 smoother->apply(lvl_f.vec_cor, lvl_f.vec_def);
1975 lvl_f.vec_sol.axpy(lvl_f.vec_cor);
1979 double mpi_exec_reduction_stop(Statistics::get_time_mpi_execute_reduction());
1980 double mpi_exec_blas2_stop(Statistics::get_time_mpi_execute_blas2());
1981 double mpi_exec_blas3_stop(Statistics::get_time_mpi_execute_blas3());
1982 double mpi_exec_collective_stop(Statistics::get_time_mpi_execute_collective());
1983 double mpi_wait_stop_reduction(Statistics::get_time_mpi_wait_reduction());
1984 double mpi_wait_stop_blas2(Statistics::get_time_mpi_wait_blas2());
1985 double mpi_wait_stop_blas3(Statistics::get_time_mpi_wait_blas3());
1986 double mpi_wait_stop_collective(Statistics::get_time_mpi_wait_collective());
1988 _mpi_execs_blas2.at((
size_t)i) += mpi_exec_blas2_stop - mpi_exec_blas2_start;
1989 _mpi_execs_blas3.at((
size_t)i) += mpi_exec_blas3_stop - mpi_exec_blas3_start;
1992 _mpi_waits_blas2.at((
size_t)i) += mpi_wait_stop_blas2 - mpi_wait_start_blas2;
1993 _mpi_waits_blas3.at((
size_t)i) += mpi_wait_stop_blas3 - mpi_wait_start_blas3;
2024 typename SystemMatrix_,
2025 typename SystemFilter_,
2026 typename TransferOperator_>
2027 std::shared_ptr<MultiGrid<SystemMatrix_, SystemFilter_, TransferOperator_>>
new_multigrid(
2033 return std::make_shared<MultiGrid<SystemMatrix_, SystemFilter_, TransferOperator_>>
2034 (hierarchy, cycle, top_level, crs_level);
#define XASSERT(expr)
Assertion macro definition.
#define XASSERTM(expr, msg)
Assertion macro definition with custom message.
Multigrid level info class.
std::shared_ptr< LevelType > level
the actual multigrid level
double time_smooth
total smoother application time
double time_coarse
coarse grid solver application time
SystemVectorType vec_rhs
four temporary vectors
double time_defect
defect computation time
double time_transfer
prolongation/restriction times
std::deque< SolverType * > unique_solvers
deque of unique solver object pointers
Multigrid hierarchy management class template.
double get_time_smooth(int lvl=-1) const
Returns the time for smoother application.
LevelType & get_level(Index lvl)
Returns a level in the hierarchy.
void done_symbolic()
Symbolic finalization method.
MultiGridLevelBase< SystemMatrix_, SystemFilter_, TransferOperator_ > LevelType
the level base class type
void init_numeric()
Numeric initialization method.
void push_level(const SystemMatrixType &system_matrix, const SystemFilterType &system_filter, std::shared_ptr< SolverType > coarse_solver)
Pushes a standard coarse-grid level into the hierarchy.
Index size_virtual() const
Returns the virtual hierarchy size.
LevelInfo & _get_level_info(Index lvl)
Returns a level info in the hierarchy.
virtual ~MultiGridHierarchy()
Destructor.
LevelType::SystemFilterType SystemFilterType
the system filter type
LevelType::TransferOperatorType TransferOperatorType
the transfer operator type
void init_symbolic()
Symbolic initialization method.
void push_level(std::shared_ptr< LevelType > level)
Pushes a new (custom) level into the hierarchy.
std::size_t _virt_size
the virtual multigrid hierarchy sizes
void done_numeric()
Numeric finalization method.
void done()
Finalization method.
std::deque< LevelInfo > _levels
the deque of all level info objects
LevelType::SystemMatrixType SystemMatrixType
the system matrix type
double get_time_transfer(int lvl=-1) const
Returns the time for grid transfer application.
void reset_timings()
Resets the internal timing statistics.
Index size_physical() const
Returns the physical hierarchy size.
bool have_numeric() const
Specifies whether the symbolic initialization was performed.
double get_time_coarse(int lvl=-1) const
Returns the time for coarse grid solver application.
void init()
Initialization method.
bool _have_init_symbolic
specifies whether init_symbolic() has been called
LevelType::SystemVectorType SystemVectorType
the system vector type
bool have_symbolic() const
Specifies whether the symbolic initialization was performed.
LevelType::SolverType SolverType
the coarse-grid solver/smoother type
MultiGridLevelStd< SystemMatrix_, SystemFilter_, TransferOperator_ > StdLevelType
the standard level class type
MultiGridHierarchy(std::size_t size_virt)
Constructor.
bool _have_init_numeric
specifies whether init_numeric() has been called
void push_level(const SystemMatrixType &system_matrix, const SystemFilterType &system_filter, const TransferOperatorType &transfer_operator, std::shared_ptr< SolverType > smoother_pre, std::shared_ptr< SolverType > smoother_post, std::shared_ptr< SolverType > smoother_peak, std::shared_ptr< SolverType > coarse_solver=nullptr)
Pushes a standard refined level into the hierarchy.
const LevelType & get_level(Index lvl) const
Returns a level in the hierarchy.
double get_time_defect(int lvl=-1) const
Returns the time for defect computation.
Multigrid preconditioner implementation.
std::vector< double > _mpi_waits_blas3
array containing toe of mpi wait blas3 for each processed level
std::vector< double > _mpi_execs_reduction
array containing toe of mpi execution reduction for each processed level
Status _apply_coarse()
Applies the coarse grid solver on the coarse level.
LevelType::TransferOperatorType TransferOperatorType
the transfer operator type
Status _apply_cycle_w()
Applies a single W-cycle.
LevelType::SolverType SolverType
the sub-solver type
Status _apply_cycle_f()
Applies a single F-cycle.
Status _apply_cycle_v()
Applies a single V-cycle.
LevelType::SystemVectorType VectorType
the system vector type
Status _apply_rest(const Index cur_lvl, bool cur_smooth)
Restricts from the current level onto the coarse level.
virtual ~MultiGrid()
virtual destructor
virtual void init_numeric() override
Numeric initialization function.
std::vector< double > _mpi_execs_blas2
array containing toe of mpi execution blas2 for each processed level
Index _crs_level
the coarse-level of this multigrid
MultiGridCycle get_cycle() const
Returns the currently selected cycle.
MultiGridCycle _cycle
the multigrid cycle
virtual void done_symbolic() override
Symbolic finalization function.
void set_adapt_cgc(MultiGridAdaptCGC adapt_cgc)
Sets the adaption mode for the coarse grid correction.
HierarchyType::LevelType LevelType
the level type
std::vector< double > _mpi_waits_collective
array containing toe of mpi wait collective for each processed level
Index _top_level
the top-level of this multigrid
MultiGridAdaptCGC _adapt_cgc
the coarse grid correction type
Index get_crs_level() const
Returns the currently selected coarse-level index.
MatrixType::DataType DataType
our data type
std::vector< double > _mpi_execs_blas3
array containing toe of mpi execution blas3 for each processed level
virtual Status _apply_prol(const Index cur_lvl, bool cur_smooth)
Prolongates from the coarse level onto the current level.
std::vector< double > _mpi_waits_reduction
array containing toe of mpi wait reduction for each processed level
std::vector< double > _toes
array containing toe for each processed level
virtual void init_symbolic() override
Symbolic initialization function.
virtual Status apply(VectorType &vec_cor, const VectorType &vec_def) override
Applies the multigrid preconditioner.
Index get_top_level() const
Returns the currently selected top-level index.
std::vector< int > _counters
W-cycle level counter vector.
void set_cycle(MultiGridCycle cycle)
Sets a new cycle.
virtual void done_numeric() override
Numeric finalization function.
virtual String name() const override
Returns a descriptive string.
void set_levels(int top_level, int crs_level)
Sets the level range for this multigrid.
std::vector< double > _mpi_execs_collective
array containing toe of mpi execution collective for each processed level
LevelType::SystemFilterType FilterType
the system filter type
LevelType::SystemMatrixType MatrixType
the system matrix type
SolverBase< typename SystemMatrix_::VectorTypeR > BaseClass
our base-class
Status _apply_smooth_peak(Index cur_lvl)
Applies the peak-smoother on the current level.
std::vector< double > _mpi_waits_blas2
array containing toe of mpi wait blas2 for each processed level
HierarchyType::LevelInfo LevelInfo
the level info type
MultiGrid(std::shared_ptr< HierarchyType > hierarchy, MultiGridCycle cycle, int top_level=0, int crs_level=-1)
Constructor.
std::shared_ptr< HierarchyType > _hierarchy
the multigrid hierarchy object
MultiGridHierarchy< SystemMatrix_, SystemFilter_, TransferOperator_ > HierarchyType
our compatible multigrid hierarchy class
Multigrid level base class.
virtual const SystemMatrixType & get_system_matrix() const =0
Returns a const reference to the system matrix.
virtual std::shared_ptr< SolverType > get_smoother_post()=0
Returns a shared pointer to the post-smoother.
SystemMatrix_::VectorTypeR SystemVectorType
the system vector type
SolverBase< SystemVectorType > SolverType
the coarse-grid solver/smoother type
virtual ~MultiGridLevelBase()
virtual destructor
virtual std::shared_ptr< SolverType > get_smoother_pre()=0
Returns a shared pointer to the pre-smoother.
SystemMatrix_ SystemMatrixType
the system matrix type
virtual std::shared_ptr< SolverType > get_smoother_peak()=0
Returns a shared pointer to the peak-smoother.
virtual std::shared_ptr< SolverType > get_coarse_solver()=0
Returns a shared pointer to the coarse grid solver.
virtual const SystemFilterType & get_system_filter() const =0
Returns a const reference to the system filter.
TransferOperator_ TransferOperatorType
the transfer operator type
SystemFilter_ SystemFilterType
the system filter type
virtual const TransferOperatorType * get_transfer_operator() const =0
Returns a const pointer to the transfer operator.
Standard Multigrid level class implementation.
const TransferOperatorType * transfer_operator
the transfer matrix
BaseClass::SystemMatrixType SystemMatrixType
the system-matrix type
virtual ~MultiGridLevelStd()
virtual destructor
MultiGridLevelStd(const SystemMatrixType &sys_matrix, const SystemFilterType &sys_filter, std::shared_ptr< SolverType > crs_solver)
Coarse-Grid level constructor.
virtual std::shared_ptr< SolverType > get_smoother_pre() override
Returns a shared pointer to the pre-smoother.
std::shared_ptr< SolverType > coarse_solver
the coarse-grid solver
BaseClass::TransferOperatorType TransferOperatorType
the transfer operator type
virtual const SystemFilterType & get_system_filter() const override
Returns a const reference to the system filter.
std::shared_ptr< SolverType > smoother_peak
the peak-smoother
virtual std::shared_ptr< SolverType > get_smoother_peak() override
Returns a shared pointer to the peak-smoother.
const SystemMatrixType & system_matrix
the system matrix
MultiGridLevelStd(const SystemMatrixType &sys_matrix, const SystemFilterType &sys_filter, const TransferOperatorType &trans_operat, std::shared_ptr< SolverType > smooth_pre, std::shared_ptr< SolverType > smooth_post, std::shared_ptr< SolverType > smooth_peak, std::shared_ptr< SolverType > crs_solver=nullptr)
Refined level constructor.
BaseClass::SystemFilterType SystemFilterType
the system-filter type
std::shared_ptr< SolverType > smoother_post
the post-smoother
std::shared_ptr< SolverType > smoother_pre
the pre-smoother
virtual std::shared_ptr< SolverType > get_smoother_post() override
Returns a shared pointer to the post-smoother.
virtual const TransferOperatorType * get_transfer_operator() const override
Returns a const pointer to the transfer operator.
BaseClass::SystemVectorType SystemVectorType
the system-vector type
virtual std::shared_ptr< SolverType > get_coarse_solver() override
Returns a shared pointer to the coarse grid solver.
virtual const SystemMatrixType & get_system_matrix() const override
Returns a const reference to the system matrix.
BaseClass::SolverType SolverType
the coarse-grid solver/smoother type
const SystemFilterType & system_filter
the system filter
MultiGridLevelBase< SystemMatrix_, SystemFilter_, TransferOperator_ > BaseClass
the base-class type
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.
String class implementation.
double elapsed(const TimeStamp &before) const
Calculates the time elapsed between two time stamps.
double elapsed_now() const
Calculates the time elapsed between the time stamp and now.
T_ min(T_ a, T_ b)
Returns the minimum of two values.
std::istream & operator>>(std::istream &is, Pack::Type &t)
stream input operator for Pack::Type
bool status_success(Status status)
Status success check function.
std::shared_ptr< MultiGrid< SystemMatrix_, SystemFilter_, TransferOperator_ > > new_multigrid(std::shared_ptr< MultiGridHierarchy< SystemMatrix_, SystemFilter_, TransferOperator_ > > hierarchy, MultiGridCycle cycle=MultiGridCycle::V, int top_level=0, int crs_level=-1)
Creates a new Multigrid preconditioner object.
MultiGridCycle
Multigrid Cycle enumeration.
MultiGridAdaptCGC
Multigrid adaptive Coarse-Grid-Correction enumeration.
@ Fixed
fixed coarse grid correction damping
@ MinDefect
Defect-Minimization.
@ MinEnergy
Energy-Minimization.
Status
Solver status return codes enumeration.
@ success
solving successful (convergence criterion fulfilled)
@ undefined
undefined status
@ aborted
premature abort (solver aborted due to internal errors or preconditioner failure)
String stringify(const T_ &item)
Converts an item into a String.
std::uint64_t Index
Index data type.