specfem::medium::properties_container

template<specfem::dimension::type DimensionTag, specfem::element::medium_tag MediumTag, specfem::element::property_tag PropertyTag>
struct properties_container

Material properties storage for spectral elements at quadrature points.

Template container that stores material properties (density, elastic moduli, etc.) for all quadrature points within spectral elements. Specializes for different dimension/medium/property combinations and provides efficient Kokkos-based storage.

Inherits from properties::data_container for storage and impl::Accessor for element-wise access. Material properties are organized as:

  • 2D: properties[nspec][ngllz][ngllx]

  • 3D: properties[nspec][ngllz][nglly][ngllx]

Template parameters select appropriate specialization:

  • DimensionTag: Spatial dimension (dim2/dim3)

  • MediumTag: Physical medium (acoustic, elastic, poroelastic)

  • PropertyTag: Material symmetry (isotropic, anisotropic)

Template Parameters:
  • DimensionTag – Spatial dimension

  • MediumTag – Physical medium type

  • PropertyTag – Material property type

Dimension-specific Specializations

template<specfem::element::medium_tag MediumTag, specfem::element::property_tag PropertyTag>
struct properties_container<specfem::dimension::type::dim2, MediumTag, PropertyTag> : public specfem::medium::properties::data_container<specfem::dimension::type::dim2, MediumTag, PropertyTag>, public specfem::medium::impl::Accessor<specfem::dimension::type::dim2, properties_container<specfem::dimension::type::dim2, MediumTag, PropertyTag>>

2D material properties container specialization.

Stores material properties at quadrature points for 2D spectral elements. Data layout: properties[element][ngllz][ngllx] where ngllz and ngllx are quadrature points in vertical and horizontal directions.

Template Parameters:
  • MediumTag – Physical medium (acoustic, elastic, poroelastic)

  • PropertyTag – Material symmetry (isotropic, anisotropic, cosserat)

Public Types

using base_type = properties::data_container<specfem::dimension::type::dim2, MediumTag, PropertyTag>

Base data container type for property storage.

Public Functions

properties_container() = default

Default constructor for empty container.

properties_container(const Kokkos::View<int*, Kokkos::DefaultHostExecutionSpace> elements, const specfem::assembly::mesh<dimension_tag> &mesh, const int ngllz, const int ngllx, const specfem::mesh::materials<dimension_tag> &materials, const bool has_gll_model, const specfem::kokkos::HostView1d<int> property_index_mapping)

Construct 2D properties from mesh and material data.

Extracts material properties from mesh materials and stores them at all quadrature points for the specified spectral elements.

Parameters:
  • elements – Element indices to initialize

  • mesh – 2D mesh geometry and connectivity

  • ngllz – Number of vertical quadrature points

  • ngllx – Number of horizontal quadrature points

  • materials – Material database indexed by element

  • has_gll_model – Skip material assignment for GLL models

  • property_index_mapping – Element to property mapping

template<typename PointValues, typename IndexType>
void add_device_values(const IndexType &index, PointValues &values) const = delete

Device value access disabled for this container type.

template<typename PointValues, typename IndexType>
void add_host_values(const IndexType &index, PointValues &values) const = delete

Host value access disabled for this container type.

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

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

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

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

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

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

Public Static Attributes

static constexpr auto dimension_tag = base_type::dimension_tag

2D spatial dimension

static constexpr auto medium_tag = base_type::medium_tag

Physical medium type.

static constexpr auto property_tag = base_type::property_tag

Material property type.

template<specfem::element::medium_tag MediumTag, specfem::element::property_tag PropertyTag>
struct properties_container<specfem::dimension::type::dim3, MediumTag, PropertyTag> : public specfem::medium::properties::data_container<specfem::dimension::type::dim3, MediumTag, PropertyTag>, public specfem::medium::impl::Accessor<specfem::dimension::type::dim3, properties_container<specfem::dimension::type::dim3, MediumTag, PropertyTag>>

3D material properties container specialization.

Stores material properties at quadrature points for 3D spectral elements. Data layout: properties[element][ngllz][nglly][ngllx] where ngllz, nglly, and ngllx are quadrature points in z, y, and x directions respectively.

Template Parameters:
  • MediumTag – Physical medium (acoustic, elastic)

  • PropertyTag – Material symmetry (isotropic, anisotropic)

Public Types

using base_type = properties::data_container<specfem::dimension::type::dim3, MediumTag, PropertyTag>

Base data container type for property storage.

Public Functions

properties_container() = default

Default constructor for empty container.

properties_container(const Kokkos::View<int*, Kokkos::DefaultHostExecutionSpace> elements, const int nspec, const int ngllz, const int nglly, const int ngllx, const specfem::mesh::materials<dimension_tag> &materials, const specfem::kokkos::HostView1d<int> property_index_mapping)

Construct 3D properties from mesh and material data.

Extracts material properties from mesh materials and stores them at all quadrature points for the specified spectral elements.

Parameters:
  • elements – Element indices to initialize

  • nspec – Total number of spectral elements

  • ngllz – Number of z-direction quadrature points

  • nglly – Number of y-direction quadrature points

  • ngllx – Number of x-direction quadrature points

  • materials – Material database indexed by element

  • property_index_mapping – Element to property mapping

template<typename PointValues, typename IndexType>
void add_device_values(const IndexType &index, PointValues &values) const = delete

Device value access disabled for this container type.

template<typename PointValues, typename IndexType>
void add_host_values(const IndexType &index, PointValues &values) const = delete

Host value access disabled for this container type.

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

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

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

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

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

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

Public Static Attributes

static constexpr auto dimension_tag = base_type::dimension_tag

3D spatial dimension

static constexpr auto medium_tag = base_type::medium_tag

Physical medium type.

static constexpr auto property_tag = base_type::property_tag

Material property type.

Implementation Details