AXOM
Axom provides a robust, flexible software infrastructure for the development of multi-physics applications and computational tools.
axom::primal::NeighborCollection Class Reference

Represents a collection of neighbor relations between vertices. More...

#include </home/docs/checkouts/readthedocs.org/user_builds/axom/checkouts/latest/src/axom/primal/geometry/Polyhedron.hpp>

Public Types

using VertexNbrs = axom::StackArray< std::int8_t, MAX_NBRS_PER_VERT >
 

Public Member Functions

 NeighborCollection ()=default
 Constructs an empty NeighborCollection. More...
 
AXOM_HOST_DEVICE void clear ()
 Clears the set of neighbors. More...
 
AXOM_HOST_DEVICE int getNumNeighbors (int vtx) const
 Returns the number of neighbors of a given vertex. More...
 
AXOM_HOST_DEVICE const VertexNbrsoperator[] (int vtx) const
 Gets the array of neighbors for a given vertex index vtx. More...
 
AXOM_HOST_DEVICE VertexNbrsoperator[] (int vtx)
 Gets the array of neighbors for a given vertex index vtx. More...
 
AXOM_HOST_DEVICE const VertexNbrsgetNeighbors (int vtx) const
 Gets the array of neighbors for a given vertex index vtx. More...
 
AXOM_HOST_DEVICE VertexNbrsgetNeighbors (int vtx)
 Gets the array of neighbors for a given vertex index vtx. More...
 
AXOM_HOST_DEVICE void addNeighbors (std::int8_t vtx, std::initializer_list< std::int8_t > nbrIds)
 Adds a set of neighbors to a given vertex. More...
 
AXOM_HOST_DEVICE void addNeighbors (std::int8_t vtx, std::int8_t nbrId)
 Adds a single neighbor to a given vertex. More...
 
AXOM_HOST_DEVICE void insertNeighborAtPos (std::int8_t vtx, std::int8_t nbr, std::int8_t pos)
 Inserts a new neighbor for a vertex at a given index in the neighbor list. More...
 
AXOM_HOST_DEVICE void pruneNeighbors ()
 Compacts all neighbor sets by removing neighbors with index -1. More...
 

Static Public Attributes

static constexpr int MAX_VERTS = 32
 
static constexpr int MAX_NBRS_PER_VERT = 8
 

Detailed Description

Represents a collection of neighbor relations between vertices.

Member Typedef Documentation

◆ VertexNbrs

Constructor & Destructor Documentation

◆ NeighborCollection()

axom::primal::NeighborCollection::NeighborCollection ( )
default

Constructs an empty NeighborCollection.

Member Function Documentation

◆ clear()

AXOM_HOST_DEVICE void axom::primal::NeighborCollection::clear ( )
inline

Clears the set of neighbors.

References MAX_VERTS.

◆ getNumNeighbors()

AXOM_HOST_DEVICE int axom::primal::NeighborCollection::getNumNeighbors ( int  vtx) const
inline

Returns the number of neighbors of a given vertex.

Parameters
[in]vtxindex of the vertex to check.
Returns
num_nbrs the number of neighbors the vertex has.

References MAX_VERTS, and SLIC_ASSERT.

◆ operator[]() [1/2]

AXOM_HOST_DEVICE const VertexNbrs& axom::primal::NeighborCollection::operator[] ( int  vtx) const
inline

Gets the array of neighbors for a given vertex index vtx.

References getNeighbors(), MAX_VERTS, and SLIC_ASSERT.

◆ operator[]() [2/2]

AXOM_HOST_DEVICE VertexNbrs& axom::primal::NeighborCollection::operator[] ( int  vtx)
inline

Gets the array of neighbors for a given vertex index vtx.

References getNeighbors(), MAX_VERTS, and SLIC_ASSERT.

◆ getNeighbors() [1/2]

AXOM_HOST_DEVICE const VertexNbrs& axom::primal::NeighborCollection::getNeighbors ( int  vtx) const
inline

Gets the array of neighbors for a given vertex index vtx.

References MAX_VERTS, and SLIC_ASSERT.

◆ getNeighbors() [2/2]

AXOM_HOST_DEVICE VertexNbrs& axom::primal::NeighborCollection::getNeighbors ( int  vtx)
inline

Gets the array of neighbors for a given vertex index vtx.

References MAX_VERTS, and SLIC_ASSERT.

◆ addNeighbors() [1/2]

AXOM_HOST_DEVICE void axom::primal::NeighborCollection::addNeighbors ( std::int8_t  vtx,
std::initializer_list< std::int8_t >  nbrIds 
)
inline

Adds a set of neighbors to a given vertex.

Parameters
[in]vtxthe index of the vertex to add new neighbors to
[in]nbra set of indices of neighboring vertices
Precondition
vtx < MAX_VERTS

References MAX_NBRS_PER_VERT, MAX_VERTS, and SLIC_ASSERT.

◆ addNeighbors() [2/2]

AXOM_HOST_DEVICE void axom::primal::NeighborCollection::addNeighbors ( std::int8_t  vtx,
std::int8_t  nbrId 
)
inline

Adds a single neighbor to a given vertex.

Parameters
[in]vtxthe index of the vertex to add the new neighbor to
[in]nbran index of a neighboring vertex
Precondition
vtx < MAX_VERTS

References MAX_NBRS_PER_VERT, MAX_VERTS, and SLIC_ASSERT.

◆ insertNeighborAtPos()

AXOM_HOST_DEVICE void axom::primal::NeighborCollection::insertNeighborAtPos ( std::int8_t  vtx,
std::int8_t  nbr,
std::int8_t  pos 
)
inline

Inserts a new neighbor for a vertex at a given index in the neighbor list.

Parameters
[in]vtxthe index of the vertex to add a new neighbor to
[in]nbrthe index of the neighboring vertex
[in]posthe position in the neighbor list to insert into
Precondition
vtx < MAX_VERTS
pos <= num_nbrs[vtx]

References MAX_NBRS_PER_VERT, MAX_VERTS, and SLIC_ASSERT.

◆ pruneNeighbors()

AXOM_HOST_DEVICE void axom::primal::NeighborCollection::pruneNeighbors ( )
inline

Compacts all neighbor sets by removing neighbors with index -1.

References MAX_VERTS.

Member Data Documentation

◆ MAX_VERTS

constexpr int axom::primal::NeighborCollection::MAX_VERTS = 32
staticconstexpr

◆ MAX_NBRS_PER_VERT

constexpr int axom::primal::NeighborCollection::MAX_NBRS_PER_VERT = 8
staticconstexpr

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