specfem::chunk_edge::displacement

template<int ChunkSize, int NGLL, specfem::element::dimension_tag DimensionTag, specfem::element::medium_tag MediumTag, bool UseSIMD>
class displacement : public specfem::chunk_edge::impl::field<ChunkSize, NGLL, DimensionTag, MediumTag, specfem::data_access::DataClassType::displacement, UseSIMD>

Chunk edge displacement field accessor for high-performance spectral edge computations.

This class provides a specialized interface for accessing and manipulating displacement field data across chunks of spectral edges. It inherits all functionality from the base chunk edge field implementation while being specifically typed for displacement data.

The displacement class is optimized for processing multiple edges simultaneously (chunk-based processing), which improves cache locality and enables vectorization.

Template Parameters:
  • ChunkSize – Number of elements processed together in a chunk for optimal performance

  • NGLL – Number of Gauss-Lobatto-Legendre points per spatial dimension

  • DimensionTag – Spatial dimension (dim2 or dim3) of the displacement field

  • MediumTag – Medium type (acoustic, elastic, poroelastic, etc.)

  • UseSIMD – Whether to enable SIMD vectorization for performance optimization

Public Types

using simd = typename base_type::simd

SIMD type for vectorized displacement operations across chunks.

using value_type = typename base_type::value_type

Vector type for storing displacement data with chunk-optimized layout.

template<typename T, int nelements, int ngll>
using scalar_type = Kokkos::View<typename simd<T>::datatype[nelements][ngll], Kokkos::DefaultExecutionSpace::scratch_memory_space, Kokkos::MemoryTraits<Kokkos::Unmanaged>>

Scalar field storage for chunked edge elements.

Template Parameters:
  • T – Base data type

  • nelements – Number of elements in the chunk

  • ngll – Number of GLL points per element

template<typename T, int nelements, int ngll, int components>
using vector_type = Kokkos::View<typename simd<T>::datatype[nelements][ngll][components], Kokkos::DefaultExecutionSpace::scratch_memory_space, Kokkos::MemoryTraits<Kokkos::Unmanaged>>

Vector field storage for chunked edge elements.

Template Parameters:
  • T – Base data type

  • nelements – Number of elements in the chunk

  • ngll – Number of GLL points per element

  • components – Number of vector components

template<typename T, int nelements, int ngll, int components, int dimension>
using tensor_type = Kokkos::View<typename simd<T>::datatype[nelements][ngll][components][dimension], Kokkos::DefaultExecutionSpace::scratch_memory_space, Kokkos::MemoryTraits<Kokkos::Unmanaged>>

Tensor field storage for chunked edge elements.

Template Parameters:
  • T – Base data type

  • nelements – Number of elements in the chunk

  • ngll – Number of GLL points per element

  • components – Number of tensor components

  • dimension – Spatial dimension

Public Functions

inline value_type::value_type &operator()(Indices... indices) const

Multi-dimensional index operator for accessing field components.

Provides access to individual field values using multi-dimensional indexing. For chunk edge fields, the indexing typically follows the pattern: (edge_id, gll_indices…, component_id).

// For 2D fields: (edge, point_on_edge, component)
auto disp_x = field(ielem, ipoint, 0);  // x-component
auto disp_z = field(ielem, ipoint, 1);  // z-component
field(ielem, ipoint, 0) = new_value;

Template Parameters:

Indices – Parameter pack for multi-dimensional indices

Parameters:

indices – The indices specifying the location and component to access

Returns:

Reference to the field value at the specified location

inline const remove_accessor_attribute<ChunkSize, NGLL, DimensionTag, MediumTag, UseSIMD, value_type>::type field_without_accessor() const

Strip accessor attributes and return a field_without_accessor type.

This method provides a way to a unified field type that does not include the accessor interface. It is useful when you need to reference field of different types.

// Example usage of field_without_accessor
const specfem::enums::wavefield wavefield_type = ...;
const auto field = [&]() {
  if (wavefield_type == specfem::enums::wavefield::displacement) {
    return displacement_field.field_without_accessor();
  } else if (wavefield_type == specfem::enums::wavefield::velocity) {
    return velocity_field.field_without_accessor();
  } else if (wavefield_type == specfem::enums::wavefield::acceleration) {
    return acceleration_field.field_without_accessor();
  } else {
    throw std::runtime_error("Unsupported wavefield type");
  }
}();
Returns:

