Salome HOME
Merge from V6_main_20120808 08Aug12
[modules/med.git] / src / MEDWrapper / Base / MED_TStructures.hxx
index 30314f8bc28b2d7dab111f1433d3bf77fabeb3d8..c49f60095701e5e78f0322abbce9a2f5aa3d09a5 100644 (file)
@@ -1,34 +1,38 @@
-//  Copyright (C) 2007-2008  CEA/DEN, EDF R&D, OPEN CASCADE
+// Copyright (C) 2007-2012  CEA/DEN, EDF R&D, OPEN CASCADE
 //
-//  Copyright (C) 2003-2007  OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
-//  CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
+// Copyright (C) 2003-2007  OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
+// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
 //
-//  This library is free software; you can redistribute it and/or
-//  modify it under the terms of the GNU Lesser General Public
-//  License as published by the Free Software Foundation; either
-//  version 2.1 of the License.
+// This library is free software; you can redistribute it and/or
+// modify it under the terms of the GNU Lesser General Public
+// License as published by the Free Software Foundation; either
+// version 2.1 of the License.
 //
-//  This library is distributed in the hope that it will be useful,
-//  but WITHOUT ANY WARRANTY; without even the implied warranty of
-//  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-//  Lesser General Public License for more details.
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+// Lesser General Public License for more details.
 //
-//  You should have received a copy of the GNU Lesser General Public
-//  License along with this library; if not, write to the Free Software
-//  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
+// You should have received a copy of the GNU Lesser General Public
+// License along with this library; if not, write to the Free Software
+// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
 //
-//  See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
 //
+
 //  File   : 
 //  Author : 
 //  Module : 
-//  $Header$
 //
 #ifndef MED_TStructures_HeaderFile
 #define MED_TStructures_HeaderFile
 
 #include "MED_Structures.hxx"
 
+#ifdef WNT
+#pragma warning(disable:4250)
+#endif
+
 namespace MED
 {
   //---------------------------------------------------------------
@@ -79,9 +83,9 @@ namespace MED
       myValue(theValue)
     {
       if(theValue.empty())
-       myRepresentation = (TRepresentation*)NULL;
+        myRepresentation = (TRepresentation*)NULL;
       else
-       myRepresentation = (TRepresentation*)&theValue[0];
+        myRepresentation = (TRepresentation*)&theValue[0];
     }
 
     TRepresentation*
@@ -136,19 +140,21 @@ namespace MED
       TNameInfoBase(theInfo->GetName())
     {
       myDim = theInfo->GetDim();
+      mySpaceDim = theInfo->GetSpaceDim();
       myType = theInfo->GetType();
       
       myDesc.resize(GetDESCLength<eVersion>()+1);
       SetDesc(theInfo->GetDesc());
     }
 
-    TTMeshInfo(TInt theDim,
-              const std::string& theValue,
-              EMaillage theType,
-              const std::string& theDesc):
+    TTMeshInfo(TInt theDim, TInt theSpaceDim,
+               const std::string& theValue,
+               EMaillage theType,
+               const std::string& theDesc):
       TNameInfoBase(theValue)
     {
       myDim = theDim;
+      mySpaceDim = theSpaceDim;
       myType = theType;
       
       myDesc.resize(GetDESCLength<eVersion>()+1);
@@ -189,9 +195,9 @@ namespace MED
       myNbGroup = theInfo->GetNbGroup();
       myGroupNames.resize(myNbGroup*GetLNOMLength<eVersion>()+1);
       if(myNbGroup){
-       for(TInt anId = 0; anId < myNbGroup; anId++){
-         SetGroupName(anId,theInfo->GetGroupName(anId));
-       }
+        for(TInt anId = 0; anId < myNbGroup; anId++){
+          SetGroupName(anId,theInfo->GetGroupName(anId));
+        }
       }
 
       myNbAttr = theInfo->GetNbAttr();
@@ -199,19 +205,19 @@ namespace MED
       myAttrVal.resize(myNbAttr);
       myAttrDesc.resize(myNbAttr*GetDESCLength<eVersion>()+1);
       if(myNbAttr){
-       for(TInt anId = 0; anId < myNbAttr; anId++){
-         SetAttrDesc(anId,theInfo->GetAttrDesc(anId));
-         myAttrVal[anId] = theInfo->GetAttrVal(anId);
-         myAttrId[anId] = theInfo->GetAttrId(anId);
-       }
+        for(TInt anId = 0; anId < myNbAttr; anId++){
+          SetAttrDesc(anId,theInfo->GetAttrDesc(anId));
+          myAttrVal[anId] = theInfo->GetAttrVal(anId);
+          myAttrId[anId] = theInfo->GetAttrId(anId);
+        }
       }
     }
 
     TTFamilyInfo(const PMeshInfo& theMeshInfo,
-                TInt theNbGroup, 
-                TInt theNbAttr,
-                TInt theId,
-                const std::string& theValue):
+                 TInt theNbGroup, 
+                 TInt theNbAttr,
+                 TInt theId,
+                 const std::string& theValue):
       TNameInfoBase(theValue)
     {
       myMeshInfo = theMeshInfo;
@@ -228,12 +234,12 @@ namespace MED
     }
 
     TTFamilyInfo(const PMeshInfo& theMeshInfo,
-                const std::string& theValue,
-                TInt theId,
-                const TStringSet& theGroupNames, 
-                const TStringVector& theAttrDescs, 
-                const TIntVector& theAttrIds, 
-                const TIntVector& theAttrVals):
+                 const std::string& theValue,
+                 TInt theId,
+                 const TStringSet& theGroupNames, 
+                 const TStringVector& theAttrDescs, 
+                 const TIntVector& theAttrIds, 
+                 const TIntVector& theAttrVals):
       TNameInfoBase(theValue)
     {
       myMeshInfo = theMeshInfo;
@@ -243,11 +249,11 @@ namespace MED
       myNbGroup = (TInt)theGroupNames.size();
       myGroupNames.resize(myNbGroup*GetLNOMLength<eVersion>()+1);
       if(myNbGroup){
-       TStringSet::const_iterator anIter = theGroupNames.begin();
-       for(TInt anId = 0; anIter != theGroupNames.end(); anIter++, anId++){
-         const std::string& aVal = *anIter;
-         SetGroupName(anId,aVal);
-       }
+        TStringSet::const_iterator anIter = theGroupNames.begin();
+        for(TInt anId = 0; anIter != theGroupNames.end(); anIter++, anId++){
+          const std::string& aVal = *anIter;
+          SetGroupName(anId,aVal);
+        }
       }
 
       myNbAttr = (TInt)theAttrDescs.size();
@@ -255,11 +261,11 @@ namespace MED
       myAttrVal.resize(myNbAttr);
       myAttrDesc.resize(myNbAttr*GetDESCLength<eVersion>()+1);
       if(myNbAttr){
-       for(TInt anId = 0, anEnd = (TInt)theAttrDescs.size(); anId < anEnd; anId++){
-         SetAttrDesc(anId,theAttrDescs[anId]);
-         myAttrVal[anId] = theAttrVals[anId];
-         myAttrId[anId] = theAttrIds[anId];
-       }
+        for(TInt anId = 0, anEnd = (TInt)theAttrDescs.size(); anId < anEnd; anId++){
+          SetAttrDesc(anId,theAttrDescs[anId]);
+          myAttrVal[anId] = theAttrVals[anId];
+          myAttrId[anId] = theAttrIds[anId];
+        }
       }
     }
 
@@ -303,96 +309,99 @@ namespace MED
       
       myNbElem = theInfo->GetNbElem();
       myFamNum.reset(new TElemNum(myNbElem));
+      myIsFamNum = eFAUX; // is set to eVRAI in SetFamNum()
 
       myIsElemNum = theInfo->IsElemNum();
       if(theInfo->IsElemNum())
-       myElemNum.reset(new TElemNum(myNbElem));
+        myElemNum.reset(new TElemNum(myNbElem));
       else
-       myElemNum.reset(new TElemNum());
+        myElemNum.reset(new TElemNum());
 
       myIsElemNames = theInfo->IsElemNames();
       if(theInfo->IsElemNames())
-       myElemNames.reset(new TString(myNbElem*GetPNOMLength<eVersion>() + 1));
+        myElemNames.reset(new TString(myNbElem*GetPNOMLength<eVersion>() + 1));
       else
-       myElemNames.reset(new TString());
+        myElemNames.reset(new TString());
 
       if(theInfo->GetNbElem()){
-       for(TInt anId = 0; anId < myNbElem; anId++){
-         SetFamNum(anId, theInfo->GetFamNum(anId));
-       }
-       if(theInfo->IsElemNum() == eVRAI){
-         for(TInt anId = 0; anId < myNbElem; anId++){
-           SetElemNum(anId, theInfo->GetElemNum(anId));
-         }
-       }
-       if(theInfo->IsElemNames() == eVRAI){
-         for(TInt anId = 0; anId < myNbElem; anId++){
-           SetElemName(anId,theInfo->GetElemName(anId));
-         }
-       }
+        for(TInt anId = 0; anId < myNbElem; anId++){
+          SetFamNum(anId, theInfo->GetFamNum(anId));
+        }
+        if(theInfo->IsElemNum() == eVRAI){
+          for(TInt anId = 0; anId < myNbElem; anId++){
+            SetElemNum(anId, theInfo->GetElemNum(anId));
+          }
+        }
+        if(theInfo->IsElemNames() == eVRAI){
+          for(TInt anId = 0; anId < myNbElem; anId++){
+            SetElemName(anId,theInfo->GetElemName(anId));
+          }
+        }
       }
     }
 
     TTElemInfo(const PMeshInfo& theMeshInfo, 
-              TInt theNbElem,
-              EBooleen theIsElemNum,
-              EBooleen theIsElemNames)
+               TInt theNbElem,
+               EBooleen theIsElemNum,
+               EBooleen theIsElemNames)
     {
       myMeshInfo = theMeshInfo;
 
       myNbElem = theNbElem;
       myFamNum.reset(new TElemNum(theNbElem));
+      myIsFamNum = eFAUX; // is set to eVRAI in SetFamNum()
 
       myIsElemNum = theIsElemNum;
       if(theIsElemNum)
-       myElemNum.reset(new TElemNum(theNbElem));
+        myElemNum.reset(new TElemNum(theNbElem));
       else
-       myElemNum.reset(new TElemNum());
+        myElemNum.reset(new TElemNum());
 
       myIsElemNames = theIsElemNames;
       if(theIsElemNames)
-       myElemNames.reset(new TString(theNbElem*GetPNOMLength<eVersion>() + 1));
+        myElemNames.reset(new TString(theNbElem*GetPNOMLength<eVersion>() + 1));
       else
-       myElemNames.reset(new TString());
+        myElemNames.reset(new TString());
    }
     
     TTElemInfo(const PMeshInfo& theMeshInfo, 
-              TInt theNbElem,
-              const TIntVector& theFamilyNums,
-              const TIntVector& theElemNums,
-              const TStringVector& theElemNames)
+               TInt theNbElem,
+               const TIntVector& theFamilyNums,
+               const TIntVector& theElemNums,
+               const TStringVector& theElemNames)
     {
       myMeshInfo = theMeshInfo;
       
       myNbElem = theNbElem;
       myFamNum.reset(new TElemNum(theNbElem));
+      myIsFamNum = eFAUX; // is set to eVRAI in SetFamNum()
       
       myIsElemNum = theElemNums.size()? eVRAI: eFAUX;
       if(myIsElemNum)
-       myElemNum.reset(new TElemNum(theNbElem));
+        myElemNum.reset(new TElemNum(theNbElem));
       else
-       myElemNum.reset(new TElemNum());
+        myElemNum.reset(new TElemNum());
       
       myIsElemNames = theElemNames.size()? eVRAI: eFAUX;
       if(myIsElemNames)
-       myElemNames.reset(new TString(theNbElem*GetPNOMLength<eVersion>() + 1));
+        myElemNames.reset(new TString(theNbElem*GetPNOMLength<eVersion>() + 1));
       else
-       myElemNames.reset(new TString());
+        myElemNames.reset(new TString());
      
       if(theNbElem){
 
-       if(theFamilyNums.size())
-         *myFamNum = theFamilyNums;
+        if(theFamilyNums.size())
+          *myFamNum = theFamilyNums;
 
-       if(myIsElemNum)
-         *myElemNum = theElemNums;
+        if(myIsElemNum)
+          *myElemNum = theElemNums;
 
-       if(myIsElemNames){
-         for(TInt anId = 0; anId < theNbElem; anId++){
-           const std::string& aVal = theElemNames[anId];
-           SetElemName(anId,aVal);
-         }
-       }
+        if(myIsElemNames){
+          for(TInt anId = 0; anId < theNbElem; anId++){
+            const std::string& aVal = theElemNames[anId];
+            SetElemName(anId,aVal);
+          }
+        }
       }
     }
 
