Data< T, N_rank > Class Template Reference
[Classes of the ODIN data processing framework (odindata library)]

#include <data.h>

Inheritance diagram for Data< T, N_rank >:

Inheritance graph
[legend]
Collaboration diagram for Data< T, N_rank >:

Collaboration graph
[legend]
List of all members.

Public Member Functions

 Data (const TinyVector< int, N_rank > &dimvec, const T &val=0)
 Data ()
 Data (int extent1)
 Data (int extent1, int extent2)
 Data (int extent1, int extent2, int extent3)
 Data (int extent1, int extent2, int extent3, int extent4)
 Data (int extent1, int extent2, int extent3, int extent4, int extent5)
 Data (int extent1, int extent2, int extent3, int extent4, int extent5, int extent6)
 Data (int extent1, int extent2, int extent3, int extent4, int extent5, int extent6, int extent7)
 Data (int extent1, int extent2, int extent3, int extent4, int extent5, int extent6, int extent7, int extent8)
 Data (int extent1, int extent2, int extent3, int extent4, int extent5, int extent6, int extent7, int extent8, int extent9)
 Data (const STD_string &filename, bool readonly, const TinyVector< int, N_rank > &shape, LONGEST_INT offset=0)
 Data (const Data< T, N_rank > &d)
 Data (const Array< T, N_rank > &a)
 Data (const tjarray< tjvector< T >, T > &a)
template<class T_expr>
 Data (BZ_ETPARM(_bz_ArrayExpr< T_expr >) expr)
 ~Data ()
Data< T, N_rank > & operator= (const Data< T, N_rank > &d)
Data< T, N_rank > & operator= (const Array< T, N_rank > &a)
Data< T, N_rank > & operator= (const T &val)
template<class T_expr>
Data< T, N_rank > & operator= (BZ_ETPARM(_bz_ArrayExpr< T_expr >) expr)
Data< T, N_rank > & operator= (const tjarray< tjvector< T >, T > &a)
Array< T, N_rank > operator+ (const Data< T, N_rank > &b) const
Array< T, N_rank > operator- (const Data< T, N_rank > &b) const
Array< T, N_rank > operator * (const Data< T, N_rank > &b) const
Array< T, N_rank > operator/ (const Data< T, N_rank > &b) const
Array< T, N_rank > operator+ (const T &v) const
Array< T, N_rank > operator- (const T &v) const
Array< T, N_rank > operator * (const T &v) const
Array< T, N_rank > operator/ (const T &v) const
int read (const STD_string &format, const STD_string &filename, LONGEST_INT offset=0)
template<typename T2>
int read (const STD_string &filename, LONGEST_INT offset=0)
int write (const STD_string &format, const STD_string &filename, autoscaleOption scaleopt=autoscale) const
template<typename T2>
int write (const STD_string &filename, autoscaleOption scaleopt=autoscale) const
int write (const STD_string &filename, fopenMode mode=overwriteMode) const
int write_asc_file (const STD_string &filename, const Array< T, N_rank > &pre=defaultArray, const Array< T, N_rank > &post=defaultArray) const
int read_asc_file (const STD_string &filename)
int autowrite (const STD_string &filename, const FileWriteOpts &opts=FileWriteOpts(), const Protocol *prot=0) const
int autoread (const STD_string &filename, const FileReadOpts &opts=FileReadOpts(), Protocol *prot=0)
bool is_filemapped ()
 operator tjarray () const
TinyVector< int, N_rank > create_index (unsigned long index) const
unsigned long create_linear_index (TinyVector< int, N_rank > &indexvec) const
void shift (unsigned int shift_dim, int shift)
void congrid (const TinyVector< int, N_rank > &newshape, const TinyVector< float, N_rank > *subpixel_shift=0, bool left_to_right=false)
template<typename T2, int N_rank2>
Data< T2, N_rank2 > & convert_to (Data< T2, N_rank2 > &dst, autoscaleOption scaleopt=autoscale) const
Data< T, N_rank > & convert_to (Data< T, N_rank > &dst, autoscaleOption scaleopt=autoscale) const
template<typename D>
unsigned int dump_to (D *dst, unsigned int dstsize, autoscaleOption scaleopt=autoscale) const
T * c_array ()
void reference (const Data< T, N_rank > &d)

Static Public Attributes

static Array< T, N_rank > defaultArray

Detailed Description

template<typename T, int N_rank>
class Data< T, N_rank >

This template class holds multidimensional data. In addition to functionality provided by the Blitz Array class, it offers methods to read/write raw data and and other file formats (vista, vtk, ...) to/from a file. In addition, uing a special constructor, the array can be associated with a block of data on disk using the UNIX mmap functionality. In this case, any changes made to the array will be automatically tranfered to the file. Please note that any attempt to resize such an array will most likely cause a segmentation fault.

Definition at line 121 of file odindata/data.h.


Constructor & Destructor Documentation

template<typename T, int N_rank>
Data< T, N_rank >::Data ( const TinyVector< int, N_rank > &  dimvec,
const T &  val = 0 
) [inline]

