Sacado Development
Loading...
Searching...
No Matches
Classes | Public Types | Public Member Functions | Static Public Attributes | Protected Attributes | List of all members
Sacado::Fad::StaticStorage< T, Num > Class Template Reference

Derivative array storage class using static memory allocation. More...

#include <Sacado_Fad_StaticStorage.hpp>

Classes

struct  apply
 Turn StaticStorage into a meta-function class usable with mpl::apply. More...
 
struct  apply_N
 Replace static derivative length (interpreted as a fixed length) More...
 

Public Types

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

Public Member Functions

 StaticStorage ()
 Default constructor.
 
 StaticStorage (const T &x)
 Constructor with value.
 
 StaticStorage (const int sz, const T &x, const DerivInit zero_out=InitDerivArray)
 Constructor with size sz.
 
 StaticStorage (const int sz, const int i, const value_type &x)
 Constructor with size sz, index i, and value x.
 
 StaticStorage (const StaticStorage &x)
 Copy constructor.
 
 StaticStorage (StaticStorage &&x)
 Move constructor.
 
 ~StaticStorage ()
 Destructor.
 
StaticStorage & operator= (const StaticStorage &x)
 Assignment.
 
StaticStorage & operator= (StaticStorage &&x)
 Move assignment.
 
int size () const
 Returns number of derivative components.
 
int length () const
 Returns array length.
 
void resize (int sz)
 Resize the derivative array to sz.
 
void resizeAndZero (int sz)
 Resize the derivative array to sz.
 
void expand (int sz)
 Expand derivative array to size sz.
 
void zero ()
 Zero out derivative array.
 
const T & val () const
 Returns value.
 
T & val ()
 Returns value.
 
const T * dx () const
 Returns derivative array.
 
T dx (int i) const
 Returns derivative component i with bounds checking.
 
T & fastAccessDx (int i)
 Returns derivative component i without bounds checking.
 
const T & fastAccessDx (int i) const
 Returns derivative component i without bounds checking.
 

Static Public Attributes

static constexpr bool is_statically_sized = false
 
static constexpr int static_size = 0
 
static constexpr bool is_view = false
 

Protected Attributes

T val_
 Value.
 
T dx_ [Num]
 Derivative array.
 
int sz_
 Size of derivative array.
 

Detailed Description

template<typename T, int Num>
class Sacado::Fad::StaticStorage< T, Num >

Derivative array storage class using static memory allocation.

This class uses a statically allocated array whose dimension is fixed by the template parameter Num.

Constructor & Destructor Documentation

◆ StaticStorage() [1/2]

template<typename T , int Num>
Sacado::Fad::StaticStorage< T, Num >::StaticStorage ( const int  sz,
const T &  x,
const DerivInit  zero_out = InitDerivArray 
)
inline

Constructor with size sz.

Initializes derivative array 0 of length sz

References Sacado::Fad::StaticStorage< T, Num >::dx_, Sacado::Fad::StaticStorage< T, Num >::sz_, and Sacado::ss_array< T, isScalar >::zero().

◆ StaticStorage() [2/2]

template<typename T , int Num>
Sacado::Fad::StaticStorage< T, Num >::StaticStorage ( const int  sz,
const int  i,
const value_type &  x 
)
inline

Constructor with size sz, index i, and value x.

Initializes value to x and derivative array of length sz as row i of the identity matrix, i.e., sets derivative component i to 1 and all other's to zero.

References Sacado::Fad::StaticStorage< T, Num >::dx_.

Member Function Documentation

◆ expand()

template<typename T , int Num>
void Sacado::Fad::StaticStorage< T, Num >::expand ( int  sz)
inline

Expand derivative array to size sz.

This method preserves any existing derivative components and sets any that are added to zero.

References Sacado::Fad::StaticStorage< T, Num >::dx_, Sacado::Fad::StaticStorage< T, Num >::sz_, and Sacado::ss_array< T, isScalar >::zero().

◆ resizeAndZero()

template<typename T , int Num>
void Sacado::Fad::StaticStorage< T, Num >::resizeAndZero ( int  sz)
inline

Resize the derivative array to sz.

This method doest not preserve any existing derivative components but sets any that are added to zero.

References Sacado::Fad::StaticStorage< T, Num >::dx_, Sacado::Fad::StaticStorage< T, Num >::sz_, and Sacado::ss_array< T, isScalar >::zero().


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