Hermes2D  3.0
Hermes::Hermes2D::LinearSolver< Scalar > Class Template Reference

#include <linear_solver.h>

+ Inheritance diagram for Hermes::Hermes2D::LinearSolver< Scalar >:

Public Member Functions

 LinearSolver (bool force_use_direct_solver=false)
 
 LinearSolver (DiscreteProblem< Scalar > *dp, bool force_use_direct_solver=false)
 
 LinearSolver (WeakFormSharedPtr< Scalar > wf, SpaceSharedPtr< Scalar > space, bool force_use_direct_solver=false)
 
 LinearSolver (WeakFormSharedPtr< Scalar > wf, std::vector< SpaceSharedPtr< Scalar > > spaces, bool force_use_direct_solver=false)
 
virtual void solve (Scalar *coeff_vec)
 
Scalar * get_sln_vector ()
 Get sln vector.
 
virtual void set_spaces (std::vector< SpaceSharedPtr< Scalar > > spaces)
 DiscreteProblemWeakForm helper.
 
virtual void set_weak_formulation (WeakFormSharedPtr< Scalar > wf)
 DiscreteProblemWeakForm helper.
 
virtual void set_verbose_output (bool to_set)
 See Hermes::Mixins::Loggable.
 
- Public Member Functions inherited from Hermes::Hermes2D::Solver< Scalar >
 Solver (bool initialize_discrete_problem=true)
 
 Solver (DiscreteProblem< Scalar > *dp)
 
 Solver (WeakFormSharedPtr< Scalar > wf, SpaceSharedPtr< Scalar > space)
 
 Solver (WeakFormSharedPtr< Scalar > wf, std::vector< SpaceSharedPtr< Scalar > > spaces)
 
virtual void solve ()
 Basic solve method.
 
virtual void solve (MeshFunctionSharedPtr< Scalar > initial_guess)
 
virtual void solve (std::vector< MeshFunctionSharedPtr< Scalar > > initial_guess)
 
virtual void set_time (double time)
 set time information for time-dependent problems.
 
virtual void set_time_step (double time_step)
 
virtual std::vector
< SpaceSharedPtr< Scalar > > 
get_spaces ()
 Get all spaces as a std::vector.
 
- Public Member Functions inherited from Hermes::Hermes2D::Mixins::SettableSpaces< Scalar >
virtual void set_space (SpaceSharedPtr< Scalar > space)
 
virtual SpaceSharedPtr< Scalar > get_space (int n)
 
- Public Member Functions inherited from Hermes::Hermes2D::Mixins::DiscreteProblemWeakForm< Scalar >
WeakFormSharedPtr< Scalar > get_weak_formulation () const
 

Protected Member Functions

virtual bool isOkay () const
 State querying helpers.
 
std::string getClassName () const
 
- Protected Member Functions inherited from Hermes::Hermes2D::Mixins::DiscreteProblemWeakForm< Scalar >
 DiscreteProblemWeakForm (WeakFormSharedPtr< Scalar > wf=WeakFormSharedPtr< Scalar >(nullptr))
 

Additional Inherited Members

- Protected Attributes inherited from Hermes::Hermes2D::Solver< Scalar >
DiscreteProblem< Scalar > * dp
 FE problem being solved.
 
bool own_dp
 This instance owns its DP.
 
- Protected Attributes inherited from Hermes::Hermes2D::Mixins::DiscreteProblemWeakForm< Scalar >
WeakFormSharedPtr< Scalar > wf
 Weak formulation.
 

Detailed Description

template<typename Scalar>
class Hermes::Hermes2D::LinearSolver< Scalar >

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
{
   linear_solver.solve();

   double* sln_vector = linear_solver.get_sln_vector();

   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 65 of file linear_solver.h.

Member Function Documentation

template<typename Scalar >
void Hermes::Hermes2D::LinearSolver< Scalar >::solve ( Scalar *  coeff_vec)
virtual

Basic solve method - in linear solvers it serves only as an initial guess for iterative solvers.

Parameters
[in]coeff_vecinitiall guess.

Implements Hermes::Hermes2D::Solver< Scalar >.

Definition at line 96 of file linear_solver.cpp.

Referenced by Hermes::Hermes2D::ExactSolutionEggShell::ExactSolutionEggShell(), and Hermes::Hermes2D::OGProjection< Scalar >::project_internal().


The documentation for this class was generated from the following files: