Sacado Package Browser (Single Doxygen Collection)  Version of the Day
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
Classes | Public Types | Public Member Functions | Static Public Attributes | Protected Attributes | Static Private Attributes | Friends | List of all members
Sacado::Fad::Exp::ViewStorage< T, static_length, static_stride, U > Class Template Reference

Derivative array storage class that is a view into a contiguous memory allocation. It does not provide proper value semantics and thus should not be used in a general-purpose scalar type. More...

#include <Sacado_Fad_Exp_ViewStorage.hpp>

Classes

struct  apply
 Turn ViewStorage into a meta-function class usable with mpl::apply. More...
 
struct  apply_N
 Replace static derivative length. More...
 

Public Types

typedef std::remove_cv< T >::type value_type
 
typedef U base_fad_type
 

Public Member Functions

SACADO_INLINE_FUNCTION ViewStorage ()
 Default constructor (needed to satisfy interface) More...
 
SACADO_INLINE_FUNCTION ViewStorage (T *v, const int arg_size=0, const int arg_stride=0)
 Constructor. More...
 
SACADO_INLINE_FUNCTION ViewStorage (T *arg_dx, T *arg_val, const int arg_size=0, const int arg_stride=0)
 Constructor. More...
 
template<typename TT >
SACADO_INLINE_FUNCTION ViewStorage (const ViewStorage< TT, static_length, static_stride, U > &x, typename std::enable_if< std::is_same< TT, T >::value||std::is_same< const TT, T >::value >::type *=0)
 Copy constructor. More...
 
SACADO_INLINE_FUNCTION ~ViewStorage ()
 Destructor. More...
 
SACADO_INLINE_FUNCTION
ViewStorage
operator= (const ViewStorage &x)
 Assignment. More...
 
SACADO_INLINE_FUNCTION
constexpr int 
size () const
 Returns number of derivative components. More...
 
SACADO_INLINE_FUNCTION
constexpr int 
length () const
 Returns array length. More...
 
SACADO_INLINE_FUNCTION void resize (int sz)
 Resize the derivative array to sz. More...
 
SACADO_INLINE_FUNCTION void resizeAndZero (int sz)
 Resize the derivative array to sz. More...
 
SACADO_INLINE_FUNCTION void expand (int sz)
 Expand derivative array to size sz. More...
 
SACADO_INLINE_FUNCTION void zero ()
 Zero out derivative array. More...
 
SACADO_INLINE_FUNCTION const Tval () const
 Returns value. More...
 
SACADO_INLINE_FUNCTION Tval ()
 Returns value. More...
 
SACADO_INLINE_FUNCTION const Tdx () const
 Returns derivative array. More...
 
SACADO_INLINE_FUNCTION T dx (int i) const
 Returns derivative component i with bounds checking. More...
 
SACADO_INLINE_FUNCTION TfastAccessDx (int i)
 Returns derivative component i without bounds checking. More...
 
SACADO_INLINE_FUNCTION const TfastAccessDx (int i) const
 Returns derivative component i without bounds checking. More...
 
SACADO_INLINE_FUNCTION
ViewFadPtr< T, static_length,
static_stride, U > 
operator& () const
 Overload of addressof operator. More...
 

Static Public Attributes

static constexpr bool is_statically_sized = (static_length > 0)
 
static constexpr int static_size = static_length
 
static constexpr bool is_view = true
 

Protected Attributes

const
mpl::integral_nonzero_constant
< int, static_length > 
sz_
 Derivative array size. More...
 
const
mpl::integral_nonzero_constant
< int, static_stride > 
stride_
 Derivative array stride. More...
 
Tval_
 Value. More...
 
Tdx_
 Derivative array. More...
 

Static Private Attributes

static constexpr bool stride_one = (1 == static_stride)
 

Friends

template<typename , unsigned , unsigned , typename >
class ViewStorage
 

Detailed Description

template<typename T, unsigned static_length, unsigned static_stride, typename U>
class Sacado::Fad::Exp::ViewStorage< T, static_length, static_stride, U >

Derivative array storage class that is a view into a contiguous memory allocation. It does not provide proper value semantics and thus should not be used in a general-purpose scalar type.

Definition at line 44 of file Sacado_Fad_Exp_ViewStorage.hpp.

Member Typedef Documentation

template<typename T, unsigned static_length, unsigned static_stride, typename U>
typedef std::remove_cv<T>::type Sacado::Fad::Exp::ViewStorage< T, static_length, static_stride, U >::value_type

Definition at line 53 of file Sacado_Fad_Exp_ViewStorage.hpp.

template<typename T, unsigned static_length, unsigned static_stride, typename U>
typedef U Sacado::Fad::Exp::ViewStorage< T, static_length, static_stride, U >::base_fad_type

Definition at line 57 of file Sacado_Fad_Exp_ViewStorage.hpp.

Constructor & Destructor Documentation

template<typename T, unsigned static_length, unsigned static_stride, typename U>
SACADO_INLINE_FUNCTION Sacado::Fad::Exp::ViewStorage< T, static_length, static_stride, U >::ViewStorage ( )
inline

