ug4
ug::CompositeConvCheck< TVector, TDomain > Class Template Reference

#include <composite_conv_check.h>

+ Inheritance diagram for ug::CompositeConvCheck< TVector, TDomain >:

Classes

struct  CmpInfo
 
struct  NativCmpInfo
 

Public Member Functions

number avg_rate () const
 
virtual SmartPtr< IConvergenceCheck< TVector > > clone ()
 clones this instance More...
 
virtual std::string config_string () const
 returns information about configuration parameters More...
 
number defect () const
 returns the current defect More...
 
void disable_rest_check ()
 disables rest check More...
 
int get_offset () const
 output More...
 
bool iteration_ended ()
 
bool post ()
 
void print_line (std::string line)
 prints a line using prefixes More...
 
number rate () const
 
number reduction () const
 
void set_adaptive (bool adapt)
 whether or not the underlying approximatioon space is adaptive More...
 
void set_all_component_check (const number minDefect, const number relReduction)
 sets check for all components in approximation space More...
 
void set_info (std::string info)
 sets info string More...
 
void set_level (int level)
 set level of grid, where defect vectors come from More...
 
void set_maximum_steps (int maxSteps)
 sets maximum number of iteration steps More...
 
void set_name (std::string name)
 sets the name of the iteration More...
 
void set_offset (int offset)
 sets the number of spaces printed before output information More...
 
void set_rest_check (number minDefect, number relReduction)
 sets default values for non-explicitly specified cmps More...
 
void set_supress_unsuccessful (bool bsupress)
 set whether always to report success when max iter is reached (useful for LIMEX) More...
 
void set_symbol (char symbol)
 sets the symbol used for output More...
 
void set_time_measurement (bool yesOrNo)
 enables time measurement More...
 
void set_verbose (bool level)
 sets if verbose More...
 
void start (const TVector &d)
 computes the start defect and set it More...
 
void start_defect (number initialDefect)
 defect control More...
 
int step () const
 information about current status More...
 
void update (const TVector &d)
 computes the defect and sets it a the next defect value More...
 
void update_defect (number newDefect)
 sets the update for the current defect More...
 
virtual ~CompositeConvCheck ()
 destructor More...
 
 CompositeConvCheck (SmartPtr< ApproximationSpace< TDomain > > approx)
 
 CompositeConvCheck (SmartPtr< ApproximationSpace< TDomain > > spApproxSpace, int maxSteps, number minDefect, number relReduction)
 
void set_component_check (const std::string &vFctName, const std::vector< number > &vMinDefect, const std::vector< number > &vRelReduction)
 
void set_component_check (const std::vector< std::string > &vFctName, const std::vector< number > &vMinDefect, const std::vector< number > &vRelReduction)
 
void set_component_check (const std::vector< std::string > &vFctName, const number minDefect, const number relReduction)
 
void set_component_check (const std::string &fctName, const number minDefect, const number relReduction)
 
void set_group_check (const std::vector< std::string > &vFctName, const number minDefect, const number relReduction)
 
void set_group_check (const std::string &fctNames, const number minDefect, const number relReduction)
 
- Public Member Functions inherited from ug::IConvergenceCheck< TVector >
virtual ~IConvergenceCheck ()
 virtual destructor More...
 

Protected Member Functions

number defect_all () const
 returns defect for all components More...
 
template<typename TBaseElem >
void extract_dof_indices (ConstSmartPtr< DoFDistribution > dd)
 extracts multi-indices for a fct-comp on a element type More...
 
void extract_dof_indices (ConstSmartPtr< DoFDistribution > dd)
 extracts multi-indices from dof distribution More...
 
const std::string & fctName (size_t i)
 
number initial_defect_all () const
 returns initial defect for all components More...
 
bool is_valid_number (number value)
 
number last_defect_all () const
 returns last defect for all components More...
 
number norm (const TVector &vec, const std::vector< DoFIndex > &index)
 calculates the 2-norm of the entries of the vector vec specified by index More...
 
void print_offset ()
 
void update_rest_check ()
 

Protected Attributes

bool m_bAdaptive
 adaptivity flag More...
 
bool m_bCheckRest
 default Values More...
 
