13#ifndef CD_AMRPOLYHEDRALEBGRAPH_H
14#define CD_AMRPOLYHEDRALEBGRAPH_H
22#include <DisjointBoxLayout.H>
23#include <GeometryService.H>
25#include <LayoutData.H>
26#include <ProblemDomain.H>
27#include <RefCountedPtr.H>
33#include <CD_NamespaceHeader.H>
85 define(const std::vector<DisjointBoxLayout>& a_grids,
86 const std::vector<ProblemDomain>& a_domains,
87 const std::vector<
int>& a_geometryLevels,
88 const
int a_numSourceLevels,
90 const std::function<GeometryService::InOut(const Box&, const ProblemDomain&)>& a_classify);
125 const DisjointBoxLayout&
126 getGrids(const
int a_level) const noexcept;
134 getDomain(const
int a_level) const noexcept;
157 getCutCells(std::vector<PolyhedralEB::CutCellDescription>& a_cells,
159 const DataIndex& a_dit,
160 const IntVect& a_cell) const;
174 getState(const
int a_level, const DataIndex& a_dit, const IntVect& a_cell) const;
185 holds(const
int a_level, const DataIndex& a_dit, const IntVect& a_cell) const;
225 fillNodes(BaseFab<
int>& a_regIrregCovered,
226 Vector<IrregNode>& a_nodes,
227 long long& a_numCollapsed,
228 long long& a_numFiner,
230 const DataIndex& a_dit,
231 const BaseFab<
bool>& a_compute,
232 const
bool a_cutRing) const;
241 const std::vector<Box>&
242 getPieces(const
int a_level, const DataIndex& a_dit, const
int a_sourceLevel) const noexcept;
253 getSourceState(const
int a_level, const DataIndex& a_dit, const
int a_sourceLevel, const IntVect& a_sourceCell) const;
262 const std::vector<IntVect>&
263 getSurfaceCells(const
int a_level, const DataIndex& a_dit, const
int a_sourceLevel) const noexcept;
273 const PolyhedralEB::CutCellSurface*
275 const DataIndex& a_dit,
276 const
int a_sourceLevel,
277 const IntVect& a_sourceCell) const;
286 const PolyhedralEB::CutCellFaceOverrides&
287 getFaceOverrides(const
int a_level, const DataIndex& a_dit, const
int a_sourceLevel) const noexcept;
299 const DataIndex& a_dit,
300 const
int a_sourceLevel,
302 const
signed char* a_states);
315 const DataIndex& a_dit,
316 const
int a_sourceLevel,
317 const IntVect& a_sourceCell,
318 const PolyhedralEB::CutCellSurface& a_surface);
337 PolyhedralEB::CutCellFaceOverrides&
338 getFaceOverrides(const
int a_level, const DataIndex& a_dit, const
int a_sourceLevel) noexcept;
359 std::function<GeometryService::InOut(const Box&, const ProblemDomain&)>
m_classify;
379 std::vector<std::vector<RefCountedPtr<LayoutData<std::vector<Box>>>>>
m_pieces;
384 std::vector<std::vector<RefCountedPtr<LayoutData<std::vector<
int>>>>>
m_pieceOffsets;
389 std::vector<std::vector<RefCountedPtr<LayoutData<std::vector<
signed char>>>>>
m_states;
394 std::vector<std::vector<RefCountedPtr<LayoutData<std::vector<IntVect>>>>>
m_surfaceCells;
399 std::vector<std::vector<RefCountedPtr<LayoutData<std::vector<PolyhedralEB::CutCellSurface>>>>>
m_surfaces;
404 std::vector<std::vector<RefCountedPtr<LayoutData<PolyhedralEB::CutCellFaceOverrides>>>>
m_faceOverrides;
409 std::vector<std::vector<RefCountedPtr<LayoutData<
int>>>>
m_binSize;
414 std::vector<std::vector<RefCountedPtr<LayoutData<Box>>>>
m_binBox;
420 std::vector<std::vector<RefCountedPtr<LayoutData<std::vector<
int>>>>>
m_binOffsets;
425 std::vector<std::vector<RefCountedPtr<LayoutData<std::vector<
int>>>>>
m_binPieces;
438 const DataIndex& a_dit,
439 const
int a_sourceLevel,
440 const Box& a_region) const;
451 describe(std::vector<PolyhedralEB::CutCellDescription>& a_cells,
453 const DataIndex& a_dit,
454 const
int a_sourceLevel,
455 const IntVect& a_sourceCell) const;
466 allocate(std::vector<std::vector<RefCountedPtr<LayoutData<T>>>>& a_data,
467 const std::vector<DisjointBoxLayout>& a_grids,
468 const
int a_numSourceLevels);
471#include <CD_NamespaceFooter.H>
Declaration of everything one cut cell of the polyhedral geometry is built from.
Declaration of the faces of a box's cut cells that their own surfaces do not describe.
Declaration of the data a cut cell's embedded boundary is reconstructed from.
std::function< GeometryService::InOut(const Box &, const ProblemDomain &)> m_classify
Classifies the boxes no tile holds, on a given domain.
Definition CD_AMRPolyhedralEBGraph.H:359
bool holds(const int a_level, const DataIndex &a_dit, const IntVect &a_cell) const
Whether a destination box holds a cell: within its ring and the domain, and not under the next finer ...
Definition CD_AMRPolyhedralEBGraph.cpp:331
void piecesNear(std::vector< int > &a_pieces, const int a_level, const DataIndex &a_dit, const int a_sourceLevel, const Box &a_region) const
The pieces of a box that may meet a region: those of the bins the region reaches, each once.
Definition CD_AMRPolyhedralEBGraph.cpp:493
void describe(std::vector< PolyhedralEB::CutCellDescription > &a_cells, const int a_level, const DataIndex &a_dit, const int a_sourceLevel, const IntVect &a_sourceCell) const
Append the description of a cut geometry cell this box holds.
Definition CD_AMRPolyhedralEBGraph.cpp:631
std::vector< std::vector< RefCountedPtr< LayoutData< std::vector< int > > > > > m_binOffsets
Where each bin's pieces begin in m_binPieces, the bins in the order a BoxIterator meets them,...
Definition CD_AMRPolyhedralEBGraph.H:420
std::vector< std::vector< RefCountedPtr< LayoutData< Box > > > > m_binBox
The bins of each box's index, on the geometry level coarsened by the bin width.
Definition CD_AMRPolyhedralEBGraph.H:414
std::vector< ProblemDomain > m_domains
Domain of every destination level.
Definition CD_AMRPolyhedralEBGraph.H:369
static constexpr int s_unowned
State of a destination cell, or of a geometry cell, that no geometry level owns here.
Definition CD_AMRPolyhedralEBGraph.H:55
std::vector< int > m_geometryLevels
Geometry level of every destination level.
Definition CD_AMRPolyhedralEBGraph.H:374
std::vector< std::vector< RefCountedPtr< LayoutData< std::vector< PolyhedralEB::CutCellSurface > > > > > m_surfaces
Their surfaces, in the same order.
Definition CD_AMRPolyhedralEBGraph.H:399
int m_ghost
Ghost width every destination box is filled to.
Definition CD_AMRPolyhedralEBGraph.H:349
void define(const std::vector< DisjointBoxLayout > &a_grids, const std::vector< ProblemDomain > &a_domains, const std::vector< int > &a_geometryLevels, const int a_numSourceLevels, const int a_ghost, const std::function< GeometryService::InOut(const Box &, const ProblemDomain &)> &a_classify)
Set the destination hierarchy, holding nothing of the graph yet.
Definition CD_AMRPolyhedralEBGraph.cpp:59
std::vector< std::vector< RefCountedPtr< LayoutData< std::vector< signed char > > > > > m_states
The pieces' states, one piece after another, each in the order a BoxIterator meets its cells.
Definition CD_AMRPolyhedralEBGraph.H:389
void finish()
Put every box's surfaces in cell order and index its pieces, after the last addPiece and addSurface a...
Definition CD_AMRPolyhedralEBGraph.cpp:531
void fillNodes(BaseFab< int > &a_regIrregCovered, Vector< IrregNode > &a_nodes, long long &a_numCollapsed, long long &a_numFiner, const int a_level, const DataIndex &a_dit, const BaseFab< bool > &a_compute, const bool a_cutRing) const
Fill a destination box's index-space data from the copied graph: what each cell is,...
Definition CD_AMRPolyhedralEBGraph.cpp:671
static constexpr int s_ringFromCoarser
Flag fillNodes gives a cell of a box's first ghost ring that would have to be cut from a coarser ance...
Definition CD_AMRPolyhedralEBGraph.H:62
void addSurface(const int a_level, const DataIndex &a_dit, const int a_sourceLevel, const IntVect &a_sourceCell, const PolyhedralEB::CutCellSurface &a_surface)
Add the surface of a geometry cell to a destination box. Surfaces may come in any order; finish puts ...
Definition CD_AMRPolyhedralEBGraph.cpp:479
std::vector< std::vector< RefCountedPtr< LayoutData< std::vector< Box > > > > > m_pieces
The pieces of every box, per destination level and geometry level.
Definition CD_AMRPolyhedralEBGraph.H:379
std::vector< std::vector< RefCountedPtr< LayoutData< int > > > > m_binSize
Width of the bins each box's pieces are indexed by.
Definition CD_AMRPolyhedralEBGraph.H:409
int getGeometryLevel(const int a_level) const noexcept
Geometry level a destination level lives on.
Definition CD_AMRPolyhedralEBGraph.cpp:149
std::vector< std::vector< RefCountedPtr< LayoutData< std::vector< IntVect > > > > > m_surfaceCells
The cells that hold a surface, in increasing order once finish has run.
Definition CD_AMRPolyhedralEBGraph.H:394
int getGhost() const noexcept
Ghost width every destination box is filled to.
Definition CD_AMRPolyhedralEBGraph.cpp:127
const std::vector< Box > & getPieces(const int a_level, const DataIndex &a_dit, const int a_sourceLevel) const noexcept
The pieces a destination box holds of a geometry level: boxes of cells, each owned by one of its tile...
Definition CD_AMRPolyhedralEBGraph.cpp:358
int getNumLevels() const noexcept
Number of destination levels.
Definition CD_AMRPolyhedralEBGraph.cpp:115
int getState(const int a_level, const DataIndex &a_dit, const IntVect &a_cell) const
What a cell of a destination box is: cut if any geometry cell owning part of it is,...
Definition CD_AMRPolyhedralEBGraph.cpp:216
bool isDefined() const noexcept
Whether define has run.
Definition CD_AMRPolyhedralEBGraph.cpp:109
int m_numSourceLevels
Number of geometry levels.
Definition CD_AMRPolyhedralEBGraph.H:354
AMRPolyhedralEBGraph() noexcept
Constructor. Holds nothing until define.
Definition CD_AMRPolyhedralEBGraph.cpp:29
int getNumSourceLevels() const noexcept
Number of geometry levels.
Definition CD_AMRPolyhedralEBGraph.cpp:121
std::vector< std::vector< RefCountedPtr< LayoutData< std::vector< int > > > > > m_binPieces
The pieces that reach each bin, one bin after another.
Definition CD_AMRPolyhedralEBGraph.H:425
const PolyhedralEB::CutCellFaceOverrides & getFaceOverrides(const int a_level, const DataIndex &a_dit, const int a_sourceLevel) const noexcept
The face overrides of a geometry level's cells, as a destination box holds them.
Definition CD_AMRPolyhedralEBGraph.cpp:440
void getCutCells(std::vector< PolyhedralEB::CutCellDescription > &a_cells, const int a_level, const DataIndex &a_dit, const IntVect &a_cell) const
The cut cells of the geometry that intersect a cell of a destination box, each with everything its po...
Definition CD_AMRPolyhedralEBGraph.cpp:157
const std::vector< IntVect > & getSurfaceCells(const int a_level, const DataIndex &a_dit, const int a_sourceLevel) const noexcept
The geometry cells of a level that a destination box holds a surface for, in increasing order.
Definition CD_AMRPolyhedralEBGraph.cpp:409
const PolyhedralEB::CutCellSurface * getSourceSurface(const int a_level, const DataIndex &a_dit, const int a_sourceLevel, const IntVect &a_sourceCell) const
The surface of a geometry cell, as a destination box holds it.
Definition CD_AMRPolyhedralEBGraph.cpp:418
int getSourceState(const int a_level, const DataIndex &a_dit, const int a_sourceLevel, const IntVect &a_sourceCell) const
The state of a geometry cell, as a destination box holds it.
Definition CD_AMRPolyhedralEBGraph.cpp:367
std::vector< std::vector< RefCountedPtr< LayoutData< std::vector< int > > > > > m_pieceOffsets
Where each piece's states begin in m_states, and one past the last piece's end.
Definition CD_AMRPolyhedralEBGraph.H:384
const ProblemDomain & getDomain(const int a_level) const noexcept
Domain of a destination level.
Definition CD_AMRPolyhedralEBGraph.cpp:141
void addPiece(const int a_level, const DataIndex &a_dit, const int a_sourceLevel, const Box &a_region, const signed char *a_states)
Add a piece to a destination box.
Definition CD_AMRPolyhedralEBGraph.cpp:460
const DisjointBoxLayout & getGrids(const int a_level) const noexcept
Layout of a destination level.
Definition CD_AMRPolyhedralEBGraph.cpp:133
bool m_isDefined
Whether define has run.
Definition CD_AMRPolyhedralEBGraph.H:344
std::vector< DisjointBoxLayout > m_grids
Destination layout of every level.
Definition CD_AMRPolyhedralEBGraph.H:364
std::vector< std::vector< RefCountedPtr< LayoutData< PolyhedralEB::CutCellFaceOverrides > > > > m_faceOverrides
The face overrides of the cells whose surfaces are overridden.
Definition CD_AMRPolyhedralEBGraph.H:404