A parsed AMG preconditioner which uses parameter files to choose between different options. More...
#include <amg.h>
Public Member Functions | |
AMGPreconditioner (const std::string &name="", const bool &elliptic=true, const bool &higher_order_elements=false, const unsigned int &n_cycles=1, const bool &w_cycle=false, const double &aggregation_threshold=1e-4, const unsigned int &smoother_sweeps=2, const unsigned int &smoother_overlap=0, const bool &output_details=false, const std::string &smoother_type="Chebyshev", const std::string &coarse_type="Amesos-KLU") | |
Constructor. More... | |
template<typename Matrix > | |
void | initialize (const Matrix &matrix) |
Initialize the preconditioner using matrix . More... | |
void | set_constant_modes (const std::vector< std::vector< bool >> &constant_modes) |
Set the constant modes of the AMG preconditioner. More... | |
![]() | |
ParameterAcceptor (const std::string §ion_name="") | |
unsigned int | get_acceptor_id () const |
virtual | ~ParameterAcceptor () override |
virtual void | declare_parameters (ParameterHandler &prm) |
virtual void | parse_parameters (ParameterHandler &prm) |
std::string | get_section_name () const |
std::vector< std::string > | get_section_path () const |
void | add_parameter (const std::string &entry, ParameterType ¶meter, const std::string &documentation="", ParameterHandler &prm_=prm, const Patterns::PatternBase &pattern=*Patterns::Tools::Convert< ParameterType >::to_pattern()) |
void | enter_subsection (const std::string &subsection) |
void | leave_subsection () |
void | enter_my_subsection (ParameterHandler &prm) |
void | leave_my_subsection (ParameterHandler &prm) |
void | serialize (Archive &ar, const unsigned int version) |
void | subscribe (std::atomic< bool > *const validity, const std::string &identifier="") const |
void | unsubscribe (std::atomic< bool > *const validity, const std::string &identifier="") const |
unsigned int | n_subscriptions () const |
void | list_subscribers (StreamType &stream) const |
void | list_subscribers () const |
void | subscribe (std::atomic< bool > *const validity, const std::string &identifier="") const |
void | unsubscribe (std::atomic< bool > *const validity, const std::string &identifier="") const |
unsigned int | n_subscriptions () const |
void | list_subscribers (StreamType &stream) const |
void | list_subscribers () const |
![]() | |
Subscriptor () | |
Subscriptor (const Subscriptor &) | |
Subscriptor (Subscriptor &&) noexcept | |
virtual | ~Subscriptor () |
Subscriptor & | operator= (const Subscriptor &) |
Subscriptor & | operator= (Subscriptor &&) noexcept |
void | serialize (Archive &ar, const unsigned int version) |
void | subscribe (std::atomic< bool > *const validity, const std::string &identifier="") const |
void | unsubscribe (std::atomic< bool > *const validity, const std::string &identifier="") const |
unsigned int | n_subscriptions () const |
void | list_subscribers (StreamType &stream) const |
void | list_subscribers () const |
void | subscribe (std::atomic< bool > *const validity, const std::string &identifier="") const |
void | unsubscribe (std::atomic< bool > *const validity, const std::string &identifier="") const |
unsigned int | n_subscriptions () const |
void | list_subscribers (StreamType &stream) const |
void | list_subscribers () const |
![]() | |
~PreconditionAMG () override | |
void | initialize (const SparseMatrix &matrix, const AdditionalData &additional_data=AdditionalData()) |
void | initialize (const Epetra_RowMatrix &matrix, const AdditionalData &additional_data=AdditionalData()) |
void | initialize (const SparseMatrix &matrix, const Teuchos::ParameterList &ml_parameters) |
void | initialize (const Epetra_RowMatrix &matrix, const Teuchos::ParameterList &ml_parameters) |
void | initialize (const ::SparseMatrix< number > &deal_ii_sparse_matrix, const AdditionalData &additional_data=AdditionalData(), const double drop_tolerance=1e-13, const ::SparsityPattern *use_this_sparsity=nullptr) |
void | reinit () |
void | clear () |
size_type | memory_consumption () const |
MPI_Comm | get_mpi_communicator () const |
void | transpose () |
virtual void | vmult (MPI::Vector &dst, const MPI::Vector &src) const |
virtual void | vmult (::Vector< double > &dst, const ::Vector< double > &src) const |
virtual void | vmult (::LinearAlgebra::distributed::Vector< double > &dst, const ::LinearAlgebra::distributed::Vector< double > &src) const |
virtual void | Tvmult (MPI::Vector &dst, const MPI::Vector &src) const |
virtual void | Tvmult (::Vector< double > &dst, const ::Vector< double > &src) const |
virtual void | Tvmult (::LinearAlgebra::distributed::Vector< double > &dst, const ::LinearAlgebra::distributed::Vector< double > &src) const |
void | serialize (Archive &ar, const unsigned int version) |
Epetra_Operator & | trilinos_operator () const |
IndexSet | locally_owned_domain_indices () const |
IndexSet | locally_owned_range_indices () const |
void | subscribe (std::atomic< bool > *const validity, const std::string &identifier="") const |
void | unsubscribe (std::atomic< bool > *const validity, const std::string &identifier="") const |
unsigned int | n_subscriptions () const |
void | list_subscribers (StreamType &stream) const |
void | list_subscribers () const |
Epetra_Operator & | trilinos_operator () const |
IndexSet | locally_owned_domain_indices () const |
IndexSet | locally_owned_range_indices () const |
void | subscribe (std::atomic< bool > *const validity, const std::string &identifier="") const |
void | unsubscribe (std::atomic< bool > *const validity, const std::string &identifier="") const |
unsigned int | n_subscriptions () const |
void | list_subscribers (StreamType &stream) const |
void | list_subscribers () const |
![]() | |
PreconditionBase () | |
void | clear () |
MPI_Comm | get_mpi_communicator () const |
void | transpose () |
void | serialize (Archive &ar, const unsigned int version) |
Epetra_Operator & | trilinos_operator () const |
IndexSet | locally_owned_domain_indices () const |
IndexSet | locally_owned_range_indices () const |
void | subscribe (std::atomic< bool > *const validity, const std::string &identifier="") const |
void | unsubscribe (std::atomic< bool > *const validity, const std::string &identifier="") const |
unsigned int | n_subscriptions () const |
void | list_subscribers (StreamType &stream) const |
void | list_subscribers () const |
Epetra_Operator & | trilinos_operator () const |
IndexSet | locally_owned_domain_indices () const |
IndexSet | locally_owned_range_indices () const |
void | subscribe (std::atomic< bool > *const validity, const std::string &identifier="") const |
void | unsubscribe (std::atomic< bool > *const validity, const std::string &identifier="") const |
unsigned int | n_subscriptions () const |
void | list_subscribers (StreamType &stream) const |
void | list_subscribers () const |
Private Member Functions | |
void | add_parameters () |
Declare preconditioner options. More... | |
Private Attributes | |
bool | elliptic |
Determines whether the AMG preconditioner should be optimized for elliptic problems (ML option smoothed aggregation SA, using a Chebyshev smoother) or for non-elliptic problems (ML option non- symmetric smoothed aggregation NSSA, smoother is SSOR with underrelaxation). More... | |
bool | higher_order_elements |
Determines whether the matrix that the preconditioner is built upon is generated from linear or higher-order elements. More... | |
unsigned int | n_cycles |
Defines how many multigrid cycles should be performed by the preconditioner. More... | |
bool | w_cycle |
Defines whether a w-cycle should be used instead of the standard setting of a v-cycle. More... | |
double | aggregation_threshold |
This threshold tells the AMG setup how the coarsening should be performed. More... | |
std::string | var_const_modes |
Specifies the variable associated to the constant modes (near null space) of the matrix. More... | |
unsigned int | smoother_sweeps |
Determines how many sweeps of the smoother should be performed. More... | |
unsigned int | smoother_overlap |
Determines the overlap in the SSOR/Chebyshev error smoother when run in parallel. More... | |
bool | output_details |
If this flag is set to true, then internal information from the ML preconditioner is printed to screen. More... | |
std::string | smoother_type |
Determines which smoother to use for the AMG cycle. More... | |
std::string | coarse_type |
Determines which solver to use on the coarsest level. More... | |
std::vector< std::vector< bool > > | constant_modes |
Constant modes of the matrix. More... | |
Additional Inherited Members | |
![]() | |
typedef ::types::global_dof_index | size_type |
![]() | |
typedef ::types::global_dof_index | size_type |
![]() | |
static void | initialize (const std::string &filename="", const std::string &output_filename="", const ParameterHandler::OutputStyle output_style_for_output_filename=ParameterHandler::Short, ParameterHandler &prm=ParameterAcceptor::prm, const ParameterHandler::OutputStyle output_style_for_filename=ParameterHandler::DefaultStyle) |
static void | initialize (std::istream &input_stream, ParameterHandler &prm=ParameterAcceptor::prm) |
static void | clear () |
static void | parse_all_parameters (ParameterHandler &prm=ParameterAcceptor::prm) |
static void | declare_all_parameters (ParameterHandler &prm=ParameterAcceptor::prm) |
static ::ExceptionBase & | ExcInUse (int arg1, std::string arg2, std::string arg3) |
static ::ExceptionBase & | ExcNoSubscriber (std::string arg1, std::string arg2) |
![]() | |
static ::ExceptionBase & | ExcInUse (int arg1, std::string arg2, std::string arg3) |
static ::ExceptionBase & | ExcNoSubscriber (std::string arg1, std::string arg2) |
![]() | |
static ::ExceptionBase & | ExcNonMatchingMaps (std::string arg1) |
static ::ExceptionBase & | ExcInUse (int arg1, std::string arg2, std::string arg3) |
static ::ExceptionBase & | ExcNoSubscriber (std::string arg1, std::string arg2) |
![]() | |
static ::ExceptionBase & | ExcNonMatchingMaps (std::string arg1) |
static ::ExceptionBase & | ExcInUse (int arg1, std::string arg2, std::string arg3) |
static ::ExceptionBase & | ExcNoSubscriber (std::string arg1, std::string arg2) |
![]() | |
boost::signals2::signal< void()> | declare_parameters_call_back |
boost::signals2::signal< void()> | parse_parameters_call_back |
![]() | |
static ParameterHandler | prm |
![]() | |
const std::string | section_name |
std::vector< std::string > | subsections |
![]() | |
Teuchos::RCP< Epetra_Operator > | preconditioner |
Epetra_MpiComm | communicator |
![]() | |
Teuchos::RCP< Epetra_Operator > | preconditioner |
Epetra_MpiComm | communicator |
A parsed AMG preconditioner which uses parameter files to choose between different options.
This object is a TrilinosWrappers::PreconditionAMG which can be called in place of the preconditioner.
ParsedLAC::AMGPreconditioner::AMGPreconditioner | ( | const std::string & | name = "" , |
const bool & | elliptic = true , |
||
const bool & | higher_order_elements = false , |
||
const unsigned int & | n_cycles = 1 , |
||
const bool & | w_cycle = false , |
||
const double & | aggregation_threshold = 1e-4 , |
||
const unsigned int & | smoother_sweeps = 2 , |
||
const unsigned int & | smoother_overlap = 0 , |
||
const bool & | output_details = false , |
||
const std::string & | smoother_type = "Chebyshev" , |
||
const std::string & | coarse_type = "Amesos-KLU" |
||
) |
Constructor.
Build the preconditioner of a matrix using AMG.
Definition at line 28 of file amg.cc.
References add_parameters().
template void ParsedLAC::AMGPreconditioner::initialize< SparseMatrix< double > > | ( | const Matrix & | matrix | ) |
Initialize the preconditioner using matrix
.
Definition at line 164 of file amg.cc.
References TrilinosWrappers::PreconditionAMG::AdditionalData::aggregation_threshold, aggregation_threshold, TrilinosWrappers::PreconditionAMG::AdditionalData::coarse_type, coarse_type, TrilinosWrappers::PreconditionAMG::AdditionalData::constant_modes, constant_modes, TrilinosWrappers::PreconditionAMG::AdditionalData::elliptic, elliptic, TrilinosWrappers::PreconditionAMG::AdditionalData::higher_order_elements, higher_order_elements, TrilinosWrappers::PreconditionAMG::initialize(), TrilinosWrappers::PreconditionAMG::AdditionalData::n_cycles, n_cycles, TrilinosWrappers::PreconditionAMG::AdditionalData::output_details, output_details, TrilinosWrappers::PreconditionAMG::AdditionalData::smoother_overlap, smoother_overlap, TrilinosWrappers::PreconditionAMG::AdditionalData::smoother_sweeps, smoother_sweeps, TrilinosWrappers::PreconditionAMG::AdditionalData::smoother_type, smoother_type, TrilinosWrappers::PreconditionAMG::AdditionalData::w_cycle, and w_cycle.
void ParsedLAC::AMGPreconditioner::set_constant_modes | ( | const std::vector< std::vector< bool >> & | constant_modes | ) |
Set the constant modes of the AMG preconditioner.
Definition at line 154 of file amg.cc.
References constant_modes.
|
private |
Declare preconditioner options.
Definition at line 56 of file amg.cc.
References ParameterAcceptor::add_parameter(), aggregation_threshold, coarse_type, elliptic, higher_order_elements, n_cycles, output_details, ParameterAcceptor::prm, smoother_overlap, smoother_sweeps, smoother_type, and w_cycle.
Referenced by AMGPreconditioner().
|
private |
Determines whether the AMG preconditioner should be optimized for elliptic problems (ML option smoothed aggregation SA, using a Chebyshev smoother) or for non-elliptic problems (ML option non- symmetric smoothed aggregation NSSA, smoother is SSOR with underrelaxation).
Definition at line 83 of file amg.h.
Referenced by add_parameters(), and initialize().
|
private |
Determines whether the matrix that the preconditioner is built upon is generated from linear or higher-order elements.
Definition at line 89 of file amg.h.
Referenced by add_parameters(), and initialize().
|
private |
Defines how many multigrid cycles should be performed by the preconditioner.
Definition at line 95 of file amg.h.
Referenced by add_parameters(), and initialize().
|
private |
Defines whether a w-cycle should be used instead of the standard setting of a v-cycle.
Definition at line 101 of file amg.h.
Referenced by add_parameters(), and initialize().
|
private |
This threshold tells the AMG setup how the coarsening should be performed.
In the AMG used by ML, all points that strongly couple with the tentative coarse-level point form one aggregate. The term strong coupling is controlled by the variable aggregation_threshold, meaning that all elements that are not smaller than aggregation_threshold times the diagonal element do couple strongly.
Definition at line 112 of file amg.h.
Referenced by add_parameters(), and initialize().
|
private |
|
private |
Determines how many sweeps of the smoother should be performed.
When the flag elliptic is set to true, i.e., for elliptic or almost elliptic problems, the polynomial degree of the Chebyshev smoother is set to smoother_sweeps. The term sweeps refers to the number of matrix-vector products performed in the Chebyshev case. In the non-elliptic case, smoother_sweeps sets the number of SSOR relaxation sweeps for post-smoothing to be performed.
Definition at line 131 of file amg.h.
Referenced by add_parameters(), and initialize().
|
private |
Determines the overlap in the SSOR/Chebyshev error smoother when run in parallel.
Definition at line 137 of file amg.h.
Referenced by add_parameters(), and initialize().
|
private |
If this flag is set to true, then internal information from the ML preconditioner is printed to screen.
This can be useful when debugging the preconditioner.
Definition at line 144 of file amg.h.
Referenced by add_parameters(), and initialize().
|
private |
Determines which smoother to use for the AMG cycle.
Possibilities for smoother_type are the following: "Aztec", "IFPACK", "Jacobi", "ML symmetric Gauss-Seidel", "symmetric Gauss-Seidel", "ML Gauss-Seidel", "Gauss-Seidel", "block Gauss-Seidel", "symmetric block Gauss-Seidel", "Chebyshev", "MLS", "Hiptmair", "Amesos-KLU", "Amesos-Superlu", "Amesos-UMFPACK", "Amesos-Superludist", "Amesos-MUMPS", "user-defined", "SuperLU", "IFPACK-Chebyshev", "self", "do-nothing", "IC", "ICT", "ILU", "ILUT", "Block Chebyshev", "IFPACK-Block Chebyshev"
Definition at line 157 of file amg.h.
Referenced by add_parameters(), and initialize().
|
private |
Determines which solver to use on the coarsest level.
The same settings as for the smoother type are possible.
Definition at line 163 of file amg.h.
Referenced by add_parameters(), and initialize().
|
private |
Constant modes of the matrix.
Definition at line 168 of file amg.h.
Referenced by initialize(), and set_constant_modes().