bool m_bTimeMeas
 enables time measurement More...
 
std::vector< CmpInfom_CmpInfo
 infos for each component More...
 
int m_currentStep
 current step More...
 
std::string m_info
 info for iteration (e.g. preconditioner type) More...
 
int m_maxSteps
 maximum number of steps to be performed More...
 
std::string m_name
 name of iteration More...
 
size_t m_numAllDoFs
 
int m_offset
 number of spaces inserted before output More...
 
number m_restMinDefect
 
number m_restRelReduction
 
SmartPtr< ApproximationSpace< TDomain > > m_spApprox
 ApproxSpace. More...
 
Stopwatch m_stopwatch
 a stopwatch More...
 
bool m_supress_unsuccessful
 whether to always report success once max iter is reached More...
 
char m_symbol
 symbol for output appearance More...
 
bool m_verbose
 verbose level More...
 
std::vector< NativCmpInfom_vNativCmpInfo
 info on natural components More...
 

Detailed Description

template<class TVector, class TDomain>
class ug::CompositeConvCheck< TVector, TDomain >

CompositeConvCheck

This is an implementation of the convergence check interface, that makes it possible to define required defect reductions on the individual functions constituting the overall solution.

Constructor & Destructor Documentation

◆ CompositeConvCheck() [1/2]

template<class TVector , class TDomain >
ug::CompositeConvCheck< TVector, TDomain >::CompositeConvCheck ( SmartPtr< ApproximationSpace< TDomain > >  approx)

◆ CompositeConvCheck() [2/2]

template<class TVector , class TDomain >
ug::CompositeConvCheck< TVector, TDomain >::CompositeConvCheck ( SmartPtr< ApproximationSpace< TDomain > >  spApproxSpace,
int  maxSteps,
number  minDefect,
number  relReduction 
)

◆ ~CompositeConvCheck()

template<class TVector , class TDomain >
virtual ug::CompositeConvCheck< TVector, TDomain >::~CompositeConvCheck ( )
inlinevirtual

destructor

Member Function Documentation

◆ avg_rate()

◆ clone()

template<class TVector , class TDomain >
SmartPtr< IConvergenceCheck< TVector > > ug::CompositeConvCheck< TVector, TDomain >::clone
virtual

clones this instance

Implements ug::IConvergenceCheck< TVector >.

◆ config_string()

template<class TVector , class TDomain >
virtual std::string ug::CompositeConvCheck< TVector, TDomain >::config_string ( ) const
inlinevirtual

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::IConvergenceCheck< TVector >.

References ug::CompositeConvCheck< TVector, TDomain >::m_CmpInfo, and ug::CompositeConvCheck< TVector, TDomain >::m_maxSteps.

◆ defect()

◆ defect_all()

◆ disable_rest_check()

template<class TVector , class TDomain >
void ug::CompositeConvCheck< TVector, TDomain >::disable_rest_check ( )
inline

◆ extract_dof_indices() [1/2]

template<class TVector , class TDomain >
template<typename TBaseElem >
void ug::CompositeConvCheck< TVector, TDomain >::extract_dof_indices ( ConstSmartPtr< DoFDistribution dd)
protected

◆ extract_dof_indices() [2/2]

template<class TVector , class TDomain >
void ug::CompositeConvCheck< TVector, TDomain >::extract_dof_indices ( ConstSmartPtr< DoFDistribution dd)
protected

extracts multi-indices from dof distribution

References ug::EDGE, ug::FACE, name, ug::VERTEX, and ug::VOLUME.

◆ fctName()

template<class TVector , class TDomain >
const std::string& ug::CompositeConvCheck< TVector, TDomain >::fctName ( size_t  i)
inlineprotected

◆ get_offset()

template<class TVector , class TDomain >
int ug::CompositeConvCheck< TVector, TDomain >::get_offset ( ) const
inlinevirtual

◆ initial_defect_all()

template<class TVector , class TDomain >
number ug::CompositeConvCheck< TVector, TDomain >::initial_defect_all ( ) const
inlineprotected

◆ is_valid_number()

template<class TVector , class TDomain >
bool ug::CompositeConvCheck< TVector, TDomain >::is_valid_number ( number  value)
protected

◆ iteration_ended()

template<class TVector , class TDomain >
bool ug::CompositeConvCheck< TVector, TDomain >::iteration_ended ( )
virtual

iteration_ended

Checks if the iteration must be ended. This can be due to convergence or divergence.

Returns
true if iteration ended false if iteration can and must be continued until convergence

Implements ug::IConvergenceCheck< TVector >.

References ug::CompositeConvCheck< TVector, TDomain >::CmpInfo::currDefect, ug::CompositeConvCheck< TVector, TDomain >::CmpInfo::initDefect, ug::CompositeConvCheck< TVector, TDomain >::CmpInfo::minDefect, and ug::CompositeConvCheck< TVector, TDomain >::CmpInfo::relReduction.

◆ last_defect_all()

template<class TVector , class TDomain >
number ug::CompositeConvCheck< TVector, TDomain >::last_defect_all ( ) const
inlineprotected

◆ norm()

template<class TVector , class TDomain >
number ug::CompositeConvCheck< TVector, TDomain >::norm ( const TVector &  vec,
const std::vector< DoFIndex > &  index 
)
protected

calculates the 2-norm of the entries of the vector vec specified by index

References pcl::ProcessCommunicator::allreduce(), ug::DoFRef(), PCL_RO_SUM, ug::PST_UNIQUE, and UG_THROW.

◆ post()

template<class TVector , class TDomain >
bool ug::CompositeConvCheck< TVector, TDomain >::post ( )
virtual

post

post-processes the iteration. Some informative outputs of the status of the iteration after finishing the iteration can be placed here

Returns
true if iteration was successful false if iteration did not lead to a satisfying result

Implements ug::IConvergenceCheck< TVector >.

References ug::CompositeConvCheck< TVector, TDomain >::CmpInfo::currDefect, ug::CompositeConvCheck< TVector, TDomain >::CmpInfo::initDefect, ug::CompositeConvCheck< TVector, TDomain >::CmpInfo::minDefect, ug::CompositeConvCheck< TVector, TDomain >::CmpInfo::name, ug::CompositeConvCheck< TVector, TDomain >::CmpInfo::relReduction, ug::repeat(), and UG_LOG.

◆ print_line()

template<class TVector , class TDomain >
void ug::CompositeConvCheck< TVector, TDomain >::print_line ( std::string  line)
virtual

prints a line using prefixes

Implements ug::IConvergenceCheck< TVector >.

References UG_LOG.

◆ print_offset()

template<class TVector , class TDomain >
void ug::CompositeConvCheck< TVector, TDomain >::print_offset
protected

References ug::repeat(), and UG_LOG.

◆ rate()

template<class TVector , class TDomain >
number ug::CompositeConvCheck< TVector, TDomain >::rate ( ) const
inlinevirtual

◆ reduction()

template<class TVector , class TDomain >
number ug::CompositeConvCheck< TVector, TDomain >::reduction ( ) const
inlinevirtual

◆ set_adaptive()

template<class TVector , class TDomain >
void ug::CompositeConvCheck< TVector, TDomain >::set_adaptive ( bool  adapt)
inline

whether or not the underlying approximatioon space is adaptive

References ug::CompositeConvCheck< TVector, TDomain >::m_bAdaptive.

◆ set_all_component_check()

template<class TVector , class TDomain >
void ug::CompositeConvCheck< TVector, TDomain >::set_all_component_check ( const number  minDefect,
const number  relReduction 
)

sets check for all components in approximation space

References name.

◆ set_component_check() [1/4]

template<class TVector , class TDomain >
void ug::CompositeConvCheck< TVector, TDomain >::set_component_check ( const std::string &  fctName,
const number  minDefect,
const number  relReduction 
)

sets check for single component

References ug::TokenizeTrimString().

◆ set_component_check() [2/4]

template<class TVector , class TDomain >
void ug::CompositeConvCheck< TVector, TDomain >::set_component_check ( const std::string &  vFctName,
const std::vector< number > &  vMinDefect,
const std::vector< number > &  vRelReduction 
)

sets check for single component

References ug::TokenizeTrimString().

