Chombo + EB + MF  3.2
Public Member Functions | Private Member Functions | Private Attributes | List of all members
MGLevelOp< T > Class Template Referenceabstract

#include <MultiGrid.H>

Inheritance diagram for MGLevelOp< T >:
Inheritance graph
[legend]

Public Member Functions

 MGLevelOp ()
 Constructor. More...
 
virtual ~MGLevelOp ()
 Destructor. More...
 
virtual void createCoarser (T &a_coarse, const T &a_fine, bool ghosted)=0
 
virtual void relax (T &a_correction, const T &a_residual, int a_iterations)=0
 
virtual void relaxNF (T &a_phi, const T *a_phiCoarse, const T &a_rhs, int a_iterations)
 specialized no-fine relax function, useful for full-multigrid schemes, defaults to regular relax More...
 
virtual void restrictResidual (T &a_resCoarse, T &a_phiFine, const T &a_rhsFine)=0
 
virtual void restrictResidual (T &a_resCoarse, T &a_phiFine, const T *a_phiCoarse, const T &a_rhsFine, bool homogeneous)
 full-multigrid version of restrictResidual, useful for FAS-type schemes. Defaults to standard restriction More...
 
virtual void restrictR (T &a_phiCoarse, const T &a_phiFine)
 simple restriction function More...
 
virtual void prolongIncrement (T &a_phiThisLevel, const T &a_correctCoarse)=0
 
void addObserver (MGLevelOpObserver< T > *a_observer)
 
virtual void applyOpMg (T &a_lhs, T &a_phi, T *a_phiCoarse, bool a_homogeneous)
 Apply an operator. More...
 
virtual void residualNF (T &a_lhs, T &a_phi, const T *a_phiCoarse, const T &a_rhs, bool a_homogeneous=false)
 
void removeObserver (MGLevelOpObserver< T > *a_observer)
 
void addCoarserObserver (MGLevelOp< T > *a_operator, int a_coarseningFactor)
 
void notifyObserversOfChange ()
 This should be called whenever the operator's data is updated. More...
 
virtual void finerOperatorChanged (const MGLevelOp< T > &a_operator, int a_coarseningFactor)
 
int numObservers () const
 Returns the number of objects observing this operator. More...
 
- Public Member Functions inherited from LinearOp< T >
virtual ~LinearOp ()
 
virtual void residual (T &a_lhs, const T &a_phi, const T &a_rhs, bool a_homogeneous=false)=0
 
virtual void preCond (T &a_cor, const T &a_residual)=0
 
virtual void applyOp (T &a_lhs, const T &a_phi, bool a_homogeneous=false)=0
 
virtual void create (T &a_lhs, const T &a_rhs)=0
 
virtual void clear (T &a_lhs)
 
virtual void assign (T &a_lhs, const T &a_rhs)=0
 
virtual void assignLocal (T &a_lhs, const T &a_rhs)
 
virtual Real dotProduct (const T &a_1, const T &a_2)=0
 
virtual void mDotProduct (const T &a_1, const int a_sz, const T a_2[], Real a_mdots[])
 
virtual void incr (T &a_lhs, const T &a_x, Real a_scale)=0
 
virtual void axby (T &a_lhs, const T &a_x, const T &a_y, Real a_a, Real a_b)=0
 
virtual void scale (T &a_lhs, const Real &a_scale)=0
 
virtual Real norm (const T &a_rhs, int a_ord)=0
 
virtual Real dx () const
 
virtual void setToZero (T &a_lhs)=0
 
virtual void write (const T *a, const char *filename)
 
- Public Member Functions inherited from MGLevelOpObserver< T >
 MGLevelOpObserver ()
 Base level Constructor. Called by all subclasses. More...
 
virtual ~MGLevelOpObserver ()
 Destructor. More...
 
virtual void operatorChanged (const MGLevelOp< T > &a_operator)
 
void setObservee (MGLevelOp< T > *a_observee)
 
void clearObservee ()
 

Private Member Functions

 MGLevelOp (const MGLevelOp &)
 
MGLevelOpoperator= (const MGLevelOp &)
 

