#include <source/solvers/packages/sundials/kinsol/KINSOL_SAMRAIContext.h>
Inheritance diagram for SAMRAI::solv::KINSOL_SAMRAIContext< DIM >:
Public Member Functions | |
KINSOL_SAMRAIContext (const std::string &object_name, tbox::Pointer< tbox::Database > input_db, KINSOLAbstractFunctions *my_functions) | |
~KINSOL_SAMRAIContext () | |
void | initialize (tbox::Pointer< SAMRAIVectorReal< DIM, double > > solution) |
int | solve () |
KINSOLSolver * | getKINSOLSolver () |
void | getFromInput (tbox::Pointer< tbox::Database > db) |
void | getFromRestart () |
void | putToDatabase (tbox::Pointer< tbox::Database > db) |
virtual void | printClassData (std::ostream &os) const |
Class KINSOL_SAMRAIContext<DIM> wraps the KINSOLSolver C++ wrapper class so that KINSOL may be used in applications that require a nonlinear solver. The class KINSOLSolver does not depend on SAMRAI. Making it derived from the SAMRAI nonlinear solver interface would require the KINSOL C++ wrapper to depend on SAMRAI.
Important note: This class can only create a KINSOL C++ wrapper instance, initialize it in a rudimentary way, and invoke the solution process. All other interaction with the nonlinear solver (i.e., setting parameters, retrieving solver statistics, etc.) must be done directly with the KINSOL wrapper accessible via the routine getKINSOLSolver(). Alternatively, solver parameters may be set up at initialization time using the SAMRAI input database.
If no parameters are read from input, KINSOL defaults are used. See KINSOL documentation for default information. Optional input keys and types are:
Note that all input values may override values read in from restart. If no new input value is given, the restart value is used.
A sample input file entry might look like:
residual_stop_tolerance = 10.e-6 max_nonlinear_iterations = 200 max_newton_step = 0.1 KINSOL_log_filename = "mylogfile" KINSOL_print_flag = 3 // print all output KINSOL has to offer
SAMRAI::solv::KINSOL_SAMRAIContext< DIM >::KINSOL_SAMRAIContext | ( | const std::string & | object_name, | |
tbox::Pointer< tbox::Database > | input_db, | |||
KINSOLAbstractFunctions * | my_functions | |||
) |
Constructor for algs::KINSOL_SAMRAIContext allocates the KINSOL C++ wrapper object and initializes rudimentary state associated with user-supplied solver components. Then, it reads solver parameter from input and restart which may override default values.
When assertion checking is active, an unrecoverable exception will result if the name string is empty or the pointer to the user-defined KINSOL functions object is null.
SAMRAI::solv::KINSOL_SAMRAIContext< DIM >::~KINSOL_SAMRAIContext | ( | ) |
Destructor for algs::KINSOL_SAMRAIContext destroys the KINSOL C++ wrapper object and the KINSOL solution vector wrapper.
void SAMRAI::solv::KINSOL_SAMRAIContext< DIM >::initialize | ( | tbox::Pointer< SAMRAIVectorReal< DIM, double > > | solution | ) | [virtual] |
Initialize the state of KINSOL based on vector argument representing the solution of the nonlinear system. In general, this routine must be called before the solve() routine is invoked.
Implements SAMRAI::solv::NonlinearSolverStrategy< DIM >.
int SAMRAI::solv::KINSOL_SAMRAIContext< DIM >::solve | ( | ) | [virtual] |
Solve the nonlinear problem and return and integer value defined by KINSOL. A return value of 1 indicates success (i.e., KINSOL_SUCCESS). Consult the KINSOL documentation, KINSOL header file kinsol.h, or the header file for the class KINSOLSolver for more information about KINSOL return codes. In general, the initialize() routine must be called before this solve function to set up the solver.
Implements SAMRAI::solv::NonlinearSolverStrategy< DIM >.
KINSOLSolver * SAMRAI::solv::KINSOL_SAMRAIContext< DIM >::getKINSOLSolver | ( | ) |
Return pointer to KINSOL solver C++ wrapper object.
void SAMRAI::solv::KINSOL_SAMRAIContext< DIM >::getFromInput | ( | tbox::Pointer< tbox::Database > | db | ) |
Read input parameters from given database.
When assertion checking is active, an unrecoverable exception will result if the database pointer is null.
void SAMRAI::solv::KINSOL_SAMRAIContext< DIM >::getFromRestart | ( | ) |
Retrieve solver parameters from restart database matching object name.
When assertion checking is active, an unrecoverable exception will result if a restart database matching the object name does not exist, or if the class version number does not match that in restart.
void SAMRAI::solv::KINSOL_SAMRAIContext< DIM >::putToDatabase | ( | tbox::Pointer< tbox::Database > | db | ) | [virtual] |
Retrieve solver parameters from restart database matching object name.
When assertion checking is active, an unrecoverable exception will result if database pointer is null.
Implements SAMRAI::tbox::Serializable.
void SAMRAI::solv::KINSOL_SAMRAIContext< DIM >::printClassData | ( | std::ostream & | os | ) | const [virtual] |
Print out all members of integrator instance to given output stream.