]> SALOME platform Git repositories - modules/visu.git/commitdiff
Salome HOME
To introduce mapping of mesh elements
authorapo <apo@opencascade.com>
Tue, 20 Sep 2005 13:06:42 +0000 (13:06 +0000)
committerapo <apo@opencascade.com>
Tue, 20 Sep 2005 13:06:42 +0000 (13:06 +0000)
src/CONVERTOR/VISU_Convertor.hxx
src/CONVERTOR/VISU_Convertor_impl.cxx
src/CONVERTOR/VISU_Convertor_impl.hxx
src/CONVERTOR/VISU_IDMapper.hxx
src/CONVERTOR/VISU_MedConvertor.cxx
src/CONVERTOR/VISU_MedConvertor.hxx
src/OBJECT/VISU_GaussPtsAct.cxx

index 2cb3673c08650b1a92c149da6ea3a454bbc8786f..7fa63b582aea7d59e1437ced415dbe4f91c8a9d5 100644 (file)
@@ -105,16 +105,8 @@ namespace VISU
 
   
   //---------------------------------------------------------------
-  typedef vtkIdType TCellID;
-  typedef vtkIdType TLocalPntID;
-  typedef std::pair<TCellID,TLocalPntID> TGaussPointID;
-
-  struct TGaussMesh: virtual TIDMapper
-  {
-    virtual 
-    TGaussPointID 
-    GetObjID(int theVtkI) const = 0;
-  };
+  struct TGaussMesh: virtual TGaussPtsIDMapper
+  {};
 
 
   //---------------------------------------------------------------
@@ -130,7 +122,7 @@ namespace VISU
   typedef std::map<TName,PFamily> TFamilyMap;
   typedef std::map<TName,PField> TFieldMap;
 
-  struct TMeshOnEntity: virtual TIDMapper
+  struct TMeshOnEntity: virtual TNamedIDMapper
   {
     TGaussMeshMap myGaussMeshMap;
     TProfileMap myProfileMap;
index ee2075a5c5693db6695b9b31f3ad9f52952c14a0..b960be2482f4c01f3feac8a360a5e314efa2298e 100644 (file)
@@ -58,7 +58,7 @@ static int MYVTKDEBUG = 0;
 
 #ifdef _DEBUG_
 static int MYDEBUG = 0;
-static int MYDEBUGWITHFILES = 0;
+static int MYDEBUGWITHFILES = 1;
 //#define _DEXCEPT_
 #else
 static int MYDEBUG = 0;
@@ -124,6 +124,7 @@ namespace VISU
   TAppendFilter
   ::GetVTKOutput()
   {
+    GetFilter()->Update();
     return GetFilter()->GetOutput();
   }
 
@@ -216,9 +217,15 @@ namespace VISU
     return -1;
   }
 
+  std::string 
+  TNamedPointCoords
+  ::GetNodeName(vtkIdType theObjID) const
+  {
+    return "";
+  }
+
   //---------------------------------------------------------------
   TMeshImpl::TMeshImpl():
-    myNamedPointCoords(new TNamedPointCoords()),
     myPoints(vtkPoints::New()),
     myNbPoints(0) 
   {
@@ -328,6 +335,12 @@ namespace VISU
     return GetFilter()->GetOutput()->GetCell(aVtkID);
   }
   
+  TVTKOutput* 
+  TProfileImpl
+  ::GetVTKOutput()
+  {
+    return mySource.GetVTKOutput();
+  }
 
   //---------------------------------------------------------------
   TGaussSubMeshImpl::TGaussSubMeshImpl():
@@ -364,10 +377,9 @@ namespace VISU
 
   //---------------------------------------------------------------
   TGaussMeshImpl
-  ::TGaussMeshImpl()
-  {
-    myParentMesh=0;
-  }
+  ::TGaussMeshImpl():
+    myParent(NULL)
+  {}
 
   TGaussPointID 
   TGaussMeshImpl
@@ -380,13 +392,18 @@ namespace VISU
     return aSubMeshImpl.GetObjID(anInputID);
   }
   
-  void TGaussMeshImpl::SetParentMesh(VISU::TMeshOnEntityImpl* theMesh) 
+  TVTKOutput* 
+  TGaussMeshImpl
+  ::GetVTKOutput()
   {
-    myParentMesh=theMesh;
+    return mySource.GetVTKOutput();
   }