Private Attributes

std::vector< MGLevelOpObserver< T > * > m_observers
 List of observers for the operator. More...
 
std::vector< int > m_coarseningFactors
 Multigrid coarsening factors. More...
 

Detailed Description

template<typename T>
class MGLevelOp< T >

This class handles the additional tasks of coordinating operations between this level and the level one coarser than this 'level'. This class is also an MGLevelOpObserver, so objects of this type can observe other MGLevelOp objects.

Constructor & Destructor Documentation

◆ MGLevelOp() [1/2]

template<typename T>
MGLevelOp< T >::MGLevelOp ( )
inline

Constructor.

◆ ~MGLevelOp()

template<typename T>
virtual MGLevelOp< T >::~MGLevelOp ( )
inlinevirtual

Destructor.

◆ MGLevelOp() [2/2]

template<typename T>
MGLevelOp< T >::MGLevelOp ( const MGLevelOp< T > &  )
private

Member Function Documentation

◆ createCoarser()

template<typename T>
virtual void MGLevelOp< T >::createCoarser ( T &  a_coarse,
const T &  a_fine,
bool  ghosted 
)
pure virtual

Create a coarsened (by two) version of the input data. This does not include averaging the data. So if a_fine is over a Box of (0, 0, 0) (63, 63, 63), a_fine should be over a Box (0, 0, 0) (31, 31, 31).

Implemented in EBAMRPoissonOp, NWOEBViscousTensorOp, EBViscousTensorOp, EBConductivityOp, NWOEBConductivityOp, NWOViscousTensorOp, ViscousTensorOp, slowEBCO, AMRPoissonOp, EBPoissonOp, ResistivityOp, MFPoissonOp, AMRNodeOp, PoissonOp4, NewPoissonOp, and NewPoissonOp4.

◆ relax()

template<typename T>
virtual void MGLevelOp< T >::relax ( T &  a_correction,
const T &  a_residual,
int  a_iterations 
)
pure virtual

Use your relaxation operator to remove the high frequency wave numbers from the correction so that it may be averaged to a coarser refinement. A point relaxtion scheme, for example takes the form a_correction -= lambda*(L(a_correction) - a_residual).

Implemented in EBAMRPoissonOp, NWOEBViscousTensorOp, EBViscousTensorOp, EBConductivityOp, NWOEBConductivityOp, NWOViscousTensorOp, slowEBCO, ViscousTensorOp, EBPoissonOp, AMRPoissonOp, ResistivityOp, MFPoissonOp, AMRNodeOp, PoissonOp4, NewPoissonOp, and NewPoissonOp4.

Referenced by AMRMultiGrid< LevelData< MFCellFAB > >::getAMROperators().

◆ relaxNF()

template<typename T>
virtual void MGLevelOp< T >::relaxNF ( T &  a_phi,
const T *  a_phiCoarse,
const T &  a_rhs,
int  a_iterations 
)
inlinevirtual

specialized no-fine relax function, useful for full-multigrid schemes, defaults to regular relax

Necessary to implement FAS correctly

Reimplemented in AMRPoissonOp.

◆ restrictResidual() [1/2]

template<typename T>
virtual void MGLevelOp< T >::restrictResidual ( T &  a_resCoarse,
T &  a_phiFine,
const T &  a_rhsFine 
)
pure virtual

◆ restrictResidual() [2/2]

template<typename T>
virtual void MGLevelOp< T >::restrictResidual ( T &  a_resCoarse,
T &  a_phiFine,
const T *  a_phiCoarse,
const T &  a_rhsFine,
bool  homogeneous 
)
inlinevirtual

full-multigrid version of restrictResidual, useful for FAS-type schemes. Defaults to standard restriction

◆ restrictR()

template<typename T>
virtual void MGLevelOp< T >::restrictR ( T &  a_phiCoarse,
const T &  a_phiFine 
)
inlinevirtual

simple restriction function

◆ prolongIncrement()

template<typename T>
virtual void MGLevelOp< T >::prolongIncrement ( T &  a_phiThisLevel,
const T &  a_correctCoarse 
)
pure virtual

