dlr::numeric::Array3D< Type > Class Template Reference

The Array3D class template represents a 3D array of arbitrary type. More...

#include <array3D.h>

List of all members.

Public Types

typedef Type value_type
 Typedef for value_type describes the contents of the array.
typedef Type * iterator
 Typedef for iterator type helps with standard library interface.
typedef const Type * const_iterator
 Typedef for const_iterator type helps with standard library interface.

Public Member Functions

 Array3D ()
 Default constructor initializes to zero size.
 Array3D (size_t arrayShape0, size_t arrayShape1, size_t arrayShape2)
 Construct an arrayShape0 x arrayShape1 x arrayShape2 array.
 Array3D (const std::string &inputString)
 Construct from an initialization string.
 Array3D (const Array3D< Type > &source)
 The copy constructor does a shallow copy.
 Array3D (size_t arrayShape0, size_t arrayShape1, size_t arrayShape2, Type *const dataPtr)
 Construct an array around external data.
virtual ~Array3D ()
 Destroys the Array3D instance and deletes the internal data store if no remaining arrays point to it.
iterator begin ()
 Return begin() iterator for Standard Library algorithms.
const_iterator begin () const
 Return begin() const_iterator for Standard Library algorithms.
void clear ()
 Reset the array to zero size, abandoning all contents.
void checkDimension (size_t arrayShape0, size_t arrayShape1, size_t arrayShape2) const
 Optionally throw an exception if the shape of *this is different than specified.
Array3D< Type > copy () const
 Allocates a new array and deep copies the contents of *this.
template<class Type2 >
void copy (const Array3D< Type2 > &source)
 Deep copies the contents of source.
template<class Type2 >
void copy (const Type2 *dataPtr)
 Copies elements from dataPtr.
Type * data ()
 Returns a pointer to the internal data store.
const Type * data () const
 This version of data(void) is appropriate for const Array2D, and returns a pointer-to-const.
Type * data (size_t index)
 Just like data(void), which is documented above, but returns a pointer to the (index)th element instead of the first element.
const Type * data (size_t index) const
 This version of data(size_t) is appropriate for const Array1D, and returns a pointer-to-const.
Type * data (size_t index0, size_t index1, size_t index2)
 Just like data(void), but returns a pointer to the element indexed by (index0, index1, index2).
const Type * data (size_t index0, size_t index1, size_t index2) const
 This version of data(size_t, size_t, size_t) is appropriate for const Array3D, and returns a pointer-to-const.
bool empty () const
 This member function returns true if the array instance contains no elements.
iterator end ()
 Return end() iterator for Standard Library algorithms.
const_iterator end () const
 Return end() const_iterator for Standard Library algorithms.
Type getElement (size_t index0) const
 This member function returns a specific element of the array by value.
Type getElement (size_t index0, size_t index1, size_t index2) const
 This member function returns a specific element of the array by value.
std::istream & readFromStream (std::istream &inputStream)
 This member function sets the value of the array from an input stream.
void reinit (size_t arrayShape0, size_t arrayShape1, size_t arrayShape2)
 Changes the shape of the array and reallocates storage.
void reinitIfNecessary (size_t arrayShape0, size_t arrayShape1, size_t arrayShape2)
 Behaves just like member function reinit() unless *this already has the requested shape, in which case this member function does nothing, or *this has the requested size (but a different shape), in which case this member function behaves just like member function resize().
void reshape (int arrayShape0, int arrayShape1, int arrayShape2)
 Changes the shape of the array.
Type & setElement (size_t index0, const Type &value)
 This member function sets the value of a specific element of the array.
Type & setElement (size_t index0, size_t index1, size_t index2, const Type &value)
 This member function sets the value of a specific element of the array.
Array1D< size_t > shape () const
 Returns a 3 element Array1D containing the dimension of *this along each axis.
size_t shape (size_t axis) const
 Returns the array dimension along the the axis indicated by index.
size_t shape0 () const
 Returns the array dimension along axis 0.
size_t shape1 () const
 Returns the array dimension along axis 1.
size_t shape2 () const
 Returns the array dimension along axis 2.
