SeldonData::RegularGrid< T > Class Template Reference

Regular grids. More...

#include <Grid.hxx>

Inheritance diagram for SeldonData::RegularGrid< T >:

SeldonData::Grid< T > List of all members.

Public Types

typedef T value_type
typedef T * pointer
typedef const T * const_pointer
typedef T & reference
typedef const T & const_reference

Public Member Functions

 RegularGrid () throw ()
 Default constructor.
 RegularGrid (int length, int variable=0) throw ()
 Constructor.
 RegularGrid (value_type start, value_type inc, int length, int variable=0) throw ()
 RegularGrid (const Array< value_type, 1 > &values, int variable=0) throw ()
 RegularGrid (const Grid< T > &G) throw ()
 Copy constructor.
 RegularGrid (const RegularGrid< T > &G) throw ()
 Copy constructor for regular grids.
 ~RegularGrid () throw ()
 Destructor.
RegularGrid< T > & operator= (const Grid< T > &)
 Affectation operator.
RegularGrid< T > & operator= (const RegularGrid< T > &)
 Affectation operator for regular grids.
int GetLength () const
 Returns grid length.
int GetLength (int i) const
 Returns grid length along dimension i.
int GetNbElements () const
 Returns the number of elements in the grid.
Array< value_type, 1 > & GetArray ()
 Returns a reference to the array storing points coordinates.
const Array< value_type, 1 > & GetArray () const
 Returns a reference to the array storing points coordinates.
Grid< T > * Duplicate () const
 Duplicates the grid and returns a pointer to the new copy.
Grid< T > * Copy ()
 Returns a pointer to a copy of the grid or to the grid itself.
reference operator() (int i)
 Returns a reference to the i-th element of the grid.
value_type operator() (int i) const
 Returns the i-th element of the grid.
reference Value (int i0, int i1=-1, int i2=-1, int i3=-1, int i4=-1, int i5=-1, int i6=-1, int i7=-1, int i8=-1, int i9=-1)
 Returns a reference to an element of the grid.
value_type Value (int i0, int i1=-1, int i2=-1, int i3=-1, int i4=-1, int i5=-1, int i6=-1, int i7=-1, int i8=-1, int i9=-1) const
 Returns an element of the grid.
template<class F>
void Apply (F &function)
 Applies a given function on all elements.
template<class T0, class F>
void Apply (RegularGrid< T0 > &, F &function)
void Print () const
 Displays grid values.

Protected Attributes

Array< value_type, 1 > values_
 Grid values.

Detailed Description

template<class T>
class SeldonData::RegularGrid< T >

Regular grids.


Constructor & Destructor Documentation

template<class T>
SeldonData::RegularGrid< T >::RegularGrid (  )  throw ()

Default constructor.

All is set to zero (including grid length).

template<class T>
SeldonData::RegularGrid< T >::RegularGrid ( int  length,
int  variable = 0 
) throw ()

Constructor.

Constructs a regular grid of length 'length', related to dimension 'dimension', with zero as initial point, and with one as increment.

Parameters:
length grid length.
variable dimension number related to the grid.

template<class T>
SeldonData::RegularGrid< T >::RegularGrid ( const Grid< T > &  G  )  throw ()

Copy constructor.

Parameters:
G grid to be copied.

template<class T>
SeldonData::RegularGrid< T >::RegularGrid ( const RegularGrid< T > &  G  )  throw ()

Copy constructor for regular grids.

Parameters:
G regular grid to be copied.


Member Function Documentation

template<class T>
RegularGrid< T > & SeldonData::RegularGrid< T >::operator= ( const Grid< T > &  G  )  [virtual]

Affectation operator.

Parameters:
G grid to be copied.
Returns:
A reference to the current grid.

Reimplemented from SeldonData::Grid< T >.

template<class T>
RegularGrid< T > & SeldonData::RegularGrid< T >::operator= ( const RegularGrid< T > &  G  ) 

Affectation operator for regular grids.

Parameters:
G regular grid to be copied.
Returns:
A reference to the current grid.

template<class T>
int SeldonData::RegularGrid< T >::GetLength (  )  const [inline, virtual]

Returns grid length.

Returns:
Length of the grid.

Reimplemented from SeldonData::Grid< T >.

template<class T>
int SeldonData::RegularGrid< T >::GetLength ( int  i  )  const [inline, virtual]

Returns grid length along dimension i.

Parameters:
i dimension number.
Returns:
Length of the grid along the i-th dimension.

Reimplemented from SeldonData::Grid< T >.

template<class T>
int SeldonData::RegularGrid< T >::GetNbElements (  )  const [inline, virtual]

Returns the number of elements in the grid.

Returns:
The number of elements in the grid.

