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 _GENAMRLEVELMG_H_
00030 #define _GENAMRLEVELMG_H_
00031
00032 #include <stdlib.h>
00033 #include <iostream>
00034 #include <assert.h>
00035 #include <math.h>
00036
00037 #include "REAL.H"
00038 #include "IntVect.H"
00039 #include "Box.H"
00040 #include "DisjointBoxLayout.H"
00041 #include "LevelFluxRegister.H"
00042 #include "BaseFab.H"
00043 #include "Copier.H"
00044 #include "CoarseAverage.H"
00045
00046 #include "GenMGInterp.H"
00047 #include "GenAMRLevelMGOp.H"
00048 #include "GenLevelMG.H"
00049
00050 template <class T> class GenAMRSolver;
00051
00053
00059 template <class T> class GenAMRLevelMG
00060 {
00061 public:
00062 friend class GenAMRSolver<T>;
00063
00065 GenAMRLevelMG();
00066
00068
00071 GenAMRLevelMG(const GenAMRSolver<T>* const a_parent,
00072 int a_level,
00073 const GenAMRLevelMGOp<T>* const a_opin,
00074 int a_ncomp = 1);
00075
00077 ~GenAMRLevelMG();
00078
00080 bool isDefined() const;
00081
00083
00088 void define(const GenAMRSolver<T>* const a_parent,
00089 int a_level,
00090 const GenAMRLevelMGOp<T>* const a_opin,
00091 int a_ncomp = 1);
00092
00094
00097 void setnumSmoothUp(int a_numSmoothUp);
00098
00100
00103 void setnumSmoothDown(int a_numSmoothDown);
00104
00106
00112 void applyAMROperator(Vector<T *>& a_phiLevel,
00113 T& a_LOfPhi);
00114
00116
00121 void applyAMROperatorHphys(Vector<T *>& a_phiLevel,
00122 T& a_LOfPhi);
00123
00125
00129 void computeAMRResidual(Vector<T *>& a_phiLevel,
00130 const Vector<T *>& a_rhsLevel);
00131
00133
00137 void computeAMRResidual(T& a_resid,
00138 Vector<T* >& a_phiLevel,
00139 const Vector<T* >& a_rhsLevel);
00140
00142
00146 void computeAMRResidualHphys(Vector<T *>& a_phiLevel,
00147 const Vector<T *>& a_rhsLevel);
00148
00150
00153 void upSweep(Vector<T *>& a_phiLevel,
00154 const Vector<T *>& a_rhsLevel);
00155
00157
00160 void downSweep(Vector<T *>& a_phiLevel,
00161 const Vector<T *>& a_rhsLevel);
00162
00164
00167 Vector<Real> computeResidualNorm(int a_normType) const;
00168
00169
00170 GenAMRLevelMGOp<T>* levelOpPtr() const;
00171
00172
00173 Vector<Real> computeNorm(const T & a_mfinput,
00174 int a_normType) const;
00175
00176 protected:
00177
00178
00179 void smooth(T& a_soln,
00180 const T& a_rhs);
00181
00182
00183 void clearMemory();
00184
00185
00186 void setDefaultValues();
00187
00188
00189
00190
00191
00192
00193
00194
00195 void reflux(Vector<T *>& a_phiLevel,
00196 T& a_LOfPhi);
00197
00198
00199
00200
00201 void initFRCoarse(Vector<T *>& a_phiLevel);
00202
00203
00204
00205
00206 void incrementFRFine(Vector<T *>& a_phiLevel);
00207
00208
00209 const GenAMRSolver<T>* m_parent;
00210
00211
00212 GenLevelMG<T> m_levelMG;
00213
00214
00215 GenMGInterp<T> m_mginterp;
00216
00217
00218 LevelFluxRegister m_levfluxreg;
00219
00220
00221 bool m_isDefined;
00222
00223 DisjointBoxLayout m_coarsenedGrids;
00224
00225 T m_resid;
00226
00227
00228 T m_corr;
00229
00230
00231 T m_dcorr;
00232
00233
00234 T m_lofPhi;
00235
00236
00237 T m_phiSave;
00238
00239 T m_resC;
00240
00241
00242
00243 Copier m_residualCopier;
00244
00245
00246
00247 Copier m_fineExchangeCopier;
00248
00249
00250 int m_level;
00251
00252
00253 GenAMRLevelMGOp<T>* m_levelopPtr;
00254
00255
00256 CoarseAverage m_averageOp;
00257
00258 bool m_arrayViewVerbose;
00259
00260 private:
00261 void setArrayViewVerbose(bool a_verbosity);
00262
00263 GenAMRLevelMG<T>(const GenAMRLevelMG<T>&) {};
00264 void operator= (const GenAMRLevelMG<T>&) {};
00265 };
00266
00267 #include "GenAMRLevelMGImplem.H"
00268
00269 #endif