size_t size () const
 Returns the number of elements in the array.
Array2D< Type > slice (size_t index)
 Returns an Array2D<Type> which addresses an entire (rows x columns) slice of *this.
const Array2D< Type > slice (size_t index) const
 Returns a const Array2D<Type> which addresses an entire (rows x columns) slice of *this.
Array3D< Type > & operator= (const Array3D< Type > &source)
 Assignment operator shallow copies the contents of source.
Array3D< Type > & operator= (Type value)
 Assign value to every element in the array.
Type & operator() (size_t index)
 Returns the (index)th element of the array by reference.
Type operator() (size_t index) const
 Returns the (index)th element of the array by value.
Type & operator() (size_t index0, size_t index1, size_t index2)
 Returns one element of the array by reference.
Type operator() (size_t index0, size_t index1, size_t index2) const
 Returns one element of the array by value.
Type & operator[] (size_t index)
 Returns the (index)th element of the array by reference.
Type operator[] (size_t index) const
 Returns the (index)th element of the array by value.
template<class Type2 >
Array3D< Type > & operator*= (const Array3D< Type2 > &arg)
 Multiplies each element of *this by the value of the corresponding element of arg.
template<class Type2 >
Array3D< Type > & operator/= (const Array3D< Type2 > &arg)
 Divides each element of *this by the value of the corresponding element of arg.
template<class Type2 >
Array3D< Type > & operator+= (const Array3D< Type2 > &arg)
 Increments each element of *this by the value of the corresponding element of arg.
template<class Type2 >
Array3D< Type > & operator-= (const Array3D< Type2 > &arg)
 Decrements each element of *this by the value of the corresponding element of arg.
Array3D< Type > & operator+= (const Type arg)
 Increments each element of *this by a constant.
Array3D< Type > & operator-= (const Type arg)
 Decrements each element of *this by a constant.
Array3D< Type > & operator*= (const Type arg)
 Multiplies each element of *this by a constant.
Array3D< Type > & operator/= (const Type arg)
 Divides each element of *this by a constant.


Detailed Description

template<class Type>
class dlr::numeric::Array3D< Type >

The Array3D class template represents a 3D array of arbitrary type.

This class has internal reference counting.

IMPORTANT: This class does _shallow_ copies by default. If you type:

array1 = array2;

then array1 and array2 point to the same data. To do a deep copy, type

array1.copy(array2);

or

array1 = array2.copy();

The advantage of the first form is that it doesn't involve allocating memory. The advantage of the second form is that there's no error if array1 and array2 have different shapes.

Definition at line 50 of file array3D.h.


Member Typedef Documentation

template<class Type>
typedef const Type* dlr::numeric::Array3D< Type >::const_iterator

Typedef for const_iterator type helps with standard library interface.

Definition at line 68 of file array3D.h.

template<class Type>
typedef Type* dlr::numeric::Array3D< Type >::iterator

Typedef for iterator type helps with standard library interface.

Definition at line 62 of file array3D.h.

template<class Type>
typedef Type dlr::numeric::Array3D< Type >::value_type

Typedef for value_type describes the contents of the array.

Definition at line 57 of file array3D.h.


Constructor & Destructor Documentation

template<class Type >
dlr::numeric::Array3D< Type >::Array3D (  )  [inline]

Default constructor initializes to zero size.

Definition at line 1201 of file array3D.h.

template<class Type >
dlr::numeric::Array3D< Type >::Array3D ( size_t  arrayShape0,
size_t  arrayShape1,
size_t  arrayShape2 
) [inline]

Construct an arrayShape0 x arrayShape1 x arrayShape2 array.

The dimensions are arranged from most minor to most major. If you like to think of the 3D array as being composed of 2D slices, you might want to create the array like this:

Array3D<Type> myArray(numSlices, numRows, numColumns);

In this way, stepping through the allocated data from beginning to end will traverse the first row of the first slice, followed subsequent rows of the first slice, followed by the first row of the second slice, and so on.

Parameters:
arrayShape0 Number of elements in the first dimension of the array.
arrayShape1 Number of elements in the second dimension of the array.
arrayShape2 Number of elements in the third dimension of the array.

