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

Standard Prolongation Operator. More...

#include <std_transfer.h>

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

Classes

struct  TransferKey
 struct to distinguish already assembled operators More...
 

Public Types

typedef TAlgebra algebra_type
 Type of Algebra. More...
 
typedef ITransferOperator< TDomain, TAlgebra > base_type
 Type of base class. More...
 
typedef TDomain domain_type
 Type of Domain. More...
 
typedef GridFunction< TDomain, TAlgebra > GF
 Type of GridFunction. 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::ITransferOperator< TDomain, TAlgebra >
typedef TDomain domain_type
 Domain type. More...
 
typedef TAlgebra::matrix_type matrix_type
 Matrix type. More...
 
typedef TAlgebra::vector_type vector_type
 Vector type. More...
 

Public Member Functions

virtual SmartPtr< ITransferOperator< TDomain, TAlgebra > > clone ()
 returns new instance with same setting More...
 
void do_restrict (GF &uCoarse, const GF &uFine)
 apply operator to a grid function More...
 
virtual void do_restrict (vector_type &uCoarse, const vector_type &uFine)
 apply transposed Operator, restrict function More...
 
void enable_p1_lagrange_optimization (bool enable)
 enables/disables an assembling optimization for p1-lagrange elements More...
 
virtual void init ()
 initialize the operator More...
 
bool p1_lagrange_optimization_enabled () const
 
void prolongate (GF &uFine, const GF &uCoarse)
 apply operator to a grid function More...
 
virtual void prolongate (vector_type &uFine, const vector_type &uCoarse)
 apply Operator, interpolate function More...
 
virtual SmartPtr< matrix_typeprolongation (const GridLevel &fineGL, const GridLevel &coarseGL, ConstSmartPtr< ApproximationSpace< TDomain > > spApproxSpace)
 returns prolongation as a matrix More...
 
virtual SmartPtr< matrix_typerestriction (const GridLevel &coarseGL, const GridLevel &fineGL, ConstSmartPtr< ApproximationSpace< TDomain > > spApproxSpace)
 returns restriction as a matrix More...
 
void set_debug (SmartPtr< IDebugWriter< TAlgebra > > spDebugWriter)
 set debug writer More...
 
virtual void set_levels (GridLevel coarseLevel, GridLevel fineLevel)
 Set levels. More...
 
void set_prolongation_damping (number damp)
 set prolongation damping (only applied on vector operation, not (!!) in assembled matrices) More...
 
void set_restriction_damping (number damp)
 set restriction damping (only applied on vector operation, not (!!) in assembled matrices) More...
 
void set_use_transposed (bool bTransposed)
 sets if restriction and prolongation are transposed More...
 
 StdTransfer ()
 Default constructor. More...
 
virtual ~StdTransfer ()
 virtual destructor More...
 
- Public Member Functions inherited from ug::ITransferOperator< TDomain, TAlgebra >
virtual void add_constraint (SmartPtr< IConstraint< TAlgebra > > pp)
 adds a dirichlet post process (not added if already registered) More...
 
virtual void clear_constraints ()
 clears dirichlet post processes More...
 
 ITransferOperator ()
 constructor More...
 
virtual void remove_constraint (SmartPtr< IConstraint< TAlgebra > > pp)
 removes a post process More...
 
virtual ~ITransferOperator ()
 virtual destructor More...
 

Protected Types

typedef std::map< TransferKey, SmartPtr< matrix_type > > TransferMap
 

Protected Member Functions

template<typename TChild >
void assemble_prolongation (matrix_type &mat, const DoFDistribution &fineDD, const DoFDistribution &coarseDD, ConstSmartPtr< TDomain > spDomain)
 
void assemble_prolongation (matrix_type &mat, const DoFDistribution &fineDD, const DoFDistribution &coarseDD, ConstSmartPtr< TDomain > spDomain)
 
void assemble_prolongation_p1 (matrix_type &mat, const DoFDistribution &fineDD, const DoFDistribution &coarseDD)
 
template<typename TChild >
void assemble_restriction (matrix_type &mat, const DoFDistribution &coarseDD, const DoFDistribution &fineDD, ConstSmartPtr< TDomain > spDomain)
 
void assemble_restriction (matrix_type &mat, const DoFDistribution &coarseDD, const DoFDistribution &fineDD, ConstSmartPtr< TDomain > spDomain)
 
void remove_outdated (TransferMap &map, const RevisionCounter &revCnt)
 
void write_debug (const matrix_type &mat, std::string name, const GridLevel &glTo, const GridLevel &glFrom)
 debug writing of matrix More...
 

Protected Attributes

bool bCached
 flag if cached (matrix) transfer used More...
 
bool m_bUseTransposed
 flag if transposed is used More...
 
number m_dampProl
 
number m_dampRes
 damping parameter More...
 
TransferMap m_mProlongation
 
TransferMap m_mRestriction
 
bool m_p1LagrangeOptimizationEnabled
 flag for p1-lagrange-optimization More...
 
