https://mooseframework.inl.gov
Classes | Public Member Functions | Private Member Functions | Private Attributes | List of all members
Moose::Kokkos::Mesh Class Reference

The Kokkos mesh object. More...

#include <KokkosMesh.h>

Classes

struct  MeshMap
 The wrapper of host maps. More...
 

Public Member Functions

 Mesh (MooseMesh &mesh)
 Constructor. More...
 
const MooseMeshgetMesh ()
 Get the underyling MOOSE mesh. More...
 
bool initialized () const
 Get whether the mesh was initialized. More...
 
void update ()
 Update the mesh. More...
 
void setNeedsElementGeometry ()
 Mark that element geometry data is needed; initElementGeometry() will be called on the next update() More...
 
void setNeedsElementSideGeometry ()
 Mark that element-side geometry data is needed; initElementSideGeometry() will be called on the next update() More...
 
auto getNumSubdomains () const
 Get the number of subdomains. More...
 
auto getNumLocalElementTypes () const
 Get the number of local elements types. More...
 
const auto & getElementTypeMap () const
 Get the element type ID map. More...
 
dof_id_type getNumLocalElements () const
 Get the number of local elements. More...
 
dof_id_type getNumLocalAndPossiblyOneNeighborLayerGhostElements () const
 Get the total number of elements, i.e. More...
 
auto getNumSubdomainLocalElements (const SubdomainID subdomain) const
 Get the number of local elements in a MOOSE subdomain. More...
 
auto getNumLocalNodes () const
 Get the number of local nodes including semi-local nodes. More...
 
const auto & getLocalNodes () const
 Get the list of local nodes including semi-local nodes. More...
 
ContiguousSubdomainID getContiguousSubdomainID (const SubdomainID subdomain) const
 Get the contiguous subdomain ID of a MOOSE subdomain. More...
 
ContiguousBoundaryID getContiguousBoundaryID (const BoundaryID boundary) const
 Get the contiguous boundary ID of a boundary. More...
 
unsigned int getElementTypeID (const Elem *elem) const
 Get the element type ID of an element. More...
 
ContiguousElementID getContiguousElementID (const Elem *elem) const
 Get the contiguous element ID of an element. More...
 
const auto & getGhostElemIdMapping () const
 Get the ghost element ID map (host-side only) More...
 
auto getSubdomainContiguousElementIDRange (const SubdomainID subdomain) const
 Get the range of contiguous element IDs for a subdomain. More...
 
ContiguousNodeID getContiguousNodeID (const Node *node) const
 Get the contiguous node ID of a node. More...
 
const auto & getSubdomainContiguousNodeIDs (const SubdomainID subdomain) const
 Get the list of local contiguous node IDs for a subdomain NOTE: This list excludes semi-local nodes. More...
 
const auto & getBoundaryContiguousNodeIDs (const BoundaryID boundary) const
 Get the list of local contiguous node IDs for a boundary NOTE: This list excludes semi-local nodes. More...
 
KOKKOS_FUNCTION const auto & getElementInfo (ContiguousElementID elem) const
 Get the element information object. More...
 
KOKKOS_FUNCTION ContiguousElementID getNeighbor (ContiguousElementID elem, unsigned int side) const
 Get the neighbor contiguous element ID. More...
 
KOKKOS_FUNCTION Real getSideArea (ContiguousElementID elem, unsigned int side) const
 Get the coordinate-weighted area of an element side. More...
 
KOKKOS_FUNCTION Real3 getSideCentroid (ContiguousElementID elem, unsigned int side) const
 Get the centroid of an element side. More...
 
KOKKOS_FUNCTION Real3 getSideNormal (ContiguousElementID elem, unsigned int side) const
 Get the outward unit normal of an element side. More...
 
KOKKOS_FUNCTION Real3 getElementCentroidToSideCentroidVector (ContiguousElementID elem, unsigned int side) const
 Get the element-centroid to side-centroid vector for an element side. More...
 
KOKKOS_FUNCTION Real getElementCentroidToSideCentroidDistance (ContiguousElementID elem, unsigned int side) const
 Get the element-centroid to side-centroid distance for an element side. More...
 
KOKKOS_FUNCTION Real3 getElementCentroidToNeighborCentroidVector (ContiguousElementID elem, unsigned int side) const
 Get the element-centroid to neighbor-centroid vector for an element side with a neighbor. More...
 
KOKKOS_FUNCTION Real getElementCentroidToNeighborCentroidDistance (ContiguousElementID elem, unsigned int side) const
 Get the element-centroid to neighbor-centroid distance for an element side with a neighbor. More...
 
KOKKOS_FUNCTION BoundaryID getSideBoundaryID (ContiguousElementID elem, unsigned int side) const
 
KOKKOS_FUNCTION Real getElementVolume (ContiguousElementID elem) const
 Get the coordinate-weighted volume of a local element. More...
 
KOKKOS_FUNCTION Real3 getElementCentroid (ContiguousElementID elem) const
 Get the centroid of a local element. More...
 
void initElementGeometry ()
 Allocate and populate local element centroids and coordinate-weighted volumes. More...
 
void initElementSideGeometry ()
 Allocate and populate cached side geometry: side areas, centroids, normals, element-centroid to side-centroid and element-centroid to neighbor-centroid vectors and their magnitudes, and boundary IDs. More...
 
KOKKOS_FUNCTION unsigned int getNumSides (unsigned int elem_type) const
 Get the number of sides of an element type. More...
 
KOKKOS_FUNCTION unsigned int getNumNodes (unsigned int elem_type) const
 Get the number of nodes of an element type. More...
 
KOKKOS_FUNCTION unsigned int getNumNodes (unsigned int elem_type, unsigned int side) const
 Get the number of nodes on a side of an element type. More...
 
KOKKOS_FUNCTION dof_id_type getExtraElementID (ContiguousElementID elem, unsigned int index) const
 Get the extra element ID of an element. More...
 
