Solve a linear system using algebraic multigrid.
Definition at line 27 of file AMG.h.
void AMG::createCoarseLevels |
( |
| ) |
|
|
private |
Definition at line 150 of file AMG.cpp.
References _coarseLinearSystems, _finestLinearSystem, _isMerge, _mergeLevel, _mergeLevelSize, _mergeLS, coarseGroupSize, LinearSystem::createCoarse(), flipComm(), MultiFieldMatrix::getLocalSize(), LinearSystem::getMatrix(), LinearSystem::isSymmetric, maxCoarseLevels, LinearSolver::verbosity, and weightRatioThreshold.
Referenced by smooth(), and solve().
158 shared_ptr<LinearSystem>
165 _commTarget.Allreduce(MPI::IN_PLACE, &isContinue, 1, MPI::INT, MPI::SUM);
167 if ( isContinue == 0 )
173 int min_size = coarseLS->getMatrix().getMinSize( _commTarget );
176 if (
verbosity > 1 && MPI::COMM_WORLD.Get_rank() == 0 )
177 cout <<
" proc_id = " << MPI::COMM_WORLD.Get_rank() <<
" Created coarse level " << n <<
" of size "
186 int size = MPI::COMM_WORLD.Get_size();
187 for (
int i = 0; i < size; i++ )
190 _mergeLS = shared_ptr<LinearSystemMerger> (
new LinearSystemMerger( 0, group, *coarseLS ) );
200 if ( coarseLS->getMatrix().getSize() <= 3 )
203 cout <<
"Created coarse level " << n <<
" of size " << coarseLS->getMatrix().getSize() << endl;
vector< shared_ptr< LinearSystem > > _coarseLinearSystems
shared_ptr< LinearSystemMerger > _mergeLS
LinearSystem * _finestLinearSystem
shared_ptr< LinearSystem > createCoarse(const int groupSize, const double weightRatioThreshold)
double weightRatioThreshold
MultiFieldMatrix & getMatrix()
void AMG::cycle |
( |
CycleType |
cycleType, |
|
|
const int |
level |
|
) |
| |
|
private |
Definition at line 71 of file AMG.cpp.
References _coarseLinearSystems, _finestLinearSystem, _mergeLevel, _mergeLS, MultiFieldMatrix::computeResidual(), MultiFieldMatrix::correctSolution(), doSweeps(), MultiField::dotWith(), F_CYCLE, LinearSystem::getB(), LinearSystem::getCoarseIndex(), LinearSystem::getDelta(), LinearSystem::getMatrix(), LinearSystem::getResidual(), MultiFieldMatrix::injectResidual(), LinearSystem::isSymmetric, nPostSweeps, nPreSweeps, MultiFieldMatrix::quadProduct(), scaleCorrections, V_CYCLE, W_CYCLE, and MultiField::zero().
Referenced by smooth(), and solve().
94 int nextLevel = level+1;
132 scale = (*mxb)/(*xTAx);
133 scale->limit(1.0, 1.0);
MultiField & getResidual()
void correctSolution(const MultiField &coarseIndex, MultiField &fineSolutionField, MFRPtr scaleField, const MultiField &coarseSolutionField)
vector< shared_ptr< LinearSystem > > _coarseLinearSystems
void doSweeps(const int nSweeps, const int level)
MultiField & getCoarseIndex()
shared_ptr< LinearSystemMerger > _mergeLS
LinearSystem * _finestLinearSystem
virtual void computeResidual(const IContainer &xB, const IContainer &bB, IContainer &rB) const
shared_ptr< MultiFieldReduction > MFRPtr
void cycle(CycleType cycleType, const int level)
shared_ptr< MultiFieldReduction > dotWith(const MultiField &ofield) const
void injectResidual(const MultiField &coarseIndex, const MultiField &fineResidualField, MultiField &coarseBField)
MultiFieldMatrix & getMatrix()
MFRPtr quadProduct(const MultiField &x) const