A field_without_accessor type with the same data storage

Public Static Functions

static inline constexpr std::size_t shmem_size()

Get the shared memory size required for this field type.

Returns the amount of shared memory (in bytes) required to allocate storage for this field type. This is used for Kokkos team scratch memory allocation.

// Example: Allocating team scratch memory
auto policy = Kokkos::TeamPolicy<>(num_teams, team_size)
  .set_scratch_size(0, Kokkos::PerTeam(DisplacementField::shmem_size()));

Returns:

Size in bytes required for field storage

Public Static Attributes

static constexpr int components

Number of field components based on dimension and medium type.

static constexpr int nedges

Number of edges in the chunk.

static constexpr int ngll

Number of Gauss-Lobatto-Legendre points per spatial dimension.

static constexpr auto medium_tag

Medium tag identifying the physical medium type.

static constexpr auto accessor_type = specfem::datatype::AccessorType::chunk_edge

Accessor pattern identifier.

static constexpr auto data_class = DataClass

Data classification type.

static constexpr auto dimension_tag = DimensionTag

Spatial dimension.

static constexpr bool using_simd = UseSIMD

SIMD vectorization flag.

Private Types

using base_type = impl::field<ChunkSize, NGLL, DimensionTag, MediumTag, specfem::data_access::DataClassType::displacement, UseSIMD>

Type alias for the base chunk edge field implementation.

Private Members

value_type m_data

Internal storage for chunk field data.

specfem::chunk_edge::velocity

template<int ChunkSize, int NGLL, specfem::element::dimension_tag DimensionTag, specfem::element::medium_tag MediumTag, bool UseSIMD>
class velocity : public specfem::chunk_edge::impl::field<ChunkSize, NGLL, DimensionTag, MediumTag, specfem::data_access::DataClassType::velocity, UseSIMD>

Chunk edge velocity field accessor for high-performance spectral element computations.

This class provides a specialized interface for accessing and manipulating velocity field data across chunks of spectral edges. It inherits all functionality from the base chunk edge field implementation while being specifically typed for velocity data.

The velocity class is optimized for processing multiple edges simultaneously (chunk-based processing), which improves cache locality and enables vectorization.

Template Parameters:
  • ChunkSize – Number of elements processed together in a chunk for optimal performance

  • NGLL – Number of Gauss-Lobatto-Legendre points per spatial dimension

  • DimensionTag – Spatial dimension (dim2 or dim3) of the velocity field

  • MediumTag – Medium type (acoustic, elastic, poroelastic, etc.)

  • UseSIMD – Whether to enable SIMD vectorization for performance optimization

Public Types

using simd = typename base_type::simd

SIMD type for vectorized velocity operations across chunks.

using value_type = typename base_type::value_type

Vector type for storing velocity data with chunk-optimized layout.

template<typename T, int nelements, int ngll>
using scalar_type = Kokkos::View<typename simd<T>::datatype[nelements][ngll], Kokkos::DefaultExecutionSpace::scratch_memory_space, Kokkos::MemoryTraits<Kokkos::Unmanaged>>

Scalar field storage for chunked edge elements.

Template Parameters:
  • T – Base data type

  • nelements – Number of elements in the chunk

  • ngll – Number of GLL points per element

template<typename T, int nelements, int ngll, int components>
using vector_type = Kokkos::View<typename simd<T>::datatype[nelements][ngll][components], Kokkos::DefaultExecutionSpace::scratch_memory_space, Kokkos::MemoryTraits<Kokkos::Unmanaged>>

Vector field storage for chunked edge elements.

Template Parameters:
  • T – Base data type

  • nelements – Number of elements in the chunk

  • ngll – Number of GLL points per element

  • components – Number of vector components

template<typename T, int nelements, int ngll, int components, int dimension>
using tensor_type = Kokkos::View<typename simd<T>::datatype[nelements][ngll][components][dimension], Kokkos::DefaultExecutionSpace::scratch_memory_space, Kokkos::MemoryTraits<Kokkos::Unmanaged>>

Tensor field storage for chunked edge elements.

Template Parameters:
  • T – Base data type

  • nelements – Number of elements in the chunk

  • ngll – Number of GLL points per element

  • components – Number of tensor components

  • dimension – Spatial dimension

Public Functions

inline value_type::value_type &operator()(Indices... indices) const

Multi-dimensional index operator for accessing field components.

