00001 #ifdef CH_LANG_CC
00002
00003
00004
00005
00006
00007
00008
00009 #endif
00010
00011
00012
00013 #ifndef _EBDATA_H_
00014 #define _EBDATA_H_
00015
00016 template <class T>
00017 int linearSize(const T& inputT);
00018
00019 template <class T>
00020 void linearIn(T& a_outputT, const void* const inBuf);
00021
00022 template <class T>
00023 void linearOut(void* const a_outBuf, const T& inputT);
00024
00025 #include "REAL.H"
00026 #include "EBGraph.H"
00027 #include "IrregNode.H"
00028 #include "BaseIVFAB.H"
00029 #include "BaseIFFAB.H"
00030 #include "RealVect.H"
00031 #include "NamespaceHeader.H"
00032
00033 class BoundaryData
00034 {
00035 public:
00036 BoundaryData();
00037 BoundaryData(const Real& bndryArea, const RealVect& normal,
00038 const RealVect& bndryCentroid, int phase,const VolIndex& index):
00039 m_bndryArea(bndryArea), m_normal(normal), m_bndryCentroid(bndryCentroid),
00040 m_bndryPhase(phase), m_volIndex(index){}
00041 Real m_bndryArea;
00042 RealVect m_normal;
00043 RealVect m_bndryCentroid;
00044 int m_bndryPhase;
00045 VolIndex m_volIndex;
00046 };
00047
00049
00051 class VolData
00052 {
00053 public:
00054 VolData();
00055 Real m_volFrac;
00056 RealVect m_volCentroid;
00057 BoundaryData m_averageFace;
00058 Vector<BoundaryData> m_phaseFaces;
00059 };
00060
00062
00063 template < >
00064 int linearSize(const VolData& vdata);
00065 template < >
00066 void linearIn(VolData& a_outputT, const void* const inBuf);
00067 template < >
00068 void linearOut(void* const a_outBuf, const VolData& a_inputT);
00069
00070
00071
00072 std::ostream& operator<< (std::ostream& a_os,
00073 const VolData& a_iv);
00075
00077 class FaceData
00078 {
00079 public:
00080 Real m_areaFrac;
00081 RealVect m_faceCentroid;
00082 };
00083
00084 template < >
00085 int linearSize(const FaceData& vdata);
00086 template < >
00087 void linearIn(FaceData& a_outputT, const void* const inBuf);
00088 template < >
00089 void linearOut(void* const a_outBuf, const FaceData& a_inputT);
00090
00092
00096 class EBDataImplem
00097 {
00098
00099 public:
00100
00102 EBDataImplem();
00103
00105 ~EBDataImplem();
00106
00108
00111 void define(const Box& box, int comps);
00112
00114
00117 EBDataImplem(const Box& a_box, int a_comps);
00118
00120
00126 void copy(const Box& a_regionFrom,
00127 const Interval& a_Cd,
00128 const Box& a_regionto,
00129 const EBDataImplem& a_source,
00130 const Interval& a_Cs);
00131
00133 void
00134 defineVoFData(const EBGraph& a_graph, const Box& a_region);
00135
00137 void
00138 defineFaceData(const EBGraph& a_graph, const Box& a_region);
00139
00141 void
00142 define(const EBGraph& a_graph,
00143 const Vector<IrregNode>& a_irregData,
00144 const Box& a_validBox);
00145
00147 void
00148 coarsenVoFs(const EBDataImplem& a_fineEBDataImplem,
00149 const EBGraph& a_fineGraph,
00150 const EBGraph& a_coarGraph,
00151 const Box& a_validRegion);
00152
00154 void
00155 coarsenFaces(const EBDataImplem& a_fineEBDataImplem,
00156 const EBGraph& a_fineGraph,
00157 const EBGraph& a_coarGraph,
00158 const Box& a_validRegion);
00160 const Real& volFrac(const VolIndex& a_vof) const;
00161
00163 const Real& areaFrac(const FaceIndex& a_face1) const;
00164
00166 const RealVect& centroid(const FaceIndex& facein) const;
00167
00169 const RealVect& centroid(const VolIndex& a_vof) const;
00170
00172 const RealVect& bndryCentroid(const VolIndex& a_vof) const;
00173 const RealVect& bndryCentroid(const VolIndex& a_vof, int face) const;
00174
00176 const Real& bndryArea(const VolIndex& a_vof) const;
00177 const Real& bndryArea(const VolIndex& a_vof, int face) const;
00178
00180 const RealVect& normal(const VolIndex& a_vof) const;
00181 const RealVect& normal(const VolIndex& a_vof, int face) const;
00182
00183
00185
00187 int facePhase(const VolIndex& a_vof, int face) const ;
00188
00190 const VolIndex& faceIndex(const VolIndex& a_vof, int face) const ;
00191
00193 void setFacePhase(const VolIndex& a_vof, int face, int phase);
00196 void setFaceIndex(const VolIndex& a_vof, int face, const VolIndex& index);
00197
00199 int numFacePhase(const VolIndex& a_vof) const ;
00200
00201 void clearMultiBoundaries();
00202 void setBoundaryPhase(int phase);
00206 int size(const Box& R, const Interval& comps) const;
00207
00209 void linearOut(void* buf, const Box& R, const Interval& comps) const;
00210
00212 void linearIn(void* buf, const Box& R, const Interval& comps);
00213
00215 static int preAllocatable()
00216 {
00217 return 2;
00218 }
00219
00220 BaseIVFAB<VolData>& getVolData()
00221 {
00222 return m_volData;
00223 }
00224 const BaseIVFAB<VolData>& getVolData() const
00225 {
00226 return m_volData;
00227 }
00228
00230 void addFullIrregularVoFs(const IntVectSet& a_vofsToChange,
00231 const EBGraph& a_newGhostGraph,
00232 const BaseIVFAB<VolData>& a_newGhostData,
00233 const EBGraph& a_oldGhostGraph);
00234
00236 static void setVerbose(bool a_verbose);
00238 static void setVerboseDebug(bool a_verboseDebug);
00239 private:
00240
00241 static bool s_verbose;
00242 static bool s_verboseDebug;
00244 BaseIVFAB<VolData> m_volData;
00245
00247 BaseIFFAB<FaceData> m_faceData[SpaceDim];
00248
00250 bool m_isFaceDataDefined;
00251
00253 bool m_isVoFDataDefined;
00254
00255 void operator=(const EBDataImplem& ebiin)
00256 {;}
00257
00258 EBDataImplem(const EBDataImplem& ebiin)
00259 {;}
00260
00261 void
00262 coarsenFaceCentroid(RealVect& a_centroidCoar,
00263 const Vector<RealVect>& a_centroidsFine,
00264 const Vector<Real>& a_areaFracFine,
00265 const Vector<FaceIndex>& a_facesFine,
00266 const FaceIndex& a_faceCoar);
00267 void
00268 coarsenAreaFrac(Real& a_areaFracCoar,
00269 const Vector<Real>& a_areaFracFine);
00270
00271 void
00272 coarsenVolFracAndCentroid(Real& a_volFracCoar,
00273 RealVect& a_volCentroidCoar,
00274 const Vector<Real>& a_volFracFine,
00275 const Vector<RealVect>& a_volCentroidFine,
00276 const Vector<VolIndex>& a_fineVoFs,
00277 const VolIndex& a_coarVoF);
00278
00279 void
00280 coarsenBoundaryAreaAndNormal(Real& a_bndryAreaCoar,
00281 RealVect& a_normalCoar,
00282 const Vector<Real>& a_bndryAreaFine,
00283 const Vector<RealVect>& a_normalFine);
00284
00285 RealVect
00286 fineToCoarseTransform(const RealVect& a_finePoint,
00287 const IntVect& a_coarCell,
00288 const IntVect& a_fineCell);
00289
00290 void
00291 coarsenBndryCentroid(RealVect& a_bndryCentroidCoar,
00292 const Vector<RealVect>& a_bndryCentroidFine,
00293 const Vector<Real>& a_bndryAreaFine,
00294 const Vector<VolIndex>& a_fineVoFs,
00295 const VolIndex& a_coarVoF);
00296
00297 void fetch(std::list<const VolData*>& fineVols, const Vector<VolIndex>& vofsFine) const;
00298 };
00299
00301
00304 class EBData
00305 {
00306 public:
00307
00309 EBData();
00310
00312 ~EBData();
00313
00315
00318 void define(const Box& box, int comps);
00319
00321
00324 EBData(const Box& a_box, int a_comps);
00325
00327
00333 void copy(const Box& a_regionFrom,
00334 const Interval& a_Cd,
00335 const Box& a_regionto,
00336 const EBData& a_source,
00337 const Interval& a_Cs);
00338
00340 void
00341 defineVoFData(const EBGraph& a_graph, const Box& a_region);
00342
00344 void
00345 defineFaceData(const EBGraph& a_graph, const Box& a_region);
00346
00348 void
00349 define(const EBGraph& a_graph,
00350 const Vector<IrregNode>& a_irregData,
00351 const Box& a_validBox);
00352
00354 void
00355 coarsenVoFs(const EBData& a_fineEBData,
00356 const EBGraph& a_fineGraph,
00357 const EBGraph& a_coarGraph,
00358 const Box& a_validRegion);
00359
00360 void
00361 coarsenFaces(const EBData& a_fineEBData,
00362 const EBGraph& a_fineGraph,
00363 const EBGraph& a_coarGraph,
00364 const Box& a_validRegion);
00366 const Real& volFrac(const VolIndex& a_vof) const;
00367
00369 const Real& areaFrac(const FaceIndex& a_face1) const;
00370
00372 const RealVect& centroid(const FaceIndex& facein) const;
00373
00375 const RealVect& centroid(const VolIndex& a_vof) const;
00376
00378 const RealVect& bndryCentroid(const VolIndex& a_vof) const;
00379 const RealVect& bndryCentroid(const VolIndex& a_vof, int face) const;
00380
00382 const Real& bndryArea(const VolIndex& a_vof) const;
00383 const Real& bndryArea(const VolIndex& a_vof, int face) const;
00384
00386 const RealVect& normal(const VolIndex& a_vof) const;
00387 const RealVect& normal(const VolIndex& a_vof, int face) const;
00388
00390 int facePhase(const VolIndex& a_vof, int face) const ;
00391
00393 const VolIndex& faceIndex(const VolIndex& a_vof, int face) const ;
00394
00396 void setFacePhase(const VolIndex& a_vof, int face, int phase);
00397
00399 void setFaceIndex(const VolIndex& a_vof, int face, int index);
00401 int numFacePhase(const VolIndex& a_vof) const ;
00402
00403 void clearMultiBoundaries();
00404 void setBoundaryPhase(int phase);
00406 EBData(const EBData& a_ebiin);
00407
00409
00412 bool operator==(const EBData& a_ebiin);
00413
00415 EBData& operator=(const EBData& a_ebiin);
00416
00418
00421 int size(const Box& R, const Interval& comps) const;
00422
00424 void linearOut(void* buf, const Box& R, const Interval& comps) const;
00425
00427 void linearIn(void* buf, const Box& R, const Interval& comps);
00428
00430 void addFullIrregularVoFs(const IntVectSet& a_vofsToChange,
00431 const EBGraph& a_newGhostGraph,
00432 const BaseIVFAB<VolData>& a_grownData,
00433 const EBGraph& a_oldGhostGraph);
00434
00436 void
00437 computeNormalsAndBoundaryAreas(const EBGraph& a_graph,
00438 const Box& a_validRegion);
00439
00440 BaseIVFAB<VolData>& getVolData()
00441 {
00442 return m_implem->getVolData();
00443 }
00444
00445 const BaseIVFAB<VolData>& getVolData() const
00446 {
00447 return m_implem->getVolData();
00448 }
00449
00451 static int preAllocatable()
00452 {
00453 return 2;
00454 }
00455 private:
00456
00458 RefCountedPtr<EBDataImplem> m_implem;
00459
00460 };
00461
00462
00463 inline const Real& EBData::volFrac(const VolIndex& a_vof) const
00464 {
00465 return m_implem->volFrac(a_vof);
00466 }
00467
00468 inline const Real& EBData::bndryArea(const VolIndex& a_vof, int face) const
00469 {
00470 return m_implem->bndryArea(a_vof, face);
00471 }
00472 inline const Real& EBData::bndryArea(const VolIndex& a_vof) const
00473 {
00474 return m_implem->bndryArea(a_vof);
00475 }
00476
00477 inline const RealVect& EBData::normal(const VolIndex& a_vof, int face) const
00478 {
00479 return m_implem->normal(a_vof, face);
00480 }
00481 inline const RealVect& EBData::normal(const VolIndex& a_vof) const
00482 {
00483 return m_implem->normal(a_vof);
00484 }
00485
00486 inline const RealVect& EBData::centroid(const VolIndex& a_vof) const
00487 {
00488 return m_implem->centroid(a_vof);
00489 }
00490
00491 inline const RealVect& EBData::bndryCentroid(const VolIndex& a_vof, int face) const
00492 {
00493 return m_implem->bndryCentroid(a_vof, face);
00494 }
00495 inline const RealVect& EBData::bndryCentroid(const VolIndex& a_vof) const
00496 {
00497 return m_implem->bndryCentroid(a_vof);
00498 }
00499
00500 inline const RealVect& EBData::centroid(const FaceIndex& a_face) const
00501 {
00502 return m_implem->centroid(a_face);
00503 }
00504
00505 inline const Real& EBData::areaFrac(const FaceIndex& a_face) const
00506 {
00507 return m_implem->areaFrac(a_face);
00508 }
00509
00510
00511 #include "NamespaceFooter.H"
00512 #endif