specfem::assembly::boundaries¶
-
template<specfem::element::dimension_tag DimensionTag>
class boundaries¶ Data container for boundary condition information at every quadrature point on the boundary.
Data container used to store information required to implement boundary conditions at every quadrature point on the boundary.
Primary template declaration. Dimension-specific partial specializations are defined in boundaries/dim2/boundaries.hpp and boundaries/dim3/boundaries.hpp.
General template declaration for boundary condition information. Individual template specializations for 2D and 3D provide specialized containers that store data required for different types of boundary conditions (e.g., acoustic free surface, Stacey boundary conditions, etc.)
Dimension-Specific Implementations¶
-
template<>
class boundaries<specfem::element::dimension_tag::dim2>¶ Data container used to store information required to implement boundary conditions in 2D SEM simulations.
This container provides constructors used to convert mesher-supplied boundary to per-quadrature-point data required to implement different types of boundary conditions (e.g., acoustic free surface, Stacey boundary conditions, etc.), and data access functions to load/store data on device/host.
Public Constants
-
static constexpr auto dimension_tag = specfem::element::dimension_tag::dim2¶
Dimension tag.
Constructors
-
boundaries() = default¶
Default constructor.
-
boundaries(const int nspec, const int ngllz, const int ngllx, const specfem::mesh::mesh<dimension_tag> &mesh, const specfem::assembly::mesh<dimension_tag> &mesh_assembly, const specfem::assembly::jacobian_matrix<dimension_tag> &jacobian_matrix)¶
Contruct boundary condition data from mesh information.
This constructor delegates to the individual boundary condition constructors to construct per-quadrature-point data from mesher-supplied boundary information.
- Parameters:
nspec – Number of spectral elements in the mesh
ngllz – Number of GLL points in the z (vertical) direction
ngllx – Number of GLL points in the x (horizontal) direction
mesh – Mesh containing boundary condition information
mesh_assembly – Assembly mesh containing coordinate and connectivity information
jacobian_matrix – Jacobian matrix container with basis function derivatives used for computing geometric transformations at quadrature points
Public Members
-
BoundaryViewType boundary_tags¶
Device-accessible boundary tag information for every element in the mesh.
This view stores the boundary tag for each spectral element in the mesh. The boundary tags are used during device kernel execution to identify which elements have specific boundary conditions.
Dimensions: [nspec]
-
BoundaryViewType::host_mirror_type h_boundary_tags¶
Host-accessible boundary tag information for every element in the mesh.
This host mirror view stores the boundary tag for each spectral element in the mesh. The boundary tags are used during host-side operations that require knowledge of element boundary conditions.
Dimensions: [nspec]
-
IndexViewType acoustic_free_surface_index_mapping¶
Device-accessible mapping of spectral element index to acoustic free surface.
This index mapping is used to access acoustic free surface boundary specific information for a particular spectral element.
Dimensions: [nspec]
// Example usage: int spectral_element_index = 5; // Example spectral element index int iz = 0, ix = 2; // GLL point indices specfem::point::index<dimension_tag> index{spectral_element_index, iz, ix}; specfem::point::boundary<dimension_tag, specfem::element::boundary_tag::acoustic_free_surface> boundary; acoustic_free_surface.load_on_device(index, boundary);
-
IndexViewType::host_mirror_type h_acoustic_free_surface_index_mapping¶
Host-accessible mapping of spectral element index to acoustic free surface.
This index mapping is used to access acoustic free surface boundary specific information for a particular spectral element.
Dimensions: [nspec]
// Example usage: int spectral_element_index = 5; // Example spectral element index int iz = 0, ix = 2; // GLL point indices specfem::point::index<dimension_tag> index{spectral_element_index, iz, ix}; specfem::point::boundary<dimension_tag, specfem::element::boundary_tag::acoustic_free_surface> boundary; acoustic_free_surface.load_on_device(index, boundary);
-
IndexViewType stacey_index_mapping¶
Device-accessible mapping of spectral element index to Stacey boundary.
This index mapping is used to access Stacey boundary specific information for a particular spectral element.
Dimensions: [nspec]
// Example usage: int spectral_element_index = 5; // Example spectral element index int iz = 0, ix = 2; // GLL point indices specfem::point::index<dimension_tag> index{spectral_element_index, iz, ix}; specfem::point::boundary<dimension_tag, specfem::element::boundary_tag::stacey> boundary; stacey.load_on_device(index, boundary);
-
IndexViewType::host_mirror_type h_stacey_index_mapping¶
Host-accessible mapping of spectral element index to Stacey boundary.
This index mapping is used to access Stacey boundary specific information for a particular spectral element.
Dimensions: [nspec]
// Example usage: int spectral_element_index = 5; // Example spectral element index int iz = 0, ix = 2; // GLL point indices specfem::point::index<dimension_tag> index{spectral_element_index, iz, ix}; specfem::point::boundary<dimension_tag, specfem::element::boundary_tag::stacey> boundary; stacey.load_on_device(index, boundary);
-
specfem::assembly::boundaries_impl::acoustic_free_surface<dimension_tag> acoustic_free_surface¶
Data container used to store acoustic free surface boundary information.
-
specfem::assembly::boundaries_impl::stacey<dimension_tag> stacey¶
Data container used to store Stacey boundary information.
-
static constexpr auto dimension_tag = specfem::element::dimension_tag::dim2¶
Data Access Functions¶
-
template<typename IndexType, typename PointBoundaryType, typename std::enable_if<PointBoundaryType::simd::using_simd == IndexType::using_simd, int>::type = 0>
void load_on_device(const IndexType &index, const specfem::assembly::boundaries<specfem::element::dimension_tag::dim2> &boundaries, PointBoundaryType &boundary)¶ Load boundary condition information for a quadrature point on device.
This function provides device-side access to boundary condition data by loading appropriate boundary information based on the boundary tag associated with a specific quadrature point.
// Example usage in a device kernel specfem::point::index<specfem::element::dimension_tag::dim2> index{ispec, iz, ix}; specfem::point::boundary<specfem::element::boundary_tag::stacey, specfem::element::dimension_tag::dim2, false> boundary; // Load Stacey boundary data for mass matrix computation specfem::assembly::load_on_device(index, assembly.boundaries, boundary); // Use loaded boundary data in physics calculations specfem::boundary_conditions::apply_boundary_condition(..., boundary, acceleration);
Note
In debug builds, the function performs runtime validation of boundary tag consistency and will abort execution if mismatched tags are detected
- Template Parameters:
IndexType – Index type for quadrature point location. Must be specfem::point::index with SIMD usage matching PointBoundaryType
PointBoundaryType – Point boundary data container. Must be specfem::point::boundary specialized for the appropriate boundary tag and dimension
- Parameters:
index – Quadrature point index specifying spectral element and GLL point coordinates (ispec, iz, ix)
boundaries – Container holding all boundary condition data for the mesh, organized by boundary type
boundary – Output parameter populated with boundary condition data for the specified quadrature point
- Pre:
The boundary tag in PointBoundaryType must match the boundary tag stored in
boundaries.boundary_tags[index.ispec]- Pre:
IndexType and PointBoundaryType must have compatible SIMD configurations (both SIMD or both non-SIMD)
-
template<typename IndexType, typename PointBoundaryType, typename std::enable_if<PointBoundaryType::simd::using_simd == IndexType::using_simd, int>::type = 0>
inline void load_on_host(const IndexType &index, const specfem::assembly::boundaries<specfem::element::dimension_tag::dim2> &boundaries, PointBoundaryType &boundary)¶ Load boundary condition information for a quadrature point on host.
This function provides host-side access to boundary condition data by loading appropriate boundary information based on the boundary tag associated with a specific quadrature point.
// Example usage in a host function specfem::point::index<specfem::element::dimension_tag::dim2> index{ispec, iz, ix}; specfem::point::boundary<specfem::element::boundary_tag::stacey, specfem::element::dimension_tag::dim2, false> boundary; // Load Stacey boundary data for mass matrix computation specfem::assembly::load_on_host(index, assembly.boundaries, boundary); // Use loaded boundary data in physics calculations specfem::boundary_conditions::apply_boundary_condition(..., boundary, acceleration);
Note
In debug builds, the function performs runtime validation of boundary tag consistency and will abort execution if mismatched tags are detected
- Template Parameters:
IndexType – Index type for quadrature point location. Must be specfem::point::index with SIMD usage matching PointBoundaryType
PointBoundaryType – Point boundary data container. Must be specfem::point::boundary specialized for the appropriate boundary tag and dimension
- Parameters:
index – Quadrature point index specifying spectral element and GLL point coordinates (ispec, iz, ix)
boundaries – Container holding all boundary condition data for the mesh, organized by boundary type
boundary – Output parameter populated with boundary condition data for the specified quadrature point
- Pre:
The boundary tag in PointBoundaryType must match the boundary tag stored in
boundaries.boundary_tags[index.ispec]- Pre:
IndexType and PointBoundaryType must have compatible SIMD configurations (both SIMD or both non-SIMD)
-
template<typename IndexType, typename PointBoundaryType, typename std::enable_if<PointBoundaryType::simd::using_simd == IndexType::using_simd, int>::type = 0>
void load_on_device(const IndexType &index, const specfem::assembly::boundaries<specfem::element::dimension_tag::dim3> &boundaries, PointBoundaryType &boundary)¶ Load boundary condition information for a quadrature point on device.
- Template Parameters:
IndexType – Index type (specfem::point::index for dim3)
PointBoundaryType – Point boundary type (specfem::point::boundary)
- Parameters:
index – Quadrature point index
boundaries – Assembly boundary data
boundary – Output boundary data for the quadrature point
-
template<typename IndexType, typename PointBoundaryType, typename std::enable_if<PointBoundaryType::simd::using_simd == IndexType::using_simd, int>::type = 0>
inline void load_on_host(const IndexType &index, const specfem::assembly::boundaries<specfem::element::dimension_tag::dim3> &boundaries, PointBoundaryType &boundary)¶ Load boundary condition information for a quadrature point on host.
- Template Parameters:
IndexType – Index type (specfem::point::index for dim3)
PointBoundaryType – Point boundary type (specfem::point::boundary)
- Parameters:
index – Quadrature point index
boundaries – Assembly boundary data
boundary – Output boundary data for the quadrature point