3D specfem::assembly::mesh

template<>
struct mesh<specfem::element::dimension_tag::dim3> : public specfem::assembly::mesh_impl::mesh_to_compute_mapping<specfem::element::dimension_tag::dim3>, public specfem::assembly::mesh_impl::points<specfem::element::dimension_tag::dim3>, public specfem::assembly::mesh_impl::quadrature<specfem::element::dimension_tag::dim3>, public specfem::assembly::mesh_impl::control_nodes<specfem::element::dimension_tag::dim3>, public specfem::assembly::mesh_impl::shape_functions<specfem::element::dimension_tag::dim3>, public specfem::assembly::mesh_impl::adjacency_graph<specfem::element::dimension_tag::dim3>

3D assembly mesh for spectral element computations.

Combines mesh components (points, control nodes, shape functions, quadrature) for efficient 3D hexahedral spectral element assembly operations.

Inherits functionality from:

  • points: Quadrature point coordinates and indexing

  • quadrature: GLL quadrature points and weights

  • control_nodes: Element control node data

  • shape_functions: Shape function values and derivatives

Public Types

using IndexMappingViewType = Kokkos::View<int****, Kokkos::LayoutLeft, Kokkos::DefaultExecutionSpace>

Index mapping view type.

Dimensions: [nspec, ngllz, nglly, ngllx] for local-to-global mapping.

using CoordViewType = Kokkos::View<type_real*****, Kokkos::LayoutLeft, Kokkos::DefaultExecutionSpace>

Coordinate view type.

Dimensions: [ndim, nspec, ngllz, nglly, ngllx] for (x, y, z) coordinates.

using ControlNodeCoordinatesView = Kokkos::View<type_real***, Kokkos::LayoutLeft, Kokkos::DefaultExecutionSpace>

Kokkos view type for 3D coordinate storage.

Dimensions: [nspec, ngnod, 3] for (x, y, z) coordinates.

using ControlNodeIndexView = Kokkos::View<int**, Kokkos::LayoutLeft, Kokkos::DefaultExecutionSpace>

Kokkos view type for node index mapping.

Dimensions: [nspec, ngnod] for element-to-node mapping.

using ShapeFunctionViewType = Kokkos::View<type_real****, Kokkos::LayoutRight, Kokkos::DefaultExecutionSpace>

Shape function view type.

Dimensions: [ngllz, nglly, ngllx, ngnod].

using DShapeFunctionViewType = Kokkos::View<type_real*****, Kokkos::LayoutRight, Kokkos::DefaultExecutionSpace>

Shape function derivative view type.

Dimensions: [ngllz, nglly, ngllx, ndim, ngnod].

Public Functions

mesh() = default

Default constructor.

mesh(const int nspec, const int ngnod, const int ngllz, const int nglly, const int ngllx, const specfem::mesh::tags<dimension_tag> &tags, const specfem::mesh::adjacency_graph<dimension_tag> &adjacency_graph, const specfem::mesh::control_nodes<dimension_tag> &control_nodes, const specfem::quadrature::quadratures &quadrature)

Constructor from mesh components.

Builds 3D assembly mesh from source mesh data.

Parameters:
  • nspec – Number of spectral elements

  • ngnod – Number of control nodes per element

  • ngllz – Number of GLL points in z direction

  • nglly – Number of GLL points in y direction

  • ngllx – Number of GLL points in x direction

  • adjacency_graph – Element connectivity

  • control_nodes – Element control node data

  • quadrature – GLL quadrature information

void assert_symmetry() const

Verify graph symmetry for undirected adjacency relationships.

Validates that the adjacency graph correctly represents undirected element connections by ensuring that for every edge (u,v) there exists a corresponding edge (v,u) with compatible properties. This is essential for spectral element methods where interface coupling is symmetric.

// Validate graph consistency after construction
try {
    adj_graph.assert_symmetry();
    std::cout << "Graph adjacency is symmetric" << std::endl;
} catch (const std::runtime_error& e) {
    std::cerr << "Adjacency error: " << e.what() << std::endl;
}

Throws:

std::runtime_error – if asymmetric adjacency is detected

Public Members

int nspec

Number of spectral elements.

int ngnod

Number of control nodes per element.

specfem::mesh_entity::element<dimension_tag> element_grid

3D GLL grid info

ViewType compute_to_mesh

Mapping from compute ordering to mesh ordering

ViewType mesh_to_compute

Mapping from mesh ordering to compute ordering

ViewType::host_mirror_type h_compute_to_mesh

Host mirror for compute_to_mesh

ViewType::host_mirror_type h_mesh_to_compute

Host mirror for mesh_to_compute

IndexMappingViewType index_mapping

Device index mapping.

IndexMappingViewType::host_mirror_type h_index_mapping

Host index mapping

CoordViewType coord

Device coordinates.

CoordViewType::host_mirror_type h_coord

Host coordinates.

type_real xmin

Minimum x coordinate (for tolerance calculations)

type_real xmax

Maximum x coordinate (for tolerance calculations)

type_real ymin

Minimum y coordinate (for tolerance calculations)

type_real ymax

Maximum y coordinate (for tolerance calculations)

type_real zmin

Minimum z coordinate (for tolerance calculations)

type_real zmax

Maximum z coordinate (for tolerance calculations)

int ngllz

Number of GLL points in z dimension.

int nglly

Number of GLL points in y dimension.

int ngllx

Number of GLL points in x dimension.

int nglob

Total number of global points.

int N

Number of GLL points.

ViewType xi

Device GLL points on [-1,1].

ViewType weights

Device integration weights.

DViewType hprime

Device Lagrange derivative matrix.

DViewType::host_mirror_type h_hprime

Host Lagrange derivative matrix.

ViewType::host_mirror_type h_xi

Host GLL points.

ViewType::host_mirror_type h_weights

Host weights.

ControlNodeCoordinatesView control_node_coordinates

Device coordinates.

ControlNodeCoordinatesView::host_mirror_type h_control_node_coordinates

Host coordinates.

ControlNodeIndexView control_node_index

Device indices.

ControlNodeIndexView::host_mirror_type h_control_node_index

Host indices.

int ngllz

Number of GLL points in z direction.

int nglly

Number of GLL points in y direction.

int ngllx

Number of GLL points in x direction.

ShapeFunctionViewType shape3D

Device shape functions.

DShapeFunctionViewType dshape3D

Device derivatives.

ShapeFunctionViewType::host_mirror_type h_shape3D

Host shape functions.

DShapeFunctionViewType::host_mirror_type h_dshape3D

Host derivatives.

Public Static Attributes

static constexpr auto data_class = specfem::data_access::DataClassType::global_coordinates

Data class.

Implementation Components

The 3D assembly mesh inherits from several implementation structures that provide specific functionality: