![]() |
Reference documentation for deal.II version 8.1.0
|
#include <solver_selector.h>
Public Member Functions | |
SolverSelector () | |
SolverSelector (const std::string &solvername, SolverControl &control, VectorMemory< VECTOR > &vector_memory) DEAL_II_DEPRECATED | |
~SolverSelector () | |
template<class Matrix , class Preconditioner > | |
void | solve (const Matrix &A, VECTOR &x, const VECTOR &b, const Preconditioner &precond) const |
void | select (const std::string &name) |
void | set_control (SolverControl &ctrl) |
void | set_data (const typename SolverRichardson< VECTOR >::AdditionalData &data) |
void | set_data (const typename SolverCG< VECTOR >::AdditionalData &data) |
void | set_data (const typename SolverMinRes< VECTOR >::AdditionalData &data) |
void | set_data (const typename SolverBicgstab< VECTOR >::AdditionalData &data) |
void | set_data (const typename SolverGMRES< VECTOR >::AdditionalData &data) |
void | set_data (const typename SolverFGMRES< VECTOR >::AdditionalData &data) |
DeclException1 (ExcSolverDoesNotExist, std::string,<< "Solver "<< arg1<< " does not exist. Use one of "<< std::endl<< get_solver_names()) | |
![]() | |
Subscriptor () | |
Subscriptor (const Subscriptor &) | |
virtual | ~Subscriptor () |
Subscriptor & | operator= (const Subscriptor &) |
void | subscribe (const char *identifier=0) const |
void | unsubscribe (const char *identifier=0) const |
unsigned int | n_subscriptions () const |
void | list_subscribers () const |
DeclException3 (ExcInUse, int, char *, std::string &,<< "Object of class "<< arg2<< " is still used by "<< arg1<< " other objects.\n"<< "(Additional information: "<< arg3<< ")\n"<< "Note the entry in the Frequently Asked Questions of "<< "deal.II (linked to from http://www.dealii.org/) for "<< "more information on what this error means.") | |
DeclException2 (ExcNoSubscriber, char *, char *,<< "No subscriber with identifier \""<< arg2<< "\" did subscribe to this object of class "<< arg1) | |
template<class Archive > | |
void | serialize (Archive &ar, const unsigned int version) |
Static Public Member Functions | |
static std::string | get_solver_names () |
Protected Attributes | |
SmartPointer< SolverControl, SolverSelector< VECTOR > > | control |
std::string | solver_name |
Private Attributes | |
SolverRichardson< VECTOR > ::AdditionalData | richardson_data |
SolverCG< VECTOR >::AdditionalData | cg_data |
SolverMinRes< VECTOR > ::AdditionalData | minres_data |
SolverBicgstab< VECTOR > ::AdditionalData | bicgstab_data |
SolverGMRES< VECTOR > ::AdditionalData | gmres_data |
SolverFGMRES< VECTOR > ::AdditionalData | fgmres_data |
Selects a solver by changing a parameter.
By calling the solve
function of this SolverSelector
, it selects the solve
function of that Solver
that was specified in the constructor of this class.
The simplest use of this class is the following:
But the full usefulness of the SolverSelector
class is not clear until the presentation of the following example that assumes the user using the ParameterHandler
class and having declared a "solver" entry, e.g. with
Assuming that in the users parameter file there exists the line
set solver = cg
then `Line 3' of the above example reads
If at some time there exists a new solver "xyz" then the user does not need to change his program. Only in the implementation of the SolverSelector
the calling of this solver has to be added and each user with program lines quoted above only needs to 'set solver = xyz' in his parameter file to get access to that new solver. :-)
(By the way, thanks to Wolfgang for implementing the ParameterHandler
.)
Definition at line 101 of file solver_selector.h.
SolverSelector< VECTOR >::SolverSelector | ( | ) |
Constructor, filling in default values
Definition at line 263 of file solver_selector.h.
SolverSelector< VECTOR >::SolverSelector | ( | const std::string & | solvername, |
SolverControl & | control, | ||
VectorMemory< VECTOR > & | vector_memory | ||
) |
Constructor. Use the arguments to initialize actual solver objects. The VectorMemory argument is ignored.
Definition at line 268 of file solver_selector.h.
SolverSelector< VECTOR >::~SolverSelector | ( | ) |
Destructor
Definition at line 277 of file solver_selector.h.
void SolverSelector< VECTOR >::solve | ( | const Matrix & | A, |
VECTOR & | x, | ||
const VECTOR & | b, | ||
const Preconditioner & | precond | ||
) | const |
Solver procedure. Calls the solve
function of the solver
whose SolverName
was specified in the constructor.
Definition at line 292 of file solver_selector.h.
void SolverSelector< VECTOR >::select | ( | const std::string & | name | ) |
Select a new solver. Note that all solver names used in this class are all lower case.
Definition at line 283 of file solver_selector.h.
void SolverSelector< VECTOR >::set_control | ( | SolverControl & | ctrl | ) |
Set a new SolverControl. This needs to be set before solving.
Definition at line 333 of file solver_selector.h.
void SolverSelector< VECTOR >::set_data | ( | const typename SolverRichardson< VECTOR >::AdditionalData & | data | ) |
Set the additional data. For more info see the Solver
class.
Definition at line 364 of file solver_selector.h.
void SolverSelector< VECTOR >::set_data | ( | const typename SolverCG< VECTOR >::AdditionalData & | data | ) |
Set the additional data. For more info see the Solver
class.
Definition at line 372 of file solver_selector.h.
void SolverSelector< VECTOR >::set_data | ( | const typename SolverMinRes< VECTOR >::AdditionalData & | data | ) |
Set the additional data. For more info see the Solver
class.
Definition at line 380 of file solver_selector.h.
void SolverSelector< VECTOR >::set_data | ( | const typename SolverBicgstab< VECTOR >::AdditionalData & | data | ) |
Set the additional data. For more info see the Solver
class.
Definition at line 388 of file solver_selector.h.
void SolverSelector< VECTOR >::set_data | ( | const typename SolverGMRES< VECTOR >::AdditionalData & | data | ) |
Set the additional data. For more info see the Solver
class.
Definition at line 348 of file solver_selector.h.
void SolverSelector< VECTOR >::set_data | ( | const typename SolverFGMRES< VECTOR >::AdditionalData & | data | ) |
Set the additional data. For more info see the Solver
class.
Definition at line 356 of file solver_selector.h.
|
static |
Get the names of all implemented solvers.
Definition at line 341 of file solver_selector.h.
SolverSelector< VECTOR >::DeclException1 | ( | ExcSolverDoesNotExist | , |
std::string | , | ||
<< "Solver "<< arg1<< " does not exist. Use one of "<< std::endl<< | get_solver_names() | ||
) |
Exception.
|
protected |
Stores the SolverControl
that is needed in the constructor of each Solver
class. This can be changed with set_control()
.
Definition at line 219 of file solver_selector.h.
|
protected |
Stores the name of the solver.
Definition at line 224 of file solver_selector.h.
|
private |
Stores the additional data.
Definition at line 230 of file solver_selector.h.
|
private |
Stores the additional data.
Definition at line 235 of file solver_selector.h.
|
private |
Stores the additional data.
Definition at line 240 of file solver_selector.h.
|
private |
Stores the additional data.
Definition at line 245 of file solver_selector.h.
|
private |
Stores the additional data.
Definition at line 250 of file solver_selector.h.
|
private |
Stores the additional data.
Definition at line 255 of file solver_selector.h.