KOKKOS_FUNCTION dof_id_type getStartingContiguousElementID (ContiguousSubdomainID subdomain) const
 Get the starting contiguous element ID of a subdomain. More...
 
KOKKOS_FUNCTION ContiguousNodeID getContiguousNodeID (ContiguousElementID elem, unsigned int node) const
 Get the contiguous node ID for an element. More...
 
KOKKOS_FUNCTION ContiguousNodeID getContiguousNodeID (ElementInfo info, unsigned int side, unsigned int node) const
 Get the contiguous node ID for a side. More...
 
KOKKOS_FUNCTION Real3 getNodePoint (ContiguousNodeID node) const
 Get the coordinate of a node. More...
 
KOKKOS_FUNCTION bool isBoundaryNode (ContiguousNodeID node, ContiguousBoundaryID boundary) const
 Get whether a node is on a boundary. More...
 

Private Member Functions

void initMap ()
 Initialize host maps. More...
 
void initElement ()
 Initialize device element data. More...
 

Private Attributes

MooseMesh_mesh
 Reference of the MOOSE mesh. More...
 
bool _initialized = false
 Flag whether the mesh was initialized. More...
 
std::shared_ptr< MeshMap_maps
 A shared pointer holding all the host maps to avoid deep copy. More...
 
unsigned int _elem_id_integer = libMesh::invalid_uint
 Element integer for Kokkos contiguous element ID. More...
 
unsigned int _node_id_integer = libMesh::invalid_uint
 Node integer for Kokkos contiguous node ID. More...
 
dof_id_type _num_local_elems = 0
 Number of local elements. More...
 
dof_id_type _num_ghost_elems = 0
 Number of ghost (off-process neighbor) elements. More...
 
dof_id_type _num_local_nodes = 0
 Number of local nodes including semi-local nodes. More...
 
Array< ElementInfo_elem_info
 Element information. More...
 
Array2D< ContiguousElementID_elem_neighbor
 Neighbor contiguous element IDs of each element. More...
 
Array< ContiguousElementID_starting_elem_id
 Starting contiguous element ID of each subdomain. More...
 
Array2D< dof_id_type_extra_elem_ids
 Extra element IDs. More...
 
Array< unsigned int_num_sides
 Number of sides of each element type. More...
 
Array< unsigned int_num_nodes
 Number of nodes of each element type. More...
 
Array< Array< unsigned int > > _num_side_nodes
 Number of nodes per side of each element side. More...
 
Array< Array2D< unsigned int > > _local_side_node
 Map from local side node index to local element node index. More...
 
Array< Real3_points
 Node coordinates. More...
 
Array2D< ContiguousNodeID_nodes
 Contiguous node IDs of each element. More...
 
Array< Array< ContiguousNodeID > > _boundary_nodes
 Contiguous node IDs on each boundary. More...
 
bool _element_geometry_initialized = false
 Whether initElementGeometry() has been called and the element geometry cache is populated. More...
 
bool _needs_element_geometry = false
 Whether initElementGeometry() should be called on the next update() More...
 
bool _element_side_geometry_initialized = false
 Whether initElementSideGeometry() has been called and the side geometry cache is populated. More...
 
bool _needs_element_side_geometry = false
 Whether initElementSideGeometry() should be called on the next update() More...
 
Array< Real_elem_volume
 Cached coordinate-weighted local element volumes indexed by contiguous element ID. More...
 
Array< Real3_elem_centroid
 Cached local element centroids indexed by contiguous element ID. More...
 
Array2D< Real_side_area
 Cached coordinate-weighted side areas indexed by (side, local contiguous element ID) More...
 
Array2D< Real3_side_centroid
 Cached side centroids indexed by (side, contiguous element ID) More...
 
Array2D< Real3_side_normal
 Cached side normals indexed by (side, contiguous element ID) More...
 
Array2D< Real3_elem_centroid_to_side_centroid
 Element-centroid to side-centroid vectors indexed by (side, contiguous element ID) More...
 
Array2D< Real_elem_centroid_to_side_centroid_distance
 Element-centroid to side-centroid distances indexed by (side, contiguous element ID) More...
 
Array2D< Real3_elem_centroid_to_neighbor_centroid
 Element-centroid to neighbor-centroid vectors indexed by (side, contiguous element ID) More...
 
Array2D< Real_elem_centroid_to_neighbor_centroid_distance
 Element-centroid to neighbor-centroid distances indexed by (side, contiguous element ID) More...
 
Array2D< BoundaryID_side_boundary_id
 Boundary IDs for each side indexed by (side, contiguous element ID) More...
 

Detailed Description

The Kokkos mesh object.

Definition at line 52 of file KokkosMesh.h.

Constructor & Destructor Documentation

◆ Mesh()

Moose::Kokkos::Mesh::Mesh ( MooseMesh mesh)
inline

Constructor.

Parameters
meshThe MOOSE mesh

Definition at line 59 of file KokkosMesh.h.

59 : _mesh(mesh) {}
MooseMesh & _mesh
Reference of the MOOSE mesh.
Definition: KokkosMesh.h:451

Member Function Documentation

◆ getBoundaryContiguousNodeIDs()

const auto& Moose::Kokkos::Mesh::getBoundaryContiguousNodeIDs ( const BoundaryID  boundary) const
inline

Get the list of local contiguous node IDs for a boundary NOTE: This list excludes semi-local nodes.

Parameters
boundaryThe MOOSE boundary ID
Returns
The list of local contiguous node IDs on the boundary

Definition at line 196 of file KokkosMesh.h.

197  {
198  return libmesh_map_find(_maps->boundary_node_ids, boundary);
199  }
std::shared_ptr< MeshMap > _maps
A shared pointer holding all the host maps to avoid deep copy.
Definition: KokkosMesh.h:505

