13#ifndef CD_CUTCELLBODY_H
14#define CD_CUTCELLBODY_H
23#include <CD_NamespaceHeader.H>
25namespace PolyhedralEB {
202 areaFraction(const
int a_dir, const Side::LoHiSide a_side) const noexcept;
211 faceCentroid(const
int a_dir, const Side::LoHiSide a_side) const noexcept;
271 const IntVect& a_cell,
272 const RealVect& a_probLo,
273 const Real a_dx)
const noexcept;
337 snapFace(const
int a_dir, const
int a_side, const
bool a_neighbourIsFluid) noexcept;
607#include <CD_NamespaceFooter.H>
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:45
bool weldTJunctions() noexcept
Split every polygon edge at the vertices of other polygons that lie on it.
Definition CD_CutCellBody.cpp:717
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:1958
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:1916
RealVect m_boundaryCentroid
Interface centroid.
Definition CD_CutCellBody.H:597
bool define(const CutCellSurface &a_surface) noexcept
Build the body from the values the surface is reconstructed from.
Definition CD_CutCellBody.cpp:1458
void accumulateMoments() noexcept
Take the moments of the assembled polygons.
Definition CD_CutCellBody.cpp:1083
bool closeBoundary(const int a_face) noexcept
Close the body over the edges no polygon carries in reverse, with a patch lying in a given face.
Definition CD_CutCellBody.cpp:840
static Kind classify(const CutCellSurface &a_surface) noexcept
How the cell relates to the interface.
Definition CD_CutCellBody.cpp:46
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:1486
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:359
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:2057
bool interfaceIsPlanar() const noexcept
Whether every polygon of the interface lies in one plane.
Definition CD_CutCellBody.cpp:1814
bool closeInterface() noexcept
Rebuild the interface from the face polygons this body holds.
Definition CD_CutCellBody.cpp:834
Real m_areaFraction[s_numFaces]
Area fraction of each cell face, indexed 2*dir + side.
Definition CD_CutCellBody.H:567
RealVect m_closure
Sum of the outward area vectors over every polygon.
Definition CD_CutCellBody.H:602
static constexpr int s_maxVertices
Largest number of vertices one of those polygons can carry.
Definition CD_CutCellBody.H:407
Real m_trueBoundaryArea
Area of the interface itself.
Definition CD_CutCellBody.H:577
static constexpr Real s_edgeTolerance
Distance by which a crossing is held off an edge's endpoints.
Definition CD_CutCellBody.H:415
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:92
Real m_boundaryArea
Magnitude of the interface's area vector.
Definition CD_CutCellBody.H:572
static int numSheets(const CutCellSurface &a_surface) noexcept
How many separate sheets of interface the surface enters the cell as.
Definition CD_CutCellBody.cpp:68
const RealVect & volumeCentroid() const noexcept
Volume centroid, relative to the cell centre, in units of the cell size.
Definition CD_CutCellBody.cpp:2043
Real trueBoundaryArea() const noexcept
Area of the interface itself, as the sum of its triangles' areas.
Definition CD_CutCellBody.cpp:2071
bool restrictFace(const CutCellSurface *a_children, 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:566
Polygon m_polygon[s_maxPolygons]
The polygons bounding the fluid.
Definition CD_CutCellBody.H:552
CutCellBody() noexcept
Constructor. Leaves the body empty; call define before reading any moment.
Definition CD_CutCellBody.cpp:28
Kind
How a cell relates to the interface.
Definition CD_CutCellBody.H:51
Real m_volumeFraction
Volume fraction.
Definition CD_CutCellBody.H:562
bool isConnected() const noexcept
Whether the fluid this body holds is one connected region.
Definition CD_CutCellBody.cpp:1754
Real boundaryArea() const noexcept
Magnitude of the interface's area vector.
Definition CD_CutCellBody.cpp:2065
RealVect m_normal
Unit normal to the interface, into the fluid.
Definition CD_CutCellBody.H:592
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:659
Real areaFraction(const int a_dir, const Side::LoHiSide a_side) const noexcept
Area fraction of one cell face.
Definition CD_CutCellBody.cpp:2049
int m_numPolygons
Number of polygons in use.
Definition CD_CutCellBody.H:557
RealVect m_volumeCentroid
Volume centroid.
Definition CD_CutCellBody.H:582
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 physical coordinates.
Definition CD_CutCellBody.cpp:1025
int numPolygons() const noexcept
How many polygons this body holds.
Definition CD_CutCellBody.cpp:1065
const RealVect & boundaryCentroid() const noexcept
Interface centroid, relative to the cell centre, in units of the cell size.
Definition CD_CutCellBody.cpp:2083
Real divergenceResidual() const noexcept
Residual in the identity the moments must satisfy among themselves.
Definition CD_CutCellBody.cpp:2095
static constexpr Real s_nullArea
Area below which a polygon carries no moment and is dropped.
Definition CD_CutCellBody.H:423
RealVect m_faceCentroid[s_numFaces]
Centroid of each cell face, indexed 2*dir + side.
Definition CD_CutCellBody.H:587
static constexpr int s_maxPolygons
Largest number of polygons a single cut cell's body can need.
Definition CD_CutCellBody.H:390
int widestPolygon() const noexcept
Largest number of vertices any of this body's polygons holds.
Definition CD_CutCellBody.cpp:1071
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:1007
const RealVect & normal() const noexcept
Unit normal to the interface, pointing into the fluid.
Definition CD_CutCellBody.cpp:2077
Real volumeFraction() const noexcept
Volume fraction.
Definition CD_CutCellBody.cpp:2037
bool defineCut(const CutCellSurface &a_surface) noexcept
Assemble the polygons of a cell the interface passes through.
Definition CD_CutCellBody.cpp:1334
Real closureResidual() const noexcept
How far the assembled polygons are from enclosing a volume.
Definition CD_CutCellBody.cpp:2089
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:118
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:292
static constexpr int s_numFaces
Number of cell faces.
Definition CD_CutCellBody.H:385
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:428
int m_numVertices
Number of vertices in use.
Definition CD_CutCellBody.H:442
int m_face
Cell face this polygon lies in, or -1 if it is part of the interface.
Definition CD_CutCellBody.H:447