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 TInt aNbAttr = GetNbFamAttr(theId,*theMeshInfo);
64 TInt aNbGroup = GetNbFamGroup(theId,*theMeshInfo);
65 PFamilyInfo anInfo = CrFamilyInfo(theMeshInfo,aNbGroup,aNbAttr);
66 GetFamilyInfo(theId,*anInfo,theErr);
69 string aName = anInfo->GetName();
70 INITMSG(MYDEBUG,"GetPFamilyInfo - aFamilyName = '"<<aName<<
71 "'; andId = "<<anInfo->GetId()<<
72 "; aNbAttr = "<<aNbAttr<<
73 "; aNbGroup = "<<aNbGroup<<"\n");
74 for(TInt iGroup = 0; iGroup < aNbGroup; iGroup++){
75 aName = anInfo->GetGroupName(iGroup);
76 INITMSG(MYDEBUG,"aGroupName = '"<<aName<<"'\n");
84 //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
87 ::GetPNodeInfo(const PMeshInfo& theMeshInfo,
90 TInt aNbElems = GetNbNodes(*theMeshInfo);
91 PNodeInfo anInfo = CrNodeInfo(theMeshInfo,aNbElems);
92 GetNodeInfo(*anInfo,theErr);
95 TInt aDim = theMeshInfo->myDim;
96 TInt aNbElem = anInfo->GetNbElem();
97 INITMSG(MYDEBUG,"GetPNodeInfo: ");
99 INITMSG(MYDEBUG,"aCoords: "<<aNbElem<<": ");
100 TNodeCoord& aCoord = anInfo->myCoord;
101 for(TInt iElem = 0; iElem < aNbElem; iElem++){
102 for(TInt iDim = 0, anId = iElem*aDim; iDim < aDim; iDim++, anId++){
103 ADDMSG(MYVALUEDEBUG,aCoord[anId]<<",");
105 ADDMSG(MYVALUEDEBUG," ");
107 ADDMSG(MYDEBUG,endl);
109 BEGMSG(MYVALUEDEBUG,"GetFamNum: ");
110 for(TInt iElem = 0; iElem < aNbElem; iElem++){
111 ADDMSG(MYVALUEDEBUG,anInfo->GetFamNum(iElem)<<", ");
113 ADDMSG(MYVALUEDEBUG,endl);
115 if(anInfo->IsElemNum()){
116 BEGMSG(MYVALUEDEBUG,"GetElemNum: ");
117 for(TInt iElem = 0; iElem < aNbElem; iElem++){
118 ADDMSG(MYVALUEDEBUG,anInfo->GetElemNum(iElem)<<", ");
120 ADDMSG(MYVALUEDEBUG,endl);
123 ADDMSG(MYDEBUG,endl);
129 //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
132 ::GetPPolygoneInfo(const PMeshInfo& theMeshInfo,
133 EEntiteMaillage theEntity,
134 EGeometrieElement theGeom,
135 EConnectivite theConnMode)
137 TInt aNbElem = GetNbPolygones(theMeshInfo,theEntity,theGeom,theConnMode);
138 TInt aConnSize = GetPolygoneConnSize(theMeshInfo,theEntity,theGeom,theConnMode);
139 PPolygoneInfo anInfo = CrPolygoneInfo(theMeshInfo,theEntity,theGeom,aNbElem,aConnSize,theConnMode);
140 GetPolygoneInfo(anInfo);
143 INITMSG(MYDEBUG,"GetPPolygoneInfo"<<
144 " - theGeom = "<<theGeom<<
145 "; aNbElem = "<<aNbElem<<": ");
146 for(TInt iElem = 1; iElem < aNbElem; iElem++){
147 TCConnSlice aConnSlice = anInfo->GetConnSlice(iElem);
148 TInt aConnDim = aConnSlice.size();
149 for(TInt iConn = 0; iConn < aConnDim; iConn++){
150 ADDMSG(MYVALUEDEBUG,aConnSlice[iConn]<<",");
154 ADDMSG(MYDEBUG,endl);
160 //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
163 ::GetPPolyedreInfo(const PMeshInfo& theMeshInfo,
164 EEntiteMaillage theEntity,
165 EGeometrieElement theGeom,
166 EConnectivite theConnMode)
168 TInt aNbElem = GetNbPolyedres(theMeshInfo,theEntity,theGeom,theConnMode);
169 TInt aNbFaces, aConnSize;
170 GetPolyedreConnSize(theMeshInfo,aNbFaces,aConnSize,theConnMode);
171 PPolyedreInfo anInfo = CrPolyedreInfo(theMeshInfo,theEntity,theGeom,aNbElem,aNbFaces,aConnSize,theConnMode);
172 GetPolyedreInfo(anInfo);
175 INITMSG(MYDEBUG,"GetPPolyedreInfo"<<
176 " - theGeom = "<<theGeom<<
177 "; aNbElem = "<<aNbElem<<": ");
178 for(TInt iElem = 0; iElem < aNbElem; iElem++){
179 TCConnSliceArr aConnSliceArr = anInfo->GetConnSliceArr(iElem);
180 TInt aNbFaces = aConnSliceArr.size();
182 for(TInt iFace = 0; iFace < aNbFaces; iFace++){
183 TCConnSlice aConnSlice = aConnSliceArr[iFace];
184 TInt aNbConn = aConnSlice.size();
186 for(TInt iConn = 0; iConn < aNbConn; iConn++){
187 ADDMSG(MYVALUEDEBUG,aConnSlice[iConn]<<",");
189 ADDMSG(MYDEBUG,"] ");
191 ADDMSG(MYDEBUG,"} ");
193 ADDMSG(MYDEBUG,endl);
199 //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
202 ::GetPCellInfo(const PMeshInfo& theMeshInfo,
203 EEntiteMaillage theEntity,
204 EGeometrieElement theGeom,
205 EConnectivite theConnMode,
208 TInt aNbElem = GetNbCells(theMeshInfo,theEntity,theGeom,theConnMode);
209 PCellInfo anInfo = CrCellInfo(theMeshInfo,theEntity,theGeom,aNbElem,theConnMode);
210 GetCellInfo(anInfo,theErr);
213 TInt aConnDim = anInfo->GetConnDim();
214 INITMSG(MYDEBUG,"GetPCellInfo - theEntity = "<<theEntity<<"; theGeom = "<<theGeom<<"; aConnDim: "<<aConnDim<<"\n");
215 BEGMSG(MYDEBUG,"GetPCellInfo - aNbElem: "<<aNbElem<<": ");
216 for(TInt iElem = 0; iElem < aNbElem; iElem++){
217 TCConnSlice aConnSlice = anInfo->GetConnSlice(iElem);
218 for(TInt iConn = 0; iConn < aConnDim; iConn++){
219 ADDMSG(MYVALUEDEBUG,aConnSlice[iConn]<<",");
221 ADDMSG(MYVALUEDEBUG," ");
223 ADDMSG(MYDEBUG,endl);
225 BEGMSG(MYVALUEDEBUG,"GetPCellInfo - GetFamNum: ");
226 for(TInt iElem = 0; iElem < aNbElem; iElem++){
227 ADDMSG(MYVALUEDEBUG,anInfo->GetFamNum(iElem)<<", ");
229 ADDMSG(MYVALUEDEBUG,endl);
231 if(anInfo->IsElemNum()){
232 BEGMSG(MYVALUEDEBUG,"GetPCellInfo - GetElemNum: ");
233 for(TInt iElem = 0; iElem < aNbElem; iElem++){
234 ADDMSG(MYVALUEDEBUG,anInfo->GetElemNum(iElem)<<", ");
236 ADDMSG(MYVALUEDEBUG,endl);
238 ADDMSG(MYDEBUG,endl);
245 //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
248 ::GetPFieldInfo(const PMeshInfo& theMeshInfo,
252 TInt aNbComp = GetNbComp(theId);
253 PFieldInfo anInfo = CrFieldInfo(theMeshInfo,aNbComp);
254 GetFieldInfo(theId,*anInfo,theErr);
259 "- aName = '"<<anInfo->GetName()<<"'"<<
260 "; aType = "<<anInfo->GetType()<<
261 "; aNbComp = "<<aNbComp<<
269 //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
272 ::GetPTimeStampInfo(const PFieldInfo& theFieldInfo,
273 EEntiteMaillage theEntity,
274 const TGeom2Size& theGeom2Size,
278 PTimeStampInfo anInfo = CrTimeStampInfo(theFieldInfo,theEntity,theGeom2Size);
279 GetTimeStampInfo(theId,*anInfo,theErr);
282 INITMSG(MYDEBUG,"GetPTimeStampInfo - anEntity = "<<anInfo->GetEntity()<<"\n");
283 TGeom2NbGauss& aGeom2NbGauss = anInfo->myGeom2NbGauss;
284 TGeom2NbGauss::const_iterator anIter = aGeom2NbGauss.begin();
285 for(; anIter != aGeom2NbGauss.end(); anIter++){
286 const EGeometrieElement& aGeom = anIter->first;
287 INITMSG(MYDEBUG,"aGeom = "<<aGeom<<" - "<<aGeom2NbGauss[aGeom]<<";\n");
295 //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
298 ::GetPProfileInfo(TInt theId,
302 TProfileInfo::TInfo aPreInfo = GetProfilePreInfo(theId);
303 PProfileInfo anInfo = CrProfileInfo(aPreInfo,theMode);
304 GetProfileInfo(theId,*anInfo,theErr);
310 //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
313 ::GetPTimeStampVal(const PTimeStampInfo& theTimeStampInfo,
314 const TMKey2Profile& theMKey2Profile,
315 const TKey2Gauss& theKey2Gauss,
318 PTimeStampVal anInfo = CrTimeStampVal(theTimeStampInfo);
319 GetTimeStampVal(*anInfo,theMKey2Profile,theKey2Gauss,theErr);
322 PFieldInfo aFieldInfo = theTimeStampInfo->GetFieldInfo();
323 INITMSG(MYDEBUG,"GetPTimeStampVal\n");
324 TGeom2Value& aGeom2Value = anInfo->myGeom2Value;
325 TGeom2Value::const_iterator anIter = aGeom2Value.begin();
326 for(; anIter != aGeom2Value.end(); anIter++){
327 const EGeometrieElement& aGeom = anIter->first;
328 const TMeshValue& aMeshValue = anIter->second;
329 TInt aNbElem = aMeshValue.myNbElem;
330 TInt aNbGauss = aMeshValue.myNbGauss;
331 TInt aNbComp = aMeshValue.myNbComp;
332 INITMSG(MYDEBUG,"aGeom = "<<aGeom<<" - "<<aNbElem<<": ");
333 for(TInt iElem = 0; iElem < aNbElem; iElem++){
334 TCValueSliceArr aValueSliceArr = aMeshValue.GetGaussValueSliceArr(iElem);
335 ADDMSG(MYVALUEDEBUG,"{");
336 for(TInt iGauss = 0; iGauss < aNbGauss; iGauss++){
337 const TCValueSlice& aValueSlice = aValueSliceArr[iGauss];
338 for(TInt iComp = 0; iComp < aNbComp; iComp++){
339 ADDMSG(MYVALUEDEBUG,aValueSlice[iComp]<<" ");
341 ADDMSG(MYVALUEDEBUG,"| ");
343 ADDMSG(MYVALUEDEBUG,"} ");
345 ADDMSG(MYDEBUG,"\n");