13#ifndef CD_POLYHEDRALGEOMETRYSHOP_H
14#define CD_POLYHEDRALGEOMETRYSHOP_H
21#include <IntVectSet.H>
29#include <CD_NamespaceHeader.H>
114 const int a_verbosity,
116 const RealVect& a_probLo,
117 const ProblemDomain& a_finestDomain,
118 const ProblemDomain& a_scanLevel,
120 const Real a_thrshdVoF,
121 const bool a_strict);
154 fillGraph(BaseFab<int>& a_regIrregCovered,
155 Vector<IrregNode>& a_nodes,
156 const Box& a_validRegion,
157 const Box& a_ghostRegion,
158 const ProblemDomain& a_domain,
159 const RealVect& a_probLo,
161 const DataIndex& a_di)
const override;
187 getGraph(
const int a_level)
const noexcept;
276 BaseFab<Real>& a_nodeValues,
278 const RealVect& a_probLo,
308 BaseFab<Real> a_intercept[SpaceDim],
309 const IntVect& a_cell,
313 const RealVect& a_probLo,
341 BaseFab<Real> a_intercept[SpaceDim],
343 const BaseFab<Real>& a_nodeValues,
344 const IntVect& a_cell,
345 const RealVect& a_probLo,
365 const IntVect& a_edgeIV,
367 const Real a_loValue,
368 const Real a_hiValue,
369 const RealVect& a_probLo,
370 const Real a_dx)
noexcept;
410 snappedValue(
const BaseIF& a_function,
const RealVect& a_point,
const Real a_dx)
noexcept;
432 resolveTangency(
const BaseIF& a_function,
const RealVect& a_point,
const Real a_dx)
noexcept;
514 collectFacets(Vector<Real>& a_facets,
const int a_level)
const;
521 sanityCheck(
const Vector<RefCountedPtr<PolyhedralEBGraph>>& a_graphs)
const;
543 const IVSFAB<PolyhedralEB::CutCellSurface>& a_surfaces,
544 const BaseFab<signed char>& a_states,
545 const BaseFab<signed char>& a_refined,
546 const IntVect& a_cell)
const;
562 writeSurface(
const std::string& a_fileName,
const Vector<Vector<Real>>& a_facets)
const;
577 const Real a_tolerance,
578 std::vector<Real>& a_vertices,
579 std::vector<int>& a_connectivity);
610 const BaseFab<int>& a_regIrregCovered,
611 const IntVect& a_cell,
612 const ProblemDomain& a_domain)
const;
615#include <CD_NamespaceFooter.H>
Declaration of a closed polyhedron bounding the fluid in one cut cell.
Declaration of the data a cut cell's embedded boundary is reconstructed from.
Declaration of the cut-cell connectivity of one level of the polyhedral geometry.
Declare a class geometry generation (ScanShop) that uses the signed distance function for optimizatio...
Abstract base class for geometries.
Definition CD_ComputationalGeometry.H:47
The cut cells of one level of the polyhedral geometry, and what they connect to.
Definition CD_PolyhedralEBGraph.H:49
The closed polyhedron bounding the fluid in one cut cell, and its moments.
Definition CD_CutCellBody.H:45
The values a cut cell's embedded boundary is reconstructed from.
Definition CD_CutCellSurface.H:41
Geometry generation whose moments are exact integrals of an explicit surface.
Definition CD_PolyhedralGeometryShop.H:50
void writeSurface(const std::string &a_fileName, const Vector< Vector< Real > > &a_facets) const
Write the surface, the boxes it was built over and the boxes that split, as one HDF5 file per phase.
Definition CD_PolyhedralGeometryShop.cpp:737
bool m_testCopy
Whether verifySurface runs testGraphCopy. PolyhedralGeometryShop.test_copy, off by default.
Definition CD_PolyhedralGeometryShop.H:496
void collectFacets(Vector< Real > &a_facets, const int a_level) const
Interface triangles of one level, from this rank's share of its irregular boxes, nine reals each.
Definition CD_PolyhedralGeometryShop.cpp:284
void setGrids(const ComputationalGeometry &a_compGeom, const phase::which_phase a_phase) noexcept
Say which grids the polyhedra are built over, and which phase this generator serves on them.
Definition CD_PolyhedralGeometryShop.cpp:129
PolyhedralGeometryShop & operator=(const PolyhedralGeometryShop &a_other)=delete
Disallow copy assignment.
int m_maxRefinement
How far below the geometry's own grids a cell must stay single valued. PolyhedralGeometryShop....
Definition CD_PolyhedralGeometryShop.H:485
UnresolvedAction
What to do with a cell this generator cannot describe at the refinement the mesh will ask for.
Definition CD_PolyhedralGeometryShop.H:61
@ Collapse
Keep the pieces in one body, taking every moment from their sum and moving only the volume centroid.
@ Warn
Report the cells and carry on, leaving it to the user to raise the geometric resolution.
@ Cover
Turn the cell solid, so that neither it nor anything cut from it is ever multi valued.
static 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_PolyhedralGeometryShop.cpp:1841
static constexpr Real s_snapTolerance
Fraction of a cell width within which an implicit-function value is read as exactly zero.
Definition CD_PolyhedralGeometryShop.H:375
bool m_verbose
Whether the member functions that run once per level or per phase announce themselves in pout....
Definition CD_PolyhedralGeometryShop.H:502
void testGraphCopy() const
Copy every graph onto a layout that splits each of its tiles into octants with the ranks shuffled,...
Definition CD_PolyhedralGeometryShop.cpp:1595
static 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_PolyhedralGeometryShop.cpp:1952
Vector< RefCountedPtr< PolyhedralEBGraph > > m_graphs
Graph of every level, indexed as the geometry indexes its levels; undefined where a level has no tile...
Definition CD_PolyhedralGeometryShop.H:448
void verifySurface() const
Build the polyhedra over the grids, check that they form a surface, and write it if asked.
Definition CD_PolyhedralGeometryShop.cpp:224
UnresolvedAction m_unresolvedAction
What becomes of a cell that fails that test. PolyhedralGeometryShop.unresolved_cells,...
Definition CD_PolyhedralGeometryShop.H:491
static bool isDust(const PolyhedralEB::CutCellBody &a_body) noexcept
Whether a cut body holds nothing at all and is therefore a regular cell.
Definition CD_PolyhedralGeometryShop.cpp:1821
static 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_PolyhedralGeometryShop.H:393
static 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_PolyhedralGeometryShop.cpp:1829
static 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_PolyhedralGeometryShop.cpp:1879
static 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_PolyhedralGeometryShop.cpp:1780
static void indexFacets(const Vector< Real > &a_facets, const Real a_tolerance, std::vector< Real > &a_vertices, std::vector< int > &a_connectivity)
Identify the vertices of a triangle soup, giving each one once and each triangle three indices.
Definition CD_PolyhedralGeometryShop.cpp:655
static 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_PolyhedralGeometryShop.H:385
static constexpr Real s_divergenceTolerance
Residual above which the stored moments and the ones PolyGeom recomputes disagree.
Definition CD_PolyhedralGeometryShop.H:584
PolyhedralGeometryShop(const PolyhedralGeometryShop &a_other)=delete
Disallow copy construction.
Real m_volumeThreshold
Volume fraction below which a cut cell carries no fluid worth keeping.
Definition CD_PolyhedralGeometryShop.H:594
bool m_writeSurface
Whether verifySurface writes the surface. PolyhedralGeometryShop.write_surface, off by default.
Definition CD_PolyhedralGeometryShop.H:458
void buildGraphs()
Build the graph of every tiled level: the cut cells, their surfaces, and what every face opens onto.
Definition CD_PolyhedralGeometryShop.cpp:140
void fillGraph(BaseFab< int > &a_regIrregCovered, Vector< IrregNode > &a_nodes, const Box &a_validRegion, const Box &a_ghostRegion, const ProblemDomain &a_domain, const RealVect &a_probLo, const Real &a_dx, const DataIndex &a_di) const override
Fill the graph and the nodes for one box.
Definition CD_PolyhedralGeometryShop.cpp:2094
const ComputationalGeometry * m_compGeom
The geometry whose grids the polyhedra are built over, or null before setGrids.
Definition CD_PolyhedralGeometryShop.H:443
~PolyhedralGeometryShop() override
Destructor.
Definition CD_PolyhedralGeometryShop.cpp:1737
bool m_strict
Whether a declined cell aborts the run rather than falling back.
Definition CD_PolyhedralGeometryShop.H:589
static 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_PolyhedralGeometryShop.cpp:1767
bool m_profile
Whether verifySurface reports its timings. PolyhedralGeometryShop.profile, off by default.
Definition CD_PolyhedralGeometryShop.H:470
void fillNode(IrregNode &a_node, const PolyhedralEB::CutCellBody &a_body, const BaseFab< int > &a_regIrregCovered, const IntVect &a_cell, const ProblemDomain &a_domain) const
Write a cut cell's node from its body.
Definition CD_PolyhedralGeometryShop.cpp:2010
const PolyhedralEBGraph & getGraph(const int a_level) const noexcept
The graph of a level, undefined below the start level. Stops the run before buildGraphs.
Definition CD_PolyhedralGeometryShop.cpp:210
static constexpr Real s_weldSpacing
Fraction of the finest grid spacing within which two vertices are the same vertex in sanityCheck.
Definition CD_PolyhedralGeometryShop.H:438
void defineBody(PolyhedralEB::CutCellBody &a_body, const PolyhedralEBGraph &a_graph, const IVSFAB< PolyhedralEB::CutCellSurface > &a_surfaces, const BaseFab< signed char > &a_states, const BaseFab< signed char > &a_refined, const IntVect &a_cell) const
Build the body of a cut cell of a graph, restricted on every face the finer level describes.
Definition CD_PolyhedralGeometryShop.cpp:341
bool m_sanityCheck
Whether verifySurface runs sanityCheck. PolyhedralGeometryShop.sanity_check.
Definition CD_PolyhedralGeometryShop.H:465
void sanityCheck() const
Check that the interface triangles form a surface that is closed except on the domain boundary.
Definition CD_PolyhedralGeometryShop.cpp:1137
static void buildSurface(const BaseIF &a_function, BaseFab< Real > a_intercept[SpaceDim], PolyhedralEB::CutCellSurface &a_surface, 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_PolyhedralGeometryShop.cpp:1968
PolyhedralGeometryShop()=delete
Disallowed default constructor.
void reportUnresolvedRefinement() const
Report the cells that cannot be cut for a refinement without falling into more than one piece.
Definition CD_PolyhedralGeometryShop.cpp:1035
phase::which_phase m_phase
Phase this generator serves on those grids.
Definition CD_PolyhedralGeometryShop.H:453
static void fillNodeValues(const BaseIF &a_function, BaseFab< Real > &a_nodeValues, const Box &a_region, const RealVect &a_probLo, const Real &a_dx)
Evaluate the implicit function at every node of a region.
Definition CD_PolyhedralGeometryShop.cpp:1740
Derived version of GeometryShop that load balances based on the cut cells themselves.
Definition CD_ScanShop.H:32
which_phase
Enumeration of supported phases.
Definition CD_MultiFluidIndexSpace.H:38