1 // Copyright (C) 2003 CEA/DEN, EDF R&D
5 // File : VISU_DatConvertor.cxx
6 // Author : Alexey PETROV
9 #include "MEDA_Wrapper.hxx"
10 #include "MED_Wrapper.hxx"
11 #include "MED_Utilities.hxx"
17 static int MYDEBUG = 0;
19 static int MYDEBUG = 0;
23 //---------------------------------------------------------------
24 TWrapper::TWrapper(const string& theFileName):
25 myWrapper(new MED::TWrapper(theFileName))
29 //---------------------------------------------------------------
30 PMeshInfo TWrapper::CrMeshInfo(med_int theDim,
31 const string& theValue)
33 MED::PMeshInfo anInfo(new MED::TMeshInfo(theDim,theValue));
34 return PMeshInfo(new TMeshInfo(anInfo));
37 PMeshInfo TWrapper::CrMeshInfo(const PMeshInfo& theInfo){
38 MED::PMeshInfo anInfo(new MED::TMeshInfo(*theInfo->myInfo));
39 return PMeshInfo(new TMeshInfo(anInfo));
42 med_int TWrapper::GetNbMeshes(){
43 return myWrapper->GetNbMeshes();
46 PMeshInfo TWrapper::GetMeshInfo(med_int theId){
47 PMeshInfo anInfo = CrMeshInfo();
48 myWrapper->GetMeshInfo(theId+1,*anInfo->myInfo);
50 MESSAGE("GetMeshInfo(...)");
51 MED::PrefixPrinter aPrefixPrinter;
52 BEGMSG("aName = '"<<anInfo->GetName()<<"'; aDim = "<<anInfo->GetDim()<<"\n");
58 void TWrapper::SetMeshInfo(const PMeshInfo& theInfo){
59 myWrapper->SetMeshInfo(*theInfo->myInfo);
63 //---------------------------------------------------------------
64 PFamilyInfo TWrapper::CrFamilyInfo(const PMeshInfo& theMeshInfo,
68 const string& theValue)
70 const MED::PMeshInfo& aMeshInfo = theMeshInfo->myInfo;
71 MED::PFamilyInfo anInfo(new MED::TFamilyInfo(aMeshInfo,
76 return PFamilyInfo(new TFamilyInfo(anInfo));
79 PFamilyInfo TWrapper::CrFamilyInfo(const PMeshInfo& theMeshInfo,
80 const string& theValue,
82 const MED::TStringSet& theGroupNames,
83 const MED::TStringVector& theAttrDescs,
84 const MED::TIntVector& theAttrIds,
85 const MED::TIntVector& theAttrVals)
87 const MED::PMeshInfo& aMeshInfo = theMeshInfo->myInfo;
88 MED::PFamilyInfo anInfo(new MED::TFamilyInfo(aMeshInfo,
95 return PFamilyInfo(new TFamilyInfo(anInfo));
98 PFamilyInfo TWrapper::CrFamilyInfo(const PMeshInfo& theMeshInfo,
99 const PFamilyInfo& theInfo)
101 MED::PFamilyInfo anInfo(new MED::TFamilyInfo(*theInfo->myInfo));
102 anInfo->myMeshInfo = theMeshInfo->myInfo;
103 return PFamilyInfo(new TFamilyInfo(anInfo));
106 med_int TWrapper::GetNbFamilies(const PMeshInfo& theMeshInfo){
107 return myWrapper->GetNbFamilies(*theMeshInfo->myInfo);
110 PFamilyInfo TWrapper::GetFamilyInfo(const PMeshInfo& theMeshInfo, med_int theId){
111 med_int aNbAttr = myWrapper->GetNbFamAttr(theId+1,*theMeshInfo->myInfo);
112 med_int aNbGroup = myWrapper->GetNbFamGroup(theId+1,*theMeshInfo->myInfo);
113 PFamilyInfo anInfo = CrFamilyInfo(theMeshInfo,aNbGroup,aNbAttr);
114 myWrapper->GetFamilyInfo(theId+1,*anInfo->myInfo);
116 MESSAGE("GetFamilyInfo(...)");
117 MED::PrefixPrinter aPrefixPrinter;
118 BEGMSG("aName = '"<<anInfo->GetName()<<"'; anId = "<<anInfo->GetId()<<"\n");
124 void TWrapper::SetFamilyInfo(const PFamilyInfo& theInfo){
125 myWrapper->SetFamilyInfo(*theInfo->myInfo);
129 //---------------------------------------------------------------
130 PNodeInfo TWrapper::CrNodeInfo(const PMeshInfo& theMeshInfo,
132 med_repere theSystem,
133 med_booleen theIsElemNum,
134 med_booleen theIsElemNames)
136 const MED::PMeshInfo& aMeshInfo = theMeshInfo->myInfo;
137 MED::PNodeInfo anInfo(new MED::TNodeInfo(aMeshInfo,
142 return PNodeInfo(new TNodeInfo(anInfo));
145 PNodeInfo TWrapper::CrNodeInfo(const PMeshInfo& theMeshInfo,
146 med_repere theSystem,
147 const MED::TFloatVector& theNodeCoords,
148 const MED::TStringVector& theCoordNames,
149 const MED::TStringVector& theCoordUnits,
150 const MED::TIntVector& theFamilyNums,
151 const MED::TIntVector& theElemNums,
152 const MED::TStringVector& theElemNames)
154 const MED::PMeshInfo& aMeshInfo = theMeshInfo->myInfo;
155 MED::PNodeInfo anInfo(new MED::TNodeInfo(aMeshInfo,
163 return PNodeInfo(new TNodeInfo(anInfo));
166 PNodeInfo TWrapper::CrNodeInfo(const PMeshInfo& theMeshInfo,
167 const PNodeInfo& theInfo)
169 MED::PNodeInfo anInfo(new MED::TNodeInfo(*theInfo->myInfo));
170 anInfo->myMeshInfo = theMeshInfo->myInfo;
171 return PNodeInfo(new TNodeInfo(anInfo));
174 PNodeInfo TWrapper::GetNodeInfo(const PMeshInfo& theMeshInfo){
175 med_int aNbElems = myWrapper->GetNbNodes(*theMeshInfo->myInfo);
176 PNodeInfo anInfo = CrNodeInfo(theMeshInfo,aNbElems);
177 myWrapper->GetNodeInfo(*anInfo->myInfo);
181 void TWrapper::SetNodeInfo(const PNodeInfo& theInfo){
182 myWrapper->SetNodeInfo(*theInfo->myInfo);
186 //---------------------------------------------------------------
187 MED::TEntityInfo TWrapper::GetEntityInfo(const PMeshInfo& theMeshInfo){
188 return myWrapper->GetEntityInfo(*theMeshInfo->myInfo);
191 PCellInfo TWrapper::CrCellInfo(const PMeshInfo& theMeshInfo,
193 med_entite_maillage theEntity,
194 med_geometrie_element theGeom,
195 med_connectivite theConn,
196 med_booleen theIsElemNum,
197 med_booleen theIsElemNames)
199 MED::PCellInfo anInfo(new MED::TCellInfo(theMeshInfo->myInfo,
206 return PCellInfo(new TCellInfo(anInfo));
209 PCellInfo TWrapper::CrCellInfo(const PMeshInfo& theMeshInfo,
210 med_entite_maillage theEntity,
211 med_geometrie_element theGeom,
212 med_connectivite theConn,
213 const MED::TIntVector& theConnectivities,
214 const MED::TIntVector& theFamilyNums,
215 const MED::TIntVector& theElemNums,
216 const MED::TStringVector& theElemNames)
218 MED::PCellInfo anInfo(new MED::TCellInfo(theMeshInfo->myInfo,
226 return PCellInfo(new TCellInfo(anInfo));
229 PCellInfo TWrapper::CrCellInfo(const PMeshInfo& theMeshInfo,
230 const PCellInfo& theInfo)
232 MED::PCellInfo anInfo(new MED::TCellInfo(*theInfo->myInfo));
233 anInfo->myMeshInfo = theMeshInfo->myInfo;
234 return PCellInfo(new TCellInfo(anInfo));
237 PCellInfo TWrapper::GetCellInfo(const PMeshInfo& theMeshInfo,
238 med_entite_maillage theEntity,
239 med_geometrie_element theGeom,
240 med_connectivite theConn)
242 med_int aNbElem = myWrapper->GetNbCells(*theMeshInfo->myInfo,theEntity,theGeom,theConn);
243 PCellInfo anInfo = CrCellInfo(theMeshInfo,aNbElem,theEntity,theGeom,theConn);
244 myWrapper->GetCellInfo(*anInfo->myInfo);
248 void TWrapper::SetCellInfo(const PCellInfo& theInfo){
249 myWrapper->SetCellInfo(*theInfo->myInfo);
253 //---------------------------------------------------------------
254 PFieldInfo TWrapper::CrFieldInfo(const PMeshInfo& theMeshInfo,
256 med_type_champ theType,
257 const string& theValue)
259 MED::PFieldInfo anInfo(new MED::TFieldInfo(theMeshInfo->myInfo,
263 return PFieldInfo(new TFieldInfo(anInfo));
266 PFieldInfo TWrapper::CrFieldInfo(const PMeshInfo& theMeshInfo,
267 const PFieldInfo& theInfo)
269 MED::PFieldInfo anInfo(new MED::TFieldInfo(*theInfo->myInfo));
270 anInfo->myMeshInfo = theMeshInfo->myInfo;
271 return PFieldInfo(new TFieldInfo(anInfo));
274 med_int TWrapper::GetNbFields(){
275 return myWrapper->GetNbFields();
278 PFieldInfo TWrapper::GetFieldInfo(const PMeshInfo& theMeshInfo, med_int theId){
279 med_int aNbComp = myWrapper->GetNbComp(theId+1);
280 PFieldInfo anInfo = CrFieldInfo(theMeshInfo,aNbComp);
281 myWrapper->GetFieldInfo(theId+1,*anInfo->myInfo);
285 void TWrapper::SetFieldInfo(const PFieldInfo& theInfo){
286 myWrapper->SetFieldInfo(*theInfo->myInfo);
290 //---------------------------------------------------------------
291 PTimeStampInfo TWrapper::CrTimeStampInfo(const PFieldInfo& theFieldInfo,
292 med_entite_maillage theEntity,
293 const MED::TGeom& theGeom)
295 MED::PTimeStampInfo anInfo(new MED::TTimeStampInfo(theFieldInfo->myInfo,
298 return PTimeStampInfo(new TTimeStampInfo(anInfo));
301 PTimeStampInfo TWrapper::CrTimeStampInfo(const PFieldInfo& theFieldInfo,
302 const PTimeStampInfo& theInfo)
304 MED::PTimeStampInfo anInfo(new MED::TTimeStampInfo(*theInfo->myInfo));
305 anInfo->myFieldInfo = theFieldInfo->myInfo;
306 return PTimeStampInfo(new TTimeStampInfo(anInfo));
309 med_int TWrapper::GetNbTimeStamps(const PFieldInfo& theFieldInfo,
310 const MED::TEntityInfo& theEntityInfo,
311 med_entite_maillage& theEntity,
314 return myWrapper->GetNbTimeStamps(*theFieldInfo->myInfo,
320 PTimeStampInfo TWrapper::GetTimeStampInfo(const PFieldInfo& theFieldInfo,
322 med_entite_maillage theEntity,
323 const MED::TGeom& theGeom)
325 PTimeStampInfo anInfo = CrTimeStampInfo(theFieldInfo,theEntity,theGeom);
326 myWrapper->GetTimeStampInfo(theId+1,*anInfo->myInfo);
331 //---------------------------------------------------------------
332 PTimeStampVal TWrapper::CrTimeStampVal(const PTimeStampInfo& theTimeStampInfo)
334 MED::PTimeStampVal anInfo(new MED::TTimeStampVal(theTimeStampInfo->myInfo));
335 return PTimeStampVal(new TTimeStampVal(anInfo));
338 PTimeStampVal TWrapper::CrTimeStampVal(const PTimeStampInfo& theTimeStampInfo,
339 const PTimeStampVal& theInfo)
341 MED::PTimeStampVal anInfo(new MED::TTimeStampVal(*theInfo->myInfo));
342 anInfo->myTimeStampInfo = theTimeStampInfo->myInfo;
343 return PTimeStampVal(new TTimeStampVal(anInfo));
346 PTimeStampVal TWrapper::GetTimeStampVal(const PTimeStampInfo& theTimeStampInfo)
348 PTimeStampVal anInfo = CrTimeStampVal(theTimeStampInfo);
349 myWrapper->GetTimeStampVal(*anInfo->myInfo);
353 void TWrapper::SetTimeStamp(const PTimeStampVal& theTimeStampVal){
354 myWrapper->SetTimeStamp(*theTimeStampVal->myInfo);