◆ set_component_check() [3/4]

template<class TVector , class TDomain >
void ug::CompositeConvCheck< TVector, TDomain >::set_component_check ( const std::vector< std::string > &  vFctName,
const number  minDefect,
const number  relReduction 
)

sets check for single component

◆ set_component_check() [4/4]

template<class TVector , class TDomain >
void ug::CompositeConvCheck< TVector, TDomain >::set_component_check ( const std::vector< std::string > &  vFctName,
const std::vector< number > &  vMinDefect,
const std::vector< number > &  vRelReduction 
)

sets check for single component

References UG_THROW.

◆ set_group_check() [1/2]

template<class TVector , class TDomain >
void ug::CompositeConvCheck< TVector, TDomain >::set_group_check ( const std::string &  fctNames,
const number  minDefect,
const number  relReduction 
)

sets check for group of components

References ug::TokenizeTrimString().

◆ set_group_check() [2/2]

template<class TVector , class TDomain >
void ug::CompositeConvCheck< TVector, TDomain >::set_group_check ( const std::vector< std::string > &  vFctName,
const number  minDefect,
const number  relReduction 
)

sets check for group of components

References name, and ug::TrimString().

◆ set_info()

template<class TVector , class TDomain >
void ug::CompositeConvCheck< TVector, TDomain >::set_info ( std::string  name)
inlinevirtual

◆ set_level()

template<class TVector , class TDomain >
void ug::CompositeConvCheck< TVector, TDomain >::set_level ( int  level)

set level of grid, where defect vectors come from

References ug::GridLevel::SURFACE.

Referenced by ug::CompositeConvCheck< TVector, TDomain >::CompositeConvCheck().

◆ set_maximum_steps()

template<class TVector , class TDomain >
void ug::CompositeConvCheck< TVector, TDomain >::set_maximum_steps ( int  maxSteps)
inline

sets maximum number of iteration steps

References ug::CompositeConvCheck< TVector, TDomain >::m_maxSteps.

◆ set_name()

template<class TVector , class TDomain >
void ug::CompositeConvCheck< TVector, TDomain >::set_name ( std::string  name)
inlinevirtual

sets the name of the iteration

Implements ug::IConvergenceCheck< TVector >.

References ug::CompositeConvCheck< TVector, TDomain >::m_name, and name.

◆ set_offset()

template<class TVector , class TDomain >
void ug::CompositeConvCheck< TVector, TDomain >::set_offset ( int  offset)
inlinevirtual

sets the number of spaces printed before output information

Implements ug::IConvergenceCheck< TVector >.

References ug::CompositeConvCheck< TVector, TDomain >::m_offset.

◆ set_rest_check()

template<class TVector , class TDomain >
void ug::CompositeConvCheck< TVector, TDomain >::set_rest_check ( number  minDefect,
number  relReduction 
)
inline

◆ set_supress_unsuccessful()

template<class TVector , class TDomain >
void ug::CompositeConvCheck< TVector, TDomain >::set_supress_unsuccessful ( bool  bsupress)
inline

set whether always to report success when max iter is reached (useful for LIMEX)

References ug::CompositeConvCheck< TVector, TDomain >::m_supress_unsuccessful.

◆ set_symbol()

template<class TVector , class TDomain >
void ug::CompositeConvCheck< TVector, TDomain >::set_symbol ( char  symbol)
inlinevirtual

sets the symbol used for output

Implements ug::IConvergenceCheck< TVector >.

References ug::CompositeConvCheck< TVector, TDomain >::m_symbol.

◆ set_time_measurement()

template<class TVector , class TDomain >
void ug::CompositeConvCheck< TVector, TDomain >::set_time_measurement ( bool  yesOrNo)
inline

enables time measurement

References ug::CompositeConvCheck< TVector, TDomain >::m_bTimeMeas.

◆ set_verbose()

template<class TVector , class TDomain >
void ug::CompositeConvCheck< TVector, TDomain >::set_verbose ( bool  level)
inline

◆ start()

◆ start_defect()

template<class TVector , class TDomain >
void ug::CompositeConvCheck< TVector, TDomain >::start_defect ( number  initialDefect)
virtual

