Doxygen 1.9.1
Toolkit for Adaptive Stochastic Modeling and Non-Intrusive ApproximatioN: Tasmanian v8.2 (development)
TasGrid::Data2D< T > Class Template Reference

Generic 2D data structure divided into contiguous strips of fixed length (similar to a matrix). More...

#include <tsgIndexSets.hpp>

Public Member Functions

 Data2D ()
 Default constructor makes an empty data-structure.
 
template<typename IntTypeA , typename IntTypeB >
 Data2D (IntTypeA new_stride, IntTypeB new_num_strips)
 Create data-structure with given stride and number of strips.
 
template<typename IntTypeA , typename IntTypeB >
 Data2D (IntTypeA new_stride, IntTypeB new_num_strips, T val)
 Create data-structure with given stride and number of strips and initializes with val.
 
template<typename IntTypeA , typename IntTypeB >
 Data2D (IntTypeA new_stride, IntTypeB new_num_strips, std::vector< T > &&data)
 Create data-structure with given stride and number of strips and moves data into the internal vector.
 
 ~Data2D ()=default
 Default destructor.
 
template<bool iomode, IO::IOPad pad>
void writeVector (std::ostream &os) const
 Write the internal vector to a stream.
 
bool empty () const
 Returns true if the number of strips is zero.
 
Data2D< T > splitData (int ibegin, int iend) const
 Get the data between ibegin and iend of each strip.
 
T * getStrip (int i)
 Returns a reference to the i-th strip.
 
T const * getStrip (int i) const
 Returns a const reference to the i-th strip.
 
std::vector< T >::iterator getIStrip (int i)
 Return iterator set at the i-th strip.
 
size_t getStride () const
 Returns the stride.
 
int getNumStrips () const
 Returns the number of strips.
 
size_t getTotalEntries () const
 Returns the total number of entries, stride times number of trips.
 
T * data ()
 Returns a reference to the internal data.
 
T const * data () const
 Returns a const reference to the internal data.
 
void clear ()
 Clear all used data.
 
std::vector< T > release ()
 Moves the data vector out of the class, this method invalidates the object.
 
std::vector< T >::iterator begin ()
 Returns an iterator to the beginning of the internal data.
 
std::vector< T >::const_iterator begin () const
 Returns a const iterator to the beginning of the internal data.
 
std::vector< T >::iterator end ()
 Returns an iterator to the end of the internal data.
 
std::vector< T >::const_iterator end () const
 Returns a const iterator to the end of the internal data.
 
std::vector< T >::reverse_iterator rbegin ()
 Returns a reverse iterator to the end of the internal data.
 
void appendStrip (typename std::vector< T >::const_iterator const &x)
 Uses std::vector::insert to append the data.
 
void appendStrip (const std::vector< T > &x)
 Uses std::vector::insert to append x, assumes x.size() is one stride.
 
void appendStrip (int pos, const std::vector< T > &x)
 Uses std::vector::insert to append a strip x to the existing data at position pos, assumes x.size() is one stride.
 
void append (Data2D< T > const &other)
 Uses std::vector::insert to append all the data from the other to this.
 

Detailed Description

template<typename T>
class TasGrid::Data2D< T >

Generic 2D data structure divided into contiguous strips of fixed length (similar to a matrix).

Many of the internal data-structures relevant to sparse grids can be represented as two dimensional arrays. The data is divided into strips of equal stride, e.g., number of multi-indexes and number of dimensions. Internally the class uses std::vector with type T, when used, T is almost always double or int.


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