ug4
ug::NewtonSolver< TAlgebra > Class Template Reference

Newton solver for assembling based discretizations. More...

#include <newton.h>

+ Inheritance diagram for ug::NewtonSolver< TAlgebra >:

Public Types

typedef TAlgebra algebra_type
 Algebra type. More...
 
typedef TAlgebra::matrix_type matrix_type
 Matrix type. More...
 
typedef TAlgebra::vector_type vector_type
 Vector type. More...
 
- Public Types inherited from ug::IOperatorInverse< TAlgebra::vector_type >
typedef TAlgebra::vector_type codomain_function_type
 Range space. More...
 
typedef TAlgebra::vector_type domain_function_type
 Domain space. More...
 
- Public Types inherited from ug::DebugWritingObject< TAlgebra >
typedef TAlgebra algebra_type
 type of algebra More...
 
typedef TAlgebra::matrix_type matrix_type
 type of matrix More...
 
typedef TAlgebra::vector_type vector_type
 type of vector More...
 
- Public Types inherited from ug::VectorDebugWritingObject< TAlgebra::vector_type >
typedef TAlgebra::vector_type vector_type
 type of vector More...
 

Public Member Functions

void add_inner_step_update (SmartPtr< INewtonUpdate > NU)
 add inner step update (applied before every linear solver step) More...
 
void add_step_update (SmartPtr< INewtonUpdate > NU)
 add outer step update (applied before every Newton step) More...
 
virtual bool apply (vector_type &u)
 apply Operator, i.e. N^{-1}(0) = u More...
 
void clear_average_convergence ()
 resets average linear solver convergence More...
 
void clear_inner_step_update (SmartPtr< INewtonUpdate > NU)
 clears inner step update More...
 
void clear_step_update (SmartPtr< INewtonUpdate > NU)
 clears outer step update More...
 
virtual std::string config_string () const
 returns information about configuration parameters More...
 
void disable_line_search ()
 
virtual bool init (SmartPtr< IOperator< vector_type > > N)
 This operator inverts the Operator N: Y -> X. More...
 
SmartPtr< ILineSearch< vector_type > > line_search ()
 
 NewtonSolver ()
 default constructor More...
 
 NewtonSolver (SmartPtr< IAssemble< TAlgebra > > spAss)
 constructor using assembling More...
 
 NewtonSolver (SmartPtr< ILinearOperatorInverse< vector_type > > LinearSolver, SmartPtr< IConvergenceCheck< vector_type > > spConvCheck, SmartPtr< ILineSearch< vector_type > > spLineSearch)
 constructor More...
 
 NewtonSolver (SmartPtr< IOperator< vector_type > > N)
 constructor setting operator More...
 
virtual bool prepare (vector_type &u)
 prepare Operator More...
 
void print_average_convergence () const
 prints average linear solver convergence More...
 
void set_convergence_check (SmartPtr< IConvergenceCheck< vector_type > > spConvCheck)
 sets the convergence check More...
 
void set_line_search (SmartPtr< ILineSearch< vector_type > > spLineSearch)
 sets the line search More...
 
void set_linear_solver (SmartPtr< ILinearOperatorInverse< vector_type > > LinearSolver)
 sets the linear solver More...
 
void set_reassemble_J_freq (int freq)
 sets the frequency of reassembling of the Jacobian (0 == 1 == in every step, i.e. classically) More...
 
size_t num_newton_steps () const
 
int num_linsolver_calls (size_t call) const
 
int num_linsolver_steps (size_t call) const
 
double average_linear_steps (size_t call) const
 
int total_linsolver_calls () const
 
int total_linsolver_steps () const
 
double total_average_linear_steps () const
 
int last_num_newton_steps () const
 
- Public Member Functions inherited from ug::IOperatorInverse< TAlgebra::vector_type >
virtual bool init (SmartPtr< IOperator< TAlgebra::vector_type, TAlgebra::vector_type > > N)=0
 initializes the operator for the inversion of the operator N: Y -> X More...
 
virtual ~IOperatorInverse ()
 virtual destructor More...
 
- Public Member Functions inherited from ug::DebugWritingObject< TAlgebra >
SmartPtr< IDebugWriter< algebra_type > > debug_writer ()
 returns the debug writer More...
 
ConstSmartPtr< IDebugWriter< algebra_type > > debug_writer () const
 
bool debug_writer_valid () const
 returns true if the debug writer is set More...
 
 DebugWritingObject ()
 
 DebugWritingObject (const DebugWritingObject< algebra_type > &parent)
 clone constructor More...
 
 DebugWritingObject (SmartPtr< IDebugWriter< algebra_type > > spDebugWriter)
 
virtual void set_debug (SmartPtr< IDebugWriter< algebra_type > > spDebugWriter)
 set debug writer More...
 
virtual ~DebugWritingObject ()
 virtual destructor More...
 
- Public Member Functions inherited from ug::VectorDebugWritingObject< TAlgebra::vector_type >
virtual void set_debug (SmartPtr< IVectorDebugWriter< vector_type > > spDebugWriter)
 set debug writer More...
 
SmartPtr< IVectorDebugWriter< vector_type > > vector_debug_writer ()
 returns the debug writer More...
 
ConstSmartPtr< IVectorDebugWriter< vector_type > > vector_debug_writer () const
 
bool vector_debug_writer_valid () const
 returns true if the debug writer is set More...
 
 VectorDebugWritingObject ()
 
 VectorDebugWritingObject (SmartPtr< IVectorDebugWriter< vector_type > > spDebugWriter)
 
void write_debug (const vector_type &vec, const char *filename)
 writing debug output for a vector (if debug writer set) More...
 
virtual ~VectorDebugWritingObject ()
 virtual destructor More...
 

Private Member Functions

void write_debug (const vector_type &vec, std::string filename)
 
void write_debug (const matrix_type &mat, std::string filename)
 

Private Attributes

int m_dgbCall
 call counter More...
 
std::vector< SmartPtr< INewtonUpdate > > m_innerStepUpdate
 Update. More...
 
SmartPtr< AssembledLinearOperator< algebra_type > > m_J
 jacobi operator More...
 
int m_lastNumSteps
 
SmartPtr< AssembledOperator< algebra_type > > m_N
 assembling routine More...
 
int m_reassembe_J_freq
 how often to reassemble the Jacobian (0 == 1 == in every step, i.e. classically) More...
 
SmartPtr< IAssemble< TAlgebra > > m_spAss
 assembling More...
 
SmartPtr< IConvergenceCheck< vector_type > > m_spConvCheck
 Convergence Check. More...
 
SmartPtr< ILinearOperatorInverse< vector_type > > m_spLinearSolver
 linear solver More...
 
SmartPtr< ILineSearch< vector_type > > m_spLineSearch
 LineSearch. More...
 
std::vector< SmartPtr< INewtonUpdate > > m_stepUpdate
 
std::vector< int > m_vTotalLinSolverSteps
 
std::vector< int > m_vLinSolverCalls
 
std::vector< numberm_vNonLinSolverRates
 
std::vector< numberm_vLinSolverRates
 

Additional Inherited Members

- Protected Member Functions inherited from ug::DebugWritingObject< TAlgebra >
void enter_debug_writer_section (const char *secDir)
 enters a debugging section More...
 
void enter_debug_writer_section (std::string secDir)
 enters a debugging section More...
 
void leave_debug_writer_section ()
 leaves a debugging section More...
 
void write_debug (const matrix_type &mat, const char *filename)
 write debug output for a matrix (if debug writer set) More...
 
void write_debug (const matrix_type &mat, std::string name)
 write debug output for a matrix (if debug writer set) More...
 
- Protected Member Functions inherited from ug::VectorDebugWritingObject< TAlgebra::vector_type >
void enter_vector_debug_writer_section (const char *secDir)
 enters a debugging section More...
 
void enter_vector_debug_writer_section (std::string secDir)
 enters a debugging section More...
 
void leave_vector_debug_writer_section ()
 leaves a debugging section More...
 
void print_debugger_message (const char *msg)
 prints a debugger message (listing all the sections) More...
 
void print_debugger_message (std::string msg)
 prints a debugger message (listing all the sections) More...
 
- Protected Attributes inherited from ug::DebugWritingObject< TAlgebra >
SmartPtr< IDebugWriter< algebra_type > > m_spDebugWriter
 Debug Writer. More...
 
- Protected Attributes inherited from ug::VectorDebugWritingObject< TAlgebra::vector_type >
SmartPtr< IVectorDebugWriter< vector_type > > m_spVectorDebugWriter
 Debug Writer. More...
 

Detailed Description

template<typename TAlgebra>
class ug::NewtonSolver< TAlgebra >

Newton solver for assembling based discretizations.

Member Typedef Documentation

◆ algebra_type

template<typename TAlgebra >
typedef TAlgebra ug::NewtonSolver< TAlgebra >::algebra_type

Algebra type.

◆ matrix_type

template<typename TAlgebra >
typedef TAlgebra::matrix_type ug::NewtonSolver< TAlgebra >::matrix_type

Matrix type.

◆ vector_type

template<typename TAlgebra >
typedef TAlgebra::vector_type ug::NewtonSolver< TAlgebra >::vector_type

Vector type.

Constructor & Destructor Documentation

◆ NewtonSolver() [1/4]

template<typename TAlgebra >
ug::NewtonSolver< TAlgebra >::NewtonSolver ( SmartPtr< IOperator< vector_type > >  N)

constructor setting operator

References new().

◆ NewtonSolver() [2/4]

