#include <MultiGrid.H>
Public Member Functions | |
MultiGrid () | |
virtual | ~MultiGrid () |
virtual void | define (MGLevelOpFactory< T > &a_factory, LinearSolver< T > *a_bottomSolver, const ProblemDomain &a_domain, int a_maxDepth=-1) |
Function to define a MultiGrid object. | |
virtual void | solve (T &a_phi, const T &a_rhs, Real a_tolerance, int a_maxIterations, int verbosity=0) |
virtual void | oneCycle (T &a_e, const T &a_res) |
Execute ONE v-cycle of multigrid. | |
void | init (const T &a_correction, const T &a_residual) |
void | cycle (int a_depth, T &a_correction, const T &a_residual) |
void | clear () |
void | setBottomSolver (LinearSolver< T > *a_bottomSolver) |
Vector< MGLevelOp< T > * > | getAllOperators () |
Public Attributes | |
int | m_depth |
int | m_defaultDepth |
int | m_pre |
int | m_post |
int | m_bottom |
int | m_cycle |
int | m_numMG |
bool | m_homogeneous |
LinearSolver< T > * | m_bottomSolver |
Protected Attributes | |
bool | m_defined |
int | m_bottomCells |
ProblemDomain | m_topLevelDomain |
Vector< MGLevelOp< T > * > | m_op |
Vector< T * > | m_residual |
Vector< T * > | m_correction |
Private Member Functions | |
MultiGrid (const MultiGrid< T > &a_opin) | |
void | operator= (const MultiGrid< T > &a_opin) |
References MultiGrid< T >::clear().
void MultiGrid< T >::define | ( | MGLevelOpFactory< T > & | a_factory, | |
LinearSolver< T > * | a_bottomSolver, | |||
const ProblemDomain & | a_domain, | |||
int | a_maxDepth = -1 | |||
) | [inline, virtual] |
Function to define a MultiGrid object.
a_factory is the factory for generating operators. a_bottomSolver is called at the bottom of v-cycle. a_domain is the problem domain at the top of the vcycle. maxDepth defines the location of the bottom of the v-cycle. The vycle will terminate (hit bottom) when the factory returns NULL for a paticular depth if maxdepth = -1. Otherwise the vycle terminates at maxdepth.
References CH_SPACEDIM, CH_TIME, ProblemDomain::domainBox(), i, MultiGrid< T >::m_bottomCells, MultiGrid< T >::m_bottomSolver, MultiGrid< T >::m_correction, MultiGrid< T >::m_defaultDepth, MultiGrid< T >::m_defined, MultiGrid< T >::m_depth, MultiGrid< T >::m_op, MultiGrid< T >::m_residual, MultiGrid< T >::m_topLevelDomain, MGLevelOpFactory< T >::MGnewOp(), Box::numPts(), Vector< T >::push_back(), and Vector< T >::resize().
void MultiGrid< T >::solve | ( | T & | a_phi, | |
const T & | a_rhs, | |||
Real | a_tolerance, | |||
int | a_maxIterations, | |||
int | verbosity = 0 | |||
) | [inline, virtual] |
solve L(a_phi) = a_rhs. Tolerance is how much you want the norm of the error reduced. verbosity is how chatty you want the function to be. maxIterations is the maximum number of v-cycles. This does the whole residual correction switcharoo and calls oneCycle up to maxIterations times, evaluating the residual as it goes.
References CH_TIME, Vector< T >::clear(), MultiGrid< T >::cycle(), MultiGrid< T >::init(), MultiGrid< T >::m_op, Max(), and pout().
void MultiGrid< T >::oneCycle | ( | T & | a_e, | |
const T & | a_res | |||
) | [inline, virtual] |
Execute ONE v-cycle of multigrid.
If you want the solution to converge, you need to iterate this. See solve() or AMRMultiGrid::solve for a more automatic solve() function. This operates residual-correction form of solution so all boundary conditions are assumed to be homogeneous. L(a_e) = a_res
References Vector< T >::clear(), MultiGrid< T >::cycle(), MultiGrid< T >::m_homogeneous, and MultiGrid< T >::m_op.
void MultiGrid< T >::init | ( | const T & | a_correction, | |
const T & | a_residual | |||
) | [inline] |
References CH_TIME, i, MultiGrid< T >::m_correction, MultiGrid< T >::m_depth, MultiGrid< T >::m_op, and MultiGrid< T >::m_residual.
Referenced by MultiGrid< T >::solve().
void MultiGrid< T >::cycle | ( | int | a_depth, | |
T & | a_correction, | |||
const T & | a_residual | |||
) | [inline] |
References MultiGrid< T >::m_bottom, MultiGrid< T >::m_bottomCells, MultiGrid< T >::m_bottomSolver, MultiGrid< T >::m_correction, MultiGrid< T >::m_cycle, MultiGrid< T >::m_depth, MultiGrid< T >::m_op, MultiGrid< T >::m_post, MultiGrid< T >::m_pre, and MultiGrid< T >::m_residual.
Referenced by MultiGrid< T >::oneCycle(), and MultiGrid< T >::solve().
void MultiGrid< T >::clear | ( | ) | [inline] |
References i, MultiGrid< T >::m_correction, MultiGrid< T >::m_defined, MultiGrid< T >::m_op, MultiGrid< T >::m_residual, Vector< T >::resize(), and Vector< T >::size().
Referenced by MultiGrid< T >::~MultiGrid().
void MultiGrid< T >::setBottomSolver | ( | LinearSolver< T > * | a_bottomSolver | ) | [inline] |
References MultiGrid< T >::m_bottomSolver, MultiGrid< T >::m_depth, and MultiGrid< T >::m_op.
for changing coefficients --- not for the faint of heart.
References MultiGrid< T >::m_op.
void MultiGrid< T >::operator= | ( | const MultiGrid< T > & | a_opin | ) | [inline, private] |
Public solver parameters. m_pre and m_post are the ones that usually get set and are the number of relaxations performed before and after multigrid recursion. See AMRMultiGrid for a more user-friendly interface.
Referenced by MultiGrid< T >::cycle(), MultiGrid< T >::define(), MultiGrid< T >::init(), and MultiGrid< T >::setBottomSolver().
int MultiGrid< T >::m_defaultDepth |
Referenced by MultiGrid< T >::define().
Referenced by MultiGrid< T >::cycle().
Referenced by MultiGrid< T >::cycle().
Referenced by MultiGrid< T >::cycle().
Referenced by MultiGrid< T >::cycle().
bool MultiGrid< T >::m_homogeneous |
Referenced by MultiGrid< T >::oneCycle().
LinearSolver<T>* MultiGrid< T >::m_bottomSolver |
Referenced by MultiGrid< T >::cycle(), MultiGrid< T >::define(), and MultiGrid< T >::setBottomSolver().
Referenced by MultiGrid< T >::clear(), and MultiGrid< T >::define().
int MultiGrid< T >::m_bottomCells [protected] |
Referenced by MultiGrid< T >::cycle(), and MultiGrid< T >::define().
ProblemDomain MultiGrid< T >::m_topLevelDomain [protected] |
Referenced by MultiGrid< T >::define().
Vector< T* > MultiGrid< T >::m_residual [protected] |
Referenced by MultiGrid< T >::clear(), MultiGrid< T >::cycle(), MultiGrid< T >::define(), and MultiGrid< T >::init().
Vector< T* > MultiGrid< T >::m_correction [protected] |
Referenced by MultiGrid< T >::clear(), MultiGrid< T >::cycle(), MultiGrid< T >::define(), and MultiGrid< T >::init().