14 #ifdef MOOSE_KOKKOS_SCOPE 122 auto range = libmesh_map_find(
_maps->subdomain_elem_id_ranges, subdomain);
123 return range.second - range.first;
171 const auto & range = libmesh_map_find(
_maps->subdomain_elem_id_ranges, subdomain);
188 return libmesh_map_find(
_maps->subdomain_node_ids, subdomain);
198 return libmesh_map_find(
_maps->boundary_node_ids, boundary);
200 #ifdef MOOSE_KOKKOS_SCOPE 262 unsigned int side)
const 274 unsigned int side)
const 287 unsigned int side)
const 300 unsigned int side)
const 354 KOKKOS_FUNCTION
unsigned int getNumSides(
unsigned int elem_type)
const 363 KOKKOS_FUNCTION
unsigned int getNumNodes(
unsigned int elem_type)
const 373 KOKKOS_FUNCTION
unsigned int getNumNodes(
unsigned int elem_type,
unsigned int side)
const 406 unsigned int node)
const 408 return _nodes(node, elem);
419 unsigned int node)
const 489 std::unordered_map<SubdomainID, std::pair<ContiguousElementID, ContiguousElementID>>
602 #ifdef MOOSE_KOKKOS_SCOPE 603 KOKKOS_FUNCTION
inline bool 613 return target != end;
645 #ifdef MOOSE_KOKKOS_SCOPE 655 "kokkosMesh() was called too early. Kokkos mesh is available after problem " 656 "initialization. Override initialSetup() if you need to setup your object data " 657 "using the Kokkos mesh.");
Array2D< dof_id_type > _extra_elem_ids
Extra element IDs.
auto getNumSubdomainLocalElements(const SubdomainID subdomain) const
Get the number of local elements in a MOOSE subdomain.
const auto & getElementTypeMap() const
Get the element type ID map.
KOKKOS_FUNCTION Real getElementVolume(ContiguousElementID elem) const
Get the coordinate-weighted volume of a local element.
const auto & getGhostElemIdMapping() const
Get the ghost element ID map (host-side only)
Array< Array2D< unsigned int > > _local_side_node
Map from local side node index to local element node index.
KOKKOS_INLINE_FUNCTION const T * find(const T &target, const T *const begin, const T *const end)
Find a value in an array.
The Kokkos object that contains the information of an element The IDs used in Kokkos are different fr...
The wrapper of host maps.
bool _needs_element_geometry
Whether initElementGeometry() should be called on the next update()
Array< ContiguousElementID > _starting_elem_id
Starting contiguous element ID of each subdomain.
KOKKOS_FUNCTION Real3 getElementCentroid(ContiguousElementID elem) const
Get the centroid of a local element.
const unsigned int invalid_uint
std::unordered_map< BoundaryID, ContiguousBoundaryID > boundary_id_mapping
Map from the MOOSE boundary ID to the contiguous boundary ID.
void initElement()
Initialize device element data.
bool _initialized
Flag whether the mesh was initialized.
Array< Real > _elem_volume
Cached coordinate-weighted local element volumes indexed by contiguous element ID.
dof_id_type ContiguousElementID
void mooseError(Args &&... args)
Emit an error message with the given stringified, concatenated args and terminate the application...
KOKKOS_FUNCTION dof_id_type getStartingContiguousElementID(ContiguousSubdomainID subdomain) const
Get the starting contiguous element ID of a subdomain.
KOKKOS_FUNCTION Real3 getSideNormal(ContiguousElementID elem, unsigned int side) const
Get the outward unit normal of an element side.
void initMap()
Initialize host maps.
BoundaryID ContiguousBoundaryID
unsigned int _elem_id_integer
Element integer for Kokkos contiguous element ID.
KOKKOS_FUNCTION BoundaryID getSideBoundaryID(ContiguousElementID elem, unsigned int side) const
void initElementGeometry()
Allocate and populate local element centroids and coordinate-weighted volumes.
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...
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...
bool _element_side_geometry_initialized
Whether initElementSideGeometry() has been called and the side geometry cache is populated.
std::vector< Node * > local_nodes
List of local nodes including semi-local nodes.
The Kokkos interface that holds the host reference of the Kokkos mesh and copies it to device during ...
dof_id_type _num_local_elems
Number of local elements.
KOKKOS_FUNCTION bool isBoundaryNode(ContiguousNodeID node, ContiguousBoundaryID boundary) const
Get whether a node is on a boundary.
Array2D< Real3 > _side_centroid
Cached side centroids indexed by (side, contiguous element ID)
auto max(const L &left, const R &right)
auto getNumSubdomains() const
Get the number of subdomains.
ContiguousNodeID getContiguousNodeID(const Node *node) const
Get the contiguous node ID of a node.
Array< Array< ContiguousNodeID > > _boundary_nodes
Contiguous node IDs on each boundary.
KOKKOS_FUNCTION unsigned int getNumNodes(unsigned int elem_type) const
Get the number of nodes of an element type.
Mesh(MooseMesh &mesh)
Constructor.
KOKKOS_FUNCTION ContiguousNodeID getContiguousNodeID(ElementInfo info, unsigned int side, unsigned int node) const
Get the contiguous node ID for a side.
const MooseMesh & getMesh()
Get the underyling MOOSE mesh.
bool initialized() const
Get whether the mesh was initialized.
static constexpr dof_id_type invalid_id
dof_id_type ContiguousNodeID
const Mesh _mesh_device
Device copy of the Kokkos mesh.
std::unordered_map< ElemType, unsigned int > elem_type_id_mapping
Map from the MOOSE element type to the element type ID.
void setNeedsElementGeometry()
Mark that element geometry data is needed; initElementGeometry() will be called on the next update() ...
boundary_id_type BoundaryID
KOKKOS_FUNCTION Real getElementCentroidToSideCentroidDistance(ContiguousElementID elem, unsigned int side) const
Get the element-centroid to side-centroid distance for an element side.
std::unordered_map< SubdomainID, ContiguousSubdomainID > subdomain_id_mapping
Map from the MOOSE subdomain ID to the contiguous subdomain ID.
dof_id_type _num_local_nodes
Number of local nodes including semi-local nodes.
KOKKOS_FUNCTION ContiguousElementID getNeighbor(ContiguousElementID elem, unsigned int side) const
Get the neighbor contiguous element ID.
MooseMesh wraps a libMesh::Mesh object and enhances its capabilities by caching additional data and s...
std::unordered_map< const Elem *, ContiguousElementID > ghost_elem_id_mapping
Map from off-process ghost Elem* to its contiguous element ID on this process.
unsigned int type
Element type ID.
MeshHolder(const Mesh &mesh)
Constructor.
std::unordered_map< SubdomainID, std::pair< ContiguousElementID, ContiguousElementID > > subdomain_elem_id_ranges
Range of the contiguous element IDs in each subdomain.
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.
KOKKOS_FUNCTION index_type size() const
Get the total array size.
KOKKOS_FUNCTION const auto & getElementInfo(ContiguousElementID elem) const
Get the element information object.
subdomain_id_type SubdomainID
Array2D< ContiguousNodeID > _nodes
Contiguous node IDs of each element.
std::unordered_map< BoundaryID, std::set< ContiguousNodeID > > boundary_node_ids
List of the contiguous node IDs on each boundary NOTE: This list excludes semi-local nodes...
KOKKOS_FUNCTION dof_id_type getExtraElementID(ContiguousElementID elem, unsigned int index) const
Get the extra element ID of an element.
Array2D< ContiguousElementID > _elem_neighbor
Neighbor contiguous element IDs of each element.
KOKKOS_FUNCTION Real3 getSideCentroid(ContiguousElementID elem, unsigned int side) const
Get the centroid of an element side.
void setNeedsElementSideGeometry()
Mark that element-side geometry data is needed; initElementSideGeometry() will be called on the next ...
auto getNumLocalElementTypes() const
Get the number of local elements types.
bool _needs_element_side_geometry
Whether initElementSideGeometry() should be called on the next update()
KOKKOS_FUNCTION Real3 getNodePoint(ContiguousNodeID node) const
Get the coordinate of a node.
Array2D< Real > _elem_centroid_to_side_centroid_distance
Element-centroid to side-centroid distances indexed by (side, contiguous element ID) ...
KOKKOS_FUNCTION const Mesh & kokkosMesh() const
Get the const reference of the Kokkos mesh.
MeshHolder(const MeshHolder &holder)
Copy constructor.
ContiguousSubdomainID subdomain
Contiguous subdomain ID.
Array2D< Real3 > _side_normal
Cached side normals indexed by (side, contiguous element ID)
auto getNumLocalNodes() const
Get the number of local nodes including semi-local nodes.
Array2D< Real3 > _elem_centroid_to_neighbor_centroid
Element-centroid to neighbor-centroid vectors indexed by (side, contiguous element ID) ...
KOKKOS_FUNCTION Real getSideArea(ContiguousElementID elem, unsigned int side) const
Get the coordinate-weighted area of an element side.
DIE A HORRIBLE DEATH HERE typedef LIBMESH_DEFAULT_SCALAR_TYPE Real
Array< Real3 > _points
Node coordinates.
Array< unsigned int > _num_sides
Number of sides of each element type.
ContiguousBoundaryID getContiguousBoundaryID(const BoundaryID boundary) const
Get the contiguous boundary ID of a boundary.
Array2D< Real3 > _elem_centroid_to_side_centroid
Element-centroid to side-centroid vectors indexed by (side, contiguous element ID) ...
dof_id_type getNumLocalElements() const
Get the number of local elements.
KOKKOS_FUNCTION unsigned int getNumSides(unsigned int elem_type) const
Get the number of sides of an element type.
IntRange< T > make_range(T beg, T end)
MooseMesh & _mesh
Reference of the MOOSE mesh.
Array< Real3 > _elem_centroid
Cached local element centroids indexed by contiguous element ID.
Array2D< Real > _elem_centroid_to_neighbor_centroid_distance
Element-centroid to neighbor-centroid distances indexed by (side, contiguous element ID) ...
const auto & getLocalNodes() const
Get the list of local nodes including semi-local nodes.
Array2D< Real > _side_area
Cached coordinate-weighted side areas indexed by (side, local contiguous element ID) ...
unsigned int _node_id_integer
Node integer for Kokkos contiguous node ID.
const Mesh & _mesh_host
Host reference of the Kokkos mesh.
ContiguousElementID getContiguousElementID(const Elem *elem) const
Get the contiguous element ID of an element.
std::unordered_map< const Node *, ContiguousNodeID > ghost_node_id_mapping
Map from off-process ghost node to the contiguous node ID.
void update()
Update the mesh.
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.
ContiguousSubdomainID getContiguousSubdomainID(const SubdomainID subdomain) const
Get the contiguous subdomain ID of a MOOSE subdomain.
void initElementSideGeometry()
Allocate and populate cached side geometry: side areas, centroids, normals, element-centroid to side-...
KOKKOS_FUNCTION ContiguousNodeID getContiguousNodeID(ContiguousElementID elem, unsigned int node) const
Get the contiguous node ID for an element.
dof_id_type getNumLocalAndPossiblyOneNeighborLayerGhostElements() const
Get the total number of elements, i.e.
Array2D< BoundaryID > _side_boundary_id
Boundary IDs for each side indexed by (side, contiguous element ID)
std::shared_ptr< MeshMap > _maps
A shared pointer holding all the host maps to avoid deep copy.
Array< ElementInfo > _elem_info
Element information.
bool _element_geometry_initialized
Whether initElementGeometry() has been called and the element geometry cache is populated.
KOKKOS_FUNCTION Real3 getElementCentroidToSideCentroidVector(ContiguousElementID elem, unsigned int side) const
Get the element-centroid to side-centroid vector for an element side.
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...
unsigned int getElementTypeID(const Elem *elem) const
Get the element type ID of an element.
Array< Array< unsigned int > > _num_side_nodes
Number of nodes per side of each element side.
auto getSubdomainContiguousElementIDRange(const SubdomainID subdomain) const
Get the range of contiguous element IDs for a subdomain.
Array< unsigned int > _num_nodes
Number of nodes of each element type.
dof_id_type _num_ghost_elems
Number of ghost (off-process neighbor) elements.
std::unordered_map< SubdomainID, std::vector< ContiguousNodeID > > subdomain_node_ids
List of the contiguous node IDs in each subdomain NOTE: This list excludes semi-local nodes...