This class provides a uniform interface for nonlinear solvers. This base class is overloaded to provide nonlinear solvers from different packages like PETSC.
Author:
Benjamin Kirk, 2005
Definition at line 54 of file nonlinear_solver.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.
template<typename T> typedef NonlinearImplicitSystemNonlinearSolver< T >::sys_typeThe type of system
Reimplemented in PetscNonlinearSolver< T >, NoxNonlinearSolver< T >, and NoxNonlinearSolver< Number >.
Definition at line 60 of file nonlinear_solver.h.
Constructor & Destructor Documentation
template<typename T > NonlinearSolver< T >::NonlinearSolver (sys_type &s) [inline]Constructor. Initializes Solver data structures
Definition at line 226 of file nonlinear_solver.h.
template<typename T > NonlinearSolver< T >::~NonlinearSolver () [inline, virtual]Destructor.
Definition at line 249 of file nonlinear_solver.h.
{
this->clear ();
}
Member Function Documentation
template<typename T> void NonlinearSolver< T >::attach_preconditioner (Preconditioner< T > *preconditioner)Attaches a Preconditioner object to be used during the linear solves.
{
if(this->_is_initialized)
{
std::cerr<<'Preconditioner must be attached before the solver is initialized!'<<std::endl;
libmesh_error();
}
_preconditioner = preconditioner;
}
template<typename T > AutoPtr< NonlinearSolver< T > > NonlinearSolver< T >::build (sys_type &s, const SolverPackagesolver_package = libMesh::default_solver_package()) [static]Builds a NonlinearSolver using the nonlinear solver package specified by solver_package
Definition at line 36 of file nonlinear_solver.C.
References libMeshEnums::PETSC_SOLVERS, AutoPtr< Tp >::reset(), and TRILINOS_SOLVERS.
template<typename T> virtual void NonlinearSolver< T >::clear () [inline, virtual]Release all memory and clear data structures.
Reimplemented in PetscNonlinearSolver< T >, NoxNonlinearSolver< T >, and NoxNonlinearSolver< Number >.
Definition at line 88 of file nonlinear_solver.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 NonlinearSolver< T >::init () [pure virtual]Initialize data structures if not done so already.
Implemented in PetscNonlinearSolver< T >, NoxNonlinearSolver< T >, and NoxNonlinearSolver< Number >.
template<typename T> bool NonlinearSolver< T >::initialized () const [inline]Returns:
true if the data structures are initialized, false otherwise.
Definition at line 83 of file nonlinear_solver.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.
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> Preconditioner<T>* NonlinearSolver< T >::_preconditioner [protected]Holds the Preconditioner object to be used for the linear solves.
Definition at line 217 of file nonlinear_solver.h.
template<typename T> sys_type& NonlinearSolver< T >::_system [protected]A reference to the system we are solving.
Definition at line 207 of file nonlinear_solver.h.
Referenced by NonlinearSolver< Number >::system().
template<typename T> RealNonlinearSolver< T >::absolute_residual_toleranceThe NonlinearSolver should exit after the residual is reduced to either less than absolute_residual_tolerance or less than relative_residual_tolerance times the initial residual.
Users should increase any of these tolerances that they want to use for a stopping condition.
Definition at line 163 of file nonlinear_solver.h.
template<typename T> RealNonlinearSolver< T >::absolute_step_toleranceThe NonlinearSolver should exit after the full nonlinear step norm is reduced to either less than absolute_step_tolerance or less than relative_step_tolerance times the largest nonlinear solution which has been seen so far.
Users should increase any of these tolerances that they want to use for a stopping condition.
Note that not all NonlinearSolvers support relative_step_tolerance!
Definition at line 177 of file nonlinear_solver.h.
template<typename T> bool NonlinearSolver< T >::convergedAfter a call to solve this will reflect whether or not the nonlinear solve was successful.
Definition at line 201 of file nonlinear_solver.h.
template<typename T> RealNonlinearSolver< T >::initial_linear_toleranceAny required linear solves will at first be done with this tolerance; the NonlinearSolver may tighten the tolerance for later solves.
Definition at line 190 of file nonlinear_solver.h.
template<typename T> void(* NonlinearSolver< T >::jacobian)(const NumericVector< Number > &X, SparseMatrix< Number > &J)Function that computes the Jacobian J(X) of the nonlinear system at the input iterate X.
Definition at line 115 of file nonlinear_solver.h.
Referenced by __libmesh_petsc_snes_jacobian().
template<typename T> void(* NonlinearSolver< T >::matvec)(const NumericVector< Number > &X, NumericVector< Number > *R, SparseMatrix< Number > *J)Function that computes either the residual $ R(X) $ or the Jacobian $ J(X) $ of the nonlinear system at the input iterate $ X $. Note that either R or J could be XSNULL.
Definition at line 124 of file nonlinear_solver.h.
Referenced by __libmesh_petsc_snes_jacobian(), and __libmesh_petsc_snes_residual().
template<typename T> unsigned int NonlinearSolver< T >::max_function_evaluationsMaximum number of function evaluations.
Definition at line 151 of file nonlinear_solver.h.
template<typename T> unsigned int NonlinearSolver< T >::max_linear_iterationsEach linear solver step should exit after max_linear_iterations is exceeded.
Definition at line 184 of file nonlinear_solver.h.
template<typename T> unsigned int NonlinearSolver< T >::max_nonlinear_iterationsMaximum number of non-linear iterations.
Definition at line 146 of file nonlinear_solver.h.
template<typename T> RealNonlinearSolver< T >::minimum_linear_toleranceThe tolerance for linear solves is kept above this minimum
Definition at line 195 of file nonlinear_solver.h.
template<typename T> RealNonlinearSolver< T >::relative_residual_tolerance
Definition at line 164 of file nonlinear_solver.h.
template<typename T> RealNonlinearSolver< T >::relative_step_tolerance
Definition at line 178 of file nonlinear_solver.h.
template<typename T> void(* NonlinearSolver< T >::residual)(const NumericVector< Number > &X, NumericVector< Number > &R)Function that computes the residual R(X) of the nonlinear system at the input iterate X.
Definition at line 108 of file nonlinear_solver.h.
Referenced by __libmesh_petsc_snes_residual(), and Problem_Interface::computeF().
Author
Generated automatically by Doxygen for libMesh from the source code.