ug4
ug::NestedIterationSolver< TDomain, TAlgebra > Class Template Reference

Nested iteration solver (e.g. for full multigrid) More...

#include <nested_iteration.h>

+ Inheritance diagram for ug::NestedIterationSolver< TDomain, TAlgebra >:

Public Types

typedef TAlgebra algebra_type
 Algebra type. More...
 
typedef GridFunction< TDomain, CPUAlgebraerror_function_type
 Error function type. More...
 
typedef GridFunction< TDomain, TAlgebra > grid_function_type
 GridFunction 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

virtual std::string config_string () const
 returns information about configuration parameters More...
 
 NestedIterationSolver ()
 default constructor More...
 
 NestedIterationSolver (SmartPtr< IAssemble< TAlgebra > > spAss)
 constructor using assembling More...
 
 NestedIterationSolver (SmartPtr< IAssemble< TAlgebra > > spAss, SmartPtr< IAssemble< TAlgebra > > spDomErr)
 constructor using assembling More...
 
 NestedIterationSolver (SmartPtr< ILinearOperatorInverse< vector_type > > LinearSolver)
 constructor More...
 
 NestedIterationSolver (SmartPtr< IOperator< vector_type > > N)
 constructor setting operator More...
 
void set_debug_elem_error (SmartPtr< error_function_type > spErrEta)
 
void set_linear_solver (SmartPtr< ILinearOperatorInverse< vector_type > > LinearSolver)
 sets the linear solver (this should be a fixed number of multi-grid cycles ) More...
 
IOperatorInverse interface
virtual bool init (SmartPtr< IOperator< vector_type > > N)
 
virtual bool prepare (vector_type &u)
 prepare Operator More...
 
virtual bool apply (vector_type &u)
 apply Operator, i.e. N^{-1}(0) = u More...
 
Adaptive refinement

for adaptive nested iteration

int top_level () const
 getter/setter for top level More...
 
void set_top_level (int lev)
 getter/setter for top level More...
 
int base_level () const
 getter/setter for base level More...
 
void set_base_level (int lev)
 getter/setter for top level More...
 
void set_refiner (SmartPtr< IRefiner > r)
 set grid refiner More...
 
void set_refinement_marking (SmartPtr< IElementMarkingStrategy< TDomain > > m)
 set marking strategy More...
 
void set_coarsening_marking (SmartPtr< IElementMarkingStrategy< TDomain > > m)
 getter/setter for top level More...
 
void set_tolerance (number tol)
 getter/setter for top level More...
 
bool use_adaptive_refinement () const
 indicates, if grids should be refined further (if desired accuracy has not been achieved) More...
 
void disable_adaptive_refinement ()
 disable grid refinement More...
 
void enable_adaptive_refinement ()
 enable grid refinement More...
 
void set_max_steps (int steps)
 getter/setter for top level More...
 
number last_error () const
 getter/setter for top level More...
 
void set_associated_space (SmartPtr< IGridFunctionSpace< grid_function_type > > spSpace)
 getter/setter for top level More...
 
void set_absolute_tolerance (number atol)
 getter/setter for top level More...
 
- 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...
 

Protected Member Functions

number coarsen_domain (const grid_function_type &u)
 Coarsen all elements. More...
 
void estimate_and_mark_domain (const grid_function_type &u, SmartPtr< IElementMarkingStrategy< TDomain > > spMarking, bool bClearMarks=true)
 Refines domain and provides error estimate. More...
 
number refine_domain (const grid_function_type &u)
 
- 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...
 
virtual void write_debug (const vector_type &vec, std::string name)
 writing debug output for a vector (if debug writer set) More...
 

Private Attributes

number m_absTOL
 absolute tolerance (for relative error) More...
 
int m_baseLevel
 
bool m_bUseAdaptiveRefinement
 
int m_dgbCall
 call counter More...
 
SmartPtr< AssembledLinearOperator< algebra_type > > m_J
 jacobi operator More...
 
number m_lastError
 
int m_lastNumSteps
 
int m_maxSteps
 
SmartPtr< AssembledOperator< algebra_type > > m_N
 assembling routine More...
 
SmartPtr< IAssemble< TAlgebra > > m_spAss
 assembling More...
 
SmartPtr< IGridFunctionSpace< grid_function_type > > m_spAssociatedSpace
 associated norm (for relative error) More...
 
SmartPtr< IElementMarkingStrategy< TDomain > > m_spCoarseningMarking
 
SmartPtr< IAssemble< TAlgebra > > m_spDomErr
 
