chombo-discharge
Loading...
Searching...
No Matches
AMRPolyhedralEBGraph Class Reference

The polyhedral graph as an AMR hierarchy of any layout holds it: every cell of every box, ghost cells included, described by the geometry level that owns it. More...

#include <CD_AMRPolyhedralEBGraph.H>

Public Member Functions

 AMRPolyhedralEBGraph () noexcept
 Constructor. Holds nothing until define.
virtual ~AMRPolyhedralEBGraph () noexcept
 Destructor.
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.
bool isDefined () const noexcept
 Whether define has run.
int getNumLevels () const noexcept
 Number of destination levels.
int getNumSourceLevels () const noexcept
 Number of geometry levels.
int getGhost () const noexcept
 Ghost width every destination box is filled to.
const DisjointBoxLayout & getGrids (const int a_level) const noexcept
 Layout of a destination level.
const ProblemDomain & getDomain (const int a_level) const noexcept
 Domain of a destination level.
int getGeometryLevel (const int a_level) const noexcept
 Geometry level a destination level lives on.
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 polyhedron is built from.
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, or if it holds both regular and covered fluid, regular or covered if all of it is, and s_unowned if the box holds nothing of it.
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 destination level.
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, and a node with the moments of each cut cell, as GeometryService::fillGraph hands them to the index space.
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 tiles.
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.
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.
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.
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.
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.
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 them in order before any is read.
void finish ()
 Put every box's surfaces in cell order and index its pieces, after the last addPiece and addSurface and before anything is read.
PolyhedralEB::CutCellFaceOverrides & getFaceOverrides (const int a_level, const DataIndex &a_dit, const int a_sourceLevel) noexcept
 The face overrides of a geometry level's cells in a destination box, to be filled.

Static Public Attributes

static constexpr int s_unowned = 2
 State of a destination cell, or of a geometry cell, that no geometry level owns here.
static constexpr int s_ringFromCoarser = 3
 Flag fillNodes gives a cell of a box's first ghost ring that would have to be cut from a coarser ancestor, when it is told not to cut the ring.

Protected Member Functions

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.
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.

Protected Attributes

bool m_isDefined
 Whether define has run.
int m_ghost
 Ghost width every destination box is filled to.
int m_numSourceLevels
 Number of geometry levels.
std::function< GeometryService::InOut(const Box &, const ProblemDomain &)> m_classify
 Classifies the boxes no tile holds, on a given domain.
std::vector< DisjointBoxLayout > m_grids
 Destination layout of every level.
std::vector< ProblemDomain > m_domains
 Domain of every destination level.
std::vector< int > m_geometryLevels
 Geometry level of every destination level.
std::vector< std::vector< RefCountedPtr< LayoutData< std::vector< Box > > > > > m_pieces
 The pieces of every box, per destination level and geometry level.
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.
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.
std::vector< std::vector< RefCountedPtr< LayoutData< std::vector< IntVect > > > > > m_surfaceCells
 The cells that hold a surface, in increasing order once finish has run.
std::vector< std::vector< RefCountedPtr< LayoutData< std::vector< PolyhedralEB::CutCellSurface > > > > > m_surfaces
 Their surfaces, in the same order.
std::vector< std::vector< RefCountedPtr< LayoutData< PolyhedralEB::CutCellFaceOverrides > > > > m_faceOverrides
 The face overrides of the cells whose surfaces are overridden.
std::vector< std::vector< RefCountedPtr< LayoutData< int > > > > m_binSize
 Width of the bins each box's pieces are indexed by.
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.
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, and one past the last bin's end.
std::vector< std::vector< RefCountedPtr< LayoutData< std::vector< int > > > > > m_binPieces
 The pieces that reach each bin, one bin after another.

Detailed Description

The polyhedral graph as an AMR hierarchy of any layout holds it: every cell of every box, ghost cells included, described by the geometry level that owns it.

The geometry's graph lives on its own levels and its own tiles. A consumer lives on its own hierarchy – one DisjointBoxLayout per level, each box filled to a ghost width, less what the next finer level covers – and a cell of it may be owned by the geometry level at its own resolution, by a finer one, or by a coarser one. Each box keeps the part of the graph that intersects it and nothing else: per geometry level, the pieces it received – boxes of cells one tile of that level owns, with their states – and the surfaces and face overrides of the cells among them that hold any. Nothing here is recomputed from the implicit function; PolyhedralGeometryShop::copyGraphs fills it from the graphs alone.

A consumer asks a destination cell for the cut cells that intersect it, getCutCells, each as a CutCellDescription from which CutCellBody::define builds its polyhedron, and asks getState what a cell with none is.

Member Function Documentation

◆ addPiece()

void AMRPolyhedralEBGraph::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.

Parameters
[in]a_levelDestination level.
[in]a_ditDestination box.
[in]a_sourceLevelGeometry level of the piece.
[in]a_regionThe piece, on that level.
[in]a_statesIts cells' states, in the order a BoxIterator meets them.

