15 #ifndef GEOSX_COMMON_TENSOR_HPP_ 16 #define GEOSX_COMMON_TENSOR_HPP_ 28 template<
typename T,
int SIZE_TPARAM >
33 static_assert( SIZE_TPARAM > 0,
"Tensor size must be a positive value" );
39 static constexpr
int SIZE = SIZE_TPARAM;
72 template<
typename U = T >
75 std::enable_if_t< std::is_floating_point< U >::value,
bool >
78 for(
int i = 0; i <
SIZE; ++i )
95 template<
typename U = T >
98 std::enable_if_t< !std::is_floating_point< U >::value,
bool >
101 for(
int i = 0; i <
SIZE; ++i )
118 constexpr
int size(
int junk )
const 135 friend inline std::ostream & operator<<( std::ostream & os, Tensor< T, SIZE >
const & t )
138 for(
int i = 1; i <
SIZE; ++i )
140 os <<
',' << t.data[i];
148 #endif //GEOSX_COMMON_TENSOR_HPP_ #define GEOSX_HOST_DEVICE
Marks a host-device function.
GEOSX_HOST_DEVICE GEOSX_FORCE_INLINE std::enable_if_t< std::is_floating_point< U >::value, bool > operator==(Tensor< U, SIZE > const &rhs) const
Equality comparison operator.
T data[SIZE]
Underlying array.
GEOSX_HOST_DEVICE GEOSX_FORCE_INLINE T & operator[](std::ptrdiff_t const i)
Non-const element access.
GEOSX_HOST_DEVICE GEOSX_FORCE_INLINE T const & operator[](std::ptrdiff_t const i) const
Const element access.
Lightweight wrapper around a c-array.
GEOSX_HOST_DEVICE GEOSX_FORCE_INLINE constexpr int size(int junk) const
Returns the size of the tensor.
GEOSX_HOST_DEVICE GEOSX_FORCE_INLINE std::enable_if_t< !std::is_floating_point< U >::value, bool > operator==(Tensor< U, SIZE > const &rhs) const
Equality comparison operator.
#define GEOSX_FORCE_INLINE
Marks a function or lambda for inlining.
#define GEOSX_UNUSED_VAR(...)
Mark an unused variable and silence compiler warnings.
static constexpr int SIZE
Alias for size template parameter.
real64 value_type
Alias for type template parameter.