20 weightRatioThreshold(0.65),
22 smootherType(GAUSS_SEIDEL),
23 scaleCorrections(true),
24 _finestLinearSystem(0),
30 _commTarget(MPI::COMM_WORLD),
55 for(
int i=0; i<nSweeps; i++)
94 int nextLevel = level+1;
105 cycle(cycleType,nextLevel);
132 scale = (*mxb)/(*xTAx);
133 scale->limit(1.0, 1.0);
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;
238 if (
verbosity >0 && MPI::COMM_WORLD.Get_rank() == 0 )
239 cout <<
"0: " << *rNorm0 << endl;
244 cout <<
"0: " << *rNorm0 << endl;
258 MFRPtr normRatio(rNorm->normalize(*rNorm0));
262 cout << i <<
": " << *rNorm << endl;
270 if (
verbosity >0 && MPI::COMM_WORLD.Get_rank() == 0 )
271 cout <<i <<
": " << *rNorm << endl;
308 int color = ( MPI::COMM_WORLD.Get_rank() == 0 );
309 int key = MPI::COMM_WORLD.Get_rank();
310 _commTarget = MPI::COMM_WORLD.Split( color, key );
313 _commTarget = MPI::COMM_WORLD;
virtual void smooth(LinearSystem &ls)
void redirectPrintToScreen()
MultiField & getResidual()
void createCoarseLevels()
void correctSolution(const MultiField &coarseIndex, MultiField &fineSolutionField, MFRPtr scaleField, const MultiField &coarseSolutionField)
virtual void forwardGS(IContainer &xB, const IContainer &bB, IContainer &temp) const
vector< shared_ptr< LinearSystem > > _coarseLinearSystems
virtual MFRPtr solve(LinearSystem &ls)
SmootherType smootherType
void redirectPrintToFile(const string &fname)
void doSweeps(const int nSweeps, const int level)
MultiField & getCoarseIndex()
shared_ptr< LinearSystemMerger > _mergeLS
shared_ptr< MultiFieldReduction > getOneNorm() const
virtual void reverseGS(IContainer &xB, const IContainer &bB, IContainer &temp) const
LinearSystem * _finestLinearSystem
virtual void computeResidual(const IContainer &xB, const IContainer &bB, IContainer &rB) const
shared_ptr< LinearSystem > createCoarse(const int groupSize, const double weightRatioThreshold)
virtual void Jacobi(IContainer &xB, const IContainer &bB, IContainer &tempB) const
shared_ptr< MultiFieldReduction > MFRPtr
void cycle(CycleType cycleType, const int level)
double weightRatioThreshold
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