Definition at line 1217 of file array3D.h.

template<class Type >
dlr::numeric::Array3D< Type >::Array3D ( const std::string &  inputString  )  [inline, explicit]

Construct from an initialization string.

The idea is to make constructor very flexible about interpreting string syntax. For now, though, the input string must have the format:

"[[[#, #, #, ...], [#, #, #, ...], [#, #, #, ...], ...], [[#, #, #, ...], [#, #, #, ...], [#, #, #, ...], ...], [[#, #, #, ...], [#, #, #, ...], [#, #, #, ...], ...], ...]"

Where "#" indicates text which can be converted to the element type of the array using the stream input operator.

Parameters:
inputString The argument specifies the string from which the array will be constructed.

Definition at line 1234 of file array3D.h.

template<class Type >
dlr::numeric::Array3D< Type >::Array3D ( const Array3D< Type > &  source  )  [inline]

The copy constructor does a shallow copy.

The newly created array points to the same data as copied array.

Parameters:
source Array which is to be copied.

Definition at line 1268 of file array3D.h.

template<class Type >
dlr::numeric::Array3D< Type >::Array3D ( size_t  arrayShape0,
size_t  arrayShape1,
size_t  arrayShape2,
Type *const   dataPtr 
) [inline]

Construct an array around external data.

Arrays constructed in this way will not implement reference counting, and will not delete dataPtr when done. The elements of the array are traversed with axis 0 being the most major axis and axis 2 being the most minor axis. That is, the first element in the C style array is at index (0, 0, 0), the second is at (0, 0, 1), followed by (0, 0, 2), (0, 0, 3), ..., (0, 0, N), (0, 1, 0), (0, 1, 1), and so on.

Parameters:
arrayShape0 Number of elements in the first dimension of the array.
arrayShape1 Number of elements in the second dimension of the array.
arrayShape2 Number of elements in the third dimension of the array.
dataPtr A C-style array of Type into which the newly constructed Array3D should index.

Definition at line 1288 of file array3D.h.

template<class Type >
dlr::numeric::Array3D< Type >::~Array3D (  )  [inline, virtual]

Destroys the Array3D instance and deletes the internal data store if no remaining arrays point to it.

Definition at line 1304 of file array3D.h.


Member Function Documentation

template<class Type>
const_iterator dlr::numeric::Array3D< Type >::begin (  )  const [inline]

Return begin() const_iterator for Standard Library algorithms.

Returns:
Const iterator pointing to the first element of the array3D.

Definition at line 162 of file array3D.h.

template<class Type>
iterator dlr::numeric::Array3D< Type >::begin (  )  [inline]

Return begin() iterator for Standard Library algorithms.

Returns:
Iterator pointing to the first element of the Array3D.

Definition at line 153 of file array3D.h.

Referenced by dlr::numeric::operator*(), dlr::numeric::operator+(), dlr::numeric::operator-(), dlr::numeric::operator/(), dlr::numeric::operator==(), dlr::numeric::operator>(), dlr::numeric::operator>=(), and dlr::numeric::Array3D< Type >::readFromStream().

template<class Type >
void dlr::numeric::Array3D< Type >::checkDimension ( size_t  arrayShape0,
size_t  arrayShape1,
size_t  arrayShape2 
) const [inline]

Optionally throw an exception if the shape of *this is different than specified.

Parameters:
arrayShape0 The required size along the first dimension.
arrayShape1 The required size along the second dimension.
arrayShape2 The required size along the third dimension.

Definition at line 1312 of file array3D.h.

References dlr::numeric::Array3D< Type >::shape0(), dlr::numeric::Array3D< Type >::shape1(), and dlr::numeric::Array3D< Type >::shape2().

Referenced by dlr::numeric::operator==().

template<class Type>
void dlr::numeric::Array3D< Type >::clear (  )  [inline]

Reset the array to zero size, abandoning all contents.

This is equivalent to this->reinit(0, 0, 0);

Definition at line 169 of file array3D.h.

