From: enk Date: Fri, 21 Jan 2005 11:51:25 +0000 (+0000) Subject: CEA DEN - PAL/SALOME 2005 - L1.4.1 - Polyhedral elements X-Git-Tag: V2_2_0a2~8 X-Git-Url: http://git.salome-platform.org/gitweb/?a=commitdiff_plain;h=e55fbb4ca20ec6cdba62b6cdc0631c5e81184c58;p=modules%2Fkernel.git CEA DEN - PAL/SALOME 2005 - L1.4.1 - Polyhedral elements --- diff --git a/src/MEDWrapper/Base/MED_Algorithm.cxx b/src/MEDWrapper/Base/MED_Algorithm.cxx index cafc21b0b..2c0e4dc2a 100644 --- a/src/MEDWrapper/Base/MED_Algorithm.cxx +++ b/src/MEDWrapper/Base/MED_Algorithm.cxx @@ -39,35 +39,63 @@ static int MYVALUEDEBUG = 0; 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 = "<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 = "<GetNbElem(); + INITMSG(MYDEBUG,"aGeo = "<GetConnDim(); + for(TInt iConn = 0; iConn < iConnEnd; iConn++){ + ADDMSG(MYVALUEDEBUG,aCellInfo->GetConn(iElem,iConn)<<","); + } + ADDMSG(MYVALUEDEBUG," "); + } + ADDMSG(MYDEBUG,"\n"); } - ADDMSG(MYVALUEDEBUG," "); } - ADDMSG(MYDEBUG,"\n"); } } } @@ -189,7 +217,7 @@ namespace MED{ TFamilyByEntity GetFamiliesByEntity(TWrapper& theWrapper, const PNodeInfo& theNodeInfo, - const TCellGroup& theCellGroup, + const TElemGroup& theElemGroup, const TFamilyGroup& theFamilyGroup) { MSG(MYDEBUG,"GetFamiliesByEntity(...)"); @@ -217,18 +245,18 @@ namespace MED{ } } - 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)); } } } diff --git a/src/MEDWrapper/Base/MED_Algorithm.hxx b/src/MEDWrapper/Base/MED_Algorithm.hxx index 7d519c0ad..e72917a74 100644 --- a/src/MEDWrapper/Base/MED_Algorithm.hxx +++ b/src/MEDWrapper/Base/MED_Algorithm.hxx @@ -36,10 +36,10 @@ namespace MED{ //--------------------------------------------------------------- - typedef std::set TCellSet; - typedef std::map TCellGroup; + typedef std::set TElemSet; + typedef std::map TElemGroup; - TCellGroup GetCellsByEntity(TWrapper& theWrapper, + TElemGroup GetElemsByEntity(TWrapper& theWrapper, const PMeshInfo& theMeshInfo, const MED::TEntityInfo& theEntityInfo); @@ -56,7 +56,7 @@ namespace MED{ TFamilyByEntity GetFamiliesByEntity(TWrapper& theWrapper, const PNodeInfo& theNodeInfo, - const TCellGroup& theCellGroup, + const TElemGroup& theElemGroup, const TFamilyGroup& theFamilyGroup); diff --git a/src/MEDWrapper/Base/MED_Common.hxx b/src/MEDWrapper/Base/MED_Common.hxx index 51307abe8..9435a2dc8 100644 --- a/src/MEDWrapper/Base/MED_Common.hxx +++ b/src/MEDWrapper/Base/MED_Common.hxx @@ -121,6 +121,12 @@ namespace MED{ struct TNodeInfo; typedef MED::shared_ptr PNodeInfo; + struct TPolygoneInfo; + typedef MED::shared_ptr PPolygoneInfo; + + struct TPolyedreInfo; + typedef MED::shared_ptr PPolyedreInfo; + struct TCellInfo; typedef MED::shared_ptr PCellInfo; diff --git a/src/MEDWrapper/Base/MED_Structures.cxx b/src/MEDWrapper/Base/MED_Structures.cxx new file mode 100644 index 000000000..7ba5c359c --- /dev/null +++ b/src/MEDWrapper/Base/MED_Structures.cxx @@ -0,0 +1,101 @@ +// 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; +} diff --git a/src/MEDWrapper/Base/MED_Structures.hxx b/src/MEDWrapper/Base/MED_Structures.hxx index 8ade5eb2f..5dad42751 100644 --- a/src/MEDWrapper/Base/MED_Structures.hxx +++ b/src/MEDWrapper/Base/MED_Structures.hxx @@ -107,12 +107,12 @@ namespace MED{ 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; @@ -132,15 +132,15 @@ namespace MED{ 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;} @@ -157,12 +157,8 @@ namespace MED{ 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;} @@ -194,14 +190,60 @@ namespace MED{ 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 @@ -272,24 +314,10 @@ namespace MED{ 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;} diff --git a/src/MEDWrapper/Base/MED_TStructures.hxx b/src/MEDWrapper/Base/MED_TStructures.hxx index 93dc7b66b..674c5518a 100644 --- a/src/MEDWrapper/Base/MED_TStructures.hxx +++ b/src/MEDWrapper/Base/MED_TStructures.hxx @@ -398,6 +398,134 @@ namespace MED{ } }; + //--------------------------------------------------------------- + template + struct TTPolygoneInfo: TPolygoneInfo, TTElemInfo + { + typedef TTElemInfo 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(theMeshInfo, + theFamilyNums, + theElemNums, + theElemNames) + { + myTEntity = theTEntity; + myTGeom = theTGeom; + myTConn = theTConn; + myConnDim = theConnectivities.size(); + myConn = theConnectivities; + myIndex = theIndexes; + } + }; + //--------------------------------------------------------------- + template + struct TTPolyedreInfo: TPolyedreInfo, TTElemInfo + { + typedef TTElemInfo 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(theMeshInfo, + theFamilyNums, + theElemNums, + theElemNames) + { + myTEntity = theTEntity; + myTGeom = theTGeom; + myTConn = theTConn; + myNbConn = theConnectivities.size(); + myNbFacesIndex = theFacesIndexes.size(); + myConn = theConnectivities; + myFacesIndex = theFacesIndexes; + myIndex = theIndexes; + } + }; //--------------------------------------------------------------- template diff --git a/src/MEDWrapper/Base/MED_TWrapper.hxx b/src/MEDWrapper/Base/MED_TWrapper.hxx index b5811b09e..ecfb13874 100644 --- a/src/MEDWrapper/Base/MED_TWrapper.hxx +++ b/src/MEDWrapper/Base/MED_TWrapper.hxx @@ -141,7 +141,112 @@ namespace MED{ 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 + (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 + (theMeshInfo, + theTEntity, + theTGeom, + theTConn, + theConnectivities, + theIndexes, + theFamilyNums, + theElemNums, + theElemNames)); + } + + virtual PPolygoneInfo CrPolygoneInfo(const PMeshInfo& theMeshInfo, + const PPolygoneInfo& theInfo) + { + return PPolygoneInfo(new TTPolygoneInfo + (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 + (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 + (theMeshInfo, + theTEntity, + theTGeom, + theTConn, + theConnectivities, + theFacesIndexes, + theIndexes, + theFamilyNums, + theElemNums, + theElemNames)); + } + + virtual PPolyedreInfo CrPolyedreInfo(const PMeshInfo& theMeshInfo, + const PPolyedreInfo& theInfo) + { + return PPolyedreInfo(new TTPolyedreInfo + (theMeshInfo, + theInfo)); + } + //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ virtual PCellInfo CrCellInfo(const PMeshInfo& theMeshInfo, TInt theNbElem, diff --git a/src/MEDWrapper/Base/MED_Utilities.cxx b/src/MEDWrapper/Base/MED_Utilities.cxx index 1454a96f3..5c53a4df2 100644 --- a/src/MEDWrapper/Base/MED_Utilities.cxx +++ b/src/MEDWrapper/Base/MED_Utilities.cxx @@ -77,6 +77,7 @@ bool InitEntity2GeomSet() aGeomFACESet.insert(eQUAD4); aGeomFACESet.insert(eTRIA6); aGeomFACESet.insert(eQUAD8); + aGeomFACESet.insert(ePOLYGONE); TGeomSet& aGeomMAILLESet = Entity2GeomSet[eMAILLE]; aGeomMAILLESet.insert(ePOINT1); @@ -90,6 +91,7 @@ bool InitEntity2GeomSet() aGeomMAILLESet.insert(ePYRA13); aGeomMAILLESet.insert(ePENTA15); aGeomMAILLESet.insert(eHEXA20); + aGeomMAILLESet.insert(ePOLYEDRE); return true; } diff --git a/src/MEDWrapper/Base/MED_Wrapper.cxx b/src/MEDWrapper/Base/MED_Wrapper.cxx index bc76b5623..1c01b2716 100644 --- a/src/MEDWrapper/Base/MED_Wrapper.cxx +++ b/src/MEDWrapper/Base/MED_Wrapper.cxx @@ -39,7 +39,34 @@ namespace MED{ 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, diff --git a/src/MEDWrapper/Base/MED_Wrapper.hxx b/src/MEDWrapper/Base/MED_Wrapper.hxx index 102e38ef1..e0ccbd9f3 100644 --- a/src/MEDWrapper/Base/MED_Wrapper.hxx +++ b/src/MEDWrapper/Base/MED_Wrapper.hxx @@ -122,6 +122,110 @@ namespace MED{ 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, diff --git a/src/MEDWrapper/Base/Makefile.in b/src/MEDWrapper/Base/Makefile.in index b32b0284a..ae80425cb 100644 --- a/src/MEDWrapper/Base/Makefile.in +++ b/src/MEDWrapper/Base/Makefile.in @@ -46,7 +46,9 @@ EXPORT_HEADERS = \ # 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 = diff --git a/src/MEDWrapper/Factory/MED_Test.cxx b/src/MEDWrapper/Factory/MED_Test.cxx index e7c894090..50dcd0499 100644 --- a/src/MEDWrapper/Factory/MED_Test.cxx +++ b/src/MEDWrapper/Factory/MED_Test.cxx @@ -61,11 +61,11 @@ void CheckMed(const std::string& theFileName) 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); @@ -214,17 +214,71 @@ void CopyMed(const PWrapper& theMed, const EGeometrieElement& aGeom = anTGeomIter->first; const TInt& aNbElem = anTGeomIter->second; INITMSG(MYDEBUG,"aGeom = "<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)<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); } } @@ -251,7 +305,7 @@ void CopyMed(const std::string& theFileName, void ReadMed(const char* theFileName, const char* theFileName2, - MED::EVersion theVersion = eV2_1, + MED::EVersion theVersion = eV2_2, int theNbCopy = 1) { MSG(MYDEBUG,"theFileName = '"<(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="<0){ anInfo[eNOEUD][ePOINT1] = aNbElem; const TEntity2GeomSet& anEntity2GeomSet = GetEntity2GeomSet(); TEntity2GeomSet::const_iterator anIter = anEntity2GeomSet.begin(); @@ -431,7 +442,8 @@ namespace MED{ 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; } } diff --git a/src/MEDWrapper/V2_2/MED_V2_2_Wrapper.cxx b/src/MEDWrapper/V2_2/MED_V2_2_Wrapper.cxx index 2405e7743..4585c08d0 100644 --- a/src/MEDWrapper/V2_2/MED_V2_2_Wrapper.cxx +++ b/src/MEDWrapper/V2_2/MED_V2_2_Wrapper.cxx @@ -424,6 +424,293 @@ namespace MED{ 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(theInfo.myTEntity); + med_connectivite& aConn = static_cast(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(theInfo); + MED::TMeshInfo& aMeshInfo = *anInfo.myMeshInfo; + + med_booleen& anIsElemNames = static_cast(theInfo.myIsElemNames); + med_booleen& anIsElemNum = static_cast(theInfo.myIsElemNum); + med_entite_maillage& anEntity = static_cast(theInfo.myTEntity); + med_connectivite& aConn = static_cast(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(theMeshInfo); + + med_entite_maillage& anEntity = static_cast(theTEntity); + med_connectivite& aConn = static_cast(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(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(theInfo); + MED::TMeshInfo& aMeshInfo = *anInfo.myMeshInfo; + + med_booleen& anIsElemNames = static_cast(theInfo.myIsElemNames); + med_booleen& anIsElemNum = static_cast(theInfo.myIsElemNum); + med_entite_maillage& anEntity = static_cast(theInfo.myTEntity); + med_connectivite& aConn = static_cast(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(theMeshInfo); + med_connectivite& aConn = static_cast(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, @@ -448,7 +735,8 @@ namespace MED{ 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; } } @@ -485,7 +773,7 @@ namespace MED{ void TVWrapper::GetCellInfo(MED::TCellInfo& theInfo, - TErr* theErr) + TErr* theErr) { TFileWrapper aFileWrapper(myFile,eLECTURE,theErr); @@ -558,7 +846,7 @@ namespace MED{ if(theErr) *theErr = aRet; else if(aRet < 0) - EXCEPTION(runtime_error,"GetCellInfo - MEDelementsLire(...)"); + EXCEPTION(runtime_error,"SetCellInfo - MEDelementsLire(...)"); } @@ -681,13 +969,15 @@ namespace MED{ TGeom::const_iterator anGeomIter = aTGeom.begin(); for(; anGeomIter != aTGeom.end(); anGeomIter++){ const med_geometrie_element& aGeom = static_cast(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="<second; } } - if(aNbTimeStamps) + if(!theGeom.empty()) break; } return aNbTimeStamps; @@ -810,8 +1100,10 @@ namespace MED{ 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," "<