A solver selector which uses parameter files to choose between different options. More...
#include <parsed_solver.h>
Public Member Functions | |
ParsedSolver (const std::string &name="", const std::string &default_solver="cg", const unsigned int iter=1000, const double reduction=1e-8, const LinearOperator< VECTOR > &op=identity_operator< VECTOR >(default_reinit< VECTOR >()), const LinearOperator< VECTOR > &prec=identity_operator< VECTOR >(default_reinit< VECTOR >())) | |
Constructor. More... | |
virtual void | declare_parameters (ParameterHandler &prm) |
Declare solver type and solver options. More... | |
virtual void | parse_parameters (ParameterHandler &prm) |
Parse solver type and solver options. More... | |
virtual void | parse_parameters_call_back () |
Initialize internal variables. More... | |
Public Member Functions inherited from LinearOperator< VECTOR, VECTOR > | |
LinearOperator (const Payload &payload=Payload()) | |
LinearOperator (const LinearOperator< VECTOR, VECTOR, Payload > &)=default | |
LinearOperator (const Op &op) | |
LinearOperator< VECTOR, VECTOR, Payload > & | operator= (const LinearOperator< VECTOR, VECTOR, Payload > &)=default |
LinearOperator< VECTOR, VECTOR, Payload > & | operator= (const Op &op) |
LinearOperator< VECTOR, VECTOR > | distribute_constraints_linear_operator (const ConstraintMatrix &constraint_matrix, const LinearOperator< VECTOR, VECTOR > &exemplar) |
LinearOperator< VECTOR, VECTOR > | distribute_constraints_linear_operator (const ConstraintMatrix &constraint_matrix, const LinearOperator< VECTOR, VECTOR > &exemplar) |
LinearOperator< VECTOR, VECTOR > | project_to_constrained_linear_operator (const ConstraintMatrix &constraint_matrix, const LinearOperator< VECTOR, VECTOR > &exemplar) |
LinearOperator< VECTOR, VECTOR > | project_to_constrained_linear_operator (const ConstraintMatrix &constraint_matrix, const LinearOperator< VECTOR, VECTOR > &exemplar) |
LinearOperator< VECTOR, VECTOR > | constrained_linear_operator (const ConstraintMatrix &constraint_matrix, const LinearOperator< VECTOR, VECTOR > &linop) |
LinearOperator< VECTOR, VECTOR > | constrained_linear_operator (const ConstraintMatrix &constraint_matrix, const LinearOperator< VECTOR, VECTOR > &linop) |
PackagedOperation< VECTOR > | constrained_right_hand_side (const ConstraintMatrix &constraint_matrix, const LinearOperator< VECTOR, VECTOR > &linop, const VECTOR &right_hand_side) |
PackagedOperation< VECTOR > | constrained_right_hand_side (const ConstraintMatrix &constraint_matrix, const LinearOperator< VECTOR, VECTOR > &linop, const VECTOR &right_hand_side) |
LinearOperator< VECTOR, VECTOR, Payload > | operator+ (const LinearOperator< VECTOR, VECTOR, Payload > &first_op, const LinearOperator< VECTOR, VECTOR, Payload > &second_op) |
LinearOperator< VECTOR, VECTOR, Payload > | operator+ (const LinearOperator< VECTOR, VECTOR, Payload > &first_op, const LinearOperator< VECTOR, VECTOR, Payload > &second_op) |
LinearOperator< VECTOR, VECTOR, Payload > | operator- (const LinearOperator< VECTOR, VECTOR, Payload > &first_op, const LinearOperator< VECTOR, VECTOR, Payload > &second_op) |
LinearOperator< VECTOR, VECTOR, Payload > | operator- (const LinearOperator< VECTOR, VECTOR, Payload > &first_op, const LinearOperator< VECTOR, VECTOR, Payload > &second_op) |
LinearOperator< VECTOR, VECTOR, Payload > | operator* (typename VECTOR ::value_type number, const LinearOperator< VECTOR, VECTOR, Payload > &op) |
LinearOperator< VECTOR, VECTOR, Payload > | operator* (const LinearOperator< VECTOR, VECTOR, Payload > &op, typename VECTOR ::value_type number) |
LinearOperator< VECTOR, VECTOR, Payload > | operator* (const LinearOperator< VECTOR, Intermediate, Payload > &first_op, const LinearOperator< Intermediate, VECTOR, Payload > &second_op) |
LinearOperator< VECTOR, VECTOR, Payload > | operator* (typename VECTOR ::value_type number, const LinearOperator< VECTOR, VECTOR, Payload > &op) |
LinearOperator< VECTOR, VECTOR, Payload > | operator* (const LinearOperator< VECTOR, VECTOR, Payload > &op, typename VECTOR ::value_type number) |
LinearOperator< VECTOR, VECTOR, Payload > | operator* (const LinearOperator< VECTOR, Intermediate, Payload > &first_op, const LinearOperator< Intermediate, VECTOR, Payload > &second_op) |
LinearOperator< VECTOR, VECTOR, Payload > | transpose_operator (const LinearOperator< VECTOR, VECTOR, Payload > &op) |
LinearOperator< VECTOR, VECTOR, Payload > | transpose_operator (const LinearOperator< VECTOR, VECTOR, Payload > &op) |
LinearOperator< VECTOR, VECTOR, Payload > | inverse_operator (const LinearOperator< VECTOR, VECTOR, Payload > &op, Solver &solver, const Preconditioner &preconditioner) |
LinearOperator< VECTOR, VECTOR, Payload > | inverse_operator (const LinearOperator< VECTOR, VECTOR, Payload > &op, Solver &solver, const Preconditioner &preconditioner) |
LinearOperator< VECTOR, VECTOR, Payload > | identity_operator (const std::function< void(VECTOR &, bool)> &reinit_vector) |
LinearOperator< VECTOR, VECTOR, Payload > | identity_operator (const LinearOperator< VECTOR, VECTOR, Payload > &op) |
LinearOperator< VECTOR, VECTOR, Payload > | identity_operator (const std::function< void(VECTOR &, bool)> &reinit_vector) |
LinearOperator< VECTOR, VECTOR, Payload > | identity_operator (const LinearOperator< VECTOR, VECTOR, Payload > &op) |
LinearOperator< VECTOR, VECTOR, Payload > | null_operator (const LinearOperator< VECTOR, VECTOR, Payload > &op) |
LinearOperator< VECTOR, VECTOR, Payload > | null_operator (const LinearOperator< VECTOR, VECTOR, Payload > &op) |
LinearOperator< VECTOR, VECTOR, Payload > | linear_operator (const Matrix &matrix) |
LinearOperator< VECTOR, VECTOR, Payload > | linear_operator (const OperatorExemplar &operator_exemplar, const Matrix &matrix) |
LinearOperator< VECTOR, VECTOR, TrilinosWrappers::internal::LinearOperator::TrilinosPayload > | linear_operator (const TrilinosWrappers::SparseMatrix &operator_exemplar, const Matrix &matrix) |
LinearOperator< VECTOR, VECTOR, TrilinosWrappers::internal::LinearOperator::TrilinosPayload > | linear_operator (const TrilinosWrappers::SparseMatrix &matrix) |
LinearOperator< VECTOR, VECTOR, Payload > | linear_operator (const Matrix &matrix) |
LinearOperator< VECTOR, VECTOR, Payload > | linear_operator (const OperatorExemplar &operator_exemplar, const Matrix &matrix) |
LinearOperator< VECTOR, VECTOR, TrilinosWrappers::internal::LinearOperator::TrilinosPayload > | linear_operator (const TrilinosWrappers::SparseMatrix &operator_exemplar, const Matrix &matrix) |
LinearOperator< VECTOR, VECTOR, TrilinosWrappers::internal::LinearOperator::TrilinosPayload > | linear_operator (const TrilinosWrappers::SparseMatrix &matrix) |
LinearOperator< Range_2, Domain_2, Payload > | schur_complement (const LinearOperator< Domain_1, Range_1, Payload > &A_inv, const LinearOperator< Range_1, Domain_2, Payload > &B, const LinearOperator< Range_2, Domain_1, Payload > &C, const LinearOperator< Range_2, Domain_2, Payload > &D) |
LinearOperator< Range_2, Domain_2, Payload > | schur_complement (const LinearOperator< Domain_1, Range_1, Payload > &A_inv, const LinearOperator< Range_1, Domain_2, Payload > &B, const LinearOperator< Range_2, Domain_1, Payload > &C, const LinearOperator< Range_2, Domain_2, Payload > &D) |
LinearOperator< VECTOR, VECTOR, Payload > & | operator+= (const LinearOperator< VECTOR, VECTOR, Payload > &second_op) |
LinearOperator< VECTOR, VECTOR, Payload > & | operator-= (const LinearOperator< VECTOR, VECTOR, Payload > &second_op) |
LinearOperator< VECTOR, VECTOR, Payload > & | operator*= (const LinearOperator< VECTOR, VECTOR, Payload > &second_op) |
LinearOperator< VECTOR, VECTOR, Payload > | operator*= (typename VECTOR ::value_type number) |
Public Member Functions inherited from ParameterAcceptor | |
ParameterAcceptor (const std::string section_name="") | |
The constructor adds derived classes to the list of acceptors. More... | |
virtual | ~ParameterAcceptor () |
The destructor sets to zero the pointer relative to this index, so that it is safe to destroy the mother class. More... | |
std::string | get_section_name () const |
Return the section name of this class. More... | |
std::vector< std::string > | get_section_path () const |
Travers all registered classes, and figure out what subsections we need to enter. More... | |
template<class T > | |
void | add_parameter (ParameterHandler &prm, T *parameter, const std::string &entry, const std::string &default_value, const Patterns::PatternBase &pattern=Patterns::Anything(), const std::string &documentation=std::string()) |
Add a parameter the given parameter list. More... | |
template<class T > | |
void | add_parameter (T ¶meter, const std::string &entry, const std::string &documentation=std::string(), ParameterHandler &prm=ParameterAcceptor::prm) |
Add a parameter to the global parameter handler ParameterAcceptor::prm. More... | |
void | enter_my_subsection (ParameterHandler &prm) |
Make sure we enter the right subsection of the global parameter file. More... | |
void | leave_my_subsection (ParameterHandler &prm) |
This function undoes what the enter_my_subsection() function did. More... | |
template<> | |
std_cxx11::shared_ptr< Patterns::PatternBase > | to_pattern (const double &) |
double More... | |
template<> | |
std::string | to_string (const double &entry) |
template<> | |
double | to_type (const std::string ¶meter) |
template<> | |
std_cxx11::shared_ptr< Patterns::PatternBase > | to_pattern (const int &) |
int More... | |
template<> | |
std::string | to_string (const int &entry) |
template<> | |
int | to_type (const std::string ¶meter) |
template<> | |
std_cxx11::shared_ptr< Patterns::PatternBase > | to_pattern (const unsigned int &) |
unsigned int More... | |
template<> | |
std::string | to_string (const unsigned int &entry) |
template<> | |
unsigned int | to_type (const std::string ¶meter) |
template<> | |
std_cxx11::shared_ptr< Patterns::PatternBase > | to_pattern (const bool &) |
bool More... | |
template<> | |
std::string | to_string (const bool &entry) |
template<> | |
bool | to_type (const std::string ¶meter) |
Public Member Functions inherited from Subscriptor | |
Subscriptor () | |
Subscriptor (const Subscriptor &) | |
Subscriptor (Subscriptor &&) | |
virtual | ~Subscriptor () |
Subscriptor & | operator= (const Subscriptor &) |
Subscriptor & | operator= (Subscriptor &&) |
void | subscribe (const char *identifier=0) const |
void | unsubscribe (const char *identifier=0) const |
unsigned int | n_subscriptions () const |
void | list_subscribers () const |
void | serialize (Archive &ar, const unsigned int version) |
Public Attributes | |
LinearOperator< VECTOR > | op |
The Operator this solver use. More... | |
LinearOperator< VECTOR > | prec |
The preconditioner used by this solver. More... | |
ReductionControl | control |
ReductionControl. More... | |
Public Attributes inherited from LinearOperator< VECTOR, VECTOR > | |
std::function< void(VECTOR &v, const VECTOR &u)> | vmult |
std::function< void(VECTOR &v, const VECTOR &u)> | vmult_add |
std::function< void(VECTOR &v, const VECTOR &u)> | Tvmult |
std::function< void(VECTOR &v, const VECTOR &u)> | Tvmult_add |
std::function< void(VECTOR &v, bool omit_zeroing_entries)> | reinit_range_vector |
std::function< void(VECTOR &v, bool omit_zeroing_entries)> | reinit_domain_vector |
bool | is_null_operator |
Private Member Functions | |
template<typename MySolver > | |
void | initialize_solver (MySolver *) |
Store a shared pointer, and intilize the inverse operator. More... | |
Private Attributes | |
std::string | solver_name |
Solver name. More... | |
unsigned int | max_iterations |
Default number of maximum iterations required to succesfully complete a solution step. More... | |
double | reduction |
Default reduction required to succesfully complete a solution step. More... | |
shared_ptr< Solver< VECTOR > > | solver |
The actual solver. More... | |
Additional Inherited Members | |
Static Public Member Functions inherited from ParameterAcceptor | |
static void | initialize (const std::string filename="", const std::string outfilename="") |
Call declare_all_parameters(), read filename (if it is present as input parameter) and parse_all_parameters() on the static member prm. More... | |
static void | clear () |
Clear class list and global parameter file. More... | |
static void | parse_all_parameters (ParameterHandler &prm=ParameterAcceptor::prm) |
Parse the given ParameterHandler. More... | |
static void | log_info () |
Print information about all stored classes. More... | |
static void | declare_all_parameters (ParameterHandler &prm=ParameterAcceptor::prm) |
Initialize the ParameterHandler with all derived classes parameters.This function enters the subsection returned by get_section_name() for each derived class, and declares all parameters that were added using add_parameter(). More... | |
template<class T > | |
static std_cxx11::shared_ptr< Patterns::PatternBase > | to_pattern (const T &) |
Given a class T, construct its default pattern to be used when declaring parameters. More... | |
template<class T > | |
static T | to_type (const std::string &) |
Given a string, fill the value of the given parameter. More... | |
template<class T > | |
static std::string | to_string (const T &) |
Given a parameter, return a string containing the given parameter. More... | |
Static Public Member Functions inherited from Subscriptor | |
static::ExceptionBase & | ExcInUse (int arg1, char *arg2, std::string &arg3) |
static::ExceptionBase & | ExcNoSubscriber (char *arg1, char *arg2) |
Static Public Attributes inherited from ParameterAcceptor | |
static ParameterHandler | prm |
Static parameter. More... | |
Protected Attributes inherited from ParameterAcceptor | |
const std::string | section_name |
The subsection name for this class. More... | |
A solver selector which uses parameter files to choose between different options.
This object is a LinearOperator which can be called in place of the inverse of another LinearOperator.
Example usage is the following:
Definition at line 71 of file parsed_solver.h.
ParsedSolver< VECTOR >::ParsedSolver | ( | const std::string & | name = "" , |
const std::string & | default_solver = "cg" , |
||
const unsigned int | iter = 1000 , |
||
const double | reduction = 1e-8 , |
||
const LinearOperator< VECTOR > & | op = identity_operator<VECTOR>(default_reinit<VECTOR>()) , |
||
const LinearOperator< VECTOR > & | prec = identity_operator<VECTOR>(default_reinit<VECTOR>()) |
||
) |
Constructor.
Build the inverse of an Operator using a parameter file. A section name can be specified, the solver type, the maximum number of iterations, and the reduction to reach convergence. If you know in advance the operators this object will need, you can also supply them here. They default to the identity, and you can assign them later by setting op and prec.
Definition at line 160 of file parsed_solver.h.
|
virtual |
Declare solver type and solver options.
Reimplemented from ParameterAcceptor.
Definition at line 176 of file parsed_solver.h.
|
private |
Store a shared pointer, and intilize the inverse operator.
Definition at line 200 of file parsed_solver.h.
|
virtual |
Parse solver type and solver options.
Reimplemented from ParameterAcceptor.
Definition at line 191 of file parsed_solver.h.
|
virtual |
Initialize internal variables.
Reimplemented from ParameterAcceptor.
Definition at line 207 of file parsed_solver.h.
ReductionControl ParsedSolver< VECTOR >::control |
|
private |
Default number of maximum iterations required to succesfully complete a solution step.
Definition at line 141 of file parsed_solver.h.
LinearOperator<VECTOR> ParsedSolver< VECTOR >::op |
The Operator this solver use.
You can assign a new one at construction time, or by this->op = some_new_op. By default it is the identity operator.
Definition at line 112 of file parsed_solver.h.
LinearOperator<VECTOR> ParsedSolver< VECTOR >::prec |
The preconditioner used by this solver.
You can assign a new one at construction time, or by this->op = some_new_op. By default it is the identity operator.
Definition at line 119 of file parsed_solver.h.
|
private |
Default reduction required to succesfully complete a solution step.
Definition at line 147 of file parsed_solver.h.
|
private |
The actual solver.
Definition at line 152 of file parsed_solver.h.
|
private |