]> SALOME platform Git repositories - modules/visu.git/commitdiff
Salome HOME
[Bug PAL7252] DEVELOPMENT: Porting to MED2.2 OCC_MED_2_2
authorapo <apo@opencascade.com>
Mon, 17 Jan 2005 11:49:36 +0000 (11:49 +0000)
committerapo <apo@opencascade.com>
Mon, 17 Jan 2005 11:49:36 +0000 (11:49 +0000)
16 files changed:
src/CONVERTOR/VISUConvertor.cxx
src/CONVERTOR/VISU_Convertor.cxx
src/CONVERTOR/VISU_Convertor.hxx
src/CONVERTOR/VISU_Convertor_impl.cxx
src/CONVERTOR/VISU_Convertor_impl.hxx
src/CONVERTOR/VISU_MedConvertor.cxx
src/CONVERTOR/VISU_MedConvertor.hxx
src/PIPELINE/VISUPipeLine.cxx
src/VISU_I/VISU_CorbaMedConvertor.cxx
src/VISU_I/VISU_CorbaMedConvertor.hxx
src/VISU_I/VISU_CutLines_i.cc
src/VISU_I/VISU_DeformedShape_i.cc
src/VISU_I/VISU_Result_i.cc
src/VISU_I/VISU_ScalarMap_i.cc
src/VISU_I/VISU_ScalarMap_i.hh
src/VISU_I/VISU_StreamLines_i.cc