template<typename TAlgebra >
ug::NewtonSolver< TAlgebra >::NewtonSolver ( SmartPtr< IAssemble< TAlgebra > >  spAss)

constructor using assembling

References new().

◆ NewtonSolver() [3/4]

template<typename TAlgebra >
ug::NewtonSolver< TAlgebra >::NewtonSolver

default constructor

References new().

◆ NewtonSolver() [4/4]

template<typename TAlgebra >
ug::NewtonSolver< TAlgebra >::NewtonSolver ( SmartPtr< ILinearOperatorInverse< vector_type > >  LinearSolver,
SmartPtr< IConvergenceCheck< vector_type > >  spConvCheck,
SmartPtr< ILineSearch< vector_type > >  spLineSearch 
)

constructor

References new().

Member Function Documentation

◆ add_inner_step_update()

template<typename TAlgebra >
void ug::NewtonSolver< TAlgebra >::add_inner_step_update ( SmartPtr< INewtonUpdate NU)
inline

add inner step update (applied before every linear solver step)

References ug::NewtonSolver< TAlgebra >::m_innerStepUpdate.

◆ add_step_update()

template<typename TAlgebra >
void ug::NewtonSolver< TAlgebra >::add_step_update ( SmartPtr< INewtonUpdate NU)
inline

add outer step update (applied before every Newton step)

References ug::NewtonSolver< TAlgebra >::m_stepUpdate.

◆ apply()

template<typename TAlgebra >
bool ug::NewtonSolver< TAlgebra >::apply ( vector_type u)
virtual

◆ average_linear_steps()

template<typename TAlgebra >
double ug::NewtonSolver< TAlgebra >::average_linear_steps ( size_t  call) const

information on convergence history

◆ clear_average_convergence()

template<typename TAlgebra >
void ug::NewtonSolver< TAlgebra >::clear_average_convergence

resets average linear solver convergence

◆ clear_inner_step_update()

template<typename TAlgebra >
void ug::NewtonSolver< TAlgebra >::clear_inner_step_update ( SmartPtr< INewtonUpdate NU)
inline

clears inner step update

References ug::NewtonSolver< TAlgebra >::m_innerStepUpdate.

◆ clear_step_update()

template<typename TAlgebra >
void ug::NewtonSolver< TAlgebra >::clear_step_update ( SmartPtr< INewtonUpdate NU)
inline

clears outer step update

References ug::NewtonSolver< TAlgebra >::m_stepUpdate.

◆ config_string()

template<typename TAlgebra >
std::string ug::NewtonSolver< TAlgebra >::config_string
virtual

returns information about configuration parameters

this should return necessary information about parameters and possibly calling config_string of subcomponents.

Returns
std::string necessary information about configuration parameters

Implements ug::IOperatorInverse< TAlgebra::vector_type >.

References ug::ConfigShift().

◆ disable_line_search()

template<typename TAlgebra >
void ug::NewtonSolver< TAlgebra >::disable_line_search ( )
inline

◆ init()

template<typename TAlgebra >
bool ug::NewtonSolver< TAlgebra >::init ( SmartPtr< IOperator< vector_type > >  N)
virtual

This operator inverts the Operator N: Y -> X.

References NEWTON_PROFILE_BEGIN, and UG_THROW.

◆ last_num_newton_steps()

template<typename TAlgebra >
int ug::NewtonSolver< TAlgebra >::last_num_newton_steps ( ) const
inline

information on convergence history

References ug::NewtonSolver< TAlgebra >::m_lastNumSteps.

◆ line_search()

template<typename TAlgebra >
SmartPtr<ILineSearch<vector_type> > ug::NewtonSolver< TAlgebra >::line_search ( )
inline

◆ num_linsolver_calls()

template<typename TAlgebra >
int ug::NewtonSolver< TAlgebra >::num_linsolver_calls ( size_t  call) const

information on convergence history

◆ num_linsolver_steps()

template<typename TAlgebra >
int ug::NewtonSolver< TAlgebra >::num_linsolver_steps ( size_t  call) const

information on convergence history

◆ num_newton_steps()

template<typename TAlgebra >
size_t ug::NewtonSolver< TAlgebra >::num_newton_steps

information on convergence history

◆ prepare()

template<typename TAlgebra >
bool ug::NewtonSolver< TAlgebra >::prepare ( vector_type u)
virtual

prepare Operator

Implements ug::IOperatorInverse< TAlgebra::vector_type >.

◆ print_average_convergence()

template<typename TAlgebra >
void ug::NewtonSolver< TAlgebra >::print_average_convergence

prints average linear solver convergence

References UG_LOG.

◆ set_convergence_check()

template<typename TAlgebra >
void ug::NewtonSolver< TAlgebra >::set_convergence_check ( SmartPtr< IConvergenceCheck< vector_type > >  spConvCheck)