SmartPtr< IDebugWriter< TAlgebra > > m_spDebugWriter
 debug writer More...
 
std::vector< SmartPtr< IConstraint< TAlgebra > > > m_vConstraint
 list of post processes More...
 
- Protected Attributes inherited from ug::ITransferOperator< TDomain, TAlgebra >
std::vector< SmartPtr< IConstraint< TAlgebra > > > m_vConstraint
 list of post processes More...
 

Detailed Description

template<typename TDomain, typename TAlgebra>
class ug::StdTransfer< TDomain, TAlgebra >

Standard Prolongation Operator.

By default a special optimization is performed for p1-lagrange-elements. This optimization is only valid if all elements have been refined with standard refinement rules. If closure elements are generated, this optimization has to be deactivated (use StdTransfer::enable_p1_lagrange_optimization(false)).

Member Typedef Documentation

◆ algebra_type

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

Type of Algebra.

◆ base_type

template<typename TDomain , typename TAlgebra >
typedef ITransferOperator<TDomain, TAlgebra> ug::StdTransfer< TDomain, TAlgebra >::base_type

Type of base class.

◆ domain_type

template<typename TDomain , typename TAlgebra >
typedef TDomain ug::StdTransfer< TDomain, TAlgebra >::domain_type

Type of Domain.

◆ GF

template<typename TDomain , typename TAlgebra >
typedef GridFunction<TDomain, TAlgebra> ug::StdTransfer< TDomain, TAlgebra >::GF

Type of GridFunction.

◆ matrix_type

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

Type of Matrix.

◆ TransferMap

template<typename TDomain , typename TAlgebra >
typedef std::map<TransferKey, SmartPtr<matrix_type> > ug::StdTransfer< TDomain, TAlgebra >::TransferMap
protected

◆ vector_type

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

Type of Vector.

Constructor & Destructor Documentation

◆ StdTransfer()

template<typename TDomain , typename TAlgebra >
ug::StdTransfer< TDomain, TAlgebra >::StdTransfer ( )
inline

Default constructor.

◆ ~StdTransfer()

template<typename TDomain , typename TAlgebra >
virtual ug::StdTransfer< TDomain, TAlgebra >::~StdTransfer ( )
inlinevirtual

virtual destructor

Member Function Documentation

◆ assemble_prolongation() [1/2]

◆ assemble_prolongation() [2/2]

template<typename TDomain , typename TAlgebra >
void ug::StdTransfer< TDomain, TAlgebra >::assemble_prolongation ( matrix_type mat,
const DoFDistribution fineDD,
const DoFDistribution coarseDD,
ConstSmartPtr< TDomain >  spDomain 
)
protected

◆ assemble_prolongation_p1()

◆ assemble_restriction() [1/2]

◆ assemble_restriction() [2/2]

template<typename TDomain , typename TAlgebra >
void ug::StdTransfer< TDomain, TAlgebra >::assemble_restriction ( matrix_type mat,
const DoFDistribution coarseDD,
const DoFDistribution fineDD,
ConstSmartPtr< TDomain >  spDomain 
)
protected

◆ clone()

template<typename TDomain , typename TAlgebra >
SmartPtr< ITransferOperator< TDomain, TAlgebra > > ug::StdTransfer< TDomain, TAlgebra >::clone
virtual

returns new instance with same setting

Implements ug::ITransferOperator< TDomain, TAlgebra >.

Reimplemented in ug::TruncatedMonotoneTransfer< TDomain, TAlgebra >.

◆ do_restrict() [1/2]

template<typename TDomain , typename TAlgebra >
void ug::StdTransfer< TDomain, TAlgebra >::do_restrict ( GF uCoarse,
const GF uFine 
)

◆ do_restrict() [2/2]

template<typename TDomain , typename TAlgebra >
virtual void ug::StdTransfer< TDomain, TAlgebra >::do_restrict ( vector_type uCoarse,
const vector_type uFine 
)
inlinevirtual

apply transposed Operator, restrict function

Implements ug::ITransferOperator< TDomain, TAlgebra >.

References UG_THROW.

◆ enable_p1_lagrange_optimization()

template<typename TDomain , typename TAlgebra >
void ug::StdTransfer< TDomain, TAlgebra >::enable_p1_lagrange_optimization ( bool  enable)
inline

enables/disables an assembling optimization for p1-lagrange elements

The optimization is enabled by default. It can however only be used, if all elements are refined with their standard refinement rule. If one uses anisotropic refinement or refinement with closure, the optimization should be disabled.

Todo:
The normal assembling strategy should be optimized in such a way that the p1-lagrange optimization is no longer required. This however involves something like a ref-type-hash for each element, which returns a unique number based on the types and order of children.

References ug::StdTransfer< TDomain, TAlgebra >::m_p1LagrangeOptimizationEnabled.

◆ init()

template<typename TDomain , typename TAlgebra >
virtual void ug::StdTransfer< TDomain, TAlgebra >::init ( )
inlinevirtual

◆ p1_lagrange_optimization_enabled()

