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
00033 #ifndef LEVELNODESOLVER_H
00034 #define LEVELNODESOLVER_H
00035
00036 #include <cstdlib>
00037 #include <iostream>
00038 #include <assert.h>
00039 #include <cmath>
00040 #include "REAL.H"
00041 #include "IntVectSet.H"
00042 #include "ProblemDomain.H"
00043 #include "NodeFArrayBox.H"
00044 #include "DisjointBoxLayout.H"
00045 #include "LevelData.H"
00046 #include "NodeLevelMG.H"
00047 #include "NodeMaskLevelOp.H"
00048
00049
00051 class LevelNodeSolver
00054 {
00055
00056 public:
00057
00059
00061
00063 LevelNodeSolver();
00064
00066
00070 LevelNodeSolver(const DisjointBoxLayout& a_grids,
00071 const DisjointBoxLayout* a_gridsCoarsePtr,
00072 const ProblemDomain& a_domain,
00073 Real a_dx,
00074 int a_refToCoarse,
00075 const NodeMaskLevelOp* const a_opin,
00076 int a_minLength = 1);
00077
00078 LevelNodeSolver(const DisjointBoxLayout& a_grids,
00079 const DisjointBoxLayout* a_gridsCoarsePtr,
00080 const Box& a_domain,
00081 Real a_dx,
00082 int a_refToCoarse,
00083 const NodeMaskLevelOp* const a_opin,
00084 int a_minLength = 1);
00085
00087
00089 virtual ~LevelNodeSolver();
00090
00091
00093
00108 virtual void define(const DisjointBoxLayout& a_grids,
00109 const DisjointBoxLayout* a_gridsCoarsePtr,
00110 const ProblemDomain& a_domain,
00111 Real a_dx,
00112 int a_refToCoarse,
00113 const NodeMaskLevelOp* const a_opin,
00114 int a_minLength = 1);
00115
00116 virtual void define(const DisjointBoxLayout& a_grids,
00117 const DisjointBoxLayout* a_gridsCoarsePtr,
00118 const Box& a_domain,
00119 Real a_dx,
00120 int a_refToCoarse,
00121 const NodeMaskLevelOp* const a_opin,
00122 int a_minLength = 1);
00123
00125
00127
00130 bool isDefined() const;
00131
00132
00134
00136
00139 void setnumBottomGSRB(int a_numBottomGSRB);
00140
00142
00145 void setnumSmoothUp(int a_numSmoothUp);
00146
00148
00151 void setnumSmoothDown(int a_numSmoothDown);
00152
00154
00156 void setBottomSmoothing(bool a_bottomSolveFlag);
00157
00159
00161 void setTolerance(Real a_tolerance);
00162
00164
00170 void setOperatorTolerance(Real a_operatorTolerance);
00171
00173
00175 void setVerbose(bool a_verbose);
00176
00178
00181 void setMaxIter(int a_maxIter);
00182
00184
00189 void setMinIter(int a_minIter);
00190
00192
00194 void clearMemory();
00195
00197 void setDefaultValues();
00198
00200
00208 void levelSolveH(LevelData<NodeFArrayBox>& a_phi,
00209 const LevelData<NodeFArrayBox>& a_rhs,
00210 bool a_initializePhiToZero = true);
00211
00213
00223 void levelSolve(LevelData<NodeFArrayBox>& a_phi,
00224 const LevelData<NodeFArrayBox>* a_phiCoarse,
00225 const LevelData<NodeFArrayBox>& a_rhs,
00226 bool a_initializePhiToZero = true);
00227
00228 protected:
00229
00230
00231 NodeLevelMG m_levelMG;
00232
00233
00234 NodeMaskLevelOp* m_levelOpPtr;
00235
00236
00237 bool m_isDefined;
00238
00239
00240 DisjointBoxLayout m_grids;
00241
00242
00243 ProblemDomain m_domain;
00244
00245
00246 LevelData<NodeFArrayBox> m_resid;
00247
00248
00249 LevelData<NodeFArrayBox> m_scratch;
00250
00251
00252 LevelData<NodeFArrayBox> m_corr;
00253
00254
00255 int m_refToCoarse;
00256
00257
00258 Real m_dx;
00259
00260
00261 int m_maxIter;
00262
00263
00264 int m_minIter;
00265
00266
00267 Real m_tolerance;
00268
00269
00270 Real m_operatorTolerance;
00271
00272
00273 bool m_bottomSolveFlag;
00274
00275
00276 bool m_verbose;
00277
00278
00279 LayoutData< Vector<IntVectSet> > m_IVSV;
00280
00281
00282 LayoutData< Vector<IntVectSet> > m_IVSVext;
00283
00284 private:
00285
00286 int countCoarserLevels(int a_minLength);
00287
00288 void operator = (const LevelNodeSolver&){;}
00289 LevelNodeSolver(const LevelNodeSolver&){;}
00290
00291 };
00292
00293 #endif