13#ifndef CD_POLYHEDRALEBUTILS_H
14#define CD_POLYHEDRALEBUTILS_H
25#include <CD_NamespaceHeader.H>
27namespace PolyhedralEB {
42isFluid(
const Real a_value)
noexcept;
80edgeOrigin(
const int a_edge,
int a_offset[SpaceDim])
noexcept;
89edgeCorners(
const int a_edge,
int& a_lo,
int& a_hi)
noexcept;
109faceCorners(
const int a_dir,
const int a_side,
int a_corner[1 << (SpaceDim - 1)]) noexcept;
120edgeIndex(const
int a_dir, const
int a_offset[SpaceDim]) noexcept;
146faceEdges(
const int a_dir,
const int a_side,
int a_edge[4])
noexcept;
168 RealVect& a_centroid)
noexcept;
223sameVertex(
const RealVect& a_a,
const RealVect& a_b)
noexcept;
265crossing(
const RealVect& a_a,
const RealVect& a_b,
const int a_dir)
noexcept;
298 const BaseIF& a_function,
300 const RealVect& a_probLo,
330 BaseFab<Real> a_intercept[SpaceDim],
331 const IntVect& a_cell,
335 const RealVect& a_probLo,
364 const BaseIF& a_function,
365 const BaseFab<Real>& a_nodeValues,
366 const IntVect& a_cell,
367 const RealVect& a_probLo,
387 const BaseIF& a_function,
388 const IntVect& a_cell,
389 const RealVect& a_probLo,
390 const Real a_dx)
noexcept;
409 const IntVect& a_edgeIV,
411 const Real a_loValue,
412 const Real a_hiValue,
413 const RealVect& a_probLo,
414 const Real a_dx)
noexcept;
454snappedValue(
const BaseIF& a_function,
const RealVect& a_point,
const Real a_dx)
noexcept;
476resolveTangency(
const BaseIF& a_function,
const RealVect& a_point,
const Real a_dx)
noexcept;
479#include <CD_NamespaceFooter.H>
Declaration of the data a cut cell's embedded boundary is reconstructed from.
Implementation of CD_PolyhedralEBUtils.H.
constexpr Real s_probeSpacing
Fraction of a cell width the implicit function is read at either side of a point, to tell a surface t...
Definition CD_PolyhedralEBUtils.H:437
constexpr Real s_snapTolerance
Fraction of a cell width within which an implicit-function value is read as exactly zero.
Definition CD_PolyhedralEBUtils.H:419
bool isFluid(const Real a_value) noexcept
Which side of the interface a value lies on.
Definition CD_PolyhedralEBUtilsImplem.H:29
constexpr Real s_rootSnap
Distance along an edge, from an endpoint that is exactly zero, within which a root is put on it.
Definition CD_PolyhedralEBUtils.H:429
void defineIntercepts(BaseFab< Real > a_intercept[SpaceDim], const Box &a_region)
Size the edge-crossing cache for a region and mark every edge as not yet bisected.
Definition CD_PolyhedralEBUtils.cpp:59
bool isDust(const PolyhedralEB::CutCellBody &a_body) noexcept
Whether a cut body holds nothing at all and is therefore a regular cell.
Definition CD_PolyhedralEBUtils.cpp:117
Real snappedValue(const BaseIF &a_function, const RealVect &a_point, const Real a_dx) noexcept
Read the implicit function at a point, with a value within s_snapTolerance of a cell width of zero re...
Definition CD_PolyhedralEBUtils.cpp:125
void fillCorners(PolyhedralEB::CutCellSurface &a_surface, const BaseFab< Real > &a_nodeValues, const IntVect &a_cell)
Read one cell's corner values off the node values.
Definition CD_PolyhedralEBUtils.cpp:256
void fillNodeValues(BaseFab< Real > &a_nodeValues, const BaseIF &a_function, const Box &a_region, const RealVect &a_probLo, const Real &a_dx)
Evaluate the implicit function at every node of a region.
Definition CD_PolyhedralEBUtils.cpp:30
void buildSurface(BaseFab< Real > a_intercept[SpaceDim], PolyhedralEB::CutCellSurface &a_surface, const BaseIF &a_function, const BaseFab< Real > &a_nodeValues, const IntVect &a_cell, const RealVect &a_probLo, const Real &a_dx)
Gather the corner values and edge crossings one cell's surface is built from.
Definition CD_PolyhedralEBUtils.cpp:272
void decideFaces(PolyhedralEB::CutCellSurface &a_surface, const BaseIF &a_function, const IntVect &a_cell, const RealVect &a_probLo, const Real a_dx) noexcept
Decide, for every face of a cell whose corners alternate in sign, whether its fluid corners or its so...
Definition CD_PolyhedralEBUtils.cpp:311
Real edgeCrossing(const BaseIF &a_function, BaseFab< Real > a_intercept[SpaceDim], const IntVect &a_cell, const int a_edge, const Real a_lo, const Real a_hi, const RealVect &a_probLo, const Real &a_dx)
Find where the implicit function changes sign along a cell edge.
Definition CD_PolyhedralEBUtils.cpp:74
Real resolveTangency(const BaseIF &a_function, const RealVect &a_point, const Real a_dx) noexcept
Read the implicit function beside a point where it is zero, when no surface passes through the point.
Definition CD_PolyhedralEBUtils.cpp:139
Real edgeRoot(const BaseIF &a_function, const IntVect &a_edgeIV, const int a_dir, const Real a_loValue, const Real a_hiValue, const RealVect &a_probLo, const Real a_dx) noexcept
Bisect one cell edge for the crossing on it.
Definition CD_PolyhedralEBUtils.cpp:179
The closed polyhedron bounding the fluid in one cut cell, and its moments.
Definition CD_CutCellBody.H:52
The values a cut cell's embedded boundary is reconstructed from.
Definition CD_CutCellSurface.H:41
static constexpr int s_numEdges
Number of cell edges a crossing can sit on.
Definition CD_CutCellSurface.H:46
Cell topology and polygon geometry the cut cell classes are assembled from.
Definition CD_PolyhedralEBUtils.H:55
void edgeOrigin(const int a_edge, int a_offset[SpaceDim]) noexcept
Corner offsets of a cell edge's low end.
Definition CD_PolyhedralEBUtilsImplem.H:45
void polygonMoments(const RealVect *a_vertex, const int a_num, Real &a_area, RealVect &a_vector, RealVect &a_centroid) noexcept
Area vector, area and centroid of a planar polygon given in circuit order.
Definition CD_PolyhedralEBUtilsImplem.H:206
constexpr int s_transverse[3][2]
The two directions transverse to each coordinate direction, in increasing order.
Definition CD_PolyhedralEBUtils.H:63
bool withinInEveryDirection(const RealVect &a_a, const RealVect &a_b, const Real a_margin) noexcept
Whether two positions differ by no more than a margin in any coordinate.
Definition CD_PolyhedralEBUtilsImplem.H:407
void faceEdges(const int a_dir, const int a_side, int a_edge[4]) noexcept
The edges of a cell face, edge i joining face corners i and i+1.
Definition CD_PolyhedralEBUtilsImplem.H:175
int facePairs(const int a_dir, const int a_side, const CutCellSurface &a_surface, int a_pair[2][2]) noexcept
The chords on a cell face, each an unordered pair of edge indices.
Definition CD_PolyhedralEBUtilsImplem.H:253
bool sameVertex(const RealVect &a_a, const RealVect &a_b) noexcept
Whether two positions are the same vertex.
Definition CD_PolyhedralEBUtilsImplem.H:421
RealVect cornerPosition(const int a_corner) noexcept
Position of a cell corner in the cell's own frame.
Definition CD_PolyhedralEBUtilsImplem.H:86
constexpr Real s_weldTolerance
Distance within which two vertices are taken to be the same one.
Definition CD_PolyhedralEBUtils.H:214
int edgeDirection(const int a_edge) noexcept
Direction a cell edge runs along.
Definition CD_PolyhedralEBUtilsImplem.H:37
void edgeCorners(const int a_edge, int &a_lo, int &a_hi) noexcept
The corners a cell edge joins, low end first.
Definition CD_PolyhedralEBUtilsImplem.H:67
RealVect crossing(const RealVect &a_a, const RealVect &a_b, const int a_dir) noexcept
Where the segment between two vertices crosses the plane x[a_dir] = 0, the same to the bit whichever ...
Definition CD_PolyhedralEBUtilsImplem.H:434
bool sameToRoundOff(const RealVect &a_a, const RealVect &a_b) noexcept
Whether two vertices differ only by round-off.
Definition CD_PolyhedralEBUtilsImplem.H:427
void faceCorners(const int a_dir, const int a_side, int a_corner[1<<(SpaceDim - 1)]) noexcept
The corners of a cell face, in circuit order around the face.
Definition CD_PolyhedralEBUtilsImplem.H:100
constexpr Real s_roundOffTolerance
Distance below which two vertices of a body cut from another are one, since they then differ only by ...
Definition CD_PolyhedralEBUtils.H:230
int edgeIndex(const int a_dir, const int a_offset[SpaceDim]) noexcept
Index of the edge running along a_dir whose low corner has the given offsets.
Definition CD_PolyhedralEBUtilsImplem.H:124
RealVect crossingPosition(const CutCellSurface &a_surface, const int a_edge, const Real a_tolerance) noexcept
Position of an edge crossing in the cell's own frame.
Definition CD_PolyhedralEBUtilsImplem.H:140
int crossingLoops(const CutCellSurface &a_surface, int a_loop[CutCellSurface::s_numEdges], int a_start[CutCellSurface::s_numEdges+1]) noexcept
Order the crossings into closed loops, or fail if they do not form clean cycles.
Definition CD_PolyhedralEBUtilsImplem.H:309