Multi-dimensional Array. More...
#include <Array.hxx>
Public Member Functions | |
Array () | |
Default constructor. More... | |
Array (int i) | |
Array (int i, int j, int k) | |
Main constructor. More... | |
Array (int i, int j, int k, int l) | |
Main constructor. More... | |
Array (int i, int j, int k, int l, int m) | |
Main constructor. More... | |
Array (int i, int j, int k, int l, int m, int n) | |
Main constructor. More... | |
Array (int i, int j, int k, int l, int m, int n, int o) | |
Main constructor. More... | |
Array (int i, int j, int k, int l, int m, int n, int o, int p) | |
Main constructor. More... | |
Array (int i, int j, int k, int l, int m, int n, int o, int p, int q) | |
Main constructor. More... | |
Array (const Array< T, N, Allocator > &A) | |
Copy constructor. | |
~Array () | |
Destructor. | |
int | GetLength (int dimension) const |
Returns the length in dimension #1. More... | |
long | GetSize () const |
Returns the number of elements in the 3D array. More... | |
long | GetDataSize () const |
Returns the number of elements stored in memory. More... | |
pointer | GetData () const |
Returns a pointer to the data array. More... | |
void | Reallocate (int i, int j, int k) |
Reallocates memory to resize the 3D array. More... | |
void | Reallocate (int i, int j, int k, int l) |
Reallocates memory to resize the 4D array. More... | |
void | Reallocate (int i, int j, int k, int l, int m) |
Reallocates memory to resize the 5D array. More... | |
void | Reallocate (int i, int j, int k, int l, int m, int n) |
Reallocates memory to resize the 6D array. More... | |
void | Reallocate (int i, int j, int k, int l, int m, int n, int o) |
Reallocates memory to resize the 7D array. More... | |
void | Reallocate (int i, int j, int k, int l, int m, int n, int o, int p) |
Reallocates memory to resize the 8D array. More... | |
void | Reallocate (int i, int j, int k, int l, int m, int n, int o, int p, int q) |
Reallocates memory to resize the 9D array. More... | |
void | Clear () |
Clears the array. More... | |
reference | operator() (int i, int j, int k) |
Access operator. More... | |
reference | operator() (int i, int j, int k, int l) |
Access operator. More... | |
reference | operator() (int i, int j, int k, int l, int m) |
Access operator. More... | |
reference | operator() (int i, int j, int k, int l, int m, int n) |
Access operator. More... | |
reference | operator() (int i, int j, int k, int l, int m, int n, int o) |
Access operator. More... | |
reference | operator() (int i, int j, int k, int l, int m, int n, int o, int p) |
Access operator. More... | |
reference | operator() (int i, int j, int k, int l, int m, int n, int o, int p, int q) |
Access operator. More... | |
const_reference | operator() (int i, int j, int k) const |
Access operator. More... | |
const_reference | operator() (int i, int j, int k, int l) const |
Access operator. More... | |
const_reference | operator() (int i, int j, int k, int l, int m) const |
Access operator. More... | |
const_reference | operator() (int i, int j, int k, int l, int m, int n) const |
Access operator. More... | |
const_reference | operator() (int i, int j, int k, int l, int m, int n, int o) const |
Access operator. More... | |
const_reference | operator() (int i, int j, int k, int l, int m, int n, int o, int p) const |
Access operator. More... | |
const_reference | operator() (int i, int j, int k, int l, int m, int n, int o, int p, int q) const |
Access operator. More... | |
Array< T, N, Allocator > & | operator= (const Array< T, N, Allocator > &A) |
Duplicates an array (assignment operator). More... | |
void | Copy (const Array< T, N, Allocator > &A) |
Duplicates an array. More... | |
size_t | GetMemorySize () const |
Returns the memory used by the object in bytes. More... | |
void | Zero () |
Sets all elements to zero. More... | |
void | Fill () |
Fills the array. More... | |
template<class T0 > | |
void | Fill (const T0 &x) |
Fills the array with a given value. More... | |
void | FillRand () |
Fills the array randomly. More... | |
void | Print () const |
Displays the array on the standard output. More... | |
void | Write (string FileName, bool with_size=true) const |
Writes the array in a file. More... | |
void | Write (ofstream &FileStream, bool with_size=true) const |
Writes the array to an output stream. More... | |
void | Read (string FileName, bool with_size=true) |
Reads the array from a file. More... | |
void | Read (ifstream &FileStream, bool with_size=true) |
Reads the array from an input stream. More... | |
Protected Attributes | |
int | length_ [N] |
long | offset_ [N] |
pointer | data_ |
Multi-dimensional Array.
This class implements multi-dimensional arrays.
Seldon::Array< T, N, Allocator >::Array |
Seldon::Array< T, N, Allocator >::Array | ( | int | i, |
int | j, | ||
int | k | ||
) |
Seldon::Array< T, N, Allocator >::Array | ( | int | i, |
int | j, | ||
int | k, | ||
int | l | ||
) |
Seldon::Array< T, N, Allocator >::Array | ( | int | i, |
int | j, | ||
int | k, | ||
int | l, | ||
int | m | ||
) |
Seldon::Array< T, N, Allocator >::Array | ( | int | i, |
int | j, | ||
int | k, | ||
int | l, | ||
int | m, | ||
int | n | ||
) |
Seldon::Array< T, N, Allocator >::Array | ( | int | i, |
int | j, | ||
int | k, | ||
int | l, | ||
int | m, | ||
int | n, | ||
int | o | ||
) |
Main constructor.
Builds a i x j x k x l x m x n x o 7D array, but data is not initialized.
i | length in dimension #1. |
j | length in dimension #2. |
k | length in dimension #3. |
l | length in dimension #4. |
m | length in dimension #5. |
n | length in dimension #6. |
o | length in dimension #7. |
Seldon::Array< T, N, Allocator >::Array | ( | int | i, |
int | j, | ||
int | k, | ||
int | l, | ||
int | m, | ||
int | n, | ||
int | o, | ||
int | p | ||
) |
Main constructor.
Builds a i x j x k x l x m x n x o x p 8D array, but data is not initialized.
i | length in dimension #1. |
j | length in dimension #2. |
k | length in dimension #3. |
l | length in dimension #4. |
m | length in dimension #5. |
n | length in dimension #6. |
o | length in dimension #7. |
p | length in dimension #8. |
Seldon::Array< T, N, Allocator >::Array | ( | int | i, |
int | j, | ||
int | k, | ||
int | l, | ||
int | m, | ||
int | n, | ||
int | o, | ||
int | p, | ||
int | q | ||
) |
Main constructor.
Builds a i x j x k x l x m x n x o x p x q 9D array, but data is not initialized.
i | length in dimension #1. |
j | length in dimension #2. |
k | length in dimension #3. |
l | length in dimension #4. |
m | length in dimension #5. |
n | length in dimension #6. |
o | length in dimension #7. |
p | length in dimension #8. |
q | length in dimension #9. |
void Seldon::Array< T, N, Allocator >::Clear |
void Seldon::Array< T, N, Allocator >::Copy | ( | const Array< T, N, Allocator > & | A | ) |
void Seldon::Array< T, N, Allocator >::Fill |
void Seldon::Array< T, N, Allocator >::Fill | ( | const T0 & | x | ) |
void Seldon::Array< T, N, Allocator >::FillRand |
|
inline |
Returns a pointer to the data array.
Returns a pointer to data, i.e. the data array 'data_' which stores the values.
Definition at line 91 of file ArrayInline.cxx.
|
inline |
Returns the number of elements stored in memory.
Returns the number of elements stored in memory by the array, i.e. the product of lengths in the three dimensions.
Definition at line 77 of file ArrayInline.cxx.
|
inline |
Returns the length in dimension #1.
dimension | index for dimension. |
Definition at line 50 of file ArrayInline.cxx.
size_t Seldon::Array< T, N, Allocator >::GetMemorySize |
|
inline |
Returns the number of elements in the 3D array.
Returns the number of elements stored by the 3D array, i.e. the product of the lengths in the three dimensions.
Definition at line 63 of file ArrayInline.cxx.
|
inline |
Access operator.
Returns the value of element (i, j, k).
i | index along dimension #1. |
j | index along dimension #2. |
k | index along dimension #3. |
Definition at line 112 of file ArrayInline.cxx.
|
inline |
Access operator.
Returns the value of element (i, j, k).
i | index along dimension #1. |
j | index along dimension #2. |
k | index along dimension #3. |
Definition at line 136 of file ArrayInline.cxx.
|
inline |
Access operator.
Returns the value of element (i, j, k, l).
i | index along dimension #1. |
j | index along dimension #2. |
k | index along dimension #3. |
l | index along dimension #4. |
Definition at line 161 of file ArrayInline.cxx.
|
inline |
Access operator.
Returns the value of element (i, j, k, l).
i | index along dimension #1. |
j | index along dimension #2. |
k | index along dimension #3. |
l | index along dimension #4. |
Definition at line 187 of file ArrayInline.cxx.
|
inline |
Access operator.
Returns the value of element (i, j, k, l, m).
i | index along dimension #1. |
j | index along dimension #2. |
k | index along dimension #3. |
l | index along dimension #4. |
m | index along dimension #5. |
Definition at line 214 of file ArrayInline.cxx.
|
inline |
Access operator.
Returns the value of element (i, j, k, l, m).
i | index along dimension #1. |
j | index along dimension #2. |
k | index along dimension #3. |
l | index along dimension #4. |
m | index along dimension #5. |
Definition at line 242 of file ArrayInline.cxx.
|
inline |
Access operator.
Returns the value of element (i, j, k, l, m, n).
i | index along dimension #1. |
j | index along dimension #2. |
k | index along dimension #3. |
l | index along dimension #4. |
m | index along dimension #5. |
n | index along dimension #6. |
Definition at line 272 of file ArrayInline.cxx.
|
inline |
Access operator.
Returns the value of element (i, j, k, l, m, n).
i | index along dimension #1. |
j | index along dimension #2. |
k | index along dimension #3. |
l | index along dimension #4. |
m | index along dimension #5. |
n | index along dimension #6. |
Definition at line 302 of file ArrayInline.cxx.
|
inline |
Access operator.
Returns the value of element (i, j, k, l, m, n, o).
i | index along dimension #1. |
j | index along dimension #2. |
k | index along dimension #3. |
l | index along dimension #4. |
m | index along dimension #5. |
n | index along dimension #6. |
o | index along dimension #7. |
Definition at line 333 of file ArrayInline.cxx.
|
inline |
Access operator.
Returns the value of element (i, j, k, l, m, n, o).
i | index along dimension #1. |
j | index along dimension #2. |
k | index along dimension #3. |
l | index along dimension #4. |
m | index along dimension #5. |
n | index along dimension #6. |
o | index along dimension #7. |
Definition at line 364 of file ArrayInline.cxx.
|
inline |
Access operator.
Returns the value of element (i, j, k, l, m, n, o, p).
i | index along dimension #1. |
j | index along dimension #2. |
k | index along dimension #3. |
l | index along dimension #4. |
m | index along dimension #5. |
n | index along dimension #6. |
o | index along dimension #7. |
p | index along dimension #8. |
Definition at line 396 of file ArrayInline.cxx.
|
inline |
Access operator.
Returns the value of element (i, j, k, l, m, n, o, p).
i | index along dimension #1. |
j | index along dimension #2. |
k | index along dimension #3. |
l | index along dimension #4. |
m | index along dimension #5. |
n | index along dimension #6. |
o | index along dimension #7. |
p | index along dimension #8. |
Definition at line 430 of file ArrayInline.cxx.
|
inline |
Access operator.
Returns the value of element (i, j, k, l, m, n, o, p, q).
i | index along dimension #1. |
j | index along dimension #2. |
k | index along dimension #3. |
l | index along dimension #4. |
m | index along dimension #5. |
n | index along dimension #6. |
o | index along dimension #7. |
p | index along dimension #8. |
q | index along dimension #9. |
Definition at line 464 of file ArrayInline.cxx.
|
inline |
Access operator.
Returns the value of element (i, j, k, l, m, n, o, p, q).
i | index along dimension #1. |
j | index along dimension #2. |
k | index along dimension #3. |
l | index along dimension #4. |
m | index along dimension #5. |
n | index along dimension #6. |
o | index along dimension #7. |
p | index along dimension #8. |
q | index along dimension #9. |
Definition at line 499 of file ArrayInline.cxx.
|
inline |
Duplicates an array (assignment operator).
A | array to be copied. |
Definition at line 526 of file ArrayInline.cxx.
void Seldon::Array< T, N, Allocator >::Print |
void Seldon::Array< T, N, Allocator >::Read | ( | ifstream & | FileStream, |
bool | with_size = true |
||
) |
void Seldon::Array< T, N, Allocator >::Read | ( | string | FileName, |
bool | with_size = true |
||
) |
void Seldon::Array< T, N, Allocator >::Reallocate | ( | int | i, |
int | j, | ||
int | k | ||
) |
void Seldon::Array< T, N, Allocator >::Reallocate | ( | int | i, |
int | j, | ||
int | k, | ||
int | l | ||
) |
void Seldon::Array< T, N, Allocator >::Reallocate | ( | int | i, |
int | j, | ||
int | k, | ||
int | l, | ||
int | m | ||
) |
Reallocates memory to resize the 5D array.
On exit, the array is a i x j x k x l x m 5D array.
i | length in dimension #1. |
j | length in dimension #2. |
k | length in dimension #3. |
l | length in dimension #4. |
m | length in dimension #5. |
void Seldon::Array< T, N, Allocator >::Reallocate | ( | int | i, |
int | j, | ||
int | k, | ||
int | l, | ||
int | m, | ||
int | n | ||
) |
Reallocates memory to resize the 6D array.
On exit, the array is a i x j x k x l x m x n 6D array.
i | length in dimension #1. |
j | length in dimension #2. |
k | length in dimension #3. |
l | length in dimension #4. |
m | length in dimension #5. |
n | length in dimension #6. |
void Seldon::Array< T, N, Allocator >::Reallocate | ( | int | i, |
int | j, | ||
int | k, | ||
int | l, | ||
int | m, | ||
int | n, | ||
int | o | ||
) |
Reallocates memory to resize the 7D array.
On exit, the array is a i x j x k x l x m x n x o 7D array.
i | length in dimension #1. |
j | length in dimension #2. |
k | length in dimension #3. |
l | length in dimension #4. |
m | length in dimension #5. |
n | length in dimension #6. |
o | length in dimension #7. |
void Seldon::Array< T, N, Allocator >::Reallocate | ( | int | i, |
int | j, | ||
int | k, | ||
int | l, | ||
int | m, | ||
int | n, | ||
int | o, | ||
int | p | ||
) |
Reallocates memory to resize the 8D array.
On exit, the array is a i x j x k x l x m x n x o x p 8D array.
i | length in dimension #1. |
j | length in dimension #2. |
k | length in dimension #3. |
l | length in dimension #4. |
m | length in dimension #5. |
n | length in dimension #6. |
o | length in dimension #7. |
p | length in dimension #8. |
void Seldon::Array< T, N, Allocator >::Reallocate | ( | int | i, |
int | j, | ||
int | k, | ||
int | l, | ||
int | m, | ||
int | n, | ||
int | o, | ||
int | p, | ||
int | q | ||
) |
Reallocates memory to resize the 9D array.
On exit, the array is a i x j x k x l x m x n x o x p x q 9D array.
i | length in dimension #1. |
j | length in dimension #2. |
k | length in dimension #3. |
l | length in dimension #4. |
m | length in dimension #5. |
n | length in dimension #6. |
o | length in dimension #7. |
p | length in dimension #8. |
q | length in dimension #9. |
void Seldon::Array< T, N, Allocator >::Write | ( | ofstream & | FileStream, |
bool | with_size = true |
||
) | const |
void Seldon::Array< T, N, Allocator >::Write | ( | string | FileName, |
bool | with_size = true |
||
) | const |
void Seldon::Array< T, N, Allocator >::Zero |