3 // Copyright (C) 2003 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
4 // CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
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.
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.
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
20 // See http://www.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org
29 #ifndef MED_TStructures_HeaderFile
30 #define MED_TStructures_HeaderFile
32 #include "MED_Structures.hxx"
36 const TInt DESC = 200;
41 //---------------------------------------------------------------
42 template<TInt nPNOM, TInt nDESC, TInt nIDENT, TInt nNOM, TInt nLNOM>
43 struct TTNameInfo: virtual TNameInfo
45 TTNameInfo(const std::string& theValue = "")
47 myName.resize(nNOM+1);
51 virtual std::string GetName() const {
52 return GetString(0,nNOM,myName);
55 virtual void SetName(const std::string& theValue){
56 SetString(0,nNOM,myName,theValue);
61 //---------------------------------------------------------------
62 template<TInt nPNOM, TInt nDESC, TInt nIDENT, TInt nNOM, TInt nLNOM>
63 struct TTMeshInfo: TMeshInfo, TTNameInfo<nPNOM,nDESC,nIDENT,nNOM,nLNOM>
65 typedef TTNameInfo<nPNOM,nDESC,nIDENT,nNOM,nLNOM> TNameInfoBase;
67 TTMeshInfo(const PMeshInfo& theInfo):
68 TNameInfoBase(theInfo->GetName())
70 myDim = theInfo->GetDim();
71 myType = theInfo->GetType();
73 myDesc.resize(nDESC+1);
74 SetDesc(theInfo->GetDesc());
77 TTMeshInfo(TInt theDim = 0,
78 const std::string& theValue = "",
79 EMaillage theType = eNON_STRUCTURE,
80 const std::string& theDesc = ""):
81 TNameInfoBase(theValue)
86 myDesc.resize(nDESC+1);
90 virtual std::string GetDesc() const {
91 return GetString(0,nDESC,myDesc);
94 virtual void SetDesc(const std::string& theValue){
95 SetString(0,nDESC,myDesc,theValue);
100 //---------------------------------------------------------------
101 template<TInt nPNOM, TInt nDESC, TInt nIDENT, TInt nNOM, TInt nLNOM>
102 struct TTFamilyInfo: TFamilyInfo, TTNameInfo<nPNOM,nDESC,nIDENT,nNOM,nLNOM>
104 typedef TTNameInfo<nPNOM,nDESC,nIDENT,nNOM,nLNOM> TNameInfoBase;
106 TTFamilyInfo(const PMeshInfo& theMeshInfo, const PFamilyInfo& theInfo):
107 TNameInfoBase(theInfo->GetName())
109 myMeshInfo = theMeshInfo;
111 myId = theInfo->GetId();
113 myNbGroup = theInfo->GetNbGroup();
114 myGroupNames.resize(myNbGroup*nLNOM+1);
116 for(TInt anId = 0; anId < myNbGroup; anId++){
117 SetGroupName(anId,theInfo->GetGroupName(anId));
121 myNbAttr = theInfo->GetNbAttr();
122 myAttrId.resize(myNbAttr);
123 myAttrVal.resize(myNbAttr);
124 myAttrDesc.resize(myNbAttr*nDESC+1);
126 for(TInt anId = 0; anId < myNbAttr; anId++){
127 SetAttrDesc(anId,theInfo->GetAttrDesc(anId));
128 myAttrVal[anId] = theInfo->GetAttrVal(anId);
129 myAttrId[anId] = theInfo->GetAttrId(anId);
134 TTFamilyInfo(const PMeshInfo& theMeshInfo,
138 const std::string& theValue = ""):
139 TNameInfoBase(theValue)
141 myMeshInfo = theMeshInfo;
145 myNbGroup = theNbGroup;
146 myGroupNames.resize(theNbGroup*nLNOM+1);
148 myNbAttr = theNbAttr;
149 myAttrId.resize(theNbAttr);
150 myAttrVal.resize(theNbAttr);
151 myAttrDesc.resize(theNbAttr*nDESC+1);
154 TTFamilyInfo(const PMeshInfo& theMeshInfo,
155 const std::string& theValue,
157 const TStringSet& theGroupNames,
158 const TStringVector& theAttrDescs = TStringVector(),
159 const TIntVector& theAttrIds = TIntVector(),
160 const TIntVector& theAttrVals = TIntVector()):
161 TNameInfoBase(theValue)
163 myMeshInfo = theMeshInfo;
167 myNbGroup = theGroupNames.size();
168 myGroupNames.resize(myNbGroup*nLNOM+1);
170 TStringSet::const_iterator anIter = theGroupNames.begin();
171 for(TInt anId = 0; anIter != theGroupNames.end(); anIter++, anId++){
172 const std::string& aVal = *anIter;
173 SetGroupName(anId,aVal);
177 myNbAttr = theAttrDescs.size();
178 myAttrId.resize(myNbAttr);
179 myAttrVal.resize(myNbAttr);
180 myAttrDesc.resize(myNbAttr*nDESC+1);
182 for(TInt anId = 0, anEnd = theAttrDescs.size(); anId < anEnd; anId++){
183 SetAttrDesc(anId,theAttrDescs[anId]);
184 myAttrVal[anId] = theAttrVals[anId];
185 myAttrId[anId] = theAttrIds[anId];
190 virtual std::string GetGroupName(TInt theId) const {
191 return GetString(theId,nLNOM,myGroupNames);
194 virtual void SetGroupName(TInt theId, const std::string& theValue){
195 SetString(theId,nLNOM,myGroupNames,theValue);
198 virtual std::string GetAttrDesc(TInt theId) const {
199 return GetString(theId,nDESC,myAttrDesc);
202 virtual void SetAttrDesc(TInt theId, const std::string& theValue){
203 SetString(theId,nDESC,myAttrDesc,theValue);
208 //---------------------------------------------------------------
209 template<TInt nPNOM, TInt nDESC, TInt nIDENT, TInt nNOM, TInt nLNOM>
210 struct TTElemInfo: virtual TElemInfo
212 TTElemInfo(const PMeshInfo& theMeshInfo, const PElemInfo& theInfo)
214 myMeshInfo = theMeshInfo;
216 myNbElem = theInfo->GetNbElem();
217 myFamNum.resize(myNbElem);
219 myIsElemNum = theInfo->IsElemNum();
220 myElemNum.resize(myIsElemNum == eFAUX? 0: myNbElem);
222 myIsElemNames = theInfo->IsElemNames();
223 myElemNames.resize(myNbElem*nPNOM+1);
226 for(TInt anId = 0; anId < myNbElem; anId++){
227 myFamNum[anId] = theInfo->GetFamNum(anId);
229 if(myIsElemNum == eVRAI){
230 for(TInt anId = 0; anId < myNbElem; anId++){
231 myElemNum[anId] = theInfo->GetElemNum(anId);
234 if(myIsElemNames == eVRAI){
235 for(TInt anId = 0; anId < myNbElem; anId++){
236 SetElemName(anId,theInfo->GetElemName(anId));
242 TTElemInfo(const PMeshInfo& theMeshInfo,
244 EBooleen theIsElemNum = eVRAI,
245 EBooleen theIsElemNames = eVRAI)
247 myMeshInfo = theMeshInfo;
249 myNbElem = theNbElem;
250 myFamNum.resize(theNbElem);
252 myIsElemNum = theIsElemNum;
253 myElemNum.resize(theIsElemNum == eFAUX? 0: theNbElem);
255 myIsElemNames = theIsElemNames;
256 myElemNames.resize(theNbElem*nPNOM+1);
259 TTElemInfo(const PMeshInfo& theMeshInfo,
260 const TIntVector& theFamilyNums,
261 const TIntVector& theElemNums,
262 const TStringVector& theElemNames = TStringVector())
264 myMeshInfo = theMeshInfo;
266 myNbElem = theFamilyNums.size();
267 myFamNum.resize(myNbElem);
269 myIsElemNum = theElemNums.size()? eVRAI: eFAUX;
270 myElemNum.resize(theElemNums.size());
272 myIsElemNames = theElemNames.size()? eVRAI: eFAUX;
273 myElemNames.resize(theElemNames.size()*nPNOM+1);
276 for(TInt anId = 0; anId < myNbElem; anId++){
277 myFamNum[anId] = theFamilyNums[anId];
279 if(myIsElemNum == eVRAI){
280 for(TInt anId = 0; anId < myNbElem; anId++){
281 myElemNum[anId] = theElemNums[anId];
284 if(myIsElemNames == eVRAI){
285 for(TInt anId = 0; anId < myNbElem; anId++){
286 const std::string& aVal = theElemNames[anId];
287 SetElemName(anId,aVal);
293 virtual std::string GetElemName(TInt theId) const {
294 return GetString(theId,nPNOM,myElemNames);
297 virtual void SetElemName(TInt theId, const std::string& theValue){
298 SetString(theId,nPNOM,myElemNames,theValue);
303 //---------------------------------------------------------------
304 template<TInt nPNOM, TInt nDESC, TInt nIDENT, TInt nNOM, TInt nLNOM>
305 struct TTNodeInfo: TNodeInfo, TTElemInfo<nPNOM,nDESC,nIDENT,nNOM,nLNOM>
307 typedef TTElemInfo<nPNOM,nDESC,nIDENT,nNOM,nLNOM> TElemInfoBase;
309 TTNodeInfo(const PMeshInfo& theMeshInfo, const PNodeInfo& theInfo):
310 TElemInfoBase(theMeshInfo,theInfo)
312 mySystem = theInfo->GetSystem();
314 TInt aDim = theMeshInfo->GetDim();
315 TInt aNbElem = theInfo->GetNbElem();
316 myCoord.resize(aNbElem*aDim);
318 for(TInt anElemId = 0; anElemId < aNbElem; anElemId++){
319 for(TInt anDimId = 0; anDimId < aDim; anDimId++){
320 SetNodeCoord(anElemId,anDimId,theInfo->GetNodeCoord(anElemId,anDimId));
324 myCoordNames.resize(aDim*nPNOM+1);
325 for(TInt anId = 0; anId < aDim; anId++){
326 SetCoordName(anId,theInfo->GetCoordName(anId));
329 myCoordUnits.resize(aDim*nPNOM+1);
330 for(TInt anId = 0; anId < aDim; anId++){
331 SetCoordUnit(anId,theInfo->GetCoordUnit(anId));
335 TTNodeInfo(const PMeshInfo& theMeshInfo,
337 ERepere theSystem = eCART,
338 EBooleen theIsElemNum = eVRAI,
339 EBooleen theIsElemNames = eVRAI):
340 TElemInfoBase(theMeshInfo,
345 mySystem = theSystem;
346 myCoord.resize(theNbElem*theMeshInfo->myDim);
347 myCoordNames.resize(theMeshInfo->myDim*nPNOM+1);
348 myCoordUnits.resize(theMeshInfo->myDim*nPNOM+1);
352 TTNodeInfo(const PMeshInfo& theMeshInfo,
354 const TFloatVector& theNodeCoords,
355 const TStringVector& theCoordNames,
356 const TStringVector& theCoordUnits,
357 const TIntVector& theFamilyNums,
358 const TIntVector& theElemNums,
359 const TStringVector& theElemNames = TStringVector()):
360 TElemInfoBase(theMeshInfo,
365 mySystem = theSystem;
366 myCoord.resize(theNodeCoords.size());
368 for(TInt anId = 0, anEnd = myCoord.size(); anId < anEnd; anId++){
369 myCoord[anId] = theNodeCoords[anId];
372 TInt aDim = theMeshInfo->GetDim();
373 myCoordNames.resize(aDim*nPNOM+1);
374 for(TInt anId = 0; anId < aDim; anId++){
375 SetCoordName(anId,theCoordNames[anId]);
378 myCoordUnits.resize(aDim*nPNOM+1);
379 for(TInt anId = 0; anId < aDim; anId++){
380 SetCoordUnit(anId,theCoordUnits[anId]);
384 virtual std::string GetCoordName(TInt theId) const {
385 return GetString(theId,nPNOM,myCoordNames);
388 virtual void SetCoordName(TInt theId, const std::string& theValue){
389 SetString(theId,nPNOM,myCoordNames,theValue);
392 virtual std::string GetCoordUnit(TInt theId) const {
393 return GetString(theId,nPNOM,myCoordUnits);
396 virtual void SetCoordUnit(TInt theId, const std::string& theValue){
397 SetString(theId,nPNOM,myCoordUnits,theValue);
402 //---------------------------------------------------------------
403 template<TInt nPNOM, TInt nDESC, TInt nIDENT, TInt nNOM, TInt nLNOM>
404 struct TTCellInfo: TCellInfo, TTElemInfo<nPNOM,nDESC,nIDENT,nNOM,nLNOM>
406 typedef TTElemInfo<nPNOM,nDESC,nIDENT,nNOM,nLNOM> TElemInfoBase;
408 TTCellInfo(const PMeshInfo& theMeshInfo, const PCellInfo& theInfo):
409 TElemInfoBase(theMeshInfo,theInfo)
411 myTEntity = theInfo->GetEntity();
412 myTGeom = theInfo->GetGeom();
413 myTConn = theInfo->GetConn();
414 myConnDim = theInfo->GetConnDim();
416 myConn.resize(myNbElem*myConnDim);
417 for(TInt anElemId = 0; anElemId < myNbElem; anElemId++){
418 for(TInt anConnId = 0; anConnId < myConnDim; anConnId++){
419 SetConn(anElemId,anConnId,theInfo->GetConn(anElemId,anConnId));
424 TTCellInfo(const PMeshInfo& theMeshInfo,
426 EEntiteMaillage theTEntity,
427 EGeometrieElement theTGeom,
428 EConnectivite theTConn = eNOD,
429 EBooleen theIsElemNum = eVRAI,
430 EBooleen theIsElemNames = eVRAI):
431 TElemInfoBase(theMeshInfo,
436 myTEntity = theTEntity;
439 myConnDim = GetNbConn(myTEntity,myTGeom,theMeshInfo->myDim);
440 myConn.resize(theNbElem*myConnDim);
443 TTCellInfo(const PMeshInfo& theMeshInfo,
444 EEntiteMaillage theTEntity,
445 EGeometrieElement theTGeom,
446 EConnectivite theTConn,
447 const TIntVector& theConnectivities,
448 const TIntVector& theFamilyNums,
449 const TIntVector& theElemNums,
450 const TStringVector& theElemNames = TStringVector()):
451 TTElemInfo<nPNOM,nDESC,nIDENT,nNOM,nLNOM>(theMeshInfo,
456 myTEntity = theTEntity;
459 myConnDim = GetNbConn(myTEntity,myTGeom,theMeshInfo->myDim);
460 myConn.resize(theConnectivities.size());
461 for(TInt anId = 0, anEnd = myConn.size(); anId < anEnd; anId++){
462 myConn[anId] = theConnectivities[anId];
468 //---------------------------------------------------------------
469 template<TInt nPNOM, TInt nDESC, TInt nIDENT, TInt nNOM, TInt nLNOM>
470 struct TTFieldInfo: TFieldInfo, TTNameInfo<nPNOM,nDESC,nIDENT,nNOM,nLNOM>
472 typedef TTNameInfo<nPNOM,nDESC,nIDENT,nNOM,nLNOM> TNameInfoBase;
474 TTFieldInfo(const PMeshInfo& theMeshInfo, const PFieldInfo& theInfo):
475 TNameInfoBase(theInfo->GetName())
477 myMeshInfo = theMeshInfo;
479 myNbComp = theInfo->GetNbComp();
480 myCompNames.resize(myNbComp*nPNOM+1);
481 for(TInt anId = 0; anId < myNbComp; anId++){
482 SetCompName(anId,theInfo->GetCompName(anId));
485 myUnitNames.resize(myNbComp*nPNOM+1);
486 for(TInt anId = 0; anId < myNbComp; anId++){
487 SetUnitName(anId,theInfo->GetUnitName(anId));
490 myType = theInfo->GetType();
492 myIsLocal = theInfo->GetIsLocal();
493 myNbRef = theInfo->GetNbRef();
496 TTFieldInfo(const PMeshInfo& theMeshInfo,
498 ETypeChamp theType = eFLOAT64,
499 const std::string& theValue = "",
500 EBooleen theIsLocal = eVRAI,
502 TNameInfoBase(theValue)
504 myMeshInfo = theMeshInfo;
506 myNbComp = theNbComp;
507 myCompNames.resize(theNbComp*nPNOM+1);
508 myUnitNames.resize(theNbComp*nPNOM+1);
512 myIsLocal = theIsLocal;
516 virtual std::string GetCompName(TInt theId) const {
517 return GetString(theId,nPNOM,myCompNames);
520 virtual void SetCompName(TInt theId, const std::string& theValue){
521 SetString(theId,nPNOM,myCompNames,theValue);
524 virtual std::string GetUnitName(TInt theId) const {
525 return GetString(theId,nPNOM,myUnitNames);
528 virtual void SetUnitName(TInt theId, const std::string& theValue){
529 SetString(theId,nPNOM,myUnitNames,theValue);
534 //---------------------------------------------------------------
535 template<TInt nPNOM, TInt nDESC, TInt nIDENT, TInt nNOM, TInt nLNOM>
536 struct TTTimeStampInfo: TTimeStampInfo
538 TTTimeStampInfo(const PFieldInfo& theFieldInfo, const PTimeStampInfo& theInfo)
540 myFieldInfo = theFieldInfo;
542 myEntity = theInfo->GetEntity();
543 myGeom = theInfo->GetGeom();
545 myNbGauss = theInfo->GetNbGauss();
546 myNumDt = theInfo->GetNumDt();
547 myNumOrd = theInfo->GetNumOrd();
548 myDt = theInfo->GetDt();
550 myUnitDt.resize(nPNOM+1);
551 SetUnitDt(theInfo->GetUnitDt());
553 myGaussName.resize(nNOM+1);
554 SetGaussName(theInfo->GetGaussName());
557 TTTimeStampInfo(const PFieldInfo& theFieldInfo,
558 EEntiteMaillage theEntity,
559 const TGeom& theGeom,
564 const std::string& theUnitDt = "",
565 const std::string& theGaussName = "")
567 myFieldInfo = theFieldInfo;
569 myEntity = theEntity;
572 myNbGauss = theNbGauss;
577 myUnitDt.resize(nPNOM+1);
578 SetUnitDt(theUnitDt);
580 myGaussName.resize(nNOM+1);
581 SetGaussName(theGaussName);
584 virtual std::string GetGaussName() const {
585 return GetString(0,nNOM,myGaussName);
588 virtual void SetGaussName(const std::string& theValue){
589 SetString(0,nNOM,myGaussName,theValue);
592 virtual std::string GetUnitDt() const {
593 return GetString(0,nPNOM,myUnitDt);
596 virtual void SetUnitDt(const std::string& theValue){
597 SetString(0,nPNOM,myUnitDt,theValue);
602 //---------------------------------------------------------------
603 template<TInt nPNOM, TInt nDESC, TInt nIDENT, TInt nNOM, TInt nLNOM>
604 struct TTTimeStampVal: TTimeStampVal
606 TTTimeStampVal(const PTimeStampInfo& theTimeStampInfo, const PTimeStampVal& theInfo)
608 myTimeStampInfo = theTimeStampInfo;
610 myPflMode = theInfo->GetPflMode();
612 myPflName.resize(nNOM+1);
613 SetPflName(theInfo->GetPflName());
615 TInt aNbComp = theTimeStampInfo->GetFieldInfo()->GetNbComp();
616 const TGeom& aTGeom = theTimeStampInfo->GetGeom();
617 TInt aNbGauss = theTimeStampInfo->GetNbGauss();
618 TGeom::const_iterator anIter = aTGeom.begin();
619 for(; anIter != aTGeom.end(); anIter++){
620 const EGeometrieElement& aGeom = anIter->first;
621 TInt aNbElem = anIter->second;
622 TInt aSize = aNbElem*aNbComp*aNbGauss;
623 TValue& aValue = myMeshValue[aGeom];
624 aValue.resize(aSize);
625 for(TInt anElemId = 0; anElemId < aNbElem; anElemId++){
626 for(TInt aCompId = 0; aCompId < aNbComp; aCompId++){
627 for(TInt aGaussId = 0; aGaussId < aNbGauss; aGaussId++){
628 SetVal(aGeom,anElemId,aCompId,theInfo->GetVal(aGeom,anElemId,aCompId,aGaussId),aGaussId);
635 TTTimeStampVal(const PTimeStampInfo& theTimeStampInfo,
636 const std::string& thePflName = "",
637 EModeProfil thePflMode = eCOMPACT)
639 myTimeStampInfo = theTimeStampInfo;
641 myPflMode = thePflMode;
643 myPflName.resize(nNOM+1);
644 SetPflName(thePflName);
646 TInt aNbComp = theTimeStampInfo->myFieldInfo->myNbComp;
647 TInt aNbGauss = theTimeStampInfo->myNbGauss;
648 const TGeom& aTGeom = theTimeStampInfo->myGeom;
649 TGeom::const_iterator anIter = aTGeom.begin();
650 for(; anIter != aTGeom.end(); anIter++){
651 const EGeometrieElement& aGeom = anIter->first;
652 TInt aNb = anIter->second*aNbComp*aNbGauss;
653 myMeshValue[aGeom].resize(aNb);
657 virtual std::string GetPflName() const {
658 return GetString(0,nNOM,myPflName);
661 virtual void SetPflName(const std::string& theValue){
662 SetString(0,nNOM,myPflName,theValue);