specfem::point::assembly_index

Datatype used to store index of a quadrature point within an assembled mesh.

template<bool using_simd = false>
struct assembly_index

Struct to store the assembled index for a quadrature point.

Template Parameters:

using_simd – Flag to indicate if this is a simd index

SIMD and Non-SIMD Specializations

template<>
struct assembly_index<false> : public specfem::data_access::Accessor<specfem::datatype::AccessorType::point, specfem::data_access::DataClassType::assembly_index, specfem::element::dimension_tag::dim2, false>

Struct to store the assembled index for a quadrature point.

This struct stores a 1D index that corresponds to a global numbering of the quadrature point within the mesh.

Constructors

Constructors for initializing the assembly index.

assembly_index() = default

Default constructor.

Initializes an empty assembly index.

inline assembly_index(const int &iglob)

Constructor with global index.

Initializes the assembly index with a specific global index.

Parameters:

iglob – Global index number of the quadrature point.

Public Members

int iglob

Global index number of the quadrature point.

This index uniquely identifies the quadrature point within the global mesh numbering system. It is used for gathering and scattering data to global arrays.

template<>
struct assembly_index<true> : public specfem::data_access::Accessor<specfem::datatype::AccessorType::point, specfem::data_access::DataClassType::assembly_index, specfem::element::dimension_tag::dim2, true>

Struct to store the SIMD assembled indices for a quadrature point.

SIMD indices are intended to be used for loading load_on_device and storing store_on_device data into SIMD vectors and operating on those data using SIMD instructions.

Constructors

Constructors for initializing the SIMD assembly index.

assembly_index() = default

Default constructor.

Initializes an empty SIMD assembly index.

inline assembly_index(const int &iglob, const int &number_points)

Constructor with values.

Initializes the SIMD assembly index with a starting global index and the number of valid points.

Parameters:
  • iglob – Global index number of the first quadrature point.

  • number_points – Number of valid points in the SIMD vector.

Public Functions

inline bool mask(const std::size_t &lane) const

Mask function to determine if a SIMD lane is valid.

Checks if the given lane index is within the valid range of points for this SIMD batch.

Parameters:

lane – The SIMD lane index to check (0 to vector_width-1).

Returns:

true if the lane is active/valid, false otherwise.

template<typename simd_type>
inline simd_type::mask_type get_mask() const

Returns a SIMD mask for valid lanes.

For full chunks (all lanes valid) returns an all-true mask using the cheap broadcast constructor, avoiding the per-lane generator. For the rare partial last chunk falls back to per-lane evaluation.

Template Parameters:

simd_type – SIMD wrapper type (e.g. specfem::datatype::simd<float, true>)

Returns:

SIMD mask with true for valid lanes

Public Members

int number_points

Number of active points in the SIMD vector.

Indicates how many lanes in the SIMD vector contain valid data. This is used for masking operations at boundaries or when the number of points is not a multiple of the SIMD width.

int iglob

Global index number of the first quadrature point in the SIMD batch.

Represents the starting global index. Subsequent points in the SIMD vector are typically assumed to be contiguous or strided based on the access pattern.