1 // Copyright (C) 2003 CEA/DEN, EDF R&D
5 // File : VISU_DatConvertor.cxx
6 // Author : Alexey PETROV
9 #include "MED_Wrapper.hxx"
10 #include "MED_Utilities.hxx"
13 static int MYDEBUG = 0;
14 static int MYVALUEDEBUG = 0;
16 static int MYDEBUG = 0;
17 static int MYVALUEDEBUG = 0;
23 ::TLockProxy(TWrapper* theWrapper):
26 boost::detail::thread::lock_ops<TWrapper::TMutex>::lock(myWrapper->myMutex);
27 INITMSG(MYDEBUG,"TLockProxy() - this -"<<this<<"; myWrapper = "<<myWrapper<<endl);
33 INITMSG(MYDEBUG,"~TLockProxy() - this -"<<this<<"; myWrapper = "<<myWrapper<<endl);
34 boost::detail::thread::lock_ops<TWrapper::TMutex>::unlock(myWrapper->myMutex);
39 ::operator-> () const // never throws
44 //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
47 ::GetPMeshInfo(TInt theId,
50 PMeshInfo anInfo = CrMeshInfo();
51 GetMeshInfo(theId,*anInfo,theErr);
56 //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
59 ::GetPFamilyInfo(const PMeshInfo& theMeshInfo,
63 // must be reimplemented in connection with mesh type eSTRUCTURE
64 // if(theMeshInfo->GetType() != eNON_STRUCTURE)
65 // return PFamilyInfo();
67 TInt aNbAttr = GetNbFamAttr(theId,*theMeshInfo);
68 TInt aNbGroup = GetNbFamGroup(theId,*theMeshInfo);
69 PFamilyInfo anInfo = CrFamilyInfo(theMeshInfo,aNbGroup,aNbAttr);
70 GetFamilyInfo(theId,*anInfo,theErr);
73 string aName = anInfo->GetName();
74 INITMSG(MYDEBUG,"GetPFamilyInfo - aFamilyName = '"<<aName<<
75 "'; andId = "<<anInfo->GetId()<<
76 "; aNbAttr = "<<aNbAttr<<
77 "; aNbGroup = "<<aNbGroup<<"\n");
78 for(TInt iGroup = 0; iGroup < aNbGroup; iGroup++){
79 aName = anInfo->GetGroupName(iGroup);
80 INITMSG(MYDEBUG,"aGroupName = '"<<aName<<"'\n");
88 //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
91 ::GetPNodeInfo(const PMeshInfo& theMeshInfo,
94 TInt aNbElems = GetNbNodes(*theMeshInfo);
99 PNodeInfo anInfo = CrNodeInfo(theMeshInfo,aNbElems);
100 GetNodeInfo(*anInfo,theErr);
103 TInt aDim = theMeshInfo->myDim;
104 TInt aNbElem = anInfo->GetNbElem();
105 INITMSG(MYDEBUG,"GetPNodeInfo: ");
107 INITMSG(MYDEBUG,"aCoords: "<<aNbElem<<": ");
108 TNodeCoord& aCoord = anInfo->myCoord;
109 for(TInt iElem = 0; iElem < aNbElem; iElem++){
110 for(TInt iDim = 0, anId = iElem*aDim; iDim < aDim; iDim++, anId++){
111 ADDMSG(MYVALUEDEBUG,aCoord[anId]<<",");
113 ADDMSG(MYVALUEDEBUG," ");
115 ADDMSG(MYDEBUG,endl);
117 BEGMSG(MYVALUEDEBUG,"GetFamNum: ");
118 for(TInt iElem = 0; iElem < aNbElem; iElem++){
119 ADDMSG(MYVALUEDEBUG,anInfo->GetFamNum(iElem)<<", ");
121 ADDMSG(MYVALUEDEBUG,endl);
123 if(anInfo->IsElemNum()){
124 BEGMSG(MYVALUEDEBUG,"GetElemNum: ");
125 for(TInt iElem = 0; iElem < aNbElem; iElem++){
126 ADDMSG(MYVALUEDEBUG,anInfo->GetElemNum(iElem)<<", ");
128 ADDMSG(MYVALUEDEBUG,endl);
131 ADDMSG(MYDEBUG,endl);
137 //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
140 ::GetPPolygoneInfo(const PMeshInfo& theMeshInfo,
141 EEntiteMaillage theEntity,
142 EGeometrieElement theGeom,
143 EConnectivite theConnMode)
145 if(theMeshInfo->GetType() != eNON_STRUCTURE)
146 return PPolygoneInfo();
148 TInt aNbElem = GetNbPolygones(theMeshInfo,theEntity,theGeom,theConnMode);
149 TInt aConnSize = GetPolygoneConnSize(theMeshInfo,theEntity,theGeom,theConnMode);
150 PPolygoneInfo anInfo = CrPolygoneInfo(theMeshInfo,theEntity,theGeom,aNbElem,aConnSize,theConnMode);
151 GetPolygoneInfo(anInfo);
154 INITMSG(MYDEBUG,"GetPPolygoneInfo"<<
155 " - theGeom = "<<theGeom<<
156 "; aNbElem = "<<aNbElem<<": ");
157 for(TInt iElem = 1; iElem < aNbElem; iElem++){
158 TCConnSlice aConnSlice = anInfo->GetConnSlice(iElem);
159 TInt aConnDim = aConnSlice.size();
160 for(TInt iConn = 0; iConn < aConnDim; iConn++){
161 ADDMSG(MYVALUEDEBUG,aConnSlice[iConn]<<",");
165 ADDMSG(MYDEBUG,endl);
171 //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
174 ::GetPPolyedreInfo(const PMeshInfo& theMeshInfo,
175 EEntiteMaillage theEntity,
176 EGeometrieElement theGeom,
177 EConnectivite theConnMode)
179 if(theMeshInfo->GetType() != eNON_STRUCTURE)
180 return PPolyedreInfo();
181 TInt aNbElem = GetNbPolyedres(theMeshInfo,theEntity,theGeom,theConnMode);
182 TInt aNbFaces, aConnSize;
183 GetPolyedreConnSize(theMeshInfo,aNbFaces,aConnSize,theConnMode);
184 PPolyedreInfo anInfo = CrPolyedreInfo(theMeshInfo,theEntity,theGeom,aNbElem,aNbFaces,aConnSize,theConnMode);
185 GetPolyedreInfo(anInfo);
188 INITMSG(MYDEBUG,"GetPPolyedreInfo"<<
189 " - theGeom = "<<theGeom<<
190 "; aNbElem = "<<aNbElem<<": ");
191 for(TInt iElem = 0; iElem < aNbElem; iElem++){
192 TCConnSliceArr aConnSliceArr = anInfo->GetConnSliceArr(iElem);
193 TInt aNbFaces = aConnSliceArr.size();
195 for(TInt iFace = 0; iFace < aNbFaces; iFace++){
196 TCConnSlice aConnSlice = aConnSliceArr[iFace];
197 TInt aNbConn = aConnSlice.size();
199 for(TInt iConn = 0; iConn < aNbConn; iConn++){
200 ADDMSG(MYVALUEDEBUG,aConnSlice[iConn]<<",");
202 ADDMSG(MYDEBUG,"] ");
204 ADDMSG(MYDEBUG,"} ");
206 ADDMSG(MYDEBUG,endl);
214 ::GetPElemInfo(const PMeshInfo& theMeshInfo,
215 EEntiteMaillage theEntity,
216 EGeometrieElement theGeom,
217 EConnectivite theConnMode,
220 EMaillage aType = theMeshInfo->GetType();
221 if(aType == eNON_STRUCTURE){
224 return GetPNodeInfo(theMeshInfo,theErr);
227 return GetPPolygoneInfo(theMeshInfo,theEntity,theGeom,theConnMode);
230 return GetPPolyedreInfo(theMeshInfo,theEntity,theGeom,theConnMode);
233 return GetPCellInfo(theMeshInfo,theEntity,theGeom,theConnMode,theErr);
236 PGrilleInfo aGrille = GetPGrilleInfo(theMeshInfo);
239 EBooleen theIsElemNum = eFAUX;
243 nbElems = aGrille->GetNbNodes();
244 theIsElemNum = eVRAI;
249 nbElems = aGrille->GetNbCells();
257 TStringVector aElemNames;
261 if(theGeom == ePOINT1){
262 aElemInfo = CrElemInfo(theMeshInfo,
265 MED::TElemInfo &aTElemInfo = *aElemInfo;
267 // must be reimplemente in connection with mesh type eSTRUCTURE
268 // GetNumeration(aTElemInfo,
274 GetFamilies(aTElemInfo,
280 // must be reimplemente in connection with mesh type eSTRUCTURE
281 // GetNames(aTElemInfo,
287 aElemInfo = CrElemInfo(theMeshInfo,
300 //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
303 ::GetPCellInfo(const PMeshInfo& theMeshInfo,
304 EEntiteMaillage theEntity,
305 EGeometrieElement theGeom,
306 EConnectivite theConnMode,
309 if(theMeshInfo->GetType() != eNON_STRUCTURE)
311 TInt aNbElem = GetNbCells(theMeshInfo,theEntity,theGeom,theConnMode);
312 PCellInfo anInfo = CrCellInfo(theMeshInfo,theEntity,theGeom,aNbElem,theConnMode);
313 GetCellInfo(anInfo,theErr);
316 TInt aConnDim = anInfo->GetConnDim();
317 INITMSG(MYDEBUG,"GetPCellInfo - theEntity = "<<theEntity<<"; theGeom = "<<theGeom<<"; aConnDim: "<<aConnDim<<"\n");
318 BEGMSG(MYDEBUG,"GetPCellInfo - aNbElem: "<<aNbElem<<": ");
319 for(TInt iElem = 0; iElem < aNbElem; iElem++){
320 TCConnSlice aConnSlice = anInfo->GetConnSlice(iElem);
321 for(TInt iConn = 0; iConn < aConnDim; iConn++){
322 ADDMSG(MYVALUEDEBUG,aConnSlice[iConn]<<",");
324 ADDMSG(MYVALUEDEBUG," ");
326 ADDMSG(MYDEBUG,endl);
328 BEGMSG(MYVALUEDEBUG,"GetPCellInfo - GetFamNum: ");
329 for(TInt iElem = 0; iElem < aNbElem; iElem++){
330 ADDMSG(MYVALUEDEBUG,anInfo->GetFamNum(iElem)<<", ");
332 ADDMSG(MYVALUEDEBUG,endl);
334 if(anInfo->IsElemNum()){
335 BEGMSG(MYVALUEDEBUG,"GetPCellInfo - GetElemNum: ");
336 for(TInt iElem = 0; iElem < aNbElem; iElem++){
337 ADDMSG(MYVALUEDEBUG,anInfo->GetElemNum(iElem)<<", ");
339 ADDMSG(MYVALUEDEBUG,endl);
341 ADDMSG(MYDEBUG,endl);
348 //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
351 ::GetPFieldInfo(const PMeshInfo& theMeshInfo,
355 TInt aNbComp = GetNbComp(theId);
356 PFieldInfo anInfo = CrFieldInfo(theMeshInfo,aNbComp);
357 GetFieldInfo(theId,*anInfo,theErr);
362 "- aName = '"<<anInfo->GetName()<<"'"<<
363 "; aType = "<<anInfo->GetType()<<
364 "; aNbComp = "<<aNbComp<<
372 //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
375 ::GetPTimeStampInfo(const PFieldInfo& theFieldInfo,
376 EEntiteMaillage theEntity,
377 const TGeom2Size& theGeom2Size,
381 PTimeStampInfo anInfo = CrTimeStampInfo(theFieldInfo,theEntity,theGeom2Size);
382 GetTimeStampInfo(theId,*anInfo,theErr);
385 INITMSG(MYDEBUG,"GetPTimeStampInfo - anEntity = "<<anInfo->GetEntity()<<"\n");
386 TGeom2NbGauss& aGeom2NbGauss = anInfo->myGeom2NbGauss;
387 TGeom2NbGauss::const_iterator anIter = aGeom2NbGauss.begin();
388 for(; anIter != aGeom2NbGauss.end(); anIter++){
389 const EGeometrieElement& aGeom = anIter->first;
390 INITMSG(MYDEBUG,"aGeom = "<<aGeom<<" - "<<aGeom2NbGauss[aGeom]<<";\n");
398 //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
401 ::GetPProfileInfo(TInt theId,
405 TProfileInfo::TInfo aPreInfo = GetProfilePreInfo(theId);
406 PProfileInfo anInfo = CrProfileInfo(aPreInfo,theMode);
407 GetProfileInfo(theId,*anInfo,theErr);
413 //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
416 ::GetPTimeStampVal(const PTimeStampInfo& theTimeStampInfo,
417 const TMKey2Profile& theMKey2Profile,
418 const TKey2Gauss& theKey2Gauss,
421 PTimeStampVal anInfo = CrTimeStampVal(theTimeStampInfo);
422 GetTimeStampVal(*anInfo,theMKey2Profile,theKey2Gauss,theErr);
425 PFieldInfo aFieldInfo = theTimeStampInfo->GetFieldInfo();
426 INITMSG(MYDEBUG,"GetPTimeStampVal\n");
427 TGeom2Value& aGeom2Value = anInfo->myGeom2Value;
428 TGeom2Value::const_iterator anIter = aGeom2Value.begin();
429 for(; anIter != aGeom2Value.end(); anIter++){
430 const EGeometrieElement& aGeom = anIter->first;
431 const TMeshValue& aMeshValue = anIter->second;
432 TInt aNbElem = aMeshValue.myNbElem;
433 TInt aNbGauss = aMeshValue.myNbGauss;
434 TInt aNbComp = aMeshValue.myNbComp;
435 INITMSG(MYDEBUG,"aGeom = "<<aGeom<<" - "<<aNbElem<<": ");
436 for(TInt iElem = 0; iElem < aNbElem; iElem++){
437 TCValueSliceArr aValueSliceArr = aMeshValue.GetGaussValueSliceArr(iElem);
438 ADDMSG(MYVALUEDEBUG,"{");
439 for(TInt iGauss = 0; iGauss < aNbGauss; iGauss++){
440 const TCValueSlice& aValueSlice = aValueSliceArr[iGauss];
441 for(TInt iComp = 0; iComp < aNbComp; iComp++){
442 ADDMSG(MYVALUEDEBUG,aValueSlice[iComp]<<" ");
444 ADDMSG(MYVALUEDEBUG,"| ");
446 ADDMSG(MYVALUEDEBUG,"} ");
448 ADDMSG(MYDEBUG,"\n");
457 ::GetPGrilleInfo(const PMeshInfo& theMeshInfo)
459 if(theMeshInfo->GetType() != eSTRUCTURE)
460 return PGrilleInfo();
463 GetGrilleType(*theMeshInfo,type);
465 if(type == eGRILLE_STANDARD){
466 const TInt nnoeuds = GetNbNodes(*theMeshInfo);
467 anInfo = CrGrilleInfo(theMeshInfo,type,nnoeuds);
471 aVec.resize(theMeshInfo->GetDim());
472 for(int aAxe=0;aAxe<theMeshInfo->GetDim();aAxe++){
476 aATable = eCOOR_IND1;
479 aATable = eCOOR_IND2;
482 aATable = eCOOR_IND3;
485 aVec[aAxe] = GetNbNodes(*theMeshInfo,aATable);
487 anInfo = CrGrilleInfo(theMeshInfo,type,aVec);
490 GetGrilleInfo(anInfo);
491 anInfo->SetGrilleType(type);
497 ::GetPGrilleInfo(const PMeshInfo& theMeshInfo,
498 const PGrilleInfo& theInfo)
500 PGrilleInfo anInfo = CrGrilleInfo(theMeshInfo,theInfo);