EBGeometry
Compact, header-only C++ library for fast evaluation of signed distance functions
Loading...
Searching...
No Matches
Public Member Functions | Static Public Member Functions | Public Attributes | List of all members
EBGeometry::Array< T, N > Struct Template Reference

Fixed-size array with host- and device-callable members. More...

#include <EBGeometry_Array.hpp>

Inheritance diagram for EBGeometry::Array< T, N >:
Inheritance graph
[legend]

Public Member Functions

constexpr T & operator[] (const std::size_t a_i) noexcept
 Element access.
 
constexpr const T & operator[] (const std::size_t a_i) const noexcept
 Element access.
 
constexpr T * data () noexcept
 Pointer to the first element.
 
constexpr const T * data () const noexcept
 Pointer to the first element.
 
constexpr T * begin () noexcept
 Iterator to the first element.
 
constexpr const T * begin () const noexcept
 Iterator to the first element.
 
constexpr T * end () noexcept
 Iterator past the last element.
 
constexpr const T * end () const noexcept
 Iterator past the last element.
 
constexpr void fill (const T &a_value) noexcept
 Set every element to a value.
 
constexpr bool operator== (const Array &a_other) const noexcept
 Element-wise equality.
 
constexpr bool operator!= (const Array &a_other) const noexcept
 Element-wise inequality.
 

Static Public Member Functions

static constexpr std::size_t size () noexcept
 Number of elements.
 

Public Attributes

T m_data [N]
 The elements. Public so that the type is an aggregate; use operator[] or data().
 

Detailed Description

template<class T, std::size_t N>
struct EBGeometry::Array< T, N >

Fixed-size array with host- and device-callable members.

An aggregate, like std::array: Array<int, 3> a = {1, 2, 3}; works, a default-constructed Array of a scalar type is uninitialized, and Array<int, 3> a{}; is zeroed. It is trivially copyable whenever T is.

Template Parameters
TElement type.
NNumber of elements, at least 1.

Member Function Documentation

◆ begin() [1/2]

template<class T , std::size_t N>
constexpr const T * EBGeometry::Array< T, N >::begin ( ) const
inlineconstexprnoexcept

Iterator to the first element.

Returns
Pointer to the first element.

◆ begin() [2/2]

template<class T , std::size_t N>
constexpr T * EBGeometry::Array< T, N >::begin ( )
inlineconstexprnoexcept

Iterator to the first element.

Returns
Pointer to the first element.

◆ data() [1/2]

template<class T , std::size_t N>
constexpr const T * EBGeometry::Array< T, N >::data ( ) const
inlineconstexprnoexcept

Pointer to the first element.

Returns
The address of the element storage.

◆ data() [2/2]

template<class T , std::size_t N>
constexpr T * EBGeometry::Array< T, N >::data ( )
inlineconstexprnoexcept

Pointer to the first element.

Returns
The address of the element storage.

◆ end() [1/2]

template<class T , std::size_t N>
constexpr const T * EBGeometry::Array< T, N >::end ( ) const
inlineconstexprnoexcept

Iterator past the last element.

Returns
Pointer past the last element.

◆ end() [2/2]

template<class T , std::size_t N>
constexpr T * EBGeometry::Array< T, N >::end ( )
inlineconstexprnoexcept

Iterator past the last element.

Returns
Pointer past the last element.

◆ fill()

template<class T , std::size_t N>
constexpr void EBGeometry::Array< T, N >::fill ( const T &  a_value)
inlineconstexprnoexcept

Set every element to a value.

Parameters
[in]a_valueValue to assign.

◆ operator!=()

template<class T , std::size_t N>
constexpr bool EBGeometry::Array< T, N >::operator!= ( const Array< T, N > &  a_other) const
inlineconstexprnoexcept

Element-wise inequality.

Parameters
[in]a_otherArray to compare with.
Returns
True if any element differs.

◆ operator==()

template<class T , std::size_t N>
constexpr bool EBGeometry::Array< T, N >::operator== ( const Array< T, N > &  a_other) const
inlineconstexprnoexcept

Element-wise equality.

Parameters
[in]a_otherArray to compare with.
Returns
True if every element compares equal.

◆ operator[]() [1/2]

template<class T , std::size_t N>
constexpr const T & EBGeometry::Array< T, N >::operator[] ( const std::size_t  a_i) const
inlineconstexprnoexcept

Element access.

Parameters
[in]a_iIndex, which must be less than N.
Returns
Const reference to element a_i.

◆ operator[]() [2/2]

template<class T , std::size_t N>
constexpr T & EBGeometry::Array< T, N >::operator[] ( const std::size_t  a_i)
inlineconstexprnoexcept

Element access.

Parameters
[in]a_iIndex, which must be less than N.
Returns
Reference to element a_i.

◆ size()

template<class T , std::size_t N>
static constexpr std::size_t EBGeometry::Array< T, N >::size ( )
inlinestaticconstexprnoexcept

Number of elements.

Returns
N.

The documentation for this struct was generated from the following file: