chombo-discharge
Loading...
Searching...
No Matches
PolyhedralEB::CutCellFaceOverrides Class Reference

The faces of a box's cut cells that do not come from the cells' own chords. More...

#include <CD_CutCellFaceOverrides.H>

Public Member Functions

 CutCellFaceOverrides () noexcept
 Constructor. Holds no cell.
 ~CutCellFaceOverrides () noexcept=default
 Destructor.
void clear () noexcept
 Drop every entry.
void beginCell (const IntVect &a_cell)
 Open the entries of a cell.
void beginFace (const int a_face, const int a_reason)
 Open a face of the cell last begun.
void addPolygon (const RealVect *a_vertices, const int *a_vertexEdges, const int a_numVertices)
 Add a polygon to the face last begun.
void endCell () noexcept
 Drop the cell last begun if no face was added to it.
int numCells () const noexcept
 Number of cells with entries.
int find (const IntVect &a_cell) const noexcept
 A cell's position among the cells with entries.
const IntVect & cell (const int a_index) const noexcept
 The cell at an index.
void faces (const int a_index, int &a_begin, int &a_end) const noexcept
 The faces of a cell, as a range of face indices.
int face (const int a_face) const noexcept
 Which face of its cell a face entry is.
int reason (const int a_face) const noexcept
 Why a face entry overrides its face.
void polygons (const int a_face, int &a_begin, int &a_end) const noexcept
 The polygons of a face entry, as a range of polygon indices.
void vertices (const int a_polygon, int &a_begin, int &a_end) const noexcept
 The vertices of a polygon, as a range of vertex indices.
const RealVect & vertex (const int a_vertex) const noexcept
 A vertex position, in its cell's frame.
int vertexEdge (const int a_vertex) const noexcept
 The cell edge a vertex came from.
int linearSize (const int a_index) const noexcept
 Bytes one cell's entries occupy in a linear buffer.
void linearOut (void *a_buffer, const int a_index) const noexcept
 Write one cell's entries into a linear buffer: its faces, each with its polygons, each with its vertices. The cell itself is not written; whoever reads the buffer knows which cell it is for.
int linearIn (const void *a_buffer, const IntVect &a_cell)
 Read one cell's entries from a buffer written by linearOut, and add them for a cell.
bool equals (const CutCellFaceOverrides &a_other) const noexcept
 Whether two sets of entries are the same, bit for bit.

Static Public Member Functions

static bool precedes (const IntVect &a_first, const IntVect &a_second) noexcept
 Whether one cell comes before another in the order the cells are kept in.

Static Public Attributes

static constexpr int s_finer = 0
 Why a face is overridden: restricted to the finer level's chords.
static constexpr int s_closed = 1
 Why a face is overridden: closed onto a covered cell.
static constexpr int s_closedLowHalf = 2
 Why a face is overridden, in two dimensions: the half of it below its midpoint is closed, the finer cell across that half having been filled.
static constexpr int s_closedHighHalf = 3
 Why a face is overridden, in two dimensions: the half of it above its midpoint is closed.

Protected Attributes

std::vector< IntVect > m_cells
 The cells with entries, in increasing order.
std::vector< int > m_cellFaces
 First face of every cell, and one past the last face of the last.
std::vector< int > m_face
 Face index of every face entry.
std::vector< int > m_reason
 Reason of every face entry.
std::vector< int > m_facePolygons
 First polygon of every face entry, and one past the last polygon of the last.
std::vector< int > m_polygonVertices
 First vertex of every polygon, and one past the last vertex of the last.
std::vector< RealVect > m_vertices
 Every vertex position.
std::vector< int > m_vertexEdges
 Cell edge every vertex came from, or -1.

Detailed Description

The faces of a box's cut cells that do not come from the cells' own chords.

A cut cell's body is built from its surface, and most of its faces are exactly what the surface's chords give. Two kinds of face are not. A face onto a cell the finer level carries is described at the finer level's resolution: the chord is replaced by the finer cells' chords, merged into the polygons stored here, less any quadrant across which the finer level filled a cell. A face onto a cell this level filled is closed, and what it gave up becomes interface in the plane of that face; such a face stores no polygon, only that it is closed. With these the body of every cut cell is a function of its own surface and its own entries here, and needs nothing from its neighbours or from the finer level.

In two dimensions a face is a segment, and the finer level's description of it is its crossing, which the surface already carries. What is left to store is which half of a face on a refinement boundary is closed, where the finer cell across it was filled, and which faces are closed onto a filled cell; no polygon is stored.

Stored compressed, in the order the faces are applied: the cells in increasing order, each with its faces, each face with its polygons, each polygon with its vertices. A cell's restricted faces come before its closed ones, and each kind in increasing face order, which is the order a body applies them in. Cells are ordered as a BoxIterator meets them, the highest direction the most significant, and found by bisection in that order.

Member Function Documentation

◆ addPolygon()

void PolyhedralEB::CutCellFaceOverrides::addPolygon ( const RealVect * a_vertices,
const int * a_vertexEdges,
const int a_numVertices )

Add a polygon to the face last begun.

