00001
00002 #ifndef _REF_CELL_TAGGER_H_
00003 #define _REF_CELL_TAGGER_H_
00004
00005 #include <iostream>
00006 #include <string>
00007
00008 #include "LevelData.H"
00009 #include "FArrayBox.H"
00010 #include "IntVectSet.H"
00011 #include "Vector.H"
00012 #include "REAL.H"
00013
00015
00030
00031
00032
00033
00034
00035 enum RefineMode {FIX, AND, OR};
00036
00037 class RefCellTagger
00038 {
00039 public:
00041 RefCellTagger();
00042
00044 RefCellTagger(const ProblemDomain& a_problemDomain,
00045 const Real& a_dx,
00046 const int& a_refRatio);
00047
00049 virtual ~RefCellTagger() {;};
00050
00052 void define();
00053
00055 void define(const ProblemDomain& a_problemDomain,
00056 const Real& a_dx,
00057 const int& a_refRatio);
00059 void setParameters(const bool a_useRefineGradient,
00060 const Real& a_gradientThreshold,
00061 const Interval& a_gradVarInterval,
00062 const bool a_useRefineOverDensity,
00063 const Real& a_cellMassThreshold,
00064 const bool a_useRefineShocks,
00065 const Real& a_presJumpThreshold,
00066 const bool a_useRefineVorticity,
00067 const Real& a_vorticityThreshold,
00068 const bool a_useRefineJeansLength,
00069 const Real& a_jeansResolThreshold,
00070 const bool a_useRefineRegion,
00071 const Vector<Box>& a_refineRegion,
00072 const Vector<RefineMode>& a_refineMode);
00073
00075 virtual RefCellTagger* new_refCellTagger() const;
00076
00078 void setRefineShocks(const bool a_useRefineShocks,
00079 const Real& a_presJumpThreshold);
00080
00082 void setRefineVorticity(const bool a_useRefineVorticity,
00083 const Real& a_vortexThreshold);
00084
00086 void setRefineGradient(const bool a_useRefineGradient,
00087 const Real& a_gradientThreshold,
00088 const Interval& a_gradVarInterval);
00089
00091 void setRefineOverdense(const bool a_useRefineOverDensity,
00092 const Real& a_cellMassThreshold);
00093
00095 void setRefineJeans(const bool a_useRefineJeans,
00096 const Real& a_jeansResolThreshold);
00097
00099 void setRefineRegion(const bool a_useRefineRegion,
00100 const Vector<Box>& a_refineRegion,
00101 const Vector<RefineMode>& a_refMode);
00102
00104 bool refineShocks() {return m_useRefineShocks;};
00105
00107 bool refineVorticity() {return m_useRefineVorticity;};
00108
00110 bool refineOverdense() {return m_useRefineOverDensity;};
00111
00113 bool refineGradient(const std::string a_var);
00114
00116 bool refineJeans() {return m_useRefineJeansLength;};
00117
00119 bool refineRegion() {return m_useRefineRegion;};
00120
00122 virtual bool needGhostCells()
00123 {return (m_useRefineGradient || m_useRefineShocks || m_useRefineVorticity);};
00124
00126 virtual IntVectSet tagShocks(const LevelData<FArrayBox>& a_U);
00127
00129 virtual IntVectSet tagVorticity(const LevelData<FArrayBox>& a_U);
00130
00132 virtual IntVectSet tagJeans(const LevelData<FArrayBox>& a_U);
00133
00135 virtual IntVectSet tagOverdense(const LevelData<FArrayBox>& a_rho);
00136
00138 virtual IntVectSet tagGradient(const LevelData<FArrayBox>& a_U);
00139
00141 virtual IntVectSet tagRegion(const RealVect& a_low,
00142 const RealVect& a_high,
00143 const DisjointBoxLayout& a_grids);
00144
00146 virtual IntVectSet tagRegion(const IntVectSet& a_tags,
00147 const int a_level,
00148 const DisjointBoxLayout& a_grids);
00149
00150 protected:
00151
00152 void relativeGradient(FArrayBox& a_gradMagFab,
00153 const FArrayBox& a_varFab,
00154 const int a_comp,
00155 const Box& a_box);
00156
00157 protected:
00158
00159 bool m_isDefined;
00160
00161
00162 Real m_dx;
00163
00164
00165 ProblemDomain m_problemDomain;
00166
00167
00168 Real m_refRatio;
00169
00170
00171 Real m_presJumpThreshold;
00172 bool m_useRefineShocks;
00173 bool m_isRefineShocksSet;
00174
00175
00176 Real m_vorticityThreshold;
00177 bool m_useRefineVorticity;
00178 bool m_isRefineVorticitySet;
00179
00180
00181 Real m_cellMassThreshold;
00182 bool m_useRefineOverDensity;
00183 bool m_isRefineOverDensitySet;
00184
00185
00186 Real m_jeansResolThreshold;
00187 bool m_useRefineJeansLength;
00188 bool m_isRefineJeansLengthSet;
00189
00190
00191 Real m_gradientThreshold;
00192 bool m_useRefineGradient;
00193 Interval m_gradVarInterval;
00194 bool m_isRefineGradientSet;
00195
00196
00197
00198 Vector<Box> m_refineRegion;
00199 Vector<RefineMode> m_refineMode;
00200 bool m_useRefineRegion;
00201 bool m_isRefineRegionSet;
00202 };
00203
00204 #endif