References dlr::numeric::Array3D< Type >::reinit().

template<class Type >
template<class Type2 >
void dlr::numeric::Array3D< Type >::copy ( const Type2 *  dataPtr  )  [inline]

Copies elements from dataPtr.

There must be valid data at all addresses from dataPtr to (dataPtr + this->size());

Parameters:
dataPtr Pointer to the data to be copied.

Definition at line 1361 of file array3D.h.

References dlr::numeric::Array3D< Type >::copy().

template<class Type >
template<class Type2 >
void dlr::numeric::Array3D< Type >::copy ( const Array3D< Type2 > &  source  )  [inline]

Deep copies the contents of source.

It is an error if source does not have the same size as *this. Note that source need not have exactly the same number of rows and columns as *this, as long as their product is right.

Parameters:
source The array to be copied.

Definition at line 1343 of file array3D.h.

References dlr::numeric::Array3D< Type >::copy(), dlr::numeric::Array3D< Type >::data(), and dlr::numeric::Array3D< Type >::size().

template<class Type >
Array3D< Type > dlr::numeric::Array3D< Type >::copy (  )  const [inline]

Allocates a new array and deep copies the contents of *this.

Returns:
A new array which is a (deep) copy of *this.

Definition at line 1333 of file array3D.h.

References dlr::numeric::Array3D< Type >::copy().

Referenced by dlr::numeric::Array3D< Type >::copy(), and dlr::numeric::Array3D< Type >::readFromStream().

template<class Type>
const Type* dlr::numeric::Array3D< Type >::data ( size_t  index0,
size_t  index1,
size_t  index2 
) const [inline]

This version of data(size_t, size_t, size_t) is appropriate for const Array3D, and returns a pointer-to-const.

Parameters:
index0 First index of selected element.
index1 Second index of selected element.
index2 Third index of selected element.
Returns:
Pointer to the selected element of the array.

Definition at line 293 of file array3D.h.

template<class Type>
Type* dlr::numeric::Array3D< Type >::data ( size_t  index0,
size_t  index1,
size_t  index2 
) [inline]

Just like data(void), but returns a pointer to the element indexed by (index0, index1, index2).

Parameters:
index0 First index of selected element.
index1 Second index of selected element.
index2 Third index of selected element.
Returns:
Pointer to the selected element of the array.

Definition at line 277 of file array3D.h.

template<class Type>
const Type* dlr::numeric::Array3D< Type >::data ( size_t  index  )  const [inline]

This version of data(size_t) is appropriate for const Array1D, and returns a pointer-to-const.

Parameters:
index Indicates to which element of the array the return value should point.
Returns:
Const pointer to the (index)th element of the array.

Definition at line 262 of file array3D.h.

template<class Type>
Type* dlr::numeric::Array3D< Type >::data ( size_t  index  )  [inline]

Just like data(void), which is documented above, but returns a pointer to the (index)th element instead of the first element.

Note that "data(index)" is synonymous with "data() + index" .

Parameters:
index Indicates to which element of the array the return value should point.
Returns:
pointer to the (index)th element of the array.

Definition at line 248 of file array3D.h.

template<class Type>
const Type* dlr::numeric::Array3D< Type >::data ( void   )  const [inline]

This version of data(void) is appropriate for const Array2D, and returns a pointer-to-const.

Returns:
Const pointer to the internal data store.

Definition at line 236 of file array3D.h.

template<class Type>
Type* dlr::numeric::Array3D< Type >::data ( void   )  [inline]

Returns a pointer to the internal data store.

This is ugly but often necessary for interfacing with external libraries. Data is stored contiguously in raster order. The first element corresponds to indices (0, 0, 0), the second to (0, 0, 1), the (shape2 + 1)th element corresponds to index (0, 1, 0), and so on.

Returns:
Pointer to the internal data store.

Definition at line 227 of file array3D.h.

Referenced by dlr::numeric::Array3D< Type >::copy(), dlr::numeric::Array3D< Type >::operator*=(), dlr::numeric::Array3D< Type >::operator+=(), dlr::numeric::Array3D< Type >::operator-=(), and dlr::numeric::Array3D< Type >::operator/=().

