Salome HOME
Version ok de MED avec MEDGUI.
[modules/med.git] / src / MEDMEM / MEDMEM_SkyLineArray.cxx
1 #include "MEDMEM_SkyLineArray.hxx"
2 #include "utilities.h"
3
4 MEDSKYLINEARRAY::MEDSKYLINEARRAY(): _count(0), _length(0),
5                                 _index((med_int*)NULL),_value((med_int*)NULL)
6 {
7   MESSAGE("Constructeur MEDSKYLINEARRAY sans parametre");
8 }
9
10 MEDSKYLINEARRAY::MEDSKYLINEARRAY(const MEDSKYLINEARRAY &myArray)
11 {
12   MESSAGE("MEDSKYLINEARRAY(const MEDSKYLINEARRAY &)");
13   _count = myArray._count ;
14   _length = myArray._length ;
15   _index = new med_int[_count+1] ;
16   _value = new med_int[_length] ;
17   memcpy(_index,myArray._index,sizeof(med_int)*(_count+1));
18   memcpy(_value,myArray._value,sizeof(med_int)*_length);
19 }
20
21 MEDSKYLINEARRAY::~MEDSKYLINEARRAY()
22 {
23   MESSAGE("Destructeur ~MEDSKYLINEARRAY");
24
25   if (_index != NULL) delete [] _index;
26   if (_value != NULL) delete [] _value;
27 }
28
29 MEDSKYLINEARRAY::MEDSKYLINEARRAY(const med_int count , const med_int length ) :
30                              _count(count), _length(length)
31 {
32   MESSAGE("Constructeur MEDSKYLINEARRAY(count="<<count<<", length="<<length<<") avec parametres");
33
34   _index = new med_int[count+1] ;
35   _value = new med_int[length] ;
36 }
37
38 void MEDSKYLINEARRAY::setMEDSKYLINEARRAY( const med_int count , const med_int length, med_int* index , med_int* value ) 
39 {
40   MESSAGE("void MEDSKYLINEARRAY::setMEDSKYLINEARRAY(count, length, index, value)");
41   _count  = count  ;
42   _length = length ;
43
44   if (_index != NULL) delete [] _index;
45   if (_value != NULL) delete [] _value;
46
47   _index = index;
48   _value = value;
49 }