◆ addSurface()

void AMRPolyhedralEBGraph::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 them in order before any is read.

Parameters
[in]a_levelDestination level.
[in]a_ditDestination box.
[in]a_sourceLevelGeometry level of the cell.
[in]a_sourceCellThe cell, on that level.
[in]a_surfaceIts surface.

◆ define()

void AMRPolyhedralEBGraph::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.

Parameters
[in]a_gridsDestination layout of every level, coarsest first.
[in]a_domainsDomain of every destination level.
[in]a_geometryLevelsGeometry level of every destination level.
[in]a_numSourceLevelsNumber of geometry levels.
[in]a_ghostGhost width every destination box is filled to.
[in]a_classifySays what a box no tile holds is, on a given domain: ComputationalGeometry::classify for the graph's phase. Whatever it refers to must outlive this object.

◆ describe()

void AMRPolyhedralEBGraph::describe ( std::vector< PolyhedralEB::CutCellDescription > & a_cells,
const int a_level,
const DataIndex & a_dit,
const int a_sourceLevel,
const IntVect & a_sourceCell ) const
protected

Append the description of a cut geometry cell this box holds.

Parameters
[out]a_cellsDescriptions to append to.
[in]a_levelDestination level.
[in]a_ditDestination box.
[in]a_sourceLevelGeometry level of the cell.
[in]a_sourceCellThe cell, on that level.

◆ fillNodes()

void AMRPolyhedralEBGraph::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, and a node with the moments of each cut cell, as GeometryService::fillGraph hands them to the index space.

The graph decides what a cell is, and nothing overrides it: a cell it calls regular is regular, one it calls covered is covered. A cut cell owned at the box's level takes its stitched body. A cell cut from a coarser ancestor takes the child the ancestor's body subdivides down to; a child holding no fluid is covered, a child that is all fluid with no interface is regular, and a child the subdivision leaves in more than one piece is kept as one node whose moments are the sums over its pieces, its volume centroid the summed first moment, and is counted. A cell a finer level owns is not filled yet: it is marked irregular, gets no node, and is counted.

The flags cover the box grown by two cells, within the domain; a cell the copy holds nothing for – one the next finer destination level covers – is marked irregular and gets no node. Nodes are written for the box and its first ghost cell, so that every face of a node has the cell across it in hand. A face beside a regular cell is open over all of it. A face two cut cells share takes its aperture and centroid from one body, on both sides, so every box writes it with the same bits: from the cell owned at the box's level where the other is cut from an ancestor, and from the low cell otherwise.

A caller that keeps the moments of the box only can leave the ring alone, and needs the copy only one ghost cell wide; a ring cut as the box is needs it two. The cells beyond the first ghost ring are then marked covered without being looked at, and a cut cell of the first ghost ring that would have to be cut from an ancestor is marked s_ringFromCoarser and gets no body or node; the box's own cells write their faces beside it from their own bodies.

A cut from an ancestor that fails, or that gives a child in one piece that does not close, has lost fluid its parent holds, and stops the run.

Parameters
[out]a_regIrregCoveredOne for regular, minus one for covered, zero for irregular, per cell.
[out]a_nodesOne node per irregular cell the box fills.
[out]a_numCollapsedIncremented for every child a subdivision left in more than one piece.
[out]a_numFinerIncremented for every cut cell a finer level owns.
[in]a_levelDestination level.
[in]a_ditDestination box.
[in]a_computeThe cells to fill, over at least the box grown by two cells within the domain. A cell left out is marked irregular, gets no node and builds no body, so a cell filled beside it does not read its faces from it: a caller that keeps a node must fill every cell across its faces too.
[in]a_cutRingWhether the ghost cells are filled as the box's own cells are. If false, only the box's own cells are filled in full, and the ring is left as described above.

◆ finish()

void AMRPolyhedralEBGraph::finish ( )

Put every box's surfaces in cell order and index its pieces, after the last addPiece and addSurface and before anything is read.

The index is a coarse grid over each box's pieces, of bins as wide as its widest piece, each listing the pieces that reach it: a cell is found among the few pieces of its bin rather than among all of a box's pieces, which a coarse destination box gathering a finer level's tiles has many of.

◆ getCutCells()

void AMRPolyhedralEBGraph::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 polyhedron is built from.

A cell the geometry owns at the destination's resolution is its own cut cell; one owned by a finer level is intersected by every cut cell of that level under it; one owned by a coarser level is intersected by the cut ancestor, whose polyhedron the consumer subdivides down to the cell. Each comes with its face overrides. A cell none of whose owners is cut gives none; getState says what it is.

Parameters
[out]a_cellsThe cut cells, appended to an emptied list.
[in]a_levelDestination level.
[in]a_ditDestination box.
[in]a_cellThe cell, on the destination level, in the box or its ghost cells.

◆ getDomain()

const ProblemDomain & AMRPolyhedralEBGraph::getDomain ( const int a_level) const
noexcept