Provides access to individual field values using multi-dimensional indexing. For chunk edge fields, the indexing typically follows the pattern: (edge_id, gll_indices…, component_id).

// For 2D fields: (edge, point_on_edge, component)
auto disp_x = field(ielem, ipoint, 0);  // x-component
auto disp_z = field(ielem, ipoint, 1);  // z-component
field(ielem, ipoint, 0) = new_value;

Template Parameters:

Indices – Parameter pack for multi-dimensional indices

Parameters:

indices – The indices specifying the location and component to access

Returns:

Reference to the field value at the specified location

inline const remove_accessor_attribute<ChunkSize, NGLL, DimensionTag, MediumTag, UseSIMD, value_type>::type field_without_accessor() const

Strip accessor attributes and return a field_without_accessor type.

This method provides a way to a unified field type that does not include the accessor interface. It is useful when you need to reference field of different types.

// Example usage of field_without_accessor
const specfem::enums::wavefield wavefield_type = ...;
const auto field = [&]() {
  if (wavefield_type == specfem::enums::wavefield::displacement) {
    return displacement_field.field_without_accessor();
  } else if (wavefield_type == specfem::enums::wavefield::velocity) {
    return velocity_field.field_without_accessor();
  } else if (wavefield_type == specfem::enums::wavefield::acceleration) {
    return acceleration_field.field_without_accessor();
  } else {
    throw std::runtime_error("Unsupported wavefield type");
  }
}();
Returns:

A field_without_accessor type with the same data storage

Public Static Functions

static inline constexpr std::size_t shmem_size()

Get the shared memory size required for this field type.

Returns the amount of shared memory (in bytes) required to allocate storage for this field type. This is used for Kokkos team scratch memory allocation.

// Example: Allocating team scratch memory
auto policy = Kokkos::TeamPolicy<>(num_teams, team_size)
  .set_scratch_size(0, Kokkos::PerTeam(DisplacementField::shmem_size()));

Returns:

Size in bytes required for field storage

Public Static Attributes

static constexpr int components

Number of field components based on dimension and medium type.

static constexpr int nedges

Number of edges in the chunk.

static constexpr int ngll

Number of Gauss-Lobatto-Legendre points per spatial dimension.

static constexpr auto medium_tag

Medium tag identifying the physical medium type.

static constexpr auto accessor_type = specfem::datatype::AccessorType::chunk_edge

Accessor pattern identifier.

static constexpr auto data_class = DataClass

Data classification type.

static constexpr auto dimension_tag = DimensionTag

Spatial dimension.

static constexpr bool using_simd = UseSIMD

SIMD vectorization flag.

Private Types

using base_type = impl::field<ChunkSize, NGLL, DimensionTag, MediumTag, specfem::data_access::DataClassType::velocity, UseSIMD>

Type alias for the base chunk edge field implementation.

Private Members

value_type m_data

Internal storage for chunk field data.

specfem::chunk_edge::acceleration

template<int ChunkSize, int NGLL, specfem::element::dimension_tag DimensionTag, specfem::element::medium_tag MediumTag, bool UseSIMD>
class acceleration : public specfem::chunk_edge::impl::field<ChunkSize, NGLL, DimensionTag, MediumTag, specfem::data_access::DataClassType::acceleration, UseSIMD>

Chunk edge acceleration field accessor for high-performance spectral edge computations.

This class provides a specialized interface for accessing and manipulating acceleration field data across chunks of spectral edges. It inherits all functionality from the base chunk edge field implementation while being specifically typed for acceleration data.

The acceleration class is optimized for processing multiple edges simultaneously (chunk-based processing), which improves cache locality and enables vectorization.

Template Parameters:
  • ChunkSize – Number of elements processed together in a chunk for optimal performance

  • NGLL – Number of Gauss-Lobatto-Legendre points per spatial dimension

  • DimensionTag – Spatial dimension (dim2 or dim3) of the acceleration field

  • MediumTag – Medium type (acoustic, elastic, poroelastic, etc.)

  • UseSIMD – Whether to enable SIMD vectorization for performance optimization

Public Types

using simd = typename base_type::simd

SIMD type for vectorized acceleration operations across chunks.

using value_type = typename base_type::value_type

Vector type for storing acceleration data with chunk-optimized layout.