◆ getContiguousBoundaryID()

ContiguousBoundaryID Moose::Kokkos::Mesh::getContiguousBoundaryID ( const BoundaryID  boundary) const

Get the contiguous boundary ID of a boundary.

Parameters
boundaryThe MOOSE boundary ID
Returns
The contiguous boundary ID

◆ getContiguousElementID()

ContiguousElementID Moose::Kokkos::Mesh::getContiguousElementID ( const Elem *  elem) const

Get the contiguous element ID of an element.

Parameters
elemThe libMesh element
Returns
The contiguous element ID

◆ getContiguousNodeID() [1/3]

ContiguousNodeID Moose::Kokkos::Mesh::getContiguousNodeID ( const Node *  node) const

Get the contiguous node ID of a node.

Parameters
nodeThe libMesh node
Returns
The contiguous node ID that starts from zero in each process

◆ getContiguousNodeID() [2/3]

KOKKOS_FUNCTION ContiguousNodeID Moose::Kokkos::Mesh::getContiguousNodeID ( ContiguousElementID  elem,
unsigned int  node 
) const
inline

Get the contiguous node ID for an element.

Parameters
elemThe contiguous element ID
nodeThe node index
Returns
The contiguous node ID

Definition at line 405 of file KokkosMesh.h.

407  {
408  return _nodes(node, elem);
409  }
Array2D< ContiguousNodeID > _nodes
Contiguous node IDs of each element.
Definition: KokkosMesh.h:566

◆ getContiguousNodeID() [3/3]

KOKKOS_FUNCTION ContiguousNodeID Moose::Kokkos::Mesh::getContiguousNodeID ( ElementInfo  info,
unsigned int  side,
unsigned int  node 
) const
inline

Get the contiguous node ID for a side.

Parameters
elemThe contiguous element ID
sideThe side index
nodeThe node index
Returns
The contiguous node ID

Definition at line 417 of file KokkosMesh.h.

420  {
421  return _nodes(_local_side_node[info.type](node, side), info.id);
422  }
Array< Array2D< unsigned int > > _local_side_node
Map from local side node index to local element node index.
Definition: KokkosMesh.h:558
MPI_Info info
Array2D< ContiguousNodeID > _nodes
Contiguous node IDs of each element.
Definition: KokkosMesh.h:566

◆ getContiguousSubdomainID()

ContiguousSubdomainID Moose::Kokkos::Mesh::getContiguousSubdomainID ( const SubdomainID  subdomain) const

Get the contiguous subdomain ID of a MOOSE subdomain.

Parameters
subdomainThe MOOSE subdomain ID
Returns
The contiguous subdomain ID

◆ getElementCentroid()

KOKKOS_FUNCTION Real3 Moose::Kokkos::Mesh::getElementCentroid ( ContiguousElementID  elem) const
inline

Get the centroid of a local element.

Parameters
elemThe local contiguous element ID
Returns
The element centroid

Definition at line 330 of file KokkosMesh.h.

Referenced by Moose::Kokkos::FVDatum::elementCentroid().

331  {
332  KOKKOS_ASSERT(_element_geometry_initialized);
333  KOKKOS_ASSERT(elem < _elem_centroid.size());
334  return _elem_centroid[elem];
335  }
Array< Real3 > _elem_centroid
Cached local element centroids indexed by contiguous element ID.
Definition: KokkosMesh.h:583
bool _element_geometry_initialized
Whether initElementGeometry() has been called and the element geometry cache is populated.
Definition: KokkosMesh.h:573

◆ getElementCentroidToNeighborCentroidDistance()

KOKKOS_FUNCTION Real Moose::Kokkos::Mesh::getElementCentroidToNeighborCentroidDistance ( ContiguousElementID  elem,
unsigned int  side 
) const
inline

Get the element-centroid to neighbor-centroid distance for an element side with a neighbor.

Parameters
elemThe contiguous element ID
sideThe side index
Returns
The element-centroid to neighbor-centroid distance, or zero when the side has no contiguous neighbor ID

Definition at line 299 of file KokkosMesh.h.

Referenced by Moose::Kokkos::FVDatum::faceDCNMag().

301  {
302  KOKKOS_ASSERT(_element_side_geometry_initialized);
304  }
bool _element_side_geometry_initialized
Whether initElementSideGeometry() has been called and the side geometry cache is populated.
Definition: KokkosMesh.h:577
Array2D< Real > _elem_centroid_to_neighbor_centroid_distance
Element-centroid to neighbor-centroid distances indexed by (side, contiguous element ID) ...
Definition: KokkosMesh.h:597

◆ getElementCentroidToNeighborCentroidVector()

KOKKOS_FUNCTION Real3 Moose::Kokkos::Mesh::getElementCentroidToNeighborCentroidVector ( ContiguousElementID  elem,
unsigned int  side 
) const
inline

Get the element-centroid to neighbor-centroid vector for an element side with a neighbor.

Parameters
elemThe contiguous element ID
sideThe side index
Returns
The element-centroid to neighbor-centroid vector, or a zero vector when the side has no contiguous neighbor ID

Definition at line 286 of file KokkosMesh.h.

288  {
289  KOKKOS_ASSERT(_element_side_geometry_initialized);
290  return _elem_centroid_to_neighbor_centroid(side, elem);
291  }
bool _element_side_geometry_initialized
Whether initElementSideGeometry() has been called and the side geometry cache is populated.
Definition: KokkosMesh.h:577
Array2D< Real3 > _elem_centroid_to_neighbor_centroid
Element-centroid to neighbor-centroid vectors indexed by (side, contiguous element ID) ...
Definition: KokkosMesh.h:595

◆ getElementCentroidToSideCentroidDistance()

KOKKOS_FUNCTION Real Moose::Kokkos::Mesh::getElementCentroidToSideCentroidDistance ( ContiguousElementID  elem,
unsigned int  side 
) const
inline

