specfem::execution::ChunkedFaceIterator

template<typename ParallelConfig, typename ViewType>
class ChunkedFaceIterator : public specfem::execution::TeamPolicy<ParallelConfig>

High-level chunked face iterator for efficient parallel face processing in 3D.

This is the main iterator class for processing mesh faces in chunks. It divides the face set into chunks of configurable size and processes each chunk in parallel using Kokkos teams. This approach improves memory locality and load balancing.

Template Parameters:
  • ParallelConfig – Configuration class defining execution parameters and chunk size

  • ViewType – Kokkos view type containing mesh faces

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 = ChunkFaceIndex<ParallelConfig::dimension, ViewType, 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 = FacePointIndex<ParallelConfig::dimension, int, typename base_type::execution_space>

Index type to be used when calling specfem::execution::for_all with this iterator.

Public Functions

inline ChunkedFaceIterator(const ViewType faces)

Constructor with explicit face view.

Parameters:

faces – View of mesh faces to process

inline ChunkedFaceIterator(const ParallelConfig, const ViewType faces)

Constructor with parallel configuration.

Parameters:
  • config – Parallel configuration (unused but required for interface compatibility)

  • faces – View of mesh faces to process

inline const index_type operator()(const policy_index_type &team) const

Team operator for chunk processing.

Creates a chunk-specific index for the given team. Each team processes a contiguous chunk of faces, improving memory locality.

Parameters:

team – Kokkos team member

Returns:

index_type Chunk index for this team

template<typename ...Args>
inline ChunkedFaceIterator &set_scratch_size(Args&&... args)

Set scratch memory size for teams.

Forwards scratch memory configuration to the underlying team policy.

Template Parameters:

Args – Variadic template for scratch size arguments

Parameters:

args – Arguments to forward to team policy

Returns:

ChunkedFaceIterator& Reference to this iterator for chaining

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::ChunkFaceIndex

template<specfem::element::dimension_tag DimensionTag, typename ViewType, typename KokkosIndexType>
class ChunkFaceIndex

Chunk-level index for managing face processing within a team.

This class serves as an intermediate index type that manages a chunk of faces assigned to a Kokkos team. It provides access to both the chunk-specific index and the team-level iterator for processing face points within the chunk.

Template Parameters:
  • DimensionTag – Spatial dimension (3D)

  • ViewType – Kokkos view type containing the chunk of mesh faces

  • KokkosIndexType – Type of the underlying Kokkos policy index (team member)

Public Functions

inline constexpr const KokkosIndexType &get_policy_index() const

Get the Kokkos policy index (team member) for this chunk.

Returns:

const KokkosIndexType& Reference to the Kokkos team member that is responsible for processing this chunk

inline const index_type get_index() const

Get the chunk-specific index.

Returns:

const index_type& Reference to the chunk index containing metadata about this specific chunk of faces

inline const iterator_type &get_iterator() const

Get the team-level iterator for processing faces in this chunk.

Returns:

const iterator_type& Reference to the ChunkFaceIterator that can be used to iterate over individual face points within this chunk

inline ChunkFaceIndex(const ViewType &faces, const KokkosIndexType &kokkos_index)

Constructor for ChunkFaceIndex.

Parameters:
  • faces – View of mesh faces for this specific chunk (subset of total faces)

  • kokkos_index – Kokkos team member responsible for this chunk

specfem::execution::ChunkedFaceIterator

template<typename ParallelConfig, typename ViewType>
class ChunkedFaceIterator : public specfem::execution::TeamPolicy<ParallelConfig>

High-level chunked face iterator for efficient parallel face processing in 3D.

This is the main iterator class for processing mesh faces in chunks. It divides the face set into chunks of configurable size and processes each chunk in parallel using Kokkos teams. This approach improves memory locality and load balancing.

Template Parameters:
  • ParallelConfig – Configuration class defining execution parameters and chunk size

  • ViewType – Kokkos view type containing mesh faces

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 = ChunkFaceIndex<ParallelConfig::dimension, ViewType, 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 = FacePointIndex<ParallelConfig::dimension, int, typename base_type::execution_space>

Index type to be used when calling specfem::execution::for_all with this iterator.

Public Functions

inline ChunkedFaceIterator(const ViewType faces)

Constructor with explicit face view.

Parameters:

faces – View of mesh faces to process

inline ChunkedFaceIterator(const ParallelConfig, const ViewType faces)

Constructor with parallel configuration.

Parameters:
  • config – Parallel configuration (unused but required for interface compatibility)

  • faces – View of mesh faces to process

inline const index_type operator()(const policy_index_type &team) const

Team operator for chunk processing.

Creates a chunk-specific index for the given team. Each team processes a contiguous chunk of faces, improving memory locality.

Parameters:

team – Kokkos team member

Returns:

index_type Chunk index for this team

template<typename ...Args>
inline ChunkedFaceIterator &set_scratch_size(Args&&... args)

Set scratch memory size for teams.

Forwards scratch memory configuration to the underlying team policy.

Template Parameters:

Args – Variadic template for scratch size arguments

Parameters:

args – Arguments to forward to team policy

Returns:

ChunkedFaceIterator& Reference to this iterator for chaining

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::FacePointIndex

template<specfem::element::dimension_tag DimensionTag, typename KokkosIndexType, typename ExecutionSpace>
class FacePointIndex

Index type representing a single point on a mesh face.

This class encapsulates the coordinates and properties of a single Gauss-Lobatto-Legendre (GLL) point located on a mesh face. It provides access to both the local element coordinates and the position on the face.

Template Parameters:
  • DimensionTag – Spatial dimension (3D)

  • KokkosIndexType – Type of the underlying Kokkos policy index

  • ExecutionSpace – Kokkos execution space for parallel operations

Public Types

using iterator_type = VoidIterator<ExecutionSpace>

Iterator type used to iterate over GLL points within this index. VoidIterator is 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 index_type &get_index() const

Get a reference to this index.

Returns:

const index_type& Reference to this FacePointIndex

inline FacePointIndex(const specfem::point::face_index<DimensionTag> &index_, const int iface, const KokkosIndexType &kokkos_index)

Constructor for FacePointIndex.

Parameters:
  • index – Local element coordinates of the face point

  • iface – Position of face within the chunk

  • kokkos_index – Underlying Kokkos policy index

inline constexpr const iterator_type &get_iterator() const

Get iterator for this single point.

Returns:

const iterator_type VoidIterator since this represents a single point

inline constexpr bool is_end() const

Tail-skip flag required by the for_each_level dispatcher. Face points have no tail-skip semantics, so this is always false.