Vector of vectors of vectors. More...
#include <Vector3.hxx>
Public Types | |
typedef T | value_type |
typedef T * | pointer |
typedef const T * | const_pointer |
typedef T & | reference |
typedef const T & | const_reference |
Public Member Functions | |
Vector3 () | |
Default constructor. | |
Vector3 (int) | |
Constructor. | |
Vector3 (Vector< int > &length) | |
Constructor. | |
template<class Allocator > | |
Vector3 (Vector< Vector< int >, Vect_Full, Allocator > &length) | |
Constructor. | |
~Vector3 () | |
Destructor. | |
int | GetLength () const |
Returns size along dimension 1. | |
int | GetSize () const |
Returns size along dimension 1. | |
int | GetLength (int i) const |
Returns the size of the inner vector of vectors #i. | |
int | GetSize (int i) const |
Returns the size of the inner vector of vectors #i. | |
int | GetLength (int i, int j) const |
Returns the size of the inner vector #i #j. | |
int | GetSize (int i, int j) const |
Returns the size of the inner vector #i #j. | |
int | GetNelement () const |
Returns the total number of elements in the inner vectors. | |
int | GetNelement (int beg, int end) const |
Returns the total number of elements in a range of inner vectors. | |
int | GetNelement (int beg0, int end0, int beg1, int end1) const |
Returns the total number of elements in a range of inner vectors. | |
Vector< int > | GetShape (int i) const |
Returns the shape of a vector of vectors. | |
void | GetShape (int i, Vector< int > &shape) const |
Returns the shape of a vector of vectors. | |
void | Reallocate (int N) |
Reallocates the vector of vectors of vectors. | |
void | Reallocate (int i, int N) |
Reallocates the inner vector of vectors #i. | |
void | Reallocate (int i, int j, int N) |
Reallocates the inner vector #i #j. | |
template<class Td , class Allocatord > | |
void | Flatten (Vector< Td, VectFull, Allocatord > &data) const |
Returns all values in a vector. | |
template<class Td , class Allocatord > | |
void | Flatten (int beg, int end, Vector< Td, VectFull, Allocatord > &data) const |
Returns in a vector all values from a range of inner vectors of vectors. | |
template<class Td , class Allocatord > | |
void | Flatten (int beg0, int end0, int beg1, int end1, Vector< Td, VectFull, Allocatord > &data) const |
Returns in a vector all values from a range of inner vectors and of inner vectors of vectors. | |
void | PushBack (int i, int j, const T &x) |
Appends an element at the end of the inner vector #i #j. | |
void | PushBack (int i, const Vector< T, Vect_Full, Allocator0 > &X) |
Appends an inner vector at the end of the inner vector of vectors #i. | |
void | PushBack (const Vector< Vector< T, Vect_Full, Allocator0 >, Vect_Full, Allocator1 > &X) |
Appends an inner vector of vectors at the end of the vector. | |
void | PushBack (const Vector< Vector< Vector< T, Vect_Full, Allocator0 >, Vect_Full, Allocator1 >, Vect_Full, Allocator2 > &X) |
Appends a vector of vectors of vectors. | |
void | PushBack (const Vector3< T, Allocator0, Allocator1, Allocator2 > &X) |
Appends a vector of vectors of vectors. | |
void | Clear () |
Clears the vector. | |
void | Clear (int i) |
Clears a given inner vector of vectors. | |
void | Clear (int i, int j) |
Clears a given inner vector. | |
void | Fill (const T &x) |
Fills the vector with a given value. | |
Vector< Vector< Vector< T, Vect_Full, Allocator0 > , Vect_Full, Allocator1 > , Vect_Full, Allocator2 > & | GetVector () |
Returns the vector of vectors of vectors. | |
const Vector< Vector< Vector < T, Vect_Full, Allocator0 > , Vect_Full, Allocator1 > , Vect_Full, Allocator2 > & | GetVector () const |
Returns the vector of vectors of vectors. | |
Vector< Vector< T, Vect_Full, Allocator0 >, VectFull, Allocator1 > & | GetVector (int i) |
Returns a given inner vector of vectors. | |
const Vector< Vector< T, Vect_Full, Allocator0 > , VectFull, Allocator1 > & | GetVector (int i) const |
Returns a given inner vector of vectors. | |
Vector< T, Vect_Full, Allocator0 > & | GetVector (int i, int j) |
Returns a given inner vector. | |
const Vector< T, Vect_Full, Allocator0 > & | GetVector (int i, int j) const |
Returns a given inner vector. | |
const Vector< Vector< T, Vect_Full, Allocator0 > , VectFull, Allocator1 > & | operator() (int i) const |
Returns a given inner vector of vectors. | |
Vector< Vector< T, Vect_Full, Allocator0 >, VectFull, Allocator1 > & | operator() (int i) |
Returns a given inner vector of vectors. | |
const Vector< T, Vect_Full, Allocator0 > & | operator() (int i, int j) const |
Returns a given inner vector. | |
Vector< T, Vect_Full, Allocator0 > & | operator() (int i, int j) |
Returns a given inner vector. | |
const_reference | operator() (int i, int j, int k) const |
Returns an element of a given inner vector of a given vector of vectors. | |
reference | operator() (int i, int j, int k) |
Returns an element of a given inner vector of a given vector of vectors. | |
void | Print () const |
Displays the vector. | |
void | Write (string file_name, bool with_size=true) const |
Writes the instance in a binary file. | |
void | Write (ostream &file_stream, bool with_size=true) const |
Writes the instance in a stream in a binary format. | |
void | Read (string file_name, bool with_size=true) |
Reads the Vector3 from a file. | |
void | Read (istream &file_stream, bool with_size=true) |
Reads the Vector3 from a stream. | |
Protected Attributes | |
Vector< Vector< Vector< T, Vect_Full, Allocator0 > , Vect_Full, Allocator1 > , Vect_Full, Allocator2 > | data_ |
Vector of vectors of vectors.
Vector3 is a structure that acts like a vector of vectors of vectors. Both inner vectors and inner vectors of vectors can be of any dimension, so that this structure is more flexible than an Array3D.
T | numerical type of the inner vectors. | |
Allocator0 | allocator for the inner vectors. The default allocator is SELDON_DEFAULT_ALLOCATOR. | |
Allocator1 | allocator for the vector of vectors. It is recommended to choose NewAlloc or, for more efficient in reallocations, MallocObject (default allocator here): these allocators can manage an array of inner vectors. | |
Allocator2 | allocator for the vector of vectors of vectors. It is recommended to choose NewAlloc or, for more efficient in reallocations, MallocObject (default allocator here). |
Definition at line 72 of file Vector3.hxx.
Seldon::Vector3< T, Allocator0, Allocator1, Allocator2 >::Vector3 | ( | ) |
Seldon::Vector3< T, Allocator0, Allocator1, Allocator2 >::Vector3 | ( | int | length | ) |
Constructor.
The vector of vectors of vectors is allocated with length empty vectors of vectors.
[in] | length | the length of the vector of vectors of vectors. |
Definition at line 54 of file Vector3.cxx.
Seldon::Vector3< T, Allocator0, Allocator1, Allocator2 >::Vector3 | ( | Vector< int > & | length | ) |
Constructor.
The vector of vectors of vectors and the inner vectors of vectors are allocated.
[in] | length | the lengths of the inner vectors of vectors. The vector of vectors of vectors will obviously have as many elements as length has. |
Definition at line 69 of file Vector3.cxx.
Seldon::Vector3< T, Allocator0, Allocator1, Allocator2 >::Vector3 | ( | Vector< Vector< int >, Vect_Full, Allocator > & | length | ) |
Constructor.
The vector of vectors of vectors, the inner vectors of vectors and the inner vectors are allocated.
[in] | length | the lengths of the inner vectors of vectors and the inner vectors. The vector of vectors of vectors will obviously have as many elements as length has. |
Definition at line 92 of file Vector3.cxx.
Seldon::Vector3< T, Allocator0, Allocator1, Allocator2 >::~Vector3 | ( | ) |
Destructor.
The vector of vectors of vectors, the inner vectors of vectors and the inner vectors are deallocated.
Definition at line 117 of file Vector3.cxx.
void Seldon::Vector3< T, Allocator0, Allocator1, Allocator2 >::Clear | ( | int | i | ) |
Clears a given inner vector of vectors.
[in] | i | index of the vector of vectors to be cleared. |
Definition at line 575 of file Vector3.cxx.
void Seldon::Vector3< T, Allocator0, Allocator1, Allocator2 >::Clear | ( | int | i, | |
int | j | |||
) |
Clears a given inner vector.
[in] | i | index of the vector to be cleared. |
[in] | j | index of the vector to be cleared. |
Definition at line 587 of file Vector3.cxx.
void Seldon::Vector3< T, Allocator0, Allocator1, Allocator2 >::Fill | ( | const T & | x | ) |
Fills the vector with a given value.
[in] | x | value to fill the vector with. |
Definition at line 598 of file Vector3.cxx.
void Seldon::Vector3< T, Allocator0, Allocator1, Allocator2 >::Flatten | ( | Vector< Td, VectFull, Allocatord > & | data | ) | const |
Returns all values in a vector.
The output vector data contains all inner vectors concatenated in the same order as they appear in the current Vector2 instance.
[out] | data | all values from the current Vector2 instance. |
Definition at line 384 of file Vector3.cxx.
void Seldon::Vector3< T, Allocator0, Allocator1, Allocator2 >::Flatten | ( | int | beg0, | |
int | end0, | |||
int | beg1, | |||
int | end1, | |||
Vector< Td, VectFull, Allocatord > & | data | |||
) | const |
Returns in a vector all values from a range of inner vectors and of inner vectors of vectors.
The output vector data contains part of the inner vectors of vectors, in the index range [beg0, end0[, concatenated in the same order as they appear in the current Vector3 instance. For each inner vector of vectors, the range [beg1, end1[ of vectors is selected.
[in] | beg0 | inclusive lower-bound for the indexes of inner vectors of vectors. |
[in] | end0 | exclusive upper-bound for the indexes of inner vectors of vectors. |
[in] | beg1 | inclusive lower-bound for the indexes of vectors to be selected in the inner vectors of vectors. |
[in] | end1 | exclusive upper-bound for the indexes of vectors to be selected in the inner vectors of vectors. |
[out] | data | the values contained in the inner vectors of vectors [beg0, end0[, in which the vectors [beg1, end1[ were selected. |
Definition at line 450 of file Vector3.cxx.
void Seldon::Vector3< T, Allocator0, Allocator1, Allocator2 >::Flatten | ( | int | beg, | |
int | end, | |||
Vector< Td, VectFull, Allocatord > & | data | |||
) | const |
Returns in a vector all values from a range of inner vectors of vectors.
The output vector data contains all inner vectors, in the index range [beg, end[, concatenated in the same order as they appear in the current Vector3 instance.
[in] | beg | inclusive lower-bound for the indexes. |
[in] | end | exclusive upper-bound for the indexes. |
[out] | data | the values contained in the inner vectors [beg, end[. |
Definition at line 407 of file Vector3.cxx.
int Seldon::Vector3< T, Allocator0, Allocator1, Allocator2 >::GetLength | ( | int | i, | |
int | j | |||
) | const |
Returns the size of the inner vector #i #j.
[in] | i | index. |
[in] | j | index. |
Definition at line 181 of file Vector3.cxx.
int Seldon::Vector3< T, Allocator0, Allocator1, Allocator2 >::GetLength | ( | ) | const |
Returns size along dimension 1.
Definition at line 132 of file Vector3.cxx.
int Seldon::Vector3< T, Allocator0, Allocator1, Allocator2 >::GetLength | ( | int | i | ) | const |
Returns the size of the inner vector of vectors #i.
[in] | i | index. |
Definition at line 155 of file Vector3.cxx.
int Seldon::Vector3< T, Allocator0, Allocator1, Allocator2 >::GetNelement | ( | int | beg, | |
int | end | |||
) | const |
Returns the total number of elements in a range of inner vectors.
Returns the total number of elements in the range [beg, end[ of inner vectors of vectors.
[in] | beg | inclusive lower-bound for the indexes. |
[in] | end | exclusive upper-bound for the indexes. |
Definition at line 226 of file Vector3.cxx.
int Seldon::Vector3< T, Allocator0, Allocator1, Allocator2 >::GetNelement | ( | int | beg0, | |
int | end0, | |||
int | beg1, | |||
int | end1 | |||
) | const |
Returns the total number of elements in a range of inner vectors.
Returns the total number of elements in the range [beg0, end0[ of inner vectors of vectors, in which only the vectors in [beg1, end1[ are selected.
[in] | beg0 | inclusive lower-bound for the indexes of inner vectors of vectors. |
[in] | end0 | exclusive upper-bound for the indexes of inner vectors of vectors. |
[in] | beg1 | inclusive lower-bound for the indexes of vectors to be selected in the inner vectors of vectors. |
[in] | end1 | exclusive upper-bound for the indexes of vectors to be selected in the inner vectors of vectors. |
Definition at line 265 of file Vector3.cxx.
int Seldon::Vector3< T, Allocator0, Allocator1, Allocator2 >::GetNelement | ( | ) | const |
Returns the total number of elements in the inner vectors.
Definition at line 206 of file Vector3.cxx.
Vector< int > Seldon::Vector3< T, Allocator0, Allocator1, Allocator2 >::GetShape | ( | int | i | ) | const |
Returns the shape of a vector of vectors.
[in] | i | index of the vector of vectors. |
Definition at line 313 of file Vector3.cxx.
void Seldon::Vector3< T, Allocator0, Allocator1, Allocator2 >::GetShape | ( | int | i, | |
Vector< int > & | shape | |||
) | const |
Returns the shape of a vector of vectors.
[in] | i | index of the vector of vectors. |
[out] | shape | the lengths of the inner vectors of the i th vector of vectors. |
Definition at line 330 of file Vector3.cxx.
int Seldon::Vector3< T, Allocator0, Allocator1, Allocator2 >::GetSize | ( | int | i | ) | const |
Returns the size of the inner vector of vectors #i.
[in] | i | index. |
Definition at line 167 of file Vector3.cxx.
int Seldon::Vector3< T, Allocator0, Allocator1, Allocator2 >::GetSize | ( | ) | const |
Returns size along dimension 1.
Definition at line 143 of file Vector3.cxx.
int Seldon::Vector3< T, Allocator0, Allocator1, Allocator2 >::GetSize | ( | int | i, | |
int | j | |||
) | const |
Returns the size of the inner vector #i #j.
[in] | i | index. |
[in] | j | index. |
Definition at line 195 of file Vector3.cxx.
const Vector< T, Vect_Full, Allocator0 > & Seldon::Vector3< T, Allocator0, Allocator1, Allocator2 >::GetVector | ( | int | i, | |
int | j | |||
) | const |
Returns a given inner vector.
[in] | i | index of the inner vector. |
[in] | j | index of the inner vector. |
Definition at line 680 of file Vector3.cxx.
Vector< T, Vect_Full, Allocator0 > & Seldon::Vector3< T, Allocator0, Allocator1, Allocator2 >::GetVector | ( | int | i, | |
int | j | |||
) |
Returns a given inner vector.
[in] | i | index of the inner vector. |
[in] | j | index of the inner vector. |
Definition at line 666 of file Vector3.cxx.
Vector< Vector< Vector< T, Vect_Full, Allocator0 >, Vect_Full, Allocator1 >, Vect_Full, Allocator2 > & Seldon::Vector3< T, Allocator0, Allocator1, Allocator2 >::GetVector | ( | ) |
Returns the vector of vectors of vectors.
Definition at line 613 of file Vector3.cxx.
const Vector< Vector< Vector< T, Vect_Full, Allocator0 >, Vect_Full, Allocator1 >, Vect_Full, Allocator2 > & Seldon::Vector3< T, Allocator0, Allocator1, Allocator2 >::GetVector | ( | ) | const |
Returns the vector of vectors of vectors.
Definition at line 626 of file Vector3.cxx.
Vector< Vector< T, Vect_Full, Allocator0 >, VectFull, Allocator1 > & Seldon::Vector3< T, Allocator0, Allocator1, Allocator2 >::GetVector | ( | int | i | ) |
Returns a given inner vector of vectors.
[in] | i | index of the inner vector of vectors. |
Definition at line 639 of file Vector3.cxx.
const Vector< Vector< T, Vect_Full, Allocator0 >, VectFull, Allocator1 > & Seldon::Vector3< T, Allocator0, Allocator1, Allocator2 >::GetVector | ( | int | i | ) | const |
Returns a given inner vector of vectors.
[in] | i | index of the inner vector of vectors. |
Definition at line 652 of file Vector3.cxx.
const Vector< Vector< T, Vect_Full, Allocator0 >, VectFull, Allocator1 > & Seldon::Vector3< T, Allocator0, Allocator1, Allocator2 >::operator() | ( | int | i | ) | const |
Returns a given inner vector of vectors.
[in] | i | index of the inner vector of vectors. |
Definition at line 700 of file Vector3.cxx.
Vector3< T, Allocator0, Allocator1, Allocator2 >::reference Seldon::Vector3< T, Allocator0, Allocator1, Allocator2 >::operator() | ( | int | i, | |
int | j, | |||
int | k | |||
) |
Returns an element of a given inner vector of a given vector of vectors.
[in] | i | index of the inner vector of vectors. |
[in] | j | index of the inner vector in the vector of vectors #i. |
[in] | k | index of the element in the inner vector #j. |
Definition at line 774 of file Vector3.cxx.
Vector< Vector< T, Vect_Full, Allocator0 >, VectFull, Allocator1 > & Seldon::Vector3< T, Allocator0, Allocator1, Allocator2 >::operator() | ( | int | i | ) |
Returns a given inner vector of vectors.
[in] | i | index of the inner vector of vectors. |
Definition at line 713 of file Vector3.cxx.
Vector3< T, Allocator0, Allocator1, Allocator2 >::const_reference Seldon::Vector3< T, Allocator0, Allocator1, Allocator2 >::operator() | ( | int | i, | |
int | j, | |||
int | k | |||
) | const |
Returns an element of a given inner vector of a given vector of vectors.
[in] | i | index of the inner vector of vectors. |
[in] | j | index of the inner vector in the vector of vectors #i. |
[in] | k | index of the element in the inner vector #j. |
Definition at line 758 of file Vector3.cxx.
Vector< T, Vect_Full, Allocator0 > & Seldon::Vector3< T, Allocator0, Allocator1, Allocator2 >::operator() | ( | int | i, | |
int | j | |||
) |
Returns a given inner vector.
[in] | i | index of the inner vector. |
[in] | j | index of the inner vector. |
Definition at line 742 of file Vector3.cxx.
const Vector< T, Vect_Full, Allocator0 > & Seldon::Vector3< T, Allocator0, Allocator1, Allocator2 >::operator() | ( | int | i, | |
int | j | |||
) | const |
Returns a given inner vector.
[in] | i | index of the inner vector. |
[in] | j | index of the inner vector. |
Definition at line 728 of file Vector3.cxx.
void Seldon::Vector3< T, Allocator0, Allocator1, Allocator2 >::PushBack | ( | int | i, | |
int | j, | |||
const T & | x | |||
) |
Appends an element at the end of the inner vector #i #j.
[in] | i | index of the inner vector of vectors. |
[in] | j | index of the inner vector to which x should be appended. |
[in] | x | element to be appended. |
Definition at line 500 of file Vector3.cxx.
void Seldon::Vector3< T, Allocator0, Allocator1, Allocator2 >::PushBack | ( | const Vector< Vector< T, Vect_Full, Allocator0 >, Vect_Full, Allocator1 > & | X | ) |
Appends an inner vector of vectors at the end of the vector.
[in] | X | inner vector of vectors to be appended. |
Definition at line 525 of file Vector3.cxx.
void Seldon::Vector3< T, Allocator0, Allocator1, Allocator2 >::PushBack | ( | const Vector< Vector< Vector< T, Vect_Full, Allocator0 >, Vect_Full, Allocator1 >, Vect_Full, Allocator2 > & | X | ) |
Appends a vector of vectors of vectors.
The inner vectors of vectors of X are appended to the current instance, in the same order as they appear in X.
[in] | X | vector of vectors of vectors to be appended. |
Definition at line 539 of file Vector3.cxx.
void Seldon::Vector3< T, Allocator0, Allocator1, Allocator2 >::PushBack | ( | int | i, | |
const Vector< T, Vect_Full, Allocator0 > & | X | |||
) |
Appends an inner vector at the end of the inner vector of vectors #i.
[in] | i | index of the inner vector of vectors. |
[in] | X | inner vector to be appended. |
Definition at line 513 of file Vector3.cxx.
void Seldon::Vector3< T, Allocator0, Allocator1, Allocator2 >::PushBack | ( | const Vector3< T, Allocator0, Allocator1, Allocator2 > & | X | ) |
Appends a vector of vectors of vectors.
The inner vectors of vectors of X are appended to the current instance, in the same order as they appear in X.
[in] | X | vector of vectors of vectors to be appended. |
Definition at line 554 of file Vector3.cxx.
void Seldon::Vector3< T, Allocator0, Allocator1, Allocator2 >::Read | ( | string | file_name, | |
bool | with_size = true | |||
) |
Reads the Vector3 from a file.
Sets the current Vector3 instance according to a binary file.
[in] | file_name | file name. |
[in] | with_size | if set to 'false', the shape is not available in the file, the shape of the current instance is thus unchanged and the values of the elements are directly read in the file. |
Definition at line 886 of file Vector3.cxx.
void Seldon::Vector3< T, Allocator0, Allocator1, Allocator2 >::Read | ( | istream & | stream, | |
bool | with_size = true | |||
) |
Reads the Vector3 from a stream.
Sets the current Vector3 instance according to a binary stream.
[in,out] | stream | input stream. |
[in] | with_size | if set to 'false', the shape is not available in the stream, the shape of the current instance is thus unchanged and the values of the elements are directly read in the stream. |
Definition at line 914 of file Vector3.cxx.
void Seldon::Vector3< T, Allocator0, Allocator1, Allocator2 >::Reallocate | ( | int | N | ) |
Reallocates the vector of vectors of vectors.
[in] | N | the new size of the vector of vectors of vectors. |
Definition at line 343 of file Vector3.cxx.
void Seldon::Vector3< T, Allocator0, Allocator1, Allocator2 >::Reallocate | ( | int | i, | |
int | j, | |||
int | N | |||
) |
Reallocates the inner vector #i #j.
[in] | i | index of the inner vector of vectors. |
[in] | j | index of the inner vector to be reallocated. |
[in] | N | the new vector size. |
Definition at line 370 of file Vector3.cxx.
void Seldon::Vector3< T, Allocator0, Allocator1, Allocator2 >::Reallocate | ( | int | i, | |
int | N | |||
) |
Reallocates the inner vector of vectors #i.
[in] | i | index of the inner vector of vectors to be reallocated. |
[in] | N | the new size of the inner vector of vectors #i. |
Definition at line 356 of file Vector3.cxx.
void Seldon::Vector3< T, Allocator0, Allocator1, Allocator2 >::Write | ( | string | file_name, | |
bool | with_size = true | |||
) | const |
Writes the instance in a binary file.
[in] | file_name | file name. |
[in] | with_size | if set to 'false', the sizes are not saved so that the shape of the instance is lost. |
Definition at line 811 of file Vector3.cxx.
void Seldon::Vector3< T, Allocator0, Allocator1, Allocator2 >::Write | ( | ostream & | stream, | |
bool | with_size = true | |||
) | const |
Writes the instance in a stream in a binary format.
[in,out] | stream | output stream. |
[in] | with_size | if set to 'false', the sizes are not saved so that the shape of the instance is lost. |
Definition at line 837 of file Vector3.cxx.