Get the element-centroid to side-centroid distance for an element side.

Parameters
elemThe contiguous element ID
sideThe side index
Returns
The element-centroid to side-centroid distance

Definition at line 273 of file KokkosMesh.h.

Referenced by Moose::Kokkos::FVDatum::faceDCFMag().

275  {
276  KOKKOS_ASSERT(_element_side_geometry_initialized);
277  return _elem_centroid_to_side_centroid_distance(side, elem);
278  }
bool _element_side_geometry_initialized
Whether initElementSideGeometry() has been called and the side geometry cache is populated.
Definition: KokkosMesh.h:577
Array2D< Real > _elem_centroid_to_side_centroid_distance
Element-centroid to side-centroid distances indexed by (side, contiguous element ID) ...
Definition: KokkosMesh.h:593

◆ getElementCentroidToSideCentroidVector()

KOKKOS_FUNCTION Real3 Moose::Kokkos::Mesh::getElementCentroidToSideCentroidVector ( ContiguousElementID  elem,
unsigned int  side 
) const
inline

Get the element-centroid to side-centroid vector for an element side.

Parameters
elemThe contiguous element ID
sideThe side index
Returns
The element-centroid to side-centroid vector

Definition at line 261 of file KokkosMesh.h.

263  {
264  KOKKOS_ASSERT(_element_side_geometry_initialized);
265  return _elem_centroid_to_side_centroid(side, elem);
266  }
bool _element_side_geometry_initialized
Whether initElementSideGeometry() has been called and the side geometry cache is populated.
Definition: KokkosMesh.h:577
Array2D< Real3 > _elem_centroid_to_side_centroid
Element-centroid to side-centroid vectors indexed by (side, contiguous element ID) ...
Definition: KokkosMesh.h:591

◆ getElementInfo()

KOKKOS_FUNCTION const auto& Moose::Kokkos::Mesh::getElementInfo ( ContiguousElementID  elem) const
inline

Get the element information object.

Parameters
elemThe contiguous element ID
Returns
The element information object

Definition at line 206 of file KokkosMesh.h.

Referenced by Moose::Kokkos::MeshDatum::neighborInfo().

207  {
208  KOKKOS_ASSERT(elem < _elem_info.size());
209 
210  return _elem_info[elem];
211  }
Array< ElementInfo > _elem_info
Element information.
Definition: KokkosMesh.h:530

◆ getElementTypeID()

unsigned int Moose::Kokkos::Mesh::getElementTypeID ( const Elem *  elem) const

Get the element type ID of an element.

Parameters
elemThe libMesh element
Returns
The element type ID

◆ getElementTypeMap()

const auto& Moose::Kokkos::Mesh::getElementTypeMap ( ) const
inline

Get the element type ID map.

Returns
The element type ID map

Definition at line 104 of file KokkosMesh.h.

104 { return _maps->elem_type_id_mapping; }
std::shared_ptr< MeshMap > _maps
A shared pointer holding all the host maps to avoid deep copy.
Definition: KokkosMesh.h:505

◆ getElementVolume()

KOKKOS_FUNCTION Real Moose::Kokkos::Mesh::getElementVolume ( ContiguousElementID  elem) const
inline

Get the coordinate-weighted volume of a local element.

Parameters
elemThe local contiguous element ID
Returns
The element volume including the coordinate transformation factor

Definition at line 319 of file KokkosMesh.h.

Referenced by Moose::Kokkos::FVDatum::elementVolume().

320  {
321  KOKKOS_ASSERT(_element_geometry_initialized);
322  KOKKOS_ASSERT(elem < _elem_volume.size());
323  return _elem_volume[elem];
324  }
Array< Real > _elem_volume
Cached coordinate-weighted local element volumes indexed by contiguous element ID.
Definition: KokkosMesh.h:581
KOKKOS_FUNCTION index_type size() const
Get the total array size.
Definition: KokkosArray.h:294
bool _element_geometry_initialized
Whether initElementGeometry() has been called and the element geometry cache is populated.
Definition: KokkosMesh.h:573

◆ getExtraElementID()

KOKKOS_FUNCTION dof_id_type Moose::Kokkos::Mesh::getExtraElementID ( ContiguousElementID  elem,
unsigned int  index 
) const
inline

Get the extra element ID of an element.

Parameters
elemThe contiguous element ID
indexThe extra element ID index
Returns
The extra element ID

Definition at line 383 of file KokkosMesh.h.

Referenced by Moose::Kokkos::Datum::extraElemID().

384  {
385  KOKKOS_ASSERT(elem < _extra_elem_ids.n(0));
386  KOKKOS_ASSERT(index < _extra_elem_ids.n(1));
387 
388  return _extra_elem_ids(elem, index);
389  }
Array2D< dof_id_type > _extra_elem_ids
Extra element IDs.
Definition: KokkosMesh.h:542

◆ getGhostElemIdMapping()

const auto& Moose::Kokkos::Mesh::getGhostElemIdMapping ( ) const
inline

Get the ghost element ID map (host-side only)

Returns
Map from ghost Elem* to contiguous element ID

Definition at line 163 of file KokkosMesh.h.

163 { return _maps->ghost_elem_id_mapping; }
std::shared_ptr< MeshMap > _maps
A shared pointer holding all the host maps to avoid deep copy.
Definition: KokkosMesh.h:505

◆ getLocalNodes()

const auto& Moose::Kokkos::Mesh::getLocalNodes ( ) const
inline

Get the list of local nodes including semi-local nodes.

Returns
The list of local nodes including semi-local nodes

Definition at line 134 of file KokkosMesh.h.

134 { return _maps->local_nodes; }
std::shared_ptr< MeshMap > _maps
A shared pointer holding all the host maps to avoid deep copy.
Definition: KokkosMesh.h:505

◆ getMesh()

const MooseMesh& Moose::Kokkos::Mesh::getMesh ( )
inline