Default constructor (needed to satisfy interface)

Definition at line 76 of file Sacado_Fad_Exp_ViewStorage.hpp.

template<typename T, unsigned static_length, unsigned static_stride, typename U>
SACADO_INLINE_FUNCTION Sacado::Fad::Exp::ViewStorage< T, static_length, static_stride, U >::ViewStorage ( T v,
const int  arg_size = 0,
const int  arg_stride = 0 
)
inline

Constructor.

Definition at line 81 of file Sacado_Fad_Exp_ViewStorage.hpp.

template<typename T, unsigned static_length, unsigned static_stride, typename U>
SACADO_INLINE_FUNCTION Sacado::Fad::Exp::ViewStorage< T, static_length, static_stride, U >::ViewStorage ( T arg_dx,
T arg_val,
const int  arg_size = 0,
const int  arg_stride = 0 
)
inline

Constructor.

Definition at line 86 of file Sacado_Fad_Exp_ViewStorage.hpp.

template<typename T, unsigned static_length, unsigned static_stride, typename U>
template<typename TT >
SACADO_INLINE_FUNCTION Sacado::Fad::Exp::ViewStorage< T, static_length, static_stride, U >::ViewStorage ( const ViewStorage< TT, static_length, static_stride, U > &  x,
typename std::enable_if< std::is_same< TT, T >::value||std::is_same< const TT, T >::value >::type *  = 0 
)
inline

Copy constructor.

Allow, e.g., ViewStorage<double,...>(ViewStorage<double,...>), ViewStorage<const double,...>(ViewStorage<double,...>), and ViewStorage<const double,...>(ViewStorage<const double,...>) but not ViewStorage<double,...>(ViewStorage<const double,...>).

Definition at line 99 of file Sacado_Fad_Exp_ViewStorage.hpp.

template<typename T, unsigned static_length, unsigned static_stride, typename U>
SACADO_INLINE_FUNCTION Sacado::Fad::Exp::ViewStorage< T, static_length, static_stride, U >::~ViewStorage ( )
inline

Destructor.

Definition at line 111 of file Sacado_Fad_Exp_ViewStorage.hpp.

Member Function Documentation

template<typename T, unsigned static_length, unsigned static_stride, typename U>
SACADO_INLINE_FUNCTION ViewStorage& Sacado::Fad::Exp::ViewStorage< T, static_length, static_stride, U >::operator= ( const ViewStorage< T, static_length, static_stride, U > &  x)
inline

Assignment.

Definition at line 115 of file Sacado_Fad_Exp_ViewStorage.hpp.

template<typename T, unsigned static_length, unsigned static_stride, typename U>
SACADO_INLINE_FUNCTION constexpr int Sacado::Fad::Exp::ViewStorage< T, static_length, static_stride, U >::size ( ) const
inline

Returns number of derivative components.

Definition at line 140 of file Sacado_Fad_Exp_ViewStorage.hpp.

template<typename T, unsigned static_length, unsigned static_stride, typename U>
SACADO_INLINE_FUNCTION constexpr int Sacado::Fad::Exp::ViewStorage< T, static_length, static_stride, U >::length ( ) const
inline

Returns array length.

Definition at line 144 of file Sacado_Fad_Exp_ViewStorage.hpp.

template<typename T, unsigned static_length, unsigned static_stride, typename U>
SACADO_INLINE_FUNCTION void Sacado::Fad::Exp::ViewStorage< T, static_length, static_stride, U >::resize ( int  sz)
inline

Resize the derivative array to sz.

Since we can't actually resize, we check for resizes to zero, which signify assigning a constant. Thus we zero out the derivative components.

Definition at line 153 of file Sacado_Fad_Exp_ViewStorage.hpp.

template<typename T, unsigned static_length, unsigned static_stride, typename U>
SACADO_INLINE_FUNCTION void Sacado::Fad::Exp::ViewStorage< T, static_length, static_stride, U >::resizeAndZero ( int  sz)
inline

Resize the derivative array to sz.

We don't do anything here as this is used in the context of resizing the derivative array to zero and then back to some size > 0. Instead we zero out components when it is resized to zero above.

Definition at line 164 of file Sacado_Fad_Exp_ViewStorage.hpp.

template<typename T, unsigned static_length, unsigned static_stride, typename U>
SACADO_INLINE_FUNCTION void Sacado::Fad::Exp::ViewStorage< T, static_length, static_stride, U >::expand ( int  sz)
inline

Expand derivative array to size sz.

Definition at line 168 of file Sacado_Fad_Exp_ViewStorage.hpp.

template<typename T, unsigned static_length, unsigned static_stride, typename U>
SACADO_INLINE_FUNCTION void Sacado::Fad::Exp::ViewStorage< T, static_length, static_stride, U >::zero ( )
inline

Zero out derivative array.

Definition at line 172 of file Sacado_Fad_Exp_ViewStorage.hpp.

template<typename T, unsigned static_length, unsigned static_stride, typename U>
SACADO_INLINE_FUNCTION const T& Sacado::Fad::Exp::ViewStorage< T, static_length, static_stride, U >::val ( ) const
inline

