1 // Copyright (C) 2007-2023 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
23 #ifndef MED_TStructures_HeaderFile
24 #define MED_TStructures_HeaderFile
26 #include "MED_Structures.hxx"
29 #pragma warning(disable:4250)
31 #include <utilities.h>
34 //---------------------------------------------------------------
35 //! To provide a common way to handle values of MEDWrapper types as native MED types
36 template<class TValue, class TRepresentation>
40 TRepresentation myRepresentation;
42 TValueHolder(TValue& theValue):
44 myRepresentation(TRepresentation(theValue))
49 myValue = TValue(myRepresentation);
55 return &myRepresentation;
58 operator TRepresentation () const
60 return myRepresentation;
70 //! To customize TValueHolder common template definition for TVector
71 template<class TVal, class TRepresentation>
72 struct TValueHolder<TVector<TVal>, TRepresentation>
74 typedef TVector<TVal> TValue;
76 TRepresentation* myRepresentation;
78 TValueHolder(TValue& theValue):
82 myRepresentation = (TRepresentation*)NULL;
84 myRepresentation = (TRepresentation*)&theValue[0];
90 return myRepresentation;
94 //---------------------------------------------------------------
95 struct TTNameInfo: virtual TNameInfo
97 TTNameInfo(const std::string& theValue)
99 myName.resize(GetNOMLength()+1);
107 return GetString(0, GetNOMLength(), myName);
112 SetName(const std::string& theValue)
114 SetString(0, GetNOMLength(), myName, theValue);
119 SetName(const TString& theValue)
121 SetString(0, GetNOMLength(), myName, theValue);
125 //---------------------------------------------------------------
130 typedef TTNameInfo TNameInfoBase;
132 TTMeshInfo(const PMeshInfo& theInfo):
133 TNameInfoBase(theInfo->GetName())
135 myDim = theInfo->GetDim();
136 mySpaceDim = theInfo->GetSpaceDim();
137 myType = theInfo->GetType();
139 myDesc.resize(GetDESCLength()+1);
140 SetDesc(theInfo->GetDesc());
143 TTMeshInfo(TInt theDim, TInt theSpaceDim,
144 const std::string& theValue,
146 const std::string& theDesc):
147 TNameInfoBase(theValue)
150 mySpaceDim = theSpaceDim;
153 myDesc.resize(GetDESCLength()+1);
161 return GetString(0, GetDESCLength(), myDesc);
166 SetDesc(const std::string& theValue)
168 SetString(0, GetDESCLength(), myDesc, theValue);
172 //---------------------------------------------------------------
177 typedef TTNameInfo TNameInfoBase;
179 TTFamilyInfo(const PMeshInfo& theMeshInfo, const PFamilyInfo& theInfo):
180 TNameInfoBase(theInfo->GetName())
182 myMeshInfo = theMeshInfo;
184 myId = theInfo->GetId();
186 myNbGroup = theInfo->GetNbGroup();
187 myGroupNames.resize(myNbGroup*GetLNOMLength()+1);
189 for(TInt anId = 0; anId < myNbGroup; anId++){
190 SetGroupName(anId,theInfo->GetGroupName(anId));
194 myNbAttr = theInfo->GetNbAttr();
195 myAttrId.resize(myNbAttr);
196 myAttrVal.resize(myNbAttr);
197 myAttrDesc.resize(myNbAttr*GetDESCLength()+1);
199 for(TInt anId = 0; anId < myNbAttr; anId++){
200 SetAttrDesc(anId,theInfo->GetAttrDesc(anId));
201 myAttrVal[anId] = theInfo->GetAttrVal(anId);
202 myAttrId[anId] = theInfo->GetAttrId(anId);
207 TTFamilyInfo(const PMeshInfo& theMeshInfo,
211 const std::string& theValue):
212 TNameInfoBase(theValue)
214 myMeshInfo = theMeshInfo;
218 myNbGroup = theNbGroup;
219 myGroupNames.resize(theNbGroup*GetLNOMLength()+1);
221 myNbAttr = theNbAttr;
222 myAttrId.resize(theNbAttr);
223 myAttrVal.resize(theNbAttr);
224 myAttrDesc.resize(theNbAttr*GetDESCLength()+1);
227 TTFamilyInfo(const PMeshInfo& theMeshInfo,
228 const std::string& theValue,
230 const TStringSet& theGroupNames,
231 const TStringVector& theAttrDescs,
232 const TIntVector& theAttrIds,
233 const TIntVector& theAttrVals):
234 TNameInfoBase(theValue)
236 myMeshInfo = theMeshInfo;
240 myNbGroup = (TInt)theGroupNames.size();
241 myGroupNames.resize(myNbGroup*GetLNOMLength()+1);
243 TStringSet::const_iterator anIter = theGroupNames.begin();
244 for(TInt anId = 0; anIter != theGroupNames.end(); anIter++, anId++){
245 const std::string& aVal = *anIter;
246 SetGroupName(anId,aVal);
250 myNbAttr = (TInt)theAttrDescs.size();
251 myAttrId.resize(myNbAttr);
252 myAttrVal.resize(myNbAttr);
253 myAttrDesc.resize(myNbAttr*GetDESCLength()+1);
255 for(TInt anId = 0, anEnd = (TInt)theAttrDescs.size(); anId < anEnd; anId++){
256 SetAttrDesc(anId,theAttrDescs[anId]);
257 myAttrVal[anId] = theAttrVals[anId];
258 myAttrId[anId] = theAttrIds[anId];
265 GetGroupName(TInt theId) const
267 return GetString(theId, GetLNOMLength(), myGroupNames);
272 SetGroupName(TInt theId, const std::string& theValue)
274 SetString(theId, GetLNOMLength(), myGroupNames, theValue);
279 GetAttrDesc(TInt theId) const
281 return GetString(theId, GetDESCLength(), myAttrDesc);
286 SetAttrDesc(TInt theId, const std::string& theValue)
288 SetString(theId, GetDESCLength(), myAttrDesc, theValue);
292 //---------------------------------------------------------------
293 struct TTElemInfo: virtual TElemInfo
295 TTElemInfo(const PMeshInfo& theMeshInfo, const PElemInfo& theInfo)
297 myMeshInfo = theMeshInfo;
299 myNbElem = theInfo->GetNbElem();
300 myFamNum.reset(new TElemNum(myNbElem));
301 myIsFamNum = eFAUX; // is set to eVRAI in SetFamNum()
303 myIsElemNum = theInfo->IsElemNum();
304 if(theInfo->IsElemNum())
305 myElemNum.reset(new TElemNum(myNbElem));
307 myElemNum.reset(new TElemNum());
309 myIsElemNames = theInfo->IsElemNames();
310 if(theInfo->IsElemNames())
311 myElemNames.reset(new TString(myNbElem*GetPNOMLength() + 1));
313 myElemNames.reset(new TString());
315 if(theInfo->GetNbElem()){
316 for(TInt anId = 0; anId < myNbElem; anId++){
317 SetFamNum(anId, theInfo->GetFamNum(anId));
319 if(theInfo->IsElemNum() == eVRAI){
320 for(TInt anId = 0; anId < myNbElem; anId++){
321 SetElemNum(anId, theInfo->GetElemNum(anId));
324 if(theInfo->IsElemNames() == eVRAI){
325 for(TInt anId = 0; anId < myNbElem; anId++){
326 SetElemName(anId,theInfo->GetElemName(anId));
332 TTElemInfo(const PMeshInfo& theMeshInfo,
334 EBooleen theIsElemNum,
335 EBooleen theIsElemNames)
337 myMeshInfo = theMeshInfo;
339 myNbElem = theNbElem;
340 myFamNum.reset(new TElemNum(theNbElem));
341 myIsFamNum = eFAUX; // is set to eVRAI in SetFamNum()
343 myIsElemNum = theIsElemNum;
345 myElemNum.reset(new TElemNum(theNbElem));
347 myElemNum.reset(new TElemNum());
349 myIsElemNames = theIsElemNames;
351 myElemNames.reset(new TString(theNbElem*GetPNOMLength() + 1));
353 myElemNames.reset(new TString());
356 TTElemInfo(const PMeshInfo& theMeshInfo,
358 const TIntVector& theFamilyNums,
359 const TIntVector& theElemNums,
360 const TStringVector& theElemNames)
362 myMeshInfo = theMeshInfo;
364 myNbElem = theNbElem;
365 myFamNum.reset(new TElemNum(theNbElem));
366 myIsFamNum = eFAUX; // is set to eVRAI in SetFamNum()
368 myIsElemNum = theElemNums.size()? eVRAI: eFAUX;
370 myElemNum.reset(new TElemNum(theNbElem));
372 myElemNum.reset(new TElemNum());
374 myIsElemNames = theElemNames.size()? eVRAI: eFAUX;
376 myElemNames.reset(new TString(theNbElem*GetPNOMLength() + 1));
378 myElemNames.reset(new TString());
382 if(theFamilyNums.size())
383 *myFamNum = theFamilyNums;
386 *myElemNum = theElemNums;
389 for(TInt anId = 0; anId < theNbElem; anId++){
390 const std::string& aVal = theElemNames[anId];
391 SetElemName(anId,aVal);
399 GetElemName(TInt theId) const
401 return GetString(theId,GetPNOMLength(), *myElemNames);
406 SetElemName(TInt theId, const std::string& theValue)
408 SetString(theId,GetPNOMLength(), *myElemNames, theValue);
412 //---------------------------------------------------------------
417 typedef TTElemInfo TElemInfoBase;
419 TTNodeInfo(const PMeshInfo& theMeshInfo, const PNodeInfo& theInfo):
421 TElemInfoBase(theMeshInfo, theInfo)
423 myModeSwitch = theInfo->GetModeSwitch();
425 mySystem = theInfo->GetSystem();
427 myCoord.reset(new TNodeCoord(*theInfo->myCoord));
429 TInt aSpaceDim = theMeshInfo->GetSpaceDim();
431 myCoordNames.resize(aSpaceDim*GetPNOMLength()+1);
432 for(TInt anId = 0; anId < aSpaceDim; anId++)
433 SetCoordName(anId,theInfo->GetCoordName(anId));
435 myCoordUnits.resize(aSpaceDim*GetPNOMLength()+1);
436 for(TInt anId = 0; anId < aSpaceDim; anId++)
437 SetCoordUnit(anId,theInfo->GetCoordUnit(anId));
440 TTNodeInfo(const PMeshInfo& theMeshInfo,
444 EBooleen theIsElemNum,
445 EBooleen theIsElemNames):
446 TModeSwitchInfo(theMode),
447 TElemInfoBase(theMeshInfo,
452 mySystem = theSystem;
454 myCoord.reset(new TNodeCoord(theNbElem * theMeshInfo->mySpaceDim));
456 myCoordUnits.resize(theMeshInfo->mySpaceDim*GetPNOMLength()+1);
458 myCoordNames.resize(theMeshInfo->mySpaceDim*GetPNOMLength()+1);
462 TTNodeInfo(const PMeshInfo& theMeshInfo,
463 const TFloatVector& theNodeCoords,
466 const TStringVector& theCoordNames,
467 const TStringVector& theCoordUnits,
468 const TIntVector& theFamilyNums,
469 const TIntVector& theElemNums,
470 const TStringVector& theElemNames):
471 TModeSwitchInfo(theMode),
472 TElemInfoBase(theMeshInfo,
473 (TInt)theNodeCoords.size()/theMeshInfo->GetDim(),
478 mySystem = theSystem;
480 myCoord.reset(new TNodeCoord(theNodeCoords));
482 TInt aSpaceDim = theMeshInfo->GetSpaceDim();
484 myCoordNames.resize(aSpaceDim*GetPNOMLength()+1);
485 if(!theCoordNames.empty())
486 for(TInt anId = 0; anId < aSpaceDim; anId++)
487 SetCoordName(anId,theCoordNames[anId]);
489 myCoordUnits.resize(aSpaceDim*GetPNOMLength() + 1);
490 if(!theCoordUnits.empty())
491 for(TInt anId = 0; anId < aSpaceDim; anId++)
492 SetCoordUnit(anId, theCoordUnits[anId]);
497 GetCoordName(TInt theId) const
499 return GetString(theId,GetPNOMLength(),myCoordNames);
504 SetCoordName(TInt theId, const std::string& theValue)
506 SetString(theId,GetPNOMLength(),myCoordNames,theValue);
511 GetCoordUnit(TInt theId) const
513 return GetString(theId,GetPNOMLength(),myCoordUnits);
518 SetCoordUnit(TInt theId, const std::string& theValue)
520 SetString(theId,GetPNOMLength(),myCoordUnits,theValue);
524 //---------------------------------------------------------------
525 struct TTPolygoneInfo:
526 virtual TPolygoneInfo,
529 typedef TTElemInfo TElemInfoBase;
531 TTPolygoneInfo(const PMeshInfo& theMeshInfo, const PPolygoneInfo& theInfo):
532 TElemInfoBase(theMeshInfo,theInfo)
534 myEntity = theInfo->GetEntity();
535 myGeom = theInfo->GetGeom();
537 myIndex.reset(new TElemNum(*theInfo->myIndex));
538 myConn.reset(new TElemNum(*theInfo->myConn));
540 myConnMode = theInfo->GetConnMode();
543 TTPolygoneInfo(const PMeshInfo& theMeshInfo,
544 EEntiteMaillage theEntity,
545 EGeometrieElement theGeom,
548 EConnectivite theConnMode,
549 EBooleen theIsElemNum,
550 EBooleen theIsElemNames):
551 TElemInfoBase(theMeshInfo,
556 myEntity = theEntity;
559 myIndex.reset(new TElemNum(theNbElem + 1));
560 myConn.reset(new TElemNum(theConnSize));
562 myConnMode = theConnMode;
565 TTPolygoneInfo(const PMeshInfo& theMeshInfo,
566 EEntiteMaillage theEntity,
567 EGeometrieElement theGeom,
568 const TIntVector& theIndexes,
569 const TIntVector& theConnectivities,
570 EConnectivite theConnMode,
571 const TIntVector& theFamilyNums,
572 const TIntVector& theElemNums,
573 const TStringVector& theElemNames):
574 TElemInfoBase(theMeshInfo,
575 (TInt)theIndexes.size() - 1,
580 myEntity = theEntity;
583 myIndex.reset(new TElemNum(theIndexes));
584 myConn.reset(new TElemNum(theConnectivities));
586 myConnMode = theConnMode;
590 //---------------------------------------------------------------
591 struct TTPolyedreInfo:
592 virtual TPolyedreInfo,
595 typedef TTElemInfo TElemInfoBase;
597 TTPolyedreInfo(const PMeshInfo& theMeshInfo, const PPolyedreInfo& theInfo):
598 TElemInfoBase(theMeshInfo,theInfo)
600 myEntity = theInfo->GetEntity();
601 myGeom = theInfo->GetGeom();
603 myIndex.reset(new TElemNum(*theInfo->myIndex));
604 myFaces.reset(new TElemNum(*theInfo->myFaces));
605 myConn.reset(new TElemNum(*theInfo->myConn));
607 myConnMode = theInfo->GetConnMode();
610 TTPolyedreInfo(const PMeshInfo& theMeshInfo,
611 EEntiteMaillage theEntity,
612 EGeometrieElement theGeom,
616 EConnectivite theConnMode,
617 EBooleen theIsElemNum,
618 EBooleen theIsElemNames):
619 TElemInfoBase(theMeshInfo,
624 myEntity = theEntity;
627 myIndex.reset(new TElemNum(theNbElem + 1));
628 myFaces.reset(new TElemNum(theNbFaces));
629 myConn.reset(new TElemNum(theConnSize));
631 myConnMode = theConnMode;
634 TTPolyedreInfo(const PMeshInfo& theMeshInfo,
635 EEntiteMaillage theEntity,
636 EGeometrieElement theGeom,
637 const TIntVector& theIndexes,
638 const TIntVector& theFaces,
639 const TIntVector& theConnectivities,
640 EConnectivite theConnMode,
641 const TIntVector& theFamilyNums,
642 const TIntVector& theElemNums,
643 const TStringVector& theElemNames):
644 TElemInfoBase(theMeshInfo,
645 (TInt)theIndexes.size()-1,
650 myEntity = theEntity;
653 myIndex.reset(new TElemNum(theIndexes));
654 myFaces.reset(new TElemNum(theFaces));
655 myConn.reset(new TElemNum(theConnectivities));
657 myConnMode = theConnMode;
661 //---------------------------------------------------------------
666 typedef TTElemInfo TElemInfoBase;
668 TTCellInfo(const PMeshInfo& theMeshInfo, const PCellInfo& theInfo):
669 TElemInfoBase(theMeshInfo,theInfo)
671 myEntity = theInfo->GetEntity();
672 myGeom = theInfo->GetGeom();
673 myConnMode = theInfo->GetConnMode();
675 TInt aConnDim = GetNbNodes(myGeom);
676 TInt aNbConn = GetNbConn(myGeom, myEntity, myMeshInfo->myDim);
677 myConn.reset(new TElemNum(myNbElem * aNbConn));
678 for(TInt anElemId = 0; anElemId < myNbElem; anElemId++){
679 TConnSlice aConnSlice = GetConnSlice(anElemId);
680 TCConnSlice aConnSlice2 = theInfo->GetConnSlice(anElemId);
681 for(TInt anConnId = 0; anConnId < aConnDim; anConnId++){
682 aConnSlice[anConnId] = aConnSlice2[anConnId];
687 TTCellInfo(const PMeshInfo& theMeshInfo,
688 EEntiteMaillage theEntity,
689 EGeometrieElement theGeom,
691 EConnectivite theConnMode,
692 EBooleen theIsElemNum,
693 EBooleen theIsElemNames,
694 EModeSwitch theMode):
695 TModeSwitchInfo(theMode),
696 TElemInfoBase(theMeshInfo,
701 myEntity = theEntity;
704 myConnMode = theConnMode;
705 TInt aNbConn = GetNbConn(theGeom, myEntity, theMeshInfo->myDim);
706 myConn.reset(new TElemNum(theNbElem * aNbConn));
709 TTCellInfo(const PMeshInfo& theMeshInfo,
710 EEntiteMaillage theEntity,
711 EGeometrieElement theGeom,
712 const TIntVector& theConnectivities,
713 EConnectivite theConnMode,
714 const TIntVector& theFamilyNums,
715 const TIntVector& theElemNums,
716 const TStringVector& theElemNames,
717 EModeSwitch theMode):
718 TModeSwitchInfo(theMode),
719 TElemInfoBase(theMeshInfo,
720 (TInt)theConnectivities.size() / GetNbNodes(theGeom),
725 myEntity = theEntity;
728 myConnMode = theConnMode;
729 TInt aConnDim = GetNbNodes(myGeom);
730 TInt aNbConn = GetNbConn(myGeom, myEntity, myMeshInfo->myDim);
731 myConn.reset(new TElemNum(myNbElem * aNbConn));
732 for(TInt anElemId = 0; anElemId < myNbElem; anElemId++){
733 TConnSlice aConnSlice = GetConnSlice(anElemId);
734 for(TInt anConnId = 0; anConnId < aConnDim; anConnId++){
735 aConnSlice[anConnId] = theConnectivities[anElemId*aConnDim + anConnId];
744 return GetNbConn(myGeom, myEntity, myMeshInfo->myDim);
749 //---------------------------------------------------------------
754 typedef TTCellInfo TCellInfoBase;
756 TTBallInfo(const PMeshInfo& theMeshInfo, const PBallInfo& theInfo):
757 TCellInfoBase::TElemInfoBase(theMeshInfo, theInfo),
758 TCellInfoBase(theMeshInfo,theInfo)
760 myDiameters = theInfo->myDiameters;
763 TTBallInfo(const PMeshInfo& theMeshInfo,
765 EBooleen theIsElemNum ):
766 TCellInfoBase::TElemInfoBase(theMeshInfo,
769 /*theIsElemNames=*/eFAUX),
770 TCellInfoBase(theMeshInfo,
774 /*EConnectivite=*/eNOD,
776 /*theIsElemNames=*/eFAUX,
779 myDiameters.resize( theNbElem );
782 TTBallInfo(const PMeshInfo& theMeshInfo,
783 const TIntVector& theNodes,
784 TFloatVector& theDiameters,
785 const TIntVector& theFamilyNums,
786 const TIntVector& theElemNums):
787 TCellInfoBase::TElemInfoBase(theMeshInfo,
788 (TInt)std::max(theNodes.size(),theDiameters.size() ),
792 TCellInfoBase(theMeshInfo,
796 /*EConnectivite=*/eNOD,
802 myDiameters.swap( theDiameters );
806 //---------------------------------------------------------------
811 typedef TTNameInfo TNameInfoBase;
813 TTFieldInfo(const PMeshInfo& theMeshInfo, const PFieldInfo& theInfo):
814 TNameInfoBase(theInfo->GetName())
816 myMeshInfo = theMeshInfo;
818 myNbComp = theInfo->GetNbComp();
819 myCompNames.resize(myNbComp*GetPNOMLength()+1);
820 for(TInt anId = 0; anId < myNbComp; anId++){
821 SetCompName(anId,theInfo->GetCompName(anId));
824 myUnitNames.resize(myNbComp*GetPNOMLength()+1);
825 for(TInt anId = 0; anId < myNbComp; anId++){
826 SetUnitName(anId,theInfo->GetUnitName(anId));
829 myType = theInfo->GetType();
831 myIsLocal = theInfo->GetIsLocal();
832 myNbRef = theInfo->GetNbRef();
835 TTFieldInfo(const PMeshInfo& theMeshInfo,
838 const std::string& theValue,
841 TNameInfoBase(theValue)
843 myMeshInfo = theMeshInfo;
845 myNbComp = theNbComp;
846 myCompNames.resize(theNbComp*GetPNOMLength()+1);
847 myUnitNames.resize(theNbComp*GetPNOMLength()+1);
851 myIsLocal = theIsLocal;
857 GetCompName(TInt theId) const
859 return GetString(theId,GetPNOMLength(),myCompNames);
864 SetCompName(TInt theId, const std::string& theValue)
866 SetString(theId,GetPNOMLength(),myCompNames,theValue);
871 GetUnitName(TInt theId) const
873 return GetString(theId,GetPNOMLength(),myUnitNames);
878 SetUnitName(TInt theId, const std::string& theValue)
880 SetString(theId,GetPNOMLength(),myUnitNames,theValue);
884 //---------------------------------------------------------------
889 typedef TTNameInfo TNameInfoBase;
891 TTGaussInfo(const TGaussInfo::TInfo& theInfo,
892 EModeSwitch theMode):
893 TModeSwitchInfo(theMode),
894 TNameInfoBase(boost::get<1>(boost::get<0>(theInfo)))
896 const TGaussInfo::TKey& aKey = boost::get<0>(theInfo);
898 myGeom = boost::get<0>(aKey);
899 myRefCoord.resize(GetNbRef()*GetDim());
901 TInt aNbGauss = boost::get<1>(theInfo);
902 myGaussCoord.resize(aNbGauss*GetDim());
903 myWeight.resize(aNbGauss);
907 //---------------------------------------------------------------
908 struct TTTimeStampInfo: virtual TTimeStampInfo
910 TTTimeStampInfo(const PFieldInfo& theFieldInfo, const PTimeStampInfo& theInfo)
912 myFieldInfo = theFieldInfo;
914 myEntity = theInfo->GetEntity();
915 myGeom2Size = theInfo->GetGeom2Size();
917 myNumDt = theInfo->GetNumDt();
918 myNumOrd = theInfo->GetNumOrd();
919 myDt = theInfo->GetDt();
921 myUnitDt.resize(GetPNOMLength()+1);
922 SetUnitDt(theInfo->GetUnitDt());
924 myGeom2NbGauss = theInfo->myGeom2NbGauss;
925 myGeom2Gauss = theInfo->GetGeom2Gauss();
928 TTTimeStampInfo(const PFieldInfo& theFieldInfo,
929 EEntiteMaillage theEntity,
930 const TGeom2Size& theGeom2Size,
931 const TGeom2NbGauss& theGeom2NbGauss,
935 const std::string& theUnitDt,
936 const TGeom2Gauss& theGeom2Gauss)
938 myFieldInfo = theFieldInfo;
940 myEntity = theEntity;
941 myGeom2Size = theGeom2Size;
947 myUnitDt.resize(GetPNOMLength()+1);
948 SetUnitDt(theUnitDt);
950 myGeom2NbGauss = theGeom2NbGauss;
951 myGeom2Gauss = theGeom2Gauss;
958 return GetString(0,GetPNOMLength(),myUnitDt);
963 SetUnitDt(const std::string& theValue)
965 SetString(0,GetPNOMLength(),myUnitDt,theValue);
969 //---------------------------------------------------------------
970 struct TTProfileInfo:
971 virtual TProfileInfo,
974 typedef TTNameInfo TNameInfoBase;
976 TTProfileInfo(const TProfileInfo::TInfo& theInfo,
977 EModeProfil theMode):
978 TNameInfoBase(boost::get<0>(theInfo))
980 TInt aSize = boost::get<1>(theInfo);
981 myElemNum.reset(new TElemNum(aSize));
982 myMode = aSize > 0? theMode: eNO_PFLMOD;
986 //---------------------------------------------------------------
987 template<class TMeshValueType>
988 struct TTTimeStampValue: virtual TTimeStampValue<TMeshValueType>
990 TTTimeStampValue(const PTimeStampInfo& theTimeStampInfo,
991 const PTimeStampValueBase& theInfo,
992 ETypeChamp theTypeChamp)
994 typedef TTimeStampValue<TMeshValueType> TCompatible;
995 if(TCompatible* aCompatible = dynamic_cast<TCompatible*>(theInfo.get())){
996 this->myTimeStampInfo = theTimeStampInfo;
997 this->myTypeChamp = theTypeChamp;
998 this->myGeom2Profile = aCompatible->GetGeom2Profile();
999 this->myGeom2Value = aCompatible->myGeom2Value;
1000 this->myGeomSet = aCompatible->GetGeomSet();
1002 EXCEPTION(std::runtime_error,"TTTimeStampValue::TTTimeStampValue - use incompatible arguments!");
1005 TTTimeStampValue(const PTimeStampInfo& theTimeStampInfo,
1006 ETypeChamp theTypeChamp,
1007 const TGeom2Profile& theGeom2Profile,
1008 EModeSwitch theMode):
1009 TModeSwitchInfo(theMode)
1011 this->myTimeStampInfo = theTimeStampInfo;
1013 this->myTypeChamp = theTypeChamp;
1015 this->myGeom2Profile = theGeom2Profile;
1017 TInt aNbComp = theTimeStampInfo->myFieldInfo->myNbComp;
1019 const TGeom2Size& aGeom2Size = theTimeStampInfo->GetGeom2Size();
1020 TGeom2Size::const_iterator anIter = aGeom2Size.begin();
1021 for(; anIter != aGeom2Size.end(); anIter++){
1022 const EGeometrieElement& aGeom = anIter->first;
1023 TInt aNbElem = anIter->second;
1025 MED::PProfileInfo aProfileInfo;
1026 MED::TGeom2Profile::const_iterator anIter = theGeom2Profile.find(aGeom);
1027 if(anIter != theGeom2Profile.end())
1028 aProfileInfo = anIter->second;
1030 if(aProfileInfo && aProfileInfo->IsPresent())
1031 aNbElem = aProfileInfo->GetSize();
1033 TInt aNbGauss = theTimeStampInfo->GetNbGauss(aGeom);
1035 this->GetMeshValue(aGeom).Allocate(aNbElem,aNbGauss,aNbComp);
1041 GetValueSize(EGeometrieElement theGeom) const
1043 return this->GetMeshValue(theGeom).GetSize();
1048 GetNbVal(EGeometrieElement theGeom) const
1050 return this->GetMeshValue(theGeom).GetNbVal();
1055 GetNbGauss(EGeometrieElement theGeom) const
1057 return this->GetMeshValue(theGeom).GetNbGauss();
1062 AllocateValue(EGeometrieElement theGeom,
1066 EModeSwitch theMode = eFULL_INTERLACE)
1068 this->GetMeshValue(theGeom).Allocate(theNbElem,theNbGauss,theNbComp,theMode);
1073 GetValuePtr(EGeometrieElement theGeom)
1075 return this->GetMeshValue(theGeom).GetValuePtr();
1079 //---------------------------------------------------------------
1080 struct TTGrilleInfo:
1083 TTGrilleInfo(const PMeshInfo& theMeshInfo,
1084 const PGrilleInfo& theInfo)
1086 myMeshInfo = theMeshInfo;
1088 myCoord = theInfo->GetNodeCoord();
1090 myGrilleType = theInfo->GetGrilleType();
1092 myCoordNames = theInfo->myCoordNames;
1094 myCoordUnits = theInfo->myCoordUnits;
1096 myIndixes = theInfo->GetMapOfIndexes();
1098 myGrilleStructure = theInfo->GetGrilleStructure();
1100 myGrilleType = theInfo->GetGrilleType();
1102 myFamNumNode.resize(theInfo->GetNbNodes());
1103 myFamNumNode = theInfo->myFamNumNode;
1105 myFamNum = theInfo->myFamNum;
1108 TTGrilleInfo(const PMeshInfo& theMeshInfo,
1109 const EGrilleType& type,
1112 myMeshInfo = theMeshInfo;
1113 TInt aSpaceDim = theMeshInfo->GetSpaceDim();
1114 if(type == eGRILLE_STANDARD){
1115 myCoord.resize(aSpaceDim*nnoeuds);
1116 myCoordNames.resize(aSpaceDim*GetPNOMLength()+1);
1117 myCoordUnits.resize(aSpaceDim*GetPNOMLength()+1);
1118 } else { //if(type == eGRILLE_CARTESIENNE){
1119 myCoordNames.resize(aSpaceDim*GetPNOMLength()+aSpaceDim);
1120 myCoordUnits.resize(aSpaceDim*GetPNOMLength()+aSpaceDim);
1122 myGrilleStructure.resize(aSpaceDim);
1123 myFamNumNode.resize(nnoeuds);
1126 TTGrilleInfo(const PMeshInfo& theMeshInfo,
1127 const EGrilleType& type)
1129 myMeshInfo = theMeshInfo;
1130 TInt aSpaceDim = theMeshInfo->GetSpaceDim();
1131 if(type == eGRILLE_STANDARD){
1132 myCoordNames.resize(aSpaceDim*GetPNOMLength()+1);
1133 myCoordUnits.resize(aSpaceDim*GetPNOMLength()+1);
1134 } else {// if(type == eGRILLE_CARTESIENNE){
1135 myCoordNames.resize(aSpaceDim*GetPNOMLength()+aSpaceDim);
1136 myCoordUnits.resize(aSpaceDim*GetPNOMLength()+aSpaceDim);
1138 myGrilleStructure.resize(aSpaceDim);
1141 TTGrilleInfo(const PMeshInfo& theMeshInfo,
1142 const EGrilleType& type,
1143 const MED::TIntVector& nbNodeVec)
1145 myMeshInfo = theMeshInfo;
1147 TInt aSpaceDim = theMeshInfo->GetSpaceDim();
1148 if(type == eGRILLE_STANDARD){
1149 myCoordNames.resize(aSpaceDim*GetPNOMLength()+1);
1150 myCoordUnits.resize(aSpaceDim*GetPNOMLength()+1);
1151 } else {// if(type == eGRILLE_CARTESIENNE){
1152 myCoordNames.resize(aSpaceDim*GetPNOMLength()+aSpaceDim);
1153 myCoordUnits.resize(aSpaceDim*GetPNOMLength()+aSpaceDim);
1156 if(type != eGRILLE_STANDARD)
1157 for(unsigned int aAxe=0;aAxe<nbNodeVec.size();aAxe++){
1158 myIndixes[aAxe].resize(nbNodeVec[aAxe]);
1160 myGrilleStructure.resize(aSpaceDim);
1165 GetCoordName(TInt theId) const
1167 return GetString(theId,GetPNOMLength(),myCoordNames);
1172 SetCoordName(TInt theId, const std::string& theValue)
1174 SetString(theId,GetPNOMLength(),myCoordNames,theValue);
1179 GetCoordUnit(TInt theId) const
1181 return GetString(theId,GetPNOMLength(),myCoordUnits);
1186 SetCoordUnit(TInt theId, const std::string& theValue)
1188 SetString(theId,GetPNOMLength(),myCoordUnits,theValue);
1193 #endif // MED_TStructures_HeaderFile