specfem::assembly::properties¶
-
template<specfem::dimension::type DimensionTag>
struct properties¶ Spectral element material properties data container.
This class provides storage and data access functions for the material properties associated with spectral elements in spectral element mesh. The dimension specific implementations provide data containers for storing material properties such as density, elastic constants, and other medium parameters as well as methods for loading and storing data on device and host.
Dimension-Specific Implementations¶
-
template<>
struct properties<specfem::dimension::type::dim2> : public specfem::assembly::impl::value_containers<specfem::dimension::type::dim2, specfem::medium::properties_container>¶ 2D spectral element material properties data container
This template specialization provides storage and management of material properties for 2-dimensional spectral elements. It stores properties such as density, elastic constants, and medium-specific parameters at quadrature points throughout the spectral element mesh.
The class inherits from value_containers which provides the underlying storage mechanism and data access patterns for different material types (elastic, acoustic, poroelastic) and property variations (isotropic, anisotropic, Cosserat).
Related classes:
specfem::medium::properties_container: Base storage container
specfem::assembly::mesh: Mesh geometry and connectivity
specfem::mesh::materials: Material assignment per element
Public Functions
-
properties() = default¶
Default constructor.
Initializes an empty properties container with no allocated storage.
-
properties(const int nspec, const int ngllz, const int ngllx, const specfem::assembly::element_types<dimension_tag> &element_types, const specfem::assembly::mesh<dimension_tag> &mesh, const specfem::mesh::materials<dimension_tag> &materials, bool has_gll_model)¶
Construct properties container from mesh and material data.
Initializes the material properties container by extracting material properties from the mesh materials and storing them at quadrature points for all spectral elements.
specfem::assembly::properties<specfem::dimension::type::dim2> props( 1000, 5, 5, element_types, mesh, materials, false);
- Parameters:
nspec – Number of spectral elements in the mesh
ngllz – Number of quadrature points in z-direction (vertical)
ngllx – Number of quadrature points in x-direction (horizontal)
element_types – Element type information for each spectral element
mesh – Spectral element mesh containing geometry and connectivity
materials – Material properties database indexed by element
has_gll_model – If true, skips material property assignment (for GLL models)
-
inline void copy_to_host()¶
Copy material properties data from device to host memory.
Transfers all material property data stored in device memory back to host-accessible memory for post-processing, I/O operations, or debugging.
-
inline void copy_to_device()¶
Copy material properties data from host to device memory.
Transfers material property data from host memory to device-accessible memory for use in GPU-accelerated computations.
-
template<>
struct properties<specfem::dimension::type::dim3> : public specfem::assembly::impl::value_containers<specfem::dimension::type::dim3, specfem::medium::properties_container>¶ 3D spectral element material properties data container
This template specialization provides storage and management of material properties for 3-dimensional spectral elements. It stores properties such as density, elastic constants, and medium-specific parameters at quadrature points throughout the 3D spectral element mesh.
The class inherits from value_containers which provides the underlying storage mechanism and data access patterns for different material types (elastic, acoustic, poroelastic) and property variations (isotropic, anisotropic, Cosserat). The 3D implementation handles the additional y-dimension compared to the 2D case.
Related classes:
specfem::medium::properties_container: Base storage container
specfem::assembly::mesh: 3D mesh geometry and connectivity
specfem::mesh::materials: Material assignment per 3D element
// Typical usage in 3D assembly construction specfem::assembly::properties<specfem::dimension::type::dim3> props( nspec, ngllz, nglly, ngllx, materials, element_types); // Access 3D material properties at quadrature points auto container = props.get_container<medium_tag, property_tag>();
Public Functions
-
properties() = default¶
Default constructor.
Initializes an empty 3D properties container with no allocated storage.
-
properties(const int nspec, const int ngllz, const int nglly, const int ngllx, const specfem::mesh::materials<dimension_tag> &materials, const specfem::assembly::element_types<dimension_tag> &element_types)¶
Construct 3D properties container from mesh and material data.
Initializes the 3D material properties container by extracting material properties from the mesh materials and storing them at quadrature points for all 3D spectral elements. The constructor handles the full 3D tensor grid of quadrature points (x, y, z directions).
- Parameters:
nspec – Number of spectral elements in the 3D mesh
ngllz – Number of quadrature points in z-direction (vertical)
nglly – Number of quadrature points in y-direction
ngllx – Number of quadrature points in x-direction (horizontal)
materials – Material properties database indexed by 3D element
element_types – Element type information for each 3D spectral element
-
inline void copy_to_host()¶
Copy 3D material properties data from device to host memory.
Transfers all 3D material property data stored in device memory back to host-accessible memory for post-processing, I/O operations, or debugging. Handles the full 3D tensor storage efficiently.
-
inline void copy_to_device()¶
Copy 3D material properties data from host to device memory.
Transfers 3D material property data from host memory to device-accessible memory for use in GPU-accelerated 3D computations. Optimized for the 3D tensor structure of quadrature points.
Data Access Functions¶
-
template<typename PointPropertiesType, typename IndexType, typename std::enable_if_t<IndexType::using_simd == PointPropertiesType::simd::using_simd, int> = 0>
void load_on_device(const IndexType &lcoord, const specfem::assembly::properties<PointPropertiesType::dimension_tag> &properties, PointPropertiesType &point_properties)¶ Load material properties at a quadrature point on device memory.
This function retrieves material properties from the assembly properties container and loads them into a point properties structure for use in device-side computations.
The function is optimized for GPU execution with KOKKOS_FORCEINLINE_FUNCTION and supports both regular and SIMD operations depending on the template parameters. SIMD compatibility is enforced through SFINAE.
// Load elastic isotropic properties at a quadrature point specfem::point::index<...> coord(ispec, iz, ix); specfem::point::properties<...> props; load_on_device(coord, assembly.properties, props);
- Template Parameters:
PointPropertiesType – Material properties type (e.g., specfem::point::properties) Must specify medium_tag, property_tag, and dimension_tag
IndexType – Index type for quadrature point location (e.g., specfem::point::index) Must have compatible SIMD settings with PointPropertiesType
- Parameters:
lcoord – Local coordinate index specifying element and quadrature point location
properties – Assembly properties container holding all material data
point_properties – Output structure to receive the loaded material properties
-
template<typename PointPropertiesType, typename IndexType, typename std::enable_if_t<IndexType::using_simd == PointPropertiesType::simd::using_simd, int> = 0>
void load_on_host(const IndexType &lcoord, const specfem::assembly::properties<PointPropertiesType::dimension_tag> &properties, PointPropertiesType &point_properties)¶ Load material properties at a quadrature point on host memory.
This function retrieves material properties from the assembly properties container and loads them into a point properties structure for use in host-side computations.
The function is optimized for host execution and supports both regular and SIMD operations depending on the template parameters. SIMD compatibility is enforced through SFINAE.
// Load elastic isotropic properties at a quadrature point specfem::point::index<...> coord(ispec, iz, ix); specfem::point::properties<...> props; load_on_host(coord, assembly.properties, props);
- Template Parameters:
PointPropertiesType – Material properties type (e.g., specfem::point::properties) Must specify medium_tag, property_tag, and dimension_tag
IndexType – Index type for quadrature point location (e.g., specfem::point::index) Must have compatible SIMD settings with PointPropertiesType
- Parameters:
lcoord – Local coordinate index specifying element and quadrature point location
properties – Assembly properties container holding all material data
point_properties – Output structure to receive the loaded material properties
-
template<typename PointPropertiesType, typename IndexType, typename std::enable_if_t<IndexType::using_simd == PointPropertiesType::simd::using_simd, int> = 0>
void store_on_host(const IndexType &lcoord, const PointPropertiesType &point_properties, const specfem::assembly::properties<PointPropertiesType::dimension_tag> &properties)¶ Store material properties at a quadrature point in host memory.
This function writes material properties from a point properties structure into the assembly properties container’s host memory storage.
The function is designed for host-side operations such as initialization, post-processing, debugging, or I/O operations. It supports both regular and SIMD operations with SIMD compatibility enforced through SFINAE. This is the counterpart to load_on_host for bidirectional data access.
// Store modified elastic properties back to host memory specfem::point::index<...> coord(ispec, iz, ix); specfem::point::properties<...> props; // Modify properties (e.g., after inversion or processing) props.rho = updated_density; props.lambda = updated_lambda; props.mu = updated_mu; store_on_host(coord, props, assembly.properties);
- Template Parameters:
PointPropertiesType – Material properties type (e.g., specfem::point::properties) Must specify medium_tag, property_tag, and dimension_tag
IndexType – Index type for quadrature point location (e.g., specfem::point::index) Must have compatible SIMD settings with PointPropertiesType
- Parameters:
lcoord – Local coordinate index specifying element and quadrature point location
point_properties – Input structure containing material properties to store
properties – Assembly properties container to receive the material data