specfem::chunk_face::displacement¶
-
template<int ChunkSize, int NGLL, specfem::element::dimension_tag DimensionTag, specfem::element::medium_tag MediumTag, bool UseSIMD>
class displacement : public specfem::chunk_face::impl::field<ChunkSize, NGLL, DimensionTag, MediumTag, specfem::data_access::DataClassType::displacement, UseSIMD>¶ Chunk face displacement field accessor for high-performance spectral face computations in 3D.
This class provides a specialized interface for accessing and manipulating displacement field data across chunks of spectral element faces. It inherits all functionality from the base chunk face field implementation while being specifically typed for displacement data.
The displacement class is optimized for processing multiple faces simultaneously (chunk-based processing), which improves cache locality and enables vectorization.
See also
specfem::chunk_face::velocity for velocity field accessor
See also
specfem::chunk_face::acceleration for acceleration field accessor
- Template Parameters:
ChunkSize – Number of faces processed together in a chunk for optimal performance
NGLL – Number of Gauss-Lobatto-Legendre points per spatial dimension
DimensionTag – Spatial dimension (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 nfaces, int ngll>
using scalar_type = Kokkos::View<typename simd<T>::datatype[nfaces][ngll][ngll], Kokkos::DefaultExecutionSpace::scratch_memory_space, Kokkos::MemoryTraits<Kokkos::Unmanaged>>¶ Scalar field storage for chunked face elements.
- Template Parameters:
T – Base data type
nfaces – Number of faces in the chunk
ngll – Number of GLL points per face dimension
-
template<typename T, int nfaces, int ngll, int components>
using vector_type = Kokkos::View<typename simd<T>::datatype[nfaces][ngll][ngll][components], Kokkos::DefaultExecutionSpace::scratch_memory_space, Kokkos::MemoryTraits<Kokkos::Unmanaged>>¶ Vector field storage for chunked face elements.
- Template Parameters:
T – Base data type
nfaces – Number of faces in the chunk
ngll – Number of GLL points per face dimension
components – Number of vector components
-
template<typename T, int nfaces, int ngll, int components, int dimension>
using tensor_type = Kokkos::View<typename simd<T>::datatype[nfaces][ngll][ngll][components][dimension], Kokkos::DefaultExecutionSpace::scratch_memory_space, Kokkos::MemoryTraits<Kokkos::Unmanaged>>¶ Tensor field storage for chunked face elements.
- Template Parameters:
T – Base data type
nfaces – Number of faces in the chunk
ngll – Number of GLL points per face dimension
components – Number of tensor components
dimension – Spatial dimension
Public Functions
-
template<typename ...Indices>
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 face fields, the indexing typically follows the pattern: (face_id, gll_i, gll_j, component_id).
// For 3D face fields: (face, i_gll, j_gll, component) auto disp_x = field(iface, i, j, 0); // x-component auto disp_y = field(iface, i, j, 1); // y-component auto disp_z = field(iface, i, j, 2); // z-component field(iface, i, j, 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_accessortype.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 = specfem::element::attributes<DimensionTag, MediumTag>::components¶
Number of field components based on dimension and medium type.
-
static constexpr auto accessor_type = specfem::datatype::AccessorType::chunk_face¶
Accessor pattern identifier.
-
static constexpr auto data_class = DataClass¶
Data classification type.
-
static constexpr auto dimension_tag = DimensionTag¶
Spatial dimension.
Private Types
-
using base_type = impl::field<ChunkSize, NGLL, DimensionTag, MediumTag, specfem::data_access::DataClassType::displacement, UseSIMD>¶
Type alias for the base chunk face field implementation.
Private Members
-
value_type m_data¶
Internal storage for chunk field data.