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.salome-platform.org/ or email : webmaster.salome@opencascade.com
29 #ifndef MED_TStructures_HeaderFile
30 #define MED_TStructures_HeaderFile
32 #include "MED_Structures.hxx"
36 //---------------------------------------------------------------
37 //! To provide a common way to handle values of MEDWrapper types as native MED types
38 template<class TValue, class TRepresentation>
42 TRepresentation myRepresentation;
44 TValueHolder(TValue& theValue):
46 myRepresentation(TRepresentation(theValue))
51 myValue = TValue(myRepresentation);
57 return &myRepresentation;
60 operator TRepresentation () const
62 return myRepresentation;
72 //! To customize TValueHolder common template definition for TVector
73 template<class TVal, class TRepresentation>
74 struct TValueHolder<TVector<TVal>, TRepresentation>
76 typedef TVector<TVal> TValue;
78 TRepresentation* myRepresentation;
80 TValueHolder(TValue& theValue):
84 myRepresentation = (TRepresentation*)NULL;
86 myRepresentation = (TRepresentation*)&theValue[0];
92 return myRepresentation;
96 //---------------------------------------------------------------
97 template<EVersion eVersion>
98 struct TTNameInfo: virtual TNameInfo
100 TTNameInfo(const std::string& theValue)
102 myName.resize(GetNOMLength<eVersion>()+1);
110 return GetString(0, GetNOMLength<eVersion>(), myName);
115 SetName(const std::string& theValue)
117 SetString(0, GetNOMLength<eVersion>(), myName, theValue);
122 SetName(const TString& theValue)
124 SetString(0, GetNOMLength<eVersion>(), myName, theValue);
129 //---------------------------------------------------------------
130 template<EVersion eVersion>
133 virtual TTNameInfo<eVersion>
135 typedef TTNameInfo<eVersion> TNameInfoBase;
137 TTMeshInfo(const PMeshInfo& theInfo):
138 TNameInfoBase(theInfo->GetName())
140 myDim = theInfo->GetDim();
141 myType = theInfo->GetType();
143 myDesc.resize(GetDESCLength<eVersion>()+1);
144 SetDesc(theInfo->GetDesc());
147 TTMeshInfo(TInt theDim,
148 const std::string& theValue,
150 const std::string& theDesc):
151 TNameInfoBase(theValue)
156 myDesc.resize(GetDESCLength<eVersion>()+1);
164 return GetString(0, GetDESCLength<eVersion>(), myDesc);
169 SetDesc(const std::string& theValue)
171 SetString(0, GetDESCLength<eVersion>(), myDesc, theValue);
176 //---------------------------------------------------------------
177 template<EVersion eVersion>
180 virtual TTNameInfo<eVersion>
182 typedef TTNameInfo<eVersion> TNameInfoBase;
184 TTFamilyInfo(const PMeshInfo& theMeshInfo, const PFamilyInfo& theInfo):
185 TNameInfoBase(theInfo->GetName())
187 myMeshInfo = theMeshInfo;
189 myId = theInfo->GetId();
191 myNbGroup = theInfo->GetNbGroup();
192 myGroupNames.resize(myNbGroup*GetLNOMLength<eVersion>()+1);
194 for(TInt anId = 0; anId < myNbGroup; anId++){
195 SetGroupName(anId,theInfo->GetGroupName(anId));
199 myNbAttr = theInfo->GetNbAttr();
200 myAttrId.resize(myNbAttr);
201 myAttrVal.resize(myNbAttr);
202 myAttrDesc.resize(myNbAttr*GetDESCLength<eVersion>()+1);
204 for(TInt anId = 0; anId < myNbAttr; anId++){
205 SetAttrDesc(anId,theInfo->GetAttrDesc(anId));
206 myAttrVal[anId] = theInfo->GetAttrVal(anId);
207 myAttrId[anId] = theInfo->GetAttrId(anId);
212 TTFamilyInfo(const PMeshInfo& theMeshInfo,
216 const std::string& theValue):
217 TNameInfoBase(theValue)
219 myMeshInfo = theMeshInfo;
223 myNbGroup = theNbGroup;
224 myGroupNames.resize(theNbGroup*GetLNOMLength<eVersion>()+1);
226 myNbAttr = theNbAttr;
227 myAttrId.resize(theNbAttr);
228 myAttrVal.resize(theNbAttr);
229 myAttrDesc.resize(theNbAttr*GetDESCLength<eVersion>()+1);
232 TTFamilyInfo(const PMeshInfo& theMeshInfo,
233 const std::string& theValue,
235 const TStringSet& theGroupNames,
236 const TStringVector& theAttrDescs,
237 const TIntVector& theAttrIds,
238 const TIntVector& theAttrVals):
239 TNameInfoBase(theValue)
241 myMeshInfo = theMeshInfo;
245 myNbGroup = (TInt)theGroupNames.size();
246 myGroupNames.resize(myNbGroup*GetLNOMLength<eVersion>()+1);
248 TStringSet::const_iterator anIter = theGroupNames.begin();
249 for(TInt anId = 0; anIter != theGroupNames.end(); anIter++, anId++){
250 const std::string& aVal = *anIter;
251 SetGroupName(anId,aVal);
255 myNbAttr = (TInt)theAttrDescs.size();
256 myAttrId.resize(myNbAttr);
257 myAttrVal.resize(myNbAttr);
258 myAttrDesc.resize(myNbAttr*GetDESCLength<eVersion>()+1);
260 for(TInt anId = 0, anEnd = (TInt)theAttrDescs.size(); anId < anEnd; anId++){
261 SetAttrDesc(anId,theAttrDescs[anId]);
262 myAttrVal[anId] = theAttrVals[anId];
263 myAttrId[anId] = theAttrIds[anId];
270 GetGroupName(TInt theId) const
272 return GetString(theId, GetLNOMLength<eVersion>(), myGroupNames);
277 SetGroupName(TInt theId, const std::string& theValue)
279 SetString(theId, GetLNOMLength<eVersion>(), myGroupNames, theValue);
284 GetAttrDesc(TInt theId) const
286 return GetString(theId, GetDESCLength<eVersion>(), myAttrDesc);
291 SetAttrDesc(TInt theId, const std::string& theValue)
293 SetString(theId, GetDESCLength<eVersion>(), myAttrDesc, theValue);
298 //---------------------------------------------------------------
299 template<EVersion eVersion>
300 struct TTElemInfo: virtual TElemInfo
302 TTElemInfo(const PMeshInfo& theMeshInfo, const PElemInfo& theInfo)
304 myMeshInfo = theMeshInfo;
306 myNbElem = theInfo->GetNbElem();
307 myFamNum.reset(new TElemNum(myNbElem));
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));
348 myIsElemNum = theIsElemNum;
350 myElemNum.reset(new TElemNum(theNbElem));
352 myElemNum.reset(new TElemNum());
354 myIsElemNames = theIsElemNames;
356 myElemNames.reset(new TString(theNbElem*GetPNOMLength<eVersion>() + 1));
358 myElemNames.reset(new TString());
361 TTElemInfo(const PMeshInfo& theMeshInfo,
363 const TIntVector& theFamilyNums,
364 const TIntVector& theElemNums,
365 const TStringVector& theElemNames)
367 myMeshInfo = theMeshInfo;
369 myNbElem = theNbElem;
370 myFamNum.reset(new TElemNum(theNbElem));
372 myIsElemNum = theElemNums.size()? eVRAI: eFAUX;
374 myElemNum.reset(new TElemNum(theNbElem));
376 myElemNum.reset(new TElemNum());
378 myIsElemNames = theElemNames.size()? eVRAI: eFAUX;
380 myElemNames.reset(new TString(theNbElem*GetPNOMLength<eVersion>() + 1));
382 myElemNames.reset(new TString());
386 if(theFamilyNums.size())
387 *myFamNum = theFamilyNums;
390 *myElemNum = theElemNums;
393 for(TInt anId = 0; anId < theNbElem; anId++){
394 const std::string& aVal = theElemNames[anId];
395 SetElemName(anId,aVal);
403 GetElemName(TInt theId) const
405 return GetString(theId,GetPNOMLength<eVersion>(), *myElemNames);
410 SetElemName(TInt theId, const std::string& theValue)
412 SetString(theId,GetPNOMLength<eVersion>(), *myElemNames, theValue);
417 //---------------------------------------------------------------
418 template<EVersion eVersion>
421 virtual TTElemInfo<eVersion>
423 typedef TTElemInfo<eVersion> TElemInfoBase;
425 TTNodeInfo(const PMeshInfo& theMeshInfo, const PNodeInfo& theInfo):
426 TElemInfoBase(theMeshInfo, theInfo),
429 myModeSwitch = theInfo->GetModeSwitch();
431 mySystem = theInfo->GetSystem();
433 myCoord.reset(new TNodeCoord(*theInfo->myCoord));
435 TInt aDim = theMeshInfo->GetDim();
437 myCoordNames.resize(aDim*GetPNOMLength<eVersion>()+1);
438 for(TInt anId = 0; anId < aDim; anId++)
439 SetCoordName(anId,theInfo->GetCoordName(anId));
441 myCoordUnits.resize(aDim*GetPNOMLength<eVersion>()+1);
442 for(TInt anId = 0; anId < aDim; anId++)
443 SetCoordUnit(anId,theInfo->GetCoordUnit(anId));
446 TTNodeInfo(const PMeshInfo& theMeshInfo,
450 EBooleen theIsElemNum,
451 EBooleen theIsElemNames):
452 TElemInfoBase(theMeshInfo,
456 TModeSwitchInfo(theMode)
458 mySystem = theSystem;
460 myCoord.reset(new TNodeCoord(theNbElem * theMeshInfo->myDim));
463 myCoordUnits.resize(theMeshInfo->myDim*GetPNOMLength<eVersion>()+1);
466 myCoordNames.resize(theMeshInfo->myDim*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 TElemInfoBase(theMeshInfo,
480 (TInt)theNodeCoords.size()/theMeshInfo->GetDim(),
484 TModeSwitchInfo(theMode)
486 mySystem = theSystem;
488 myCoord.reset(new TNodeCoord(theNodeCoords));
490 TInt aDim = theMeshInfo->GetDim();
492 myCoordNames.resize(aDim*GetPNOMLength<eVersion>()+1);
493 if(!theCoordNames.empty())
494 for(TInt anId = 0; anId < aDim; anId++)
495 SetCoordName(anId,theCoordNames[anId]);
497 myCoordUnits.resize(aDim*GetPNOMLength<eVersion>() + 1);
498 if(!theCoordUnits.empty())
499 for(TInt anId = 0; anId < aDim; 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 TElemInfoBase(theMeshInfo,
710 TModeSwitchInfo(theMode)
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 TElemInfoBase(theMeshInfo,
730 (TInt)theConnectivities.size() / GetNbNodes(theGeom),
734 TModeSwitchInfo(theMode)
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);
761 //---------------------------------------------------------------
762 template<EVersion eVersion>
765 virtual TTNameInfo<eVersion>
767 typedef TTNameInfo<eVersion> TNameInfoBase;
769 TTFieldInfo(const PMeshInfo& theMeshInfo, const PFieldInfo& theInfo):
770 TNameInfoBase(theInfo->GetName())
772 myMeshInfo = theMeshInfo;
774 myNbComp = theInfo->GetNbComp();
775 myCompNames.resize(myNbComp*GetPNOMLength<eVersion>()+1);
776 for(TInt anId = 0; anId < myNbComp; anId++){
777 SetCompName(anId,theInfo->GetCompName(anId));
780 myUnitNames.resize(myNbComp*GetPNOMLength<eVersion>()+1);
781 for(TInt anId = 0; anId < myNbComp; anId++){
782 SetUnitName(anId,theInfo->GetUnitName(anId));
785 myType = theInfo->GetType();
787 myIsLocal = theInfo->GetIsLocal();
788 myNbRef = theInfo->GetNbRef();
791 TTFieldInfo(const PMeshInfo& theMeshInfo,
794 const std::string& theValue,
797 TNameInfoBase(theValue)
799 myMeshInfo = theMeshInfo;
801 myNbComp = theNbComp;
802 myCompNames.resize(theNbComp*GetPNOMLength<eVersion>()+1);
803 myUnitNames.resize(theNbComp*GetPNOMLength<eVersion>()+1);
807 myIsLocal = theIsLocal;
813 GetCompName(TInt theId) const
815 return GetString(theId,GetPNOMLength<eVersion>(),myCompNames);
820 SetCompName(TInt theId, const std::string& theValue)
822 SetString(theId,GetPNOMLength<eVersion>(),myCompNames,theValue);
827 GetUnitName(TInt theId) const
829 return GetString(theId,GetPNOMLength<eVersion>(),myUnitNames);
834 SetUnitName(TInt theId, const std::string& theValue)
836 SetString(theId,GetPNOMLength<eVersion>(),myUnitNames,theValue);
841 //---------------------------------------------------------------
842 template<EVersion eVersion>
845 virtual TTNameInfo<eVersion>
847 typedef TTNameInfo<eVersion> TNameInfoBase;
849 TTGaussInfo(const TGaussInfo::TInfo& theInfo,
850 EModeSwitch theMode):
851 TNameInfoBase(boost::get<1>(boost::get<0>(theInfo))),
852 TModeSwitchInfo(theMode)
854 const TGaussInfo::TKey& aKey = boost::get<0>(theInfo);
856 myGeom = boost::get<0>(aKey);
857 myRefCoord.resize(GetNbRef()*GetDim());
859 TInt aNbGauss = boost::get<1>(theInfo);
860 myGaussCoord.resize(aNbGauss*GetDim());
861 myWeight.resize(aNbGauss);
866 //---------------------------------------------------------------
867 template<EVersion eVersion>
868 struct TTTimeStampInfo: virtual TTimeStampInfo
870 TTTimeStampInfo(const PFieldInfo& theFieldInfo, const PTimeStampInfo& theInfo)
872 myFieldInfo = theFieldInfo;
874 myEntity = theInfo->GetEntity();
875 myGeom2Size = theInfo->GetGeom2Size();
877 myNumDt = theInfo->GetNumDt();
878 myNumOrd = theInfo->GetNumOrd();
879 myDt = theInfo->GetDt();
881 myUnitDt.resize(GetPNOMLength<eVersion>()+1);
882 SetUnitDt(theInfo->GetUnitDt());
884 myGeom2NbGauss = theInfo->myGeom2NbGauss;
885 myGeom2Gauss = theInfo->GetGeom2Gauss();
888 TTTimeStampInfo(const PFieldInfo& theFieldInfo,
889 EEntiteMaillage theEntity,
890 const TGeom2Size& theGeom2Size,
891 const TGeom2NbGauss& theGeom2NbGauss,
895 const std::string& theUnitDt,
896 const TGeom2Gauss& theGeom2Gauss)
898 myFieldInfo = theFieldInfo;
900 myEntity = theEntity;
901 myGeom2Size = theGeom2Size;
907 myUnitDt.resize(GetPNOMLength<eVersion>()+1);
908 SetUnitDt(theUnitDt);
910 myGeom2NbGauss = theGeom2NbGauss;
911 myGeom2Gauss = theGeom2Gauss;
918 return GetString(0,GetPNOMLength<eVersion>(),myUnitDt);
923 SetUnitDt(const std::string& theValue)
925 SetString(0,GetPNOMLength<eVersion>(),myUnitDt,theValue);
930 //---------------------------------------------------------------
931 template<EVersion eVersion>
932 struct TTProfileInfo:
933 virtual TProfileInfo,
934 virtual TTNameInfo<eVersion>
936 typedef TTNameInfo<eVersion> TNameInfoBase;
938 TTProfileInfo(const TProfileInfo::TInfo& theInfo,
939 EModeProfil theMode):
940 TNameInfoBase(boost::get<0>(theInfo))
942 TInt aSize = boost::get<1>(theInfo);
943 myElemNum.reset(new TElemNum(aSize));
944 myMode = aSize > 0? theMode: eNO_PFLMOD;
949 //---------------------------------------------------------------
950 template<EVersion eVersion, class TMeshValueType>
951 struct TTTimeStampValue: virtual TTimeStampValue<TMeshValueType>
953 TTTimeStampValue(const PTimeStampInfo& theTimeStampInfo,
954 const PTimeStampValueBase& theInfo,
955 ETypeChamp theTypeChamp)
957 typedef TTimeStampValue<TMeshValueType> TCompatible;
958 if(TCompatible* aCompatible = dynamic_cast<TCompatible*>(theInfo.get())){
959 this->myTimeStampInfo = theTimeStampInfo;
960 this->myTypeChamp = theTypeChamp;
961 this->myGeom2Profile = aCompatible->GetGeom2Profile();
962 this->myGeom2Value = aCompatible->myGeom2Value;
963 this->myGeomSet = aCompatible->GetGeomSet();
965 EXCEPTION(std::runtime_error,"TTTimeStampValue::TTTimeStampValue - use incompatible arguments!");
968 TTTimeStampValue(const PTimeStampInfo& theTimeStampInfo,
969 ETypeChamp theTypeChamp,
970 const TGeom2Profile& theGeom2Profile,
971 EModeSwitch theMode):
972 TModeSwitchInfo(theMode)
974 this->myTimeStampInfo = theTimeStampInfo;
976 this->myTypeChamp = theTypeChamp;
978 this->myGeom2Profile = theGeom2Profile;
980 TInt aNbComp = theTimeStampInfo->myFieldInfo->myNbComp;
982 const TGeom2Size& aGeom2Size = theTimeStampInfo->GetGeom2Size();
983 TGeom2Size::const_iterator anIter = aGeom2Size.begin();
984 for(; anIter != aGeom2Size.end(); anIter++){
985 const EGeometrieElement& aGeom = anIter->first;
986 TInt aNbElem = anIter->second;
988 MED::PProfileInfo aProfileInfo;
989 MED::TGeom2Profile::const_iterator anIter = theGeom2Profile.find(aGeom);
990 if(anIter != theGeom2Profile.end())
991 aProfileInfo = anIter->second;
993 if(aProfileInfo && aProfileInfo->IsPresent())
994 aNbElem = aProfileInfo->GetSize();
996 TInt aNbGauss = theTimeStampInfo->GetNbGauss(aGeom);
998 this->GetMeshValue(aGeom).Allocate(aNbElem,aNbGauss,aNbComp);
1004 GetValueSize(EGeometrieElement theGeom) const
1006 return this->GetMeshValue(theGeom).GetSize();
1011 GetNbVal(EGeometrieElement theGeom) const
1013 return this->GetMeshValue(theGeom).GetNbVal();
1018 GetNbGauss(EGeometrieElement theGeom) const
1020 return this->GetMeshValue(theGeom).GetNbGauss();
1025 AllocateValue(EGeometrieElement theGeom,
1029 EModeSwitch theMode = eFULL_INTERLACE)
1031 this->GetMeshValue(theGeom).Allocate(theNbElem,theNbGauss,theNbComp,theMode);
1036 GetValuePtr(EGeometrieElement theGeom)
1038 return this->GetMeshValue(theGeom).GetValuePtr();
1042 //---------------------------------------------------------------
1043 template<EVersion eVersion>
1044 struct TTGrilleInfo:
1047 TTGrilleInfo(const PMeshInfo& theMeshInfo,
1048 const PGrilleInfo& theInfo)
1050 myMeshInfo = theMeshInfo;
1052 myCoord = theInfo->GetNodeCoord();
1054 myGrilleType = theInfo->GetGrilleType();
1056 myCoordNames = theInfo->myCoordNames;
1058 myCoordUnits = theInfo->myCoordUnits;
1060 myIndixes = theInfo->GetMapOfIndexes();
1062 myGrilleStructure = theInfo->GetGrilleStructure();
1064 myGrilleType = theInfo->GetGrilleType();
1066 myFamNumNode.resize(theInfo->GetNbNodes());
1067 myFamNumNode = theInfo->myFamNumNode;
1069 myFamNum = theInfo->myFamNum;
1072 TTGrilleInfo(const PMeshInfo& theMeshInfo,
1073 const EGrilleType& type,
1076 myMeshInfo = theMeshInfo;
1077 TInt aDim = theMeshInfo->GetDim();
1078 if(type == eGRILLE_STANDARD){
1079 myCoord.resize(aDim*nnoeuds);
1080 myCoordNames.resize(aDim*GetPNOMLength<eVersion>()+1);
1081 myCoordUnits.resize(aDim*GetPNOMLength<eVersion>()+1);
1082 } else { //if(type == eGRILLE_CARTESIENNE){
1083 myCoordNames.resize(aDim*GetPNOMLength<eVersion>()+aDim);
1084 myCoordUnits.resize(aDim*GetPNOMLength<eVersion>()+aDim);
1087 myGrilleStructure.resize(theMeshInfo->myDim);
1088 myFamNumNode.resize(nnoeuds);
1091 TTGrilleInfo(const PMeshInfo& theMeshInfo,
1092 const EGrilleType& type)
1094 myMeshInfo = theMeshInfo;
1095 TInt aDim = theMeshInfo->GetDim();
1096 if(type == eGRILLE_STANDARD){
1097 myCoordNames.resize(aDim*GetPNOMLength<eVersion>()+1);
1098 myCoordUnits.resize(aDim*GetPNOMLength<eVersion>()+1);
1099 } else {// if(type == eGRILLE_CARTESIENNE){
1100 myCoordNames.resize(aDim*GetPNOMLength<eVersion>()+aDim);
1101 myCoordUnits.resize(aDim*GetPNOMLength<eVersion>()+aDim);
1103 TTGrilleInfo(theMeshInfo,type,0);
1106 TTGrilleInfo(const PMeshInfo& theMeshInfo,
1107 const EGrilleType& type,
1108 const MED::TIntVector& nbNodeVec)
1110 myMeshInfo = theMeshInfo;
1112 TInt aDim = theMeshInfo->GetDim();
1113 if(type == eGRILLE_STANDARD){
1114 myCoordNames.resize(aDim*GetPNOMLength<eVersion>()+1);
1115 myCoordUnits.resize(aDim*GetPNOMLength<eVersion>()+1);
1116 } else {// if(type == eGRILLE_CARTESIENNE){
1117 myCoordNames.resize(aDim*GetPNOMLength<eVersion>()+aDim);
1118 myCoordUnits.resize(aDim*GetPNOMLength<eVersion>()+aDim);
1121 if(type != eGRILLE_STANDARD)
1122 for(int aAxe=0;aAxe<nbNodeVec.size();aAxe++){
1123 myIndixes[aAxe].resize(nbNodeVec[aAxe]);
1126 TTGrilleInfo(theMeshInfo,type,0);
1131 GetCoordName(TInt theId) const
1133 return GetString(theId,GetPNOMLength<eVersion>(),myCoordNames);
1138 SetCoordName(TInt theId, const std::string& theValue)
1140 SetString(theId,GetPNOMLength<eVersion>(),myCoordNames,theValue);
1145 GetCoordUnit(TInt theId) const
1147 return GetString(theId,GetPNOMLength<eVersion>(),myCoordUnits);
1152 SetCoordUnit(TInt theId, const std::string& theValue)
1154 SetString(theId,GetPNOMLength<eVersion>(),myCoordUnits,theValue);