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