#include <MEDMEM_Array.hxx>
Public Member Functions |
| | MEDARRAY () |
| | ~MEDARRAY () |
| | MEDARRAY (const int ld_values, const int length_values, const MED_EN::medModeSwitch mode=MED_EN::MED_FULL_INTERLACE) |
| | MEDARRAY (T *values, const int ld_values, const int length_values, const MED_EN::medModeSwitch mode=MED_EN::MED_FULL_INTERLACE, bool shallowCopy=false, bool ownershipOfValues=false) |
| | MEDARRAY (MEDARRAY const &m) |
| | MEDARRAY (MEDARRAY const &m, bool copyOther) |
| MEDARRAY & | operator= (const MEDARRAY &m) |
| MEDARRAY & | shallowCopy (const MEDARRAY &m) |
| int | getLeadingValue () const |
| int | getLengthValue () const |
| const T * | get (const MED_EN::medModeSwitch mode) |
| const T * | getRow (const int i) |
| const T * | getColumn (const int j) |
| const T | getIJ (const int i, const int j) const |
| MED_EN::medModeSwitch | getMode () const |
| void | set (const MED_EN::medModeSwitch mode, const T *value) |
| void | setI (const int i, const T *value) |
| void | setJ (const int j, const T *value) |
| void | setIJ (const int i, const int j, const T value) |
| void | calculateOther () |
| bool | isOtherCalculated () const |
| void | clearOtherMode () |
Private Attributes |
| int | _ldValues |
| int | _lengthValues |
| MED_EN::medModeSwitch | _mode |
| PointerOf< T > | _valuesFull |
| PointerOf< T > | _valuesNo |
| PointerOf< T > | _valuesDefault |
| PointerOf< T > | _valuesOther |
template<class T>
class MEDMEM::MEDARRAY< T >
Constructor & Destructor Documentation
This constructor does allocation and does not set values :
. It allocates a "T" array of length_values*ld_values length.
You don't have to know the T values when calling this construtor but you have to call "set" method to initialize them later. You also can get the pointer to the memory zone (with "get" method), and work with it.
The desallocation of T array is not your responsability.
Throws MEDEXCEPTION if T array length is < 1
References ASSERT_MED, LOCALIZED, MED_EN.MED_FULL_INTERLACE, and MED_EN.MED_NO_INTERLACE.
Member Function Documentation
This operator makes a deep copy of the arrays.
Idem operator= but performs only shallow copy (just copy of pointers) of arrays contains in _valuesFull and _valuesNo
WARNING the MEDARRAY returned HAS THE OWNERSHIP OF THE ARRAY !!!!
returns _ldValues. (for example, space dimension for coordinates array)
returns _ldValues. (for example, number of nodes for coordinates array)
returns a pointer to _valuesDefault or _valuesOther, depending on mode value : if mode is the same as _mode, _valuesDefault is returned. else, if _valuesOther is calculated (if necessary) and then returned. The pointer can be used to set values
returns a pointer to ith element of the array. (ith line in a MED_FULL_INTERLACE representation )
Be aware : if _mode is MED_NO_INTERLACE, the entire array will be recalculate in MED_FULL_INTERLACE representation.
this method is similar to getRow method.
It returns a pointer to jth line of the array in a MED_NO-INTERLACE representation (for example, 2nd coordinates).
Be aware : if _mode is MED_FULL_INTERLACE, the entire array will be recalculate in MED_NO_INTERLACE representation.
returns Jth value of Ith element .
don't forget first element is element 1 (and not element 0).
returns the default mode (_mode)
(internal use : needed by write method)
sets T pointer of _valuesDefault (cf class PointerOf) on value.
no copy of value is done.
the other representation mode is not recalculate. the corresponding pointers are setted to null
Sets ith element to T* values
if they both exist, both _valuesFull and _valuesNo arrays will be updated.
Throws exception if i < 1 or i > _lengthValues
Sets ith element to T* values
if they both exist, both _valuesFull and _valuesNo arrays will be updated.
Throws exception if i < 1 or i > _lengthValues
Sets value of Jth coordinate of Ith element to T value.
Maintains coherency.
Throws exception if we don't have 1<=i<=_lengthValues and 1<=j<=_ldValues
Calculates the other mode of representation : MED_FULL_INTERLACE if __mode = MED_NO_INTERLACE and vice versa.
Throws exception if no value are setted
This function clears the other mode of representation if it exists It is usefull for people who needs for optimisation reasons to work directly on the inside array without using set-functions
References MED_EN.MED_FULL_INTERLACE.
Field Documentation
leading dimension of value (example : space dimension for coordinates)
length of values (example : number of nodes for coordinates)
data access mode. possible values are :
- MED_FULL_INTERLACE (default mode)
- MED_NO_INTERLACE
Pointer to representation in mode MED_FULL_INTERLACE
Pointer to representation in mode MED_NO_INTERLACE
Pointer to representation in mode _mode
Pointer to representation in the other mode (!=_mode)