@@ -421,8 +430,8 @@ namespace MED
     typedef TTElemInfo<eVersion> TElemInfoBase;
 
     TTNodeInfo(const PMeshInfo& theMeshInfo, const PNodeInfo& theInfo):
-      TElemInfoBase(theMeshInfo, theInfo),
-      TNodeInfo(theInfo)
+      TNodeInfo(theInfo),
+      TElemInfoBase(theMeshInfo, theInfo)
     {
       myModeSwitch = theInfo->GetModeSwitch();
       
@@ -430,70 +439,70 @@ namespace MED
       
       myCoord.reset(new TNodeCoord(*theInfo->myCoord));
       
-      TInt aDim = theMeshInfo->GetDim();
+      TInt aSpaceDim = theMeshInfo->GetSpaceDim();
 
-      myCoordNames.resize(aDim*GetPNOMLength<eVersion>()+1);
-      for(TInt anId = 0; anId < aDim; anId++)
-       SetCoordName(anId,theInfo->GetCoordName(anId));
+      myCoordNames.resize(aSpaceDim*GetPNOMLength<eVersion>()+1);
+      for(TInt anId = 0; anId < aSpaceDim; anId++)
+        SetCoordName(anId,theInfo->GetCoordName(anId));
       
-      myCoordUnits.resize(aDim*GetPNOMLength<eVersion>()+1);
-      for(TInt anId = 0; anId < aDim; anId++)
-       SetCoordUnit(anId,theInfo->GetCoordUnit(anId));
+      myCoordUnits.resize(aSpaceDim*GetPNOMLength<eVersion>()+1);
+      for(TInt anId = 0; anId < aSpaceDim; anId++)
+        SetCoordUnit(anId,theInfo->GetCoordUnit(anId));
     }
 
     TTNodeInfo(const PMeshInfo& theMeshInfo, 
-              TInt theNbElem,
-              EModeSwitch theMode,
-              ERepere theSystem, 
-              EBooleen theIsElemNum,
-              EBooleen theIsElemNames):
+               TInt theNbElem,
+               EModeSwitch theMode,
+               ERepere theSystem, 
+               EBooleen theIsElemNum,
+               EBooleen theIsElemNames):
+      TModeSwitchInfo(theMode),
       TElemInfoBase(theMeshInfo,
-                   theNbElem,
-                   theIsElemNum,
-                   theIsElemNames),
-      TModeSwitchInfo(theMode)
+                    theNbElem,
+                    theIsElemNum,
+                    theIsElemNames)
     {
       mySystem = theSystem;
 
-      myCoord.reset(new TNodeCoord(theNbElem * theMeshInfo->myDim));
+      myCoord.reset(new TNodeCoord(theNbElem * theMeshInfo->mySpaceDim));
 
-      myCoordUnits.resize(theMeshInfo->myDim*GetPNOMLength<eVersion>()+1);
+      myCoordUnits.resize(theMeshInfo->mySpaceDim*GetPNOMLength<eVersion>()+1);
 
-      myCoordNames.resize(theMeshInfo->myDim*GetPNOMLength<eVersion>()+1);
+      myCoordNames.resize(theMeshInfo->mySpaceDim*GetPNOMLength<eVersion>()+1);
     }
 
     
     TTNodeInfo(const PMeshInfo& theMeshInfo, 
-              const TFloatVector& theNodeCoords,
-              EModeSwitch theMode,
-              ERepere theSystem, 
-              const TStringVector& theCoordNames,
-              const TStringVector& theCoordUnits,
-              const TIntVector& theFamilyNums,
-              const TIntVector& theElemNums,
-              const TStringVector& theElemNames):
+               const TFloatVector& theNodeCoords,
+               EModeSwitch theMode,
+               ERepere theSystem, 
+               const TStringVector& theCoordNames,
+               const TStringVector& theCoordUnits,
+               const TIntVector& theFamilyNums,
+               const TIntVector& theElemNums,
+               const TStringVector& theElemNames):
+      TModeSwitchInfo(theMode),
       TElemInfoBase(theMeshInfo,
-                   (TInt)theNodeCoords.size()/theMeshInfo->GetDim(),
-                   theFamilyNums,
-                   theElemNums,
-                   theElemNames),
-      TModeSwitchInfo(theMode)
+                    (TInt)theNodeCoords.size()/theMeshInfo->GetDim(),
+                    theFamilyNums,
+                    theElemNums,
+                    theElemNames)
     {
       mySystem = theSystem;
 
       myCoord.reset(new TNodeCoord(theNodeCoords));
       
-      TInt aDim = theMeshInfo->GetDim();
+      TInt aSpaceDim = theMeshInfo->GetSpaceDim();
 
-      myCoordNames.resize(aDim*GetPNOMLength<eVersion>()+1);
+      myCoordNames.resize(aSpaceDim*GetPNOMLength<eVersion>()+1);
       if(!theCoordNames.empty())
-       for(TInt anId = 0; anId < aDim; anId++)
-         SetCoordName(anId,theCoordNames[anId]);
+        for(TInt anId = 0; anId < aSpaceDim; anId++)
+          SetCoordName(anId,theCoordNames[anId]);
       
-      myCoordUnits.resize(aDim*GetPNOMLength<eVersion>() + 1);
+      myCoordUnits.resize(aSpaceDim*GetPNOMLength<eVersion>() + 1);
       if(!theCoordUnits.empty())
-       for(TInt anId = 0; anId < aDim; anId++)
-         SetCoordUnit(anId, theCoordUnits[anId]);
+        for(TInt anId = 0; anId < aSpaceDim; anId++)
+          SetCoordUnit(anId, theCoordUnits[anId]);
     }
 
     virtual
