1 // MED MEDMEM : MED files in memory
3 // Copyright (C) 2003 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
4 // CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
6 // This library is free software; you can redistribute it and/or
7 // modify it under the terms of the GNU Lesser General Public
8 // License as published by the Free Software Foundation; either
9 // version 2.1 of the License.
11 // This library is distributed in the hope that it will be useful,
12 // but WITHOUT ANY WARRANTY; without even the implied warranty of
13 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14 // Lesser General Public License for more details.
16 // You should have received a copy of the GNU Lesser General Public
17 // License along with this library; if not, write to the Free Software
18 // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
20 // See http://www.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org
24 // File : MEDMEM_Field.cxx
28 #include "MEDMEM_Field.hxx"
30 // ---------------------------------
31 // FIELD_ : Constructors
32 // ---------------------------------
35 _name(""), _description(""), _support((SUPPORT *)NULL),
36 _numberOfComponents(0), _numberOfValues(0),_componentsTypes((int *)NULL),
37 _componentsNames((string *)NULL),
38 _componentsDescriptions((string *)NULL),
39 _componentsUnits((UNIT*)NULL),
40 _MEDComponentsUnits((string *)NULL),
41 _iterationNumber(-1),_time(0.0),_orderNumber(-1)
43 MESSAGE("Constructeur FIELD_ sans parametre");
46 FIELD_::FIELD_(const SUPPORT * Support, const int NumberOfComponents):
48 _name(""), _description(""), _support(Support),
49 _numberOfComponents(NumberOfComponents),
50 _iterationNumber(-1),_time(0.0),_orderNumber(-1)
52 MESSAGE("FIELD_(const SUPPORT * Support, const int NumberOfComponents)");
54 _numberOfValues = Support->getNumberOfElements(MED_ALL_ELEMENTS);
55 _componentsTypes = new int[NumberOfComponents] ;
56 _componentsNames = new string[NumberOfComponents];
57 _componentsDescriptions = new string[NumberOfComponents];
58 _componentsUnits = new UNIT[NumberOfComponents];
59 _MEDComponentsUnits = new string[NumberOfComponents];
60 for(int i=0;i<NumberOfComponents;i++) {
61 _componentsTypes[i] = 0 ;
65 FIELD_::FIELD_(const FIELD_ &m)
69 _description = m._description;
70 _support = m._support;
71 _numberOfComponents = m._numberOfComponents;
72 _numberOfValues = m._numberOfValues;
74 if (m._componentsTypes != NULL)
76 _componentsTypes = new int[m._numberOfComponents] ;
77 memcpy(_componentsTypes,m._componentsTypes,sizeof(int)*m._numberOfComponents);
79 _componentsTypes = new int[m._numberOfComponents] ;
80 for(int i=0;i<m._numberOfComponents;i++) {
81 _componentsTypes[i] = m._componentsTypes[i] ;
85 else _componentsTypes = (int *) NULL;
87 _componentsNames = new string[m._numberOfComponents];
88 for (int i=0; i<m._numberOfComponents; i++)
89 {_componentsNames[i]=m._componentsNames[i];}
90 _componentsDescriptions = new string[m._numberOfComponents];
91 for (int i=0; i<m._numberOfComponents; i++)
92 {_componentsDescriptions[i]=m._componentsDescriptions[i];}
93 _componentsUnits = new UNIT[m._numberOfComponents];
94 for (int i=0; i<m._numberOfComponents; i++)
95 {_componentsUnits[i] = m._componentsUnits[i];}
96 // L'operateur '=' est defini dans la classe UNIT
97 _MEDComponentsUnits = new string[m._numberOfComponents];
98 for (int i=0; i<m._numberOfComponents; i++)
99 {_MEDComponentsUnits[i] = m._MEDComponentsUnits[i];}
100 _iterationNumber = m._iterationNumber;
102 _orderNumber = m._orderNumber;
103 _valueType = m._valueType;
104 //_drivers = m._drivers ; // PG : Well, same driver, what about m destructor !
110 MESSAGE("~FIELD_()");
111 if ( _componentsTypes !=NULL)
112 delete[] _componentsTypes ;
113 if ( _componentsNames !=NULL)
114 delete[] _componentsNames ;
115 if ( _componentsDescriptions !=NULL)
116 delete[] _componentsDescriptions ;
117 if ( _componentsUnits !=NULL)
118 delete[] _componentsUnits ;
119 if ( _MEDComponentsUnits !=NULL)
120 delete[] _MEDComponentsUnits ;
123 // vector<GENDRIVER *>::const_iterator it ;
124 // SCRUTE(_drivers.size());
126 // for (it=_drivers.begin();it!=_drivers.end();it++) {
132 MESSAGE("In this object FIELD_ there is(are) " << _drivers.size() << " driver(s)");
134 for (int index=0; index < _drivers.size(); index++ )
136 SCRUTE(_drivers[index]);
137 if ( _drivers[index] != NULL) delete _drivers[index];
141 // void FIELD_::setIterationNumber (int IterationNumber) {};
142 // void FIELD_::setOrderNumber (int OrderNumber) {};
143 // void FIELD_::setFieldName (string& fieldName) {};
145 void FIELD_::rmDriver (int index) {};
146 int FIELD_::addDriver (driverTypes driverType,
147 const string & fileName,
148 const string & driverFieldName) {};
149 int FIELD_::addDriver (GENDRIVER & driver) {};
150 void FIELD_::write (const GENDRIVER &) {};
151 void FIELD_::read (const GENDRIVER &) {};
152 void FIELD_::write (int index, const string & driverName) {};
153 void FIELD_::read (int index) {};
155 // void FIELD_::setValueType(med_type_champ ValueType) {};
156 // med_type_champ FIELD_::getValueType() {};