Version: 6.3.1
Public Member Functions | Private Attributes

MEDMEM.MEDARRAY< T > Class Template Reference

#include <MEDMEM_Array.hxx>

Inheritance diagram for MEDMEM.MEDARRAY< T >:
Inheritance graph

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)
MEDARRAYoperator= (const MEDARRAY &m)
MEDARRAYshallowCopy (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

template<class T >
MEDMEM.MEDARRAY< T >::MEDARRAY ( )
template<class T >
MEDMEM.MEDARRAY< T >::~MEDARRAY ( )
template<class T >
MEDMEM.MEDARRAY< T >::MEDARRAY ( const int  ld_values,
const int  length_values,
const MED_EN::medModeSwitch  mode = MED_EN::MED_FULL_INTERLACE 
)

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.

template<class T>
MEDMEM.MEDARRAY< T >::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 
)
template<class T>
MEDMEM.MEDARRAY< T >.MEDARRAY ( MEDARRAY< T > const &  m)
template<class T>
MEDMEM.MEDARRAY< T >.MEDARRAY ( MEDARRAY< T > const &  m,
bool  copyOther 
)

Member Function Documentation

template<class T >
MEDARRAY< T > & MEDMEM.MEDARRAY< T >::operator= ( const MEDARRAY< T > &  m)

This operator makes a deep copy of the arrays.

template<class T >
MEDARRAY< T > & MEDMEM.MEDARRAY< T >::shallowCopy ( const MEDARRAY< T > &  m)

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 !!!!

template<class T >
int MEDMEM.MEDARRAY< T >::getLeadingValue ( ) const

returns _ldValues. (for example, space dimension for coordinates array)

template<class T >
int MEDMEM.MEDARRAY< T >::getLengthValue ( ) const

returns _ldValues. (for example, number of nodes for coordinates array)

template<class T >
const T * MEDMEM.MEDARRAY< T >::get ( const MED_EN::medModeSwitch  mode)

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

template<class T >
const T * MEDMEM.MEDARRAY< T >::getRow ( const int  i)

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.

template<class T >
const T * MEDMEM.MEDARRAY< T >::getColumn ( const int  j)

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.

template<class T >
const T MEDMEM.MEDARRAY< T >::getIJ ( const int  i,
const int  j 
) const

returns Jth value of Ith element .
don't forget first element is element 1 (and not element 0).

template<class T >
MED_EN::medModeSwitch MEDMEM.MEDARRAY< T >::getMode ( ) const

returns the default mode (_mode)
(internal use : needed by write method)

template<class T>
void MEDMEM.MEDARRAY< T >::set ( const MED_EN::medModeSwitch  mode,
const T *  value 
)

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

template<class T>
void MEDMEM.MEDARRAY< T >::setI ( const int  i,
const T *  value 
)

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

template<class T>
void MEDMEM.MEDARRAY< T >::setJ ( const int  j,
const T *  value 
)

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

template<class T>
void MEDMEM.MEDARRAY< T >::setIJ ( const int  i,
const int  j,
const T  value 
)

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

template<class T >
void MEDMEM.MEDARRAY< T >::calculateOther ( )

Calculates the other mode of representation : MED_FULL_INTERLACE if __mode = MED_NO_INTERLACE and vice versa.
Throws exception if no value are setted

template<class T>
bool MEDMEM.MEDARRAY< T >.isOtherCalculated ( ) const
template<class T >
void MEDMEM.MEDARRAY< T >::clearOtherMode ( )

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

template<class T>
int MEDMEM.MEDARRAY< T >._ldValues [private]

leading dimension of value (example : space dimension for coordinates)

template<class T>
int MEDMEM.MEDARRAY< T >._lengthValues [private]

length of values (example : number of nodes for coordinates)

template<class T>
MED_EN::medModeSwitch MEDMEM.MEDARRAY< T >._mode [private]

data access mode. possible values are :

  • MED_FULL_INTERLACE (default mode)
  • MED_NO_INTERLACE
template<class T>
PointerOf<T> MEDMEM.MEDARRAY< T >._valuesFull [private]

Pointer to representation in mode MED_FULL_INTERLACE

template<class T>
PointerOf<T> MEDMEM.MEDARRAY< T >._valuesNo [private]

Pointer to representation in mode MED_NO_INTERLACE

template<class T>
PointerOf<T> MEDMEM.MEDARRAY< T >._valuesDefault [private]

Pointer to representation in mode _mode

template<class T>
PointerOf<T> MEDMEM.MEDARRAY< T >._valuesOther [private]

Pointer to representation in the other mode (!=_mode)

Copyright © 2007-2011 CEA/DEN, EDF R&D, OPEN CASCADE
Copyright © 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS