|
Hermes2D
2.0
|
#include <linear_solver.h>
Inheritance diagram for Hermes::Hermes2D::LinearSolver< Scalar >:Public Member Functions | |
| LinearSolver (DiscreteProblemLinear< Scalar > *dp) | |
| LinearSolver (const WeakForm< Scalar > *wf, const Space< Scalar > *space) | |
| LinearSolver (const WeakForm< Scalar > *wf, Hermes::vector< const Space< Scalar > * > spaces) | |
| void | init () |
| virtual bool | isOkay () const |
| State querying helpers. | |
| std::string | getClassName () const |
| Get class name, for the purpose of messaging. | |
| virtual void | solve () |
| Basic solve method. | |
| Scalar * | get_sln_vector () |
| virtual void | set_time (double time) |
| set time information for time-dependent problems. | |
| virtual void | set_time_step (double time_step) |
| virtual void | set_spaces (Hermes::vector< const Space< Scalar > * > spaces) |
| Sets new spaces for the instance. | |
| virtual void | set_space (const Space< Scalar > *space) |
|
virtual Hermes::vector< const Space< Scalar > * > | get_spaces () const |
| Get all spaces as a Hermes::vector. | |
| void | set_weak_formulation (const WeakForm< Scalar > *wf) |
| Set the weak forms. | |
| SparseMatrix< Scalar > * | get_jacobian () |
| Get the Jacobian. | |
| Vector< Scalar > * | get_residual () |
| Get the Residual. | |
Public Member Functions inherited from Hermes::Hermes2D::Mixins::SettableSpaces< Scalar > | |
| virtual const Space< Scalar > * | get_space (int n) const |
Public Member Functions inherited from Hermes::Hermes2D::Mixins::MatrixRhsOutput< Scalar > | |
| MatrixRhsOutput () | |
| void | output_matrix (int firstIterations=-1) |
| void | set_print_zero_matrix_entries (bool to_set) |
| Sets this instance to output matrix entries even though they are zero or not. | |
| void | set_matrix_filename (std::string name) |
| void | set_matrix_varname (std::string name) |
| void | set_matrix_E_matrix_dump_format (EMatrixDumpFormat format) |
| void | set_matrix_number_format (char *number_format) |
| void | output_rhs (int firstIterations=-1) |
| void | set_rhs_filename (std::string name) |
| void | set_rhs_varname (std::string name) |
| void | set_rhs_E_matrix_dump_format (EMatrixDumpFormat format) |
| void | set_rhs_number_format (char *number_format) |
Public Member Functions inherited from Hermes::Hermes2D::Mixins::StateQueryable | |
| void | check () const |
| Method to handle the state. | |
Protected Attributes | |
| DiscreteProblemLinear< Scalar > * | dp |
| FE problem being solved. | |
| Scalar * | sln_vector |
| The solution vector. | |
| SparseMatrix< Scalar > * | jacobian |
| Jacobian. | |
| Vector< Scalar > * | residual |
| Residual. | |
| LinearMatrixSolver< Scalar > * | matrix_solver |
| Linear solver. | |
| const bool | own_dp |
| This instance owns its DP. | |
Protected Attributes inherited from Hermes::Hermes2D::Mixins::MatrixRhsOutput< Scalar > | |
| bool | print_matrix_zero_values |
| bool | output_matrixOn |
| int | output_matrixIterations |
| std::string | matrixFilename |
| std::string | matrixVarname |
| EMatrixDumpFormat | matrixFormat |
| char * | matrix_number_format |
| bool | output_rhsOn |
| int | output_rhsIterations |
| std::string | RhsFilename |
| std::string | RhsVarname |
| EMatrixDumpFormat | RhsFormat |
| char * | rhs_number_format |
Class for solving linear problems.
Typical usage:
// Initialize linear solver.
// Here wf is Hermes2D::WeakForm<double>, space is Hermes2D::Space<double>
Hermes::Hermes2D::LinearSolver<double> linear_solver(&wf, &space);
// Solve the linear problem.
try
{
// Just call solve().
linear_solver.solve();
// Get the solution vector from the solver.
double* sln_vector = linear_solver.get_sln_vector();
// Translate the solution vector into the previously initialized Solution<double> using the static method vector_to_solution.
Hermes::Hermes2D::Solution<double>::vector_to_solution(sln_vector, &space, &sln);
}
// All kinds of Exceptions may happen (Linear algebraic solver, some bad parameters, some data not initialized...)
catch(Hermes::Exceptions::Exception& e)
{
e.print_msg();
return -1;
}
// For illustrative purposes, otherwise one can just catch std::exception directly, as Hermes::Exceptions::Exception derive from it.
catch(std::exception& e)
{
std::cout << e.what();
return -1;
}
Definition at line 67 of file linear_solver.h.