specfem::execution::ChunkedDomainIterator¶
-
template<specfem::dimension::type DimensionTag, typename ParallelConfig, typename ViewType>
class ChunkedDomainIterator : public specfem::execution::TeamPolicy<ParallelConfig>¶ ChunkedDomainIterator class is used to iterate over all quadrature points within a given set of finite elements.
The iterator divides the elements into chunks of size
ParallelConfig::chunk_sizeand iterates over them in parallel.- Template Parameters:
DimensionTag – The dimension tag for the elements.
ParallelConfig – Configuration for parallel execution. specfem::parallel_configurationuration::chunk_config
ViewType – Type of the view containing indices of elements.
Subclassed by specfem::execution::MappedChunkedDomainIterator< DimensionTag, ParallelConfig, ViewType >
Public Types
-
using base_policy_type = typename base_type::base_policy_type¶
Base policy type. Evaluates to
Kokkos::TeamPolicy`
-
using policy_index_type = typename base_type::policy_index_type¶
Policy index type. Evaluates to
Kokkos::TeamPolicy::member_type
-
using index_type = ChunkElementIndex<DimensionTag, typename ParallelConfig::simd, decltype(Kokkos::subview(std::declval<ViewType>(), std::declval<Kokkos::pair<int, int>>())), policy_index_type>¶
Underlying index type. This index will be passed to the closure when calling specfem::execution::for_each_level
-
using execution_space = typename base_type::execution_space¶
Execution space type.
-
using base_index_type = PointIndex<dimension_tag, typename ViewType::value_type, ParallelConfig::simd::using_simd, typename base_type::execution_space>¶
Index type to be used when calling specfem::execution::for_all with this iterator.
Public Functions
-
inline ChunkedDomainIterator(const ViewType indices, const specfem::mesh_entity::element_grid<DimensionTag> &element_grid)¶
Construct a new Chunked Domain Iterator object.
- Parameters:
indices – View of indices of elements within this iterator.
element_grid – specfem::mesh_entity::element which defines the number of GLL points etc.
-
inline ChunkedDomainIterator(const ParallelConfig, const ViewType indices, const specfem::mesh_entity::element_grid<DimensionTag> &element_grid)¶
Construct a new Chunked Domain Iterator object for a given parallel configuration.
- Parameters:
ParallelConfig – Configuration for parallel execution.
indices – View of indices of elements within this iterator.
element_grid – specfem::mesh_entity::element which defines the number of GLL points etc.
-
inline const index_type operator()(const policy_index_type &team) const¶
Compute the index for a given policy index.
The operator assigns a range of elements to each team.
- Parameters:
team – The policy index for which to compute the chunked domain index.
- Returns:
index_type The computed index type.
-
template<typename ...Args>
inline ChunkedDomainIterator &set_scratch_size(Args&&... args)¶ Set scratch size for the iterator.
This method sets passes its arguments to Kokkos::TeamPolicy’s set_scratch_size method, allowing for the configuration of scratch space for the iterator.
- Template Parameters:
Args – Types of arguments to be forwarded to the base policy.
- Parameters:
args – Arguments to be forwarded to the base policy’s set_scratch_size method.
- Returns:
ChunkedDomainIterator& Returns a reference to itself.
Public Static Attributes
-
static constexpr PolicyType policy_type = PolicyType::KokkosPolicy¶
Indicates this is a Kokkos policy.
-
static constexpr bool is_top_level_policy = true¶
Indicates this is a top-level policy.
specfem::execution::ChunkElementIndex¶
-
template<specfem::dimension::type DimensionTag, typename SIMD, typename ViewType, typename TeamMemberType>
class ChunkElementIndex¶ ChunkElementIndex class is used to represent an index for a chunk of elements in a finite element mesh.
This class provides methods to access the Kokkos index, the underlying chunked element index, and an iterator for iterating over the elements in the chunk.
- Template Parameters:
DimensionTag – The dimension tag (e.g., dim2, dim3).
SIMD – The SIMD type used for vectorization.
ViewType – The type of the view containing indices of elements.
TeamMemberType – The type of the Kokkos team member.
Subclassed by specfem::chunk_element::Index< DimensionTag, SIMD, ViewType, TeamMemberType >, specfem::execution::MappedChunkElementIndex< DimensionTag, SIMD, ViewType, TeamMemberType >
Public Types
-
using iterator_type = ChunkElementIterator<DimensionTag, SIMD, ViewType, TeamMemberType>¶
Iterator type for iterating over the elements in the chunk.
Public Functions
-
inline constexpr const TeamMemberType get_policy_index() const¶
Get the policy index that defined this chunk element index.
- Returns:
const TeamMemberType The policy index that defined this chunk element index.
-
inline constexpr const index_type get_index() const¶
Get the underlying index used to store elements in the chunk.
- Returns:
const index_type The underlying index that defines the chunk elements.
-
inline constexpr const iterator_type get_iterator() const¶
Get the iterator used to iterate over the elements in the chunk.
- Returns:
const iterator_type The iterator for this chunk element index.
-
inline ChunkElementIndex(const ViewType indices, const specfem::mesh_entity::element_grid<DimensionTag> &element_grid, const TeamMemberType &kokkos_index)¶
Constructor for ChunkElementIndex.
- Parameters:
indices – View of indices of elements within this chunk.
element_grid – Element grid information containing ngll, ngllx, ngllz, etc.
kokkos_index – Kokkos index type.
-
inline Kokkos::pair<typename ViewType::value_type, typename ViewType::value_type> get_range() const¶
Get a pair representing the range of indices in this chunk.
- Returns:
Kokkos::pair<typename ViewType::value_type, typename ViewType::value_type> A pair containing the first and last index in the chunk.
specfem::execution::ChunkElementIterator¶
-
template<specfem::dimension::type DimensionTag, typename SIMD, typename ViewType, typename TeamMemberType>
class ChunkElementIterator : public specfem::execution::TeamThreadRangePolicy<TeamMemberType, ViewType::value_type>¶ ChunkElementIterator class is used to iterate over all GLL points within the given chunk of elements.
- Template Parameters:
DimensionTag – The dimension tag (e.g., dim2, dim3).
SIMD – The SIMD type used for vectorization.
ViewType – The type of the view containing indices of elements.
TeamMemberType – The type of the Kokkos team member.
Subclassed by specfem::execution::MappedChunkElementIterator< DimensionTag, SIMD, ViewType, TeamMemberType >
Public Types
-
using base_policy_type = typename base_type::base_policy_type¶
Base policy type. Evaluates to
Kokkos::TeamThreadRange
-
using index_type = PointIndex<dimension_tag, policy_index_type, using_simd, typename base_type::execution_space>¶
Underlying index type. This index will be passed to the closure when calling specfem::execution::for_each_level
-
using execution_space = typename base_type::execution_space¶
Execution space type.
Public Functions
-
template<bool U = using_simd, specfem::dimension::type D = dimension_tag>
inline std::enable_if<U && D == specfem::dimension::type::dim2, const index_type>::type operator()(const policy_index_type &i) const¶ Operator to get the index for a given policy index.
- Parameters:
i – The policy index to convert to an index.
- Returns:
const index_type The index corresponding to the policy index.
-
template<bool U = using_simd, specfem::dimension::type D = dimension_tag>
inline std::enable_if<U && D == specfem::dimension::type::dim3, const index_type>::type operator()(const policy_index_type &i) const¶ Operator to get the index for a given policy index.
- Parameters:
i – The policy index to convert to an index.
- Returns:
const index_type The index corresponding to the policy index.
-
inline ChunkElementIterator(const TeamMemberType &team, const ViewType indices, const specfem::mesh_entity::element_grid<dimension_tag> &element_grid)¶
Constructor for ChunkElementIterator.
- Parameters:
team – The Kokkos team member type.
indices – View of indices of elements within this chunk.
element_grid – Element grid information containing ngll, ngllx, ngllz, etc.
Public Static Attributes
-
static constexpr PolicyType policy_type¶
Indicates this is a Kokkos policy.
-
static constexpr bool is_top_level_policy¶
Indicates this is not a top-level policy.
specfem::execution::PointIndex¶
-
template<specfem::dimension::type DimensionTag, typename KokkosIndexType, bool UseSIMD, typename ExecutionSpace>
class PointIndex¶ PointIndex class is used to represent a quadrature point index within a domain.
- Template Parameters:
DimensionTag – The dimension tag (e.g., dim2, dim3).
KokkosIndexType – The type of the Kokkos index, must be convertible to an integral type.
UseSIMD – Indicates whether SIMD is used for the index.
ExecutionSpace – The execution space type where the index will be executed.
Public Types
-
using iterator_type = VoidIterator<ExecutionSpace>¶
Iterator type used to iterate over GLL points within this index.
VoidIteratoris used when the index refers to a single GLL point.
Public Functions
-
inline constexpr const KokkosIndexType get_policy_index() const¶
Get the policy index that defined this point index.
- Returns:
const KokkosIndexType The policy index that defined this point index.
-
inline constexpr const point_index_type get_index() const¶
Get the underlying index used to define the GLL point.
- Returns:
const specfem::point::index<DimensionTag, UseSIMD> The point index that defines the GLL point.
-
inline constexpr const point_index_type get_local_index() const¶
Get the underlying index used to define the GLL point relative to current chunk.
- Returns:
const specfem::point::index<DimensionTag, UseSIMD> The point index that defines the GLL point relative to current chunk.
-
inline constexpr const iterator_type get_iterator() const¶
Get the iterator for this index.
- Returns:
const iterator_type The iterator for this index.
-
template<bool U = UseSIMD, specfem::dimension::type D = DimensionTag, typename std::enable_if<U && D == specfem::dimension::type::dim2, int>::type = 0>
inline PointIndex(const int &ispec, const int &number_elements, const int &iz, const int &ix, const int &ielement, const KokkosIndexType &kokkos_index)¶ Constructor for 2D PointIndex when SIMD is used.
- Parameters:
ispec – The index of the spectral element.
number_elements – The number of elements in the chunk.
iz – The z-coordinate of the GLL point.
ix – The x-coordinate of the GLL point.
ielement – The index of the element relative to the first in the chunk.
kokkos_index – The Kokkos index type.
-
template<bool U = UseSIMD, specfem::dimension::type D = DimensionTag, typename std::enable_if<!U && D == specfem::dimension::type::dim2, int>::type = 0>
inline PointIndex(const int &ispec, const int &iz, const int &ix, const int &ielement, const KokkosIndexType &kokkos_index)¶ Constructor for 2D PointIndex when SIMD is not used.
- Parameters:
ispec – The index of the spectral element.
iz – The z-coordinate of the GLL point.
ix – The x-coordinate of the GLL point.
kokkos_index – The Kokkos index type.
-
template<bool U = UseSIMD, specfem::dimension::type D = DimensionTag, typename std::enable_if<U && D == specfem::dimension::type::dim3, int>::type = 0>
inline PointIndex(const int &ispec, const int &number_elements, const int &iz, const int &iy, const int &ix, const int &ielement, const KokkosIndexType &kokkos_index)¶ Constructor for 3D PointIndex when SIMD is used.
- Parameters:
ispec – The index of the spectral element.
number_elements – The number of elements in the chunk.
iz – The z-coordinate of the GLL point.
iy – The y-coordinate of the GLL point.
ix – The x-coordinate of the GLL point.
ielement – The index of the element relative to the first in the chunk.
kokkos_index – The Kokkos index type.
-
template<bool U = UseSIMD, specfem::dimension::type D = DimensionTag, typename std::enable_if<!U && D == specfem::dimension::type::dim3, int>::type = 0>
inline PointIndex(const int &ispec, const int &iz, const int &iy, const int &ix, const int &ielement, const KokkosIndexType &kokkos_index)¶ Constructor for 3D PointIndex when SIMD is not used.
- Parameters:
ispec – The index of the spectral element.
iz – The z-coordinate of the GLL point.
iy – The y-coordinate of the GLL point.
ix – The x-coordinate of the GLL point.
ielement – The index of the element relative to the first in the chunk.
kokkos_index – The Kokkos index type.