defect control

Implements ug::IConvergenceCheck< TVector >.

References UG_THROW.

◆ step()

template<class TVector , class TDomain >
int ug::CompositeConvCheck< TVector, TDomain >::step ( ) const
inlinevirtual

information about current status

Implements ug::IConvergenceCheck< TVector >.

References ug::CompositeConvCheck< TVector, TDomain >::m_currentStep.

◆ update()

◆ update_defect()

template<class TVector , class TDomain >
void ug::CompositeConvCheck< TVector, TDomain >::update_defect ( number  defect)
virtual

sets the update for the current defect

Implements ug::IConvergenceCheck< TVector >.

References UG_THROW.

◆ update_rest_check()

template<class TVector , class TDomain >
void ug::CompositeConvCheck< TVector, TDomain >::update_rest_check
protected

Member Data Documentation

◆ m_bAdaptive

template<class TVector , class TDomain >
bool ug::CompositeConvCheck< TVector, TDomain >::m_bAdaptive
protected

◆ m_bCheckRest

template<class TVector , class TDomain >
bool ug::CompositeConvCheck< TVector, TDomain >::m_bCheckRest
protected

◆ m_bTimeMeas

template<class TVector , class TDomain >
bool ug::CompositeConvCheck< TVector, TDomain >::m_bTimeMeas
protected

◆ m_CmpInfo

template<class TVector , class TDomain >
std::vector<CmpInfo> ug::CompositeConvCheck< TVector, TDomain >::m_CmpInfo
protected

◆ m_currentStep

template<class TVector , class TDomain >
int ug::CompositeConvCheck< TVector, TDomain >::m_currentStep
protected

◆ m_info

template<class TVector , class TDomain >
std::string ug::CompositeConvCheck< TVector, TDomain >::m_info
protected

info for iteration (e.g. preconditioner type)

Referenced by ug::CompositeConvCheck< TVector, TDomain >::set_info().

◆ m_maxSteps

template<class TVector , class TDomain >
int ug::CompositeConvCheck< TVector, TDomain >::m_maxSteps
protected

◆ m_name

template<class TVector , class TDomain >
std::string ug::CompositeConvCheck< TVector, TDomain >::m_name
protected

◆ m_numAllDoFs

template<class TVector , class TDomain >
size_t ug::CompositeConvCheck< TVector, TDomain >::m_numAllDoFs
protected

◆ m_offset

template<class TVector , class TDomain >
int ug::CompositeConvCheck< TVector, TDomain >::m_offset
protected

◆ m_restMinDefect

template<class TVector , class TDomain >
number ug::CompositeConvCheck< TVector, TDomain >::m_restMinDefect
protected

◆ m_restRelReduction

template<class TVector , class TDomain >
number ug::CompositeConvCheck< TVector, TDomain >::m_restRelReduction
protected

◆ m_spApprox

template<class TVector , class TDomain >
SmartPtr<ApproximationSpace<TDomain> > ug::CompositeConvCheck< TVector, TDomain >::m_spApprox
protected

ApproxSpace.

◆ m_stopwatch

template<class TVector , class TDomain >
Stopwatch ug::CompositeConvCheck< TVector, TDomain >::m_stopwatch
protected

a stopwatch

◆ m_supress_unsuccessful

template<class TVector , class TDomain >
bool ug::CompositeConvCheck< TVector, TDomain >::m_supress_unsuccessful
protected

whether to always report success once max iter is reached

Referenced by ug::CompositeConvCheck< TVector, TDomain >::set_supress_unsuccessful().

◆ m_symbol

template<class TVector , class TDomain >
char ug::CompositeConvCheck< TVector, TDomain >::m_symbol
protected

symbol for output appearance

Referenced by ug::CompositeConvCheck< TVector, TDomain >::set_symbol().

◆ m_verbose

template<class TVector , class TDomain >
bool ug::CompositeConvCheck< TVector, TDomain >::m_verbose
protected

◆ m_vNativCmpInfo

template<class TVector , class TDomain >
std::vector<NativCmpInfo> ug::CompositeConvCheck< TVector, TDomain >::m_vNativCmpInfo
protected

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