]> SALOME platform Git repositories - modules/med.git/blob - src/MEDWrapper/Base/MED_TStructures.hxx
Salome HOME
71be5228509c9952dc61ace6fb37ecec792a424d
[modules/med.git] / src / MEDWrapper / Base / MED_TStructures.hxx
1 //  
2 //
3 //  Copyright (C) 2003  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.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org 
21 //
22 //
23 //
24 //  File   : 
25 //  Author : 
26 //  Module : 
27 //  $Header$
28
29 #ifndef MED_TStructures_HeaderFile
30 #define MED_TStructures_HeaderFile
31
32 #include "MED_Structures.hxx"
33
34 namespace MED
35 {
36   //---------------------------------------------------------------
37   template<EVersion eVersion>
38   struct TTNameInfo: virtual TNameInfo
39   {
40     TTNameInfo(const std::string& theValue)
41     {
42       myName.resize(GetNOMLength<eVersion>()+1);
43       SetName(theValue);
44     }
45
46     virtual
47     std::string
48     GetName() const 
49     { 
50       return GetString(0,GetNOMLength<eVersion>(),myName);
51     }
52
53     virtual
54     void
55     SetName(const std::string& theValue)
56     {
57       SetString(0,GetNOMLength<eVersion>(),myName,theValue);
58     }
59   };
60
61
62   //---------------------------------------------------------------
63   template<EVersion eVersion>
64   struct TTMeshInfo: 
65     virtual TMeshInfo, 
66     virtual TTNameInfo<eVersion>
67   {
68     typedef TTNameInfo<eVersion> TNameInfoBase;
69
70     TTMeshInfo(const PMeshInfo& theInfo):
71       TNameInfoBase(theInfo->GetName())
72     {
73       myDim = theInfo->GetDim();
74       myType = theInfo->GetType();
75       
76       myDesc.resize(GetDESCLength<eVersion>()+1);
77       SetDesc(theInfo->GetDesc());
78     }
79
80     TTMeshInfo(TInt theDim,
81                const std::string& theValue,
82                EMaillage theType,
83                const std::string& theDesc):
84       TNameInfoBase(theValue)
85     {
86       myDim = theDim;
87       myType = theType;
88       
89       myDesc.resize(GetDESCLength<eVersion>()+1);
90       SetDesc(theDesc);
91     }
92
93     virtual 
94     std::string
95     GetDesc() const 
96     { 
97       return GetString(0,GetDESCLength<eVersion>(),myDesc);
98     }
99
100     virtual
101     void
102     SetDesc(const std::string& theValue)
103     {
104       SetString(0,GetDESCLength<eVersion>(),myDesc,theValue);
105     }
106   };
107
108
109   //---------------------------------------------------------------
110   template<EVersion eVersion>
111   struct TTFamilyInfo: 
112     virtual TFamilyInfo, 
113     virtual TTNameInfo<eVersion>
114   {
115     typedef TTNameInfo<eVersion> TNameInfoBase;
116
117     TTFamilyInfo(const PMeshInfo& theMeshInfo, const PFamilyInfo& theInfo):
118       TNameInfoBase(theInfo->GetName())
119     {
120       myMeshInfo = theMeshInfo;
121
122       myId = theInfo->GetId();
123
124       myNbGroup = theInfo->GetNbGroup();
125       myGroupNames.resize(myNbGroup*GetLNOMLength<eVersion>()+1);
126       if(myNbGroup){
127         for(TInt anId = 0; anId < myNbGroup; anId++){
128           SetGroupName(anId,theInfo->GetGroupName(anId));
129         }
130       }
131
132       myNbAttr = theInfo->GetNbAttr();
133       myAttrId.resize(myNbAttr);
134       myAttrVal.resize(myNbAttr);
135       myAttrDesc.resize(myNbAttr*GetDESCLength<eVersion>()+1);
136       if(myNbAttr){
137         for(TInt anId = 0; anId < myNbAttr; anId++){
138           SetAttrDesc(anId,theInfo->GetAttrDesc(anId));
139           myAttrVal[anId] = theInfo->GetAttrVal(anId);
140           myAttrId[anId] = theInfo->GetAttrId(anId);
141         }
142       }
143     }
144
145     TTFamilyInfo(const PMeshInfo& theMeshInfo,
146                  TInt theNbGroup, 
147                  TInt theNbAttr,
148                  TInt theId,
149                  const std::string& theValue):
150       TNameInfoBase(theValue)
151     {
152       myMeshInfo = theMeshInfo;
153
154       myId = theId;
155
156       myNbGroup = theNbGroup;
157       myGroupNames.resize(theNbGroup*GetLNOMLength<eVersion>()+1);
158
159       myNbAttr = theNbAttr;
160       myAttrId.resize(theNbAttr);
161       myAttrVal.resize(theNbAttr);
162       myAttrDesc.resize(theNbAttr*GetDESCLength<eVersion>()+1);
163     }
164
165     TTFamilyInfo(const PMeshInfo& theMeshInfo,
166                  const std::string& theValue,
167                  TInt theId,
168                  const TStringSet& theGroupNames, 
169                  const TStringVector& theAttrDescs, 
170                  const TIntVector& theAttrIds, 
171                  const TIntVector& theAttrVals):
172       TNameInfoBase(theValue)
173     {
174       myMeshInfo = theMeshInfo;
175
176       myId = theId;
177
178       myNbGroup = theGroupNames.size();
179       myGroupNames.resize(myNbGroup*GetLNOMLength<eVersion>()+1);
180       if(myNbGroup){
181         TStringSet::const_iterator anIter = theGroupNames.begin();
182         for(TInt anId = 0; anIter != theGroupNames.end(); anIter++, anId++){
183           const std::string& aVal = *anIter;
184           SetGroupName(anId,aVal);
185         }
186       }
187
188       myNbAttr = theAttrDescs.size();
189       myAttrId.resize(myNbAttr);
190       myAttrVal.resize(myNbAttr);
191       myAttrDesc.resize(myNbAttr*GetDESCLength<eVersion>()+1);
192       if(myNbAttr){
193         for(TInt anId = 0, anEnd = theAttrDescs.size(); anId < anEnd; anId++){
194           SetAttrDesc(anId,theAttrDescs[anId]);
195           myAttrVal[anId] = theAttrVals[anId];
196           myAttrId[anId] = theAttrIds[anId];
197         }
198       }
199     }
200
201     virtual
202     std::string
203     GetGroupName(TInt theId) const 
204     { 
205       return GetString(theId,GetLNOMLength<eVersion>(),myGroupNames);
206     }
207
208     virtual
209     void
210     SetGroupName(TInt theId, const std::string& theValue)
211     {
212       SetString(theId,GetLNOMLength<eVersion>(),myGroupNames,theValue);
213     }
214
215     virtual
216     std::string
217     GetAttrDesc(TInt theId) const 
218     { 
219       return GetString(theId,GetDESCLength<eVersion>(),myAttrDesc);
220     }
221
222     virtual
223     void
224     SetAttrDesc(TInt theId, const std::string& theValue)
225     {
226       SetString(theId,GetDESCLength<eVersion>(),myAttrDesc,theValue);
227     }
228   };
229
230
231   //---------------------------------------------------------------
232   template<EVersion eVersion>
233   struct TTElemInfo: virtual TElemInfo
234   {
235     TTElemInfo(const PMeshInfo& theMeshInfo, const PElemInfo& theInfo)
236     {
237       myMeshInfo = theMeshInfo;
238       
239       myNbElem = theInfo->GetNbElem();
240       myFamNum.resize(myNbElem);
241
242       myIsElemNum = theInfo->IsElemNum();
243       myElemNum.resize(myIsElemNum == eFAUX? 0: myNbElem);
244
245       myIsElemNames = theInfo->IsElemNames();
246       myElemNames.resize(myNbElem*GetPNOMLength<eVersion>()+1);
247
248       if(myNbElem){
249         for(TInt anId = 0; anId < myNbElem; anId++){
250           myFamNum[anId] = theInfo->GetFamNum(anId);
251         }
252         if(myIsElemNum == eVRAI){
253           for(TInt anId = 0; anId < myNbElem; anId++){
254             myElemNum[anId] = theInfo->GetElemNum(anId);
255           }
256         }
257         if(myIsElemNames == eVRAI){
258           for(TInt anId = 0; anId < myNbElem; anId++){
259             SetElemName(anId,theInfo->GetElemName(anId));
260           }
261         }
262       }
263     }
264
265     TTElemInfo(const PMeshInfo& theMeshInfo, 
266                TInt theNbElem,
267                EBooleen theIsElemNum,
268                EBooleen theIsElemNames)
269     {
270       myMeshInfo = theMeshInfo;
271
272       myNbElem = theNbElem;
273       myFamNum.resize(theNbElem);
274
275       myIsElemNum = theIsElemNum;
276       if(theIsElemNum)
277         myElemNum.resize(theNbElem);
278
279       myIsElemNames = theIsElemNames;
280       if(theIsElemNames)
281         myElemNames.resize(theNbElem*GetPNOMLength<eVersion>()+1);
282     }
283     
284     TTElemInfo(const PMeshInfo& theMeshInfo, 
285                TInt theNbElem,
286                const TIntVector& theFamilyNums,
287                const TIntVector& theElemNums,
288                const TStringVector& theElemNames)
289     {
290       myMeshInfo = theMeshInfo;
291       
292       myNbElem = theNbElem;
293       
294       myIsElemNum = theElemNums.size()? eVRAI: eFAUX;
295       if(myIsElemNum)
296         myElemNum.resize(theNbElem);
297       
298       myIsElemNames = theElemNames.size()? eVRAI: eFAUX;
299       if(myIsElemNames)
300         myElemNames.resize(theNbElem*GetPNOMLength<eVersion>()+1);
301       
302       if(theNbElem){
303
304         myFamNum.resize(theNbElem);
305         if(theFamilyNums.size())
306           myFamNum = theFamilyNums;
307
308         if(myIsElemNum)
309           myElemNum = theElemNums;
310
311         if(myIsElemNames){
312           for(TInt anId = 0; anId < theNbElem; anId++){
313             const std::string& aVal = theElemNames[anId];
314             SetElemName(anId,aVal);
315           }
316         }
317       }
318     }
319
320     virtual
321     std::string
322     GetElemName(TInt theId) const 
323     { 
324       return GetString(theId,GetPNOMLength<eVersion>(),myElemNames);
325     }
326
327     virtual
328     void
329     SetElemName(TInt theId, const std::string& theValue)
330     {
331       SetString(theId,GetPNOMLength<eVersion>(),myElemNames,theValue);
332     }
333   };
334
335
336   //---------------------------------------------------------------
337   template<EVersion eVersion>
338   struct TTNodeInfo: 
339     virtual TNodeInfo, 
340     virtual TTElemInfo<eVersion>
341   {
342     typedef TTElemInfo<eVersion> TElemInfoBase;
343
344     TTNodeInfo(const PMeshInfo& theMeshInfo, const PNodeInfo& theInfo):
345       TElemInfoBase(theMeshInfo,theInfo),
346       TNodeInfo(theInfo)
347     {
348       myModeSwitch = theInfo->GetModeSwitch();
349       
350       mySystem = theInfo->GetSystem();
351       
352       myCoord = theInfo->myCoord;
353       
354       TInt aDim = theMeshInfo->GetDim();
355
356       myCoordNames.resize(aDim*GetPNOMLength<eVersion>()+1);
357       for(TInt anId = 0; anId < aDim; anId++)
358         SetCoordName(anId,theInfo->GetCoordName(anId));
359       
360       myCoordUnits.resize(aDim*GetPNOMLength<eVersion>()+1);
361       for(TInt anId = 0; anId < aDim; anId++)
362         SetCoordUnit(anId,theInfo->GetCoordUnit(anId));
363     }
364
365     TTNodeInfo(const PMeshInfo& theMeshInfo, 
366                TInt theNbElem,
367                EModeSwitch theMode,
368                ERepere theSystem, 
369                EBooleen theIsElemNum,
370                EBooleen theIsElemNames):
371       TElemInfoBase(theMeshInfo,
372                     theNbElem,
373                     theIsElemNum,
374                     theIsElemNames),
375       TModeSwitchInfo(theMode)
376     {
377       mySystem = theSystem;
378
379       myCoord.resize(theNbElem*theMeshInfo->myDim);
380
381       if(theIsElemNum)
382         myCoordUnits.resize(theMeshInfo->myDim*GetPNOMLength<eVersion>()+1);
383
384       if(theIsElemNames)
385         myCoordNames.resize(theMeshInfo->myDim*GetPNOMLength<eVersion>()+1);
386     }
387
388     
389     TTNodeInfo(const PMeshInfo& theMeshInfo, 
390                const TFloatVector& theNodeCoords,
391                EModeSwitch theMode,
392                ERepere theSystem, 
393                const TStringVector& theCoordNames,
394                const TStringVector& theCoordUnits,
395                const TIntVector& theFamilyNums,
396                const TIntVector& theElemNums,
397                const TStringVector& theElemNames):
398       TElemInfoBase(theMeshInfo,
399                     theNodeCoords.size()/theMeshInfo->GetDim(),
400                     theFamilyNums,
401                     theElemNums,
402                     theElemNames),
403       TModeSwitchInfo(theMode)
404     {
405       mySystem = theSystem;
406
407       myCoord = theNodeCoords;
408       
409       TInt aDim = theMeshInfo->GetDim();
410
411       myCoordNames.resize(aDim*GetPNOMLength<eVersion>()+1);
412       if(!theCoordNames.empty())
413         for(TInt anId = 0; anId < aDim; anId++)
414           SetCoordName(anId,theCoordNames[anId]);
415       
416       myCoordUnits.resize(aDim*GetPNOMLength<eVersion>()+1);
417       if(!theCoordUnits.empty())
418         for(TInt anId = 0; anId < aDim; anId++)
419           SetCoordUnit(anId,theCoordUnits[anId]);
420     }
421
422     virtual
423     std::string
424     GetCoordName(TInt theId) const 
425     { 
426       return GetString(theId,GetPNOMLength<eVersion>(),myCoordNames);
427     }
428
429     virtual
430     void
431     SetCoordName(TInt theId, const std::string& theValue)
432     {
433       SetString(theId,GetPNOMLength<eVersion>(),myCoordNames,theValue);
434     }
435
436     virtual
437     std::string 
438     GetCoordUnit(TInt theId) const 
439     { 
440       return GetString(theId,GetPNOMLength<eVersion>(),myCoordUnits);
441     }
442
443     virtual
444     void
445     SetCoordUnit(TInt theId, const std::string& theValue)
446     {
447       SetString(theId,GetPNOMLength<eVersion>(),myCoordUnits,theValue);
448     }
449   };
450
451   //---------------------------------------------------------------
452   template<EVersion eVersion>
453   struct TTPolygoneInfo: 
454     virtual TPolygoneInfo, 
455     virtual TTElemInfo<eVersion>
456   {
457     typedef TTElemInfo<eVersion> TElemInfoBase;
458
459     TTPolygoneInfo(const PMeshInfo& theMeshInfo, const PPolygoneInfo& theInfo):
460       TElemInfoBase(theMeshInfo,theInfo)
461     {
462       myEntity = theInfo->GetEntity();
463       myGeom = theInfo->GetGeom();
464
465       myIndex = theInfo->myIndex;
466       myConn = theInfo->myConn;
467
468       myConnMode = theInfo->GetConnMode();
469     }
470
471     TTPolygoneInfo(const PMeshInfo& theMeshInfo, 
472                    EEntiteMaillage theEntity, 
473                    EGeometrieElement theGeom,
474                    TInt theNbElem,
475                    TInt theConnSize,
476                    EConnectivite theConnMode,
477                    EBooleen theIsElemNum,
478                    EBooleen theIsElemNames):
479       TElemInfoBase(theMeshInfo,
480                     theNbElem,
481                     theIsElemNum,
482                     theIsElemNames)
483     {
484       myEntity = theEntity;
485       myGeom = theGeom;
486
487       myIndex.resize(theNbElem+1);
488       myConn.resize(theConnSize);
489
490       myConnMode = theConnMode;
491     }
492     
493     TTPolygoneInfo(const PMeshInfo& theMeshInfo, 
494                    EEntiteMaillage theEntity, 
495                    EGeometrieElement theGeom,
496                    const TIntVector& theIndexes,
497                    const TIntVector& theConnectivities,
498                    EConnectivite theConnMode,
499                    const TIntVector& theFamilyNums,
500                    const TIntVector& theElemNums,
501                    const TStringVector& theElemNames):
502       TElemInfoBase(theMeshInfo,
503                     theIndexes.size() - 1,
504                     theFamilyNums,
505                     theElemNums,
506                     theElemNames)
507     {
508       myEntity = theEntity;
509       myGeom = theGeom;
510
511       myIndex = theIndexes;
512       myConn = theConnectivities;
513
514       myConnMode = theConnMode;
515     }
516   };
517   
518   //---------------------------------------------------------------
519   template<EVersion eVersion>
520   struct TTPolyedreInfo: 
521     virtual TPolyedreInfo, 
522     virtual TTElemInfo<eVersion>
523   {
524     typedef TTElemInfo<eVersion> TElemInfoBase;
525
526     TTPolyedreInfo(const PMeshInfo& theMeshInfo, const PPolyedreInfo& theInfo):
527       TElemInfoBase(theMeshInfo,theInfo)
528     {
529       myEntity = theInfo->GetEntity();
530       myGeom = theInfo->GetGeom();
531
532       myIndex = theInfo->myIndex;
533       myFaces = theInfo->myFaces;
534       myConn = theInfo->myConn;
535
536       myConnMode = theInfo->GetConnMode();
537     }
538
539     TTPolyedreInfo(const PMeshInfo& theMeshInfo, 
540                    EEntiteMaillage theEntity, 
541                    EGeometrieElement theGeom,
542                    TInt theNbElem,
543                    TInt theNbFaces,
544                    TInt theConnSize,
545                    EConnectivite theConnMode,
546                    EBooleen theIsElemNum,
547                    EBooleen theIsElemNames):
548       TElemInfoBase(theMeshInfo,
549                     theNbElem,
550                     theIsElemNum,
551                     theIsElemNames)
552     {
553       myEntity = theEntity;
554       myGeom = theGeom;
555
556       myIndex.resize(theNbElem + 1);
557       myFaces.resize(theNbFaces);
558       myConn.resize(theConnSize);
559
560       myConnMode = theConnMode;
561     }
562     
563     TTPolyedreInfo(const PMeshInfo& theMeshInfo, 
564                    EEntiteMaillage theEntity, 
565                    EGeometrieElement theGeom,
566                    const TIntVector& theIndexes,
567                    const TIntVector& theFaces,
568                    const TIntVector& theConnectivities,
569                    EConnectivite theConnMode,
570                    const TIntVector& theFamilyNums,
571                    const TIntVector& theElemNums,
572                    const TStringVector& theElemNames):
573       TElemInfoBase(theMeshInfo,
574                     theIndexes.size()-1,
575                     theFamilyNums,
576                     theElemNums,
577                     theElemNames)
578     {
579       myEntity = theEntity;
580       myGeom = theGeom;
581
582       myIndex = theIndexes;
583       myFaces = theFaces;
584       myConn = theConnectivities;
585
586       myConnMode = theConnMode;
587     }
588   };
589
590   //---------------------------------------------------------------
591   template<EVersion eVersion>
592   struct TTCellInfo: 
593     virtual TCellInfo, 
594     virtual TTElemInfo<eVersion>
595   {
596     typedef TTElemInfo<eVersion> TElemInfoBase;
597
598     TTCellInfo(const PMeshInfo& theMeshInfo, const PCellInfo& theInfo):
599       TElemInfoBase(theMeshInfo,theInfo)
600     {
601       myEntity = theInfo->GetEntity();
602       myGeom = theInfo->GetGeom();
603       myConnMode  = theInfo->GetConnMode();
604       
605       TInt aConnDim = GetNbNodes(myGeom);
606       myConn.resize(myNbElem*GetNbConn<eVersion>(myGeom,myEntity,myMeshInfo->myDim));
607       for(TInt anElemId = 0; anElemId < myNbElem; anElemId++){
608         TConnSlice aConnSlice = GetConnSlice(anElemId);
609         TCConnSlice aConnSlice2 = theInfo->GetConnSlice(anElemId);
610         for(TInt anConnId = 0; anConnId < aConnDim; anConnId++){
611           aConnSlice[anConnId] = aConnSlice2[anConnId];
612         }
613       }
614     }
615
616     TTCellInfo(const PMeshInfo& theMeshInfo, 
617                EEntiteMaillage theEntity, 
618                EGeometrieElement theGeom,
619                TInt theNbElem,
620                EConnectivite theConnMode,
621                EBooleen theIsElemNum,
622                EBooleen theIsElemNames,
623                EModeSwitch theMode):
624       TElemInfoBase(theMeshInfo,
625                     theNbElem,
626                     theIsElemNum,
627                     theIsElemNames),
628       TModeSwitchInfo(theMode)
629     {
630       myEntity = theEntity;
631       myGeom = theGeom;
632
633       myConnMode = theConnMode;
634       myConn.resize(theNbElem*GetNbConn<eVersion>(theGeom,myEntity,theMeshInfo->myDim));
635     }
636     
637     TTCellInfo(const PMeshInfo& theMeshInfo, 
638                EEntiteMaillage theEntity, 
639                EGeometrieElement theGeom,
640                const TIntVector& theConnectivities,
641                EConnectivite theConnMode,
642                const TIntVector& theFamilyNums,
643                const TIntVector& theElemNums,
644                const TStringVector& theElemNames,
645                EModeSwitch theMode):
646       TElemInfoBase(theMeshInfo,
647                     theConnectivities.size()/GetNbNodes(theGeom),
648                     theFamilyNums,
649                     theElemNums,
650                     theElemNames),
651       TModeSwitchInfo(theMode)
652     {
653       myEntity = theEntity;
654       myGeom = theGeom;
655
656       myConnMode = theConnMode;
657       TInt aConnDim = GetNbNodes(myGeom);
658       myConn.resize(myNbElem*GetNbConn<eVersion>(myGeom,myEntity,myMeshInfo->myDim));
659       for(TInt anElemId = 0; anElemId < myNbElem; anElemId++){
660         TConnSlice aConnSlice = GetConnSlice(anElemId);
661         for(TInt anConnId = 0; anConnId < aConnDim; anConnId++){
662           aConnSlice[anConnId] = theConnectivities[anElemId*aConnDim+anConnId];
663         }
664       }
665
666     }
667
668     virtual 
669     TInt
670     GetConnDim() const 
671     { 
672       return GetNbConn<eVersion>(myGeom,myEntity,myMeshInfo->myDim);
673     }
674
675   };
676
677
678   //---------------------------------------------------------------
679   template<EVersion eVersion>
680   struct TTFieldInfo: 
681     virtual TFieldInfo, 
682     virtual TTNameInfo<eVersion>
683   {
684     typedef TTNameInfo<eVersion> TNameInfoBase;
685
686     TTFieldInfo(const PMeshInfo& theMeshInfo, const PFieldInfo& theInfo):
687       TNameInfoBase(theInfo->GetName())
688     {
689       myMeshInfo = theMeshInfo;
690
691       myNbComp = theInfo->GetNbComp();
692       myCompNames.resize(myNbComp*GetPNOMLength<eVersion>()+1);
693       for(TInt anId = 0; anId < myNbComp; anId++){
694         SetCompName(anId,theInfo->GetCompName(anId));
695       }
696
697       myUnitNames.resize(myNbComp*GetPNOMLength<eVersion>()+1);
698       for(TInt anId = 0; anId < myNbComp; anId++){
699         SetUnitName(anId,theInfo->GetUnitName(anId));
700       }
701
702       myType = theInfo->GetType();
703
704       myIsLocal = theInfo->GetIsLocal();
705       myNbRef = theInfo->GetNbRef();
706     }
707
708     TTFieldInfo(const PMeshInfo& theMeshInfo, 
709                 TInt theNbComp,
710                 ETypeChamp theType,
711                 const std::string& theValue,
712                 EBooleen theIsLocal,
713                 TInt theNbRef):
714       TNameInfoBase(theValue)
715     {
716       myMeshInfo = theMeshInfo;
717
718       myNbComp = theNbComp;
719       myCompNames.resize(theNbComp*GetPNOMLength<eVersion>()+1);
720       myUnitNames.resize(theNbComp*GetPNOMLength<eVersion>()+1);
721
722       myType = theType;
723
724       myIsLocal = theIsLocal;
725       myNbRef = theNbRef;
726     }
727     
728     virtual 
729     std::string
730     GetCompName(TInt theId) const 
731     { 
732       return GetString(theId,GetPNOMLength<eVersion>(),myCompNames);
733     }
734
735     virtual
736     void
737     SetCompName(TInt theId, const std::string& theValue)
738     {
739       SetString(theId,GetPNOMLength<eVersion>(),myCompNames,theValue);
740     }
741
742     virtual
743     std::string 
744     GetUnitName(TInt theId) const 
745     { 
746       return GetString(theId,GetPNOMLength<eVersion>(),myUnitNames);
747     }
748
749     virtual
750     void
751     SetUnitName(TInt theId, const std::string& theValue)
752     {
753       SetString(theId,GetPNOMLength<eVersion>(),myUnitNames,theValue);
754     }
755   };
756
757
758   //---------------------------------------------------------------
759   template<EVersion eVersion>
760   struct TTGaussInfo: 
761     virtual TGaussInfo,
762     virtual TTNameInfo<eVersion>
763   {
764     typedef TTNameInfo<eVersion> TNameInfoBase;
765
766     TTGaussInfo(const TGaussInfo::TInfo& theInfo,
767                 EModeSwitch theMode):
768       TNameInfoBase(boost::get<1>(boost::get<0>(theInfo))),
769       TModeSwitchInfo(theMode)
770     {
771       const TGaussInfo::TKey& aKey = boost::get<0>(theInfo);
772
773       myGeom = boost::get<0>(aKey);
774       myRefCoord.resize(GetNbRef()*GetDim());
775
776       TInt aNbGauss = boost::get<1>(theInfo);
777       myGaussCoord.resize(aNbGauss*GetDim());
778       myWeight.resize(aNbGauss);
779     }
780   };
781
782
783   //---------------------------------------------------------------
784   template<EVersion eVersion>
785   struct TTTimeStampInfo: virtual TTimeStampInfo
786   {
787     TTTimeStampInfo(const PFieldInfo& theFieldInfo, const PTimeStampInfo& theInfo)
788     {
789       myFieldInfo = theFieldInfo;
790
791       myEntity = theInfo->GetEntity();
792       myGeom2Size = theInfo->GetGeom2Size();
793
794       myNumDt = theInfo->GetNumDt();
795       myNumOrd = theInfo->GetNumOrd();
796       myDt = theInfo->GetDt();
797
798       myUnitDt.resize(GetPNOMLength<eVersion>()+1);
799       SetUnitDt(theInfo->GetUnitDt());
800
801       myGeom2NbGauss = theInfo->myGeom2NbGauss;
802       myGeom2Gauss = theInfo->GetGeom2Gauss();
803     }
804
805     TTTimeStampInfo(const PFieldInfo& theFieldInfo, 
806                     EEntiteMaillage theEntity,
807                     const TGeom2Size& theGeom2Size,
808                     const TGeom2NbGauss& theGeom2NbGauss,
809                     TInt theNumDt,
810                     TInt theNumOrd,
811                     TFloat theDt,
812                     const std::string& theUnitDt,
813                     const TGeom2Gauss& theGeom2Gauss)
814     {
815       myFieldInfo = theFieldInfo;
816
817       myEntity = theEntity;
818       myGeom2Size = theGeom2Size;
819
820       myNumDt = theNumDt;
821       myNumOrd = theNumDt;
822       myDt = theDt;
823
824       myUnitDt.resize(GetPNOMLength<eVersion>()+1);
825       SetUnitDt(theUnitDt);
826
827       myGeom2NbGauss = theGeom2NbGauss;
828       myGeom2Gauss = theGeom2Gauss;
829     }
830
831     virtual 
832     std::string
833     GetUnitDt() const
834     { 
835       return GetString(0,GetPNOMLength<eVersion>(),myUnitDt);
836     }
837
838     virtual
839     void
840     SetUnitDt(const std::string& theValue)
841     {
842       SetString(0,GetPNOMLength<eVersion>(),myUnitDt,theValue);
843     }
844   };
845
846
847   //---------------------------------------------------------------
848   template<EVersion eVersion>
849   struct TTProfileInfo: 
850     virtual TProfileInfo,
851     virtual TTNameInfo<eVersion>
852   {
853     typedef TTNameInfo<eVersion> TNameInfoBase;
854
855     TTProfileInfo(const TProfileInfo::TInfo& theInfo,
856                   EModeProfil theMode):
857       TNameInfoBase(boost::get<0>(theInfo))
858     {
859       TInt aSize = boost::get<1>(theInfo);
860       myElemNum.resize(aSize);
861       myMode = aSize > 0? theMode: eNO_PFLMOD;
862     }
863   };
864
865
866   //---------------------------------------------------------------
867   template<EVersion eVersion>
868   struct TTTimeStampVal: virtual TTimeStampVal
869   {
870     TTTimeStampVal(const PTimeStampInfo& theTimeStampInfo,
871                    const PTimeStampVal& theInfo)
872     {
873       myTimeStampInfo = theTimeStampInfo;
874
875       myGeom2Profile = theInfo->GetGeom2Profile();
876
877       myGeom2Value = theInfo->myGeom2Value;
878     }
879
880     TTTimeStampVal(const PTimeStampInfo& theTimeStampInfo,
881                    const TGeom2Profile& theGeom2Profile,
882                    EModeSwitch theMode):
883       TModeSwitchInfo(theMode)
884     {
885       myTimeStampInfo = theTimeStampInfo;
886
887       myGeom2Profile = theGeom2Profile;
888
889       TInt aNbComp = theTimeStampInfo->myFieldInfo->myNbComp;
890
891       const TGeom2Size& aGeom2Size = theTimeStampInfo->myGeom2Size;
892       TGeom2Size::const_iterator anIter = aGeom2Size.begin();
893       for(; anIter != aGeom2Size.end(); anIter++){
894         const EGeometrieElement& aGeom = anIter->first;
895         TInt aNbElem = anIter->second;
896
897         MED::PProfileInfo aProfileInfo;
898         MED::TGeom2Profile::const_iterator anIter = theGeom2Profile.find(aGeom);
899         if(anIter != theGeom2Profile.end())
900           aProfileInfo = anIter->second;
901
902         if(aProfileInfo && aProfileInfo->IsPresent())
903           aNbElem = aProfileInfo->GetSize();
904
905         TInt aNbGauss = theTimeStampInfo->GetNbGauss(aGeom);
906         
907         TMeshValue& aMeshValue = GetMeshValue(aGeom);
908         aMeshValue.Init(aNbElem,aNbGauss,aNbComp);
909       }
910     }
911   };
912
913 }
914
915 #endif