-  VISU::TMeshOnEntityImpl* TGaussMeshImpl::GetParentMesh() 
+
+  TNamedIDMapper* 
+  TGaussMeshImpl::
+  GetParent()
   {
-    return myParentMesh;
+    return myParent;
   }
 
   //---------------------------------------------------------------
@@ -397,6 +414,12 @@ namespace VISU
     return myStartID + theID;
   }
 
+  std::string 
+  TSubMeshImpl
+  ::GetElemName(vtkIdType theObjID) const
+  {
+    return "";
+  }
 
   //---------------------------------------------------------------
   vtkIdType
@@ -438,6 +461,23 @@ namespace VISU
     return aSubMesh->GetElemObjID(aID);
   }
 
+  std::string 
+  TMeshOnEntityImpl
+  ::GetNodeName(vtkIdType theObjID) const
+  {
+    return myNamedPointCoords->GetNodeName(theObjID);
+  }
+
+  std::string 
+  TMeshOnEntityImpl
+  ::GetElemName(vtkIdType theObjID) const
+  {
+    vtkIdType anInputID;
+    const TVTKAppendFilter& anAppendFilter = GetFilter();
+    vtkIdType aID = anAppendFilter->GetCellInputID(theObjID,anInputID);
+    const PSubMeshImpl& aSubMesh = mySubMeshArr[anInputID];
+    return aSubMesh->GetElemName(aID);
+  }
 
   //---------------------------------------------------------------
   vtkIdType
@@ -475,6 +515,13 @@ namespace VISU
     return myNamedPointCoords->GetVTKID(theID);
   }
 
+  TVTKOutput* 
+  TFamilyImpl
+  ::GetVTKOutput()
+  {
+    return TSource::GetVTKOutput();
+  }
+
 
   //---------------------------------------------------------------
   TNbASizeCells 
@@ -1458,7 +1505,9 @@ namespace
       anAppendFilter->AddInput(aSource.GetPointer());
     }
     anAppendFilter->Update(); // Fix on VTK
-    theGaussMesh->SetParentMesh(theMeshOnEntity.get());
+
+    theGaussMesh->myParent = theMeshOnEntity.get();
+
     vtkDataSet* aSource = anAppendFilter->GetOutput();
     INITMSGA(MYDEBUG,0,"aNbPoints - "<<aSource->GetNumberOfPoints()<<endl);
     BEGMSG(MYDEBUG,"aNbCells - "<<aSource->GetNumberOfCells()<<endl);
index b60a9fecd070677e8a570796a6b1489685176375..f1923dd8dcfb68aff87134f41125d5da260a5b72 100644 (file)
@@ -157,12 +157,17 @@ namespace VISU
     virtual
     vtkIdType
     GetVTKID(vtkIdType theID) const;
+
+    virtual
+    std::string 
+    GetNodeName(vtkIdType theObjID) const;
   };
   typedef SharedPtr<TNamedPointCoords> PNamedPointCoords;
 
 
   //---------------------------------------------------------------