sets the convergence check

◆ set_line_search()

template<typename TAlgebra >
void ug::NewtonSolver< TAlgebra >::set_line_search ( SmartPtr< ILineSearch< vector_type > >  spLineSearch)
inline

sets the line search

References ug::NewtonSolver< TAlgebra >::m_spLineSearch.

◆ set_linear_solver()

template<typename TAlgebra >
void ug::NewtonSolver< TAlgebra >::set_linear_solver ( SmartPtr< ILinearOperatorInverse< vector_type > >  LinearSolver)
inline

sets the linear solver

References ug::NewtonSolver< TAlgebra >::m_spLinearSolver.

◆ set_reassemble_J_freq()

template<typename TAlgebra >
void ug::NewtonSolver< TAlgebra >::set_reassemble_J_freq ( int  freq)
inline

sets the frequency of reassembling of the Jacobian (0 == 1 == in every step, i.e. classically)

References ug::NewtonSolver< TAlgebra >::m_reassembe_J_freq.

◆ total_average_linear_steps()

template<typename TAlgebra >
double ug::NewtonSolver< TAlgebra >::total_average_linear_steps

information on convergence history

◆ total_linsolver_calls()

template<typename TAlgebra >
int ug::NewtonSolver< TAlgebra >::total_linsolver_calls

information on convergence history

◆ total_linsolver_steps()

template<typename TAlgebra >
int ug::NewtonSolver< TAlgebra >::total_linsolver_steps

information on convergence history

◆ write_debug() [1/2]

template<typename TAlgebra >
void ug::NewtonSolver< TAlgebra >::write_debug ( const matrix_type mat,
std::string  filename 
)
private

help functions for debug output

References name.

◆ write_debug() [2/2]

template<typename TAlgebra >
void ug::NewtonSolver< TAlgebra >::write_debug ( const vector_type vec,
std::string  filename 
)
privatevirtual

help functions for debug output

Reimplemented from ug::VectorDebugWritingObject< TAlgebra::vector_type >.

References name.

Member Data Documentation

◆ m_dgbCall

template<typename TAlgebra >
int ug::NewtonSolver< TAlgebra >::m_dgbCall
private

call counter

◆ m_innerStepUpdate

template<typename TAlgebra >
std::vector<SmartPtr<INewtonUpdate> > ug::NewtonSolver< TAlgebra >::m_innerStepUpdate
private

◆ m_J

template<typename TAlgebra >
SmartPtr<AssembledLinearOperator<algebra_type> > ug::NewtonSolver< TAlgebra >::m_J
private

jacobi operator

◆ m_lastNumSteps

template<typename TAlgebra >
int ug::NewtonSolver< TAlgebra >::m_lastNumSteps
private

◆ m_N

template<typename TAlgebra >
SmartPtr<AssembledOperator<algebra_type> > ug::NewtonSolver< TAlgebra >::m_N
private

assembling routine

◆ m_reassembe_J_freq

template<typename TAlgebra >
int ug::NewtonSolver< TAlgebra >::m_reassembe_J_freq
private

how often to reassemble the Jacobian (0 == 1 == in every step, i.e. classically)

Referenced by ug::NewtonSolver< TAlgebra >::set_reassemble_J_freq().

◆ m_spAss

template<typename TAlgebra >
SmartPtr<IAssemble<TAlgebra> > ug::NewtonSolver< TAlgebra >::m_spAss
private

assembling

◆ m_spConvCheck

template<typename TAlgebra >
SmartPtr<IConvergenceCheck<vector_type> > ug::NewtonSolver< TAlgebra >::m_spConvCheck
private

Convergence Check.

◆ m_spLinearSolver

template<typename TAlgebra >
SmartPtr<ILinearOperatorInverse<vector_type> > ug::NewtonSolver< TAlgebra >::m_spLinearSolver
private

◆ m_spLineSearch

◆ m_stepUpdate

template<typename TAlgebra >
std::vector<SmartPtr<INewtonUpdate> > ug::NewtonSolver< TAlgebra >::m_stepUpdate
private

◆ m_vLinSolverCalls

template<typename TAlgebra >
std::vector<int> ug::NewtonSolver< TAlgebra >::m_vLinSolverCalls
private

convergence history of linear solver

◆ m_vLinSolverRates

template<typename TAlgebra >
std::vector<number> ug::NewtonSolver< TAlgebra >::m_vLinSolverRates
private

convergence history of linear solver

◆ m_vNonLinSolverRates

template<typename TAlgebra >
std::vector<number> ug::NewtonSolver< TAlgebra >::m_vNonLinSolverRates
private

convergence history of linear solver

◆ m_vTotalLinSolverSteps

template<typename TAlgebra >
std::vector<int> ug::NewtonSolver< TAlgebra >::m_vTotalLinSolverSteps
private

convergence history of linear solver


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