00001 #ifdef CH_LANG_CC
00002
00003
00004
00005
00006
00007
00008
00009 #endif
00010
00011 #ifndef _NEWGEOMETRYSHOP_H_
00012 #define _NEWGEOMETRYSHOP_H_
00013
00014 #include "REAL.H"
00015 #include "RealVect.H"
00016 #include "Box.H"
00017 #include "IntVect.H"
00018 #include "EBISBox.H"
00019 #include "GeometryService.H"
00020 #include "GeometryShop.H"
00021 #include "LSquares.H"
00022 #include "BaseIF.H"
00023 #include "AMRIO.H"
00024
00025 #include "ReferenceHeightIF.H"
00026 #include "CutCellMoments.H"
00027
00028 #include "NamespaceHeader.H"
00030
00035 class NewGeometryShop: public GeometryService
00036 {
00037
00038 public:
00040
00043 NewGeometryShop(const ReferenceHeightIF & a_baseIF,
00044 const RealVect & a_origin,
00045 const RealVect & a_vectDx,
00046 const ProblemDomain & a_domain,
00047 const int & a_order = GEOMETRY_ORDER,
00048 const int & a_degreeP = GEOMETRY_DEGREEP,
00049 const bool & a_useConstraints = GEOMETRY_CONSTRAINTS);
00050
00052 ~NewGeometryShop();
00053
00058 bool isRegular(const Box & a_region,
00059 const ProblemDomain & a_domain,
00060 const RealVect & a_origin,
00061 const Real & a_dx) const;
00062
00064
00068 bool isCovered(const Box & a_region,
00069 const ProblemDomain & a_domain,
00070 const RealVect & a_origin,
00071 const Real & a_dx) const;
00072
00073
00074 virtual bool isIrregular(const Box & a_region,
00075 const ProblemDomain & a_domain,
00076 const RealVect & a_origin,
00077 const Real & a_dx) const;
00078
00079 virtual bool canGenerateMultiCells() const
00080 {
00081 return false;
00082 }
00083
00085
00088 virtual void fillGraph(BaseFab<int> & a_regIrregCovered,
00089 Vector<IrregNode> & a_nodes,
00090 const Box & a_validRegion,
00091 const Box & a_ghostRegion,
00092 const ProblemDomain & a_domain,
00093 const RealVect & a_origin,
00094 const Real & a_dx) const;
00095
00098 void computeVoFInternals(Real & a_volFrac,
00099 Vector<int> a_loArc[SpaceDim],
00100 Vector<int> a_hiArc[SpaceDim],
00101 Vector<Real> a_loAreaFrac[SpaceDim],
00102 Vector<Real> a_hiAreaFrac[SpaceDim],
00103 Real & a_bndryArea,
00104 RealVect & a_normal,
00105 RealVect & a_volCentroid,
00106 RealVect & a_bndryCentroid,
00107 Vector<RealVect> a_loFaceCentroid[SpaceDim],
00108 Vector<RealVect> a_hiFaceCentroid[SpaceDim],
00109 const IntVectSet & a_ivsIrreg,
00110 const VolIndex & a_vof,
00111 const ProblemDomain & a_domain,
00112 const RealVect & a_origin,
00113 const Real & a_dx,
00114 const RealVect & a_vectDx,
00115 const IntVect & a_iv) const;
00116
00117
00118 void settCurrIv(const IntVect& a_iv)const;
00119
00120
00121 void fillResiduals(int & a_degreeP)const;
00122
00123
00124 Real fillVolFrac()const;
00125
00126
00127 void fillArc(Vector<int> a_arc[SpaceDim],
00128 const int & a_hilo,
00129 const IntVectSet & a_ivsIrreg)const;
00130
00131 void fillLoArc(Vector<int> a_loArc[SpaceDim],
00132 const IntVectSet & a_ivsIrreg)const;
00133
00134 void fillHiArc(Vector<int> a_hiArc[SpaceDim],
00135 const IntVectSet & a_ivsIrreg)const;
00136
00137 void fillAreaFrac(Vector<Real> a_AreaFrac[SpaceDim],
00138 const int & a_hilo)const;
00139
00140 void fillLoAreaFrac(Vector<Real> a_loAreaFrac[SpaceDim])const;
00141
00142
00143 void fillHiAreaFrac(Vector<Real> a_hiAreaFrac[SpaceDim])const;
00144
00145
00146 Real fillBndryArea()const;
00147
00148
00149 RealVect fillNormal()const;
00150
00151
00152 RealVect fillvolCentroid()const;
00153
00154
00155 RealVect fillBndryCentroid()const;
00156
00157
00158 void fillFaceCentroid(Vector<RealVect>a_loFaceCentroid[SpaceDim],
00159 const int & a_hilo)const;
00160
00161 void fillLoFaceCentroid(Vector<RealVect>a_LOFaceCentroid[SpaceDim])const;
00162
00163 void fillHiFaceCentroid(Vector<RealVect>a_hiFaceCentroid[SpaceDim])const;
00164
00165
00166
00167 void clipComputedVal(Real & a_volFrac,
00168 Vector<Real> a_loAreaFrac[SpaceDim],
00169 Vector<Real> a_hiAreaFrac[SpaceDim],
00170 Real & a_bndryArea,
00171 RealVect & a_volCentroid,
00172 RealVect & a_bndryCentroid,
00173 Vector<RealVect> a_loFaceCentroid[SpaceDim],
00174 Vector<RealVect> a_hiFaceCentroid[SpaceDim],
00175 const IntVect & a_iv)const;
00176
00177
00178 RealVect convertIndexTM2RealVect(const IndexTM<Real,SpaceDim>& a_indexTm)const;
00179
00180
00181 IndexTM<Real,SpaceDim>convertRealVect2IndexTM(const RealVect& a_realVect)const;
00182
00183
00184
00185 IntVect convertIndexTM2IntVect(const IndexTM<int,SpaceDim>& a_indexTm)const;
00186
00187
00188 IndexTM<int,SpaceDim>convertIntVect2IndexTM(const IntVect& a_intVect)const;
00189
00190
00191 RealVect convert2RelativeCoord(const RealVect& a_rVect)const;
00192
00193
00194
00195 RealVect convert2RelativeCoord(const IndexTM<Real,SpaceDim>& a_rVect)const;
00196 int m_phase;
00197
00198
00199 void outputResidual(int & type,int & a_degreeP)const;
00200 void outputGradNormal()const;
00201
00202 private:
00203 int m_numCellsClipped;
00204 Real m_threshold;
00205
00206
00207 RealVect m_origin;
00208
00209 RealVect m_vectDx;
00210 RvgDim m_dxVect;
00211
00212 int m_order;
00213 int m_degreeP;
00214 bool m_useConstraints;
00215
00216
00217 Real m_volScaleFactor;
00218
00219
00220 Real m_bndryAreaScaleFactor;
00221
00222
00223 mutable FArrayBox m_residuals;
00224 mutable FArrayBox m_gradNormal;
00225
00226
00227 mutable IntVect m_currIv;
00228
00229 ProblemDomain m_domain;
00230
00231 const ReferenceHeightIF * m_baseIF;
00232
00233 #if USING_TOP_FACE_MOMENTS
00234 CutCellMoments<GLOBALDIM-1> m_cutCellMoments;
00235 #else
00236 CutCellMoments<GLOBALDIM> m_cutCellMoments;
00237 #endif
00238
00239 static bool s_verbose;
00240
00245 bool isRegularEveryPoint(const Box& a_region,
00246 const ProblemDomain& a_domain,
00247 const RealVect& a_origin,
00248 const Real& a_dx) const;
00249
00251
00255 bool isCoveredEveryPoint(const Box& a_region,
00256 const ProblemDomain& a_domain,
00257 const RealVect& a_origin,
00258 const Real& a_dx) const;
00259
00260
00261 virtual bool isIrregularEveryPoint(const Box& a_region,
00262 const ProblemDomain& a_domain,
00263 const RealVect& a_origin,
00264 const Real& a_dx,
00265 const Real& a_originVal) const ;
00266
00267 int getNumCellsClipped();
00268
00269
00270 NewGeometryShop()
00271 {
00272 MayDay::Error("GeometryShop uses strong construction only");
00273 }
00274 NewGeometryShop(const NewGeometryShop& a_workshopin)
00275 {
00276 MayDay::Error("GeometryShop disallows copy contruction");
00277 }
00278 void operator=(const NewGeometryShop& a_workshopin)
00279 {
00280 MayDay::Error("GeometryShop disallows the assignment operator");
00281 }
00282
00283 };
00284 #include "NamespaceFooter.H"
00285 #endif