This class provides a uniform interface for preconditioners. This base class is overloaded to provide linear solvers from different packages like PETSC or Trilinos.
In the below comments P is the matrix to be preconditioned with Apply() performing the equivalent of the matrix vector product P^-1 x. This can also be thought of as (usually approximately) solving for Py=x.
Author:
Derek Gaston, 2009
Definition at line 59 of file preconditioner.h.
Member Typedef Documentation
typedef std::map<std::string, std::pair<unsigned int, unsigned int> > ReferenceCounter::Counts [protected, inherited]Data structure to log the information. The log is identified by the class name.
Definition at line 105 of file reference_counter.h.
Constructor & Destructor Documentation
template<typename T > Preconditioner< T >::Preconditioner () [inline]Constructor. Initializes Preconditioner data structures
template<typename T > Preconditioner< T >::~Preconditioner () [inline, virtual]Destructor.
Definition at line 154 of file preconditioner.h.
{
this->clear ();
}
Member Function Documentation
template<typename T> virtual void Preconditioner< T >::apply (const NumericVector< T > &x, NumericVector< T > &y) [pure virtual]Computes the preconditioned vector 'y' based on input 'x'. Usually by solving Py=x to get the action of P^-1 x.
Implemented in PetscPreconditioner< T >.
Referenced by __libmesh_petsc_preconditioner_apply().
template<typename T > Preconditioner< T > * Preconditioner< T >::build (const SolverPackagesolver_package = libMesh::default_solver_package()) [static]Builds a Preconditioner using the linear solver package specified by solver_package
template<typename T> virtual void Preconditioner< T >::clear () [inline, virtual]Release all memory and clear data structures.
Reimplemented in PetscPreconditioner< T >.
Definition at line 95 of file preconditioner.h.
{}
std::string ReferenceCounter::get_info () [static, inherited]Gets a string containing the reference information.
Definition at line 45 of file reference_counter.C.
References ReferenceCounter::_counts, and Quality::name().
Referenced by ReferenceCounter::print_info().
{
#if defined(LIBMESH_ENABLE_REFERENCE_COUNTING) && defined(DEBUG)
std::ostringstream out;
out << '
<< ' ----------------------------------------------------------------------------
<< '| Reference count information |
<< ' ---------------------------------------------------------------------------- ;
for (Counts::iterator it = _counts.begin();
it != _counts.end(); ++it)
{
const std::string name(it->first);
const unsigned int creations = it->second.first;
const unsigned int destructions = it->second.second;
out << '| ' << name << ' reference count information:
<< '| Creations: ' << creations << '
<< '| Destructions: ' << destructions << ';
}
out << ' ---------------------------------------------------------------------------- ;
return out.str();
#else
return '';
#endif
}
void ReferenceCounter::increment_constructor_count (const std::string &name) [inline, protected, inherited]Increments the construction counter. Should be called in the constructor of any derived class that will be reference counted.
Definition at line 149 of file reference_counter.h.
References ReferenceCounter::_counts, Quality::name(), and Threads::spin_mtx.
Referenced by ReferenceCountedObject< Value >::ReferenceCountedObject().
void ReferenceCounter::increment_destructor_count (const std::string &name) [inline, protected, inherited]Increments the destruction counter. Should be called in the destructor of any derived class that will be reference counted.
Definition at line 167 of file reference_counter.h.
References ReferenceCounter::_counts, Quality::name(), and Threads::spin_mtx.
Referenced by ReferenceCountedObject< Value >::~ReferenceCountedObject().
template<typename T> virtual void Preconditioner< T >::init () [inline, virtual]Initialize data structures if not done so already.
Reimplemented in PetscPreconditioner< T >.
Definition at line 100 of file preconditioner.h.
Referenced by __libmesh_petsc_preconditioner_setup().
{};
template<typename T> bool Preconditioner< T >::initialized () const [inline]Returns:
true if the data structures are initialized, false otherwise.
Definition at line 84 of file preconditioner.h.
{ return _is_initialized; }
static unsigned int ReferenceCounter::n_objects () [inline, static, inherited]Prints the number of outstanding (created, but not yet destroyed) objects.
Definition at line 76 of file reference_counter.h.
References ReferenceCounter::_n_objects.
Referenced by System::read_serialized_blocked_dof_objects(), and System::write_serialized_blocked_dof_objects().
{ return _n_objects; }
void ReferenceCounter::print_info () [static, inherited]Prints the reference information to std::cout.
Definition at line 83 of file reference_counter.C.
{
//If the preconditioner type changes we (probably) need to reinitialize.
_is_initialized = false;
_preconditioner_type = pct;
}
template<typename T> PreconditionerType Preconditioner< T >::type () const [inline]Returns the type of preconditioner to use.
Definition at line 110 of file preconditioner.h.
{ return _preconditioner_type; }
Member Data Documentation
ReferenceCounter::CountsReferenceCounter::_counts [static, protected, inherited]Actually holds the data.
Definition at line 110 of file reference_counter.h.
Referenced by ReferenceCounter::get_info(), ReferenceCounter::increment_constructor_count(), and ReferenceCounter::increment_destructor_count().
template<typename T> bool Preconditioner< T >::_is_initialized [protected]Flag indicating if the data structures have been initialized.
Definition at line 134 of file preconditioner.h.
Referenced by Preconditioner< Number >::initialized().
template<typename T> SparseMatrix<T>* Preconditioner< T >::_matrix [protected]The matrix P... ie the matrix to be preconditioned. This is often the actual system matrix of a linear sytem.
Definition at line 123 of file reference_counter.h.
Threads::atomic< unsigned int > ReferenceCounter::_n_objects [static, protected, inherited]The number of objects. Print the reference count information when the number returns to 0.
Definition at line 118 of file reference_counter.h.
Referenced by ReferenceCounter::n_objects(), ReferenceCounter::ReferenceCounter(), and ReferenceCounter::~ReferenceCounter().
template<typename T> PreconditionerType Preconditioner< T >::_preconditioner_type [protected]Enum statitng with type of preconditioner to use.
Definition at line 129 of file preconditioner.h.
Referenced by Preconditioner< Number >::type().
Author
Generated automatically by Doxygen for libMesh from the source code.