specfem::assembly::sources¶
-
template<specfem::element::dimension_tag DimensionTag>
struct sources¶ Assembly-level source management for spectral element simulations.
This template class manages sources within assembled finite element meshes, providing efficient access to source data for both host and device computations. The sources are organized by medium type (elastic, acoustic, poroelastic) and support time-dependent source time functions.
- Template Parameters:
DimensionTag – The spatial dimension (dim2 or dim3)
Private Type Definitions
Kokkos view types used for efficient memory management and data access patterns in source computations.
Index Storage by Tag Combination
Keyed by (dimension, medium, property, boundary, wavefield)
Public Constants
-
static constexpr auto dimension_tag = DimensionTag¶
Dimension tag for this source assembly.
Constructors and Destructors
-
sources() = default¶
Default constructor.
Construct source assembly from mesh and source configuration.
- Parameters:
sources – Vector of source objects
mesh – Finite element mesh
jacobian_matrix – Jacobian transformation matrices
element_types – Element classification by medium and property
t0 – Initial simulation time
dt – Time step size
nsteps – Total number of time steps
Public Functions
-
std::tuple<Kokkos::View<int*, Kokkos::DefaultHostExecutionSpace>, Kokkos::View<int*, Kokkos::DefaultHostExecutionSpace>> get_sources_on_host(const specfem::element::medium_tag medium, const specfem::element::property_tag property, const specfem::element::boundary_tag boundary, const specfem::simulation::field_type wavefield) const¶
Retrieve source indices for specified criteria on host memory.
- Parameters:
medium – Physical medium type
property – Material property classification
boundary – Boundary condition type
wavefield – Simulation type (forward, adjoint, backward)
- Returns:
Tuple of (element indices, source indices) host views
-
std::tuple<Kokkos::View<int*, Kokkos::DefaultExecutionSpace>, Kokkos::View<int*, Kokkos::DefaultExecutionSpace>> get_sources_on_device(const specfem::element::medium_tag medium, const specfem::element::property_tag property, const specfem::element::boundary_tag boundary, const specfem::simulation::field_type wavefield) const¶
Retrieve source indices for specified criteria on device memory.
- Parameters:
medium – Physical medium type
property – Material property classification
boundary – Boundary condition type
wavefield – Simulation type (forward, adjoint, backward)
- Returns:
Tuple of (element indices, source indices) device views
-
inline const std::vector<int> &get_partition_index() const¶
Get the MPI slice index for each source.
- Returns:
Vector of MPI slice indices corresponding to each source (host memory)
-
inline void update_timestep(const int timestep)¶
Update the current simulation time step.
Must be called before each time step to ensure source time functions are evaluated at the correct temporal point.
- Parameters:
timestep – Current time step index (0-based)
Dimension-Specific Implementations¶
Warning
doxygenstruct: Cannot find class “specfem::assembly::sources< specfem::element::dimension_tag::dim2 >” in doxygen xml output for project “specfem++” from directory: _build/doxygen/xml
Warning
doxygenstruct: Cannot find class “specfem::assembly::sources< specfem::element::dimension_tag::dim3 >” in doxygen xml output for project “specfem++” from directory: _build/doxygen/xml
Data Access Functions¶
Warning
doxygengroup: Cannot find group “SourceDataAccess” in doxygen xml output for project “specfem++” from directory: _build/doxygen/xml