Vector of vectors of vectors. More...
#include <Vector3.hxx>
Public Types | |
typedef T | value_type |
typedef T * | pointer |
typedef T & | reference |
Public Member Functions | |
Vector3 () | |
Default constructor. More... | |
Vector3 (int) | |
Constructor. More... | |
Vector3 (Vector< int > &length) | |
Constructor. More... | |
template<class Allocator > | |
Vector3 (Vector< Vector< int >, Vect_Full, Allocator > &length) | |
Constructor. More... | |
~Vector3 () | |
Destructor. More... | |
int | GetLength () const |
Returns size along dimension 1. More... | |
int | GetSize () const |
Returns size along dimension 1. More... | |
int | GetLength (int i) const |
Returns the size of the inner vector of vectors #i. More... | |
int | GetSize (int i) const |
Returns the size of the inner vector of vectors #i. More... | |
int | GetLength (int i, int j) const |
Returns the size of the inner vector #i #j. More... | |
int | GetSize (int i, int j) const |
Returns the size of the inner vector #i #j. More... | |
size_t | GetMemorySize () const |
Returns the memory used by the object in bytes. More... | |
int | GetNelement () const |
Returns the total number of elements in the inner vectors. More... | |
int | GetNelement (int beg, int end) const |
Returns the total number of elements in a range of inner vectors. More... | |
int | GetNelement (int beg0, int end0, int beg1, int end1) const |
Returns the total number of elements in a range of inner vectors. More... | |
Vector< int > | GetShape (int i) const |
Returns the shape of a vector of vectors. More... | |
void | GetShape (int i, Vector< int > &shape) const |
Returns the shape of a vector of vectors. More... | |
void | Reallocate (int N) |
Reallocates the vector of vectors of vectors. More... | |
void | Reallocate (int i, int N) |
Reallocates the inner vector of vectors #i. More... | |
void | Reallocate (int i, int j, int N) |
Reallocates the inner vector #i #j. More... | |
template<class Td , class Allocatord > | |
void | Flatten (Vector< Td, VectFull, Allocatord > &data) const |
Returns all values in a vector. More... | |
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. More... | |
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. More... | |
void | PushBack (int i, int j, const T &x) |
Appends an element at the end of the inner vector #i #j. More... | |
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. More... | |
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. More... | |
void | PushBack (const Vector< Vector< Vector< T, Vect_Full, Allocator0 >, Vect_Full, Allocator1 >, Vect_Full, Allocator2 > &X) |
Appends a vector of vectors of vectors. More... | |
void | PushBack (const Vector3< T, Allocator0, Allocator1, Allocator2 > &X) |
Appends a vector of vectors of vectors. More... | |
void | Clear () |
Clears the vector. | |
void | Clear (int i) |
Clears a given inner vector of vectors. More... | |
void | Clear (int i, int j) |
Clears a given inner vector. More... | |
void | Fill (const T &x) |
Fills the vector with a given value. More... | |
Vector< Vector< Vector< T, Vect_Full, Allocator0 >, Vect_Full, Allocator1 >, Vect_Full, Allocator2 > & | GetVector () |
Returns the vector of vectors of vectors. More... | |
const Vector< Vector< Vector< T, Vect_Full, Allocator0 >, Vect_Full, Allocator1 >, Vect_Full, Allocator2 > & | GetVector () const |
Vector< Vector< T, Vect_Full, Allocator0 >, VectFull, Allocator1 > & | GetVector (int i) |
Returns a given inner vector of vectors. More... | |
const Vector< Vector< T, Vect_Full, Allocator0 >, VectFull, Allocator1 > & | GetVector (int i) const |
Returns a given inner vector of vectors. More... | |
Vector< T, Vect_Full, Allocator0 > & | GetVector (int i, int j) |
Returns a given inner vector. More... | |
const Vector< T, Vect_Full, Allocator0 > & | GetVector (int i, int j) const |
Returns a given inner vector. More... | |
const Vector< Vector< T, Vect_Full, Allocator0 >, VectFull, Allocator1 > & | operator() (int i) const |
Returns a given inner vector of vectors. More... | |
Vector< Vector< T, Vect_Full, Allocator0 >, VectFull, Allocator1 > & | operator() (int i) |
Returns a given inner vector of vectors. More... | |
const Vector< T, Vect_Full, Allocator0 > & | operator() (int i, int j) const |
Returns a given inner vector. More... | |
Vector< T, Vect_Full, Allocator0 > & | operator() (int i, int j) |
Returns a given inner vector. More... | |
const_reference | operator() (int i, int j, int k) const |
Returns an element of a given inner vector of a given vector of vectors. More... | |
reference | operator() (int i, int j, int k) |
Returns an element of a given inner vector of a given vector of vectors. More... | |
void | Print () const |
Displays the vector. | |
void | Write (string file_name, bool with_size=true) const |
Writes the instance in a binary file. More... | |
void | Write (ostream &file_stream, bool with_size=true) const |
Writes the instance in a stream in a binary format. More... | |
void | Read (string file_name, bool with_size=true) |
Reads the Vector3 from a file. More... | |
void | Read (istream &file_stream, bool with_size=true) |
Reads the Vector3 from a stream. More... | |
Public Attributes | |
const typedef T * | const_pointer |
const typedef T & | const_reference |
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 65 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 57 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 72 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 95 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 120 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 598 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 610 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 621 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 430 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 473 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 407 of file Vector3.cxx.
int Seldon::Vector3< T, Allocator0, Allocator1, Allocator2 >::GetLength |
Returns size along dimension 1.
Definition at line 135 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 158 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 184 of file Vector3.cxx.
size_t Seldon::Vector3< T, Allocator0, Allocator1, Allocator2 >::GetMemorySize |
Returns the memory used by the object in bytes.
In this method, the type T is assumed to be "static" such that sizeof(T) provides the correct size
Definition at line 210 of file Vector3.cxx.
int Seldon::Vector3< T, Allocator0, Allocator1, Allocator2 >::GetNelement |
Returns the total number of elements in the inner vectors.
Definition at line 229 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 249 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 288 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 336 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 353 of file Vector3.cxx.
int Seldon::Vector3< T, Allocator0, Allocator1, Allocator2 >::GetSize |
Returns size along dimension 1.
Definition at line 146 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 170 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 198 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 |
Returns the vector of vectors of vectors.
Definition at line 636 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 662 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 675 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 689 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 703 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 736 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 723 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 765 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 751 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 797 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 781 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 577 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 548 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 562 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 536 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 523 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 937 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 909 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 393 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 379 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 366 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 860 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 834 of file Vector3.cxx.