|
chombo-discharge
|
Geometry generation whose moments are exact integrals of an explicit surface. More...
#include <CD_PolyhedralGeometryShop.H>


Public Types | |
| enum class | UnresolvedAction { Warn , Cover , Collapse } |
| What to do with a cell this generator cannot describe at the refinement the mesh will ask for. More... | |
Public Member Functions | |
| PolyhedralGeometryShop ()=delete | |
| Disallowed default constructor. | |
| PolyhedralGeometryShop (const BaseIF &a_localGeom, const int a_verbosity, const Real a_dx, const RealVect &a_probLo, const ProblemDomain &a_finestDomain, const ProblemDomain &a_scanLevel, const int a_ebGhost, const Real a_thrshdVoF, const bool a_strict) | |
| Constructor. | |
| ~PolyhedralGeometryShop () override | |
| Destructor. | |
| PolyhedralGeometryShop (const PolyhedralGeometryShop &a_other)=delete | |
| Disallow copy construction. | |
| PolyhedralGeometryShop & | operator= (const PolyhedralGeometryShop &a_other)=delete |
| Disallow copy assignment. | |
| GeometryService::InOut | InsideOutside (const Box &a_region, const ProblemDomain &a_domain, const RealVect &a_probLo, const Real &a_dx, const DataIndex &a_dit) const override |
| Whether a box is all regular, all covered or holds the surface, as EBISLevel asks it of a region. | |
| 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. | |
| 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. | |
| void | buildGraphs () |
| Build the graph of every tiled level: the cut cells, their surfaces, and what every face opens onto. | |
| const PolyhedralEBGraph & | getGraph (const int a_level) const noexcept |
| The graph of a level, undefined below the start level. Stops the run before buildGraphs. | |
| void | buildMoments () |
| Compute the index-space data on the geometry's own grids, from the graph and nothing else. | |
| const LevelData< EBGraph > & | getEBGraph (const int a_level) const |
| The index-space graph buildMoments made for a level. | |
| const LevelData< EBData > & | getEBData (const int a_level) const |
| The index-space moments buildMoments made for a level. | |
| void | fillLayout (LevelData< EBGraph > &a_graph, LevelData< EBData > &a_data, const DisjointBoxLayout &a_grids, const ProblemDomain &a_domain, const int a_graphGhost, const int a_dataGhost) const |
| Fill any layout on any level with its index space: graph and first moments, ghost cells included. | |
| void | verifySurface () const |
| Build the polyhedra over the grids, check that they form a surface, and write it if asked. | |
| void | sanityCheck () const |
| Check that the interface triangles form a surface that is closed except on the domain boundary. | |
| void | reportUnresolvedRefinement () const |
| Report the cells that cannot be cut for a refinement without falling into more than one piece. | |
| void | testGraphCopy () const |
| Copy every graph onto a layout that splits each of its tiles into octants with the ranks shuffled, and then onto the tiles themselves with the ranks shuffled; run sanityCheck over the copies each time, copy them back onto the original layouts and require equality bit for bit. | |
| int | destinationLevel (const ProblemDomain &a_domain) const |
| The geometry level a destination domain lives on. | |
| void | destinationPieces (std::vector< std::vector< std::pair< int, Box > > > &a_pieces, const IntVectSet &a_valid, const int a_level) const |
| The pieces of the graph a destination region needs: what each tiled level owns of it, tile by tile, down to the cells whose footprint on the destination level lies in the region. | |
| void | planSends (std::vector< std::vector< PolyhedralEB::GraphCopyHeader > > &a_sends, const std::vector< DisjointBoxLayout > &a_grids, const std::vector< ProblemDomain > &a_domains, const int a_ghost, const std::vector< std::vector< char > > &a_taking) const |
| Plan the pieces of a copy of the graph onto a destination hierarchy that this rank sends. | |
| void | planReceives (std::vector< std::vector< PolyhedralEB::GraphCopyHeader > > &a_receives, const std::vector< DisjointBoxLayout > &a_grids, const std::vector< ProblemDomain > &a_domains, const int a_ghost) const |
| The pieces of a copy of the graph that this rank's destination boxes need, worked out from the destination side: the reference checkCopyPlan holds planSends to. | |
| long long | checkCopyPlan (const std::vector< DisjointBoxLayout > &a_grids, const std::vector< ProblemDomain > &a_domains, const int a_ghost) const |
| Plan a copy onto a destination hierarchy from both sides, send every rank the headers planSends gives it, and require them to hold exactly the cells planReceives expects, per destination box and source box, none twice. Collective. | |
| void | testCopyPlan () const |
| Check the copy plan onto the geometry's own box hierarchy with the ranks shuffled, onto every level of it alone, and onto a level past the finest. Collective. Switched by PolyhedralGeometryShop.test_copy. | |
| void | copyGraphs (AMRPolyhedralEBGraph &a_dest, const std::vector< DisjointBoxLayout > &a_grids, const std::vector< ProblemDomain > &a_domains, const int a_ghost, const std::vector< std::vector< char > > &a_taking) const |
| Copy the graphs onto a destination hierarchy. | |
| void | testCopyRoundTrip () const |
| Copy every graph onto its own layout as a destination level of its own, and require every cell the level owns to arrive as the graph holds it, bit for bit: state, surface, role and face overrides. Collective. Switched by PolyhedralGeometryShop.test_copy. | |
| void | testCopyBodies () const |
| Require every cut cell's body to survive a copy bit for bit. | |
| void | testMoments () const |
| Check the index-space data buildMoments made against the graph it came from. | |
| void | testFill () const |
| Check fillLayout on every level of the geometry and one past the finest, onto the level's boxes in octants and onto the boxes of the next coarser level refined. | |
| void | testLinks () const |
| Check the links between every two neighbouring levels of the geometry, filled onto the coarser level's boxes in octants with the ranks shuffled and onto the same boxes refined. | |
| void | extensionTiles (Vector< Box > &a_tiles, const DisjointBoxLayout &a_grids, const ProblemDomain &a_domain, const int a_graphGhost) const |
| The tiles of a destination level that the stored level does not hold. | |
| void | extensionLoads (Vector< long > &a_loads, const Vector< Box > &a_tiles, const int a_level) const |
| The work of cutting each extension tile from its ancestors. | |
| void | extendLevel (LevelData< EBGraph > &a_graph, LevelData< EBData > &a_data, const DisjointBoxLayout &a_tiles, const ProblemDomain &a_domain) const |
| Cut the extension tiles from their ancestors, on a layout balanced for it. | |
| void | countTileCutCells () |
| Count the cut cells of every tile on every level, for extensionLoads. | |
| void | coarsenLevel (LevelData< EBGraph > &a_coarGraph, LevelData< EBData > &a_coarData, long long &a_numInexact, const std::vector< DisjointBoxLayout > &a_grids, const std::vector< ProblemDomain > &a_domains, const int a_fineLevel) const |
| Coarsen a level of the index space onto its coarsened layout. | |
| void | assembleLevel (long long &a_numPromoted, const AMRPolyhedralEBGraph &a_copy, const AMRPolyhedralEBGraph &a_everyBox, const LevelData< EBGraph > *a_coarsenedGraph, const LevelData< EBData > *a_coarsenedData, const std::vector< DisjointBoxLayout > &a_grids, const std::vector< ProblemDomain > &a_domains, const int a_level) |
| Build a level of the index space from its own cells and the cells coarsened from the next finer level. | |
| Public Member Functions inherited from ScanShop | |
| ScanShop ()=delete | |
| Disallowed default constructor. | |
| ScanShop (const BaseIF &a_localGeom, int a_verbosity, Real a_dx, const RealVect &a_probLo, const ProblemDomain &a_finestDomain, const ProblemDomain &a_scanLevel, int a_ebGhost=4, Real a_thrshdVoF=1.0e-16) | |
| Constructor. | |
| ~ScanShop () override | |
| Destructor (does nothing). | |
| ScanShop (const ScanShop &)=delete | |
| Disallow copy construction. | |
| ScanShop & | operator= (const ScanShop &)=delete |
| Disallow copy assignment. | |
| ScanShop (ScanShop &&)=delete | |
| Disallow move construction. | |
| ScanShop & | operator= (ScanShop &&)=delete |
| Disallow move assignment. | |
| void | setProfileFileName (std::string a_fileName) |
| If doing profiling, set the output name. | |
| void | makeGrids (const ProblemDomain &a_domain, DisjointBoxLayout &a_grids, const int &a_maxGridSize, const int &a_maxIrregGridSize) override |
| This grid generation method is called by EBISLevel when using distributed data. | |
| GeometryService::InOut | InsideOutside (const Box &a_region, const ProblemDomain &a_domain, const RealVect &a_probLo, const Real &a_dx, const DataIndex &a_dit) const override |
| This method is called by EBSILevel when using distributed data. | |
| 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 |
| Override of GeometryShop's fillGraph. | |
Static Public Member Functions | |
| static void | validRegion (IntVectSet &a_valid, const Box &a_box, const ProblemDomain &a_domain, const DisjointBoxLayout *a_finer, const Vector< Box > *a_finerBoxes, const int a_ratio, const int a_ghost) |
| The cells of a destination box a copy of the graph fills: the box grown by a ghost width, inside the domain, less what the next finer destination level covers. | |
| static void | coarsenBoxwise (IntVectSet &a_cells, const int a_ratio) |
| Coarsen a set of cells: every coarse cell holding any of them. | |
| static bool | sourceBody (PolyhedralEB::CutCellBody &a_body, const AMRPolyhedralEBGraph &a_graph, const int a_level, const DataIndex &a_dit, const int a_sourceLevel, const IntVect &a_cell) |
| Build the body of one cut cell of a geometry level, from what a destination box holds of that level. | |
| static void | destinationBodies (std::vector< PolyhedralEB::CutCellBody > &a_bodies, long long &a_numSplit, const AMRPolyhedralEBGraph &a_graph, const int a_level, const DataIndex &a_dit, const IntVect &a_cell) |
| The bodies a cell of a destination level is made of, from the geometry levels that own it. | |
| static DisjointBoxLayout | shuffledLayout (const Vector< Box > &a_boxes, const ProblemDomain &a_domain) |
| A layout over given boxes with the ranks shuffled: they walk the rank list with a stride coprime to its length, so that no rank holds what a load balance would have given it. For the copy tests. | |
Protected Member Functions | |
| void | collectFacets (Vector< Real > &a_facets, const int a_level) const |
| Interface triangles of one level, or segments in two dimensions, from this rank's share of its irregular boxes, three reals per vertex. | |
| void | stitchGraphs (const Vector< RefCountedPtr< PolyhedralEBGraph > > &a_graphs) const |
| Stitch every level of a set of graphs to the level above it, from the graphs alone. | |
| void | sanityCheck (const Vector< RefCountedPtr< PolyhedralEBGraph > > &a_graphs) const |
| The closure check over a given set of graphs, one per level as m_graphs holds them. | |
| void | defineBodyFromFunction (PolyhedralEB::CutCellBody &a_body, const PolyhedralEB::CutCellSurface &a_surface, const PolyhedralEBGraph &a_graph, const BaseFab< signed char > &a_filled, const BaseFab< signed char > &a_refined, const IntVect &a_cell) const |
| Stitch a cut cell's body with its children reconstructed from the implicit function. | |
| void | stitchLevel (PolyhedralEBGraph &a_coarse, const PolyhedralEBGraph *a_fine, const PolyhedralEBGraph *a_coarser) const |
| Stitch one level: take its refined edges' crossings and its seam faces from the finer level's stored cells, close its faces onto filled cells, write the crossings into its surfaces and the faces into its overrides. | |
| 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. | |
| void | writeGraph (const std::string &a_fileName) const |
| Write the cut cells' connectivity as a skeleton a viewer can draw: a point per cut cell and per open face of one, and a line from each cut cell to each of its open faces. | |
| Protected Member Functions inherited from ScanShop | |
| void | makeDomains (Real a_dx, const RealVect &a_probLo, const ProblemDomain &a_finestDomain, const ProblemDomain &a_scanLevel) |
| Create the problem domain and resolutions. | |
| void | buildFinerLevels (int a_coarserLevel, int a_maxGridSize) |
| Refine levels recursively down to the finest level. | |
| void | buildCoarseLevel (int a_level, int a_maxGridSize) |
| Build the "coarse level" where we initiate the recursion process. | |
| int | getScanSkip (Real a_slack, Real a_dx) const |
| Number of cells along the scan line that can be passed over without evaluating the implicit function. | |
| bool | isRegular (Box a_box, const RealVect &a_probLo, Real a_dx) const |
| Check if every point in input box is regular. | |
| bool | isCovered (Box a_box, const RealVect &a_probLo, Real a_dx) const |
| Check if every point in box is covered. | |
| std::vector< std::pair< Box, int > > | getSortedBoxesAndTypes (const Vector< Box > &a_boxes, const Vector< int > &a_types) const |
| Sort boxes lexicographically. | |
| void | defineLevel (Vector< Box > &coveredBoxes, Vector< Box > ®ularBoxes, Vector< Box > &cutCellBoxes, int a_level) |
| Define the "box map" on a specified level. | |
Static Protected Member Functions | |
| static void | exchangeBytes (const std::vector< std::vector< char > > &a_send, std::vector< char > &a_recv, std::vector< int > &a_offset, std::vector< int > &a_count) |
| Trade byte buffers among all ranks: counts first, then the payloads, into one flat buffer. | |
| static bool | edgesRefined (bool a_edgeRefined[PolyhedralEB::CutCellSurface::s_numEdges], const BaseFab< signed char > &a_refined, const Box &a_domain, const IntVect &a_cell) |
| Which of a cell's edges the finer level describes. | |
| static int | stitchBody (PolyhedralEB::CutCellBody &a_body, PolyhedralEB::CutCellSurface &a_surface, PolyhedralEB::CutCellFaceOverrides *a_overrides, const PolyhedralEB::CutCellSurface *a_children, const bool *a_edgeRefined, const BaseFab< signed char > &a_filled, const BaseFab< signed char > &a_refined, const BaseFab< signed char > *a_fineFilled, const Box &a_domain, const IntVect &a_cell) |
| Stitch a cut cell's body to the finer level and to the covered cells around it. | |
| static void | defineBody (PolyhedralEB::CutCellBody &a_body, const IVSFAB< PolyhedralEB::CutCellSurface > &a_surfaces, const PolyhedralEB::CutCellFaceOverrides &a_overrides, const IntVect &a_cell) |
| Build the body of a cut cell of a stitched graph from its stored surface and face overrides. | |
| static void | readFineCells (BaseFab< Real > &a_nodes, BaseFab< Real > a_crossings[SpaceDim], BaseFab< int > &a_fluidJoined, const Box &a_region, const BaseFab< signed char > &a_states, const BaseFab< signed char > &a_mask, const IVSFAB< PolyhedralEB::CutCellSurface > &a_surfaces) |
| Read the nodes and edges of a region of the finer level off its stored cells. | |
| static void | assembleSurface (PolyhedralEB::CutCellSurface &a_surface, const BaseFab< Real > &a_nodes, const BaseFab< Real > a_crossings[SpaceDim], const BaseFab< int > &a_fluidJoined, const IntVect &a_cell) |
| One cell's surface, read off node values, edge crossings and face decisions that are already known. | |
| static void | copyFinerCells (LevelData< BaseFab< signed char > > &a_states, LevelData< BaseFab< signed char > > &a_mask, LayoutData< IntVectSet > &a_sets, LevelData< IVSFAB< PolyhedralEB::CutCellSurface > > &a_surfaces, const PolyhedralEBGraph &a_fine, const DisjointBoxLayout &a_grids, const int a_ring) |
| Copy a finer level's cells onto a coarser level's layout refined, with a ring around every box. | |
| static void | indexFacets (std::vector< Real > &a_vertices, std::vector< int > &a_connectivity, const Vector< Real > &a_facets, const Real a_tolerance) |
| Identify the vertices of a triangle soup, giving each one once and each triangle three indices. | |
Protected Attributes | |
| const ComputationalGeometry * | m_compGeom |
| The geometry whose grids the polyhedra are built over, or null before setGrids. | |
| Vector< RefCountedPtr< PolyhedralEBGraph > > | m_graphs |
| Graph of every level, indexed as the geometry indexes its levels; undefined where a level has no tiles. | |
| Vector< RefCountedPtr< LevelData< EBGraph > > > | m_ebGraphs |
| Index-space graph of every level buildMoments built, over the geometry's boxes; null where it built none. | |
| Vector< RefCountedPtr< LevelData< EBData > > > | m_ebData |
| Index-space moments of every level buildMoments built, over the geometry's boxes; null where it built none. | |
| phase::which_phase | m_phase |
| Phase this generator serves on those grids. | |
| bool | m_writeSurface |
| Whether verifySurface writes the surface. PolyhedralGeometryShop.write_surface, off by default. | |
| bool | m_writeGraph |
| Whether verifySurface writes the graph as a skeleton. PolyhedralGeometryShop.write_graph, off by default. | |
| bool | m_sanityCheck |
| Whether verifySurface runs sanityCheck. PolyhedralGeometryShop.sanity_check. | |
| bool | m_profile |
| Whether verifySurface reports its timings. PolyhedralGeometryShop.profile, off by default. | |
| int | m_maxRefinement |
| How far below the geometry's own grids a cell must stay single valued. PolyhedralGeometryShop.max_refinement, one – that is, off – by default. | |
| UnresolvedAction | m_unresolvedAction |
| What becomes of a cell that fails that test. PolyhedralGeometryShop.unresolved_cells, warn by default. | |
| bool | m_fillSplitFluid |
| Whether a cell whose fluid falls into more than one piece is always filled (true), or only when its fluid is the larger part of it (false). PolyhedralGeometryShop.fill_split_fluid, always by default, or majority. | |
| bool | m_testCopy |
| Whether verifySurface runs testGraphCopy. PolyhedralGeometryShop.test_copy, off by default. | |
| bool | m_extensionLoadByCutCells |
| Whether the extension tiles are balanced by the cut cells they are cut from (true) or carry one unit of load each (false). PolyhedralGeometryShop.extension_cut_cell_loads, off by default. | |
| Vector< Vector< long long > > | m_tileCutCells |
| The number of cut cells of every tile, indexed [level][tile] as ComputationalGeometry::getCutTiles lists them. The same on every rank. Set by countTileCutCells. | |
| bool | m_verbose |
| Whether the member functions that run once per level or per phase announce themselves in pout. PolyhedralGeometryShop.verbose, off by default. The functions that run per cell never announce themselves. | |
| bool | m_strict |
| Whether a declined cell aborts the run rather than falling back. | |
| Real | m_volumeThreshold |
| Volume fraction below which a cut cell carries no fluid worth keeping. | |
| Protected Attributes inherited from ScanShop | |
| std::string | m_fileName |
| Set output file name (if doing profiling). | |
| BoxSorting | m_boxSorting |
| For arranging boxes in space when we load balance. | |
| Timer | m_timer |
| Timer for when we use run-time profiling. | |
| bool | m_profile |
| Bool for run-time profiling of ScanShop. | |
| bool | m_distanceSkip |
| Whether or not the box scan may skip cells using the implicit function value as a distance. | |
| int | m_scanLevel |
| Scan level where we first begin to break up boxes. This is relative the EBIS level. | |
| int | m_ebGhost |
| Maximum number of ghost cells near the EB. | |
| RealVect | m_probLo |
| Lower-left corner of simulation domain. | |
| const BaseIF * | m_baseIF |
| Implicit function used to generate geometries. | |
| bool | m_hasScanLevel |
| Check if scan level has been built. | |
| Vector< Real > | m_dx |
| Level resolutions. Note that index 0 is the finest level. | |
| Vector< ProblemDomain > | m_domains |
| Level domains. Note that index 0 is the finest level. | |
| Vector< DisjointBoxLayout > | m_grids |
| Grids on each level, used for generating the EBIS information. | |
| Vector< RefCountedPtr< LayoutData< GeometryService::InOut > > > | m_boxMap |
| Box maps. | |
| std::vector< bool > | m_hasThisLevel |
| Check if level has been scanned. 0 = false, != 0 implies true. | |
Static Protected Attributes | |
| static constexpr int | s_elementVertices = SpaceDim |
| Vertices of one element of the written surface: a triangle in three dimensions, a segment in two. | |
| static constexpr int | s_cutRing = 2 |
| Width of the ring the graph is copied with for a box whose ghost cells are cut as its own cells are. | |
| static constexpr int | s_ownRing = 1 |
| Width of the ring the graph is copied onto the geometry's grids with for buildMoments. | |
| static constexpr int | s_signatureComps = 2 + 3 * SpaceDim |
| Number of components cellSignature writes: the VoF count, the volume, the first moment and the apertures. | |
| static constexpr int | s_cellNode = 0 |
| Kind of a node of the written graph: a cut cell, at its fluid's centroid. | |
| static constexpr int | s_faceNode = 1 |
| Kind of a node of the written graph: an open face of a cut cell, at the centroid of its open part. | |
| static constexpr int | s_noValue = -1 |
| What a field of the written graph reads on a node of the kind it does not belong to. | |
| static constexpr Real | s_weldSpacing = 1.0E-10 |
| Fraction of a level's grid spacing within which two vertices are the same vertex, in sanityCheck and in the written surface. | |
| static constexpr int | s_absent = 2 |
| State of a cell of the finer level that the finer level does not hold, in a copy of its states. | |
| static constexpr Real | s_divergenceTolerance = 1.0E-9 |
| Residual above which the stored moments and the ones PolyGeom recomputes disagree. | |
Geometry generation whose moments are exact integrals of an explicit surface.
Takes the same topology as GeometryShop – the same classification, the same graph and the same covered-cell fix-ups – and replaces only the quadrature. Where GeometryShop integrates the arc the interface really follows, this assembles the closed polyhedron whose faces are bounded by straight chords between the edge crossings and integrates that.
The difference is deliberate and costs accuracy on curved geometry, where the apertures drop from third order to second. What it buys is that the moments are the moments of a body, so they satisfy the relations Chombo's own coarsening applies to them, and a subdivision of that body sums back to it exactly.
Cells are declined rather than approximated when the assembled polygons do not close. That is fatal by default: it has never fired on any geometry tested, and a cell that trips it is an edge case worth seeing rather than absorbing.
|
strong |
What to do with a cell this generator cannot describe at the refinement the mesh will ask for.
A cell whose fluid falls into more than one piece when it is cut for a refinement cannot be carried single valued at that ratio, and there is no reformulation of the interior that avoids it: the only representation guaranteed to keep every descendant single valued is a planar interface, and a planar interface cannot meet the face chords a cell shares with its neighbours. So the cell is a choice rather than a bug, and the choice belongs to whoever set up the run.
| PolyhedralGeometryShop::PolyhedralGeometryShop | ( | const BaseIF & | a_localGeom, |
| const int | a_verbosity, | ||
| const Real | a_dx, | ||
| const RealVect & | a_probLo, | ||
| const ProblemDomain & | a_finestDomain, | ||
| const ProblemDomain & | a_scanLevel, | ||
| const int | a_ebGhost, | ||
| const Real | a_thrshdVoF, | ||
| const bool | a_strict ) |
Constructor.
| [in] | a_localGeom | The implicit function for the geometry |
| [in] | a_verbosity | Verbosity |
| [in] | a_dx | Resolution on the finest level |
| [in] | a_probLo | Physical coordinates of the lower-left corner of the domain |
| [in] | a_finestDomain | Finest grid level |
| [in] | a_scanLevel | Level on which to initiate the load balancing sequence |
| [in] | a_ebGhost | Number of EB ghost cells |
| [in] | a_thrshdVoF | Volume fraction below which a cut cell is dropped |
| [in] | a_strict | Whether a declined cell aborts the run |
| void PolyhedralGeometryShop::assembleLevel | ( | long long & | a_numPromoted, |
| const AMRPolyhedralEBGraph & | a_copy, | ||
| const AMRPolyhedralEBGraph & | a_everyBox, | ||
| const LevelData< EBGraph > * | a_coarsenedGraph, | ||
| const LevelData< EBData > * | a_coarsenedData, | ||
| const std::vector< DisjointBoxLayout > & | a_grids, | ||
| const std::vector< ProblemDomain > & | a_domains, | ||
| const int | a_level ) |
Build a level of the index space from its own cells and the cells coarsened from the next finer level.
A box the geometry calls regular or covered is set whole with its ghost cell, and nothing of the graph is read for it. The geometry classifies its boxes grown by its EB ghost width, at least one cell, so the ghost cell holds no cut cell; under PolyhedralGeometryShop.test_copy every cell of the box and its ghost cell is checked against the graph copied onto every box. Otherwise, the level's own cells take what the copied graph says. Its cells the next finer level covers take the coarsened VoFs, and an own cell beside one takes the faces between them from the coarsened side, which knows which VoF each leads into. A regular cell, own or coarsened, beside a cell of more than one VoF is written as a full cut cell, since a regular cell connects to one VoF only; this changes no moment.
A coarsened cell carries its links to the next finer level, the pieces coarsenLevel gave it, and a regular cell made cut all of its children. An own cut cell, which no finer box lies over, has no links to the finer level. When the domain coarsens by two, every VoF of the boxes is linked to the next coarser level by writeCoarserLinks, from this level's own graph, before that level is built.
| [out] | a_numPromoted | Incremented for every regular cell written as a full cut cell. |
| [in] | a_copy | The graph copied onto the geometry's grids, with one ghost cell; the boxes set whole need not have taken it. |
| [in] | a_everyBox | The graph copied onto every box of the geometry's grids, with one ghost cell. Read only under PolyhedralGeometryShop.test_copy, for the boxes set whole. |
| [in] | a_coarsenedGraph | coarsenLevel's graph for the level above, or null on the finest level. |
| [in] | a_coarsenedData | coarsenLevel's moments for the level above, or null on the finest level. |
| [in] | a_grids | The geometry's grids. |
| [in] | a_domains | Their domains. |
| [in] | a_level | Level to build. |
|
staticprotected |
One cell's surface, read off node values, edge crossings and face decisions that are already known.
A face's decision is taken from the cell itself where it holds a surface, else from the cell across the face, else from the bilinear saddle of the face's corners.
| [out] | a_surface | The surface. |
| [in] | a_nodes | Node values. |
| [in] | a_crossings | Edge crossings, addressed as defineIntercepts addresses them. |
| [in] | a_fluidJoined | Face decisions per cell. |
| [in] | a_cell | The cell. |
| void PolyhedralGeometryShop::buildGraphs | ( | ) |
Build the graph of every tiled level: the cut cells, their surfaces, and what every face opens onto.
One PolyhedralEBGraph per level from the geometry's start level up, over that level's cut tiles, each defined from this phase's implicit function with one ghost cell and then linked to the level above it so that the coarse side of every level boundary knows which of its cells and faces the finer level describes. The levels below the start level carry no graph. Collective. Requires setGrids.
| void PolyhedralGeometryShop::buildMoments | ( | ) |
Compute the index-space data on the geometry's own grids, from the graph and nothing else.
One LevelData<EBGraph> and one LevelData<EBData> per level, over every box the geometry built on it, as EBISLevel keeps them: the graph with one ghost cell, the moments with none. As in ScanShop, the boxes holding the phase's cut cells and the regular or covered ones are distributed over the ranks separately, a box at a time. The graph is copied onto the grids first, so that every box holds what it needs. Finest level first: a level's own cells take what the graph says – regular, covered, or the moments of the stitched body – and its cells the next finer level covers are coarsened from that level by Chombo's coarsening (coarsenLevel), then joined to the level's own (assembleLevel). The graph holds the links between levels that assembleLevel describes. Under PolyhedralGeometryShop.test_copy every coarsened cell is checked against the sums over its children. Collective. Requires buildGraphs.
| long long PolyhedralGeometryShop::checkCopyPlan | ( | const std::vector< DisjointBoxLayout > & | a_grids, |
| const std::vector< ProblemDomain > & | a_domains, | ||
| const int | a_ghost ) const |
Plan a copy onto a destination hierarchy from both sides, send every rank the headers planSends gives it, and require them to hold exactly the cells planReceives expects, per destination box and source box, none twice. Collective.
| [in] | a_grids | Destination layout of every level, coarsest first. |
| [in] | a_domains | Domain of every destination level. |
| [in] | a_ghost | Ghost width every destination box is filled to. |
|
static |
Coarsen a set of cells: every coarse cell holding any of them.
Coarsens the set's boxes one by one and takes their union, which costs a box at a time rather than a cell at a time.
| [in,out] | a_cells | The cells, coarsened in place. |
| [in] | a_ratio | Coarsening ratio. |
| void PolyhedralGeometryShop::coarsenLevel | ( | LevelData< EBGraph > & | a_coarGraph, |
| LevelData< EBData > & | a_coarData, | ||
| long long & | a_numInexact, | ||
| const std::vector< DisjointBoxLayout > & | a_grids, | ||
| const std::vector< ProblemDomain > & | a_domains, | ||
| const int | a_fineLevel ) const |
Coarsen a level of the index space onto its coarsened layout.
Reads the finished fine level only. The children of a coarse cell are all inside the fine boxes, which are blocked by two. Each coarse cell's VoFs are the pieces its children's VoFs fall into when joined through the fine faces between sibling cells, numbered by coarsePieces, and each lists those fine VoFs as its links to the finer level and carries the sums of their volumes and first moments, and its boundary centroid weighted by their boundary areas. A coarse face is split by the VoF across that its fine faces lead into: a piece of the coarse cell across when that cell is coarsened too, the one VoF of a cell the level owns, or the domain boundary; its aperture is the scaled sum of those fine apertures, and its centroid their aperture-weighted mean. Every sum runs in an order fixed by the fine level, so every box writes a coarse face with the same bits. Coarse nodes are written for the valid cells only. Under PolyhedralGeometryShop.test_copy every coarse cell's volume, first moment and apertures are compared with the sums over its children, and a cell differing by more than round-off is counted.
| [out] | a_coarGraph | Coarsened graph, defined here over the coarsened fine layout. |
| [out] | a_coarData | Coarsened moments, defined here over the coarsened fine layout. |
| [out] | a_numInexact | Incremented for every coarse cell that is not the sum of its children. |
| [in] | a_grids | The geometry's grids. |
| [in] | a_domains | Their domains. |
| [in] | a_fineLevel | Level to coarsen, already built. |
|
protected |
Interface triangles of one level, or segments in two dimensions, from this rank's share of its irregular boxes, three reals per vertex.
Cells the next finer level carries are skipped. A cut cell with such a cell across one of its faces has that face restricted to the finer cells' chords (restrictFace) and its interface rebuilt (closeInterface). A coarse edge that carries no crossing while both finer edges under it do is a multi-valued coarse cell in disguise and stops the run, as does a body that will not close.
| [out] | a_facets | Element coordinates, appended to. |
| [in] | a_level | Level to collect from. |
|
staticprotected |
Copy a finer level's cells onto a coarser level's layout refined, with a ring around every box.
The cell states, a mask of the cells that hold a surface, the sets of those cells and their surfaces – everything a cell of the finer level is rebuilt from, apart from faces it restricts to a level above it. Cells the finer level does not hold read s_absent. Collective.
| [out] | a_states | Cell states. |
| [out] | a_mask | One where a cell holds a surface. |
| [out] | a_sets | The cells that hold a surface, per box. |
| [out] | a_surfaces | Their surfaces. |
| [in] | a_fine | The finer level. |
| [in] | a_grids | The coarser level's layout. |
| [in] | a_ring | Width of the ring around every box, in cells of the coarser level. |
| void PolyhedralGeometryShop::copyGraphs | ( | AMRPolyhedralEBGraph & | a_dest, |
| const std::vector< DisjointBoxLayout > & | a_grids, | ||
| const std::vector< ProblemDomain > & | a_domains, | ||
| const int | a_ghost, | ||
| const std::vector< std::vector< char > > & | a_taking ) const |
Copy the graphs onto a destination hierarchy.
Plans the copy and sends the pieces in two passes, each destination box keeping exactly the pieces it receives. The first carries every cell's state and the surface of every cell that holds one, its role included; the second carries the face overrides of every cell whose surface is overridden, which the receiver knows from the first. Nothing on either side evaluates the implicit function. A piece that arrives unplanned, a cell whose role is invalid, and an overridden cell without overrides all stop the run. Collective.
| [out] | a_dest | The graph on the destination hierarchy. |
| [in] | a_grids | Destination layout of every level, coarsest first. |
| [in] | a_domains | Domain of every destination level. |
| [in] | a_ghost | Ghost width every destination box is filled to. |
| [in] | a_taking | Per destination level, whether each box of its layout, in the order of its box array, takes the copy; a box that does not receives nothing. A level left empty has every box take it. |
| void PolyhedralGeometryShop::countTileCutCells | ( | ) |
Count the cut cells of every tile on every level, for extensionLoads.
Each rank counts the cells with a surface in its own graph boxes, and the counts are summed over the ranks. Run by buildMoments under PolyhedralGeometryShop.extension_cut_cell_loads. Collective. Requires buildGraphs.
|
staticprotected |
Build the body of a cut cell of a stitched graph from its stored surface and face overrides.
Defines the body from the surface, replaces every restricted face with its stored polygons, closes the interface over them, and closes every closed face, in the order they were recorded – which rebuilds the body stitchBody made, bit for bit, from the cell's own data alone.
| [out] | a_body | The body. |
| [in] | a_surfaces | Surfaces of the cell's box, from the graph. |
| [in] | a_overrides | Face overrides of the cell's box, from the graph. |
| [in] | a_cell | The cell. |
|
protected |
Stitch a cut cell's body with its children reconstructed from the implicit function.
The reference the stitched graph is checked against under sanity_check: the same stitching as the stored faces were made with, from children built at the finer spacing from the function rather than from the finer level's stored surfaces. Nothing else calls the function to build a body.
| [out] | a_body | The body. |
| [in] | a_surface | The cell's surface as the graph first built it. |
| [in] | a_graph | Graph of the cell's level. |
| [in] | a_filled | One where a cell around the cell was filled, from isFilled. |
| [in] | a_refined | Refined mask around the cell. |
| [in] | a_cell | The cell. |
|
static |
The bodies a cell of a destination level is made of, from the geometry levels that own it.
A cell owned at its own resolution is its own body. One owned by a finer level is the bodies of every cut cell under it, each in its own frame and none merged, so the surface they bound is the finer level's exactly. One owned by a coarser level is the cut ancestor subdivided down to the destination level, and the child that is this cell, in this cell's frame; a child whose fluid falls into more than one piece is kept, and counted. A cell no level owns, or owned by a level that holds no cut cell there, has no body.
| [out] | a_bodies | The bodies. |
| [in,out] | a_numSplit | Incremented for every subdivision on the way down that left a child whose fluid is in more than one piece, or whose children did not partition their parent. |
| [in] | a_graph | The graph on the destination hierarchy. |
| [in] | a_level | Destination level. |
| [in] | a_dit | Destination box. |
| [in] | a_cell | The cell, on the destination level. |
| int PolyhedralGeometryShop::destinationLevel | ( | const ProblemDomain & | a_domain | ) | const |
The geometry level a destination domain lives on.
A stored domain's own level; a domain finer than every stored one is a refinement by two per level of the finest stored domain, and lives that many levels past it. Any other domain stops the run.
| [in] | a_domain | The domain. |
| void PolyhedralGeometryShop::destinationPieces | ( | std::vector< std::vector< std::pair< int, Box > > > & | a_pieces, |
| const IntVectSet & | a_valid, | ||
| const int | a_level ) const |
The pieces of the graph a destination region needs: what each tiled level owns of it, tile by tile, down to the cells whose footprint on the destination level lies in the region.
A cell of a level at or finer than the destination's is kept if the destination cell it lies in is in the region; a cell of a coarser level if any destination cell it holds is.
| [out] | a_pieces | One list per geometry level of (index into the level's cut tiles, box on that level) pairs. |
| [in] | a_valid | The region, on the destination level, from validRegion. |
| [in] | a_level | Geometry level of the destination, from destinationLevel. |
|
staticprotected |
Which of a cell's edges the finer level describes.
An edge is shared by the cells that meet along it, and the crossing on it has to be one point for all of them, so the question is asked of the edge: it is refined if any cell meeting it is.
| [out] | a_edgeRefined | One flag per edge of the cell. |
| [in] | a_refined | Refined mask around the cell. |
| [in] | a_domain | Domain box of the cell's level. |
| [in] | a_cell | The cell. |
|
staticprotected |
Trade byte buffers among all ranks: counts first, then the payloads, into one flat buffer.
What this rank sends itself is copied rather than sent. Byte totals that do not fit in an int, which is what MPI counts are, stop the run in every build. Collective.
| [in] | a_send | Per destination rank, the bytes this rank sends there. |
| [out] | a_recv | Everything this rank received, source rank after source rank. |
| [out] | a_offset | Per source rank, where its bytes begin in a_recv. |
| [out] | a_count | Per source rank, how many bytes it sent. |
| void PolyhedralGeometryShop::extendLevel | ( | LevelData< EBGraph > & | a_graph, |
| LevelData< EBData > & | a_data, | ||
| const DisjointBoxLayout & | a_tiles, | ||
| const ProblemDomain & | a_domain ) const |
Cut the extension tiles from their ancestors, on a layout balanced for it.
The polyhedral graph is copied onto the tiles with a ring of s_cutRing cells, so that every face of a tile and of its one ghost cell has the cell across it in hand. A tile the geometry calls regular or covered with its ghost cell is set whole. Every other tile is cut from its ancestors (AMRPolyhedralEBGraph::fillNodes) and a regular cell beside a multi-valued one is written as a full cut cell. Each VoF is linked to the only VoF of its coarser cell when the domain coarsens by two, and to no finer cell. A cut cell a finer level owns stops the run. Collective.
| [out] | a_graph | The graph, defined here over the tiles with one ghost cell. |
| [out] | a_data | The moments, defined here over the tiles. |
| [in] | a_tiles | The tiles, balanced over the ranks. |
| [in] | a_domain | Their domain. |
| void PolyhedralGeometryShop::extensionLoads | ( | Vector< long > & | a_loads, |
| const Vector< Box > & | a_tiles, | ||
| const int | a_level ) const |
The work of cutting each extension tile from its ancestors.
A tile is cut from the tiles of the coarser levels that own its cells (ComputationalGeometry::ownedPieces). Each owning piece contributes its share of its tile's cut cells, multiplied by the 2^(SpaceDim - 1) cut children a cut cell has per level of subdivision, and every tile carries one unit besides. Each rank works out a share of the tiles and the loads are summed over the ranks. Collective.
| [out] | a_loads | The load of each tile. |
| [in] | a_tiles | The extension tiles, on the destination level, the same on every rank. |
| [in] | a_level | The geometry level of the destination level. |
| void PolyhedralGeometryShop::extensionTiles | ( | Vector< Box > & | a_tiles, |
| const DisjointBoxLayout & | a_grids, | ||
| const ProblemDomain & | a_domain, | ||
| const int | a_graphGhost ) const |
The tiles of a destination level that the stored level does not hold.
A destination box needs every cell out to its graph's ghost width. Those the geometry's boxes on the matching level do not hold are covered by a leaf of a coarser level, or finer than the finest stored level, and are cut from their coarser ancestors. They are gathered from every rank as whole tiles of the geometry, so that the list is the same everywhere and holds each tile once. A tile is held whole or not at all, since a leaf refines to whole tiles; one held in part stops the run. Collective.
| [out] | a_tiles | The tiles, on the destination level, clipped to its domain. |
| [in] | a_grids | The destination layout. |
| [in] | a_domain | Its domain. |
| [in] | a_graphGhost | Ghost width of the destination graph. |
|
override |
Fill the graph and the nodes for one box.
Classifies the cells, reuses GeometryShop's fix-up for the regular cells bordering a covered one, and then builds each remaining irregular cell's node from the polyhedron rather than from a quadrature of the implicit function.
| [in,out] | a_regIrregCovered | Regular/Covered/Irregular cells |
| [in,out] | a_nodes | Nodes |
| [in] | a_validRegion | Grid region |
| [in] | a_ghostRegion | Grid region, including ghost cells |
| [in] | a_domain | Domain |
| [in] | a_probLo | Lower-left corner of computational domain |
| [in] | a_dx | Grid resolution |
| [in] | a_di | Grid index |
| void PolyhedralGeometryShop::fillLayout | ( | LevelData< EBGraph > & | a_graph, |
| LevelData< EBData > & | a_data, | ||
| const DisjointBoxLayout & | a_grids, | ||
| const ProblemDomain & | a_domain, | ||
| const int | a_graphGhost, | ||
| const int | a_dataGhost ) const |
Fill any layout on any level with its index space: graph and first moments, ghost cells included.
A cell in the geometry's boxes on the level takes what buildMoments made there. The cells outside them, which a leaf of a coarser level covers or which are finer than the finest stored level, are cut from their ancestors on tiles of their own (extensionTiles), balanced over the ranks with one unit of load per tile, or by the work of cutting them (extensionLoads) under PolyhedralGeometryShop.extension_cut_cell_loads, and computed there (extendLevel). The stored level and the tiles hold disjoint cells, and both are copied onto the layout. A stored cell carries the links to the coarser and finer levels buildMoments gave it; a cell cut from an ancestor is linked to the ancestor's only VoF and to no finer cell. Nothing evaluates the implicit function. This is the shape of EBISLayout::Filler. Collective: every rank calls it for the same layouts in the same order, since the tiles are gathered and balanced over all ranks. Requires buildMoments.
| [out] | a_graph | The graph, defined here over the layout with a_graphGhost ghost cells. |
| [out] | a_data | The moments, defined here over the layout with a_dataGhost ghost cells. |
| [in] | a_grids | The layout. |
| [in] | a_domain | Its domain: one of the geometry's, or one refined from the finest by two per level. |
| [in] | a_graphGhost | Ghost width of the graph, above a_dataGhost. |
| [in] | a_dataGhost | Ghost width of the moments. |
| const LevelData< EBData > & PolyhedralGeometryShop::getEBData | ( | const int | a_level | ) | const |
The index-space moments buildMoments made for a level.
| [in] | a_level | Level, 0 being the coarsest of the geometry's levels. |
| const LevelData< EBGraph > & PolyhedralGeometryShop::getEBGraph | ( | const int | a_level | ) | const |
The index-space graph buildMoments made for a level.
| [in] | a_level | Level, 0 being the coarsest of the geometry's levels. |
|
noexcept |
The graph of a level, undefined below the start level. Stops the run before buildGraphs.
| [in] | a_level | Level, 0 being the coarsest of the geometry's levels. |
|
staticprotected |
Identify the vertices of a triangle soup, giving each one once and each triangle three indices.
Two positions closer than the tolerance are one vertex. Candidates are taken from the lattice cell of the tolerance a position falls in and the twenty-six around it, which is what keeps this out of the quadratic scan a surface meeting the mesh squarely would otherwise provoke, with every candidate still measured against so that two positions either side of a lattice wall are not told apart.
| [out] | a_vertices | The vertices, three reals each. |
| [out] | a_connectivity | Three vertex indices per triangle. |
| [in] | a_facets | Triangles, nine reals each. |
| [in] | a_tolerance | Distance within which two positions are the same vertex. |
|
override |
Whether a box is all regular, all covered or holds the surface, as EBISLevel asks it of a region.
Answered from the boxes the geometry's grids classify (ComputationalGeometry::classify), which the graph's cut tiles come from, so the index space treats as uniform exactly what the graph does. The scan ScanShop answers from samples the implicit function at each level's own spacing and reads it as a distance, so it can call a coarse box covered while the coarsened finer cells hold fluid. EBISLevel fills a ghost graph from that answer before it copies the coarsened graph over it, and then reads a regular cell beside a cell with no face toward it. EBISLevel also passes a region of the level above or below on a domain, so the region is classified as lying on the domain, one level finer and one level coarser, and is uniform only if all three agree. A domain coarser than every level the grids describe is answered as irregular, which is always safe. Before setGrids, ScanShop answers.
| [in] | a_region | Region to classify. |
| [in] | a_domain | Domain of the region. |
| [in] | a_probLo | Lower-left corner of the domain. |
| [in] | a_dx | Grid spacing. |
| [in] | a_dit | Grid index. |
| void PolyhedralGeometryShop::planReceives | ( | std::vector< std::vector< PolyhedralEB::GraphCopyHeader > > & | a_receives, |
| const std::vector< DisjointBoxLayout > & | a_grids, | ||
| const std::vector< ProblemDomain > & | a_domains, | ||
| const int | a_ghost ) const |
The pieces of a copy of the graph that this rank's destination boxes need, worked out from the destination side: the reference checkCopyPlan holds planSends to.
Each of this rank's destination boxes takes the cells validRegion gives it, and asks destinationPieces which levels own them. Every header's counts are left at zero.
| [out] | a_receives | Per source rank, the pieces this rank's destination boxes need from there. |
| [in] | a_grids | Destination layout of every level, coarsest first. |
| [in] | a_domains | Domain of every destination level. |
| [in] | a_ghost | Ghost width every destination box is filled to. |
| void PolyhedralGeometryShop::planSends | ( | std::vector< std::vector< PolyhedralEB::GraphCopyHeader > > & | a_sends, |
| const std::vector< DisjointBoxLayout > & | a_grids, | ||
| const std::vector< ProblemDomain > & | a_domains, | ||
| const int | a_ghost, | ||
| const std::vector< std::vector< char > > & | a_taking ) const |
Plan the pieces of a copy of the graph onto a destination hierarchy that this rank sends.
Only the sender plans: every piece travels with its header, so a receiver places what arrives with no plan of its own. For each of this rank's graph boxes, which are its level's cut tiles, the cells its level owns of it are taken from ComputationalGeometry::ownedPart, and the destination boxes the tile reaches, grown by the ghost width, are found through the destination layouts' spatial index. The cells each of those destination boxes takes come from validRegion, once per destination box on this rank. A piece is the owned cells a destination box takes: a cell at or finer than the destination's level if the destination cell it lies in is taken, a cell of a coarser level if any destination cell it holds is. A destination box that does not take the copy is sent nothing. Every header's counts are left at zero.
| [out] | a_sends | Per destination rank, the pieces this rank sends there. |
| [in] | a_grids | Destination layout of every level, coarsest first. |
| [in] | a_domains | Domain of every destination level. |
| [in] | a_ghost | Ghost width every destination box is filled to. |
| [in] | a_taking | Per destination level, whether each box of its layout, in the order of its box array, takes the copy. A level left empty has every box take it. |
|
staticprotected |
Read the nodes and edges of a region of the finer level off its stored cells.
A node or edge belongs to every cell around it, so it is written from each cell of the region that holds a surface, and two cells that disagree about one stop the run. A node that no such cell touches lies among cells whose corners agree, and takes their sign: minus one where they are regular, one where they are covered. An edge that no such cell touches carries no crossing. Cells the finer level does not hold write nothing.
| [out] | a_nodes | Node values over the nodes of a_region. |
| [out] | a_crossings | Crossings over the edges of a_region, addressed as defineIntercepts addresses them. |
| [out] | a_fluidJoined | Face decisions of each cell of a_region that holds a surface, minus one elsewhere. |
| [in] | a_region | Cells of the finer level. |
| [in] | a_states | Cell states of the finer level over the region, s_absent where it holds none. |
| [in] | a_mask | One where a cell holds a surface. |
| [in] | a_surfaces | The surfaces. |
| void PolyhedralGeometryShop::reportUnresolvedRefinement | ( | ) | const |
Report the cells that cannot be cut for a refinement without falling into more than one piece.
Asked of every cut cell the level itself describes, at the ratio m_maxRefinement names, and of the body the consumers build – which on a refinement boundary is the one whose faces were taken from the finer level, since stitching lengthens the interface loop and it is that loop the question is about. A cell whose interface is planar is exempt without being cut, because its fluid is then convex and convexity survives every ratio.
What happens to a failing cell is m_unresolvedAction's to decide. Only Warn is wired: the cells are named and the run continues, leaving it to whoever set it up to raise the geometric resolution. Runs regardless of m_sanityCheck, since it reports on the geometry the run will actually use rather than on this generator's own consistency. Requires buildGraphs.
| void PolyhedralGeometryShop::sanityCheck | ( | ) | const |
Check that the interface triangles form a surface that is closed except on the domain boundary.
A triangle edge can be shared only by cells that touch, so every edge of a cell's interface must be used exactly twice among the interface triangles of the cell and of its 3^D neighbourhood: on the cell's own level through the ghost surfaces the graph holds, and across a level boundary through the finer cells behind a face the finer level describes, reconstructed for the purpose. An edge in the domain boundary is used once, an edge in a face the coarser level describes is checked from that side, and an edge in a face onto a cell the graph filled has no partner to meet, since that face is closed. Every rank checks its own cells, vertices are welded at s_weldSpacing times the level's spacing, the counts are summed, and a violation stops the run. A regular cell sharing a face with a covered one stops the run as well: the four nodes of that face belong to both cells and cannot be fluid for one and solid for the other, so the pair can only come from a classification that disagrees with itself, and there would be no cut cell to carry the interface between them. A filled cell is covered whatever its nodes read, which is why the graph keeps a neighbour of one as a cut cell holding the whole of itself rather than a regular one; the test is what says it did. That test is dimension-independent and runs on every graph, including the cells beyond the tiles, which is where the edge of the tiled region meets what no tile carries. Switched by PolyhedralGeometryShop.sanity_check, on by default in a build that keeps its assertions. Requires buildGraphs.
|
protected |
The closure check over a given set of graphs, one per level as m_graphs holds them.
| [in] | a_graphs | Graphs, undefined entries skipped. |
|
noexcept |
Say which grids the polyhedra are built over, and which phase this generator serves on them.
| [in] | a_compGeom | Builder holding the boxes and their classifications per level. |
| [in] | a_phase | Phase whose classifications and implicit function this generator uses. |
|
static |
A layout over given boxes with the ranks shuffled: they walk the rank list with a stride coprime to its length, so that no rank holds what a load balance would have given it. For the copy tests.
| [in] | a_boxes | The boxes. |
| [in] | a_domain | Their domain. |
|
static |
Build the body of one cut cell of a geometry level, from what a destination box holds of that level.
| [out] | a_body | The body. |
| [in] | a_graph | The graph on the destination hierarchy. |
| [in] | a_level | Destination level. |
| [in] | a_dit | Destination box. |
| [in] | a_sourceLevel | Geometry level of the cell. |
| [in] | a_cell | The cell, on that level. |
|
staticprotected |
Stitch a cut cell's body to the finer level and to the covered cells around it.
Every refined edge takes its crossing from the half the finer level put it in, which rewrites a_surface. The body is then defined from it – as the whole cell where every corner is fluid – every face onto a refined neighbour is replaced by the chords of the children on that face, after the check that no coarse edge on it is crossed twice at the finer spacing, and the interface is closed again, which also recomputes the moments. A face onto a filled cell (a_filled) is closed instead, through CutCellBody::snapFace, and the footprint it gives up becomes interface lying in the plane of that face. Every face so changed is recorded, in the order it was changed, when overrides are given. A body that will not close, a face that cannot be restricted or closed, or a doubly crossed edge stops the run.
| [out] | a_body | The body. |
| [in,out] | a_surface | The cell's surface; its refined edges' crossings are rewritten. |
| [in,out] | a_overrides | Overrides to record the changed faces in, with the cell begun; null records nothing. |
| [in] | a_children | The cell's eight children in corner order, which must be given when any edge is refined and describe at least the cell's refined faces and edges; null otherwise. |
| [in] | a_edgeRefined | Which edges are refined, from edgesRefined. |
| [in] | a_filled | One where a cell around the cell was filled, from isFilled. |
| [in] | a_refined | Refined mask around the cell. |
| [in] | a_fineFilled | One where a cell of the finer level was filled, over the finer cells across the cell's faces; a quadrant of a restricted face whose finer cell was filled is closed. Null where nothing is known of the finer level's fills. |
| [in] | a_domain | Domain box of the cell's level. |
| [in] | a_cell | The cell. |
|
protected |
Stitch every level of a set of graphs to the level above it, from the graphs alone.
In two dimensions no face is stitched and every level's overrides stay empty. Collective.
| [in] | a_graphs | Graphs, one per level, linked to one another; undefined entries are skipped. |
|
protected |
Stitch one level: take its refined edges' crossings and its seam faces from the finer level's stored cells, close its faces onto filled cells, write the crossings into its surfaces and the faces into its overrides.
The finer level's cell states and surfaces over the refined coarse boxes and a ring around them are copied onto this level's layout refined, and every cut cell of every box and its ghost ring is stitched from them. A quadrant of a seam face across which the finer level filled a cell is closed. A regular or covered cell beside the finer level is made cut where the finer level describes the face between them otherwise than the cell's corners do – the node at the middle of the face on the other side, or a filled cell across a quadrant of a regular one – and stitched like any other. A cell pierced at the middle of such a face should have been refined by ComputationalGeometry, so each one is listed in pout and warned about. A node at the middle of such a face's edge that disagrees with the edge's ends is an edge the finer level crosses twice, which is counted and reported rather than acted on. Every stitched surface carries its role. Under sanity_check each body is also built from the stored data, and from the implicit function where its children can say the same, and they must agree bit for bit. Collective. A face onto a cell the coarser level filled is closed like a face onto a cell this level filled.
| [in,out] | a_coarse | The level. |
| [in] | a_fine | The finer level, or null where there is none. |
| [in] | a_coarser | The coarser level, or null where there is none. |
| void PolyhedralGeometryShop::testCopyBodies | ( | ) | const |
Require every cut cell's body to survive a copy bit for bit.
Every cut cell every geometry level owns is built from the graph as it stands and hashed, bit for bit, and the hashes are summed over all ranks. Then the graphs are copied onto the geometry's own box hierarchy with the ranks shuffled, onto every level of it alone, and onto a level past the finest, and every valid cell of every destination – ghost cells left out – rebuilds the source bodies it stands for from what it received: its own, those of the finer cells under it, and, from the one destination cell at its low corner, a coarser ancestor's. Each owned cell is then counted exactly once, and the sums and counts must be the source's. Every coarser cut cell is also subdivided down to the destination level, and the child destinationBodies gives the destination cell at its low corner must be the one found there. The hierarchy is also copied with every box split into octants, which must change nothing.
On every face between two valid cells owned by different levels, the two sides must read the same aperture to 1e-10: the claim that a subdivided stitched ancestor meets the finer cells beside it.
All of it – the copies and every body rebuilt from them – runs with the shop's implicit function replaced by one that stops the run if it is evaluated. Collective. Switched by PolyhedralGeometryShop.test_copy.
| void PolyhedralGeometryShop::testFill | ( | ) | const |
Check fillLayout on every level of the geometry and one past the finest, onto the level's boxes in octants and onto the boxes of the next coarser level refined.
The cells the geometry's level holds must arrive bit for bit, every ghost cell must equal the cell its own box holds to round-off, every face must read the same aperture from its two sides, and every cell of the next coarser level must be the sum of the cells it holds, to round-off. Then an EBIndexSpace is defined over the geometry's domains with fillLayout as its filler, and on every level the EBISLayout it fills onto the level's boxes in octants, twice so that the second comes from its cache, must hold the graph, the moments and the links fillLayout gives, bit for bit. Collective. Switched by PolyhedralGeometryShop.test_copy.
| void PolyhedralGeometryShop::testGraphCopy | ( | ) | const |
Copy every graph onto a layout that splits each of its tiles into octants with the ranks shuffled, and then onto the tiles themselves with the ranks shuffled; run sanityCheck over the copies each time, copy them back onto the original layouts and require equality bit for bit.
A stand-in, until the index space is generated over the graphs, for what a consumer on another layout does: take the graph's data through a Copier and read it there. Switched by PolyhedralGeometryShop.test_copy. Collective. Requires buildGraphs.
| void PolyhedralGeometryShop::testLinks | ( | ) | const |
Check the links between every two neighbouring levels of the geometry, filled onto the coarser level's boxes in octants with the ranks shuffled and onto the same boxes refined.
For every coarse cell the finer level's boxes lie over, the pieces coarsePieces finds among its children in the finer layout must be its VoFs' links to the finer level, in number and in order. A coarse cut cell outside them is a leaf: it must be one VoF, it has no links to the finer level, and the VoFs of its children stand in for them on the finer level. Every fine VoF's link to the coarser level must name a VoF of the coarse cell whose links list it, and every VoF a coarse VoF lists must link back to it; and each coarse cut VoF's volume fraction and apertures must be the scaled sums over the fine VoFs it lists, to round-off. Collective. Switched by PolyhedralGeometryShop.test_copy.
| void PolyhedralGeometryShop::testMoments | ( | ) | const |
Check the index-space data buildMoments made against the graph it came from.
On every level built, each cell is what the graph says it is, and each VoF of a cut cell carries the moments of the cell's stitched body exactly: volume fraction and centroid, boundary centroid, and per face the aperture and centroid. Collective. Switched by PolyhedralGeometryShop.test_copy.
|
static |
The cells of a destination box a copy of the graph fills: the box grown by a ghost width, inside the domain, less what the next finer destination level covers.
| [out] | a_valid | The cells. |
| [in] | a_box | The destination box. |
| [in] | a_domain | Domain of the box's level. |
| [in] | a_finer | Layout of the next finer destination level, or null where there is none. |
| [in] | a_finerBoxes | Its boxes, as boxArray gives them, or null where there is no finer level. |
| [in] | a_ratio | Refinement ratio to that level. |
| [in] | a_ghost | Ghost width the box is grown by. |
| void PolyhedralGeometryShop::verifySurface | ( | ) | const |
Build the polyhedra over the grids, check that they form a surface, and write it if asked.
Every cut cell of every irregular box is reconstructed at its own level, cells the next finer level carries are skipped, and a face shared with such a cell is restricted to the finer chords and the interface closed. The interface triangles of every level are then checked by sanityCheck when PolyhedralGeometryShop.sanity_check is set, and written to the geometry directory as an indexed surface mesh when PolyhedralGeometryShop.write_surface is set. Under PolyhedralGeometryShop.test_copy the copy, moment, fill and link tests run. Collective; every rank reconstructs its share of the boxes and writes its own share of the mesh. Requires setGrids, and buildMoments under PolyhedralGeometryShop.test_copy.
|
protected |
Write the cut cells' connectivity as a skeleton a viewer can draw: a point per cut cell and per open face of one, and a line from each cut cell to each of its open faces.
One group per level. A cell node is written for every cut cell of the level's tiles, at its fluid's centroid, with its volume fraction, the role of its surface, its number of sheets and its rank. A face node is written for every open face of one, at the centroid of the face's open part, with its aperture, its face state and whether the stitch rewrote it; a face two cut cells of the level share is written once, by the cell on its low side, on whichever rank holds it. The two kinds share one point mesh, told apart by a field holding s_cellNode or s_faceNode, and a field reads s_noValue on the kind it does not belong to. An edge is written from a cell node to the centroid of each of its open faces, so that the edges of two neighbouring cut cells meet in the face between them, and a face onto a regular cell, another level or the domain boundary ends in a half; it carries the face's fields too. Two XDMF descriptions are written next to the file, a_fileName followed by _nodes.xmf with the nodes as points and a_fileName followed by _edges.xmf with the edges as segments, since a reader may take only the first grid of a file.
| [in] | a_fileName | File to write, without a suffix. |
|
protected |
Write the surface, the boxes it was built over and the boxes that split, as one HDF5 file per phase.
One group per level, holding the level's triangles, or segments in two dimensions, as an indexed mesh – the vertices once each and s_elementVertices indices per element – rather than as a soup of coordinates, which is what a viewer wants and what an XDMF description can point at. The boxes of the level and the boxes that split on it go in the same group, so that the surface can be read against the grids it was built on without a second file. The distance within which two positions are one vertex is written alongside them. An XDMF description of the file is written next to it. Collective: every rank writes its own stretch of every dataset, so a vertex on a boundary between two ranks is written by each, since vertices are identified within a rank and not across them.
| [in] | a_fileName | File to write, without a suffix. |
| [in] | a_facets | This rank's elements of each level, three reals per vertex. |
|
protected |
How far below the geometry's own grids a cell must stay single valued. PolyhedralGeometryShop.max_refinement, one – that is, off – by default.
A power of two. One asks for nothing and skips the check entirely; two asks that the cells one refinement below the geometry grid are each a single piece of fluid, four that the cells two below are, and so on. The property is not inherited – a cell whose children are all single valued can still have a grandchild that is not – so this has to name the ratio the mesh will actually use rather than being derived from one level.
Off by default because the test costs a subdivision of every cut cell whose interface is not planar, which is two to three times what building the geometry costs in the first place, and because nothing downstream reads a subdivided cell yet. It becomes worth its price once it does.
|
protected |
Whether verifySurface runs sanityCheck. PolyhedralGeometryShop.sanity_check.
On by default in a build that keeps its assertions and off in one that does not, since the check tells the generator nothing it uses and only reports. Either default can be overridden from the inputs.
|
staticconstexprprotected |
Width of the ring the graph is copied with for a box whose ghost cells are cut as its own cells are.
A box is built with one ghost cell, and a node's face toward a cut cell across it reads that cell's body, one cell further out (AMRPolyhedralEBGraph::fillNodes with its ring cut). extendLevel and the tests copy with it. Nothing to do with the ghost cells a solver asks of the index space.
|
staticconstexprprotected |
Width of the ring the graph is copied onto the geometry's grids with for buildMoments.
assembleLevel keeps the moments of a box's own cells only, so fillNodes leaves its ghost cells uncut and reads nothing of the copy beyond the first ghost cell. Nothing to do with the ghost cells a solver asks of the index space.
|
staticconstexprprotected |
Fraction of a level's grid spacing within which two vertices are the same vertex, in sanityCheck and in the written surface.
Cells of one level compute a shared vertex from the same nodes and edge and agree bit for bit, and cells rebuilt across a level boundary agree to about 1e-12 of a cell, so the radius sits just above that. A larger one welds the distinct vertices of a feature thinner than it into one, and the check then reports its edges as used more than twice.