13#ifndef CD_CUTCELLBODY_H
14#define CD_CUTCELLBODY_H
23#include <ProblemDomain.H>
30#include <CD_NamespaceHeader.H>
32namespace PolyhedralEB {
264 areaFraction(const
int a_dir, const Side::LoHiSide a_side) const noexcept;
273 faceCentroid(const
int a_dir, const Side::LoHiSide a_side) const noexcept;
334 const IntVect& a_cell,
335 const RealVect& a_probLo,
336 const Real a_dx) const noexcept;
365 const bool* a_closedQuadrant,
367 const int a_side)
noexcept;
408 closeBoundary(const
int a_face, const
bool a_roundOff) noexcept;
470 snapFace(const
int a_dir, const
int a_side, const
bool a_neighbourIsFluid) noexcept;
485 closeHalfFace(
const int a_dir,
const int a_side,
const int a_half)
noexcept;
559 const BaseFab<
int>& a_regIrregCovered,
560 const IntVect& a_cell,
561 const ProblemDomain& a_domain) const;
824#include <CD_NamespaceFooter.H>
Declaration of the faces of a box's cut cells that their own surfaces do not describe.
Declaration of the data a cut cell's embedded boundary is reconstructed from.
Declaration of the cell topology and polygon geometry the polyhedral cut cells are built from.
The closed polyhedron bounding the fluid in one cut cell, and its moments.
Definition CD_CutCellBody.H:52
bool partitions(const CutCellBody *a_children) const noexcept
Whether a set of children partitions this body, in every moment that has to add up.
Definition CD_CutCellBody.cpp:2607
bool hasMultiValuedChildren(const int a_refRat) const noexcept
Whether cutting this body for a refinement asks for a child whose fluid is in more than one piece.
Definition CD_CutCellBody.cpp:2565
void clear() noexcept
Empty the body, as the constructor leaves it.
Definition CD_CutCellBody.cpp:70
RealVect m_boundaryCentroid
Interface centroid.
Definition CD_CutCellBody.H:814
bool define(const CutCellSurface &a_surface) noexcept
Build the body from the values the surface is reconstructed from.
Definition CD_CutCellBody.cpp:1972
void accumulateMoments() noexcept
Take the moments of the assembled polygons.
Definition CD_CutCellBody.cpp:1597
static Kind classify(const CutCellSurface &a_surface) noexcept
How the cell relates to the interface.
Definition CD_CutCellBody.cpp:103
bool subdivide(CutCellBody *a_children) const noexcept
Cut this body into the bodies of the 2^SpaceDim cells one refinement finer that fill its cell.
Definition CD_CutCellBody.cpp:2203
bool mergeCoplanar(const Polygon *a_in, const int a_num, Polygon *a_out, const int a_maxOut, int &a_numOut) const noexcept
Merge coplanar polygons into the boundary of their union.
Definition CD_CutCellBody.cpp:476
const RealVect & faceCentroid(const int a_dir, const Side::LoHiSide a_side) const noexcept
Centroid of one cell face, relative to the face centre, in units of the cell size.
Definition CD_CutCellBody.cpp:2706
bool restrictFace(const CutCellSurface *a_children, const bool *a_closedQuadrant, const int a_dir, const int a_side) noexcept
Replace one face's chord with the chords of the children that cover it.
Definition CD_CutCellBody.cpp:683
bool interfaceIsPlanar() const noexcept
Whether every polygon of the interface lies in one plane.
Definition CD_CutCellBody.cpp:2463
bool closeInterface() noexcept
Rebuild the interface from the face polygons this body holds.
Definition CD_CutCellBody.cpp:1139
void fillNode(IrregNode &a_node, const BaseFab< int > &a_regIrregCovered, const IntVect &a_cell, const ProblemDomain &a_domain) const
Write a cut cell's node from this body.
Definition CD_CutCellBody.cpp:2859
Real m_areaFraction[s_numFaces]
Area fraction of each cell face, indexed 2*dir + side.
Definition CD_CutCellBody.H:784
bool subdivideChild(CutCellBody &a_child, bool &a_connected, const int a_which) const noexcept
Cut this body into the body of one of the cells one refinement finer that fill its cell.
Definition CD_CutCellBody.cpp:2386
RealVect m_closure
Sum of the outward area vectors over every polygon.
Definition CD_CutCellBody.H:819
static constexpr int s_maxVertices
Largest number of vertices one of those polygons can carry.
Definition CD_CutCellBody.H:608
Real m_trueBoundaryArea
Area of the interface itself.
Definition CD_CutCellBody.H:794
static constexpr Real s_edgeTolerance
Distance by which a crossing is held off an edge's endpoints.
Definition CD_CutCellBody.H:616
void orientOutward(Polygon &a_polygon, const int a_dir, const int a_side) const noexcept
Reverse a face polygon if its area vector points into the fluid.
Definition CD_CutCellBody.cpp:209
Real m_boundaryArea
Magnitude of the interface's area vector.
Definition CD_CutCellBody.H:789
static int numSheets(const CutCellSurface &a_surface) noexcept
How many separate sheets of interface the surface enters the cell as.
Definition CD_CutCellBody.cpp:125
const RealVect & volumeCentroid() const noexcept
Volume centroid, relative to the cell centre, in units of the cell size.
Definition CD_CutCellBody.cpp:2692
Real trueBoundaryArea() const noexcept
Area of the interface itself, as the sum of its triangles' areas.
Definition CD_CutCellBody.cpp:2720
Polygon m_polygon[s_maxPolygons]
The polygons bounding the fluid.
Definition CD_CutCellBody.H:769
CutCellBody() noexcept
Constructor. Leaves the body empty; call define before reading any moment.
Definition CD_CutCellBody.cpp:30
Kind
How a cell relates to the interface.
Definition CD_CutCellBody.H:58
bool replaceFace(const CutCellFaceOverrides &a_overrides, const int a_entry) noexcept
Replace one face's polygons with a face entry's, and drop the interface.
Definition CD_CutCellBody.cpp:834
Real m_volumeFraction
Volume fraction.
Definition CD_CutCellBody.H:779
bool isConnected() const noexcept
Whether the fluid this body holds is one connected region.
Definition CD_CutCellBody.cpp:2403
Real boundaryArea() const noexcept
Magnitude of the interface's area vector.
Definition CD_CutCellBody.cpp:2714
RealVect m_normal
Unit normal to the interface, into the fluid.
Definition CD_CutCellBody.H:809
int childState() const noexcept
What the cell this body describes is: covered if it holds no fluid, regular if it is all fluid with n...
Definition CD_CutCellBody.cpp:2845
bool snapFace(const int a_dir, const int a_side, const bool a_neighbourIsFluid) noexcept
Make one face agree with a neighbour that holds no solid, or none that holds no fluid,...
Definition CD_CutCellBody.cpp:883
Real areaFraction(const int a_dir, const Side::LoHiSide a_side) const noexcept
Area fraction of one cell face.
Definition CD_CutCellBody.cpp:2698
int m_numPolygons
Number of polygons in use.
Definition CD_CutCellBody.H:774
void defineWhole() noexcept
Make the body the whole cell: every face a polygon, and no interface.
Definition CD_CutCellBody.cpp:783
RealVect m_volumeCentroid
Volume centroid.
Definition CD_CutCellBody.H:799
void appendInterfaceFacets(Vector< Real > &a_facets, const IntVect &a_cell, const RealVect &a_probLo, const Real a_dx) const noexcept
Append this body's interface, as triangles in three dimensions and segments in two,...
Definition CD_CutCellBody.cpp:1364
int numPolygons() const noexcept
How many polygons this body holds.
Definition CD_CutCellBody.cpp:1579
const RealVect & boundaryCentroid() const noexcept
Interface centroid, relative to the cell centre, in units of the cell size.
Definition CD_CutCellBody.cpp:2732
Real divergenceResidual() const noexcept
Residual in the identity the moments must satisfy among themselves.
Definition CD_CutCellBody.cpp:2744
static constexpr Real s_partitionTolerance
Largest difference between a moment of a subdivision and what it must equal.
Definition CD_CutCellBody.H:574
static constexpr Real s_nullArea
Area below which a polygon carries no moment and is dropped.
Definition CD_CutCellBody.H:624
bool identical(const CutCellBody &a_other) const noexcept
Whether another body holds the same polygons and the same moments, bit for bit.
Definition CD_CutCellBody.cpp:2758
RealVect m_faceCentroid[s_numFaces]
Centroid of each cell face, indexed 2*dir + side.
Definition CD_CutCellBody.H:804
static constexpr int s_maxPolygons
Largest number of polygons a single cut cell's body can need.
Definition CD_CutCellBody.H:591
int widestPolygon() const noexcept
Largest number of vertices any of this body's polygons holds.
Definition CD_CutCellBody.cpp:1585
void printPolygons(std::ostream &a_out) const noexcept
Print every polygon this body holds, in the cell's own frame, for inspection.
Definition CD_CutCellBody.cpp:1346
const RealVect & normal() const noexcept
Unit normal to the interface, pointing into the fluid.
Definition CD_CutCellBody.cpp:2726
bool closeBoundary(const int a_face, const bool a_roundOff) noexcept
Close the body over the edges no polygon carries in reverse, with a patch lying in a given face.
Definition CD_CutCellBody.cpp:1151
bool weldTJunctions(const bool a_roundOff) noexcept
Split every polygon edge at the vertices of other polygons that lie on it.
Definition CD_CutCellBody.cpp:957
Real volumeFraction() const noexcept
Volume fraction.
Definition CD_CutCellBody.cpp:2686
bool defineCut(const CutCellSurface &a_surface) noexcept
Assemble the polygons of a cell the interface passes through.
Definition CD_CutCellBody.cpp:1848
Real closureResidual() const noexcept
How far the assembled polygons are from enclosing a volume.
Definition CD_CutCellBody.cpp:2738
static void copyPolygon(Polygon &a_to, const Polygon &a_from) noexcept
Copy one polygon's vertices in use, its count and its face.
Definition CD_CutCellBody.cpp:88
std::uint64_t fingerprint() const noexcept
A 64-bit hash of everything identical compares: every polygon's face, vertices and vertex edges in or...
Definition CD_CutCellBody.cpp:2803
void recordFace(const int a_face, const int a_reason, CutCellFaceOverrides &a_overrides) const
Write one face's polygons, as this body holds them, into a set of face overrides.
Definition CD_CutCellBody.cpp:814
int faceWalk(const int a_dir, const int a_side, const CutCellSurface &a_surface, Polygon *a_out) const noexcept
The fluid part of one cell face, as outward-oriented polygons.
Definition CD_CutCellBody.cpp:235
void defineDegenerate(const CutCellSurface &a_surface, const Kind a_kind) noexcept
Moments of a cell the interface only touches, never enters.
Definition CD_CutCellBody.cpp:409
bool cutChild(CutCellBody &a_child, const int a_which) const noexcept
Cut this body down to one child's quadrant, without checking the child.
Definition CD_CutCellBody.cpp:2072
static constexpr int s_numFaces
Number of cell faces.
Definition CD_CutCellBody.H:567
The faces of a box's cut cells that do not come from the cells' own chords.
Definition CD_CutCellFaceOverrides.H:48
The values a cut cell's embedded boundary is reconstructed from.
Definition CD_CutCellSurface.H:41
One polygon of the body, in the cell's own frame.
Definition CD_CutCellBody.H:629
int m_numVertices
Number of vertices in use.
Definition CD_CutCellBody.H:643
RealVect m_vertex[s_maxVertices]
Vertices in circuit order, oriented so the area vector points out of the fluid.
Definition CD_CutCellBody.H:633
int m_face
Cell face this polygon lies in, or -1 if it is part of the interface.
Definition CD_CutCellBody.H:648
int m_segmentFace[s_maxVertices]
Cell face the segment leaving each vertex lies in, or -1 for the interface.
Definition CD_CutCellBody.H:658
int m_vertexEdge[s_maxVertices]
Cell edge each vertex came from, or -1 for a cell corner.
Definition CD_CutCellBody.H:638