1 // Copyright (C) 2007-2014 CEA/DEN, EDF R&D, OPEN CASCADE
3 // Copyright (C) 2003-2007 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, or (at your option) any later version.
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.salome-platform.org/ or email : webmaster.salome@opencascade.com
22 #ifndef MED_TStructures_HeaderFile
23 #define MED_TStructures_HeaderFile
25 #include "MED_Structures.hxx"
28 #pragma warning(disable:4250)
33 //---------------------------------------------------------------
34 //! To provide a common way to handle values of MEDWrapper types as native MED types
35 template<class TValue, class TRepresentation>
39 TRepresentation myRepresentation;
41 TValueHolder(TValue& theValue):
43 myRepresentation(TRepresentation(theValue))
48 myValue = TValue(myRepresentation);
54 return &myRepresentation;
57 operator TRepresentation () const
59 return myRepresentation;
69 //! To customize TValueHolder common template definition for TVector
70 template<class TVal, class TRepresentation>
71 struct TValueHolder<TVector<TVal>, TRepresentation>
73 typedef TVector<TVal> TValue;
75 TRepresentation* myRepresentation;
77 TValueHolder(TValue& theValue):
81 myRepresentation = (TRepresentation*)NULL;
83 myRepresentation = (TRepresentation*)&theValue[0];
89 return myRepresentation;
93 //---------------------------------------------------------------
94 template<EVersion eVersion>
95 struct TTNameInfo: virtual TNameInfo
97 TTNameInfo(const std::string& theValue)
99 myName.resize(GetNOMLength<eVersion>()+1);
107 return GetString(0, GetNOMLength<eVersion>(), myName);
112 SetName(const std::string& theValue)
114 SetString(0, GetNOMLength<eVersion>(), myName, theValue);
119 SetName(const TString& theValue)
121 SetString(0, GetNOMLength<eVersion>(), myName, theValue);
126 //---------------------------------------------------------------
127 template<EVersion eVersion>
130 virtual TTNameInfo<eVersion>
132 typedef TTNameInfo<eVersion> TNameInfoBase;
134 TTMeshInfo(const PMeshInfo& theInfo):
135 TNameInfoBase(theInfo->GetName())
137 myDim = theInfo->GetDim();
138 mySpaceDim = theInfo->GetSpaceDim();
139 myType = theInfo->GetType();
141 myDesc.resize(GetDESCLength<eVersion>()+1);
142 SetDesc(theInfo->GetDesc());
145 TTMeshInfo(TInt theDim, TInt theSpaceDim,
146 const std::string& theValue,
148 const std::string& theDesc):
149 TNameInfoBase(theValue)
152 mySpaceDim = theSpaceDim;
155 myDesc.resize(GetDESCLength<eVersion>()+1);
163 return GetString(0, GetDESCLength<eVersion>(), myDesc);
168 SetDesc(const std::string& theValue)
170 SetString(0, GetDESCLength<eVersion>(), myDesc, theValue);
175 //---------------------------------------------------------------
176 template<EVersion eVersion>
179 virtual TTNameInfo<eVersion>
181 typedef TTNameInfo<eVersion> TNameInfoBase;
183 TTFamilyInfo(const PMeshInfo& theMeshInfo, const PFamilyInfo& theInfo):
184 TNameInfoBase(theInfo->GetName())
186 myMeshInfo = theMeshInfo;
188 myId = theInfo->GetId();
190 myNbGroup = theInfo->GetNbGroup();
191 myGroupNames.resize(myNbGroup*GetLNOMLength<eVersion>()+1);
193 for(TInt anId = 0; anId < myNbGroup; anId++){
194 SetGroupName(anId,theInfo->GetGroupName(anId));
198 myNbAttr = theInfo->GetNbAttr();
199 myAttrId.resize(myNbAttr);
200 myAttrVal.resize(myNbAttr);
201 myAttrDesc.resize(myNbAttr*GetDESCLength<eVersion>()+1);
203 for(TInt anId = 0; anId < myNbAttr; anId++){
204 SetAttrDesc(anId,theInfo->GetAttrDesc(anId));
205 myAttrVal[anId] = theInfo->GetAttrVal(anId);
206 myAttrId[anId] = theInfo->GetAttrId(anId);
211 TTFamilyInfo(const PMeshInfo& theMeshInfo,
215 const std::string& theValue):
216 TNameInfoBase(theValue)
218 myMeshInfo = theMeshInfo;
222 myNbGroup = theNbGroup;
223 myGroupNames.resize(theNbGroup*GetLNOMLength<eVersion>()+1);
225 myNbAttr = theNbAttr;
226 myAttrId.resize(theNbAttr);
227 myAttrVal.resize(theNbAttr);
228 myAttrDesc.resize(theNbAttr*GetDESCLength<eVersion>()+1);
231 TTFamilyInfo(const PMeshInfo& theMeshInfo,
232 const std::string& theValue,
234 const TStringSet& theGroupNames,
235 const TStringVector& theAttrDescs,
236 const TIntVector& theAttrIds,
237 const TIntVector& theAttrVals):
238 TNameInfoBase(theValue)
240 myMeshInfo = theMeshInfo;
244 myNbGroup = (TInt)theGroupNames.size();
245 myGroupNames.resize(myNbGroup*GetLNOMLength<eVersion>()+1);
247 TStringSet::const_iterator anIter = theGroupNames.begin();
248 for(TInt anId = 0; anIter != theGroupNames.end(); anIter++, anId++){
249 const std::string& aVal = *anIter;
250 SetGroupName(anId,aVal);
254 myNbAttr = (TInt)theAttrDescs.size();
255 myAttrId.resize(myNbAttr);
256 myAttrVal.resize(myNbAttr);
257 myAttrDesc.resize(myNbAttr*GetDESCLength<eVersion>()+1);
259 for(TInt anId = 0, anEnd = (TInt)theAttrDescs.size(); anId < anEnd; anId++){
260 SetAttrDesc(anId,theAttrDescs[anId]);
261 myAttrVal[anId] = theAttrVals[anId];
262 myAttrId[anId] = theAttrIds[anId];
269 GetGroupName(TInt theId) const
271 return GetString(theId, GetLNOMLength<eVersion>(), myGroupNames);
276 SetGroupName(TInt theId, const std::string& theValue)
278 SetString(theId, GetLNOMLength<eVersion>(), myGroupNames, theValue);
283 GetAttrDesc(TInt theId) const
285 return GetString(theId, GetDESCLength<eVersion>(), myAttrDesc);
290 SetAttrDesc(TInt theId, const std::string& theValue)
292 SetString(theId, GetDESCLength<eVersion>(), myAttrDesc, theValue);
297 //---------------------------------------------------------------
298 template<EVersion eVersion>
299 struct TTElemInfo: virtual TElemInfo
301 TTElemInfo(const PMeshInfo& theMeshInfo, const PElemInfo& theInfo)
303 myMeshInfo = theMeshInfo;
305 myNbElem = theInfo->GetNbElem();
306 myFamNum.reset(new TElemNum(myNbElem));
307 myIsFamNum = eFAUX; // is set to eVRAI in SetFamNum()
309 myIsElemNum = theInfo->IsElemNum();
310 if(theInfo->IsElemNum())
311 myElemNum.reset(new TElemNum(myNbElem));
313 myElemNum.reset(new TElemNum());
315 myIsElemNames = theInfo->IsElemNames();
316 if(theInfo->IsElemNames())
317 myElemNames.reset(new TString(myNbElem*GetPNOMLength<eVersion>() + 1));
319 myElemNames.reset(new TString());
321 if(theInfo->GetNbElem()){
322 for(TInt anId = 0; anId < myNbElem; anId++){
323 SetFamNum(anId, theInfo->GetFamNum(anId));
325 if(theInfo->IsElemNum() == eVRAI){
326 for(TInt anId = 0; anId < myNbElem; anId++){
327 SetElemNum(anId, theInfo->GetElemNum(anId));
330 if(theInfo->IsElemNames() == eVRAI){
331 for(TInt anId = 0; anId < myNbElem; anId++){
332 SetElemName(anId,theInfo->GetElemName(anId));
338 TTElemInfo(const PMeshInfo& theMeshInfo,
340 EBooleen theIsElemNum,
341 EBooleen theIsElemNames)
343 myMeshInfo = theMeshInfo;
345 myNbElem = theNbElem;
346 myFamNum.reset(new TElemNum(theNbElem));
347 myIsFamNum = eFAUX; // is set to eVRAI in SetFamNum()
349 myIsElemNum = theIsElemNum;
351 myElemNum.reset(new TElemNum(theNbElem));
353 myElemNum.reset(new TElemNum());
355 myIsElemNames = theIsElemNames;
357 myElemNames.reset(new TString(theNbElem*GetPNOMLength<eVersion>() + 1));
359 myElemNames.reset(new TString());
362 TTElemInfo(const PMeshInfo& theMeshInfo,
364 const TIntVector& theFamilyNums,
365 const TIntVector& theElemNums,
366 const TStringVector& theElemNames)
368 myMeshInfo = theMeshInfo;
370 myNbElem = theNbElem;
371 myFamNum.reset(new TElemNum(theNbElem));
372 myIsFamNum = eFAUX; // is set to eVRAI in SetFamNum()
374 myIsElemNum = theElemNums.size()? eVRAI: eFAUX;
376 myElemNum.reset(new TElemNum(theNbElem));
378 myElemNum.reset(new TElemNum());
380 myIsElemNames = theElemNames.size()? eVRAI: eFAUX;
382 myElemNames.reset(new TString(theNbElem*GetPNOMLength<eVersion>() + 1));
384 myElemNames.reset(new TString());
388 if(theFamilyNums.size())
389 *myFamNum = theFamilyNums;
392 *myElemNum = theElemNums;
395 for(TInt anId = 0; anId < theNbElem; anId++){
396 const std::string& aVal = theElemNames[anId];
397 SetElemName(anId,aVal);
405 GetElemName(TInt theId) const
407 return GetString(theId,GetPNOMLength<eVersion>(), *myElemNames);
412 SetElemName(TInt theId, const std::string& theValue)
414 SetString(theId,GetPNOMLength<eVersion>(), *myElemNames, theValue);
419 //---------------------------------------------------------------
420 template<EVersion eVersion>
423 virtual TTElemInfo<eVersion>
425 typedef TTElemInfo<eVersion> TElemInfoBase;
427 TTNodeInfo(const PMeshInfo& theMeshInfo, const PNodeInfo& theInfo):
429 TElemInfoBase(theMeshInfo, theInfo)
431 myModeSwitch = theInfo->GetModeSwitch();
433 mySystem = theInfo->GetSystem();
435 myCoord.reset(new TNodeCoord(*theInfo->myCoord));
437 TInt aSpaceDim = theMeshInfo->GetSpaceDim();
439 myCoordNames.resize(aSpaceDim*GetPNOMLength<eVersion>()+1);
440 for(TInt anId = 0; anId < aSpaceDim; anId++)
441 SetCoordName(anId,theInfo->GetCoordName(anId));
443 myCoordUnits.resize(aSpaceDim*GetPNOMLength<eVersion>()+1);
444 for(TInt anId = 0; anId < aSpaceDim; anId++)
445 SetCoordUnit(anId,theInfo->GetCoordUnit(anId));
448 TTNodeInfo(const PMeshInfo& theMeshInfo,
452 EBooleen theIsElemNum,
453 EBooleen theIsElemNames):
454 TModeSwitchInfo(theMode),
455 TElemInfoBase(theMeshInfo,
460 mySystem = theSystem;
462 myCoord.reset(new TNodeCoord(theNbElem * theMeshInfo->mySpaceDim));
464 myCoordUnits.resize(theMeshInfo->mySpaceDim*GetPNOMLength<eVersion>()+1);
466 myCoordNames.resize(theMeshInfo->mySpaceDim*GetPNOMLength<eVersion>()+1);
470 TTNodeInfo(const PMeshInfo& theMeshInfo,
471 const TFloatVector& theNodeCoords,
474 const TStringVector& theCoordNames,
475 const TStringVector& theCoordUnits,
476 const TIntVector& theFamilyNums,
477 const TIntVector& theElemNums,
478 const TStringVector& theElemNames):
479 TModeSwitchInfo(theMode),
480 TElemInfoBase(theMeshInfo,
481 (TInt)theNodeCoords.size()/theMeshInfo->GetDim(),
486 mySystem = theSystem;
488 myCoord.reset(new TNodeCoord(theNodeCoords));
490 TInt aSpaceDim = theMeshInfo->GetSpaceDim();
492 myCoordNames.resize(aSpaceDim*GetPNOMLength<eVersion>()+1);
493 if(!theCoordNames.empty())
494 for(TInt anId = 0; anId < aSpaceDim; anId++)
495 SetCoordName(anId,theCoordNames[anId]);
497 myCoordUnits.resize(aSpaceDim*GetPNOMLength<eVersion>() + 1);
498 if(!theCoordUnits.empty())
499 for(TInt anId = 0; anId < aSpaceDim; anId++)
500 SetCoordUnit(anId, theCoordUnits[anId]);
505 GetCoordName(TInt theId) const
507 return GetString(theId,GetPNOMLength<eVersion>(),myCoordNames);
512 SetCoordName(TInt theId, const std::string& theValue)
514 SetString(theId,GetPNOMLength<eVersion>(),myCoordNames,theValue);
519 GetCoordUnit(TInt theId) const
521 return GetString(theId,GetPNOMLength<eVersion>(),myCoordUnits);
526 SetCoordUnit(TInt theId, const std::string& theValue)
528 SetString(theId,GetPNOMLength<eVersion>(),myCoordUnits,theValue);
532 //---------------------------------------------------------------
533 template<EVersion eVersion>
534 struct TTPolygoneInfo:
535 virtual TPolygoneInfo,
536 virtual TTElemInfo<eVersion>
538 typedef TTElemInfo<eVersion> TElemInfoBase;
540 TTPolygoneInfo(const PMeshInfo& theMeshInfo, const PPolygoneInfo& theInfo):
541 TElemInfoBase(theMeshInfo,theInfo)
543 myEntity = theInfo->GetEntity();
544 myGeom = theInfo->GetGeom();
546 myIndex.reset(new TElemNum(*theInfo->myIndex));
547 myConn.reset(new TElemNum(*theInfo->myConn));
549 myConnMode = theInfo->GetConnMode();
552 TTPolygoneInfo(const PMeshInfo& theMeshInfo,
553 EEntiteMaillage theEntity,
554 EGeometrieElement theGeom,
557 EConnectivite theConnMode,
558 EBooleen theIsElemNum,
559 EBooleen theIsElemNames):
560 TElemInfoBase(theMeshInfo,
565 myEntity = theEntity;
568 myIndex.reset(new TElemNum(theNbElem + 1));
569 myConn.reset(new TElemNum(theConnSize));
571 myConnMode = theConnMode;
574 TTPolygoneInfo(const PMeshInfo& theMeshInfo,
575 EEntiteMaillage theEntity,
576 EGeometrieElement theGeom,
577 const TIntVector& theIndexes,
578 const TIntVector& theConnectivities,
579 EConnectivite theConnMode,
580 const TIntVector& theFamilyNums,
581 const TIntVector& theElemNums,
582 const TStringVector& theElemNames):
583 TElemInfoBase(theMeshInfo,
584 (TInt)theIndexes.size() - 1,
589 myEntity = theEntity;
592 myIndex.reset(new TElemNum(theIndexes));
593 myConn.reset(new TElemNum(theConnectivities));
595 myConnMode = theConnMode;
599 //---------------------------------------------------------------
600 template<EVersion eVersion>
601 struct TTPolyedreInfo:
602 virtual TPolyedreInfo,
603 virtual TTElemInfo<eVersion>
605 typedef TTElemInfo<eVersion> TElemInfoBase;
607 TTPolyedreInfo(const PMeshInfo& theMeshInfo, const PPolyedreInfo& theInfo):
608 TElemInfoBase(theMeshInfo,theInfo)
610 myEntity = theInfo->GetEntity();
611 myGeom = theInfo->GetGeom();
613 myIndex.reset(new TElemNum(*theInfo->myIndex));
614 myFaces.reset(new TElemNum(*theInfo->myFaces));
615 myConn.reset(new TElemNum(*theInfo->myConn));
617 myConnMode = theInfo->GetConnMode();
620 TTPolyedreInfo(const PMeshInfo& theMeshInfo,
621 EEntiteMaillage theEntity,
622 EGeometrieElement theGeom,
626 EConnectivite theConnMode,
627 EBooleen theIsElemNum,
628 EBooleen theIsElemNames):
629 TElemInfoBase(theMeshInfo,
634 myEntity = theEntity;
637 myIndex.reset(new TElemNum(theNbElem + 1));
638 myFaces.reset(new TElemNum(theNbFaces));
639 myConn.reset(new TElemNum(theConnSize));
641 myConnMode = theConnMode;
644 TTPolyedreInfo(const PMeshInfo& theMeshInfo,
645 EEntiteMaillage theEntity,
646 EGeometrieElement theGeom,
647 const TIntVector& theIndexes,
648 const TIntVector& theFaces,
649 const TIntVector& theConnectivities,
650 EConnectivite theConnMode,
651 const TIntVector& theFamilyNums,
652 const TIntVector& theElemNums,
653 const TStringVector& theElemNames):
654 TElemInfoBase(theMeshInfo,
655 (TInt)theIndexes.size()-1,
660 myEntity = theEntity;
663 myIndex.reset(new TElemNum(theIndexes));
664 myFaces.reset(new TElemNum(theFaces));
665 myConn.reset(new TElemNum(theConnectivities));
667 myConnMode = theConnMode;
671 //---------------------------------------------------------------
672 template<EVersion eVersion>
675 virtual TTElemInfo<eVersion>
677 typedef TTElemInfo<eVersion> TElemInfoBase;
679 TTCellInfo(const PMeshInfo& theMeshInfo, const PCellInfo& theInfo):
680 TElemInfoBase(theMeshInfo,theInfo)
682 myEntity = theInfo->GetEntity();
683 myGeom = theInfo->GetGeom();
684 myConnMode = theInfo->GetConnMode();
686 TInt aConnDim = GetNbNodes(myGeom);
687 TInt aNbConn = GetNbConn<eVersion>(myGeom, myEntity, myMeshInfo->myDim);
688 myConn.reset(new TElemNum(myNbElem * aNbConn));
689 for(TInt anElemId = 0; anElemId < myNbElem; anElemId++){
690 TConnSlice aConnSlice = GetConnSlice(anElemId);
691 TCConnSlice aConnSlice2 = theInfo->GetConnSlice(anElemId);
692 for(TInt anConnId = 0; anConnId < aConnDim; anConnId++){
693 aConnSlice[anConnId] = aConnSlice2[anConnId];
698 TTCellInfo(const PMeshInfo& theMeshInfo,
699 EEntiteMaillage theEntity,
700 EGeometrieElement theGeom,
702 EConnectivite theConnMode,
703 EBooleen theIsElemNum,
704 EBooleen theIsElemNames,
705 EModeSwitch theMode):
706 TModeSwitchInfo(theMode),
707 TElemInfoBase(theMeshInfo,
712 myEntity = theEntity;
715 myConnMode = theConnMode;
716 TInt aNbConn = GetNbConn<eVersion>(theGeom, myEntity, theMeshInfo->myDim);
717 myConn.reset(new TElemNum(theNbElem * aNbConn));
720 TTCellInfo(const PMeshInfo& theMeshInfo,
721 EEntiteMaillage theEntity,
722 EGeometrieElement theGeom,
723 const TIntVector& theConnectivities,
724 EConnectivite theConnMode,
725 const TIntVector& theFamilyNums,
726 const TIntVector& theElemNums,
727 const TStringVector& theElemNames,
728 EModeSwitch theMode):
729 TModeSwitchInfo(theMode),
730 TElemInfoBase(theMeshInfo,
731 (TInt)theConnectivities.size() / GetNbNodes(theGeom),
736 myEntity = theEntity;
739 myConnMode = theConnMode;
740 TInt aConnDim = GetNbNodes(myGeom);
741 TInt aNbConn = GetNbConn<eVersion>(myGeom, myEntity, myMeshInfo->myDim);
742 myConn.reset(new TElemNum(myNbElem * aNbConn));
743 for(TInt anElemId = 0; anElemId < myNbElem; anElemId++){
744 TConnSlice aConnSlice = GetConnSlice(anElemId);
745 for(TInt anConnId = 0; anConnId < aConnDim; anConnId++){
746 aConnSlice[anConnId] = theConnectivities[anElemId*aConnDim + anConnId];
755 return GetNbConn<eVersion>(myGeom, myEntity, myMeshInfo->myDim);
760 //---------------------------------------------------------------
761 template<EVersion eVersion>
764 virtual TTCellInfo<eVersion>
766 typedef TTCellInfo<eVersion> TCellInfoBase;
768 TTBallInfo(const PMeshInfo& theMeshInfo, const PBallInfo& theInfo):
769 TCellInfoBase::TElemInfoBase(theMeshInfo, theInfo),
770 TCellInfoBase(theMeshInfo,theInfo)
772 myDiameters = theInfo->myDiameters;
775 TTBallInfo(const PMeshInfo& theMeshInfo,
777 EBooleen theIsElemNum ):
778 TCellInfoBase::TElemInfoBase(theMeshInfo,
781 /*theIsElemNames=*/eFAUX),
782 TCellInfoBase(theMeshInfo,
786 /*EConnectivite=*/eNOD,
788 /*theIsElemNames=*/eFAUX,
791 myDiameters.resize( theNbElem );
794 TTBallInfo(const PMeshInfo& theMeshInfo,
795 const TIntVector& theNodes,
796 TFloatVector& theDiameters,
797 const TIntVector& theFamilyNums,
798 const TIntVector& theElemNums):
799 TCellInfoBase::TElemInfoBase(theMeshInfo,
800 (TInt)std::max(theNodes.size(),theDiameters.size() ),
804 TCellInfoBase(theMeshInfo,
808 /*EConnectivite=*/eNOD,
814 myDiameters.swap( theDiameters );
818 //---------------------------------------------------------------
819 template<EVersion eVersion>
822 virtual TTNameInfo<eVersion>
824 typedef TTNameInfo<eVersion> TNameInfoBase;
826 TTFieldInfo(const PMeshInfo& theMeshInfo, const PFieldInfo& theInfo):
827 TNameInfoBase(theInfo->GetName())
829 myMeshInfo = theMeshInfo;
831 myNbComp = theInfo->GetNbComp();
832 myCompNames.resize(myNbComp*GetPNOMLength<eVersion>()+1);
833 for(TInt anId = 0; anId < myNbComp; anId++){
834 SetCompName(anId,theInfo->GetCompName(anId));
837 myUnitNames.resize(myNbComp*GetPNOMLength<eVersion>()+1);
838 for(TInt anId = 0; anId < myNbComp; anId++){
839 SetUnitName(anId,theInfo->GetUnitName(anId));
842 myType = theInfo->GetType();
844 myIsLocal = theInfo->GetIsLocal();
845 myNbRef = theInfo->GetNbRef();
848 TTFieldInfo(const PMeshInfo& theMeshInfo,
851 const std::string& theValue,
854 TNameInfoBase(theValue)
856 myMeshInfo = theMeshInfo;
858 myNbComp = theNbComp;
859 myCompNames.resize(theNbComp*GetPNOMLength<eVersion>()+1);
860 myUnitNames.resize(theNbComp*GetPNOMLength<eVersion>()+1);
864 myIsLocal = theIsLocal;
870 GetCompName(TInt theId) const
872 return GetString(theId,GetPNOMLength<eVersion>(),myCompNames);
877 SetCompName(TInt theId, const std::string& theValue)
879 SetString(theId,GetPNOMLength<eVersion>(),myCompNames,theValue);
884 GetUnitName(TInt theId) const
886 return GetString(theId,GetPNOMLength<eVersion>(),myUnitNames);
891 SetUnitName(TInt theId, const std::string& theValue)
893 SetString(theId,GetPNOMLength<eVersion>(),myUnitNames,theValue);
898 //---------------------------------------------------------------
899 template<EVersion eVersion>
902 virtual TTNameInfo<eVersion>
904 typedef TTNameInfo<eVersion> TNameInfoBase;
906 TTGaussInfo(const TGaussInfo::TInfo& theInfo,
907 EModeSwitch theMode):
908 TModeSwitchInfo(theMode),
909 TNameInfoBase(boost::get<1>(boost::get<0>(theInfo)))
911 const TGaussInfo::TKey& aKey = boost::get<0>(theInfo);
913 myGeom = boost::get<0>(aKey);
914 myRefCoord.resize(GetNbRef()*GetDim());
916 TInt aNbGauss = boost::get<1>(theInfo);
917 myGaussCoord.resize(aNbGauss*GetDim());
918 myWeight.resize(aNbGauss);
923 //---------------------------------------------------------------
924 template<EVersion eVersion>
925 struct TTTimeStampInfo: virtual TTimeStampInfo
927 TTTimeStampInfo(const PFieldInfo& theFieldInfo, const PTimeStampInfo& theInfo)
929 myFieldInfo = theFieldInfo;
931 myEntity = theInfo->GetEntity();
932 myGeom2Size = theInfo->GetGeom2Size();
934 myNumDt = theInfo->GetNumDt();
935 myNumOrd = theInfo->GetNumOrd();
936 myDt = theInfo->GetDt();
938 myUnitDt.resize(GetPNOMLength<eVersion>()+1);
939 SetUnitDt(theInfo->GetUnitDt());
941 myGeom2NbGauss = theInfo->myGeom2NbGauss;
942 myGeom2Gauss = theInfo->GetGeom2Gauss();
945 TTTimeStampInfo(const PFieldInfo& theFieldInfo,
946 EEntiteMaillage theEntity,
947 const TGeom2Size& theGeom2Size,
948 const TGeom2NbGauss& theGeom2NbGauss,
952 const std::string& theUnitDt,
953 const TGeom2Gauss& theGeom2Gauss)
955 myFieldInfo = theFieldInfo;
957 myEntity = theEntity;
958 myGeom2Size = theGeom2Size;
964 myUnitDt.resize(GetPNOMLength<eVersion>()+1);
965 SetUnitDt(theUnitDt);
967 myGeom2NbGauss = theGeom2NbGauss;
968 myGeom2Gauss = theGeom2Gauss;
975 return GetString(0,GetPNOMLength<eVersion>(),myUnitDt);
980 SetUnitDt(const std::string& theValue)
982 SetString(0,GetPNOMLength<eVersion>(),myUnitDt,theValue);
987 //---------------------------------------------------------------
988 template<EVersion eVersion>
989 struct TTProfileInfo:
990 virtual TProfileInfo,
991 virtual TTNameInfo<eVersion>
993 typedef TTNameInfo<eVersion> TNameInfoBase;
995 TTProfileInfo(const TProfileInfo::TInfo& theInfo,
996 EModeProfil theMode):
997 TNameInfoBase(boost::get<0>(theInfo))
999 TInt aSize = boost::get<1>(theInfo);
1000 myElemNum.reset(new TElemNum(aSize));
1001 myMode = aSize > 0? theMode: eNO_PFLMOD;
1006 //---------------------------------------------------------------
1007 template<EVersion eVersion, class TMeshValueType>
1008 struct TTTimeStampValue: virtual TTimeStampValue<TMeshValueType>
1010 TTTimeStampValue(const PTimeStampInfo& theTimeStampInfo,
1011 const PTimeStampValueBase& theInfo,
1012 ETypeChamp theTypeChamp)
1014 typedef TTimeStampValue<TMeshValueType> TCompatible;
1015 if(TCompatible* aCompatible = dynamic_cast<TCompatible*>(theInfo.get())){
1016 this->myTimeStampInfo = theTimeStampInfo;
1017 this->myTypeChamp = theTypeChamp;
1018 this->myGeom2Profile = aCompatible->GetGeom2Profile();
1019 this->myGeom2Value = aCompatible->myGeom2Value;
1020 this->myGeomSet = aCompatible->GetGeomSet();
1022 EXCEPTION(std::runtime_error,"TTTimeStampValue::TTTimeStampValue - use incompatible arguments!");
1025 TTTimeStampValue(const PTimeStampInfo& theTimeStampInfo,
1026 ETypeChamp theTypeChamp,
1027 const TGeom2Profile& theGeom2Profile,
1028 EModeSwitch theMode):
1029 TModeSwitchInfo(theMode)
1031 this->myTimeStampInfo = theTimeStampInfo;
1033 this->myTypeChamp = theTypeChamp;
1035 this->myGeom2Profile = theGeom2Profile;
1037 TInt aNbComp = theTimeStampInfo->myFieldInfo->myNbComp;
1039 const TGeom2Size& aGeom2Size = theTimeStampInfo->GetGeom2Size();
1040 TGeom2Size::const_iterator anIter = aGeom2Size.begin();
1041 for(; anIter != aGeom2Size.end(); anIter++){
1042 const EGeometrieElement& aGeom = anIter->first;
1043 TInt aNbElem = anIter->second;
1045 MED::PProfileInfo aProfileInfo;
1046 MED::TGeom2Profile::const_iterator anIter = theGeom2Profile.find(aGeom);
1047 if(anIter != theGeom2Profile.end())
1048 aProfileInfo = anIter->second;
1050 if(aProfileInfo && aProfileInfo->IsPresent())
1051 aNbElem = aProfileInfo->GetSize();
1053 TInt aNbGauss = theTimeStampInfo->GetNbGauss(aGeom);
1055 this->GetMeshValue(aGeom).Allocate(aNbElem,aNbGauss,aNbComp);
1061 GetValueSize(EGeometrieElement theGeom) const
1063 return this->GetMeshValue(theGeom).GetSize();
1068 GetNbVal(EGeometrieElement theGeom) const
1070 return this->GetMeshValue(theGeom).GetNbVal();
1075 GetNbGauss(EGeometrieElement theGeom) const
1077 return this->GetMeshValue(theGeom).GetNbGauss();
1082 AllocateValue(EGeometrieElement theGeom,
1086 EModeSwitch theMode = eFULL_INTERLACE)
1088 this->GetMeshValue(theGeom).Allocate(theNbElem,theNbGauss,theNbComp,theMode);
1093 GetValuePtr(EGeometrieElement theGeom)
1095 return this->GetMeshValue(theGeom).GetValuePtr();
1099 //---------------------------------------------------------------
1100 template<EVersion eVersion>
1101 struct TTGrilleInfo:
1104 TTGrilleInfo(const PMeshInfo& theMeshInfo,
1105 const PGrilleInfo& theInfo)
1107 myMeshInfo = theMeshInfo;
1109 myCoord = theInfo->GetNodeCoord();
1111 myGrilleType = theInfo->GetGrilleType();
1113 myCoordNames = theInfo->myCoordNames;
1115 myCoordUnits = theInfo->myCoordUnits;
1117 myIndixes = theInfo->GetMapOfIndexes();
1119 myGrilleStructure = theInfo->GetGrilleStructure();
1121 myGrilleType = theInfo->GetGrilleType();
1123 myFamNumNode.resize(theInfo->GetNbNodes());
1124 myFamNumNode = theInfo->myFamNumNode;
1126 myFamNum = theInfo->myFamNum;
1129 TTGrilleInfo(const PMeshInfo& theMeshInfo,
1130 const EGrilleType& type,
1133 myMeshInfo = theMeshInfo;
1134 TInt aSpaceDim = theMeshInfo->GetSpaceDim();
1135 if(type == eGRILLE_STANDARD){
1136 myCoord.resize(aSpaceDim*nnoeuds);
1137 myCoordNames.resize(aSpaceDim*GetPNOMLength<eVersion>()+1);
1138 myCoordUnits.resize(aSpaceDim*GetPNOMLength<eVersion>()+1);
1139 } else { //if(type == eGRILLE_CARTESIENNE){
1140 myCoordNames.resize(aSpaceDim*GetPNOMLength<eVersion>()+aSpaceDim);
1141 myCoordUnits.resize(aSpaceDim*GetPNOMLength<eVersion>()+aSpaceDim);
1143 myGrilleStructure.resize(aSpaceDim);
1144 myFamNumNode.resize(nnoeuds);
1147 TTGrilleInfo(const PMeshInfo& theMeshInfo,
1148 const EGrilleType& type)
1150 myMeshInfo = theMeshInfo;
1151 TInt aSpaceDim = theMeshInfo->GetSpaceDim();
1152 if(type == eGRILLE_STANDARD){
1153 myCoordNames.resize(aSpaceDim*GetPNOMLength<eVersion>()+1);
1154 myCoordUnits.resize(aSpaceDim*GetPNOMLength<eVersion>()+1);
1155 } else {// if(type == eGRILLE_CARTESIENNE){
1156 myCoordNames.resize(aSpaceDim*GetPNOMLength<eVersion>()+aSpaceDim);
1157 myCoordUnits.resize(aSpaceDim*GetPNOMLength<eVersion>()+aSpaceDim);
1159 myGrilleStructure.resize(aSpaceDim);
1162 TTGrilleInfo(const PMeshInfo& theMeshInfo,
1163 const EGrilleType& type,
1164 const MED::TIntVector& nbNodeVec)
1166 myMeshInfo = theMeshInfo;
1168 TInt aSpaceDim = theMeshInfo->GetSpaceDim();
1169 if(type == eGRILLE_STANDARD){
1170 myCoordNames.resize(aSpaceDim*GetPNOMLength<eVersion>()+1);
1171 myCoordUnits.resize(aSpaceDim*GetPNOMLength<eVersion>()+1);
1172 } else {// if(type == eGRILLE_CARTESIENNE){
1173 myCoordNames.resize(aSpaceDim*GetPNOMLength<eVersion>()+aSpaceDim);
1174 myCoordUnits.resize(aSpaceDim*GetPNOMLength<eVersion>()+aSpaceDim);
1177 if(type != eGRILLE_STANDARD)
1178 for(unsigned int aAxe=0;aAxe<nbNodeVec.size();aAxe++){
1179 myIndixes[aAxe].resize(nbNodeVec[aAxe]);
1181 myGrilleStructure.resize(aSpaceDim);
1186 GetCoordName(TInt theId) const
1188 return GetString(theId,GetPNOMLength<eVersion>(),myCoordNames);
1193 SetCoordName(TInt theId, const std::string& theValue)
1195 SetString(theId,GetPNOMLength<eVersion>(),myCoordNames,theValue);
1200 GetCoordUnit(TInt theId) const
1202 return GetString(theId,GetPNOMLength<eVersion>(),myCoordUnits);
1207 SetCoordUnit(TInt theId, const std::string& theValue)
1209 SetString(theId,GetPNOMLength<eVersion>(),myCoordUnits,theValue);