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
00030
00031
00032 #ifndef LEVELNODESOLVER_H
00033 #define LEVELNODESOLVER_H
00034
00035 #include <cstdlib>
00036 #include <iostream>
00037 #include <assert.h>
00038 #include <cmath>
00039 #include "REAL.H"
00040 #include "IntVectSet.H"
00041 #include "ProblemDomain.H"
00042 #include "NodeFArrayBox.H"
00043 #include "DisjointBoxLayout.H"
00044 #include "LevelData.H"
00045 #include "NodeLevelMG.H"
00046 #include "NodeLevelOp.H"
00047
00049 class LevelNodeSolver
00052 {
00053
00054 public:
00055
00057
00059
00061 LevelNodeSolver();
00062
00064
00068 LevelNodeSolver(const DisjointBoxLayout& a_grids,
00069 const DisjointBoxLayout* a_gridsCoarsePtr,
00070 const ProblemDomain& a_domain,
00071 Real a_dx,
00072 int a_refToCoarse,
00073 const NodeLevelOp* const a_opin,
00074 int a_minLength = 1);
00075
00076 LevelNodeSolver(const DisjointBoxLayout& a_grids,
00077 const DisjointBoxLayout* a_gridsCoarsePtr,
00078 const Box& a_domain,
00079 Real a_dx,
00080 int a_refToCoarse,
00081 const NodeLevelOp* const a_opin,
00082 int a_minLength = 1);
00083
00085
00087 virtual ~LevelNodeSolver();
00088
00089
00091
00106 virtual void define(const DisjointBoxLayout& a_grids,
00107 const DisjointBoxLayout* a_gridsCoarsePtr,
00108 const ProblemDomain& a_domain,
00109 Real a_dx,
00110 int a_refToCoarse,
00111 const NodeLevelOp* const a_opin,
00112 int a_minLength = 1);
00113
00114 virtual void define(const DisjointBoxLayout& a_grids,
00115 const DisjointBoxLayout* a_gridsCoarsePtr,
00116 const Box& a_domain,
00117 Real a_dx,
00118 int a_refToCoarse,
00119 const NodeLevelOp* const a_opin,
00120 int a_minLength = 1);
00121
00123
00125
00128 bool isDefined() const;
00129
00130
00132
00134
00137 void setnumBottomGSRB(int a_numBottomGSRB);
00138
00140
00143 void setnumSmoothUp(int a_numSmoothUp);
00144
00146
00149 void setnumSmoothDown(int a_numSmoothDown);
00150
00152
00154 void setBottomSmoothing(bool a_bottomSolveFlag);
00155
00157
00159 void setTolerance(Real a_tolerance);
00160
00162
00168 void setOperatorTolerance(Real a_operatorTolerance);
00169
00171
00173 void setVerbose(bool a_verbose);
00174
00176
00179 void setMaxIter(int a_maxIter);
00180
00182
00187 void setMinIter(int a_minIter);
00188
00190
00192 void clearMemory();
00193
00195 void setDefaultValues();
00196
00198
00206 void levelSolveH(LevelData<NodeFArrayBox>& a_phi,
00207 const LevelData<NodeFArrayBox>& a_rhs,
00208 bool a_initializePhiToZero = true);
00209
00211
00221 void levelSolve(LevelData<NodeFArrayBox>& a_phi,
00222 const LevelData<NodeFArrayBox>* a_phiCoarse,
00223 const LevelData<NodeFArrayBox>& a_rhs,
00224 bool a_initializePhiToZero = true);
00225
00226 protected:
00227
00228
00229 NodeLevelMG m_levelMG;
00230
00231
00232 NodeLevelOp* m_levelOpPtr;
00233
00234
00235 bool m_isDefined;
00236
00237
00238 DisjointBoxLayout m_grids;
00239
00240
00241 ProblemDomain m_domain;
00242
00243
00244 LevelData<NodeFArrayBox> m_resid;
00245
00246
00247 LevelData<NodeFArrayBox> m_scratch;
00248
00249
00250 LevelData<NodeFArrayBox> m_corr;
00251
00252
00253 int m_refToCoarse;
00254
00255
00256 Real m_dx;
00257
00258
00259 int m_maxIter;
00260
00261
00262 int m_minIter;
00263
00264
00265 Real m_tolerance;
00266
00267
00268 Real m_operatorTolerance;
00269
00270
00271 bool m_bottomSolveFlag;
00272
00273
00274 bool m_verbose;
00275
00276
00277 LayoutData< Vector<IntVectSet> > m_IVSV;
00278
00279
00280 LayoutData< Vector<IntVectSet> > m_IVSVext;
00281
00282 private:
00283
00284 int countCoarserLevels(int a_minLength);
00285
00286 void operator = (const LevelNodeSolver&){;}
00287 LevelNodeSolver(const LevelNodeSolver&){;}
00288
00289 };
00290
00291 #endif