namespace MED{
//---------------------------------------------------------------
- TCellGroup
- GetCellsByEntity(TWrapper& theWrapper,
+ TElemGroup
+ GetElemsByEntity(TWrapper& theWrapper,
const PMeshInfo& theMeshInfo,
const MED::TEntityInfo& theEntityInfo)
{
- MSG(MYDEBUG,"GetCellsByEntity(...)");
- TCellGroup aGroup;
+ MSG(MYDEBUG,"GetElemsByEntity(...)");
+ TElemGroup aGroup;
MED::TEntityInfo::const_iterator anIter = theEntityInfo.begin();
for(; anIter != theEntityInfo.end(); anIter++){
const EEntiteMaillage& anEntity = anIter->first;
if(anEntity == eNOEUD) continue;
const MED::TGeom& aGeom = anIter->second;
- TCellSet& aCellSet = aGroup[anEntity];
+ TElemSet& aElemSet = aGroup[anEntity];
MED::TGeom::const_iterator anGeomIter = aGeom.begin();
for(; anGeomIter != aGeom.end(); anGeomIter++){
const EGeometrieElement& aGeo = anGeomIter->first;
- PCellInfo aCellInfo = theWrapper.GetPCellInfo(theMeshInfo,anEntity,aGeo);
- aCellSet.insert(aCellInfo);
- if(MYDEBUG){
- TInt aNbElem = aCellInfo->GetNbElem();
- INITMSG(MYDEBUG,"aGeo = "<<aGeo<<"; aNbElem = "<<aNbElem<<": ");
- for(TInt iElem = 0; iElem < aNbElem; iElem++){
- TInt iConnEnd = aCellInfo->GetConnDim();
- for(TInt iConn = 0; iConn < iConnEnd; iConn++){
- ADDMSG(MYVALUEDEBUG,aCellInfo->GetConn(iElem,iConn)<<",");
+ switch(aGeo){
+ case ePOLYGONE:
+ {
+ PPolygoneInfo aPolygoneInfo = theWrapper.GetPPolygoneInfo(theMeshInfo,anEntity,aGeo);
+ aElemSet.insert(aPolygoneInfo);
+ TElemNum aConn = aPolygoneInfo->GetConnectivite();
+ TElemNum aIndex = aPolygoneInfo->GetIndex();
+ TInt aNbIndex = aIndex.size();
+ TInt aIndex0 = aIndex[0];
+ INITMSG(MYDEBUG,"aGeo = "<<aGeo<<"; aNbElem = "<<aNbIndex-1<<": ");
+ for(TInt iElem = 1; iElem < aNbIndex; iElem++){
+ for (TInt i = aIndex0; i < aIndex[iElem];i++)
+ ADDMSG(MYVALUEDEBUG,aConn[i-1]<<",");
+ ADDMSG(MYDEBUG," ");
+ aIndex0 = aIndex[iElem];
+ }
+ ADDMSG(MYDEBUG,endl);
+ ADDMSG(MYDEBUG," Indexes :");
+ for(TInt iElem = 0; iElem < aIndex.size(); iElem++){
+ ADDMSG(MYVALUEDEBUG,aIndex[iElem]<<",");
+ }
+ ADDMSG(MYDEBUG,endl);
+ break;
+ }
+ default:
+ {
+ PCellInfo aCellInfo = theWrapper.GetPCellInfo(theMeshInfo,anEntity,aGeo);
+ aElemSet.insert(aCellInfo);
+ if(MYDEBUG){
+ TInt aNbElem = aCellInfo->GetNbElem();
+ INITMSG(MYDEBUG,"aGeo = "<<aGeo<<"; aNbElem = "<<aNbElem<<": ");
+ for(TInt iElem = 0; iElem < aNbElem; iElem++){
+ TInt iConnEnd = aCellInfo->GetConnDim();
+ for(TInt iConn = 0; iConn < iConnEnd; iConn++){
+ ADDMSG(MYVALUEDEBUG,aCellInfo->GetConn(iElem,iConn)<<",");
+ }
+ ADDMSG(MYVALUEDEBUG," ");
+ }
+ ADDMSG(MYDEBUG,"\n");
}
- ADDMSG(MYVALUEDEBUG," ");
}
- ADDMSG(MYDEBUG,"\n");
}
}
}
TFamilyByEntity
GetFamiliesByEntity(TWrapper& theWrapper,
const PNodeInfo& theNodeInfo,
- const TCellGroup& theCellGroup,
+ const TElemGroup& theElemGroup,
const TFamilyGroup& theFamilyGroup)
{
MSG(MYDEBUG,"GetFamiliesByEntity(...)");
}
}
- if(!theCellGroup.empty()){
- TCellGroup::const_iterator anIter = theCellGroup.begin();
- for(; anIter != theCellGroup.end(); anIter++){
+ if(!theElemGroup.empty()){
+ TElemGroup::const_iterator anIter = theElemGroup.begin();
+ for(; anIter != theElemGroup.end(); anIter++){
const EEntiteMaillage& anEntity = anIter->first;
TFamilyIdSet& aFamilyIdSet = aFamilyIdByEntity[anEntity];
- const TCellSet& aCellSet = anIter->second;
- TCellSet::const_iterator anCellIter = aCellSet.begin();
- for(; anCellIter != aCellSet.end(); anCellIter++){
- const PCellInfo& aCellInfo = *anCellIter;
- if(TInt aNbElem = aCellInfo->GetNbElem()){
+ const TElemSet& aElemSet = anIter->second;
+ TElemSet::const_iterator anElemIter = aElemSet.begin();
+ for(; anElemIter != aElemSet.end(); anElemIter++){
+ const PElemInfo& aElemInfo = *anElemIter;
+ if(TInt aNbElem = aElemInfo->GetNbElem()){
for(TInt i = 0; i < aNbElem; i++){
- aFamilyIdSet.insert(aCellInfo->GetFamNum(i));
+ aFamilyIdSet.insert(aElemInfo->GetFamNum(i));
}
}
}
namespace MED{
//---------------------------------------------------------------
- typedef std::set<PCellInfo> TCellSet;
- typedef std::map<EEntiteMaillage,TCellSet> TCellGroup;
+ typedef std::set<PElemInfo> TElemSet;
+ typedef std::map<EEntiteMaillage,TElemSet> TElemGroup;
- TCellGroup GetCellsByEntity(TWrapper& theWrapper,
+ TElemGroup GetElemsByEntity(TWrapper& theWrapper,
const PMeshInfo& theMeshInfo,
const MED::TEntityInfo& theEntityInfo);
TFamilyByEntity GetFamiliesByEntity(TWrapper& theWrapper,
const PNodeInfo& theNodeInfo,
- const TCellGroup& theCellGroup,
+ const TElemGroup& theElemGroup,
const TFamilyGroup& theFamilyGroup);
struct TNodeInfo;
typedef MED::shared_ptr<TNodeInfo> PNodeInfo;
+ struct TPolygoneInfo;
+ typedef MED::shared_ptr<TPolygoneInfo> PPolygoneInfo;
+
+ struct TPolyedreInfo;
+ typedef MED::shared_ptr<TPolyedreInfo> PPolyedreInfo;
+
struct TCellInfo;
typedef MED::shared_ptr<TCellInfo> PCellInfo;
--- /dev/null
+// Copyright (C) 2003 CEA/DEN, EDF R&D
+//
+//
+//
+// File : VISU_Structure.cxx
+// Author : Eugeny NIKOLAEV
+// Module : VISU
+
+#include "MED_Structures.hxx"
+#include "MED_Utilities.hxx"
+using namespace MED;
+
+#if defined __GNUC__
+ #if __GNUC__ == 2
+ #define __GNUC_2__
+ #endif
+#endif
+
+#if defined __GNUC_2__
+#define GETINDEX(anArray,ind) anArray[ind]
+#else
+#define GETINDEX(anArray,ind) anArray.at(ind)
+#endif
+
+//---------------------------------------------------------------
+TInt TFamilyInfo::GetAttrId(TInt theId) const {
+ return GETINDEX(myAttrId,theId);
+}
+
+TInt TFamilyInfo::GetAttrVal(TInt theId) const {
+ return GETINDEX(myAttrVal,theId);
+}
+
+void TFamilyInfo::SetAttrId(TInt theId,TInt theVal) {
+ GETINDEX(myAttrId,theId) = theVal;
+}
+
+void TFamilyInfo::SetAttrVal(TInt theId,TInt theVal) {
+ GETINDEX(myAttrVal,theId) = theVal;
+}
+
+//---------------------------------------------------------------
+TInt TElemInfo::GetFamNum(TInt theId) const {
+ return GETINDEX(myFamNum,theId);
+}
+
+TInt TElemInfo::GetElemNum(TInt theId) const {
+ return GETINDEX(myElemNum,theId);
+}
+
+void TElemInfo::SetFamNum(TInt theId,TInt theVal) {
+ GETINDEX(myFamNum,theId) = theVal;
+}
+
+//---------------------------------------------------------------
+TFloat TNodeInfo::GetNodeCoord(TInt theId,TInt theComp) const {
+ return GETINDEX(myCoord,myMeshInfo->myDim*theId + theComp);
+}
+
+void TNodeInfo::SetNodeCoord(TInt theId,TInt theComp,TFloat theVal) {
+ GETINDEX(myCoord,myMeshInfo->myDim*theId + theComp) = theVal;
+}
+
+//---------------------------------------------------------------
+TInt TCellInfo::GetConn(TInt theElemId, TInt theConnId) const {
+ return GETINDEX(myConn,myConnDim*theElemId + theConnId);
+}
+
+void TCellInfo::SetConn(TInt theElemId, TInt theConnId, TInt theVal){
+ GETINDEX(myConn,myConnDim*theElemId + theConnId) = theVal;
+}
+//---------------------------------------------------------------
+TInt TPolygoneInfo::GetNbConn(TInt theElemId) const {
+ TInt i1 = GETINDEX(myIndex,theElemId);
+ TInt i2 = GETINDEX(myIndex,theElemId+1);
+ TInt ret = i2 - i1;
+ return ret;
+}
+
+//---------------------------------------------------------------
+TFloat TTimeStampVal::GetVal(EGeometrieElement theGeom, TInt theId,
+ TInt theComp, TInt theGauss) const {
+ TInt aNbComp = myTimeStampInfo->myFieldInfo->myNbComp;
+ TInt aNbGauss = myTimeStampInfo->myNbGauss;
+ TInt aStep = aNbComp*aNbGauss;
+ TMeshValue::const_iterator anIter = myMeshValue.find(theGeom);
+ if(anIter != myMeshValue.end()){
+ TFloat aRet=GETINDEX(anIter->second,theId*aStep + theComp*aNbGauss + theGauss);
+ return aRet;
+ }
+ return TFloat();
+}
+
+void TTimeStampVal::SetVal(EGeometrieElement theGeom, TInt theId,
+ TInt theComp, TFloat theVal, TInt theGauss)
+{
+ TInt aNbComp = myTimeStampInfo->myFieldInfo->myNbComp;
+ TInt aNbGauss = myTimeStampInfo->myNbGauss;
+ TInt aStep = aNbComp*aNbGauss;
+ GETINDEX(myMeshValue[theGeom],theId*aStep + theComp*aNbGauss + theGauss) = theVal;
+}
TInt GetNbAttr() const { return myNbAttr;}
TFamAttr myAttrId;
- TInt GetAttrId(TInt theId) const { return myAttrId[theId];}
- void SetAttrId(TInt theId, TInt theVal) { myAttrId[theId] = theVal;}
+ TInt GetAttrId(TInt theId) const;
+ void SetAttrId(TInt theId, TInt theVal);
TFamAttr myAttrVal;
- TInt GetAttrVal(TInt theId) const { return myAttrVal[theId];}
- void SetAttrVal(TInt theId, TInt theVal) { myAttrVal[theId] = theVal;}
+ TInt GetAttrVal(TInt theId) const;
+ void SetAttrVal(TInt theId, TInt theVal);
TString myAttrDesc;
virtual std::string GetAttrDesc(TInt theId) const = 0;
TInt GetNbElem() const { return myNbElem;}
TElemNum myFamNum;
- TInt GetFamNum(TInt theId) const { return myFamNum[theId];}
- void SetFamNum(TInt theId, TInt theVal) { myFamNum[theId] = theVal;}
+ TInt GetFamNum(TInt theId) const;
+ void SetFamNum(TInt theId, TInt theVal);
EBooleen myIsElemNum;
EBooleen IsElemNum() const { return myIsElemNum;}
TElemNum myElemNum;
- TInt GetElemNum(TInt theId) const { return myElemNum[theId];}
- void SetElemNum(TInt theId, TInt theVal) { myElemNum[theId] = theVal;}
+ TInt GetElemNum(TInt theId) const;
+ void SetElemNum(TInt theId, TInt theVal);
EBooleen myIsElemNames;
EBooleen IsElemNames() const { return myIsElemNames;}
struct TNodeInfo: virtual TElemInfo
{
TNodeCoord myCoord;
- TFloat GetNodeCoord(TInt theId, TInt theComp) const {
- return myCoord[myMeshInfo->myDim*theId + theComp];
- }
- void SetNodeCoord(TInt theId, TInt theComp, TFloat theVal){
- myCoord[myMeshInfo->myDim*theId + theComp] = theVal;
- }
+ TFloat GetNodeCoord(TInt theId, TInt theComp) const;
+ void SetNodeCoord(TInt theId, TInt theComp, TFloat theVal);
ERepere mySystem;
ERepere GetSystem() const { return mySystem;}
TInt GetConnDim() const { return myConnDim;}
TElemNum myConn;
- TInt GetConn(TInt theElemId, TInt theConnId) const {
- return myConn[myConnDim*theElemId + theConnId];
- }
- void SetConn(TInt theElemId, TInt theConnId, TInt theVal){
- myConn[myConnDim*theElemId + theConnId] = theVal;
- }
+ TInt GetConn(TInt theElemId, TInt theConnId) const;
+ void SetConn(TInt theElemId, TInt theConnId, TInt theVal);
};
+ //---------------------------------------------------------------
+ struct TPolygoneInfo: virtual TElemInfo
+ {
+ EEntiteMaillage myTEntity; // MED_FACE|MED_MAILLE
+ EEntiteMaillage GetEntity() const { return myTEntity;}
+
+ EGeometrieElement myTGeom; // ePOLYGONE
+ EGeometrieElement GetGeom() const { return ePOLYGONE;}
+
+ EConnectivite myTConn; // eNOD|eDESC(eDESC not used)
+ EConnectivite GetConn() const { return myTConn;}
+
+ TInt myConnDim;
+ TInt GetConnDim() const { return myConnDim;}
+
+ TElemNum myConn; // Table de connectivities
+ TElemNum GetConnectivite() const { return myConn;}
+
+ TElemNum myIndex; // Table de indexes
+ TElemNum GetIndex() {return myIndex;}
+ TInt GetNbConn(TInt theElemId) const;
+ };
+
+ //---------------------------------------------------------------
+ struct TPolyedreInfo: virtual TElemInfo
+ {
+ EEntiteMaillage myTEntity; // MED_FACE|MED_MAILLE
+ EEntiteMaillage GetEntity() const { return myTEntity;}
+
+ EGeometrieElement myTGeom; // ePOLYEDRE
+ EGeometrieElement GetGeom() const { return ePOLYEDRE;}
+
+ EConnectivite myTConn; // eNOD|eDESC(eDESC not used)
+ EConnectivite GetConn() const { return myTConn;}
+
+ TInt myNbConn;
+ TInt GetNbConn() const { return myNbConn;}
+
+ TElemNum myConn; // Table de connectivities
+ TElemNum GetConnectivite() const { return myConn;}
+
+ TInt myNbFacesIndex;
+ TInt GetNbFacesIndex() const { return myNbFacesIndex;}
+
+ TElemNum myFacesIndex; // Table de faces indexes
+ TElemNum GetFacesIndex() {return myFacesIndex;}
+
+ TElemNum myIndex; // Table de indexes
+ TElemNum GetIndex() {return myIndex;}
+ };
//---------------------------------------------------------------
struct TFieldInfo: virtual TNameInfo
TMeshValue myMeshValue;
TFloat GetVal(EGeometrieElement theGeom, TInt theId,
- TInt theComp, TInt theGauss = 0) const
- {
- TInt aNbComp = myTimeStampInfo->myFieldInfo->myNbComp;
- TInt aNbGauss = myTimeStampInfo->myNbGauss;
- TInt aStep = aNbComp*aNbGauss;
- TMeshValue::const_iterator anIter = myMeshValue.find(theGeom);
- if(anIter != myMeshValue.end())
- return anIter->second[theId*aStep + theComp*aNbGauss + theGauss];
- return TFloat();
- }
+ TInt theComp, TInt theGauss = 0) const;
+
void SetVal(EGeometrieElement theGeom, TInt theId,
- TInt theComp, TFloat theVal, TInt theGauss = 0)
- {
- TInt aNbComp = myTimeStampInfo->myFieldInfo->myNbComp;
- TInt aNbGauss = myTimeStampInfo->myNbGauss;
- TInt aStep = aNbComp*aNbGauss;
- myMeshValue[theGeom][theId*aStep + theComp*aNbGauss + theGauss] = theVal;
- }
+ TInt theComp, TFloat theVal, TInt theGauss = 0);
EModeProfil myPflMode;
EModeProfil GetPflMode() const { return myPflMode;}
void GetPflMode(EModeProfil theVal) { myPflMode = theVal;}
}
};
+ //---------------------------------------------------------------
+ template<TInt nPNOM, TInt nDESC, TInt nIDENT, TInt nNOM, TInt nLNOM>
+ struct TTPolygoneInfo: TPolygoneInfo, TTElemInfo<nPNOM,nDESC,nIDENT,nNOM,nLNOM>
+ {
+ typedef TTElemInfo<nPNOM,nDESC,nIDENT,nNOM,nLNOM> TElemInfoBase;
+
+ TTPolygoneInfo(const PMeshInfo& theMeshInfo, const PPolygoneInfo& theInfo):
+ TElemInfoBase(theMeshInfo,theInfo)
+ {
+ myTEntity = theInfo->GetEntity();
+ myTGeom = theInfo->GetGeom();
+ myTConn = theInfo->GetConn();
+ myConnDim = theInfo->GetConnDim();
+ myConn = theInfo->GetConnectivite();
+ myIndex = theInfo->GetIndex();
+ }
+
+ TTPolygoneInfo(const PMeshInfo& theMeshInfo,
+ TInt theNbElem,
+ TInt theNbConn,
+ EEntiteMaillage theTEntity,
+ EGeometrieElement theTGeom,
+ EConnectivite theTConn = eNOD,
+ EBooleen theIsElemNum = eVRAI,
+ EBooleen theIsElemNames = eVRAI):
+ TElemInfoBase(theMeshInfo,
+ theNbElem,
+ theIsElemNum,
+ theIsElemNames)
+ {
+ myTEntity = theTEntity;
+ myTGeom = theTGeom;
+ myTConn = theTConn;
+ myConnDim = theNbConn;
+ myConn.resize(myConnDim);
+ myIndex.resize(theNbElem+1);
+ }
+
+ TTPolygoneInfo(const PMeshInfo& theMeshInfo,
+ EEntiteMaillage theTEntity,
+ EGeometrieElement theTGeom,
+ EConnectivite theTConn,
+ const TIntVector& theConnectivities,
+ const TIntVector& theIndexes,
+ const TIntVector& theFamilyNums,
+ const TIntVector& theElemNums,
+ const TStringVector& theElemNames = TStringVector()):
+ TTElemInfo<nPNOM,nDESC,nIDENT,nNOM,nLNOM>(theMeshInfo,
+ theFamilyNums,
+ theElemNums,
+ theElemNames)
+ {
+ myTEntity = theTEntity;
+ myTGeom = theTGeom;
+ myTConn = theTConn;
+ myConnDim = theConnectivities.size();
+ myConn = theConnectivities;
+ myIndex = theIndexes;
+ }
+ };
+ //---------------------------------------------------------------
+ template<TInt nPNOM, TInt nDESC, TInt nIDENT, TInt nNOM, TInt nLNOM>
+ struct TTPolyedreInfo: TPolyedreInfo, TTElemInfo<nPNOM,nDESC,nIDENT,nNOM,nLNOM>
+ {
+ typedef TTElemInfo<nPNOM,nDESC,nIDENT,nNOM,nLNOM> TElemInfoBase;
+
+ TTPolyedreInfo(const PMeshInfo& theMeshInfo, const PPolyedreInfo& theInfo):
+ TElemInfoBase(theMeshInfo,theInfo)
+ {
+ myTEntity = theInfo->GetEntity();
+ myTGeom = theInfo->GetGeom();
+ myTConn = theInfo->GetConn();
+ myNbConn = theInfo->GetNbConn();
+ myNbFacesIndex = theInfo->GetNbFacesIndex();
+ myConn = theInfo->GetConnectivite();
+ myFacesIndex = theInfo->GetFacesIndex();
+ myIndex = theInfo->GetIndex();
+ }
+
+ TTPolyedreInfo(const PMeshInfo& theMeshInfo,
+ TInt theNbElem,
+ TInt theNbConn,
+ TInt theNbFacesIndex,
+ EEntiteMaillage theTEntity,
+ EGeometrieElement theTGeom,
+ EConnectivite theTConn = eNOD,
+ EBooleen theIsElemNum = eVRAI,
+ EBooleen theIsElemNames = eVRAI):
+ TElemInfoBase(theMeshInfo,
+ theNbElem,
+ theIsElemNum,
+ theIsElemNames)
+ {
+ myTEntity = theTEntity;
+ myTGeom = theTGeom;
+ myTConn = theTConn;
+ myNbConn = theNbConn;
+ myNbFacesIndex = theNbFacesIndex;
+ myConn.resize(myNbConn);
+ myFacesIndex.resize(myNbFacesIndex);
+ myIndex.resize(theNbElem+1);
+ }
+
+ TTPolyedreInfo(const PMeshInfo& theMeshInfo,
+ EEntiteMaillage theTEntity,
+ EGeometrieElement theTGeom,
+ EConnectivite theTConn,
+ const TIntVector& theConnectivities,
+ const TIntVector& theFacesIndexes,
+ const TIntVector& theIndexes,
+ const TIntVector& theFamilyNums,
+ const TIntVector& theElemNums,
+ const TStringVector& theElemNames = TStringVector()):
+ TTElemInfo<nPNOM,nDESC,nIDENT,nNOM,nLNOM>(theMeshInfo,
+ theFamilyNums,
+ theElemNums,
+ theElemNames)
+ {
+ myTEntity = theTEntity;
+ myTGeom = theTGeom;
+ myTConn = theTConn;
+ myNbConn = theConnectivities.size();
+ myNbFacesIndex = theFacesIndexes.size();
+ myConn = theConnectivities;
+ myFacesIndex = theFacesIndexes;
+ myIndex = theIndexes;
+ }
+ };
//---------------------------------------------------------------
template<TInt nPNOM, TInt nDESC, TInt nIDENT, TInt nNOM, TInt nLNOM>
theInfo));
}
-
+ //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ virtual PPolygoneInfo CrPolygoneInfo(const PMeshInfo& theMeshInfo,
+ TInt theNbElem,
+ TInt theNbConn,
+ EEntiteMaillage theTEntity,
+ EGeometrieElement theTGeom,
+ EConnectivite theTConn = eNOD,
+ EBooleen theIsElemNum = eVRAI,
+ EBooleen theIsElemNames = eVRAI)
+ {
+ return PPolygoneInfo(new TTPolygoneInfo<nPNOM,nDESC,nIDENT,nNOM,nLNOM>
+ (theMeshInfo,
+ theNbElem,
+ theNbConn,
+ theTEntity,
+ theTGeom,
+ theTConn,
+ theIsElemNum,
+ theIsElemNames));
+ }
+
+ virtual PPolygoneInfo CrPolygoneInfo(const PMeshInfo& theMeshInfo,
+ EEntiteMaillage theTEntity,
+ EGeometrieElement theTGeom,
+ EConnectivite theTConn,
+ const TIntVector& theConnectivities,
+ const TIntVector& theIndexes,
+ const TIntVector& theFamilyNums,
+ const TIntVector& theElemNums,
+ const TStringVector& theElemNames = TStringVector())
+ {
+ return PPolygoneInfo(new TTPolygoneInfo<nPNOM,nDESC,nIDENT,nNOM,nLNOM>
+ (theMeshInfo,
+ theTEntity,
+ theTGeom,
+ theTConn,
+ theConnectivities,
+ theIndexes,
+ theFamilyNums,
+ theElemNums,
+ theElemNames));
+ }
+
+ virtual PPolygoneInfo CrPolygoneInfo(const PMeshInfo& theMeshInfo,
+ const PPolygoneInfo& theInfo)
+ {
+ return PPolygoneInfo(new TTPolygoneInfo<nPNOM,nDESC,nIDENT,nNOM,nLNOM>
+ (theMeshInfo,
+ theInfo));
+ }
+
+ //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ virtual PPolyedreInfo CrPolyedreInfo(const PMeshInfo& theMeshInfo,
+ TInt theNbElem,
+ TInt theNbConn,
+ TInt theNbFaces,
+ EEntiteMaillage theTEntity,
+ EGeometrieElement theTGeom,
+ EConnectivite theTConn = eNOD,
+ EBooleen theIsElemNum = eVRAI,
+ EBooleen theIsElemNames = eVRAI)
+ {
+ return PPolyedreInfo(new TTPolyedreInfo<nPNOM,nDESC,nIDENT,nNOM,nLNOM>
+ (theMeshInfo,
+ theNbElem,
+ theNbConn,
+ theNbFaces,
+ theTEntity,
+ theTGeom,
+ theTConn,
+ theIsElemNum,
+ theIsElemNames));
+ }
+
+ virtual PPolyedreInfo CrPolyedreInfo(const PMeshInfo& theMeshInfo,
+ EEntiteMaillage theTEntity,
+ EGeometrieElement theTGeom,
+ EConnectivite theTConn,
+ const TIntVector& theConnectivities,
+ const TIntVector& theFacesIndexes,
+ const TIntVector& theIndexes,
+ const TIntVector& theFamilyNums,
+ const TIntVector& theElemNums,
+ const TStringVector& theElemNames = TStringVector())
+ {
+ return PPolyedreInfo(new TTPolyedreInfo<nPNOM,nDESC,nIDENT,nNOM,nLNOM>
+ (theMeshInfo,
+ theTEntity,
+ theTGeom,
+ theTConn,
+ theConnectivities,
+ theFacesIndexes,
+ theIndexes,
+ theFamilyNums,
+ theElemNums,
+ theElemNames));
+ }
+
+ virtual PPolyedreInfo CrPolyedreInfo(const PMeshInfo& theMeshInfo,
+ const PPolyedreInfo& theInfo)
+ {
+ return PPolyedreInfo(new TTPolyedreInfo<nPNOM,nDESC,nIDENT,nNOM,nLNOM>
+ (theMeshInfo,
+ theInfo));
+ }
+
//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
virtual PCellInfo CrCellInfo(const PMeshInfo& theMeshInfo,
TInt theNbElem,
aGeomFACESet.insert(eQUAD4);
aGeomFACESet.insert(eTRIA6);
aGeomFACESet.insert(eQUAD8);
+ aGeomFACESet.insert(ePOLYGONE);
TGeomSet& aGeomMAILLESet = Entity2GeomSet[eMAILLE];
aGeomMAILLESet.insert(ePOINT1);
aGeomMAILLESet.insert(ePYRA13);
aGeomMAILLESet.insert(ePENTA15);
aGeomMAILLESet.insert(eHEXA20);
+ aGeomMAILLESet.insert(ePOLYEDRE);
return true;
}
return anInfo;
}
-
+ //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ PPolygoneInfo TWrapper::GetPPolygoneInfo(const PMeshInfo& theMeshInfo,
+ EEntiteMaillage theEntity,
+ EGeometrieElement theGeom,
+ EConnectivite theConn)
+ {
+ TInt aNbElem = GetNbPolygones(*theMeshInfo,theEntity,theGeom,theConn);
+ TInt aNbConn = GetNbPolygoneConn(*theMeshInfo,theEntity,theGeom,theConn);
+ PPolygoneInfo anInfo = CrPolygoneInfo(theMeshInfo,aNbElem,aNbConn,theEntity,theGeom,theConn);
+ GetPolygoneInfo(*anInfo);
+ return anInfo;
+ }
+
+ //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ PPolyedreInfo TWrapper::GetPPolyedreInfo(const PMeshInfo& theMeshInfo,
+ EEntiteMaillage theEntity,
+ EGeometrieElement theGeom,
+ EConnectivite theConn)
+ {
+ TInt aNbElem = GetNbPolyedres(*theMeshInfo,theEntity,theGeom,theConn);
+ TInt aNbConn = 0;
+ TInt aNbFaces = 0;
+ GetNbPolyedreConnF(*theMeshInfo,theConn,aNbFaces,aNbConn);
+ PPolyedreInfo anInfo = CrPolyedreInfo(theMeshInfo,aNbElem,aNbConn,aNbFaces,theEntity,theGeom,theConn);
+ GetPolyedreInfo(*anInfo);
+ return anInfo;
+ }
+
//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
PCellInfo TWrapper::GetPCellInfo(const PMeshInfo& theMeshInfo,
EEntiteMaillage theEntity,
PNodeInfo GetPNodeInfo(const PMeshInfo& theMeshInfo);
+ //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ virtual void GetPolygoneInfo(TPolygoneInfo& theInfo,
+ TErr* theErr = NULL) {};
+ virtual void SetPolygoneInfo(const TPolygoneInfo& theInfo,
+ TErr* theErr = NULL) {};
+ virtual TInt GetNbPolygones(const TMeshInfo& theMeshInfo,
+ EEntiteMaillage,
+ EGeometrieElement,
+ EConnectivite,
+ TErr* theErr = NULL) { return 0;};
+
+ virtual TInt GetNbPolygoneConn(const TMeshInfo& theMeshInfo,
+ EEntiteMaillage,
+ EGeometrieElement,
+ EConnectivite,
+ TErr* theErr = NULL){ return 0;};
+
+ virtual PPolygoneInfo CrPolygoneInfo(const PMeshInfo& theMeshInfo,
+ TInt theNbElem,
+ TInt theNbConn,
+ EEntiteMaillage theTEntity,
+ EGeometrieElement theTGeom,
+ EConnectivite theTConn = eNOD,
+ EBooleen theIsElemNum = eVRAI,
+ EBooleen theIsElemNames = eVRAI)
+ {
+ return PPolygoneInfo();
+ };
+
+ virtual PPolygoneInfo CrPolygoneInfo(const PMeshInfo& theMeshInfo,
+ EEntiteMaillage theTEntity,
+ EGeometrieElement theTGeom,
+ EConnectivite theTConn,
+ const TIntVector& theConnectivities,
+ const TIntVector& theFamilyNums,
+ const TIntVector& theElemNums,
+ const TStringVector& theElemNames = TStringVector())
+ {
+ return PPolygoneInfo();
+ };
+
+ virtual PPolygoneInfo CrPolygoneInfo(const PMeshInfo& theMeshInfo,
+ const PPolygoneInfo& theInfo)
+ {
+ return PPolygoneInfo();
+ };
+
+ PPolygoneInfo GetPPolygoneInfo(const PMeshInfo& theMeshInfo,
+ EEntiteMaillage theEntity,
+ EGeometrieElement theGeom,
+ EConnectivite theConn = eNOD);
+
+ //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ virtual void GetPolyedreInfo(TPolyedreInfo& theInfo,
+ TErr* theErr = NULL) {};
+ virtual void SetPolyedreInfo(const TPolyedreInfo& theInfo,
+ TErr* theErr = NULL) {};
+ virtual TInt GetNbPolyedres(const TMeshInfo& theMeshInfo,
+ EEntiteMaillage,
+ EGeometrieElement,
+ EConnectivite,
+ TErr* theErr = NULL) { return 0;};
+
+ virtual void GetNbPolyedreConnF(const TMeshInfo& theMeshInfo,
+ EConnectivite theConn,
+ TInt& nf,
+ TInt& nc,
+ TErr* theErr = NULL){};
+
+ virtual PPolyedreInfo CrPolyedreInfo(const PMeshInfo& theMeshInfo,
+ TInt theNbElem,
+ TInt theNbConn,
+ TInt theNbFaces,
+ EEntiteMaillage theTEntity,
+ EGeometrieElement theTGeom,
+ EConnectivite theTConn = eNOD,
+ EBooleen theIsElemNum = eVRAI,
+ EBooleen theIsElemNames = eVRAI)
+ {
+ return PPolyedreInfo();
+ };
+
+ virtual PPolyedreInfo CrPolyedreInfo(const PMeshInfo& theMeshInfo,
+ EEntiteMaillage theTEntity,
+ EGeometrieElement theTGeom,
+ EConnectivite theTConn,
+ const TIntVector& theConnectivities,
+ const TIntVector& theFamilyNums,
+ const TIntVector& theElemNums,
+ const TStringVector& theElemNames = TStringVector())
+ {
+ return PPolyedreInfo();
+ };
+
+ virtual PPolyedreInfo CrPolyedreInfo(const PMeshInfo& theMeshInfo,
+ const PPolyedreInfo& theInfo)
+ {
+ return PPolyedreInfo();
+ };
+
+ PPolyedreInfo GetPPolyedreInfo(const PMeshInfo& theMeshInfo,
+ EEntiteMaillage theEntity,
+ EGeometrieElement theGeom,
+ EConnectivite theConn = eNOD);
//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
virtual TEntityInfo GetEntityInfo(const TMeshInfo& theMeshInfo,
# Libraries targets
LIB = libMEDWrapperBase.la
-LIB_SRC = MED_Wrapper.cxx MED_Algorithm.cxx MED_Utilities.cxx
+LIB_SRC = \
+ MED_Structures.cxx MED_Wrapper.cxx \
+ MED_Algorithm.cxx MED_Utilities.cxx
# Executables targets
BIN =
TEntityInfo aEntityInfo = aMed->GetEntityInfo(aMeshInfo);
- TCellGroup aCellGroup = GetCellsByEntity(aMed,aMeshInfo,aEntityInfo);
+ TElemGroup aElemGroup = GetElemsByEntity(aMed,aMeshInfo,aEntityInfo);
TFamilyGroup aFamilyGroup = GetFamilies(aMed,aMeshInfo);
- TFamilyByEntity aFamilyByEntity = GetFamiliesByEntity(aMed,aNodeInfo,aCellGroup,aFamilyGroup);
+ TFamilyByEntity aFamilyByEntity = GetFamiliesByEntity(aMed,aNodeInfo,aElemGroup,aFamilyGroup);
TGroupInfo aGroupInfo = GetFamiliesByGroup(aFamilyGroup);
const EGeometrieElement& aGeom = anTGeomIter->first;
const TInt& aNbElem = anTGeomIter->second;
INITMSG(MYDEBUG,"aGeom = "<<aGeom<<"; aNbElem = "<<aNbElem<<": ");
- PCellInfo aCellInfo = theMed->GetPCellInfo(aMeshInfo,anEntity,aGeom);
- TInt aConnDim = aCellInfo->GetConnDim();
- for(TInt iElem = 0; iElem < aNbElem; iElem++){
- for(TInt iConn = 0; iConn < aConnDim; iConn++){
- ADDMSG(MYVALUEDEBUG,aCellInfo->GetConn(iElem,iConn)<<",");
+ switch(aGeom){
+ case ePOLYGONE:
+ {
+ PPolygoneInfo aPolygoneInfo = theMed->GetPPolygoneInfo(aMeshInfo,anEntity,aGeom);
+ TElemNum aConn = aPolygoneInfo->GetConnectivite();
+ TElemNum aIndex = aPolygoneInfo->GetIndex();
+ TInt aNbIndex = aIndex.size();
+ TInt aIndex0 = aIndex[0];
+ for(TInt iElem = 1; iElem < aNbIndex; iElem++){
+ for (TInt i = aIndex0; i < aIndex[iElem];i++)
+ ADDMSG(MYVALUEDEBUG,aConn[i-1]<<",");
+ ADDMSG(MYDEBUG," ");
+ aIndex0 = aIndex[iElem];
+ }
+ ADDMSG(MYDEBUG,endl);
+ INITMSG(MYDEBUG,"Indexes :");
+ for(TInt iElem = 0; iElem < aIndex.size(); iElem++){
+ ADDMSG(MYVALUEDEBUG,aIndex[iElem]<<",");
+ }
+ ADDMSG(MYDEBUG,endl);
+ PPolygoneInfo aPolygoneInfo2 = theMed->CrPolygoneInfo(aMeshInfo2,aPolygoneInfo);
+ if(MYWRITEDEBUG) theMed2->SetPolygoneInfo(aPolygoneInfo2);
+ break;
}
- ADDMSG(MYVALUEDEBUG," ");
+ case ePOLYEDRE:
+ {
+ PPolyedreInfo aPolyedreInfo = theMed->GetPPolyedreInfo(aMeshInfo,anEntity,aGeom);
+ TElemNum aConn = aPolyedreInfo->GetConnectivite();
+ TElemNum aFacesIndex = aPolyedreInfo->GetFacesIndex();
+ TElemNum aIndex = aPolyedreInfo->GetIndex();
+
+ TInt aNbIndex = aIndex.size();
+
+ for (int aNp = 0; aNp < aNbIndex-1;aNp++){
+ if (aPolyedreInfo->IsElemNames())
+ ADDMSG(MYDEBUG,aPolyedreInfo->GetElemName(aNp)<<endl);
+ else
+ ADDMSG(MYDEBUG,"POLYEDRE "<<aNp+1<<endl);
+
+ for (int aNf = aIndex[aNp]-1;aNf < aIndex[aNp+1]-1;aNf++){
+ ADDMSG(MYDEBUG,"Face "<<aNf-aIndex[aNp]+2<<": [");
+ for (int aNc = aFacesIndex[aNf]-1; aNc < aFacesIndex[aNf+1]-1;aNc++){
+ ADDMSG(MYDEBUG," "<<aConn[aNc]);
+ }
+ ADDMSG(MYDEBUG," ]"<<endl;);
+ }
+ }
+
+ PPolyedreInfo aPolyedreInfo2 = theMed->CrPolyedreInfo(aMeshInfo2,aPolyedreInfo);
+ if(MYWRITEDEBUG) theMed2->SetPolyedreInfo(aPolyedreInfo2);
+ break;
+ }
+ default:
+ PCellInfo aCellInfo = theMed->GetPCellInfo(aMeshInfo,anEntity,aGeom);
+ TInt aConnDim = aCellInfo->GetConnDim();
+ for(TInt iElem = 0; iElem < aNbElem; iElem++){
+ for(TInt iConn = 0; iConn < aConnDim; iConn++){
+ ADDMSG(MYVALUEDEBUG,aCellInfo->GetConn(iElem,iConn)<<",");
+ }
+ ADDMSG(MYVALUEDEBUG," ");
+ }
+ ADDMSG(MYDEBUG,endl);
+ PCellInfo aCellInfo2 = theMed->CrCellInfo(aMeshInfo2,aCellInfo);
+ if(MYWRITEDEBUG) theMed2->SetCellInfo(aCellInfo2);
}
- ADDMSG(MYDEBUG,endl);
- PCellInfo aCellInfo2 = theMed->CrCellInfo(aMeshInfo2,aCellInfo);
- if(MYWRITEDEBUG) theMed2->SetCellInfo(aCellInfo2);
}
}
void ReadMed(const char* theFileName,
const char* theFileName2,
- MED::EVersion theVersion = eV2_1,
+ MED::EVersion theVersion = eV2_2,
int theNbCopy = 1)
{
MSG(MYDEBUG,"theFileName = '"<<theFileName<<"'; "<<
TInt TVWrapper::GetNbNodes(const MED::TMeshInfo& theMeshInfo,
TErr* theErr)
{
+ MSG(MYDEBUG,"TVWrapper::GetNbNodes");
+ INITMSG(MYDEBUG,"GetNbNodes ... ");
TFileWrapper aFileWrapper(myFile,eLECT,theErr);
if(theErr && *theErr < 0)
MED::TMeshInfo& aMeshInfo = const_cast<MED::TMeshInfo&>(theMeshInfo);
- return MEDnEntMaa(myFile->Id(),
- &aMeshInfo.myName[0],
- MED_COOR,
- MED_NOEUD,
- med_geometrie_element(0),
- med_connectivite(0));
+ TInt aRet = MEDnEntMaa(myFile->Id(),
+ &aMeshInfo.myName[0],
+ MED_COOR,
+ MED_NOEUD,
+ med_geometrie_element(0),
+ med_connectivite(0));
+
+ ADDMSG(MYDEBUG," nbnodes="<<aRet<<" ... OK"<<endl);
+ return aRet;
}
void TVWrapper::GetNodeInfo(MED::TNodeInfo& theInfo,
TErr* theErr)
{
+ MSG(MYDEBUG,"TVWrapper::GetNodeInfo");
+ INITMSG(MYDEBUG,"GetNodeInfo ... ");
TFileWrapper aFileWrapper(myFile,eLECT,theErr);
- if(theErr && *theErr < 0)
+ if(theErr && *theErr < 0 || theInfo.myNbElem<=0)
return;
MED::TMeshInfo& aMeshInfo = *theInfo.myMeshInfo;
&anIsElemNum,
&theInfo.myFamNum[0],
theInfo.myNbElem);
+
+ ADDMSG(MYDEBUG," myDim="<<aMeshInfo.myDim<<" myNbElem="<<theInfo.myNbElem<<" ... ");
if(theErr)
*theErr = aRet;
else if(aRet < 0)
EXCEPTION(runtime_error,"GetNodeInfo - MEDnoeudsLire(...)");
+ ADDMSG(MYDEBUG,"OK"<<endl);
}
if(theErr && *theErr < 0)
return anInfo;
- if(TInt aNbElem = GetNbNodes(theMeshInfo)){
+ TInt aNbElem = GetNbNodes(theMeshInfo);
+ if(aNbElem>0){
anInfo[eNOEUD][ePOINT1] = aNbElem;
const TEntity2GeomSet& anEntity2GeomSet = GetEntity2GeomSet();
TEntity2GeomSet::const_iterator anIter = anEntity2GeomSet.begin();
TGeomSet::const_iterator anIterEnd2 = aGeomSet.end();
for(; anIter2 != anIterEnd2; anIter2++){
const EGeometrieElement& aGeom = *anIter2;
- if(TInt aNb = GetNbCells(theMeshInfo,anEntity,aGeom,theTConn,theErr)){
+ TInt aNb = GetNbCells(theMeshInfo,anEntity,aGeom,theTConn,theErr);
+ if(aNb>0){
anInfo[anEntity][aGeom] = aNb;
}
}
SetNodeInfo(theInfo,eLECTURE_AJOUT,theErr);
}
+ void TVWrapper::GetPolygoneInfo(MED::TPolygoneInfo& theInfo,
+ TErr* theErr)
+ {
+ TFileWrapper aFileWrapper(myFile,eLECTURE,theErr);
+
+ if(theErr && !*theErr)
+ return;
+
+ MED::TMeshInfo& aMeshInfo = *theInfo.myMeshInfo;
+ TInt aNbElem = theInfo.myElemNum.size();
+
+ med_entite_maillage& anEntity = static_cast<med_entite_maillage>(theInfo.myTEntity);
+ med_connectivite& aConn = static_cast<med_connectivite>(theInfo.myTConn);
+
+ TErr aRet = 0;
+
+ aRet = MEDpolygoneConnLire(myFile->Id(),
+ &aMeshInfo.myName[0],
+ &theInfo.myIndex[0],
+ aNbElem+1,
+ &theInfo.myConn[0],
+ anEntity,
+ aConn);
+
+ if(theErr)
+ *theErr = aRet;
+ else if(aRet < 0)
+ EXCEPTION(runtime_error,"GetPolygoneInfo - MEDpolygoneInfo(...)");
+ }
+
+ void TVWrapper::SetPolygoneInfo(const MED::TPolygoneInfo& theInfo,
+ TErr* theErr)
+ {
+ SetPolygoneInfo(theInfo,eLECTURE_ECRITURE,theErr);
+ }
+
+ void TVWrapper::SetPolygoneInfo(const MED::TPolygoneInfo& theInfo,
+ EModeAcces theMode,
+ TErr* theErr)
+ {
+ TFileWrapper aFileWrapper(myFile,theMode,theErr);
+
+ if(theErr && !*theErr)
+ return;
+
+ MED::TPolygoneInfo& anInfo = const_cast<MED::TPolygoneInfo&>(theInfo);
+ MED::TMeshInfo& aMeshInfo = *anInfo.myMeshInfo;
+
+ med_booleen& anIsElemNames = static_cast<med_booleen>(theInfo.myIsElemNames);
+ med_booleen& anIsElemNum = static_cast<med_booleen>(theInfo.myIsElemNum);
+ med_entite_maillage& anEntity = static_cast<med_entite_maillage>(theInfo.myTEntity);
+ med_connectivite& aConn = static_cast<med_connectivite>(theInfo.myTConn);
+
+ TErr aRet = MEDpolygoneConnEcr(myFile->Id(),
+ &aMeshInfo.myName[0],
+ &anInfo.myIndex[0],
+ anInfo.myNbElem+1,
+ &anInfo.myConn[0],
+ anEntity,
+ aConn);
+
+ if(theErr)
+ *theErr = aRet;
+ else if(aRet < 0)
+ EXCEPTION(runtime_error,"SetPolygoneInfo - MEDpolygoneConnEcr(...)");
+
+ if (anIsElemNames){
+ aRet = MEDnomEcr(myFile->Id(),
+ &aMeshInfo.myName[0],
+ &anInfo.myElemNames[0],
+ anInfo.myElemNames.size(),
+ anEntity,
+ MED_POLYGONE);
+ if(theErr)
+ *theErr = aRet;
+ else if(aRet < 0)
+ EXCEPTION(runtime_error,"SetPolygoneInfo - MEDnomEcr(...)");
+ }
+
+ if (anIsElemNum){
+ aRet = MEDnumEcr(myFile->Id(),
+ &aMeshInfo.myName[0],
+ &anInfo.myElemNum[0],
+ anInfo.myElemNum.size(),
+ anEntity,
+ MED_POLYGONE);
+ if(theErr)
+ *theErr = aRet;
+ else if(aRet < 0)
+ EXCEPTION(runtime_error,"SetPolygoneInfo - MEDnumEcr(...)");
+ }
+
+ aRet = MEDfamEcr(myFile->Id(),
+ &aMeshInfo.myName[0],
+ &anInfo.myFamNum[0],
+ anInfo.myFamNum.size(),
+ anEntity,
+ MED_POLYGONE);
+
+ if(theErr)
+ *theErr = aRet;
+ else if(aRet < 0)
+ EXCEPTION(runtime_error,"SetPolygoneInfo - MEDfamEcr(...)");
+ }
+
+ TInt TVWrapper::GetNbPolygones(const MED::TMeshInfo& theMeshInfo,
+ EEntiteMaillage theTEntity,
+ EGeometrieElement theTGeom,
+ EConnectivite theTConn,
+ TErr* theErr)
+ {
+ return GetNbCells(theMeshInfo,theTEntity,theTGeom,theTConn,theErr);
+ }
+
+ TInt TVWrapper::GetNbPolygoneConn(const MED::TMeshInfo& theMeshInfo,
+ EEntiteMaillage theTEntity,
+ EGeometrieElement theTGeom,
+ EConnectivite theTConn,
+ TErr* theErr)
+ {
+ TFileWrapper aFileWrapper(myFile,eLECTURE,theErr);
+
+ if(theErr && !*theErr)
+ return 0;
+
+ MED::TMeshInfo& aMeshInfo = const_cast<MED::TMeshInfo&>(theMeshInfo);
+
+ med_entite_maillage& anEntity = static_cast<med_entite_maillage>(theTEntity);
+ med_connectivite& aConn = static_cast<med_connectivite>(theTConn);
+
+ med_int taille = 0;
+
+ TErr aRet = MEDpolygoneInfo(myFile->Id(),
+ &aMeshInfo.myName[0],
+ anEntity,
+ aConn,
+ &taille);
+
+ if(theErr)
+ *theErr = aRet;
+ else if(aRet < 0)
+ EXCEPTION(runtime_error,"GetPolygoneInfo - MEDpolygoneInfo(...)");
+
+ return TInt(taille);
+ }
+
+ void TVWrapper::GetPolyedreInfo(TPolyedreInfo& theInfo,
+ TErr* theErr)
+ {
+ TFileWrapper aFileWrapper(myFile,eLECTURE,theErr);
+
+ if(theErr && !*theErr)
+ return;
+
+ MED::TMeshInfo& aMeshInfo = *theInfo.myMeshInfo;
+ TInt aNbElem = theInfo.myElemNum.size();
+
+ med_connectivite& aConn = static_cast<med_connectivite>(theInfo.myTConn);
+
+ TErr aRet = 0;
+
+ aRet = MEDpolyedreConnLire(myFile->Id(),
+ &aMeshInfo.myName[0],
+ &theInfo.myIndex[0],
+ aNbElem+1,
+ &theInfo.myFacesIndex[0],
+ theInfo.myNbFacesIndex,
+ &theInfo.myConn[0],
+ aConn);
+
+ if(theErr)
+ *theErr = aRet;
+ else if(aRet < 0)
+ EXCEPTION(runtime_error,"GetPolygoneInfo - MEDpolyedreConnLire(...)");
+ }
+
+ void TVWrapper::SetPolyedreInfo(const TPolyedreInfo& theInfo,
+ TErr* theErr)
+ {
+ SetPolyedreInfo(theInfo,eLECTURE_ECRITURE,theErr);
+ }
+
+ void TVWrapper::SetPolyedreInfo(const MED::TPolyedreInfo& theInfo,
+ EModeAcces theMode,
+ TErr* theErr)
+ {
+ TFileWrapper aFileWrapper(myFile,theMode,theErr);
+
+ if(theErr && !*theErr)
+ return;
+
+ MED::TPolyedreInfo& anInfo = const_cast<MED::TPolyedreInfo&>(theInfo);
+ MED::TMeshInfo& aMeshInfo = *anInfo.myMeshInfo;
+
+ med_booleen& anIsElemNames = static_cast<med_booleen>(theInfo.myIsElemNames);
+ med_booleen& anIsElemNum = static_cast<med_booleen>(theInfo.myIsElemNum);
+ med_entite_maillage& anEntity = static_cast<med_entite_maillage>(theInfo.myTEntity);
+ med_connectivite& aConn = static_cast<med_connectivite>(theInfo.myTConn);
+
+ TErr aRet = MEDpolyedreConnEcr(myFile->Id(),
+ &aMeshInfo.myName[0],
+ &anInfo.myIndex[0],
+ anInfo.myNbElem+1,
+ &anInfo.myFacesIndex[0],
+ anInfo.myNbFacesIndex,
+ &anInfo.myConn[0],
+ aConn);
+
+ if(theErr)
+ *theErr = aRet;
+ else if(aRet < 0)
+ EXCEPTION(runtime_error,"SetPolyedreInfo - MEDpolyedreConnEcr(...)");
+
+ if (anIsElemNames){
+ aRet = MEDnomEcr(myFile->Id(),
+ &aMeshInfo.myName[0],
+ &anInfo.myElemNames[0],
+ anInfo.myElemNames.size(),
+ anEntity,
+ MED_POLYEDRE);
+ if(theErr)
+ *theErr = aRet;
+ else if(aRet < 0)
+ EXCEPTION(runtime_error,"SetPolyedreInfo - MEDnomEcr(...)");
+ }
+
+ if (anIsElemNum){
+ aRet = MEDnumEcr(myFile->Id(),
+ &aMeshInfo.myName[0],
+ &anInfo.myElemNum[0],
+ anInfo.myElemNum.size(),
+ anEntity,
+ MED_POLYEDRE);
+ if(theErr)
+ *theErr = aRet;
+ else if(aRet < 0)
+ EXCEPTION(runtime_error,"SetPolyedreInfo - MEDnumEcr(...)");
+ }
+
+
+ aRet = MEDfamEcr(myFile->Id(),
+ &aMeshInfo.myName[0],
+ &anInfo.myFamNum[0],
+ anInfo.myFamNum.size(),
+ anEntity,
+ MED_POLYEDRE);
+
+ if(theErr)
+ *theErr = aRet;
+ else if(aRet < 0)
+ EXCEPTION(runtime_error,"SetPolyedreInfo - MEDfamEcr(...)");
+ }
+
+ TInt TVWrapper::GetNbPolyedres(const MED::TMeshInfo& theMeshInfo,
+ EEntiteMaillage theTEntity,
+ EGeometrieElement theTGeom,
+ EConnectivite theTConn,
+ TErr* theErr)
+ {
+ return GetNbCells(theMeshInfo,theTEntity,theTGeom,theTConn,theErr);
+ }
+
+ void TVWrapper::GetNbPolyedreConnF(const MED::TMeshInfo& theMeshInfo,
+ EConnectivite theTConn,
+ TInt& nf,
+ TInt& nc,
+ TErr* theErr)
+ {
+ TFileWrapper aFileWrapper(myFile,eLECTURE,theErr);
+
+ if(theErr && !*theErr) EXCEPTION(runtime_error,"GetPolyedreInfo - (...)");
+
+ MED::TMeshInfo& aMeshInfo = const_cast<MED::TMeshInfo&>(theMeshInfo);
+ med_connectivite& aConn = static_cast<med_connectivite>(theTConn);
+
+ TErr aRet = MEDpolyedreInfo(myFile->Id(),
+ &aMeshInfo.myName[0],
+ aConn,
+ &nf,
+ &nc);
+
+ if(theErr)
+ *theErr = aRet;
+ else if(aRet < 0)
+ EXCEPTION(runtime_error,"GetPolygoneInfo - MEDpolyedreInfo(...)");
+
+ }
TEntityInfo TVWrapper::GetEntityInfo(const MED::TMeshInfo& theMeshInfo,
EConnectivite theTConn,
TGeomSet::const_iterator anIterEnd2 = aGeomSet.end();
for(; anIter2 != anIterEnd2; anIter2++){
const EGeometrieElement& aGeom = *anIter2;
- if(TInt aNb = GetNbCells(theMeshInfo,anEntity,aGeom,theTConn,theErr)){
+ TInt aNb = GetNbCells(theMeshInfo,anEntity,aGeom,theTConn,theErr);
+ if(aNb>0){
anInfo[anEntity][aGeom] = aNb;
}
}
void TVWrapper::GetCellInfo(MED::TCellInfo& theInfo,
- TErr* theErr)
+ TErr* theErr)
{
TFileWrapper aFileWrapper(myFile,eLECTURE,theErr);
if(theErr)
*theErr = aRet;
else if(aRet < 0)
- EXCEPTION(runtime_error,"GetCellInfo - MEDelementsLire(...)");
+ EXCEPTION(runtime_error,"SetCellInfo - MEDelementsLire(...)");
}
TGeom::const_iterator anGeomIter = aTGeom.begin();
for(; anGeomIter != aTGeom.end(); anGeomIter++){
const med_geometrie_element& aGeom = static_cast<const med_geometrie_element>(anGeomIter->first);
- aNbTimeStamps = MEDnPasdetemps(myFile->Id(),&anInfo.myName[0],anEntity,aGeom);
- if(aNbTimeStamps){
+ TInt aTmp = MEDnPasdetemps(myFile->Id(),&anInfo.myName[0],anEntity,aGeom);
+ aNbTimeStamps = max(aTmp,aNbTimeStamps);
+ BEGMSG(MYDEBUG,"GetNbTimeStamps aNbTimeStamps="<<aTmp<<"; aGeom="<<aGeom<<"; anEntity="<<anEntity<<"\n");
+ if(aTmp){
theEntity = EEntiteMaillage(anEntity);
theGeom[EGeometrieElement(aGeom)] = anGeomIter->second;
}
}
- if(aNbTimeStamps)
+ if(!theGeom.empty())
break;
}
return aNbTimeStamps;
aTimeStampInfo.myNumDt,
aTimeStampInfo.myNumOrd);
if(aRet >= 0)
- for(TInt i = 0; i < iEnd; i++)
+ for(TInt i = 0; i < iEnd; i++) {
aValue[i] = anArray[i];
+ MSG(MYDEBUG," "<<anArray[i]);
+ }
break;
}
default: {
EModeAcces theMode,
TErr* theErr = NULL);
+ //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ virtual void GetPolygoneInfo(TPolygoneInfo& theInfo,
+ TErr* theErr = NULL);
+
+ virtual void SetPolygoneInfo(const TPolygoneInfo& theInfo,
+ TErr* theErr = NULL);
+
+ void SetPolygoneInfo(const MED::TPolygoneInfo& theInfo,
+ EModeAcces theMode,
+ TErr* theErr = NULL);
+
+ virtual TInt GetNbPolygones(const TMeshInfo& theMeshInfo,
+ EEntiteMaillage,
+ EGeometrieElement,
+ EConnectivite,
+ TErr* theErr = NULL);
+
+ virtual TInt GetNbPolygoneConn(const TMeshInfo& theMeshInfo,
+ EEntiteMaillage,
+ EGeometrieElement,
+ EConnectivite,
+ TErr* theErr = NULL);
+
+ //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ virtual void GetPolyedreInfo(TPolyedreInfo& theInfo,
+ TErr* theErr = NULL);
+
+ virtual void SetPolyedreInfo(const TPolyedreInfo& theInfo,
+ TErr* theErr = NULL);
+
+ void SetPolyedreInfo(const MED::TPolyedreInfo& theInfo,
+ EModeAcces theMode,
+ TErr* theErr = NULL);
+
+ virtual TInt GetNbPolyedres(const TMeshInfo& theMeshInfo,
+ EEntiteMaillage,
+ EGeometrieElement,
+ EConnectivite,
+ TErr* theErr = NULL);
+
+ virtual void GetNbPolyedreConnF(const TMeshInfo& theMeshInfo,
+ EConnectivite,
+ TInt& nf,
+ TInt& nc,
+ TErr* theErr = NULL);
//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
virtual TEntityInfo GetEntityInfo(const MED::TMeshInfo& theMeshInfo,