correct the fine solution based on coarse correction a_phiThisLevel += I[2h->h](a_correctCoarse)

Implemented in EBAMRPoissonOp, NWOEBViscousTensorOp, EBViscousTensorOp, EBConductivityOp, NWOEBConductivityOp, NWOViscousTensorOp, slowEBCO, ViscousTensorOp, AMRPoissonOp, EBPoissonOp, MFPoissonOp, ResistivityOp, AMRNodeOp, PoissonOp4, NewPoissonOp, and NewPoissonOp4.

◆ addObserver()

template<typename T>
void MGLevelOp< T >::addObserver ( MGLevelOpObserver< T > *  a_observer)
inline

This adds a new observer to this operator. Note that this operator does not own the resources for the observer, so you must be careful to ensure that the observer does not go out of scope while the operator lives. If the observer is already observing the operator, this operation has no effect.

Parameters
a_observerAn observer to be notified when the operator changes.

◆ applyOpMg()

template<typename T>
virtual void MGLevelOp< T >::applyOpMg ( T &  a_lhs,
T &  a_phi,
T *  a_phiCoarse,
bool  a_homogeneous 
)
inlinevirtual

Apply an operator.

useful for full-multigrid/FAS types of algorithms

◆ residualNF()

template<typename T>
virtual void MGLevelOp< T >::residualNF ( T &  a_lhs,
T &  a_phi,
const T *  a_phiCoarse,
const T &  a_rhs,
bool  a_homogeneous = false 
)
inlinevirtual

Reimplemented in AMRPoissonOp.

◆ removeObserver()

template<typename T>
void MGLevelOp< T >::removeObserver ( MGLevelOpObserver< T > *  a_observer)
inline

Removes the given observer from the operator's list of observers. This method has no effect if the observer is not found in the list.

Parameters
a_observerAn observer to be removed from the operator's observer list.

◆ addCoarserObserver()

template<typename T>
void MGLevelOp< T >::addCoarserObserver ( MGLevelOp< T > *  a_operator,
int  a_coarseningFactor 
)
inline

Adds a MGLevelOp observer to this operator that is notified when the operator changes so that it can coarsen its corresponding data. This is used to implement dependencies between multigrid operators at different grid levels.

Parameters
a_operatorThe multigrid operator that will observe this operator. No operator may observe itself. If a_operator is already observing this operator, this method has no effect.
a_coarseningFactorThe refinement factor between the grid level for a_operator and that for this one.

◆ notifyObserversOfChange()

template<typename T>
void MGLevelOp< T >::notifyObserversOfChange ( )
inline

This should be called whenever the operator's data is updated.

Notify our observers that the operator's data has changed, taking special care to pass multigrid operators their level.

◆ finerOperatorChanged()

template<typename T>
virtual void MGLevelOp< T >::finerOperatorChanged ( const MGLevelOp< T > &  a_operator,
int  a_coarseningFactor 
)
inlinevirtual

Overload this method to implement the response of a multigrid operator to a change in a finer operator that it is observing. This allows the coarser observer to coarsen any data that has been changed in the finer operator.

Parameters
a_operatorThe operator whose state has changed.
a_coarseningFactorThe factor by which this operator's data is coarsened with respect to that of a_operator.

Reimplemented in EBViscousTensorOp, EBConductivityOp, and VCAMRPoissonOp2.

Referenced by MGLevelOp< LevelData< MFCellFAB > >::notifyObserversOfChange().

◆ numObservers()

template<typename T>
int MGLevelOp< T >::numObservers ( ) const
inline

Returns the number of objects observing this operator.

◆ operator=()

template<typename T>
MGLevelOp& MGLevelOp< T >::operator= ( const MGLevelOp< T > &  )
private

Member Data Documentation

◆ m_observers

template<typename T>
std::vector<MGLevelOpObserver<T>*> MGLevelOp< T >::m_observers
private

List of observers for the operator.

◆ m_coarseningFactors

template<typename T>
std::vector<int> MGLevelOp< T >::m_coarseningFactors
private

Multigrid coarsening factors.


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