]> SALOME platform Git repositories - modules/kernel.git/commitdiff
Salome HOME
CEA DEN - PAL/SALOME 2005 - L1.4.1 - Polyhedral elements
authorenk <enk@opencascade.com>
Fri, 21 Jan 2005 11:51:25 +0000 (11:51 +0000)
committerenk <enk@opencascade.com>
Fri, 21 Jan 2005 11:51:25 +0000 (11:51 +0000)
15 files changed:
src/MEDWrapper/Base/MED_Algorithm.cxx
src/MEDWrapper/Base/MED_Algorithm.hxx
src/MEDWrapper/Base/MED_Common.hxx
src/MEDWrapper/Base/MED_Structures.cxx [new file with mode: 0644]
src/MEDWrapper/Base/MED_Structures.hxx
src/MEDWrapper/Base/MED_TStructures.hxx
src/MEDWrapper/Base/MED_TWrapper.hxx
src/MEDWrapper/Base/MED_Utilities.cxx
src/MEDWrapper/Base/MED_Wrapper.cxx
src/MEDWrapper/Base/MED_Wrapper.hxx
src/MEDWrapper/Base/Makefile.in
src/MEDWrapper/Factory/MED_Test.cxx
src/MEDWrapper/V2_1/MED_V2_1_Wrapper.cxx
src/MEDWrapper/V2_2/MED_V2_2_Wrapper.cxx
src/MEDWrapper/V2_2/MED_V2_2_Wrapper.hxx

index cafc21b0bf53da8bc41a5793dfde754a10b6ee4f..2c0e4dc2af0f27c357439a8fe384fd61c529deea 100644 (file)
@@ -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 = "<<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");
        }
       }
     }
@@ -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));
              }
            }
          }
index 7d519c0ad1b7d16409730b2cefeb061b3f720c9e..e72917a743aa47259758a353d535bdb8450a9b14 100644 (file)
 
 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);
 
@@ -56,7 +56,7 @@ namespace MED{
   
   TFamilyByEntity GetFamiliesByEntity(TWrapper& theWrapper, 
                                      const PNodeInfo& theNodeInfo, 
-                                     const TCellGroup& theCellGroup,
+                                     const TElemGroup& theElemGroup,
                                      const TFamilyGroup& theFamilyGroup);
 
 
index 51307abe89abe90ed52f155074d9298161a5e180..9435a2dc88037f5677a215c2e1c352f12937e78d 100644 (file)
@@ -121,6 +121,12 @@ namespace MED{
   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;
 
diff --git a/src/MEDWrapper/Base/MED_Structures.cxx b/src/MEDWrapper/Base/MED_Structures.cxx
new file mode 100644 (file)
index 0000000..7ba5c35
--- /dev/null
@@ -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;
+}
index 8ade5eb2fa3b160f374ec11e2c494a60d788dfdf..5dad42751bc765a9c4a60a2b8cba68941abafa54 100644 (file)
@@ -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;}
index 93dc7b66b7ab5cf6e56eef28b58ca9015ee305a4..674c5518ac2c81160ac290e09ea91da9c0c702d5 100644 (file)
@@ -398,6 +398,134 @@ namespace MED{
     }
   };
 
+  //---------------------------------------------------------------
+  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>
index b5811b09e767fa114c86947262e596655668406c..ecfb13874d8df821375b9d8b487721595f81b2f3 100644 (file)
@@ -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<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,
index 1454a96f33c39d21e40a998745a040d5d3ee7102..5c53a4df29c7ff7fe879a29b01e981b63a38753e 100644 (file)
@@ -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;
 }
index bc76b56239673ff5da90dfb3e52a2739e70b8ab0..1c01b2716d6f8b197ae2b0cd1892536d24c831dc 100644 (file)
@@ -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, 
index 102e38ef165738a980f7e53f988782660a68ebcf..e0ccbd9f36b2a71e229d2937761ad897ffbfdeae 100644 (file)
@@ -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,
index b32b0284ae5e65733e86ca86a9f8f74dd2fb2c67..ae80425cbe6f8ae2d691cfa0f2edeb33c0602ec8 100644 (file)
@@ -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 = 
index e7c8940909ffe586bb44b6977d5b60855c879cfa..50dcd0499dcd06498fc13a3e6bd9aea51b204c24 100644 (file)
@@ -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 = "<<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);
       }
     }
     
@@ -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 = '"<<theFileName<<"'; "<<
index fafc8671ad765deaa115e6f3917cad245abbd621..8b71d6071e27a6087ec2dfb18e60370a6f6fc166 100644 (file)
@@ -308,6 +308,8 @@ namespace MED{
     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)
@@ -315,21 +317,26 @@ namespace MED{
       
       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;
@@ -352,10 +359,13 @@ namespace MED{
                                &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);
     }
     
     
@@ -419,7 +429,8 @@ namespace MED{
       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();
@@ -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;
            }
          }
index 2405e774379894488c891583ab4992bbfed75968..4585c08d0e0d8811290074cc98aa6c76146ceef4 100644 (file)
@@ -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<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,
@@ -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<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;
@@ -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," "<<anArray[i]);
+           }
          break;
        }
        default: {
index 0d60ca7e5082adadc839d2e3c1a59e04ae784d8c..ac113af85d5cde4249dce2df5c985734d668b604 100644 (file)
@@ -118,6 +118,51 @@ namespace MED{
                       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,