Get the underyling MOOSE mesh.

Returns
The MOOSE mesh

Definition at line 64 of file KokkosMesh.h.

64 { return _mesh; }
MooseMesh & _mesh
Reference of the MOOSE mesh.
Definition: KokkosMesh.h:451

◆ getNeighbor()

KOKKOS_FUNCTION ContiguousElementID Moose::Kokkos::Mesh::getNeighbor ( ContiguousElementID  elem,
unsigned int  side 
) const
inline

Get the neighbor contiguous element ID.

Parameters
elemThe contiguous element ID
sideThe side index
Returns
The neighbor contiguous element ID

Definition at line 218 of file KokkosMesh.h.

Referenced by Moose::Kokkos::MeshDatum::neighborInfo().

219  {
220  return _elem_neighbor(side, elem);
221  }
Array2D< ContiguousElementID > _elem_neighbor
Neighbor contiguous element IDs of each element.
Definition: KokkosMesh.h:534

◆ getNodePoint()

KOKKOS_FUNCTION Real3 Moose::Kokkos::Mesh::getNodePoint ( ContiguousNodeID  node) const
inline

Get the coordinate of a node.

Parameters
nodeThe contiguous node ID
Returns
The node coordinate

Definition at line 428 of file KokkosMesh.h.

Referenced by Moose::Kokkos::Assembly::computePhysicalMap(), and Moose::Kokkos::Datum::q_point().

428 { return _points[node]; }
Array< Real3 > _points
Node coordinates.
Definition: KokkosMesh.h:562

◆ getNumLocalAndPossiblyOneNeighborLayerGhostElements()

dof_id_type Moose::Kokkos::Mesh::getNumLocalAndPossiblyOneNeighborLayerGhostElements ( ) const
inline

Get the total number of elements, i.e.

the local elements plus the ghost elements

Returns
The total number of elements

Definition at line 618 of file KokkosMesh.h.

619 {
621 }
dof_id_type _num_local_elems
Number of local elements.
Definition: KokkosMesh.h:518
dof_id_type _num_ghost_elems
Number of ghost (off-process neighbor) elements.
Definition: KokkosMesh.h:522

◆ getNumLocalElements()

dof_id_type Moose::Kokkos::Mesh::getNumLocalElements ( ) const
inline

Get the number of local elements.

Returns
The number of local elements

Definition at line 109 of file KokkosMesh.h.

109 { return _num_local_elems; }
dof_id_type _num_local_elems
Number of local elements.
Definition: KokkosMesh.h:518

◆ getNumLocalElementTypes()

auto Moose::Kokkos::Mesh::getNumLocalElementTypes ( ) const
inline

Get the number of local elements types.

Returns
The number of local element types

Definition at line 99 of file KokkosMesh.h.

99 { return _maps->elem_type_id_mapping.size(); }
std::shared_ptr< MeshMap > _maps
A shared pointer holding all the host maps to avoid deep copy.
Definition: KokkosMesh.h:505

◆ getNumLocalNodes()

auto Moose::Kokkos::Mesh::getNumLocalNodes ( ) const
inline

Get the number of local nodes including semi-local nodes.

Returns
The number of local nodes including semi-local nodes

Definition at line 129 of file KokkosMesh.h.

129 { return _num_local_nodes; }
dof_id_type _num_local_nodes
Number of local nodes including semi-local nodes.
Definition: KokkosMesh.h:526

◆ getNumNodes() [1/2]

KOKKOS_FUNCTION unsigned int Moose::Kokkos::Mesh::getNumNodes ( unsigned int  elem_type) const
inline

Get the number of nodes of an element type.

Parameters
elem_typeThe element type ID
Returns
The number of nodes of the element type

Definition at line 363 of file KokkosMesh.h.

Referenced by Moose::Kokkos::Assembly::computePhysicalMap().

364  {
365  return _num_nodes[elem_type];
366  }
Array< unsigned int > _num_nodes
Number of nodes of each element type.
Definition: KokkosMesh.h:550

◆ getNumNodes() [2/2]

KOKKOS_FUNCTION unsigned int Moose::Kokkos::Mesh::getNumNodes ( unsigned int  elem_type,
unsigned int  side 
) const
inline

Get the number of nodes on a side of an element type.

Parameters
elem_typeThe element type ID
sideThe side index
Returns
The number of nodes on the side of the element type

Definition at line 373 of file KokkosMesh.h.

374  {
375  return _num_side_nodes[elem_type][side];
376  }
Array< Array< unsigned int > > _num_side_nodes
Number of nodes per side of each element side.
Definition: KokkosMesh.h:554

◆ getNumSides()

KOKKOS_FUNCTION unsigned int Moose::Kokkos::Mesh::getNumSides ( unsigned int  elem_type) const
inline

Get the number of sides of an element type.

Parameters
elem_typeThe element type ID
Returns
The number of sides of the element type

Definition at line 354 of file KokkosMesh.h.

355  {
356  return _num_sides[elem_type];
357  }
Array< unsigned int > _num_sides
Number of sides of each element type.
Definition: KokkosMesh.h:546

◆ getNumSubdomainLocalElements()

auto Moose::Kokkos::Mesh::getNumSubdomainLocalElements ( const SubdomainID  subdomain) const
inline

Get the number of local elements in a MOOSE subdomain.

Parameters
subdomainThe MOOSE subdomain ID
Returns
The local number of elements in the subdomain

Definition at line 120 of file KokkosMesh.h.

121  {
122  auto range = libmesh_map_find(_maps->subdomain_elem_id_ranges, subdomain);
123  return range.second - range.first;
124  }
std::shared_ptr< MeshMap > _maps
A shared pointer holding all the host maps to avoid deep copy.
Definition: KokkosMesh.h:505

◆ getNumSubdomains()

auto Moose::Kokkos::Mesh::getNumSubdomains ( ) const
inline

