Basic data types, vectors and arrays used by ODIN (tjutils library)

Introduction

Well known data types, such as integers, floating point numbers, complex numbers, strings, vectors (1-dimensional) and arrays (multi-dimensional) are used in ODIN. For all these basic types discussed in this section, there exists a corresponding labeled data record (LDR) type (Labeled Data Record (LDR) implementation (odinpara library)). This LDR type is prefixed by 'LDR' followed the data type, e.g. 'float' has a LDR counterpart 'LDRfloat' with the same basic functionality. In addition, LDR parameters can be assigned a label, grouped together with other LDR parameters, written to and read from file etc.

Vectors

Vectors are implemented by the tjvector template class which is derived from the STL vector class. Its interface is therefore equivalent to that of the std::vector class. In addition, some useful functions are added. Some predefined vector classes are created by using the tjvector template class:

Arrays

Multidimensional arrays are covered by the tjarray template class. It is derived from the tjvector class to store the data. In addition, the information about the dimensionality and extent in each dimension is stored separately in the class by an ndim object. Some predefined array classes and their corresponding LDR type are created by using the tjarray template class:

Some examples on how to use these arrays:

farray fa1(3,3); // creates a 2-dimensional 3x3 array
fa1(0,1)=5.7; // assigns 5.7 to the second element in the firs row
farray fa2(3,3); // creates another 2-dimensional 3x3 array
fa1+fa2; // returns the element-wise sum of the two arrays
fa1.redim(1,2,3); // resizes fa1 to a 3-dimensional 1x2x3 array

Please see the class documention for a complete reference.