Chombo + EB + MF  3.2
GeometryShop.H
Go to the documentation of this file.
1 #ifdef CH_LANG_CC
2 /*
3  * _______ __
4  * / ___/ / ___ __ _ / / ___
5  * / /__/ _ \/ _ \/ V \/ _ \/ _ \
6  * \___/_//_/\___/_/_/_/_.__/\___/
7  * Please refer to Copyright.txt, in Chombo's root directory.
8  */
9 #endif
10 
11 // ANAG, LBNL, DTG
12 
13 #ifndef _GEOMETRYSHOP_H_
14 #define _GEOMETRYSHOP_H_
15 
16 #include "REAL.H"
17 #include "RealVect.H"
18 #include "Box.H"
19 #include "IntVect.H"
20 
21 #include "EBISBox.H"
22 #include "BaseIF.H"
23 #include "STLIF.H"
24 #include "GeometryService.H"
25 #include "Moments.H"
26 
27 #include "NamespaceHeader.H"
28 
29 ///
30 /**
31  This is the base class for the workshop algorithm.
32  It forms the interface between the workshop classes
33  and the geometryservice class.
34  */
36 {
37 public:
38  ///
39  /**
40  Define the workshop using the local geometry description
41  */
42  GeometryShop(const BaseIF& a_localGeom,
43  int a_verbosity,
44  RealVect a_vectDx,
45  Real a_thrshdVoF = 1.0e-16);
46 
47  ///
48  ~GeometryShop();
49 
50  ///
51  bool twoEdgeIntersections(edgeMo a_edges[4]) const;
52 
53  /**
54  Return true if every cell in region is regular at the
55  refinement described by dx.
56  */
57  bool isRegular(const Box& a_region,
58  const ProblemDomain& a_domain,
59  const RealVect& a_origin,
60  const Real& a_dx) const;
61 
62  ///
63  /**
64  Return true if every cell in region is covered at the
65  refinement described by dx.
66  */
67  bool isCovered(const Box& a_region,
68  const ProblemDomain& a_domain,
69  const RealVect& a_origin,
70  const Real& a_dx) const;
71 
72 
73  virtual bool isIrregular(const Box& a_region,
74  const ProblemDomain& a_domain,
75  const RealVect& a_origin,
76  const Real& a_dx) const ;
77 
78  virtual InOut InsideOutside(const Box& a_region,
79  const ProblemDomain& a_domain,
80  const RealVect& a_origin,
81  const Real& a_dx) const ;
82 
83 
84  virtual bool canGenerateMultiCells() const
85  {
86  return false;
87  }
88 
89  ///
90  /**
91  Define the internals of the input ebisRegion.
92  */
93  virtual void fillGraph(BaseFab<int>& a_regIrregCovered,
94  Vector<IrregNode>& a_nodes,
95  const Box& a_validRegion,
96  const Box& a_ghostRegion,
97  const ProblemDomain& a_domain,
98  const RealVect& a_origin,
99  const Real& a_dx,
100  const DataIndex& a_di) const;
101 
102  /**
103  */
104  void computeVoFInternals(Real& a_volFrac,
105  Vector<int> a_loArc[SpaceDim],
106  Vector<int> a_hiArc[SpaceDim],
107  Vector<Real> a_loAreaFrac[SpaceDim],
108  Vector<Real> a_hiAreaFrac[SpaceDim],
109  Real& a_bndryArea,
110  RealVect& a_normal,
111  RealVect& a_volCentroid,
112  RealVect& a_bndryCentroid,
113  Vector<RealVect> a_loFaceCentroid[SpaceDim],
114  Vector<RealVect> a_hiFaceCentroid[SpaceDim],
115  const BaseFab<int>& a_regIrregCovered,
116  const IntVectSet& a_ivsIrreg,
117  const VolIndex& a_vof,
118  const ProblemDomain& a_domain,
119  const RealVect& a_origin,
120  const Real& a_dx,
121  const RealVect& a_vectDx,
122  const IntVect& a_iv) const;
123 
124  void
126  const BaseFab<int> & a_regIrregCovered,
127  const IntVect & a_iv,
128  const ProblemDomain & a_domain) const;
129 
130  void
132  BaseFab<int> & a_regIrregCovered,
133  const Box & a_validRegion,
134  const ProblemDomain & a_domain,
135  const IntVect & a_iv,
136  const Real & a_dx) const;
137 
138  ///
139  /**
140  A GeometryService has three options for implementing this function
141  1) do nothing, allow the empty base implementation to remain in place as a null-op
142  2) take the makeGrids call as a directive: Here are the grids EBIndexSpace is wanting to use, configure
143  yourself accordingly to make this efficient for you.
144  3) discard the DisjointBoxLayout EBIndexSpace would like and insert your own implementation of layout
145  EBIndexSpace will faithfully use a_grids returned from this function, including it's load balance.
146  */
147  virtual void makeGrids( const ProblemDomain& a_domain,
148  DisjointBoxLayout& a_grids,
149  const int& a_maxGridSize,
150  const int& a_maxIrregGridSize );
151 
152  int m_phase;
153 
154 private:
158  Real m_thrshdVoF; //CP, threshold to remove very small VoFs.
159 
161 
162  BaseIF* m_implicitFunction; // the call to makeGrids might alter this IF object
163  const STLIF* m_stlIF;
164  mutable bool m_STLBoxSet;
165 
166  static bool s_verbose;
167 
168  // local geometry description
169  // const BaseLocalGeometry* m_localGeomPtr;
170 
171  /**
172  Return true if every cell in region is regular at the
173  refinement described by dx.
174  */
175  bool isRegularEveryPoint(const Box& a_region,
176  const ProblemDomain& a_domain,
177  const RealVect& a_origin,
178  const Real& a_dx) const;
179 
180  ///
181  /**
182  Return true if every cell in region is covered at the
183  refinement described by dx.
184  */
185  bool isCoveredEveryPoint(const Box& a_region,
186  const ProblemDomain& a_domain,
187  const RealVect& a_origin,
188  const Real& a_dx) const;
189 
190 
191  virtual bool isIrregularEveryPoint(const Box& a_region,
192  const ProblemDomain& a_domain,
193  const RealVect& a_origin,
194  const Real& a_dx,
195  const Real& a_originVal) const ;
196 
197  void edgeData3D(edgeMo a_edges[4],
198  bool& a_faceCovered,
199  bool& a_faceRegular,
200  bool& a_faceDontKnow,
201  const int a_hiLoFace,
202  const int a_faceNormal,
203  const Real& a_dx,
204  const RealVect& a_vectDx,
205  const IntVect& a_coord,
206  const ProblemDomain& a_domain,
207  const RealVect& a_origin) const;
208 
209  void edgeData2D(edgeMo a_edges[4],
210  bool& a_faceCovered,
211  bool& a_faceRegular,
212  bool& a_faceDontKnow,
213  const Real& a_dx,
214  const RealVect& a_vectDx,
215  const IntVect& a_coord,
216  const ProblemDomain& a_domain,
217  const RealVect& a_origin) const;
218 
219  void edgeType(bool& a_regular,
220  bool& a_covered,
221  bool& a_dontKnow,
222  Real& a_signHi,
223  Real& a_signLo) const;
224 
225  Real BrentRootFinder(const RealVect& a_x1,
226  const RealVect& a_x2,
227  const int& a_range) const;
228 
229 #if 1
231  RealVect& a_yVec) const;
232 #endif
233 
234  int getNumCellsClipped();
235 
236  Real Min(const Real x, const Real y) const;
237 
238  //stuff disallowed for all the usual reasons.
240  {
241  MayDay::Abort("GeometryShop uses strong construction only");
242  }
243  GeometryShop(const GeometryShop& a_workshopin)
244  {
245  MayDay::Abort("GeometryShop disallows copy contruction");
246  }
247  void operator=(const GeometryShop& a_workshopin)
248  {
249  MayDay::Abort("GeometryShop disallows the assignment operator");
250  }
251 
252 };
253 #include "NamespaceFooter.H"
254 #endif
bool isRegular(const Box &a_region, const ProblemDomain &a_domain, const RealVect &a_origin, const Real &a_dx) const
virtual InOut InsideOutside(const Box &a_region, const ProblemDomain &a_domain, const RealVect &a_origin, const Real &a_dx) const
GeometryShop()
Definition: GeometryShop.H:239
An irregular domain on an integer lattice.
Definition: IntVectSet.H:44
Real m_threshold
Definition: GeometryShop.H:157
A class to facilitate interaction with physical boundary conditions.
Definition: ProblemDomain.H:141
Definition: STLIF.H:32
static bool s_verbose
Definition: GeometryShop.H:166
Definition: Moments.H:24
int m_verbosity
Definition: GeometryShop.H:156
one dimensional dynamic array
Definition: Vector.H:53
const STLIF * m_stlIF
Definition: GeometryShop.H:163
RealVect m_vectDx
Definition: GeometryShop.H:160
virtual bool isIrregular(const Box &a_region, const ProblemDomain &a_domain, const RealVect &a_origin, const Real &a_dx) const
Definition: GeometryShop.H:35
bool m_STLBoxSet
Definition: GeometryShop.H:164
virtual void makeGrids(const ProblemDomain &a_domain, DisjointBoxLayout &a_grids, const int &a_maxGridSize, const int &a_maxIrregGridSize)
Real Min(const Real x, const Real y) const
bool isCovered(const Box &a_region, const ProblemDomain &a_domain, const RealVect &a_origin, const Real &a_dx) const
BaseIF * m_implicitFunction
Definition: GeometryShop.H:162
const int SpaceDim
Definition: SPACE.H:38
InOut
Definition: GeometryService.H:41
void operator=(const GeometryShop &a_workshopin)
Definition: GeometryShop.H:247
int m_phase
Definition: GeometryShop.H:152
void edgeType(bool &a_regular, bool &a_covered, bool &a_dontKnow, Real &a_signHi, Real &a_signLo) const
void edgeData3D(edgeMo a_edges[4], bool &a_faceCovered, bool &a_faceRegular, bool &a_faceDontKnow, const int a_hiLoFace, const int a_faceNormal, const Real &a_dx, const RealVect &a_vectDx, const IntVect &a_coord, const ProblemDomain &a_domain, const RealVect &a_origin) const
Definition: BaseIF.H:32
bool isCoveredEveryPoint(const Box &a_region, const ProblemDomain &a_domain, const RealVect &a_origin, const Real &a_dx) const
void fixRegularCellsNextToCovered(Vector< IrregNode > &a_nodes, BaseFab< int > &a_regIrregCovered, const Box &a_validRegion, const ProblemDomain &a_domain, const IntVect &a_iv, const Real &a_dx) const
double Real
Definition: REAL.H:33
Definition: IrregNode.H:33
Definition: GeometryService.H:37
Real PrismoidalAreaCalc(RealVect &a_xVec, RealVect &a_yVec) const
void edgeData2D(edgeMo a_edges[4], bool &a_faceCovered, bool &a_faceRegular, bool &a_faceDontKnow, const Real &a_dx, const RealVect &a_vectDx, const IntVect &a_coord, const ProblemDomain &a_domain, const RealVect &a_origin) const
A BoxLayout that has a concept of disjointedness.
Definition: DisjointBoxLayout.H:30
int getNumCellsClipped()
Real m_thrshdVoF
Definition: GeometryShop.H:158
A Rectangular Domain on an Integer Lattice.
Definition: Box.H:469
A Real vector in SpaceDim-dimensional space.
Definition: RealVect.H:41
Definition: DataIndex.H:114
GeometryShop(const GeometryShop &a_workshopin)
Definition: GeometryShop.H:243
bool twoEdgeIntersections(edgeMo a_edges[4]) const
An integer Vector in SpaceDim-dimensional space.
Definition: CHArray.H:42
virtual bool canGenerateMultiCells() const
Definition: GeometryShop.H:84
bool isRegularEveryPoint(const Box &a_region, const ProblemDomain &a_domain, const RealVect &a_origin, const Real &a_dx) const
void getFullNodeWithCoveredFace(IrregNode &a_newNode, const BaseFab< int > &a_regIrregCovered, const IntVect &a_iv, const ProblemDomain &a_domain) const
Volume of Fluid Index.
Definition: VolIndex.H:31
virtual bool isIrregularEveryPoint(const Box &a_region, const ProblemDomain &a_domain, const RealVect &a_origin, const Real &a_dx, const Real &a_originVal) const
int m_numCellsClipped
Definition: GeometryShop.H:155
virtual void fillGraph(BaseFab< int > &a_regIrregCovered, Vector< IrregNode > &a_nodes, const Box &a_validRegion, const Box &a_ghostRegion, const ProblemDomain &a_domain, const RealVect &a_origin, const Real &a_dx, const DataIndex &a_di) const
static void Abort(const char *const a_msg=m_nullString)
Print out message to cerr and exit via abort() (if serial) or MPI_Abort() (if parallel).
Real BrentRootFinder(const RealVect &a_x1, const RealVect &a_x2, const int &a_range) const
void computeVoFInternals(Real &a_volFrac, Vector< int > a_loArc[SpaceDim], Vector< int > a_hiArc[SpaceDim], Vector< Real > a_loAreaFrac[SpaceDim], Vector< Real > a_hiAreaFrac[SpaceDim], Real &a_bndryArea, RealVect &a_normal, RealVect &a_volCentroid, RealVect &a_bndryCentroid, Vector< RealVect > a_loFaceCentroid[SpaceDim], Vector< RealVect > a_hiFaceCentroid[SpaceDim], const BaseFab< int > &a_regIrregCovered, const IntVectSet &a_ivsIrreg, const VolIndex &a_vof, const ProblemDomain &a_domain, const RealVect &a_origin, const Real &a_dx, const RealVect &a_vectDx, const IntVect &a_iv) const