SmartPtr< error_function_typem_spElemError
 (optional) debug info for adaptive refinement More...
 
SmartPtr< ILinearOperatorInverse< vector_type > > m_spLinearSolver
 linear solver More...
 
SmartPtr< IElementMarkingStrategy< TDomain > > m_spRefinementMarking
 
SmartPtr< IRefinerm_spRefiner
 (adaptive) refinement More...
 
number m_TOL
 tolerance More...
 
int m_topLevel
 

Additional Inherited Members

- 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 TDomain, typename TAlgebra>
class ug::NestedIterationSolver< TDomain, TAlgebra >

Nested iteration solver (e.g. for full multigrid)

If error estimators are available and the convergence rate of the FE/FV method is known, these methods allow to construct an optimal order method.

Member Typedef Documentation

◆ algebra_type

template<typename TDomain , typename TAlgebra >
typedef TAlgebra ug::NestedIterationSolver< TDomain, TAlgebra >::algebra_type

Algebra type.

◆ error_function_type

template<typename TDomain , typename TAlgebra >
typedef GridFunction<TDomain, CPUAlgebra> ug::NestedIterationSolver< TDomain, TAlgebra >::error_function_type

Error function type.

◆ grid_function_type

template<typename TDomain , typename TAlgebra >
typedef GridFunction<TDomain, TAlgebra> ug::NestedIterationSolver< TDomain, TAlgebra >::grid_function_type

GridFunction type.

◆ matrix_type

template<typename TDomain , typename TAlgebra >
typedef TAlgebra::matrix_type ug::NestedIterationSolver< TDomain, TAlgebra >::matrix_type

Matrix type.

◆ vector_type

template<typename TDomain , typename TAlgebra >
typedef TAlgebra::vector_type ug::NestedIterationSolver< TDomain, TAlgebra >::vector_type

Vector type.

Constructor & Destructor Documentation

◆ NestedIterationSolver() [1/5]

template<typename TDomain , typename TAlgebra >
ug::NestedIterationSolver< TDomain, TAlgebra >::NestedIterationSolver

default constructor

◆ NestedIterationSolver() [2/5]

template<typename TDomain , typename TAlgebra >
ug::NestedIterationSolver< TDomain, TAlgebra >::NestedIterationSolver ( SmartPtr< IOperator< vector_type > >  N)

constructor setting operator

References ug::NestedIterationSolver< TDomain, TAlgebra >::init().

◆ NestedIterationSolver() [3/5]

template<typename TDomain , typename TAlgebra >
ug::NestedIterationSolver< TDomain, TAlgebra >::NestedIterationSolver ( SmartPtr< IAssemble< TAlgebra > >  spAss)

◆ NestedIterationSolver() [4/5]

template<typename TDomain , typename TAlgebra >
ug::NestedIterationSolver< TDomain, TAlgebra >::NestedIterationSolver ( SmartPtr< IAssemble< TAlgebra > >  spAss,
SmartPtr< IAssemble< TAlgebra > >  spDomErr 
)

◆ NestedIterationSolver() [5/5]

template<typename TDomain , typename TAlgebra >
ug::NestedIterationSolver< TDomain, TAlgebra >::NestedIterationSolver ( SmartPtr< ILinearOperatorInverse< vector_type > >  LinearSolver)

constructor

Member Function Documentation

◆ apply()

template<typename TDomain , typename TAlgebra >
bool ug::NestedIterationSolver< TDomain, TAlgebra >::apply ( vector_type u)
virtual

◆ base_level()

template<typename TDomain , typename TAlgebra >
int ug::NestedIterationSolver< TDomain, TAlgebra >::base_level ( ) const
inline

getter/setter for base level

References ug::NestedIterationSolver< TDomain, TAlgebra >::m_baseLevel.

◆ coarsen_domain()

template<typename TDomain , typename TAlgebra >
number ug::NestedIterationSolver< TDomain, TAlgebra >::coarsen_domain ( const grid_function_type u)
protected

Coarsen all elements.

◆ config_string()

template<typename TDomain , typename TAlgebra >
std::string ug::NestedIterationSolver< TDomain, 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_adaptive_refinement()

template<typename TDomain , typename TAlgebra >
void ug::NestedIterationSolver< TDomain, TAlgebra >::disable_adaptive_refinement ( )
inline

◆ enable_adaptive_refinement()

template<typename TDomain , typename TAlgebra >
void ug::NestedIterationSolver< TDomain, TAlgebra >::enable_adaptive_refinement ( )
inline

◆ estimate_and_mark_domain()

template<typename TDomain , typename TAlgebra >
void ug::NestedIterationSolver< TDomain, TAlgebra >::estimate_and_mark_domain ( const grid_function_type u,
SmartPtr< IElementMarkingStrategy< TDomain > >  spMarking,
bool  bClearMarks = true 
)
protected

Refines domain and provides error estimate.

Values depend on m_spDomErr

References ug::GridFunction< TDomain, TAlgebra >::dd(), UG_ASSERT, UG_LOG, and SmartPtr< T, FreePolicy >::valid().

◆ init()

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

This operator inverts the Operator N: Y -> X

Requires an AssembledOperator

References NESTED_ITER_PROFILE_BEGIN, and UG_THROW.

Referenced by ug::NestedIterationSolver< TDomain, TAlgebra >::NestedIterationSolver().

◆ last_error()

template<typename TDomain , typename TAlgebra >
number ug::NestedIterationSolver< TDomain, TAlgebra >::last_error ( ) const
inline

getter/setter for top level

References ug::NestedIterationSolver< TDomain, TAlgebra >::m_lastError.

◆ prepare()

template<typename TDomain , typename TAlgebra >
bool ug::NestedIterationSolver< TDomain, TAlgebra >::prepare ( vector_type u)
virtual

prepare Operator

todo: remove from interface

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

◆ refine_domain()

template<typename TDomain , typename TAlgebra >
number ug::NestedIterationSolver< TDomain, TAlgebra >::refine_domain ( const grid_function_type u)
protected

◆ set_absolute_tolerance()

template<typename TDomain , typename TAlgebra >
void ug::NestedIterationSolver< TDomain, TAlgebra >::set_absolute_tolerance ( number  atol)
inline

getter/setter for top level

References ug::NestedIterationSolver< TDomain, TAlgebra >::m_absTOL, and UG_LOG.

◆ set_associated_space()

template<typename TDomain , typename TAlgebra >
void ug::NestedIterationSolver< TDomain, TAlgebra >::set_associated_space ( SmartPtr< IGridFunctionSpace< grid_function_type > >  spSpace)
inline

◆ set_base_level()

template<typename TDomain , typename TAlgebra >
void ug::NestedIterationSolver< TDomain, TAlgebra >::set_base_level ( int  lev)
inline

getter/setter for top level

References ug::NestedIterationSolver< TDomain, TAlgebra >::m_baseLevel.

◆ set_coarsening_marking()

template<typename TDomain , typename TAlgebra >
void ug::NestedIterationSolver< TDomain, TAlgebra >::set_coarsening_marking ( SmartPtr< IElementMarkingStrategy< TDomain > >  m)
inline

◆ set_debug_elem_error()

template<typename TDomain , typename TAlgebra >
void ug::NestedIterationSolver< TDomain, TAlgebra >::set_debug_elem_error ( SmartPtr< error_function_type spErrEta)
inline

◆ set_linear_solver()

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

sets the linear solver (this should be a fixed number of multi-grid cycles )

References ug::NestedIterationSolver< TDomain, TAlgebra >::m_spLinearSolver.

◆ set_max_steps()

template<typename TDomain , typename TAlgebra >
void ug::NestedIterationSolver< TDomain, TAlgebra >::set_max_steps ( int  steps)
inline

getter/setter for top level

References ug::NestedIterationSolver< TDomain, TAlgebra >::m_maxSteps.

◆ set_refinement_marking()

template<typename TDomain , typename TAlgebra >
void ug::NestedIterationSolver< TDomain, TAlgebra >::set_refinement_marking ( SmartPtr< IElementMarkingStrategy< TDomain > >  m)
inline

◆ set_refiner()

template<typename TDomain , typename TAlgebra >
void ug::NestedIterationSolver< TDomain, TAlgebra >::set_refiner ( SmartPtr< IRefiner r)
inline

◆ set_tolerance()

template<typename TDomain , typename TAlgebra >
void ug::NestedIterationSolver< TDomain, TAlgebra >::set_tolerance ( number  tol)
inline

getter/setter for top level

References ug::NestedIterationSolver< TDomain, TAlgebra >::m_TOL, and UG_LOG.

◆ set_top_level()

template<typename TDomain , typename TAlgebra >
void ug::NestedIterationSolver< TDomain, TAlgebra >::set_top_level ( int  lev)
inline

getter/setter for top level

References ug::NestedIterationSolver< TDomain, TAlgebra >::m_topLevel.

◆ top_level()

template<typename TDomain , typename TAlgebra >
int ug::NestedIterationSolver< TDomain, TAlgebra >::top_level ( ) const
inline