@@ -546,17 +555,17 @@ namespace MED
     }
 
     TTPolygoneInfo(const PMeshInfo& theMeshInfo, 
-                  EEntiteMaillage theEntity, 
-                  EGeometrieElement theGeom,
-                  TInt theNbElem,
-                  TInt theConnSize,
-                  EConnectivite theConnMode,
-                  EBooleen theIsElemNum,
-                  EBooleen theIsElemNames):
+                   EEntiteMaillage theEntity, 
+                   EGeometrieElement theGeom,
+                   TInt theNbElem,
+                   TInt theConnSize,
+                   EConnectivite theConnMode,
+                   EBooleen theIsElemNum,
+                   EBooleen theIsElemNames):
       TElemInfoBase(theMeshInfo,
-                   theNbElem,
-                   theIsElemNum,
-                   theIsElemNames)
+                    theNbElem,
+                    theIsElemNum,
+                    theIsElemNames)
     {
       myEntity = theEntity;
       myGeom = theGeom;
@@ -568,19 +577,19 @@ namespace MED
     }
     
     TTPolygoneInfo(const PMeshInfo& theMeshInfo, 
-                  EEntiteMaillage theEntity, 
-                  EGeometrieElement theGeom,
-                  const TIntVector& theIndexes,
-                  const TIntVector& theConnectivities,
-                  EConnectivite theConnMode,
-                  const TIntVector& theFamilyNums,
-                  const TIntVector& theElemNums,
-                  const TStringVector& theElemNames):
+                   EEntiteMaillage theEntity, 
+                   EGeometrieElement theGeom,
+                   const TIntVector& theIndexes,
+                   const TIntVector& theConnectivities,
+                   EConnectivite theConnMode,
+                   const TIntVector& theFamilyNums,
+                   const TIntVector& theElemNums,
+                   const TStringVector& theElemNames):
       TElemInfoBase(theMeshInfo,
-                   (TInt)theIndexes.size() - 1,
-                   theFamilyNums,
-                   theElemNums,
-                   theElemNames)
+                    (TInt)theIndexes.size() - 1,
+                    theFamilyNums,
+                    theElemNums,
+                    theElemNames)
     {
       myEntity = theEntity;
       myGeom = theGeom;
@@ -614,18 +623,18 @@ namespace MED
     }
 
     TTPolyedreInfo(const PMeshInfo& theMeshInfo, 
-                  EEntiteMaillage theEntity, 
-                  EGeometrieElement theGeom,
-                  TInt theNbElem,
-                  TInt theNbFaces,
-                  TInt theConnSize,
-                  EConnectivite theConnMode,
-                  EBooleen theIsElemNum,
-                  EBooleen theIsElemNames):
+                   EEntiteMaillage theEntity, 
+                   EGeometrieElement theGeom,
+                   TInt theNbElem,
+                   TInt theNbFaces,
+                   TInt theConnSize,
+                   EConnectivite theConnMode,
+                   EBooleen theIsElemNum,
+                   EBooleen theIsElemNames):
       TElemInfoBase(theMeshInfo,
-                   theNbElem,
-                   theIsElemNum,
-                   theIsElemNames)
+                    theNbElem,
+                    theIsElemNum,
+                    theIsElemNames)
     {
       myEntity = theEntity;
       myGeom = theGeom;
@@ -638,20 +647,20 @@ namespace MED
     }
     
     TTPolyedreInfo(const PMeshInfo& theMeshInfo, 
-                  EEntiteMaillage theEntity, 
-                  EGeometrieElement theGeom,
-                  const TIntVector& theIndexes,
-                  const TIntVector& theFaces,
-                  const TIntVector& theConnectivities,
-                  EConnectivite theConnMode,
-                  const TIntVector& theFamilyNums,
-                  const TIntVector& theElemNums,
-                  const TStringVector& theElemNames):
+                   EEntiteMaillage theEntity, 
+                   EGeometrieElement theGeom,
+                   const TIntVector& theIndexes,
+                   const TIntVector& theFaces,
+                   const TIntVector& theConnectivities,
+                   EConnectivite theConnMode,
+                   const TIntVector& theFamilyNums,
+                   const TIntVector& theElemNums,
+                   const TStringVector& theElemNames):
       TElemInfoBase(theMeshInfo,
-                   (TInt)theIndexes.size()-1,
-                   theFamilyNums,
-                   theElemNums,
-                   theElemNames)
+                    (TInt)theIndexes.size()-1,
+                    theFamilyNums,
+                    theElemNums,
+                    theElemNames)
     {
       myEntity = theEntity;
       myGeom = theGeom;
@@ -683,27 +692,27 @@ namespace MED
       TInt aNbConn = GetNbConn<eVersion>(myGeom, myEntity, myMeshInfo->myDim);
       myConn.reset(new TElemNum(myNbElem * aNbConn));
       for(TInt anElemId = 0; anElemId < myNbElem; anElemId++){
-       TConnSlice aConnSlice = GetConnSlice(anElemId);
-       TCConnSlice aConnSlice2 = theInfo->GetConnSlice(anElemId);
-       for(TInt anConnId = 0; anConnId < aConnDim; anConnId++){
-         aConnSlice[anConnId] = aConnSlice2[anConnId];
-       }
+        TConnSlice aConnSlice = GetConnSlice(anElemId);
+        TCConnSlice aConnSlice2 = theInfo->GetConnSlice(anElemId);
+        for(TInt anConnId = 0; anConnId < aConnDim; anConnId++){
+          aConnSlice[anConnId] = aConnSlice2[anConnId];
+        }
       }
     }
 
     TTCellInfo(const PMeshInfo& theMeshInfo, 
-              EEntiteMaillage theEntity, 
-              EGeometrieElement theGeom,
-              TInt theNbElem,
-              EConnectivite theConnMode,
-              EBooleen theIsElemNum,
-              EBooleen theIsElemNames,
-              EModeSwitch theMode):
+               EEntiteMaillage theEntity, 
+               EGeometrieElement theGeom,
+               TInt theNbElem,
+               EConnectivite theConnMode,
+               EBooleen theIsElemNum,
+               EBooleen theIsElemNames,
+               EModeSwitch theMode):
+      TModeSwitchInfo(theMode),
       TElemInfoBase(theMeshInfo,
-                   theNbElem,
-                   theIsElemNum,
-                   theIsElemNames),
-      TModeSwitchInfo(theMode)
+                    theNbElem,
+                    theIsElemNum,
+                    theIsElemNames)
     {
       myEntity = theEntity;
       myGeom = theGeom;
@@ -714,20 +723,20 @@ namespace MED
     }
     
     TTCellInfo(const PMeshInfo& theMeshInfo, 
-              EEntiteMaillage theEntity, 
-              EGeometrieElement theGeom,
-              const TIntVector& theConnectivities,
-              EConnectivite theConnMode,
-              const TIntVector& theFamilyNums,
-              const TIntVector& theElemNums,
-              const TStringVector& theElemNames,
-              EModeSwitch theMode):
+               EEntiteMaillage theEntity, 
+               EGeometrieElement theGeom,
+               const TIntVector& theConnectivities,
+               EConnectivite theConnMode,
+               const TIntVector& theFamilyNums,
+               const TIntVector& theElemNums,
+               const TStringVector& theElemNames,
+               EModeSwitch theMode):
+      TModeSwitchInfo(theMode),
       TElemInfoBase(theMeshInfo,
-                   (TInt)theConnectivities.size() / GetNbNodes(theGeom),
-                   theFamilyNums,
-                   theElemNums,
-                   theElemNames),
-      TModeSwitchInfo(theMode)
+                    (TInt)theConnectivities.size() / GetNbNodes(theGeom),
+                    theFamilyNums,
+                    theElemNums,
+                    theElemNames)
     {
       myEntity = theEntity;
       myGeom = theGeom;
@@ -737,10 +746,10 @@ namespace MED
       TInt aNbConn = GetNbConn<eVersion>(myGeom, myEntity, myMeshInfo->myDim);
       myConn.reset(new TElemNum(myNbElem * aNbConn));
       for(TInt anElemId = 0; anElemId < myNbElem; anElemId++){
-       TConnSlice aConnSlice = GetConnSlice(anElemId);
-       for(TInt anConnId = 0; anConnId < aConnDim; anConnId++){
-         aConnSlice[anConnId] = theConnectivities[anElemId*aConnDim + anConnId];
-       }
+        TConnSlice aConnSlice = GetConnSlice(anElemId);
+        for(TInt anConnId = 0; anConnId < aConnDim; anConnId++){
+          aConnSlice[anConnId] = theConnectivities[anElemId*aConnDim + anConnId];
+        }
       }
     }
 
