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 _GENLEVELSOLVER_H_
00030 #define _GENLEVELSOLVER_H_
00031
00032 #include <cstdlib>
00033 #include <iostream>
00034 #include <assert.h>
00035 #include <cmath>
00036
00037 #include "REAL.H"
00038 #include "IntVect.H"
00039 #include "Box.H"
00040 #include "DisjointBoxLayout.H"
00041 #include "ProblemDomain.H"
00042
00043 #include "GenLevelMGOp.H"
00044 #include "GenLevelMG.H"
00045
00047
00051 template <class T> class GenLevelSolver
00052 {
00053 public:
00055
00058 GenLevelSolver();
00059
00061
00078 GenLevelSolver(const DisjointBoxLayout& a_grids,
00079 const DisjointBoxLayout* a_baseGrids,
00080 const Box& a_domain,
00081 Real a_dxLevel,
00082 int a_nRefCrse,
00083 const GenLevelMGOp<T>* const a_opin,
00084 int a_ncomp = 1);
00085
00087
00104 GenLevelSolver(const DisjointBoxLayout& a_grids,
00105 const DisjointBoxLayout* a_baseGrids,
00106 const ProblemDomain& a_domain,
00107 Real a_dxLevel,
00108 int a_nRefCrse,
00109 const GenLevelMGOp<T>* const a_opin,
00110 int a_ncomp);
00111
00113 virtual ~GenLevelSolver();
00114
00116 bool isDefined() const;
00117
00119
00136 virtual void define(const DisjointBoxLayout& a_grids,
00137 const DisjointBoxLayout* a_baseGrids,
00138 const Box& a_domain,
00139 Real a_dxLevel,
00140 int a_nRefCrse,
00141 const GenLevelMGOp<T>* const a_opin,
00142 int a_ncomp = 1);
00143
00145
00162 virtual void define(const DisjointBoxLayout& a_grids,
00163 const DisjointBoxLayout* a_baseGrids,
00164 const ProblemDomain& a_domain,
00165 Real a_dxLevel,
00166 int a_nRefCrse,
00167 const GenLevelMGOp<T>* const a_opin,
00168 int a_ncomp = 1);
00169
00171 void clearMemory();
00172
00174 void setDefaultValues();
00175
00177
00186 void levelSolveH(T& a_phi,
00187 const T& a_rhs,
00188 bool a_initializePhiToZero = true);
00189
00191
00202 void levelSolve(T& a_phi,
00203 const T* a_phic,
00204 const T& a_rhs,
00205 bool a_initializePhiToZero = true);
00206
00208 void setTolerance(Real a_tolerance);
00209
00211
00217 void setOperatorTolerance(Real a_operatorTolerance);
00218
00220 void setVerbose(bool a_verbose);
00221
00223 void setMaxIter(int a_maxIter);
00224
00226
00231
00232 void setMinIter(int a_minIter);
00233
00234 protected:
00235
00236 GenLevelMG<T> m_levelMG;
00237
00238
00239 GenLevelMGOp<T>* m_levelOpPtr;
00240
00241
00242 bool m_isDefined;
00243
00244
00245 DisjointBoxLayout m_grids;
00246
00247
00248 ProblemDomain m_domain;
00249
00250
00251 T m_resid;
00252
00253
00254 T m_scratch;
00255
00256
00257 T m_corr;
00258
00259
00260 int m_nRefCrse;
00261
00262
00263 Real m_dxLevel;
00264
00265
00266 int m_maxIter;
00267
00268
00269 int m_minIter;
00270
00271
00272 Real m_tolerance;
00273
00274
00275 Real m_operatorTolerance;
00276
00277
00278 bool m_verbose;
00279
00280 private:
00281 GenLevelSolver<T>(const GenLevelSolver<T>&) {};
00282 void operator= (const GenLevelSolver<T>&) {};
00283 };
00284
00285 #include "GenLevelSolverImplem.H"
00286
00287 #endif
00288