Main Page | User's Guide | Namespace List | Class Hierarchy | Class List | Directories | File List | Namespace Members | Class Members

Seldon::Array3D< T, Allocator > Class Template Reference

3D array. More...

#include <Array3D.hxx>

List of all members.

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 ()
 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.
reference operator() (int i, int j, int k)
 Access operator.
const_reference operator() (int i, int j, int k) const
 Access 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.

Protected Attributes

int length1_
int length2_
int length3_
int length23_
pointer data_

Static Protected Attributes

static Allocator array3D_allocator_


Detailed Description

template<class T, class Allocator = SELDON_DEFAULT_ALLOCATOR<T>>
class Seldon::Array3D< T, Allocator >

3D array.

This class implements 3D arrays.


Constructor & Destructor Documentation

template<class T, class Allocator>
Seldon::Array3D< T, Allocator >::Array3D  )  [inline]
 

Default constructor.

On exit, the array is an empty 0x0x0 3D array.

template<class T, class Allocator>
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.

Parameters:
i length in dimension #1.
j length in dimension #2.
k length in dimension #3.


Member Function Documentation

template<class T, class Allocator>
void Seldon::Array3D< T, Allocator >::Copy const Array3D< T, Allocator > &  A  )  [inline]
 

Duplicates a 3D array.

Parameters:
A 3D array to be copied.
Note:
Memory is duplicated: 'A' is therefore independent from the current instance after the copy.

template<class T, class Allocator>
template<class T0>
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'.

Parameters:
x the value to fill the 3D array with.

template<class T, class Allocator>
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.

template<class T, class Allocator>
void Seldon::Array3D< T, Allocator >::FillRand  ) 
 

Fills the 3D array randomly.

On exit, the 3D array is filled with random values.

template<class T, class Allocator>
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.

Returns:
A pointer to the data array.

template<class T, class Allocator>
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.

Returns:
The number of elements stored in the array.

template<class T, class Allocator>
int Seldon::Array3D< T, Allocator >::GetLength1  )  const
 

Returns the length in dimension #1.

Returns:
The length in dimension #1.

template<class T, class Allocator>
int Seldon::Array3D< T, Allocator >::GetLength2  )  const
 

Returns the length in dimension #2.

Returns:
The length in dimension #2.

template<class T, class Allocator>
int Seldon::Array3D< T, Allocator >::GetLength3  )  const
 

Returns the length in dimension #3.

Returns:
The length in dimension #3.

template<class T, class Allocator>
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.

Returns:
The number of elements in the 3D array.

template<class T, class Allocator>
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).

Parameters:
i index along dimension #1.
j index along dimension #2.
k index along dimension #3.
Returns:
Element (i, j, k) of the 3D array.

template<class T, class Allocator>
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).

Parameters:
i index along dimension #1.
j index along dimension #2.
k index along dimension #3.
Returns:
Element (i, j, k) of the 3D array.

template<class T, class Allocator>
void Seldon::Array3D< T, Allocator >::Print  )  const
 

Displays the array on the standard output.

Displays elements on the standard output, in text format.

template<class T, class Allocator>
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.

Parameters:
i length in dimension #1.
j length in dimension #2.
k length in dimension #3.
Warning:
Depending on your allocator, data may be lost.

template<class T, class Allocator>
void Seldon::Array3D< T, Allocator >::Zero  ) 
 

Sets all elements to zero.

Warning:
It fills the memory with zeros. If the 3D array stores complex structures, use 'Fill' instead.


The documentation for this class was generated from the following files:
Generated on Sun Jan 16 23:38:01 2005 for Multivac by  doxygen 1.4.0