Salome HOME
ad1a4fd5292adaf0620bacf4d6eb7c33ddd2246c
[modules/smesh.git] / src / MEDWrapper / Base / MED_Wrapper.cxx
1 // Copyright (C) 2007-2016  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, or (at your option) any later version.
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 //  File   : MED_Wrapper.cxx
23 //  Author : Alexey PETROV
24 //
25 #include "MED_Wrapper.hxx"
26 #include "MED_Utilities.hxx"
27  
28 #include <boost/version.hpp>
29
30 #ifdef _DEBUG_
31 static int MYDEBUG = 0;
32 static int MYVALUEDEBUG = 0;
33 #else
34 // static int MYDEBUG = 0;
35 // static int MYVALUEDEBUG = 0;
36 #endif
37
38 namespace MED
39 {
40   TLockProxy
41   ::TLockProxy(TWrapper* theWrapper):
42     myWrapper(theWrapper)
43   {
44 #if BOOST_VERSION >= 103500
45     myWrapper->myMutex.lock();
46 #else
47     boost::detail::thread::lock_ops<TWrapper::TMutex>::lock(myWrapper->myMutex);
48 #endif
49     INITMSG(MYDEBUG,"TLockProxy() - this -"<<this<<"; myWrapper = "<<myWrapper<<std::endl);
50   }
51   
52   TLockProxy
53   ::~TLockProxy()
54   {
55     INITMSG(MYDEBUG,"~TLockProxy() - this -"<<this<<"; myWrapper = "<<myWrapper<<std::endl);
56 #if BOOST_VERSION >= 103500
57     myWrapper->myMutex.unlock();
58 #else
59     boost::detail::thread::lock_ops<TWrapper::TMutex>::unlock(myWrapper->myMutex);
60 #endif
61   }
62   
63   TWrapper*
64   TLockProxy
65   ::operator-> () const // never throws
66   {
67     return myWrapper;
68   }
69
70   //----------------------------------------------------------------------------
71   TWrapper::~TWrapper()
72   {
73   }
74
75   //----------------------------------------------------------------------------
76   PMeshInfo
77   TWrapper
78   ::GetPMeshInfo(TInt theId,
79                  TErr* theErr)
80   {
81     PMeshInfo anInfo = CrMeshInfo();
82     GetMeshInfo(theId,*anInfo,theErr);
83     return anInfo;
84   }
85
86
87   //----------------------------------------------------------------------------
88   PFamilyInfo 
89   TWrapper
90   ::GetPFamilyInfo(const PMeshInfo& theMeshInfo, 
91                    TInt theId,
92                    TErr* theErr)
93   {
94     // must be reimplemented in connection with mesh type eSTRUCTURE
95     //     if(theMeshInfo->GetType() != eNON_STRUCTURE)
96     //       return PFamilyInfo();
97     
98     TInt aNbAttr = GetNbFamAttr(theId,*theMeshInfo);
99     TInt aNbGroup = GetNbFamGroup(theId,*theMeshInfo);
100     PFamilyInfo anInfo = CrFamilyInfo(theMeshInfo,aNbGroup,aNbAttr);
101     GetFamilyInfo(theId,*anInfo,theErr);
102
103 #ifdef _DEBUG_
104     std::string aName = anInfo->GetName();
105     INITMSG(MYDEBUG,"GetPFamilyInfo - aFamilyName = '"<<aName<<
106             "'; andId = "<<anInfo->GetId()<<
107             "; aNbAttr = "<<aNbAttr<<
108             "; aNbGroup = "<<aNbGroup<<"\n");
109     for(TInt iGroup = 0; iGroup < aNbGroup; iGroup++){
110       aName = anInfo->GetGroupName(iGroup);
111       INITMSG(MYDEBUG,"aGroupName = '"<<aName<<"'\n");
112     }
113 #endif
114     
115     return anInfo;
116   }
117
118
119   //----------------------------------------------------------------------------
120   PNodeInfo
121   TWrapper
122   ::GetPNodeInfo(const PMeshInfo& theMeshInfo,
123                  TErr* theErr)
124   {
125     TInt aNbElems = GetNbNodes(*theMeshInfo);
126     if(aNbElems == 0){
127       return PNodeInfo();
128     }
129
130     PNodeInfo anInfo = CrNodeInfo(theMeshInfo,aNbElems);
131     GetNodeInfo(*anInfo,theErr);
132
133 #ifdef _DEBUG_
134     TInt aDim = theMeshInfo->myDim;
135     TInt aNbElem = anInfo->GetNbElem();
136     INITMSG(MYDEBUG,"GetPNodeInfo: ");
137     {
138       INITMSG(MYDEBUG,"aCoords: "<<aNbElem<<": ");
139       TNodeCoord& aCoord = anInfo->myCoord;
140       for(TInt iElem = 0; iElem < aNbElem; iElem++){
141         for(TInt iDim = 0, anId = iElem*aDim; iDim < aDim; iDim++, anId++){
142           ADDMSG(MYVALUEDEBUG,aCoord[anId]<<",");
143         }
144         ADDMSG(MYVALUEDEBUG," ");
145       }
146       ADDMSG(MYDEBUG, std::endl);
147       
148       BEGMSG(MYVALUEDEBUG, "GetFamNum: ");
149       for(TInt iElem = 0; iElem < aNbElem; iElem++){
150         ADDMSG(MYVALUEDEBUG,anInfo->GetFamNum(iElem)<<", ");
151       }
152       ADDMSG(MYVALUEDEBUG, std::endl);
153       
154       if(anInfo->IsElemNum()){
155         BEGMSG(MYVALUEDEBUG,"GetElemNum: ");
156         for(TInt iElem = 0; iElem < aNbElem; iElem++){
157           ADDMSG(MYVALUEDEBUG,anInfo->GetElemNum(iElem)<<", ");
158         }
159         ADDMSG(MYVALUEDEBUG, std::endl);
160       }
161     }
162     ADDMSG(MYDEBUG, std::endl);
163 #endif
164     
165     return anInfo;
166   }
167
168   //----------------------------------------------------------------------------
169   PPolygoneInfo
170   TWrapper
171   ::GetPPolygoneInfo(const PMeshInfo& theMeshInfo,
172                      EEntiteMaillage theEntity, 
173                      EGeometrieElement theGeom, 
174                      EConnectivite theConnMode)
175   {
176     if(theMeshInfo->GetType() != eNON_STRUCTURE)
177       return PPolygoneInfo();
178
179     TInt aNbElem = GetNbPolygones(theMeshInfo,theEntity,theGeom,theConnMode);
180     TInt aConnSize = GetPolygoneConnSize(theMeshInfo,theEntity,theGeom,theConnMode);
181     PPolygoneInfo anInfo = CrPolygoneInfo(theMeshInfo,theEntity,theGeom,aNbElem,aConnSize,theConnMode);
182     GetPolygoneInfo(anInfo);
183
184 #ifdef _DEBUG_
185     INITMSG(MYDEBUG,"GetPPolygoneInfo"<<
186             " - theGeom = "<<theGeom<<
187             "; aNbElem = "<<aNbElem<<": ");
188     for(TInt iElem = 1; iElem < aNbElem; iElem++){
189       TCConnSlice aConnSlice = anInfo->GetConnSlice(iElem);
190       TInt aConnDim = aConnSlice.size();
191       for(TInt iConn = 0; iConn < aConnDim; iConn++){
192         ADDMSG(MYVALUEDEBUG,aConnSlice[iConn]<<",");
193       }
194       ADDMSG(MYDEBUG," ");
195     }
196     ADDMSG(MYDEBUG, std::endl);
197 #endif
198
199     return anInfo;
200   }
201   
202   //----------------------------------------------------------------------------
203   PPolyedreInfo
204   TWrapper
205   ::GetPPolyedreInfo(const PMeshInfo& theMeshInfo,
206                      EEntiteMaillage theEntity, 
207                      EGeometrieElement theGeom, 
208                      EConnectivite theConnMode)
209   {
210     if(theMeshInfo->GetType() != eNON_STRUCTURE)
211       return PPolyedreInfo();
212     TInt aNbElem  = GetNbPolyedres(theMeshInfo,theEntity,theGeom,theConnMode);
213     TInt aNbFaces, aConnSize;
214     GetPolyedreConnSize(theMeshInfo,aNbFaces,aConnSize,theConnMode);
215     PPolyedreInfo anInfo = CrPolyedreInfo(theMeshInfo,theEntity,theGeom,aNbElem,aNbFaces,aConnSize,theConnMode);
216     GetPolyedreInfo(anInfo);
217
218 #ifdef _DEBUG_
219     INITMSG(MYDEBUG,"GetPPolyedreInfo"<<
220             " - theGeom = "<<theGeom<<
221             "; aNbElem = "<<aNbElem<<": ");
222     for(TInt iElem = 0; iElem < aNbElem; iElem++){
223       TCConnSliceArr aConnSliceArr = anInfo->GetConnSliceArr(iElem);
224       TInt aNbFaces = aConnSliceArr.size();
225       ADDMSG(MYDEBUG,"{");
226       for(TInt iFace = 0; iFace < aNbFaces; iFace++){
227         TCConnSlice aConnSlice = aConnSliceArr[iFace];
228         TInt aNbConn = aConnSlice.size();
229         ADDMSG(MYDEBUG,"[");
230         for(TInt iConn = 0; iConn < aNbConn; iConn++){
231           ADDMSG(MYVALUEDEBUG,aConnSlice[iConn]<<",");
232         }
233         ADDMSG(MYDEBUG,"] ");
234       }
235       ADDMSG(MYDEBUG,"} ");
236     }
237     ADDMSG(MYDEBUG, std::endl);
238 #endif
239
240     return anInfo;
241   }
242   
243   //----------------------------------------------------------------------------
244   PElemInfo 
245   TWrapper
246   ::GetPElemInfo(const PMeshInfo& theMeshInfo,
247                  EEntiteMaillage theEntity, 
248                  EGeometrieElement theGeom, 
249                  EConnectivite theConnMode,
250                  TErr* theErr)
251   {
252     EMaillage aType = theMeshInfo->GetType();
253     if(aType == eNON_STRUCTURE){
254       switch(theGeom){
255       case ePOINT1:
256         if(theEntity == eNOEUD)
257           return GetPNodeInfo(theMeshInfo,theErr);
258         return GetPCellInfo(theMeshInfo,theEntity,theGeom,theConnMode,theErr);
259         break;
260       case ePOLYGONE:
261         return GetPPolygoneInfo(theMeshInfo,theEntity,theGeom,theConnMode);
262         break;
263       case ePOLYEDRE:
264         return GetPPolyedreInfo(theMeshInfo,theEntity,theGeom,theConnMode);
265         break;
266       default:
267         return GetPCellInfo(theMeshInfo,theEntity,theGeom,theConnMode,theErr);
268       }
269     } else {
270       PGrilleInfo aGrille = GetPGrilleInfo(theMeshInfo);
271
272       TInt nbElems;
273       EBooleen theIsElemNum = eFAUX;
274       // nodes
275       switch(theGeom){
276       case ePOINT1:
277         nbElems = aGrille->GetNbNodes();
278         theIsElemNum = eVRAI;
279         break;
280       case eSEG2:
281       case eQUAD4:
282       case eHEXA8:
283         nbElems = aGrille->GetNbCells();
284         break;
285       default:
286         nbElems = 0;
287       }
288       
289       TIntVector aFamNum;
290       TIntVector aElemNum;
291       TStringVector aElemNames;
292       
293       PElemInfo aElemInfo;
294
295       if(theGeom == ePOINT1){
296         aElemInfo = CrElemInfo(theMeshInfo,
297                                nbElems,
298                                theIsElemNum);
299         MED::TElemInfo &aTElemInfo = *aElemInfo;
300
301         // must be reimplemente in connection with mesh type eSTRUCTURE
302 //      GetNumeration(aTElemInfo,
303 //                    nbElems,
304 //                    theEntity,
305 //                    theGeom,
306 //                    theErr);
307         
308         GetFamilies(aTElemInfo,
309                     nbElems,
310                     theEntity,
311                     theGeom,
312                     theErr);
313         
314         // must be reimplemente in connection with mesh type eSTRUCTURE
315 //      GetNames(aTElemInfo,
316 //               nbElems,
317 //               theEntity,
318 //               theGeom,
319 //               theErr);
320       } else {
321         aElemInfo = CrElemInfo(theMeshInfo,
322                                nbElems,
323                                aFamNum,
324                                aElemNum,
325                                aElemNames);
326       }
327       
328       return aElemInfo;
329     }
330     return PElemInfo();
331   }
332
333
334   //----------------------------------------------------------------------------
335   PCellInfo 
336   TWrapper
337   ::GetPCellInfo(const PMeshInfo& theMeshInfo,
338                  EEntiteMaillage theEntity, 
339                  EGeometrieElement theGeom, 
340                  EConnectivite theConnMode,
341                  TErr* theErr)
342   {
343     if(theMeshInfo->GetType() != eNON_STRUCTURE)
344       return PCellInfo();
345     TInt aNbElem = GetNbCells(theMeshInfo,theEntity,theGeom,theConnMode);
346     PCellInfo anInfo = CrCellInfo(theMeshInfo,theEntity,theGeom,aNbElem,theConnMode);
347     GetCellInfo(anInfo,theErr);
348
349 #ifdef _DEBUG_
350     TInt aConnDim = anInfo->GetConnDim();
351     INITMSG(MYDEBUG,"GetPCellInfo - theEntity = "<<theEntity<<"; theGeom = "<<theGeom<<"; aConnDim: "<<aConnDim<<"\n");
352     BEGMSG(MYDEBUG,"GetPCellInfo - aNbElem: "<<aNbElem<<": ");
353     for(TInt iElem = 0; iElem < aNbElem; iElem++){
354       TCConnSlice aConnSlice = anInfo->GetConnSlice(iElem);
355       for(TInt iConn = 0; iConn < aConnDim; iConn++){
356         ADDMSG(MYVALUEDEBUG,aConnSlice[iConn]<<",");
357       }
358       ADDMSG(MYVALUEDEBUG," ");
359     }
360     ADDMSG(MYDEBUG, std::endl);
361
362     BEGMSG(MYVALUEDEBUG,"GetPCellInfo - GetFamNum: ");
363     for(TInt iElem = 0; iElem < aNbElem; iElem++){
364       ADDMSG(MYVALUEDEBUG,anInfo->GetFamNum(iElem)<<", ");
365     }
366     ADDMSG(MYVALUEDEBUG, std::endl);
367
368     if(anInfo->IsElemNum()){
369       BEGMSG(MYVALUEDEBUG,"GetPCellInfo - GetElemNum: ");
370       for(TInt iElem = 0; iElem < aNbElem; iElem++){
371         ADDMSG(MYVALUEDEBUG,anInfo->GetElemNum(iElem)<<", ");
372       }
373       ADDMSG(MYVALUEDEBUG, std::endl);
374     }
375     ADDMSG(MYDEBUG, std::endl);
376 #endif
377     
378     return anInfo;
379   }
380
381   //----------------------------------------------------------------------------
382   //! Read a MEDWrapped representation of MED Balls from the MED file
383   PBallInfo
384   TWrapper
385   ::GetPBallInfo(const PMeshInfo& theMeshInfo)
386   {
387     TInt nbBalls = GetNbBalls(theMeshInfo);
388     if ( nbBalls < 1 ) return PBallInfo();
389
390     PBallInfo anInfo = CrBallInfo( theMeshInfo, nbBalls );
391     GetBallInfo(anInfo);
392
393     return anInfo;
394   }
395   //----------------------------------------------------------------------------
396   PFieldInfo
397   TWrapper
398   ::GetPFieldInfo(const PMeshInfo& theMeshInfo, 
399                   TInt theId,
400                   TErr* theErr)
401   {
402     TInt aNbComp = GetNbComp(theId);
403     PFieldInfo anInfo = CrFieldInfo(theMeshInfo,aNbComp);
404     GetFieldInfo(theId,*anInfo,theErr);
405
406 #ifdef _DEBUG_
407     INITMSG(MYDEBUG,
408             "GetPFieldInfo "<<
409             "- aName = '"<<anInfo->GetName()<<"'"<<
410             "; aType = "<<anInfo->GetType()<<
411             "; aNbComp = "<<aNbComp<<
412             std::endl);
413 #endif
414     
415     return anInfo;
416   }
417
418
419   //----------------------------------------------------------------------------
420   PTimeStampInfo
421   TWrapper
422   ::GetPTimeStampInfo(const PFieldInfo& theFieldInfo,
423                       EEntiteMaillage theEntity,
424                       const TGeom2Size& theGeom2Size,
425                       TInt theId,
426                       TErr* theErr)
427   {
428     PTimeStampInfo anInfo = CrTimeStampInfo(theFieldInfo,theEntity,theGeom2Size);
429     GetTimeStampInfo(theId,*anInfo,theErr);
430
431 #ifdef _DEBUG_
432     INITMSG(MYDEBUG,"GetPTimeStampInfo - anEntity = "<<anInfo->GetEntity()<<"\n");
433     TGeom2NbGauss& aGeom2NbGauss = anInfo->myGeom2NbGauss;
434     TGeom2NbGauss::const_iterator anIter = aGeom2NbGauss.begin();
435     for(; anIter != aGeom2NbGauss.end(); anIter++){
436       const EGeometrieElement& aGeom = anIter->first;
437       INITMSG(MYDEBUG,"aGeom = "<<aGeom<<" - "<<aGeom2NbGauss[aGeom]<<";\n");
438     }
439 #endif
440
441     return anInfo;
442   }
443
444
445   //----------------------------------------------------------------------------
446   PProfileInfo
447   TWrapper
448   ::GetPProfileInfo(TInt theId,
449                     EModeProfil theMode,
450                     TErr* theErr)
451   {
452     TProfileInfo::TInfo aPreInfo = GetProfilePreInfo(theId);
453     PProfileInfo anInfo = CrProfileInfo(aPreInfo,theMode);
454     GetProfileInfo(theId,*anInfo,theErr);
455
456     return anInfo;
457   }
458
459
460   //----------------------------------------------------------------------------
461   PTimeStampValueBase
462   TWrapper
463   ::CrTimeStampValue(const PTimeStampInfo& theTimeStampInfo,
464                      const TGeom2Profile& theGeom2Profile,
465                      EModeSwitch theMode)
466   {
467     PFieldInfo aFieldInfo = theTimeStampInfo->GetFieldInfo();
468     return CrTimeStampValue(theTimeStampInfo,
469                             aFieldInfo->GetType(),
470                             theGeom2Profile,
471                             theMode);
472   }
473
474   //----------------------------------------------------------------------------
475   PTimeStampValueBase
476   TWrapper
477   ::CrTimeStampValue(const PTimeStampInfo& theTimeStampInfo,
478                      const PTimeStampValueBase& theInfo)
479   {
480     PFieldInfo aFieldInfo = theTimeStampInfo->GetFieldInfo();
481     return CrTimeStampValue(theTimeStampInfo,
482                             theInfo,
483                             aFieldInfo->GetType());
484   }
485
486   //----------------------------------------------------------------------------
487   template<class TimeStampValueType>
488   void
489   Print(SharedPtr<TimeStampValueType> theTimeStampValue)
490   {
491     INITMSG(MYDEBUG,"Print - TimeStampValue\n");
492     typename TimeStampValueType::TTGeom2Value& aGeom2Value = theTimeStampValue->myGeom2Value;
493     typename TimeStampValueType::TTGeom2Value::const_iterator anIter = aGeom2Value.begin();
494     for(; anIter != aGeom2Value.end(); anIter++){
495       const EGeometrieElement& aGeom = anIter->first;
496       const typename TimeStampValueType::TTMeshValue& aMeshValue = anIter->second;
497       TInt aNbElem = aMeshValue.myNbElem;
498       TInt aNbGauss = aMeshValue.myNbGauss;
499       TInt aNbComp = aMeshValue.myNbComp;
500       INITMSG(MYDEBUG,"aGeom = "<<aGeom<<" - "<<aNbElem<<": ");
501       for(TInt iElem = 0; iElem < aNbElem; iElem++){
502         typename TimeStampValueType::TTMeshValue::TCValueSliceArr aValueSliceArr = aMeshValue.GetGaussValueSliceArr(iElem);
503         ADDMSG(MYVALUEDEBUG,"{");
504         for(TInt iGauss = 0; iGauss < aNbGauss; iGauss++){
505           const typename TimeStampValueType::TTMeshValue::TCValueSlice& aValueSlice = aValueSliceArr[iGauss];
506           for(TInt iComp = 0; iComp < aNbComp; iComp++){
507             ADDMSG(MYVALUEDEBUG,aValueSlice[iComp]<<" ");
508           }
509           ADDMSG(MYVALUEDEBUG,"| ");
510         }
511         ADDMSG(MYVALUEDEBUG,"} ");
512       }
513       ADDMSG(MYDEBUG,"\n");
514     }
515   }
516
517   //----------------------------------------------------------------------------
518   PTimeStampValueBase 
519   TWrapper
520   ::GetPTimeStampValue(const PTimeStampInfo& theTimeStampInfo,
521                        const TMKey2Profile& theMKey2Profile,
522                        const TKey2Gauss& theKey2Gauss,
523                        TErr* theErr)
524   {
525     PFieldInfo aFieldInfo = theTimeStampInfo->GetFieldInfo();
526     PTimeStampValueBase anInfo = CrTimeStampValue(theTimeStampInfo,
527                                                   aFieldInfo->GetType());
528     GetTimeStampValue(anInfo, 
529                       theMKey2Profile, 
530                       theKey2Gauss,
531                       theErr);
532 #ifdef _DEBUG_
533     if(aFieldInfo->GetType() == eFLOAT64)
534       Print<TFloatTimeStampValue>(anInfo);
535     else
536       Print<TIntTimeStampValue>(anInfo);
537 #endif
538     return anInfo;
539   }
540
541   //----------------------------------------------------------------------------
542   void 
543   TWrapper
544   ::GetTimeStampVal(const PTimeStampVal& theVal,
545                     const TMKey2Profile& theMKey2Profile,
546                     const TKey2Gauss& theKey2Gauss,
547                     TErr* theErr)
548   {
549     PTimeStampInfo aTimeStampInfo = theVal->GetTimeStampInfo();
550     PFieldInfo aFieldInfo = aTimeStampInfo->GetFieldInfo();
551     if(aFieldInfo->GetType() == eFLOAT64)
552       GetTimeStampValue(theVal,
553                         theMKey2Profile,
554                         theKey2Gauss,
555                         theErr);
556     else{
557       PTimeStampValueBase aVal = CrTimeStampValue(aTimeStampInfo,
558                                                   theVal,
559                                                   eINT);
560       GetTimeStampValue(aVal,
561                         theMKey2Profile,
562                         theKey2Gauss,
563                         theErr);
564       CopyTimeStampValueBase(aVal, theVal);
565     }
566   }
567
568   //----------------------------------------------------------------------------
569   void
570   TWrapper
571   ::SetTimeStamp(const PTimeStampVal& theVal,
572                  TErr* theErr)
573   {
574     PTimeStampInfo aTimeStampInfo = theVal->GetTimeStampInfo();
575     PFieldInfo aFieldInfo = aTimeStampInfo->GetFieldInfo();
576     if(aFieldInfo->GetType() == eFLOAT64)
577       SetTimeStampValue(theVal, theErr);
578     else{
579       PTimeStampValueBase aVal = CrTimeStampValue(aTimeStampInfo,
580                                                   eINT,
581                                                   theVal->GetGeom2Profile(),
582                                                   theVal->GetModeSwitch());
583       CopyTimeStampValueBase(theVal, aVal);
584       SetTimeStampValue(aVal, theErr);
585     }
586   }
587
588   //----------------------------------------------------------------------------
589   PTimeStampVal
590   TWrapper
591   ::CrTimeStampVal(const PTimeStampInfo& theTimeStampInfo,
592                    const TGeom2Profile& theGeom2Profile,
593                    EModeSwitch theMode)
594   {
595     return CrTimeStampValue(theTimeStampInfo,
596                             eFLOAT64,
597                             theGeom2Profile,
598                             theMode);
599   }
600
601   //----------------------------------------------------------------------------
602   PTimeStampVal
603   TWrapper
604   ::CrTimeStampVal(const PTimeStampInfo& theTimeStampInfo,
605                    const PTimeStampVal& theInfo)
606   {
607     return CrTimeStampValue(theTimeStampInfo,
608                             theInfo,
609                             eFLOAT64);
610   }
611
612   //----------------------------------------------------------------------------
613   PTimeStampVal 
614   TWrapper
615   ::GetPTimeStampVal(const PTimeStampInfo& theTimeStampInfo,
616                      const TMKey2Profile& theMKey2Profile,
617                      const TKey2Gauss& theKey2Gauss,
618                      TErr* theErr)
619   {
620     PTimeStampVal anInfo = CrTimeStampVal(theTimeStampInfo);
621     GetTimeStampVal(anInfo, 
622                     theMKey2Profile, 
623                     theKey2Gauss,
624                     theErr);
625     return anInfo;
626   }
627
628   //----------------------------------------------------------------------------
629   PGrilleInfo
630   TWrapper
631   ::GetPGrilleInfo(const PMeshInfo& theMeshInfo)
632   {
633     if(theMeshInfo->GetType() != eSTRUCTURE)
634       return PGrilleInfo();
635
636     EGrilleType type;
637     GetGrilleType(*theMeshInfo,type);
638     PGrilleInfo anInfo;
639     if(type == eGRILLE_STANDARD){
640       const TInt nnoeuds = GetNbNodes(*theMeshInfo);
641       anInfo = CrGrilleInfo(theMeshInfo,type,nnoeuds);
642     }
643     else {
644       TIntVector aVec;
645       aVec.resize(theMeshInfo->GetDim());
646       for(int aAxe=0;aAxe<theMeshInfo->GetDim();aAxe++){
647         ETable aATable;
648         switch(aAxe){
649         case 0:
650           aATable = eCOOR_IND1;
651           break;
652         case 1:
653           aATable = eCOOR_IND2;
654           break;
655         case 2:
656           aATable = eCOOR_IND3;
657           break;
658         }
659         aVec[aAxe] = GetNbNodes(*theMeshInfo,aATable);
660       }
661       anInfo = CrGrilleInfo(theMeshInfo,type,aVec);
662     }
663
664     GetGrilleInfo(anInfo);
665     anInfo->SetGrilleType(type);
666
667 #ifdef _DEBUG_
668     INITMSG(MYDEBUG,"GetPGrilleInfo: ");
669     {
670       TInt aNbElem = anInfo->GetNbNodes();
671       BEGMSG(MYVALUEDEBUG,"GetFamNumNode: ");
672       for(TInt iElem = 0; iElem < aNbElem; iElem++){
673         ADDMSG(MYVALUEDEBUG,anInfo->GetFamNumNode(iElem)<<", ");
674       }
675       TInt aNbCells = anInfo->GetNbCells();
676       BEGMSG(MYVALUEDEBUG,"GetFamNum: ");
677       for(TInt iElem = 0; iElem < aNbCells; iElem++){
678         ADDMSG(MYVALUEDEBUG,anInfo->GetFamNum(iElem)<<", ");
679       }
680       ADDMSG(MYVALUEDEBUG, std::endl);
681       BEGMSG(MYVALUEDEBUG,"GetCoordName: ");
682       for(TInt iElem = 0; iElem < theMeshInfo->GetDim(); iElem++){
683         ADDMSG(MYVALUEDEBUG,anInfo->GetCoordName(iElem)<<", ");
684       }
685       ADDMSG(MYVALUEDEBUG, std::endl);
686       BEGMSG(MYVALUEDEBUG,"GetCoordUnit: ");
687       for(TInt iElem = 0; iElem < theMeshInfo->GetDim(); iElem++){
688         ADDMSG(MYVALUEDEBUG,anInfo->GetCoordUnit(iElem)<<", ");
689       }
690       ADDMSG(MYVALUEDEBUG, std::endl);
691       
692     }
693 #endif
694     
695     return anInfo;
696   }
697   
698   //----------------------------------------------------------------------------
699   PGrilleInfo
700   TWrapper
701   ::GetPGrilleInfo(const PMeshInfo& theMeshInfo,
702                    const PGrilleInfo& theInfo)
703   {
704     PGrilleInfo anInfo = CrGrilleInfo(theMeshInfo,theInfo);
705     return anInfo;
706   }  
707 }