template<class Type>
bool dlr::numeric::Array3D< Type >::empty (  )  const [inline]

This member function returns true if the array instance contains no elements.

It has complexity O(1).

Returns:
The return value indicates whether or not the array is empty.

Definition at line 308 of file array3D.h.

References dlr::numeric::Array3D< Type >::size().

template<class Type>
const_iterator dlr::numeric::Array3D< Type >::end (  )  const [inline]

Return end() const_iterator for Standard Library algorithms.

Returns:
Const iterator pointing just past the last element of the array3D.

Definition at line 327 of file array3D.h.

template<class Type>
iterator dlr::numeric::Array3D< Type >::end (  )  [inline]

Return end() iterator for Standard Library algorithms.

Returns:
Iterator pointing just past the last element of the array3D.

Definition at line 318 of file array3D.h.

Referenced by dlr::numeric::operator*(), dlr::numeric::operator+(), dlr::numeric::operator-(), dlr::numeric::operator/(), dlr::numeric::operator==(), dlr::numeric::operator>(), dlr::numeric::operator>=(), and dlr::numeric::Array3D< Type >::readFromStream().

template<class Type>
Type dlr::numeric::Array3D< Type >::getElement ( size_t  index0,
size_t  index1,
size_t  index2 
) const [inline]

This member function returns a specific element of the array by value.

Parameters:
index0 This argument, and the next two, specify which element value should be returned.
index1 This argument, the previous, and the next, specify which element value should be returned.
index2 This argument, and the previous two, specify which element value should be returned.
Returns:
The return value is a copy of the requested element.

Definition at line 359 of file array3D.h.

References dlr::numeric::Array3D< Type >::operator()().

template<class Type>
Type dlr::numeric::Array3D< Type >::getElement ( size_t  index0  )  const [inline]

This member function returns a specific element of the array by value.

Parameters:
index0 This argument specifies which element value should be returned.
Returns:
The return value is a copy of the requested element.

Definition at line 340 of file array3D.h.

References dlr::numeric::Array3D< Type >::operator()().

template<class Type>
Type dlr::numeric::Array3D< Type >::operator() ( size_t  index0,
size_t  index1,
size_t  index2 
) const [inline]

Returns one element of the array by value.

Elements are indexed as described in the documentation of Array3D::Array3D(size_t, size_t, size_t).

Parameters:
index0 Indicates the position of the selected element along the first axis.
index1 Indicates the position of the selected element along the third axis.
index2 Indicates the position of the selected element along the third axis.
Returns:
Value of the selected element of the array.

Definition at line 627 of file array3D.h.

template<class Type>
Type& dlr::numeric::Array3D< Type >::operator() ( size_t  index0,
size_t  index1,
size_t  index2 
) [inline]

Returns one element of the array by reference.

Elements are indexed as described in the documentation of Array3D::Array3D(size_t, size_t, size_t).

Parameters:
index0 Indicates the position of the selected element along the first axis.
index1 Indicates the position of the selected element along the third axis.
index2 Indicates the position of the selected element along the third axis.
Returns:
Reference to the selected element of the array.

Definition at line 607 of file array3D.h.

template<class Type>
Type dlr::numeric::Array3D< Type >::operator() ( size_t  index  )  const [inline]

Returns the (index)th element of the array by value.

Synonymous with operator()(size_t) const.

Parameters:
index Indicates the selected element.
Returns:
Value of the (index)th element of the array.

Definition at line 588 of file array3D.h.

template<class Type>
Type& dlr::numeric::Array3D< Type >::operator() ( size_t  index  )  [inline]

Returns the (index)th element of the array by reference.

Synonymous with operator()(size_t).

Parameters:
index Indicates the selected element.
Returns:
Reference to the (index)th element of the array.

Definition at line 575 of file array3D.h.

Referenced by dlr::numeric::Array3D< Type >::getElement(), dlr::numeric::Array3D< Type >::operator[](), and dlr::numeric::Array3D< Type >::setElement().

