specfem::datatype::RegisterArray

template<typename T, typename Extents, typename Layout>
class RegisterArray

Stack-allocated multi-dimensional array with compile-time layout.

High-performance register array for small, fixed-size data with specified memory layout.

Template Parameters:
  • T – Base data type of the array elements

  • Extents – Array dimensions and sizes

  • Layout – Memory layout specification

Subclassed by specfem::datatype::VectorPointViewType< type_real, num_dimensions, UseSIMD >, specfem::datatype::VectorPointViewType< type_real, NQuadIntersection, false >

Public Types

using value_type = T

Element value type.

Public Functions

inline RegisterArray(const value_type value)

Construct array filled with single value.

Parameters:

value – Fill value for all elements

template<typename ...Args, typename std::enable_if<sizeof...(Args) == size, bool>::type = true>
inline RegisterArray(const Args&... args)

Construct from individual element values.

Template Parameters:

Args – Argument types (must match array size)

Parameters:

args – Element values in linear order

inline RegisterArray(const RegisterArray &other)

Copy constructor.

Parameters:

other – Array to copy from

inline RegisterArray()

Default constructor (zero-initialized)

inline RegisterArray(const T *values)

Construct from C-style array.

Parameters:

values – Pointer to array data (must have at least ‘size’ elements)

template<typename ...IndexType>
inline constexpr value_type &operator()(const IndexType&... i)

Multi-dimensional element access (non-const)

Template Parameters:

IndexType – Variadic index types

Parameters:

i – Multi-dimensional indices

Returns:

Reference to element

template<typename ...IndexType>
inline constexpr const value_type &operator()(const IndexType&... i) const

Multi-dimensional element access (const)

Template Parameters:

IndexType – Variadic index types

Parameters:

i – Multi-dimensional indices

Returns:

Const reference to element

inline T l2_norm() const

Compute L2 norm (for 1D arrays)

Returns:

L2 norm value

template<typename U = T, std::enable_if_t<std::is_integral<U>::value, int> = 0>
inline bool operator==(const RegisterArray &other) const

Equality comparison for integral types.

Parameters:

other – Array to compare with

Returns:

True if arrays are equal

inline bool operator!=(const RegisterArray &other) const

Inequality comparison.

Parameters:

other – Array to compare with

Returns:

True if arrays are not equal

Private Types

using mapping = typename Layout::template mapping<Extents>

Memory layout mapping type.

Private Members

T m_value[size]

Stack-allocated data storage.

Private Static Attributes

static constexpr std::size_t rank = Extents::rank()

Array rank (number of dimensions)

static constexpr std::size_t size = impl::compute_size<Extents>()

Total number of elements.