Returns value.

Definition at line 178 of file Sacado_Fad_Exp_ViewStorage.hpp.

template<typename T, unsigned static_length, unsigned static_stride, typename U>
SACADO_INLINE_FUNCTION T& Sacado::Fad::Exp::ViewStorage< T, static_length, static_stride, U >::val ( )
inline

Returns value.

Definition at line 182 of file Sacado_Fad_Exp_ViewStorage.hpp.

template<typename T, unsigned static_length, unsigned static_stride, typename U>
SACADO_INLINE_FUNCTION const T* Sacado::Fad::Exp::ViewStorage< T, static_length, static_stride, U >::dx ( ) const
inline

Returns derivative array.

Definition at line 186 of file Sacado_Fad_Exp_ViewStorage.hpp.

template<typename T, unsigned static_length, unsigned static_stride, typename U>
SACADO_INLINE_FUNCTION T Sacado::Fad::Exp::ViewStorage< T, static_length, static_stride, U >::dx ( int  i) const
inline

Returns derivative component i with bounds checking.

Definition at line 190 of file Sacado_Fad_Exp_ViewStorage.hpp.

template<typename T, unsigned static_length, unsigned static_stride, typename U>
SACADO_INLINE_FUNCTION T& Sacado::Fad::Exp::ViewStorage< T, static_length, static_stride, U >::fastAccessDx ( int  i)
inline

Returns derivative component i without bounds checking.

Definition at line 196 of file Sacado_Fad_Exp_ViewStorage.hpp.

template<typename T, unsigned static_length, unsigned static_stride, typename U>
SACADO_INLINE_FUNCTION const T& Sacado::Fad::Exp::ViewStorage< T, static_length, static_stride, U >::fastAccessDx ( int  i) const
inline

Returns derivative component i without bounds checking.

Definition at line 202 of file Sacado_Fad_Exp_ViewStorage.hpp.

template<typename T, unsigned static_length, unsigned static_stride, typename U>
SACADO_INLINE_FUNCTION ViewFadPtr<T,static_length,static_stride,U> Sacado::Fad::Exp::ViewStorage< T, static_length, static_stride, U >::operator& ( ) const
inline

Overload of addressof operator.

Definition at line 208 of file Sacado_Fad_Exp_ViewStorage.hpp.

Friends And Related Function Documentation

template<typename T, unsigned static_length, unsigned static_stride, typename U>
template<typename , unsigned , unsigned , typename >
friend class ViewStorage
friend

Definition at line 216 of file Sacado_Fad_Exp_ViewStorage.hpp.

Member Data Documentation

template<typename T, unsigned static_length, unsigned static_stride, typename U>
constexpr bool Sacado::Fad::Exp::ViewStorage< T, static_length, static_stride, U >::stride_one = (1 == static_stride)
staticprivate

Definition at line 49 of file Sacado_Fad_Exp_ViewStorage.hpp.

template<typename T, unsigned static_length, unsigned static_stride, typename U>
constexpr bool Sacado::Fad::Exp::ViewStorage< T, static_length, static_stride, U >::is_statically_sized = (static_length > 0)
static

Definition at line 54 of file Sacado_Fad_Exp_ViewStorage.hpp.

template<typename T, unsigned static_length, unsigned static_stride, typename U>
constexpr int Sacado::Fad::Exp::ViewStorage< T, static_length, static_stride, U >::static_size = static_length
static

Definition at line 55 of file Sacado_Fad_Exp_ViewStorage.hpp.

template<typename T, unsigned static_length, unsigned static_stride, typename U>
constexpr bool Sacado::Fad::Exp::ViewStorage< T, static_length, static_stride, U >::is_view = true
static

Definition at line 56 of file Sacado_Fad_Exp_ViewStorage.hpp.

template<typename T, unsigned static_length, unsigned static_stride, typename U>
const mpl::integral_nonzero_constant< int, static_length > Sacado::Fad::Exp::ViewStorage< T, static_length, static_stride, U >::sz_
protected

Derivative array size.

Definition at line 219 of file Sacado_Fad_Exp_ViewStorage.hpp.

template<typename T, unsigned static_length, unsigned static_stride, typename U>
const mpl::integral_nonzero_constant< int, static_stride > Sacado::Fad::Exp::ViewStorage< T, static_length, static_stride, U >::stride_
protected

Derivative array stride.

Definition at line 222 of file Sacado_Fad_Exp_ViewStorage.hpp.

template<typename T, unsigned static_length, unsigned static_stride, typename U>
T* Sacado::Fad::Exp::ViewStorage< T, static_length, static_stride, U >::val_
protected

Value.

Definition at line 225 of file Sacado_Fad_Exp_ViewStorage.hpp.

template<typename T, unsigned static_length, unsigned static_stride, typename U>
T* Sacado::Fad::Exp::ViewStorage< T, static_length, static_stride, U >::dx_
protected

Derivative array.

Definition at line 228 of file Sacado_Fad_Exp_ViewStorage.hpp.


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