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;
21 //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
22 PMeshInfo TWrapper::GetPMeshInfo(TInt theId,
25 PMeshInfo anInfo = CrMeshInfo();
26 GetMeshInfo(theId,*anInfo,theErr);
31 //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
32 PFamilyInfo TWrapper::GetPFamilyInfo(const PMeshInfo& theMeshInfo,
36 TInt aNbAttr = GetNbFamAttr(theId,*theMeshInfo);
37 TInt aNbGroup = GetNbFamGroup(theId,*theMeshInfo);
38 PFamilyInfo anInfo = CrFamilyInfo(theMeshInfo,aNbGroup,aNbAttr);
39 GetFamilyInfo(theId,*anInfo,theErr);
42 string aName = anInfo->GetName();
43 INITMSG(MYDEBUG,"GetPFamilyInfo - aFamilyName = '"<<aName<<
44 "'; andId = "<<anInfo->GetId()<<
45 "; aNbAttr = "<<aNbAttr<<
46 "; aNbGroup = "<<aNbGroup<<"\n");
47 for(TInt iGroup = 0; iGroup < aNbGroup; iGroup++){
48 aName = anInfo->GetGroupName(iGroup);
49 INITMSG(MYDEBUG,"aGroupName = '"<<aName<<"'\n");
57 //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
58 PNodeInfo TWrapper::GetPNodeInfo(const PMeshInfo& theMeshInfo,
61 TInt aNbElems = GetNbNodes(*theMeshInfo);
62 PNodeInfo anInfo = CrNodeInfo(theMeshInfo,aNbElems);
63 GetNodeInfo(*anInfo,theErr);
66 TInt aDim = theMeshInfo->myDim;
67 TInt aNbElem = anInfo->GetNbElem();
68 INITMSG(MYDEBUG,"GetPNodeInfo - aCoords: "<<aNbElem<<": ");
69 TNodeCoord& aCoord = anInfo->myCoord;
70 for(TInt iElem = 0; iElem < aNbElem; iElem++){
71 for(TInt iDim = 0, anId = iElem*aDim; iDim < aDim; iDim++, anId++){
72 ADDMSG(MYVALUEDEBUG,aCoord[anId]<<",");
74 ADDMSG(MYVALUEDEBUG," ");
78 BEGMSG(MYDEBUG,"GetPNodeInfo - GetFamNum: ");
79 for(TInt iElem = 0; iElem < aNbElem; iElem++){
80 ADDMSG(MYVALUEDEBUG,anInfo->GetFamNum(iElem)<<", ");
84 if(anInfo->IsElemNum()){
85 BEGMSG(MYDEBUG,"GetPNodeInfo - GetElemNum: ");
86 for(TInt iElem = 0; iElem < aNbElem; iElem++){
87 ADDMSG(MYVALUEDEBUG,anInfo->GetElemNum(iElem)<<", ");
98 //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
99 PPolygoneInfo TWrapper::GetPPolygoneInfo(const PMeshInfo& theMeshInfo,
100 EEntiteMaillage theEntity,
101 EGeometrieElement theGeom,
102 EConnectivite theConn)
104 TInt aNbElem = GetNbPolygones(*theMeshInfo,theEntity,theGeom,theConn);
105 TInt aNbConn = GetNbPolygoneConn(*theMeshInfo,theEntity,theGeom,theConn);
106 PPolygoneInfo anInfo = CrPolygoneInfo(theMeshInfo,aNbElem,aNbConn,theEntity,theGeom,theConn);
107 GetPolygoneInfo(*anInfo);
110 TElemNum aConn = anInfo->GetConnectivite();
111 TElemNum aIndex = anInfo->GetIndex();
112 TInt aNbIndex = aIndex.size();
113 TInt aIndex0 = aIndex[0];
114 INITMSG(MYDEBUG,"theGeom = "<<theGeom<<"; aNbElem = "<<aNbIndex-1<<": ");
115 for(TInt iElem = 1; iElem < aNbIndex; iElem++){
116 for (TInt i = aIndex0; i < aIndex[iElem];i++)
117 ADDMSG(MYVALUEDEBUG,aConn[i-1]<<",");
119 aIndex0 = aIndex[iElem];
121 ADDMSG(MYDEBUG,endl);
122 BEGMSG(MYDEBUG,"Indexes: ");
123 for(TInt iElem = 0; iElem < aIndex.size(); iElem++){
124 ADDMSG(MYVALUEDEBUG,aIndex[iElem]<<",");
126 ADDMSG(MYDEBUG,endl);
132 //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
133 PPolyedreInfo TWrapper::GetPPolyedreInfo(const PMeshInfo& theMeshInfo,
134 EEntiteMaillage theEntity,
135 EGeometrieElement theGeom,
136 EConnectivite theConn)
138 TInt aNbElem = GetNbPolyedres(*theMeshInfo,theEntity,theGeom,theConn);
141 GetNbPolyedreConnF(*theMeshInfo,theConn,aNbFaces,aNbConn);
142 PPolyedreInfo anInfo = CrPolyedreInfo(theMeshInfo,aNbElem,aNbConn,aNbFaces,theEntity,theGeom,theConn);
143 GetPolyedreInfo(*anInfo);
146 TElemNum aConn = anInfo->GetConnectivite();
147 TElemNum aFacesIndex = anInfo->GetFacesIndex();
148 TElemNum aIndex = anInfo->GetIndex();
150 TInt aNbIndex = aIndex.size();
152 for (int aNp = 0; aNp < aNbIndex-1;aNp++){
153 if (anInfo->IsElemNames())
154 ADDMSG(MYDEBUG,anInfo->GetElemName(aNp)<<endl);
156 ADDMSG(MYDEBUG,"POLYEDRE "<<aNp+1<<endl);
158 for (int aNf = aIndex[aNp]-1;aNf < aIndex[aNp+1]-1;aNf++){
159 ADDMSG(MYDEBUG,"Face "<<aNf-aIndex[aNp]+2<<": [");
160 for (int aNc = aFacesIndex[aNf]-1; aNc < aFacesIndex[aNf+1]-1;aNc++){
161 ADDMSG(MYDEBUG," "<<aConn[aNc]);
163 ADDMSG(MYDEBUG," ]"<<endl;);
171 //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
172 PCellInfo TWrapper::GetPCellInfo(const PMeshInfo& theMeshInfo,
173 EEntiteMaillage theEntity,
174 EGeometrieElement theGeom,
175 EConnectivite theConn,
178 TInt aNbElem = GetNbCells(*theMeshInfo,theEntity,theGeom,theConn);
179 PCellInfo anInfo = CrCellInfo(theMeshInfo,aNbElem,theEntity,theGeom,theConn);
180 GetCellInfo(*anInfo,theErr);
183 TInt aConnDim = anInfo->GetConnDim();
184 INITMSG(MYDEBUG,"GetPCellInfo - theEntity = "<<theEntity<<"; theGeom = "<<theGeom<<"; aConnDim: "<<aConnDim<<"\n");
185 BEGMSG(MYDEBUG,"GetPCellInfo - aNbElem: "<<aNbElem<<": ");
186 for(TInt iElem = 0; iElem < aNbElem; iElem++){
187 for(TInt iConn = 0; iConn < aConnDim; iConn++){
188 ADDMSG(MYVALUEDEBUG,anInfo->GetConn(iElem,iConn)<<",");
190 ADDMSG(MYVALUEDEBUG," ");
192 ADDMSG(MYDEBUG,endl);
194 BEGMSG(MYDEBUG,"GetPCellInfo - GetFamNum: ");
195 for(TInt iElem = 0; iElem < aNbElem; iElem++){
196 ADDMSG(MYVALUEDEBUG,anInfo->GetFamNum(iElem)<<", ");
198 ADDMSG(MYDEBUG,endl);
200 if(anInfo->IsElemNum()){
201 BEGMSG(MYDEBUG,"GetPCellInfo - GetElemNum: ");
202 for(TInt iElem = 0; iElem < aNbElem; iElem++){
203 ADDMSG(MYVALUEDEBUG,anInfo->GetElemNum(iElem)<<", ");
205 ADDMSG(MYDEBUG,endl);
207 ADDMSG(MYDEBUG,endl);
214 //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
215 PFieldInfo TWrapper::GetPFieldInfo(const PMeshInfo& theMeshInfo,
219 TInt aNbComp = GetNbComp(theId);
220 PFieldInfo anInfo = CrFieldInfo(theMeshInfo,aNbComp);
221 GetFieldInfo(theId,*anInfo,theErr);
225 "GetPFieldInfo - aNbComp = "<<aNbComp<<
226 "; aType = "<<anInfo->GetType()<<"\n");
233 //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
234 PTimeStampInfo TWrapper::GetPTimeStampInfo(const PFieldInfo& theFieldInfo,
235 EEntiteMaillage theEntity,
236 const MED::TGeom& theGeom,
240 PTimeStampInfo anInfo = CrTimeStampInfo(theFieldInfo,theEntity,theGeom);
241 GetTimeStampInfo(theId,*anInfo,theErr);
245 "GetPTimeStampInfo - aNbGauss = "<<anInfo->GetNbGauss()<<
246 "; aNumDt = "<<anInfo->GetNumDt()<<"\n");
253 //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
254 PTimeStampVal TWrapper::GetPTimeStampVal(const PTimeStampInfo& theTimeStampInfo,
257 PTimeStampVal anInfo = CrTimeStampVal(theTimeStampInfo);
258 GetTimeStampVal(*anInfo,theErr);
261 TInt aNbGauss = theTimeStampInfo->GetNbGauss();
262 PFieldInfo aFieldInfo = theTimeStampInfo->GetFieldInfo();
263 TInt aNbComp = aFieldInfo->GetNbComp();
264 INITMSG(MYDEBUG,"GetPTimeStampVal\n");
265 TMeshValue& aMeshValue = anInfo->myMeshValue;
266 TMeshValue::const_iterator aMeshValueIter = aMeshValue.begin();
267 for(; aMeshValueIter != aMeshValue.end(); aMeshValueIter++){
268 const EGeometrieElement& aGeom = aMeshValueIter->first;
269 const TValue& aValue = aMeshValueIter->second;
270 TInt iElemEnd = aValue.size() / aNbComp / aNbGauss;
271 INITMSG(MYDEBUG,"aGeom = "<<aGeom<<" - "<<iElemEnd<<": ");
272 for(TInt iElem = 0, anId = 0; iElem < iElemEnd; iElem++){
273 ADDMSG(MYVALUEDEBUG,"{");
274 for(TInt iComp = 0; iComp < aNbComp; iComp++){
275 for(TInt iGauss = 0; iGauss < aNbGauss; iGauss++){
276 ADDMSG(MYVALUEDEBUG,aValue[anId++]<<" ");
278 ADDMSG(MYVALUEDEBUG,"| ");
280 ADDMSG(MYVALUEDEBUG,"} ");
282 ADDMSG(MYDEBUG,"\n");