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
00060
00062
00064 LevelNodeSolver();
00065
00067
00071 LevelNodeSolver(const DisjointBoxLayout& a_grids,
00072 const DisjointBoxLayout* a_gridsCoarsePtr,
00073 const ProblemDomain& a_domain,
00074 Real a_dx,
00075 int a_refToCoarse,
00076 const NodeLevelOp* const a_opin,
00077 int a_minLength = 1);
00078
00080
00084 LevelNodeSolver(const DisjointBoxLayout& a_grids,
00085 const DisjointBoxLayout* a_gridsCoarsePtr,
00086 const Box& a_domain,
00087 Real a_dx,
00088 int a_refToCoarse,
00089 const NodeLevelOp* const a_opin,
00090 int a_minLength = 1);
00091
00093
00095 virtual ~LevelNodeSolver();
00096
00098
00101 virtual void define(
00102 const DisjointBoxLayout& a_grids,
00104 const DisjointBoxLayout* a_gridsCoarsePtr,
00106 const ProblemDomain& a_domain,
00108 Real a_dx,
00110 int a_refToCoarse,
00112 const NodeLevelOp* const a_opin,
00114 int a_minLength = 1);
00115
00117
00120 virtual void define(
00121 const DisjointBoxLayout& a_grids,
00123 const DisjointBoxLayout* a_gridsCoarsePtr,
00125 const Box& a_domain,
00127 Real a_dx,
00129 int a_refToCoarse,
00131 const NodeLevelOp* const a_opin,
00133 int a_minLength = 1);
00134
00141
00143
00146 bool isDefined() const;
00147
00148
00155
00157
00160 void setnumSmoothUp(int a_numSmoothUp);
00161
00163
00166 void setnumSmoothDown(int a_numSmoothDown);
00167
00169
00172 void setBottomSmoothing(bool a_bottomSolveFlag);
00173
00175
00177 void setTolerance(Real a_tolerance);
00178
00180
00187 void setOperatorTolerance(Real a_operatorTolerance);
00188
00190
00193 void setVerbose(bool a_verbose);
00194
00196
00199 void setMaxIter(int a_maxIter);
00200
00202
00207 void setMinIter(int a_minIter);
00208
00215
00218 void clearMemory();
00219
00222 void setDefaultValues();
00223
00225
00228 void levelSolveH(
00229 LevelData<NodeFArrayBox>& a_phi,
00231 const LevelData<NodeFArrayBox>& a_rhs,
00233 bool a_initializePhiToZero = true);
00234
00236
00239 void levelSolve(
00240 LevelData<NodeFArrayBox>& a_phi,
00242 const LevelData<NodeFArrayBox>* a_phiCoarse,
00244 const LevelData<NodeFArrayBox>& a_rhs,
00246 bool a_initializePhiToZero = true);
00247
00250 protected:
00251
00254 NodeLevelMG m_levelMG;
00255
00258 NodeLevelOp* m_levelOpPtr;
00259
00262 bool m_isDefined;
00263
00266 DisjointBoxLayout m_grids;
00267
00270 ProblemDomain m_domain;
00271
00274 LevelData<NodeFArrayBox> m_resid;
00275
00278 LevelData<NodeFArrayBox> m_scratch;
00279
00282 LevelData<NodeFArrayBox> m_corr;
00283
00286 int m_refToCoarse;
00287
00290 Real m_dx;
00291
00294 int m_maxIter;
00295
00298 int m_minIter;
00299
00302 Real m_tolerance;
00303
00307 Real m_operatorTolerance;
00308
00311 bool m_bottomSolveFlag;
00312
00315 bool m_verbose;
00316
00319 LayoutData< Vector<IntVectSet> > m_IVSV;
00320
00323 LayoutData< Vector<IntVectSet> > m_IVSVext;
00324
00325 private:
00326
00327 int countCoarserLevels(int a_minLength);
00328
00329 void operator = (const LevelNodeSolver&){;}
00330 LevelNodeSolver(const LevelNodeSolver&){;}
00331
00332 };
00333
00334 #endif