Warning: this documentation for the development version is under construction.
3D array. More...
#include <Array3D.hxx>
Public Types | |
typedef Allocator::value_type | value_type |
typedef Allocator::pointer | pointer |
typedef Allocator::const_pointer | const_pointer |
typedef Allocator::reference | reference |
typedef Allocator::const_reference | const_reference |
Public Member Functions | |
Array3D () | |
Default constructor. | |
Array3D (int i, int j, int k) | |
Main constructor. | |
Array3D (const Array3D< T, Allocator > &A) | |
Copy constructor. | |
~Array3D () | |
Destructor. | |
int | GetLength1 () const |
Returns the length in dimension #1. | |
int | GetLength2 () const |
Returns the length in dimension #2. | |
int | GetLength3 () const |
Returns the length in dimension #3. | |
int | GetSize () const |
Returns the number of elements in the 3D array. | |
int | GetDataSize () const |
Returns the number of elements stored in memory. | |
pointer | GetData () const |
Returns a pointer to the data array. | |
void | Reallocate (int i, int j, int k) |
Reallocates memory to resize the 3D array. | |
void | Clear () |
Clears the array. | |
reference | operator() (int i, int j, int k) |
Access operator. | |
const_reference | operator() (int i, int j, int k) const |
Access operator. | |
Array3D< T, Allocator > & | operator= (const Array3D< T, Allocator > &A) |
Duplicates a 3D array (assignment operator). | |
void | Copy (const Array3D< T, Allocator > &A) |
Duplicates a 3D array. | |
void | Zero () |
Sets all elements to zero. | |
void | Fill () |
Fills the array. | |
template<class T0 > | |
void | Fill (const T0 &x) |
Fills the 3D array with a given value. | |
void | FillRand () |
Fills the 3D array randomly. | |
void | Print () const |
Displays the array on the standard output. | |
void | Write (string FileName) const |
Writes the 3D array in a file. | |
void | Write (ofstream &FileStream) const |
Writes the 3D array to an output stream. | |
void | Read (string FileName) |
Reads the 3D array from a file. | |
void | Read (ifstream &FileStream) |
Reads the 3D array from an input stream. | |
Protected Attributes | |
int | length1_ |
int | length2_ |
int | length3_ |
int | length23_ |
pointer | data_ |
Static Protected Attributes | |
static Allocator | array3D_allocator_ |
3D array.
This class implements 3D arrays.
Definition at line 38 of file Array3D.hxx.
Seldon::Array3D< T, Allocator >::Array3D | ( | ) | [inline] |
Default constructor.
On exit, the array is an empty 0x0x0 3D array.
Definition at line 37 of file Array3D.cxx.
Seldon::Array3D< T, Allocator >::Array3D | ( | int | i, | |
int | j, | |||
int | k | |||
) | [inline] |
Main constructor.
Builds a i x j x k 3D array, but data is not initialized.
i | length in dimension #1. | |
j | length in dimension #2. | |
k | length in dimension #3. |
Definition at line 56 of file Array3D.cxx.
void Seldon::Array3D< T, Allocator >::Clear | ( | ) | [inline] |
Clears the array.
Destructs the array.
Definition at line 213 of file Array3D.cxx.
void Seldon::Array3D< T, Allocator >::Copy | ( | const Array3D< T, Allocator > & | A | ) | [inline] |
Duplicates a 3D array.
A | 3D array to be copied. |
Definition at line 397 of file Array3D.cxx.
void Seldon::Array3D< T, Allocator >::Fill | ( | ) |
Fills the array.
On exit, the 3D array is filled with 1, 2, 3, 4, ... The order of those numbers depends on the storage.
Definition at line 429 of file Array3D.cxx.
void Seldon::Array3D< T, Allocator >::Fill | ( | const T0 & | x | ) |
Fills the 3D array with a given value.
On exit, the 3D array is filled with 'x'.
x | the value to fill the 3D array with. |
Definition at line 443 of file Array3D.cxx.
void Seldon::Array3D< T, Allocator >::FillRand | ( | ) |
Fills the 3D array randomly.
On exit, the 3D array is filled with random values.
Definition at line 455 of file Array3D.cxx.
Array3D< T, Allocator >::pointer Seldon::Array3D< T, Allocator >::GetData | ( | ) | const |
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 295 of file Array3D.cxx.
int Seldon::Array3D< T, Allocator >::GetDataSize | ( | ) | const |
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 281 of file Array3D.cxx.
int Seldon::Array3D< T, Allocator >::GetLength1 | ( | ) | const |
Returns the length in dimension #1.
Definition at line 232 of file Array3D.cxx.
int Seldon::Array3D< T, Allocator >::GetLength2 | ( | ) | const |
Returns the length in dimension #2.
Definition at line 243 of file Array3D.cxx.
int Seldon::Array3D< T, Allocator >::GetLength3 | ( | ) | const |
Returns the length in dimension #3.
Definition at line 254 of file Array3D.cxx.
int Seldon::Array3D< T, Allocator >::GetSize | ( | ) | const |
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 267 of file Array3D.cxx.
Array3D< T, Allocator >::reference Seldon::Array3D< T, Allocator >::operator() | ( | int | i, | |
int | j, | |||
int | k | |||
) | [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 316 of file Array3D.cxx.
Array3D< T, Allocator >::const_reference Seldon::Array3D< T, Allocator >::operator() | ( | int | i, | |
int | j, | |||
int | k | |||
) | const [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 351 of file Array3D.cxx.
Array3D< T, Allocator > & Seldon::Array3D< T, Allocator >::operator= | ( | const Array3D< T, Allocator > & | A | ) | [inline] |
Duplicates a 3D array (assignment operator).
A | 3D array to be copied. |
Definition at line 383 of file Array3D.cxx.
void Seldon::Array3D< T, Allocator >::Print | ( | ) | const |
Displays the array on the standard output.
Displays elements on the standard output, in text format.
Definition at line 468 of file Array3D.cxx.
void Seldon::Array3D< T, Allocator >::Read | ( | ifstream & | FileStream | ) |
Reads the 3D array from an input stream.
Reads a 3D array in binary format from an input stream. The dimensions of the array are read (i,j, k three integers), and array elements are then read in the same order as it should be in memory
FileStream | input stream. |
Definition at line 595 of file Array3D.cxx.
void Seldon::Array3D< T, Allocator >::Read | ( | string | FileName | ) |
Reads the 3D array from a file.
Reads a 3D array stored in binary format in a file. The dimensions of the array are read (i,j, k three integers), and array elements are then read in the same order as it should be in memory
FileName | input file name. |
Definition at line 567 of file Array3D.cxx.
void Seldon::Array3D< T, Allocator >::Reallocate | ( | int | i, | |
int | j, | |||
int | k | |||
) | [inline] |
Reallocates memory to resize the 3D array.
On exit, the array is a i x j x k 3D array.
i | length in dimension #1. | |
j | length in dimension #2. | |
k | length in dimension #3. |
Definition at line 161 of file Array3D.cxx.
void Seldon::Array3D< T, Allocator >::Write | ( | ofstream & | FileStream | ) | const |
Writes the 3D array to an output stream.
Writes the 3D array to an output stream in binary format. The number of rows (integer) and the number of columns (integer) are written, and array elements are then written in the same order as in memory
FileStream | output stream. |
Definition at line 526 of file Array3D.cxx.
void Seldon::Array3D< T, Allocator >::Write | ( | string | FileName | ) | const |
Writes the 3D array in a file.
Stores the 3D array in a file in binary format. The number of rows (integer) and the number of columns (integer) are written, and matrix elements are then written in the same order as in memory
FileName | output file name. |
Definition at line 499 of file Array3D.cxx.
void Seldon::Array3D< T, Allocator >::Zero | ( | ) |
Sets all elements to zero.
Definition at line 416 of file Array3D.cxx.