chombo-discharge
CD_VofUtils.H
Go to the documentation of this file.
1 /* chombo-discharge
2  * Copyright © 2021 SINTEF Energy Research.
3  * Please refer to Copyright.txt and LICENSE in the chombo-discharge root directory.
4  */
5 
12 #ifndef CD_VofUtils_H
13 #define CD_VofUtils_H
14 
15 // Chombo includes
16 #include <Stencils.H>
17 #include <EBISBox.H>
18 #include <IntVectSet.H>
19 #include <RealVect.H>
20 #include <ProblemDomain.H>
21 #include <VolIndex.H>
22 #include <LoHiSide.H>
23 #include <DenseIntVectSet.H>
24 
25 // Our includes
26 #include <CD_Location.H>
27 #include <CD_NamespaceHeader.H>
28 
32 class VofUtils
33 {
34 public:
41  enum class Connectivity
42  {
43  MonotonePath,
44  SimplyConnected,
45  All
46  };
47 
54  enum class Neighborhood
55  {
56  Quadrant,
57  Radius,
58  SemiCircle
59  };
60 
64  VofUtils() = delete;
65 
74  static Vector<VolIndex>
75  getVofsInRadius(const VolIndex& a_startVof,
76  const EBISBox& a_ebisbox,
77  const int a_radius,
78  const Connectivity a_connectivity,
79  const bool a_addStartVof);
80 
90  static Vector<VolIndex>
91  getVofsInRadius(const VolIndex& a_startVof,
92  const EBISBox& a_ebisbox,
93  const int a_radius,
94  const DenseIntVectSet& a_validCells,
95  const Connectivity a_connectivity,
96  const bool a_addStartVof);
97 
108  static Vector<VolIndex>
109  getVofsInQuadrant(const VolIndex& a_startVof,
110  const EBISBox& a_ebisbox,
111  const RealVect& a_normal,
112  const int a_radius,
113  const Connectivity a_connectivity,
114  const bool a_addStartVof);
115 
130  static Vector<VolIndex>
131  getVofsInSemiCircle(const VolIndex& a_startVof,
132  const EBISBox& a_ebisbox,
133  const RealVect& a_normal,
134  const int a_radius,
135  const Real a_deltaThresh,
136  const Connectivity a_connectivity,
137  const Location::Cell a_vofLocation,
138  const Location::Cell a_cellLocation,
139  const bool a_addStartVof);
140 
147  static void
148  excludeCells(Vector<VolIndex>& a_vofs, const Box& a_excludeBox);
149 
156  static void
157  excludeCells(Vector<VolIndex>& a_vofs, const IntVectSet& a_excludeIVS);
158 
165  static void
166  includeCells(Vector<VolIndex>& a_vofs, const Box& a_includeBox);
167 
174  static void
175  includeCells(Vector<VolIndex>& a_vofs, const IntVectSet& a_includeIVS);
176 
183  static void
184  includeCells(Vector<VolIndex>& a_vofs, const DenseIntVectSet& a_includeIVS);
185 
191  static void
192  onlyUnique(Vector<VolIndex>& a_vofs);
193 
194 protected:
200  static bool
201  isQuadrantWellDefined(const RealVect a_normal);
202 
208  static std::pair<int, Side::LoHiSide>
209  getCardinalDirection(const RealVect a_normal);
210 
219  static Vector<VolIndex>
220  getVofsInMonotonePath(const VolIndex& a_startVof,
221  const EBISBox& a_ebisbox,
222  const int a_radius,
223  const bool a_addStartVof);
224 
233  static Vector<VolIndex>
234  getConnectedVofsInRadius(const VolIndex& a_startVof,
235  const EBISBox& a_ebisbox,
236  const int a_radius,
237  const bool a_addStartVof);
238 
246  static Vector<VolIndex>
247  getAllVofsInRadius(const VolIndex& a_startVof,
248  const EBISBox& a_ebisbox,
249  const int a_radius,
250  const bool a_addStartVof);
251 
259  static Vector<VolIndex>
260  connectedVofsOnly(const VolIndex& a_startVof, const Vector<VolIndex>& a_allVofs, const EBISBox& a_ebisbox);
261 
270  static Box
271  getQuadrant(const RealVect& a_normal, const VolIndex& a_vof, const EBISBox& a_ebisbox, const Real a_radius);
272 
280  static Box
281  getSymmetricQuadrant(const std::pair<int, Side::LoHiSide>& a_cardinal,
282  const VolIndex& a_vof,
283  const EBISBox& a_ebisbox,
284  const Real a_radius);
285 
295  static void
296  getVofsInMonotonePath(Vector<VolIndex>& a_vofList,
297  const VolIndex& a_startVof,
298  const EBISBox& a_ebisbox,
299  const int a_radius,
300  const IntVect& a_timesMoved,
301  const IntVect& a_pathSign);
302 
312  static void
313  getVofsInMonotonePath(std::set<VolIndex>& a_vofList,
314  const VolIndex& a_startVof,
315  const EBISBox& a_ebisbox,
316  const Box& a_validBox,
317  const int& a_radius,
318  const IntVect& a_timesMoved,
319  const IntVect& a_pathSign);
320 };
321 
322 #include <CD_NamespaceFooter.H>
323 
324 #endif
Declaration of cell positions.
Static class which contains some routines for fetching VoFs using various algorithms....
Definition: CD_VofUtils.H:33
Neighborhood
Neighborhood type.
Definition: CD_VofUtils.H:55
static void onlyUnique(Vector< VolIndex > &a_vofs)
Discard duplicates.
Definition: CD_VofUtils.cpp:292
static std::pair< int, Side::LoHiSide > getCardinalDirection(const RealVect a_normal)
Returns the coordinate direction.
Definition: CD_VofUtils.cpp:322
Connectivity
Class for specifying connectivity of Vofs.
Definition: CD_VofUtils.H:42
static Vector< VolIndex > getVofsInQuadrant(const VolIndex &a_startVof, const EBISBox &a_ebisbox, const RealVect &a_normal, const int a_radius, const Connectivity a_connectivity, const bool a_addStartVof)
Fetch vofs in a quadrant, using a specified radius and with a specified connectivitiy between them.
Definition: CD_VofUtils.cpp:46
static void includeCells(Vector< VolIndex > &a_vofs, const Box &a_includeBox)
Modifies a_vofs so it only includes cells in a box.
Definition: CD_VofUtils.cpp:249
static Vector< VolIndex > getConnectedVofsInRadius(const VolIndex &a_startVof, const EBISBox &a_ebisbox, const int a_radius, const bool a_addStartVof)
Get all connected Vofs in radius which can be reached without crossing a covered face or reaching int...
Definition: CD_VofUtils.cpp:170
static Vector< VolIndex > getVofsInMonotonePath(const VolIndex &a_startVof, const EBISBox &a_ebisbox, const int a_radius, const bool a_addStartVof)
Get all VoFs that can be found with a monotone path with specified radius.
Definition: CD_VofUtils.cpp:121
static Vector< VolIndex > getVofsInRadius(const VolIndex &a_startVof, const EBISBox &a_ebisbox, const int a_radius, const Connectivity a_connectivity, const bool a_addStartVof)
Fetch vofs in a specified radius and with a specified connectivitiy between them.
Definition: CD_VofUtils.cpp:17
static Box getQuadrant(const RealVect &a_normal, const VolIndex &a_vof, const EBISBox &a_ebisbox, const Real a_radius)
Get quadrant defined by direction in space.
Definition: CD_VofUtils.cpp:342
static Vector< VolIndex > connectedVofsOnly(const VolIndex &a_startVof, const Vector< VolIndex > &a_allVofs, const EBISBox &a_ebisbox)
Get all Vofs that are connected to a specific starting Vof. The connection does not have to be direct...
Definition: CD_VofUtils.cpp:391
static Vector< VolIndex > getVofsInSemiCircle(const VolIndex &a_startVof, const EBISBox &a_ebisbox, const RealVect &a_normal, const int a_radius, const Real a_deltaThresh, const Connectivity a_connectivity, const Location::Cell a_vofLocation, const Location::Cell a_cellLocation, const bool a_addStartVof)
Get all vofs lying in a semi-circle (sphere in 3D) from the indicated position in the starting vof.
Definition: CD_VofUtils.cpp:81
static bool isQuadrantWellDefined(const RealVect a_normal)
Check if a quadrant is well-defined for a direction in space.
Definition: CD_VofUtils.cpp:306
VofUtils()=delete
Disallowed.
static Box getSymmetricQuadrant(const std::pair< int, Side::LoHiSide > &a_cardinal, const VolIndex &a_vof, const EBISBox &a_ebisbox, const Real a_radius)
Get "symmetric" quadrant defined by direction in space.
Definition: CD_VofUtils.cpp:367
static Vector< VolIndex > getVofsInRadius(const VolIndex &a_startVof, const EBISBox &a_ebisbox, const int a_radius, const DenseIntVectSet &a_validCells, const Connectivity a_connectivity, const bool a_addStartVof)
Fetch vofs in a specified radius and with a specified connectivitiy between them.
static void excludeCells(Vector< VolIndex > &a_vofs, const Box &a_excludeBox)
Modifies a_vofs so it doesn't include cells in a_excludeIVS.
Definition: CD_VofUtils.cpp:219
static Vector< VolIndex > getAllVofsInRadius(const VolIndex &a_startVof, const EBISBox &a_ebisbox, const int a_radius, const bool a_addStartVof)
Get all Vofs in a radius from a starting Vof.
Definition: CD_VofUtils.cpp:188
Cell
Enum for distinguishing between cell locations.
Definition: CD_Location.H:30