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 (const MooseMesh &mesh)
 Constructor. More...
 
const MooseMeshgetMesh ()
 Get the underyling MOOSE mesh. More...
 
void update ()
 Update the mesh. 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 & getElementTypeMap () const
 Get the element type ID map. More...
 
const auto & getContiguousElementMap () const
 Get the contiguous element ID map. More...
 
const auto & getSubdomainContiguousElementIDs (const SubdomainID subdomain) const
 Get the list 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 & getContiguousNodeMap () const
 Get the contiguous node ID map This list contains the nodes of local elements, so some nodes may belong to other processes. More...
 
const auto & getSubdomainContiguousNodeIDs (const SubdomainID subdomain) const
 Get the list of contiguous node IDs for a subdomain This list strictly contains the nodes local to the current process. 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 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 ContiguousNodeID getContiguousNodeID (ContiguousElementID elem, unsigned int node) const
 Get the contiguous node ID for an element. More...
 
KOKKOS_FUNCTION ContiguousNodeID getContiguousNodeID (ContiguousElementID elem, 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

const MooseMesh_mesh
 Reference of the MOOSE mesh. More...
 
std::shared_ptr< MeshMap_maps
 A shared pointer holding all the host maps to avoid deep copy. More...
 
Array< ElementInfo_elem_info
 Element information. More...
 
Array2D< ContiguousElementID_elem_neighbor
 Neighbor contiguous element IDs of each element. 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< Real3_points
 Node coordinates. More...
 
Array< Array< ContiguousNodeID > > _boundary_nodes
 Contiguous node IDs on each boundary. More...
 
Array2D< ContiguousNodeID_nodes
 Contiguous node IDs of each element and side. More...
 
Array3D< ContiguousNodeID_nodes_face
 

Detailed Description

The Kokkos mesh object.

Definition at line 54 of file KokkosMesh.h.

Constructor & Destructor Documentation

◆ Mesh()

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

Constructor.

Parameters
meshThe MOOSE mesh

Definition at line 61 of file KokkosMesh.h.

61 : _mesh(mesh) {}
const MooseMesh & _mesh
Reference of the MOOSE mesh.
Definition: KokkosMesh.h:238

Member Function Documentation

◆ 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

◆ getContiguousElementMap()

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

Get the contiguous element ID map.

Returns
The contiguous element ID map

Definition at line 105 of file KokkosMesh.h.

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

◆ 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 192 of file KokkosMesh.h.

194  {
195  return _nodes(node, elem);
196  }
Array2D< ContiguousNodeID > _nodes
Contiguous node IDs of each element and side.
Definition: KokkosMesh.h:308

◆ getContiguousNodeID() [3/3]

KOKKOS_FUNCTION ContiguousNodeID Moose::Kokkos::Mesh::getContiguousNodeID ( ContiguousElementID  elem,
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 204 of file KokkosMesh.h.

207  {
208  return _nodes_face(node, side, elem);
209  }
Array3D< ContiguousNodeID > _nodes_face
Definition: KokkosMesh.h:309

◆ getContiguousNodeMap()

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

Get the contiguous node ID map This list contains the nodes of local elements, so some nodes may belong to other processes.

Returns
The contiguous node ID map

Definition at line 126 of file KokkosMesh.h.

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

◆ 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

◆ 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 144 of file KokkosMesh.h.

145  {
146  return _elem_info[elem];
147  }
Array< ElementInfo > _elem_info
Element information.
Definition: KokkosMesh.h:283

◆ 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 100 of file KokkosMesh.h.

100 { 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:278

◆ getMesh()

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

Get the underyling MOOSE mesh.

Returns
The MOOSE mesh

Definition at line 66 of file KokkosMesh.h.

66 { return _mesh; }
const MooseMesh & _mesh
Reference of the MOOSE mesh.
Definition: KokkosMesh.h:238

◆ 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 154 of file KokkosMesh.h.

155  {
156  return _elem_neighbor(side, elem);
157  }
Array2D< ContiguousElementID > _elem_neighbor
Neighbor contiguous element IDs of each element.
Definition: KokkosMesh.h:287

◆ 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 215 of file KokkosMesh.h.

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

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

◆ 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 172 of file KokkosMesh.h.

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

173  {
174  return _num_nodes[elem_type];
175  }
Array< unsigned int > _num_nodes
Number of nodes of each element type.
Definition: KokkosMesh.h:295

◆ 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 182 of file KokkosMesh.h.

183  {
184  return _num_side_nodes[elem_type][side];
185  }
Array< Array< unsigned int > > _num_side_nodes
number of nodes per side of each element side
Definition: KokkosMesh.h:299

◆ 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 163 of file KokkosMesh.h.

164  {
165  return _num_sides[elem_type];
166  }
Array< unsigned int > _num_sides
Number of sides of each element type.
Definition: KokkosMesh.h:291

◆ getSubdomainContiguousElementIDs()

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

Get the list of contiguous element IDs for a subdomain.

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

Definition at line 111 of file KokkosMesh.h.

112  {
113  return _maps->_subdomain_elem_ids.at(subdomain);
114  }
std::shared_ptr< MeshMap > _maps
A shared pointer holding all the host maps to avoid deep copy.
Definition: KokkosMesh.h:278

◆ getSubdomainContiguousNodeIDs()

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

Get the list of contiguous node IDs for a subdomain This list strictly contains the nodes local to the current process.

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

Definition at line 133 of file KokkosMesh.h.

134  {
135  return _maps->_subdomain_node_ids.at(subdomain);
136  }
std::shared_ptr< MeshMap > _maps
A shared pointer holding all the host maps to avoid deep copy.
Definition: KokkosMesh.h:278

◆ initElement()

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

Initialize device element data.

◆ 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 319 of file KokkosMesh.h.

320 {
321  if (!_boundary_nodes[boundary].size())
322  return false;
323 
324  auto begin = &_boundary_nodes[boundary].begin();
325  auto end = &_boundary_nodes[boundary].end();
326  auto target = Utils::find(node, begin, end);
327 
328  return target != end;
329 }
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:30
Array< Array< ContiguousNodeID > > _boundary_nodes
Contiguous node IDs on each boundary.
Definition: KokkosMesh.h:314

◆ 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 314 of file KokkosMesh.h.

Referenced by isBoundaryNode().

◆ _elem_info

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

Element information.

Definition at line 283 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 287 of file KokkosMesh.h.

Referenced by getNeighbor().

◆ _maps

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

A shared pointer holding all the host maps to avoid deep copy.

Definition at line 278 of file KokkosMesh.h.

Referenced by getContiguousElementMap(), getContiguousNodeMap(), getElementTypeMap(), getSubdomainContiguousElementIDs(), and getSubdomainContiguousNodeIDs().

◆ _mesh

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

Reference of the MOOSE mesh.

Definition at line 238 of file KokkosMesh.h.

Referenced by getMesh().

◆ _nodes

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

Contiguous node IDs of each element and side.

Definition at line 308 of file KokkosMesh.h.

Referenced by getContiguousNodeID().

◆ _nodes_face

Array3D<ContiguousNodeID> Moose::Kokkos::Mesh::_nodes_face
private

Definition at line 309 of file KokkosMesh.h.

Referenced by getContiguousNodeID().

◆ _num_nodes

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

Number of nodes of each element type.

Definition at line 295 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 299 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 291 of file KokkosMesh.h.

Referenced by getNumSides().

◆ _points

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

Node coordinates.

Definition at line 303 of file KokkosMesh.h.

Referenced by getNodePoint().


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