SeldonData::Grid< T > Class Template Reference

Base class for grids. More...

#include <Grid.hxx>

Inheritance diagram for SeldonData::Grid< T >:

SeldonData::GeneralGrid< T, n > SeldonData::RegularGrid< 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

 Grid () throw ()
 Default constructor.
 Grid (int length, int variable=0) throw ()
 Constructor.
 Grid (const Grid &G) throw ()
 Copy constructor.
virtual ~Grid () throw ()
 Destructor.
virtual Grid< T > & operator= (const Grid< T > &)
 Affectation operator.
virtual int GetLength () const
 Returns grid length.
virtual int GetLength (int i) const
 Returns grid length along dimension i.
int GetVariable () const
 Returns dimension number related to the grid.
virtual bool IsDependent (int i) const
 Returns whether the grid depends on a given dimension.
virtual int GetNbElements () const
 Returns the number of elements in the grid.
void SetVariable (int variable)
 Sets the dimension to which the grid is related.
void SetPointers (int pointers)
 Sets the number of pointers that point to the current grid.
int GetPointers () const
 Returns the number of pointers that point to the current grid.
void SetDuplicate (bool duplicate)
 Sets whether the grid should be duplicated in certain cases.
bool GetDuplicate () const
 Should the grid be duplicated?
virtual Grid< T > * Duplicate () const
 Duplicates the grid and returns a pointer to the new copy.
virtual Grid< T > * Copy ()
 Returns a pointer to a copy of the grid or to the grid itself.
virtual reference operator() (int i)
 Returns a reference to the i-th element of the grid.
virtual value_type operator() (int i) const
 Returns i-th element of the grid.
virtual 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.
virtual 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.
virtual void ChangeCoordsInPlace (Function_Base< T > &f, Array< Grid< T > *, 1 > grids)
 Coordinate transformation "in place".
virtual void Print () const
 Displays grid values.

Protected Attributes

int length_
 Length of the grid.
int variable_
 Dimension related to the grid.
bool duplicate_
int pointers_
 How many pointers to the current grid.
value_type zero_
 Zero.

Detailed Description

template<class T>
class SeldonData::Grid< T >

Base class for grids.


Constructor & Destructor Documentation

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

Default constructor.

All is set to zero (including grid length).

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

Constructor.

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

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

Copy constructor.

Parameters:
G grid to be copied.


Member Function Documentation

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

Affectation operator.

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

Reimplemented in SeldonData::RegularGrid< T >, and SeldonData::GeneralGrid< T, n >.

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

Returns grid length.

Returns:
Length of the grid.

Reimplemented in SeldonData::RegularGrid< T >, and SeldonData::GeneralGrid< T, n >.

template<class T>
int SeldonData::Grid< 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 in SeldonData::RegularGrid< T >, and SeldonData::GeneralGrid< T, n >.

template<class T>
int SeldonData::Grid< T >::GetVariable (  )  const [inline]

Returns dimension number related to the grid.

Returns:
Dimension number related to the grid.

template<class T>
bool SeldonData::Grid< T >::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 in SeldonData::GeneralGrid< T, n >.

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

Returns the number of elements in the grid.

Returns:
Zero.

Reimplemented in SeldonData::RegularGrid< T >, and SeldonData::GeneralGrid< T, n >.

template<class T>
void SeldonData::Grid< T >::SetVariable ( int  variable  )  [inline]

Sets the dimension to which the grid is related.

A grid is used to store coordinates along a given dimension. The function sets this dimension.

Parameters:
variable dimension to which the grid is related.

template<class T>
void SeldonData::Grid< T >::SetPointers ( int  pointers  ) 

Sets the number of pointers that point to the current grid.

Parameters:
pointers the number of pointers that point to the current grid.

template<class T>
int SeldonData::Grid< T >::GetPointers (  )  const

Returns the number of pointers that point to the current grid.

Returns:
The number of pointers that point to the current grid.

template<class T>
void SeldonData::Grid< T >::SetDuplicate ( bool  duplicate  ) 

Sets whether the grid should be duplicated in certain cases.

Parameters:
duplicate true if the grid should be duplicated, false otherwise.

template<class T>
bool SeldonData::Grid< T >::GetDuplicate (  )  const

Should the grid be duplicated?

When an instance of 'Data' is created, one may want to duplicate the grid or not (if two instances of 'Data' should share a given grid).

Returns:
true if the grid should be duplicated, false otherwise.

template<class T>
Grid< T > * SeldonData::Grid< 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 in SeldonData::RegularGrid< T >, and SeldonData::GeneralGrid< T, n >.

template<class T>
Grid< T > * SeldonData::Grid< 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 in SeldonData::RegularGrid< T >, and SeldonData::GeneralGrid< T, n >.

template<class T>
Grid< T >::reference SeldonData::Grid< 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:
Zero.
Exceptions:
SeldonData::WrongIndex index is out of range (i.e. is not 0).

Reimplemented in SeldonData::RegularGrid< T >, and SeldonData::GeneralGrid< T, n >.

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

Returns i-th element of the grid.

Parameters:
i index of the element to be returned.
Returns:
Zero.
Exceptions:
SeldonData::WrongIndex index is out of range (i.e. is not 0).

Reimplemented in SeldonData::RegularGrid< T >, and SeldonData::GeneralGrid< T, n >.

template<class T>
Grid< T >::reference SeldonData::Grid< 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:
Zero.
Exceptions:
SeldonData::WrongIndex index is out of range (i.e. is not 0).

Reimplemented in SeldonData::RegularGrid< T >, and SeldonData::GeneralGrid< T, n >.

template<class T>
Grid< T >::value_type SeldonData::Grid< 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:
Zero.
Exceptions:
SeldonData::WrongIndex index is out of range (i.e. is not 0).

Reimplemented in SeldonData::RegularGrid< T >, and SeldonData::GeneralGrid< T, n >.

template<class T>
void SeldonData::Grid< T >::ChangeCoordsInPlace ( Function_Base< T > &  f,
Array< Grid< T > *, 1 >  grids 
) [virtual]

Coordinate transformation "in place".

Function f takes as inputs all coordinates and transforms those coordinates. This transformation is performed in place because function f works directly on its inputs.

Parameters:
f coordinate transformation. It must be an instance of Function_Base<TG> or of a class derived from Function_Base<TG>.
grids array of pointers to other grids (along other directions).

Reimplemented in SeldonData::GeneralGrid< T, n >.

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

Displays grid values.

Displays "Empty grid.".

Reimplemented in SeldonData::RegularGrid< T >, and SeldonData::GeneralGrid< T, n >.


Member Data Documentation

template<class T>
bool SeldonData::Grid< T >::duplicate_ [protected]

When copying the grid, should grid values be duplicated?


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