Salome HOME
ed9d00d692208052a42fa6a2ade6e8ea14dca99c
[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   const TInt DESC = 200;
37   const TInt IDENT = 8;
38   const TInt NOM = 32;
39   const TInt LNOM = 80;
40
41   //---------------------------------------------------------------
42   template<TInt nPNOM, TInt nDESC, TInt nIDENT, TInt nNOM, TInt nLNOM, EVersion nV>
43   struct TTNameInfo: virtual TNameInfo
44   {
45     TTNameInfo(const std::string& theValue = "")
46     {
47       myName.resize(nNOM+1);
48       SetName(theValue);
49     }
50
51     virtual std::string GetName() const { 
52       return GetString(0,nNOM,myName);
53     }
54
55     virtual void SetName(const std::string& theValue){
56       SetString(0,nNOM,myName,theValue);
57     }
58   };
59
60
61   //---------------------------------------------------------------
62   template<TInt nPNOM, TInt nDESC, TInt nIDENT, TInt nNOM, TInt nLNOM, EVersion nV>
63   struct TTMeshInfo: 
64     virtual TMeshInfo, 
65     virtual TTNameInfo<nPNOM,nDESC,nIDENT,nNOM,nLNOM,nV>
66   {
67     typedef TTNameInfo<nPNOM,nDESC,nIDENT,nNOM,nLNOM,nV> TNameInfoBase;
68
69     TTMeshInfo(const PMeshInfo& theInfo):
70       TNameInfoBase(theInfo->GetName())
71     {
72       myDim = theInfo->GetDim();
73       myType = theInfo->GetType();
74       
75       myDesc.resize(nDESC+1);
76       SetDesc(theInfo->GetDesc());
77     }
78
79     TTMeshInfo(TInt theDim = 0,
80                const std::string& theValue = "",
81                EMaillage theType = eNON_STRUCTURE,
82                const std::string& theDesc = ""):
83       TNameInfoBase(theValue)
84     {
85       myDim = theDim;
86       myType = theType;
87       
88       myDesc.resize(nDESC+1);
89       SetDesc(theDesc);
90     }
91
92     virtual std::string GetDesc() const { 
93       return GetString(0,nDESC,myDesc);
94     }
95
96     virtual void SetDesc(const std::string& theValue){
97       SetString(0,nDESC,myDesc,theValue);
98     }
99   };
100
101
102   //---------------------------------------------------------------
103   template<TInt nPNOM, TInt nDESC, TInt nIDENT, TInt nNOM, TInt nLNOM, EVersion nV>
104   struct TTFamilyInfo: 
105     virtual TFamilyInfo, 
106     virtual TTNameInfo<nPNOM,nDESC,nIDENT,nNOM,nLNOM,nV>
107   {
108     typedef TTNameInfo<nPNOM,nDESC,nIDENT,nNOM,nLNOM,nV> TNameInfoBase;
109
110     TTFamilyInfo(const PMeshInfo& theMeshInfo, const PFamilyInfo& theInfo):
111       TNameInfoBase(theInfo->GetName())
112     {
113       myMeshInfo = theMeshInfo;
114
115       myId = theInfo->GetId();
116
117       myNbGroup = theInfo->GetNbGroup();
118       myGroupNames.resize(myNbGroup*nLNOM+1);
119       if(myNbGroup){
120         for(TInt anId = 0; anId < myNbGroup; anId++){
121           SetGroupName(anId,theInfo->GetGroupName(anId));
122         }
123       }
124
125       myNbAttr = theInfo->GetNbAttr();
126       myAttrId.resize(myNbAttr);
127       myAttrVal.resize(myNbAttr);
128       myAttrDesc.resize(myNbAttr*nDESC+1);
129       if(myNbAttr){
130         for(TInt anId = 0; anId < myNbAttr; anId++){
131           SetAttrDesc(anId,theInfo->GetAttrDesc(anId));
132           myAttrVal[anId] = theInfo->GetAttrVal(anId);
133           myAttrId[anId] = theInfo->GetAttrId(anId);
134         }
135       }
136     }
137
138     TTFamilyInfo(const PMeshInfo& theMeshInfo,
139                  TInt theNbGroup = 0, 
140                  TInt theNbAttr = 0,
141                  TInt theId = 0,
142                  const std::string& theValue = ""):
143       TNameInfoBase(theValue)
144     {
145       myMeshInfo = theMeshInfo;
146
147       myId = theId;
148
149       myNbGroup = theNbGroup;
150       myGroupNames.resize(theNbGroup*nLNOM+1);
151
152       myNbAttr = theNbAttr;
153       myAttrId.resize(theNbAttr);
154       myAttrVal.resize(theNbAttr);
155       myAttrDesc.resize(theNbAttr*nDESC+1);
156     }
157
158     TTFamilyInfo(const PMeshInfo& theMeshInfo,
159                  const std::string& theValue,
160                  TInt theId,
161                  const TStringSet& theGroupNames, 
162                  const TStringVector& theAttrDescs = TStringVector(), 
163                  const TIntVector& theAttrIds = TIntVector(), 
164                  const TIntVector& theAttrVals = TIntVector()):
165       TNameInfoBase(theValue)
166     {
167       myMeshInfo = theMeshInfo;
168
169       myId = theId;
170
171       myNbGroup = theGroupNames.size();
172       myGroupNames.resize(myNbGroup*nLNOM+1);
173       if(myNbGroup){
174         TStringSet::const_iterator anIter = theGroupNames.begin();
175         for(TInt anId = 0; anIter != theGroupNames.end(); anIter++, anId++){
176           const std::string& aVal = *anIter;
177           SetGroupName(anId,aVal);
178         }
179       }
180
181       myNbAttr = theAttrDescs.size();
182       myAttrId.resize(myNbAttr);
183       myAttrVal.resize(myNbAttr);
184       myAttrDesc.resize(myNbAttr*nDESC+1);
185       if(myNbAttr){
186         for(TInt anId = 0, anEnd = theAttrDescs.size(); anId < anEnd; anId++){
187           SetAttrDesc(anId,theAttrDescs[anId]);
188           myAttrVal[anId] = theAttrVals[anId];
189           myAttrId[anId] = theAttrIds[anId];
190         }
191       }
192     }
193
194     virtual std::string GetGroupName(TInt theId) const { 
195       return GetString(theId,nLNOM,myGroupNames);
196     }
197
198     virtual void SetGroupName(TInt theId, const std::string& theValue){
199       SetString(theId,nLNOM,myGroupNames,theValue);
200     }
201
202     virtual std::string GetAttrDesc(TInt theId) const { 
203       return GetString(theId,nDESC,myAttrDesc);
204     }
205
206     virtual void SetAttrDesc(TInt theId, const std::string& theValue){
207       SetString(theId,nDESC,myAttrDesc,theValue);
208     }
209   };
210
211
212   //---------------------------------------------------------------
213   template<TInt nPNOM, TInt nDESC, TInt nIDENT, TInt nNOM, TInt nLNOM, EVersion nV>
214   struct TTElemInfo: virtual TElemInfo
215   {
216     TTElemInfo(const PMeshInfo& theMeshInfo, const PElemInfo& theInfo)
217     {
218       myMeshInfo = theMeshInfo;
219       
220       myNbElem = theInfo->GetNbElem();
221       myFamNum.resize(myNbElem);
222
223       myIsElemNum = theInfo->IsElemNum();
224       myElemNum.resize(myIsElemNum == eFAUX? 0: myNbElem);
225
226       myIsElemNames = theInfo->IsElemNames();
227       myElemNames.resize(myNbElem*nPNOM+1);
228
229       if(myNbElem){
230         for(TInt anId = 0; anId < myNbElem; anId++){
231           myFamNum[anId] = theInfo->GetFamNum(anId);
232         }
233         if(myIsElemNum == eVRAI){
234           for(TInt anId = 0; anId < myNbElem; anId++){
235             myElemNum[anId] = theInfo->GetElemNum(anId);
236           }
237         }
238         if(myIsElemNames == eVRAI){
239           for(TInt anId = 0; anId < myNbElem; anId++){
240             SetElemName(anId,theInfo->GetElemName(anId));
241           }
242         }
243       }
244     }
245
246     TTElemInfo(const PMeshInfo& theMeshInfo, 
247                TInt theNbElem,
248                EBooleen theIsElemNum = eVRAI,
249                EBooleen theIsElemNames = eVRAI)
250     {
251       myMeshInfo = theMeshInfo;
252
253       myNbElem = theNbElem;
254       myFamNum.resize(theNbElem);
255
256       myIsElemNum = theIsElemNum;
257       myElemNum.resize(theIsElemNum == eFAUX? 0: theNbElem);
258
259       myIsElemNames = theIsElemNames;
260       myElemNames.resize(theNbElem*nPNOM+1);
261     }
262     
263     TTElemInfo(const PMeshInfo& theMeshInfo, 
264                const TIntVector& theFamilyNums,
265                const TIntVector& theElemNums,
266                const TStringVector& theElemNames = TStringVector())
267     {
268       myMeshInfo = theMeshInfo;
269       
270       myNbElem = theFamilyNums.size();
271       myFamNum.resize(myNbElem);
272       
273       myIsElemNum = theElemNums.size()? eVRAI: eFAUX;
274       myElemNum.resize(theElemNums.size());
275       
276       myIsElemNames = theElemNames.size()? eVRAI: eFAUX;
277       myElemNames.resize(theElemNames.size()*nPNOM+1);
278       
279       if(myNbElem){
280         for(TInt anId = 0; anId < myNbElem; anId++){
281           myFamNum[anId] = theFamilyNums[anId];
282         }
283         if(myIsElemNum == eVRAI){
284           for(TInt anId = 0; anId < myNbElem; anId++){
285             myElemNum[anId] = theElemNums[anId];
286           }
287         }
288         if(myIsElemNames == eVRAI){
289           for(TInt anId = 0; anId < myNbElem; anId++){
290             const std::string& aVal = theElemNames[anId];
291             SetElemName(anId,aVal);
292           }
293         }
294       }
295     }
296
297     virtual std::string GetElemName(TInt theId) const { 
298       return GetString(theId,nPNOM,myElemNames);
299     }
300
301     virtual void SetElemName(TInt theId, const std::string& theValue){
302       SetString(theId,nPNOM,myElemNames,theValue);
303     }
304   };
305
306
307   //---------------------------------------------------------------
308   template<TInt nPNOM, TInt nDESC, TInt nIDENT, TInt nNOM, TInt nLNOM, EVersion nV>
309   struct TTNodeInfo: 
310     virtual TNodeInfo, 
311     virtual TTElemInfo<nPNOM,nDESC,nIDENT,nNOM,nLNOM,nV>
312   {
313     typedef TTElemInfo<nPNOM,nDESC,nIDENT,nNOM,nLNOM,nV> TElemInfoBase;
314
315     TTNodeInfo(const PMeshInfo& theMeshInfo, const PNodeInfo& theInfo):
316       TElemInfoBase(theMeshInfo,theInfo)
317     {
318       mySystem = theInfo->GetSystem();
319
320       TInt aDim = theMeshInfo->GetDim();
321       TInt aNbElem = theInfo->GetNbElem();
322       myCoord.resize(aNbElem*aDim);
323       
324       for(TInt anElemId = 0; anElemId < aNbElem; anElemId++){
325         for(TInt anDimId = 0; anDimId < aDim; anDimId++){
326           SetNodeCoord(anElemId,anDimId,theInfo->GetNodeCoord(anElemId,anDimId));
327         }
328       }
329
330       myCoordNames.resize(aDim*nPNOM+1);
331       for(TInt anId = 0; anId < aDim; anId++){
332         SetCoordName(anId,theInfo->GetCoordName(anId));
333       }
334       
335       myCoordUnits.resize(aDim*nPNOM+1);
336       for(TInt anId = 0; anId < aDim; anId++){
337         SetCoordUnit(anId,theInfo->GetCoordUnit(anId));
338       }
339     }
340
341     TTNodeInfo(const PMeshInfo& theMeshInfo, 
342                TInt theNbElem,
343                ERepere theSystem = eCART, 
344                EBooleen theIsElemNum = eVRAI,
345                EBooleen theIsElemNames = eVRAI):
346       TElemInfoBase(theMeshInfo,
347                     theNbElem,
348                     theIsElemNum,
349                     theIsElemNames)
350     {
351       mySystem = theSystem;
352       myCoord.resize(theNbElem*theMeshInfo->myDim);
353       myCoordNames.resize(theMeshInfo->myDim*nPNOM+1);
354       myCoordUnits.resize(theMeshInfo->myDim*nPNOM+1);
355     }
356
357     
358     TTNodeInfo(const PMeshInfo& theMeshInfo, 
359                ERepere theSystem, 
360                const TFloatVector& theNodeCoords,
361                const TStringVector& theCoordNames,
362                const TStringVector& theCoordUnits,
363                const TIntVector& theFamilyNums,
364                const TIntVector& theElemNums,
365                const TStringVector& theElemNames = TStringVector()):
366       TElemInfoBase(theMeshInfo,
367                     theFamilyNums,
368                     theElemNums,
369                     theElemNames)
370     {
371       mySystem = theSystem;
372       myCoord.resize(theNodeCoords.size());
373       
374       for(TInt anId = 0, anEnd = myCoord.size(); anId < anEnd; anId++){
375         myCoord[anId] = theNodeCoords[anId];
376       }
377
378       TInt aDim = theMeshInfo->GetDim();
379       myCoordNames.resize(aDim*nPNOM+1);
380       for(TInt anId = 0; anId < aDim; anId++){
381         SetCoordName(anId,theCoordNames[anId]);
382       }
383       
384       myCoordUnits.resize(aDim*nPNOM+1);
385       for(TInt anId = 0; anId < aDim; anId++){
386         SetCoordUnit(anId,theCoordUnits[anId]);
387       }
388     }
389
390     virtual std::string GetCoordName(TInt theId) const { 
391       return GetString(theId,nPNOM,myCoordNames);
392     }
393
394     virtual void SetCoordName(TInt theId, const std::string& theValue){
395       SetString(theId,nPNOM,myCoordNames,theValue);
396     }
397
398     virtual std::string GetCoordUnit(TInt theId) const { 
399       return GetString(theId,nPNOM,myCoordUnits);
400     }
401
402     virtual void SetCoordUnit(TInt theId, const std::string& theValue){
403       SetString(theId,nPNOM,myCoordUnits,theValue);
404     }
405   };
406
407   //---------------------------------------------------------------
408   template<TInt nPNOM, TInt nDESC, TInt nIDENT, TInt nNOM, TInt nLNOM, EVersion nV>
409   struct TTPolygoneInfo: 
410     virtual TPolygoneInfo, 
411     virtual TTElemInfo<nPNOM,nDESC,nIDENT,nNOM,nLNOM,nV>
412   {
413     typedef TTElemInfo<nPNOM,nDESC,nIDENT,nNOM,nLNOM,nV> TElemInfoBase;
414
415     TTPolygoneInfo(const PMeshInfo& theMeshInfo, const PPolygoneInfo& theInfo):
416       TElemInfoBase(theMeshInfo,theInfo)
417     {
418       myTEntity = theInfo->GetEntity();
419       myTGeom = theInfo->GetGeom();
420       myTConn  = theInfo->GetConn();
421       myConnDim = theInfo->GetConnDim();
422       myConn = theInfo->GetConnectivite();
423       myIndex = theInfo->GetIndex();
424     }
425
426     TTPolygoneInfo(const PMeshInfo& theMeshInfo, 
427                    TInt theNbElem,
428                    TInt theNbConn,
429                    EEntiteMaillage theTEntity, 
430                    EGeometrieElement theTGeom,
431                    EConnectivite theTConn = eNOD,
432                    EBooleen theIsElemNum = eVRAI,
433                    EBooleen theIsElemNames = eVRAI):
434       TElemInfoBase(theMeshInfo,
435                     theNbElem,
436                     theIsElemNum,
437                     theIsElemNames)
438     {
439       myTEntity = theTEntity;
440       myTGeom = theTGeom;
441       myTConn  = theTConn;
442       myConnDim = theNbConn;
443       myConn.resize(myConnDim);
444       myIndex.resize(theNbElem+1);
445     }
446     
447     TTPolygoneInfo(const PMeshInfo& theMeshInfo, 
448                    EEntiteMaillage theTEntity, 
449                    EGeometrieElement theTGeom,
450                    EConnectivite theTConn,
451                    const TIntVector& theConnectivities,
452                    const TIntVector& theIndexes,
453                    const TIntVector& theFamilyNums,
454                    const TIntVector& theElemNums,
455                    const TStringVector& theElemNames = TStringVector()):
456       TElemInfoBase(theMeshInfo,
457                     theFamilyNums,
458                     theElemNums,
459                     theElemNames)
460     {
461       myTEntity = theTEntity;
462       myTGeom = theTGeom;
463       myTConn  = theTConn;
464       myConnDim = theConnectivities.size();
465       myConn = theConnectivities;
466       myIndex = theIndexes;
467     }
468   };
469   
470   //---------------------------------------------------------------
471   template<TInt nPNOM, TInt nDESC, TInt nIDENT, TInt nNOM, TInt nLNOM, EVersion nV>
472   struct TTPolyedreInfo: 
473     virtual TPolyedreInfo, 
474     virtual TTElemInfo<nPNOM,nDESC,nIDENT,nNOM,nLNOM,nV>
475   {
476     typedef TTElemInfo<nPNOM,nDESC,nIDENT,nNOM,nLNOM,nV> TElemInfoBase;
477
478     TTPolyedreInfo(const PMeshInfo& theMeshInfo, const PPolyedreInfo& theInfo):
479       TElemInfoBase(theMeshInfo,theInfo)
480     {
481       myTEntity = theInfo->GetEntity();
482       myTGeom = theInfo->GetGeom();
483       myTConn  = theInfo->GetConn();
484       myNbConn = theInfo->GetNbConn();
485       myNbFacesIndex = theInfo->GetNbFacesIndex();
486       myConn = theInfo->GetConnectivite();
487       myFacesIndex = theInfo->GetFacesIndex();
488       myIndex = theInfo->GetIndex();
489     }
490
491     TTPolyedreInfo(const PMeshInfo& theMeshInfo, 
492                    TInt theNbElem,
493                    TInt theNbConn,
494                    TInt theNbFacesIndex,
495                    EEntiteMaillage theTEntity, 
496                    EGeometrieElement theTGeom,
497                    EConnectivite theTConn = eNOD,
498                    EBooleen theIsElemNum = eVRAI,
499                    EBooleen theIsElemNames = eVRAI):
500       TElemInfoBase(theMeshInfo,
501                     theNbElem,
502                     theIsElemNum,
503                     theIsElemNames)
504     {
505       myTEntity = theTEntity;
506       myTGeom = theTGeom;
507       myTConn  = theTConn;
508       myNbConn = theNbConn;
509       myNbFacesIndex = theNbFacesIndex;
510       myConn.resize(myNbConn);
511       myFacesIndex.resize(myNbFacesIndex);
512       myIndex.resize(theNbElem+1);
513     }
514     
515     TTPolyedreInfo(const PMeshInfo& theMeshInfo, 
516                    EEntiteMaillage theTEntity, 
517                    EGeometrieElement theTGeom,
518                    EConnectivite theTConn,
519                    const TIntVector& theConnectivities,
520                    const TIntVector& theFacesIndexes,
521                    const TIntVector& theIndexes,
522                    const TIntVector& theFamilyNums,
523                    const TIntVector& theElemNums,
524                    const TStringVector& theElemNames = TStringVector()):
525       TElemInfoBase(theMeshInfo,
526                     theFamilyNums,
527                     theElemNums,
528                     theElemNames)
529     {
530       myTEntity = theTEntity;
531       myTGeom = theTGeom;
532       myTConn  = theTConn;
533       myNbConn = theConnectivities.size();
534       myNbFacesIndex = theFacesIndexes.size();
535       myConn = theConnectivities;
536       myFacesIndex = theFacesIndexes;
537       myIndex = theIndexes;
538     }
539   };
540
541   //---------------------------------------------------------------
542   template<TInt nPNOM, TInt nDESC, TInt nIDENT, TInt nNOM, TInt nLNOM, EVersion nV>
543   struct TTCellInfo: 
544     virtual TCellInfo, 
545     virtual TTElemInfo<nPNOM,nDESC,nIDENT,nNOM,nLNOM,nV>
546   {
547     typedef TTElemInfo<nPNOM,nDESC,nIDENT,nNOM,nLNOM,nV> TElemInfoBase;
548
549     TTCellInfo(const PMeshInfo& theMeshInfo, const PCellInfo& theInfo):
550       TElemInfoBase(theMeshInfo,theInfo)
551     {
552       myTEntity = theInfo->GetEntity();
553       myTGeom = theInfo->GetGeom();
554       myTConn  = theInfo->GetConn();
555       
556       TInt aConnDim = GetNbNodes(myTGeom);
557       myConn.resize(myNbElem*GetNbConn<nV>(myTGeom,myTEntity,myMeshInfo->myDim));
558       for(TInt anElemId = 0; anElemId < myNbElem; anElemId++){
559         for(TInt anConnId = 0; anConnId < aConnDim; anConnId++){
560           SetConn(anElemId,anConnId,theInfo->GetConn(anElemId,anConnId));
561         }
562       }
563     }
564
565     TTCellInfo(const PMeshInfo& theMeshInfo, 
566                TInt theNbElem,
567                EEntiteMaillage theTEntity, 
568                EGeometrieElement theTGeom,
569                EConnectivite theTConn = eNOD,
570                EBooleen theIsElemNum = eVRAI,
571                EBooleen theIsElemNames = eVRAI):
572       TElemInfoBase(theMeshInfo,
573                     theNbElem,
574                     theIsElemNum,
575                     theIsElemNames)
576     {
577       myTEntity = theTEntity;
578       myTGeom = theTGeom;
579       myTConn  = theTConn;
580       myConn.resize(theNbElem*GetNbConn<nV>(theTGeom,myTEntity,theMeshInfo->myDim));
581     }
582     
583     TTCellInfo(const PMeshInfo& theMeshInfo, 
584                EEntiteMaillage theTEntity, 
585                EGeometrieElement theTGeom,
586                EConnectivite theTConn,
587                const TIntVector& theConnectivities,
588                const TIntVector& theFamilyNums,
589                const TIntVector& theElemNums,
590                const TStringVector& theElemNames = TStringVector()):
591       TElemInfoBase(theMeshInfo,
592                     theFamilyNums,
593                     theElemNums,
594                     theElemNames)
595     {
596       myTEntity = theTEntity;
597       myTGeom = theTGeom;
598       myTConn  = theTConn;
599
600       TInt aConnDim = GetNbNodes(myTGeom);
601       myNbElem = theConnectivities.size() / aConnDim;
602       myConn.resize(myNbElem*GetNbConn<nV>(myTGeom,myTEntity,myMeshInfo->myDim));
603       for(TInt anElemId = 0; anElemId < myNbElem; anElemId++){
604         for(TInt anConnId = 0; anConnId < aConnDim; anConnId++){
605           SetConn(anElemId,anConnId,theConnectivities[anElemId*aConnDim+anConnId]);
606         }
607       }
608
609     }
610
611     virtual TInt GetConnDim() const { 
612       return GetNbConn<nV>(myTGeom,myTEntity,myMeshInfo->myDim);
613     }
614
615   };
616
617
618   //---------------------------------------------------------------
619   template<TInt nPNOM, TInt nDESC, TInt nIDENT, TInt nNOM, TInt nLNOM, EVersion nV>
620   struct TTFieldInfo: 
621     virtual TFieldInfo, 
622     virtual TTNameInfo<nPNOM,nDESC,nIDENT,nNOM,nLNOM,nV>
623   {
624     typedef TTNameInfo<nPNOM,nDESC,nIDENT,nNOM,nLNOM,nV> TNameInfoBase;
625
626     TTFieldInfo(const PMeshInfo& theMeshInfo, const PFieldInfo& theInfo):
627       TNameInfoBase(theInfo->GetName())
628     {
629       myMeshInfo = theMeshInfo;
630
631       myNbComp = theInfo->GetNbComp();
632       myCompNames.resize(myNbComp*nPNOM+1);
633       for(TInt anId = 0; anId < myNbComp; anId++){
634         SetCompName(anId,theInfo->GetCompName(anId));
635       }
636
637       myUnitNames.resize(myNbComp*nPNOM+1);
638       for(TInt anId = 0; anId < myNbComp; anId++){
639         SetUnitName(anId,theInfo->GetUnitName(anId));
640       }
641
642       myType = theInfo->GetType();
643
644       myIsLocal = theInfo->GetIsLocal();
645       myNbRef = theInfo->GetNbRef();
646     }
647
648     TTFieldInfo(const PMeshInfo& theMeshInfo, 
649                 TInt theNbComp = 0,
650                 ETypeChamp theType = eFLOAT64,
651                 const std::string& theValue = "",
652                 EBooleen theIsLocal = eVRAI,
653                 TInt theNbRef = 1):
654       TNameInfoBase(theValue)
655     {
656       myMeshInfo = theMeshInfo;
657
658       myNbComp = theNbComp;
659       myCompNames.resize(theNbComp*nPNOM+1);
660       myUnitNames.resize(theNbComp*nPNOM+1);
661
662       myType = theType;
663
664       myIsLocal = theIsLocal;
665       myNbRef = theNbRef;
666     }
667     
668     virtual std::string GetCompName(TInt theId) const { 
669       return GetString(theId,nPNOM,myCompNames);
670     }
671
672     virtual void SetCompName(TInt theId, const std::string& theValue){
673       SetString(theId,nPNOM,myCompNames,theValue);
674     }
675
676     virtual std::string GetUnitName(TInt theId) const { 
677       return GetString(theId,nPNOM,myUnitNames);
678     }
679
680     virtual void SetUnitName(TInt theId, const std::string& theValue){
681       SetString(theId,nPNOM,myUnitNames,theValue);
682     }
683   };
684
685
686   //---------------------------------------------------------------
687   template<TInt nPNOM, TInt nDESC, TInt nIDENT, TInt nNOM, TInt nLNOM, EVersion nV>
688   struct TTTimeStampInfo: virtual TTimeStampInfo
689   {
690     TTTimeStampInfo(const PFieldInfo& theFieldInfo, const PTimeStampInfo& theInfo)
691     {
692       myFieldInfo = theFieldInfo;
693
694       myEntity = theInfo->GetEntity();
695       myGeom = theInfo->GetGeom();
696
697       myNbGauss = theInfo->GetNbGauss();
698       myNumDt = theInfo->GetNumDt();
699       myNumOrd = theInfo->GetNumOrd();
700       myDt = theInfo->GetDt();
701
702       myUnitDt.resize(nPNOM+1);
703       SetUnitDt(theInfo->GetUnitDt());
704
705       myGaussName.resize(nNOM+1);
706       SetGaussName(theInfo->GetGaussName());
707     }
708
709     TTTimeStampInfo(const PFieldInfo& theFieldInfo, 
710                     EEntiteMaillage theEntity,
711                     const TGeom& theGeom,
712                     TInt theNbGauss = 0,
713                     TInt theNumDt = 0,
714                     TInt theNumOrd = 0,
715                     TFloat theDt = 0,
716                     const std::string& theUnitDt = "",
717                     const std::string& theGaussName = "")
718     {
719       myFieldInfo = theFieldInfo;
720
721       myEntity = theEntity;
722       myGeom = theGeom;
723
724       myNbGauss = theNbGauss;
725       myNumDt = theNumDt;
726       myNumOrd = theNumDt;
727       myDt = theDt;
728
729       myUnitDt.resize(nPNOM+1);
730       SetUnitDt(theUnitDt);
731
732       myGaussName.resize(nNOM+1);
733       SetGaussName(theGaussName);
734     }
735
736     virtual std::string GetGaussName() const { 
737       return GetString(0,nNOM,myGaussName);
738     }
739
740     virtual void SetGaussName(const std::string& theValue){
741       SetString(0,nNOM,myGaussName,theValue);
742     }
743
744     virtual std::string GetUnitDt() const { 
745       return GetString(0,nPNOM,myUnitDt);
746     }
747
748     virtual void SetUnitDt(const std::string& theValue){
749       SetString(0,nPNOM,myUnitDt,theValue);
750     }
751   };
752
753
754   //---------------------------------------------------------------
755   template<TInt nPNOM, TInt nDESC, TInt nIDENT, TInt nNOM, TInt nLNOM, EVersion nV>
756   struct TTTimeStampVal: virtual TTimeStampVal
757   {
758     TTTimeStampVal(const PTimeStampInfo& theTimeStampInfo, const PTimeStampVal& theInfo)
759     {
760       myTimeStampInfo = theTimeStampInfo;
761
762       myPflMode = theInfo->GetPflMode();
763
764       myPflName.resize(nNOM+1);
765       SetPflName(theInfo->GetPflName());
766
767       TInt aNbComp = theTimeStampInfo->GetFieldInfo()->GetNbComp();
768       const TGeom& aTGeom = theTimeStampInfo->GetGeom();
769       TInt aNbGauss = theTimeStampInfo->GetNbGauss();
770       TGeom::const_iterator anIter = aTGeom.begin();
771       for(; anIter != aTGeom.end(); anIter++){
772         const EGeometrieElement& aGeom = anIter->first;
773         TInt aNbElem = anIter->second;
774         TInt aSize = aNbElem*aNbComp*aNbGauss;
775         TValue& aValue = myMeshValue[aGeom];
776         aValue.resize(aSize);
777         for(TInt anElemId = 0; anElemId < aNbElem; anElemId++){
778           for(TInt aCompId = 0; aCompId < aNbComp; aCompId++){
779             for(TInt aGaussId = 0; aGaussId < aNbGauss; aGaussId++){
780               SetVal(aGeom,anElemId,aCompId,theInfo->GetVal(aGeom,anElemId,aCompId,aGaussId),aGaussId);
781             }
782           }
783         }
784       }
785     }
786
787     TTTimeStampVal(const PTimeStampInfo& theTimeStampInfo,
788                    const std::string& thePflName = "",
789                    EModeProfil thePflMode = eCOMPACT)
790     {
791       myTimeStampInfo = theTimeStampInfo;
792
793       myPflMode = thePflMode;
794
795       myPflName.resize(nNOM+1);
796       SetPflName(thePflName);
797
798       TInt aNbComp = theTimeStampInfo->myFieldInfo->myNbComp;
799       TInt aNbGauss = theTimeStampInfo->myNbGauss;
800       const TGeom& aTGeom = theTimeStampInfo->myGeom;
801       TGeom::const_iterator anIter = aTGeom.begin();
802       for(; anIter != aTGeom.end(); anIter++){
803         const EGeometrieElement& aGeom = anIter->first;
804         TInt aNb = anIter->second*aNbComp*aNbGauss;
805         myMeshValue[aGeom].resize(aNb);
806       }
807     }
808
809     virtual std::string GetPflName() const { 
810       return GetString(0,nNOM,myPflName);
811     }
812     
813     virtual void SetPflName(const std::string& theValue){
814       SetString(0,nNOM,myPflName,theValue);
815     }
816   };
817
818 }
819
820 #endif