#include <Grid.hxx>
Inheritance diagram for SeldonData::Grid< T >:
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. |
SeldonData::Grid< T >::Grid | ( | ) | throw () |
Default constructor.
All is set to zero (including grid length).
SeldonData::Grid< T >::Grid | ( | int | length, | |
int | variable = 0 | |||
) | throw () |
Constructor.
length | grid length. | |
variable | dimension number related to the grid. |
SeldonData::Grid< T >::Grid | ( | const Grid< T > & | G | ) | throw () |
Copy constructor.
G | grid to be copied. |
Grid< T > & SeldonData::Grid< T >::operator= | ( | const Grid< T > & | G | ) | [virtual] |
Affectation operator.
G | grid to be copied. |
Reimplemented in SeldonData::RegularGrid< T >, and SeldonData::GeneralGrid< T, n >.
int SeldonData::Grid< T >::GetLength | ( | ) | const [inline, virtual] |
Returns grid length.
Reimplemented in SeldonData::RegularGrid< T >, and SeldonData::GeneralGrid< T, n >.
int SeldonData::Grid< T >::GetLength | ( | int | i | ) | const [inline, virtual] |
Returns grid length along dimension i.
i | dimension number. |
Reimplemented in SeldonData::RegularGrid< T >, and SeldonData::GeneralGrid< T, n >.
int SeldonData::Grid< T >::GetVariable | ( | ) | const [inline] |
Returns dimension number related to the grid.
bool SeldonData::Grid< T >::IsDependent | ( | int | i | ) | const [inline, virtual] |
Returns whether the grid depends on a given dimension.
i | dimension number. |
SeldonData::WrongDim | Dimension number i is out of range. |
Reimplemented in SeldonData::GeneralGrid< T, n >.
int SeldonData::Grid< T >::GetNbElements | ( | ) | const [inline, virtual] |
Returns the number of elements in the grid.
Reimplemented in SeldonData::RegularGrid< T >, and SeldonData::GeneralGrid< T, n >.
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.
variable | dimension to which the grid is related. |
void SeldonData::Grid< T >::SetPointers | ( | int | pointers | ) |
Sets the number of pointers that point to the current grid.
pointers | the number of pointers that point to the current grid. |
int SeldonData::Grid< T >::GetPointers | ( | ) | const |
Returns the number of pointers that point to the current grid.
void SeldonData::Grid< T >::SetDuplicate | ( | bool | duplicate | ) |
Sets whether the grid should be duplicated in certain cases.
duplicate | true if the grid should be duplicated, false otherwise. |
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).
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.
SeldonData::NoMemory | no more memory is available; duplication is impossible. |
Reimplemented in SeldonData::RegularGrid< T >, and SeldonData::GeneralGrid< T, n >.
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'.
SeldonData::NoMemory | no more memory is available; duplication is impossible. |
Reimplemented in SeldonData::RegularGrid< T >, and SeldonData::GeneralGrid< T, n >.
Grid< T >::reference SeldonData::Grid< T >::operator() | ( | int | i | ) | [inline, virtual] |
Returns a reference to the i-th element of the grid.
i | index of the element to be returned. |
SeldonData::WrongIndex | index is out of range (i.e. is not 0). |
Reimplemented in SeldonData::RegularGrid< T >, and SeldonData::GeneralGrid< T, n >.
Grid< T >::value_type SeldonData::Grid< T >::operator() | ( | int | i | ) | const [inline, virtual] |
Returns i-th element of the grid.
i | index of the element to be returned. |
SeldonData::WrongIndex | index is out of range (i.e. is not 0). |
Reimplemented in SeldonData::RegularGrid< T >, and SeldonData::GeneralGrid< T, n >.
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.
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. |
SeldonData::WrongIndex | index is out of range (i.e. is not 0). |
Reimplemented in SeldonData::RegularGrid< T >, and SeldonData::GeneralGrid< T, n >.
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.
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. |
SeldonData::WrongIndex | index is out of range (i.e. is not 0). |
Reimplemented in SeldonData::RegularGrid< T >, and SeldonData::GeneralGrid< T, n >.
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.
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 >.
void SeldonData::Grid< T >::Print | ( | ) | const [virtual] |
Displays grid values.
Displays "Empty grid.".
Reimplemented in SeldonData::RegularGrid< T >, and SeldonData::GeneralGrid< T, n >.
bool SeldonData::Grid< T >::duplicate_ [protected] |
When copying the grid, should grid values be duplicated?