Reimplemented from SeldonData::Grid< T >.

template<class T>
Array< typename RegularGrid< T >::value_type, 1 > & SeldonData::RegularGrid< T >::GetArray (  )  [inline]

Returns a reference to the array storing points coordinates.

Returns:
A reference to the array storing points coordinates.

template<class T>
const Array< typename RegularGrid< T >::value_type, 1 > & SeldonData::RegularGrid< T >::GetArray (  )  const [inline]

Returns a reference to the array storing points coordinates.

Returns:
A reference to the array storing points coordinates.

template<class T>
Grid< T > * SeldonData::RegularGrid< T >::Duplicate (  )  const [virtual]

Duplicates the grid and returns a pointer to the new copy.

After duplication, no memory is shared with the new grid.

Returns:
A pointer to a copy of the current grid.
Exceptions:
SeldonData::NoMemory no more memory is available; duplication is impossible.

Reimplemented from SeldonData::Grid< T >.

template<class T>
Grid< T > * SeldonData::RegularGrid< T >::Copy (  )  [virtual]

Returns a pointer to a copy of the grid or to the grid itself.

After copy, no memory is shared with the new grid if 'duplicate_' is set to true. Otherwise, the new grid is the same as the current grid, and the returned pointer is the 'this'.

Returns:
A pointer to a copy of the current grid, or to the current grid.
Exceptions:
SeldonData::NoMemory no more memory is available; duplication is impossible.

Reimplemented from SeldonData::Grid< T >.

template<class T>
RegularGrid< T >::reference SeldonData::RegularGrid< T >::operator() ( int  i  )  [inline, virtual]

Returns a reference to the i-th element of the grid.

Parameters:
i index of the element to be returned.
Returns:
A reference to the i-th element of the grid.
Exceptions:
SeldonData::WrongIndex index is out of range.

Reimplemented from SeldonData::Grid< T >.

template<class T>
RegularGrid< T >::value_type SeldonData::RegularGrid< T >::operator() ( int  i  )  const [inline, virtual]

Returns the i-th element of the grid.

Parameters:
i index of the element to be returned.
Returns:
The i-th element of the grid.
Exceptions:
SeldonData::WrongIndex index is out of range.

Reimplemented from SeldonData::Grid< T >.

template<class T>
RegularGrid< T >::reference SeldonData::RegularGrid< T >::Value ( int  i0,
int  i1 = -1,
int  i2 = -1,
int  i3 = -1,
int  i4 = -1,
int  i5 = -1,
int  i6 = -1,
int  i7 = -1,
int  i8 = -1,
int  i9 = -1 
) [inline, virtual]

Returns a reference to an element of the grid.

Parameters:
i0 index along dimension #0.
i1 index along dimension #1.
i2 index along dimension #2.
i3 index along dimension #3.
i4 index along dimension #4.
i5 index along dimension #5.
i6 index along dimension #6.
i7 index along dimension #7.
i8 index along dimension #8.
i9 index along dimension #9.
Returns:
A reference to the element to be returned.
Exceptions:
SeldonData::WrongIndex index is out of range.

Reimplemented from SeldonData::Grid< T >.

template<class T>
RegularGrid< T >::value_type SeldonData::RegularGrid< T >::Value ( int  i0,
int  i1 = -1,
int  i2 = -1,
int  i3 = -1,
int  i4 = -1,
int  i5 = -1,
int  i6 = -1,
int  i7 = -1,
int  i8 = -1,
int  i9 = -1 
) const [inline, virtual]

Returns an element of the grid.

Parameters:
i0 index along dimension #0.
i1 index along dimension #1.
i2 index along dimension #2.
i3 index along dimension #3.
i4 index along dimension #4.
i5 index along dimension #5.
i6 index along dimension #6.
i7 index along dimension #7.
i8 index along dimension #8.
i9 index along dimension #9.
Returns:
The element to be returned.
Exceptions:
SeldonData::WrongIndex index is out of range.

Reimplemented from SeldonData::Grid< T >.

template<class T>
template<class F>
void SeldonData::RegularGrid< T >::Apply ( F &  function  ) 

Applies a given function on all elements.

Parameters:
function function to be applied.

template<class T>
template<class T0, class F>
void SeldonData::RegularGrid< T >::Apply ( RegularGrid< T0 > &  G,
F &  function 
)

Parameters:
G grid.
function function to be applied on 'G'.

template<class T>
void SeldonData::RegularGrid< T >::Print (  )  const [virtual]

Displays grid values.

Displays "Regular grid:" followed by the dimension and the grid values.

Reimplemented from SeldonData::Grid< T >.


The documentation for this class was generated from the following files:
Generated on Tue Nov 17 11:20:52 2009 for SeldonData by  doxygen 1.5.1