|
Sacado Package Browser (Single Doxygen Collection)
Version of the Day
|
Go to the documentation of this file.
30 #ifndef SACADO_FAD_EXP_STATICFIXEDSTORAGE_HPP
31 #define SACADO_FAD_EXP_STATICFIXEDSTORAGE_HPP
33 #include <type_traits>
48 template <
typename T,
int Num>
58 template <
typename TT>
86 #if defined(SACADO_DEBUG) && !defined(__CUDA_ARCH__ )
88 throw "StaticFixedStorage::StaticFixedStorage() Error: Supplied derivative dimension does not equal static length.";
103 for (
int i=0; i<Num; i++)
120 for (
int i=0; i<Num; i++)
128 constexpr
int size()
const {
return Num; }
132 constexpr
int length()
const {
return Num; }
137 #if defined(SACADO_DEBUG) && !defined(__CUDA_ARCH__ )
138 if (sz != 0 && sz != Num)
139 throw "StaticFixedStorage::resize() Error: Cannot resize fixed storage length.";
151 #if defined(SACADO_DEBUG) && !defined(__CUDA_ARCH__ )
152 if (sz != 0 && sz != Num)
153 throw "StaticFixedStorage::resize() Error: Cannot resize fixed storage length.";
161 #if defined(SACADO_DEBUG) && !defined(__CUDA_ARCH__ )
163 throw "StaticFixedStorage::expand() Error: Cannot resize fixed storage length.";
211 #endif // SACADO_FAD_EXP_STATICFIXEDSTORAGE_HPP
StaticFixedStorage()=default
Default constructor.
const KOKKOS_INLINE_FUNCTION T & fastAccessDx(int i) const
Returns derivative component i without bounds checking.
#define KOKKOS_INLINE_FUNCTION
Derivative array storage class using static, fixed memory allocation.
constexpr KOKKOS_INLINE_FUNCTION int size() const
Returns number of derivative components.
static constexpr bool is_statically_sized
KOKKOS_INLINE_FUNCTION void resize(int sz)
Resize the derivative array to sz.
KOKKOS_INLINE_FUNCTION T & fastAccessDx(int i)
Returns derivative component i without bounds checking.
KOKKOS_INLINE_FUNCTION StaticFixedStorage(const int sz, const T &x, const DerivInit zero_out)
Constructor with size sz.
KOKKOS_INLINE_FUNCTION StaticFixedStorage(const StaticFixedStorage &x)
Copy constructor.
KOKKOS_INLINE_FUNCTION T dx(int i) const
Returns derivative component i with bounds checking.
static constexpr int static_size
Turn StaticFixedStorage into a meta-function class usable with mpl::apply.
T dx_[Num]
Derivative array.
KOKKOS_INLINE_FUNCTION void zero()
Zero out derivative array.
Replace static derivative length.
StaticFixedStorage< T, N > type
StaticFixedStorage< TT, Num > type
const KOKKOS_INLINE_FUNCTION T & val() const
Returns value.
KOKKOS_INLINE_FUNCTION void expand(int sz)
Expand derivative array to size sz.
std::remove_cv< T >::type value_type
KOKKOS_INLINE_FUNCTION T & val()
Returns value.
KOKKOS_INLINE_FUNCTION StaticFixedStorage & operator=(const StaticFixedStorage &x)
Assignment.
KOKKOS_INLINE_FUNCTION StaticFixedStorage(const T &x)
Constructor with value.
constexpr KOKKOS_INLINE_FUNCTION int length() const
Returns array length.
~StaticFixedStorage()=default
Destructor.
static KOKKOS_INLINE_FUNCTION void zero(T *dest, int sz)
Zero out array dest of length sz.
DerivInit
Enum use to signal whether the derivative array should be initialized in AD object constructors.
const KOKKOS_INLINE_FUNCTION T * dx() const
Returns derivative array.
Initialize the derivative array.
KOKKOS_INLINE_FUNCTION void resizeAndZero(int sz)
Resize the derivative array to sz.