template<typename T, int nelements, int ngll>
using scalar_type = Kokkos::View<typename simd<T>::datatype[nelements][ngll], Kokkos::DefaultExecutionSpace::scratch_memory_space, Kokkos::MemoryTraits<Kokkos::Unmanaged>>

Scalar field storage for chunked edge elements.

Template Parameters:
  • T – Base data type

  • nelements – Number of elements in the chunk

  • ngll – Number of GLL points per element

template<typename T, int nelements, int ngll, int components>
using vector_type = Kokkos::View<typename simd<T>::datatype[nelements][ngll][components], Kokkos::DefaultExecutionSpace::scratch_memory_space, Kokkos::MemoryTraits<Kokkos::Unmanaged>>

Vector field storage for chunked edge elements.

Template Parameters:
  • T – Base data type

  • nelements – Number of elements in the chunk

  • ngll – Number of GLL points per element

  • components – Number of vector components

template<typename T, int nelements, int ngll, int components, int dimension>
using tensor_type = Kokkos::View<typename simd<T>::datatype[nelements][ngll][components][dimension], Kokkos::DefaultExecutionSpace::scratch_memory_space, Kokkos::MemoryTraits<Kokkos::Unmanaged>>

Tensor field storage for chunked edge elements.

Template Parameters:
  • T – Base data type

  • nelements – Number of elements in the chunk

  • ngll – Number of GLL points per element

  • components – Number of tensor components

  • dimension – Spatial dimension

Public Functions

inline value_type::value_type &operator()(Indices... indices) const

Multi-dimensional index operator for accessing field components.

Provides access to individual field values using multi-dimensional indexing. For chunk edge fields, the indexing typically follows the pattern: (edge_id, gll_indices…, component_id).

// For 2D fields: (edge, point_on_edge, component)
auto disp_x = field(ielem, ipoint, 0);  // x-component
auto disp_z = field(ielem, ipoint, 1);  // z-component
field(ielem, ipoint, 0) = new_value;

Template Parameters:

Indices – Parameter pack for multi-dimensional indices

Parameters:

indices – The indices specifying the location and component to access

Returns:

Reference to the field value at the specified location

inline const remove_accessor_attribute<ChunkSize, NGLL, DimensionTag, MediumTag, UseSIMD, value_type>::type field_without_accessor() const

Strip accessor attributes and return a field_without_accessor type.

This method provides a way to a unified field type that does not include the accessor interface. It is useful when you need to reference field of different types.

// Example usage of field_without_accessor
const specfem::enums::wavefield wavefield_type = ...;
const auto field = [&]() {
  if (wavefield_type == specfem::enums::wavefield::displacement) {
    return displacement_field.field_without_accessor();
  } else if (wavefield_type == specfem::enums::wavefield::velocity) {
    return velocity_field.field_without_accessor();
  } else if (wavefield_type == specfem::enums::wavefield::acceleration) {
    return acceleration_field.field_without_accessor();
  } else {
    throw std::runtime_error("Unsupported wavefield type");
  }
}();
Returns:

A field_without_accessor type with the same data storage

Public Static Functions

static inline constexpr std::size_t shmem_size()

Get the shared memory size required for this field type.

Returns the amount of shared memory (in bytes) required to allocate storage for this field type. This is used for Kokkos team scratch memory allocation.

// Example: Allocating team scratch memory
auto policy = Kokkos::TeamPolicy<>(num_teams, team_size)
  .set_scratch_size(0, Kokkos::PerTeam(DisplacementField::shmem_size()));

Returns:

Size in bytes required for field storage

Public Static Attributes

static constexpr int components

Number of field components based on dimension and medium type.

static constexpr int nedges

Number of edges in the chunk.

static constexpr int ngll

Number of Gauss-Lobatto-Legendre points per spatial dimension.

static constexpr auto medium_tag

Medium tag identifying the physical medium type.

static constexpr auto accessor_type = specfem::datatype::AccessorType::chunk_edge

Accessor pattern identifier.

static constexpr auto data_class = DataClass

Data classification type.

static constexpr auto dimension_tag = DimensionTag

Spatial dimension.

static constexpr bool using_simd = UseSIMD

SIMD vectorization flag.

Private Types

using base_type = impl::field<ChunkSize, NGLL, DimensionTag, MediumTag, specfem::data_access::DataClassType::acceleration, UseSIMD>

Type alias for the base chunk edges field implementation.

Private Members

value_type m_data

Internal storage for chunk field data.

Implementation Details