Domain of a destination level.

Parameters
[in]a_levelDestination level.
Returns
The domain.

◆ getFaceOverrides() [1/2]

const PolyhedralEB::CutCellFaceOverrides & AMRPolyhedralEBGraph::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.

Parameters
[in]a_levelDestination level.
[in]a_ditDestination box.
[in]a_sourceLevelGeometry level.
Returns
The overrides, keyed by cells of that level.

◆ getFaceOverrides() [2/2]

PolyhedralEB::CutCellFaceOverrides & AMRPolyhedralEBGraph::getFaceOverrides ( const int a_level,
const DataIndex & a_dit,
const int a_sourceLevel )
noexcept

The face overrides of a geometry level's cells in a destination box, to be filled.

Parameters
[in]a_levelDestination level.
[in]a_ditDestination box.
[in]a_sourceLevelGeometry level.
Returns
The overrides.

◆ getGeometryLevel()

int AMRPolyhedralEBGraph::getGeometryLevel ( const int a_level) const
noexcept

Geometry level a destination level lives on.

Parameters
[in]a_levelDestination level.
Returns
The geometry level.

◆ getGhost()

int AMRPolyhedralEBGraph::getGhost ( ) const
noexcept

Ghost width every destination box is filled to.

Returns
The width.

◆ getGrids()

const DisjointBoxLayout & AMRPolyhedralEBGraph::getGrids ( const int a_level) const
noexcept

Layout of a destination level.

Parameters
[in]a_levelDestination level.
Returns
The layout.

◆ getNumLevels()

int AMRPolyhedralEBGraph::getNumLevels ( ) const
noexcept

Number of destination levels.

Returns
The count.

◆ getNumSourceLevels()

int AMRPolyhedralEBGraph::getNumSourceLevels ( ) const
noexcept

Number of geometry levels.

Returns
The count.

◆ getPieces()

const std::vector< Box > & AMRPolyhedralEBGraph::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 tiles.

Parameters
[in]a_levelDestination level.
[in]a_ditDestination box.
[in]a_sourceLevelGeometry level.
Returns
The pieces, in the geometry level's index space.

◆ getSourceState()

int AMRPolyhedralEBGraph::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.

Parameters
[in]a_levelDestination level.
[in]a_ditDestination box.
[in]a_sourceLevelGeometry level of the cell.
[in]a_sourceCellThe cell, on that level.
Returns
Its state, or s_unowned if the box holds no piece with it.

◆ getSourceSurface()

const PolyhedralEB::CutCellSurface * AMRPolyhedralEBGraph::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.

Parameters
[in]a_levelDestination level.
[in]a_ditDestination box.
[in]a_sourceLevelGeometry level of the cell.
[in]a_sourceCellThe cell, on that level.
Returns
The surface, or null if the box holds none for the cell.

◆ getState()

int AMRPolyhedralEBGraph::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, or if it holds both regular and covered fluid, regular or covered if all of it is, and s_unowned if the box holds nothing of it.

The graph holds only cut tiles. A part of the cell no tile holds is regular or covered whole, as the geometry's own boxes say (ComputationalGeometry::classify), and is read from them at the finest level holding any of the cell.

Parameters
[in]a_levelDestination level.
[in]a_ditDestination box.
[in]a_cellThe cell, on the destination level.
Returns
PolyhedralEBGraph::s_cut, s_regular or s_covered, or s_unowned.

◆ getSurfaceCells()

const std::vector< IntVect > & AMRPolyhedralEBGraph::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.

Parameters
[in]a_levelDestination level.
[in]a_ditDestination box.
[in]a_sourceLevelGeometry level.
Returns
The cells.

◆ holds()

bool AMRPolyhedralEBGraph::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 destination level.

Parameters
[in]a_levelDestination level.
[in]a_ditDestination box.
[in]a_cellThe cell, on the destination level.
Returns
True if the box holds the cell.

◆ isDefined()

bool AMRPolyhedralEBGraph::isDefined ( ) const
noexcept

Whether define has run.

Returns
True after define.

◆ piecesNear()

void AMRPolyhedralEBGraph::piecesNear ( std::vector< int > & a_pieces,
const int a_level,
const DataIndex & a_dit,
const int a_sourceLevel,
const Box & a_region ) const
protected

The pieces of a box that may meet a region: those of the bins the region reaches, each once.

Parameters
[out]a_piecesIndices into the box's pieces.
[in]a_levelDestination level.
[in]a_ditDestination box.
[in]a_sourceLevelGeometry level.
[in]a_regionRegion on that level.

Member Data Documentation

◆ s_ringFromCoarser

int AMRPolyhedralEBGraph::s_ringFromCoarser = 3
staticconstexpr

Flag fillNodes gives a cell of a box's first ghost ring that would have to be cut from a coarser ancestor, when it is told not to cut the ring.

Such a cell gets no body and no node; the caller decides what it is from the box's own cells.


The documentation for this class was generated from the following files: