specfem::medium::impl::Accessor¶
-
template<specfem::dimension::type DimensionTag, typename DataContainer>
class Accessor¶ CRTP base for accessing data containers in device/host memory.
Provides unified interface for loading, storing, and accumulating point data from containers at specific quadrature point indices. Uses CRTP to delegate actual data access to derived container classes while providing common interface patterns.
Supports both scalar and SIMD vectorized operations, with automatic dispatch based on index type. All device functions are Kokkos-compatible.
- Template Parameters:
DimensionTag – Spatial dimension (dim2/dim3)
DataContainer – Container type inheriting from this accessor
Public Functions
-
template<typename PointValues, typename IndexType>
inline void load_device_values(const IndexType &index, PointValues &values) const¶ Load data from container to point values on device.
Reads data from the container at the specified index and copies it to the provided point values object. Supports both scalar and SIMD vectorized indices for optimal performance.
- Template Parameters:
PointValues – Point data type (properties, field, etc.)
IndexType – Index type (index or simd_index)
- Parameters:
index – Quadrature point index within element
values – Point values object to fill with data
-
template<typename PointValues, typename IndexType>
inline void load_host_values(const IndexType &index, PointValues &values) const¶ Load data from container to point values on host.
Host version of load_device_values. Should be called from host code for accessing data in host memory or performing host-side operations.
- Template Parameters:
PointValues – Point data type (properties, field, etc.)
IndexType – Index type (index or simd_index)
- Parameters:
index – Quadrature point index within element
values – Point values object to fill with data
-
template<typename PointValues, typename IndexType>
inline void store_device_values(const IndexType &index, const PointValues &values) const¶ Store point values to container on device.
Writes data from point values object to the container at the specified index. Overwrites existing data in the container.
- Template Parameters:
PointValues – Point data type (properties, field, etc.)
IndexType – Index type (index or simd_index)
- Parameters:
index – Quadrature point index within element
values – Point values object containing data to store
-
template<typename PointValues, typename IndexType>
inline void store_host_values(const IndexType &index, const PointValues &values) const¶ Store point values to container on host.
Host version of store_device_values for host-side operations.
- Template Parameters:
PointValues – Point data type (properties, field, etc.)
IndexType – Index type (index or simd_index)
- Parameters:
index – Quadrature point index within element
values – Point values object containing data to store
-
template<typename PointValues, typename IndexType>
inline void add_device_values(const IndexType &index, const PointValues &values) const¶ Add point values to existing container data on device.
Performs element-wise addition of point values to existing data in the container. Commonly used for accumulating contributions (e.g., sensitivity kernels, forces).
- Template Parameters:
PointValues – Point data type (properties, field, etc.)
IndexType – Index type (index or simd_index)
- Parameters:
index – Quadrature point index within element
values – Point values to add to existing container data
-
template<typename PointValues, typename IndexType>
inline void add_host_values(const IndexType &index, const PointValues &values) const¶ Add point values to existing container data on host.
Host version of add_device_values for accumulation operations.
- Template Parameters:
PointValues – Point data type (properties, field, etc.)
IndexType – Index type (index or simd_index)
- Parameters:
index – Quadrature point index within element
values – Point values to add to existing container data