template<class Type >
Array3D< Type > & dlr::numeric::Array3D< Type >::operator*= ( const Type  arg  )  [inline]

Multiplies each element of *this by a constant.

Parameters:
arg Value by which array elements will be multiplied.
Returns:
Reference to *this.

Definition at line 1710 of file array3D.h.

template<class Type >
template<class Type2 >
Array3D< Type > & dlr::numeric::Array3D< Type >::operator*= ( const Array3D< Type2 > &  arg  )  [inline]

Multiplies each element of *this by the value of the corresponding element of arg.

Parameters:
arg Array3D of values to be added to the elements of *this.
Returns:
Reference to *this.

Definition at line 1618 of file array3D.h.

References dlr::numeric::Array3D< Type >::data(), and dlr::numeric::Array3D< Type >::size().

template<class Type >
Array3D< Type > & dlr::numeric::Array3D< Type >::operator+= ( const Type  arg  )  [inline]

Increments each element of *this by a constant.

Parameters:
arg Value by which array elements will be incremented.
Returns:
Reference to *this.

Definition at line 1690 of file array3D.h.

template<class Type >
template<class Type2 >
Array3D< Type > & dlr::numeric::Array3D< Type >::operator+= ( const Array3D< Type2 > &  arg  )  [inline]

Increments each element of *this by the value of the corresponding element of arg.

Parameters:
arg Array3D of values to be added to the elements of *this.
Returns:
Reference to *this.

Definition at line 1654 of file array3D.h.

References dlr::numeric::Array3D< Type >::data(), and dlr::numeric::Array3D< Type >::size().

template<class Type >
Array3D< Type > & dlr::numeric::Array3D< Type >::operator-= ( const Type  arg  )  [inline]

Decrements each element of *this by a constant.

Parameters:
arg Value by which array elements will be decremented.
Returns:
Reference to *this.

Definition at line 1700 of file array3D.h.

template<class Type >
template<class Type2 >
Array3D< Type > & dlr::numeric::Array3D< Type >::operator-= ( const Array3D< Type2 > &  arg  )  [inline]

Decrements each element of *this by the value of the corresponding element of arg.

Parameters:
arg Array3D of values to be subtracted from the elements of *this.
Returns:
Reference to *this.

Definition at line 1672 of file array3D.h.

References dlr::numeric::Array3D< Type >::data(), and dlr::numeric::Array3D< Type >::size().

template<class Type >
Array3D< Type > & dlr::numeric::Array3D< Type >::operator/= ( const Type  arg  )  [inline]

Divides each element of *this by a constant.

Parameters:
arg Value by which array elements will be divided.
Returns:
Reference to *this.

Definition at line 1720 of file array3D.h.

template<class Type >
template<class Type2 >
Array3D< Type > & dlr::numeric::Array3D< Type >::operator/= ( const Array3D< Type2 > &  arg  )  [inline]

Divides each element of *this by the value of the corresponding element of arg.

Parameters:
arg Array3D of values to be added to the elements of *this.
Returns:
Reference to *this.

Definition at line 1636 of file array3D.h.

References dlr::numeric::Array3D< Type >::data(), and dlr::numeric::Array3D< Type >::size().

template<class Type >
Array3D< Type > & dlr::numeric::Array3D< Type >::operator= ( Type  value  )  [inline]

Assign value to every element in the array.

Parameters:
value The value to be copied.
Returns:
Reference to *this.

Definition at line 1609 of file array3D.h.

template<class Type >
Array3D< Type > & dlr::numeric::Array3D< Type >::operator= ( const Array3D< Type > &  source  )  [inline]

Assignment operator shallow copies the contents of source.

After the copy, both arrays reference the same data.

Parameters:
source The Array3D instance to be copied.
Returns:
Reference to *this.

Definition at line 1586 of file array3D.h.

References dlr::numeric::Array3D< Type >::m_dataPtr, dlr::numeric::Array3D< Type >::m_isAllocated, dlr::numeric::Array3D< Type >::m_refCountPtr, dlr::numeric::Array3D< Type >::m_shape0, dlr::numeric::Array3D< Type >::m_shape1, dlr::numeric::Array3D< Type >::m_shape1Times2, dlr::numeric::Array3D< Type >::m_shape2, and dlr::numeric::Array3D< Type >::m_size.

template<class Type>
Type dlr::numeric::Array3D< Type >::operator[] ( size_t  index  )  const [inline]

Returns the (index)th element of the array by value.

Synonymous with operator()(size_t) const.

Parameters:
index Indicates the selected element.
Returns:
Value of the (index)th element of the array.

Definition at line 651 of file array3D.h.

References dlr::numeric::Array3D< Type >::operator()().

template<class Type>
Type& dlr::numeric::Array3D< Type >::operator[] ( size_t  index  )  [inline]

Returns the (index)th element of the array by reference.

Synonymous with operator()(size_t).

Parameters:
index Indicates the selected element.
Returns:
Reference to the (index)th element of the array.

Definition at line 641 of file array3D.h.

References dlr::numeric::Array3D< Type >::operator()().

template<class Type >
std::istream & dlr::numeric::Array3D< Type >::readFromStream ( std::istream &  inputStream  )  [inline]

This member function sets the value of the array from an input stream.

The array is modified only if the read was successful, otherwise the array is not modified, and failbit is set in the stream state. Because of this nice behavior, readFromStream is quite slow.

Parameters:
inputStream This is the stream from which to read the array.
Returns:
The return value is a reference to inputStream.

Definition at line 1376 of file array3D.h.

References dlr::numeric::Array3D< Type >::begin(), dlr::numeric::Array2D< Type >::clear(), dlr::numeric::Array3D< Type >::copy(), dlr::numeric::Array3D< Type >::end(), and dlr::numeric::Array3D< Type >::reinit().

Referenced by dlr::numeric::operator>>().

template<class Type >
void dlr::numeric::Array3D< Type >::reinit ( size_t  arrayShape0,
size_t  arrayShape1,
size_t  arrayShape2 
) [inline]

Changes the shape of the array and reallocates storage.

The current array contents are lost. After a successful call to reinit(), the array will have arrayShape0 x arrayShape1 x arrayShape2 elements.

Parameters:
arrayShape0 Requested dimension along axis 0.
arrayShape1 Requested dimension along axis 1.
arrayShape2 Requested dimension along axis 2.

Definition at line 1469 of file array3D.h.

Referenced by dlr::numeric::Array3D< Type >::clear(), dlr::numeric::Array3D< Type >::readFromStream(), and dlr::numeric::Array3D< Type >::reinitIfNecessary().

template<class Type >
void dlr::numeric::Array3D< Type >::reinitIfNecessary ( size_t  arrayShape0,
size_t  arrayShape1,
size_t  arrayShape2 
) [inline]

Behaves just like member function reinit() unless *this already has the requested shape, in which case this member function does nothing, or *this has the requested size (but a different shape), in which case this member function behaves just like member function resize().

Parameters:
arrayShape0 Requested dimension along axis 0.
arrayShape1 Requested dimension along axis 1.
arrayShape2 Requested dimension along axis 2.

Definition at line 1481 of file array3D.h.

References dlr::numeric::Array3D< Type >::reinit(), dlr::numeric::Array3D< Type >::reshape(), dlr::numeric::Array3D< Type >::shape0(), dlr::numeric::Array3D< Type >::shape1(), and dlr::numeric::Array3D< Type >::size().

template<class Type >
void dlr::numeric::Array3D< Type >::reshape ( int  arrayShape0,
int  arrayShape1,
int  arrayShape2 
) [inline]

Changes the shape of the array.

It is an error if arrayShape0 * arrayShape1 * arrayShape2 is not equal to this->size(). Any one argument may be specified as -1, but no more than one. If one of the arguments is -1, its value will be calculated based on the total size of the array and the value of the other arguments.

Parameters:
arrayShape0 Requested dimension along axis 0.
arrayShape1 Requested dimension along axis 1.
arrayShape2 Requested dimension along axis 2.

Definition at line 1497 of file array3D.h.

References dlr::numeric::Array3D< Type >::size().

