1 // Copyright (C) 2007-2013 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
23 #ifndef MED_TStructures_HeaderFile
24 #define MED_TStructures_HeaderFile
26 #include "MED_Structures.hxx"
29 #pragma warning(disable:4250)
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 template<EVersion eVersion>
96 struct TTNameInfo: virtual TNameInfo
98 TTNameInfo(const std::string& theValue)
100 myName.resize(GetNOMLength<eVersion>()+1);
108 return GetString(0, GetNOMLength<eVersion>(), myName);
113 SetName(const std::string& theValue)
115 SetString(0, GetNOMLength<eVersion>(), myName, theValue);
120 SetName(const TString& theValue)
122 SetString(0, GetNOMLength<eVersion>(), myName, theValue);
127 //---------------------------------------------------------------
128 template<EVersion eVersion>
131 virtual TTNameInfo<eVersion>
133 typedef TTNameInfo<eVersion> TNameInfoBase;
135 TTMeshInfo(const PMeshInfo& theInfo):
136 TNameInfoBase(theInfo->GetName())
138 myDim = theInfo->GetDim();
139 mySpaceDim = theInfo->GetSpaceDim();
140 myType = theInfo->GetType();
142 myDesc.resize(GetDESCLength<eVersion>()+1);
143 SetDesc(theInfo->GetDesc());
146 TTMeshInfo(TInt theDim, TInt theSpaceDim,
147 const std::string& theValue,
149 const std::string& theDesc):
150 TNameInfoBase(theValue)
153 mySpaceDim = theSpaceDim;
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));
308 myIsFamNum = eFAUX; // is set to eVRAI in SetFamNum()
310 myIsElemNum = theInfo->IsElemNum();
311 if(theInfo->IsElemNum())
312 myElemNum.reset(new TElemNum(myNbElem));
314 myElemNum.reset(new TElemNum());
316 myIsElemNames = theInfo->IsElemNames();
317 if(theInfo->IsElemNames())
318 myElemNames.reset(new TString(myNbElem*GetPNOMLength<eVersion>() + 1));
320 myElemNames.reset(new TString());
322 if(theInfo->GetNbElem()){
323 for(TInt anId = 0; anId < myNbElem; anId++){
324 SetFamNum(anId, theInfo->GetFamNum(anId));
326 if(theInfo->IsElemNum() == eVRAI){
327 for(TInt anId = 0; anId < myNbElem; anId++){
328 SetElemNum(anId, theInfo->GetElemNum(anId));
331 if(theInfo->IsElemNames() == eVRAI){
332 for(TInt anId = 0; anId < myNbElem; anId++){
333 SetElemName(anId,theInfo->GetElemName(anId));
339 TTElemInfo(const PMeshInfo& theMeshInfo,
341 EBooleen theIsElemNum,
342 EBooleen theIsElemNames)
344 myMeshInfo = theMeshInfo;
346 myNbElem = theNbElem;
347 myFamNum.reset(new TElemNum(theNbElem));
348 myIsFamNum = eFAUX; // is set to eVRAI in SetFamNum()
350 myIsElemNum = theIsElemNum;
352 myElemNum.reset(new TElemNum(theNbElem));
354 myElemNum.reset(new TElemNum());
356 myIsElemNames = theIsElemNames;
358 myElemNames.reset(new TString(theNbElem*GetPNOMLength<eVersion>() + 1));
360 myElemNames.reset(new TString());
363 TTElemInfo(const PMeshInfo& theMeshInfo,
365 const TIntVector& theFamilyNums,
366 const TIntVector& theElemNums,
367 const TStringVector& theElemNames)
369 myMeshInfo = theMeshInfo;
371 myNbElem = theNbElem;
372 myFamNum.reset(new TElemNum(theNbElem));
373 myIsFamNum = eFAUX; // is set to eVRAI in SetFamNum()
375 myIsElemNum = theElemNums.size()? eVRAI: eFAUX;
377 myElemNum.reset(new TElemNum(theNbElem));
379 myElemNum.reset(new TElemNum());
381 myIsElemNames = theElemNames.size()? eVRAI: eFAUX;
383 myElemNames.reset(new TString(theNbElem*GetPNOMLength<eVersion>() + 1));
385 myElemNames.reset(new TString());
389 if(theFamilyNums.size())
390 *myFamNum = theFamilyNums;
393 *myElemNum = theElemNums;
396 for(TInt anId = 0; anId < theNbElem; anId++){
397 const std::string& aVal = theElemNames[anId];
398 SetElemName(anId,aVal);
406 GetElemName(TInt theId) const
408 return GetString(theId,GetPNOMLength<eVersion>(), *myElemNames);
413 SetElemName(TInt theId, const std::string& theValue)
415 SetString(theId,GetPNOMLength<eVersion>(), *myElemNames, theValue);
420 //---------------------------------------------------------------
421 template<EVersion eVersion>
424 virtual TTElemInfo<eVersion>
426 typedef TTElemInfo<eVersion> TElemInfoBase;
428 TTNodeInfo(const PMeshInfo& theMeshInfo, const PNodeInfo& theInfo):
430 TElemInfoBase(theMeshInfo, theInfo)
432 myModeSwitch = theInfo->GetModeSwitch();
434 mySystem = theInfo->GetSystem();
436 myCoord.reset(new TNodeCoord(*theInfo->myCoord));
438 TInt aSpaceDim = theMeshInfo->GetSpaceDim();
440 myCoordNames.resize(aSpaceDim*GetPNOMLength<eVersion>()+1);
441 for(TInt anId = 0; anId < aSpaceDim; anId++)
442 SetCoordName(anId,theInfo->GetCoordName(anId));
444 myCoordUnits.resize(aSpaceDim*GetPNOMLength<eVersion>()+1);
445 for(TInt anId = 0; anId < aSpaceDim; anId++)
446 SetCoordUnit(anId,theInfo->GetCoordUnit(anId));
449 TTNodeInfo(const PMeshInfo& theMeshInfo,
453 EBooleen theIsElemNum,
454 EBooleen theIsElemNames):
455 TModeSwitchInfo(theMode),
456 TElemInfoBase(theMeshInfo,
461 mySystem = theSystem;
463 myCoord.reset(new TNodeCoord(theNbElem * theMeshInfo->mySpaceDim));
465 myCoordUnits.resize(theMeshInfo->mySpaceDim*GetPNOMLength<eVersion>()+1);
467 myCoordNames.resize(theMeshInfo->mySpaceDim*GetPNOMLength<eVersion>()+1);
471 TTNodeInfo(const PMeshInfo& theMeshInfo,
472 const TFloatVector& theNodeCoords,
475 const TStringVector& theCoordNames,
476 const TStringVector& theCoordUnits,
477 const TIntVector& theFamilyNums,
478 const TIntVector& theElemNums,
479 const TStringVector& theElemNames):
480 TModeSwitchInfo(theMode),
481 TElemInfoBase(theMeshInfo,
482 (TInt)theNodeCoords.size()/theMeshInfo->GetDim(),
487 mySystem = theSystem;
489 myCoord.reset(new TNodeCoord(theNodeCoords));
491 TInt aSpaceDim = theMeshInfo->GetSpaceDim();
493 myCoordNames.resize(aSpaceDim*GetPNOMLength<eVersion>()+1);
494 if(!theCoordNames.empty())
495 for(TInt anId = 0; anId < aSpaceDim; anId++)
496 SetCoordName(anId,theCoordNames[anId]);
498 myCoordUnits.resize(aSpaceDim*GetPNOMLength<eVersion>() + 1);
499 if(!theCoordUnits.empty())
500 for(TInt anId = 0; anId < aSpaceDim; anId++)
501 SetCoordUnit(anId, theCoordUnits[anId]);
506 GetCoordName(TInt theId) const
508 return GetString(theId,GetPNOMLength<eVersion>(),myCoordNames);
513 SetCoordName(TInt theId, const std::string& theValue)
515 SetString(theId,GetPNOMLength<eVersion>(),myCoordNames,theValue);
520 GetCoordUnit(TInt theId) const
522 return GetString(theId,GetPNOMLength<eVersion>(),myCoordUnits);
527 SetCoordUnit(TInt theId, const std::string& theValue)
529 SetString(theId,GetPNOMLength<eVersion>(),myCoordUnits,theValue);
533 //---------------------------------------------------------------
534 template<EVersion eVersion>
535 struct TTPolygoneInfo:
536 virtual TPolygoneInfo,
537 virtual TTElemInfo<eVersion>
539 typedef TTElemInfo<eVersion> TElemInfoBase;
541 TTPolygoneInfo(const PMeshInfo& theMeshInfo, const PPolygoneInfo& theInfo):
542 TElemInfoBase(theMeshInfo,theInfo)
544 myEntity = theInfo->GetEntity();
545 myGeom = theInfo->GetGeom();
547 myIndex.reset(new TElemNum(*theInfo->myIndex));
548 myConn.reset(new TElemNum(*theInfo->myConn));
550 myConnMode = theInfo->GetConnMode();
553 TTPolygoneInfo(const PMeshInfo& theMeshInfo,
554 EEntiteMaillage theEntity,
555 EGeometrieElement theGeom,
558 EConnectivite theConnMode,
559 EBooleen theIsElemNum,
560 EBooleen theIsElemNames):
561 TElemInfoBase(theMeshInfo,
566 myEntity = theEntity;
569 myIndex.reset(new TElemNum(theNbElem + 1));
570 myConn.reset(new TElemNum(theConnSize));
572 myConnMode = theConnMode;
575 TTPolygoneInfo(const PMeshInfo& theMeshInfo,
576 EEntiteMaillage theEntity,
577 EGeometrieElement theGeom,
578 const TIntVector& theIndexes,
579 const TIntVector& theConnectivities,
580 EConnectivite theConnMode,
581 const TIntVector& theFamilyNums,
582 const TIntVector& theElemNums,
583 const TStringVector& theElemNames):
584 TElemInfoBase(theMeshInfo,
585 (TInt)theIndexes.size() - 1,
590 myEntity = theEntity;
593 myIndex.reset(new TElemNum(theIndexes));
594 myConn.reset(new TElemNum(theConnectivities));
596 myConnMode = theConnMode;
600 //---------------------------------------------------------------
601 template<EVersion eVersion>
602 struct TTPolyedreInfo:
603 virtual TPolyedreInfo,
604 virtual TTElemInfo<eVersion>
606 typedef TTElemInfo<eVersion> TElemInfoBase;
608 TTPolyedreInfo(const PMeshInfo& theMeshInfo, const PPolyedreInfo& theInfo):
609 TElemInfoBase(theMeshInfo,theInfo)
611 myEntity = theInfo->GetEntity();
612 myGeom = theInfo->GetGeom();
614 myIndex.reset(new TElemNum(*theInfo->myIndex));
615 myFaces.reset(new TElemNum(*theInfo->myFaces));
616 myConn.reset(new TElemNum(*theInfo->myConn));
618 myConnMode = theInfo->GetConnMode();
621 TTPolyedreInfo(const PMeshInfo& theMeshInfo,
622 EEntiteMaillage theEntity,
623 EGeometrieElement theGeom,
627 EConnectivite theConnMode,
628 EBooleen theIsElemNum,
629 EBooleen theIsElemNames):
630 TElemInfoBase(theMeshInfo,
635 myEntity = theEntity;
638 myIndex.reset(new TElemNum(theNbElem + 1));
639 myFaces.reset(new TElemNum(theNbFaces));
640 myConn.reset(new TElemNum(theConnSize));
642 myConnMode = theConnMode;
645 TTPolyedreInfo(const PMeshInfo& theMeshInfo,
646 EEntiteMaillage theEntity,
647 EGeometrieElement theGeom,
648 const TIntVector& theIndexes,
649 const TIntVector& theFaces,
650 const TIntVector& theConnectivities,
651 EConnectivite theConnMode,
652 const TIntVector& theFamilyNums,
653 const TIntVector& theElemNums,
654 const TStringVector& theElemNames):
655 TElemInfoBase(theMeshInfo,
656 (TInt)theIndexes.size()-1,
661 myEntity = theEntity;
664 myIndex.reset(new TElemNum(theIndexes));
665 myFaces.reset(new TElemNum(theFaces));
666 myConn.reset(new TElemNum(theConnectivities));
668 myConnMode = theConnMode;
672 //---------------------------------------------------------------
673 template<EVersion eVersion>
676 virtual TTElemInfo<eVersion>
678 typedef TTElemInfo<eVersion> TElemInfoBase;
680 TTCellInfo(const PMeshInfo& theMeshInfo, const PCellInfo& theInfo):
681 TElemInfoBase(theMeshInfo,theInfo)
683 myEntity = theInfo->GetEntity();
684 myGeom = theInfo->GetGeom();
685 myConnMode = theInfo->GetConnMode();
687 TInt aConnDim = GetNbNodes(myGeom);
688 TInt aNbConn = GetNbConn<eVersion>(myGeom, myEntity, myMeshInfo->myDim);
689 myConn.reset(new TElemNum(myNbElem * aNbConn));
690 for(TInt anElemId = 0; anElemId < myNbElem; anElemId++){
691 TConnSlice aConnSlice = GetConnSlice(anElemId);
692 TCConnSlice aConnSlice2 = theInfo->GetConnSlice(anElemId);
693 for(TInt anConnId = 0; anConnId < aConnDim; anConnId++){
694 aConnSlice[anConnId] = aConnSlice2[anConnId];
699 TTCellInfo(const PMeshInfo& theMeshInfo,
700 EEntiteMaillage theEntity,
701 EGeometrieElement theGeom,
703 EConnectivite theConnMode,
704 EBooleen theIsElemNum,
705 EBooleen theIsElemNames,
706 EModeSwitch theMode):
707 TModeSwitchInfo(theMode),
708 TElemInfoBase(theMeshInfo,
713 myEntity = theEntity;
716 myConnMode = theConnMode;
717 TInt aNbConn = GetNbConn<eVersion>(theGeom, myEntity, theMeshInfo->myDim);
718 myConn.reset(new TElemNum(theNbElem * aNbConn));
721 TTCellInfo(const PMeshInfo& theMeshInfo,
722 EEntiteMaillage theEntity,
723 EGeometrieElement theGeom,
724 const TIntVector& theConnectivities,
725 EConnectivite theConnMode,
726 const TIntVector& theFamilyNums,
727 const TIntVector& theElemNums,
728 const TStringVector& theElemNames,
729 EModeSwitch theMode):
730 TModeSwitchInfo(theMode),
731 TElemInfoBase(theMeshInfo,
732 (TInt)theConnectivities.size() / GetNbNodes(theGeom),
737 myEntity = theEntity;
740 myConnMode = theConnMode;
741 TInt aConnDim = GetNbNodes(myGeom);
742 TInt aNbConn = GetNbConn<eVersion>(myGeom, myEntity, myMeshInfo->myDim);
743 myConn.reset(new TElemNum(myNbElem * aNbConn));
744 for(TInt anElemId = 0; anElemId < myNbElem; anElemId++){
745 TConnSlice aConnSlice = GetConnSlice(anElemId);
746 for(TInt anConnId = 0; anConnId < aConnDim; anConnId++){
747 aConnSlice[anConnId] = theConnectivities[anElemId*aConnDim + anConnId];
756 return GetNbConn<eVersion>(myGeom, myEntity, myMeshInfo->myDim);
761 //---------------------------------------------------------------
762 template<EVersion eVersion>
765 virtual TTCellInfo<eVersion>
767 typedef TTCellInfo<eVersion> TCellInfoBase;
769 TTBallInfo(const PMeshInfo& theMeshInfo, const PBallInfo& theInfo):
770 TCellInfoBase::TElemInfoBase(theMeshInfo, theInfo),
771 TCellInfoBase(theMeshInfo,theInfo)
773 myDiameters = theInfo->myDiameters;
776 TTBallInfo(const PMeshInfo& theMeshInfo,
778 EBooleen theIsElemNum ):
779 TCellInfoBase::TElemInfoBase(theMeshInfo,
782 /*theIsElemNames=*/eFAUX),
783 TCellInfoBase(theMeshInfo,
787 /*EConnectivite=*/eNOD,
789 /*theIsElemNames=*/eFAUX,
792 myDiameters.resize( theNbElem );
795 TTBallInfo(const PMeshInfo& theMeshInfo,
796 const TIntVector& theNodes,
797 TFloatVector& theDiameters,
798 const TIntVector& theFamilyNums,
799 const TIntVector& theElemNums):
800 TCellInfoBase::TElemInfoBase(theMeshInfo,
801 (TInt)std::max(theNodes.size(),theDiameters.size() ),
805 TCellInfoBase(theMeshInfo,
809 /*EConnectivite=*/eNOD,
815 myDiameters.swap( theDiameters );
819 //---------------------------------------------------------------
820 template<EVersion eVersion>
823 virtual TTNameInfo<eVersion>
825 typedef TTNameInfo<eVersion> TNameInfoBase;
827 TTFieldInfo(const PMeshInfo& theMeshInfo, const PFieldInfo& theInfo):
828 TNameInfoBase(theInfo->GetName())
830 myMeshInfo = theMeshInfo;
832 myNbComp = theInfo->GetNbComp();
833 myCompNames.resize(myNbComp*GetPNOMLength<eVersion>()+1);
834 for(TInt anId = 0; anId < myNbComp; anId++){
835 SetCompName(anId,theInfo->GetCompName(anId));
838 myUnitNames.resize(myNbComp*GetPNOMLength<eVersion>()+1);
839 for(TInt anId = 0; anId < myNbComp; anId++){
840 SetUnitName(anId,theInfo->GetUnitName(anId));
843 myType = theInfo->GetType();
845 myIsLocal = theInfo->GetIsLocal();
846 myNbRef = theInfo->GetNbRef();
849 TTFieldInfo(const PMeshInfo& theMeshInfo,
852 const std::string& theValue,
855 TNameInfoBase(theValue)
857 myMeshInfo = theMeshInfo;
859 myNbComp = theNbComp;
860 myCompNames.resize(theNbComp*GetPNOMLength<eVersion>()+1);
861 myUnitNames.resize(theNbComp*GetPNOMLength<eVersion>()+1);
865 myIsLocal = theIsLocal;
871 GetCompName(TInt theId) const
873 return GetString(theId,GetPNOMLength<eVersion>(),myCompNames);
878 SetCompName(TInt theId, const std::string& theValue)
880 SetString(theId,GetPNOMLength<eVersion>(),myCompNames,theValue);
885 GetUnitName(TInt theId) const
887 return GetString(theId,GetPNOMLength<eVersion>(),myUnitNames);
892 SetUnitName(TInt theId, const std::string& theValue)
894 SetString(theId,GetPNOMLength<eVersion>(),myUnitNames,theValue);
899 //---------------------------------------------------------------
900 template<EVersion eVersion>
903 virtual TTNameInfo<eVersion>
905 typedef TTNameInfo<eVersion> TNameInfoBase;
907 TTGaussInfo(const TGaussInfo::TInfo& theInfo,
908 EModeSwitch theMode):
909 TModeSwitchInfo(theMode),
910 TNameInfoBase(boost::get<1>(boost::get<0>(theInfo)))
912 const TGaussInfo::TKey& aKey = boost::get<0>(theInfo);
914 myGeom = boost::get<0>(aKey);
915 myRefCoord.resize(GetNbRef()*GetDim());
917 TInt aNbGauss = boost::get<1>(theInfo);
918 myGaussCoord.resize(aNbGauss*GetDim());
919 myWeight.resize(aNbGauss);
924 //---------------------------------------------------------------
925 template<EVersion eVersion>
926 struct TTTimeStampInfo: virtual TTimeStampInfo
928 TTTimeStampInfo(const PFieldInfo& theFieldInfo, const PTimeStampInfo& theInfo)
930 myFieldInfo = theFieldInfo;
932 myEntity = theInfo->GetEntity();
933 myGeom2Size = theInfo->GetGeom2Size();
935 myNumDt = theInfo->GetNumDt();
936 myNumOrd = theInfo->GetNumOrd();
937 myDt = theInfo->GetDt();
939 myUnitDt.resize(GetPNOMLength<eVersion>()+1);
940 SetUnitDt(theInfo->GetUnitDt());
942 myGeom2NbGauss = theInfo->myGeom2NbGauss;
943 myGeom2Gauss = theInfo->GetGeom2Gauss();
946 TTTimeStampInfo(const PFieldInfo& theFieldInfo,
947 EEntiteMaillage theEntity,
948 const TGeom2Size& theGeom2Size,
949 const TGeom2NbGauss& theGeom2NbGauss,
953 const std::string& theUnitDt,
954 const TGeom2Gauss& theGeom2Gauss)
956 myFieldInfo = theFieldInfo;
958 myEntity = theEntity;
959 myGeom2Size = theGeom2Size;
965 myUnitDt.resize(GetPNOMLength<eVersion>()+1);
966 SetUnitDt(theUnitDt);
968 myGeom2NbGauss = theGeom2NbGauss;
969 myGeom2Gauss = theGeom2Gauss;
976 return GetString(0,GetPNOMLength<eVersion>(),myUnitDt);
981 SetUnitDt(const std::string& theValue)
983 SetString(0,GetPNOMLength<eVersion>(),myUnitDt,theValue);
988 //---------------------------------------------------------------
989 template<EVersion eVersion>
990 struct TTProfileInfo:
991 virtual TProfileInfo,
992 virtual TTNameInfo<eVersion>
994 typedef TTNameInfo<eVersion> TNameInfoBase;
996 TTProfileInfo(const TProfileInfo::TInfo& theInfo,
997 EModeProfil theMode):
998 TNameInfoBase(boost::get<0>(theInfo))
1000 TInt aSize = boost::get<1>(theInfo);
1001 myElemNum.reset(new TElemNum(aSize));
1002 myMode = aSize > 0? theMode: eNO_PFLMOD;
1007 //---------------------------------------------------------------
1008 template<EVersion eVersion, class TMeshValueType>
1009 struct TTTimeStampValue: virtual TTimeStampValue<TMeshValueType>
1011 TTTimeStampValue(const PTimeStampInfo& theTimeStampInfo,
1012 const PTimeStampValueBase& theInfo,
1013 ETypeChamp theTypeChamp)
1015 typedef TTimeStampValue<TMeshValueType> TCompatible;
1016 if(TCompatible* aCompatible = dynamic_cast<TCompatible*>(theInfo.get())){
1017 this->myTimeStampInfo = theTimeStampInfo;
1018 this->myTypeChamp = theTypeChamp;
1019 this->myGeom2Profile = aCompatible->GetGeom2Profile();
1020 this->myGeom2Value = aCompatible->myGeom2Value;
1021 this->myGeomSet = aCompatible->GetGeomSet();
1023 EXCEPTION(std::runtime_error,"TTTimeStampValue::TTTimeStampValue - use incompatible arguments!");
1026 TTTimeStampValue(const PTimeStampInfo& theTimeStampInfo,
1027 ETypeChamp theTypeChamp,
1028 const TGeom2Profile& theGeom2Profile,
1029 EModeSwitch theMode):
1030 TModeSwitchInfo(theMode)
1032 this->myTimeStampInfo = theTimeStampInfo;
1034 this->myTypeChamp = theTypeChamp;
1036 this->myGeom2Profile = theGeom2Profile;
1038 TInt aNbComp = theTimeStampInfo->myFieldInfo->myNbComp;
1040 const TGeom2Size& aGeom2Size = theTimeStampInfo->GetGeom2Size();
1041 TGeom2Size::const_iterator anIter = aGeom2Size.begin();
1042 for(; anIter != aGeom2Size.end(); anIter++){
1043 const EGeometrieElement& aGeom = anIter->first;
1044 TInt aNbElem = anIter->second;
1046 MED::PProfileInfo aProfileInfo;
1047 MED::TGeom2Profile::const_iterator anIter = theGeom2Profile.find(aGeom);
1048 if(anIter != theGeom2Profile.end())
1049 aProfileInfo = anIter->second;
1051 if(aProfileInfo && aProfileInfo->IsPresent())
1052 aNbElem = aProfileInfo->GetSize();
1054 TInt aNbGauss = theTimeStampInfo->GetNbGauss(aGeom);
1056 this->GetMeshValue(aGeom).Allocate(aNbElem,aNbGauss,aNbComp);
1062 GetValueSize(EGeometrieElement theGeom) const
1064 return this->GetMeshValue(theGeom).GetSize();
1069 GetNbVal(EGeometrieElement theGeom) const
1071 return this->GetMeshValue(theGeom).GetNbVal();
1076 GetNbGauss(EGeometrieElement theGeom) const
1078 return this->GetMeshValue(theGeom).GetNbGauss();
1083 AllocateValue(EGeometrieElement theGeom,
1087 EModeSwitch theMode = eFULL_INTERLACE)
1089 this->GetMeshValue(theGeom).Allocate(theNbElem,theNbGauss,theNbComp,theMode);
1094 GetValuePtr(EGeometrieElement theGeom)
1096 return this->GetMeshValue(theGeom).GetValuePtr();
1100 //---------------------------------------------------------------
1101 template<EVersion eVersion>
1102 struct TTGrilleInfo:
1105 TTGrilleInfo(const PMeshInfo& theMeshInfo,
1106 const PGrilleInfo& theInfo)
1108 myMeshInfo = theMeshInfo;
1110 myCoord = theInfo->GetNodeCoord();
1112 myGrilleType = theInfo->GetGrilleType();
1114 myCoordNames = theInfo->myCoordNames;
1116 myCoordUnits = theInfo->myCoordUnits;
1118 myIndixes = theInfo->GetMapOfIndexes();
1120 myGrilleStructure = theInfo->GetGrilleStructure();
1122 myGrilleType = theInfo->GetGrilleType();
1124 myFamNumNode.resize(theInfo->GetNbNodes());
1125 myFamNumNode = theInfo->myFamNumNode;
1127 myFamNum = theInfo->myFamNum;
1130 TTGrilleInfo(const PMeshInfo& theMeshInfo,
1131 const EGrilleType& type,
1134 myMeshInfo = theMeshInfo;
1135 TInt aSpaceDim = theMeshInfo->GetSpaceDim();
1136 if(type == eGRILLE_STANDARD){
1137 myCoord.resize(aSpaceDim*nnoeuds);
1138 myCoordNames.resize(aSpaceDim*GetPNOMLength<eVersion>()+1);
1139 myCoordUnits.resize(aSpaceDim*GetPNOMLength<eVersion>()+1);
1140 } else { //if(type == eGRILLE_CARTESIENNE){
1141 myCoordNames.resize(aSpaceDim*GetPNOMLength<eVersion>()+aSpaceDim);
1142 myCoordUnits.resize(aSpaceDim*GetPNOMLength<eVersion>()+aSpaceDim);
1144 myGrilleStructure.resize(aSpaceDim);
1145 myFamNumNode.resize(nnoeuds);
1148 TTGrilleInfo(const PMeshInfo& theMeshInfo,
1149 const EGrilleType& type)
1151 myMeshInfo = theMeshInfo;
1152 TInt aSpaceDim = theMeshInfo->GetSpaceDim();
1153 if(type == eGRILLE_STANDARD){
1154 myCoordNames.resize(aSpaceDim*GetPNOMLength<eVersion>()+1);
1155 myCoordUnits.resize(aSpaceDim*GetPNOMLength<eVersion>()+1);
1156 } else {// if(type == eGRILLE_CARTESIENNE){
1157 myCoordNames.resize(aSpaceDim*GetPNOMLength<eVersion>()+aSpaceDim);
1158 myCoordUnits.resize(aSpaceDim*GetPNOMLength<eVersion>()+aSpaceDim);
1160 myGrilleStructure.resize(aSpaceDim);
1163 TTGrilleInfo(const PMeshInfo& theMeshInfo,
1164 const EGrilleType& type,
1165 const MED::TIntVector& nbNodeVec)
1167 myMeshInfo = theMeshInfo;
1169 TInt aSpaceDim = theMeshInfo->GetSpaceDim();
1170 if(type == eGRILLE_STANDARD){
1171 myCoordNames.resize(aSpaceDim*GetPNOMLength<eVersion>()+1);
1172 myCoordUnits.resize(aSpaceDim*GetPNOMLength<eVersion>()+1);
1173 } else {// if(type == eGRILLE_CARTESIENNE){
1174 myCoordNames.resize(aSpaceDim*GetPNOMLength<eVersion>()+aSpaceDim);
1175 myCoordUnits.resize(aSpaceDim*GetPNOMLength<eVersion>()+aSpaceDim);
1178 if(type != eGRILLE_STANDARD)
1179 for(unsigned int aAxe=0;aAxe<nbNodeVec.size();aAxe++){
1180 myIndixes[aAxe].resize(nbNodeVec[aAxe]);
1182 myGrilleStructure.resize(aSpaceDim);
1187 GetCoordName(TInt theId) const
1189 return GetString(theId,GetPNOMLength<eVersion>(),myCoordNames);
1194 SetCoordName(TInt theId, const std::string& theValue)
1196 SetString(theId,GetPNOMLength<eVersion>(),myCoordNames,theValue);
1201 GetCoordUnit(TInt theId) const
1203 return GetString(theId,GetPNOMLength<eVersion>(),myCoordUnits);
1208 SetCoordUnit(TInt theId, const std::string& theValue)
1210 SetString(theId,GetPNOMLength<eVersion>(),myCoordUnits,theValue);