specfem::point::index¶
-
template<specfem::element::dimension_tag DimensionTag, bool UseSIMD>
struct index¶ Struct to store the index associated with a quadrature point.
- Template Parameters:
DimensionTag – Dimension of the element where the quadrature point is located
using_simd – Flag to indicate if this is a simd index
Subclassed by specfem::point::mapped_index< DimensionTag, UseSIMD >
2D Specialization¶
-
template<>
struct index<specfem::element::dimension_tag::dim2, false> : public specfem::data_access::Accessor<specfem::datatype::AccessorType::point, specfem::data_access::DataClassType::index, specfem::element::dimension_tag::dim2, false>¶ 2D specialization of the index struct for the non-SIMD case
Public Functions
-
index() = default¶
Default constructor.
-
inline index(const int &ispec, const int &iz, const int &ix)¶
Construct a new index object.
- Parameters:
ispec – Index of the spectral element.
iz – Index of the quadrature point in the z direction within the spectral element.
ix – Index of the quadrature point in the x direction within the spectral element.
-
index() = default¶
-
template<>
struct index<specfem::element::dimension_tag::dim2, true> : public specfem::data_access::Accessor<specfem::datatype::AccessorType::point, specfem::data_access::DataClassType::index, specfem::element::dimension_tag::dim2, true>¶ 2D specialization of the index struct for the SIMD case
Public Functions
-
index() = default¶
Default constructor.
-
inline index(const int &ispec, const int &number_elements, const int &iz, const int &ix)¶
Construct a new simd index object.
- Parameters:
ispec – Index of the spectral element.
number_elements – Number of elements.
iz – Index of the quadrature point in the z direction within the spectral element.
ix – Index of the quadrature point in the x direction within the spectral element.
-
inline index &operator=(const index &other)¶
Copy assignment operator.
- Parameters:
other – The index to copy from.
- Returns:
Reference to this index.
-
inline bool mask(const std::size_t &lane) const¶
Returns a boolean mask to check if the SIMD index is within the SIMD vector.
- Parameters:
lane – SIMD lane.
- Returns:
bool True if the SIMD index is within the SIMD vector.
-
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 ispec¶
Index associated with the spectral element at the start of the SIMD vector.
-
int number_elements¶
Number of elements stored in the SIMD vector.
-
int iz¶
Index of the quadrature point in the z direction within the spectral element.
-
int ix¶
Index of the quadrature point in the x direction within the spectral element.
-
index() = default¶
3D Specialization¶
-
template<>
struct index<specfem::element::dimension_tag::dim3, false> : public specfem::data_access::Accessor<specfem::datatype::AccessorType::point, specfem::data_access::DataClassType::index, specfem::element::dimension_tag::dim3, false>¶ Template specialization for 3D elements for the non-SIMD index implementation.
Public Functions
-
index() = default¶
Default constructor.
-
inline index(const int &ispec, const int &iz, const int &iy, const int &ix)¶
Construct a new index object.
- Parameters:
ispec – Index of the spectral element.
iz – Index of the quadrature point in the z direction within the spectral element.
iy – Index of the quadrature point in the y direction within the spectral element.
ix – Index of the quadrature point in the x direction within the spectral element.
Public Members
-
int ispec¶
Index of the spectral element.
-
int iz¶
Index of the quadrature point in the z direction within the spectral element.
-
int iy¶
Index of the quadrature point in the y direction within the spectral element.
-
int ix¶
Index of the quadrature point in the x direction within the spectral element.
-
index() = default¶
-
template<>
struct index<specfem::element::dimension_tag::dim3, true> : public specfem::data_access::Accessor<specfem::datatype::AccessorType::point, specfem::data_access::DataClassType::index, specfem::element::dimension_tag::dim3, true>¶ Template specialization for 2D elements for the SIMD index implementation.
Public Functions
-
index() = default¶
Default constructor.
-
inline index(const int &ispec, const int &number_elements, const int &iz, const int &iy, const int &ix)¶
Construct a new simd index object.
- Parameters:
ispec – Index of the spectral element.
number_elements – Number of elements.
iz – Index of the quadrature point in the z direction within the spectral element.
iy – Index of the quadrature point in the y direction within the spectral element.
ix – Index of the quadrature point in the x direction within the spectral element.
-
inline index &operator=(const index &other)¶
Copy assignment operator.
- Parameters:
other – The index to copy from.
- Returns:
Reference to this index.
-
inline bool mask(const std::size_t &lane) const¶
Returns a boolean mask to check if the SIMD index is within the SIMD vector.
- Parameters:
lane – SIMD lane.
- Returns:
bool True if the SIMD index is within the SIMD vector.
-
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 ispec¶
Index associated with the spectral element at the start of the SIMD vector.
-
int number_elements¶
Number of elements stored in the SIMD vector.
-
int iz¶
Index of the quadrature point in the z direction within the spectral element.
-
int iy¶
Index of the quadrature point in the y direction within the spectral element.
-
int ix¶
Index of the quadrature point in the x direction within the spectral element.
-
index() = default¶
specfem::point::mapped_index¶
-
template<specfem::element::dimension_tag DimensionTag, bool UseSIMD>
struct mapped_index : public specfem::point::index<DimensionTag, UseSIMD>¶ Struct associated to store the index of a quadrature point, along with a mapping to reference another parameter to be associated with the qudrature point.
This struct is used to associated a vector paramter with a quadrature point index.
View<int*> mapped_indices("mapped_indices", n_points); // The following code associates the 0-th mapped index with the quadrature point at (0, 1, 1) specfem::point::mapped_index<specfem::element::dimension_tag::dim2, false> index( specfem::point::index(0, 1, 1), 0);
- Template Parameters:
DimensionTag – Dimension of the element where the quadrature point is located
UseSIMD – Flag to indicate if this is a SIMD index
Public Functions
-
inline mapped_index(const base_type &index, const int &imap)¶
Constructor for the mapped index.
- Parameters:
index – Index to store the location of the quadrature point.
imap – Index of the mapped element to be associated with the quadrature point.
Public Members
-
int imap¶
Index of the mapped element.
This index refers to the associated parameter or element that is mapped to the current quadrature point.