specfem::execution::RangeIterator

template<typename ParallelConfig>
class RangeIterator : public specfem::execution::RangePolicy<ParallelConfig>

RangeIterator class is used to iterate over a range of assembled quadrature points within an FE assembly.

This iterator iterates over a range of GLL points between [0, RangeSize).

Template Parameters:

ParallelConfig – Configuration for parallel execution. specfem::parallel_configurationuration::range_config

Public Types

using base_policy_type = typename base_type::base_policy_type

Base policy type. Evaluates to Kokkos::RangePolicy`

using policy_index_type = typename base_type::policy_index_type

Policy index type. Must be convertible to intergral type. Evaluates to Kokkos::RangePolicy::index_type

using index_type = RangeIndex<policy_index_type, ParallelConfig::simd::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 base_index_type = RangeIndex<typename base_type::index_type, ParallelConfig::simd::using_simd, typename base_type::execution_space>

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

using execution_space = typename base_type::execution_space

Execution space type.

Public Functions

inline RangeIterator(const policy_index_type range_size)

Constructs a RangeIterator for a given range size.

Parameters:

range_size – The size of the range to iterate over.

inline RangeIterator(const ParallelConfig, const policy_index_type range_size)

Construct a new Range Iterator object for a given parallel configuration.

Parameters:

range_size – The size of the range to iterate over.

template<bool UseSIMD = ParallelConfig::simd::using_simd>
inline std::enable_if_t<UseSIMD, const index_type> operator()(const policy_index_type &i) const

Compute the index for a given policy index.

Parameters:

i – The policy index for which to compute the range index.

Returns:

const index_type The computed index for the given policy index.

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

template<typename PolicyIndexType, bool UseSIMD, typename ExecutionSpace>
class RangeIndex

RangeIndex is used to represent an index for GLL points within a FE assembly.

Template Parameters:
  • PolicyIndexType – Type of the policy index, must be convertible to an integral type.

  • UseSIMD – Indicates whether SIMD is used for the index.

Public Types

using iterator_type = VoidIterator<ExecutionSpace>

Iterator used to iterate over GLL points within this index. VoidIterator is used when the index refers to a single GLL point.

Public Functions

inline const PolicyIndexType get_policy_index() const

Get the policy index that defined this range index. See specfem::execution::RangeIterator::operator()

Returns:

cosnt PolicyIndexType The policy index that defined this range index.

inline const specfem::point::assembly_index<UseSIMD> get_index() const

Get the underlying index used to define the GLL point.

Returns:

const specfem::point::assembly_index<UseSIMD> The assembly index that defines the GLL point.

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, typename std::enable_if<!U, int>::type = 0>
inline RangeIndex(const PolicyIndexType i, const int &index)

Constructor for RangeIndex when SIMD is not used.

Parameters:
  • i – The policy index which created this range index.

  • index – The index of the GLL point within FE assembly.

template<bool U = UseSIMD, typename std::enable_if<U, int>::type = 0>
inline RangeIndex(const PolicyIndexType i, const int &starting_index, const int &number_points)

Constructor for RangeIndex when SIMD is used.

Parameters:
  • i – The policy index which created this range index.

  • starting_index – The starting index of the GLL point within this SIMD vector.

  • number_points – The number of GLL points in this SIMD vector.

Returns:

const RangeIndex The constructed RangeIndex object.