template<typename TDomain , typename TAlgebra >
bool ug::StdTransfer< TDomain, TAlgebra >::p1_lagrange_optimization_enabled ( ) const
inline

◆ prolongate() [1/2]

◆ prolongate() [2/2]

template<typename TDomain , typename TAlgebra >
virtual void ug::StdTransfer< TDomain, TAlgebra >::prolongate ( vector_type uFine,
const vector_type uCoarse 
)
inlinevirtual

apply Operator, interpolate function

Implements ug::ITransferOperator< TDomain, TAlgebra >.

References UG_THROW.

◆ prolongation()

template<typename TDomain , typename TAlgebra >
SmartPtr< typename TAlgebra::matrix_type > ug::StdTransfer< TDomain, TAlgebra >::prolongation ( const GridLevel fineGL,
const GridLevel coarseGL,
ConstSmartPtr< ApproximationSpace< TDomain > >  spApproxSpace 
)
virtual

◆ remove_outdated()

template<typename TDomain , typename TAlgebra >
void ug::StdTransfer< TDomain, TAlgebra >::remove_outdated ( TransferMap map,
const RevisionCounter revCnt 
)
inlineprotected

◆ restriction()

template<typename TDomain , typename TAlgebra >
SmartPtr< typename TAlgebra::matrix_type > ug::StdTransfer< TDomain, TAlgebra >::restriction ( const GridLevel coarseGL,
const GridLevel fineGL,
ConstSmartPtr< ApproximationSpace< TDomain > >  spApproxSpace 
)
virtual

◆ set_debug()

template<typename TDomain , typename TAlgebra >
void ug::StdTransfer< TDomain, TAlgebra >::set_debug ( SmartPtr< IDebugWriter< TAlgebra > >  spDebugWriter)
inline

◆ set_levels()

template<typename TDomain , typename TAlgebra >
virtual void ug::StdTransfer< TDomain, TAlgebra >::set_levels ( GridLevel  coarseLevel,
GridLevel  fineLevel 
)
inlinevirtual

◆ set_prolongation_damping()

template<typename TDomain , typename TAlgebra >
void ug::StdTransfer< TDomain, TAlgebra >::set_prolongation_damping ( number  damp)
inline

set prolongation damping (only applied on vector operation, not (!!) in assembled matrices)

References ug::StdTransfer< TDomain, TAlgebra >::m_dampProl.

◆ set_restriction_damping()

template<typename TDomain , typename TAlgebra >
void ug::StdTransfer< TDomain, TAlgebra >::set_restriction_damping ( number  damp)
inline

set restriction damping (only applied on vector operation, not (!!) in assembled matrices)

References ug::StdTransfer< TDomain, TAlgebra >::m_dampRes.

◆ set_use_transposed()

template<typename TDomain , typename TAlgebra >
void ug::StdTransfer< TDomain, TAlgebra >::set_use_transposed ( bool  bTransposed)
inline

sets if restriction and prolongation are transposed

References ug::StdTransfer< TDomain, TAlgebra >::m_bUseTransposed.

◆ write_debug()

template<typename TDomain , typename TAlgebra >
void ug::StdTransfer< TDomain, TAlgebra >::write_debug ( const matrix_type mat,
std::string  name,
const GridLevel glTo,
const GridLevel glFrom 
)
protected

Member Data Documentation

◆ bCached

template<typename TDomain , typename TAlgebra >
bool ug::StdTransfer< TDomain, TAlgebra >::bCached
protected

flag if cached (matrix) transfer used

◆ m_bUseTransposed

template<typename TDomain , typename TAlgebra >
bool ug::StdTransfer< TDomain, TAlgebra >::m_bUseTransposed
protected

flag if transposed is used

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

◆ m_dampProl

template<typename TDomain , typename TAlgebra >
number ug::StdTransfer< TDomain, TAlgebra >::m_dampProl
protected

◆ m_dampRes

template<typename TDomain , typename TAlgebra >
number ug::StdTransfer< TDomain, TAlgebra >::m_dampRes
protected

◆ m_mProlongation

template<typename TDomain , typename TAlgebra >
TransferMap ug::StdTransfer< TDomain, TAlgebra >::m_mProlongation
protected

◆ m_mRestriction

template<typename TDomain , typename TAlgebra >
TransferMap ug::StdTransfer< TDomain, TAlgebra >::m_mRestriction
protected

◆ m_p1LagrangeOptimizationEnabled

template<typename TDomain , typename TAlgebra >
bool ug::StdTransfer< TDomain, TAlgebra >::m_p1LagrangeOptimizationEnabled
protected

◆ m_spDebugWriter

template<typename TDomain , typename TAlgebra >
SmartPtr<IDebugWriter<TAlgebra> > ug::StdTransfer< TDomain, TAlgebra >::m_spDebugWriter
protected

◆ m_vConstraint

template<typename TDomain , typename TAlgebra >
std::vector<SmartPtr<IConstraint<TAlgebra> > > ug::ITransferOperator< TDomain, TAlgebra >::m_vConstraint
protected

list of post processes


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