-  struct TMeshImpl: virtual TMesh, virtual TIsVTKDone
+  struct TMeshImpl: virtual TMesh, 
+                   virtual TIsVTKDone
   {
     PNamedPointCoords myNamedPointCoords;
 
@@ -178,7 +183,8 @@ namespace VISU
   typedef TVector<vtkIdType> TSubMeshID;
   typedef enum {eRemoveAll, eAddAll, eAddPart, eNone} ESubMeshStatus; 
 
-  struct TSubProfileImpl: virtual TSubProfile, virtual TSource
+  struct TSubProfileImpl: virtual TSubProfile, 
+                         virtual TSource
   {
     TSubProfileImpl();
 
@@ -202,7 +208,8 @@ namespace VISU
   typedef TVector<PSubProfileImpl> TSubProfileArr;
   typedef std::map<vtkIdType,PSubProfileImpl> TGeom2SubProfile;
 
-  struct TProfileImpl: virtual TProfile, virtual TAppendFilter
+  struct TProfileImpl: virtual TProfile, 
+                      virtual TAppendFilter
   {
     TProfileImpl();
     bool myIsAll;
@@ -233,10 +240,7 @@ namespace VISU
     
     virtual
     TVTKOutput* 
-    GetVTKOutput()
-    {
-      return mySource.GetVTKOutput();
-    }
+    GetVTKOutput();
 
     TID2ID myElemObj2VTKID;
     TSubProfileArr mySubProfileArr;
@@ -260,7 +264,8 @@ namespace VISU
 
 
   //---------------------------------------------------------------
-  struct TGaussSubMeshImpl: virtual TGaussSubMesh, virtual TSource
+  struct TGaussSubMeshImpl: virtual TGaussSubMesh, 
+                           virtual TSource
   {
     TGaussSubMeshImpl();
 
@@ -279,30 +284,27 @@ namespace VISU
   typedef TVector<PGaussSubMeshImpl> TGaussSubMeshArr;
   typedef std::map<vtkIdType,PGaussSubMeshImpl> TGeom2GaussSubMesh;
 
-  struct TGaussMeshImpl: virtual TGaussMesh, virtual TAppendFilter
+  struct TGaussMeshImpl: virtual TGaussMesh, 
+                        virtual TAppendFilter
   {
     TGaussMeshImpl();
 
     virtual
     TGaussPointID
-    GetObjID(int theVtkI) const;
+    GetObjID(vtkIdType theID) const;
 
     virtual
     TVTKOutput* 
-    GetVTKOutput()
-    {
-      return mySource.GetVTKOutput();
-    }
-
-    void SetParentMesh(VISU::TMeshOnEntityImpl* theMesh);
-
-    VISU::TMeshOnEntityImpl* GetParentMesh();
+    GetVTKOutput();
 
-    TGaussSubMeshArr myGaussSubMeshArr;
+    virtual 
+    TNamedIDMapper*
+    GetParent();
 
     TSource mySource;
+    TNamedIDMapper* myParent;
+    TGaussSubMeshArr myGaussSubMeshArr;
     TGeom2GaussSubMesh myGeom2GaussSubMesh;
-    TMeshOnEntityImpl* myParentMesh;
   };
   typedef SharedPtr<TGaussMeshImpl> PGaussMeshImpl;
 
@@ -317,6 +319,10 @@ namespace VISU
     vtkIdType 
     GetElemObjID(vtkIdType theID) const;
 
+    virtual
+    std::string 
+    GetElemName(vtkIdType theObjID) const;
+
     vtkIdType myStartID;
     TCell2Connect myCell2Connect;
   };
@@ -327,7 +333,9 @@ namespace VISU
   typedef std::map<vtkIdType,PSubMeshImpl> TGeom2SubMesh;
   typedef TVector<PSubMeshImpl> TSubMeshArr;
 
-  struct TMeshOnEntityImpl: virtual TMeshOnEntity, virtual TAppendFilter, virtual TSizeCounter
+  struct TMeshOnEntityImpl: virtual TMeshOnEntity, 
+                           virtual TAppendFilter, 
+                           virtual TSizeCounter
   {
     virtual 
     vtkIdType 
@@ -345,6 +353,14 @@ namespace VISU
     vtkIdType 
     GetElemObjID(vtkIdType theID) const;
 
+    virtual
+    std::string 
+    GetNodeName(vtkIdType theObjID) const;
+
+    virtual
+    std::string 
+    GetElemName(vtkIdType theObjID) const;
+
     TID2ID myElemObj2VTKID;
     TSubMeshArr mySubMeshArr;
     PNamedPointCoords myNamedPointCoords;
@@ -357,7 +373,8 @@ namespace VISU
   //---------------------------------------------------------------
   typedef std::map<vtkIdType,TSubMeshID> TGeom2SubMeshID;
 
-  struct TFamilyImpl: virtual TFamily, virtual TSource
+  struct TFamilyImpl: virtual TFamily, 
+                     virtual TSource
   {
     vtkIdType 
     GetNodeObjID(vtkIdType theID) const ;
@@ -376,10 +393,7 @@ namespace VISU
 
     virtual
     TVTKOutput* 
-    GetVTKOutput()
-    {
-      return TSource::GetVTKOutput();
-    }
+    GetVTKOutput();
 
     PNamedPointCoords myNamedPointCoords;
     TID2ID myElemObj2VTKID;
@@ -394,7 +408,8 @@ namespace VISU
   typedef std::pair<vtkIdType,vtkIdType> TNbASizeCells;
   typedef TVector<PFamilyImpl> TFamilyArr;
 
-  struct TGroupImpl: virtual TGroup, virtual TAppendFilter
+  struct TGroupImpl: virtual TGroup, 
+                    virtual TAppendFilter
   {
     TNbASizeCells 
     GetNbASizeCells() const;
index 6b1e5a5016ea90c557843f492e9225abb9d1ed84..8bfdd23fde761f4a15319d66f6b46cbfa7071b9b 100644 (file)
@@ -30,6 +30,7 @@
 #include "MED_SharedPtr.hxx"
 
 #include <vtkSystemIncludes.h>
+#include <string>
 
 class vtkUnstructuredGrid;
 class vtkCell;
@@ -81,6 +82,39 @@ namespace VISU
   };
   typedef SharedPtr<TIDMapper> PIDMapper;
   
+
+  //---------------------------------------------------------------
+  struct TNamedIDMapper: virtual TIDMapper
+  {
+    virtual
+    std::string 
+    GetNodeName(vtkIdType theObjID) const = 0;
+
+    virtual
+    std::string 
+    GetElemName(vtkIdType theObjID) const = 0;
+  };
+  typedef SharedPtr<TNamedIDMapper> PNamedIDMapper;
+  
+
+  //---------------------------------------------------------------
+  typedef vtkIdType TCellID;
+  typedef vtkIdType TLocalPntID;
+  typedef std::pair<TCellID,TLocalPntID> TGaussPointID;
+
+  struct TGaussPtsIDMapper: virtual TIDMapper
+  {
+    virtual 
+    TGaussPointID 
+    GetObjID(vtkIdType theID) const = 0;
+
+    virtual 
+    TNamedIDMapper*
+    GetParent() = 0;
+  };
+  typedef SharedPtr<TGaussPtsIDMapper> PGaussPtsIDMapper;
+
+  //---------------------------------------------------------------
 }
 
 #endif
index 133e200b6407fef5f0e9e8182ea91c98d8da5738..92d0736231b67bec0fe73b5ef457bdea993391bd 100644 (file)
@@ -919,6 +919,35 @@ namespace
   }
 
 
+  //---------------------------------------------------------------
+  void
+  TMEDNamedPointCoords
+  ::Init(vtkIdType theNbPoints,
+        vtkIdType theDim,
+        const MED::PNodeInfo& theNodeInfo)
+  {
+    if(theNodeInfo->IsElemNum())
+      TNamedPointCoords::Init(theNbPoints,theDim,theNodeInfo->myElemNum);
+    else
+      TNamedPointCoords::Init(theNbPoints,theDim);
+
+    if(theNodeInfo->IsElemNames() && theNbPoints > 0){
+      myPointNames.resize(theNbPoints);
+      for(vtkIdType anID = 0; anID < theNbPoints; anID++)
+       myPointNames[anID] = theNodeInfo->GetElemName(anID);
+    }
+  }
+
+  std::string 
+  TMEDNamedPointCoords
+  ::GetNodeName(vtkIdType theObjID) const
+  {
+    if(myPointNames.empty())
+      return TNamedPointCoords::GetNodeName(theObjID);
+    return myPointNames[theObjID];
+  }
+
+
   //---------------------------------------------------------------
   vtkIdType
   TMEDSubProfile
@@ -948,6 +977,21 @@ namespace
   
 
   //---------------------------------------------------------------
+  void
+  TMEDSubMesh
+  ::Init(const MED::PElemInfo& theElemInfo)
+  {
+    myIsElemNum = theElemInfo->IsElemNum();
+    myElemNum = theElemInfo->myElemNum;
+    if(theElemInfo->IsElemNames()){
+      TInt aNbElem = theElemInfo->GetNbElem();
+      myElemNames.resize(aNbElem);
+      for(TInt anID = 0; anID < aNbElem; anID++){
+       myElemNames[anID] = theElemInfo->GetElemName(anID);
+      }
+    }
+  }
+
   vtkIdType
   TMEDSubMesh
   ::GetElemObjID(vtkIdType theID) const
@@ -957,6 +1001,16 @@ namespace
     else
       return TSubMeshImpl::GetElemObjID(theID);
   }
+
+  std::string 
+  TMEDSubMesh
+  ::GetElemName(vtkIdType theObjID) const
+  {
+    if(myElemNames.empty())
+      return TSubMeshImpl::GetElemName(theObjID);
+    else
+      return myElemNames[theObjID];
+  }
 }
 
 
@@ -1015,7 +1069,8 @@ VISU_MedConvertor
       aMesh->myNbPoints = aNodeInfo->GetNbElem();
       aMesh->myMeshInfo = aMeshInfo;
       aMesh->myEntityInfo = aEntityInfo;
-      
+      aMesh->myNamedPointCoords(new TMEDNamedPointCoords());
+
       INITMSG(MYDEBUG,"aMeshName = '"<<aMeshName<<
              "'; myNbPoints = "<<aMesh->myNbPoints<<
              "; aDim = "<<aDim<<"\n");
@@ -1202,11 +1257,9 @@ VISU_MedConvertor
     TInt aNbElem = aNodeInfo->GetNbElem();
     TInt aDim = theMesh->myDim;
 
-    TNamedPointCoords& aCoords = theMesh->myNamedPointCoords;
-    if(EBooleen anIsNodeNum = aNodeInfo->IsElemNum())
-      aCoords.Init(aNbElem,aDim,aNodeInfo->myElemNum);
-    else
-      aCoords.Init(aNbElem,aDim);
+    PMEDNamedPointCoords aNamedPointCoords = theMesh->myNamedPointCoords;
+    TMEDNamedPointCoords& aCoords = aNamedPointCoords;
+    aCoords.Init(aNbElem,aDim,aNodeInfo);
     
     for(int iDim = 0; iDim < aDim; iDim++)
       aCoords.GetName(iDim) = aNodeInfo->GetCoordName(iDim);
@@ -1220,9 +1273,8 @@ VISU_MedConvertor
     
     TGeom2SubMesh& aGeom2SubMesh = aMeshOnEntity->myGeom2SubMesh;
     PMEDSubMesh aSubMesh = aGeom2SubMesh[VTK_VERTEX](new TMEDSubMesh());
-         
-    aSubMesh->myIsElemNum = aNodeInfo->IsElemNum();
-    aSubMesh->myElemNum = aNodeInfo->myElemNum;
+
+    aSubMesh->Init(aNodeInfo); 
     aSubMesh->myNbCells = theMesh->myNbPoints;
     aSubMesh->myCellsSize = 2*theMesh->myNbPoints;
     
@@ -1341,8 +1393,7 @@ VISU_MedConvertor
        if(aNbElem > 0){
          PMEDSubMesh aSubMesh = aGeom2SubMesh[aVGeom](new TMEDSubMesh());
          
-         aSubMesh->myIsElemNum = aPolygoneInfo->IsElemNum();
-         aSubMesh->myElemNum = aPolygoneInfo->myElemNum;
+         aSubMesh->Init(aPolygoneInfo); 
          aSubMesh->myNbCells = aNbElem;      
 
          TCell2Connect& aCell2Connect = aSubMesh->myCell2Connect;
@@ -1367,8 +1418,7 @@ VISU_MedConvertor
        if(aNbElem > 0){
          PMEDSubMesh aSubMesh = aGeom2SubMesh[aVGeom](new TMEDSubMesh());
          
-         aSubMesh->myIsElemNum = aPolyedreInfo->IsElemNum();
-         aSubMesh->myElemNum = aPolyedreInfo->myElemNum;
+         aSubMesh->Init(aPolyedreInfo); 
          aSubMesh->myNbCells = aNbElem;      
 
          TCell2Connect& aCell2Connect = aSubMesh->myCell2Connect;
@@ -1410,8 +1460,7 @@ VISU_MedConvertor
        if(aNbElem > 0){
          PMEDSubMesh aSubMesh = aGeom2SubMesh[aVGeom](new TMEDSubMesh());
          
-         aSubMesh->myIsElemNum = aCellInfo->IsElemNum();
-         aSubMesh->myElemNum = aCellInfo->myElemNum;
+         aSubMesh->Init(aCellInfo); 
          aSubMesh->myNbCells = aNbElem;      
          aSubMesh->myCellsSize = aNbElem*(aVNbNodes+1);
 
index 0307427d904ffd53a1527d96f0d5d069a9915627..ee063780bc5fbe2b7f842c340aeaf9bbb60d1a11 100644 (file)
 
 namespace VISU
 {
+  typedef TVector<TName> TNames;
+
+  //---------------------------------------------------------------
+  class TMEDNamedPointCoords: public virtual TNamedPointCoords
+  {
+    TNames myPointNames;
+  public:
+    void
+    Init(vtkIdType theNbPoints,
+        vtkIdType theDim,
+        const MED::PNodeInfo& theNodeInfo);
+
+    virtual
+    std::string 
+    GetNodeName(vtkIdType theObjID) const;
+  };
+  typedef SharedPtr<TMEDNamedPointCoords> PMEDNamedPointCoords;
+
+
   //---------------------------------------------------------------
   struct TMEDMesh: virtual TMeshImpl
   {
@@ -93,10 +112,18 @@ namespace VISU
 
     MED::EBooleen myIsElemNum;
     MED::TElemNum myElemNum;
+    TNames myElemNames;
+
+    void
+    Init(const MED::PElemInfo& theElemInfo);
 
     virtual 
     vtkIdType 
     GetElemObjID(vtkIdType theID) const;
+
+    virtual
+    std::string 
+    GetElemName(vtkIdType theObjID) const;
   };
   typedef SharedPtr<TMEDSubMesh> PMEDSubMesh;
 
index be0d5a90aa57d444866f7b856cc3954c30257a0c..8489cc3bd2534af023429ac4c0914b715d918f2e 100644 (file)
@@ -62,7 +62,6 @@
 #include <vtkCell.h>
 #include <vtkMath.h>
 
-#include "VISU_Convertor_impl.hxx"
 //
 ///////////////////////////////////////////////////////////////////////////
 //
@@ -286,24 +285,24 @@ VISU_GaussPtsAct
   mySphereActorSelected->GetProperty()->SetColor(aColorSelected);
   // 
   // Cell 
-  myCellSource=vtkUnstructuredGrid::New();
+  myCellSource = vtkUnstructuredGrid::New();
   myCellSource->Allocate();
-  myCellMapper=vtkDataSetMapper::New();
-  myCellActor=vtkActor::New();
-  //
   myCellSource->Delete();
+  //
+  myCellMapper = vtkDataSetMapper::New();
   myCellMapper->Delete();
+  //
+  myCellActor = vtkActor::New();
   myCellActor->Delete();
   //
   myCellMapper->SetInput(myCellSource.GetPointer());
   myCellActor->SetMapper(myCellMapper.GetPointer());
   myCellActor->SetVisibility(0);
   myCellActor->SetPickable(0);
-  
-  float aColorCell[3]={.9,.9,.9};
-  vtkProperty* pPropertyCell=myCellActor->GetProperty();
-  pPropertyCell->SetColor(aColorCell);
-  pPropertyCell->SetRepresentationToWireframe(); 
+  //
+  myCellActor->GetProperty()->SetAmbient(1.0);
+  myCellActor->GetProperty()->SetDiffuse(0.0);
+  myCellActor->GetProperty()->SetRepresentationToWireframe(); 
 }
 
 VISU_GaussPtsAct
@@ -374,7 +373,8 @@ VISU_GaussPtsAct
 {
   myTextActor->SetVisibility(false);
   mySphereActor->SetVisibility(false);
-  myCursorPyramid->SetVisibility(0);  
+  myCursorPyramid->SetVisibility(false);  
+  myCellActor->SetVisibility(false);
 
   if(theSelectionEvent->mySelectionMode == ActorSelection || !theIsHighlight)
     return Superclass::PreHighlight(theSelector,theInteractorStyle,theSelectionEvent,theIsHighlight);
@@ -414,10 +414,14 @@ VISU_GaussPtsAct
          std::ostringstream aStr;
          aStr<<"Global ID: "<<anObjId;
 
+         const VISU::PGaussMesh& aGaussMesh = myGaussPointsPL->GetGaussMesh();
+         VISU::TNamedIDMapper* aParent = aGaussMesh->GetParent();
+
          VISU::TGaussPointID aGaussPointID = myGaussPointsPL->GetObjID(anObjId);
          VISU::TCellID aCellID = aGaussPointID.first;
          VISU::TLocalPntID aLocalPntID = aGaussPointID.second;
          aStr<<"\nParentCellID: "<<aCellID;
+         //aStr<<"\nParentCellName: '"<<aParent->GetElemName(aCellID)<<"'";
          aStr<<"\nLocalPntID: "<<aLocalPntID;
 
          vtkDataSet* aDataSet = GetInput();
@@ -476,10 +480,12 @@ VISU_GaussPtsAct
 // function : Highlight
 // purpose  :
 //==================================================================
-bool VISU_GaussPtsAct::Highlight(SVTK_Selector* theSelector, 
-                                vtkInteractorStyle* theInteractorStyle, 
-                                SVTK_SelectionEvent* theSelectionEvent,
-                                bool theIsHighlight)
+bool
+VISU_GaussPtsAct
+::Highlight(SVTK_Selector* theSelector, 
+           vtkInteractorStyle* theInteractorStyle, 
+           SVTK_SelectionEvent* theSelectionEvent,
+           bool theIsHighlight)
 { 
   int aTextVisibility = myTextActor->GetVisibility();
   int aSphereVisibility = mySphereActor->GetVisibility();
@@ -569,45 +575,21 @@ bool VISU_GaussPtsAct::Highlight(SVTK_Selector* theSelector,
        //
        if(aSelectionMode == CellSelection){
          // Hilighting an element from the parent Mesh
-         int k, aNbPoints, aIDs[20];
-         float *pX;
-         vtkIdType aCellID;
-         vtkCell* pCell; 
-         vtkPoints *pPoints;
-         VISU::TMeshOnEntityImpl* pMeshOnEntityImpl; 
-         //
-         const VISU::PGaussMesh& aGaussMesh=myGaussPointsPL->GetGaussMesh();
-         VISU::TGaussMeshImpl* pGaussMeshImpl=
-           dynamic_cast<VISU::TGaussMeshImpl*>(aGaussMesh.get());
-         //
-         VISU::TGaussPointID anGPID= aGaussMesh->GetObjID(anObjId);
-         aCellID=anGPID.first;
-
-         pMeshOnEntityImpl=pGaussMeshImpl->GetParentMesh();
-         pCell=pMeshOnEntityImpl->GetElemCell(aCellID);
-         //
-         pPoints=pCell->GetPoints();
-         //
-         aNbPoints=pCell->GetNumberOfPoints();
-         for (k=0; k<aNbPoints; ++k) {
-           pX=pPoints->GetPoint(k);
-           aIDs[k]=k;  
-         }
-         myCellSource->Initialize();
-         myCellSource->Allocate();
-         myCellSource->SetPoints(pCell->GetPoints());
-         myCellSource->InsertNextCell(pCell->GetCellType(), aNbPoints, aIDs);
-         //
-         vtkProperty* pPropertyCell=myCellActor->GetProperty();
-         pPropertyCell->SetAmbient(1.0);
-         pPropertyCell->SetDiffuse(0.0);
-         pPropertyCell->SetRepresentationToWireframe(); 
-         if (theSelector->HasIndex(myIO)) {
+         if(theSelector->HasIndex(myIO)){
+           const VISU::PGaussMesh& aGaussMesh = myGaussPointsPL->GetGaussMesh();
+           VISU::TNamedIDMapper* aParent = aGaussMesh->GetParent();
+
+           myCellSource->Reset();
+           myCellSource->Modified(); // a VTK bug
+           myCellSource->SetPoints(aParent->GetVTKOutput()->GetPoints());
+
+           VISU::TGaussPointID aGaussPointID = aGaussMesh->GetObjID(anObjId);
+           vtkIdType aCellID = aGaussPointID.first;
+           vtkCell* aCell = aParent->GetElemCell(aCellID);
+           myCellSource->InsertNextCell(aCell->GetCellType(),aCell->GetPointIds());
+
            myCellActor->SetVisibility(1);
          }
-         else { 
-           myCellActor->SetVisibility(0);
-         }
        }
        
        return bRet;