Referenced by dlr::numeric::Array3D< Type >::reinitIfNecessary().

template<class Type>
Type& dlr::numeric::Array3D< Type >::setElement ( size_t  index0,
size_t  index1,
size_t  index2,
const Type &  value 
) [inline]

This member function sets the value of a specific element of the array.

Parameters:
index0 This argument, and the next two, specify which element value should be set.
index1 This argument, the previous, and the next, specify which element value should be set.
index2 This argument, and the previous two, specify which element value should be set.
value This argument will be copied into the selected array element.
Returns:
The return value is a reference to the newly created array element.

Definition at line 462 of file array3D.h.

References dlr::numeric::Array3D< Type >::operator()().

template<class Type>
Type& dlr::numeric::Array3D< Type >::setElement ( size_t  index0,
const Type &  value 
) [inline]

This member function sets the value of a specific element of the array.

Parameters:
index0 This argument specifies which element value should be set.
value This argument will be copied into the selected array element.
Returns:
The return value is a reference to the newly set array element.

Definition at line 437 of file array3D.h.

References dlr::numeric::Array3D< Type >::operator()().

template<class Type >
size_t dlr::numeric::Array3D< Type >::shape ( size_t  axis  )  const [inline]

Returns the array dimension along the the axis indicated by index.

This is synonymous with shape()[axis], but may execute faster.

Parameters:
axis Selected axis.
Returns:
Dimension along the selected axis.

Definition at line 1539 of file array3D.h.

References dlr::numeric::Array3D< Type >::shape0(), dlr::numeric::Array3D< Type >::shape1(), and dlr::numeric::Array3D< Type >::shape2().

template<class Type >
Array1D< size_t > dlr::numeric::Array3D< Type >::shape (  )  const [inline]

Returns a 3 element Array1D containing the dimension of *this along each axis.

That is, the first element of the returned array will be this->shape0(), the second element will be this->shape1(), and the third element will be this->shape2().

Returns:
Array describing the shape of *this.

Definition at line 1527 of file array3D.h.

References dlr::numeric::Array3D< Type >::shape0(), dlr::numeric::Array3D< Type >::shape1(), and dlr::numeric::Array3D< Type >::shape2().

template<class Type>
size_t dlr::numeric::Array3D< Type >::shape0 (  )  const [inline]

template<class Type>
size_t dlr::numeric::Array3D< Type >::shape1 (  )  const [inline]

template<class Type>
size_t dlr::numeric::Array3D< Type >::shape2 (  )  const [inline]

Returns the array dimension along axis 2.

This is synonymous with shape(2), but may execute faster.

Returns:
Number of elements.

Definition at line 515 of file array3D.h.

Referenced by dlr::numeric::Array3D< Type >::checkDimension(), dlr::numeric::operator*(), dlr::numeric::operator+(), dlr::numeric::operator-(), dlr::numeric::operator/(), dlr::numeric::operator==(), dlr::numeric::operator>(), dlr::numeric::operator>=(), and dlr::numeric::Array3D< Type >::shape().

template<class Type>
size_t dlr::numeric::Array3D< Type >::size (  )  const [inline]

template<class Type >
const Array2D< Type > dlr::numeric::Array3D< Type >::slice ( size_t  index  )  const [inline]

Returns a const Array2D<Type> which addresses an entire (rows x columns) slice of *this.

The returned Array2D references the same data as the selected slice of *this.

Parameters:
index Specifies which slice to reference.
Returns:
An Array2D instance referencing the selected slice.

Definition at line 1576 of file array3D.h.

template<class Type >
Array2D< Type > dlr::numeric::Array3D< Type >::slice ( size_t  index  )  [inline]

Returns an Array2D<Type> which addresses an entire (rows x columns) slice of *this.

The returned Array2D references the same data as the selected slice of *this.

Parameters:
index Specifies which slice to reference.
Returns:
An Array2D instance referencing the selected slice.

Definition at line 1565 of file array3D.h.


The documentation for this class was generated from the following file:

Generated on Wed Nov 25 00:42:48 2009 for dlrUtilities Utility Library by  doxygen 1.5.8