index 6f360813d38ab699f8a4115f7b3636c3aa5e9023..47cdbeeabe663ae2faf63086afa8ffa8d8a5f08b 100644 (file)
@@ -44,7 +44,7 @@ static int MYDEBUG = 0;
 #endif
 
 void parseFile(const char* theFileName) {
-  try{
+  //try{
     MSG(MYDEBUG,"'"<<theFileName<<"'...");
     auto_ptr<VISU_Convertor> aCon(CreateConvertor(theFileName));
     //aCon->GetSize();
@@ -53,21 +53,21 @@ void parseFile(const char* theFileName) {
     VISU::TMeshMap::const_iterator aMeshMapIter = aMeshMap.begin();
     for(; aMeshMapIter != aMeshMap.end(); aMeshMapIter++){
       const string& aMeshName = aMeshMapIter->first;
-      const VISU::TMesh& aMesh = aMeshMapIter->second;
-      const VISU::TMeshOnEntityMap& aMeshOnEntityMap = aMesh.myMeshOnEntityMap;
+      const VISU::PMesh& aMesh = aMeshMapIter->second;
+      const VISU::TMeshOnEntityMap& aMeshOnEntityMap = aMesh->myMeshOnEntityMap;
       VISU::TMeshOnEntityMap::const_iterator aMeshOnEntityMapIter;
       //Import fields
       aMeshOnEntityMapIter = aMeshOnEntityMap.begin();
       for(; aMeshOnEntityMapIter != aMeshOnEntityMap.end(); aMeshOnEntityMapIter++){
        const VISU::TEntity& anEntity = aMeshOnEntityMapIter->first;
-       const VISU::TMeshOnEntity& aMeshOnEntity = aMeshOnEntityMapIter->second;
-       const VISU::TFieldMap& aFieldMap = aMeshOnEntity.myFieldMap;
+       const VISU::PMeshOnEntity& aMeshOnEntity = aMeshOnEntityMapIter->second;
+       const VISU::TFieldMap& aFieldMap = aMeshOnEntity->myFieldMap;
        VISU::TFieldMap::const_reverse_iterator aFieldMapIter = aFieldMap.rbegin();
        for(; aFieldMapIter != aFieldMap.rend(); aFieldMapIter++){
          const string& aFieldName = aFieldMapIter->first;
-         const VISU::TField& aField = aFieldMapIter->second;
-         const VISU::TField::TValField& aValField = aField.myValField;
-         VISU::TField::TValField::const_iterator aValFieldIter = aValField.begin();
+         const VISU::PField& aField = aFieldMapIter->second;
+         const VISU::TValField& aValField = aField->myValField;
+         VISU::TValField::const_iterator aValFieldIter = aValField.begin();
          for(; aValFieldIter != aValField.end(); aValFieldIter++){
            int aTimeStamp = aValFieldIter->first;
            aCon->GetTimeStampOnMesh(aMeshName,anEntity,aFieldName,aTimeStamp);
@@ -77,7 +77,7 @@ void parseFile(const char* theFileName) {
       }
       //continue;
       //Importing groups
-      const VISU::TGroupMap& aGroupMap = aMesh.myGroupMap;
+      const VISU::TGroupMap& aGroupMap = aMesh->myGroupMap;
       VISU::TGroupMap::const_iterator aGroupMapIter = aGroupMap.begin();
       for(; aGroupMapIter != aGroupMap.end(); aGroupMapIter++){
        const string& aGroupName = aGroupMapIter->first;
@@ -87,9 +87,9 @@ void parseFile(const char* theFileName) {
       aMeshOnEntityMapIter = aMeshOnEntityMap.begin();
       for(; aMeshOnEntityMapIter != aMeshOnEntityMap.end(); aMeshOnEntityMapIter++){
        const VISU::TEntity& anEntity = aMeshOnEntityMapIter->first;
-       const VISU::TMeshOnEntity& aMeshOnEntity = aMeshOnEntityMapIter->second;
+       const VISU::PMeshOnEntity& aMeshOnEntity = aMeshOnEntityMapIter->second;
        //aCon->GetMeshOnEntity(aMeshName,anEntity);
-       const VISU::TFamilyMap& aFamilyMap = aMeshOnEntity.myFamilyMap;
+       const VISU::TFamilyMap& aFamilyMap = aMeshOnEntity->myFamilyMap;
        VISU::TFamilyMap::const_iterator aFamilyMapIter = aFamilyMap.begin();
        for(; aFamilyMapIter != aFamilyMap.end(); aFamilyMapIter++){
          const string& aFamilyName = aFamilyMapIter->first;
@@ -104,15 +104,15 @@ void parseFile(const char* theFileName) {
       }
     }
     MSG(MYDEBUG,"OK");
-  }catch(std::exception& exc){
-    MSG(MYDEBUG,"Follow exception was occured in file:"<<theFileName<<"\n"<<exc.what());
-  }catch(...){
-    MSG(MYDEBUG,"Unknown exception was occured in VISU_Convertor_impl in file:"<<theFileName);
-  } 
+  //}catch(std::exception& exc){
+  //  MSG(MYDEBUG,"Follow exception was occured in file:"<<theFileName<<"\n"<<exc.what());
+  //}catch(...){
+  //  MSG(MYDEBUG,"Unknown exception was occured in VISU_Convertor_impl in file:"<<theFileName);
+  //
 }
 
 int main(int argc, char** argv){ 
-  try{
+  //try{
     if(argc > 1){
       QFileInfo fi(argv[1]);
       for(int i = 0; i < 1; i++){
@@ -131,10 +131,10 @@ int main(int argc, char** argv){
       }
       return 0;
     }
-  }catch(std::exception& exc){
-    MSG(MYDEBUG,"Follow exception was occured :\n"<<exc.what());
-  }catch(...){
-    MSG(MYDEBUG,"Unknown exception was occured in VISU_Convertor_impl");
-  } 
+  //}catch(std::exception& exc){
+  //  MSG(MYDEBUG,"Follow exception was occured :\n"<<exc.what());
+  //}catch(...){
+  //  MSG(MYDEBUG,"Unknown exception was occured in VISU_Convertor_impl");
+  //
   return 1;
 }
index aabf3996100606bffcc9d5bca7f2734a32331ded..c08d9a6122a46ecc94e955509b7745b49a0125cd 100644 (file)
@@ -32,6 +32,7 @@
 using namespace std;
 
 namespace VISU{
+
   inline int GetNbOfPoints(int theVTKCellType){
     switch(theVTKCellType){
     case VTK_VERTEX : return 1;
@@ -48,78 +49,53 @@ namespace VISU{
 
   pair<int,int> TMeshOnEntity::GetCellsDims(const string& theFamilyName) const
   {
-    bool isFamilyPresent = (theFamilyName != "");
-    int aNbCells = 0, aCellsSize = 0;
-    if(!isFamilyPresent){
-      TCellsConn::const_iterator aCellsConnIter = myCellsConn.begin();
-      for(; aCellsConnIter != myCellsConn.end(); aCellsConnIter++){
-       const TConnForCellType& aConnForCellType = aCellsConnIter->second;
-       if(!aConnForCellType.empty()){
-         aNbCells += aConnForCellType.size();
-         aCellsSize += aConnForCellType.size()*(aConnForCellType[0].size()+1);
-       }
-      }
-    }else{
-      TFamilyMap::const_iterator aFamilyMapIter = myFamilyMap.find(theFamilyName);
-      if(aFamilyMapIter == myFamilyMap.end())
-       throw std::runtime_error("GetCellsDims >> There is no family on the mesh with entity !!!");
-      const TFamily& aFamily = aFamilyMapIter->second; 
-      const TFamily::TSubMesh& aSubMesh = aFamily.mySubMesh;
-      TFamily::TSubMesh::const_iterator aSubMeshIter = aSubMesh.begin();
-      for(; aSubMeshIter != aSubMesh.end(); aSubMeshIter++){
-       const TFamily::TSubMeshOnCellType& aSubMeshOnCellType = aSubMeshIter->second;
-       if(!aSubMeshOnCellType.empty()){
-         int tmp = aSubMeshOnCellType.size();
-         aNbCells += tmp;
-         int aVtkType = aSubMeshIter->first;
-         int aVtkSize = GetNbOfPoints(aVtkType);
-         aCellsSize += tmp*(aVtkSize+1);
-       }
-      }
-    }
-    return make_pair(aNbCells,aCellsSize);
+    if(theFamilyName == "")
+      return make_pair(myNbCells,myCellsSize);
+    TFamilyMap::const_iterator aFamilyMapIter = myFamilyMap.find(theFamilyName);
+    if(aFamilyMapIter == myFamilyMap.end())
+      throw std::runtime_error("GetCellsDims >> There is no family on the mesh with entity !!!");
+    const PFamily& aFamily = aFamilyMapIter->second; 
+    return make_pair(aFamily->myNbCells,aFamily->myCellsSize);
   }
   
-  const TField* TMesh::GetField(const string& theFieldName) const {
+  const PField TMesh::GetField(const string& theFieldName) const {
     TMeshOnEntityMap::const_iterator aMeshOnEntityMapIter = myMeshOnEntityMap.begin();
     for(; aMeshOnEntityMapIter != myMeshOnEntityMap.end(); aMeshOnEntityMapIter++){
-      const TFieldMap& aFieldMap = (aMeshOnEntityMapIter->second).myFieldMap;
+      const TFieldMap& aFieldMap = aMeshOnEntityMapIter->second->myFieldMap;
       TFieldMap::const_iterator aFieldMapIter = aFieldMap.begin();
       for(; aFieldMapIter != aFieldMap.end(); aFieldMapIter++)
-       if(theFieldName == aFieldMapIter->first) return &(aFieldMapIter->second);
+       if(theFieldName == aFieldMapIter->first) 
+         return aFieldMapIter->second;
     }
-    return NULL;
+    return PField();
   }
 
-  const TFamily* GetFamily(const VISU::TMeshOnEntity& theMeshOnEntity, const string& theFamilyName)
+
+  PFamily FindFamily(VISU::PMesh theMesh, const string& theFamilyName)
   {
-    if(theFamilyName == "") return NULL;
-    const VISU::TFamilyMap& aFamilyMap = theMeshOnEntity.myFamilyMap;
-    VISU::TFamilyMap::const_iterator aFamilyMapIter = aFamilyMap.find(theFamilyName);
-    if(aFamilyMapIter == aFamilyMap.end())
-      throw std::runtime_error("GetFamily >> There is no family on the mesh with entity !!!");
-    const VISU::TFamily& aFamily = aFamilyMapIter->second;
-    return &aFamily;
+    PFamily aFamily;
+    const TMeshOnEntityMap& aMeshOnEntityMap = theMesh->myMeshOnEntityMap;
+    TMeshOnEntityMap::const_iterator aMeshOnEntityMapIter = aMeshOnEntityMap.begin();
+    for(; aMeshOnEntityMapIter != aMeshOnEntityMap.end(); aMeshOnEntityMapIter++){
+      const PMeshOnEntity aMeshOnEntity = aMeshOnEntityMapIter->second;
+      aFamily = GetFamily(aMeshOnEntity,theFamilyName);
+      if(aFamily)
+       break;
+    }
+    return aFamily;
   }
   
-  TFamily* GetFamily(VISU::TMeshOnEntity& theMeshOnEntity, const string& theFamilyName)
+
+  PFamily GetFamily(VISU::PMeshOnEntity theMeshOnEntity, const string& theFamilyName)
   {
-    if(theFamilyName == "") return NULL;
-    VISU::TFamilyMap& aFamilyMap = theMeshOnEntity.myFamilyMap;
-    VISU::TFamilyMap::iterator aFamilyMapIter = aFamilyMap.find(theFamilyName);
-    if(aFamilyMapIter == aFamilyMap.end())
-      throw std::runtime_error("GetFamily >> There is no family on the mesh with entity !!!");
-    VISU::TFamily& aFamily = aFamilyMapIter->second;
-    return &aFamily;
-  }
-  
-  void TField::ShallowCopy(const TField& aField){
-    myEntity = aField.myEntity;
-    myMeshName = aField.myMeshName;
-    myNbComp = aField.myNbComp;
-    VISU::TField::TValField::const_iterator iter = aField.myValField.begin();
-    for(; iter != aField.myValField.end(); iter++)
-      myValField[iter->first];
+    PFamily aFamily;
+    if(theFamilyName != ""){
+      TFamilyMap& aFamilyMap = theMeshOnEntity->myFamilyMap;
+      TFamilyMap::iterator aFamilyMapIter = aFamilyMap.find(theFamilyName);
+      if(aFamilyMapIter != aFamilyMap.end())
+       aFamily = aFamilyMapIter->second;
+    }
+    return aFamily;
   }
 }
 
@@ -130,7 +106,7 @@ const VISU::TMeshMap& VISU_Convertor::GetMeshMap() {
 }
 
 
-string VISU_Convertor::GenerateName(const VISU::TField::TTime& aTime){
+string VISU_Convertor::GenerateName(const VISU::TTime& aTime){
   static QString aName;
   const string aUnits = aTime.second, tmp(aUnits.size(),' ');
   if(aUnits == "" || aUnits == tmp)
index 4feb723a274c6a6f74aeb1e475edd9623bdace9e..bebb26f096e3f5f67ab41d21ed26f03d0741a983 100644 (file)
 
 #include <stdio.h>
 
-#include <algorithm>
-#include <iterator>
 #include <list>
 #include <map>
-#include <numeric>
 #include <set>
 #include <utility>
 #include <vector>
 #include <string>
 #include <stdexcept>
 
-#include <vtkPoints.h>
-#include <vtkSystemIncludes.h>
-#include <vtkUnstructuredGrid.h>
-#include <vtkMergeDataObjectFilter.h>
-#include <vtkFieldDataToAttributeDataFilter.h>
+#include <boost/shared_ptr.hpp>
 
-#include "VISU_ExtractUnstructuredGrid.hxx"
-#include "MED_Common.hxx"
-
-#include <vtkSmartPointer.h>
+class vtkUnstructuredGrid;
 
 namespace VISU{
+
+  template<class T> class shared_ptr: public boost::shared_ptr<T>
+  {
+  public:
+    shared_ptr() {}
+
+    template<class Y>
+    explicit shared_ptr(Y * p)
+    {
+      reset(p);
+    }
+
+    template<class Y>
+    shared_ptr(shared_ptr<Y> const & r):
+      boost::shared_ptr<T>(r,boost::detail::dynamic_cast_tag())
+    {}
+
+    template<class Y>
+    shared_ptr & operator=(shared_ptr<Y> const & r)
+    {
+      shared_ptr<T>(r).swap(*this);
+      return *this;
+    }
+
+    template<class Y> shared_ptr& operator()(Y * p) // Y must be complete
+    {
+      if(T* pt = dynamic_cast<T*>(p))
+       boost::shared_ptr<T>::reset(pt);
+      else
+       boost::throw_exception(std::bad_cast());
+      return *this;
+    }
+
+  };
+
+
   enum  TEntity {NODE_ENTITY, EDGE_ENTITY, FACE_ENTITY, CELL_ENTITY};
 
-  typedef vtkSmartPointer<vtkPoints> TVTKPoints;
-  typedef vtkSmartPointer<vtkUnstructuredGrid> TVTKSource;
-  typedef vtkSmartPointer<vtkMergeDataObjectFilter> TVTKMergetFilter;
-  typedef vtkSmartPointer<VISU_ExtractUnstructuredGrid> TVTKExtractFilter;
-  typedef vtkSmartPointer<vtkFieldDataToAttributeDataFilter> TVTKAttribyteFilter;
+  typedef std::pair<std::string,TEntity> TFamilyAndEntity;
+  typedef std::set<TFamilyAndEntity> TFamilyAndEntitySet;
   typedef std::set<std::string> TBindGroups;
 
-  struct TFamily{
-    TVTKSource myStorage;
-    vtkIdType myId;
-    std::string myName;
-    TEntity myEntity;
-    TBindGroups myGroups;
-    vtkIdType myNbCells, myCellsSize;
-    typedef std::set<vtkIdType> TSubMeshOnCellType;
-    typedef std::map<vtkIdType,TSubMeshOnCellType> TSubMesh;
-    TSubMesh mySubMesh;
-    TFamily() : myNbCells(0), myCellsSize(0) {}
+  typedef std::pair<double,std::string> TTime;
+
+  struct TMesh;
+  typedef shared_ptr<TMesh> PMesh;
+  typedef std::map<std::string,PMesh> TMeshMap;
+
+  struct TMeshOnEntity;
+  typedef shared_ptr<TMeshOnEntity> PMeshOnEntity;
+  typedef std::map<TEntity,PMeshOnEntity> TMeshOnEntityMap;
+
+  struct TFamily;
+  typedef shared_ptr<TFamily> PFamily;
+  typedef std::map<std::string,PFamily> TFamilyMap;
+
+  struct TGroup;
+  typedef shared_ptr<TGroup> PGroup;
+  typedef std::map<std::string,PGroup> TGroupMap;
+
+  struct TField;
+  typedef shared_ptr<TField> PField;
+  typedef std::map<std::string,PField> TFieldMap;
+
+  struct TValForTime;
+  typedef shared_ptr<TValForTime> PValForTime;
+  typedef std::map<int,PValForTime> TValField;
+
+  struct TBaseStructure{
+    virtual ~TBaseStructure(){}
   };
-  typedef std::map<std::string,TFamily> TFamilyMap;
 
-  struct TField{
-    TVTKExtractFilter myExtractFilter;
-    vtkIdType myId;
+  typedef std::vector<std::string> TNames;
+
+  struct TMesh: TBaseStructure{
+    int myDim, myNbPoints;
     std::string myName;
-    TEntity myEntity;
-    std::string myMeshName;
-    vtkIdType myNbComp, myNbValField, myDataSize, myIsTrimmed;
-    typedef std::vector<float> TValForCellsWithType;
-    typedef std::map<vtkIdType,TValForCellsWithType> TValForCells;
-    typedef std::pair<double,std::string> TTime;
-    typedef std::vector<std::string> TCompNames;
-    typedef std::vector<std::string> TUnitNames;
-    struct TValForTime{
-      TVTKAttribyteFilter myAttribyteFilter;
-      TVTKMergetFilter myMergeFilter;
-      TVTKSource myStorage;
-      vtkIdType myId;
-      std::string myMeshName;
-      TEntity myEntity;
-      std::string myFieldName;
-      vtkIdType myNbComp;
-      TTime myTime;
-      TValForCells myValForCells;
-      TValForTime() : myNbComp(0) {}
-      ~TValForTime() { 
-       if(myMergeFilter.GetPointer())
-         myMergeFilter->UnRegisterAllOutputs();
-       if(myAttribyteFilter.GetPointer())
-         myAttribyteFilter->UnRegisterAllOutputs();
-      }
-    };
-    typedef std::map<vtkIdType,TValForTime> TValField;
-    TValField myValField;
-    TCompNames myCompNames;
-    TUnitNames myUnitNames;
-    TField() : myNbComp(0), myNbValField(0), myDataSize(0), myIsTrimmed(0) {}
-    void ShallowCopy(const TField& aField);
-    ~TField() { 
-      if(myExtractFilter.GetPointer())
-       myExtractFilter->UnRegisterAllOutputs();
-    }
+
+    TMeshOnEntityMap myMeshOnEntityMap;
+    TGroupMap myGroupMap;
+
+    TMesh() : myDim(0), myNbPoints(0) {}
+    const PField GetField(const std::string& theFieldName) const;
   };
-  typedef std::map<std::string,TField> TFieldMap;
-  struct TMeshOnEntity{
-    TVTKSource myStorage;
+
+  struct TMeshOnEntity: TBaseStructure{
     std::string myMeshName;
     TEntity myEntity;
-    vtkIdType myNbCells, myCellsSize;
-    typedef std::vector<vtkIdType> TConnect;
-    typedef std::vector<TConnect> TConnForCellType;
-    typedef std::map<vtkIdType,TConnForCellType> TCellsConn;
-    TCellsConn myCellsConn;
+    int myNbCells, myCellsSize;
     TFamilyMap myFamilyMap;
     TFieldMap myFieldMap;
-    MED::TGeom myGeom;
     TMeshOnEntity() : myNbCells(0), myCellsSize(0) {}
-    std::pair<vtkIdType,vtkIdType> GetCellsDims(const std::string& theFamilyName = "") const;
-      
+
+    std::pair<int,int> 
+    GetCellsDims(const std::string& theFamilyName = "") const;
   };
-  typedef std::map<TEntity,TMeshOnEntity> TMeshOnEntityMap;
-  const TFamily* GetFamily(const VISU::TMeshOnEntity& theMeshOnEntity, 
-                    const std::string& theFamilyName);
 
-  TFamily* GetFamily(VISU::TMeshOnEntity& theMeshOnEntity, 
-                    const std::string& theFamilyName);
+  struct TFamily: TBaseStructure{
+    int myId;
+    std::string myName;
+    TEntity myEntity;
+    TBindGroups myGroups;
+    int myNbCells, myCellsSize;
+    TFamily() : myNbCells(0), myCellsSize(0) {}
+  };
 
-  typedef std::pair<std::string,TEntity> TFamilyAndEntity;
-  typedef std::set<TFamilyAndEntity> TFamilyAndEntitySet;
-  struct TGroup{
-    TVTKSource myStorage;
+  struct TGroup: TBaseStructure{
     std::string myName;
     std::string myMeshName;
-    vtkIdType myNbCells, myCellsSize;
-    TGroup() : myNbCells(0), myCellsSize(0) {}
+    int myNbCells, myCellsSize;
     TFamilyAndEntitySet myFamilyAndEntitySet;
+    TGroup() : myNbCells(0), myCellsSize(0) {}
   };
-  typedef std::map<std::string,TGroup> TGroupMap;
 
-  struct TMesh{
-    TVTKPoints myPoints;
-    vtkIdType myDim, myNbPoints;
+  struct TField: TBaseStructure{
+    int myId;
+    TEntity myEntity;
+    bool myIsTrimmed;
     std::string myName;
-    typedef float TCoord;
-    typedef std::vector<TCoord> TPointsCoord;
-    TPointsCoord myPointsCoord;
-    typedef std::vector<std::string> TPointsDim;
-    TPointsDim myPointsDim;
-    TMeshOnEntityMap myMeshOnEntityMap;
-    TGroupMap myGroupMap;
-    MED::PMeshInfo myMeshInfo;
-    MED::TEntityInfo myEntityInfo;
-    TMesh() : myDim(0), myNbPoints(0) {}
-    const TField* GetField(const std::string& theFieldName) const;
+    std::string myMeshName;
+    int myNbComp, myDataSize;
+    TValField myValField;
+    TNames myCompNames;
+    TNames myUnitNames;
+    TField() : myNbComp(0), myDataSize(0), myIsTrimmed(0) {}
+  };
+  struct TValForTime: TBaseStructure{
+    int myId;
+    TEntity myEntity;
+    std::string myMeshName;
+    std::string myFieldName;
+    int myNbComp;
+    TTime myTime;
+
+    TValForTime() : myNbComp(0) {}
   };
-  typedef std::map<std::string,TMesh> TMeshMap;
-  void WriteToFile(vtkUnstructuredGrid* theDataSet, const std::string& theFileName);
+
+  PFamily FindFamily(VISU::PMesh theMesh, 
+                    const std::string& theFamilyName);
+
+  PFamily GetFamily(VISU::PMeshOnEntity theMeshOnEntity, 
+                   const std::string& theFamilyName);
+
+  void WriteToFile(vtkUnstructuredGrid* theDataSet, 
+                  const std::string& theFileName);
+
 };
 
 class VISU_Convertor{
@@ -217,18 +234,17 @@ public:
                                   const VISU::TEntity& theEntity,
                                   const std::string& theFieldName) = 0;
  
-  virtual const VISU::TField& GetField(const std::string& theMeshName, 
-                                      VISU::TEntity theEntity, 
-                                      const std::string& theFieldName) = 0;
-
-  virtual const VISU::TField::TValForTime& GetTimeStamp(const std::string& theMeshName, 
-                                                       const VISU::TEntity& theEntity,
-                                                       const std::string& theFieldName,
-                                                       int theStampsNum) = 0;
+  virtual const VISU::PField GetField(const std::string& theMeshName, 
+                                     VISU::TEntity theEntity, 
+                                     const std::string& theFieldName) = 0;
+
+  virtual const VISU::PValForTime GetTimeStamp(const std::string& theMeshName, 
+                                              const VISU::TEntity& theEntity,
+                                              const std::string& theFieldName,
+                                              int theStampsNum) = 0;
     
-  static std::string GenerateName(const VISU::TField::TTime& aTime);
+  static std::string GenerateName(const VISU::TTime& aTime);
   static std::string GenerateName(const std::string& theName, unsigned int theTimeId);
-  static void WriteToFile(vtkUnstructuredGrid* theDataSet, const std::string& theFileName);
 };
 
 extern "C"{
index ee667fec8a834bb6a5d82a683ea805f3b0780e75..5fcb2f9e5983cc7236200e4369ca021d2115d0c3 100644 (file)
@@ -71,18 +71,20 @@ namespace{
   }
 
   enum ECoordName{eX, eY, eZ, eNone};
-  typedef VISU::TMesh::TCoord (*TGetCoord)(const VISU::TMesh::TPointsCoord&, int);
+  typedef VISU::TCoord (*TGetCoord)(const VISU::TMeshImpl::TPointsCoord&, int);
   
   template<ECoordName TheCoordId>
-  VISU::TMesh::TCoord GetCoord(const VISU::TMesh::TPointsCoord& thePointsCoord, 
-                              int theStartPos)
+  VISU::TCoord 
+  GetCoord(const VISU::TMeshImpl::TPointsCoord& thePointsCoord, 
+          int theStartPos)
   {
     return thePointsCoord[theStartPos+TheCoordId];
   }
   
   template<>
-  VISU::TMesh::TCoord GetCoord<eNone>(const VISU::TMesh::TPointsCoord& thePointsCoord, 
-                                     int theStartPos)
+  VISU::TCoord 
+  GetCoord<eNone>(const VISU::TMeshImpl::TPointsCoord& thePointsCoord, 
+                 int theStartPos)
   {
     return 0.0;
   }
@@ -134,33 +136,35 @@ namespace{
 
   
   class TCoordHelper{
-    const VISU::TMesh::TPointsCoord& myPointsCoord;
+    const VISU::TMeshImpl::TPointsCoord& myPointsCoord;
     TGetCoord* myGetCoord;
   public:
-    TCoordHelper(const VISU::TMesh::TPointsCoord& thePointsCoord,
+    TCoordHelper(const VISU::TMeshImpl::TPointsCoord& thePointsCoord,
                 TGetCoord* theGetCoord):
       myPointsCoord(thePointsCoord),
       myGetCoord(theGetCoord)
     {}
     virtual ~TCoordHelper(){}
-    VISU::TMesh::TCoord GetCoord(int theStartPos, int theCoodId){
+    VISU::TCoord 
+    GetCoord(int theStartPos, int theCoodId)
+    {
       return (*myGetCoord[theCoodId])(myPointsCoord,theStartPos);
     }
   };
   typedef std::auto_ptr<TCoordHelper> TCoordHelperPtr;
   
-  void GetPoints(VISU::TVTKSource& theStorage, VISU::TMesh& theMesh) 
+  void GetPoints(VISU::TVTKSource& theStorage, VISU::PMeshImpl theMesh) 
   {
-    vtkPoints* aPoints = theMesh.myPoints.GetPointer();
+    vtkPoints* aPoints = theMesh->myPoints.GetPointer();
     if(!aPoints){
       aPoints = vtkPoints::New();
       TCoordHelperPtr aCoordHelperPtr;
-      const VISU::TMesh::TPointsCoord& anArray = theMesh.myPointsCoord;
+      const VISU::TMeshImpl::TPointsCoord& anArray = theMesh->myPointsCoord;
       {
-       int aMeshDimension = theMesh.myDim;
+       int aMeshDimension = theMesh->myDim;
        bool anIsDimPresent[3] = {false, false, false};
        for(int iDim = 0; iDim < aMeshDimension; iDim++){
-         string aDimName = theMesh.myPointsDim[iDim];
+         string aDimName = theMesh->myPointsDim[iDim];
          if(aDimName == "x" || aDimName == "X")
            anIsDimPresent[eX] = true;
          else if(aDimName == "y" || aDimName == "Y")
@@ -193,16 +197,16 @@ namespace{
       }
 
       if(MYVTKDEBUG) aPoints->DebugOn();
-      vtkIdType iEnd = theMesh.myPointsCoord.size();
-      vtkIdType aNbPoints = iEnd / theMesh.myDim;
+      vtkIdType iEnd = theMesh->myPointsCoord.size();
+      vtkIdType aNbPoints = iEnd / theMesh->myDim;
       aPoints->SetNumberOfPoints(aNbPoints);
-      MSG(MYDEBUG,"GetPoints - aNbPoints = "<<aNbPoints<<"; myDim = "<<theMesh.myDim);
-      for (vtkIdType i = 0, j = 0; i < iEnd; i += theMesh.myDim, j++) 
+      MSG(MYDEBUG,"GetPoints - aNbPoints = "<<aNbPoints<<"; myDim = "<<theMesh->myDim);
+      for (vtkIdType i = 0, j = 0; i < iEnd; i += theMesh->myDim, j++) 
        aPoints->SetPoint(j,
                          aCoordHelperPtr->GetCoord(i,eX),
                          aCoordHelperPtr->GetCoord(i,eY),
                          aCoordHelperPtr->GetCoord(i,eZ));
-      theMesh.myPoints = aPoints;
+      theMesh->myPoints = aPoints;
     }
     theStorage->SetPoints(aPoints);
   }
@@ -210,7 +214,7 @@ namespace{
   
   inline void PrintCells(int& theStartId,
                         vtkCellArray* theConnectivity, 
-                        const VISU::TMeshOnEntity::TConnect& theVector)
+                        const VISU::TMeshOnEntityImpl::TConnect& theVector)
   {
     vtkIdList *anIdList = vtkIdList::New();
     int kEnd = theVector.size();
@@ -222,42 +226,40 @@ namespace{
   }
 
   void GetCellsOnEntity(VISU::TVTKSource& theStorage,
-                       const VISU::TMeshOnEntity& theMeshOnEntity, 
+                       const VISU::PMeshOnEntityImpl theMeshOnEntity, 
                        const string& theFamilyName) 
   {
     //Check on existing family
-    const VISU::TFamily* pFamily = VISU::GetFamily(theMeshOnEntity,theFamilyName);
-    bool isFamilyPresent = (pFamily != NULL);
-    const VISU::TFamily& aFamily = *pFamily;
+    PFamilyImpl aFamily = GetFamily(theMeshOnEntity,theFamilyName);
     //Main part of code
-    pair<int,int> aCellsDim = theMeshOnEntity.GetCellsDims(theFamilyName);
+    pair<int,int> aCellsDim = theMeshOnEntity->GetCellsDims(theFamilyName);
     int aNbCells = aCellsDim.first, aCellsSize = aCellsDim.second;
     vtkCellArray* aConnectivity = vtkCellArray::New();
     aConnectivity->Allocate(aCellsSize,0);
     vtkUnsignedCharArray* aCellTypesArray = vtkUnsignedCharArray::New();
     aCellTypesArray->SetNumberOfComponents(1);
     aCellTypesArray->SetNumberOfTuples(aNbCells);
-    MSG(MYDEBUG,"GetCellsOnEntity - isFamilyPresent = "<<isFamilyPresent);
-    const VISU::TMeshOnEntity::TCellsConn &aCellsConn = theMeshOnEntity.myCellsConn;
-    VISU::TMeshOnEntity::TCellsConn::const_iterator aCellsConnIter = aCellsConn.begin();
+    MSG(MYDEBUG,"GetCellsOnEntity - isFamilyPresent = "<<bool(aFamily));
+    const VISU::TMeshOnEntityImpl::TCellsConn &aCellsConn = theMeshOnEntity->myCellsConn;
+    VISU::TMeshOnEntityImpl::TCellsConn::const_iterator aCellsConnIter = aCellsConn.begin();
     for(int i = 0, j = 0; aCellsConnIter != aCellsConn.end(); aCellsConnIter++){
-      const VISU::TMeshOnEntity::TConnForCellType& anArray = aCellsConnIter->second;
+      const VISU::TMeshOnEntityImpl::TConnForCellType& anArray = aCellsConnIter->second;
       int aVtkType = aCellsConnIter->first;
       MSG(MYDEBUG,"GetCellsOnEntity - aVtkType = "<<aVtkType<<"; anArray.size() = "<<anArray.size());
-      if(!isFamilyPresent)
+      if(!aFamily)
        for(int k = 0, kEnd = anArray.size(); k < kEnd; k++, i++){
          PrintCells(i,aConnectivity,anArray[k]);
          aCellTypesArray->SetValue(j++,(unsigned char)aVtkType);
        }
       else{
-       const VISU::TFamily::TSubMesh& aSubMesh = aFamily.mySubMesh;
+       const VISU::TFamilyImpl::TSubMesh& aSubMesh = aFamily->mySubMesh;
        if(aSubMesh.empty()) 
          EXCEPTION(runtime_error,"GetCells >> There is no elements on the family !!!");
-       VISU::TFamily::TSubMesh::const_iterator aSubMeshIter = aSubMesh.find(aVtkType);
+       VISU::TFamilyImpl::TSubMesh::const_iterator aSubMeshIter = aSubMesh.find(aVtkType);
        if(aSubMeshIter == aSubMesh.end()) continue;
-       const VISU::TFamily::TSubMeshOnCellType& aSubMeshOnCellType = aSubMeshIter->second;
+       const VISU::TFamilyImpl::TSubMeshOnCellType& aSubMeshOnCellType = aSubMeshIter->second;
        MSG(MYDEBUG,"GetCellsOnEntity - aSubMeshOnCellType.size() = "<<aSubMeshOnCellType.size());
-       VISU::TFamily::TSubMeshOnCellType::const_iterator aSubMeshOnCellTypeIter = aSubMeshOnCellType.begin();
+       VISU::TFamilyImpl::TSubMeshOnCellType::const_iterator aSubMeshOnCellTypeIter = aSubMeshOnCellType.begin();
        for(; aSubMeshOnCellTypeIter != aSubMeshOnCellType.end(); aSubMeshOnCellTypeIter++, i++){
          PrintCells(i,aConnectivity,anArray[*aSubMeshOnCellTypeIter]);
          aCellTypesArray->SetValue(j++,(unsigned char)aVtkType);
@@ -280,7 +282,7 @@ namespace{
   
   
   void GetCellsOnGroup(VISU::TVTKSource& theStorage,
-                      const VISU::TMesh& theMesh,
+                      VISU::PMeshImpl theMesh,
                       const VISU::TFamilyAndEntitySet& theFamilyAndEntitySet) 
   {
     //Calculate dimentions of the group
@@ -290,8 +292,8 @@ namespace{
       const VISU::TFamilyAndEntity& aFamilyAndEntity = *aFamilyAndEntitySetIter;
       const string& aFamilyName = aFamilyAndEntity.first;
       const VISU::TEntity& anEntity = aFamilyAndEntity.second;
-      const VISU::TMeshOnEntity& aMeshOnEntity = theMesh.myMeshOnEntityMap.find(anEntity)->second;
-      pair<int,int> aCellsDim = aMeshOnEntity.GetCellsDims(aFamilyName);
+      const VISU::PMeshOnEntity aMeshOnEntity = theMesh->myMeshOnEntityMap[anEntity];
+      pair<int,int> aCellsDim = aMeshOnEntity->GetCellsDims(aFamilyName);
       aNbCells += aCellsDim.first;
       aCellsSize += aCellsDim.second;
     }
@@ -305,22 +307,22 @@ namespace{
       const VISU::TFamilyAndEntity& aFamilyAndEntity = *aFamilyAndEntitySetIter;
       const string& aFamilyName = aFamilyAndEntity.first;
       const VISU::TEntity& anEntity = aFamilyAndEntity.second;
-      const VISU::TMeshOnEntity& aMeshOnEntity = theMesh.myMeshOnEntityMap.find(anEntity)->second;
-      const VISU::TFamily& aFamily = *(VISU::GetFamily(aMeshOnEntity,aFamilyName));
-      const VISU::TMeshOnEntity::TCellsConn &aCellsConn = aMeshOnEntity.myCellsConn;
-      VISU::TMeshOnEntity::TCellsConn::const_iterator aCellsConnIter = aCellsConn.begin();
+      PMeshOnEntityImpl aMeshOnEntity = theMesh->myMeshOnEntityMap[anEntity];
+      PFamilyImpl aFamily = GetFamily(aMeshOnEntity,aFamilyName);
+      const VISU::TMeshOnEntityImpl::TCellsConn &aCellsConn = aMeshOnEntity->myCellsConn;
+      VISU::TMeshOnEntityImpl::TCellsConn::const_iterator aCellsConnIter = aCellsConn.begin();
       for(; aCellsConnIter != aCellsConn.end(); aCellsConnIter++){
-       const VISU::TMeshOnEntity::TConnForCellType& anArray = aCellsConnIter->second;
+       const VISU::TMeshOnEntityImpl::TConnForCellType& anArray = aCellsConnIter->second;
        int aVtkType = aCellsConnIter->first;
        MSG(MYDEBUG,"GetCellsOnGroup - aVtkType = "<<aVtkType<<"; anArray.size() = "<<anArray.size());
-       const VISU::TFamily::TSubMesh& aSubMesh = aFamily.mySubMesh;
+       const VISU::TFamilyImpl::TSubMesh& aSubMesh = aFamily->mySubMesh;
        if(aSubMesh.empty()) 
          EXCEPTION(runtime_error,"GetCells >> There is no elements on the family !!!");
-       VISU::TFamily::TSubMesh::const_iterator aSubMeshIter = aSubMesh.find(aVtkType);
+       VISU::TFamilyImpl::TSubMesh::const_iterator aSubMeshIter = aSubMesh.find(aVtkType);
        if(aSubMeshIter == aSubMesh.end()) continue;
-       const VISU::TFamily::TSubMeshOnCellType& aSubMeshOnCellType = aSubMeshIter->second;
+       const VISU::TFamilyImpl::TSubMeshOnCellType& aSubMeshOnCellType = aSubMeshIter->second;
        MSG(MYDEBUG,"GetCellsOnGroup - aSubMeshOnCellType.size() = "<<aSubMeshOnCellType.size());
-       VISU::TFamily::TSubMeshOnCellType::const_iterator aSubMeshOnCellTypeIter = aSubMeshOnCellType.begin();
+       VISU::TFamilyImpl::TSubMeshOnCellType::const_iterator aSubMeshOnCellTypeIter = aSubMeshOnCellType.begin();
        for(; aSubMeshOnCellTypeIter != aSubMeshOnCellType.end(); aSubMeshOnCellTypeIter++, i++){
          PrintCells(i,aConnectivity,anArray[*aSubMeshOnCellTypeIter]);
          aCellTypesArray->SetValue(j++,(unsigned char)aVtkType);
@@ -342,12 +344,12 @@ namespace{
   
   
   void InitProfile(VISU::TVTKExtractFilter& theFilter,
-                  const VISU::TMeshOnEntity& theMeshOnEntity, 
-                  const VISU::TField::TValForTime& theValForTime)
+                  PMeshOnEntityImpl theMeshOnEntity, 
+                  PValForTimeImpl theValForTime)
   {
-    const VISU::TField::TValForCells& aValForCells = theValForTime.myValForCells;
-    const VISU::TMeshOnEntity::TCellsConn &aCellsConn = theMeshOnEntity.myCellsConn;
-    VISU::TMeshOnEntity::TCellsConn::const_iterator aCellsConnIter = aCellsConn.begin();
+    const VISU::TValForTimeImpl::TValForCells& aValForCells = theValForTime->myValForCells;
+    const VISU::TMeshOnEntityImpl::TCellsConn &aCellsConn = theMeshOnEntity->myCellsConn;
+    VISU::TMeshOnEntityImpl::TCellsConn::const_iterator aCellsConnIter = aCellsConn.begin();
     for(; aCellsConnIter != aCellsConn.end(); aCellsConnIter++){
       const vtkIdType& aCellType = aCellsConnIter->first;
       if(aValForCells.find(aCellType) == aValForCells.end())
@@ -359,21 +361,21 @@ namespace{
   void GetValsOnTimeStamp(vtkFloatArray *theFloatArray, 
                          const vtkIdType& theNumberOfTuples,
                          const std::string& theFieldName,
-                         const VISU::TField& theField,
-                         const VISU::TField::TValForTime& theValForTime)
+                         VISU::PFieldImpl theField,
+                         VISU::PValForTimeImpl theValForTime)
   {
     //theFloatArray->DebugOn();
     theFloatArray->SetNumberOfTuples(theNumberOfTuples);
     theFloatArray->SetName(theFieldName.c_str());
     MSG(MYDEBUG,"GetValsOnTimeStamp - theNumberOfTuples = "<<theNumberOfTuples);
-    const VISU::TField::TValForCells& aValForCells = theValForTime.myValForCells;
-    VISU::TField::TValForCells::const_iterator aValForCellsIter = aValForCells.begin();
+    const VISU::TValForTimeImpl::TValForCells& aValForCells = theValForTime->myValForCells;
+    VISU::TValForTimeImpl::TValForCells::const_iterator aValForCellsIter = aValForCells.begin();
     for(int k = 0; aValForCellsIter != aValForCells.end(); aValForCellsIter++) {
-      const VISU::TField::TValForCellsWithType& anArray = aValForCellsIter->second;
-      int iEnd = anArray.size()/theField.myNbComp;
+      const VISU::TValForTimeImpl::TValForCellsWithType& anArray = aValForCellsIter->second;
+      int iEnd = anArray.size()/theField->myNbComp;
       int aVtkType = aValForCellsIter->first;
       MSG(MYDEBUG,"GetValsOnTimeStamp -  iEnd = "<<iEnd<<"; aVtkType = "<<aVtkType);
-      switch(theField.myNbComp) {
+      switch(theField->myNbComp) {
       case 1:
        for (int i = 0; i < iEnd; i++) 
          theFloatArray->SetTuple1(k++,anArray[i]);
@@ -400,28 +402,26 @@ namespace{
     }
   }
 
-  string GenerateFieldName(const VISU::TField& theField,
-                          const VISU::TField::TValForTime& theValForTime)
+  string GenerateFieldName(const VISU::PFieldImpl theField,
+                          const VISU::PValForTimeImpl theValForTime)
   {
-    const VISU::TField::TTime& aTime = theValForTime.myTime;
-    string aFieldName = theField.myMeshName + ", " + theField.myName + ": " + 
+    const VISU::TTime& aTime = theValForTime->myTime;
+    string aFieldName = theField->myMeshName + ", " + theField->myName + ": " + 
       VISU_Convertor::GenerateName(aTime);
     return aFieldName;
   }
 
   void GetTimeStamp(VISU::TVTKSource& theStorage,
-                   const VISU::TMesh& theMesh,
-                   const VISU::TMeshOnEntity& theMeshOnEntity, 
-                   const VISU::TField& theField, 
-                   const VISU::TField::TValForTime& theValForTime)
+                   const VISU::PFieldImpl theField, 
+                   const VISU::PValForTimeImpl theValForTime)
   {
-    int aNumberOfTuples = theField.myDataSize/theField.myNbComp;
+    int aNumberOfTuples = theField->myDataSize/theField->myNbComp;
     string aFieldName = GenerateFieldName(theField,theValForTime);
     MSG(MYDEBUG,"GetTimeStamp(TVTKSource) - aFieldName = "<<aFieldName<<
        "; aNumberOfTuples = "<<aNumberOfTuples);
     
     vtkDataSetAttributes* aDataSetAttributes;
-    switch(theField.myEntity){
+    switch(theField->myEntity){
     case VISU::NODE_ENTITY : 
       aDataSetAttributes = theStorage->GetPointData();
       break;
@@ -430,7 +430,7 @@ namespace{
     }
 
     vtkFloatArray *aFloatArray = vtkFloatArray::New();
-    switch(theField.myNbComp) {
+    switch(theField->myNbComp) {
     case 1:
       aFloatArray->SetNumberOfComponents(1);
       aDataSetAttributes->SetScalars(aFloatArray);
@@ -446,12 +446,10 @@ namespace{
   void GetTimeStamp(VISU::TVTKAttribyteFilter& theAttribyteFilter,
                    VISU::TVTKMergetFilter& theMergeFilter,
                    VISU::TVTKExtractFilter& theExtractFilter,
-                   const VISU::TMesh& theMesh,
-                   const VISU::TMeshOnEntity& theMeshOnEntity, 
-                   const VISU::TField& theField, 
-                   const VISU::TField::TValForTime& theValForTime)
+                   const VISU::PFieldImpl theField, 
+                   const VISU::PValForTimeImpl theValForTime)
   {
-    int aNumberOfTuples = theField.myDataSize/theField.myNbComp;
+    int aNumberOfTuples = theField->myDataSize/theField->myNbComp;
     string aFieldName = GenerateFieldName(theField,theValForTime);
     MSG(MYDEBUG,"GetTimeStamp(TVTKAttribyteFilter) - aFieldName = "<<aFieldName<<
        "; aNumberOfTuples = "<<aNumberOfTuples);
@@ -463,7 +461,7 @@ namespace{
     theMergeFilter->SetInput(theExtractFilter->GetOutput());
     theAttribyteFilter->SetInput(theMergeFilter->GetOutput());
 
-    switch(theField.myEntity){
+    switch(theField->myEntity){
     case VISU::NODE_ENTITY : 
       theMergeFilter->SetOutputFieldToPointDataField();
       theAttribyteFilter->SetInputFieldToPointDataField();
@@ -476,7 +474,7 @@ namespace{
     }
 
     vtkFloatArray *aFloatArray = vtkFloatArray::New();
-    switch(theField.myNbComp) {
+    switch(theField->myNbComp) {
     case 1:
       aFloatArray->SetNumberOfComponents(1);
       theAttribyteFilter->SetScalarComponent(0,aFieldName.c_str(),0);
@@ -510,17 +508,16 @@ VISU_Convertor_impl::GetMeshOnEntity(const string& theMeshName,
   MSG(MYDEBUG,"GetMeshOnEntity - theMeshName = '"<<theMeshName<<
       "'; theEntity = "<<theEntity<<"; theFamilyName = '"<<theFamilyName<<"'");
   //Cheching possibility do the query
-  VISU::TMesh* pMesh = NULL;
-  VISU::TFamily* pFamily = NULL;
-  VISU::TMeshOnEntity* pMeshOnEntity = NULL;
-  FindMeshOnEntity(theMeshName,pMesh,theEntity,pMeshOnEntity,theFamilyName,pFamily);
-  VISU::TMesh& aMesh = *pMesh;
-  VISU::TMeshOnEntity& aMeshOnEntity = *pMeshOnEntity;
+  TFindMeshOnEntity aFindMeshOnEntity = 
+    FindMeshOnEntity(theMeshName,theEntity,theFamilyName);
   VISU::TVTKSource* pSource;
-  if(pFamily != NULL)
-    pSource = &(pFamily->myStorage);
+  PMeshImpl aMesh = boost::get<0>(aFindMeshOnEntity);;
+  PFamilyImpl aFamily = boost::get<2>(aFindMeshOnEntity);
+  PMeshOnEntityImpl aMeshOnEntity = boost::get<1>(aFindMeshOnEntity);
+  if(aFamily)
+    pSource = &(aFamily->myStorage);
   else
-    pSource = &(aMeshOnEntity.myStorage);
+    pSource = &(aMeshOnEntity->myStorage);
   VISU::TVTKSource& aSource = *pSource;
   //Main part of code
   try{
@@ -565,13 +562,11 @@ VISU_Convertor_impl::GetMeshOnGroup(const string& theMeshName,
   MSG(MYDEBUG,"GetMeshOnGroup - theMeshName = '"<<theMeshName<<
       "'; theGroupName = '"<<theGroupName<<"'");
   //Cheching possibility do the query
-  VISU::TMesh* pMesh = NULL;
-  VISU::TGroup* pGroup = NULL;
-  FindMeshOnGroup(theMeshName,pMesh,theGroupName,pGroup);
-  VISU::TMesh& aMesh = *pMesh;
-  VISU::TGroup& aGroup = *pGroup;
-  const VISU::TFamilyAndEntitySet& aFamilyAndEntitySet = aGroup.myFamilyAndEntitySet;
-  VISU::TVTKSource& aSource = aGroup.myStorage;
+  TFindMeshOnGroup aFindMeshOnGroup = FindMeshOnGroup(theMeshName,theGroupName);
+  PMeshImpl aMesh = boost::get<0>(aFindMeshOnGroup);
+  PGroupImpl aGroup = boost::get<1>(aFindMeshOnGroup);
+  const VISU::TFamilyAndEntitySet& aFamilyAndEntitySet = aGroup->myFamilyAndEntitySet;
+  VISU::TVTKSource& aSource = aGroup->myStorage;
   //Main part of code
   try{
     if(aSource.GetPointer() == NULL){
@@ -605,18 +600,16 @@ VISU_Convertor_impl::GetTimeStampOnMesh(const string& theMeshName,
   MSG(MYDEBUG,"GetTimeStampOnMesh - theFieldName = '"<<theFieldName<<"'; theStampsNum = "<<theStampsNum);
 
   //Cheching possibility do the query
-  VISU::TMesh* pMesh = NULL;
-  VISU::TField* pField = NULL;
-  VISU::TMeshOnEntity *pMeshOnEntity = NULL, *pVTKMeshOnEntity = NULL;
-  VISU::TField::TValForTime* pValForTime = NULL;
-  FindTimeStamp(theMeshName,pMesh,theEntity,pMeshOnEntity,pVTKMeshOnEntity,
-               theFieldName,pField,theStampsNum,pValForTime);
-  VISU::TMesh& aMesh = *pMesh;
-  VISU::TMeshOnEntity& aMeshOnEntity = *pMeshOnEntity;
-  VISU::TField& aField = *pField;
-  VISU::TField::TValForTime& aValForTime = *pValForTime;
-  VISU::TVTKAttribyteFilter& anAttribyteFilter = aValForTime.myAttribyteFilter;
-  VISU::TVTKSource& aSource = aValForTime.myStorage;
+  TFindTimeStamp aFindTimeStamp = 
+    FindTimeStamp(theMeshName,theEntity,theFieldName,theStampsNum);
+  PMeshImpl aMesh = boost::get<0>(aFindTimeStamp);
+  PMeshOnEntityImpl aMeshOnEntity = boost::get<1>(aFindTimeStamp);
+  PMeshOnEntityImpl aVTKMeshOnEntity = boost::get<2>(aFindTimeStamp);
+  PValForTimeImpl aValForTime = boost::get<4>(aFindTimeStamp);
+  PFieldImpl aField = boost::get<3>(aFindTimeStamp);
+
+  VISU::TVTKAttribyteFilter& anAttribyteFilter = aValForTime->myAttribyteFilter;
+  VISU::TVTKSource& aSource = aValForTime->myStorage;
   TOutput* anOutput = NULL;
   //Main part of code
   try{
@@ -627,43 +620,43 @@ VISU_Convertor_impl::GetTimeStampOnMesh(const string& theMeshName,
     else{
       LoadFieldOnMesh(aMesh,aMeshOnEntity,aField,aValForTime);
 
-      VISU::TVTKExtractFilter& anExtractFilter = aField.myExtractFilter;
+      VISU::TVTKExtractFilter& anExtractFilter = aField->myExtractFilter;
       if(anExtractFilter.GetPointer() == NULL){
        anExtractFilter = VISU_ExtractUnstructuredGrid::New();
        anExtractFilter->Delete();
        //anExtractFilter->DebugOn();
        try{
-         LoadMeshOnEntity(*pVTKMeshOnEntity);
+         LoadMeshOnEntity(aVTKMeshOnEntity);
        }catch(std::exception& exc){
-         pVTKMeshOnEntity = pMeshOnEntity;
+         aVTKMeshOnEntity = aMeshOnEntity;
          MSG(MYDEBUG,"Follow exception was occured :\n"<<exc.what());
        }catch(...){
-         pVTKMeshOnEntity = pMeshOnEntity;
+         aVTKMeshOnEntity = aMeshOnEntity;
          MSG(MYDEBUG,"Unknown exception was occured!");
        }
-       GetMeshOnEntity(pVTKMeshOnEntity->myMeshName,pVTKMeshOnEntity->myEntity);
+       GetMeshOnEntity(aVTKMeshOnEntity->myMeshName,aVTKMeshOnEntity->myEntity);
        
-       anExtractFilter->SetInput(pVTKMeshOnEntity->myStorage.GetPointer());
-       ::InitProfile(anExtractFilter,*pMeshOnEntity,aValForTime);
+       anExtractFilter->SetInput(aVTKMeshOnEntity->myStorage.GetPointer());
+       ::InitProfile(anExtractFilter,aMeshOnEntity,aValForTime);
       }      
       if(!anExtractFilter->IsRemoving()){
        aSource = TOutput::New();
        aSource->Delete();
-       aSource->ShallowCopy(pVTKMeshOnEntity->myStorage.GetPointer());
-       ::GetTimeStamp(aSource,aMesh,*pVTKMeshOnEntity,aField,aValForTime);
+       aSource->ShallowCopy(aVTKMeshOnEntity->myStorage.GetPointer());
+       ::GetTimeStamp(aSource,aField,aValForTime);
        anOutput = aSource.GetPointer();
       }else{
        anAttribyteFilter = vtkFieldDataToAttributeDataFilter::New();
        anAttribyteFilter->Delete();
        //anAttribyteFilter->DebugOn();
        
-       VISU::TVTKMergetFilter& aMergeFilter = aValForTime.myMergeFilter;
+       VISU::TVTKMergetFilter& aMergeFilter = aValForTime->myMergeFilter;
        aMergeFilter = vtkMergeDataObjectFilter::New();
        aMergeFilter->Delete();
        //aMergeFilter->DebugOn();
 
        ::GetTimeStamp(anAttribyteFilter,aMergeFilter,anExtractFilter,
-                      aMesh,*pVTKMeshOnEntity,aField,aValForTime);
+                      aField,aValForTime);
        anOutput = anAttribyteFilter->GetUnstructuredGridOutput();
       }
       if(MYDEBUGWITHFILES){
@@ -693,28 +686,35 @@ VISU_Convertor_impl::GetTimeStampOnMesh(const string& theMeshName,
   return anOutput;
 }
 
-void VISU_Convertor_impl::FindMesh(const string& theMeshName, VISU::TMesh*& theMesh)
+VISU::PMeshImpl 
+VISU_Convertor_impl::FindMesh(const string& theMeshName)
 {
   GetMeshMap();
-  if(myMeshMap.find(theMeshName) == myMeshMap.end())
+  TMeshMap::iterator aMeshMapIter = myMeshMap.find(theMeshName);
+  if(aMeshMapIter == myMeshMap.end())
     EXCEPTION(runtime_error,"FindMesh >> There is no mesh with the name - '"<<theMeshName<<"'!!!");
-  theMesh = &myMeshMap[theMeshName];
+
+  PMeshImpl aMesh = aMeshMapIter->second;
+  return aMesh;
 }
 
 
-void VISU_Convertor_impl::FindMeshOnEntity(const string& theMeshName, 
-                                          VISU::TMesh*& theMesh,
-                                          const VISU::TEntity& theEntity, 
-                                          VISU::TMeshOnEntity*& theMeshOnEntity,
-                                          const string& theFamilyName, 
-                                          VISU::TFamily*& theFamily)
+VISU_Convertor_impl::TFindMeshOnEntity
+VISU_Convertor_impl::FindMeshOnEntity(const string& theMeshName,
+                                     const VISU::TEntity& theEntity,
+                                     const string& theFamilyName)
 {
-  FindMesh(theMeshName,theMesh);
-  VISU::TMeshOnEntityMap& aMeshOnEntityMap = theMesh->myMeshOnEntityMap;
-  if(aMeshOnEntityMap.find(theEntity) == aMeshOnEntityMap.end())
+  PMeshImpl aMesh = FindMesh(theMeshName);
+  VISU::TMeshOnEntityMap& aMeshOnEntityMap = aMesh->myMeshOnEntityMap;
+  VISU::TMeshOnEntityMap::const_iterator aMeshOnEntityMapIter = aMeshOnEntityMap.find(theEntity);
+  if(aMeshOnEntityMapIter == aMeshOnEntityMap.end())
     EXCEPTION(runtime_error,"FindMeshOnEntity >> There is no mesh on the entity - "<<theEntity<<"!!!");
-  theMeshOnEntity = &aMeshOnEntityMap[theEntity];
-  theFamily = VISU::GetFamily(*theMeshOnEntity,theFamilyName);
+
+  PMeshOnEntityImpl aMeshOnEntity = aMeshOnEntityMapIter->second;
+
+  return TFindMeshOnEntity(aMesh,
+                          aMeshOnEntityMap[theEntity],
+                          GetFamily(aMeshOnEntity,theFamilyName));
 }
 
 
@@ -724,35 +724,35 @@ float VISU_Convertor_impl::GetSize() {
   VISU::TMeshMap::const_iterator aMeshMapIter = aMeshMap.begin();
   for(; aMeshMapIter != aMeshMap.end(); aMeshMapIter++){
     const string& aMeshName = aMeshMapIter->first;
-    const VISU::TMesh& aMesh = aMeshMapIter->second;
-    const VISU::TMeshOnEntityMap& aMeshOnEntityMap = aMesh.myMeshOnEntityMap;
+    const VISU::PMesh aMesh = aMeshMapIter->second;
+    const VISU::TMeshOnEntityMap& aMeshOnEntityMap = aMesh->myMeshOnEntityMap;
     VISU::TMeshOnEntityMap::const_iterator aMeshOnEntityMapIter;
     //Import fields
     aMeshOnEntityMapIter = aMeshOnEntityMap.begin();
     for(; aMeshOnEntityMapIter != aMeshOnEntityMap.end(); aMeshOnEntityMapIter++){
       const VISU::TEntity& anEntity = aMeshOnEntityMapIter->first;
-      const VISU::TMeshOnEntity& aMeshOnEntity = aMeshOnEntityMapIter->second;
-      const VISU::TFieldMap& aFieldMap = aMeshOnEntity.myFieldMap;
+      const VISU::PMeshOnEntity aMeshOnEntity = aMeshOnEntityMapIter->second;
+      const VISU::TFieldMap& aFieldMap = aMeshOnEntity->myFieldMap;
       VISU::TFieldMap::const_iterator aFieldMapIter = aFieldMap.begin();
       for(; aFieldMapIter != aFieldMap.end(); aFieldMapIter++){
        const string& aFieldName = aFieldMapIter->first;
-       const VISU::TField& aField = aFieldMapIter->second;
-       const VISU::TField::TValField& aValField = aField.myValField;
-       VISU::TField::TValField::const_iterator aValFieldIter = aValField.begin();
+       const VISU::PField aField = aFieldMapIter->second;
+       const VISU::TValField& aValField = aField->myValField;
+       VISU::TValField::const_iterator aValFieldIter = aValField.begin();
        for(; aValFieldIter != aValField.end(); aValFieldIter++){
          int aTimeStamp = aValFieldIter->first;
          aResult += GetTimeStampSize(aMeshName,anEntity,aFieldName,aTimeStamp);
        }
       }
       //Importing groups
-      const VISU::TGroupMap& aGroupMap = aMesh.myGroupMap;
+      const VISU::TGroupMap& aGroupMap = aMesh->myGroupMap;
       VISU::TGroupMap::const_iterator aGroupMapIter = aGroupMap.begin();
       for(; aGroupMapIter != aGroupMap.end(); aGroupMapIter++){
        const string& aGroupName = aGroupMapIter->first;
        aResult += GetMeshOnGroupSize(aMeshName,aGroupName);
       }
       //Import families
-      const VISU::TFamilyMap& aFamilyMap = aMeshOnEntity.myFamilyMap;
+      const VISU::TFamilyMap& aFamilyMap = aMeshOnEntity->myFamilyMap;
       VISU::TFamilyMap::const_iterator aFamilyMapIter = aFamilyMap.begin();
       for(; aFamilyMapIter != aFamilyMap.end(); aFamilyMapIter++){
        const string& aFamilyName = aFamilyMapIter->first;
@@ -771,24 +771,28 @@ float VISU_Convertor_impl::GetMeshOnEntitySize(const std::string& theMeshName,
                                               const VISU::TEntity& theEntity,
                                               const std::string& theFamilyName)
 {
-  VISU::TMesh* pMesh = NULL;
-  VISU::TFamily* pFamily = NULL;
-  VISU::TMeshOnEntity* pMeshOnEntity = NULL;
-  FindMeshOnEntity(theMeshName,pMesh,theEntity,pMeshOnEntity,theFamilyName,pFamily);
-  vtkIdType aPointsSize = 3*pMesh->myNbPoints*sizeof(VISU::TMesh::TCoord);
+  TFindMeshOnEntity aFindMeshOnEntity = 
+    FindMeshOnEntity(theMeshName,theEntity,theFamilyName);
+  PMeshImpl aMesh = boost::get<0>(aFindMeshOnEntity);
+  PFamilyImpl aFamily = boost::get<2>(aFindMeshOnEntity);
+  PMeshOnEntityImpl aMeshOnEntity = boost::get<1>(aFindMeshOnEntity);
+
+  vtkIdType aPointsSize = 3*aMesh->myNbPoints*sizeof(VISU::TCoord);
   vtkIdType aNbCells, aCellsSize;
-  if(!pFamily){
-    aNbCells = pMeshOnEntity->myNbCells;
-    aCellsSize = pMeshOnEntity->myCellsSize;
+
+  if(!aFamily){
+    aNbCells = aMeshOnEntity->myNbCells;
+    aCellsSize = aMeshOnEntity->myCellsSize;
   }else{
-    aNbCells = pFamily->myNbCells;
-    aCellsSize = pFamily->myCellsSize;
+    aNbCells = aFamily->myNbCells;
+    aCellsSize = aFamily->myCellsSize;
   }
+
   vtkIdType aConnectivitySize = aCellsSize*sizeof(vtkIdType);
   vtkIdType aTypesSize = aNbCells*sizeof(char);
   vtkIdType aLocationsSize = aNbCells*sizeof(int);
   float aNbCellsPerPoint = aCellsSize / aNbCells - 1;
-  vtkIdType aLinksSize = pMesh->myNbPoints * 
+  vtkIdType aLinksSize = aMesh->myNbPoints * 
     (vtkIdType(sizeof(vtkIdType)*aNbCellsPerPoint) + sizeof(vtkCellLinks::Link));
   aLinksSize = 0;
   vtkIdType aResult = aPointsSize + aConnectivitySize + aTypesSize + aLocationsSize + aLinksSize;
@@ -807,30 +811,34 @@ float VISU_Convertor_impl::GetMeshOnEntitySize(const std::string& theMeshName,
 }
 
 
-void VISU_Convertor_impl::FindMeshOnGroup(const std::string& theMeshName, VISU::TMesh*& theMesh,
-                                         const std::string& theGroupName, VISU::TGroup*& theGroup)
+VISU_Convertor_impl::TFindMeshOnGroup
+VISU_Convertor_impl::FindMeshOnGroup(const std::string& theMeshName, 
+                                    const std::string& theGroupName)
 {
-  FindMesh(theMeshName,theMesh);
-  VISU::TGroupMap& aGroupMap = theMesh->myGroupMap;
+  PMeshImpl aMesh = FindMesh(theMeshName);
+  VISU::TGroupMap& aGroupMap = aMesh->myGroupMap;
   VISU::TGroupMap::iterator aGroupMapIter = aGroupMap.find(theGroupName);
   if(aGroupMapIter == aGroupMap.end())
     EXCEPTION(runtime_error,"FindMesh >> There is no the group in the mesh!!! - '"<<theGroupName<<"'");
-  theGroup = &aGroupMapIter->second;
+
+  VISU::PGroupImpl aGroup = aGroupMapIter->second;
+  return TFindMeshOnGroup(aMesh,aGroup);
 }
 
 
 float VISU_Convertor_impl::GetMeshOnGroupSize(const std::string& theMeshName, 
                                              const std::string& theGroupName)
 {
-  VISU::TMesh* pMesh = NULL;
-  VISU::TGroup* pGroup = NULL;
-  FindMeshOnGroup(theMeshName,pMesh,theGroupName,pGroup);
-  vtkIdType aPointsSize = 3*pMesh->myNbPoints*sizeof(VISU::TMesh::TCoord);
-  vtkIdType aNbCells = pGroup->myNbCells, aCellsSize = pGroup->myCellsSize;
+  TFindMeshOnGroup aFindMeshOnGroup = FindMeshOnGroup(theMeshName,theGroupName);
+  PMeshImpl aMesh = boost::get<0>(aFindMeshOnGroup);
+  PGroupImpl aGroup = boost::get<1>(aFindMeshOnGroup);
+
+  vtkIdType aPointsSize = 3*aMesh->myNbPoints*sizeof(VISU::TCoord);
+  vtkIdType aNbCells = aGroup->myNbCells, aCellsSize = aGroup->myCellsSize;
   vtkIdType aConnectivityAndTypesSize = aCellsSize*sizeof(vtkIdType);
   vtkIdType aLocationsSize = aNbCells*sizeof(int);
   float aNbCellsPerPoint = aCellsSize / aNbCells - 1;
-  vtkIdType aLinksSize = pMesh->myNbPoints * 
+  vtkIdType aLinksSize = aMesh->myNbPoints * 
     (vtkIdType(sizeof(vtkIdType)*aNbCellsPerPoint) + sizeof(short));
   aLinksSize = 0;
   vtkIdType aResult = aPointsSize + aConnectivityAndTypesSize + aLocationsSize + aLinksSize;
@@ -847,31 +855,39 @@ float VISU_Convertor_impl::GetMeshOnGroupSize(const std::string& theMeshName,
   return aResult;
 }
 
-
-void VISU_Convertor_impl::FindField(const string& theMeshName, VISU::TMesh*& theMesh,
-                                   const VISU::TEntity& theEntity, 
-                                   VISU::TMeshOnEntity*& theMeshOnEntity,
-                                   VISU::TMeshOnEntity*& theVTKMeshOnEntity,
-                                   const string& theFieldName, VISU::TField*& theField)
+VISU_Convertor_impl::TFindField
+VISU_Convertor_impl::FindField(const string& theMeshName, 
+                              const VISU::TEntity& theEntity, 
+                              const string& theFieldName)
 {
-  VISU::TFamily* pFamily = NULL;
-  VISU::TMeshOnEntity* pMeshOnEntity = NULL;
-  FindMeshOnEntity(theMeshName,theMesh,theEntity,pMeshOnEntity,"",pFamily);
-  theMeshOnEntity = pMeshOnEntity;
-  VISU::TMeshOnEntityMap& aMeshOnEntityMap = theMesh->myMeshOnEntityMap;
+  TFindMeshOnEntity aFindMeshOnEntity = FindMeshOnEntity(theMeshName,theEntity,"");
+  PMeshImpl aMesh = boost::get<0>(aFindMeshOnEntity);;
+  PFamilyImpl aFamily = boost::get<2>(aFindMeshOnEntity);
+  PMeshOnEntityImpl aMeshOnEntity = boost::get<1>(aFindMeshOnEntity);
+
+  VISU::TMeshOnEntityMap& aMeshOnEntityMap = aMesh->myMeshOnEntityMap;
+  PMeshOnEntityImpl aVTKMeshOnEntity;
   if(theEntity == VISU::NODE_ENTITY){
     if(aMeshOnEntityMap.find(VISU::CELL_ENTITY) != aMeshOnEntityMap.end())
-      pMeshOnEntity = &aMeshOnEntityMap[VISU::CELL_ENTITY];
+      aVTKMeshOnEntity = aMeshOnEntityMap[VISU::CELL_ENTITY];
     else if(aMeshOnEntityMap.find(VISU::FACE_ENTITY) != aMeshOnEntityMap.end())
-      pMeshOnEntity = &aMeshOnEntityMap[VISU::FACE_ENTITY];
+      aVTKMeshOnEntity = aMeshOnEntityMap[VISU::FACE_ENTITY];
     else if(aMeshOnEntityMap.find(VISU::NODE_ENTITY) != aMeshOnEntityMap.end())
-      pMeshOnEntity = &aMeshOnEntityMap[VISU::EDGE_ENTITY];
-  }
-  theVTKMeshOnEntity = pMeshOnEntity;
-  VISU::TFieldMap& aFieldMap = theMeshOnEntity->myFieldMap;
-  if(aFieldMap.find(theFieldName) == aFieldMap.end())
+      aVTKMeshOnEntity = aMeshOnEntityMap[VISU::EDGE_ENTITY];
+  }else
+    aVTKMeshOnEntity = aMeshOnEntity;
+  
+  VISU::TFieldMap& aFieldMap = aMeshOnEntity->myFieldMap;
+  VISU::TFieldMap::const_iterator aFieldIter= aFieldMap.find(theFieldName);
+  if(aFieldIter == aFieldMap.end())
     EXCEPTION(runtime_error,"FindField >> There is no field on the mesh!!!");
-  theField = &aFieldMap[theFieldName];
+  
+  PFieldImpl aField = aFieldIter->second;
+
+  return TFindField(aMesh,
+                   aMeshOnEntity,
+                   aVTKMeshOnEntity,
+                   aField);
 }
 
 
@@ -879,13 +895,12 @@ float VISU_Convertor_impl::GetFieldOnMeshSize(const std::string& theMeshName,
                                              const VISU::TEntity& theEntity,
                                              const std::string& theFieldName)
 {
-  VISU::TMesh* pMesh = NULL;
-  VISU::TField* pField = NULL;
-  VISU::TMeshOnEntity *pMeshOnEntity = NULL, *pVTKMeshOnEntity = NULL;
-  FindField(theMeshName,pMesh,theEntity,pMeshOnEntity,pVTKMeshOnEntity,
-           theFieldName,pField);
-  float aMeshSize = GetMeshOnEntitySize(theMeshName,pVTKMeshOnEntity->myEntity);
-  float aFieldOnMeshSize = float(pField->myDataSize*sizeof(float)*pField->myNbValField * ERR_SIZE_CALC);
+  TFindField aFindField = FindField(theMeshName,theEntity,theFieldName);
+  PMeshOnEntityImpl aVTKMeshOnEntity = boost::get<2>(aFindField);
+  PField aField = boost::get<3>(aFindField);
+
+  float aMeshSize = GetMeshOnEntitySize(theMeshName,aVTKMeshOnEntity->myEntity);
+  float aFieldOnMeshSize = float(aField->myDataSize*sizeof(float)*aField->myValField.size()*ERR_SIZE_CALC);
   float aResult = aMeshSize + aFieldOnMeshSize;
   if(MYDEBUG)
     MSG(MYVTKDEBUG,"GetFieldOnMeshSize - aFieldOnMeshSize = "<<float(aFieldOnMeshSize));
@@ -896,18 +911,30 @@ float VISU_Convertor_impl::GetFieldOnMeshSize(const std::string& theMeshName,
 }
 
 
-void VISU_Convertor_impl::FindTimeStamp(const std::string& theMeshName, VISU::TMesh*& theMesh,
-                                       const VISU::TEntity& theEntity, 
-                                       VISU::TMeshOnEntity*& theMeshOnEntity,
-                                       VISU::TMeshOnEntity*& theVTKMeshOnEntity,
-                                       const std::string& theFieldName, VISU::TField*& theField,
-                                       int theStampsNum, VISU::TField::TValForTime*& theValForTime)
+VISU_Convertor_impl::TFindTimeStamp
+VISU_Convertor_impl::FindTimeStamp(const std::string& theMeshName, 
+                                  const VISU::TEntity& theEntity, 
+                                  const std::string& theFieldName, 
+                                  int theStampsNum)
 {
-  FindField(theMeshName,theMesh,theEntity,theMeshOnEntity,theVTKMeshOnEntity,theFieldName,theField);
-  VISU::TField::TValField& aValField = theField->myValField;
-  if(aValField.find(theStampsNum) == aValField.end())
+  TFindField aFindField = FindField(theMeshName,theEntity,theFieldName);
+  PField aField = boost::get<3>(aFindField);
+
+  VISU::TValField& aValField = aField->myValField;
+  VISU::TValField::const_iterator aValFieldIter= aValField.find(theStampsNum);
+  if(aValFieldIter == aValField.end())
     EXCEPTION(runtime_error,"FindTimeStamp >> There is no field with the timestamp!!!");
-  theValForTime = &aValField[theStampsNum];
+  
+  PMeshImpl aMesh = boost::get<0>(aFindField);
+  PMeshOnEntityImpl aMeshOnEntity = boost::get<1>(aFindField);
+  PMeshOnEntityImpl aVTKMeshOnEntity = boost::get<2>(aFindField);
+  PValForTimeImpl aValForTime = aValFieldIter->second;
+
+  return TFindTimeStamp(aMesh,
+                       aMeshOnEntity,
+                       aVTKMeshOnEntity,
+                       aField,
+                       aValForTime);
 }
 
 
@@ -916,52 +943,43 @@ float VISU_Convertor_impl::GetTimeStampSize(const std::string& theMeshName,
                                            const std::string& theFieldName,
                                            int theStampsNum)
 {
-  VISU::TMesh* pMesh = NULL;
-  VISU::TField* pField = NULL;
-  VISU::TMeshOnEntity *pMeshOnEntity = NULL, *pVTKMeshOnEntity = NULL;
-  VISU::TField::TValForTime* pValForTime = NULL;
-  FindTimeStamp(theMeshName,pMesh,theEntity,pMeshOnEntity,pVTKMeshOnEntity,
-               theFieldName,pField,theStampsNum,pValForTime);
-  float aMeshSize = GetMeshOnEntitySize(theMeshName,pVTKMeshOnEntity->myEntity);
-  float aTimeStampSize = float(pField->myDataSize*sizeof(float) * ERR_SIZE_CALC);
+  TFindTimeStamp aFindTimeStamp = 
+    FindTimeStamp(theMeshName,theEntity,theFieldName,theStampsNum);
+  PMeshOnEntityImpl aVTKMeshOnEntity = boost::get<2>(aFindTimeStamp);
+  PField aField = boost::get<3>(aFindTimeStamp);
+  
+  float aMeshSize = GetMeshOnEntitySize(theMeshName,aVTKMeshOnEntity->myEntity);
+  float aTimeStampSize = float(aField->myDataSize*sizeof(float) * ERR_SIZE_CALC);
   float aResult = aMeshSize + aTimeStampSize;
-  if(MYDEBUG)
-    if(MYVTKDEBUG)
-      MSG(MYVTKDEBUG,"GetTimeStampSize - aTimeStampSize = "<<float(aTimeStampSize));
-  MSG(MYDEBUG,"GetTimeStampSize - aResult = "<<float(aResult)<<"; theMeshName = '"<<theMeshName<<"'; theEntity = "<<theEntity<<
+
+  MSG(MYDEBUG && MYVTKDEBUG,"GetTimeStampSize - aTimeStampSize = "<<float(aTimeStampSize));
+  MSG(MYDEBUG,"GetTimeStampSize - aResult = "<<float(aResult)<<
+      "; theMeshName = '"<<theMeshName<<"'; theEntity = "<<theEntity<<
       "; theFieldName = '"<<theFieldName<<"'; theStampsNum = "<<theStampsNum);
 
   return aResult;
 }
 
 
-const VISU::TField& 
+const VISU::PField
 VISU_Convertor_impl::GetField(const string& theMeshName, 
                              VISU::TEntity theEntity, 
                              const string& theFieldName) 
 {
-  VISU::TMesh* pMesh = NULL;
-  VISU::TField* pField = NULL;
-  VISU::TMeshOnEntity *pMeshOnEntity = NULL, *pVTKMeshOnEntity = NULL;
-  FindField(theMeshName,pMesh,theEntity,pMeshOnEntity,pVTKMeshOnEntity,
-           theFieldName,pField);
-  return *pField;
+  TFindField aFindField = FindField(theMeshName,theEntity,theFieldName);
+  PField aField = boost::get<3>(aFindField);
+  return aField;
 }
 
 
-const VISU::TField::TValForTime& 
+const VISU::PValForTime 
 VISU_Convertor_impl::GetTimeStamp(const std::string& theMeshName, 
                                  const VISU::TEntity& theEntity,
                                  const std::string& theFieldName,
                                  int theStampsNum)
 {
-  VISU::TMesh* pMesh = NULL;
-  VISU::TField* pField = NULL;
-  VISU::TMeshOnEntity *pMeshOnEntity = NULL, *pVTKMeshOnEntity = NULL;
-  VISU::TField::TValForTime* pValForTime = NULL;
-  FindTimeStamp(theMeshName,pMesh,theEntity,pMeshOnEntity,pVTKMeshOnEntity,
-               theFieldName,pField,theStampsNum,pValForTime);
-  return *pValForTime;
+  TFindTimeStamp aFindTimeStamp = 
+    FindTimeStamp(theMeshName,theEntity,theFieldName,theStampsNum);
+  PValForTime aValForTime = boost::get<4>(aFindTimeStamp);
+  return aValForTime;
 }
-
-
index 7bbaf03bf07c2c175a76ca1c02091425da93f5c8..46284cba0cab26d047f6b2bc59202fec10e5121e 100644 (file)
 
 #include "VISU_Convertor.hxx"
 
+#include <vtkSystemIncludes.h>
+
+#include <vtkPoints.h>
+#include <vtkUnstructuredGrid.h>
+#include <vtkMergeDataObjectFilter.h>
+#include <vtkFieldDataToAttributeDataFilter.h>
+#include "VISU_ExtractUnstructuredGrid.hxx"
+
 #include <qstring.h>
 #include <qfileinfo.h>
 
+#include <vtkSmartPointer.h>
+
+#include <boost/tuple/tuple.hpp>
+
+namespace VISU{
+
+  typedef vtkSmartPointer<vtkPoints> TVTKPoints;
+  typedef vtkSmartPointer<vtkUnstructuredGrid> TVTKSource;
+  typedef vtkSmartPointer<vtkMergeDataObjectFilter> TVTKMergetFilter;
+  typedef vtkSmartPointer<VISU_ExtractUnstructuredGrid> TVTKExtractFilter;
+  typedef vtkSmartPointer<vtkFieldDataToAttributeDataFilter> TVTKAttribyteFilter;
+
+  typedef float TCoord;
+
+  struct TMeshImpl: TMesh{
+    TVTKPoints myPoints;
+
+    typedef std::vector<TCoord> TPointsCoord;
+    TPointsCoord myPointsCoord;
+
+    typedef std::vector<std::string> TPointsDim;
+    TPointsDim myPointsDim;
+  };
+  typedef shared_ptr<TMeshImpl> PMeshImpl;
+
+  struct TMeshOnEntityImpl: TMeshOnEntity{
+    TVTKSource myStorage;
+    typedef std::vector<vtkIdType> TConnect;
+    typedef std::vector<TConnect> TConnForCellType;
+    typedef std::map<vtkIdType,TConnForCellType> TCellsConn;
+    TCellsConn myCellsConn;
+  };
+  typedef shared_ptr<TMeshOnEntityImpl> PMeshOnEntityImpl;
+
+  struct TFamilyImpl: TFamily{
+    TVTKSource myStorage;
+
+    typedef std::set<vtkIdType> TSubMeshOnCellType;
+    typedef std::map<vtkIdType,TSubMeshOnCellType> TSubMesh;
+    TSubMesh mySubMesh;
+  };
+  typedef shared_ptr<TFamilyImpl> PFamilyImpl;
+
+  struct TGroupImpl: TGroup{
+    TVTKSource myStorage;
+  };
+  typedef shared_ptr<TGroupImpl> PGroupImpl;
+
+  struct TFieldImpl: TField{
+    TVTKExtractFilter myExtractFilter;
+    ~TFieldImpl()
+    { 
+      if(myExtractFilter.GetPointer())
+       myExtractFilter->UnRegisterAllOutputs();
+    }
+  };
+  typedef shared_ptr<TFieldImpl> PFieldImpl;
+
+  struct TValForTimeImpl: TValForTime{
+    TVTKAttribyteFilter myAttribyteFilter;
+    TVTKMergetFilter myMergeFilter;
+    TVTKSource myStorage;
+
+    typedef std::vector<float> TValForCellsWithType;
+    typedef std::map<vtkIdType,TValForCellsWithType> TValForCells;
+    TValForCells myValForCells;
+
+    ~TValForTimeImpl()
+    { 
+      if(myMergeFilter.GetPointer())
+       myMergeFilter->UnRegisterAllOutputs();
+      if(myAttribyteFilter.GetPointer())
+       myAttribyteFilter->UnRegisterAllOutputs();
+    }
+  };
+  typedef shared_ptr<TValForTimeImpl> PValForTimeImpl;
+
+}
+
 class VISU_Convertor_impl: public VISU_Convertor{
 public:
   virtual float GetSize() ;
 
-  virtual float GetMeshOnEntitySize(const std::string& theMeshName, 
-                                   const VISU::TEntity& theEntity,
-                                   const std::string& theFamilyName = "");
-
-  virtual float GetMeshOnGroupSize(const std::string& theMeshName, 
-                                  const std::string& theGroupName);
-
-  virtual float GetTimeStampSize(const std::string& theMeshName, 
-                                const VISU::TEntity& theEntity,
-                                const std::string& theFieldName,
-                                int theStampsNum);
-
-  virtual float GetFieldOnMeshSize(const std::string& theMeshName, 
-                                  const VISU::TEntity& theEntity,
-                                  const std::string& theFieldName);
-
-  virtual const VISU::TField& GetField(const std::string& theMeshName, 
-                                      VISU::TEntity theEntity, 
-                                      const std::string& theFieldName);
-
-  virtual const VISU::TField::TValForTime& GetTimeStamp(const std::string& theMeshName, 
-                                                       const VISU::TEntity& theEntity,
-                                                       const std::string& theFieldName,
-                                                       int theStampsNum);
+  virtual 
+  float 
+  GetMeshOnEntitySize(const std::string& theMeshName, 
+                     const VISU::TEntity& theEntity,
+                     const std::string& theFamilyName = "");
+
+  virtual 
+  float 
+  GetMeshOnGroupSize(const std::string& theMeshName, 
+                    const std::string& theGroupName);
+
+  virtual 
+  float 
+  GetTimeStampSize(const std::string& theMeshName, 
+                  const VISU::TEntity& theEntity,
+                  const std::string& theFieldName,
+                  int theStampsNum);
+
+  virtual 
+  float 
+  GetFieldOnMeshSize(const std::string& theMeshName, 
+                    const VISU::TEntity& theEntity,
+                    const std::string& theFieldName);
+
+  virtual 
+  const VISU::PField 
+  GetField(const std::string& theMeshName, 
+          VISU::TEntity theEntity, 
+          const std::string& theFieldName);
+
+  virtual 
+  const VISU::PValForTime 
+  GetTimeStamp(const std::string& theMeshName, 
+              const VISU::TEntity& theEntity,
+              const std::string& theFieldName,
+              int theStampsNum);
 
 public:
   VISU_Convertor_impl();
@@ -50,52 +149,70 @@ public:
 
   virtual VISU_Convertor* Build()  { return this;};
 
-  virtual TOutput* GetMeshOnEntity(const std::string& theMeshName, 
-                                  const VISU::TEntity& theEntity,
-                                  const std::string& theFamilyName = "");
-
-  virtual TOutput* GetMeshOnGroup(const std::string& theMeshName, 
-                                 const std::string& theGroupName);
-
-  virtual TOutput* GetTimeStampOnMesh(const std::string& theMeshName, 
-                                     const VISU::TEntity& theEntity,
-                                     const std::string& theFieldName,
-                                     int theStampsNum);
+  virtual 
+  TOutput* 
+  GetMeshOnEntity(const std::string& theMeshName, 
+                 const VISU::TEntity& theEntity,
+                 const std::string& theFamilyName = "");
+
+  virtual 
+  TOutput* 
+  GetMeshOnGroup(const std::string& theMeshName, 
+                const std::string& theGroupName);
+  
+  virtual
+  TOutput* 
+  GetTimeStampOnMesh(const std::string& theMeshName, 
+                    const VISU::TEntity& theEntity,
+                    const std::string& theFieldName,
+                    int theStampsNum);
 
 protected:
-  void FindMesh(const std::string& theMeshName, VISU::TMesh*& theMesh);
-
-  void FindMeshOnEntity(const std::string& theMeshName, VISU::TMesh*& theMesh,
-                       const VISU::TEntity& theEntity, VISU::TMeshOnEntity*& theMeshOnEntity,
-                       const std::string& theFamilyName, VISU::TFamily*& theFamily);
-
-  void FindMeshOnGroup(const std::string& theMeshName, VISU::TMesh*& theMesh,
-                      const std::string& theGroupName, VISU::TGroup*& theGroup);
-
-  void FindField(const std::string& theMeshName, VISU::TMesh*& theMesh,
-                const VISU::TEntity& theEntity, 
-                VISU::TMeshOnEntity*& theMeshOnEntity,
-                VISU::TMeshOnEntity*& theVTKMeshOnEntity,
-                const std::string& theFieldName, VISU::TField*& theField);
-
-  void FindTimeStamp(const std::string& theMeshName, VISU::TMesh*& theMesh,
-                    const VISU::TEntity& theEntity, 
-                    VISU::TMeshOnEntity*& theMeshOnEntity,
-                    VISU::TMeshOnEntity*& theVTKMeshOnEntity,
-                    const std::string& theFieldName, VISU::TField*& theField,
-                    int theStampsNum, VISU::TField::TValForTime*& theValForTime);
-
+  VISU::PMeshImpl 
+  FindMesh(const std::string& theMeshName);
+
+  typedef boost::tuple<VISU::PMeshImpl,VISU::PMeshOnEntityImpl,VISU::PFamilyImpl> TFindMeshOnEntity;
+  TFindMeshOnEntity
+  FindMeshOnEntity(const std::string& theMeshName,
+                  const VISU::TEntity& theEntity,
+                  const std::string& theFamilyName);
+
+  typedef boost::tuple<VISU::PMeshImpl,VISU::PGroupImpl> TFindMeshOnGroup;
+  TFindMeshOnGroup
+  FindMeshOnGroup(const std::string& theMeshName, 
+                 const std::string& theGroupName);
+
+  typedef boost::tuple<VISU::PMeshImpl,
+                      VISU::PMeshOnEntityImpl,
+                      VISU::PMeshOnEntityImpl,
+                      VISU::PFieldImpl> TFindField;
+  TFindField
+  FindField(const std::string& theMeshName, 
+           const VISU::TEntity& theEntity, 
+           const std::string& theFieldName);
+
+  typedef boost::tuple<VISU::PMeshImpl,
+                      VISU::PMeshOnEntityImpl,
+                      VISU::PMeshOnEntityImpl,
+                      VISU::PFieldImpl,
+                      VISU::PValForTimeImpl> TFindTimeStamp;
+  TFindTimeStamp
+  FindTimeStamp(const std::string& theMeshName, 
+               const VISU::TEntity& theEntity, 
+               const std::string& theFieldName, 
+               int theStampsNum);
+  
 protected:
-  virtual int LoadMeshOnEntity(VISU::TMeshOnEntity& theMeshOnEntity, 
+  virtual int LoadMeshOnEntity(VISU::PMeshOnEntityImpl theMeshOnEntity, 
                               const std::string& theFamilyName = "") = 0;
 
-  virtual int LoadMeshOnGroup(VISU::TMesh& theMesh, 
+  virtual int LoadMeshOnGroup(VISU::PMeshImpl theMesh, 
                              const VISU::TFamilyAndEntitySet& theFamilyAndEntitySet) = 0;
 
-  virtual int LoadFieldOnMesh(VISU::TMesh& theMesh, 
-                             VISU::TMeshOnEntity& theMeshOnEntity, 
-                             VISU::TField& theField, 
-                             VISU::TField::TValForTime& theValForTime) = 0;
+  virtual int LoadFieldOnMesh(VISU::PMeshImpl theMesh, 
+                             VISU::PMeshOnEntityImpl theMeshOnEntity, 
+                             VISU::PFieldImpl theField, 
+                             VISU::PValForTimeImpl theValForTime) = 0;
 };
 
 #endif
index 4c7b8d887362539db5c8e5d49174daa3df5ddb00..a861616ac9aad35d83f953c7fbf295566e1ef771 100644 (file)
@@ -42,7 +42,7 @@ using namespace MED;
 using namespace VISU;
 
 #ifdef _DEBUG_
-static int MYDEBUG = 0;
+static int MYDEBUG = 1;
 #else
 static int MYDEBUG = 0;
 #endif
@@ -176,37 +176,38 @@ VISU_Convertor* VISU_MedConvertor::Build()  {
     TInt aDim = aMeshInfo->GetDim();
     const string& aMeshName = aMeshInfo->GetName();
     
-    TMesh& aMesh = aMeshMap[aMeshName];
-    aMesh.myDim = aDim;
-    aMesh.myName = aMeshName;
-    aMesh.myNbPoints = aNodeInfo->GetNbElem();
-    aMesh.myMeshInfo = aMeshInfo;
-    aMesh.myEntityInfo = aEntityInfo;
+    PMEDMesh aMesh = aMeshMap[aMeshName](new TMEDMesh());
+    aMesh->myDim = aDim;
+    aMesh->myName = aMeshName;
+    aMesh->myNbPoints = aNodeInfo->GetNbElem();
+    aMesh->myMeshInfo = aMeshInfo;
+    aMesh->myEntityInfo = aEntityInfo;
 
     INITMSG(MYDEBUG,"aMeshName = '"<<aMeshName<<
-           "'; myNbPoints = "<<aMesh.myNbPoints<<
+           "'; myNbPoints = "<<aMesh->myNbPoints<<
            "; aDim = "<<aDim<<"\n");
     
     BEGMSG(MYDEBUG,"aEntityInfo.size() = "<<aEntityInfo.size()<<"\n");
 
+    TMeshOnEntityMap& aMeshOnEntityMap = aMesh->myMeshOnEntityMap;
     MED::TEntityInfo::iterator anEntityIter = aEntityInfo.begin();
     for(; anEntityIter != aEntityInfo.end(); anEntityIter++){
       const EEntiteMaillage& aMEntity = anEntityIter->first;
       const MED::TGeom& aTGeom = anEntityIter->second;
 
       TEntity aVEntity = MEDEntityToVTK(aMEntity);
-      VISU::TMeshOnEntity& aMeshOnEntity = aMesh.myMeshOnEntityMap[aVEntity];
-      aMeshOnEntity.myEntity = aVEntity;
-      aMeshOnEntity.myMeshName = aMeshName;
-      aMeshOnEntity.myGeom = aTGeom;
+      PMEDMeshOnEntity aMeshOnEntity = aMeshOnEntityMap[aVEntity](new TMEDMeshOnEntity());
+      aMeshOnEntity->myEntity = aVEntity;
+      aMeshOnEntity->myMeshName = aMeshName;
+      aMeshOnEntity->myGeom = aTGeom;
 
       INITMSG(MYDEBUG,"aMEntity = "<<aMEntity<<"; aVEntity = "<<aVEntity<<"\n");
 
       if(aMEntity == eNOEUD){
-       aMeshOnEntity.myNbCells = aMesh.myNbPoints;
-       aMeshOnEntity.myCellsSize = 2*aMesh.myNbPoints;
+       aMeshOnEntity->myNbCells = aMesh->myNbPoints;
+       aMeshOnEntity->myCellsSize = 2*aMesh->myNbPoints;
        
-       for(TInt iElem = 0; iElem < aMesh.myNbPoints; iElem++){
+       for(TInt iElem = 0; iElem < aMesh->myNbPoints; iElem++){
          TInt aFamId = aNodeInfo->GetFamNum(iElem);
          if(aFamId != 0){
            aFamilyNbCellsCounterMap[aFamId] += 1;
@@ -214,25 +215,25 @@ VISU_Convertor* VISU_MedConvertor::Build()  {
          }
        }
 
-       INITMSG(MYDEBUG,"myNbCells = "<<aMeshOnEntity.myNbCells<<
-               "; myCellsSize = "<<aMeshOnEntity.myCellsSize<<"\n");;
+       INITMSG(MYDEBUG,"myNbCells = "<<aMeshOnEntity->myNbCells<<
+               "; myCellsSize = "<<aMeshOnEntity->myCellsSize<<"\n");;
 
       }else{
        MED::TGeom::const_iterator anTGeomIter = aTGeom.begin();
-       aMeshOnEntity.myNbCells = 0;
-       aMeshOnEntity.myCellsSize = 0;
+       aMeshOnEntity->myNbCells = 0;
+       aMeshOnEntity->myCellsSize = 0;
        for(; anTGeomIter != aTGeom.end(); anTGeomIter++){
          const EGeometrieElement& aGeom = anTGeomIter->first;
          int aVNbNodes = VTKGeom2NbNodes(MEDGeomToVTK(aGeom));
          PCellInfo aCellInfo = aMed->GetPCellInfo(aMeshInfo,aMEntity,aGeom);
          TInt aNbElem = aCellInfo->GetNbElem();
-         aMeshOnEntity.myNbCells += aNbElem;
-         aMeshOnEntity.myCellsSize += aNbElem*(aVNbNodes+1);
+         aMeshOnEntity->myNbCells += aNbElem;
+         aMeshOnEntity->myCellsSize += aNbElem*(aVNbNodes+1);
          INITMSG(MYDEBUG,"aGeom = "<<aGeom<<"; aNbElem = "<<aNbElem<<
-                 "; myNbCells = "<<aMeshOnEntity.myNbCells<<
-                 "; myCellsSize = "<<aMeshOnEntity.myCellsSize<<"\n");
+                 "; myNbCells = "<<aMeshOnEntity->myNbCells<<
+                 "; myCellsSize = "<<aMeshOnEntity->myCellsSize<<"\n");
 
-         for(TInt iElem = 0; iElem < aMesh.myNbPoints; iElem++){
+         for(TInt iElem = 0; iElem < aMesh->myNbPoints; iElem++){
            TInt aFamId = aCellInfo->GetFamNum(iElem);
            if(aFamId != 0){
              aFamilyNbCellsCounterMap[aFamId] += 1;
@@ -250,30 +251,34 @@ VISU_Convertor* VISU_MedConvertor::Build()  {
       const TFamilyGroup& aFamilyGroup = aFamilyByEntityIter->second;
 
       TEntity aVEntity = MEDEntityToVTK(aMEntity);
-      VISU::TMeshOnEntity& aMeshOnEntity = aMesh.myMeshOnEntityMap[aVEntity];
+      VISU::PMEDMeshOnEntity aMeshOnEntity = aMesh->myMeshOnEntityMap[aVEntity];
+      VISU::TFamilyMap& aFamilyMap = aMeshOnEntity->myFamilyMap;
 
       INITMSG(MYDEBUG,"aMEntity = "<<aMEntity<<"; aVEntity = "<<aVEntity<<"\n");
       TFamilyGroup::const_iterator aFamilyGroupIter = aFamilyGroup.begin();
       for(; aFamilyGroupIter != aFamilyGroup.end(); aFamilyGroupIter++){
        const PFamilyInfo& aFamilyInfo = *aFamilyGroupIter;
-       if (aFamilyInfo->GetId() == 0) continue;
-       VISU::TFamily& aFamily = aMeshOnEntity.myFamilyMap[aFamilyInfo->GetName()];
+       if (aFamilyInfo->GetId() == 0) 
+         continue;
+
+       const std::string& aFamilyName = aFamilyInfo->GetName();
+       PMEDFamily aFamily = aFamilyMap[aFamilyName](new TMEDFamily());
        
-       aFamily.myId = aFamilyInfo->GetId();
-       aFamily.myName = aFamilyInfo->GetName();
-       aFamily.myEntity = aVEntity;
-       aFamily.myNbCells = aFamilyNbCellsCounterMap[aFamily.myId];
-       aFamily.myCellsSize = aFamilyCellsSizeCounterMap[aFamily.myId];
+       aFamily->myId = aFamilyInfo->GetId();
+       aFamily->myName = aFamilyInfo->GetName();
+       aFamily->myEntity = aVEntity;
+       aFamily->myNbCells = aFamilyNbCellsCounterMap[aFamily->myId];
+       aFamily->myCellsSize = aFamilyCellsSizeCounterMap[aFamily->myId];
        
-       INITMSG(MYDEBUG,"aFamilyName = '"<<aFamily.myName<<
-               "'; myId = "<<aFamily.myId<<"; "<<
+       INITMSG(MYDEBUG,"aFamilyName = '"<<aFamily->myName<<
+               "'; myId = "<<aFamily->myId<<"; "<<
                "; aNbAttr = "<<aFamilyInfo->GetNbAttr()<<
                "; aNbGroup = "<<aFamilyInfo->GetNbGroup()<<
-               "; myEntity = "<<aFamily.myEntity<<
-               "; myNbCells = "<<aFamily.myNbCells<<
-               "; myCellsSize = "<<aFamily.myCellsSize<<"\n");
+               "; myEntity = "<<aFamily->myEntity<<
+               "; myNbCells = "<<aFamily->myNbCells<<
+               "; myCellsSize = "<<aFamily->myCellsSize<<"\n");
 
-       VISU::TBindGroups& aBindGroups = aFamily.myGroups;
+       VISU::TBindGroups& aBindGroups = aFamily->myGroups;
        const TInt aNbGroup = aFamilyInfo->GetNbGroup();
        for(TInt i = 0; i < aNbGroup; i++){
          const string& aGroupName = aFamilyInfo->GetGroupName(i);
@@ -285,59 +290,59 @@ VISU_Convertor* VISU_MedConvertor::Build()  {
     
     BEGMSG(MYDEBUG,"VISU::TGroup:\n");
 
-    VISU::TGroupMap& aGroupMap = aMesh.myGroupMap;
+    VISU::TGroupMap& aGroupMap = aMesh->myGroupMap;
     TGroupInfo::const_iterator aGroupInfoIter = aGroupInfo.begin();
     for(;aGroupInfoIter != aGroupInfo.end(); aGroupInfoIter++){
       const string& aGroupName = aGroupInfoIter->first;
       const TFamilyGroup& aFamilyGroup = aGroupInfoIter->second;
-      VISU::TGroup aGroup;
-      aGroup.myName = aGroupName;
-      aGroup.myMeshName = aMesh.myName;
+      PMEDGroup aGroup(new TMEDGroup());
+      aGroup->myName = aGroupName;
+      aGroup->myMeshName = aMesh->myName;
 
-      INITMSG(MYDEBUG,"aGroup.myName = '"<<aGroup.myName<<"'\n");
+      INITMSG(MYDEBUG,"aGroup->myName = '"<<aGroup->myName<<"'\n");
 
       TFamilyGroup::const_iterator aFamilyIter = aFamilyGroup.begin();
-      for( ;aFamilyIter != aFamilyGroup.end(); aFamilyIter++){
+      for(aFamilyIter != aFamilyGroup.end(); aFamilyIter++){
        const PFamilyInfo& aFamilyInfo = *aFamilyIter;
        const string& aFamilyName = aFamilyInfo->GetName();
 
        TEntity aVEntity = TEntity(-1);
+       PFamily aFamily;
 
        // Find aVisuEntity
-       const TMeshOnEntityMap& aMeshOnEntityMap = aMesh.myMeshOnEntityMap;
+       const TMeshOnEntityMap& aMeshOnEntityMap = aMesh->myMeshOnEntityMap;
        TMeshOnEntityMap::const_iterator aMeshOnEntityIter = aMeshOnEntityMap.begin();
-       for (; aMeshOnEntityIter != aMeshOnEntityMap.end(); aMeshOnEntityIter++){
-         const TMeshOnEntity& aMeshOnEntity = aMeshOnEntityIter->second;
-         const TFamilyMap& aFamilyMap = aMeshOnEntity.myFamilyMap;
+       for(; aMeshOnEntityIter != aMeshOnEntityMap.end(); aMeshOnEntityIter++){
+         const PMeshOnEntity& aMeshOnEntity = aMeshOnEntityIter->second;
+         const TFamilyMap& aFamilyMap = aMeshOnEntity->myFamilyMap;
          TFamilyMap::const_iterator aFamilyMapIter = aFamilyMap.begin();
          for (; aFamilyMapIter != aFamilyMap.end(); aFamilyMapIter++){
            const string& aFamilyName = aFamilyMapIter->first;
-           const TFamily& aFamily = aFamilyMapIter->second;
-           TFamilyGroup::const_iterator aGroupInfoIter = aFamilyGroup.begin();
-           for (;aGroupInfoIter != aFamilyGroup.end(); aGroupInfoIter++){
-             const PFamilyInfo& aFamilyInfo = *aGroupInfoIter;
-             if(aFamilyInfo->GetName() == aFamilyName){
-               aVEntity = aFamily.myEntity;
-               goto exit_lable;
+           aFamily = aFamilyMapIter->second;
+           if(aFamily){
+             TFamilyGroup::const_iterator aGroupInfoIter = aFamilyGroup.begin();
+             for(; aGroupInfoIter != aFamilyGroup.end(); aGroupInfoIter++){
+               const PFamilyInfo& aFamilyInfo = *aGroupInfoIter;
+               if(aFamilyInfo->GetName() == aFamilyName){
+                 aVEntity = aFamily->myEntity;
+                 goto exit_lable;
+               }
              }
            }
          }
        }
       exit_lable:
-       if(aVEntity >= 0){
-         VISU::TMeshOnEntity& aMeshOnEntity = aMesh.myMeshOnEntityMap[aVEntity];
-         VISU::TFamily& aFamily = aMeshOnEntity.myFamilyMap[aFamilyInfo->GetName()];   
-         VISU::TFamilyAndEntity aFamilyAndEntity(aFamilyName,aVEntity);
-         aGroup.myFamilyAndEntitySet.insert(aFamilyAndEntity);
+       if(aFamily && aVEntity >= 0){
+         aGroup->myFamilyAndEntitySet.insert(TFamilyAndEntity(aFamilyName,aVEntity));
          INITMSG(MYDEBUG,"aFamilyName = '"<<aFamilyName<<"'; aVEntity = "<<aVEntity<<"\n");
-
-         aGroup.myNbCells += aFamily.myNbCells;
-         aGroup.myCellsSize += aFamily.myCellsSize;
+         
+         aGroup->myNbCells += aFamily->myNbCells;
+         aGroup->myCellsSize += aFamily->myCellsSize;
        }
       }
-      BEGMSG(MYDEBUG,"myNbCells = "<<aGroup.myNbCells<<
-            "; myCellsSize = "<<aGroup.myCellsSize<<"\n\n");
-      if(!aGroup.myFamilyAndEntitySet.empty() && aGroup.myNbCells > 0){
+      if(!aGroup->myFamilyAndEntitySet.empty() && aGroup->myNbCells > 0){
+       BEGMSG(MYDEBUG,"myNbCells = "<<aGroup->myNbCells<<
+              "; myCellsSize = "<<aGroup->myCellsSize<<"\n\n");
        aGroupMap.insert(VISU::TGroupMap::value_type(aGroupName,aGroup));
       }
     }
@@ -355,28 +360,27 @@ VISU_Convertor* VISU_MedConvertor::Build()  {
       TInt aNbTimeStamps = aMed->GetNbTimeStamps(aFieldInfo,aEntityInfo,aMEntity,aTGeom);
 
       TEntity aVEntity = MEDEntityToVTK(aMEntity);
-      VISU::TMeshOnEntity& aMeshOnEntity = aMesh.myMeshOnEntityMap[aVEntity];
-      VISU::TField& aField = aMeshOnEntity.myFieldMap[aFieldName];
-      aField.myId = iField;
-      aField.myNbComp = aNbComp;
-      aField.myEntity = aVEntity;
-      aField.myName = aFieldName;
-      aField.myMeshName = aMeshName;
-      aField.myNbValField = aNbTimeStamps;
-      aField.myDataSize = aMeshOnEntity.myNbCells * aNbComp;
-      aField.myCompNames.resize(aNbComp);
-      aField.myUnitNames.resize(aNbComp);
-
-      INITMSG(MYDEBUG,"myName = '"<<aField.myName<<
-             "'; myId = "<<aField.myId<<
-             "; myNbValField = "<<aField.myNbValField<<
-             "; myEntity = "<<aField.myEntity<<
-             "; myDataSize = "<<aField.myDataSize<<
-             "; myNbComp = "<<aField.myNbComp<<"\n");
+      VISU::PMeshOnEntity aMeshOnEntity = aMesh->myMeshOnEntityMap[aVEntity];
+      TFieldMap& aFieldMap = aMeshOnEntity->myFieldMap;
+      PMEDField aField = aFieldMap[aFieldName](new TMEDField());
+      aField->myId = iField;
+      aField->myNbComp = aNbComp;
+      aField->myEntity = aVEntity;
+      aField->myName = aFieldName;
+      aField->myMeshName = aMeshName;
+      aField->myDataSize = aMeshOnEntity->myNbCells * aNbComp;
+      aField->myCompNames.resize(aNbComp);
+      aField->myUnitNames.resize(aNbComp);
+
+      INITMSG(MYDEBUG,"myName = '"<<aField->myName<<
+             "'; myId = "<<aField->myId<<
+             "; myEntity = "<<aField->myEntity<<
+             "; myDataSize = "<<aField->myDataSize<<
+             "; myNbComp = "<<aField->myNbComp<<"\n");
 
       for(TInt iComp = 0; iComp < aNbComp; iComp++){
-       aField.myCompNames[iComp] = aFieldInfo->GetCompName(iComp);
-       aField.myUnitNames[iComp] = aFieldInfo->GetUnitName(iComp);
+       aField->myCompNames[iComp] = aFieldInfo->GetCompName(iComp);
+       aField->myUnitNames[iComp] = aFieldInfo->GetUnitName(iComp);
       }
 
       for(TInt iTimeStamp = 1; iTimeStamp <= aNbTimeStamps; iTimeStamp++){
@@ -387,13 +391,14 @@ VISU_Convertor* VISU_MedConvertor::Build()  {
        TFloat aDt = aTimeStamp->GetDt();
        const string& anUnitDt = aTimeStamp->GetUnitDt();
        PTimeStampVal aTimeStampVal = aMed->GetPTimeStampVal(aTimeStamp);
-       VISU::TField::TValForTime& aValForTime = aField.myValField[iTimeStamp];
-       aValForTime.myId = iTimeStamp;
-       aValForTime.myFieldName = aField.myName;
-       aValForTime.myEntity = aField.myEntity;
-       aValForTime.myMeshName = aField.myMeshName;
-       aValForTime.myNbComp = aField.myNbComp;
-       aValForTime.myTime = VISU::TField::TTime(aDt,anUnitDt);
+       TValField& aValField = aField->myValField;
+       PMEDValForTime aValForTime = aValField[iTimeStamp](new TMEDValForTime());
+       aValForTime->myId = iTimeStamp;
+       aValForTime->myFieldName = aField->myName;
+       aValForTime->myEntity = aField->myEntity;
+       aValForTime->myMeshName = aField->myMeshName;
+       aValForTime->myNbComp = aField->myNbComp;
+       aValForTime->myTime = VISU::TTime(aDt,anUnitDt);
        INITMSG(MYDEBUG,"aDt = "<<aDt<<", "<<anUnitDt<<"\n");
       }
     }
@@ -402,24 +407,24 @@ VISU_Convertor* VISU_MedConvertor::Build()  {
   return this; 
 }
 
-int VISU_MedConvertor::LoadMeshOnEntity(VISU::TMeshOnEntity& theMeshOnEntity, 
+int VISU_MedConvertor::LoadMeshOnEntity(VISU::PMeshOnEntityImpl theMeshOnEntity, 
                                        const string& theFamilyName)
 {
   PWrapper aMed = CrWrapper(myFileInfo.absFilePath().latin1());
-  const string& aMeshName = theMeshOnEntity.myMeshName;
-  const VISU::TEntity& anEntity = theMeshOnEntity.myEntity;
-  VISU::TMesh& aMesh = myMeshMap[aMeshName];
+  const string& aMeshName = theMeshOnEntity->myMeshName;
+  const VISU::TEntity& anEntity = theMeshOnEntity->myEntity;
+  PMeshImpl aMesh = myMeshMap[aMeshName];
   int isPointsUpdated;
   if(anEntity == VISU::NODE_ENTITY) 
     isPointsUpdated = LoadPoints(aMed,aMesh,theFamilyName);
   else 
     isPointsUpdated = LoadPoints(aMed,aMesh);
-  int isCellsOnEntityUpdated = LoadCellsOnEntity(aMed,theMeshOnEntity,theFamilyName);
+  int isCellsOnEntityUpdated = LoadCellsOnEntity(aMed,aMesh,theMeshOnEntity,theFamilyName);
 
   return (isPointsUpdated || isCellsOnEntityUpdated);
 }
 
-int VISU_MedConvertor::LoadMeshOnGroup(VISU::TMesh& theMesh, 
+int VISU_MedConvertor::LoadMeshOnGroup(VISU::PMeshImpl theMesh, 
                                       const VISU::TFamilyAndEntitySet& theFamilyAndEntitySet)
 {
   PWrapper aMed = CrWrapper(myFileInfo.absFilePath().latin1());
@@ -428,28 +433,28 @@ int VISU_MedConvertor::LoadMeshOnGroup(VISU::TMesh& theMesh,
   for(; aFamilyAndEntitySetIter != theFamilyAndEntitySet.end(); aFamilyAndEntitySetIter++){
     const string& aFamilyName = aFamilyAndEntitySetIter->first;
     const VISU::TEntity& anEntity = aFamilyAndEntitySetIter->second;
-    VISU::TMeshOnEntity& aMeshOnEntity = theMesh.myMeshOnEntityMap[anEntity];
+    const VISU::PMEDMeshOnEntity aMeshOnEntity = theMesh->myMeshOnEntityMap[anEntity];
     if(anEntity == VISU::NODE_ENTITY){
       isPointsUpdated += LoadPoints(aMed,theMesh,aFamilyName);
-      isCellsOnEntityUpdated += LoadCellsOnEntity(aMed,aMeshOnEntity);
+      isCellsOnEntityUpdated += LoadCellsOnEntity(aMed,theMesh,aMeshOnEntity);
     }else{
       isPointsUpdated += LoadPoints(aMed,theMesh);
-      isCellsOnEntityUpdated += LoadCellsOnEntity(aMed,aMeshOnEntity,aFamilyName);
+      isCellsOnEntityUpdated += LoadCellsOnEntity(aMed,theMesh,aMeshOnEntity,aFamilyName);
     }
   }
 
   return (isPointsUpdated || isCellsOnEntityUpdated);
 }
 
-int VISU_MedConvertor::LoadFieldOnMesh(VISU::TMesh& theMesh, 
-                                      VISU::TMeshOnEntity& theMeshOnEntity, 
-                                      VISU::TField& theField, 
-                                      VISU::TField::TValForTime& theValForTime)
+int VISU_MedConvertor::LoadFieldOnMesh(VISU::PMeshImpl theMesh, 
+                                      VISU::PMeshOnEntityImpl theMeshOnEntity, 
+                                      VISU::PFieldImpl theField, 
+                                      VISU::PValForTimeImpl theValForTime)
 {
   PWrapper aMed = CrWrapper(myFileInfo.absFilePath().latin1());
   int isPointsUpdated = LoadPoints(aMed,theMesh);
-  int isCellsOnEntityUpdated = LoadCellsOnEntity(aMed,theMeshOnEntity);
-  int isFieldUpdated = LoadField(aMed,theMeshOnEntity,theField,theValForTime);
+  int isCellsOnEntityUpdated = LoadCellsOnEntity(aMed,theMesh,theMeshOnEntity);
+  int isFieldUpdated = LoadField(aMed,theMesh,theMeshOnEntity,theField,theValForTime);
   
   return (isPointsUpdated || isCellsOnEntityUpdated || isFieldUpdated);
 }
@@ -457,58 +462,58 @@ int VISU_MedConvertor::LoadFieldOnMesh(VISU::TMesh& theMesh,
 
 int 
 VISU_MedConvertor::LoadPoints(const MED::PWrapper& theMed,
-                             VISU::TMesh& theMesh, 
+                             VISU::PMEDMesh theMesh, 
                              const string& theFamilyName) 
 {
   try{
     //Check on existing family
-    VISU::TMeshOnEntity& aMeshOnEntity = theMesh.myMeshOnEntityMap[VISU::NODE_ENTITY];
-    aMeshOnEntity.myEntity = VISU::NODE_ENTITY;
-    aMeshOnEntity.myMeshName = theMesh.myName;
-    VISU::TFamily* pFamily = VISU::GetFamily(aMeshOnEntity,theFamilyName);
-    bool isFamilyPresent = (pFamily != NULL);
-    VISU::TFamily& aFamily = *pFamily;
+    VISU::PMEDMeshOnEntity aMeshOnEntity = theMesh->myMeshOnEntityMap[VISU::NODE_ENTITY];
+    aMeshOnEntity->myEntity = VISU::NODE_ENTITY;
+    aMeshOnEntity->myMeshName = theMesh->myName;
+    PFamilyImpl aFamily = GetFamily(aMeshOnEntity,theFamilyName);
     //Check on loading already done
-    bool isPointsLoaded = !theMesh.myPointsCoord.empty();
+    bool isPointsLoaded = !theMesh->myPointsCoord.empty();
     if(isPointsLoaded) 
-      if(!isFamilyPresent) return 0;
-      else if(!aFamily.mySubMesh.empty()) return 0;
+      if(!aFamily) 
+       return 0;
+      else if(!aFamily->mySubMesh.empty()) 
+       return 0;
 
     INITMSG(MYDEBUG,"LoadPoints - isPointsLoaded = "<<isPointsLoaded<<"; theFamilyName = '"<<theFamilyName<<"'\n");
 
     //Main part of code
-    PNodeInfo aNodeInfo = theMed->GetPNodeInfo(theMesh.myMeshInfo);
+    PNodeInfo aNodeInfo = theMed->GetPNodeInfo(theMesh->myMeshInfo);
     TInt aNbElem = aNodeInfo->GetNbElem();
 
     if(!isPointsLoaded){
-      VISU::TMesh::TPointsDim&  aPointsDim = theMesh.myPointsDim;
-      aPointsDim.resize(theMesh.myDim);
-      for(int iDim = 0; iDim < theMesh.myDim; iDim++)
+      VISU::TMeshImpl::TPointsDim&  aPointsDim = theMesh->myPointsDim;
+      aPointsDim.resize(theMesh->myDim);
+      for(int iDim = 0; iDim < theMesh->myDim; iDim++)
        aPointsDim[iDim] = aNodeInfo->GetCoordName(iDim);
       
-      VISU::TMesh::TPointsCoord& aPointsCoord = theMesh.myPointsCoord;
-      aPointsCoord.resize(aNbElem*theMesh.myDim);
+      VISU::TMeshImpl::TPointsCoord& aPointsCoord = theMesh->myPointsCoord;
+      aPointsCoord.resize(aNbElem*theMesh->myDim);
       for (int iElem = 0; iElem < aNbElem; iElem++) 
-       for(int iDim = 0, iElem2Dim = iElem*theMesh.myDim; iDim < theMesh.myDim; iDim++, iElem2Dim++)
+       for(int iDim = 0, iElem2Dim = iElem*theMesh->myDim; iDim < theMesh->myDim; iDim++, iElem2Dim++)
          aPointsCoord[iElem2Dim] = aNodeInfo->GetNodeCoord(iElem,iDim);
       
-      VISU::TMeshOnEntity::TConnForCellType& aConnForCellType = aMeshOnEntity.myCellsConn[VTK_VERTEX];
+      VISU::TMeshOnEntityImpl::TConnForCellType& aConnForCellType = aMeshOnEntity->myCellsConn[VTK_VERTEX];
       aConnForCellType.resize(aNbElem);
       for (int iElem = 0; iElem < aNbElem; iElem++)
-       aConnForCellType[iElem] = VISU::TMeshOnEntity::TConnect(1,iElem);
+       aConnForCellType[iElem] = VISU::TMeshOnEntityImpl::TConnect(1,iElem);
     }
-    if(isFamilyPresent && aNbElem > 0){
-      VISU::TFamily::TSubMeshOnCellType& aSubMeshOnCellType = aFamily.mySubMesh[VTK_VERTEX];
+    if(aFamily && aNbElem > 0){
+      VISU::TFamilyImpl::TSubMeshOnCellType& aSubMeshOnCellType = aFamily->mySubMesh[VTK_VERTEX];
       for (int iElem = 0; iElem < aNbElem; iElem++) 
-       if(aNodeInfo->GetElemNum(iElem) == aFamily.myId)
+       if(aNodeInfo->GetElemNum(iElem) == aFamily->myId)
          aSubMeshOnCellType.insert(iElem);
     }
     return 1;
   }catch(std::runtime_error& exc){
-    theMesh.myPointsCoord.clear();
+    theMesh->myPointsCoord.clear();
     throw;
   }catch(...){
-    theMesh.myPointsCoord.clear();
+    theMesh->myPointsCoord.clear();
     EXCEPTION(runtime_error,"Unknown exception !!!");
   }
   return 0;
@@ -517,31 +522,29 @@ VISU_MedConvertor::LoadPoints(const MED::PWrapper& theMed,
 
 int 
 VISU_MedConvertor::LoadCellsOnEntity(const MED::PWrapper& theMed, 
-                                    VISU::TMeshOnEntity& theMeshOnEntity,
+                                    VISU::PMEDMesh theMesh,
+                                    VISU::PMEDMeshOnEntity theMeshOnEntity,
                                     const string& theFamilyName)
 {
   try{
     //Check on existing family
-    VISU::TFamily* pFamily = VISU::GetFamily(theMeshOnEntity,theFamilyName);
-    bool isFamilyPresent = (pFamily != NULL);
-    VISU::TFamily& aFamily = *pFamily;
+    PFamilyImpl aFamily = GetFamily(theMeshOnEntity,theFamilyName);
     //Check on loading already done
-    bool isCellsLoaded = !theMeshOnEntity.myCellsConn.empty();
+    bool isCellsLoaded = !theMeshOnEntity->myCellsConn.empty();
     if(isCellsLoaded) 
-      if(!isFamilyPresent) return 0;
-      else if(!aFamily.mySubMesh.empty()) return 0;
+      if(!aFamily) 
+       return 0;
+      else if(!aFamily->mySubMesh.empty()) 
+       return 0;
 
     INITMSG(MYDEBUG,"LoadCellsOnEntity - theFamilyName = '"<<theFamilyName<<"'\n");
-    BEGMSG(MYDEBUG,"LoadCellsOnEntity - isCellsLoaded = "<<isCellsLoaded<<"; isFamilyPresent = "<<isFamilyPresent<<endl);
+    BEGMSG(MYDEBUG,"LoadCellsOnEntity - isCellsLoaded = "<<isCellsLoaded<<"; isFamilyPresent = "<<bool(aFamily)<<endl);
 
-    const VISU::TEntity& aVEntity = theMeshOnEntity.myEntity;
+    const VISU::TEntity& aVEntity = theMeshOnEntity->myEntity;
     const EEntiteMaillage& aMEntity = VTKEntityToMED(aVEntity);
-    const std::string& aMeshName = theMeshOnEntity.myMeshName;
-
-    VISU::TMesh& aMesh = myMeshMap[aMeshName];
-    const PMeshInfo& aMeshInfo = aMesh.myMeshInfo;
 
-    PNodeInfo aNodeInfo = theMed->GetPNodeInfo(aMesh.myMeshInfo);
+    const PMeshInfo& aMeshInfo = theMesh->myMeshInfo;
+    PNodeInfo aNodeInfo = theMed->GetPNodeInfo(aMeshInfo);
     TInt aNbPoints = aNodeInfo->GetNbElem();
 
     std::map<TInt,TInt> aNodeIdMap;
@@ -556,9 +559,9 @@ VISU_MedConvertor::LoadCellsOnEntity(const MED::PWrapper& theMed,
     }
 #endif
 
-    const MED::TGeom& aTGeom = theMeshOnEntity.myGeom;
+    const MED::TGeom& aTGeom = theMeshOnEntity->myGeom;
     MED::TGeom::const_iterator anTGeomIter = aTGeom.begin();
-    TMeshOnEntity::TCellsConn& aCellsConn = theMeshOnEntity.myCellsConn;
+    TMeshOnEntityImpl::TCellsConn& aCellsConn = theMeshOnEntity->myCellsConn;
 
     for(; anTGeomIter != aTGeom.end(); anTGeomIter++){
       const EGeometrieElement& aGeom = anTGeomIter->first;
@@ -569,14 +572,14 @@ VISU_MedConvertor::LoadCellsOnEntity(const MED::PWrapper& theMed,
       TInt aNbElem = aCellInfo->GetNbElem();
 
       if(!isCellsLoaded){
-       VISU::TMeshOnEntity::TConnForCellType& aConnForCellType = aCellsConn[aVTKGeomType];
+       VISU::TMeshOnEntityImpl::TConnForCellType& aConnForCellType = aCellsConn[aVTKGeomType];
        aConnForCellType.resize(aNbElem);
        
        int aMNbNodes = MEDGeom2NbNodes(aGeom);
        vector<TInt> aConnect(aMNbNodes);
 
        for (int iElem = 0; iElem < aNbElem; iElem++) {
-         VISU::TMeshOnEntity::TConnect& anArray = aConnForCellType[iElem];
+         VISU::TMeshOnEntityImpl::TConnect& anArray = aConnForCellType[iElem];
          anArray.resize(aVNbNodes);
 
          if(anIsNodeNum){
@@ -618,19 +621,19 @@ VISU_MedConvertor::LoadCellsOnEntity(const MED::PWrapper& theMed,
        }
       }
       //Filling aFamily SubMesh
-      if(isFamilyPresent){
-       VISU::TFamily::TSubMeshOnCellType& aSubMeshOnCellType = aFamily.mySubMesh[aVTKGeomType];
+      if(aFamily){
+       VISU::TFamilyImpl::TSubMeshOnCellType& aSubMeshOnCellType = aFamily->mySubMesh[aVTKGeomType];
        for(int iElem = 0; iElem < aNbElem; iElem++) 
-         if(aCellInfo->GetFamNum(iElem) == aFamily.myId)
+         if(aCellInfo->GetFamNum(iElem) == aFamily->myId)
            aSubMeshOnCellType.insert(iElem);
       }
     }
     return 1;
   }catch(std::runtime_error& exc){
-    theMeshOnEntity.myCellsConn.clear();
+    theMeshOnEntity->myCellsConn.clear();
     throw;
   }catch(...){
-    theMeshOnEntity.myCellsConn.clear();
+    theMeshOnEntity->myCellsConn.clear();
     EXCEPTION(runtime_error,"Unknown exception !!!");
   }
   return 0;
@@ -638,41 +641,41 @@ VISU_MedConvertor::LoadCellsOnEntity(const MED::PWrapper& theMed,
 
 
 int 
-VISU_MedConvertor::LoadField(const MED::PWrapper& theMed, 
-                            const VISU::TMeshOnEntity& theMeshOnEntity,
-                            VISU::TField& theField, 
-                            VISU::TField::TValForTime& theValForTime)
+VISU_MedConvertor::LoadField(const MED::PWrapper& theMed,
+                            VISU::PMEDMesh theMesh,
+                            VISU::PMEDMeshOnEntity theMeshOnEntity,
+                            VISU::PMEDField theField, 
+                            VISU::PMEDValForTime theValForTime)
 {
   //Check on loading already done
-  if(!theValForTime.myValForCells.empty()) return 0;
+  if(!theValForTime->myValForCells.empty()) return 0;
 
   //Main part of code
-  const std::string& aMeshName = theMeshOnEntity.myMeshName;
-  VISU::TMesh& aMesh = myMeshMap[aMeshName];
-  const PMeshInfo& aMeshInfo = aMesh.myMeshInfo;
-  PFieldInfo aFieldInfo = theMed->GetPFieldInfo(aMeshInfo,theField.myId);
+  const std::string& aMeshName = theMeshOnEntity->myMeshName;
+  const PMeshInfo& aMeshInfo = theMesh->myMeshInfo;
+  PFieldInfo aFieldInfo = theMed->GetPFieldInfo(aMeshInfo,theField->myId);
 
   MED::TGeom aTGeom;
   EEntiteMaillage aMEntity;
-  theMed->GetNbTimeStamps(aFieldInfo,aMesh.myEntityInfo,aMEntity,aTGeom);
+  theMed->GetNbTimeStamps(aFieldInfo,theMesh->myEntityInfo,aMEntity,aTGeom);
 
   PTimeStampInfo aTimeStampInfo = theMed->GetPTimeStampInfo(aFieldInfo,
                                                            aMEntity,
                                                            aTGeom,
-                                                           theValForTime.myId);
+                                                           theValForTime->myId);
   TInt aNbGauss = aTimeStampInfo->GetNbGauss();
-  TInt aNbComp = theField.myNbComp;
+  TInt aNbComp = theField->myNbComp;
 
   PTimeStampVal aTimeStampVal = theMed->GetPTimeStampVal(aTimeStampInfo);
 
   INITMSG(MYDEBUG,"LoadField - aMeshName = '"<<aMeshName<<
          "'; aFieldName = '"<<aFieldInfo->GetName()<<
          "'; aMEntity = "<<aMEntity<<
-         "; anId = "<<theValForTime.myId<<endl);
+         "; anId = "<<theValForTime->myId<<endl);
   BEGMSG(MYDEBUG,"LoadField - aNbComp = "<<aNbComp<<
         "; aNbGauss = "<<aNbGauss<<endl);
 
-  const MED::TGeom& anEntityTGeom = theMeshOnEntity.myGeom;
+  const MED::TGeom& anEntityTGeom = theMeshOnEntity->myGeom;
   MED::TGeom::const_iterator aTGeomIter = anEntityTGeom.begin();
   for(; aTGeomIter != anEntityTGeom.end(); aTGeomIter++){
     const EGeometrieElement& aGeom = aTGeomIter->first;
@@ -681,11 +684,11 @@ VISU_MedConvertor::LoadField(const MED::PWrapper& theMed,
     INITMSG(MYDEBUG,"LoadField - aGeom = "<<aGeom<<"; aNbElem = '"<<aNbElem<<endl);
 
     if(aTGeom.find(aGeom) == aTGeom.end()){
-      theField.myDataSize -= aNbElem*theField.myNbComp;
-      theField.myIsTrimmed = true;
+      theField->myDataSize -= aNbElem*theField->myNbComp;
+      theField->myIsTrimmed = true;
     }else{
       int aVTKGeomType = MEDGeomToVTK(aGeom);
-      VISU::TField::TValForCellsWithType& anArray = theValForTime.myValForCells[aVTKGeomType];
+      VISU::TValForTimeImpl::TValForCellsWithType& anArray = theValForTime->myValForCells[aVTKGeomType];
       anArray.resize(aNbComp*aNbElem);
       for(TInt iElem = 0, anId = 0; iElem < aNbElem; iElem++){
        for(TInt iComp = 0; iComp < aNbComp; iComp++, anId++){
index 74b28310e1ef0f7a1f14348010dddacacc05f99f..c93ac3412872831635a548142ec02d8cc3569446 100644 (file)
 
 #include "VISU_Convertor_impl.hxx"
 
+#include "MED_Common.hxx"
+
+namespace VISU{
+
+  struct TMEDMesh: TMeshImpl{
+    MED::PMeshInfo myMeshInfo;
+    MED::TEntityInfo myEntityInfo;
+  };
+  typedef shared_ptr<TMEDMesh> PMEDMesh;
+
+  struct TMEDMeshOnEntity: TMeshOnEntityImpl{
+    MED::TGeom myGeom;
+  };
+  typedef shared_ptr<TMEDMeshOnEntity> PMEDMeshOnEntity;
+
+  struct TMEDFamily: TFamilyImpl{
+  };
+  typedef shared_ptr<TMEDFamily> PMEDFamily;
+  
+  struct TMEDGroup: TGroupImpl{
+  };
+  typedef shared_ptr<TMEDGroup> PMEDGroup;
+
+  struct TMEDField: TFieldImpl{
+  };
+  typedef shared_ptr<TMEDField> PMEDField;
+
+  struct TMEDValForTime: TValForTimeImpl{
+  };
+  typedef shared_ptr<TMEDValForTime> PMEDValForTime;
+
+}
+
 class VISU_MedConvertor: public VISU_Convertor_impl{
   VISU_MedConvertor();
   VISU_MedConvertor(const VISU_MedConvertor&);
@@ -20,29 +53,31 @@ public:
 protected:
   QFileInfo myFileInfo;
 
-  virtual int LoadMeshOnEntity(VISU::TMeshOnEntity& theMeshOnEntity, 
+  virtual int LoadMeshOnEntity(VISU::PMeshOnEntityImpl theMeshOnEntity, 
                               const std::string& theFamilyName = "");
 
-  virtual int LoadMeshOnGroup(VISU::TMesh& theMesh, 
+  virtual int LoadMeshOnGroup(VISU::PMeshImpl theMesh, 
                              const VISU::TFamilyAndEntitySet& theFamilyAndEntitySet);
 
-  virtual int LoadFieldOnMesh(VISU::TMesh& theMesh, 
-                             VISU::TMeshOnEntity& theMeshOnEntity, 
-                             VISU::TField& theField, 
-                             VISU::TField::TValForTime& theValForTime);
+  virtual int LoadFieldOnMesh(VISU::PMeshImpl theMesh, 
+                             VISU::PMeshOnEntityImpl theMeshOnEntity, 
+                             VISU::PFieldImpl theField, 
+                             VISU::PValForTimeImpl theValForTime);
   
   int LoadPoints(const MED::PWrapper& theMed,
-                VISU::TMesh& theMesh, 
+                VISU::PMEDMesh theMesh, 
                 const std::string& theFamilyName = "");
 
   int LoadCellsOnEntity(const MED::PWrapper& theMed,
-                       VISU::TMeshOnEntity& theMeshOnEntity,
+                       VISU::PMEDMesh theMesh,
+                       VISU::PMEDMeshOnEntity theMeshOnEntity,
                        const std::string& theFamilyName = "");
   
   int LoadField(const MED::PWrapper& theMed,
-               const VISU::TMeshOnEntity& theMeshOnEntity,
-               VISU::TField& theField, 
-               VISU::TField::TValForTime& theValForTime);
+               VISU::PMEDMesh theMesh,
+               VISU::PMEDMeshOnEntity theMeshOnEntity,
+               VISU::PMEDField theField, 
+               VISU::PMEDValForTime theValForTime);
   
 };
 
index 7f0b646b87ec1ec01f2aa62cd3fb0a327155f21b..6595ae839612ab43a52db4e9d76947c31722f8da 100644 (file)
@@ -65,8 +65,8 @@ int main(int argc, char** argv){
       VISU::TMeshMap::const_iterator aMeshMapIter = aMeshMap.begin();
       if(aMeshMapIter == aMeshMap.end()) return 0;
       const string& aMeshName = aMeshMapIter->first;
-      const VISU::TMesh& aMesh = aMeshMapIter->second;
-      const VISU::TMeshOnEntityMap& aMeshOnEntityMap = aMesh.myMeshOnEntityMap;
+      const VISU::PMesh aMesh = aMeshMapIter->second;
+      const VISU::TMeshOnEntityMap& aMeshOnEntityMap = aMesh->myMeshOnEntityMap;
       VISU::TMeshOnEntityMap::const_iterator aMeshOnEntityMapIter;
       if(isOnlyMesh){
        const VISU::TEntity& anEntity = VISU::CELL_ENTITY;
@@ -92,15 +92,15 @@ int main(int argc, char** argv){
       aMeshOnEntityMapIter = aMeshOnEntityMap.begin();
       for(; aMeshOnEntityMapIter != aMeshOnEntityMap.end(); aMeshOnEntityMapIter++) {
        const VISU::TEntity& anEntity = aMeshOnEntityMapIter->first;
-       const VISU::TMeshOnEntity& aMeshOnEntity = aMeshOnEntityMapIter->second;
-       const VISU::TFieldMap& aFieldMap = aMeshOnEntity.myFieldMap;
+       const VISU::PMeshOnEntity aMeshOnEntity = aMeshOnEntityMapIter->second;
+       const VISU::TFieldMap& aFieldMap = aMeshOnEntity->myFieldMap;
        VISU::TFieldMap::const_iterator aFieldMapIter = aFieldMap.begin();
        for(; aFieldMapIter != aFieldMap.end(); aFieldMapIter++){
-         const VISU::TField& aField = aFieldMapIter->second;
-         if(aField.myNbComp == 1) continue;
+         const VISU::PField aField = aFieldMapIter->second;
+         if(aField->myNbComp == 1) continue;
          const string& aFieldName = aFieldMapIter->first;
-         const VISU::TField::TValField& aValField = aField.myValField;
-         VISU::TField::TValField::const_iterator aValFieldIter = aValField.begin();
+         const VISU::TValField& aValField = aField->myValField;
+         VISU::TValField::const_iterator aValFieldIter = aValField.begin();
          if(aValFieldIter == aValField.end()) return 0;
          int aTimeStamp = aValFieldIter->first;
          vtkUnstructuredGrid* aDataSet = aConvertor->GetTimeStampOnMesh(aMeshName,anEntity,aFieldName,aTimeStamp);
index b33369835494c1fae23c87c8a9ac90a412ef5799..464abb14e612b35ee67d465299488f2b7a443364 100644 (file)
 //  Copyright (C) 2003  CEA/DEN, EDF R&D
 
 #include "VISU_CorbaMedConvertor.hxx"
-#include "VISU_ConvertorUtils.hxx"
 
-#include <valarray>    
 #include <vtkCellType.h>
 
 #include <boost/tuple/tuple.hpp>
 
 using namespace std;
+using namespace VISU;
 
 #define USER_INTERLACE MED_FULL_INTERLACE
 
 #ifdef _DEBUG_
-static int MYDEBUG = 0;
+static int MYDEBUG = 1;
 #else
 static int MYDEBUG = 0;
 #endif
@@ -56,7 +55,6 @@ extern "C" {
 
 namespace{
   using namespace SALOME_MED;
-  using namespace VISU;
   
   const int MED_NBR_GEOMETRIE_MAILLE = 15;
   
@@ -267,26 +265,27 @@ namespace{
   
   
   void
-  GetCellsSize(VISU::TMesh& theMesh, 
+  GetCellsSize(VISU::PCMesh theMesh, 
               SALOME_MED::MESH_ptr theMEDMesh, 
               const VISU::TEntity& theEntity)
   {
-    VISU::TMeshOnEntity& aMeshOnEntity = theMesh.myMeshOnEntityMap[theEntity];
-    if(theEntity == VISU::NODE_ENTITY){
-      theMesh.myNbPoints = theMEDMesh->getNumberOfNodes();
-      aMeshOnEntity.myNbCells = theMesh.myNbPoints;
-      aMeshOnEntity.myCellsSize = 2*theMesh.myNbPoints;
+    TMeshOnEntityMap& aMeshOnEntityMap = theMesh->myMeshOnEntityMap;
+    VISU::PCMeshOnEntity aMeshOnEntity = aMeshOnEntityMap[theEntity];
+    if(theEntity == NODE_ENTITY){
+      theMesh->myNbPoints = theMEDMesh->getNumberOfNodes();
+      aMeshOnEntity->myNbCells = theMesh->myNbPoints;
+      aMeshOnEntity->myCellsSize = 2*theMesh->myNbPoints;
       vtkIdType aNbCells, aCellsSize;
-      GetCellsSize(aNbCells,aCellsSize,theMEDMesh,VISU::CELL_ENTITY);
+      GetCellsSize(aNbCells,aCellsSize,theMEDMesh,CELL_ENTITY);
       if(aNbCells > 0){
-       VISU::TMeshOnEntity& aMeshOnCells = theMesh.myMeshOnEntityMap[VISU::CELL_ENTITY];
-       aMeshOnCells.myEntity = VISU::CELL_ENTITY;
-       aMeshOnCells.myMeshName = theMesh.myName;
-       aMeshOnCells.myNbCells = aNbCells;
-       aMeshOnCells.myCellsSize = aCellsSize;
+       PCMeshOnEntity aMeshOnCells = aMeshOnEntityMap[CELL_ENTITY];
+       aMeshOnCells->myEntity = VISU::CELL_ENTITY;
+       aMeshOnCells->myMeshName = theMesh->myName;
+       aMeshOnCells->myNbCells = aNbCells;
+       aMeshOnCells->myCellsSize = aCellsSize;
       }
     }else
-      GetCellsSize(aMeshOnEntity.myNbCells,aMeshOnEntity.myCellsSize,theMEDMesh,theEntity);
+      GetCellsSize(aMeshOnEntity->myNbCells,aMeshOnEntity->myCellsSize,theMEDMesh,theEntity);
   }
   
 }
@@ -301,53 +300,68 @@ VISU_MEDFieldConvertor::Build()
   SALOME_MED::SUPPORT_var aMEDSupport = myField->getSupport();
   if(aMEDSupport->_is_nil()) 
     throw std::runtime_error("VISU_MEDFieldConvertor::Build >> aMEDSupport->_is_nil() !!!");
+
   SALOME_MED::medEntityMesh aMEntity = aMEDSupport->getEntity();
-  VISU::TEntity aVEntity = MEDEntityToVTK(aMEntity);
+  TEntity aVEntity = MEDEntityToVTK(aMEntity);
   SALOME_MED::MESH_var aMEDMesh = aMEDSupport->getMesh();
   if(aMEDMesh->_is_nil()) 
     throw std::runtime_error("VISU_MEDFieldConvertor::Build >> aMEDMesh->_is_nil() !!!");
+
   CORBA::String_var aMeshName = aMEDMesh->getName();
   CORBA::String_var aFieldName = myField->getName();
 
-  VISU::TMesh &aMesh = myMeshMap[aMeshName.in()];
-  aMesh.myDim = aMEDMesh->getSpaceDimension();
-  aMesh.myPointsDim.resize(aMesh.myDim);
-  aMesh.myName = aMeshName.in();
-  VISUMED::TMesh &aMesh2 = myMeshMap2[aMeshName.in()];
-  aMesh2.myMesh = aMEDMesh;
-  if(MYDEBUG) MESSAGE("VISU_MEDFieldConvertor::Build - aMeshName = "<<aMeshName<<"; myDim = "<<aMesh.myDim);
-
-  VISU::TMeshOnEntity& aMeshOnEntity = aMesh.myMeshOnEntityMap[aVEntity];
-  aMeshOnEntity.myEntity = aVEntity;
-  aMeshOnEntity.myMeshName = aMeshName.in();
-  VISUMED::TMeshOnEntity& aMeshOnEntity2 = aMesh2.myMeshOnEntityMap[aVEntity];
-  aMeshOnEntity2.mySupport = aMEDSupport;
-  if(aVEntity == VISU::NODE_ENTITY)
-    aMesh2.myMeshOnEntityMap[VISU::CELL_ENTITY].mySupport = aMEDSupport;
+  PCMesh aMesh = myMeshMap[aMeshName.in()](new TCMesh());
+  aMesh->myDim = aMEDMesh->getSpaceDimension();
+  aMesh->myPointsDim.resize(aMesh->myDim);
+  aMesh->myName = aMeshName.in();
+  aMesh->myMesh = aMEDMesh;
+
+  if(MYDEBUG) MESSAGE("VISU_MEDFieldConvertor::Build - aMeshName = "<<aMeshName<<"; myDim = "<<aMesh->myDim);
+
+  TMeshOnEntityMap& aMeshOnEntityMap = aMesh->myMeshOnEntityMap;
+  PCMeshOnEntity aMeshOnEntity = aMeshOnEntityMap[aVEntity](new TCMeshOnEntity());
+  aMeshOnEntity->myEntity = aVEntity;
+  aMeshOnEntity->myMeshName = aMeshName.in();
+  aMeshOnEntity->mySupport = aMEDSupport;
+
+  if(aVEntity == NODE_ENTITY){
+    PCMeshOnEntity aMeshOnEntity2 = aMeshOnEntityMap[CELL_ENTITY](new TCMeshOnEntity());
+    *aMeshOnEntity2 = *aMeshOnEntity;
+    aMeshOnEntity->myEntity = CELL_ENTITY;
+    GetCellsSize(aMesh,aMEDMesh,CELL_ENTITY);
+  }else{
+    PCMeshOnEntity aMeshOnEntity2 = aMeshOnEntityMap[NODE_ENTITY](new TCMeshOnEntity());
+    *aMeshOnEntity2 = *aMeshOnEntity;
+    aMeshOnEntity->myEntity = NODE_ENTITY;
+    GetCellsSize(aMesh,aMEDMesh,NODE_ENTITY);
+  }
   GetCellsSize(aMesh,aMEDMesh,aVEntity);
 
-  VISU::TField& aField = aMeshOnEntity.myFieldMap[aFieldName.in()];
-  aField.myId = myField->getOrderNumber();
-  aField.myName = aFieldName.in();
-  aField.myEntity = aVEntity;
-  aField.myMeshName = aMeshName.in();
-  aField.myNbComp = myField->getNumberOfComponents();
-  aField.myNbValField = 1;
-  aField.myDataSize = aMeshOnEntity.myNbCells * aField.myNbComp;
-  aField.myCompNames.resize(aField.myNbComp);
-  aField.myUnitNames.resize(aField.myNbComp);
-  if(MYDEBUG) MESSAGE("VISU_MEDFieldConvertor::Build - aMeshName = "<<aMeshName<<"; myDim = "<<aMesh.myDim);
-  int iTimeStamp = myField->getIterationNumber();
-  VISU::TField::TValForTime& aValForTime = aField.myValField[iTimeStamp];
-  aValForTime.myId = iTimeStamp;
-  double dt = myField->getTime();
-  aValForTime.myTime = VISU::TField::TTime(dt,"");
-  
-  VISUMED::TField& aField2 = aMeshOnEntity2.myFieldMap[aFieldName.in()];
-  VISUMED::TField::TValForTime& aValForTime2 = aField2.myValField[iTimeStamp];
-  aValForTime2.myField = myField;
+  TFieldMap& aFieldMap = aMeshOnEntity->myFieldMap;
+  PCField aField = aFieldMap[aFieldName.in()](new TCField());
+  aField->myId = myField->getOrderNumber();
+  aField->myName = aFieldName.in();
+  aField->myEntity = aVEntity;
+  aField->myMeshName = aMeshName.in();
+  aField->myNbComp = myField->getNumberOfComponents();
+  aField->myDataSize = aMeshOnEntity->myNbCells * aField->myNbComp;
+  aField->myCompNames.resize(aField->myNbComp);
+  aField->myUnitNames.resize(aField->myNbComp);
+
+  if(MYDEBUG) MESSAGE("VISU_MEDFieldConvertor::Build - aMeshName = "<<aMeshName<<"; myDim = "<<aMesh->myDim);
+
+  TValField& aValField = aField->myValField;
+  int anId = myField->getIterationNumber();
+  PCValForTime aValForTime = aValField[anId](new TCValForTime());
+  aValForTime->myId = anId;
+  CORBA::Double aDT = myField->getTime();
+  aValForTime->myTime = TTime(aDT,"");
+  aValForTime->myField = myField;
+
   if(MYDEBUG) 
-    MESSAGE("VISU_MEDFieldConvertor::Build - aFieldName = '"<<aFieldName<<"'; myId = "<<aField.myId<<"; myTime = "<<dt);
+    MESSAGE("VISU_MEDFieldConvertor::Build - aFieldName = '"<<aFieldName<<
+           "'; myId = "<<anId<<"; myTime = "<<aDT);
+
   return this;
 }
 
@@ -467,15 +481,15 @@ VISU_MEDConvertor::Build(SALOME_MED::MED_ptr theMED)
       if(!anIsSuccess)
        continue;
 
-      VISU::TMesh &aMesh = myMeshMap[aMeshName.in()];
+      PCMesh aMesh = myMeshMap[aMeshName.in()](new TCMesh());
       SALOME_MED::MESH_var aMEDMesh = boost::get<0>(aMeshByNameRet);
-      aMesh.myDim = aMEDMesh->getSpaceDimension();
-      aMesh.myName = aMeshName.in();
-      aMesh.myPointsDim.resize(aMesh.myDim);
-      VISUMED::TMesh &aMesh2 = myMeshMap2[aMeshName.in()];
-      aMesh2.myMesh = aMEDMesh;
+      aMesh->myDim = aMEDMesh->getSpaceDimension();
+      aMesh->myName = aMeshName.in();
+      aMesh->myPointsDim.resize(aMesh->myDim);
+      aMesh->myMesh = aMEDMesh;
 
-      if(MYDEBUG) MESSAGE("VISU_MEDConvertor::Build - aMeshName = "<<aMeshName<<"; myDim = "<<aMesh.myDim);
+      if(MYDEBUG) 
+       MESSAGE("VISU_MEDConvertor::Build - aMeshName = "<<aMeshName<<"; myDim = "<<aMesh->myDim);
 
       anIsSuccess = false;
       std::ostringstream aStream;
@@ -486,8 +500,11 @@ VISU_MEDConvertor::Build(SALOME_MED::MED_ptr theMED)
       if(!anIsSuccess)
        continue;
 
+      TMeshOnEntityMap& aMeshOnEntityMap = aMesh->myMeshOnEntityMap;
       SALOMEDS::SObject_var aSupportsSObj = boost::get<0>(aSObjectByNameRet);
       SALOMEDS::ChildIterator_var aSupportIterator = aStudy->NewChildIterator(aSupportsSObj);
+
+      // Fill all MeshOnEntity
       aSupportIterator->InitEx(true);
       for(; aSupportIterator->More(); aSupportIterator->Next()){
        SALOMEDS::SObject_var aSupportSObj = aSupportIterator->Value();
@@ -509,25 +526,41 @@ VISU_MEDConvertor::Build(SALOME_MED::MED_ptr theMED)
          if(MYDEBUG) MESSAGE("VISU_MEDConvertor::Build - Support isOnAllElements = '"<<aSupportName<<"' aVEntity = "<<aVEntity);
          int aNbCells, aCellsSize;
          //Check, if there is any data on the support?
-         if(aVEntity == VISU::NODE_ENTITY){
-           aMesh.myNbPoints = aMeshOnSupport->getNumberOfNodes();
-           aNbCells = aMesh.myNbPoints;
-           aCellsSize = 2*aMesh.myNbPoints;
+         if(aVEntity == NODE_ENTITY){
+           aMesh->myNbPoints = aMeshOnSupport->getNumberOfNodes();
+           aNbCells = aMesh->myNbPoints;
+           aCellsSize = 2*aMesh->myNbPoints;
          }else
            GetCellsSize(aNbCells,aCellsSize,aMeshOnSupport,aVEntity);
          
          if(aNbCells > 0){
-           VISU::TMeshOnEntity& aMeshOnEntity = aMesh.myMeshOnEntityMap[aVEntity];
-           aMeshOnEntity.myMeshName = aMeshName.in();
-           aMeshOnEntity.myEntity = aVEntity;
-           aMeshOnEntity.myNbCells = aNbCells;
-           aMeshOnEntity.myCellsSize = aCellsSize;
-           
-           VISUMED::TMeshOnEntity& aMeshOnEntity2 = aMesh2.myMeshOnEntityMap[aVEntity];
-           aMeshOnEntity2.mySupport = aMEDSupport;
+           PCMeshOnEntity aMeshOnEntity = aMeshOnEntityMap[aVEntity](new TCMeshOnEntity());
+           aMeshOnEntity->myMeshName = aMeshName.in();
+           aMeshOnEntity->myEntity = aVEntity;
+           aMeshOnEntity->myNbCells = aNbCells;
+           aMeshOnEntity->myCellsSize = aCellsSize;
+           aMeshOnEntity->mySupport = aMEDSupport;
          }
-         continue;
        }
+      }
+
+      // Fill all Family
+      aSupportIterator->InitEx(true);
+      for(; aSupportIterator->More(); aSupportIterator->Next()){
+       SALOMEDS::SObject_var aSupportSObj = aSupportIterator->Value();
+       
+       CORBA::Object_var aMedSupport = VISU::SObjectToObject(aSupportSObj);
+       if(CORBA::is_nil(aMedSupport)) 
+         continue;
+       
+       SALOME_MED::SUPPORT_var aMEDSupport = SALOME_MED::SUPPORT::_narrow(aMedSupport); 
+       if(aMEDSupport->_is_nil()) 
+         continue;
+       
+       SALOME_MED::MESH_var aMeshOnSupport = aMEDSupport->getMesh();
+       SALOME_MED::medEntityMesh aMEntity = aMEDSupport->getEntity();
+       VISU::TEntity aVEntity = MEDEntityToVTK(aMEntity);
+       CORBA::String_var aSupportName = aMEDSupport->getName();
        
        SALOME_MED::FAMILY_var aMEDFamily = SALOME_MED::FAMILY::_narrow(aMedSupport);
        if(!aMEDFamily->_is_nil()) {
@@ -535,39 +568,59 @@ VISU_MEDConvertor::Build(SALOME_MED::MED_ptr theMED)
          GetCellsSize(aNbCells,aCellsSize,aMEDFamily);
          if(aNbCells > 0){
            if(MYDEBUG) MESSAGE("VISU_MEDConvertor::Build - aFamily = '"<<aSupportName<<"' aVEntity = "<<aVEntity);
-           VISU::TMeshOnEntity& aMeshOnEntity = aMesh.myMeshOnEntityMap[aVEntity];
-           VISU::TFamily& aFamily = aMeshOnEntity.myFamilyMap[aSupportName.in()];
-           aFamily.myName = aSupportName.in();
-           aFamily.myEntity = aVEntity;
-           aFamily.myNbCells = aNbCells;
-           aFamily.myCellsSize = aCellsSize;
-           aFamily.myId = aMEDFamily->getIdentifier();
-           
-           VISUMED::TMeshOnEntity& aMeshOnEntity2 = aMesh2.myMeshOnEntityMap[aVEntity];
-           VISUMED::TFamily& aFamily2 = aMeshOnEntity2.myFamilyMap[aSupportName.in()];
-           aFamily2.myFamily = aMEDFamily;
+           TMeshOnEntityMap::iterator aMeshOnEntityMapIter = aMeshOnEntityMap.find(aVEntity);
+           if(aMeshOnEntityMapIter == aMeshOnEntityMap.end())
+             continue;
+
+           PCMeshOnEntity aMeshOnEntity = aMeshOnEntityMapIter->second;
+           TFamilyMap& aFamilyMap = aMeshOnEntity->myFamilyMap;
+           PCFamily aFamily = aFamilyMap[aSupportName.in()](new TCFamily());
+           aFamily->myName = aSupportName.in();
+           aFamily->myEntity = aVEntity;
+           aFamily->myNbCells = aNbCells;
+           aFamily->myCellsSize = aCellsSize;
+           aFamily->myId = aMEDFamily->getIdentifier();
+           aFamily->myFamily = aMEDFamily;
          }
-         continue;
        }
+      }
+       
+      // Fill all Groups
+      aSupportIterator->InitEx(true);
+      for(; aSupportIterator->More(); aSupportIterator->Next()){
+       SALOMEDS::SObject_var aSupportSObj = aSupportIterator->Value();
+       
+       CORBA::Object_var aMedSupport = VISU::SObjectToObject(aSupportSObj);
+       if(CORBA::is_nil(aMedSupport)) 
+         continue;
+       
+       SALOME_MED::SUPPORT_var aMEDSupport = SALOME_MED::SUPPORT::_narrow(aMedSupport); 
+       if(aMEDSupport->_is_nil()) 
+         continue;
+       
+       SALOME_MED::MESH_var aMeshOnSupport = aMEDSupport->getMesh();
+       SALOME_MED::medEntityMesh aMEntity = aMEDSupport->getEntity();
+       VISU::TEntity aVEntity = MEDEntityToVTK(aMEntity);
+       CORBA::String_var aSupportName = aMEDSupport->getName();
        
        SALOME_MED::GROUP_var aMEDGroup = SALOME_MED::GROUP::_narrow(aMedSupport);
        if(!aMEDGroup->_is_nil()){
          if(MYDEBUG) MESSAGE("VISU_MEDConvertor::Build - aGroup = '"<<aSupportName<<"' aVEntity = "<<aVEntity);
-         VISUMED::TGroupMap& aGroupMap2 = aMesh2.myGroupMap;
-         VISUMED::TGroup& aGroup2 = aGroupMap2[aSupportName.in()];
-         aGroup2.myGroup = aMEDGroup;
+         TGroupMap& aGroupMap = aMesh->myGroupMap;
+         PCGroup aGroup = aGroupMap[aSupportName.in()](new TCGroup());
+         aGroup->myGroup = aMEDGroup;
          SALOME_MED::Family_array_var aFamilies = aMEDGroup->getFamilies();
          int iFamilyEnd = aFamilies->length();
          for(int iFamaily = 0; iFamaily < iFamilyEnd; iFamaily++){
-           aMEDFamily = aFamilies[iFamaily];
+           SALOME_MED::FAMILY_var aMEDFamily = aFamilies[iFamaily];
            CORBA::String_var aFamilyName = aMEDFamily->getName();
-           VISU::TMeshOnEntity& aMeshOnEntity = aMesh.myMeshOnEntityMap[aVEntity];
            if(MYDEBUG) MESSAGE("VISU_MEDConvertor::Build - aGroup - aFamilyName = '"<<aFamilyName.in()<<"'");
-           VISU::TFamily& aFamily = aMeshOnEntity.myFamilyMap[aFamilyName.in()];
-           VISU::TBindGroups& aBindGroups = aFamily.myGroups;
-           aBindGroups.insert(aSupportName.in());
+           PFamily aFamily = FindFamily(aMesh,aFamilyName.in());
+           if(aFamily){
+             VISU::TBindGroups& aBindGroups = aFamily->myGroups;
+             aBindGroups.insert(aSupportName.in());
+           }
          }
-         continue;
        }
       }
     }
@@ -583,7 +636,7 @@ VISU_MEDConvertor::Build(SALOME_MED::MED_ptr theMED)
       SALOMEDS::SObject_var aFieldSObj = aFieldIterator->Value();
       if(MYDEBUG) MESSAGE("VISU_MEDConvertor::Build - aFieldName = '"<<GetSObjectName(aFieldSObj)<<"'");
       SALOMEDS::ChildIterator_var aTimeStampIterator = aStudy->NewChildIterator(aFieldSObj);
-      for(int iTimeStamp = 1; aTimeStampIterator->More(); aTimeStampIterator->Next(), iTimeStamp++){
+      for(; aTimeStampIterator->More(); aTimeStampIterator->Next()){
        SALOMEDS::SObject_var aTimeStampSObj = aTimeStampIterator->Value();
        if(MYDEBUG) MESSAGE("VISU_MEDConvertor::Build - aTimeStampSObj = '"<<GetSObjectName(aTimeStampSObj)<<"'");
        CORBA::Object_var aMedField = VISU::SObjectToObject(aTimeStampSObj);
@@ -607,48 +660,45 @@ VISU_MEDConvertor::Build(SALOME_MED::MED_ptr theMED)
        CORBA::String_var aMeshName = aMEDMesh->getName();
        CORBA::String_var aFieldName = aMEDField->getName();
        
-       VISU::TMeshMap::iterator aMeshMapIter = myMeshMap.find(aMeshName.in());
+       TMeshMap::iterator aMeshMapIter = myMeshMap.find(aMeshName.in());
        if(aMeshMapIter == myMeshMap.end())
          continue;
 
-       VISU::TMesh &aMesh = aMeshMapIter->second;
-       aMesh.myDim = aMEDMesh->getSpaceDimension();
-       aMesh.myName = aMeshName.in();
-       VISUMED::TMesh &aMesh2 = myMeshMap2[aMeshName.in()];
-       aMesh2.myMesh = aMEDMesh;
-       
-       VISU::TMeshOnEntity& aMeshOnEntity = aMesh.myMeshOnEntityMap[anEntity];
-       aMeshOnEntity.myEntity = anEntity;
-       aMeshOnEntity.myMeshName = aMeshName.in();
-       VISUMED::TMeshOnEntity& aMeshOnEntity2 = aMesh2.myMeshOnEntityMap[anEntity];
-       aMeshOnEntity2.mySupport = aMEDSupport;
-       if(anEntity == VISU::NODE_ENTITY)
-         aMesh2.myMeshOnEntityMap[VISU::CELL_ENTITY].mySupport = aMEDSupport;
-       GetCellsSize(aMesh,aMEDMesh,anEntity);
-       
-       VISU::TField& aField = aMeshOnEntity.myFieldMap[aFieldName.in()];
-       aField.myId = iField;
-       aField.myName = aFieldName.in();
-       aField.myEntity = anEntity;
-       aField.myMeshName = aMeshName.in();
-       aField.myNbComp = aMEDField->getNumberOfComponents();
-       aField.myNbValField = iTimeStamp;
-       aField.myDataSize = aMeshOnEntity.myNbCells * aField.myNbComp;
-       if(MYDEBUG && !iTimeStamp) 
-         MESSAGE("VISU_MEDConvertor::Build - aMeshOnEntity.myNbCells = "<<aMeshOnEntity.myNbCells);
-       aField.myCompNames.resize(aField.myNbComp);
-       aField.myUnitNames.resize(aField.myNbComp);
-       
+       PCMesh aMesh = aMeshMapIter->second;
+       TMeshOnEntityMap& aMeshOnEntityMap = aMesh->myMeshOnEntityMap;
+       TMeshOnEntityMap::iterator aMeshOnEntityMapIter = aMeshOnEntityMap.find(anEntity);
+       if(aMeshOnEntityMapIter == aMeshOnEntityMap.end())
+         continue;
+
+       PCMeshOnEntity aMeshOnEntity = aMeshOnEntityMapIter->second;
+       TFieldMap& aFieldMap = aMeshOnEntity->myFieldMap;
+       TFieldMap::iterator aFieldMapIter = aFieldMap.find(aFieldName.in());
+       PCField aField;
+       if(aFieldMapIter == aFieldMap.end()){
+         aField = aFieldMap[aFieldName.in()](new TCField());
+         aField->myId = iField;
+         aField->myName = aFieldName.in();
+         aField->myEntity = anEntity;
+         aField->myMeshName = aMeshName.in();
+         aField->myNbComp = aMEDField->getNumberOfComponents();
+         aField->myDataSize = aMeshOnEntity->myNbCells * aField->myNbComp;
+         if(MYDEBUG) 
+           MESSAGE("VISU_MEDConvertor::Build - aMeshOnEntity->myNbCells = "<<aMeshOnEntity->myNbCells);
+         aField->myCompNames.resize(aField->myNbComp);
+         aField->myUnitNames.resize(aField->myNbComp);
+       }else
+         aField = aFieldMapIter->second;
+
+       TValField& aValField = aField->myValField;
        int anId = aMEDField->getIterationNumber();
-       VISU::TField::TValForTime& aValForTime = aField.myValField[anId];
-       aValForTime.myId = anId;
-       aValForTime.myTime = VISU::TField::TTime(aMEDField->getTime(),"");
-       VISUMED::TField& aField2 = aMeshOnEntity2.myFieldMap[aFieldName.in()];
-       VISUMED::TField::TValForTime& aValForTime2 = aField2.myValField[anId];
-       aValForTime2.myField = aMEDField;
+       PCValForTime aValForTime = aValField[anId](new TCValForTime());
+       aValForTime->myId = anId;
+       CORBA::Double aDT = aMEDField->getTime();
+       aValForTime->myTime = TTime(aDT,"");
+       aValForTime->myField = aMEDField;
        if(MYDEBUG) 
          MESSAGE("VISU_MEDConvertor::Build - aMeshName = '"<<aMeshName<<
-                 "'; myEntity = "<<anEntity<<"; myTime = "<<aValForTime.myTime.first);
+                 "'; myEntity = "<<anEntity<<"; myTime = "<<aDT);
       }      
     }
   }
@@ -660,90 +710,110 @@ VISU_Convertor*
 VISU_MEDConvertor::Build(SALOMEDS::ChildIterator_ptr theTimeStampIterator)
 {
   if(theTimeStampIterator->_is_nil()) return NULL;
-  for(int iTimeStamp = 1; theTimeStampIterator->More(); theTimeStampIterator->Next(), iTimeStamp++){
+  for(; theTimeStampIterator->More(); theTimeStampIterator->Next()){
     SALOMEDS::SObject_var aTimeStampSObj = theTimeStampIterator->Value();
     if(MYDEBUG) MESSAGE("VISU_MEDConvertor::Build - aTimeStampSObj = '"<<GetSObjectName(aTimeStampSObj)<<"'");
+
     CORBA::Object_var aMedField = VISU::SObjectToObject(aTimeStampSObj);
-    if(CORBA::is_nil(aMedField)) continue;
+    if(CORBA::is_nil(aMedField)) 
+      continue;
+
     SALOME_MED::FIELD_var aMEDField = SALOME_MED::FIELD::_narrow(aMedField);
-    if(aMEDField->_is_nil()) continue;
+    if(aMEDField->_is_nil()) 
+      continue;
+
     SALOME_MED::SUPPORT_var aMEDSupport = aMEDField->getSupport();
-    if(aMEDSupport->_is_nil()) continue;
+    if(aMEDSupport->_is_nil()) 
+      continue;
+
     SALOME_MED::medEntityMesh aMEntity = aMEDSupport->getEntity();
-    VISU::TEntity anEntity = MEDEntityToVTK(aMEntity);
+    TEntity aVEntity = MEDEntityToVTK(aMEntity);
     SALOME_MED::MESH_var aMEDMesh = aMEDSupport->getMesh();
     if(aMEDMesh->_is_nil()) continue;
     CORBA::String_var aMeshName = aMEDMesh->getName();
     CORBA::String_var aFieldName = aMEDField->getName();
 
-    VISU::TMesh &aMesh = myMeshMap[aMeshName.in()];
-    aMesh.myDim = aMEDMesh->getSpaceDimension();
-    aMesh.myPointsDim.resize(aMesh.myDim);
-    aMesh.myName = aMeshName.in();
-    aMesh.myNbPoints = aMEDMesh->getNumberOfNodes();
-    VISUMED::TMesh &aMesh2 = myMeshMap2[aMeshName.in()];
-    aMesh2.myMesh = aMEDMesh;
-    if(MYDEBUG) MESSAGE("VISU_MEDConvertor::Build - aMeshName = "<<aMeshName<<"; myDim = "<<aMesh.myDim);
-
-    VISU::TMeshOnEntity& aMeshOnEntity = aMesh.myMeshOnEntityMap[anEntity];
-    aMeshOnEntity.myEntity = anEntity;
-    aMeshOnEntity.myMeshName = aMeshName.in();
-    VISUMED::TMeshOnEntity& aMeshOnEntity2 = aMesh2.myMeshOnEntityMap[anEntity];
-    aMeshOnEntity2.mySupport = aMEDSupport;
-    if(anEntity == VISU::NODE_ENTITY)
-      aMesh2.myMeshOnEntityMap[VISU::CELL_ENTITY].mySupport = aMEDSupport;
-    GetCellsSize(aMesh,aMEDMesh,anEntity);
-
-    VISU::TField& aField = aMeshOnEntity.myFieldMap[aFieldName.in()];
-    CORBA::Short iField = mySObject->Tag();
-    aField.myId = iField;
-    aField.myName = aFieldName.in();
-    aField.myEntity = anEntity;
-    aField.myMeshName = aMeshName.in();
-    aField.myNbComp = aMEDField->getNumberOfComponents();
-    aField.myNbValField = iTimeStamp;
-    aField.myDataSize = aMeshOnEntity.myNbCells * aField.myNbComp;
-    if(MYDEBUG && !iTimeStamp) 
-      MESSAGE("VISU_MEDConvertor::Build - aMeshOnEntity.myNbCells = "<<aMeshOnEntity.myNbCells);
-    aField.myCompNames.resize(aField.myNbComp);
-    aField.myUnitNames.resize(aField.myNbComp);
+    PCMesh aMesh = myMeshMap[aMeshName.in()](new TCMesh());
+    aMesh->myDim = aMEDMesh->getSpaceDimension();
+    aMesh->myPointsDim.resize(aMesh->myDim);
+    aMesh->myName = aMeshName.in();
+    aMesh->myNbPoints = aMEDMesh->getNumberOfNodes();
+    aMesh->myMesh = aMEDMesh;
+    if(MYDEBUG) MESSAGE("VISU_MEDConvertor::Build - aMeshName = "<<aMeshName<<"; myDim = "<<aMesh->myDim);
+
+    TMeshOnEntityMap& aMeshOnEntityMap = aMesh->myMeshOnEntityMap;
+    PCMeshOnEntity aMeshOnEntity = aMeshOnEntityMap[aVEntity](new TCMeshOnEntity());
+    aMeshOnEntity->myEntity = aVEntity;
+    aMeshOnEntity->myMeshName = aMeshName.in();
+    aMeshOnEntity->mySupport = aMEDSupport;
 
+    if(aVEntity == NODE_ENTITY){
+      PCMeshOnEntity aMeshOnEntity2 = aMeshOnEntityMap[CELL_ENTITY](new TCMeshOnEntity());
+      *aMeshOnEntity2 = *aMeshOnEntity;
+      aMeshOnEntity->myEntity = CELL_ENTITY;
+      GetCellsSize(aMesh,aMEDMesh,CELL_ENTITY);
+    }else{
+      PCMeshOnEntity aMeshOnEntity2 = aMeshOnEntityMap[NODE_ENTITY](new TCMeshOnEntity());
+      *aMeshOnEntity2 = *aMeshOnEntity;
+      aMeshOnEntity->myEntity = NODE_ENTITY;
+      GetCellsSize(aMesh,aMEDMesh,NODE_ENTITY);
+    }
+    GetCellsSize(aMesh,aMEDMesh,aVEntity);
+
+    TFieldMap& aFieldMap = aMeshOnEntity->myFieldMap;
+    TFieldMap::iterator aFieldMapIter = aFieldMap.find(aFieldName.in());
+    PCField aField;
+    if(aFieldMapIter == aFieldMap.end()){
+      aField = aFieldMap[aFieldName.in()](new TCField());
+      CORBA::Short iField = mySObject->Tag();
+      aField->myId = iField;
+      aField->myName = aFieldName.in();
+      aField->myEntity = aVEntity;
+      aField->myMeshName = aMeshName.in();
+      aField->myNbComp = aMEDField->getNumberOfComponents();
+      aField->myDataSize = aMeshOnEntity->myNbCells * aField->myNbComp;
+      if(MYDEBUG) 
+       MESSAGE("VISU_MEDConvertor::Build - aMeshOnEntity->myNbCells = "<<aMeshOnEntity->myNbCells);
+      aField->myCompNames.resize(aField->myNbComp);
+      aField->myUnitNames.resize(aField->myNbComp);
+    }
+    
+    TValField& aValField = aField->myValField;
     int anId = aMEDField->getIterationNumber();
-    VISU::TField::TValForTime& aValForTime = aField.myValField[anId];
-    aValForTime.myId = anId;
-    aValForTime.myTime = VISU::TField::TTime(aMEDField->getTime(),"");
-    VISUMED::TField& aField2 = aMeshOnEntity2.myFieldMap[aFieldName.in()];
-    VISUMED::TField::TValForTime& aValForTime2 = aField2.myValField[anId];
-    aValForTime2.myField = aMEDField;
+    PCValForTime aValForTime = aValField[anId](new TCValForTime());
+    aValForTime->myId = anId;
+    CORBA::Double aDT = aMEDField->getTime();
+    aValForTime->myTime = TTime(aDT,"");
+    aValForTime->myField = aMEDField;
     if(MYDEBUG) 
       MESSAGE("VISU_MEDConvertor::Build - aMeshName = '"<<aMeshName<<
-             "'; myEntity = "<<anEntity<<"; myTime = "<<aValForTime.myTime.first);
+             "'; myEntity = "<<aVEntity<<"; myTime = "<<aDT);
   }
   return this; 
 }
 
 
 int
-VISU_MEDConvertor::LoadMeshOnEntity(VISU::TMeshOnEntity& theMeshOnEntity, 
+VISU_MEDConvertor::LoadMeshOnEntity(VISU::PMeshOnEntityImpl theMeshOnEntity, 
                                    const string& theFamilyName)
 {
   //Main part of code
-  const string& aMeshName = theMeshOnEntity.myMeshName;
-  const VISU::TEntity& anEntity = theMeshOnEntity.myEntity;
-  VISU::TMesh& aMesh = myMeshMap[aMeshName];
+  const string& aMeshName = theMeshOnEntity->myMeshName;
+  const TEntity& aVEntity = theMeshOnEntity->myEntity;
+  PCMesh aMesh = myMeshMap[aMeshName];
   int isPointsUpdated;
-  if(anEntity == VISU::NODE_ENTITY) 
+  if(aVEntity == NODE_ENTITY) 
     isPointsUpdated = LoadPoints(aMesh,theFamilyName);
   else 
     isPointsUpdated = LoadPoints(aMesh);
-  int isCellsOnEntityUpdated = LoadCellsOnEntity(theMeshOnEntity,theFamilyName);
+  int isCellsOnEntityUpdated = LoadCellsOnEntity(aMesh,theMeshOnEntity,theFamilyName);
 
   return (isPointsUpdated || isCellsOnEntityUpdated);
 }
  
  
 int 
-VISU_MEDConvertor::LoadMeshOnGroup(VISU::TMesh& theMesh, 
+VISU_MEDConvertor::LoadMeshOnGroup(VISU::PMeshImpl theMesh, 
                                   const VISU::TFamilyAndEntitySet& theFamilyAndEntitySet)
 {
   //Main part of code
@@ -752,14 +822,14 @@ VISU_MEDConvertor::LoadMeshOnGroup(VISU::TMesh& theMesh,
   VISU::TFamilyAndEntitySet::const_iterator aFamilyAndEntitySetIter = theFamilyAndEntitySet.begin();
   for(; aFamilyAndEntitySetIter != theFamilyAndEntitySet.end(); aFamilyAndEntitySetIter++){
     const string& aFamilyName = aFamilyAndEntitySetIter->first;
-    const VISU::TEntity& anEntity = aFamilyAndEntitySetIter->second;
-    VISU::TMeshOnEntity& aMeshOnEntity = theMesh.myMeshOnEntityMap[anEntity];
-    if(anEntity == VISU::NODE_ENTITY){
+    const VISU::TEntity& aVEntity = aFamilyAndEntitySetIter->second;
+    PCMeshOnEntity aMeshOnEntity = theMesh->myMeshOnEntityMap[aVEntity];
+    if(aVEntity == VISU::NODE_ENTITY){
       isPointsUpdated += LoadPoints(theMesh,aFamilyName);
-      isCellsOnEntityUpdated += LoadCellsOnEntity(aMeshOnEntity);
+      isCellsOnEntityUpdated += LoadCellsOnEntity(theMesh,aMeshOnEntity);
     }else{
       isPointsUpdated += LoadPoints(theMesh);
-      isCellsOnEntityUpdated += LoadCellsOnEntity(aMeshOnEntity,aFamilyName);
+      isCellsOnEntityUpdated += LoadCellsOnEntity(theMesh,aMeshOnEntity,aFamilyName);
     }
   }
 
@@ -768,61 +838,58 @@ VISU_MEDConvertor::LoadMeshOnGroup(VISU::TMesh& theMesh,
 
 
 int 
-VISU_MEDConvertor::LoadFieldOnMesh(VISU::TMesh& theMesh, 
-                                  VISU::TMeshOnEntity& theMeshOnEntity, 
-                                  VISU::TField& theField, 
-                                  VISU::TField::TValForTime& theValForTime)
+VISU_MEDConvertor::LoadFieldOnMesh(VISU::PMeshImpl theMesh, 
+                                  VISU::PMeshOnEntityImpl theMeshOnEntity, 
+                                  VISU::PFieldImpl theField, 
+                                  VISU::PValForTimeImpl theValForTime)
 {
   //Main part of code
   int isPointsUpdated = LoadPoints(theMesh);
-  int isCellsOnEntityUpdated = LoadCellsOnEntity(theMeshOnEntity);
-  int isFieldUpdated = LoadField(theMeshOnEntity,theField,theValForTime);
+  int isCellsOnEntityUpdated = LoadCellsOnEntity(theMesh,theMeshOnEntity);
+  int isFieldUpdated = LoadField(theMesh,theMeshOnEntity,theField,theValForTime);
   
   return (isPointsUpdated || isCellsOnEntityUpdated || isFieldUpdated);
 }
 
 int 
-VISU_MEDConvertor::LoadPoints(VISU::TMesh& theMesh, const string& theFamilyName)
+VISU_MEDConvertor::LoadPoints(VISU::PCMesh theMesh, 
+                             const string& theFamilyName)
 {
   //Check on existing family
-  VISU::TMeshOnEntity& aMeshOnEntity = theMesh.myMeshOnEntityMap[VISU::NODE_ENTITY];
-  aMeshOnEntity.myEntity = VISU::NODE_ENTITY;
-  aMeshOnEntity.myMeshName = theMesh.myName;
-  VISU::TFamily* pFamily = VISU::GetFamily(aMeshOnEntity,theFamilyName);
-  bool isFamilyPresent = (pFamily != NULL);
-  VISU::TFamily& aFamily = *pFamily;
+  PCMeshOnEntity aMeshOnEntity = theMesh->myMeshOnEntityMap[VISU::NODE_ENTITY];
+  PCFamily aFamily = GetFamily(aMeshOnEntity,theFamilyName);
   //Check on loading already done
-  bool isPointsLoaded = !theMesh.myPointsCoord.empty();
+  bool isPointsLoaded = !theMesh->myPointsCoord.empty();
   if(isPointsLoaded) 
-    if(!isFamilyPresent) return 0;
-    else if(!aFamily.mySubMesh.empty()) return 0;
-  VISUMED::TMesh& aMesh2 = myMeshMap2[theMesh.myName];
-  SALOME_MED::MESH_var& aMedMesh = aMesh2.myMesh;
-  VISUMED::TMeshOnEntity& aMeshOnEntity2 = aMesh2.myMeshOnEntityMap[VISU::NODE_ENTITY];
+    if(!aFamily) 
+      return 0;
+    else if(!aFamily->mySubMesh.empty()) 
+      return 0;
+
   if(MYDEBUG) 
     MESSAGE("LoadPoints - isPointsLoaded = "<<isPointsLoaded<<"; theFamilyName = '"<<theFamilyName<<"'");
-  theMesh.myDim = aMedMesh->getSpaceDimension();
+
+  SALOME_MED::MESH_var& aMedMesh = theMesh->myMesh;
   int iNumElemEnd = aMedMesh->getNumberOfNodes();
-  VISU::TMesh::TPointsCoord& aPointsCoord = theMesh.myPointsCoord;
+  TMeshImpl::TPointsCoord& aPointsCoord = theMesh->myPointsCoord;
   if(MYDEBUG) MESSAGE("LoadPoints - iNumElemEnd = "<<iNumElemEnd);
   if (iNumElemEnd <= 0) throw std::runtime_error("LoadPoints >> There is no points in the mesh !!!");
-  aPointsCoord.resize(theMesh.myDim*iNumElemEnd,0.0);
-   SALOME_MED::double_array_var coord = aMedMesh->getCoordinates(SALOME_MED::MED_FULL_INTERLACE);
+  aPointsCoord.resize(theMesh->myDim*iNumElemEnd,0.0);
+  SALOME_MED::double_array_var coord = aMedMesh->getCoordinates(SALOME_MED::MED_FULL_INTERLACE);
   if(!isPointsLoaded){
     for (int iNumElem = 0; iNumElem < iNumElemEnd; iNumElem++) 
-      for(int iDim = 0, iNumElem2Dim = iNumElem*theMesh.myDim; iDim < theMesh.myDim; iDim++, iNumElem2Dim++)
+      for(int iDim = 0, iNumElem2Dim = iNumElem*theMesh->myDim; iDim < theMesh->myDim; iDim++, iNumElem2Dim++)
        aPointsCoord[iNumElem2Dim] = coord[iNumElem2Dim];
     if(MYDEBUG) MESSAGE("LoadPoints - Filling aMeshOnEntity with type NODE_ENTITY");
-    VISU::TMeshOnEntity::TConnForCellType& aConnForCellType = aMeshOnEntity.myCellsConn[VTK_VERTEX];
+    TMeshOnEntityImpl::TConnForCellType& aConnForCellType = aMeshOnEntity->myCellsConn[VTK_VERTEX];
     aConnForCellType.resize(iNumElemEnd);
     for (int iNumElem = 0; iNumElem < iNumElemEnd; iNumElem++)
-      aConnForCellType[iNumElem] = VISU::TMeshOnEntity::TConnect(1,iNumElem);
+      aConnForCellType[iNumElem] = TMeshOnEntityImpl::TConnect(1,iNumElem);
   }
-  if(isFamilyPresent){
+  if(aFamily){
     if(MYDEBUG) MESSAGE("LoadPoints - Filling aFamily SubMesh");
-    VISUMED::TFamily aFamily2 = aMeshOnEntity2.myFamilyMap[aFamily.myName];
-    SALOME_MED::FAMILY_var aMedFamily = aFamily2.myFamily;
-    VISU::TFamily::TSubMeshOnCellType& aSubMeshOnCellType = aFamily.mySubMesh[VTK_VERTEX];
+    SALOME_MED::FAMILY_var aMedFamily = aFamily->myFamily;
+    TFamilyImpl::TSubMeshOnCellType& aSubMeshOnCellType = aFamily->mySubMesh[VTK_VERTEX];
     SALOME_MED::medGeometryElement_array_var aGeom = aMedFamily->getTypes();
     SALOME_MED::long_array_var aCellNumForType = aMedFamily->getNumber(aGeom[0]);
     int iNumElemEndTmp = iNumElemEnd;
@@ -842,32 +909,33 @@ VISU_MEDConvertor::LoadPoints(VISU::TMesh& theMesh, const string& theFamilyName)
 
 
 int 
-VISU_MEDConvertor::LoadCellsOnEntity(VISU::TMeshOnEntity& theMeshOnEntity, const string& theFamilyName)
+VISU_MEDConvertor::LoadCellsOnEntity(VISU::PCMesh theMesh,
+                                    VISU::PCMeshOnEntity theMeshOnEntity, 
+                                    const string& theFamilyName)
 {
   //Check on existing family
-  VISU::TFamily* pFamily = VISU::GetFamily(theMeshOnEntity,theFamilyName);
-  bool isFamilyPresent = (pFamily != NULL);
-  VISU::TFamily& aFamily = *pFamily;
+  PCFamily aFamily = GetFamily(theMeshOnEntity,theFamilyName);
   //Check on loading already done
-  bool isCellsLoaded = !theMeshOnEntity.myCellsConn.empty();
+  bool isCellsLoaded = !theMeshOnEntity->myCellsConn.empty();
   if(isCellsLoaded) 
-    if(!isFamilyPresent) return 0;
-    else if(!aFamily.mySubMesh.empty()) return 0;
-  VISUMED::TMesh& aMesh2 = myMeshMap2[theMeshOnEntity.myMeshName];
-  VISUMED::TMeshOnEntity& aMeshOnEntity2 = aMesh2.myMeshOnEntityMap[theMeshOnEntity.myEntity];
-  SALOME_MED::SUPPORT_var& aMedSupport = aMeshOnEntity2.mySupport;
+    if(!aFamily) 
+      return 0;
+    else if(!aFamily->mySubMesh.empty()) 
+      return 0;
+
+  SALOME_MED::SUPPORT_var& aMedSupport = theMeshOnEntity->mySupport;
   SALOME_MED::MESH_var aMedMesh = aMedSupport->getMesh();
   if(MYDEBUG) {
     MESSAGE("LoadCellsOnEntity - theFamilyName = '"<<theFamilyName<<"'");
-    MESSAGE("LoadCellsOnEntity - isCellsLoaded = "<<isCellsLoaded<<"; isFamilyPresent = "<<isFamilyPresent);
+    MESSAGE("LoadCellsOnEntity - isCellsLoaded = "<<isCellsLoaded<<"; isFamilyPresent = "<<bool(aFamily));
   }
+
   //Main part of code
   SALOME_MED::medGeometryElement* aGeomElems;
-  const VISU::TEntity& aVEntity = theMeshOnEntity.myEntity;
+  const TEntity& aVEntity = theMeshOnEntity->myEntity;
   int iGeomEnd = GetEntity2Geom(aVEntity,aGeomElems);
   const SALOME_MED::medEntityMesh& aMEntity = VTKEntityToMED(aVEntity);
-  VISU::TMesh &aMesh = myMeshMap[theMeshOnEntity.myMeshName];
-  int aNbPoints = aMesh.myPointsCoord.size()/aMesh.myDim;
+  int aNbPoints = theMesh->myPointsCoord.size()/theMesh->myDim;
   if(!isCellsLoaded){
     for(int iGeom = 0, aCounter = 0; iGeom < iGeomEnd; iGeom++){
       SALOME_MED::medGeometryElement aGeom = aGeomElems[iGeom];
@@ -878,15 +946,15 @@ VISU_MEDConvertor::LoadCellsOnEntity(VISU::TMeshOnEntity& theMeshOnEntity, const
       if (iNumElemEnd > 0) {
        SALOME_MED::long_array_var conn = 
          aMedMesh->getConnectivity(SALOME_MED::MED_FULL_INTERLACE,SALOME_MED::MED_NODAL,aMEntity,aGeom);
-       VISU::TMeshOnEntity::TConnForCellType& aConnForCellType = theMeshOnEntity.myCellsConn[aVGeom];
+       TMeshOnEntityImpl::TConnForCellType& aConnForCellType = theMeshOnEntity->myCellsConn[aVGeom];
        //APO - aConnForCellType.resize(iNumElemEnd);
-       valarray<int> aConnect(aMNbNodes);
+       vector<int> aConnect(aMNbNodes);
        int aNbConnForElem = conn->length()/iNumElemEnd;
        if(MYDEBUG) MESSAGE("LoadCellsOnEntity - aGeom = "<<aGeom<<
                            "; iNumElemEnd = "<<iNumElemEnd<<
                            "; aNbConnForElem = "<<aNbConnForElem);
        for (int iNumElem = 0; iNumElem < iNumElemEnd; iNumElem++) {
-         VISU::TMeshOnEntity::TConnect anArray(aVNbNodes);
+         VISU::TMeshOnEntityImpl::TConnect anArray(aVNbNodes);
          for (int k = 0, kj = iNumElem*aNbConnForElem; k < aMNbNodes; k++) {
            aConnect[k] = conn[kj+k] - 1;
          }
@@ -920,15 +988,14 @@ VISU_MEDConvertor::LoadCellsOnEntity(VISU::TMeshOnEntity& theMeshOnEntity, const
        }
        //Workaround for MED Component data structure
        int aSize = aConnForCellType.size();
-       aMeshOnEntity2.myCellsFirstIndex[aGeom] = VISUMED::TMeshOnEntity::TIndexAndSize(aCounter,aSize);
+       theMeshOnEntity->myCellsFirstIndex[aGeom] = TCMeshOnEntity::TIndexAndSize(aCounter,aSize);
        aCounter += aSize;
       }
     }
   }
   //Filling aFamily SubMesh
-  if(isFamilyPresent){
-    VISUMED::TFamily aFamily2 = aMeshOnEntity2.myFamilyMap[aFamily.myName];
-    SALOME_MED::FAMILY_var aMedFamily = aFamily2.myFamily;
+  if(aFamily){
+    SALOME_MED::FAMILY_var aMedFamily = aFamily->myFamily;
     SALOME_MED::medGeometryElement_array_var aGeoms = aMedFamily->getTypes();
     iGeomEnd = aGeoms->length();
     if(MYDEBUG) MESSAGE("LoadCellsOnEntity - iGeomEnd = "<<iGeomEnd);
@@ -936,10 +1003,10 @@ VISU_MEDConvertor::LoadCellsOnEntity(VISU::TMeshOnEntity& theMeshOnEntity, const
       SALOME_MED::medGeometryElement aGeom = aGeoms[iGeom];
       SALOME_MED::long_array_var aCellNumForType = aMedFamily->getNumber(aGeom);
       int aVGeom = MEDGeomToVTK(aGeom);
-      VISU::TFamily::TSubMeshOnCellType& aSubMeshOnCellType = aFamily.mySubMesh[aVGeom]; 
-      int iNumElemEndTmp = theMeshOnEntity.myCellsConn[aVGeom].size();
+      TFamilyImpl::TSubMeshOnCellType& aSubMeshOnCellType = aFamily->mySubMesh[aVGeom]; 
+      int iNumElemEndTmp = theMeshOnEntity->myCellsConn[aVGeom].size();
       int iNumElemEnd = aCellNumForType->length();
-      int aCounter = aMeshOnEntity2.myCellsFirstIndex[aGeom].first;
+      int aCounter = theMeshOnEntity->myCellsFirstIndex[aGeom].first;
       if(MYDEBUG) 
        MESSAGE("LoadCellsOnEntity - aGeom = "<<aGeom<<
                "; iNumElemEnd = "<<iNumElemEnd<<
@@ -961,40 +1028,40 @@ VISU_MEDConvertor::LoadCellsOnEntity(VISU::TMeshOnEntity& theMeshOnEntity, const
 template<class TArray> 
 int 
 ImportField(TArray& theArray, 
-           const VISU::TMesh& theMesh,
-           const VISU::TField& theField,
-           VISU::TField::TValForTime& theValForTime,
-           const VISU::TMeshOnEntity& theMeshOnEntity,
-           const VISUMED::TMeshOnEntity& theMeshOnEntity2)
+           VISU::PCMesh theMesh,
+           VISU::PCField theField,
+           VISU::PCValForTime theValForTime,
+           VISU::PCMeshOnEntity theMeshOnEntity)
 {
-  if(theField.myEntity == VISU::NODE_ENTITY){
-    VISU::TField::TValForCellsWithType& aValForCellsWithType = theValForTime.myValForCells[VTK_VERTEX];
-    int iNumElemEnd = theMesh.myPointsCoord.size()/theMesh.myDim*theField.myNbComp;
+  if(theField->myEntity == NODE_ENTITY){
+    TValForTimeImpl::TValForCellsWithType& aValForCellsWithType = 
+      theValForTime->myValForCells[VTK_VERTEX];
+    int iNumElemEnd = theMesh->myPointsCoord.size()/theMesh->myDim*theField->myNbComp;
     if(MYDEBUG) MESSAGE("ImportField - iNumElemEnd = "<<iNumElemEnd);
     aValForCellsWithType.resize(iNumElemEnd);
     for (int iNumElem = 0; iNumElem < iNumElemEnd; iNumElem++) 
       aValForCellsWithType[iNumElem] = theArray[iNumElem];
   }else{
     SALOME_MED::medGeometryElement* aGeomElems;
-    const VISU::TEntity& aVEntity = theField.myEntity;
+    const TEntity& aVEntity = theField->myEntity;
     int iGeomEnd = GetEntity2Geom(aVEntity,aGeomElems);
     for(int iGeom = 0; iGeom < iGeomEnd; iGeom++){
       SALOME_MED::medGeometryElement aGeom = aGeomElems[iGeom];
       int aVGeom = MEDGeomToVTK(aGeom);
-      const VISUMED::TMeshOnEntity::TCellsFirstIndex& aCellsFirstIndex = theMeshOnEntity2.myCellsFirstIndex;
-      VISUMED::TMeshOnEntity::TCellsFirstIndex::const_iterator aCellsFirstIndexIter = aCellsFirstIndex.find(aGeom);
+      const TCMeshOnEntity::TCellsFirstIndex& aCellsFirstIndex = theMeshOnEntity->myCellsFirstIndex;
+      TCMeshOnEntity::TCellsFirstIndex::const_iterator aCellsFirstIndexIter = aCellsFirstIndex.find(aGeom);
       if(aCellsFirstIndexIter != aCellsFirstIndex.end()){
-       const VISUMED::TMeshOnEntity::TIndexAndSize& aIndexAndSize = aCellsFirstIndexIter->second;
+       const TCMeshOnEntity::TIndexAndSize& aIndexAndSize = aCellsFirstIndexIter->second;
        int iNumElemEnd = aIndexAndSize.second;
        if(MYDEBUG) 
          MESSAGE("ImportField - aGeom = "<<aGeom<<
                  "; aIndexAndSize = {"<<aIndexAndSize.first<<
                  ","<<aIndexAndSize.second<<"}");
-       VISU::TField::TValForCellsWithType& aValForCellsWithType = theValForTime.myValForCells[aVGeom];
-       aValForCellsWithType.resize(iNumElemEnd*theField.myNbComp);
+       TValForTimeImpl::TValForCellsWithType& aValForCellsWithType = theValForTime->myValForCells[aVGeom];
+       aValForCellsWithType.resize(iNumElemEnd*theField->myNbComp);
        for(int iNumElem = 0; iNumElem < iNumElemEnd; iNumElem++)
-         for(int k = 0, kj = iNumElem*theField.myNbComp; k < theField.myNbComp; k++)
-           aValForCellsWithType[kj+k] = theArray[aIndexAndSize.first*theField.myNbComp+kj+k];
+         for(int k = 0, kj = iNumElem*theField->myNbComp; k < theField->myNbComp; k++)
+           aValForCellsWithType[kj+k] = theArray[aIndexAndSize.first*theField->myNbComp+kj+k];
       }
     }
   }
@@ -1002,30 +1069,27 @@ ImportField(TArray& theArray,
 }
 
 int
-VISU_MEDConvertor::LoadField(const VISU::TMeshOnEntity& theMeshOnEntity,
-                            const VISU::TField& theField, 
-                            VISU::TField::TValForTime& theValForTime)
+VISU_MEDConvertor::LoadField(VISU::PCMesh theMesh,
+                            VISU::PCMeshOnEntity theMeshOnEntity,
+                            VISU::PField theField, 
+                            VISU::PCValForTime theValForTime)
 {
   //Check on loading already done
-  if(!theValForTime.myValForCells.empty()) return 0;
-  VISU::TMesh& aMesh = myMeshMap[theMeshOnEntity.myMeshName];
-  VISUMED::TMesh& aMesh2 = myMeshMap2[theMeshOnEntity.myMeshName];
-  VISUMED::TMeshOnEntity& aMeshOnEntity2 = aMesh2.myMeshOnEntityMap[theMeshOnEntity.myEntity];
-  VISUMED::TField& aField2 = aMeshOnEntity2.myFieldMap[theField.myName];
-  VISUMED::TField::TValForTime& aValForTime2 = aField2.myValField[theValForTime.myId];
-  SALOME_MED::FIELD_var aMEDField = aValForTime2.myField;
-  //Main part of code
+  if(!theValForTime->myValForCells.empty()) 
+    return 0;
+  SALOME_MED::FIELD_var aMEDField = theValForTime->myField;
   SALOME_MED::FIELDDOUBLE_ptr aFieldDouble = SALOME_MED::FIELDDOUBLE::_narrow(aMEDField);
   if(!aFieldDouble->_is_nil()){
     SALOME_MED::double_array_var anArray = aFieldDouble->getValue(SALOME_MED::MED_FULL_INTERLACE);
     if(MYDEBUG) MESSAGE("VISU_MEDConvertor::LoadField - There is FIELDDOUBLE = "<<anArray->length());
-    ::ImportField(anArray,aMesh,theField,theValForTime,theMeshOnEntity,aMeshOnEntity2);
+    ::ImportField(anArray,theMesh,theField,theValForTime,theMeshOnEntity);
   }
   SALOME_MED::FIELDINT_ptr aFieldInt = SALOME_MED::FIELDINT::_narrow(aMEDField);
   if(!aFieldInt->_is_nil()){
     SALOME_MED::long_array_var anArray = aFieldInt->getValue(SALOME_MED::MED_FULL_INTERLACE);
     if(MYDEBUG) MESSAGE("VISU_MEDConvertor::LoadField - There is FIELDINT = "<<anArray->length());
-    ::ImportField(anArray,aMesh,theField,theValForTime,theMeshOnEntity,aMeshOnEntity2);
+    ::ImportField(anArray,theMesh,theField,theValForTime,theMeshOnEntity);
   }
   return 1;
 }
index 6500527ff2e74c7106bccbb0d093410453122ffd..6b7c94107ae077047bfd960a113b1fcc7ed26f90 100644 (file)
 
 #include <string>      
 
-namespace VISUMED{
-  struct TFamily{
-    SALOME_MED::FAMILY_var myFamily;
-  };
-  typedef std::map<std::string,TFamily> TFamilyMap;
-  
-  struct TField{
-    struct TValForTime{
-      SALOME_MED::FIELD_var myField;
-    };
-    typedef std::map<int,TValForTime> TValField;
-    TValField myValField;
+namespace VISU{
+
+  struct TCMesh: TMeshImpl{
+    SALOME_MED::MESH_var myMesh;
   };
-  typedef std::map<std::string,TField> TFieldMap;
+  typedef shared_ptr<TCMesh> PCMesh;
 
-  struct TMeshOnEntity{
+  struct TCMeshOnEntity: TMeshOnEntityImpl{
     SALOME_MED::SUPPORT_var mySupport;
     typedef std::pair<int,int> TIndexAndSize;
     typedef std::map<int,TIndexAndSize> TCellsFirstIndex;
     TCellsFirstIndex myCellsFirstIndex;
-    TFamilyMap myFamilyMap;
-    TFieldMap myFieldMap;
   };
-  typedef std::map<VISU::TEntity,TMeshOnEntity> TMeshOnEntityMap;
+  typedef shared_ptr<TCMeshOnEntity> PCMeshOnEntity;
+  
+  struct TCFamily: TFamilyImpl{
+    SALOME_MED::FAMILY_var myFamily;
+  };
+  typedef shared_ptr<TCFamily> PCFamily;
   
-  struct TGroup{
+  struct TCGroup: TGroupImpl{
     SALOME_MED::GROUP_var myGroup;
   };
-  typedef std::map<std::string,TGroup> TGroupMap;
+  typedef shared_ptr<TCGroup> PCGroup;
 
-  struct TMesh{
-    SALOME_MED::MESH_var myMesh;
-    TMeshOnEntityMap myMeshOnEntityMap;
-    TGroupMap myGroupMap;
+  struct TCField: TFieldImpl{
+  };
+  typedef shared_ptr<TCField> PCField;
+
+  struct TCValForTime: TValForTimeImpl{
+    SALOME_MED::FIELD_var myField;
   };
-  typedef std::map<std::string,TMesh> TMeshMap;
+  typedef shared_ptr<TCValForTime> PCValForTime;
+
 }
 
 
 class VISU_MEDConvertor: public VISU_Convertor_impl{
  protected:
-  VISUMED::TMeshMap myMeshMap2;
   SALOMEDS::SObject_var mySObject;
   VISU_MEDConvertor() {};
 
@@ -89,23 +86,28 @@ class VISU_MEDConvertor: public VISU_Convertor_impl{
   VISU_Convertor* Build(SALOME_MED::MED_ptr theMED);
   VISU_Convertor* Build(SALOMEDS::ChildIterator_ptr theTimeStampIterator);
 
-  virtual int LoadMeshOnEntity(VISU::TMeshOnEntity& theMeshOnEntity, 
+  virtual int LoadMeshOnEntity(VISU::PMeshOnEntityImpl theMeshOnEntity, 
                               const std::string& theFamilyName = "");
 
-  virtual int LoadMeshOnGroup(VISU::TMesh& theMesh, 
+  virtual int LoadMeshOnGroup(VISU::PMeshImpl theMesh, 
                              const VISU::TFamilyAndEntitySet& theFamilyAndEntitySet);
 
-  virtual int LoadFieldOnMesh(VISU::TMesh& theMesh, 
-                             VISU::TMeshOnEntity& theMeshOnEntity, 
-                             VISU::TField& theField, 
-                             VISU::TField::TValForTime& theValForTime);
-
-  int LoadPoints(VISU::TMesh& theMesh, const std::string& theFamilyName = "") ;
+  virtual int LoadFieldOnMesh(VISU::PMeshImpl theMesh, 
+                             VISU::PMeshOnEntityImpl theMeshOnEntity, 
+                             VISU::PFieldImpl theField, 
+                             VISU::PValForTimeImpl theValForTime);
 
-  int LoadCellsOnEntity(VISU::TMeshOnEntity& theMeshOnEntity, const std::string& theFamilyName = "");
+  int LoadPoints(VISU::PCMesh theMesh,
+                const std::string& theFamilyName = "") ;
 
-  int LoadField(const VISU::TMeshOnEntity& theMeshOnEntity,
-               const VISU::TField& theField, VISU::TField::TValForTime& theValForTime);
+  int LoadCellsOnEntity(VISU::PCMesh theMesh,
+                       VISU::PCMeshOnEntity theMeshOnEntity, 
+                       const std::string& theFamilyName = "");
+  
+  int LoadField(VISU::PCMesh theMesh,
+               VISU::PCMeshOnEntity theMeshOnEntity,
+               VISU::PField theField, 
+               VISU::PCValForTime theValForTime);
 
 };
 
@@ -113,7 +115,9 @@ class VISU_MEDFieldConvertor: public VISU_MEDConvertor{
  protected:
   SALOME_MED::FIELD_var myField;
  public:
-  VISU_MEDFieldConvertor(SALOME_MED::FIELD_ptr theField) : myField(SALOME_MED::FIELD::_duplicate(theField)) {}
+  VISU_MEDFieldConvertor(SALOME_MED::FIELD_ptr theField) : 
+    myField(SALOME_MED::FIELD::_duplicate(theField)) 
+  {}
   virtual VISU_Convertor* Build() ;
 };
 
index 4021956fd18dfe51354b573d6aaf9e719f6d69e5..daebefcd303f460cc4dba7853fa9944789fdeb03 100644 (file)
@@ -251,9 +251,9 @@ void VISU::CutLines_i::BuildTableOfReal(SALOMEDS::SObject_ptr theSObject){
     typedef map<int,TXYMap> TXYMapCont;
     typedef map<long,long> TLineIdCont;
     
-    const VISU::TField::TValField& aValField = myField->myValField;
-    const VISU::TField::TValForTime& aValForTime = aValField.find((int)myIteration)->second;
-    const VISU::TField::TTime& aTime = aValForTime.myTime;
+    const VISU::TValField& aValField = myField->myValField;
+    const VISU::PValForTime aValForTime = aValField.find((int)myIteration)->second;
+    const VISU::TTime& aTime = aValForTime->myTime;
     QString aTitle;
     //aTitle.sprintf("%s %s",myTitle.c_str(),aTime.second.c_str());
     aTitle.sprintf("%s",myTitle.c_str());
index 8333217fd7fddded443a1e955f752017e586718c..7d253297dcde4686abe79dc6fefbf0a651d1d37a 100644 (file)
@@ -47,8 +47,8 @@ int VISU::DeformedShape_i::IsPossible(Result_i* theResult, const char* theMeshNa
 {
   try{
     if(!VISU::ScalarMap_i::IsPossible(theResult,theMeshName,theEntity,theFieldName,theIteration,isMemoryCheck)) return 0;
-    const VISU::TField& aField = theResult->GetInput()->GetField(theMeshName,(VISU::TEntity)theEntity,theFieldName);
-    return aField.myNbComp > 1;
+    const VISU::PField aField = theResult->GetInput()->GetField(theMeshName,(VISU::TEntity)theEntity,theFieldName);
+    return aField->myNbComp > 1;
   }catch(std::exception& exc){
     INFOS("Follow exception was occured :\n"<<exc.what());
   }catch(...){
index 3ca6fc2768d092e032336a9dfd4aad2440f58d64..52df2361374ae4c9a818553ced723291531e9180 100644 (file)
@@ -166,21 +166,21 @@ CORBA::Boolean VISU::Result_i::BuildAll(){
     VISU::TMeshMap::const_iterator aMeshMapIter = aMeshMap.begin();
     for(; aMeshMapIter != aMeshMap.end(); aMeshMapIter++){
       const string& aMeshName = aMeshMapIter->first;
-      const VISU::TMesh& aMesh = aMeshMapIter->second;
-      const VISU::TMeshOnEntityMap& aMeshOnEntityMap = aMesh.myMeshOnEntityMap;
+      const VISU::PMesh aMesh = aMeshMapIter->second;
+      const VISU::TMeshOnEntityMap& aMeshOnEntityMap = aMesh->myMeshOnEntityMap;
       VISU::TMeshOnEntityMap::const_iterator aMeshOnEntityMapIter;
       //Import fields
       aMeshOnEntityMapIter = aMeshOnEntityMap.begin();
       for(; aMeshOnEntityMapIter != aMeshOnEntityMap.end(); aMeshOnEntityMapIter++){
        const VISU::TEntity& anEntity = aMeshOnEntityMapIter->first;
-       const VISU::TMeshOnEntity& aMeshOnEntity = aMeshOnEntityMapIter->second;
-       const VISU::TFieldMap& aFieldMap = aMeshOnEntity.myFieldMap;
+       const VISU::PMeshOnEntity aMeshOnEntity = aMeshOnEntityMapIter->second;
+       const VISU::TFieldMap& aFieldMap = aMeshOnEntity->myFieldMap;
        VISU::TFieldMap::const_iterator aFieldMapIter = aFieldMap.begin();
        for(; aFieldMapIter != aFieldMap.end(); aFieldMapIter++){
          const string& aFieldName = aFieldMapIter->first;
-         const VISU::TField& aField = aFieldMapIter->second;
-         const VISU::TField::TValField& aValField = aField.myValField;
-         VISU::TField::TValField::const_iterator aValFieldIter = aValField.begin();
+         const VISU::PField aField = aFieldMapIter->second;
+         const VISU::TValField& aValField = aField->myValField;
+         VISU::TValField::const_iterator aValFieldIter = aValField.begin();
          for(; aValFieldIter != aValField.end(); aValFieldIter++){
            int aTimeStamp = aValFieldIter->first;
            try{
@@ -193,7 +193,7 @@ CORBA::Boolean VISU::Result_i::BuildAll(){
          }
        }
        //Importing groups
-       const VISU::TGroupMap& aGroupMap = aMesh.myGroupMap;
+       const VISU::TGroupMap& aGroupMap = aMesh->myGroupMap;
        VISU::TGroupMap::const_iterator aGroupMapIter = aGroupMap.begin();
        for(; aGroupMapIter != aGroupMap.end(); aGroupMapIter++){
          const string& aGroupName = aGroupMapIter->first;
@@ -206,7 +206,7 @@ CORBA::Boolean VISU::Result_i::BuildAll(){
          }
        }
        //Import families
-       const VISU::TFamilyMap& aFamilyMap = aMeshOnEntity.myFamilyMap;
+       const VISU::TFamilyMap& aFamilyMap = aMeshOnEntity->myFamilyMap;
        VISU::TFamilyMap::const_iterator aFamilyMapIter = aFamilyMap.begin();
        for(; aFamilyMapIter != aFamilyMap.end(); aFamilyMapIter++){
          const string& aFamilyName = aFamilyMapIter->first;
@@ -264,11 +264,11 @@ VISU::Storable* VISU::Result_i::Build(SALOMEDS::SObject_ptr theSObject)
     TMeshMap::const_iterator aMeshMapIter = aMeshMap.begin();
     for(; aMeshMapIter != aMeshMap.end(); aMeshMapIter++){
       const string& aMeshName = aMeshMapIter->first;
-      const VISU::TMesh& aMesh = aMeshMapIter->second;
-      const VISU::TMeshOnEntityMap& aMeshOnEntityMap = aMesh.myMeshOnEntityMap;
+      const VISU::PMesh aMesh = aMeshMapIter->second;
+      const VISU::TMeshOnEntityMap& aMeshOnEntityMap = aMesh->myMeshOnEntityMap;
       VISU::TMeshOnEntityMap::const_iterator aMeshOnEntityMapIter;
       aComment.sprintf("myComment=MESH;myName=%s;myDim=%d",
-                      aMeshName.c_str(),aMesh.myDim);
+                      aMeshName.c_str(),aMesh->myDim);
       string aMeshEntry = CreateAttributes(myStudyDocument,aResultEntry.c_str(),aRefFatherEntry.c_str(),
                                           "",aMeshName.c_str(),"",aComment.latin1(),true);
       if(aMeshOnEntityMap.empty()) continue;
@@ -294,8 +294,8 @@ VISU::Storable* VISU::Result_i::Build(SALOMEDS::SObject_ptr theSObject)
        }
        aEntity2Entry[anEntity] = CreateAttributes(myStudyDocument,aSubMeshesEntry.c_str(),aRefFatherEntry.c_str(),
                                                   "",anEntityName.c_str(),"",aComment.latin1(),true);
-       const VISU::TMeshOnEntity& aMeshOnEntity = aMeshOnEntityMapIter->second;
-       const VISU::TFamilyMap& aFamilyMap = aMeshOnEntity.myFamilyMap;
+       const VISU::PMeshOnEntity aMeshOnEntity = aMeshOnEntityMapIter->second;
+       const VISU::TFamilyMap& aFamilyMap = aMeshOnEntity->myFamilyMap;
        VISU::TFamilyMap::const_iterator aFamilyMapIter = aFamilyMap.begin();
        for(; aFamilyMapIter != aFamilyMap.end(); aFamilyMapIter++){
          const string& aFamilyName = aFamilyMapIter->first;
@@ -306,7 +306,7 @@ VISU::Storable* VISU::Result_i::Build(SALOMEDS::SObject_ptr theSObject)
        }
       }
       //Importing groups
-      const VISU::TGroupMap& aGroupMap = aMesh.myGroupMap;
+      const VISU::TGroupMap& aGroupMap = aMesh->myGroupMap;
       if(aGroupMap.size() > 0){
        aComment.sprintf("myComment=GROUPS;myMeshName=%s",aMeshName.c_str());
        string aGroupsEntry = CreateAttributes(myStudyDocument,aMeshEntry.c_str(),aRefFatherEntry.c_str(),
@@ -318,8 +318,8 @@ VISU::Storable* VISU::Result_i::Build(SALOMEDS::SObject_ptr theSObject)
                           VISU::TGROUP,aMeshName.c_str(),aGroupName.c_str());
          string aGroupEntry = CreateAttributes(myStudyDocument,aGroupsEntry.c_str(),aRefFatherEntry.c_str(),
                                                "",aGroupName.c_str(),"",aComment.latin1(),true);
-         const VISU::TGroup& aGroup = aGroupMapIter->second;
-         const VISU::TFamilyAndEntitySet& aFamilyAndEntitySet = aGroup.myFamilyAndEntitySet;
+         const VISU::PGroup aGroup = aGroupMapIter->second;
+         const VISU::TFamilyAndEntitySet& aFamilyAndEntitySet = aGroup->myFamilyAndEntitySet;
          VISU::TFamilyAndEntitySet::const_iterator aFamilyAndEntitySetIter = aFamilyAndEntitySet.begin();
          for(; aFamilyAndEntitySetIter != aFamilyAndEntitySet.end(); aFamilyAndEntitySetIter++){
            const VISU::TFamilyAndEntity& aFamilyAndEntity = *aFamilyAndEntitySetIter;
@@ -338,8 +338,8 @@ VISU::Storable* VISU::Result_i::Build(SALOMEDS::SObject_ptr theSObject)
       aMeshOnEntityMapIter = aMeshOnEntityMap.begin();
       for(; aMeshOnEntityMapIter != aMeshOnEntityMap.end(); aMeshOnEntityMapIter++){
        const VISU::TEntity& anEntity = aMeshOnEntityMapIter->first;
-       const VISU::TMeshOnEntity& aMeshOnEntity = aMeshOnEntityMapIter->second;
-       const VISU::TFieldMap& aFieldMap = aMeshOnEntity.myFieldMap;
+       const VISU::PMeshOnEntity aMeshOnEntity = aMeshOnEntityMapIter->second;
+       const VISU::TFieldMap& aFieldMap = aMeshOnEntity->myFieldMap;
        VISU::TFieldMap::const_iterator aFieldMapIter = aFieldMap.begin();
        for(; aFieldMapIter != aFieldMap.end(); aFieldMapIter++){
          if(!isFieldEntryCreated){
@@ -349,21 +349,21 @@ VISU::Storable* VISU::Result_i::Build(SALOMEDS::SObject_ptr theSObject)
            isFieldEntryCreated = true;
          }
          const string& aFieldName = aFieldMapIter->first;
-         const VISU::TField& aField = aFieldMapIter->second;
-         const VISU::TField::TValField& aValField = aField.myValField;
-         QString aFieldNameWithUnit = ::GenerateFieldName(aFieldName,aField.myUnitNames[0]);
+         const VISU::PField aField = aFieldMapIter->second;
+         const VISU::TValField& aValField = aField->myValField;
+         QString aFieldNameWithUnit = ::GenerateFieldName(aFieldName,aField->myUnitNames[0]);
          aComment.sprintf("myComment=FIELD;myType=%d;myMeshName=%s;myEntityId=%d;myName=%s;myNbTimeStamps=%d;myNumComponent=%d",
-                          VISU::TFIELD,aMeshName.c_str(),anEntity,aFieldName.c_str(),aValField.size(),aField.myNbComp);
+                          VISU::TFIELD,aMeshName.c_str(),anEntity,aFieldName.c_str(),aValField.size(),aField->myNbComp);
          string aFieldEntry = CreateAttributes(myStudyDocument,aFieldsEntry.c_str(),aRefFatherEntry.c_str(),
                                                "",aFieldNameWithUnit.latin1(),"",aComment.latin1(),true);
          CreateReference(myStudyDocument,aFieldEntry,aEntity2Entry[anEntity]);
-         VISU::TField::TValField::const_iterator aValFieldIter = aValField.begin();
+         VISU::TValField::const_iterator aValFieldIter = aValField.begin();
          for(; aValFieldIter != aValField.end(); aValFieldIter++){
            int aTimeStamp = aValFieldIter->first;
-           const VISU::TField::TValForTime& aValForTime = aValFieldIter->second;
+           const VISU::PValForTime aValForTime = aValFieldIter->second;
            aComment.sprintf("myComment=TIMESTAMP;myType=%d;myMeshName=%s;myEntityId=%d;myFieldName=%s;myTimeStampId=%d;myNumComponent=%d",
-                            VISU::TTIMESTAMP,aMeshName.c_str(),anEntity,aFieldName.c_str(),aTimeStamp,aField.myNbComp);
-           string aTimeStampId = VISU_Convertor::GenerateName(aValForTime.myTime);
+                            VISU::TTIMESTAMP,aMeshName.c_str(),anEntity,aFieldName.c_str(),aTimeStamp,aField->myNbComp);
+           string aTimeStampId = VISU_Convertor::GenerateName(aValForTime->myTime);
            CreateAttributes(myStudyDocument,aFieldEntry.c_str(),aRefFatherEntry.c_str(),
                             "",aTimeStampId.c_str(),"",aComment.latin1(),true);
          }
index 96beba4d0b59643604d023c0545083bd44ec3832..aee04e00fd26817d6b1b9e1e4e5e5fa184d82d04 100644 (file)
@@ -435,7 +435,7 @@ VISU::Storable* VISU::ScalarMap_i::Build(int theRestoring){
   try{
     if(myResult->GetInput() == NULL) 
       throw std::runtime_error("Mesh_i::Build - myResult->GetInput() == NULL !!!");
-    myField = &(myResult->GetInput()->GetField(myMeshName,myEntity,myFieldName));
+    myField = myResult->GetInput()->GetField(myMeshName,myEntity,myFieldName);
     if(myField == NULL) throw std::runtime_error("There is no Field with the parameters !!!");
     VISU_Convertor::TOutput *anOutput = 
       myResult->GetInput()->GetTimeStampOnMesh(myMeshName,myEntity,myFieldName,myIteration);
@@ -447,9 +447,9 @@ VISU::Storable* VISU::ScalarMap_i::Build(int theRestoring){
     if(theRestoring <= 0){
       if(theRestoring == 0) myScalarMapPL->Init();
       if(!myIsFixedRange) myScalarMapPL->SetSourceRange();
-      const VISU::TField::TValField& aValField = myField->myValField;
-      const VISU::TField::TValForTime& aValForTime = aValField.find(myIteration)->second;
-      aComment.sprintf("%s %s",myFieldName.c_str(),VISU_Convertor::GenerateName(aValForTime.myTime).c_str());
+      const VISU::TValField& aValField = myField->myValField;
+      const VISU::PValForTime aValForTime = aValField.find(myIteration)->second;
+      aComment.sprintf("%s %s",myFieldName.c_str(),VISU_Convertor::GenerateName(aValForTime->myTime).c_str());
       if (theRestoring == 0) myTitle = aComment.simplifyWhiteSpace().latin1();
     }
     if(myAddToStudy){
index a42b55f0525d77ceeb10b84b323dcc507eca5799..510ff794b827a8df12a9099959fb00f42b6393e1 100644 (file)
@@ -125,7 +125,7 @@ namespace VISU{
     virtual void DoHook();
 
     VISU_ScalarMapPL* myScalarMapPL;
-    const TField* myField;
+    PField myField;
 
     string myMeshName;
     TEntity myEntity;
@@ -172,8 +172,8 @@ namespace VISU{
     virtual void Update() ;
     virtual void SetMapScale(double theMapScale = 1.0);
 
-    const VISU::TField*  GetField() const { return myField;}
-    const string&  GetFieldName() const { return myFieldName;}
+    const VISU::PField GetField() const { return myField;}
+    const string& GetFieldName() const { return myFieldName;}
 
     virtual bool IsRangeFixed() { return myIsFixedRange; }
     virtual void SetSourceRange();
index 66a2305f10f24f4f7990c73adc19ff70c849f0da..f6b5a303e80241b6f5599473a8bc52286829db54 100644 (file)
@@ -31,6 +31,7 @@
 
 #include <vtkDataSetMapper.h>
 #include <vtkAppendFilter.h>
+#include <vtkUnstructuredGrid.h>
 
 using namespace VISU;
 using namespace std;