Constructs an array with the given dimensionality and initial value

Definition at line 129 of file odindata/data.h.

template<typename T, int N_rank>
Data< T, N_rank >::Data ( const STD_string &  filename,
bool  readonly,
const TinyVector< int, N_rank > &  shape,
LONGEST_INT  offset = 0 
)

Maps the given file 'filename' into the newly created array via the the mmap function, see the mmap man page for details. The mapping is abolish when the array is destroyed (destructor). Other parameters:

Definition at line 439 of file odindata/data.h.

template<typename T, int N_rank>
Data< T, N_rank >::Data ( const Data< T, N_rank > &  d  )  [inline]

Copy constructor

Definition at line 158 of file odindata/data.h.

template<typename T, int N_rank>
Data< T, N_rank >::Data ( const Array< T, N_rank > &  a  )  [inline]

Copy constructor from Blitz::Array

Definition at line 163 of file odindata/data.h.

template<typename T, int N_rank>
Data< T, N_rank >::Data ( const tjarray< tjvector< T >, T > &  a  )  [inline]

Constructor from an equivalent tjarray (Arrays)

Definition at line 168 of file odindata/data.h.

template<typename T, int N_rank>
template<class T_expr>
Data< T, N_rank >::Data ( BZ_ETPARM(_bz_ArrayExpr< T_expr >)  expr  )  [inline]

Constructor from expression template

Definition at line 174 of file odindata/data.h.

template<typename T, int N_rank>
Data< T, N_rank >::~Data (  ) 

Destructor

Definition at line 472 of file odindata/data.h.


Member Function Documentation

template<typename T, int N_rank>
Data<T,N_rank>& Data< T, N_rank >::operator= ( const Data< T, N_rank > &  d  )  [inline]

Assignment operator

Definition at line 186 of file odindata/data.h.

template<typename T, int N_rank>
Data<T,N_rank>& Data< T, N_rank >::operator= ( const Array< T, N_rank > &  a  )  [inline]

Assignment operator from Blitz::Array

Reimplemented in ComplexData< N_rank >, ComplexData< 1 >, ComplexData< 2 >, ComplexData< 3 >, ComplexData< 4 >, and ComplexData< 5 >.

Definition at line 191 of file odindata/data.h.

template<typename T, int N_rank>
Data<T,N_rank>& Data< T, N_rank >::operator= ( const T &  val  )  [inline]

Fills all elements with 'val'

Reimplemented in ComplexData< N_rank >, ComplexData< 1 >, ComplexData< 2 >, ComplexData< 3 >, ComplexData< 4 >, and ComplexData< 5 >.

Definition at line 196 of file odindata/data.h.

template<typename T, int N_rank>
template<class T_expr>
Data<T,N_rank>& Data< T, N_rank >::operator= ( BZ_ETPARM(_bz_ArrayExpr< T_expr >)  expr  )  [inline]

Assignment operator for expression templates

Reimplemented in ComplexData< N_rank >, ComplexData< 1 >, ComplexData< 2 >, ComplexData< 3 >, ComplexData< 4 >, and ComplexData< 5 >.

Definition at line 202 of file odindata/data.h.

template<typename T, int N_rank>
Data< T, N_rank > & Data< T, N_rank >::operator= ( const tjarray< tjvector< T >, T > &  a  ) 

Assignment from an equivalent tjarray (Arrays)

Definition at line 494 of file odindata/data.h.

template<typename T, int N_rank>
int Data< T, N_rank >::read ( const STD_string &  format,
const STD_string &  filename,
LONGEST_INT  offset = 0 
)

Reads the array from a raw data file 'filename' of type 'format' which can be one of 's8bit, u8bit, s16bit, u16bit, s32bit, u32bit, float or double'. No resizing is performed prior to reading. Skip the first 'offset' bytes.

Definition at line 510 of file odindata/data.h.

template<typename T, int N_rank>
template<typename T2>
int Data< T, N_rank >::read ( const STD_string &  filename,
LONGEST_INT  offset = 0 
)

Reads the array from a raw data file 'filename' of type 'T2'. No resizing is performed prior to reading. Skip the first 'offset' bytes.

Definition at line 529 of file odindata/data.h.

template<typename T, int N_rank>
int Data< T, N_rank >::write ( const STD_string &  format,
const STD_string &  filename,
autoscaleOption  scaleopt = autoscale 
) const

Writes the array to a raw data file 'filename' of type 'format' which can be one of 's8bit, u8bit, s16bit, u16bit, s32bit, u32bit, float or double'.

Definition at line 559 of file odindata/data.h.

template<typename T, int N_rank>
template<typename T2>
int Data< T, N_rank >::write ( const STD_string &  filename,
autoscaleOption  scaleopt = autoscale 
) const

Writes the array to a raw data file 'filename' of type 'T2'.

Definition at line 599 of file odindata/data.h.

template<typename T, int N_rank>
int Data< T, N_rank >::write ( const STD_string &  filename,
fopenMode  mode = overwriteMode 
) const