Get the number of subdomains.

Returns
The number of subdomains

Definition at line 94 of file KokkosMesh.h.

94 { return _maps->subdomain_id_mapping.size(); }
std::shared_ptr< MeshMap > _maps
A shared pointer holding all the host maps to avoid deep copy.
Definition: KokkosMesh.h:505

◆ getSideArea()

KOKKOS_FUNCTION Real Moose::Kokkos::Mesh::getSideArea ( ContiguousElementID  elem,
unsigned int  side 
) const
inline

Get the coordinate-weighted area of an element side.

Parameters
elemThe local contiguous element ID
sideThe side index
Returns
The side area including the coordinate transformation factor

Definition at line 228 of file KokkosMesh.h.

Referenced by Moose::Kokkos::FVDatum::faceArea().

229  {
230  KOKKOS_ASSERT(_element_side_geometry_initialized);
231  return _side_area(side, elem);
232  }
bool _element_side_geometry_initialized
Whether initElementSideGeometry() has been called and the side geometry cache is populated.
Definition: KokkosMesh.h:577
Array2D< Real > _side_area
Cached coordinate-weighted side areas indexed by (side, local contiguous element ID) ...
Definition: KokkosMesh.h:585

◆ getSideBoundaryID()

KOKKOS_FUNCTION BoundaryID Moose::Kokkos::Mesh::getSideBoundaryID ( ContiguousElementID  elem,
unsigned int  side 
) const
inline
Returns
The boundary ID associated with an element side. If there is none, the returned value will be Moose::INVALID_BOUNDARY_ID

Definition at line 309 of file KokkosMesh.h.

310  {
311  KOKKOS_ASSERT(_element_side_geometry_initialized);
312  return _side_boundary_id(side, elem);
313  }
bool _element_side_geometry_initialized
Whether initElementSideGeometry() has been called and the side geometry cache is populated.
Definition: KokkosMesh.h:577
Array2D< BoundaryID > _side_boundary_id
Boundary IDs for each side indexed by (side, contiguous element ID)
Definition: KokkosMesh.h:599

◆ getSideCentroid()

KOKKOS_FUNCTION Real3 Moose::Kokkos::Mesh::getSideCentroid ( ContiguousElementID  elem,
unsigned int  side 
) const
inline

Get the centroid of an element side.

Parameters
elemThe contiguous element ID
sideThe side index
Returns
The side centroid

Definition at line 239 of file KokkosMesh.h.

Referenced by Moose::Kokkos::FVDatum::faceCentroid().

240  {
241  KOKKOS_ASSERT(_element_side_geometry_initialized);
242  return _side_centroid(side, elem);
243  }
bool _element_side_geometry_initialized
Whether initElementSideGeometry() has been called and the side geometry cache is populated.
Definition: KokkosMesh.h:577
Array2D< Real3 > _side_centroid
Cached side centroids indexed by (side, contiguous element ID)
Definition: KokkosMesh.h:587

◆ getSideNormal()

KOKKOS_FUNCTION Real3 Moose::Kokkos::Mesh::getSideNormal ( ContiguousElementID  elem,
unsigned int  side 
) const
inline

Get the outward unit normal of an element side.

Parameters
elemThe contiguous element ID
sideThe side index
Returns
The side normal

Definition at line 250 of file KokkosMesh.h.

Referenced by Moose::Kokkos::FVDatum::faceNormal().

251  {
252  KOKKOS_ASSERT(_element_side_geometry_initialized);
253  return _side_normal(side, elem);
254  }
bool _element_side_geometry_initialized
Whether initElementSideGeometry() has been called and the side geometry cache is populated.
Definition: KokkosMesh.h:577
Array2D< Real3 > _side_normal
Cached side normals indexed by (side, contiguous element ID)
Definition: KokkosMesh.h:589

◆ getStartingContiguousElementID()

KOKKOS_FUNCTION dof_id_type Moose::Kokkos::Mesh::getStartingContiguousElementID ( ContiguousSubdomainID  subdomain) const
inline

Get the starting contiguous element ID of a subdomain.

Parameters
subdomainThe contiguous subdomain ID
Returns
The starting contiguous element ID

Definition at line 395 of file KokkosMesh.h.

396  {
397  return _starting_elem_id[subdomain];
398  }
Array< ContiguousElementID > _starting_elem_id
Starting contiguous element ID of each subdomain.
Definition: KokkosMesh.h:538

◆ getSubdomainContiguousElementIDRange()

auto Moose::Kokkos::Mesh::getSubdomainContiguousElementIDRange ( const SubdomainID  subdomain) const
inline

Get the range of contiguous element IDs for a subdomain.

Parameters
subdomainThe MOOSE subdomain ID
Returns
The range of contiguous element IDs in the subdomain

Definition at line 169 of file KokkosMesh.h.

170  {
171  const auto & range = libmesh_map_find(_maps->subdomain_elem_id_ranges, subdomain);
172  return libMesh::make_range(range.first, range.second);
173  }
IntRange< T > make_range(T beg, T end)
std::shared_ptr< MeshMap > _maps
A shared pointer holding all the host maps to avoid deep copy.
Definition: KokkosMesh.h:505

◆ getSubdomainContiguousNodeIDs()

const auto& Moose::Kokkos::Mesh::getSubdomainContiguousNodeIDs ( const SubdomainID  subdomain) const
inline

Get the list of local contiguous node IDs for a subdomain NOTE: This list excludes semi-local nodes.

Parameters
subdomainThe MOOSE subdomain ID
Returns
The list of local contiguous node IDs in the subdomain

Definition at line 186 of file KokkosMesh.h.

187  {
188  return libmesh_map_find(_maps->subdomain_node_ids, subdomain);
189  }
std::shared_ptr< MeshMap > _maps
A shared pointer holding all the host maps to avoid deep copy.
Definition: KokkosMesh.h:505