Parameters
[in]a_verticesVertices in circuit order, in the cell's frame.
[in]a_vertexEdgesCell edge each vertex came from, or -1.
[in]a_numVerticesNumber of vertices.

◆ beginCell()

void PolyhedralEB::CutCellFaceOverrides::beginCell ( const IntVect & a_cell)

Open the entries of a cell.

Cells are added in increasing BoxIterator order, each once, and a cell's faces follow it.

Parameters
[in]a_cellThe cell.

◆ beginFace()

void PolyhedralEB::CutCellFaceOverrides::beginFace ( const int a_face,
const int a_reason )

Open a face of the cell last begun.

Parameters
[in]a_faceFace index, 2 * dir + side.
[in]a_reasons_finer, s_closed, s_closedLowHalf or s_closedHighHalf.

◆ cell()

const IntVect & PolyhedralEB::CutCellFaceOverrides::cell ( const int a_index) const
noexcept

The cell at an index.

Parameters
[in]a_indexIndex among the cells.
Returns
The cell.

◆ equals()

bool PolyhedralEB::CutCellFaceOverrides::equals ( const CutCellFaceOverrides & a_other) const
noexcept

Whether two sets of entries are the same, bit for bit.

Parameters
[in]a_otherThe other set.
Returns
True if nothing differs.

◆ face()

int PolyhedralEB::CutCellFaceOverrides::face ( const int a_face) const
noexcept

Which face of its cell a face entry is.

Parameters
[in]a_faceFace entry.
Returns
2 * dir + side.

◆ faces()

void PolyhedralEB::CutCellFaceOverrides::faces ( const int a_index,
int & a_begin,
int & a_end ) const
noexcept

The faces of a cell, as a range of face indices.

Parameters
[in]a_indexIndex among the cells.
[out]a_beginFirst face.
[out]a_endOne past the last face.

◆ find()

int PolyhedralEB::CutCellFaceOverrides::find ( const IntVect & a_cell) const
noexcept

A cell's position among the cells with entries.

Parameters
[in]a_cellThe cell.
Returns
Its index, or -1 if it has none.

◆ linearIn()

int PolyhedralEB::CutCellFaceOverrides::linearIn ( const void * a_buffer,
const IntVect & a_cell )

Read one cell's entries from a buffer written by linearOut, and add them for a cell.

As beginCell, cells are added in increasing order, each once.

Parameters
[in]a_bufferBuffer written by linearOut.
[in]a_cellThe cell the entries are for.
Returns
Bytes read.

◆ linearOut()

void PolyhedralEB::CutCellFaceOverrides::linearOut ( void * a_buffer,
const int a_index ) const
noexcept

Write one cell's entries into a linear buffer: its faces, each with its polygons, each with its vertices. The cell itself is not written; whoever reads the buffer knows which cell it is for.

Parameters
[out]a_bufferBuffer of at least linearSize(a_index) bytes.
[in]a_indexIndex among the cells.

◆ linearSize()

int PolyhedralEB::CutCellFaceOverrides::linearSize ( const int a_index) const
noexcept

Bytes one cell's entries occupy in a linear buffer.

Parameters
[in]a_indexIndex among the cells.
Returns
The size linearOut writes.

◆ numCells()

int PolyhedralEB::CutCellFaceOverrides::numCells ( ) const
noexcept

Number of cells with entries.

Returns
The count.

◆ polygons()

void PolyhedralEB::CutCellFaceOverrides::polygons ( const int a_face,
int & a_begin,
int & a_end ) const
noexcept

The polygons of a face entry, as a range of polygon indices.

Parameters
[in]a_faceFace entry.
[out]a_beginFirst polygon.
[out]a_endOne past the last polygon.

◆ precedes()

bool PolyhedralEB::CutCellFaceOverrides::precedes ( const IntVect & a_first,
const IntVect & a_second )
staticnoexcept

Whether one cell comes before another in the order the cells are kept in.

Parameters
[in]a_firstOne cell.
[in]a_secondThe other.
Returns
True if a_first is kept first.

◆ reason()

int PolyhedralEB::CutCellFaceOverrides::reason ( const int a_face) const
noexcept

Why a face entry overrides its face.

Parameters
[in]a_faceFace entry.
Returns
s_finer, s_closed, s_closedLowHalf or s_closedHighHalf.

◆ vertex()

const RealVect & PolyhedralEB::CutCellFaceOverrides::vertex ( const int a_vertex) const
noexcept

A vertex position, in its cell's frame.

Parameters
[in]a_vertexVertex index.
Returns
The position.

◆ vertexEdge()

int PolyhedralEB::CutCellFaceOverrides::vertexEdge ( const int a_vertex) const
noexcept

The cell edge a vertex came from.

Parameters
[in]a_vertexVertex index.
Returns
The edge, or -1.

◆ vertices()

void PolyhedralEB::CutCellFaceOverrides::vertices ( const int a_polygon,
int & a_begin,
int & a_end ) const
noexcept

The vertices of a polygon, as a range of vertex indices.

Parameters
[in]a_polygonPolygon index.
[out]a_beginFirst vertex.
[out]a_endOne past the last vertex.

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