Go to the documentation of this file.
21 #include "libmesh/auto_ptr.h"
22 #include "libmesh/nonlinear_solver.h"
23 #include "libmesh/petsc_nonlinear_solver.h"
24 #include "libmesh/trilinos_nox_nonlinear_solver.h"
25 #include "libmesh/solver_configuration.h"
26 #include "libmesh/enum_solver_package.h"
34 #if defined(LIBMESH_HAVE_PETSC) || defined(LIBMESH_TRILINOS_HAVE_NOX)
36 std::unique_ptr<NonlinearSolver<T>>
40 switch (solver_package)
43 #ifdef LIBMESH_HAVE_PETSC
45 return libmesh_make_unique<PetscNonlinearSolver<T>>(s);
46 #endif // LIBMESH_HAVE_PETSC
48 #if defined(LIBMESH_TRILINOS_HAVE_NOX) && defined(LIBMESH_TRILINOS_HAVE_EPETRA)
50 return libmesh_make_unique<NoxNonlinearSolver<T>>(s);
54 libmesh_error_msg(
"ERROR: Unrecognized solver package: " << solver_package);
58 #else // LIBMESH_HAVE_PETSC || LIBMESH_TRILINOS_HAVE_NOX
61 std::unique_ptr<NonlinearSolver<T>>
64 libmesh_not_implemented_msg(
"ERROR: libMesh was compiled without nonlinear solver support");
74 libmesh_error_msg(
"Preconditioner must be attached before the solver is initialized!");
76 _preconditioner = preconditioner;
82 _solver_configuration = &solver_configuration;
SolverPackage
Defines an enum for various linear solver packages.
void set_solver_configuration(SolverConfiguration &solver_configuration)
Set the solver configuration object.
The libMesh namespace provides an interface to certain functionality in the library.
void attach_preconditioner(Preconditioner< T > *preconditioner)
Attaches a Preconditioner object to be used during the linear solves.
Manages consistently variables, degrees of freedom, coefficient vectors, matrices and non-linear solv...
This class provides a uniform interface for preconditioners.
bool _is_initialized
Flag that tells if init() has been called.
This class stores solver configuration data, e.g.
static std::unique_ptr< NonlinearSolver< T > > build(sys_type &s, const SolverPackage solver_package=libMesh::default_solver_package())
Builds a NonlinearSolver using the nonlinear solver package specified by solver_package.