@@ -753,6 +762,63 @@ namespace MED
 
   };
 
+  //---------------------------------------------------------------
+  template<EVersion eVersion>
+  struct TTBallInfo: 
+    virtual TBallInfo,
+    virtual TTCellInfo<eVersion>
+  {
+    typedef TTCellInfo<eVersion> TCellInfoBase;
+
+    TTBallInfo(const PMeshInfo& theMeshInfo, const PBallInfo& theInfo):
+      TCellInfoBase::TElemInfoBase(theMeshInfo, theInfo),
+      TCellInfoBase(theMeshInfo,theInfo)
+    {
+      myDiameters = theInfo->myDiameters;
+    }
+
+    TTBallInfo(const PMeshInfo& theMeshInfo,
+               TInt             theNbElem,
+               EBooleen         theIsElemNum ):
+      TCellInfoBase::TElemInfoBase(theMeshInfo,
+                                   theNbElem,
+                                   theIsElemNum,
+                                   /*theIsElemNames=*/eFAUX),
+      TCellInfoBase(theMeshInfo,
+                    eSTRUCT_ELEMENT,
+                    eBALL,
+                    theNbElem,
+                    /*EConnectivite=*/eNOD,
+                    theIsElemNum,
+                    /*theIsElemNames=*/eFAUX,
+                    eFULL_INTERLACE)
+    {
+      myDiameters.resize( theNbElem );
+    }
+
+    TTBallInfo(const PMeshInfo&  theMeshInfo, 
+               const TIntVector& theNodes,
+               TFloatVector&     theDiameters,
+               const TIntVector& theFamilyNums,
+               const TIntVector& theElemNums):
+      TCellInfoBase::TElemInfoBase(theMeshInfo,
+                                   (TInt)std::max(theNodes.size(),theDiameters.size() ),
+                                   theFamilyNums,
+                                   theElemNums,
+                                   TStringVector()),
+      TCellInfoBase(theMeshInfo,
+                    eSTRUCT_ELEMENT,
+                    eBALL,
+                    theNodes,
+                    /*EConnectivite=*/eNOD,
+                    theFamilyNums,
+                    theElemNums,
+                    TStringVector(),
+                    eFULL_INTERLACE)
+    {
+      myDiameters.swap( theDiameters );
+    }
+  };
 
   //---------------------------------------------------------------
   template<EVersion eVersion>
