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 <assert.h>
00035 #include <cmath>
00036 #include "REAL.H"
00037 #include "IntVect.H"
00038 #include "Box.H"
00039 #include "FArrayBox.H"
00040 #include "DisjointBoxLayout.H"
00041 #include "LevelData.H"
00042 #include "LevelMG.H"
00043 #include "ProblemDomain.H"
00044
00046
00050 class LevelSolver
00051 {
00052
00053 public:
00055
00058 LevelSolver();
00059
00061 virtual ~LevelSolver();
00062
00064
00081 LevelSolver(const DisjointBoxLayout& a_grids,
00082 const DisjointBoxLayout* a_baseGrids,
00083 const Box& a_domain,
00084 Real a_dxLevel,
00085 int a_nRefCrse,
00086 const LevelOp* const a_opin,
00087 int a_ncomp = 1);
00088
00089
00091
00108 LevelSolver(const DisjointBoxLayout& a_grids,
00109 const DisjointBoxLayout* a_baseGrids,
00110 const ProblemDomain& a_domain,
00111 Real a_dxLevel,
00112 int a_nRefCrse,
00113 const LevelOp* const a_opin,
00114 int a_ncomp);
00115
00116
00118
00135 virtual void define(const DisjointBoxLayout& a_grids,
00136 const DisjointBoxLayout* a_baseGrids,
00137 const Box& a_domain,
00138 Real a_dxLevel,
00139 int a_nRefCrse,
00140 const LevelOp* const a_opin,
00141 int a_ncomp=1);
00142
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 LevelOp* const a_opin,
00168 int a_ncomp = 1);
00169
00170
00172 bool isDefined() const;
00173
00175 void clearMemory();
00176
00178 void setDefaultValues();
00179
00181
00190 void levelSolveH(LevelData<FArrayBox>& phi,
00191 const LevelData<FArrayBox>& rhs,
00192 bool initializePhiToZero=true);
00193
00195
00206 void levelSolve(LevelData<FArrayBox>& phi,
00207 const LevelData<FArrayBox>* phic,
00208 const LevelData<FArrayBox>& rhs,
00209 bool initializePhiToZero=true);
00210
00212 void setTolerance(Real a_tolerance);
00213
00215
00221 void setOperatorTolerance(Real a_operatorTolerance);
00222
00223
00225 void setVerbose(bool a_verbose);
00226
00228 void setMaxIter(int a_maxIter);
00229
00231
00236
00237 void setMinIter(int a_minIter);
00238
00239 protected:
00240
00241
00242 LevelMG m_levelMG;
00243
00244
00245 LevelOp* m_levelOpPtr;
00246
00247
00248 bool m_isDefined;
00249
00250
00251 DisjointBoxLayout m_grids;
00252
00253
00254 ProblemDomain m_domain;
00255
00256
00257 LevelData<FArrayBox> m_resid;
00258
00259
00260 LevelData<FArrayBox> m_scratch;
00261
00262
00263 LevelData<FArrayBox> m_corr;
00264
00265
00266 int m_nRefCrse;
00267
00268
00269 Real m_dxLevel;
00270
00271
00272 int m_maxIter;
00273
00274
00275 int m_minIter;
00276
00277
00278 Real m_tolerance;
00279
00280
00281 Real m_operatorTolerance;
00282
00283
00284
00285 bool m_verbose;
00286
00287 private:
00288 void operator = (const LevelSolver&){;}
00289 LevelSolver(const LevelSolver&){;}
00290
00291 };
00292
00293 #endif
00294
00295