#include <MultiGrid.H>
Public Member Functions | |
MGLevelOp () | |
Constructor. | |
virtual | ~MGLevelOp () |
Destructor. | |
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 | |
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 | |
virtual void | restrictR (T &a_phiCoarse, const T &a_phiFine) |
simple restriction function | |
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. | |
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. | |
virtual void | finerOperatorChanged (const MGLevelOp< T > &a_operator, int a_coarseningFactor) |
int | numObservers () const |
Returns the number of objects observing this operator. | |
Private Member Functions | |
MGLevelOp (const MGLevelOp &) | |
MGLevelOp & | operator= (const MGLevelOp &) |
Private Attributes | |
std::vector< MGLevelOpObserver < T > * > | m_observers |
List of observers for the operator. | |
std::vector< int > | m_coarseningFactors |
Multigrid coarsening factors. |
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 AMRNodeOp, AMRPoissonOp, NewPoissonOp, NewPoissonOp4, ViscousTensorOp, NWOViscousTensorOp, PoissonOp4, ResistivityOp, ViscousTensorOp, EBAMRPoissonOp, EBConductivityOp, EBPoissonOp, EBViscousTensorOp, NWOEBConductivityOp, NWOEBViscousTensorOp, and slowEBCO.
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 AMRNodeOp, AMRPoissonOp, NewPoissonOp, NewPoissonOp4, ViscousTensorOp, NWOViscousTensorOp, PoissonOp4, ResistivityOp, ViscousTensorOp, EBAMRPoissonOp, EBConductivityOp, EBPoissonOp, EBViscousTensorOp, NWOEBConductivityOp, NWOEBViscousTensorOp, and slowEBCO.
Referenced by MGLevelOp< LevelData< NodeFArrayBox > >::relaxNF().
virtual void MGLevelOp< T >::relaxNF | ( | T & | a_phi, | |
const T * | a_phiCoarse, | |||
const T & | a_rhs, | |||
int | a_iterations | |||
) | [inline, virtual] |
specialized no-fine relax function, useful for full-multigrid schemes, defaults to regular relax
Necessary to implement FAS correctly
Reimplemented in AMRPoissonOp.
virtual void MGLevelOp< T >::restrictResidual | ( | T & | a_resCoarse, | |
T & | a_phiFine, | |||
const T & | a_rhsFine | |||
) | [pure virtual] |
calculate restricted residual a_resCoarse[2h] = I[h->2h] (rhsFine[h] - L[h](phiFine[h])
Implemented in AMRNodeOp, AMRPoissonOp, NewPoissonOp, NewPoissonOp4, ViscousTensorOp, NWOViscousTensorOp, PoissonOp4, ResistivityOp, VCAMRPoissonOp2, ViscousTensorOp, EBAMRPoissonOp, EBConductivityOp, EBPoissonOp, EBViscousTensorOp, NWOEBConductivityOp, NWOEBViscousTensorOp, and slowEBCO.
Referenced by MGLevelOp< LevelData< NodeFArrayBox > >::restrictResidual().
virtual void MGLevelOp< T >::restrictResidual | ( | T & | a_resCoarse, | |
T & | a_phiFine, | |||
const T * | a_phiCoarse, | |||
const T & | a_rhsFine, | |||
bool | homogeneous | |||
) | [inline, virtual] |
full-multigrid version of restrictResidual, useful for FAS-type schemes. Defaults to standard restriction
virtual void MGLevelOp< T >::restrictR | ( | T & | a_phiCoarse, | |
const T & | a_phiFine | |||
) | [inline, virtual] |
simple restriction function
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 AMRNodeOp, AMRPoissonOp, NewPoissonOp, NewPoissonOp4, ViscousTensorOp, NWOViscousTensorOp, PoissonOp4, ResistivityOp, ViscousTensorOp, EBAMRPoissonOp, EBConductivityOp, EBPoissonOp, EBViscousTensorOp, NWOEBConductivityOp, NWOEBViscousTensorOp, and slowEBCO.
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.
a_observer | An observer to be notified when the operator changes. |
Referenced by MGLevelOp< LevelData< NodeFArrayBox > >::addCoarserObserver().
virtual void MGLevelOp< T >::applyOpMg | ( | T & | a_lhs, | |
T & | a_phi, | |||
T * | a_phiCoarse, | |||
bool | a_homogeneous | |||
) | [inline, virtual] |
Apply an operator.
useful for full-multigrid/FAS types of algorithms
virtual void MGLevelOp< T >::residualNF | ( | T & | a_lhs, | |
T & | a_phi, | |||
const T * | a_phiCoarse, | |||
const T & | a_rhs, | |||
bool | a_homogeneous = false | |||
) | [inline, virtual] |
Reimplemented in AMRPoissonOp.
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.
a_observer | An observer to be removed from the operator's observer list. |
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.
a_operator | The 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_coarseningFactor | The refinement factor between the grid level for a_operator and that for this one. |
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.
virtual void MGLevelOp< T >::finerOperatorChanged | ( | const MGLevelOp< T > & | a_operator, | |
int | a_coarseningFactor | |||
) | [inline, virtual] |
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.
a_operator | The operator whose state has changed. | |
a_coarseningFactor | The factor by which this operator's data is coarsened with respect to that of a_operator. |
Reimplemented in VCAMRPoissonOp2, EBConductivityOp, and EBViscousTensorOp.
Referenced by MGLevelOp< LevelData< NodeFArrayBox > >::notifyObserversOfChange().
int MGLevelOp< T >::numObservers | ( | ) | const [inline] |
Returns the number of objects observing this operator.
std::vector<MGLevelOpObserver<T>*> MGLevelOp< T >::m_observers [private] |
List of observers for the operator.
Referenced by MGLevelOp< LevelData< NodeFArrayBox > >::addCoarserObserver(), MGLevelOp< LevelData< NodeFArrayBox > >::addObserver(), MGLevelOp< LevelData< NodeFArrayBox > >::notifyObserversOfChange(), MGLevelOp< LevelData< NodeFArrayBox > >::numObservers(), MGLevelOp< LevelData< NodeFArrayBox > >::removeObserver(), and MGLevelOp< LevelData< NodeFArrayBox > >::~MGLevelOp().
std::vector<int> MGLevelOp< T >::m_coarseningFactors [private] |