@@ -770,12 +836,12 @@ namespace MED
       myNbComp = theInfo->GetNbComp();
       myCompNames.resize(myNbComp*GetPNOMLength<eVersion>()+1);
       for(TInt anId = 0; anId < myNbComp; anId++){
-       SetCompName(anId,theInfo->GetCompName(anId));
+        SetCompName(anId,theInfo->GetCompName(anId));
       }
 
       myUnitNames.resize(myNbComp*GetPNOMLength<eVersion>()+1);
       for(TInt anId = 0; anId < myNbComp; anId++){
-       SetUnitName(anId,theInfo->GetUnitName(anId));
+        SetUnitName(anId,theInfo->GetUnitName(anId));
       }
 
       myType = theInfo->GetType();
@@ -785,11 +851,11 @@ namespace MED
     }
 
     TTFieldInfo(const PMeshInfo& theMeshInfo, 
-               TInt theNbComp,
-               ETypeChamp theType,
-               const std::string& theValue,
-               EBooleen theIsLocal,
-               TInt theNbRef):
+                TInt theNbComp,
+                ETypeChamp theType,
+                const std::string& theValue,
+                EBooleen theIsLocal,
+                TInt theNbRef):
       TNameInfoBase(theValue)
     {
       myMeshInfo = theMeshInfo;
@@ -843,9 +909,9 @@ namespace MED
     typedef TTNameInfo<eVersion> TNameInfoBase;
 
     TTGaussInfo(const TGaussInfo::TInfo& theInfo,
-               EModeSwitch theMode):
-      TNameInfoBase(boost::get<1>(boost::get<0>(theInfo))),
-      TModeSwitchInfo(theMode)
+                EModeSwitch theMode):
+      TModeSwitchInfo(theMode),
+      TNameInfoBase(boost::get<1>(boost::get<0>(theInfo)))
     {
       const TGaussInfo::TKey& aKey = boost::get<0>(theInfo);
 
@@ -882,14 +948,14 @@ namespace MED
     }
 
     TTTimeStampInfo(const PFieldInfo& theFieldInfo, 
-                   EEntiteMaillage theEntity,
-                   const TGeom2Size& theGeom2Size,
-                   const TGeom2NbGauss& theGeom2NbGauss,
-                   TInt theNumDt,
-                   TInt theNumOrd,
-                   TFloat theDt,
-                   const std::string& theUnitDt,
-                   const TGeom2Gauss& theGeom2Gauss)
+                    EEntiteMaillage theEntity,
+                    const TGeom2Size& theGeom2Size,
+                    const TGeom2NbGauss& theGeom2NbGauss,
+                    TInt theNumDt,
+                    TInt theNumOrd,
+                    TFloat theDt,
+                    const std::string& theUnitDt,
+                    const TGeom2Gauss& theGeom2Gauss)
     {
       myFieldInfo = theFieldInfo;
 
@@ -932,7 +998,7 @@ namespace MED
     typedef TTNameInfo<eVersion> TNameInfoBase;
 
     TTProfileInfo(const TProfileInfo::TInfo& theInfo,
-                 EModeProfil theMode):
+                  EModeProfil theMode):
       TNameInfoBase(boost::get<0>(theInfo))
     {
       TInt aSize = boost::get<1>(theInfo);
@@ -947,24 +1013,24 @@ namespace MED
   struct TTTimeStampValue: virtual TTimeStampValue<TMeshValueType>
   {
     TTTimeStampValue(const PTimeStampInfo& theTimeStampInfo,
-                    const PTimeStampValueBase& theInfo,
-                    ETypeChamp theTypeChamp)
+                     const PTimeStampValueBase& theInfo,
+                     ETypeChamp theTypeChamp)
     {
       typedef TTimeStampValue<TMeshValueType> TCompatible;
       if(TCompatible* aCompatible = dynamic_cast<TCompatible*>(theInfo.get())){
-       this->myTimeStampInfo = theTimeStampInfo;
-       this->myTypeChamp = theTypeChamp;
-       this->myGeom2Profile = aCompatible->GetGeom2Profile();
-       this->myGeom2Value = aCompatible->myGeom2Value;
-       this->myGeomSet = aCompatible->GetGeomSet();
+        this->myTimeStampInfo = theTimeStampInfo;
+        this->myTypeChamp = theTypeChamp;
+        this->myGeom2Profile = aCompatible->GetGeom2Profile();
+        this->myGeom2Value = aCompatible->myGeom2Value;
+        this->myGeomSet = aCompatible->GetGeomSet();
       }else
-       EXCEPTION(std::runtime_error,"TTTimeStampValue::TTTimeStampValue - use incompatible arguments!");
+        EXCEPTION(std::runtime_error,"TTTimeStampValue::TTTimeStampValue - use incompatible arguments!");
     }
 
     TTTimeStampValue(const PTimeStampInfo& theTimeStampInfo,
-                    ETypeChamp theTypeChamp,
-                    const TGeom2Profile& theGeom2Profile,
-                    EModeSwitch theMode):
+                     ETypeChamp theTypeChamp,
+                     const TGeom2Profile& theGeom2Profile,
+                     EModeSwitch theMode):
       TModeSwitchInfo(theMode)
     {
       this->myTimeStampInfo = theTimeStampInfo;
@@ -978,20 +1044,20 @@ namespace MED
       const TGeom2Size& aGeom2Size = theTimeStampInfo->GetGeom2Size();
       TGeom2Size::const_iterator anIter = aGeom2Size.begin();
       for(; anIter != aGeom2Size.end(); anIter++){
-       const EGeometrieElement& aGeom = anIter->first;
-       TInt aNbElem = anIter->second;
+        const EGeometrieElement& aGeom = anIter->first;
+        TInt aNbElem = anIter->second;
 
-       MED::PProfileInfo aProfileInfo;
-       MED::TGeom2Profile::const_iterator anIter = theGeom2Profile.find(aGeom);
-       if(anIter != theGeom2Profile.end())
-         aProfileInfo = anIter->second;
+        MED::PProfileInfo aProfileInfo;
+        MED::TGeom2Profile::const_iterator anIter = theGeom2Profile.find(aGeom);
+        if(anIter != theGeom2Profile.end())
+          aProfileInfo = anIter->second;
 
-       if(aProfileInfo && aProfileInfo->IsPresent())
-         aNbElem = aProfileInfo->GetSize();
+        if(aProfileInfo && aProfileInfo->IsPresent())
+          aNbElem = aProfileInfo->GetSize();
 
-       TInt aNbGauss = theTimeStampInfo->GetNbGauss(aGeom);
-       
-       this->GetMeshValue(aGeom).Allocate(aNbElem,aNbGauss,aNbComp);
+        TInt aNbGauss = theTimeStampInfo->GetNbGauss(aGeom);
+        
+        this->GetMeshValue(aGeom).Allocate(aNbElem,aNbGauss,aNbComp);
       }
     }
 
