SeldonData::GeneralGrid< T, n > Class Template Reference

General grids. More...

#include <Grid.hxx>

Inheritance diagram for SeldonData::GeneralGrid< T, n >:

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

 GeneralGrid () throw ()
 Default constructor.
 GeneralGrid (Array< value_type, n > &values, int variable, const TinyVector< int, n > &dependencies) throw ()
 GeneralGrid (const TinyVector< int, n > &values_shape, int variable, const TinyVector< int, n > &dependencies) throw ()
 Main constructor.
 GeneralGrid (const GeneralGrid< T, n > &G) throw ()
 Copy constructor for general grids.
 GeneralGrid (const Grid< T > &G) throw ()
 Copy constructor.
 ~GeneralGrid () throw ()
 Destructor.
GeneralGrid< T, n > & operator= (const Grid< T > &)
 Affectation operator.
GeneralGrid< T, n > & operator= (const GeneralGrid< T, n > &)
 Affectation operator for general 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, n > & GetArray ()
 Returns a reference to the array storing points coordinates.
const Array< value_type, n > & GetArray () const
 Returns a reference to the array storing points coordinates.
Array< int, 1 > & GetDependencies ()
 Returns a reference to dependencies array.
const Array< int, 1 > & GetDependencies () const
 Returns a reference to dependencies array.
int GetMainVariable () const
bool IsDependent (int i) const
 Returns whether the grid depends on a given dimension.
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)
 Not defined.
value_type operator() (int i) const
 Not defined.
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.
void ChangeCoordsInPlace (Function_Base< T > &f, Array< Grid< T > *, 1 > grids)
 Not defined.
template<class F>
void Apply (F &function)
 Applies a given function on all elements.
template<class T0, class F>
void Apply (GeneralGrid< T0, n > &, F &function)
void Print () const
 Displays grid values.

Protected Attributes

Array< value_type, n > values_
 Grid values.
Array< int, 1 > dependencies_
 Dimension upon which the grid depends.

Detailed Description

template<class T, int n>
class SeldonData::GeneralGrid< T, n >

General grids.


Constructor & Destructor Documentation

template<class T, int n>
SeldonData::GeneralGrid< T, n >::GeneralGrid (  )  throw ()

Default constructor.

All is set to zero (including grid length).

template<class T, int n>
SeldonData::GeneralGrid< T, n >::GeneralGrid ( const TinyVector< int, n > &  values_shape,
int  variable,
const TinyVector< int, n > &  dependencies 
) throw ()

Main constructor.

Constructs a general grid related to dimension 'variable'. The number of coordinates to be stored is provided through 'values_shape'. The number of elements of 'values' is the number 'n' of dimension upon which the grid depends. 'dependencies' gives upon which dimensions the grid depends. Notice that 'dependencies' must contain 'variable'.

Parameters:
values_shape array of extents along dimensions.
variable dimension number related to the grid.
dependencies dimensions upon which the grid depends.

template<class T, int n>
SeldonData::GeneralGrid< T, n >::GeneralGrid ( const GeneralGrid< T, n > &  G  )  throw ()

Copy constructor for general grids.

Parameters:
G general grid to be copied.

template<class T, int n>
SeldonData::GeneralGrid< T, n >::GeneralGrid ( const Grid< T > &  G  )  throw ()

Copy constructor.

Parameters:
G grid to be copied.


Member Function Documentation

template<class T, int n>
GeneralGrid< T, n > & SeldonData::GeneralGrid< T, n >::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, int n>
GeneralGrid< T, n > & SeldonData::GeneralGrid< T, n >::operator= ( const GeneralGrid< T, n > &  G  ) 

Affectation operator for general grids.

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

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

Returns grid length.

Returns:
Length of the grid.

Reimplemented from SeldonData::Grid< T >.

template<class T, int n>
int SeldonData::GeneralGrid< T, n >::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 n>
int SeldonData::GeneralGrid< T, n >::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, int n>
Array< typename GeneralGrid< T, n >::value_type, n > & SeldonData::GeneralGrid< T, n >::GetArray (  )  [inline]

Returns a reference to the array storing points coordinates.

Returns:
A reference to the array storing points coordinates.

template<class T, int n>
const Array< typename GeneralGrid< T, n >::value_type, n > & SeldonData::GeneralGrid< T, n >::GetArray (  )  const [inline]

Returns a reference to the array storing points coordinates.

Returns:
A reference to the array storing points coordinates.

template<class T, int n>
Array< int, 1 > & SeldonData::GeneralGrid< T, n >::GetDependencies (  )  [inline]

Returns a reference to dependencies array.

Returns:
A reference to dependencies array.

template<class T, int n>
const Array< int, 1 > & SeldonData::GeneralGrid< T, n >::GetDependencies (  )  const [inline]

Returns a reference to dependencies array.

Returns:
A reference to dependencies array.

template<class T, int n>
int SeldonData::GeneralGrid< T, n >::GetMainVariable (  )  const [inline]

For instance, let the grid be related to direction z. If coordinate along z depends upon x and z, then the array storing coordinateds is a (Nx, Nz) matrix. If the "0-th dimension" of the matrix corresponds to x, then the "1-st dimension" is the dimension of the array corresponding to the dimension related to the grid (i.e. z). So, this function will return 1.

Returns:
Main dimension of the array.

template<class T, int n>
bool SeldonData::GeneralGrid< T, n >::IsDependent ( int  i  )  const [inline, virtual]

Returns whether the grid depends on a given dimension.

Parameters:
i dimension number.
Returns:
true if the grid depends on dimension i, false otherwise.
Exceptions:
SeldonData::WrongDim Dimension number i is out of range.

Reimplemented from SeldonData::Grid< T >.

template<class T, int n>
Grid< T > * SeldonData::GeneralGrid< T, n >::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, int n>
Grid< T > * SeldonData::GeneralGrid< T, n >::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, int n>
GeneralGrid< T, n >::reference SeldonData::GeneralGrid< T, n >::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 an index is out of range.

Reimplemented from SeldonData::Grid< T >.

template<class T, int n>
GeneralGrid< T, n >::value_type SeldonData::GeneralGrid< T, n >::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 an index is out of range.

Reimplemented from SeldonData::Grid< T >.

template<class T, int n>
template<class F>
void SeldonData::GeneralGrid< T, n >::Apply ( F &  function  ) 

Applies a given function on all elements.

Parameters:
function function to be applied.

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

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

template<class T, int n>
void SeldonData::GeneralGrid< T, n >::Print (  )  const [virtual]

Displays grid values.

Displays "General grid:" followed by dimensions 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