1 // Copyright (C) 2007-2012 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.
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
27 #ifndef MED_TStructures_HeaderFile
28 #define MED_TStructures_HeaderFile
30 #include "MED_Structures.hxx"
33 #pragma warning(disable:4250)
38 //---------------------------------------------------------------
39 //! To provide a common way to handle values of MEDWrapper types as native MED types
40 template<class TValue, class TRepresentation>
44 TRepresentation myRepresentation;
46 TValueHolder(TValue& theValue):
48 myRepresentation(TRepresentation(theValue))
53 myValue = TValue(myRepresentation);
59 return &myRepresentation;
62 operator TRepresentation () const
64 return myRepresentation;
74 //! To customize TValueHolder common template definition for TVector
75 template<class TVal, class TRepresentation>
76 struct TValueHolder<TVector<TVal>, TRepresentation>
78 typedef TVector<TVal> TValue;
80 TRepresentation* myRepresentation;
82 TValueHolder(TValue& theValue):
86 myRepresentation = (TRepresentation*)NULL;
88 myRepresentation = (TRepresentation*)&theValue[0];
94 return myRepresentation;
98 //---------------------------------------------------------------
99 template<EVersion eVersion>
100 struct TTNameInfo: virtual TNameInfo
102 TTNameInfo(const std::string& theValue)
104 myName.resize(GetNOMLength<eVersion>()+1);
112 return GetString(0, GetNOMLength<eVersion>(), myName);
117 SetName(const std::string& theValue)
119 SetString(0, GetNOMLength<eVersion>(), myName, theValue);
124 SetName(const TString& theValue)
126 SetString(0, GetNOMLength<eVersion>(), myName, theValue);
131 //---------------------------------------------------------------
132 template<EVersion eVersion>
135 virtual TTNameInfo<eVersion>
137 typedef TTNameInfo<eVersion> TNameInfoBase;
139 TTMeshInfo(const PMeshInfo& theInfo):
140 TNameInfoBase(theInfo->GetName())
142 myDim = theInfo->GetDim();
143 mySpaceDim = theInfo->GetSpaceDim();
144 myType = theInfo->GetType();
146 myDesc.resize(GetDESCLength<eVersion>()+1);
147 SetDesc(theInfo->GetDesc());
150 TTMeshInfo(TInt theDim, TInt theSpaceDim,
151 const std::string& theValue,
153 const std::string& theDesc):
154 TNameInfoBase(theValue)
157 mySpaceDim = theSpaceDim;
160 myDesc.resize(GetDESCLength<eVersion>()+1);
168 return GetString(0, GetDESCLength<eVersion>(), myDesc);
173 SetDesc(const std::string& theValue)
175 SetString(0, GetDESCLength<eVersion>(), myDesc, theValue);
180 //---------------------------------------------------------------
181 template<EVersion eVersion>
184 virtual TTNameInfo<eVersion>
186 typedef TTNameInfo<eVersion> TNameInfoBase;
188 TTFamilyInfo(const PMeshInfo& theMeshInfo, const PFamilyInfo& theInfo):
189 TNameInfoBase(theInfo->GetName())
191 myMeshInfo = theMeshInfo;
193 myId = theInfo->GetId();
195 myNbGroup = theInfo->GetNbGroup();
196 myGroupNames.resize(myNbGroup*GetLNOMLength<eVersion>()+1);
198 for(TInt anId = 0; anId < myNbGroup; anId++){
199 SetGroupName(anId,theInfo->GetGroupName(anId));
203 myNbAttr = theInfo->GetNbAttr();
204 myAttrId.resize(myNbAttr);
205 myAttrVal.resize(myNbAttr);
206 myAttrDesc.resize(myNbAttr*GetDESCLength<eVersion>()+1);
208 for(TInt anId = 0; anId < myNbAttr; anId++){
209 SetAttrDesc(anId,theInfo->GetAttrDesc(anId));
210 myAttrVal[anId] = theInfo->GetAttrVal(anId);
211 myAttrId[anId] = theInfo->GetAttrId(anId);
216 TTFamilyInfo(const PMeshInfo& theMeshInfo,
220 const std::string& theValue):
221 TNameInfoBase(theValue)
223 myMeshInfo = theMeshInfo;
227 myNbGroup = theNbGroup;
228 myGroupNames.resize(theNbGroup*GetLNOMLength<eVersion>()+1);
230 myNbAttr = theNbAttr;
231 myAttrId.resize(theNbAttr);
232 myAttrVal.resize(theNbAttr);
233 myAttrDesc.resize(theNbAttr*GetDESCLength<eVersion>()+1);
236 TTFamilyInfo(const PMeshInfo& theMeshInfo,
237 const std::string& theValue,
239 const TStringSet& theGroupNames,
240 const TStringVector& theAttrDescs,
241 const TIntVector& theAttrIds,
242 const TIntVector& theAttrVals):
243 TNameInfoBase(theValue)
245 myMeshInfo = theMeshInfo;
249 myNbGroup = (TInt)theGroupNames.size();
250 myGroupNames.resize(myNbGroup*GetLNOMLength<eVersion>()+1);
252 TStringSet::const_iterator anIter = theGroupNames.begin();
253 for(TInt anId = 0; anIter != theGroupNames.end(); anIter++, anId++){
254 const std::string& aVal = *anIter;
255 SetGroupName(anId,aVal);
259 myNbAttr = (TInt)theAttrDescs.size();
260 myAttrId.resize(myNbAttr);
261 myAttrVal.resize(myNbAttr);
262 myAttrDesc.resize(myNbAttr*GetDESCLength<eVersion>()+1);
264 for(TInt anId = 0, anEnd = (TInt)theAttrDescs.size(); anId < anEnd; anId++){
265 SetAttrDesc(anId,theAttrDescs[anId]);
266 myAttrVal[anId] = theAttrVals[anId];
267 myAttrId[anId] = theAttrIds[anId];
274 GetGroupName(TInt theId) const
276 return GetString(theId, GetLNOMLength<eVersion>(), myGroupNames);
281 SetGroupName(TInt theId, const std::string& theValue)
283 SetString(theId, GetLNOMLength<eVersion>(), myGroupNames, theValue);
288 GetAttrDesc(TInt theId) const
290 return GetString(theId, GetDESCLength<eVersion>(), myAttrDesc);
295 SetAttrDesc(TInt theId, const std::string& theValue)
297 SetString(theId, GetDESCLength<eVersion>(), myAttrDesc, theValue);
302 //---------------------------------------------------------------
303 template<EVersion eVersion>
304 struct TTElemInfo: virtual TElemInfo
306 TTElemInfo(const PMeshInfo& theMeshInfo, const PElemInfo& theInfo)
308 myMeshInfo = theMeshInfo;
310 myNbElem = theInfo->GetNbElem();
311 myFamNum.reset(new TElemNum(myNbElem));
312 myIsFamNum = eFAUX; // is set to eVRAI in SetFamNum()
314 myIsElemNum = theInfo->IsElemNum();
315 if(theInfo->IsElemNum())
316 myElemNum.reset(new TElemNum(myNbElem));
318 myElemNum.reset(new TElemNum());
320 myIsElemNames = theInfo->IsElemNames();
321 if(theInfo->IsElemNames())
322 myElemNames.reset(new TString(myNbElem*GetPNOMLength<eVersion>() + 1));
324 myElemNames.reset(new TString());
326 if(theInfo->GetNbElem()){
327 for(TInt anId = 0; anId < myNbElem; anId++){
328 SetFamNum(anId, theInfo->GetFamNum(anId));
330 if(theInfo->IsElemNum() == eVRAI){
331 for(TInt anId = 0; anId < myNbElem; anId++){
332 SetElemNum(anId, theInfo->GetElemNum(anId));
335 if(theInfo->IsElemNames() == eVRAI){
336 for(TInt anId = 0; anId < myNbElem; anId++){
337 SetElemName(anId,theInfo->GetElemName(anId));
343 TTElemInfo(const PMeshInfo& theMeshInfo,
345 EBooleen theIsElemNum,
346 EBooleen theIsElemNames)
348 myMeshInfo = theMeshInfo;
350 myNbElem = theNbElem;
351 myFamNum.reset(new TElemNum(theNbElem));
352 myIsFamNum = eFAUX; // is set to eVRAI in SetFamNum()
354 myIsElemNum = theIsElemNum;
356 myElemNum.reset(new TElemNum(theNbElem));
358 myElemNum.reset(new TElemNum());
360 myIsElemNames = theIsElemNames;
362 myElemNames.reset(new TString(theNbElem*GetPNOMLength<eVersion>() + 1));
364 myElemNames.reset(new TString());
367 TTElemInfo(const PMeshInfo& theMeshInfo,
369 const TIntVector& theFamilyNums,
370 const TIntVector& theElemNums,
371 const TStringVector& theElemNames)
373 myMeshInfo = theMeshInfo;
375 myNbElem = theNbElem;
376 myFamNum.reset(new TElemNum(theNbElem));
377 myIsFamNum = eFAUX; // is set to eVRAI in SetFamNum()
379 myIsElemNum = theElemNums.size()? eVRAI: eFAUX;
381 myElemNum.reset(new TElemNum(theNbElem));
383 myElemNum.reset(new TElemNum());
385 myIsElemNames = theElemNames.size()? eVRAI: eFAUX;
387 myElemNames.reset(new TString(theNbElem*GetPNOMLength<eVersion>() + 1));
389 myElemNames.reset(new TString());
393 if(theFamilyNums.size())
394 *myFamNum = theFamilyNums;
397 *myElemNum = theElemNums;
400 for(TInt anId = 0; anId < theNbElem; anId++){
401 const std::string& aVal = theElemNames[anId];
402 SetElemName(anId,aVal);
410 GetElemName(TInt theId) const
412 return GetString(theId,GetPNOMLength<eVersion>(), *myElemNames);
417 SetElemName(TInt theId, const std::string& theValue)
419 SetString(theId,GetPNOMLength<eVersion>(), *myElemNames, theValue);
424 //---------------------------------------------------------------
425 template<EVersion eVersion>
428 virtual TTElemInfo<eVersion>
430 typedef TTElemInfo<eVersion> TElemInfoBase;
432 TTNodeInfo(const PMeshInfo& theMeshInfo, const PNodeInfo& theInfo):
434 TElemInfoBase(theMeshInfo, theInfo)
436 myModeSwitch = theInfo->GetModeSwitch();
438 mySystem = theInfo->GetSystem();
440 myCoord.reset(new TNodeCoord(*theInfo->myCoord));
442 TInt aSpaceDim = theMeshInfo->GetSpaceDim();
444 myCoordNames.resize(aSpaceDim*GetPNOMLength<eVersion>()+1);
445 for(TInt anId = 0; anId < aSpaceDim; anId++)
446 SetCoordName(anId,theInfo->GetCoordName(anId));
448 myCoordUnits.resize(aSpaceDim*GetPNOMLength<eVersion>()+1);
449 for(TInt anId = 0; anId < aSpaceDim; anId++)
450 SetCoordUnit(anId,theInfo->GetCoordUnit(anId));
453 TTNodeInfo(const PMeshInfo& theMeshInfo,
457 EBooleen theIsElemNum,
458 EBooleen theIsElemNames):
459 TModeSwitchInfo(theMode),
460 TElemInfoBase(theMeshInfo,
465 mySystem = theSystem;
467 myCoord.reset(new TNodeCoord(theNbElem * theMeshInfo->mySpaceDim));
469 myCoordUnits.resize(theMeshInfo->mySpaceDim*GetPNOMLength<eVersion>()+1);
471 myCoordNames.resize(theMeshInfo->mySpaceDim*GetPNOMLength<eVersion>()+1);
475 TTNodeInfo(const PMeshInfo& theMeshInfo,
476 const TFloatVector& theNodeCoords,
479 const TStringVector& theCoordNames,
480 const TStringVector& theCoordUnits,
481 const TIntVector& theFamilyNums,
482 const TIntVector& theElemNums,
483 const TStringVector& theElemNames):
484 TModeSwitchInfo(theMode),
485 TElemInfoBase(theMeshInfo,
486 (TInt)theNodeCoords.size()/theMeshInfo->GetDim(),
491 mySystem = theSystem;
493 myCoord.reset(new TNodeCoord(theNodeCoords));
495 TInt aSpaceDim = theMeshInfo->GetSpaceDim();
497 myCoordNames.resize(aSpaceDim*GetPNOMLength<eVersion>()+1);
498 if(!theCoordNames.empty())
499 for(TInt anId = 0; anId < aSpaceDim; anId++)
500 SetCoordName(anId,theCoordNames[anId]);
502 myCoordUnits.resize(aSpaceDim*GetPNOMLength<eVersion>() + 1);
503 if(!theCoordUnits.empty())
504 for(TInt anId = 0; anId < aSpaceDim; anId++)
505 SetCoordUnit(anId, theCoordUnits[anId]);
510 GetCoordName(TInt theId) const
512 return GetString(theId,GetPNOMLength<eVersion>(),myCoordNames);
517 SetCoordName(TInt theId, const std::string& theValue)
519 SetString(theId,GetPNOMLength<eVersion>(),myCoordNames,theValue);
524 GetCoordUnit(TInt theId) const
526 return GetString(theId,GetPNOMLength<eVersion>(),myCoordUnits);
531 SetCoordUnit(TInt theId, const std::string& theValue)
533 SetString(theId,GetPNOMLength<eVersion>(),myCoordUnits,theValue);
537 //---------------------------------------------------------------
538 template<EVersion eVersion>
539 struct TTPolygoneInfo:
540 virtual TPolygoneInfo,
541 virtual TTElemInfo<eVersion>
543 typedef TTElemInfo<eVersion> TElemInfoBase;
545 TTPolygoneInfo(const PMeshInfo& theMeshInfo, const PPolygoneInfo& theInfo):
546 TElemInfoBase(theMeshInfo,theInfo)
548 myEntity = theInfo->GetEntity();
549 myGeom = theInfo->GetGeom();
551 myIndex.reset(new TElemNum(*theInfo->myIndex));
552 myConn.reset(new TElemNum(*theInfo->myConn));
554 myConnMode = theInfo->GetConnMode();
557 TTPolygoneInfo(const PMeshInfo& theMeshInfo,
558 EEntiteMaillage theEntity,
559 EGeometrieElement theGeom,
562 EConnectivite theConnMode,
563 EBooleen theIsElemNum,
564 EBooleen theIsElemNames):
565 TElemInfoBase(theMeshInfo,
570 myEntity = theEntity;
573 myIndex.reset(new TElemNum(theNbElem + 1));
574 myConn.reset(new TElemNum(theConnSize));
576 myConnMode = theConnMode;
579 TTPolygoneInfo(const PMeshInfo& theMeshInfo,
580 EEntiteMaillage theEntity,
581 EGeometrieElement theGeom,
582 const TIntVector& theIndexes,
583 const TIntVector& theConnectivities,
584 EConnectivite theConnMode,
585 const TIntVector& theFamilyNums,
586 const TIntVector& theElemNums,
587 const TStringVector& theElemNames):
588 TElemInfoBase(theMeshInfo,
589 (TInt)theIndexes.size() - 1,
594 myEntity = theEntity;
597 myIndex.reset(new TElemNum(theIndexes));
598 myConn.reset(new TElemNum(theConnectivities));
600 myConnMode = theConnMode;
604 //---------------------------------------------------------------
605 template<EVersion eVersion>
606 struct TTPolyedreInfo:
607 virtual TPolyedreInfo,
608 virtual TTElemInfo<eVersion>
610 typedef TTElemInfo<eVersion> TElemInfoBase;
612 TTPolyedreInfo(const PMeshInfo& theMeshInfo, const PPolyedreInfo& theInfo):
613 TElemInfoBase(theMeshInfo,theInfo)
615 myEntity = theInfo->GetEntity();
616 myGeom = theInfo->GetGeom();
618 myIndex.reset(new TElemNum(*theInfo->myIndex));
619 myFaces.reset(new TElemNum(*theInfo->myFaces));
620 myConn.reset(new TElemNum(*theInfo->myConn));
622 myConnMode = theInfo->GetConnMode();
625 TTPolyedreInfo(const PMeshInfo& theMeshInfo,
626 EEntiteMaillage theEntity,
627 EGeometrieElement theGeom,
631 EConnectivite theConnMode,
632 EBooleen theIsElemNum,
633 EBooleen theIsElemNames):
634 TElemInfoBase(theMeshInfo,
639 myEntity = theEntity;
642 myIndex.reset(new TElemNum(theNbElem + 1));
643 myFaces.reset(new TElemNum(theNbFaces));
644 myConn.reset(new TElemNum(theConnSize));
646 myConnMode = theConnMode;
649 TTPolyedreInfo(const PMeshInfo& theMeshInfo,
650 EEntiteMaillage theEntity,
651 EGeometrieElement theGeom,
652 const TIntVector& theIndexes,
653 const TIntVector& theFaces,
654 const TIntVector& theConnectivities,
655 EConnectivite theConnMode,
656 const TIntVector& theFamilyNums,
657 const TIntVector& theElemNums,
658 const TStringVector& theElemNames):
659 TElemInfoBase(theMeshInfo,
660 (TInt)theIndexes.size()-1,
665 myEntity = theEntity;
668 myIndex.reset(new TElemNum(theIndexes));
669 myFaces.reset(new TElemNum(theFaces));
670 myConn.reset(new TElemNum(theConnectivities));
672 myConnMode = theConnMode;
676 //---------------------------------------------------------------
677 template<EVersion eVersion>
680 virtual TTElemInfo<eVersion>
682 typedef TTElemInfo<eVersion> TElemInfoBase;
684 TTCellInfo(const PMeshInfo& theMeshInfo, const PCellInfo& theInfo):
685 TElemInfoBase(theMeshInfo,theInfo)
687 myEntity = theInfo->GetEntity();
688 myGeom = theInfo->GetGeom();
689 myConnMode = theInfo->GetConnMode();
691 TInt aConnDim = GetNbNodes(myGeom);
692 TInt aNbConn = GetNbConn<eVersion>(myGeom, myEntity, myMeshInfo->myDim);
693 myConn.reset(new TElemNum(myNbElem * aNbConn));
694 for(TInt anElemId = 0; anElemId < myNbElem; anElemId++){
695 TConnSlice aConnSlice = GetConnSlice(anElemId);
696 TCConnSlice aConnSlice2 = theInfo->GetConnSlice(anElemId);
697 for(TInt anConnId = 0; anConnId < aConnDim; anConnId++){
698 aConnSlice[anConnId] = aConnSlice2[anConnId];
703 TTCellInfo(const PMeshInfo& theMeshInfo,
704 EEntiteMaillage theEntity,
705 EGeometrieElement theGeom,
707 EConnectivite theConnMode,
708 EBooleen theIsElemNum,
709 EBooleen theIsElemNames,
710 EModeSwitch theMode):
711 TModeSwitchInfo(theMode),
712 TElemInfoBase(theMeshInfo,
717 myEntity = theEntity;
720 myConnMode = theConnMode;
721 TInt aNbConn = GetNbConn<eVersion>(theGeom, myEntity, theMeshInfo->myDim);
722 myConn.reset(new TElemNum(theNbElem * aNbConn));
725 TTCellInfo(const PMeshInfo& theMeshInfo,
726 EEntiteMaillage theEntity,
727 EGeometrieElement theGeom,
728 const TIntVector& theConnectivities,
729 EConnectivite theConnMode,
730 const TIntVector& theFamilyNums,
731 const TIntVector& theElemNums,
732 const TStringVector& theElemNames,
733 EModeSwitch theMode):
734 TModeSwitchInfo(theMode),
735 TElemInfoBase(theMeshInfo,
736 (TInt)theConnectivities.size() / GetNbNodes(theGeom),
741 myEntity = theEntity;
744 myConnMode = theConnMode;
745 TInt aConnDim = GetNbNodes(myGeom);
746 TInt aNbConn = GetNbConn<eVersion>(myGeom, myEntity, myMeshInfo->myDim);
747 myConn.reset(new TElemNum(myNbElem * aNbConn));
748 for(TInt anElemId = 0; anElemId < myNbElem; anElemId++){
749 TConnSlice aConnSlice = GetConnSlice(anElemId);
750 for(TInt anConnId = 0; anConnId < aConnDim; anConnId++){
751 aConnSlice[anConnId] = theConnectivities[anElemId*aConnDim + anConnId];
760 return GetNbConn<eVersion>(myGeom, myEntity, myMeshInfo->myDim);
765 //---------------------------------------------------------------
766 template<EVersion eVersion>
769 virtual TTCellInfo<eVersion>
771 typedef TTCellInfo<eVersion> TCellInfoBase;
773 TTBallInfo(const PMeshInfo& theMeshInfo, const PBallInfo& theInfo):
774 TCellInfoBase::TElemInfoBase(theMeshInfo, theInfo),
775 TCellInfoBase(theMeshInfo,theInfo)
777 myDiameters = theInfo->myDiameters;
780 TTBallInfo(const PMeshInfo& theMeshInfo,
782 EBooleen theIsElemNum ):
783 TCellInfoBase::TElemInfoBase(theMeshInfo,
786 /*theIsElemNames=*/eFAUX),
787 TCellInfoBase(theMeshInfo,
791 /*EConnectivite=*/eNOD,
793 /*theIsElemNames=*/eFAUX,
796 myDiameters.resize( theNbElem );
799 TTBallInfo(const PMeshInfo& theMeshInfo,
800 const TIntVector& theNodes,
801 TFloatVector& theDiameters,
802 const TIntVector& theFamilyNums,
803 const TIntVector& theElemNums):
804 TCellInfoBase::TElemInfoBase(theMeshInfo,
805 (TInt)std::max(theNodes.size(),theDiameters.size() ),
809 TCellInfoBase(theMeshInfo,
813 /*EConnectivite=*/eNOD,
819 myDiameters.swap( theDiameters );
823 //---------------------------------------------------------------
824 template<EVersion eVersion>
827 virtual TTNameInfo<eVersion>
829 typedef TTNameInfo<eVersion> TNameInfoBase;
831 TTFieldInfo(const PMeshInfo& theMeshInfo, const PFieldInfo& theInfo):
832 TNameInfoBase(theInfo->GetName())
834 myMeshInfo = theMeshInfo;
836 myNbComp = theInfo->GetNbComp();
837 myCompNames.resize(myNbComp*GetPNOMLength<eVersion>()+1);
838 for(TInt anId = 0; anId < myNbComp; anId++){
839 SetCompName(anId,theInfo->GetCompName(anId));
842 myUnitNames.resize(myNbComp*GetPNOMLength<eVersion>()+1);
843 for(TInt anId = 0; anId < myNbComp; anId++){
844 SetUnitName(anId,theInfo->GetUnitName(anId));
847 myType = theInfo->GetType();
849 myIsLocal = theInfo->GetIsLocal();
850 myNbRef = theInfo->GetNbRef();
853 TTFieldInfo(const PMeshInfo& theMeshInfo,
856 const std::string& theValue,
859 TNameInfoBase(theValue)
861 myMeshInfo = theMeshInfo;
863 myNbComp = theNbComp;
864 myCompNames.resize(theNbComp*GetPNOMLength<eVersion>()+1);
865 myUnitNames.resize(theNbComp*GetPNOMLength<eVersion>()+1);
869 myIsLocal = theIsLocal;
875 GetCompName(TInt theId) const
877 return GetString(theId,GetPNOMLength<eVersion>(),myCompNames);
882 SetCompName(TInt theId, const std::string& theValue)
884 SetString(theId,GetPNOMLength<eVersion>(),myCompNames,theValue);
889 GetUnitName(TInt theId) const
891 return GetString(theId,GetPNOMLength<eVersion>(),myUnitNames);
896 SetUnitName(TInt theId, const std::string& theValue)
898 SetString(theId,GetPNOMLength<eVersion>(),myUnitNames,theValue);
903 //---------------------------------------------------------------
904 template<EVersion eVersion>
907 virtual TTNameInfo<eVersion>
909 typedef TTNameInfo<eVersion> TNameInfoBase;
911 TTGaussInfo(const TGaussInfo::TInfo& theInfo,
912 EModeSwitch theMode):
913 TModeSwitchInfo(theMode),
914 TNameInfoBase(boost::get<1>(boost::get<0>(theInfo)))
916 const TGaussInfo::TKey& aKey = boost::get<0>(theInfo);
918 myGeom = boost::get<0>(aKey);
919 myRefCoord.resize(GetNbRef()*GetDim());
921 TInt aNbGauss = boost::get<1>(theInfo);
922 myGaussCoord.resize(aNbGauss*GetDim());
923 myWeight.resize(aNbGauss);
928 //---------------------------------------------------------------
929 template<EVersion eVersion>
930 struct TTTimeStampInfo: virtual TTimeStampInfo
932 TTTimeStampInfo(const PFieldInfo& theFieldInfo, const PTimeStampInfo& theInfo)
934 myFieldInfo = theFieldInfo;
936 myEntity = theInfo->GetEntity();
937 myGeom2Size = theInfo->GetGeom2Size();
939 myNumDt = theInfo->GetNumDt();
940 myNumOrd = theInfo->GetNumOrd();
941 myDt = theInfo->GetDt();
943 myUnitDt.resize(GetPNOMLength<eVersion>()+1);
944 SetUnitDt(theInfo->GetUnitDt());
946 myGeom2NbGauss = theInfo->myGeom2NbGauss;
947 myGeom2Gauss = theInfo->GetGeom2Gauss();
950 TTTimeStampInfo(const PFieldInfo& theFieldInfo,
951 EEntiteMaillage theEntity,
952 const TGeom2Size& theGeom2Size,
953 const TGeom2NbGauss& theGeom2NbGauss,
957 const std::string& theUnitDt,
958 const TGeom2Gauss& theGeom2Gauss)
960 myFieldInfo = theFieldInfo;
962 myEntity = theEntity;
963 myGeom2Size = theGeom2Size;
969 myUnitDt.resize(GetPNOMLength<eVersion>()+1);
970 SetUnitDt(theUnitDt);
972 myGeom2NbGauss = theGeom2NbGauss;
973 myGeom2Gauss = theGeom2Gauss;
980 return GetString(0,GetPNOMLength<eVersion>(),myUnitDt);
985 SetUnitDt(const std::string& theValue)
987 SetString(0,GetPNOMLength<eVersion>(),myUnitDt,theValue);
992 //---------------------------------------------------------------
993 template<EVersion eVersion>
994 struct TTProfileInfo:
995 virtual TProfileInfo,
996 virtual TTNameInfo<eVersion>
998 typedef TTNameInfo<eVersion> TNameInfoBase;
1000 TTProfileInfo(const TProfileInfo::TInfo& theInfo,
1001 EModeProfil theMode):
1002 TNameInfoBase(boost::get<0>(theInfo))
1004 TInt aSize = boost::get<1>(theInfo);
1005 myElemNum.reset(new TElemNum(aSize));
1006 myMode = aSize > 0? theMode: eNO_PFLMOD;
1011 //---------------------------------------------------------------
1012 template<EVersion eVersion, class TMeshValueType>
1013 struct TTTimeStampValue: virtual TTimeStampValue<TMeshValueType>
1015 TTTimeStampValue(const PTimeStampInfo& theTimeStampInfo,
1016 const PTimeStampValueBase& theInfo,
1017 ETypeChamp theTypeChamp)
1019 typedef TTimeStampValue<TMeshValueType> TCompatible;
1020 if(TCompatible* aCompatible = dynamic_cast<TCompatible*>(theInfo.get())){
1021 this->myTimeStampInfo = theTimeStampInfo;
1022 this->myTypeChamp = theTypeChamp;
1023 this->myGeom2Profile = aCompatible->GetGeom2Profile();
1024 this->myGeom2Value = aCompatible->myGeom2Value;
1025 this->myGeomSet = aCompatible->GetGeomSet();
1027 EXCEPTION(std::runtime_error,"TTTimeStampValue::TTTimeStampValue - use incompatible arguments!");
1030 TTTimeStampValue(const PTimeStampInfo& theTimeStampInfo,
1031 ETypeChamp theTypeChamp,
1032 const TGeom2Profile& theGeom2Profile,
1033 EModeSwitch theMode):
1034 TModeSwitchInfo(theMode)
1036 this->myTimeStampInfo = theTimeStampInfo;
1038 this->myTypeChamp = theTypeChamp;
1040 this->myGeom2Profile = theGeom2Profile;
1042 TInt aNbComp = theTimeStampInfo->myFieldInfo->myNbComp;
1044 const TGeom2Size& aGeom2Size = theTimeStampInfo->GetGeom2Size();
1045 TGeom2Size::const_iterator anIter = aGeom2Size.begin();
1046 for(; anIter != aGeom2Size.end(); anIter++){
1047 const EGeometrieElement& aGeom = anIter->first;
1048 TInt aNbElem = anIter->second;
1050 MED::PProfileInfo aProfileInfo;
1051 MED::TGeom2Profile::const_iterator anIter = theGeom2Profile.find(aGeom);
1052 if(anIter != theGeom2Profile.end())
1053 aProfileInfo = anIter->second;
1055 if(aProfileInfo && aProfileInfo->IsPresent())
1056 aNbElem = aProfileInfo->GetSize();
1058 TInt aNbGauss = theTimeStampInfo->GetNbGauss(aGeom);
1060 this->GetMeshValue(aGeom).Allocate(aNbElem,aNbGauss,aNbComp);
1066 GetValueSize(EGeometrieElement theGeom) const
1068 return this->GetMeshValue(theGeom).GetSize();
1073 GetNbVal(EGeometrieElement theGeom) const
1075 return this->GetMeshValue(theGeom).GetNbVal();
1080 GetNbGauss(EGeometrieElement theGeom) const
1082 return this->GetMeshValue(theGeom).GetNbGauss();
1087 AllocateValue(EGeometrieElement theGeom,
1091 EModeSwitch theMode = eFULL_INTERLACE)
1093 this->GetMeshValue(theGeom).Allocate(theNbElem,theNbGauss,theNbComp,theMode);
1098 GetValuePtr(EGeometrieElement theGeom)
1100 return this->GetMeshValue(theGeom).GetValuePtr();
1104 //---------------------------------------------------------------
1105 template<EVersion eVersion>
1106 struct TTGrilleInfo:
1109 TTGrilleInfo(const PMeshInfo& theMeshInfo,
1110 const PGrilleInfo& theInfo)
1112 myMeshInfo = theMeshInfo;
1114 myCoord = theInfo->GetNodeCoord();
1116 myGrilleType = theInfo->GetGrilleType();
1118 myCoordNames = theInfo->myCoordNames;
1120 myCoordUnits = theInfo->myCoordUnits;
1122 myIndixes = theInfo->GetMapOfIndexes();
1124 myGrilleStructure = theInfo->GetGrilleStructure();
1126 myGrilleType = theInfo->GetGrilleType();
1128 myFamNumNode.resize(theInfo->GetNbNodes());
1129 myFamNumNode = theInfo->myFamNumNode;
1131 myFamNum = theInfo->myFamNum;
1134 TTGrilleInfo(const PMeshInfo& theMeshInfo,
1135 const EGrilleType& type,
1138 myMeshInfo = theMeshInfo;
1139 TInt aSpaceDim = theMeshInfo->GetSpaceDim();
1140 if(type == eGRILLE_STANDARD){
1141 myCoord.resize(aSpaceDim*nnoeuds);
1142 myCoordNames.resize(aSpaceDim*GetPNOMLength<eVersion>()+1);
1143 myCoordUnits.resize(aSpaceDim*GetPNOMLength<eVersion>()+1);
1144 } else { //if(type == eGRILLE_CARTESIENNE){
1145 myCoordNames.resize(aSpaceDim*GetPNOMLength<eVersion>()+aSpaceDim);
1146 myCoordUnits.resize(aSpaceDim*GetPNOMLength<eVersion>()+aSpaceDim);
1148 myGrilleStructure.resize(aSpaceDim);
1149 myFamNumNode.resize(nnoeuds);
1152 TTGrilleInfo(const PMeshInfo& theMeshInfo,
1153 const EGrilleType& type)
1155 myMeshInfo = theMeshInfo;
1156 TInt aSpaceDim = theMeshInfo->GetSpaceDim();
1157 if(type == eGRILLE_STANDARD){
1158 myCoordNames.resize(aSpaceDim*GetPNOMLength<eVersion>()+1);
1159 myCoordUnits.resize(aSpaceDim*GetPNOMLength<eVersion>()+1);
1160 } else {// if(type == eGRILLE_CARTESIENNE){
1161 myCoordNames.resize(aSpaceDim*GetPNOMLength<eVersion>()+aSpaceDim);
1162 myCoordUnits.resize(aSpaceDim*GetPNOMLength<eVersion>()+aSpaceDim);
1164 myGrilleStructure.resize(aSpaceDim);
1167 TTGrilleInfo(const PMeshInfo& theMeshInfo,
1168 const EGrilleType& type,
1169 const MED::TIntVector& nbNodeVec)
1171 myMeshInfo = theMeshInfo;
1173 TInt aSpaceDim = theMeshInfo->GetSpaceDim();
1174 if(type == eGRILLE_STANDARD){
1175 myCoordNames.resize(aSpaceDim*GetPNOMLength<eVersion>()+1);
1176 myCoordUnits.resize(aSpaceDim*GetPNOMLength<eVersion>()+1);
1177 } else {// if(type == eGRILLE_CARTESIENNE){
1178 myCoordNames.resize(aSpaceDim*GetPNOMLength<eVersion>()+aSpaceDim);
1179 myCoordUnits.resize(aSpaceDim*GetPNOMLength<eVersion>()+aSpaceDim);
1182 if(type != eGRILLE_STANDARD)
1183 for(unsigned int aAxe=0;aAxe<nbNodeVec.size();aAxe++){
1184 myIndixes[aAxe].resize(nbNodeVec[aAxe]);
1186 myGrilleStructure.resize(aSpaceDim);
1191 GetCoordName(TInt theId) const
1193 return GetString(theId,GetPNOMLength<eVersion>(),myCoordNames);
1198 SetCoordName(TInt theId, const std::string& theValue)
1200 SetString(theId,GetPNOMLength<eVersion>(),myCoordNames,theValue);
1205 GetCoordUnit(TInt theId) const
1207 return GetString(theId,GetPNOMLength<eVersion>(),myCoordUnits);
1212 SetCoordUnit(TInt theId, const std::string& theValue)
1214 SetString(theId,GetPNOMLength<eVersion>(),myCoordUnits,theValue);