Writes the array to a raw data file 'filename' of type the same type as the array is. The mode specifies whether an already existing file is overwritten, or the data is appended.

Definition at line 576 of file odindata/data.h.

template<typename T, int N_rank>
int Data< T, N_rank >::write_asc_file ( const STD_string &  filename,
const Array< T, N_rank > &  pre = defaultArray,
const Array< T, N_rank > &  post = defaultArray 
) const

Writes the array as a formatted ASCII file to 'filename', one value per line. If 'pre' is of the same size as this, its values are inserted before the value on each line, and the values of 'post' are inserted after the values of this array on each line. Return value is -1 if an error occurs.

Definition at line 618 of file odindata/data.h.

template<typename T, int N_rank>
int Data< T, N_rank >::read_asc_file ( const STD_string &  filename  ) 

reads in white-space separated data from ASCII file, no resizing is performed prior to reading Return value is -1 if an error occurs.

Definition at line 655 of file odindata/data.h.

template<typename T, int N_rank>
int Data< T, N_rank >::autowrite ( const STD_string &  filename,
const FileWriteOpts opts = FileWriteOpts(),
const Protocol prot = 0 
) const

Writes data set to file 'filename' in the format automatically detected by the given file extension. Extra options can be given by 'opts' and protocol settings can be overwritten by 'prot'. Returns number of slices, or -1 if it fails.

Definition at line 679 of file odindata/data.h.

template<typename T, int N_rank>
int Data< T, N_rank >::autoread ( const STD_string &  filename,
const FileReadOpts opts = FileReadOpts(),
Protocol prot = 0 
)

Reads data set from file 'filename' assuming the format automatically detected by the given file extension. Extra options can be given by 'opts' and protocol settings will be stored in 'prot'. Returns number of slices sucessfully read, or -1 if it fails.

Definition at line 685 of file odindata/data.h.

template<typename T, int N_rank>
bool Data< T, N_rank >::is_filemapped (  )  [inline]

Returns true if the array is associated with a file on disk

Definition at line 306 of file odindata/data.h.

template<typename T, int N_rank>
Data< T, N_rank >::operator tjarray< tjvector< T >, T > (  )  const

Exports this array into an equivalent tjarray (Arrays)

Definition at line 696 of file odindata/data.h.

template<typename T, int N_rank>
TinyVector< int, N_rank > Data< T, N_rank >::create_index ( unsigned long  index  )  const

Creates an index vector according to a linear index for the whole array by taking the shape into account.

Definition at line 755 of file odindata/data.h.

template<typename T, int N_rank>
unsigned long Data< T, N_rank >::create_linear_index ( TinyVector< int, N_rank > &  indexvec  )  const

Creates a linear index from an index vector

Definition at line 762 of file odindata/data.h.

template<typename T, int N_rank>
void Data< T, N_rank >::shift ( unsigned int  shift_dim,
int  shift 
)

Shift the data by 'shift' pixels in dimension 'shift_dim'. The data is shifted cyclically, i.e. the values which are shifted out at one edge of the array will be shifted in on the other edge.

Definition at line 777 of file odindata/data.h.

template<typename T, int N_rank>
void Data< T, N_rank >::congrid ( const TinyVector< int, N_rank > &  newshape,
const TinyVector< float, N_rank > *  subpixel_shift = 0,
bool  left_to_right = false 
)

Interpolate (or extrapolate) the data in the array to the new shape. The interpolation is performed dimension-by-dimension using the GSL spline interpolation routines. Add extra shift 'subpixel_shift' in units of pixels on the destination grid if 'subpixel_shift' is non-null. if 'left_to_right' is set to true, interpolation starts at the most left dimension, i.e. at those with the highest index, down to the lowest index. If set to false, interpolation is performed vice versa.

Definition at line 814 of file odindata/data.h.

template<typename T, int N_rank>
template<typename T2, int N_rank2>
Data< T2, N_rank2 > & Data< T, N_rank >::convert_to ( Data< T2, N_rank2 > &  dst,
autoscaleOption  scaleopt = autoscale 
) const

Converts the array to type 'T2', with dimensionality 'N_rank2' and stores the result in 'dst'. The scaling strategy can be specified by 'scaleopt'. 'dst' will be unique, i.e. no other references to the array exist. In addition to changing 'dst', a reference to the same array is returned for convenience.

Definition at line 711 of file odindata/data.h.

template<typename T, int N_rank>
template<typename D>
unsigned int Data< T, N_rank >::dump_to ( D *  dst,
unsigned int  dstsize,
autoscaleOption  scaleopt = autoscale 
) const

Copies the array into an c-array of type D via Converter::convert_array. Values will be multiplied by scale this factor and the offset added. The amount of the copied data is returned.

template<typename T, int N_rank>
T * Data< T, N_rank >::c_array (  ) 

Makes array unique and continuous and returns pointer to data

Definition at line 900 of file odindata/data.h.


The documentation for this class was generated from the following file:
Generated on Sat Jun 14 12:31:24 2008 by  doxygen 1.5.1