chombo-discharge
Loading...
Searching...
No Matches
CD_PolyhedralGeometryShop.H
Go to the documentation of this file.
1/*
2 * SPDX-FileCopyrightText: 2021-2026 SINTEF Energy Research
3 *
4 * SPDX-License-Identifier: GPL-3.0-or-later
5 */
6
12
13#ifndef CD_POLYHEDRALGEOMETRYSHOP_H
14#define CD_POLYHEDRALGEOMETRYSHOP_H
15
16// Std includes
17#include <string>
18#include <utility>
19#include <vector>
20
21// Chombo includes
22#include <BaseFab.H>
23#include <BaseIF.H>
24#include <EBData.H>
25#include <EBGraph.H>
26#include <FArrayBox.H>
27#include <IntVectSet.H>
28#include <IrregNode.H>
29#include <LevelData.H>
30
31#ifdef CH_USE_HDF5
32#include <hdf5.h>
33#endif
34
35// Our includes
37#include <CD_ScanShop.H>
38#include <CD_CutCellBody.H>
39#include <CD_CutCellSurface.H>
40#include <CD_GraphCopyHeader.H>
43#include <CD_NamespaceHeader.H>
44
46
64{
65public:
75 {
80
85
108 };
109
114
127 PolyhedralGeometryShop(const BaseIF& a_localGeom,
128 const int a_verbosity,
129 const Real a_dx,
130 const RealVect& a_probLo,
131 const ProblemDomain& a_finestDomain,
132 const ProblemDomain& a_scanLevel,
133 const int a_ebGhost,
134 const Real a_thrshdVoF,
135 const bool a_strict);
136
140 ~PolyhedralGeometryShop() override;
141
146
151 operator=(const PolyhedralGeometryShop& a_other) = delete;
152
154
173 GeometryService::InOut
174 InsideOutside(const Box& a_region,
175 const ProblemDomain& a_domain,
176 const RealVect& a_probLo,
177 const Real& a_dx,
178 const DataIndex& a_dit) const override;
179
194 void
195 fillGraph(BaseFab<int>& a_regIrregCovered,
196 Vector<IrregNode>& a_nodes,
197 const Box& a_validRegion,
198 const Box& a_ghostRegion,
199 const ProblemDomain& a_domain,
200 const RealVect& a_probLo,
201 const Real& a_dx,
202 const DataIndex& a_di) const override;
203
209 void
210 setGrids(const ComputationalGeometry& a_compGeom, const phase::which_phase a_phase) noexcept;
211
219 void
220 buildGraphs();
221
227 const PolyhedralEBGraph&
228 getGraph(const int a_level) const noexcept;
229
243 void
244 buildMoments();
245
251 const LevelData<EBGraph>&
252 getEBGraph(const int a_level) const;
253
259 const LevelData<EBData>&
260 getEBData(const int a_level) const;
261
280 void
281 fillLayout(LevelData<EBGraph>& a_graph,
282 LevelData<EBData>& a_data,
283 const DisjointBoxLayout& a_grids,
284 const ProblemDomain& a_domain,
285 const int a_graphGhost,
286 const int a_dataGhost) const;
287
298 void
299 verifySurface() const;
300
319 void
320 sanityCheck() const;
321
335 void
337
346 void
347 testGraphCopy() const;
348
356 int
357 destinationLevel(const ProblemDomain& a_domain) const;
358
370 static void
371 validRegion(IntVectSet& a_valid,
372 const Box& a_box,
373 const ProblemDomain& a_domain,
374 const DisjointBoxLayout* a_finer,
375 const Vector<Box>* a_finerBoxes,
376 const int a_ratio,
377 const int a_ghost);
378
388 void
389 destinationPieces(std::vector<std::vector<std::pair<int, Box>>>& a_pieces,
390 const IntVectSet& a_valid,
391 const int a_level) const;
392
410 void
411 planSends(std::vector<std::vector<PolyhedralEB::GraphCopyHeader>>& a_sends,
412 const std::vector<DisjointBoxLayout>& a_grids,
413 const std::vector<ProblemDomain>& a_domains,
414 const int a_ghost,
415 const std::vector<std::vector<char>>& a_taking) const;
416
427 void
428 planReceives(std::vector<std::vector<PolyhedralEB::GraphCopyHeader>>& a_receives,
429 const std::vector<DisjointBoxLayout>& a_grids,
430 const std::vector<ProblemDomain>& a_domains,
431 const int a_ghost) const;
432
440 static void
441 coarsenBoxwise(IntVectSet& a_cells, const int a_ratio);
442
452 long long
453 checkCopyPlan(const std::vector<DisjointBoxLayout>& a_grids,
454 const std::vector<ProblemDomain>& a_domains,
455 const int a_ghost) const;
456
461 void
462 testCopyPlan() const;
463
478 void
480 const std::vector<DisjointBoxLayout>& a_grids,
481 const std::vector<ProblemDomain>& a_domains,
482 const int a_ghost,
483 const std::vector<std::vector<char>>& a_taking) const;
484
490 void
491 testCopyRoundTrip() const;
492
503 static bool
505 const AMRPolyhedralEBGraph& a_graph,
506 const int a_level,
507 const DataIndex& a_dit,
508 const int a_sourceLevel,
509 const IntVect& a_cell);
510
526 static void
527 destinationBodies(std::vector<PolyhedralEB::CutCellBody>& a_bodies,
528 long long& a_numSplit,
529 const AMRPolyhedralEBGraph& a_graph,
530 const int a_level,
531 const DataIndex& a_dit,
532 const IntVect& a_cell);
533
552 void
553 testCopyBodies() const;
554
561 void
562 testMoments() const;
563
574 void
575 testFill() const;
576
588 void
589 testLinks() const;
590
603 void
604 extensionTiles(Vector<Box>& a_tiles,
605 const DisjointBoxLayout& a_grids,
606 const ProblemDomain& a_domain,
607 const int a_graphGhost) const;
608
619 void
620 extensionLoads(Vector<long>& a_loads, const Vector<Box>& a_tiles, const int a_level) const;
621
635 void
636 extendLevel(LevelData<EBGraph>& a_graph,
637 LevelData<EBData>& a_data,
638 const DisjointBoxLayout& a_tiles,
639 const ProblemDomain& a_domain) const;
640
646 void
648
669 void
670 coarsenLevel(LevelData<EBGraph>& a_coarGraph,
671 LevelData<EBData>& a_coarData,
672 long long& a_numInexact,
673 const std::vector<DisjointBoxLayout>& a_grids,
674 const std::vector<ProblemDomain>& a_domains,
675 const int a_fineLevel) const;
676
703 void
704 assembleLevel(long long& a_numPromoted,
705 const AMRPolyhedralEBGraph& a_copy,
706 const AMRPolyhedralEBGraph& a_everyBox,
707 const LevelData<EBGraph>* a_coarsenedGraph,
708 const LevelData<EBData>* a_coarsenedData,
709 const std::vector<DisjointBoxLayout>& a_grids,
710 const std::vector<ProblemDomain>& a_domains,
711 const int a_level);
712
720 static DisjointBoxLayout
721 shuffledLayout(const Vector<Box>& a_boxes, const ProblemDomain& a_domain);
722
723protected:
727 static constexpr int s_elementVertices = SpaceDim;
728
735 static constexpr int s_cutRing = 2;
736
743 static constexpr int s_ownRing = 1;
744
748 static constexpr int s_signatureComps = 2 + 3 * SpaceDim;
749
753 static constexpr int s_cellNode = 0;
754
758 static constexpr int s_faceNode = 1;
759
763 static constexpr int s_noValue = -1;
764
773 static constexpr Real s_weldSpacing = 1.0E-10;
774
779
783 static constexpr int s_absent = 2;
784
794 static void
795 exchangeBytes(const std::vector<std::vector<char>>& a_send,
796 std::vector<char>& a_recv,
797 std::vector<int>& a_offset,
798 std::vector<int>& a_count);
799
803 Vector<RefCountedPtr<PolyhedralEBGraph>> m_graphs;
804
808 Vector<RefCountedPtr<LevelData<EBGraph>>> m_ebGraphs;
809
813 Vector<RefCountedPtr<LevelData<EBData>>> m_ebData;
814
819
824
829
836
841
856
862
868
873
879
884 Vector<Vector<long long>> m_tileCutCells;
885
891
902 void
903 collectFacets(Vector<Real>& a_facets, const int a_level) const;
904
910 void
911 stitchGraphs(const Vector<RefCountedPtr<PolyhedralEBGraph>>& a_graphs) const;
912
917 void
918 sanityCheck(const Vector<RefCountedPtr<PolyhedralEBGraph>>& a_graphs) const;
919
930 static bool
932 const BaseFab<signed char>& a_refined,
933 const Box& a_domain,
934 const IntVect& a_cell);
935
961 static int
965 const PolyhedralEB::CutCellSurface* a_children,
966 const bool* a_edgeRefined,
967 const BaseFab<signed char>& a_filled,
968 const BaseFab<signed char>& a_refined,
969 const BaseFab<signed char>* a_fineFilled,
970 const Box& a_domain,
971 const IntVect& a_cell);
972
985 void
987 const PolyhedralEB::CutCellSurface& a_surface,
988 const PolyhedralEBGraph& a_graph,
989 const BaseFab<signed char>& a_filled,
990 const BaseFab<signed char>& a_refined,
991 const IntVect& a_cell) const;
992
1003 static void
1005 const IVSFAB<PolyhedralEB::CutCellSurface>& a_surfaces,
1006 const PolyhedralEB::CutCellFaceOverrides& a_overrides,
1007 const IntVect& a_cell);
1008
1023 static void
1024 readFineCells(BaseFab<Real>& a_nodes,
1025 BaseFab<Real> a_crossings[SpaceDim],
1026 BaseFab<int>& a_fluidJoined,
1027 const Box& a_region,
1028 const BaseFab<signed char>& a_states,
1029 const BaseFab<signed char>& a_mask,
1030 const IVSFAB<PolyhedralEB::CutCellSurface>& a_surfaces);
1031
1042 static void
1044 const BaseFab<Real>& a_nodes,
1045 const BaseFab<Real> a_crossings[SpaceDim],
1046 const BaseFab<int>& a_fluidJoined,
1047 const IntVect& a_cell);
1048
1062 static void
1063 copyFinerCells(LevelData<BaseFab<signed char>>& a_states,
1064 LevelData<BaseFab<signed char>>& a_mask,
1065 LayoutData<IntVectSet>& a_sets,
1066 LevelData<IVSFAB<PolyhedralEB::CutCellSurface>>& a_surfaces,
1067 const PolyhedralEBGraph& a_fine,
1068 const DisjointBoxLayout& a_grids,
1069 const int a_ring);
1070
1089 void
1090 stitchLevel(PolyhedralEBGraph& a_coarse, const PolyhedralEBGraph* a_fine, const PolyhedralEBGraph* a_coarser) const;
1091
1104 void
1105 writeSurface(const std::string& a_fileName, const Vector<Vector<Real>>& a_facets) const;
1106
1123 void
1124 writeGraph(const std::string& a_fileName) const;
1125
1137 static void
1138 indexFacets(std::vector<Real>& a_vertices,
1139 std::vector<int>& a_connectivity,
1140 const Vector<Real>& a_facets,
1141 const Real a_tolerance);
1142
1146 static constexpr Real s_divergenceTolerance = 1.0E-9;
1147
1152
1157
1158private:
1164 class AbortingIF : public BaseIF
1165 {
1166 public:
1172 Real
1173 value(const RealVect& a_point) const override;
1174
1179 BaseIF*
1180 newImplicitFunction() const override;
1181 };
1182
1183#ifdef CH_USE_HDF5
1192 static void
1193 writeH5Attribute(const hid_t a_where,
1194 const std::string& a_name,
1195 const hid_t a_type,
1196 const hsize_t a_count,
1197 const void* a_data);
1198
1214 static void
1215 writeH5Slab(const hid_t a_where,
1216 const std::string& a_name,
1217 const hid_t a_type,
1218 const hsize_t a_rows,
1219 const hsize_t a_offset,
1220 const hsize_t a_total,
1221 const hsize_t a_columns,
1222 const void* a_data,
1223 const hid_t a_transfer);
1224#endif
1225
1242 static void
1243 appendNodes(Vector<IrregNode>& a_nodes,
1244 const EBGraph& a_graph,
1245 const EBData& a_data,
1246 const IntVect& a_cell,
1247 const bool a_withMoments,
1248 const bool a_withCoarser,
1249 const bool a_withFiner);
1250
1263 static void
1264 coarsePieces(Vector<Vector<VolIndex>>& a_pieces, const EBGraph& a_fineGraph, const IntVect& a_coarseCell);
1265
1277 static void
1278 writeCoarserLinks(Vector<IrregNode>& a_nodes, const EBGraph& a_graph, const Box& a_box);
1279
1293 static void
1294 linkRingFromCoarser(BaseFab<int>& a_flags, Vector<IrregNode>& a_nodes, const Box& a_region, const Box& a_valid);
1295
1312 static long long
1313 cutRegularNextToMultiValued(BaseFab<int>& a_flags,
1314 Vector<IrregNode>& a_nodes,
1315 const Box& a_region,
1316 const Box& a_valid,
1317 const ProblemDomain& a_domain);
1318
1330 static void
1331 cellSignature(FArrayBox& a_signature, const EBGraph& a_graph, const EBData& a_data, const Box& a_region);
1332};
1333
1334#include <CD_NamespaceFooter.H>
1335
1336#endif
Declaration of the polyhedral graph as an AMR hierarchy of any layout holds it.
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 record that opens every piece of a polyhedral graph sent to another layout.
Multi-fluid index space.
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...
The polyhedral graph as an AMR hierarchy of any layout holds it: every cell of every box,...
Definition CD_AMRPolyhedralEBGraph.H:50
Abstract base class for geometries.
Definition CD_ComputationalGeometry.H:51
The cut cells of one level of the polyhedral geometry, and what they connect to.
Definition CD_PolyhedralEBGraph.H:52
The closed polyhedron bounding the fluid in one cut cell, and its moments.
Definition CD_CutCellBody.H:52
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
static constexpr int s_numEdges
Number of cell edges a crossing can sit on.
Definition CD_CutCellSurface.H:46
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.
Definition CD_PolyhedralGeometryShop.cpp:2572
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.
Definition CD_PolyhedralGeometryShop.cpp:2248
static constexpr int s_elementVertices
Vertices of one element of the written surface: a triangle in three dimensions, a segment in two.
Definition CD_PolyhedralGeometryShop.H:727
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:7388
Vector< Vector< long long > > m_tileCutCells
The number of cut cells of every tile, indexed [level][tile] as ComputationalGeometry::getCutTiles li...
Definition CD_PolyhedralGeometryShop.H:884
bool m_extensionLoadByCutCells
Whether the extension tiles are balanced by the cut cells they are cut from (true) or carry one unit ...
Definition CD_PolyhedralGeometryShop.H:878
static constexpr int s_ownRing
Width of the ring the graph is copied onto the geometry's grids with for buildMoments.
Definition CD_PolyhedralGeometryShop.H:743
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.
Definition CD_PolyhedralGeometryShop.cpp:8541
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.
Definition CD_PolyhedralGeometryShop.cpp:3098
void testMoments() const
Check the index-space data buildMoments made against the graph it came from.
Definition CD_PolyhedralGeometryShop.cpp:5873
bool m_testCopy
Whether verifySurface runs testGraphCopy. PolyhedralGeometryShop.test_copy, off by default.
Definition CD_PolyhedralGeometryShop.H:872
void countTileCutCells()
Count the cut cells of every tile on every level, for extensionLoads.
Definition CD_PolyhedralGeometryShop.cpp:1361
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 irregu...
Definition CD_PolyhedralGeometryShop.cpp:2448
bool m_writeGraph
Whether verifySurface writes the graph as a skeleton. PolyhedralGeometryShop.write_graph,...
Definition CD_PolyhedralGeometryShop.H:828
void testCopyRoundTrip() const
Copy every graph onto its own layout as a destination level of its own, and require every cell the le...
Definition CD_PolyhedralGeometryShop.cpp:4920
static constexpr int s_signatureComps
Number of components cellSignature writes: the VoF count, the volume, the first moment and the apertu...
Definition CD_PolyhedralGeometryShop.H:748
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:741
PolyhedralGeometryShop & operator=(const PolyhedralGeometryShop &a_other)=delete
Disallow copy assignment.
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.
Definition CD_PolyhedralGeometryShop.cpp:4456
int m_maxRefinement
How far below the geometry's own grids a cell must stay single valued. PolyhedralGeometryShop....
Definition CD_PolyhedralGeometryShop.H:855
UnresolvedAction
What to do with a cell this generator cannot describe at the refinement the mesh will ask for.
Definition CD_PolyhedralGeometryShop.H:75
@ Collapse
Keep the pieces in one body, taking every moment from their sum and moving only the volume centroid.
Definition CD_PolyhedralGeometryShop.H:107
@ Warn
Report the cells and carry on, leaving it to the user to raise the geometric resolution.
Definition CD_PolyhedralGeometryShop.H:79
@ Cover
Turn the cell solid, so that neither it nor anything cut from it is ever multi valued.
Definition CD_PolyhedralGeometryShop.H:84
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.
Definition CD_PolyhedralGeometryShop.cpp:4547
void testCopyPlan() const
Check the copy plan onto the geometry's own box hierarchy with the ranks shuffled,...
Definition CD_PolyhedralGeometryShop.cpp:4403
bool m_verbose
Whether the member functions that run once per level or per phase announce themselves in pout....
Definition CD_PolyhedralGeometryShop.H:890
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:8390
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...
Definition CD_PolyhedralGeometryShop.cpp:4231
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 destin...
Definition CD_PolyhedralGeometryShop.cpp:3791
static constexpr int s_noValue
What a field of the written graph reads on a node of the kind it does not belong to.
Definition CD_PolyhedralGeometryShop.H:763
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:803
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.
Definition CD_PolyhedralGeometryShop.cpp:1096
void verifySurface() const
Build the polyhedra over the grids, check that they form a surface, and write it if asked.
Definition CD_PolyhedralGeometryShop.cpp:2359
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.
Definition CD_PolyhedralGeometryShop.cpp:3183
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.
Definition CD_PolyhedralGeometryShop.cpp:2957
UnresolvedAction m_unresolvedAction
What becomes of a cell that fails that test. PolyhedralGeometryShop.unresolved_cells,...
Definition CD_PolyhedralGeometryShop.H:861
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.
Definition CD_PolyhedralGeometryShop.cpp:2516
const LevelData< EBData > & getEBData(const int a_level) const
The index-space moments buildMoments made for a level.
Definition CD_PolyhedralGeometryShop.cpp:2238
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.
Definition CD_PolyhedralGeometryShop.cpp:2978
static constexpr int s_absent
State of a cell of the finer level that the finer level does not hold, in a copy of its states.
Definition CD_PolyhedralGeometryShop.H:783
int destinationLevel(const ProblemDomain &a_domain) const
The geometry level a destination domain lives on.
Definition CD_PolyhedralGeometryShop.cpp:3663
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.
Definition CD_PolyhedralGeometryShop.cpp:7303
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.
Definition CD_PolyhedralGeometryShop.cpp:1263
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.
Definition CD_PolyhedralGeometryShop.cpp:5046
void buildMoments()
Compute the index-space data on the geometry's own grids, from the graph and nothing else.
Definition CD_PolyhedralGeometryShop.cpp:876
static constexpr int s_faceNode
Kind of a node of the written graph: an open face of a cut cell, at the centroid of its open part.
Definition CD_PolyhedralGeometryShop.H:758
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,...
Definition CD_PolyhedralGeometryShop.cpp:3723
Vector< RefCountedPtr< LevelData< EBData > > > m_ebData
Index-space moments of every level buildMoments built, over the geometry's boxes; null where it built...
Definition CD_PolyhedralGeometryShop.H:813
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 ...
Definition CD_PolyhedralGeometryShop.cpp:6826
static constexpr Real s_divergenceTolerance
Residual above which the stored moments and the ones PolyGeom recomputes disagree.
Definition CD_PolyhedralGeometryShop.H:1146
PolyhedralGeometryShop(const PolyhedralGeometryShop &a_other)=delete
Disallow copy construction.
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.
Definition CD_PolyhedralGeometryShop.cpp:1209
static void coarsenBoxwise(IntVectSet &a_cells, const int a_ratio)
Coarsen a set of cells: every coarse cell holding any of them.
Definition CD_PolyhedralGeometryShop.cpp:4214
Real m_volumeThreshold
Volume fraction below which a cut cell carries no fluid worth keeping.
Definition CD_PolyhedralGeometryShop.H:1156
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 i...
Definition CD_PolyhedralGeometryShop.cpp:6781
static constexpr int s_cellNode
Kind of a node of the written graph: a cut cell, at its fluid's centroid.
Definition CD_PolyhedralGeometryShop.H:753
Vector< RefCountedPtr< LevelData< EBGraph > > > m_ebGraphs
Index-space graph of every level buildMoments built, over the geometry's boxes; null where it built n...
Definition CD_PolyhedralGeometryShop.H:808
bool m_writeSurface
Whether verifySurface writes the surface. PolyhedralGeometryShop.write_surface, off by default.
Definition CD_PolyhedralGeometryShop.H:823
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.
Definition CD_PolyhedralGeometryShop.cpp:6804
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,...
Definition CD_PolyhedralGeometryShop.cpp:3693
void buildGraphs()
Build the graph of every tiled level: the cut cells, their surfaces, and what every face opens onto.
Definition CD_PolyhedralGeometryShop.cpp:752
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 ...
Definition CD_PolyhedralGeometryShop.cpp:3253
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:8593
const ComputationalGeometry * m_compGeom
The geometry whose grids the polyhedra are built over, or null before setGrids.
Definition CD_PolyhedralGeometryShop.H:778
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.
Definition CD_PolyhedralGeometryShop.cpp:3942
~PolyhedralGeometryShop() override
Destructor.
Definition CD_PolyhedralGeometryShop.cpp:8537
bool m_strict
Whether a declined cell aborts the run rather than falling back.
Definition CD_PolyhedralGeometryShop.H:1151
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.
Definition CD_PolyhedralGeometryShop.cpp:1420
void testCopyBodies() const
Require every cut cell's body to survive a copy bit for bit.
Definition CD_PolyhedralGeometryShop.cpp:5119
bool m_profile
Whether verifySurface reports its timings. PolyhedralGeometryShop.profile, off by default.
Definition CD_PolyhedralGeometryShop.H:840
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:2345
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.
Definition CD_PolyhedralGeometryShop.cpp:2893
void testLinks() const
Check the links between every two neighbouring levels of the geometry, filled onto the coarser level'...
Definition CD_PolyhedralGeometryShop.cpp:6551
static constexpr Real s_weldSpacing
Fraction of a level's grid spacing within which two vertices are the same vertex, in sanityCheck and ...
Definition CD_PolyhedralGeometryShop.H:773
const LevelData< EBGraph > & getEBGraph(const int a_level) const
The index-space graph buildMoments made for a level.
Definition CD_PolyhedralGeometryShop.cpp:2228
bool m_fillSplitFluid
Whether a cell whose fluid falls into more than one piece is always filled (true),...
Definition CD_PolyhedralGeometryShop.H:867
bool m_sanityCheck
Whether verifySurface runs sanityCheck. PolyhedralGeometryShop.sanity_check.
Definition CD_PolyhedralGeometryShop.H:835
void sanityCheck() const
Check that the interface triangles form a surface that is closed except on the domain boundary.
Definition CD_PolyhedralGeometryShop.cpp:7745
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.
Definition CD_PolyhedralGeometryShop.cpp:5067
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:7659
static constexpr int s_cutRing
Width of the ring the graph is copied with for a box whose ghost cells are cut as its own cells are.
Definition CD_PolyhedralGeometryShop.H:735
void testFill() const
Check fillLayout on every level of the geometry and one past the finest, onto the level's boxes in oc...
Definition CD_PolyhedralGeometryShop.cpp:6054
phase::which_phase m_phase
Phase this generator serves on those grids.
Definition CD_PolyhedralGeometryShop.H:818
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...
Definition CD_PolyhedralGeometryShop.cpp:1918
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.
Definition CD_ScanShop.cpp:495
ScanShop()=delete
Disallowed default constructor.
which_phase
Enumeration of supported phases.
Definition CD_MultiFluidIndexSpace.H:38