◆ initElement()

void Moose::Kokkos::Mesh::initElement ( )
private

Initialize device element data.

◆ initElementGeometry()

void Moose::Kokkos::Mesh::initElementGeometry ( )

Allocate and populate local element centroids and coordinate-weighted volumes.

◆ initElementSideGeometry()

void Moose::Kokkos::Mesh::initElementSideGeometry ( )

Allocate and populate cached side geometry: side areas, centroids, normals, element-centroid to side-centroid and element-centroid to neighbor-centroid vectors and their magnitudes, and boundary IDs.

◆ initialized()

bool Moose::Kokkos::Mesh::initialized ( ) const
inline

Get whether the mesh was initialized.

Definition at line 68 of file KokkosMesh.h.

Referenced by Moose::Kokkos::MeshHolder::kokkosMesh().

68 { return _initialized; }
bool _initialized
Flag whether the mesh was initialized.
Definition: KokkosMesh.h:455

◆ initMap()

void Moose::Kokkos::Mesh::initMap ( )
private

Initialize host maps.

◆ isBoundaryNode()

KOKKOS_FUNCTION bool Moose::Kokkos::Mesh::isBoundaryNode ( ContiguousNodeID  node,
ContiguousBoundaryID  boundary 
) const
inline

Get whether a node is on a boundary.

Parameters
nodeThe contiguous node ID
boundaryThe contiguous boundary ID
Returns
Whether the node is on the boundary

Definition at line 604 of file KokkosMesh.h.

Referenced by KokkosBoundNodalKernel::skipOnBoundary().

605 {
606  if (!_boundary_nodes[boundary].size())
607  return false;
608 
609  auto begin = &_boundary_nodes[boundary].begin();
610  auto end = &_boundary_nodes[boundary].end();
611  auto target = Utils::find(node, begin, end);
612 
613  return target != end;
614 }
KOKKOS_INLINE_FUNCTION const T * find(const T &target, const T *const begin, const T *const end)
Find a value in an array.
Definition: KokkosUtils.h:40
Array< Array< ContiguousNodeID > > _boundary_nodes
Contiguous node IDs on each boundary.
Definition: KokkosMesh.h:570

◆ setNeedsElementGeometry()

void Moose::Kokkos::Mesh::setNeedsElementGeometry ( )
inline

Mark that element geometry data is needed; initElementGeometry() will be called on the next update()

Definition at line 78 of file KokkosMesh.h.

Referenced by setNeedsElementSideGeometry().

78 { _needs_element_geometry = true; }
bool _needs_element_geometry
Whether initElementGeometry() should be called on the next update()
Definition: KokkosMesh.h:575

◆ setNeedsElementSideGeometry()

void Moose::Kokkos::Mesh::setNeedsElementSideGeometry ( )
inline

Mark that element-side geometry data is needed; initElementSideGeometry() will be called on the next update()

Definition at line 84 of file KokkosMesh.h.

85  {
88  }
void setNeedsElementGeometry()
Mark that element geometry data is needed; initElementGeometry() will be called on the next update() ...
Definition: KokkosMesh.h:78
bool _needs_element_side_geometry
Whether initElementSideGeometry() should be called on the next update()
Definition: KokkosMesh.h:579

◆ update()

void Moose::Kokkos::Mesh::update ( )

Update the mesh.

Member Data Documentation

◆ _boundary_nodes

Array<Array<ContiguousNodeID> > Moose::Kokkos::Mesh::_boundary_nodes
private

Contiguous node IDs on each boundary.

Definition at line 570 of file KokkosMesh.h.

Referenced by isBoundaryNode().

◆ _elem_centroid

Array<Real3> Moose::Kokkos::Mesh::_elem_centroid
private

Cached local element centroids indexed by contiguous element ID.

Definition at line 583 of file KokkosMesh.h.

Referenced by getElementCentroid().

◆ _elem_centroid_to_neighbor_centroid

Array2D<Real3> Moose::Kokkos::Mesh::_elem_centroid_to_neighbor_centroid
private

Element-centroid to neighbor-centroid vectors indexed by (side, contiguous element ID)

Definition at line 595 of file KokkosMesh.h.

Referenced by getElementCentroidToNeighborCentroidVector().

◆ _elem_centroid_to_neighbor_centroid_distance

Array2D<Real> Moose::Kokkos::Mesh::_elem_centroid_to_neighbor_centroid_distance
private

Element-centroid to neighbor-centroid distances indexed by (side, contiguous element ID)

Definition at line 597 of file KokkosMesh.h.

Referenced by getElementCentroidToNeighborCentroidDistance().

◆ _elem_centroid_to_side_centroid

Array2D<Real3> Moose::Kokkos::Mesh::_elem_centroid_to_side_centroid
private

Element-centroid to side-centroid vectors indexed by (side, contiguous element ID)

Definition at line 591 of file KokkosMesh.h.

Referenced by getElementCentroidToSideCentroidVector().

◆ _elem_centroid_to_side_centroid_distance

Array2D<Real> Moose::Kokkos::Mesh::_elem_centroid_to_side_centroid_distance
private

Element-centroid to side-centroid distances indexed by (side, contiguous element ID)

Definition at line 593 of file KokkosMesh.h.

Referenced by getElementCentroidToSideCentroidDistance().

◆ _elem_id_integer

unsigned int Moose::Kokkos::Mesh::_elem_id_integer = libMesh::invalid_uint
private

Element integer for Kokkos contiguous element ID.

Definition at line 510 of file KokkosMesh.h.

◆ _elem_info

Array<ElementInfo> Moose::Kokkos::Mesh::_elem_info
private

Element information.

Definition at line 530 of file KokkosMesh.h.

Referenced by getElementInfo().

◆ _elem_neighbor

Array2D<ContiguousElementID> Moose::Kokkos::Mesh::_elem_neighbor
private

