00001 #ifdef CH_LANG_CC
00002
00003
00004
00005
00006
00007
00008
00009 #endif
00010
00011
00012
00013
00014
00015 #ifndef LEVELNODESOLVER_H
00016 #define LEVELNODESOLVER_H
00017
00018 #include <cstdlib>
00019 #include <iostream>
00020 #include "SPACE.H"
00021 #include <cmath>
00022 #include "REAL.H"
00023 #include "IntVectSet.H"
00024 #include "ProblemDomain.H"
00025 #include "NodeFArrayBox.H"
00026 #include "DisjointBoxLayout.H"
00027 #include "LevelData.H"
00028 #include "NodeLevelMG.H"
00029 #include "NodeLevelOp.H"
00030
00031 #include "UsingNamespace.H"
00032
00034 class LevelNodeSolver
00037 {
00038
00039 public:
00040
00045
00047
00049 LevelNodeSolver();
00050
00052
00056 LevelNodeSolver(const DisjointBoxLayout& a_grids,
00057 const DisjointBoxLayout* a_gridsCoarsePtr,
00058 const ProblemDomain& a_domain,
00059 Real a_dx,
00060 int a_refToCoarse,
00061 const NodeLevelOp* const a_opin,
00062 int a_minLength = 1);
00063
00065
00069 LevelNodeSolver(const DisjointBoxLayout& a_grids,
00070 const DisjointBoxLayout* a_gridsCoarsePtr,
00071 const Box& a_domain,
00072 Real a_dx,
00073 int a_refToCoarse,
00074 const NodeLevelOp* const a_opin,
00075 int a_minLength = 1);
00076
00078
00080 virtual ~LevelNodeSolver();
00081
00083
00086 virtual void define(
00087 const DisjointBoxLayout& a_grids,
00089 const DisjointBoxLayout* a_gridsCoarsePtr,
00091 const ProblemDomain& a_domain,
00093 Real a_dx,
00095 int a_refToCoarse,
00097 const NodeLevelOp* const a_opin,
00099 int a_minLength = 1);
00100
00102
00105 virtual void define(
00106 const DisjointBoxLayout& a_grids,
00108 const DisjointBoxLayout* a_gridsCoarsePtr,
00110 const Box& a_domain,
00112 Real a_dx,
00114 int a_refToCoarse,
00116 const NodeLevelOp* const a_opin,
00118 int a_minLength = 1);
00119
00126
00128
00131 bool isDefined() const;
00132
00133
00140
00142
00145 void setnumSmoothUp(int a_numSmoothUp);
00146
00148
00151 void setnumSmoothDown(int a_numSmoothDown);
00152
00154
00157 void setBottomSmoothing(bool a_bottomSolveFlag);
00158
00160
00162 void setTolerance(Real a_tolerance);
00163
00165
00172 void setOperatorTolerance(Real a_operatorTolerance);
00173
00175
00178 void setVerbose(bool a_verbose);
00179
00181
00184 void setMaxIter(int a_maxIter);
00185
00187
00192 void setMinIter(int a_minIter);
00193
00200
00203 void clearMemory();
00204
00207 void setDefaultValues();
00208
00210
00213 void levelSolveH(
00214 LevelData<NodeFArrayBox>& a_phi,
00216 const LevelData<NodeFArrayBox>& a_rhs,
00218 bool a_initializePhiToZero = true);
00219
00221
00224 void levelSolve(
00225 LevelData<NodeFArrayBox>& a_phi,
00227 const LevelData<NodeFArrayBox>* a_phiCoarse,
00229 const LevelData<NodeFArrayBox>& a_rhs,
00231 bool a_initializePhiToZero = true);
00232
00235 protected:
00236
00239 NodeLevelMG m_levelMG;
00240
00243 NodeLevelOp* m_levelOpPtr;
00244
00247 bool m_isDefined;
00248
00251 DisjointBoxLayout m_grids;
00252
00255 ProblemDomain m_domain;
00256
00259 LevelData<NodeFArrayBox> m_resid;
00260
00263 LevelData<NodeFArrayBox> m_scratch;
00264
00267 LevelData<NodeFArrayBox> m_corr;
00268
00271 int m_refToCoarse;
00272
00275 Real m_dx;
00276
00279 int m_maxIter;
00280
00283 int m_minIter;
00284
00287 Real m_tolerance;
00288
00292 Real m_operatorTolerance;
00293
00296 bool m_bottomSolveFlag;
00297
00300 bool m_verbose;
00301
00304 LayoutData< Vector<IntVectSet> > m_IVSV;
00305
00308 LayoutData< Vector<IntVectSet> > m_IVSVext;
00309
00310 private:
00311
00312 int countCoarserLevels(int a_minLength);
00313
00314 void operator = (const LevelNodeSolver&){;}
00315 LevelNodeSolver(const LevelNodeSolver&){;}
00316
00317 };
00318
00319 #endif