#include <Grid.hxx>
Inheritance diagram for SeldonData::GeneralGrid< T, n >:
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. |
SeldonData::GeneralGrid< T, n >::GeneralGrid | ( | ) | throw () |
Default constructor.
All is set to zero (including grid length).
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'.
values_shape | array of extents along dimensions. | |
variable | dimension number related to the grid. | |
dependencies | dimensions upon which the grid depends. |
SeldonData::GeneralGrid< T, n >::GeneralGrid | ( | const GeneralGrid< T, n > & | G | ) | throw () |
Copy constructor for general grids.
G | general grid to be copied. |
SeldonData::GeneralGrid< T, n >::GeneralGrid | ( | const Grid< T > & | G | ) | throw () |
Copy constructor.
G | grid to be copied. |
GeneralGrid< T, n > & SeldonData::GeneralGrid< T, n >::operator= | ( | const Grid< T > & | G | ) | [virtual] |
Affectation operator.
G | grid to be copied. |
Reimplemented from SeldonData::Grid< T >.
GeneralGrid< T, n > & SeldonData::GeneralGrid< T, n >::operator= | ( | const GeneralGrid< T, n > & | G | ) |
Affectation operator for general grids.
G | general grid to be copied. |
int SeldonData::GeneralGrid< T, n >::GetLength | ( | ) | const [inline, virtual] |
int SeldonData::GeneralGrid< T, n >::GetLength | ( | int | i | ) | const [inline, virtual] |
Returns grid length along dimension i.
i | dimension number. |
Reimplemented from SeldonData::Grid< T >.
int SeldonData::GeneralGrid< T, n >::GetNbElements | ( | ) | const [inline, virtual] |
Returns the number of elements in the grid.
Reimplemented from SeldonData::Grid< T >.
Array< typename GeneralGrid< T, n >::value_type, n > & SeldonData::GeneralGrid< T, n >::GetArray | ( | ) | [inline] |
Returns a reference to the array storing points coordinates.
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.
Array< int, 1 > & SeldonData::GeneralGrid< T, n >::GetDependencies | ( | ) | [inline] |
Returns a reference to dependencies array.
const Array< int, 1 > & SeldonData::GeneralGrid< T, n >::GetDependencies | ( | ) | const [inline] |
Returns a reference to dependencies array.
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.
bool SeldonData::GeneralGrid< T, n >::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 from SeldonData::Grid< T >.
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.
SeldonData::NoMemory | no more memory is available; duplication is impossible. |
Reimplemented from SeldonData::Grid< T >.
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'.
SeldonData::NoMemory | no more memory is available; duplication is impossible. |
Reimplemented from SeldonData::Grid< T >.
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.
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 | an index is out of range. |
Reimplemented from SeldonData::Grid< T >.
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.
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 | an index is out of range. |
Reimplemented from SeldonData::Grid< T >.
void SeldonData::GeneralGrid< T, n >::Apply | ( | F & | function | ) |
Applies a given function on all elements.
function | function to be applied. |
void SeldonData::GeneralGrid< T, n >::Apply | ( | GeneralGrid< T0, n > & | G, | |
F & | function | |||
) |
G | grid. | |
function | function to be applied on 'G'. |
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 >.