specfem::assembly::kernels

template<specfem::element::dimension_tag DimensionTag>
struct kernels : public specfem::assembly::impl::value_containers_base<DimensionTag, impl::domain_kernels>

Data container for misfit kernels within the spectral element domain.

This class provides storage and data access functions for the misfit kernels associated with spectral elements in spectral element mesh.

Template Parameters:

DimensionTag – Spatial dimension (2D or 3D)

Public Functions

template<specfem::element::medium_tag MediumTag, specfem::element::property_tag PropertyTag>
inline int property_index_mapping(int ispec) const

Typed arithmetic index mapping replacing the old View-based lookup.

Returns the container-local index for a global element index ispec. Valid for device and host code.

template<specfem::element::medium_tag MediumTag, specfem::element::property_tag PropertyTag>
inline constexpr containers_type<dimension_tag, MediumTag, PropertyTag> const &get_container() const

Returns the container for a given medium and property.

inline void copy_to_host()

Copy data to host.

Public Members

int nspec

Total number of spectral elements.

specfem::mesh_entity::element_grid<DimensionTag> element_grid

GLL grid layout

specfem::tag_dispatch::Storage<specfem::datatype::ElementIndexRange, decltype(combinations)> element_ranges

Per-(medium,property) element index range; enables arithmetic index mapping without a device View.

Dimension-Specific Implementations

Warning

doxygenstruct: Cannot find class “specfem::assembly::kernels< specfem::element::dimension_tag::dim2 >” in doxygen xml output for project “specfem++” from directory: _build/doxygen/xml

Warning

doxygenstruct: Cannot find class “specfem::assembly::kernels< specfem::element::dimension_tag::dim3 >” in doxygen xml output for project “specfem++” from directory: _build/doxygen/xml

Data Access Functions

template<typename IndexType, typename PointKernelType, typename std::enable_if<IndexType::using_simd == PointKernelType::simd::using_simd, int>::type = 0>
void add_on_device(const IndexType &index, const PointKernelType &point_kernels, const kernels<PointKernelType::dimension_tag> &kernels)

Accumulate misfit kernel values on GPU device for seismic inversion.

This function performs point-wise accumulation of misfit kernel values.

// Example: Accumulate elastic kernels during adjoint simulation
const specfem::point::index<...> index = ...; // Current element and GLL
point const specfem::point::kernels<...> point_kernels = ...;
const auto kernels = assembly.kernels; // Global kernels container
add_on_device(index, point_kernels, kernels);

Template Parameters:
Parameters:
  • index – Spatial index specifying element and quadrature point location

  • point_kernels – Point-wise kernel values computed from forward-adjoint correlation

  • kernels – Global kernels container to accumulate values into

template<typename IndexType, typename PointKernelType, typename std::enable_if<IndexType::using_simd == PointKernelType::simd::using_simd, int>::type = 0>
void add_on_host(const IndexType &index, const PointKernelType &point_kernels, const kernels<PointKernelType::dimension_tag> &kernels)

Accumulate misfit kernel values on CPU host for seismic inversion.

This function performs point-wise accumulation of misfit kernel values.

// Example: Accumulate elastic kernels during adjoint simulation
const auto index = ...; // Current element and GLL
const specfem::point::kernels<...> point_kernels = ...;
const auto kernels = assembly.kernels; // Global kernels container
add_on_host(index, point_kernels, kernels);

Template Parameters:
Parameters:
  • index – Spatial index specifying element and quadrature point location

  • point_kernels – Point-wise kernel values computed from forward-adjoint correlation

  • kernels – Global kernels container to accumulate values into

template<typename PointKernelType, typename IndexType, typename std::enable_if<IndexType::using_simd == PointKernelType::simd::using_simd, int>::type = 0>
void load_on_device(const IndexType &index, const kernels<PointKernelType::dimension_tag> &kernels, PointKernelType &point_kernels)

Load misfit kernel values on GPU device for seismic inversion.

This function performs point-wise loading of misfit kernel values.

// Example: Load elastic kernels during adjoint simulation
const auto index = specfem::point::index<...>  ...; // Current element and
GLL point specfem::point::kernels<...> point_kernels = ...; const auto
kernels = assembly.kernels; // Global kernels container load_on_device(index,
kernels, point_kernels);

Template Parameters:
Parameters:
  • index – Spatial index specifying element and quadrature point location

  • kernels – Global kernels container to load values from

  • point_kernels – Point-wise kernel values loaded from global container

template<typename PointKernelType, typename IndexType, typename std::enable_if<IndexType::using_simd == PointKernelType::simd::using_simd, int>::type = 0>
void load_on_host(const IndexType &index, const kernels<PointKernelType::dimension_tag> &kernels, PointKernelType &point_kernels)

Load misfit kernel values on CPU host for seismic inversion.

This function performs point-wise loading of misfit kernel values.

// Example: Load elastic kernels during adjoint simulation
const specfem::point::index<...> index = ...; // Current element and GLL
point specfem::point::kernels<...> point_kernels = ...;
const auto kernels = assembly.kernels; // Global kernels container
load_on_host(index, kernels, point_kernels);

Template Parameters:
Parameters:
  • index – Spatial index specifying element and quadrature point location

  • kernels – Global kernels container to load values from

  • point_kernels – Point-wise kernel values loaded from global container

template<typename PointKernelType, typename IndexType, typename std::enable_if<IndexType::using_simd == PointKernelType::simd::using_simd, int>::type = 0>
void store_on_device(const IndexType &index, const PointKernelType &point_kernels, const kernels<PointKernelType::dimension_tag> &kernels)

Store misfit kernel values on GPU device for seismic inversion.

This function performs point-wise storage of misfit kernel values.

// Example: Store elastic kernels during adjoint simulation
const specfem::point::index<...> index = ...; // Current element and GLL
point const specfem::point::kernels<...> point_kernels = ...; const auto
kernels = assembly.kernels; // Global kernels container
store_on_device(index, point_kernels, kernels);

Template Parameters:
Parameters:
  • index – Spatial index specifying element and quadrature point location

  • point_kernels – Point-wise kernel values to store into global container

  • kernels – Global kernels container to store values into

template<typename PointKernelType, typename IndexType, typename std::enable_if<IndexType::using_simd == PointKernelType::simd::using_simd, int>::type = 0>
void store_on_host(const IndexType &index, const PointKernelType &point_kernels, const kernels<PointKernelType::dimension_tag> &kernels)

Store misfit kernel values on CPU host for seismic inversion.

This function performs point-wise storage of misfit kernel values.

// Example: Store elastic kernels during adjoint simulation
const specfem::point::index<...> index = ...; // Current element and GLL
point const specfem::point::kernels<...> point_kernels = ...; const auto
kernels = assembly.kernels; // Global kernels container store_on_host(index,
point_kernels, kernels);

Template Parameters:
Parameters:
  • index – Spatial index specifying element and quadrature point location

  • point_kernels – Point-wise kernel values to store into global container

  • kernels – Global kernels container to store values into