00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029 #ifndef _LEVELSOLVER_H_
00030 #define _LEVELSOLVER_H_
00031
00032 #include <cstdlib>
00033 #include <iostream>
00034 #include <cassert>
00035 #include <cmath>
00036
00037 #include "REAL.H"
00038 #include "IntVect.H"
00039 #include "Box.H"
00040 #include "FArrayBox.H"
00041 #include "DisjointBoxLayout.H"
00042 #include "LevelData.H"
00043 #include "LevelMG.H"
00044 #include "ProblemDomain.H"
00045
00047
00051 class LevelSolver
00052 {
00053 public:
00055
00057 LevelSolver();
00058
00060 virtual ~LevelSolver();
00061
00063
00079 LevelSolver(const DisjointBoxLayout& a_grids,
00080 const DisjointBoxLayout* a_baseGrids,
00081 const ProblemDomain& a_domain,
00082 Real a_dxLevel,
00083 int a_nRefCrse,
00084 const LevelOp* const a_opin,
00085 int a_ncomp,
00086 bool a_limitCoarsening = false);
00087
00089
00105 LevelSolver(const DisjointBoxLayout& a_grids,
00106 const DisjointBoxLayout* a_baseGrids,
00107 const Box& a_domain,
00108 Real a_dxLevel,
00109 int a_nRefCrse,
00110 const LevelOp* const a_opin,
00111 int a_ncomp = 1,
00112 bool a_limitCoarsening = false);
00113
00115
00129 virtual void define(const DisjointBoxLayout& a_grids,
00130 const DisjointBoxLayout* a_baseGrids,
00131 const ProblemDomain& a_domain,
00132 Real a_dxLevel,
00133 int a_nRefCrse,
00134 const LevelOp* const a_opin,
00135 int a_ncomp = 1,
00136 bool a_limitCoarsening = false);
00137
00139
00153 virtual void define(const DisjointBoxLayout& a_grids,
00154 const DisjointBoxLayout* a_baseGrids,
00155 const Box& a_domain,
00156 Real a_dxLevel,
00157 int a_nRefCrse,
00158 const LevelOp* const a_opin,
00159 int a_ncomp=1,
00160 bool a_limitCoarsening = false);
00161
00163 bool isDefined() const;
00164
00166 void clearMemory();
00167
00169 void setDefaultValues();
00170
00172
00175 void levelSolveH(
00176 LevelData<FArrayBox>& a_phi,
00178 const LevelData<FArrayBox>& a_rhs,
00180 bool a_initializePhiToZero=true);
00181
00183
00187 void levelSolve(
00188 LevelData<FArrayBox>& a_phi,
00190 const LevelData<FArrayBox>* a_phic,
00192 const LevelData<FArrayBox>& a_rhs,
00194 bool a_initializePhiToZero=true);
00195
00197 void setNumSmoothUp(int a_numSmoothUp);
00198
00200 void setNumSmoothDown(int a_numSmoothDown);
00201
00203 void setTolerance(Real a_tolerance);
00204
00206
00212 void setOperatorTolerance(Real a_operatorTolerance);
00213
00215 void setVerbose(bool a_verbose);
00216
00218 void setMaxIter(int a_maxIter);
00219
00221
00226
00227 void setMinIter(int a_minIter);
00228
00230
00235 virtual void setConvergenceMetric(Real a_metric, int a_comp);
00236
00237
00239 virtual void resetConvergenceMetrics();
00240
00241 protected:
00245 LevelMG m_levelMG;
00246
00250 LevelOp* m_levelOpPtr;
00251
00255 bool m_isDefined;
00256
00260 DisjointBoxLayout m_grids;
00261
00265 ProblemDomain m_domain;
00266
00270 LevelData<FArrayBox> m_resid;
00271
00275 LevelData<FArrayBox> m_scratch;
00276
00280 LevelData<FArrayBox> m_corr;
00281
00285 int m_nRefCrse;
00286
00290 Real m_dxLevel;
00291
00295 int m_maxIter;
00296
00300 int m_minIter;
00301
00305 int m_numSmoothUp;
00306
00310 int m_numSmoothDown;
00311
00315 Real m_tolerance;
00316
00320 Vector<Real> m_convergenceMetrics;
00321
00325 Real m_operatorTolerance;
00326
00330 bool m_verbose;
00331
00332 private:
00333 void operator = (const LevelSolver&){;}
00334 LevelSolver(const LevelSolver&){;}
00335 };
00336
00337 #endif