Neighbor contiguous element IDs of each element.

Definition at line 534 of file KokkosMesh.h.

Referenced by getNeighbor().

◆ _elem_volume

Array<Real> Moose::Kokkos::Mesh::_elem_volume
private

Cached coordinate-weighted local element volumes indexed by contiguous element ID.

Definition at line 581 of file KokkosMesh.h.

Referenced by getElementVolume().

◆ _element_geometry_initialized

bool Moose::Kokkos::Mesh::_element_geometry_initialized = false
private

Whether initElementGeometry() has been called and the element geometry cache is populated.

Definition at line 573 of file KokkosMesh.h.

Referenced by getElementCentroid(), and getElementVolume().

◆ _element_side_geometry_initialized

bool Moose::Kokkos::Mesh::_element_side_geometry_initialized = false
private

◆ _extra_elem_ids

Array2D<dof_id_type> Moose::Kokkos::Mesh::_extra_elem_ids
private

Extra element IDs.

Definition at line 542 of file KokkosMesh.h.

Referenced by getExtraElementID().

◆ _initialized

bool Moose::Kokkos::Mesh::_initialized = false
private

Flag whether the mesh was initialized.

Definition at line 455 of file KokkosMesh.h.

Referenced by initialized().

◆ _local_side_node

Array<Array2D<unsigned int> > Moose::Kokkos::Mesh::_local_side_node
private

Map from local side node index to local element node index.

Definition at line 558 of file KokkosMesh.h.

Referenced by getContiguousNodeID().

◆ _maps

std::shared_ptr<MeshMap> Moose::Kokkos::Mesh::_maps
private

◆ _mesh

MooseMesh& Moose::Kokkos::Mesh::_mesh
private

Reference of the MOOSE mesh.

Definition at line 451 of file KokkosMesh.h.

Referenced by getMesh().

◆ _needs_element_geometry

bool Moose::Kokkos::Mesh::_needs_element_geometry = false
private

Whether initElementGeometry() should be called on the next update()

Definition at line 575 of file KokkosMesh.h.

Referenced by setNeedsElementGeometry().

◆ _needs_element_side_geometry

bool Moose::Kokkos::Mesh::_needs_element_side_geometry = false
private

Whether initElementSideGeometry() should be called on the next update()

Definition at line 579 of file KokkosMesh.h.

Referenced by setNeedsElementSideGeometry().

◆ _node_id_integer

unsigned int Moose::Kokkos::Mesh::_node_id_integer = libMesh::invalid_uint
private

Node integer for Kokkos contiguous node ID.

Definition at line 514 of file KokkosMesh.h.

◆ _nodes

Array2D<ContiguousNodeID> Moose::Kokkos::Mesh::_nodes
private

Contiguous node IDs of each element.

Definition at line 566 of file KokkosMesh.h.

Referenced by getContiguousNodeID().

◆ _num_ghost_elems

dof_id_type Moose::Kokkos::Mesh::_num_ghost_elems = 0
private

Number of ghost (off-process neighbor) elements.

Definition at line 522 of file KokkosMesh.h.

Referenced by getNumLocalAndPossiblyOneNeighborLayerGhostElements().

◆ _num_local_elems

dof_id_type Moose::Kokkos::Mesh::_num_local_elems = 0
private

Number of local elements.

Definition at line 518 of file KokkosMesh.h.

Referenced by getNumLocalAndPossiblyOneNeighborLayerGhostElements(), and getNumLocalElements().

◆ _num_local_nodes

dof_id_type Moose::Kokkos::Mesh::_num_local_nodes = 0
private

Number of local nodes including semi-local nodes.

Definition at line 526 of file KokkosMesh.h.

Referenced by getNumLocalNodes().

◆ _num_nodes

Array<unsigned int> Moose::Kokkos::Mesh::_num_nodes
private

Number of nodes of each element type.

Definition at line 550 of file KokkosMesh.h.

Referenced by getNumNodes().

◆ _num_side_nodes

Array<Array<unsigned int> > Moose::Kokkos::Mesh::_num_side_nodes
private

Number of nodes per side of each element side.

Definition at line 554 of file KokkosMesh.h.

Referenced by getNumNodes().

◆ _num_sides

Array<unsigned int> Moose::Kokkos::Mesh::_num_sides
private

Number of sides of each element type.

Definition at line 546 of file KokkosMesh.h.

Referenced by getNumSides().

◆ _points

Array<Real3> Moose::Kokkos::Mesh::_points
private

Node coordinates.

Definition at line 562 of file KokkosMesh.h.

Referenced by getNodePoint().

◆ _side_area

Array2D<Real> Moose::Kokkos::Mesh::_side_area
private

Cached coordinate-weighted side areas indexed by (side, local contiguous element ID)

Definition at line 585 of file KokkosMesh.h.

Referenced by getSideArea().

◆ _side_boundary_id

Array2D<BoundaryID> Moose::Kokkos::Mesh::_side_boundary_id
private

Boundary IDs for each side indexed by (side, contiguous element ID)

Definition at line 599 of file KokkosMesh.h.

Referenced by getSideBoundaryID().

◆ _side_centroid

Array2D<Real3> Moose::Kokkos::Mesh::_side_centroid
private

Cached side centroids indexed by (side, contiguous element ID)

Definition at line 587 of file KokkosMesh.h.

Referenced by getSideCentroid().

◆ _side_normal

Array2D<Real3> Moose::Kokkos::Mesh::_side_normal
private

Cached side normals indexed by (side, contiguous element ID)

Definition at line 589 of file KokkosMesh.h.

Referenced by getSideNormal().

◆ _starting_elem_id

Array<ContiguousElementID> Moose::Kokkos::Mesh::_starting_elem_id
private

Starting contiguous element ID of each subdomain.

Definition at line 538 of file KokkosMesh.h.

Referenced by getStartingContiguousElementID().


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