]> SALOME platform Git repositories - modules/med.git/blob - src/MEDMEM/MEDMEM_CellModel.cxx
Salome HOME
Merge from BR_V5_DEV 16Feb09
[modules/med.git] / src / MEDMEM / MEDMEM_CellModel.cxx
1 //  Copyright (C) 2007-2008  CEA/DEN, EDF R&D, OPEN CASCADE
2 //
3 //  Copyright (C) 2003-2007  OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
4 //  CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
5 //
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.
10 //
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.
15 //
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
19 //
20 //  See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
21 //
22 /*
23  File MEDMEM_CellModel.cxx
24  $Header$
25 */
26
27 #include "MEDMEM_CellModel.hxx"
28
29 using namespace std;
30 using namespace MEDMEM;
31 using namespace MED_EN;
32
33 CELLMODEL_Map *CELLMODEL_Map::_singleton=0;
34
35 const MEDMEM::CELLMODEL& CELLMODEL_Map::retrieveCellModel(MED_EN::medGeometryElement type)
36 {
37   return CELLMODEL_Map::getInstance()->getCellModel(type);
38 }
39
40 CELLMODEL_Map *CELLMODEL_Map::getInstance()
41 {
42   if(!_singleton) _singleton=new CELLMODEL_Map;
43   return _singleton;
44 }
45
46 CELLMODEL::CELLMODEL(medGeometryElement t)
47 {
48   // init first all to nothing
49   _dimension=0 ;
50   _numberOfNodes=0 ;
51   _numberOfVertexes=0 ;
52   _numberOfConstituentsDimension=0 ;
53   _numberOfConstituents=(int*)NULL ;
54   _numberOfNodeOfEachConstituent=(int**)NULL ;
55   _constituents=(int***)NULL ; 
56   //_numberOfonstituentsType=(int*)NULL ;
57   _constituentsType=(medGeometryElement**)NULL ;
58   
59   MESSAGE_MED("CELLMODEL : constructeur pour le type " << t);
60   switch (t)
61     {
62     case MED_POINT1  : {
63       _name="MED_POINT1";
64       _type=t;
65       _dimension=0;
66       _numberOfVertexes=1;
67       _numberOfNodes=1;
68       // nothing else : POINT are none constituent
69       break;
70     }
71     case MED_SEG2    : {
72       _name="MED_SEG2" ;
73       _type=t;
74       _dimension=1;
75       _numberOfVertexes=2;
76       _numberOfNodes=2;
77       // constituent are POINT1 and we have no need to define _constituents vector
78       _numberOfConstituentsDimension=1 ;
79       _numberOfConstituents=new int[1] ;
80       _numberOfConstituents[0]=2 ;
81       _numberOfNodeOfEachConstituent=new int*[1] ;
82       _numberOfNodeOfEachConstituent[0]=new int[2] ;
83       _numberOfNodeOfEachConstituent[0][0]=1 ;
84       _numberOfNodeOfEachConstituent[0][1]=1 ;
85
86       _constituents = new int**[1] ;
87       _constituents[0] = new int*[2] ;
88       _constituents[0][0] = new int[1] ;
89       _constituents[0][0][0] = 1 ;
90       _constituents[0][1] = new int[1] ;
91       _constituents[0][1][0] = 2 ;
92
93       medGeometryElement * tmpConstituentsType1 = new medGeometryElement[2] ;
94       tmpConstituentsType1[0] = MED_POINT1 ;
95       tmpConstituentsType1[1] = MED_POINT1 ;
96       _constituentsType = new medGeometryElement*[1] ;
97       _constituentsType[0]=tmpConstituentsType1 ;
98       break;
99     }
100     case MED_SEG3    : {
101       _name="MED_SEG3" ;
102       _type=t;
103       _dimension=1;
104       _numberOfVertexes=2;
105       _numberOfNodes=3;
106       // constituent are POINT1 and we have no need to define _constituents vector
107       _numberOfConstituentsDimension=1 ;
108       _numberOfConstituents=new int[1] ;
109       _numberOfConstituents[0]=3 ;
110       _numberOfNodeOfEachConstituent=new int*[1] ;
111       _numberOfNodeOfEachConstituent[0]=new int[3] ;
112       _numberOfNodeOfEachConstituent[0][0]=1 ;
113       _numberOfNodeOfEachConstituent[0][1]=1 ;
114       _numberOfNodeOfEachConstituent[0][2]=1 ;
115
116       _constituents = new int**[1] ;
117       _constituents[0] = new int*[3] ;
118       _constituents[0][0] = new int[1] ;
119       _constituents[0][0][0] = 1 ;
120       _constituents[0][1] = new int[1] ;
121       _constituents[0][1][0] = 2 ;
122       _constituents[0][2] = new int[1] ;
123       _constituents[0][2][0] = 3 ;
124
125       medGeometryElement * tmpConstituentsType1 = new medGeometryElement[3] ;
126       tmpConstituentsType1[0] = MED_POINT1 ;
127       tmpConstituentsType1[1] = MED_POINT1 ;
128       tmpConstituentsType1[2] = MED_POINT1 ;
129       _constituentsType = new medGeometryElement*[1] ;
130       _constituentsType[0]=tmpConstituentsType1 ;
131       break;
132     }
133     case MED_TRIA3   : {
134       _name="MED_TRIA3" ;
135       _type=t;
136       _dimension=2;
137       _numberOfVertexes=3;
138       _numberOfNodes=3;
139
140       _numberOfConstituentsDimension=1 ;
141       _numberOfConstituents=new int[1] ;
142       _numberOfConstituents[0]=3 ;
143       _numberOfNodeOfEachConstituent=new int*[1] ;
144       _numberOfNodeOfEachConstituent[0]=new int[3] ;
145       _numberOfNodeOfEachConstituent[0][0]=2 ;
146       _numberOfNodeOfEachConstituent[0][1]=2 ;
147       _numberOfNodeOfEachConstituent[0][2]=2 ;
148
149       int* _edge1=new int[2];
150       _edge1[0]=1;
151       _edge1[1]=2;
152       int* _edge2=new int[2];
153       _edge2[0]=2;
154       _edge2[1]=3;
155       int* _edge3=new int[2];
156       _edge3[0]=3;
157       _edge3[1]=1;
158       int ** tmpConstituents1 = new int*[3];
159       tmpConstituents1[0]=_edge1 ;
160       tmpConstituents1[1]=_edge2 ;
161       tmpConstituents1[2]=_edge3 ;
162       _constituents = new int**[1] ;
163       _constituents[0]=tmpConstituents1 ;
164
165       medGeometryElement * tmpConstituentsType1 = new medGeometryElement[3] ;
166       tmpConstituentsType1[0] = MED_SEG2 ;
167       tmpConstituentsType1[1] = MED_SEG2 ;
168       tmpConstituentsType1[2] = MED_SEG2 ;
169 //        medGeometryElement * tmpConstituentsType2 = new medGeometryElement[3] ;
170 //        tmpConstituentsType2[0] = MED_POINT1 ;
171 //        tmpConstituentsType2[1] = MED_POINT1 ;
172 //        tmpConstituentsType2[2] = MED_POINT1 ;
173 //        _constituentsType = new medGeometryElement*[2] ;
174       _constituentsType = new medGeometryElement*[1] ;
175       _constituentsType[0]=tmpConstituentsType1 ;
176 //        _constituentsType[1]=tmpConstituentsType2 ;
177       // Well, point are defined, but could not be acces because we have 
178       // only 1 numberOfConstituentsDimension !
179
180       break;
181     }
182     case MED_TRIA6   : {
183       _name="MED_TRIA6" ;
184       _type=t;
185       _dimension=2;
186       _numberOfVertexes=3;
187       _numberOfNodes=6;
188       _numberOfConstituentsDimension=1 ;
189       _numberOfConstituents=new int[1] ;
190       _numberOfConstituents[0]=3 ;
191       _numberOfNodeOfEachConstituent=new int*[1] ;
192       _numberOfNodeOfEachConstituent[0]=new int[3] ;
193       _numberOfNodeOfEachConstituent[0][0]=3 ;
194       _numberOfNodeOfEachConstituent[0][1]=3 ;
195       _numberOfNodeOfEachConstituent[0][2]=3 ;
196
197       int* _edge1=new int[3];
198       _edge1[0]=1;
199       _edge1[1]=2;
200       _edge1[2]=4;
201       int* _edge2=new int[3];
202       _edge2[0]=2;
203       _edge2[1]=3;
204       _edge2[2]=5;
205       int* _edge3=new int[3];
206       _edge3[0]=3;
207       _edge3[1]=1;
208       _edge3[2]=6;
209       int ** tmpConstituents1 = new int*[3];
210       tmpConstituents1[0]=_edge1 ;
211       tmpConstituents1[1]=_edge2 ;
212       tmpConstituents1[2]=_edge3 ;
213       _constituents = new int**[1] ;
214       _constituents[0]=tmpConstituents1 ;
215       medGeometryElement * tmpConstituentsType1 = new medGeometryElement[3] ;
216       tmpConstituentsType1[0] = MED_SEG3 ;
217       tmpConstituentsType1[1] = MED_SEG3 ;
218       tmpConstituentsType1[2] = MED_SEG3 ;
219 //        medGeometryElement * tmpConstituentsType2 = new medGeometryElement[6] ;
220 //        tmpConstituentsType2[0] = MED_POINT1 ;
221 //        tmpConstituentsType2[1] = MED_POINT1 ;
222 //        tmpConstituentsType2[2] = MED_POINT1 ;
223 //        tmpConstituentsType2[3] = MED_POINT1 ;
224 //        tmpConstituentsType2[4] = MED_POINT1 ;
225 //        tmpConstituentsType2[5] = MED_POINT1 ;
226 //        _constituentsType = new medGeometryElement*[2] ;
227       _constituentsType = new medGeometryElement*[1] ;
228       _constituentsType[0]=tmpConstituentsType1 ;
229 //        _constituentsType[1]=tmpConstituentsType2 ;
230       // Well, point are defined, but could not be acces because we have 
231       // only 1 numberOfConstituentsDimension !
232
233       break;
234     }
235     case MED_QUAD4   : {
236       _name="MED_QUAD4" ;
237       _type=t;
238       _dimension=2;
239       _numberOfVertexes=4;
240       _numberOfNodes=4;
241       _numberOfConstituentsDimension=1 ;
242       _numberOfConstituents=new int[1] ;
243       _numberOfConstituents[0]=4 ;
244       _numberOfNodeOfEachConstituent=new int*[1] ;
245       _numberOfNodeOfEachConstituent[0]=new int[4] ;
246       _numberOfNodeOfEachConstituent[0][0]=2 ;
247       _numberOfNodeOfEachConstituent[0][1]=2 ;
248       _numberOfNodeOfEachConstituent[0][2]=2 ;
249       _numberOfNodeOfEachConstituent[0][3]=2 ;
250
251       int* _edge1=new int[2];
252       _edge1[0]=1;
253       _edge1[1]=2;
254       int* _edge2=new int[2];
255       _edge2[0]=2;
256       _edge2[1]=3;
257       int* _edge3=new int[2];
258       _edge3[0]=3;
259       _edge3[1]=4;
260       int* _edge4=new int[2];
261       _edge4[0]=4;
262       _edge4[1]=1;
263       int ** tmpConstituents1 = new int*[4];
264       tmpConstituents1[0]=_edge1 ;
265       tmpConstituents1[1]=_edge2 ;
266       tmpConstituents1[2]=_edge3 ;
267       tmpConstituents1[3]=_edge4 ;
268       _constituents = new int**[1] ;
269       _constituents[0]=tmpConstituents1 ;
270       medGeometryElement * tmpConstituentsType1 = new medGeometryElement[4] ;
271       tmpConstituentsType1[0] = MED_SEG2 ;
272       tmpConstituentsType1[1] = MED_SEG2 ;
273       tmpConstituentsType1[2] = MED_SEG2 ;
274       tmpConstituentsType1[3] = MED_SEG2 ;
275 //        medGeometryElement * tmpConstituentsType2 = new medGeometryElement[4] ;
276 //        tmpConstituentsType2[0] = MED_POINT1 ;
277 //        tmpConstituentsType2[1] = MED_POINT1 ;
278 //        tmpConstituentsType2[2] = MED_POINT1 ;
279 //        tmpConstituentsType2[3] = MED_POINT1 ;
280 //        _constituentsType = new medGeometryElement*[2] ;
281       _constituentsType = new medGeometryElement*[1] ;
282       _constituentsType[0]=tmpConstituentsType1 ;
283 //        _constituentsType[1]=tmpConstituentsType2 ;
284       // Well, point are defined, but could not be acces because we have 
285       // only 1 numberOfConstituentsDimension !
286
287       break;
288     }
289     case MED_QUAD8   : {
290       _name="MED_QUAD8" ;
291       _type=t;
292       _dimension=2;
293       _numberOfVertexes=4;
294       _numberOfNodes=8;
295       _numberOfConstituentsDimension=1 ;
296       _numberOfConstituents=new int[1] ;
297       _numberOfConstituents[0]=4 ;
298       _numberOfNodeOfEachConstituent=new int*[1] ;
299       _numberOfNodeOfEachConstituent[0]=new int[4] ;
300       _numberOfNodeOfEachConstituent[0][0]=3 ;
301       _numberOfNodeOfEachConstituent[0][1]=3 ;
302       _numberOfNodeOfEachConstituent[0][2]=3 ;
303       _numberOfNodeOfEachConstituent[0][3]=3 ;
304
305       int* _edge1=new int[3];
306       _edge1[0]=1;
307       _edge1[1]=2;
308       _edge1[2]=5;
309       int* _edge2=new int[3];
310       _edge2[0]=2;
311       _edge2[1]=3;
312       _edge2[2]=6;
313       int* _edge3=new int[3];
314       _edge3[0]=3;
315       _edge3[1]=4;
316       _edge3[2]=7;
317       int* _edge4=new int[3];
318       _edge4[0]=4;
319       _edge4[1]=1;
320       _edge4[2]=8;
321       int ** tmpConstituents1 = new int*[4];
322       tmpConstituents1[0]=_edge1 ;
323       tmpConstituents1[1]=_edge2 ;
324       tmpConstituents1[2]=_edge3 ;
325       tmpConstituents1[3]=_edge4 ;
326       _constituents = new int**[1] ;
327       _constituents[0]=tmpConstituents1 ;
328       medGeometryElement * tmpConstituentsType1 = new medGeometryElement[4] ;
329       tmpConstituentsType1[0] = MED_SEG3 ;
330       tmpConstituentsType1[1] = MED_SEG3 ;
331       tmpConstituentsType1[2] = MED_SEG3 ;
332       tmpConstituentsType1[3] = MED_SEG3 ;
333 //        medGeometryElement * tmpConstituentsType2 = new medGeometryElement[8] ;
334 //        tmpConstituentsType2[0] = MED_POINT1 ;
335 //        tmpConstituentsType2[1] = MED_POINT1 ;
336 //        tmpConstituentsType2[2] = MED_POINT1 ;
337 //        tmpConstituentsType2[3] = MED_POINT1 ;
338 //        tmpConstituentsType2[4] = MED_POINT1 ;
339 //        tmpConstituentsType2[5] = MED_POINT1 ;
340 //        tmpConstituentsType2[6] = MED_POINT1 ;
341 //        tmpConstituentsType2[7] = MED_POINT1 ;
342 //        _constituentsType = new medGeometryElement*[2] ;
343       _constituentsType = new medGeometryElement*[1] ;
344       _constituentsType[0]=tmpConstituentsType1 ;
345 //        _constituentsType[1]=tmpConstituentsType2 ;
346       // Well, point are defined, but could not be acces because we have 
347       // only 1 numberOfConstituentsDimension !
348
349       break;
350     }
351     case MED_TETRA4  : {
352       _name="MED_TETRA4" ;
353       _type=t;
354       _dimension=3;
355       _numberOfVertexes=4;
356       _numberOfNodes=4;
357       _numberOfConstituentsDimension=2 ;
358       _numberOfConstituents=new int[2] ;
359       _numberOfConstituents[0]=4 ;
360       _numberOfConstituents[1]=6 ;
361       _numberOfNodeOfEachConstituent=new int*[2] ;
362       _numberOfNodeOfEachConstituent[0]=new int[4] ;
363       _numberOfNodeOfEachConstituent[0][0]=3 ;
364       _numberOfNodeOfEachConstituent[0][1]=3 ;
365       _numberOfNodeOfEachConstituent[0][2]=3 ;
366       _numberOfNodeOfEachConstituent[0][3]=3 ;
367       _numberOfNodeOfEachConstituent[1]=new int[6] ;
368       _numberOfNodeOfEachConstituent[1][0]=2 ;
369       _numberOfNodeOfEachConstituent[1][1]=2 ;
370       _numberOfNodeOfEachConstituent[1][2]=2 ;
371       _numberOfNodeOfEachConstituent[1][3]=2 ;
372       _numberOfNodeOfEachConstituent[1][4]=2 ;
373       _numberOfNodeOfEachConstituent[1][5]=2 ;
374
375       int* _face1=new int[3];
376       _face1[0]=1;
377       _face1[1]=2;
378       _face1[2]=3;
379       int* _face2=new int[3];
380       _face2[0]=1;
381       _face2[1]=4;
382       _face2[2]=2;
383       int* _face3=new int[3];
384       _face3[0]=2;
385       _face3[1]=4;
386       _face3[2]=3;
387       int* _face4=new int[3];
388       _face4[0]=3;
389       _face4[1]=4;
390       _face4[2]=1;
391       int* _edge1=new int[2];
392       _edge1[0]=1;
393       _edge1[1]=2;
394       int* _edge2=new int[2];
395       _edge2[0]=2;
396       _edge2[1]=3;
397       int* _edge3=new int[2];
398       _edge3[0]=3;
399       _edge3[1]=1;
400       int* _edge4=new int[2];
401       _edge4[0]=1;
402       _edge4[1]=4;
403       int* _edge5=new int[2];
404       _edge5[0]=2;
405       _edge5[1]=4;
406       int* _edge6=new int[2];
407       _edge6[0]=3;
408       _edge6[1]=4;
409       int ** tmpConstituents1 = new int*[4];
410       tmpConstituents1[0]=_face1 ;
411       tmpConstituents1[1]=_face2 ;
412       tmpConstituents1[2]=_face3 ;
413       tmpConstituents1[3]=_face4 ;
414       int ** tmpConstituents2 = new int*[6];
415       tmpConstituents2[0]=_edge1 ;
416       tmpConstituents2[1]=_edge2 ;
417       tmpConstituents2[2]=_edge3 ;
418       tmpConstituents2[3]=_edge4 ;
419       tmpConstituents2[4]=_edge5 ;
420       tmpConstituents2[5]=_edge6 ;
421       _constituents = new int**[2] ;
422       _constituents[0]=tmpConstituents1 ;
423       _constituents[1]=tmpConstituents2 ;
424       medGeometryElement * tmpConstituentsType1 = new medGeometryElement[4] ;
425       tmpConstituentsType1[0] = MED_TRIA3 ;
426       tmpConstituentsType1[1] = MED_TRIA3 ;
427       tmpConstituentsType1[2] = MED_TRIA3 ;
428       tmpConstituentsType1[3] = MED_TRIA3 ;
429       medGeometryElement * tmpConstituentsType2 = new medGeometryElement[6] ;
430       tmpConstituentsType2[0] = MED_SEG2 ;
431       tmpConstituentsType2[1] = MED_SEG2 ;
432       tmpConstituentsType2[2] = MED_SEG2 ;
433       tmpConstituentsType2[3] = MED_SEG2 ;
434       tmpConstituentsType2[4] = MED_SEG2 ;
435       tmpConstituentsType2[5] = MED_SEG2 ;
436       _constituentsType = new medGeometryElement*[2] ;
437       _constituentsType[0]=tmpConstituentsType1 ;
438       _constituentsType[1]=tmpConstituentsType2 ;
439       break;
440     }
441     case MED_TETRA10 : {
442       _name="MED_TETRA10" ;
443       _type=t;
444       _dimension=3;
445       _numberOfVertexes=4;
446       _numberOfNodes=10;
447       _numberOfConstituentsDimension=2 ;
448       _numberOfConstituents=new int[2] ;
449       _numberOfConstituents[0]=4 ;
450       _numberOfConstituents[1]=6 ;
451       _numberOfNodeOfEachConstituent=new int*[2] ;
452       _numberOfNodeOfEachConstituent[0]=new int[4] ;
453       _numberOfNodeOfEachConstituent[0][0]=6 ;
454       _numberOfNodeOfEachConstituent[0][1]=6 ;
455       _numberOfNodeOfEachConstituent[0][2]=6 ;
456       _numberOfNodeOfEachConstituent[0][3]=6 ;
457       _numberOfNodeOfEachConstituent[1]=new int[6] ;
458       _numberOfNodeOfEachConstituent[1][0]=3 ;
459       _numberOfNodeOfEachConstituent[1][1]=3 ;
460       _numberOfNodeOfEachConstituent[1][2]=3 ;
461       _numberOfNodeOfEachConstituent[1][3]=3 ;
462       _numberOfNodeOfEachConstituent[1][4]=3 ;
463       _numberOfNodeOfEachConstituent[1][5]=3 ;
464
465       int* _face1=new int[6];
466       _face1[0]=1;
467       _face1[1]=2;
468       _face1[2]=3;
469       _face1[3]=5;
470       _face1[4]=6;
471       _face1[5]=7;
472       int* _face2=new int[6];
473       _face2[0]=1;
474       _face2[1]=4;
475       _face2[2]=2;
476       _face2[3]=8;
477       _face2[4]=9;
478       _face2[5]=5;
479       int* _face3=new int[6];
480       _face3[0]=2;
481       _face3[1]=4;
482       _face3[2]=3;
483       _face3[3]=9;
484       _face3[4]=10;
485       _face3[5]=6;
486       int* _face4=new int[6];
487       _face4[0]=3;
488       _face4[1]=4;
489       _face4[2]=1;
490       _face4[3]=10;
491       _face4[4]=8;
492       _face4[5]=7;
493       int* _edge1=new int[3];
494       _edge1[0]=1;
495       _edge1[1]=2;
496       _edge1[2]=5;
497       int* _edge2=new int[3];
498       _edge2[0]=2;
499       _edge2[1]=3;
500       _edge2[2]=6;
501       int* _edge3=new int[3];
502       _edge3[0]=3;
503       _edge3[1]=1;
504       _edge3[2]=7;
505       int* _edge4=new int[3];
506       _edge4[0]=1;
507       _edge4[1]=4;
508       _edge4[2]=8;
509       int* _edge5=new int[3];
510       _edge5[0]=2;
511       _edge5[1]=4;
512       _edge5[2]=9;
513       int* _edge6=new int[3];
514       _edge6[0]=3;
515       _edge6[1]=4;
516       _edge6[2]=10;
517       int ** tmpConstituents1 = new int*[4];
518       tmpConstituents1[0]=_face1 ;
519       tmpConstituents1[1]=_face2 ;
520       tmpConstituents1[2]=_face3 ;
521       tmpConstituents1[3]=_face4 ;
522       int ** tmpConstituents2 = new int*[6];
523       tmpConstituents2[0]=_edge1 ;
524       tmpConstituents2[1]=_edge2 ;
525       tmpConstituents2[2]=_edge3 ;
526       tmpConstituents2[3]=_edge4 ;
527       tmpConstituents2[4]=_edge5 ;
528       tmpConstituents2[5]=_edge6 ;
529       _constituents = new int**[2] ;
530       _constituents[0]=tmpConstituents1 ;
531       _constituents[1]=tmpConstituents2 ;
532       medGeometryElement * tmpConstituentsType1 = new medGeometryElement[4] ;
533       tmpConstituentsType1[0] = MED_TRIA6 ;
534       tmpConstituentsType1[1] = MED_TRIA6 ;
535       tmpConstituentsType1[2] = MED_TRIA6 ;
536       tmpConstituentsType1[3] = MED_TRIA6 ;
537       medGeometryElement * tmpConstituentsType2 = new medGeometryElement[6] ;
538       tmpConstituentsType2[0] = MED_SEG3 ;
539       tmpConstituentsType2[1] = MED_SEG3 ;
540       tmpConstituentsType2[2] = MED_SEG3 ;
541       tmpConstituentsType2[3] = MED_SEG3 ;
542       tmpConstituentsType2[4] = MED_SEG3 ;
543       tmpConstituentsType2[5] = MED_SEG3 ;
544       _constituentsType = new medGeometryElement*[2] ;
545       _constituentsType[0]=tmpConstituentsType1 ;
546       _constituentsType[1]=tmpConstituentsType2 ;
547     break;
548     }
549     case MED_HEXA8   : {
550       _name="MED_HEXA8" ;
551       _type=t;
552       _dimension=3;
553       _numberOfVertexes=8;
554       _numberOfNodes=8;
555       _numberOfConstituentsDimension=2 ;
556       _numberOfConstituents=new int[2] ;
557       _numberOfConstituents[0]=6 ;
558       _numberOfConstituents[1]=12 ;
559       _numberOfNodeOfEachConstituent=new int*[2] ;
560       _numberOfNodeOfEachConstituent[0]=new int[6] ;
561       _numberOfNodeOfEachConstituent[0][0]=4 ;
562       _numberOfNodeOfEachConstituent[0][1]=4 ;
563       _numberOfNodeOfEachConstituent[0][2]=4 ;
564       _numberOfNodeOfEachConstituent[0][3]=4 ;
565       _numberOfNodeOfEachConstituent[0][4]=4 ;
566       _numberOfNodeOfEachConstituent[0][5]=4 ;
567       _numberOfNodeOfEachConstituent[1]=new int[12] ;
568       _numberOfNodeOfEachConstituent[1][0]=2 ;
569       _numberOfNodeOfEachConstituent[1][1]=2 ;
570       _numberOfNodeOfEachConstituent[1][2]=2 ;
571       _numberOfNodeOfEachConstituent[1][3]=2 ;
572       _numberOfNodeOfEachConstituent[1][4]=2 ;
573       _numberOfNodeOfEachConstituent[1][5]=2 ;
574       _numberOfNodeOfEachConstituent[1][6]=2 ;
575       _numberOfNodeOfEachConstituent[1][7]=2 ;
576       _numberOfNodeOfEachConstituent[1][8]=2 ;
577       _numberOfNodeOfEachConstituent[1][9]=2 ;
578       _numberOfNodeOfEachConstituent[1][10]=2 ;
579       _numberOfNodeOfEachConstituent[1][11]=2 ;
580
581       int* _edge1=new int[2];
582       _edge1[0]=1;
583       _edge1[1]=2;
584       int* _edge2=new int[2];
585       _edge2[0]=2;
586       _edge2[1]=3;
587       int* _edge3=new int[2];
588       _edge3[0]=3;
589       _edge3[1]=4;
590       int* _edge4=new int[2];
591       _edge4[0]=4;
592       _edge4[1]=1;
593       int* _edge5=new int[2];
594       _edge5[0]=5;
595       _edge5[1]=6;
596       int* _edge6=new int[2];
597       _edge6[0]=6;
598       _edge6[1]=7;
599       int* _edge7=new int[2];
600       _edge7[0]=7;
601       _edge7[1]=8;
602       int* _edge8=new int[2];
603       _edge8[0]=8;
604       _edge8[1]=5;
605       int* _edge9=new int[2];
606       _edge9[0]=1;
607       _edge9[1]=5;
608       int* _edge10=new int[2];
609       _edge10[0]=2;
610       _edge10[1]=6;
611       int* _edge11=new int[2];
612       _edge11[0]=3;
613       _edge11[1]=7;
614       int* _edge12=new int[2];
615       _edge12[0]=4;
616       _edge12[1]=8;
617       int* _face1=new int[4];
618       _face1[0]=1;
619       _face1[1]=2;
620       _face1[2]=3;
621       _face1[3]=4;
622       int* _face2=new int[4];
623       _face2[0]=5;
624       _face2[1]=8;
625       _face2[2]=7;
626       _face2[3]=6;
627       int* _face3=new int[4];
628       _face3[0]=1;
629       _face3[1]=5;
630       _face3[2]=6;
631       _face3[3]=2;
632       int* _face4=new int[4];
633       _face4[0]=2;
634       _face4[1]=6;
635       _face4[2]=7;
636       _face4[3]=3;
637       int* _face5=new int[4];
638       _face5[0]=3;
639       _face5[1]=7;
640       _face5[2]=8;
641       _face5[3]=4;
642      int* _face6=new int[4];
643       _face6[0]=4;
644       _face6[1]=8;
645       _face6[2]=5;
646       _face6[3]=1;
647       int ** tmpConstituents1 = new int*[6];
648       tmpConstituents1[0]=_face1 ;
649       tmpConstituents1[1]=_face2 ;
650       tmpConstituents1[2]=_face3 ;
651       tmpConstituents1[3]=_face4 ;
652       tmpConstituents1[4]=_face5 ;
653       tmpConstituents1[5]=_face6 ;
654       int ** tmpConstituents2 = new int*[12];
655       tmpConstituents2[0]=_edge1 ;
656       tmpConstituents2[1]=_edge2 ;
657       tmpConstituents2[2]=_edge3 ;
658       tmpConstituents2[3]=_edge4 ;
659       tmpConstituents2[4]=_edge5 ;
660       tmpConstituents2[5]=_edge6 ;
661       tmpConstituents2[6]=_edge7 ;
662       tmpConstituents2[7]=_edge8 ;
663       tmpConstituents2[8]=_edge9 ;
664       tmpConstituents2[9]=_edge10;
665       tmpConstituents2[10]=_edge11;
666       tmpConstituents2[11]=_edge12;
667       _constituents = new int**[2] ;
668       _constituents[0]=tmpConstituents1 ;
669       _constituents[1]=tmpConstituents2 ;
670       medGeometryElement * tmpConstituentsType1 = new medGeometryElement[6] ;
671       tmpConstituentsType1[0] = MED_QUAD4 ;
672       tmpConstituentsType1[1] = MED_QUAD4 ;
673       tmpConstituentsType1[2] = MED_QUAD4 ;
674       tmpConstituentsType1[3] = MED_QUAD4 ;
675       tmpConstituentsType1[4] = MED_QUAD4 ;
676       tmpConstituentsType1[5] = MED_QUAD4 ;
677       medGeometryElement * tmpConstituentsType2 = new medGeometryElement[12] ;
678       tmpConstituentsType2[0] = MED_SEG2 ;
679       tmpConstituentsType2[1] = MED_SEG2 ;
680       tmpConstituentsType2[2] = MED_SEG2 ;
681       tmpConstituentsType2[3] = MED_SEG2 ;
682       tmpConstituentsType2[4] = MED_SEG2 ;
683       tmpConstituentsType2[5] = MED_SEG2 ;
684       tmpConstituentsType2[6] = MED_SEG2 ;
685       tmpConstituentsType2[7] = MED_SEG2 ;
686       tmpConstituentsType2[8] = MED_SEG2 ;
687       tmpConstituentsType2[9] = MED_SEG2 ;
688       tmpConstituentsType2[10] = MED_SEG2 ;
689       tmpConstituentsType2[11] = MED_SEG2 ;
690       _constituentsType = new medGeometryElement*[2] ;
691       _constituentsType[0]=tmpConstituentsType1 ;
692       _constituentsType[1]=tmpConstituentsType2 ;
693       break;
694     }
695     case MED_HEXA20  : {
696       _name="MED_HEXA20" ;
697       _type=t;
698       _dimension=3;
699       _numberOfVertexes=8;
700       _numberOfNodes=20;
701       _numberOfConstituentsDimension=2 ;
702       _numberOfConstituents=new int[2] ;
703       _numberOfConstituents[0]=6 ;
704       _numberOfConstituents[1]=12 ;
705       _numberOfNodeOfEachConstituent=new int*[2] ;
706       _numberOfNodeOfEachConstituent[0]=new int[6] ;
707       _numberOfNodeOfEachConstituent[0][0]=8 ;
708       _numberOfNodeOfEachConstituent[0][1]=8 ;
709       _numberOfNodeOfEachConstituent[0][2]=8 ;
710       _numberOfNodeOfEachConstituent[0][3]=8 ;
711       _numberOfNodeOfEachConstituent[0][4]=8 ;
712       _numberOfNodeOfEachConstituent[0][5]=8 ;
713       _numberOfNodeOfEachConstituent[1]=new int[12] ;
714       _numberOfNodeOfEachConstituent[1][0]=3 ;
715       _numberOfNodeOfEachConstituent[1][1]=3 ;
716       _numberOfNodeOfEachConstituent[1][2]=3 ;
717       _numberOfNodeOfEachConstituent[1][3]=3 ;
718       _numberOfNodeOfEachConstituent[1][4]=3 ;
719       _numberOfNodeOfEachConstituent[1][5]=3 ;
720       _numberOfNodeOfEachConstituent[1][6]=3 ;
721       _numberOfNodeOfEachConstituent[1][7]=3 ;
722       _numberOfNodeOfEachConstituent[1][8]=3 ;
723       _numberOfNodeOfEachConstituent[1][9]=3 ;
724       _numberOfNodeOfEachConstituent[1][10]=3 ;
725       _numberOfNodeOfEachConstituent[1][11]=3 ;
726
727       int* _edge1=new int[3];
728       _edge1[0]=1;
729       _edge1[1]=2;
730       _edge1[2]=9;
731       int* _edge2=new int[3];
732       _edge2[0]=2;
733       _edge2[1]=3;
734       _edge2[2]=10;
735       int* _edge3=new int[3];
736       _edge3[0]=3;
737       _edge3[1]=4;
738       _edge3[2]=11;
739       int* _edge4=new int[3];
740       _edge4[0]=4;
741       _edge4[1]=1;
742       _edge4[2]=12;
743       int* _edge5=new int[3];
744       _edge5[0]=5;
745       _edge5[1]=6;
746       _edge5[2]=13;
747       int* _edge6=new int[3];
748       _edge6[0]=6;
749       _edge6[1]=7;
750       _edge6[2]=14;
751       int* _edge7=new int[3];
752       _edge7[0]=7;
753       _edge7[1]=8;
754       _edge7[2]=15;
755       int* _edge8=new int[3];
756       _edge8[0]=8;
757       _edge8[1]=5;
758       _edge8[2]=16;
759       int* _edge9=new int[3];
760       _edge9[0]=1;
761       _edge9[1]=5;
762       _edge9[2]=17;
763       int* _edge10=new int[3];
764       _edge10[0]=2;
765       _edge10[1]=6;
766       _edge10[2]=18;
767       int* _edge11=new int[3];
768       _edge11[0]=3;
769       _edge11[1]=7;
770       _edge11[2]=19;
771       int* _edge12=new int[3];
772       _edge12[0]=4;
773       _edge12[1]=8;
774       _edge12[2]=20;
775       int* _face1=new int[8];
776       _face1[0]=1;
777       _face1[1]=2;
778       _face1[2]=3;
779       _face1[3]=4;
780       _face1[4]=9;
781       _face1[5]=10;
782       _face1[6]=11;
783       _face1[7]=12;
784       int* _face2=new int[8];
785       _face2[0]=5;
786       _face2[1]=8;
787       _face2[2]=7;
788       _face2[3]=6;
789       _face2[4]=16;
790       _face2[5]=15;
791       _face2[6]=14;
792       _face2[7]=13;
793       int* _face3=new int[8];
794       _face3[0]=1;
795       _face3[1]=5;
796       _face3[2]=6;
797       _face3[3]=2;
798       _face3[4]=17;
799       _face3[5]=13;
800       _face3[6]=18;
801       _face3[7]=9;
802       int* _face4=new int[8];
803       _face4[0]=2;
804       _face4[1]=6;
805       _face4[2]=7;
806       _face4[3]=3;
807       _face4[4]=18;
808       _face4[5]=14;
809       _face4[6]=19;
810       _face4[7]=10;
811       int* _face5=new int[8];
812       _face5[0]=3;
813       _face5[1]=7;
814       _face5[2]=8;
815       _face5[3]=4;
816       _face5[4]=19;
817       _face5[5]=15;
818       _face5[6]=20;
819       _face5[7]=11;
820      int* _face6=new int[8];
821       _face6[0]=4;
822       _face6[1]=8;
823       _face6[2]=5;
824       _face6[3]=1;
825       _face6[4]=20;
826       _face6[5]=16;
827       _face6[6]=17;
828       _face6[7]=12;
829       int ** tmpConstituents1 = new int*[6];
830       tmpConstituents1[0]=_face1 ;
831       tmpConstituents1[1]=_face2 ;
832       tmpConstituents1[2]=_face3 ;
833       tmpConstituents1[3]=_face4 ;
834       tmpConstituents1[4]=_face5 ;
835       tmpConstituents1[5]=_face6 ;
836       int ** tmpConstituents2 = new int*[12];
837       tmpConstituents2[0]=_edge1 ;
838       tmpConstituents2[1]=_edge2 ;
839       tmpConstituents2[2]=_edge3 ;
840       tmpConstituents2[3]=_edge4 ;
841       tmpConstituents2[4]=_edge5 ;
842       tmpConstituents2[5]=_edge6 ;
843       tmpConstituents2[6]=_edge7 ;
844       tmpConstituents2[7]=_edge8 ;
845       tmpConstituents2[8]=_edge9 ;
846       tmpConstituents2[9]=_edge10;
847       tmpConstituents2[10]=_edge11;
848       tmpConstituents2[11]=_edge12;
849       _constituents = new int**[2] ;
850       _constituents[0]=tmpConstituents1 ;
851       _constituents[1]=tmpConstituents2 ;
852       medGeometryElement * tmpConstituentsType1 = new medGeometryElement[6] ;
853       tmpConstituentsType1[0] = MED_QUAD8 ;
854       tmpConstituentsType1[1] = MED_QUAD8 ;
855       tmpConstituentsType1[2] = MED_QUAD8 ;
856       tmpConstituentsType1[3] = MED_QUAD8 ;
857       tmpConstituentsType1[4] = MED_QUAD8 ;
858       tmpConstituentsType1[5] = MED_QUAD8 ;
859       medGeometryElement * tmpConstituentsType2 = new medGeometryElement[12] ;
860       tmpConstituentsType2[0] = MED_SEG3 ;
861       tmpConstituentsType2[1] = MED_SEG3 ;
862       tmpConstituentsType2[2] = MED_SEG3 ;
863       tmpConstituentsType2[3] = MED_SEG3 ;
864       tmpConstituentsType2[4] = MED_SEG3 ;
865       tmpConstituentsType2[5] = MED_SEG3 ;
866       tmpConstituentsType2[6] = MED_SEG3 ;
867       tmpConstituentsType2[7] = MED_SEG3 ;
868       tmpConstituentsType2[8] = MED_SEG3 ;
869       tmpConstituentsType2[9] = MED_SEG3 ;
870       tmpConstituentsType2[10] = MED_SEG3 ;
871       tmpConstituentsType2[11] = MED_SEG3 ;
872       _constituentsType = new medGeometryElement*[2] ;
873       _constituentsType[0]=tmpConstituentsType1 ;
874       _constituentsType[1]=tmpConstituentsType2 ;
875       break;
876     }
877     case MED_PENTA6  : {
878       _name="MED_PENTA6" ;
879       _type=t;
880       _dimension=3;
881       _numberOfVertexes=6;
882       _numberOfNodes=6;
883
884       _numberOfConstituentsDimension=2 ;
885       _numberOfConstituents=new int[2] ;
886       _numberOfConstituents[0]=5 ;
887       _numberOfConstituents[1]=9 ;
888       _numberOfNodeOfEachConstituent=new int*[2] ;
889       _numberOfNodeOfEachConstituent[0]=new int[5] ;
890       _numberOfNodeOfEachConstituent[0][0]=3 ;
891       _numberOfNodeOfEachConstituent[0][1]=3 ;
892       _numberOfNodeOfEachConstituent[0][2]=4 ;
893       _numberOfNodeOfEachConstituent[0][3]=4 ;
894       _numberOfNodeOfEachConstituent[0][4]=4 ;
895       _numberOfNodeOfEachConstituent[1]=new int[9] ;
896       _numberOfNodeOfEachConstituent[1][0]=2 ;
897       _numberOfNodeOfEachConstituent[1][1]=2 ;
898       _numberOfNodeOfEachConstituent[1][2]=2 ;
899       _numberOfNodeOfEachConstituent[1][3]=2 ;
900       _numberOfNodeOfEachConstituent[1][4]=2 ;
901       _numberOfNodeOfEachConstituent[1][5]=2 ;
902       _numberOfNodeOfEachConstituent[1][6]=2 ;
903       _numberOfNodeOfEachConstituent[1][7]=2 ;
904       _numberOfNodeOfEachConstituent[1][8]=2 ;
905
906       int* _edge1=new int[2];
907       _edge1[0]=1;
908       _edge1[1]=2;
909       int* _edge2=new int[2];
910       _edge2[0]=2;
911       _edge2[1]=3;
912       int* _edge3=new int[2];
913       _edge3[0]=3;
914       _edge3[1]=1;
915       int* _edge4=new int[2];
916       _edge4[0]=4;
917       _edge4[1]=5;
918       int* _edge5=new int[2];
919       _edge5[0]=5;
920       _edge5[1]=6;
921       int* _edge6=new int[2];
922       _edge6[0]=6;
923       _edge6[1]=4;
924       int* _edge7=new int[2];
925       _edge7[0]=1;
926       _edge7[1]=4;
927       int* _edge8=new int[2];
928       _edge8[0]=2;
929       _edge8[1]=5;
930       int* _edge9=new int[2];
931       _edge9[0]=3;
932       _edge9[1]=6;
933       int* _face1=new int[3];
934       _face1[0]=1;
935       _face1[1]=2;
936       _face1[2]=3;
937       int* _face2=new int[3];
938       _face2[0]=4;
939       _face2[1]=6;
940       _face2[2]=5;
941       int* _face3=new int[4];
942       _face3[0]=1;
943       _face3[1]=4;
944       _face3[2]=5;
945       _face3[3]=2;
946       int* _face4=new int[4];
947       _face4[0]=2;
948       _face4[1]=5;
949       _face4[2]=6;
950       _face4[3]=3;
951       int* _face5=new int[4];
952       _face5[0]=3;
953       _face5[1]=6;
954       _face5[2]=4;
955       _face5[3]=1;
956       int ** tmpConstituents1 = new int*[5];
957       tmpConstituents1[0]=_face1 ;
958       tmpConstituents1[1]=_face2 ;
959       tmpConstituents1[2]=_face3 ;
960       tmpConstituents1[3]=_face4 ;
961       tmpConstituents1[4]=_face5 ;
962       int ** tmpConstituents2 = new int*[9];
963       tmpConstituents2[0]=_edge1 ;
964       tmpConstituents2[1]=_edge2 ;
965       tmpConstituents2[2]=_edge3 ;
966       tmpConstituents2[3]=_edge4 ;
967       tmpConstituents2[4]=_edge5 ;
968       tmpConstituents2[5]=_edge6 ;
969       tmpConstituents2[6]=_edge7 ;
970       tmpConstituents2[7]=_edge8 ;
971       tmpConstituents2[8]=_edge9 ;
972       _constituents = new int**[2] ;
973       _constituents[0]=tmpConstituents1 ;
974       _constituents[1]=tmpConstituents2 ;
975       medGeometryElement * tmpConstituentsType1 = new medGeometryElement[5] ;
976       tmpConstituentsType1[0] = MED_TRIA3 ;
977       tmpConstituentsType1[1] = MED_TRIA3 ;
978       tmpConstituentsType1[2] = MED_QUAD4 ;
979       tmpConstituentsType1[3] = MED_QUAD4 ;
980       tmpConstituentsType1[4] = MED_QUAD4 ;
981       medGeometryElement * tmpConstituentsType2 = new medGeometryElement[9] ;
982       tmpConstituentsType2[0] = MED_SEG2 ;
983       tmpConstituentsType2[1] = MED_SEG2 ;
984       tmpConstituentsType2[2] = MED_SEG2 ;
985       tmpConstituentsType2[3] = MED_SEG2 ;
986       tmpConstituentsType2[4] = MED_SEG2 ;
987       tmpConstituentsType2[5] = MED_SEG2 ;
988       tmpConstituentsType2[6] = MED_SEG2 ;
989       tmpConstituentsType2[7] = MED_SEG2 ;
990       tmpConstituentsType2[8] = MED_SEG2 ;
991       _constituentsType = new medGeometryElement*[2] ;
992       _constituentsType[0]=tmpConstituentsType1 ;
993       _constituentsType[1]=tmpConstituentsType2 ;
994       break;
995     }
996     case MED_PENTA15 : {
997       _name="MED_PENTA15" ;
998       _type=t;
999       _dimension=3;
1000       _numberOfVertexes=6;
1001       _numberOfNodes=15;
1002       _numberOfConstituentsDimension=2 ;
1003       _numberOfConstituents=new int[2] ;
1004       _numberOfConstituents[0]=5 ;
1005       _numberOfConstituents[1]=9 ;
1006       _numberOfNodeOfEachConstituent=new int*[2] ;
1007       _numberOfNodeOfEachConstituent[0]=new int[5] ;
1008       _numberOfNodeOfEachConstituent[0][0]=6 ;
1009       _numberOfNodeOfEachConstituent[0][1]=6 ;
1010       _numberOfNodeOfEachConstituent[0][2]=8 ;
1011       _numberOfNodeOfEachConstituent[0][3]=8 ;
1012       _numberOfNodeOfEachConstituent[0][4]=8 ;
1013       _numberOfNodeOfEachConstituent[1]=new int[9] ;
1014       _numberOfNodeOfEachConstituent[1][0]=3 ;
1015       _numberOfNodeOfEachConstituent[1][1]=3 ;
1016       _numberOfNodeOfEachConstituent[1][2]=3 ;
1017       _numberOfNodeOfEachConstituent[1][3]=3 ;
1018       _numberOfNodeOfEachConstituent[1][4]=3 ;
1019       _numberOfNodeOfEachConstituent[1][5]=3 ;
1020       _numberOfNodeOfEachConstituent[1][6]=3 ;
1021       _numberOfNodeOfEachConstituent[1][7]=3 ;
1022       _numberOfNodeOfEachConstituent[1][8]=3 ;
1023
1024       int* _edge1=new int[3];
1025       _edge1[0]=1;
1026       _edge1[1]=2;
1027       _edge1[2]=7;
1028       int* _edge2=new int[3];
1029       _edge2[0]=2;
1030       _edge2[1]=3;
1031       _edge2[2]=8;
1032       int* _edge3=new int[3];
1033       _edge3[0]=3;
1034       _edge3[1]=1;
1035       _edge3[2]=9;
1036       int* _edge4=new int[3];
1037       _edge4[0]=4;
1038       _edge4[1]=5;
1039       _edge4[2]=10;
1040       int* _edge5=new int[3];
1041       _edge5[0]=5;
1042       _edge5[1]=6;
1043       _edge5[2]=11;
1044       int* _edge6=new int[3];
1045       _edge6[0]=6;
1046       _edge6[1]=4;
1047       _edge6[2]=12;
1048       int* _edge7=new int[3];
1049       _edge7[0]=1;
1050       _edge7[1]=4;
1051       _edge7[2]=13;
1052       int* _edge8=new int[3];
1053       _edge8[0]=2;
1054       _edge8[1]=5;
1055       _edge8[2]=14;
1056       int* _edge9=new int[3];
1057       _edge9[0]=3;
1058       _edge9[1]=6;
1059       _edge9[2]=15;
1060       int* _face1=new int[6];
1061       _face1[0]=1;
1062       _face1[1]=2;
1063       _face1[2]=3;
1064       _face1[3]=7;
1065       _face1[4]=8;
1066       _face1[5]=9;
1067       int* _face2=new int[6];
1068       _face2[0]=4;
1069       _face2[1]=5;
1070       _face2[2]=6;
1071       _face2[3]=12;
1072       _face2[4]=11;
1073       _face2[5]=10;
1074       int* _face3=new int[8];
1075       _face3[0]=1;
1076       _face3[1]=4;
1077       _face3[2]=5;
1078       _face3[3]=2;
1079       _face3[4]=13;
1080       _face3[5]=10;
1081       _face3[6]=14;
1082       _face3[7]=7;
1083       int* _face4=new int[8];
1084       _face4[0]=2;
1085       _face4[1]=5;
1086       _face4[2]=6;
1087       _face4[3]=3;
1088       _face4[4]=14;
1089       _face4[5]=11;
1090       _face4[6]=15;
1091       _face4[7]=8;
1092       int* _face5=new int[8];
1093       _face5[0]=3;
1094       _face5[1]=6;
1095       _face5[2]=4;
1096       _face5[3]=1;
1097       _face5[4]=15;
1098       _face5[5]=12;
1099       _face5[6]=13;
1100       _face5[7]=9;
1101       int ** tmpConstituents1 = new int*[5];
1102       tmpConstituents1[0]=_face1 ;
1103       tmpConstituents1[1]=_face2 ;
1104       tmpConstituents1[2]=_face3 ;
1105       tmpConstituents1[3]=_face4 ;
1106       tmpConstituents1[4]=_face5 ;
1107       int ** tmpConstituents2 = new int*[9];
1108       tmpConstituents2[0]=_edge1 ;
1109       tmpConstituents2[1]=_edge2 ;
1110       tmpConstituents2[2]=_edge3 ;
1111       tmpConstituents2[3]=_edge4 ;
1112       tmpConstituents2[4]=_edge5 ;
1113       tmpConstituents2[5]=_edge6 ;
1114       tmpConstituents2[6]=_edge7 ;
1115       tmpConstituents2[7]=_edge8 ;
1116       tmpConstituents2[8]=_edge9 ;
1117       _constituents = new int**[2] ;
1118       _constituents[0]=tmpConstituents1 ;
1119       _constituents[1]=tmpConstituents2 ;
1120       medGeometryElement * tmpConstituentsType1 = new medGeometryElement[5] ;
1121       tmpConstituentsType1[0] = MED_TRIA6 ;
1122       tmpConstituentsType1[1] = MED_TRIA6 ;
1123       tmpConstituentsType1[2] = MED_QUAD8 ;
1124       tmpConstituentsType1[3] = MED_QUAD8 ;
1125       tmpConstituentsType1[4] = MED_QUAD8 ;
1126       medGeometryElement * tmpConstituentsType2 = new medGeometryElement[9] ;
1127       tmpConstituentsType2[0] = MED_SEG3 ;
1128       tmpConstituentsType2[1] = MED_SEG3 ;
1129       tmpConstituentsType2[2] = MED_SEG3 ;
1130       tmpConstituentsType2[3] = MED_SEG3 ;
1131       tmpConstituentsType2[4] = MED_SEG3 ;
1132       tmpConstituentsType2[5] = MED_SEG3 ;
1133       tmpConstituentsType2[6] = MED_SEG3 ;
1134       tmpConstituentsType2[7] = MED_SEG3 ;
1135       tmpConstituentsType2[8] = MED_SEG3 ;
1136       _constituentsType = new medGeometryElement*[2] ;
1137       _constituentsType[0]=tmpConstituentsType1 ;
1138       _constituentsType[1]=tmpConstituentsType2 ;
1139       break ;
1140     }
1141     case MED_PYRA5   : {
1142       _name="MED_PYRA5" ;
1143       _type=t;
1144       _dimension=3;
1145       _numberOfVertexes=5;
1146       _numberOfNodes=5;
1147       _numberOfConstituentsDimension=2 ;
1148       _numberOfConstituents=new int[2] ;
1149       _numberOfConstituents[0]=5 ;
1150       _numberOfConstituents[1]=8 ;
1151       _numberOfNodeOfEachConstituent=new int*[2] ;
1152       _numberOfNodeOfEachConstituent[0]=new int[5] ;
1153       _numberOfNodeOfEachConstituent[0][0]=4 ;
1154       _numberOfNodeOfEachConstituent[0][1]=3 ;
1155       _numberOfNodeOfEachConstituent[0][2]=3 ;
1156       _numberOfNodeOfEachConstituent[0][3]=3 ;
1157       _numberOfNodeOfEachConstituent[0][4]=3 ;
1158       _numberOfNodeOfEachConstituent[1]=new int[8] ;
1159       _numberOfNodeOfEachConstituent[1][0]=2 ;
1160       _numberOfNodeOfEachConstituent[1][1]=2 ;
1161       _numberOfNodeOfEachConstituent[1][2]=2 ;
1162       _numberOfNodeOfEachConstituent[1][3]=2 ;
1163       _numberOfNodeOfEachConstituent[1][4]=2 ;
1164       _numberOfNodeOfEachConstituent[1][5]=2 ;
1165       _numberOfNodeOfEachConstituent[1][6]=2 ;
1166       _numberOfNodeOfEachConstituent[1][7]=2 ;
1167
1168       int* _edge1=new int[2];
1169       _edge1[0]=1;
1170       _edge1[1]=2;
1171       int* _edge2=new int[2];
1172       _edge2[0]=2;
1173       _edge2[1]=3;
1174       int* _edge3=new int[2];
1175       _edge3[0]=3;
1176       _edge3[1]=4;
1177       int* _edge4=new int[2];
1178       _edge4[0]=4;
1179       _edge4[1]=1;
1180       int* _edge5=new int[2];
1181       _edge5[0]=1;
1182       _edge5[1]=5;
1183       int* _edge6=new int[2];
1184       _edge6[0]=2;
1185       _edge6[1]=5;
1186       int* _edge7=new int[2];
1187       _edge7[0]=3;
1188       _edge7[1]=5;
1189       int* _edge8=new int[2];
1190       _edge8[0]=4;
1191       _edge8[1]=5;
1192       int* _face1=new int[4];
1193       _face1[0]=1;
1194       _face1[1]=2;
1195       _face1[2]=3;
1196       _face1[3]=4;
1197       int* _face2=new int[3];
1198       _face2[0]=1;
1199       _face2[1]=5;
1200       _face2[2]=2;
1201       int* _face3=new int[3];
1202       _face3[0]=2;
1203       _face3[1]=5;
1204       _face3[2]=3;
1205       int* _face4=new int[3];
1206       _face4[0]=3;
1207       _face4[1]=5;
1208       _face4[2]=4;
1209       int* _face5=new int[3];
1210       _face5[0]=4;
1211       _face5[1]=5;
1212       _face5[2]=1;
1213       int ** tmpConstituents1 = new int*[5];
1214       tmpConstituents1[0]=_face1 ;
1215       tmpConstituents1[1]=_face2 ;
1216       tmpConstituents1[2]=_face3 ;
1217       tmpConstituents1[3]=_face4 ;
1218       tmpConstituents1[4]=_face5 ;
1219       int ** tmpConstituents2 = new int*[8];
1220       tmpConstituents2[0]=_edge1 ;
1221       tmpConstituents2[1]=_edge2 ;
1222       tmpConstituents2[2]=_edge3 ;
1223       tmpConstituents2[3]=_edge4 ;
1224       tmpConstituents2[4]=_edge5 ;
1225       tmpConstituents2[5]=_edge6 ;
1226       tmpConstituents2[6]=_edge7 ;
1227       tmpConstituents2[7]=_edge8 ;
1228       _constituents = new int**[2] ;
1229       _constituents[0]=tmpConstituents1 ;
1230       _constituents[1]=tmpConstituents2 ;
1231       medGeometryElement * tmpConstituentsType1 = new medGeometryElement[5] ;
1232       tmpConstituentsType1[0] = MED_QUAD4 ;
1233       tmpConstituentsType1[1] = MED_TRIA3 ;
1234       tmpConstituentsType1[2] = MED_TRIA3 ;
1235       tmpConstituentsType1[3] = MED_TRIA3 ;
1236       tmpConstituentsType1[4] = MED_TRIA3 ;
1237       medGeometryElement * tmpConstituentsType2 = new medGeometryElement[8] ;
1238       tmpConstituentsType2[0] = MED_SEG2 ;
1239       tmpConstituentsType2[1] = MED_SEG2 ;
1240       tmpConstituentsType2[2] = MED_SEG2 ;
1241       tmpConstituentsType2[3] = MED_SEG2 ;
1242       tmpConstituentsType2[4] = MED_SEG2 ;
1243       tmpConstituentsType2[5] = MED_SEG2 ;
1244       tmpConstituentsType2[6] = MED_SEG2 ;
1245       tmpConstituentsType2[7] = MED_SEG2 ;
1246       _constituentsType = new medGeometryElement*[2] ;
1247       _constituentsType[0]=tmpConstituentsType1 ;
1248       _constituentsType[1]=tmpConstituentsType2 ;
1249       break;
1250     }
1251     case MED_PYRA13  : {
1252       _name="MED_PYRA13" ;
1253       _type=t;
1254       _dimension=3;
1255       _numberOfVertexes=5;
1256       _numberOfNodes=13;
1257       _numberOfConstituentsDimension=2 ;
1258       _numberOfConstituents=new int[2] ;
1259       _numberOfConstituents[0]=5 ;
1260       _numberOfConstituents[1]=8 ;
1261       _numberOfNodeOfEachConstituent=new int*[2] ;
1262       _numberOfNodeOfEachConstituent[0]=new int[5] ;
1263       _numberOfNodeOfEachConstituent[0][0]=8 ;
1264       _numberOfNodeOfEachConstituent[0][1]=6 ;
1265       _numberOfNodeOfEachConstituent[0][2]=6 ;
1266       _numberOfNodeOfEachConstituent[0][3]=6 ;
1267       _numberOfNodeOfEachConstituent[0][4]=6 ;
1268       _numberOfNodeOfEachConstituent[1]=new int[8] ;
1269       _numberOfNodeOfEachConstituent[1][0]=3 ;
1270       _numberOfNodeOfEachConstituent[1][1]=3 ;
1271       _numberOfNodeOfEachConstituent[1][2]=3 ;
1272       _numberOfNodeOfEachConstituent[1][3]=3 ;
1273       _numberOfNodeOfEachConstituent[1][4]=3 ;
1274       _numberOfNodeOfEachConstituent[1][5]=3 ;
1275       _numberOfNodeOfEachConstituent[1][6]=3 ;
1276       _numberOfNodeOfEachConstituent[1][7]=3 ;
1277
1278       int* _edge1=new int[3];
1279       _edge1[0]=1;
1280       _edge1[1]=2;
1281       _edge1[2]=6;
1282       int* _edge2=new int[3];
1283       _edge2[0]=2;
1284       _edge2[1]=3;
1285       _edge2[2]=7;
1286       int* _edge3=new int[3];
1287       _edge3[0]=3;
1288       _edge3[1]=4;
1289       _edge3[2]=8;
1290       int* _edge4=new int[3];
1291       _edge4[0]=4;
1292       _edge4[1]=1;
1293       _edge4[2]=9;
1294       int* _edge5=new int[3];
1295       _edge5[0]=1;
1296       _edge5[1]=5;
1297       _edge5[2]=10;
1298       int* _edge6=new int[3];
1299       _edge6[0]=2;
1300       _edge6[1]=5;
1301       _edge6[2]=11;
1302       int* _edge7=new int[3];
1303       _edge7[0]=3;
1304       _edge7[1]=5;
1305       _edge7[2]=12;
1306       int* _edge8=new int[3];
1307       _edge8[0]=4;
1308       _edge8[1]=5;
1309       _edge8[2]=13;
1310       int* _face1=new int[8];
1311       _face1[0]=1;
1312       _face1[1]=2;
1313       _face1[2]=3;
1314       _face1[3]=4;
1315       _face1[4]=6;
1316       _face1[5]=7;
1317       _face1[6]=8;
1318       _face1[7]=9;
1319       int* _face2=new int[6];
1320       _face2[0]=1;
1321       _face2[1]=5;
1322       _face2[2]=2;
1323       _face2[3]=10;
1324       _face2[4]=11;
1325       _face2[5]=6;
1326       int* _face3=new int[6];
1327       _face3[0]=2;
1328       _face3[1]=5;
1329       _face3[2]=3;
1330       _face3[3]=11;
1331       _face3[4]=12;
1332       _face3[5]=7;
1333       int* _face4=new int[6];
1334       _face4[0]=3;
1335       _face4[1]=5;
1336       _face4[2]=4;
1337       _face4[3]=12;
1338       _face4[4]=13;
1339       _face4[5]=8;
1340       int* _face5=new int[6];
1341       _face5[0]=4;
1342       _face5[1]=5;
1343       _face5[2]=1;
1344       _face5[3]=13;
1345       _face5[4]=10;
1346       _face5[5]=9;
1347       int ** tmpConstituents1 = new int*[5];
1348       tmpConstituents1[0]=_face1 ;
1349       tmpConstituents1[1]=_face2 ;
1350       tmpConstituents1[2]=_face3 ;
1351       tmpConstituents1[3]=_face4 ;
1352       tmpConstituents1[4]=_face5 ;
1353       int ** tmpConstituents2 = new int*[8];
1354       tmpConstituents2[0]=_edge1 ;
1355       tmpConstituents2[1]=_edge2 ;
1356       tmpConstituents2[2]=_edge3 ;
1357       tmpConstituents2[3]=_edge4 ;
1358       tmpConstituents2[4]=_edge5 ;
1359       tmpConstituents2[5]=_edge6 ;
1360       tmpConstituents2[6]=_edge7 ;
1361       tmpConstituents2[7]=_edge8 ;
1362       _constituents = new int**[2] ;
1363       _constituents[0]=tmpConstituents1 ;
1364       _constituents[1]=tmpConstituents2 ;
1365       medGeometryElement * tmpConstituentsType1 = new medGeometryElement[5] ;
1366       tmpConstituentsType1[0] = MED_QUAD8 ;
1367       tmpConstituentsType1[1] = MED_TRIA6 ;
1368       tmpConstituentsType1[2] = MED_TRIA6 ;
1369       tmpConstituentsType1[3] = MED_TRIA6 ;
1370       tmpConstituentsType1[4] = MED_TRIA6 ;
1371       medGeometryElement * tmpConstituentsType2 = new medGeometryElement[8] ;
1372       tmpConstituentsType2[0] = MED_SEG3 ;
1373       tmpConstituentsType2[1] = MED_SEG3 ;
1374       tmpConstituentsType2[2] = MED_SEG3 ;
1375       tmpConstituentsType2[3] = MED_SEG3 ;
1376       tmpConstituentsType2[4] = MED_SEG3 ;
1377       tmpConstituentsType2[5] = MED_SEG3 ;
1378       tmpConstituentsType2[6] = MED_SEG3 ;
1379       tmpConstituentsType2[7] = MED_SEG3 ;
1380       _constituentsType = new medGeometryElement*[2] ;
1381       _constituentsType[0]=tmpConstituentsType1 ;
1382       _constituentsType[1]=tmpConstituentsType2 ;
1383       break;
1384     }
1385 //      default : 
1386 //        _type=0;
1387 //        break;
1388     }
1389 }
1390
1391 ostream & MEDMEM::operator<<(ostream &os,const CELLMODEL &my)
1392 {
1393   os << "Cell Model :" << endl ;
1394   os << "  - name               : " << my._name << endl;
1395   os << "  - type               : " << (int)my._type << endl;
1396   os << "  - dimension          : " << my._dimension << endl;
1397   os << "  - number of nodes    : " << my._numberOfNodes << endl ;
1398   os << "  - number of vertexes : " << my._numberOfVertexes << endl ;
1399
1400   os << "  - number of Constituents Dimension : " << my._numberOfConstituentsDimension << endl ;
1401
1402   for(int i=0;i<my._numberOfConstituentsDimension;i++)
1403     {
1404
1405       os << "  - for dimension (-" << i+1 << ") : " << endl ;
1406       os << "    - number of Constituents for this Dimension : " << my._numberOfConstituents[i] << endl ;
1407
1408       for(int j=0;j<my._numberOfConstituents[i];j++)
1409         {
1410           os << "    - number of node for this constituent : " << my._numberOfNodeOfEachConstituent[i][j] << endl ;
1411           os << "      - constituents " << j+1 << " of type "<< my._constituentsType[i][j] <<" : " ;
1412           for(int k=0;k<my._numberOfNodeOfEachConstituent[i][j];k++)
1413             os << my._constituents[i][j][k] << " " ;
1414           os << endl ;
1415         }
1416     }
1417   return os;
1418 }
1419 /*
1420 */
1421
1422 // Return number of constituents type (which dimension is _dimension-1).
1423 int CELLMODEL::getNumberOfConstituentsType() const
1424 {
1425   set<medGeometryElement> constituentsTypes ;
1426 //   if (_constituentsType.size() > 0 ) {
1427 //     vector<medGeometryElement> constituentsType = _constituentsType[0] ;
1428 //     vector<medGeometryElement>::iterator itvec ;
1429 //     for(itvec=constituentsType.begin();itvec!=constituentsType.end();itvec++)
1430 //       constituentsTypes.insert(*itvec);
1431 //   }
1432   return constituentsTypes.size() ;
1433 }
1434
1435   // Return all types of constituents which dimension is (_dimension-1).
1436 set<medGeometryElement>  CELLMODEL::getAllConstituentsType() const
1437 {
1438   set<medGeometryElement> constituentsTypes ;
1439 //   if (_constituentsType.size() > 0 ) {
1440 //     vector<medGeometryElement> constituentsType = _constituentsType[0] ;
1441 //     vector<medGeometryElement>::iterator itvec ;
1442 //     for(itvec=constituentsType.begin();itvec!=constituentsType.end();itvec++)
1443 //       constituentsTypes.insert(*itvec);
1444 //   }
1445   return constituentsTypes ;
1446 }
1447
1448   // Return number of constituents foreach type (which dimension is _dimension-1).
1449 map<medGeometryElement,int>  CELLMODEL::getNumberOfConstituentsForeachType() const
1450 {
1451   map<medGeometryElement,int> numberOfConstituentsForeachType ;
1452 //   map<medGeometryElement,int>::iterator itmap ;
1453 //   if (_constituentsType.size() > 0 ) {
1454 //     vector<medGeometryElement> constituentsType = _constituentsType[0] ;
1455 //     vector<medGeometryElement>::iterator itvec ;
1456 //     for(itvec=constituentsType.begin();itvec!=constituentsType.end();itvec++) {
1457 //       itmap = numberOfConstituentsForeachType.find(*itvec);
1458 //       if (itmap==numberOfConstituentsForeachType.end()) // new element
1459 //      numberOfConstituentsForeachType[*itvec]=1 ;
1460 //       else
1461 //      numberOfConstituentsForeachType[*itvec]++ ;
1462 //     }
1463 //   }
1464   return numberOfConstituentsForeachType ;
1465 }
1466
1467 void CELLMODEL::init(const CELLMODEL &m)
1468 {
1469   _name=m._name ;
1470   _type= m._type ;
1471   _dimension = m._dimension ;
1472   _numberOfNodes = m._numberOfNodes ;
1473   _numberOfVertexes = m._numberOfVertexes ;
1474   
1475   _numberOfConstituentsDimension = m._numberOfConstituentsDimension ;
1476   
1477   _numberOfConstituents = new int[_numberOfConstituentsDimension] ;
1478   for(int i=0; i<_numberOfConstituentsDimension; i++)
1479     _numberOfConstituents[i]=m._numberOfConstituents[i] ;
1480   
1481   _numberOfNodeOfEachConstituent = new int*[_numberOfConstituentsDimension] ;
1482   for(int i=0; i<_numberOfConstituentsDimension; i++) {
1483     int numberOf = _numberOfConstituents[i] ;
1484     int * newArray = new int[numberOf] ;
1485     int * oldArray = m._numberOfNodeOfEachConstituent[i] ;
1486     for(int j=0; j<numberOf; j++)
1487       newArray[j] = oldArray[j] ;
1488     _numberOfNodeOfEachConstituent[i] = newArray ;
1489   }
1490   _constituents = new int**[_numberOfConstituentsDimension] ;
1491   _constituentsType = new medGeometryElement*[_numberOfConstituentsDimension] ;
1492   for(int i=0; i<_numberOfConstituentsDimension; i++) {
1493     int numberOf = _numberOfConstituents[i] ;
1494     int ** tmpArray = new int*[numberOf] ;
1495     medGeometryElement * newArrayType = new medGeometryElement[numberOf] ;
1496     medGeometryElement * oldArrayType = m._constituentsType[i] ;
1497     
1498     for(int j=0; j<numberOf; j++) {
1499       int numberOf2 = _numberOfNodeOfEachConstituent[i][j] ;
1500       int * newArray = new int[numberOf2] ;
1501       int * oldArray = m._constituents[i][j] ;
1502       for(int k=0; k<numberOf2; k++)
1503         newArray[k] = oldArray[k] ;
1504       tmpArray[j] = newArray ;
1505       newArrayType[j] = oldArrayType[j] ;
1506     }
1507     _constituents[i] = tmpArray ;
1508     _constituentsType[i] = newArrayType ;
1509   }
1510   
1511 }
1512 void CELLMODEL::clean()
1513 {
1514   for(int i=0; i<_numberOfConstituentsDimension; i++) {
1515     int numberOf = _numberOfConstituents[i] ;
1516     for(int j=0; j<numberOf; j++) {
1517       if (NULL!=_constituents[i][j])
1518         delete[] _constituents[i][j] ;
1519     }
1520     if (NULL!=_constituentsType[i])
1521       delete[] _constituentsType[i] ;
1522     if (NULL!=_constituents[i])
1523       delete[] _constituents[i] ;
1524     if (NULL!=_numberOfNodeOfEachConstituent[i])
1525       delete[] _numberOfNodeOfEachConstituent[i] ;
1526   }
1527   if (NULL!=_numberOfConstituents)
1528     delete[]_numberOfConstituents ;
1529   if (NULL!=_constituentsType)
1530     delete[] _constituentsType ;
1531   if (NULL!=_constituents)
1532     delete[] _constituents ;
1533   if (NULL!=_numberOfNodeOfEachConstituent)
1534     delete[] _numberOfNodeOfEachConstituent ;
1535 }