getter/setter for top level

References ug::NestedIterationSolver< TDomain, TAlgebra >::m_topLevel.

◆ use_adaptive_refinement()

template<typename TDomain , typename TAlgebra >
bool ug::NestedIterationSolver< TDomain, TAlgebra >::use_adaptive_refinement ( ) const
inline

indicates, if grids should be refined further (if desired accuracy has not been achieved)

References ug::NestedIterationSolver< TDomain, TAlgebra >::m_bUseAdaptiveRefinement.

Member Data Documentation

◆ m_absTOL

template<typename TDomain , typename TAlgebra >
number ug::NestedIterationSolver< TDomain, TAlgebra >::m_absTOL
private

absolute tolerance (for relative error)

Referenced by ug::NestedIterationSolver< TDomain, TAlgebra >::set_absolute_tolerance().

◆ m_baseLevel

template<typename TDomain , typename TAlgebra >
int ug::NestedIterationSolver< TDomain, TAlgebra >::m_baseLevel
private

◆ m_bUseAdaptiveRefinement

◆ m_dgbCall

template<typename TDomain , typename TAlgebra >
int ug::NestedIterationSolver< TDomain, TAlgebra >::m_dgbCall
private

call counter

◆ m_J

template<typename TDomain , typename TAlgebra >
SmartPtr<AssembledLinearOperator<algebra_type> > ug::NestedIterationSolver< TDomain, TAlgebra >::m_J
private

jacobi operator

◆ m_lastError

template<typename TDomain , typename TAlgebra >
number ug::NestedIterationSolver< TDomain, TAlgebra >::m_lastError
private

◆ m_lastNumSteps

template<typename TDomain , typename TAlgebra >
int ug::NestedIterationSolver< TDomain, TAlgebra >::m_lastNumSteps
private

◆ m_maxSteps

template<typename TDomain , typename TAlgebra >
int ug::NestedIterationSolver< TDomain, TAlgebra >::m_maxSteps
private

◆ m_N

template<typename TDomain , typename TAlgebra >
SmartPtr<AssembledOperator<algebra_type> > ug::NestedIterationSolver< TDomain, TAlgebra >::m_N
private

◆ m_spAss

template<typename TDomain , typename TAlgebra >
SmartPtr<IAssemble<TAlgebra> > ug::NestedIterationSolver< TDomain, TAlgebra >::m_spAss
private

◆ m_spAssociatedSpace

template<typename TDomain , typename TAlgebra >
SmartPtr<IGridFunctionSpace<grid_function_type> > ug::NestedIterationSolver< TDomain, TAlgebra >::m_spAssociatedSpace
private

associated norm (for relative error)

Referenced by ug::NestedIterationSolver< TDomain, TAlgebra >::set_associated_space().

◆ m_spCoarseningMarking

template<typename TDomain , typename TAlgebra >
SmartPtr<IElementMarkingStrategy<TDomain> > ug::NestedIterationSolver< TDomain, TAlgebra >::m_spCoarseningMarking
private

◆ m_spDomErr

template<typename TDomain , typename TAlgebra >
SmartPtr<IAssemble<TAlgebra> > ug::NestedIterationSolver< TDomain, TAlgebra >::m_spDomErr
private

◆ m_spElemError

template<typename TDomain , typename TAlgebra >
SmartPtr<error_function_type> ug::NestedIterationSolver< TDomain, TAlgebra >::m_spElemError
private

(optional) debug info for adaptive refinement

Referenced by ug::NestedIterationSolver< TDomain, TAlgebra >::set_debug_elem_error().

◆ m_spLinearSolver

template<typename TDomain , typename TAlgebra >
SmartPtr<ILinearOperatorInverse<vector_type> > ug::NestedIterationSolver< TDomain, TAlgebra >::m_spLinearSolver
private

◆ m_spRefinementMarking

template<typename TDomain , typename TAlgebra >
SmartPtr<IElementMarkingStrategy<TDomain> > ug::NestedIterationSolver< TDomain, TAlgebra >::m_spRefinementMarking
private

◆ m_spRefiner

template<typename TDomain , typename TAlgebra >
SmartPtr<IRefiner> ug::NestedIterationSolver< TDomain, TAlgebra >::m_spRefiner
private

◆ m_TOL

template<typename TDomain , typename TAlgebra >
number ug::NestedIterationSolver< TDomain, TAlgebra >::m_TOL
private

◆ m_topLevel

template<typename TDomain , typename TAlgebra >
int ug::NestedIterationSolver< TDomain, TAlgebra >::m_topLevel
private

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