@@ -1019,10 +1085,10 @@ namespace MED
     virtual 
     void
     AllocateValue(EGeometrieElement theGeom,
-                 TInt theNbElem,
-                 TInt theNbGauss,
-                 TInt theNbComp,
-                 EModeSwitch theMode = eFULL_INTERLACE)
+                  TInt theNbElem,
+                  TInt theNbGauss,
+                  TInt theNbComp,
+                  EModeSwitch theMode = eFULL_INTERLACE)
     {
       this->GetMeshValue(theGeom).Allocate(theNbElem,theNbGauss,theNbComp,theMode);
     }
@@ -1041,7 +1107,7 @@ namespace MED
     virtual TGrilleInfo
   {
     TTGrilleInfo(const PMeshInfo& theMeshInfo,
-                const PGrilleInfo& theInfo)
+                 const PGrilleInfo& theInfo)
     {
       myMeshInfo        = theMeshInfo;
 
@@ -1066,60 +1132,58 @@ namespace MED
     }
 
     TTGrilleInfo(const PMeshInfo& theMeshInfo,
-                const EGrilleType& type,
-                const TInt nnoeuds)
+                 const EGrilleType& type,
+                 const TInt nnoeuds)
     {
       myMeshInfo        = theMeshInfo;
-      TInt aDim = theMeshInfo->GetDim();
+      TInt aSpaceDim = theMeshInfo->GetSpaceDim();
       if(type == eGRILLE_STANDARD){
-       myCoord.resize(aDim*nnoeuds);
-       myCoordNames.resize(aDim*GetPNOMLength<eVersion>()+1);
-       myCoordUnits.resize(aDim*GetPNOMLength<eVersion>()+1);
+        myCoord.resize(aSpaceDim*nnoeuds);
+        myCoordNames.resize(aSpaceDim*GetPNOMLength<eVersion>()+1);
+        myCoordUnits.resize(aSpaceDim*GetPNOMLength<eVersion>()+1);
       } else { //if(type == eGRILLE_CARTESIENNE){
-       myCoordNames.resize(aDim*GetPNOMLength<eVersion>()+aDim);
-       myCoordUnits.resize(aDim*GetPNOMLength<eVersion>()+aDim);
+        myCoordNames.resize(aSpaceDim*GetPNOMLength<eVersion>()+aSpaceDim);
+        myCoordUnits.resize(aSpaceDim*GetPNOMLength<eVersion>()+aSpaceDim);
       }
-      
-      myGrilleStructure.resize(theMeshInfo->myDim);
+      myGrilleStructure.resize(aSpaceDim);
       myFamNumNode.resize(nnoeuds);
     }
 
     TTGrilleInfo(const PMeshInfo& theMeshInfo,
-                const EGrilleType& type)
+                 const EGrilleType& type)
     {
       myMeshInfo        = theMeshInfo;
-      TInt aDim = theMeshInfo->GetDim();
+      TInt aSpaceDim = theMeshInfo->GetSpaceDim();
       if(type == eGRILLE_STANDARD){
-       myCoordNames.resize(aDim*GetPNOMLength<eVersion>()+1);
-       myCoordUnits.resize(aDim*GetPNOMLength<eVersion>()+1);
+        myCoordNames.resize(aSpaceDim*GetPNOMLength<eVersion>()+1);
+        myCoordUnits.resize(aSpaceDim*GetPNOMLength<eVersion>()+1);
       } else {// if(type == eGRILLE_CARTESIENNE){
-       myCoordNames.resize(aDim*GetPNOMLength<eVersion>()+aDim);
-       myCoordUnits.resize(aDim*GetPNOMLength<eVersion>()+aDim);
+        myCoordNames.resize(aSpaceDim*GetPNOMLength<eVersion>()+aSpaceDim);
+        myCoordUnits.resize(aSpaceDim*GetPNOMLength<eVersion>()+aSpaceDim);
       }
-      TTGrilleInfo(theMeshInfo,type,0);
+      myGrilleStructure.resize(aSpaceDim);
     }
 
     TTGrilleInfo(const PMeshInfo& theMeshInfo,
-                const EGrilleType& type,
-                const MED::TIntVector& nbNodeVec)
+                 const EGrilleType& type,
+                 const MED::TIntVector& nbNodeVec)
     {
       myMeshInfo        = theMeshInfo;
 
-      TInt aDim = theMeshInfo->GetDim();
+      TInt aSpaceDim = theMeshInfo->GetSpaceDim();
       if(type == eGRILLE_STANDARD){
-       myCoordNames.resize(aDim*GetPNOMLength<eVersion>()+1);
-       myCoordUnits.resize(aDim*GetPNOMLength<eVersion>()+1);
+        myCoordNames.resize(aSpaceDim*GetPNOMLength<eVersion>()+1);
+        myCoordUnits.resize(aSpaceDim*GetPNOMLength<eVersion>()+1);
       } else {// if(type == eGRILLE_CARTESIENNE){
-       myCoordNames.resize(aDim*GetPNOMLength<eVersion>()+aDim);
-       myCoordUnits.resize(aDim*GetPNOMLength<eVersion>()+aDim);
+        myCoordNames.resize(aSpaceDim*GetPNOMLength<eVersion>()+aSpaceDim);
+        myCoordUnits.resize(aSpaceDim*GetPNOMLength<eVersion>()+aSpaceDim);
       }
 
       if(type != eGRILLE_STANDARD)
-       for(int aAxe=0;aAxe<nbNodeVec.size();aAxe++){
-         myIndixes[aAxe].resize(nbNodeVec[aAxe]);
-       }
-      
-      TTGrilleInfo(theMeshInfo,type,0);
+        for(unsigned int aAxe=0;aAxe<nbNodeVec.size();aAxe++){
+          myIndixes[aAxe].resize(nbNodeVec[aAxe]);
+        }
+      myGrilleStructure.resize(aSpaceDim);
     }
 
     virtual