2D specfem::assembly::mesh

template<>
struct mesh<specfem::dimension::type::dim2> : public specfem::assembly::mesh_impl::points<specfem::dimension::type::dim2>, public specfem::assembly::mesh_impl::quadrature<specfem::dimension::type::dim2>, public specfem::assembly::mesh_impl::control_nodes<specfem::dimension::type::dim2>, public specfem::assembly::mesh_impl::mesh_to_compute_mapping<specfem::dimension::type::dim2>, public specfem::assembly::mesh_impl::shape_functions<specfem::dimension::type::dim2>, public specfem::assembly::mesh_impl::adjacency_graph<specfem::dimension::type::dim2>

2D assembly-optimized mesh for spectral element computations.

Combines all mesh components (points, control nodes, shape functions, etc.) with compute-optimized ordering for efficient assembly operations.

Inherits functionality from:

  • points: Quadrature point coordinates and indexing

  • quadrature: GLL quadrature points and weights

  • control_nodes: Element control node data

  • mesh_to_compute_mapping: Element reordering for performance

  • shape_functions: Shape function values and derivatives

  • adjacency_graph: Element connectivity information

Public Types

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

Kokkos view for storing global element number for every quadrature point.

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

Kokkos view for storing coordinates of every distinct quadrature point.

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

Kokkos view type for integer index mappings.

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

Kokkos view type for real-valued coordinate data.

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

Kokkos view type for shape function storage.

3D view with dimensions [ngllz, ngllx, ngnod] using right layout for optimal memory access when iterating over control nodes.

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

Kokkos view type for shape function derivative storage.

4D view with dimensions [ngllz, ngllx, ndim, ngnod] where ndim=2, storing derivatives with respect to both \(\xi\) and \(\zeta\) directions.

Public Functions

mesh() = default

Default constructor.

mesh(const specfem::mesh::tags<dimension_tag> &tags, const specfem::mesh::control_nodes<dimension_tag> &control_nodes, const specfem::quadrature::quadratures &quadratures, const specfem::mesh::adjacency_graph<dimension_tag> &adjacency_graph)

Constructor from mesh components.

Builds assembly mesh from source mesh data with compute optimization.

Parameters:
  • tags – Element tags for reordering

  • control_nodes – Element control node data

  • quadratures – GLL quadrature information

  • adjacency_graph – Element connectivity

void assemble()

Assemble quadrature point coordinates.

Computes physical coordinates for all quadrature points using control nodes and shape functions.

inline Graph &graph()

Get mutable reference to the underlying graph.

Provides direct access to the Boost graph structure for modification operations such as adding edges or vertices.

Returns:

Mutable reference to the Boost adjacency_list graph

inline const Graph &graph() const

Get const reference to the underlying graph.

Provides read-only access to the Boost graph structure for query operations such as traversing edges or checking connectivity.

Returns:

Const reference to the Boost adjacency_list graph

void assert_symmetry() const

Assert that the adjacency graph is symmetric.

Verifies that for every directed edge from vertex A to vertex B, there exists a corresponding edge from vertex B to vertex A. This is required for proper mesh connectivity in spectral element methods.

Throws:

std::runtime_error – if the graph is not symmetric

Public Members

int nspec

Number of spectral elements.

int ngnod

Number of control nodes per element.

specfem::mesh_entity::element_grid<dimension_tag> element_grid

GLL grid info

int ngllz

Number of quadrature points in z dimension.

int ngllx

Number of quadrature points in x dimension.

int nglob

Number of global quadrature points.

IndexMappingViewType index_mapping

Global index number for every quadrature point

CoordViewType coord

(x, z) for every distinct quadrature point

IndexMappingViewType::HostMirror h_index_mapping

Global element number for every quadrature point

CoordViewType::HostMirror h_coord

(x, z) for every distinct quadrature point

type_real zmax

Min and max values of x and z coordinates

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::HostMirror h_hprime

Host Lagrange derivative matrix.

ViewType::HostMirror h_xi

Host GLL points.

ViewType::HostMirror h_weights

Host weights.

ControlNodeIndexView control_node_mapping

Device view containing control node indices in compute ordering.

Dimensions: [nspec, ngnod]. Maps from compute-ordered spectral elements to global control node indices.

ControlNodeCoordinatesView control_node_coord

Device view containing control node coordinates.

Dimensions: [ndim, nspec, ngnod] where ndim=2 for 2D problems. Stores (x, z) coordinates for each control node of each spectral element.

ControlNodeIndexView::HostMirror h_control_node_mapping

Host mirror view of control node index mapping.

ControlNodeCoordinatesView::HostMirror h_control_node_coord

Host mirror view of control node coordinates.

ViewType compute_to_mesh

Mapping from compute ordering to mesh ordering

ViewType mesh_to_compute

Mapping from mesh ordering to compute ordering

int ngllz

Number of quadrature points in z dimension.

int ngllx

Number of quadrature points in x dimension.

ShapeFunctionViewType shape2D

Device view containing shape function values.

Shape functions

DShapeFunctionViewType dshape2D

Device view containing shape function derivatives.

Shape function derivatives

ShapeFunctionViewType::HostMirror h_shape2D

Host mirror view of shape function values.

Shape functions

DShapeFunctionViewType::HostMirror h_dshape2D

Host mirror view of shape function derivatives.

Shape function derivatives

Implementation Components

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

Data Access Functions

Warning

doxygengroup: Cannot find group “QuadratureDataAccess” in doxygen xml output for project “specfem++” from directory: _build/doxygen/xml