chombo-discharge
Loading...
Searching...
No Matches
CD_VofUtils.H
Go to the documentation of this file.
1/*
2 * SPDX-FileCopyrightText: 2021-2026 SINTEF Energy Research
3 *
4 * SPDX-License-Identifier: GPL-3.0-or-later
5 */
6
13#ifndef CD_VOFUTILS_H
14#define CD_VOFUTILS_H
15
16// Chombo includes
17#include <Stencils.H>
18#include <EBISBox.H>
19#include <IntVectSet.H>
20#include <RealVect.H>
21#include <ProblemDomain.H>
22#include <VolIndex.H>
23#include <LoHiSide.H>
24#include <DenseIntVectSet.H>
25
26// Our includes
27#include <CD_Location.H>
28#include <CD_NamespaceHeader.H>
29
35{
36public:
43 enum class Connectivity
44 {
45 MonotonePath,
46 SimplyConnected,
47 All
48 };
49
56 enum class Neighborhood
57 {
58 Quadrant,
59 Radius,
60 SemiCircle
61 };
62
66 VofUtils() = delete;
67
77 static Vector<VolIndex>
78 getVofsInRadius(const VolIndex& a_startVof,
79 const EBISBox& a_ebisbox,
80 const int a_radius,
81 const Connectivity a_connectivity,
82 const bool a_addStartVof);
83
94 static Vector<VolIndex>
95 getVofsInRadius(const VolIndex& a_startVof,
96 const EBISBox& a_ebisbox,
97 const int a_radius,
98 const DenseIntVectSet& a_validCells,
99 const Connectivity a_connectivity,
100 const bool a_addStartVof);
101
113 static Vector<VolIndex>
114 getVofsInQuadrant(const VolIndex& a_startVof,
115 const EBISBox& a_ebisbox,
116 const RealVect& a_normal,
117 const int a_radius,
118 const Connectivity a_connectivity,
119 const bool a_addStartVof);
120
130 static Vector<VolIndex>
131 restrictVofsToQuadrant(const Vector<VolIndex>& a_vofs,
132 const VolIndex& a_startVof,
133 const EBISBox& a_ebisbox,
134 const RealVect& a_normal,
135 const int a_radius);
136
152 static Vector<VolIndex>
153 getVofsInSemiCircle(const VolIndex& a_startVof,
154 const EBISBox& a_ebisbox,
155 const RealVect& a_normal,
156 const int a_radius,
157 const Real a_deltaThresh,
158 const Connectivity a_connectivity,
159 const Location::Cell a_vofLocation,
160 const Location::Cell a_cellLocation,
161 const bool a_addStartVof);
162
176 static Vector<VolIndex>
177 restrictVofsToSemiCircle(const Vector<VolIndex>& a_vofs,
178 const VolIndex& a_startVof,
179 const EBISBox& a_ebisbox,
180 const RealVect& a_normal,
181 const Real a_deltaThresh,
182 const Location::Cell a_vofLocation,
183 const Location::Cell a_cellLocation);
184
190 static void
191 excludeCells(Vector<VolIndex>& a_vofs, const Box& a_excludeBox);
192
198 static void
199 excludeCells(Vector<VolIndex>& a_vofs, const IntVectSet& a_excludeIVS);
200
206 static void
207 includeCells(Vector<VolIndex>& a_vofs, const Box& a_includeBox);
208
214 static void
215 includeCells(Vector<VolIndex>& a_vofs, const IntVectSet& a_includeIVS);
216
222 static void
223 includeCells(Vector<VolIndex>& a_vofs, const DenseIntVectSet& a_includeIVS);
224
229 static void
230 onlyUnique(Vector<VolIndex>& a_vofs);
231
232protected:
238 static bool
239 isQuadrantWellDefined(const RealVect& a_normal);
240
246 static std::pair<int, Side::LoHiSide>
247 getCardinalDirection(const RealVect& a_normal);
248
257 static Vector<VolIndex>
258 getVofsInMonotonePath(const VolIndex& a_startVof,
259 const EBISBox& a_ebisbox,
260 const int a_radius,
261 const bool a_addStartVof);
262
272 static Vector<VolIndex>
273 getConnectedVofsInRadius(const VolIndex& a_startVof,
274 const EBISBox& a_ebisbox,
275 const int a_radius,
276 const bool a_addStartVof);
277
286 static Vector<VolIndex>
287 getAllVofsInRadius(const VolIndex& a_startVof,
288 const EBISBox& a_ebisbox,
289 const int a_radius,
290 const bool a_addStartVof);
291
299 static Vector<VolIndex>
300 connectedVofsOnly(const VolIndex& a_startVof, const Vector<VolIndex>& a_allVofs, const EBISBox& a_ebisbox);
301
310 static Box
311 getQuadrant(const RealVect& a_normal, const VolIndex& a_vof, const EBISBox& a_ebisbox, const Real a_radius);
312
321 static Box
322 getSymmetricQuadrant(const std::pair<int, Side::LoHiSide>& a_cardinal,
323 const VolIndex& a_vof,
324 const EBISBox& a_ebisbox,
325 const Real a_radius);
326
336 static void
337 getVofsInMonotonePath(Vector<VolIndex>& a_vofList,
338 const VolIndex& a_startVof,
339 const EBISBox& a_ebisbox,
340 const int a_radius,
341 const IntVect& a_timesMoved,
342 const IntVect& a_pathSign);
343
354 static void
355 getVofsInMonotonePath(std::set<VolIndex>& a_vofSet,
356 const VolIndex& a_startVof,
357 const EBISBox& a_ebisbox,
358 const Box& a_validBox,
359 const int& a_radius,
360 const IntVect& a_timesMoved,
361 const IntVect& a_pathSign);
362};
363
364#include <CD_NamespaceFooter.H>
365
366#endif
Declaration of cell positions.
Static class which contains some routines for fetching VoFs using various algorithms....
Definition CD_VofUtils.H:35
Neighborhood
Neighborhood type.
Definition CD_VofUtils.H:57
static void onlyUnique(Vector< VolIndex > &a_vofs)
Discard duplicates.
Definition CD_VofUtils.cpp:325
static bool isQuadrantWellDefined(const RealVect &a_normal)
Check if a quadrant is well-defined for a direction in space.
Definition CD_VofUtils.cpp:339
Connectivity
Class for specifying connectivity of Vofs.
Definition CD_VofUtils.H:44
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 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:47
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:282
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:200
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:151
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:18
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:373
static Vector< VolIndex > restrictVofsToSemiCircle(const Vector< VolIndex > &a_vofs, const VolIndex &a_startVof, const EBISBox &a_ebisbox, const RealVect &a_normal, const Real a_deltaThresh, const Location::Cell a_vofLocation, const Location::Cell a_cellLocation)
Extract the subset of VoFs that lie in a semi-circle ahead of the input vof (a_startVof)
Definition CD_VofUtils.cpp:124
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:422
static std::pair< int, Side::LoHiSide > getCardinalDirection(const RealVect &a_normal)
Returns the coordinate direction.
Definition CD_VofUtils.cpp:353
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:94
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:398
static Vector< VolIndex > restrictVofsToQuadrant(const Vector< VolIndex > &a_vofs, const VolIndex &a_startVof, const EBISBox &a_ebisbox, const RealVect &a_normal, const int a_radius)
Extract the subset of vofs that lie within the quadrant/octant defined by the normal vector.
Definition CD_VofUtils.cpp:70
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:252
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:218
Cell
Enum for distinguishing between cell locations.
Definition CD_Location.H:31