]> SALOME platform Git repositories - modules/visu.git/commitdiff
Salome HOME
The deep revision of the PrsMerger and ScalarMapOnDeformedShape presentations (bound... T_PAL_15278
authorapo <apo@opencascade.com>
Tue, 8 May 2007 13:38:43 +0000 (13:38 +0000)
committerapo <apo@opencascade.com>
Tue, 8 May 2007 13:38:43 +0000 (13:38 +0000)
42 files changed:
src/CONVERTOR/VISUConvertor.cxx
src/CONVERTOR/VISU_CommonCellsFilter.cxx
src/CONVERTOR/VISU_ConvertorUtils.cxx
src/CONVERTOR/VISU_ConvertorUtils.hxx
src/CONVERTOR/VISU_Convertor_impl.cxx
src/CONVERTOR/VISU_MergeFilter.cxx
src/CONVERTOR/VISU_MergeFilter.hxx
src/OBJECT/VISU_Actor.cxx
src/PIPELINE/Makefile.in
src/PIPELINE/VISUPipeLine.cxx
src/PIPELINE/VISU_CellDataToPointData.cxx [new file with mode: 0644]
src/PIPELINE/VISU_CellDataToPointData.hxx [new file with mode: 0644]
src/PIPELINE/VISU_CutLinesPL.cxx
src/PIPELINE/VISU_CutPlanesPL.cxx
src/PIPELINE/VISU_CutPlanesPL.hxx
src/PIPELINE/VISU_DeformedShapePL.cxx
src/PIPELINE/VISU_DeformedShapePL.hxx
src/PIPELINE/VISU_GaussPointsPL.cxx
src/PIPELINE/VISU_GaussPointsPL.hxx
src/PIPELINE/VISU_IsoSurfacesPL.cxx
src/PIPELINE/VISU_IsoSurfacesPL.hxx
src/PIPELINE/VISU_MeshPL.cxx
src/PIPELINE/VISU_PipeLine.cxx
src/PIPELINE/VISU_PipeLine.hxx
src/PIPELINE/VISU_PipeLineUtils.hxx
src/PIPELINE/VISU_Plot3DPL.cxx
src/PIPELINE/VISU_Plot3DPL.hxx
src/PIPELINE/VISU_PrsMergerPL.cxx
src/PIPELINE/VISU_PrsMergerPL.hxx
src/PIPELINE/VISU_ScalarMapOnDeformedShapePL.cxx
src/PIPELINE/VISU_ScalarMapOnDeformedShapePL.hxx
src/PIPELINE/VISU_ScalarMapPL.cxx
src/PIPELINE/VISU_ScalarMapPL.hxx
src/PIPELINE/VISU_StreamLinesPL.cxx
src/PIPELINE/VISU_StreamLinesPL.hxx
src/PIPELINE/VISU_VectorsPL.cxx
src/PIPELINE/VISU_VectorsPL.hxx
src/VISUGUI/VisuGUI_Selection.cxx
src/VISU_I/VISU_GaussPoints_i.cc
src/VISU_I/VISU_PrsMerger_i.cc
src/VISU_I/VISU_PrsMerger_i.hh
src/VISU_I/VISU_ScalarMap_i.cc

index 60ce65673b63b74dd5c88197e35d95aeeca090b7..0a470a0e7c61e068ab7e1092fcfdce27b371b6ab 100644 (file)
@@ -62,17 +62,28 @@ void parseFile(const char* theFileName)
     aCon->BuildEntities();
     aCon->BuildFields();
     aCon->BuildMinMax();
+    aCon->BuildGroups();
+
     const VISU::TMeshMap& aMeshMap = aCon->GetMeshMap();
     //return;
     VISU::TMeshMap::const_iterator aMeshMapIter = aMeshMap.begin();
     for(; aMeshMapIter != aMeshMap.end(); aMeshMapIter++){
-      //continue;
 
       const string& aMeshName = aMeshMapIter->first;
       const VISU::PMesh& aMesh = aMeshMapIter->second;
       const VISU::TMeshOnEntityMap& aMeshOnEntityMap = aMesh->myMeshOnEntityMap;
       VISU::TMeshOnEntityMap::const_iterator aMeshOnEntityMapIter;
 
+      //Importing groups
+      const VISU::TGroupMap& aGroupMap = aMesh->myGroupMap;
+      VISU::TGroupMap::const_iterator aGroupMapIter = aGroupMap.begin();
+      for(; aGroupMapIter != aGroupMap.end(); aGroupMapIter++){
+       const string& aGroupName = aGroupMapIter->first;
+       aCon->GetMeshOnGroup(aMeshName,aGroupName);
+      }
+      
+      //continue;
+
       //Import fields
       aMeshOnEntityMapIter = aMeshOnEntityMap.begin();
       for(; aMeshOnEntityMapIter != aMeshOnEntityMap.end(); aMeshOnEntityMapIter++){
@@ -88,7 +99,7 @@ void parseFile(const char* theFileName)
          for(; aValFieldIter != aValField.end(); aValFieldIter++){
            int aTimeStamp = aValFieldIter->first;
 
-           if(anEntity != VISU::NODE_ENTITY){
+           if(false && anEntity != VISU::NODE_ENTITY){
              VISU::PGaussPtsIDMapper aGaussMesh = 
                aCon->GetTimeStampOnGaussPts(aMeshName,anEntity,aFieldName,aTimeStamp);
              VISU::TVTKOutput* aDataSet = aGaussMesh->GetVTKOutput();
@@ -117,14 +128,6 @@ void parseFile(const char* theFileName)
        }
       }
 
-      //Importing groups
-      const VISU::TGroupMap& aGroupMap = aMesh->myGroupMap;
-      VISU::TGroupMap::const_iterator aGroupMapIter = aGroupMap.begin();
-      for(; aGroupMapIter != aGroupMap.end(); aGroupMapIter++){
-       const string& aGroupName = aGroupMapIter->first;
-       aCon->GetMeshOnGroup(aMeshName,aGroupName);
-      }
-
       //continue;
 
       //Import mesh on entity
index 2473ea64f5125f640d478d8c43be95caff2a4cbb..e0dd2220e759aa3cddf0f754f5043de3182952ef 100644 (file)
@@ -290,12 +290,16 @@ VISU_CommonCellsFilter
           //anOutput->GetPointData()->GetArray("VISU_CELLS_MAPPER")->SetName("VISU_POINTS_MAPPER");
 
           // apply VISU_POINTS_MAPPER
+         int anEntity = int(VISU::NODE_ENTITY);
           vtkIntArray*  aNewPointsIdsArray = vtkIntArray::New();
           aNewPointsIdsArray->SetName("VISU_POINTS_MAPPER");
-          aNewPointsIdsArray->SetNumberOfComponents(1);
+          aNewPointsIdsArray->SetNumberOfComponents(2);
           aNewPointsIdsArray->SetNumberOfTuples(aPointIdsForCopy->GetNumberOfIds());
-          for(int i=0;i<aPointIdsForCopy->GetNumberOfIds();i++)
-            aNewPointsIdsArray->SetValue(i,aPointIdsForCopy->GetId(i));
+         int *aPtr = aNewPointsIdsArray->GetPointer(0);
+          for(int i = 0; i < aPointIdsForCopy->GetNumberOfIds(); i++){
+           *aPtr++ = aPointIdsForCopy->GetId(i);
+           *aPtr++ = anEntity;
+         }
           anOutput->GetPointData()->AddArray(aNewPointsIdsArray);
 
           
index 7839fab88c88abd85e7ed1abec1ed4034e084122..573d1664dfd637b8d0c18c68daa7027fe5d1e9a7 100644 (file)
@@ -25,6 +25,7 @@
 //  Module : VISU
 
 #include "VISU_ConvertorUtils.hxx"
+#include "VISU_ConvertorDef.hxx"
 
 #include <vtkUnstructuredGridWriter.h>
 #include <vtkTimerLog.h>
@@ -81,6 +82,37 @@ namespace VISU
   }
 
 
+  //---------------------------------------------------------------
+  vtkIdType
+  GetVTKID(vtkDataArray *theIDDataArray, vtkIdType theID, int theEntity)
+  {
+    if(vtkIntArray *anIntArray = dynamic_cast<vtkIntArray*>(theIDDataArray)){
+      int aNbTuples = anIntArray->GetNumberOfTuples();
+      int* aPointer = anIntArray->GetPointer(0);
+      for(int aTupleId = 0; aTupleId < aNbTuples; aTupleId++){
+       if(*aPointer == theID && *(aPointer + 1) == theEntity){
+         return aTupleId;
+       }
+       aPointer += 2;
+      }
+    }
+    return -1;
+  }
+
+
+  //---------------------------------------------------------------
+  vtkIdType
+  GetObjectID(vtkDataArray *theIDDataArray, vtkIdType theID)
+  {
+    if(vtkIntArray *anIntArray = dynamic_cast<vtkIntArray*>(theIDDataArray)){
+      int aNbComp = anIntArray->GetNumberOfComponents();
+      int* aPointer = anIntArray->GetPointer(theID*aNbComp);
+      return *aPointer;
+    }
+    return -1;
+  }
+
+
   //---------------------------------------------------------------
   vtkIdType
   GetElemVTKID(vtkDataSet *theDataSet, vtkIdType theID, int theEntity)
@@ -88,22 +120,29 @@ namespace VISU
     theDataSet->Update();
     vtkDataSetAttributes *aDataSetAttributes = theDataSet->GetCellData();
     if(vtkDataArray *aDataArray = aDataSetAttributes->GetArray("VISU_CELLS_MAPPER")){
-      if(vtkIntArray *anIntArray = dynamic_cast<vtkIntArray*>(aDataArray)){
-        int nbTuples = anIntArray->GetNumberOfTuples();
-        int aMaxId = nbTuples * anIntArray->GetNumberOfComponents();
-       int* aPointer = anIntArray->GetPointer(0);
-        for(int i=0;i<nbTuples;i++){
-          if ( *aPointer == theID ){
-            aPointer++;
-            if( *aPointer == theEntity)
-              return i;
-            aPointer++;
-            continue;
-          }
-          aPointer++;aPointer++;
-        }
-       return -1;
-      }
+      if(theEntity < 0){
+       {
+         vtkIdType anID = GetVTKID(aDataArray, theID, VISU::CELL_ENTITY);
+         if(anID != -1)
+           return anID;
+       }
+       {
+         vtkIdType anID = GetVTKID(aDataArray, theID, VISU::FACE_ENTITY);
+         if(anID != -1)
+           return anID;
+       }
+       {
+         vtkIdType anID = GetVTKID(aDataArray, theID, VISU::EDGE_ENTITY);
+         if(anID != -1)
+           return anID;
+       }
+       {
+         vtkIdType anID = GetVTKID(aDataArray, theID, VISU::NODE_ENTITY);
+         if(anID != -1)
+           return anID;
+       }
+      }else
+       return GetVTKID(aDataArray, theID, theEntity);
     }
     return -1;
   }
@@ -115,31 +154,31 @@ namespace VISU
   {
     theDataSet->Update();
     vtkDataSetAttributes *aDataSetAttributes = theDataSet->GetCellData();
-    if(vtkDataArray *aDataArray = aDataSetAttributes->GetArray("VISU_CELLS_MAPPER")){
-      if(vtkIntArray *anIntArray = dynamic_cast<vtkIntArray*>(aDataArray)){
-        int nbComp = anIntArray->GetNumberOfComponents();
-       return *anIntArray->GetPointer(theID*nbComp);
-      }
-    }
+    if(vtkDataArray *aDataArray = aDataSetAttributes->GetArray("VISU_CELLS_MAPPER"))
+      return GetObjectID(aDataArray, theID);
+
     return -1;
   }
 
 
+  //---------------------------------------------------------------
+  vtkCell* 
+  GetElemCell(vtkDataSet *theDataSet, vtkIdType  theObjID)
+  {
+    vtkIdType aVTKID = GetElemVTKID(theDataSet, theObjID);
+    return theDataSet->GetCell(aVTKID);
+  }
+
+
   //---------------------------------------------------------------
   vtkIdType
   GetNodeVTKID(vtkDataSet *theDataSet, vtkIdType theID)
   {
     theDataSet->Update();
     vtkDataSetAttributes *aDataSetAttributes = theDataSet->GetPointData();
-    if(vtkDataArray *aDataArray = aDataSetAttributes->GetArray("VISU_POINTS_MAPPER")){
-      if(vtkIntArray *anIntArray = dynamic_cast<vtkIntArray*>(aDataArray)){
-       int aMaxId = anIntArray->GetMaxId();
-       int* aPointer = anIntArray->GetPointer(0);
-       int* anEndPointer = anIntArray->GetPointer(aMaxId + 1);
-       int* aPtr = std::find(aPointer, anEndPointer, theID);
-       return aPtr - aPointer;
-      }
-    }
+    if(vtkDataArray *aDataArray = aDataSetAttributes->GetArray("VISU_POINTS_MAPPER"))
+      return GetVTKID(aDataArray, theID, VISU::NODE_ENTITY);
+
     return -1;
   }
 
@@ -150,15 +189,22 @@ namespace VISU
   {
     theDataSet->Update();
     vtkDataSetAttributes *aDataSetAttributes = theDataSet->GetPointData();
-    if(vtkDataArray *aDataArray = aDataSetAttributes->GetArray("VISU_POINTS_MAPPER")){
-      if(vtkIntArray *anIntArray = dynamic_cast<vtkIntArray*>(aDataArray)){
-       return anIntArray->GetValue(theID);
-      }
-    }
+    if(vtkDataArray *aDataArray = aDataSetAttributes->GetArray("VISU_POINTS_MAPPER"))
+      return GetObjectID(aDataArray, theID);
+
     return -1;
   }
 
 
+  //---------------------------------------------------------------
+  vtkFloatingPointType* 
+  GetNodeCoord(vtkDataSet *theDataSet, vtkIdType theObjID)
+  {
+    vtkIdType aVTKID = GetNodeVTKID(theDataSet, theObjID);
+    return theDataSet->GetPoint(aVTKID);
+  }
+
+
   //---------------------------------------------------------------
   TTimerLog
   ::TTimerLog(int theIsDebug,
index f70b69f55b141ad2ddeeb4bb83addf5160c2e3c0..8d324dbfcc81156c789699eb05c7e8ff3aa1d5fa 100644 (file)
@@ -37,6 +37,7 @@
 class vtkUnstructuredGrid;
 class vtkTimerLog;
 class vtkDataSet;
+class vtkCell;
 
 namespace MED
 {
@@ -56,17 +57,23 @@ namespace VISU
   IsDataOnPoints(vtkDataSet* theDataSet);
 
   vtkIdType
-  GetElemVTKID(vtkDataSet *theDataSet, vtkIdType theID, int theEntity);
+  GetElemVTKID(vtkDataSet *theDataSet, vtkIdType theID, int theEntity = -1);
 
   vtkIdType
   GetElemObjID(vtkDataSet *theDataSet, vtkIdType theID);
 
+  vtkCell* 
+  GetElemCell(vtkDataSet *theDataSet, vtkIdType theObjID);
+
   vtkIdType
   GetNodeVTKID(vtkDataSet *theDataSet, vtkIdType theID);
 
   vtkIdType
   GetNodeObjID(vtkDataSet *theDataSet, vtkIdType theID);
 
+  vtkFloatingPointType* 
+  GetNodeCoord(vtkDataSet *theDataSet, vtkIdType theObjID);
+
   class TTimerLog
   {
     int myIsDebug;
index e63d3b60ae18d1aa8bfe8f9901cb9cbc701f253c..cbf89c2579979043229f3697bb5223a24a6eb7fc 100644 (file)
@@ -1226,13 +1226,16 @@ namespace
       }
 
       vtkIdType aNbTuples = aNbPoints;
+      int anEntity = int(VISU::NODE_ENTITY);
       vtkIntArray *aDataArray = vtkIntArray::New();
       aDataArray->SetName("VISU_POINTS_MAPPER");
-      aDataArray->SetNumberOfComponents(1);
+      aDataArray->SetNumberOfComponents(2);
       aDataArray->SetNumberOfTuples(aNbTuples);
+      int *aPtr = aDataArray->GetPointer(0);
       for(vtkIdType aTupleId = 0; aTupleId < aNbTuples; aTupleId++){
        vtkIdType anObjID = aCoords.GetObjID(aTupleId);
-       aDataArray->SetValue(aTupleId, anObjID);
+        *aPtr++ = anObjID;
+        *aPtr++ = anEntity;
        }
       aPointSource->GetPointData()->AddArray(aDataArray);
       aDataArray->Delete();
@@ -1291,6 +1294,7 @@ namespace
 
     {
       int aNbTuples = aNbCells;
+      int anEntity = int(theMeshOnEntity->myEntity);
       vtkIntArray *aDataArray = vtkIntArray::New();
       aDataArray->SetName("VISU_CELLS_MAPPER");
       // the [0] component is element object ID
@@ -1300,13 +1304,10 @@ namespace
       int *aPtr = aDataArray->GetPointer(0);
       for(int aTupleId = 0; aTupleId < aNbTuples; aTupleId++){
        int anObjID = theSubMesh->GetElemObjID(aTupleId);
-        *aPtr = anObjID;
-        aPtr++;
-        *aPtr = (int)theMeshOnEntity->myEntity;
-        aPtr++;
+        *aPtr++ = anObjID;
+        *aPtr++ = anEntity;
       }
       theSource->GetCellData()->AddArray(aDataArray);
-      
       aDataArray->Delete();
     }
     vtkIdType *pts = 0, npts = 0;
@@ -1348,6 +1349,7 @@ namespace
 
     vtkIntArray *aDataArray = vtkIntArray::New();
 
+    int anEntity = int(theMeshOnEntity->myEntity);
     aDataArray->SetName("VISU_CELLS_MAPPER");
     // the [0] component is element object ID
     // the [1] component is entity type
@@ -1388,12 +1390,10 @@ namespace
        PrintCells(aCellId, aConnectivity, anArray[anID]);
        aCellTypesArray->SetValue(aCellId, (unsigned char)aVGeom);
        vtkIdType anObjID = aSubMesh.GetElemObjID(anID);
-        *aPtr = anObjID;
-        aPtr++;
-        *aPtr = (int)theMeshOnEntity->myEntity;
-        aPtr++;
        anElemObj2VTKID[anObjID] = aCellId;
        aMeshID[aCellId] = anObjID;
+        *aPtr++ = anObjID;
+        *aPtr++ = anEntity;
       }
     }
     theSource->GetCellData()->AddArray(aDataArray);
@@ -1574,20 +1574,18 @@ namespace
     
     {
       int aNbTuples = aNbCells;
+      int anEntity = int(theMeshOnEntity->myEntity);
       vtkIntArray *aDataArray = vtkIntArray::New();
       aDataArray->SetName("VISU_CELLS_MAPPER");
       // the [0] component is element object ID
       // the [1] component is entity type
       aDataArray->SetNumberOfComponents(2);
       aDataArray->SetNumberOfTuples(aNbTuples);
-      int *aPtr = aDataArray->GetPointer(0);
-      
+      int *aPtr = aDataArray->GetPointer(0);      
       for(int aTupleId = 0; aTupleId < aNbTuples; aTupleId++){
        int anObjID = theSubProfile->GetElemObjID(aTupleId);
-        *aPtr = anObjID;
-        aPtr++;
-        *aPtr = (int)theMeshOnEntity->myEntity;
-        aPtr++;
+        *aPtr++ = anObjID;
+        *aPtr++ = anEntity;
       }
       theSource->GetCellData()->AddArray(aDataArray);
       aDataArray->Delete();
index f7b384ffccbae121e45264523321a7bda974b0e6..29ad6ec696b43eb839ac802131b6b0399f5ba1c4 100644 (file)
@@ -27,6 +27,7 @@
 //  $Header$
 
 #include "VISU_MergeFilter.hxx"
+#include "VISU_ConvertorUtils.hxx"
 
 #include <vtkCellData.h>
 #include <vtkObjectFactory.h>
@@ -50,12 +51,10 @@ static int MYDEBUG = 0;
 #else
 static int MYDEBUG = 0;
 #endif
-// TTimerLog
-#include "VISU_ConvertorUtils.hxx"
 
 namespace VISU
 {
-
+  //---------------------------------------------------------------
   class TFieldNode
   {
   public:
@@ -88,6 +87,7 @@ namespace VISU
     char* Name;
   };
 
+  //---------------------------------------------------------------
   class TFieldList
   {
   public:
@@ -127,6 +127,8 @@ namespace VISU
     TFieldNode* Last;
   };
   
+
+  //---------------------------------------------------------------
   class TFieldListIterator
   {
   public:
@@ -173,11 +175,37 @@ VISU_MergeFilter::VISU_MergeFilter():
   this->FieldList = new VISU::TFieldList;
 }
 
+
+//---------------------------------------------------------------
 VISU_MergeFilter::~VISU_MergeFilter()
 {
   delete this->FieldList;
 }
 
+
+//---------------------------------------------------------------
+unsigned long
+VISU_MergeFilter
+::GetMTime()
+{
+  int aNbInputs = GetNumberOfInputs();
+  vtkDataObject** aDataObjects = GetInputs();
+  unsigned long aTime = Superclass::GetMTime();
+  for(int anInputId = 0; anInputId < aNbInputs; anInputId++){
+    if(vtkDataObject* aDataObject = aDataObjects[anInputId])
+      aTime = std::max(aTime, aDataObject->GetMTime());
+  }
+  if(this->FieldList){
+    VISU::TFieldListIterator anIter(this->FieldList);
+    for(anIter.Begin(); !anIter.End() ; anIter.Next()){
+      if(vtkDataSet *aDataSet = anIter.Get()->Ptr)
+       aTime = std::max(aTime, aDataSet->GetMTime());
+    }
+  }
+  return aTime;
+}
+
+//---------------------------------------------------------------
 void VISU_MergeFilter::SetScalars(vtkDataSet *input)
 {
   this->vtkProcessObject::SetNthInput(1, input);
@@ -191,6 +219,8 @@ vtkDataSet *VISU_MergeFilter::GetScalars()
   return (vtkDataSet *)(this->Inputs[1]);
 }
 
+
+//---------------------------------------------------------------
 void VISU_MergeFilter::SetVectors(vtkDataSet *input)
 {
   this->vtkProcessObject::SetNthInput(2, input);
@@ -204,6 +234,8 @@ vtkDataSet *VISU_MergeFilter::GetVectors()
   return (vtkDataSet *)(this->Inputs[2]);
 }
 
+
+//---------------------------------------------------------------
 void VISU_MergeFilter::SetNormals(vtkDataSet *input)
 {
   this->vtkProcessObject::SetNthInput(3, input);
@@ -217,6 +249,8 @@ vtkDataSet *VISU_MergeFilter::GetNormals()
   return (vtkDataSet *)(this->Inputs[3]);
 }
 
+
+//---------------------------------------------------------------
 void VISU_MergeFilter::SetTCoords(vtkDataSet *input)
 {
   this->vtkProcessObject::SetNthInput(4, input);
@@ -230,6 +264,8 @@ vtkDataSet *VISU_MergeFilter::GetTCoords()
   return (vtkDataSet *)(this->Inputs[4]);
 }
 
+
+//---------------------------------------------------------------
 void VISU_MergeFilter::SetTensors(vtkDataSet *input)
 {
   this->vtkProcessObject::SetNthInput(5, input);
@@ -243,6 +279,8 @@ vtkDataSet *VISU_MergeFilter::GetTensors()
   return (vtkDataSet *)(this->Inputs[5]);
 }
 
+
+//---------------------------------------------------------------
 void VISU_MergeFilter::AddField(const char* name, vtkDataSet* input)
 {
   this->FieldList->Add(name, input);
@@ -252,699 +290,283 @@ void VISU_MergeFilter::RemoveFields()
 {
   delete this->FieldList;
   this->FieldList = new VISU::TFieldList;
+  this->Modified();
 }
 
 namespace
 {
-  typedef std::vector<int> TSortedArray;
+  //---------------------------------------------------------------
+  typedef int TCellId;
+  typedef int TEntityId;
+  typedef std::pair<TCellId, TEntityId> TObjectId;
 
-  inline
+  typedef std::set<TObjectId> TObjectIdSet;
+  typedef std::vector<TObjectId> TObjectIdArray;
+
+  typedef int TTupleId;
+  typedef std::map<TObjectId, TTupleId> TObjectId2TupleIdMap;
+
+
+  //---------------------------------------------------------------
   void
-  GetSortedArray(vtkIntArray *theArray, 
-                TSortedArray& theSortedArray)
+  GetObjectIdSet(vtkIntArray *theArray, 
+                TObjectIdSet& theObjectIdSet)
   {
+    theObjectIdSet.clear();
     int aMaxId = theArray->GetMaxId();
     int* aPointer = theArray->GetPointer(0);
     int* anEndPointer = theArray->GetPointer(aMaxId + 1);
-    TSortedArray aSortedArray(aPointer, anEndPointer);
-    std::sort(aSortedArray.begin(), aSortedArray.end());
-    theSortedArray.swap(aSortedArray);
-  }
-
-  typedef std::map<int,int> TId2IdMap;
-  typedef std::set<int> TIdSet;
-
-  template <class TNumericType>
-  void DeepCopySwitchOnOutput(TNumericType *theInputPtr, 
-                             TNumericType *theOutputPtr,
-                             const TSortedArray& theIntersection,
-                             const TId2IdMap& theObj2VTKMap,
-                             vtkIdType theNbComp)
-  {
-    vtkIdType aNbIds = theIntersection.size();
-    for(vtkIdType aTargetTupleId = 0; aTargetTupleId < aNbIds; aTargetTupleId++){
-      vtkIdType aTargetId = aTargetTupleId*theNbComp;
-      vtkIdType anObjId = theIntersection[aTargetTupleId];
-      TId2IdMap::const_iterator anIter = theObj2VTKMap.find(anObjId);
-      vtkIdType aSourceTupleId = anIter->second;
-      vtkIdType aSourceId = aSourceTupleId*theNbComp;
-      for(vtkIdType aComp = 0; aComp < theNbComp; aComp++){
-       theOutputPtr[aTargetId++] = theInputPtr[aSourceId++];
-      }
+    for(; aPointer != anEndPointer; aPointer += 2){
+      TCellId aCellId = *aPointer;
+      TEntityId anEntityId = *(aPointer + 1);
+      TObjectId anObjectId(aCellId, anEntityId);
+      theObjectIdSet.insert(anObjectId);
     }
   }
 
-  typedef vtkDataArray* (vtkDataSetAttributes::* TGetAttribute)();
-  typedef int (vtkDataSetAttributes::* TSetAttribute)(vtkDataArray*);
 
-  inline
+  //---------------------------------------------------------------
   void
-  CopyArray(vtkDataArray* theDataArray,
-           vtkDataSetAttributes* theOutput, 
-           TSetAttribute theSetAttribute,
-           vtkIdType theFixedNbTuples)
+  GetObjectId2TupleIdMap(vtkIntArray *theArray, 
+                       TObjectId2TupleIdMap& theObjectId2TupleIdMap)
   {
-    if(theDataArray){
-      vtkIdType aNbTuples = theDataArray->GetNumberOfTuples();
-      if(theFixedNbTuples == aNbTuples)
-       (theOutput->*theSetAttribute)(theDataArray);
+    theObjectId2TupleIdMap.clear();
+    int* aPointer = theArray->GetPointer(0);
+    int aNbTuples = theArray->GetNumberOfTuples();
+    for(vtkIdType aTupleId = 0; aTupleId < aNbTuples; aTupleId++, aPointer += 2){
+      TCellId aCellId = *aPointer;
+      TEntityId anEntityId = *(aPointer + 1);
+      TObjectId anObjectId(aCellId, anEntityId);
+      theObjectId2TupleIdMap[anObjectId] = aTupleId;
     }
   }
 
-  inline
-  void
-  CopyAttribute(vtkDataSetAttributes* theInput, 
-               TGetAttribute theGetAttribute,
-               vtkDataSetAttributes* theOutput, 
-               TSetAttribute theSetAttribute,
-               vtkIdType theFixedNbTuples)
-  {
-    CopyArray((theInput->*theGetAttribute)(),
-             theOutput, theSetAttribute,
-             theFixedNbTuples);
-  }
 
-  vtkDataArray*
-  DeepCopyArray(vtkDataArray* theDataArray,
-               vtkDataSetAttributes* theOutput, 
-               TSetAttribute theSetAttribute,
-               const TSortedArray& theIntersection, 
-               const TId2IdMap& theObj2VTKMap)
-  {
-    vtkDataArray *aDataArray = NULL;
-    if(theDataArray){
-      void *anInputPtr = theDataArray->GetVoidPointer(0);
-      vtkIdType aNbTuples = theIntersection.size();
-      vtkIdType aNbComp = theDataArray->GetNumberOfComponents();
-
-      aDataArray = vtkDataArray::CreateDataArray(theDataArray->GetDataType());
-      aDataArray->SetNumberOfComponents(aNbComp);
-      aDataArray->SetNumberOfTuples(aNbTuples);
-      void *anOutputPtr = aDataArray->GetVoidPointer(0);       
-
-      switch(theDataArray->GetDataType()){
-       vtkTemplateMacro5(DeepCopySwitchOnOutput, 
-                         (VTK_TT*)anInputPtr, 
-                         (VTK_TT*)anOutputPtr, 
-                         theIntersection, 
-                         theObj2VTKMap,
-                         aNbComp);
-      default:
-        vtkGenericWarningMacro(<<"Unsupported data type!");
-      }
+  //---------------------------------------------------------------
+  typedef vtkFieldData* (vtkDataSet::* TGetFieldData)();
 
-      (theOutput->*theSetAttribute)(aDataArray);
-      aDataArray->Delete();
-    }
-    return aDataArray;
-  }
-
-  void
-  DeepCopyAttribute(vtkDataSetAttributes* theInput, 
-                   TGetAttribute theGetAttribute,
-                   vtkDataSetAttributes* theOutput, 
-                   TSetAttribute theSetAttribute,
-                   const TSortedArray& theIntersection, 
-                   const TId2IdMap& theObj2VTKMap)
+  //---------------------------------------------------------------
+  struct TGetCellData
   {
-    DeepCopyArray((theInput->*theGetAttribute)(),
-                 theOutput, 
-                 theSetAttribute,
-                 theIntersection, 
-                 theObj2VTKMap);
-  }
-
-  inline
-  void
-  DeepCopyDataSetAttribute(vtkDataSet* theInput,
-                          TGetAttribute theGetAttribute,
-                          vtkDataSet* theOutput, 
-                          TSetAttribute theSetAttribute,
-                          const TSortedArray& theIntersection, 
-                          const TId2IdMap& theObj2VTKMap)
-  {
-    CopyAttribute(theInput->GetPointData(), 
-                 theGetAttribute,
-                 theOutput->GetPointData(), 
-                 theSetAttribute,
-                 theInput->GetNumberOfPoints());
-    DeepCopyAttribute(theInput->GetCellData(), 
-                     theGetAttribute,
-                     theOutput->GetCellData(), 
-                     theSetAttribute,
-                     theIntersection, 
-                     theObj2VTKMap);
-  }
+    vtkFieldData*
+    operator()(vtkDataSet* theDataSet)
+    {
+      return theDataSet->GetCellData();
+    }
+  };
 
-  inline
-  void
-  DeepCopyField(vtkDataSetAttributes* theInput, 
-               const char* theFieldName, 
-               vtkDataSetAttributes* theOutput, 
-               const TSortedArray& theIntersection,
-               const TId2IdMap& theObj2VTKMap)
-  {
-    vtkDataArray* aDataArray = 
-      DeepCopyArray(theInput->GetArray(theFieldName), 
-                   theOutput, 
-                   &vtkFieldData::AddArray,
-                   theIntersection,
-                   theObj2VTKMap);
-    if(aDataArray)
-      aDataArray->SetName(theFieldName);
-  }
 
-  inline
-  void
-  CopyField(vtkDataSetAttributes* theInput, 
-           const char* theFieldName, 
-           vtkDataSetAttributes* theOutput,
-           vtkIdType theFixedNbTuples)
+  //---------------------------------------------------------------
+  struct TGetPointData
   {
-    CopyArray(theInput->GetArray(theFieldName),
-             theOutput,
-             &vtkDataSetAttributes::AddArray,
-             theFixedNbTuples);
-  }
+    vtkFieldData*
+    operator()(vtkDataSet* theDataSet)
+    {
+      return theDataSet->GetPointData();
+    }
+  };
 
-  inline
-  void
-  DeepCopyDataSetField(vtkDataSet* theInput, 
-                      const char* theFieldName, 
-                      vtkDataSet* theOutput,
-                      const TSortedArray& theIntersection, 
-                      const TId2IdMap& theObj2VTKMap)
-  {
-    CopyField(theInput->GetPointData(), theFieldName, 
-             theOutput->GetPointData(), 
-             theInput->GetNumberOfPoints());
-    DeepCopyField(theInput->GetCellData(), theFieldName, 
-                 theOutput->GetCellData(), 
-                 theIntersection, theObj2VTKMap);
-  }
 
-  inline
-  void
-  DeepCopyDataSetAttributes(VISU_MergeFilter *theFilter, 
-                           vtkDataSet *theFilterOutput, 
-                           VISU::TFieldList* theFieldList,
-                           const TSortedArray& theIntersection, 
-                           const TId2IdMap& theObj2VTKMap)
+  //---------------------------------------------------------------
+  template<class TGetFieldData>
+  vtkIntArray*
+  GetIDMapper(VISU::TFieldList* theFieldList,
+             TGetFieldData theGetFieldData,
+             const char* theFieldName)
   {
-    if(vtkDataSet* aDataSet = theFilter->GetScalars())
-      DeepCopyDataSetAttribute(aDataSet, 
-                              &vtkDataSetAttributes::GetScalars,
-                              theFilterOutput, 
-                              &vtkDataSetAttributes::SetScalars,
-                              theIntersection, 
-                              theObj2VTKMap);
-    
-    if(vtkDataSet* aDataSet = theFilter->GetVectors())
-      DeepCopyDataSetAttribute(aDataSet, 
-                              &vtkDataSetAttributes::GetVectors,
-                              theFilterOutput, 
-                              &vtkDataSetAttributes::SetVectors,
-                              theIntersection, 
-                              theObj2VTKMap);
-    
-    if(vtkDataSet* aDataSet = theFilter->GetNormals())
-      DeepCopyDataSetAttribute(aDataSet, 
-                              &vtkDataSetAttributes::GetNormals,
-                              theFilterOutput, 
-                              &vtkDataSetAttributes::SetNormals,
-                              theIntersection, 
-                              theObj2VTKMap);
-    
-    if(vtkDataSet* aDataSet = theFilter->GetTCoords())
-      DeepCopyDataSetAttribute(aDataSet, 
-                              &vtkDataSetAttributes::GetTCoords,
-                              theFilterOutput, 
-                              &vtkDataSetAttributes::SetTCoords,
-                              theIntersection, 
-                              theObj2VTKMap);
-    
-    if(vtkDataSet* aDataSet = theFilter->GetTensors())
-      DeepCopyDataSetAttribute(aDataSet, 
-                              &vtkDataSetAttributes::GetTensors,
-                              theFilterOutput, 
-                              &vtkDataSetAttributes::SetTensors,
-                              theIntersection, 
-                              theObj2VTKMap);
-
     VISU::TFieldListIterator anIter(theFieldList);
     for(anIter.Begin(); !anIter.End() ; anIter.Next()){
-      vtkDataSet *aDataSet = anIter.Get()->Ptr;
       const char* aFieldName = anIter.Get()->GetName();
-      DeepCopyDataSetField(aDataSet, 
-                          aFieldName, 
-                          theFilterOutput, 
-                          theIntersection, 
-                          theObj2VTKMap);
-    }
-  }
-
-  inline
-  void
-  GetIdsForCopy(vtkUnstructuredGrid *inputUGrid, 
-                vtkIntArray* inputPointIds,
-                TSortedArray& outputSortedArray)
-  {
-    if(inputUGrid){
-      TSortedArray aSortedPointIds;
-      TSortedArray aOutputCellIds;
-
-      TIdSet aMapForSearch;
-      int nbTuples = inputPointIds->GetNumberOfTuples();
-      int nbComp = inputPointIds->GetNumberOfComponents();
-      int * aPtr = inputPointIds->GetPointer(0);
-      int * aPtrEnd = inputPointIds->GetPointer(nbTuples*nbComp+1);
-      if(nbComp == 1)
-        while(aPtr<aPtrEnd){
-          aMapForSearch.insert(*aPtr);
-          aPtr++;
-        }
-      else if (nbComp == 2)
-        while(aPtr<aPtrEnd){
-          aMapForSearch.insert(*aPtr);
-          aPtr++;aPtr++;
-        }
-      int nbInputCells = inputUGrid->GetNumberOfCells();
-
-      for(int idCell=0;idCell<nbInputCells;idCell++){
-        vtkCell*   aCell = inputUGrid->GetCell(idCell);
-        vtkIdList* ptIds = aCell->GetPointIds();
-        int nbPointsInCell = ptIds->GetNumberOfIds();
-        bool aGoodCell = true;
-        for(int i=0;i<nbPointsInCell;i++){
-          int aSearchingId = ptIds->GetId(i);
-          TIdSet::iterator aResult = aMapForSearch.find(aSearchingId);
-          if(aResult == aMapForSearch.end()){
-            aGoodCell = false;
-            break;
-          }
-        }
-        if(aGoodCell)
-          aOutputCellIds.push_back(idCell);
-        else
-          continue;
-        
+      if(strcmp(aFieldName, theFieldName) == 0){
+       vtkDataSet* aDataSet = anIter.Get()->Ptr;
+       vtkFieldData *aFieldData = theGetFieldData(aDataSet);
+       vtkDataArray *anIDMapper = aFieldData->GetArray(theFieldName);
+       return dynamic_cast<vtkIntArray*>(anIDMapper);
       }
-
-      outputSortedArray.swap(aOutputCellIds);
     }
+    return NULL;
   }
 
-  inline
-  void
-  CopyElementsToOutput(vtkUnstructuredGrid* theInputUG,
-                       int& theNbElements,
-                       TSortedArray& theElementIdsForCopy,
-                       TId2IdMap& theOldId2NewIdPointsMap,
-                       vtkUnstructuredGrid* theOutputUG)
-  {
-    vtkIntArray* theOutputIDSArray = vtkIntArray::New();
-    theOutputIDSArray->SetName("VISU_CELLS_MAPPER");
-    // the [0] component is element object ID
-    // the [1] component is entity type
-    theOutputIDSArray->SetNumberOfComponents(2);
-    theOutputIDSArray->SetNumberOfTuples(theNbElements);
-    int* aOutputIDSPtr = theOutputIDSArray->GetPointer(0);
-    
-    vtkIntArray* aInputCellsMapper =
-      dynamic_cast<vtkIntArray*>(theInputUG->GetCellData()->GetArray("VISU_CELLS_MAPPER"));
-    
-    int* aInputCellsMapperPointer = aInputCellsMapper->GetPointer(0);
-    
-    for(int aCellIndex=0;aCellIndex<theNbElements;aCellIndex++){
-      int aCellId = theElementIdsForCopy[aCellIndex];
-      vtkIdList* aOldPointIds = theInputUG->GetCell(aCellId)->GetPointIds();
-      vtkIdList* aNewPointIds = vtkIdList::New();
-      int nbPointIds = aOldPointIds->GetNumberOfIds();
-      aNewPointIds->SetNumberOfIds(nbPointIds);
-      for(int j=0;j<nbPointIds;j++){
-        int aOldId = aOldPointIds->GetId(j);
-        int aNewId = theOldId2NewIdPointsMap[aOldId];
-        aNewPointIds->SetId(j,aNewId);
-      }
-      theOutputUG->InsertNextCell(theInputUG->GetCellType(aCellId),
-                                  aNewPointIds);
-
-      *aOutputIDSPtr = aInputCellsMapperPointer[2*aCellId];
-      aOutputIDSPtr++;
-      *aOutputIDSPtr = aInputCellsMapperPointer[2*aCellId+1];
-      aOutputIDSPtr++;
-      
-      aNewPointIds->Delete();
-    }
-    theOutputUG->GetCellData()->AddArray(theOutputIDSArray);
-    theOutputIDSArray->Delete();
-  }
 
-  inline
-  void
-  copyOneToOneComponent(vtkIntArray* input,
-                        vtkIntArray* output)
+  //---------------------------------------------------------------
+  template<class TGetFieldData>
+  vtkIntArray*
+  GetIDMapper(vtkDataSet* theIDMapperDataSet,
+             TGetFieldData theGetFieldData,
+             const char* theFieldName)
   {
-    int nbTuples = input->GetNumberOfTuples();
-    int nbComp   = input->GetNumberOfComponents();
-    int* aInputPtr = input->GetPointer(0);
-    int* aOutputPtr = output->GetPointer(0);
-    if(nbComp == 2){
-      for(int i=0;i<nbTuples;i++){
-        *aOutputPtr = *aInputPtr;
-        aOutputPtr++;
-        aInputPtr++;
-        aInputPtr++;
-      }
-    } else if (nbComp == 1){
-      for(int i=0;i<nbTuples;i++){
-        *aOutputPtr = *aInputPtr;
-        aOutputPtr++;
-        aInputPtr++;
-      }
-    }
+    vtkFieldData *aFieldData = theGetFieldData(theIDMapperDataSet);
+    vtkDataArray *anIDMapper = aFieldData->GetArray(theFieldName);
+    return dynamic_cast<vtkIntArray*>(anIDMapper);
   }
 
-  inline
+
+  //---------------------------------------------------------------
   bool
-  isTwoArraysSame(vtkIntArray* theFirst,
-                  vtkIntArray* theSecond)
+  IsDifferent(vtkIntArray *theFirstIDMapper,
+             vtkIntArray *theSecondIDMapper)
   {
-    int* theFirstPtr  = theFirst->GetPointer(0);
-    int* theSecondPtr = theSecond->GetPointer(0);
-    int nbTuples1     = theFirst->GetNumberOfTuples();
-    int nbTuples2     = theSecond->GetNumberOfTuples();
-    if(nbTuples1 != nbTuples2)
-      return false;
-    for(int i=0;i<nbTuples1;i++,theFirstPtr++,theSecondPtr++){
-      if(*theFirstPtr != *theSecondPtr)
-        return false;
-    }
-      
-    return true;
-  }
-}
+    vtkIdType aFirstNbTuples = theFirstIDMapper->GetNumberOfTuples();
+    vtkIdType aSecondNbTuples = theSecondIDMapper->GetNumberOfTuples();
+    if(aFirstNbTuples != aSecondNbTuples)
+      return true;
 
-bool 
-VISU_MergeFilter
-::MergeGeometryCellsAndDataOnCells()
-{
-  if(MYDEBUG) cout << "MergeGeometryCellsAndDataOnCells" << endl;
-  vtkUnstructuredGrid *anInput = this->GetInput();
-  vtkUnstructuredGrid *anOutput = this->GetOutput();
-  vtkCellData *aCellData = anInput->GetCellData();
-  vtkDataArray *aCellMapper = aCellData->GetArray("VISU_CELLS_MAPPER"); // 1
-  vtkIntArray *aGeometryCellMapper = dynamic_cast<vtkIntArray*>(aCellMapper);
-  
-  // The situation for merging CELLS from anInput as Geometry
-  // and scalars on cell data
-  vtkIntArray* aDataCellMapper = NULL;
-  VISU::TFieldListIterator anIter(this->FieldList);
-  for(anIter.Begin(); !anIter.End() ; anIter.Next()){
-    vtkCellData *aCellData = anIter.Get()->Ptr->GetCellData();
-    const char* aFieldName = anIter.Get()->GetName();
-    if(strcmp(aFieldName, "VISU_CELLS_MAPPER") == 0){
-      vtkDataArray *aCellMapper_tmp = aCellData->GetArray(aFieldName);
-      aDataCellMapper = dynamic_cast<vtkIntArray*>(aCellMapper_tmp);
-      break;
+    int aMaxId = theFirstIDMapper->GetMaxId();
+    int* aFirstPointer = theFirstIDMapper->GetPointer(0);
+    int* aSecondPointer = theSecondIDMapper->GetPointer(0);
+    for(int anId = 0; anId <= aMaxId; anId++){
+      if(*aFirstPointer++ != *aSecondPointer++)
+       return true;
     }
-  }
-  
-  bool anIsDifferent = aDataCellMapper &&
-    aDataCellMapper->GetNumberOfTuples() != aGeometryCellMapper->GetNumberOfTuples();
-  
-  if(anIsDifferent || IsMergingInputs() ){
-    TSortedArray aGeometryCellArray;
-    vtkIntArray* aGeometryCellMapperOnly = vtkIntArray::New();
-    vtkIntArray* aDataCellMapperOnly     = vtkIntArray::New();
-    aGeometryCellMapperOnly->SetNumberOfComponents(1);
-    aGeometryCellMapperOnly->SetNumberOfTuples(aGeometryCellMapper->GetNumberOfTuples());
-    aGeometryCellMapperOnly->SetName(aGeometryCellMapper->GetName());
-    aDataCellMapperOnly->SetNumberOfComponents(1);
-    aDataCellMapperOnly->SetNumberOfTuples(aDataCellMapper->GetNumberOfTuples());
-    aDataCellMapperOnly->SetName(aDataCellMapper->GetName());
     
-    copyOneToOneComponent(aGeometryCellMapper,aGeometryCellMapperOnly);
-    copyOneToOneComponent(aDataCellMapper,aDataCellMapperOnly);
-    
-    GetSortedArray(aGeometryCellMapperOnly, aGeometryCellArray);
-    TSortedArray aDataCellArray;
-    GetSortedArray(aDataCellMapperOnly, aDataCellArray);
-    
-    int aMaxLength = std::max(aGeometryCellArray.size(), aDataCellArray.size());
-    TSortedArray anIntersectionArray(aMaxLength);
-    TSortedArray::iterator anArrayIter = anIntersectionArray.begin();
-    anArrayIter = std::set_intersection(aGeometryCellArray.begin(),
-                                        aGeometryCellArray.end(),
-                                        aDataCellArray.begin(),
-                                        aDataCellArray.end(),
-                                        anArrayIter);
-    
-    anIntersectionArray.erase(anArrayIter, anIntersectionArray.end());
-    
-    bool anIsCompletelyCoincide = 
-      anIntersectionArray.size() == aGeometryCellArray.size() && 
-      anIntersectionArray.size() == aDataCellArray.size();
-    
-    if(!anIsCompletelyCoincide || IsMergingInputs()){
-      {
-        TId2IdMap anObj2VTKGeometryMap;
-        vtkIdType aNbCells = aGeometryCellMapperOnly->GetNumberOfTuples();
-        int* aGPtr = aGeometryCellMapperOnly->GetPointer(0);
-        for(int aCellId = 0; aCellId < aNbCells; aCellId++){
-          vtkIdType anObjID = *aGPtr;
-          aGPtr++;
-          anObj2VTKGeometryMap[anObjID] = aCellId;
-        }
-        
-        vtkIdType aNbTuples = anIntersectionArray.size();
-        anOutput->Allocate(aNbTuples);
-        vtkIdList *aCellIds = vtkIdList::New();
-        for(int aTupleId = 0; aTupleId < aNbTuples; aTupleId++){
-          vtkIdType anObjID = anIntersectionArray[aTupleId];
-          vtkIdType aCellId = anObj2VTKGeometryMap[anObjID];
-          vtkCell *aCell = anInput->GetCell(aCellId);
-          aCellIds->Reset();
-          vtkIdType aNbPointIds = aCell->PointIds->GetNumberOfIds();
-          for(vtkIdType aPointId = 0; aPointId < aNbPointIds; aPointId++)
-            aCellIds->InsertNextId(aCell->GetPointIds()->GetId(aPointId));
-          anOutput->InsertNextCell(anInput->GetCellType(aCellId), aCellIds);
-        }
-        aCellIds->Delete();
-        anOutput->SetPoints(anInput->GetPoints());
-       }
-      {
-        TId2IdMap anObj2VTKDataMap;
-        vtkIdType aNbCells = aDataCellMapperOnly->GetNumberOfTuples();
-        int* aDPtr = aDataCellMapperOnly->GetPointer(0);
-        for(int aCellId = 0; aCellId < aNbCells; aCellId++){
-          vtkIdType anObjID = *aDPtr;
-          aDPtr++;
-          anObj2VTKDataMap[anObjID] = aCellId;
-        }
-       
-        DeepCopyDataSetAttributes(this, 
-                                  anOutput, 
-                                  this->FieldList,
-                                  anIntersectionArray, 
-                                  anObj2VTKDataMap);
-      }
-      aGeometryCellMapperOnly->Delete();
-      aDataCellMapperOnly->Delete();
-      return true;
-    }
-    aGeometryCellMapperOnly->Delete();
-    aDataCellMapperOnly->Delete();
+    return false;
   }
-  return false;
-}
 
-bool
-VISU_MergeFilter
-::MergeGeometryCellsAndDataOnAllPoints()
-{
-  if(MYDEBUG) cout << "MergeGeometryCellsAndDataOnAllPoints" << endl;
-  // The situation for merging CELLS from anInput as Geometry
-  // and scalars on point data
-  vtkUnstructuredGrid *anInput = this->GetInput();
-  vtkUnstructuredGrid *anOutput = this->GetOutput();
 
-  vtkPointData *aPointData   = anInput->GetPointData();
-  vtkCellData *aCellData = anInput->GetCellData();
-  vtkDataSet*  aInputScalars = this->GetScalars();
-  vtkPointData* aInputScalarsPointData = aInputScalars->GetPointData();
-  vtkDataArray *aPointMapper = aPointData->GetArray("VISU_POINTS_MAPPER");
-  vtkIntArray *aGeometryPointMapper = dynamic_cast<vtkIntArray*>(aPointMapper);
-  vtkDataArray *aCellMapper = aCellData->GetArray("VISU_CELLS_MAPPER"); // 1
-  vtkIntArray *aGeometryCellMapper = dynamic_cast<vtkIntArray*>(aCellMapper); // 1->2
-  
-  vtkIntArray* aDataPointMapper = NULL;
-  VISU::TFieldListIterator anIter(this->FieldList);
-  for(anIter.Begin(); !anIter.End() ; anIter.Next()){
-    const char* aFieldName = anIter.Get()->GetName();
-    if(strcmp(aFieldName, "VISU_POINTS_MAPPER") == 0){
-      vtkDataArray *aPointMapper = aInputScalarsPointData->GetArray(aFieldName);
-      aDataPointMapper = dynamic_cast<vtkIntArray*>(aPointMapper);
-      break;
-    }
+  //---------------------------------------------------------------
+  inline
+  void
+  GetIntersection(vtkIntArray *theFirstIDMapper,
+                 vtkIntArray *theSecondIDMapper,
+                 TObjectIdArray& theResult)
+  {
+    TObjectIdSet aFirstObjectIdSet;
+    GetObjectIdSet(theFirstIDMapper, aFirstObjectIdSet);
+    
+    TObjectIdSet aSecondObjectIdSet;
+    GetObjectIdSet(theSecondIDMapper, aSecondObjectIdSet);
+
+    size_t aMaxLength = std::max(aFirstObjectIdSet.size(), aSecondObjectIdSet.size());
+    theResult.resize(aMaxLength);
+    TObjectIdArray::iterator anArrayIter = theResult.begin();
+    anArrayIter = std::set_intersection(aFirstObjectIdSet.begin(),
+                                       aFirstObjectIdSet.end(),
+                                       aSecondObjectIdSet.begin(),
+                                       aSecondObjectIdSet.end(),
+                                       anArrayIter);
+    theResult.erase(anArrayIter, theResult.end());
   }
-  
-  if(aDataPointMapper){
-    bool isArraysEqual = isTwoArraysSame(aDataPointMapper,aGeometryPointMapper);
-    {
-      TId2IdMap anObj2VTKGeometryPointsMap;
-      vtkIdType aNbPoints = aDataPointMapper->GetNumberOfTuples();
-      if(isArraysEqual){
-        for(int aCellId = 0; aCellId < aNbPoints; aCellId++)
-          anObj2VTKGeometryPointsMap[aCellId] = aCellId;
-      } else {
-        // situation: the numbering of points are different in geometry and in scalars
-        cout << "------------------"<<endl;
-        cout << "Warning! Incorrect data are used in "<<__FILE__<<"["<<__LINE__<<"]"<<endl;
-        cout << "------------------"<<endl;
-      }
 
-      int aNbCells = aGeometryCellMapper->GetNumberOfTuples();
-      
-      // copy points to output
-      vtkUnstructuredGrid* aUnstructuredScalars = dynamic_cast<vtkUnstructuredGrid*>(aInputScalars);
-      if(aUnstructuredScalars)
-        anOutput->SetPoints(aUnstructuredScalars->GetPoints());
-      anOutput->GetPointData()->ShallowCopy(aInputScalars->GetPointData());
-      
-      // Calculate output cells
-      TSortedArray aCellIdsForCopy;
-      for(int i=0;i<aNbCells;i++)
-        aCellIdsForCopy.push_back(i);
+
+  //---------------------------------------------------------------
+  void 
+  CopyDataOnCells(vtkUnstructuredGrid *theInput,
+                 vtkIntArray *theGeometryCellMapper,
+                 vtkIntArray *theDataCellMapper,
+                 vtkDataSet* theScalarsDataSet,
+                 vtkDataSet* theVectorsDataSet,
+                 vtkDataSet* theNormalsDataSet,
+                 vtkDataSet* theTCoordsDataSet,
+                 vtkDataSet* theTensorsDataSet,
+                 VISU::TFieldList* theFieldList,
+                 vtkUnstructuredGrid *theOutput)
+  {
+    if(IsDifferent(theGeometryCellMapper, theDataCellMapper)){
+      TObjectIdArray anIntersection;
+      GetIntersection(theGeometryCellMapper,
+                     theDataCellMapper,
+                     anIntersection);
+    
+      TObjectId2TupleIdMap aGeomObjectId2TupleIdMap;
+      GetObjectId2TupleIdMap(theGeometryCellMapper, aGeomObjectId2TupleIdMap);
       
-      // copy cells to output
-      anOutput->Allocate(aNbCells);
+      TObjectId2TupleIdMap aDataObjectId2TupleIdMap;
+      GetObjectId2TupleIdMap(theDataCellMapper, aDataObjectId2TupleIdMap);
       
-      if(aNbCells>0)
-        CopyElementsToOutput(anInput,
-                             aNbCells,
-                             aCellIdsForCopy,
-                             anObj2VTKGeometryPointsMap,
-                             anOutput);
-
-      return true;
-    }
-  }
-  return false;
-}
-
-bool
-VISU_MergeFilter
-::MergeGeometryCellsAndDataOnNotAllPoints()
-{
-  if(MYDEBUG) cout << "MergeGeometryCellsAndDataOnNotAllPoints" << endl;
-  // The situation for merging CELLS from anInput as Geometry
-  // and scalars on point data (there the number of points of point data less than
-  // number of points of Geometry)
-  
-  vtkUnstructuredGrid *anInput = this->GetInput();
-  vtkUnstructuredGrid *anOutput = this->GetOutput();
-  vtkDataSet*  aInputScalars = this->GetScalars();
-  vtkPointData *aPointData   = anInput->GetPointData();
+      vtkCellData *aCellData = theScalarsDataSet->GetCellData();
+      vtkCellData *anOutputCellData = theOutput->GetCellData();
+      anOutputCellData->CopyAllocate(aCellData);
+
+      vtkIdType aNbTuples = anIntersection.size();
+      theOutput->Allocate(aNbTuples);
+      vtkIdList *aCellIds = vtkIdList::New();
+      for(int aTupleId = 0; aTupleId < aNbTuples; aTupleId++){
+       TObjectId& anObjectId = anIntersection[aTupleId];
+       vtkIdType aCellId = aGeomObjectId2TupleIdMap[anObjectId];
+       vtkCell *aCell = theInput->GetCell(aCellId);
+       aCellIds->Reset();
+       vtkIdType aNbPointIds = aCell->PointIds->GetNumberOfIds();
+       for(vtkIdType anId = 0; anId < aNbPointIds; anId++)
+         aCellIds->InsertNextId(aCell->GetPointIds()->GetId(anId));
+       vtkIdType aCellType = theInput->GetCellType(aCellId);
+       vtkIdType aNewCellId = theOutput->InsertNextCell(aCellType, aCellIds);
+       vtkIdType aDataCellId = aDataObjectId2TupleIdMap[anObjectId];
+       anOutputCellData->CopyData(aCellData, aDataCellId, aNewCellId);
+      }
+      aCellIds->Delete();
 
-  vtkPointData* aInputScalarsPointData = aInputScalars->GetPointData();
-  vtkDataArray *aPointMapper = aPointData->GetArray("VISU_POINTS_MAPPER");
-  vtkIntArray *aGeometryPointMapper = dynamic_cast<vtkIntArray*>(aPointMapper);
-  
-  vtkIntArray* aDataPointMapper = NULL;
-  VISU::TFieldListIterator anIter(this->FieldList);
-  for(anIter.Begin(); !anIter.End() ; anIter.Next()){
-    const char* aFieldName = anIter.Get()->GetName();
-    if(strcmp(aFieldName, "VISU_POINTS_MAPPER") == 0){
-      vtkDataArray *aPointMapper = aInputScalarsPointData->GetArray(aFieldName);
-      aDataPointMapper = dynamic_cast<vtkIntArray*>(aPointMapper);
-      break;
-    }
-  }
-  vtkIntArray* aDataCellMapper = NULL;
-  VISU::TFieldListIterator anIter2(this->FieldList);
-  for(anIter2.Begin(); !anIter2.End() ; anIter2.Next()){
-    const char* aFieldName = anIter2.Get()->GetName();
-    if(strcmp(aFieldName, "VISU_CELLS_MAPPER") == 0){
-      vtkDataArray *aCellMapper_tmp = aInputScalarsPointData->GetArray(aFieldName);
-      aDataCellMapper = dynamic_cast<vtkIntArray*>(aCellMapper_tmp);
-      break;
+      theOutput->SetPoints(theInput->GetPoints());
+    }else{
+      theOutput->CopyStructure(theInput);
+      theOutput->GetCellData()->ShallowCopy(theScalarsDataSet->GetCellData());
     }
+    theOutput->GetPointData()->ShallowCopy(theInput->GetPointData());
   }
   
-  vtkIntArray* aDataArray = NULL;
-  VISU::TFieldListIterator anIter3(this->FieldList);
-  for(anIter2.Begin(); !anIter3.End() ; anIter3.Next()){
-    const char* aFieldName = anIter3.Get()->GetName();
-    if(strcmp(aFieldName, "VISU_FIELD") == 0){
-      vtkDataArray *aPointMapper_tmp = aInputScalarsPointData->GetArray(aFieldName);
-      aDataArray = dynamic_cast<vtkIntArray*>(aPointMapper_tmp);
-      break;
-    }
-  }
   
-  
-  bool anIsDifferent = aDataPointMapper &&
-    aDataPointMapper->GetNumberOfTuples() != aGeometryPointMapper->GetNumberOfTuples();
-  if(anIsDifferent){
-    {
-      vtkIntArray* aPointsIds = vtkIntArray::New();
-      
-      TId2IdMap anObj2VTKGeometryMap;
-      vtkIdType aNbCells = aDataPointMapper->GetNumberOfTuples();
-      aPointsIds->SetNumberOfTuples(aNbCells);
-      aPointsIds->SetNumberOfComponents(1);
-      vtkIdType aNbComp = aDataPointMapper->GetNumberOfComponents();
-      int * aPtr = aDataPointMapper->GetPointer(0);
-      int * aPtrOut = aPointsIds->GetPointer(0);
-      if(aNbComp==2){
-        for(int aCellId = 0; aCellId < aNbCells; aCellId++){
-          vtkIdType anObjID = *aPtr;
-          aPtr++;aPtr++;
-          *aPtrOut = anObjID;
-          aPtrOut++;
-          anObj2VTKGeometryMap[anObjID] = aCellId;
-        }
-      } else if (aNbComp == 1 ){
-        for(int aCellId = 0; aCellId < aNbCells; aCellId++){
-          vtkIdType anObjID = *aPtr;
-          aPtr++;
-          *aPtrOut = anObjID;
-          aPtrOut++;
-          anObj2VTKGeometryMap[anObjID] = aCellId;
-        }
+  //---------------------------------------------------------------
+  void 
+  CopyDataOnPoints(vtkUnstructuredGrid *theInput,
+                  vtkIntArray *theGeometryPointMapper,
+                  vtkIntArray *theDataPointMapper,
+                  vtkDataSet* theScalarsDataSet,
+                  vtkDataSet* theVectorsDataSet,
+                  vtkDataSet* theNormalsDataSet,
+                  vtkDataSet* theTCoordsDataSet,
+                  vtkDataSet* theTensorsDataSet,
+                  VISU::TFieldList* theFieldList,
+                  vtkUnstructuredGrid *theOutput)
+  {
+    if(IsDifferent(theGeometryPointMapper, theDataPointMapper)){
+      TObjectId2TupleIdMap aDataObjectId2PointIdMap;
+      GetObjectId2TupleIdMap(theDataPointMapper, aDataObjectId2PointIdMap);
+
+      vtkCellData *aCellData = theInput->GetCellData();
+      vtkCellData *anOutputCellData = theOutput->GetCellData();
+      anOutputCellData->CopyAllocate(aCellData);
+
+      vtkIdList *aCellIds = vtkIdList::New();
+      int aNbCells = theInput->GetNumberOfCells();
+      theOutput->Allocate(aNbCells);
+      for(int aCellId = 0; aCellId < aNbCells; aCellId++){
+       aCellIds->Reset();
+       vtkCell *aCell = theInput->GetCell(aCellId);
+       vtkIdType aNbPointIds = aCell->PointIds->GetNumberOfIds();
+       for(vtkIdType anId = 0; anId < aNbPointIds; anId++){
+         vtkIdType aPointId = aCell->GetPointIds()->GetId(anId);
+         int* aPointer = theGeometryPointMapper->GetPointer(aPointId * 2);
+         TCellId aCellId = *aPointer;
+         TEntityId anEntityId = *(aPointer + 1);
+         TObjectId anObjectId(aCellId, anEntityId);
+         TObjectId2TupleIdMap::iterator anIter = aDataObjectId2PointIdMap.find(anObjectId);
+         if(anIter != aDataObjectId2PointIdMap.end()){
+           aPointId = anIter->second;
+           aCellIds->InsertNextId(aPointId);
+         }else
+           goto PASS_INSERT_NEXT_CELL;
+       }
+       {
+         vtkIdType aCellType = theInput->GetCellType(aCellId);
+         vtkIdType aNewCellId = theOutput->InsertNextCell(aCellType, aCellIds);
+         anOutputCellData->CopyData(aCellData, aCellId, aNewCellId);
+       }
+      PASS_INSERT_NEXT_CELL:
+       continue;
       }
+      aCellIds->Delete();
 
-      vtkUnstructuredGrid* aUnstructuredScalars = dynamic_cast<vtkUnstructuredGrid*>(aInputScalars);
-      if(aUnstructuredScalars)
-        anOutput->SetPoints(aUnstructuredScalars->GetPoints());
-      
-      anOutput->GetPointData()->ShallowCopy(aInputScalars->GetPointData());
-      
-      // Calculate output cells
-      int nbCells=0;
-      TSortedArray aCellIdsForCopy;
-      GetIdsForCopy(anInput,aPointsIds,aCellIdsForCopy);
-      aPointsIds->Delete();
-      nbCells = aCellIdsForCopy.size();
-      
-      // copy cells to output
-      anOutput->Allocate(nbCells);
-        
-      if(nbCells>0)
-        CopyElementsToOutput(anInput,
-                             nbCells,
-                             aCellIdsForCopy,
-                             anObj2VTKGeometryMap,
-                             anOutput);
-      return true;
+      vtkPointSet* aScalarsDataSet = dynamic_cast<vtkPointSet*>(theScalarsDataSet);
+      theOutput->SetPoints(aScalarsDataSet->GetPoints());
+    }else{
+      theOutput->CopyStructure(theInput);
+      theOutput->GetCellData()->ShallowCopy(theInput->GetCellData());
     }
-    
+    theOutput->GetPointData()->ShallowCopy(theScalarsDataSet->GetPointData());
   }
-  
-  return false;
 }
 
+
+//---------------------------------------------------------------
 void
 VISU_MergeFilter
 ::SetMergingInputs(bool theIsMergingInputs)
@@ -956,6 +578,8 @@ VISU_MergeFilter
   Modified();
 }
   
+
+//---------------------------------------------------------------
 bool
 VISU_MergeFilter
 ::IsMergingInputs()
@@ -964,45 +588,102 @@ VISU_MergeFilter
 }
   
 
+//---------------------------------------------------------------
 void VISU_MergeFilter::Execute()
 {
   VISU::TTimerLog aTimerLog(MYDEBUG,"VISU_MergeFilter::Execute");
   vtkUnstructuredGrid *anInput = this->GetInput();
   vtkUnstructuredGrid *anOutput = this->GetOutput();
-  
-  vtkDataSet*  aInputScalars = this->GetScalars();
-  int nbPointsInScalars = aInputScalars->GetNumberOfPoints();
-  int nbPointsInGeometr = anInput->GetNumberOfPoints();
-  vtkCellData *aCellData = anInput->GetCellData();
-  
-  vtkDataArray* aScalarsOnCellsArray = NULL;
-  if(aInputScalars->GetCellData())
-    aScalarsOnCellsArray = aInputScalars->GetCellData()->GetArray("VISU_FIELD");
-
-  vtkDataArray* aScalarsOnPointsArray = NULL;
-  if(aInputScalars->GetPointData())
-    aScalarsOnPointsArray = aInputScalars->GetPointData()->GetArray("VISU_FIELD");
-  
-  vtkDataArray *aCellMapper = aCellData->GetArray("VISU_CELLS_MAPPER");
-  vtkIntArray *aGeometryCellMapper = dynamic_cast<vtkIntArray*>(aCellMapper);
-
-  if (aGeometryCellMapper && aScalarsOnCellsArray && (nbPointsInScalars == nbPointsInGeometr)){
-    if(MergeGeometryCellsAndDataOnCells())
-      return;
-  } else if (aGeometryCellMapper && aScalarsOnPointsArray && (nbPointsInScalars == nbPointsInGeometr)){
-    if(MergeGeometryCellsAndDataOnAllPoints())
-      return;
-  } else if (aGeometryCellMapper && (nbPointsInScalars < nbPointsInGeometr)) {
-    if(MergeGeometryCellsAndDataOnNotAllPoints())
-      return;
+  if(IsMergingInputs()){
+    vtkCellData *aCellData = anInput->GetCellData();
+    if(vtkDataArray *aCellMapper = aCellData->GetArray("VISU_CELLS_MAPPER")){
+
+      bool anIsDataOnCells = false;
+      if(vtkDataSet* aDataSet = GetScalars())
+       if(vtkCellData* aCellData = aDataSet->GetCellData())
+         anIsDataOnCells = (aCellData->GetArray("VISU_FIELD") != NULL);
+
+      if(anIsDataOnCells){
+       vtkIntArray *aGeometryCellMapper = dynamic_cast<vtkIntArray*>(aCellMapper);
+
+       vtkIntArray* aDataCellMapper = GetIDMapper(this->FieldList,
+                                                  TGetCellData(),
+                                                  "VISU_CELLS_MAPPER");
+       CopyDataOnCells(anInput,
+                       aGeometryCellMapper,
+                       aDataCellMapper,
+                       this->GetScalars(),
+                       this->GetVectors(),
+                       this->GetNormals(),
+                       this->GetTCoords(),
+                       this->GetTensors(),
+                       this->FieldList,
+                       anOutput);
+      }else{
+       vtkPointData *aPointData = anInput->GetPointData();
+       vtkDataArray *aPointMapper = aPointData->GetArray("VISU_POINTS_MAPPER");
+       vtkIntArray *aGeometryPointMapper = dynamic_cast<vtkIntArray*>(aPointMapper);
+
+       vtkIntArray* aDataPointMapper = GetIDMapper(this->FieldList,
+                                                   TGetPointData(),
+                                                   "VISU_POINTS_MAPPER");
+       CopyDataOnPoints(anInput,
+                        aGeometryPointMapper,
+                        aDataPointMapper,
+                        this->GetScalars(),
+                        this->GetVectors(),
+                        this->GetNormals(),
+                        this->GetTCoords(),
+                        this->GetTensors(),
+                        this->FieldList,
+                        anOutput);
+      }
+    }
+  }else{
+    anOutput->CopyStructure(anInput);
+    this->BasicExecute(anOutput);
   }
-
-  anOutput->CopyStructure(anInput);
-  this->BasicExecute(anOutput);
 }
 
+
+//---------------------------------------------------------------
 namespace
 {
+  //---------------------------------------------------------------
+  typedef vtkDataArray* (vtkDataSetAttributes::* TGetAttribute)();
+  typedef int (vtkDataSetAttributes::* TSetAttribute)(vtkDataArray*);
+
+  inline
+  void
+  CopyArray(vtkDataArray* theDataArray,
+           vtkDataSetAttributes* theOutput, 
+           TSetAttribute theSetAttribute,
+           vtkIdType theFixedNbTuples)
+  {
+    if(theDataArray){
+      vtkIdType aNbTuples = theDataArray->GetNumberOfTuples();
+      if(theFixedNbTuples == aNbTuples)
+       (theOutput->*theSetAttribute)(theDataArray);
+    }
+  }
+
+
+  //---------------------------------------------------------------
+  inline
+  void
+  CopyAttribute(vtkDataSetAttributes* theInput, 
+               TGetAttribute theGetAttribute,
+               vtkDataSetAttributes* theOutput, 
+               TSetAttribute theSetAttribute,
+               vtkIdType theFixedNbTuples)
+  {
+    CopyArray((theInput->*theGetAttribute)(),
+             theOutput, theSetAttribute,
+             theFixedNbTuples);
+  }
+
+
+  //---------------------------------------------------------------
   inline
   void
   CopyDataSetAttribute(vtkDataSet *theInput,
@@ -1024,6 +705,23 @@ namespace
                  theNbCells);
   }
 
+
+  //---------------------------------------------------------------
+  inline
+  void
+  CopyField(vtkDataSetAttributes* theInput, 
+           const char* theFieldName, 
+           vtkDataSetAttributes* theOutput,
+           vtkIdType theFixedNbTuples)
+  {
+    CopyArray(theInput->GetArray(theFieldName),
+             theOutput,
+             &vtkDataSetAttributes::AddArray,
+             theFixedNbTuples);
+  }
+
+
+  //---------------------------------------------------------------
   inline
   void
   CopyDataSetField(vtkDataSet* theInput, 
@@ -1032,17 +730,25 @@ namespace
                   vtkIdType theNbPoints, 
                   vtkIdType theNbCells)
   {
-    CopyField(theInput->GetPointData(), theFieldName, 
-             theOutput->GetPointData(), 
-             theNbPoints);
-    CopyField(theInput->GetCellData(), theFieldName, 
-             theOutput->GetCellData(), 
-             theNbCells);
+    if(theInput){
+      CopyField(theInput->GetPointData(), 
+               theFieldName, 
+               theOutput->GetPointData(), 
+               theNbPoints);
+      CopyField(theInput->GetCellData(), 
+               theFieldName, 
+               theOutput->GetCellData(), 
+               theNbCells);
+    }
   }
 
 }
 
-void VISU_MergeFilter::BasicExecute(vtkDataSet *output)
+
+//---------------------------------------------------------------
+void
+VISU_MergeFilter
+::BasicExecute(vtkDataSet *output)
 {
   vtkIdType numPts, numCells;
   
@@ -1106,3 +812,6 @@ void VISU_MergeFilter::BasicExecute(vtkDataSet *output)
                     numCells);
   }
 }
+
+
+//---------------------------------------------------------------
index fb18bb5134369207edc504bdc240f3789f3aef72..f37d90613ac89fec7f34c119276eb5e0591c1d3f 100644 (file)
@@ -47,6 +47,10 @@ public:
   static VISU_MergeFilter *New();
   vtkTypeMacro(VISU_MergeFilter,vtkUnstructuredGridToUnstructuredGridFilter);
 
+  virtual
+  unsigned long
+  GetMTime();
+
   // Description:
   // Specify object from which to extract geometry information.
   void SetGeometry(vtkUnstructuredGrid *input) {this->SetInput(input);};
@@ -108,10 +112,6 @@ protected:
   bool myIsMergingInputs;
 
 private:
-  bool MergeGeometryCellsAndDataOnCells();
-  bool MergeGeometryCellsAndDataOnAllPoints();
-  bool MergeGeometryCellsAndDataOnNotAllPoints();
-  
   VISU_MergeFilter(const VISU_MergeFilter&);  // Not implemented.
   void operator=(const VISU_MergeFilter&);  // Not implemented.
 };
index c2f6a388c513be414ddd1e8b807fd6ba1aae573c..0aeb54aee821dd7890613d684005f487b0d43cc1 100644 (file)
@@ -31,6 +31,7 @@
 #include "VTKViewer_ShrinkFilter.h"
 #include "VTKViewer_GeometryFilter.h"
 #include "VTKViewer_PassThroughFilter.h"
+#include "VISU_ConvertorUtils.hxx"
 
 #include <stdexcept>
 #include <sstream>
@@ -411,12 +412,7 @@ VISU_Actor
   if(myIsVTKMapping)
     return Superclass::GetNodeObjId(theID);
 
-  vtkIdType anID = myGeomFilter->GetNodeObjId(theID);
-
-  if(myIsShrunk)
-   anID = myShrinkFilter->GetNodeObjId(anID);
-
-  return GetCurrentPL()->GetNodeObjID(anID);
+  return VISU::GetNodeObjID(GetMapper()->GetInput(), theID);
 }
 
 vtkIdType
@@ -426,7 +422,7 @@ VISU_Actor
   if(myIsVTKMapping)
     return theID;
 
-  return GetCurrentPL()->GetNodeVTKID(theID);
+  return VISU::GetNodeVTKID(GetMapper()->GetInput(), theID);
 }
 
 vtkFloatingPointType*
@@ -436,7 +432,7 @@ VISU_Actor
   if(myIsVTKMapping)
     return Superclass::GetNodeCoord(theObjID);
 
-  return GetCurrentPL()->GetNodeCoord(theObjID);
+  return VISU::GetNodeCoord(GetInput(), theObjID);
 }
 
 
@@ -448,12 +444,7 @@ VISU_Actor
   if(myIsVTKMapping)
     return Superclass::GetElemObjId(theID);
 
-  vtkIdType anID = myGeomFilter->GetElemObjId(theID);
-
-  if(myIsShrunk)
-   anID = myShrinkFilter->GetElemObjId(anID);
-
-  return GetCurrentPL()->GetElemObjID(anID);
+  return VISU::GetElemObjID(GetMapper()->GetInput(), theID);
 }
 
 vtkIdType
@@ -463,7 +454,7 @@ VISU_Actor
   if(myIsVTKMapping)
     return theID;
 
-  return GetCurrentPL()->GetElemVTKID(theID);
+  return VISU::GetElemVTKID(GetMapper()->GetInput(), theID);
 }
 
 vtkCell* 
@@ -473,7 +464,7 @@ VISU_Actor
   if(myIsVTKMapping)
     return Superclass::GetElemCell(theObjID);
 
-  return GetCurrentPL()->GetElemCell(theObjID);
+  return VISU::GetElemCell(GetInput(), theObjID);
 }
 
 
index 64ee4b76c2a19ea0ff41e69a82b24b4f43347e88..690882d6beba76dafb275c290c3a5a2049409b38 100644 (file)
@@ -58,7 +58,8 @@ EXPORT_HEADERS = \
        VISU_SphereWidget.hxx \
        VISU_WidgetCtrl.hxx \
        VISU_ScalarMapOnDeformedShapePL.hxx \
-       VISU_PrsMergerPL.hxx
+       VISU_PrsMergerPL.hxx \
+       VISU_CellDataToPointData.hxx
 
 # Libraries targets
 
@@ -89,7 +90,8 @@ LIB_SRC = \
        VISU_WidgetCtrl.cxx \
        VISU_ScalarBarCtrl.cxx \
        VISU_ScalarMapOnDeformedShapePL.cxx \
-       VISU_PrsMergerPL.cxx
+       VISU_PrsMergerPL.cxx \
+       VISU_CellDataToPointData.cxx
 
 # Executables targets
 
index 2af09bb99c4423d97d9fb0f57575c8a4bd7b2d9c..7c93e0c9ee9af6424b9143ca4515b631e8e9ca18 100644 (file)
 #include "VISU_Convertor.hxx"
 #include "VISU_MeshPL.hxx"
 #include "VISU_ScalarMapPL.hxx"
+#include "VISU_PrsMergerPL.hxx"
 #include "VISU_IsoSurfacesPL.hxx"
 #include "VISU_CutPlanesPL.hxx"
 #include "VISU_CutLinesPL.hxx"
 #include "VISU_DeformedShapePL.hxx"
+#include "VISU_ScalarMapOnDeformedShapePL.hxx"
 #include "VISU_VectorsPL.hxx"
 #include "VISU_StreamLinesPL.hxx"
 #include "VISU_GaussPointsPL.hxx"
 #include "VISU_Plot3DPL.hxx"
 
-typedef VISU_GaussPointsPL TPresent;
+typedef VISU_DeformedShapePL TPresent;
 
 #include <vtkUnstructuredGrid.h>
 #include <vtkDataSetMapper.h>
@@ -67,6 +69,7 @@ int main(int argc, char** argv){
       iren->SetRenderWindow(renWin);
       VISU_Convertor* aConvertor = CreateConvertor(argv[1]);
       aConvertor->BuildEntities();
+      aConvertor->BuildGroups();
       aConvertor->BuildFields();
       aConvertor->BuildMinMax();
       const VISU::TMeshMap& aMeshMap = aConvertor->GetMeshMap();
@@ -120,32 +123,47 @@ int main(int argc, char** argv){
 
          TPresent* aPresent = TPresent::New();
          VISU::PIDMapper anIDMapper;
-         if(anEntity != VISU::NODE_ENTITY){
-           VISU::PGaussPtsIDMapper aGaussPtsIDMapper = aConvertor->GetTimeStampOnGaussPts(aMeshName,anEntity,aFieldName,aTimeStamp);
-           aPresent->SetGaussPtsIDMapper(aGaussPtsIDMapper);
-         }else{
+         if(anEntity == VISU::NODE_ENTITY){
            continue;
+           //VISU::PGaussPtsIDMapper aGaussPtsIDMapper = aConvertor->GetTimeStampOnGaussPts(aMeshName,anEntity,aFieldName,aTimeStamp);
+           //aPresent->SetGaussPtsIDMapper(aGaussPtsIDMapper);
+         }else{
            VISU::PIDMapper anIDMapper = aConvertor->GetTimeStampOnMesh(aMeshName,anEntity,aFieldName,aTimeStamp);
            aPresent->SetIDMapper(anIDMapper);
          }
 
          aPresent->Build();
          aPresent->Init();
-
-         char aMainTexture[80];
-         strcpy( aMainTexture, getenv( "VISU_ROOT_DIR" ) );
-         strcat( aMainTexture, "/share/salome/resources/visu/sprite_texture.vti" );
-         //cout << aMainTexture << endl;
-
-         char anAlphaTexture[80];
-         strcpy( anAlphaTexture, getenv( "VISU_ROOT_DIR" ) );
-         strcat( anAlphaTexture, "/share/salome/resources/visu/sprite_alpha.vti" );
-         //cout << anAlphaTexture << endl;
-
-         vtkSmartPointer<vtkImageData> aTextureValue = VISU_GaussPointsPL::MakeTexture( aMainTexture, anAlphaTexture );
-         aPresent->SetImageData( aTextureValue.GetPointer() );
-
          aPresent->Update();
+         //aPresent->SetScalars(aPresent->GetInput());
+         //aPresent->Build();
+         //aPresent->Init();
+         //aPresent->RemoveAllGeom();
+         //{
+         //  VISU::PIDMapper anIDMapper = aConvertor->GetMeshOnGroup(aMeshName, 
+         //                                                        //"TUYAU                                                                           ");
+         //                                                        "groupe1");
+         //  VISU_MeshPL* aGeomPresent = VISU_MeshPL::New();
+         //  aGeomPresent->SetIDMapper(anIDMapper);
+         //  aGeomPresent->Build();
+         //  aPresent->AddBackGeometry(aGeomPresent);
+         //}
+         aPresent->Update();
+
+//       char aMainTexture[80];
+//       strcpy( aMainTexture, getenv( "VISU_ROOT_DIR" ) );
+//       strcat( aMainTexture, "/share/salome/resources/visu/sprite_texture.vti" );
+//       //cout << aMainTexture << endl;
+//
+//       char anAlphaTexture[80];
+//       strcpy( anAlphaTexture, getenv( "VISU_ROOT_DIR" ) );
+//       strcat( anAlphaTexture, "/share/salome/resources/visu/sprite_alpha.vti" );
+//       //cout << anAlphaTexture << endl;
+//
+//       vtkSmartPointer<vtkImageData> aTextureValue = VISU_GaussPointsPL::MakeTexture( aMainTexture, anAlphaTexture );
+//       aPresent->SetImageData( aTextureValue.GetPointer() );
+//
+//       aPresent->Update();
 
          vtkActor* anActor = vtkActor::New();
          anActor->SetMapper(aPresent->GetMapper());
diff --git a/src/PIPELINE/VISU_CellDataToPointData.cxx b/src/PIPELINE/VISU_CellDataToPointData.cxx
new file mode 100644 (file)
index 0000000..3053295
--- /dev/null
@@ -0,0 +1,135 @@
+//  VISU OBJECT : interactive object for VISU entities implementation
+//
+//  Copyright (C) 2003  OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
+//  CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
+//
+//  This library is free software; you can redistribute it and/or
+//  modify it under the terms of the GNU Lesser General Public
+//  License as published by the Free Software Foundation; either
+//  version 2.1 of the License.
+//
+//  This library is distributed in the hope that it will be useful,
+//  but WITHOUT ANY WARRANTY; without even the implied warranty of
+//  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+//  Lesser General Public License for more details.
+//
+//  You should have received a copy of the GNU Lesser General Public
+//  License along with this library; if not, write to the Free Software
+//  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
+//
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
+//
+//
+// File:    VISU_CellDataToPointData.cxx
+// Author:  Alexey PETROV
+// Module : VISU
+
+
+#include "VISU_CellDataToPointData.hxx"
+
+#include <vtkCellData.h>
+#include <vtkDataSet.h>
+#include <vtkIdList.h>
+#include <vtkObjectFactory.h>
+#include <vtkPointData.h>
+
+vtkStandardNewMacro(VISU_CellDataToPointData);
+
+VISU_CellDataToPointData
+::VISU_CellDataToPointData()
+{}
+
+#define VTK_MAX_CELLS_PER_POINT 4096
+
+void VISU_CellDataToPointData::Execute()
+{
+  vtkIdType cellId, ptId;
+  vtkIdType numCells, numPts;
+  vtkDataSet *input= this->GetInput();
+  vtkDataSet *output= this->GetOutput();
+  vtkCellData *inPD=input->GetCellData();
+  vtkPointData *outPD=output->GetPointData();
+  vtkIdList *cellIds;
+  float weight;
+  float *weights;
+
+  vtkDebugMacro(<<"Mapping cell data to point data");
+
+  // First, copy the input to the output as a starting point
+  output->CopyStructure( input );
+
+  cellIds = vtkIdList::New();
+  cellIds->Allocate(VTK_MAX_CELLS_PER_POINT);
+
+  if ( (numPts=input->GetNumberOfPoints()) < 1 )
+    {
+    vtkErrorMacro(<<"No input point data!");
+    cellIds->Delete();
+    return;
+    }
+  weights = new float[VTK_MAX_CELLS_PER_POINT];
+  
+  outPD->CopyAllocate(inPD,numPts);
+
+  int abort=0;
+  vtkIdType progressInterval=numPts/20 + 1;
+  for (ptId=0; ptId < numPts && !abort; ptId++)
+    {
+    if ( !(ptId % progressInterval) )
+      {
+      this->UpdateProgress((float)ptId/numPts);
+      abort = GetAbortExecute();
+      }
+
+    input->GetPointCells(ptId, cellIds);
+    numCells = cellIds->GetNumberOfIds();
+    if ( numCells > 0 )
+      {
+      weight = 1.0 / numCells;
+      for (cellId=0; cellId < numCells; cellId++)
+        {
+        weights[cellId] = weight;
+        }
+      outPD->InterpolatePoint(inPD, ptId, cellIds, weights);
+      }
+    else
+      {
+      outPD->NullPoint(ptId);
+      }
+    }
+
+  // Pass the point data first. The fields and attributes
+  // which also exist in the cell data of the input will
+  // be missed
+  {
+    vtkPointData* anInputPointData = input->GetPointData();
+    vtkPointData* anOutputPointData = output->GetPointData();
+
+    int aNbAttributeTypes = vtkDataSetAttributes::NUM_ATTRIBUTES;
+    for(int anAttribueType = 0; anAttribueType < aNbAttributeTypes; anAttribueType++){
+      if(vtkDataArray* anInputAttribute = anInputPointData->GetAttribute(anAttribueType)){
+       if(anOutputPointData->GetAttribute(anAttribueType) == NULL){
+         int anArrayId = anOutputPointData->AddArray(anInputAttribute);
+         anOutputPointData->SetActiveAttribute(anArrayId, anAttribueType);
+       }
+      }
+    }
+
+    int aNbOfInputArrays = anInputPointData->GetNumberOfArrays();
+    for(int anArrayId = 0; anArrayId < aNbOfInputArrays; anArrayId++){
+      if(anInputPointData->IsArrayAnAttribute(anArrayId) < 0){
+       vtkDataArray* anInputArray = anInputPointData->GetArray(anArrayId);
+       if(anOutputPointData->GetArray(anInputArray->GetName()) == NULL)
+         anOutputPointData->AddArray(anInputArray);
+      }
+    }
+  }
+
+  if ( this->GetPassCellData() )
+    {
+    output->GetCellData()->PassData(input->GetCellData());
+    }
+
+  cellIds->Delete();
+  delete [] weights;
+}
diff --git a/src/PIPELINE/VISU_CellDataToPointData.hxx b/src/PIPELINE/VISU_CellDataToPointData.hxx
new file mode 100644 (file)
index 0000000..172ebc3
--- /dev/null
@@ -0,0 +1,51 @@
+//  VISU OBJECT : interactive object for VISU entities implementation
+//
+//  Copyright (C) 2003  OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
+//  CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
+//
+//  This library is free software; you can redistribute it and/or
+//  modify it under the terms of the GNU Lesser General Public
+//  License as published by the Free Software Foundation; either
+//  version 2.1 of the License.
+//
+//  This library is distributed in the hope that it will be useful,
+//  but WITHOUT ANY WARRANTY; without even the implied warranty of
+//  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+//  Lesser General Public License for more details.
+//
+//  You should have received a copy of the GNU Lesser General Public
+//  License along with this library; if not, write to the Free Software
+//  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
+//
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
+//
+//
+// File:    VISU_CellDataToPointData.hxx
+// Author:  Alexey PETROV
+// Module : VISU
+
+
+#ifndef VISU_CellDataToPointData_HeaderFile
+#define VISU_CellDataToPointData_HeaderFile
+
+#include <vtkCellDataToPointData.h>
+
+class VISU_CellDataToPointData : public vtkCellDataToPointData
+{
+public:
+  static VISU_CellDataToPointData *New();
+  vtkTypeMacro(VISU_CellDataToPointData, vtkCellDataToPointData);
+
+protected:
+  VISU_CellDataToPointData();
+
+  void Execute();
+
+private:
+  VISU_CellDataToPointData(const VISU_CellDataToPointData&);  // Not implemented.
+  void operator=(const VISU_CellDataToPointData&);  // Not implemented.
+};
+
+#endif
+
+
index 3da0ca4a2f96a78d554e1a21e760080303091322..86fcaeeeff2c7c790a14fc22115923cc63af52b9 100644 (file)
@@ -89,7 +89,7 @@ VISU_CutLinesPL
   vtkFloatingPointType aPosition = myPosition;
   if(myCondition){
       vtkFloatingPointType aDir[3], aBounds[6], aBoundPrj[3];
-      GetInput2()->GetBounds(aBounds);
+      GetMergedInput()->GetBounds(aBounds);
       GetDir(aDir,myAng[0],myBasePlane[0]);
       GetBoundProject(aBoundPrj,aBounds,aDir);
       aPosition = aBoundPrj[0] + aBoundPrj[2]*myDisplacement[0];
@@ -122,22 +122,33 @@ VISU_CutLinesPL
   vtkAppendPolyData *anAppendPolyData = vtkAppendPolyData::New();
   //Build base plane
   vtkFloatingPointType aDir[2][3], aBaseBounds[6];
-  GetInput2()->GetBounds(aBaseBounds);
+  vtkPointSet* aPointSet = GetMergedInput();
+  aPointSet->GetBounds(aBaseBounds);
   GetDir(aDir[0],myAng[0],myBasePlane[0]);
-  vtkUnstructuredGrid* anUnstructuredGrid =
-    myFieldTransform->GetUnstructuredGridOutput();
-  CutWithPlanes(anAppendPolyData,anUnstructuredGrid,1,aDir[0],aBaseBounds,
-               myPosition,myCondition,myDisplacement[0]);
+  CutWithPlanes(anAppendPolyData,
+               aPointSet,
+               1,
+               aDir[0],
+               aBaseBounds,
+               myPosition,
+               myCondition,
+               myDisplacement[0]);
   //Build lines
   vtkFloatingPointType aBounds[6];
   vtkDataSet *aDataSet = anAppendPolyData->GetOutput();
   aDataSet->Update();
   if(aDataSet->GetNumberOfCells() == 0)
-    aDataSet = anUnstructuredGrid;
+    aDataSet = aPointSet;
   aDataSet->GetBounds(aBounds);
   GetDir(aDir[1],myAng[1],myBasePlane[1]);
-  VISU_CutPlanesPL::CutWithPlanes(myAppendPolyData,aDataSet,GetNbParts(),aDir[1],aBounds,
-                                 myPartPosition,myPartCondition,myDisplacement[1]);
+  VISU_CutPlanesPL::CutWithPlanes(myAppendPolyData,
+                                 aDataSet,
+                                 GetNbParts(),
+                                 aDir[1],
+                                 aBounds,
+                                 myPartPosition,
+                                 myPartCondition,
+                                 myDisplacement[1]);
   anAppendPolyData->Register(myAppendPolyData);
   anAppendPolyData->Delete();
   //Calculate values for building of table
index b858181d4c7e433b91d16ba6178c3a6b16a00422..c897d3010cf93752ebe2b36d3e38d3d320247ccf 100644 (file)
@@ -91,9 +91,9 @@ VISU_CutPlanesPL
   myAng[0][0] = myAng[0][1] = myAng[0][2] = 0.0;
 }
 
-VISU_ScalarMapPL::THook
+VISU_ScalarMapPL::TInsertCustomPL
 VISU_CutPlanesPL
-::DoHook()
+::InsertCustomPL()
 {
   return myAppendPolyData->GetOutput();
 }
@@ -102,17 +102,26 @@ void
 VISU_CutPlanesPL
 ::Update()
 {
+  Superclass::Update();
+
   ClearAppendPolyData(myAppendPolyData);
   SetPartPosition();
+
   vtkFloatingPointType aDir[3];
   GetDir(aDir,myAng[0],myBasePlane[0]);
-  vtkFloatingPointType aBounds[6];
-  GetInput2()->GetBounds(aBounds);
-  vtkDataSet* aDataSet = myFieldTransform->GetUnstructuredGridOutput();
-  CutWithPlanes(myAppendPolyData,aDataSet,myNbParts,aDir,aBounds,
-               myPartPosition,myPartCondition,myDisplacement[0]);
 
-  Superclass::Update();
+  vtkFloatingPointType aBounds[6];
+  vtkPointSet* aMergedInput = GetMergedInput();
+  aMergedInput->GetBounds(aBounds);
+
+  CutWithPlanes(myAppendPolyData,
+               aMergedInput,
+               myNbParts,
+               aDir,
+               aBounds,
+               myPartPosition,
+               myPartCondition,
+               myDisplacement[0]);
 }
 
 void
@@ -290,7 +299,7 @@ VISU_CutPlanesPL
   vtkFloatingPointType aPosition = myPartPosition[thePartNumber];
   if(myPartCondition[thePartNumber]){
       vtkFloatingPointType aDir[3], aBounds[6], aBoundPrj[3];
-      GetInput2()->GetBounds(aBounds);
+      GetMergedInput()->GetBounds(aBounds);
       GetDir(aDir,myAng[theNum],myBasePlane[theNum]);
       GetBoundProject(aBoundPrj,aBounds,aDir);
       if (myNbParts > 1){
index 0be096b974842d944b25392cdd3d351a6c3fb9d8..a5e77a3e45cc024bfbf8a94e1a000120c8ba40b1 100644 (file)
@@ -190,8 +190,8 @@ public:
                vtkFloatingPointType theDisplacement);
 protected:
   virtual 
-  THook
-  DoHook();
+  TInsertCustomPL
+  InsertCustomPL();
 
   void
   SetPartPosition(int theNum = 0);
index 0a69dc9b838cd412785c0c357076da0e4f44d89a..db852b9906e39ec2ae8356ecf643c8cc7416b96e 100644 (file)
@@ -26,8 +26,9 @@
 
 
 #include "VISU_DeformedShapePL.hxx"
-#include "VISU_PipeLineUtils.hxx"
+#include "VISU_CellDataToPointData.hxx"
 #include "VTKViewer_Transform.h"
+#include "VISU_PipeLineUtils.hxx"
 
 #include <vtkWarpVector.h>
 
@@ -37,7 +38,7 @@ VISU_DeformedShapePL
 ::VISU_DeformedShapePL()
 {
   myWarpVector = vtkWarpVector::New();
-  myCellDataToPointData = vtkCellDataToPointData::New();
+  myCellDataToPointData = VISU_CellDataToPointData::New();
 }
 
 VISU_DeformedShapePL
@@ -57,14 +58,15 @@ VISU_DeformedShapePL
   if(VISU_DeformedShapePL *aPipeLine = dynamic_cast<VISU_DeformedShapePL*>(thePipeLine)){
     SetScale(aPipeLine->GetScale());
   }
-  TSupperClass::ShallowCopy(thePipeLine);
+  Superclass::ShallowCopy(thePipeLine);
 }
 
 vtkFloatingPointType
 VISU_DeformedShapePL
 ::GetScaleFactor(vtkDataSet* theDataSet)
 {
-  if(!theDataSet) return 0.0;
+  if(!theDataSet)
+    return 0.0;
   theDataSet->Update();
   int aNbCells = theDataSet->GetNumberOfCells();
   int aNbPoints = theDataSet->GetNumberOfPoints();
@@ -103,12 +105,12 @@ void
 VISU_DeformedShapePL
 ::Init()
 {
-  TSupperClass::Init();
+  Superclass::Init();
+
   vtkFloatingPointType aScalarRange[2];
   GetSourceRange(aScalarRange);
 
-  vtkDataSet* aDataSet = GetInput2();
-  //vtkDataSet* aDataSet = GetScalars()->GetInput();
+  vtkDataSet* aDataSet = GetMergedInput();
   vtkFloatingPointType aScaleFactor = VISU_DeformedShapePL::GetScaleFactor( aDataSet );
 
   static double EPS = 1.0 / VTK_LARGE_FLOAT;
@@ -118,26 +120,41 @@ VISU_DeformedShapePL
     SetScale(0.0);
 }
 
-VISU_ScalarMapPL::THook* 
+void
 VISU_DeformedShapePL
-::DoHook()
+::Build()
 {
-  VISU::CellDataToPoint(myWarpVector,myCellDataToPointData,GetInput2(),myFieldTransform);
-  return myWarpVector->GetOutput();
+  Superclass::Build();
+
+  VISU::CellDataToPoint(myWarpVector,
+                       myCellDataToPointData,
+                       GetMergedInput());
+  //{
+  //  std::string aFileName = std::string(getenv("HOME"))+"/"+getenv("USER")+"-myMergeFilter3-.vtk";
+  //  VISU::WriteToFile(dynamic_cast<vtkUnstructuredGrid*>(GetMergedInput()), aFileName);
+  //}
+  //{
+  //  std::string aFileName = std::string(getenv("HOME"))+"/"+getenv("USER")+"-myMergeFilter3.vtk";
+  //  VISU::WriteToFile(myCellDataToPointData->GetUnstructuredGridOutput(), aFileName);
+  //}
+  //{
+  //  std::string aFileName = std::string(getenv("HOME"))+"/"+getenv("USER")+"-myMergeFilter3+.vtk";
+  //  VISU::WriteToFile(myWarpVector->GetUnstructuredGridOutput(), aFileName);
+  //}
 }
 
-void
+VISU_ScalarMapPL::TInsertCustomPL* 
 VISU_DeformedShapePL
-::Update()
+::InsertCustomPL()
 {
-  TSupperClass::Update();
+  return myWarpVector->GetOutput();
 }
 
 void
 VISU_DeformedShapePL
 ::SetMapScale(vtkFloatingPointType theMapScale)
 {
-  TSupperClass::SetMapScale(theMapScale);
+  Superclass::SetMapScale(theMapScale);
 
   myWarpVector->SetScaleFactor(myScaleFactor*theMapScale);
   Modified();
index 4cb3aa8b2a4743cc46788a7d19388933c9615e6c..f6def0edec44e31707087a7d2c9da84b1a092725 100644 (file)
 
 #include "VISU_PrsMergerPL.hxx"
 
-class vtkCellDataToPointData;
+class VISU_CellDataToPointData;
 class SALOME_Transform;
+
 class vtkWarpVector;
 
 class VISU_DeformedShapePL : public VISU_PrsMergerPL
 {
-  typedef VISU_PrsMergerPL TSupperClass;
-  
 protected:
   VISU_DeformedShapePL();
   VISU_DeformedShapePL(const VISU_DeformedShapePL&);
@@ -45,7 +44,7 @@ protected:
   ~VISU_DeformedShapePL();
 
 public:
-  vtkTypeMacro(VISU_DeformedShapePL,TSupperClass);
+  vtkTypeMacro(VISU_DeformedShapePL, VISU_PrsMergerPL);
 
   static
   VISU_DeformedShapePL* 
@@ -70,7 +69,7 @@ public:
 
   virtual
   void
-  Update();
+  Build();
 
   virtual
   void
@@ -82,12 +81,12 @@ public:
 
 protected:
   virtual
-  THook
-  DoHook();
+  TInsertCustomPL
+  InsertCustomPL();
 
   vtkFloatingPointType myScaleFactor;
   vtkWarpVector *myWarpVector;
-  vtkCellDataToPointData* myCellDataToPointData;
+  VISU_CellDataToPointData* myCellDataToPointData;
 };
 
 
index 3ffc756480d8959e83d6a04f045c343d064e6cec..a27a63aee60f4af1be634abfdea32830a9aa4563 100644 (file)
 
 #include "VISU_GaussPointsPL.hxx"
 #include "VISU_DeformedShapePL.hxx"
-#include "VISU_PipeLineUtils.hxx"
+#include "VISU_CellDataToPointData.hxx"
 #include "SALOME_ExtractGeometry.h"
 #include "VISU_DeformedShapePL.hxx"
 #include "VISU_OpenGLPointSpriteMapper.hxx"
 #include "VTKViewer_PassThroughFilter.h"
 
+#include "VISU_PipeLineUtils.hxx"
+
 #include <vtkPointSource.h>
 #include <vtkElevationFilter.h>
 #include <vtkImageGaussianSource.h>
@@ -64,7 +66,7 @@ VISU_GaussPointsPL
   myGeomFilter = vtkGeometryFilter::New();
 
   myWarpVector = vtkWarpVector::New();
-  myCellDataToPointData = vtkCellDataToPointData::New();
+  myCellDataToPointData = VISU_CellDataToPointData::New();
   myCellDataToPointData->SetPassCellData(true);
 
   myGlyph = vtkGlyph3D::New();
@@ -72,9 +74,6 @@ VISU_GaussPointsPL
   myGlyph->SetColorModeToColorByScalar();
   myGlyph->ClampingOn();
 
-  myExtractor->SetInput( myExtractGeometry->GetOutput() );
-  myFieldTransform->SetInput( myExtractor->GetOutput() );
-
   myCellDataToPointData->SetInput( myFieldTransform->GetUnstructuredGridOutput() );
 
   mySphereSource = vtkSphereSource::New();
@@ -172,7 +171,7 @@ VISU_GaussPointsPL
 {
   if(GetInput()){
     if(!myPSMapper->GetInput()){
-      GetInput2()->Update();
+      GetClippedInput()->Update();
       Build();
       Init();
     }
index 4acd793f6214ab69dfa52ca95ce17036879b7a06..0c86a8e3bf2d3b9d2e6a6df5e989cd482d754a4d 100644 (file)
@@ -33,6 +33,8 @@
 
 #include <vector>
 
+class SALOME_Transform;
+class VISU_CellDataToPointData;
 class VTKViewer_PassThroughFilter;
 class VISU_OpenGLPointSpriteMapper;
 
@@ -43,9 +45,7 @@ class vtkDataArray;
 class vtkImageData;
 class vtkPointSet;
 
-class vtkCellDataToPointData;
 class vtkWarpVector;
-class SALOME_Transform;
 
 //! Pipeline for the Gauss Points presentation.
 /*!
@@ -267,7 +267,7 @@ protected:
   bool myIsDeformed;
   vtkFloatingPointType myScaleFactor;
   vtkWarpVector *myWarpVector;
-  vtkCellDataToPointData* myCellDataToPointData;
+  VISU_CellDataToPointData* myCellDataToPointData;
   std::vector<VTKViewer_PassThroughFilter*> myPassFilter;
   
   vtkGlyph3D* myGlyph;
index c8b9eaeaf1b1717356cd0e55d21d7ddc06b29cfa..f8fa6b7b765cb57c36e68c328b903b025c97284a 100644 (file)
@@ -27,6 +27,7 @@
 
 
 #include "VISU_IsoSurfacesPL.hxx"
+#include "VISU_CellDataToPointData.hxx"
 #include "VISU_PipeLineUtils.hxx"
 
 #include <vtkContourFilter.h>
@@ -37,7 +38,7 @@ VISU_IsoSurfacesPL
 ::VISU_IsoSurfacesPL()
 {
   myContourFilter = vtkContourFilter::New();
-  myCellDataToPointData = vtkCellDataToPointData::New();
+  myCellDataToPointData = VISU_CellDataToPointData::New();
   myIsShrinkable = false;
 }
 
@@ -60,7 +61,7 @@ VISU_IsoSurfacesPL
     vtkFloatingPointType aRange[2] = {aPipeLine->GetMin(), aPipeLine->GetMax()};
     SetRange(aRange);
   }
-  TSupperClass::ShallowCopy(thePipeLine);
+  Superclass::ShallowCopy(thePipeLine);
 }
 
 int
@@ -82,7 +83,7 @@ void
 VISU_IsoSurfacesPL
 ::SetScaling(int theScaling) 
 {
-  TSupperClass::SetScaling(theScaling);
+  Superclass::SetScaling(theScaling);
   SetRange(myRange);
 }
 void
@@ -118,7 +119,7 @@ void
 VISU_IsoSurfacesPL
 ::Init()
 {
-  TSupperClass::Init();
+  Superclass::Init();
 
   SetNbParts(10);
   vtkFloatingPointType aScalarRange[2];
@@ -126,27 +127,30 @@ VISU_IsoSurfacesPL
   SetRange(aScalarRange);
 }
 
-VISU_ScalarMapPL::THook
+VISU_ScalarMapPL::TInsertCustomPL
 VISU_IsoSurfacesPL
-::DoHook()
+::InsertCustomPL()
 {
-  VISU::CellDataToPoint(myContourFilter,myCellDataToPointData,GetInput2(),myFieldTransform);
   return myContourFilter->GetOutput();
 }
 
 
 void
 VISU_IsoSurfacesPL
-::Update()
+::Build()
 {
-  TSupperClass::Update();
+  Superclass::Build();
+
+  VISU::CellDataToPoint(myContourFilter,
+                       myCellDataToPointData,
+                       GetMergedInput());
 }
 
 void
 VISU_IsoSurfacesPL
 ::SetMapScale(vtkFloatingPointType theMapScale)
 {
-  TSupperClass::SetMapScale(theMapScale);
+  Superclass::SetMapScale(theMapScale);
 
   vtkFloatingPointType aRange[2] = {GetMax() - theMapScale*(GetMax()-GetMin()), GetMax()};
   vtkFloatingPointType aNewRange[2] = {aRange[0], aRange[1]};
index bd29bbb905243c53ce30f56c16641bdec474018f..3ab0cf4f03f123e765695c6e0c20e5225f0310cd 100644 (file)
 
 #include "VISU_PrsMergerPL.hxx"
 
+class VISU_CellDataToPointData;
+
 class vtkContourFilter;
-class vtkCellDataToPointData;
 
 class VISU_IsoSurfacesPL : public VISU_PrsMergerPL
 {
-  typedef VISU_ScalarMapPL TSupperClass;
-
 protected:
   VISU_IsoSurfacesPL();
   VISU_IsoSurfacesPL(const VISU_IsoSurfacesPL&);
@@ -44,7 +43,7 @@ protected:
   ~VISU_IsoSurfacesPL();
 
 public:
-  vtkTypeMacro(VISU_IsoSurfacesPL,TSupperClass);
+  vtkTypeMacro(VISU_IsoSurfacesPL, VISU_PrsMergerPL);
 
   static
   VISU_IsoSurfacesPL* 
@@ -85,11 +84,11 @@ public:
 
   virtual
   void
-  Update();
+  Build();
 
   virtual
-  THook
-  DoHook();
+  TInsertCustomPL
+  InsertCustomPL();
 
   virtual
   void
@@ -98,7 +97,7 @@ public:
 protected:
   int myNbParts;
   vtkFloatingPointType myRange[2];
-  vtkCellDataToPointData* myCellDataToPointData;
+  VISU_CellDataToPointData* myCellDataToPointData;
   vtkContourFilter *myContourFilter;
 };
 
index b4730bc3066e6e3ed25882343e2d1c83a0d905f9..e08b34138c2eaf6970552c4b95c09fd2a5f25598 100644 (file)
@@ -43,7 +43,7 @@ VISU_MeshPL::VISU_MeshPL()
 
 void VISU_MeshPL::Build()
 {
-  myMapper->SetInput(GetInput2());
+  myMapper->SetInput(GetClippedInput());
 }
 
 void VISU_MeshPL::Init()
index 91e05edb700fa084d2928f26cd63e259ea494f59..ea4f8da731f70e01c74e934428b0ae0055c5a074 100644 (file)
@@ -122,7 +122,7 @@ VISU_PipeLine
   GetImplicitFunction()->Delete();
 }
 
-TInput* 
+VISU_PipeLine::TInput* 
 VISU_PipeLine
 ::GetInput() const
 {
@@ -136,18 +136,18 @@ VISU_PipeLine
   return GetMapper()->GetInput();
 }
 
-TInput* 
+VISU_PipeLine::TInput* 
 VISU_PipeLine
-::GetInput2() const
+::GetClippedInput()
 {
-  vtkUnstructuredGrid* aDataSet = myExtractGeometry->GetOutput();
-  aDataSet->Update();
-  return aDataSet;
+  if(myExtractGeometry->GetInput())
+    myExtractGeometry->Update();
+  return myExtractGeometry->GetOutput();
 }
 
 void
 VISU_PipeLine
-::SetInput(TInput* theInput)
+::SetInput(VISU_PipeLine::TInput* theInput)
 {
   if(theInput)
     theInput->Update();
@@ -164,7 +164,7 @@ VISU_PipeLine
 {
   if(GetInput()){
     if(!myMapper->GetInput()){
-      GetInput2()->Update();
+      GetClippedInput()->Update();
       Build();
     }
     myMapper->Update();
@@ -227,7 +227,7 @@ VISU_PipeLine
 
       // Check, that at least one cell present after clipping.
       // This check was introduced because of bug IPAL8849.
-      vtkUnstructuredGrid* aClippedGrid = GetInput2();
+      vtkUnstructuredGrid* aClippedGrid = GetClippedInput();
       if (aClippedGrid->GetNumberOfCells() < 1) {
         return false;
       }
index c90080cef9e3497cb4252a2279bc8ff24518621c..4af292eec4ddab9d061cca41389be6f66d93aac3 100644 (file)
@@ -79,9 +79,9 @@ class vtkPlane;
 
 class SALOME_ExtractGeometry;
 
-typedef VISU::TVTKOutput TInput;
 
-class VISU_PipeLine : public vtkObject{
+class VISU_PipeLine : public vtkObject
+{
 public:
   vtkTypeMacro(VISU_PipeLine,vtkObject);
   virtual
@@ -104,6 +104,8 @@ public:
   SameAs(VISU_PipeLine *thePipeLine);
 
 public:
+  typedef VISU::TVTKOutput TInput;
+
   virtual
   void
   SetInput(TInput* theInput);
@@ -213,7 +215,7 @@ protected:
 
   virtual 
   TInput* 
-  GetInput2() const;
+  GetClippedInput();
 
   virtual
   void
index 7b87e3627bf6792b0f485d6da67ff82d59657025..1056358d32ee6f42c62430ae1230ebe4fc465bff 100644 (file)
@@ -27,6 +27,7 @@
 #ifndef VISU_PipeLineUtils_HeaderFile
 #define VISU_PipeLineUtils_HeaderFile
 
+#include "VISU_CellDataToPointData.hxx"
 #include "VISU_FieldTransform.hxx"
 #include "VISU_LookupTable.hxx"
 #include "VISU_Extractor.hxx"
@@ -37,7 +38,6 @@
 #include <vtkDataSetMapper.h>
 #include <vtkUnstructuredGrid.h>
 
-#include <vtkCellDataToPointData.h>
 #include <vtkCellCenters.h>
 #include <vtkPointData.h>
 #include <vtkCellData.h>
@@ -68,34 +68,32 @@ namespace VISU
       const vtkFloatingPointType B[3], 
       vtkFloatingPointType C[3]); // C = A - B
 
-  template<class TItem
+  template<class TOutputFilter
   void
-  CellDataToPoint(TItem* theTItem, 
-                 vtkCellDataToPointData *theFilter,
-                 vtkDataSet* theDataSet,
-                 VISU_FieldTransform *theFieldTransform)
+  CellDataToPoint(TOutputFilter* theOutputFilter, 
+                 VISU_CellDataToPointData *theCellDataToPointData,
+                 vtkPointSet* theDataSet)
   {
     if(VISU::IsDataOnCells(theDataSet)){
-      theFilter->SetInput(theFieldTransform->GetUnstructuredGridOutput());
-      theFilter->PassCellDataOn();
-      theTItem->SetInput(theFilter->GetUnstructuredGridOutput());
+      theCellDataToPointData->SetInput(theDataSet);
+      theCellDataToPointData->PassCellDataOn();
+      theOutputFilter->SetInput(theCellDataToPointData->GetUnstructuredGridOutput());
     }else
-      theTItem->SetInput(theFieldTransform->GetUnstructuredGridOutput());
+      theOutputFilter->SetInput(theDataSet);
   }
 
-  template<class TItem
+  template<class TOutputFilter
   void
-  ToCellCenters(TItem* theTItem, 
-               vtkCellCenters *theFilter,
-               vtkDataSet* theDataSet,
-               VISU_FieldTransform *theFieldTransform)
+  ToCellCenters(TOutputFilter* theOutputFilter, 
+               vtkCellCenters *theCellCenters,
+               vtkPointSet* theDataSet)
   {
     if(VISU::IsDataOnCells(theDataSet)){
-      theFilter->SetInput(theFieldTransform->GetUnstructuredGridOutput());
-      theFilter->VertexCellsOn();
-      theTItem->SetInput(theFilter->GetOutput());
+      theCellCenters->SetInput(theDataSet);
+      theCellCenters->VertexCellsOn();
+      theOutputFilter->SetInput(theCellCenters->GetOutput());
     }else
-      theTItem->SetInput(theFieldTransform->GetUnstructuredGridOutput());
+      theOutputFilter->SetInput(theDataSet);
   }
 }
 
index 4d0ebf651fab0b1152743233f41dd1257523127f..a11328997766606f47b0106e8a9b4a0734c8960f 100644 (file)
 
 #include "VISU_Plot3DPL.hxx"
 #include "VISU_CutPlanesPL.hxx"
+#include "VISU_CellDataToPointData.hxx"
 #include "VISU_PipeLineUtils.hxx"
 
 #include <vtkAppendPolyData.h>
 #include <vtkCutter.h>
 #include <vtkPlane.h>
 
-#include <vtkCellDataToPointData.h>
 #include <vtkGeometryFilter.h>
 #include <vtkContourFilter.h>
 #include <vtkWarpScalar.h>
@@ -44,7 +44,7 @@ using namespace std;
 vtkStandardNewMacro(VISU_Plot3DPL);
 
 VISU_Plot3DPL::VISU_Plot3DPL():
-  myCellDataToPointData(vtkCellDataToPointData::New(),true),
+  myCellDataToPointData(VISU_CellDataToPointData::New(),true),
   myAppendPolyData(vtkAppendPolyData::New(),true),
   myGeometryFilter(vtkGeometryFilter::New(),true),
   myContourFilter(vtkContourFilter::New(),true),
@@ -77,7 +77,7 @@ ShallowCopy(VISU_PipeLine *thePipeLine)
     SetContourPrs( aPipeLine->GetIsContourPrs() );
     SetNumberOfContours( aPipeLine->GetNumberOfContours() );
   }
-  TSupperClass::ShallowCopy(thePipeLine);
+  Superclass::ShallowCopy(thePipeLine);
 }
 
 VISU_CutPlanesPL::PlaneOrientation
@@ -133,15 +133,15 @@ void
 VISU_Plot3DPL::
 Init()
 {
-  TSupperClass::Init();
+  Superclass::Init();
 
-  myOrientation = GetOrientation(GetInput2());
-  SetScaleFactor(GetScaleFactor(GetInput2()));
+  myOrientation = GetOrientation(GetMergedInput());
+  SetScaleFactor(GetScaleFactor(GetMergedInput()));
 }
 
-VISU_ScalarMapPL::THook*
+VISU_ScalarMapPL::TInsertCustomPL*
 VISU_Plot3DPL::
-DoHook()
+InsertCustomPL()
 {
   return myAppendPolyData->GetOutput();
 }
@@ -156,13 +156,12 @@ Update()
 
   vtkPolyData* aPolyData = 0;
   vtkCutter *aCutPlane = 0;
-  vtkUnstructuredGrid* anUnstructuredGrid =
-    myFieldTransform->GetUnstructuredGridOutput();
+  vtkPointSet* aPointSet = GetMergedInput();
 
   if ( !IsPlanarInput() )
   {
     aCutPlane = vtkCutter::New();
-    aCutPlane->SetInput(anUnstructuredGrid);
+    aCutPlane->SetInput(aPointSet);
 
     vtkPlane *aPlane = vtkPlane::New();
     aPlane->SetOrigin(anOrigin);
@@ -176,7 +175,7 @@ Update()
   }
 
   if ( !aPolyData || aPolyData->GetNumberOfCells() == 0 ) {
-    myGeometryFilter->SetInput(anUnstructuredGrid);
+    myGeometryFilter->SetInput(aPointSet);
     aPolyData = myGeometryFilter->GetOutput();
     aPolyData->Update();
   }
@@ -213,7 +212,7 @@ Update()
 
   myWarpScalar->SetNormal(aPlaneNormal);
 
-  TSupperClass::Update();
+  Superclass::Update();
 }
 
 void
@@ -325,7 +324,7 @@ GetPlanePosition() const
 
 void VISU_Plot3DPL::GetBasePlane(vtkFloatingPointType theOrigin[3],
                                  vtkFloatingPointType theNormal[3],
-                                 bool  theCenterOrigine ) const
+                                 bool  theCenterOrigine )
 {
   VISU_CutPlanesPL::GetDir(theNormal,myAngle,myOrientation);
 
@@ -341,7 +340,7 @@ void VISU_Plot3DPL::GetBasePlane(vtkFloatingPointType theOrigin[3],
 
   if ( theCenterOrigine ) {
     // move theOrigin to the center of aBounds projections to the plane
-    GetInput2()->GetBounds(aBounds);
+    GetMergedInput()->GetBounds(aBounds);
     vtkFloatingPointType boundPoints[8][3] = {
       {aBounds[0],aBounds[2],aBounds[4]},
       {aBounds[1],aBounds[2],aBounds[4]},
@@ -388,7 +387,7 @@ void VISU_Plot3DPL::GetMinMaxPosition( vtkFloatingPointType& minPos,
 
 void VISU_Plot3DPL::SetMapScale(vtkFloatingPointType theMapScale)
 {
-  TSupperClass::SetMapScale(theMapScale);
+  Superclass::SetMapScale(theMapScale);
 
   if ( myIsContour ) {
     vtkFloatingPointType aRange[2];
index 59012133176a60081829a22d068bd45b8348be1a..52e69ff21a87e77f14f099921459ff27246d95f0 100644 (file)
 #include "VISU_PrsMergerPL.hxx"
 #include "VISU_CutPlanesPL.hxx"
 
+class VISU_CellDataToPointData;
+
 class vtkWarpScalar;
 class vtkContourFilter;
 class vtkGeometryFilter;
-class vtkCellDataToPointData;
 
 class VISU_Plot3DPL : public VISU_PrsMergerPL{
-  typedef VISU_ScalarMapPL TSupperClass;
 protected:
   VISU_Plot3DPL();
   VISU_Plot3DPL(const VISU_Plot3DPL&);
 
 public:
-  vtkTypeMacro(VISU_Plot3DPL,TSupperClass);
+  vtkTypeMacro(VISU_Plot3DPL, VISU_PrsMergerPL);
   static VISU_Plot3DPL* New();
   virtual ~VISU_Plot3DPL();
 
@@ -94,7 +94,7 @@ public:
 
   void GetBasePlane (vtkFloatingPointType theOrigin[3],
                      vtkFloatingPointType theNormal[3],
-                     bool  theCenterOrigine = false ) const;
+                     bool  theCenterOrigine = false );
 
   void GetMinMaxPosition( vtkFloatingPointType& minPos, 
                          vtkFloatingPointType& maxPos ) const;
@@ -113,14 +113,14 @@ public:
   void SetMapScale(vtkFloatingPointType theMapScale);
 
 protected:
-  virtual THook* DoHook();
+  virtual TInsertCustomPL* InsertCustomPL();
 
   vtkFloatingPointType myAngle[3];
   bool myIsRelative, myIsContour;
   vtkFloatingPointType myPosition, myScaleFactor;
   VISU_CutPlanesPL::PlaneOrientation myOrientation;
 
-  TVTKSmartPtr<vtkCellDataToPointData> myCellDataToPointData;
+  TVTKSmartPtr<VISU_CellDataToPointData> myCellDataToPointData;
   TVTKSmartPtr<vtkAppendPolyData> myAppendPolyData;
   TVTKSmartPtr<vtkGeometryFilter> myGeometryFilter;
   TVTKSmartPtr<vtkContourFilter> myContourFilter;
index 61aa4fcd62965b0f262adf5568afc5f54ff922ad..121ff067f174c3570ae5e6b965269eac82d18503 100644 (file)
@@ -35,6 +35,7 @@
 #include "VISU_MergeFilter.hxx"
 
 #include "VISU_PipeLineUtils.hxx"
+#include "VISU_ConvertorDef.hxx"
 
 #include <vtkMapper.h>
 #include <vtkDataSet.h>
@@ -66,8 +67,7 @@ vtkStandardNewMacro(VISU_PrsMergerPL);
 VISU_PrsMergerPL
 ::VISU_PrsMergerPL():
   myAppendFilter(VISU_AppendFilter::New()),
-  myMergeFilter(VISU_MergeFilter::New()),
-  myScalars(NULL)
+  myMergeFilter(VISU_MergeFilter::New())
 {
   myAppendFilter->SetMergingInputs(true);
   myAppendFilter->Delete();
@@ -85,7 +85,6 @@ VISU_PrsMergerPL
 ::RemoveAllGeom()
 {
   myMeshGeometryList.clear();
-  this->Execute();
 }
 
 void
@@ -95,7 +94,7 @@ VISU_PrsMergerPL
   if (MYDEBUG) MESSAGE("ShallowCopy");
   VISU_PrsMergerPL* aPipeLine = dynamic_cast<VISU_PrsMergerPL*>(thePipeLine);
   if(this == aPipeLine){
-    TSupperClass::ShallowCopy(thePipeLine);
+    Superclass::ShallowCopy(thePipeLine);
     return;
   }
   if(aPipeLine){
@@ -103,16 +102,15 @@ VISU_PrsMergerPL
     if (MYDEBUG) MESSAGE("aNbGeoms="<<aNbGeoms);
     myMeshGeometryList.clear();
     for(int i=0; i<aNbGeoms; i++){
-      AddBackGeometry(aPipeLine->GetGeometry(i),false);
+      AddBackGeometry(aPipeLine->GetGeometry(i));
     }
-    SetScalars(aPipeLine->GetScalars(),true);
   }
-  TSupperClass::ShallowCopy(thePipeLine);
+  Superclass::ShallowCopy(thePipeLine);
 }
 
 bool
 VISU_PrsMergerPL
-::SetGeometry(VISU_PipeLine* theGeometry,bool theUpdate)
+::SetGeometry(VISU_PipeLine* theGeometry)
 {
   if(MYDEBUG) MESSAGE("VISU_PrsMergerPL::SetGeometry()");
   myMeshGeometryList.clear();
@@ -120,10 +118,6 @@ VISU_PrsMergerPL
   if(this->checkGeometry(theGeometry)){
     myMeshGeometryList.push_back(theGeometry);
     if (MYDEBUG) MESSAGE("this->GetGeometry(0)->GetIDMapper()="<<this->GetGeometry(0)->GetIDMapper());
-    
-    if(theUpdate)
-      this->Execute();
-
     return true;
   } else
     return false;
@@ -132,20 +126,17 @@ VISU_PrsMergerPL
 
 int
 VISU_PrsMergerPL
-::AddBackGeometry(VISU_PipeLine* theGeometry,bool theUpdate)
+::AddBackGeometry(VISU_PipeLine* theGeometry)
 {
   if(MYDEBUG) MESSAGE("VISU_PrsMergerPL::AddBackGeometry() "<<theGeometry);
-  if(theGeometry == NULL) return -1;
+  if(theGeometry == NULL) 
+    return -1;
   int aGeomNum = this->GetGeometryNumber(theGeometry);
   if(aGeomNum == -1){
     bool aCheckGeom = this->checkGeometry(theGeometry);
     if(aCheckGeom){
       myMeshGeometryList.push_back(theGeometry);
-      
-      if(theUpdate)
-       this->Execute();
-
-      return (myMeshGeometryList.size()-1);
+      return (myMeshGeometryList.size() - 1);
     } else {
       return -1;
     }
@@ -177,7 +168,6 @@ VISU_PrsMergerPL
     for(;aIter != myMeshGeometryList.end();aIter++){
       if( myMeshGeometryList[theId] == (*aIter)){
        myMeshGeometryList.erase(aIter);
-       this->Execute();
        break;
       }
     }
@@ -195,13 +185,6 @@ VISU_PrsMergerPL
     return NULL;
 }
 
-VISU_PipeLine*
-VISU_PrsMergerPL
-::GetScalars()
-{
-  return myScalars.GetPointer();
-}
-
 int
 VISU_PrsMergerPL
 ::GetNbGeometry()
@@ -209,150 +192,140 @@ VISU_PrsMergerPL
   return myMeshGeometryList.size();
 }
 
-bool
+//=======================================================================
+vtkIdType 
 VISU_PrsMergerPL
-::SetScalars(VISU_PipeLine* theInput,bool theUpdate)
+::GetNodeObjID(vtkIdType theID)
 {
-  if(MYDEBUG) MESSAGE("VISU_PrsMergerPL::SetScalars()");
-  if ( this->checkScalars( theInput ) ){
-    myScalars = theInput;
-    VISU_ScalarMapPL* aScalarMap = dynamic_cast<VISU_ScalarMapPL*>(this->GetScalars());
-    myScalarRanges = aScalarMap->GetScalarRange();
-    if(theUpdate)
-      this->Execute();
-    return true;
-  } else
-    return false;
+  return VISU::GetNodeObjID(myMergeFilter->GetOutput(), theID);
 }
 
-void
+vtkIdType 
 VISU_PrsMergerPL
-::Init()
+::GetNodeVTKID(vtkIdType theID)
 {
-  Superclass::Init();
-  if(MYDEBUG) MESSAGE("VISU_PrsMergerPL::Init() this="<<this);
-  this->Execute();
+  return VISU::GetNodeVTKID(myMergeFilter->GetOutput(), theID);
 }
 
-void
+vtkFloatingPointType* 
 VISU_PrsMergerPL
-::Update()
+::GetNodeCoord(int theObjID)
 {
-  if(MYDEBUG) MESSAGE("VISU_PrsMergerPL::Update()");
-  Superclass::Update();
-  Execute();
+  return VISU::GetNodeCoord(myMergeFilter->GetOutput(), theObjID);
 }
 
-void
+//=======================================================================
+vtkIdType 
 VISU_PrsMergerPL
-::Build()
+::GetElemObjID(vtkIdType theID)
 {
-  if(MYDEBUG) MESSAGE("VISU_PrsMergerPL::Build()");
-  TSupperClass::Build(); // call DoHook method
+  return VISU::GetElemObjID(myMergeFilter->GetOutput(), theID);
 }
 
-void
+vtkIdType
 VISU_PrsMergerPL
-::SetInitialRange()
+::GetElemVTKID(vtkIdType theID)
 {
-  myMapper->UseLookupTableScalarRangeOff();
+  return VISU::GetElemVTKID(myMergeFilter->GetOutput(), theID);
 }
 
-bool
+vtkCell* 
 VISU_PrsMergerPL
-::checkGeometry(const VISU_PipeLine* thePipeLine)
+::GetElemCell(vtkIdType  theObjID)
 {
-  const VISU::PIDMapper& aMapper  = thePipeLine->GetIDMapper();
-  int aNbPoints = aMapper->GetVTKOutput()->GetNumberOfPoints();
-//   if (this->GetNbGeometry() > 0){
-//     const VISU::PIDMapper& aMapper2 = this->GetGeometry(0)->GetIDMapper();
-//     int aNbPoints2 = aMapper2->GetVTKOutput()->GetNumberOfPoints();
-//     if(aNbPoints2 != aNbPoints)
-//       return false;
-//   } else if (this->GetScalars()) {
-//     const VISU::PIDMapper& aMapper2 = this->GetScalars()->GetIDMapper();
-//     int aNbPoints2 = aMapper2->GetVTKOutput()->GetNumberOfPoints();
-//     if(aNbPoints2 != aNbPoints)
-//       return false;
-//   }
-  if(aNbPoints < 1)
-    return false;
-  return true;
+  return VISU::GetElemCell(myMergeFilter->GetOutput(), theObjID);
 }
 
-bool
+//=======================================================================
+void
 VISU_PrsMergerPL
-::checkScalars(const VISU_PipeLine* thePipeLine)
+::Build()
 {
-  const VISU::PIDMapper& aMapper  = thePipeLine->GetIDMapper();
-  int aNbPoints = aMapper->GetVTKOutput()->GetNumberOfPoints();
-//   if (this->GetNbGeometry() > 0){
-//     const VISU::PIDMapper& aMapper2 = this->GetGeometry(0)->GetIDMapper();
-//     int aNbPoints2 = aMapper2->GetVTKOutput()->GetNumberOfPoints();
-//     if(aNbPoints2 != aNbPoints)
-//       return false;
-//   }
-  if(aNbPoints < 1)
-    return false;
-  return true;
+  Superclass::Build();
+
+  UpdateGeometry();
+
+  myMergeFilter->SetGeometry(myAppendFilter->GetOutput());
+
+  myMergeFilter->SetScalars(GetClippedInput());
+  myMergeFilter->SetVectors(GetClippedInput());
+  
+  myMergeFilter->RemoveFields();
+  myMergeFilter->AddField("VISU_FIELD", GetClippedInput());
+  myMergeFilter->AddField("VISU_CELLS_MAPPER", GetClippedInput());
+  myMergeFilter->AddField("VISU_POINTS_MAPPER", GetClippedInput());
 }
 
 void
 VISU_PrsMergerPL
-::Execute(){
-  /* Where are next situations:
-   * 1. Timestamp on entity=NODE
-   * 1.1 Group Cell         - OK
-   * 1.2 Group Cell + Point - ERR (remove points groups)
-   * 1.3 Group Node         - ERR (remove points groups)
-   * 2. Timesatamp on entity=CELL
-   * 2.1 Group Cell         - OK
-   * 2.2 Group Point        - ERR (remove points groups)
-   */
-  if(MYDEBUG) MESSAGE("VISU_PrsMergerPL::Execute()");
-
+::UpdateGeometry()
+{
   myAppendFilter->RemoveAllInputs();
   if(!myMeshGeometryList.empty()){
-    const VISU::PIDMapper& aScalarsIDMapper = myScalars->GetIDMapper();
-    VISU::TVTKOutput* aScalarsOutput = aScalarsIDMapper->GetVTKOutput();
-
-    // copy points to output from input first geometry
-
-    VISU::TVTKOutput* aGeomOutput = NULL;
     vtkIdType aNbGeoms = this->GetNbGeometry();
     for(vtkIdType aGeomId = 0; aGeomId < aNbGeoms; aGeomId++){
       VISU_PipeLine* aGeomPipeLine  = this->GetGeometry(aGeomId);
       const VISU::PIDMapper& aGeomIDMapper = aGeomPipeLine->GetIDMapper();
-      aGeomOutput = aGeomIDMapper->GetVTKOutput();
-      vtkIdType aNbCells = aGeomOutput->GetNumberOfCells();
-//       if(aNbCells > 0)
-//     if(aGeomOutput->GetCell(0)->GetCellType() == VTK_VERTEX )
-//       continue;
-      
+      VISU::TVTKOutput* aGeomOutput = aGeomIDMapper->GetVTKOutput();
       myAppendFilter->AddInput(aGeomOutput);
     }
-    
-    myAppendFilter->SetSharedPointsDataSet(aGeomOutput);
-    myAppendFilter->Update();
-
-    vtkUnstructuredGrid* aGeomDataSet = myAppendFilter->GetOutput();
-    myMergeFilter->SetGeometry(aGeomDataSet);
-
-    //copy array values
-    myMergeFilter->SetScalars(aScalarsOutput);
-    myMergeFilter->SetVectors(aScalarsOutput);
-
-    myMergeFilter->RemoveFields();
-    myMergeFilter->AddField("VISU_FIELD", aScalarsOutput);
-    myMergeFilter->AddField("VISU_CELLS_MAPPER", aScalarsOutput);
-    myMergeFilter->AddField("VISU_POINTS_MAPPER", aScalarsOutput);
-    
-    myMergeFilter->Update();
-    SetInput(myMergeFilter->GetOutput());
   }else{
-    if(myScalars != NULL){
-      if(VISU_ScalarMapPL* aScalarMap = dynamic_cast<VISU_ScalarMapPL*>(this->GetScalars()))
-       SetInput(aScalarMap->GetInput());
-    }
+    VISU::TVTKOutput* aScalarsOutput = myFieldTransform->GetUnstructuredGridOutput();
+    myAppendFilter->AddInput(aScalarsOutput);
   }
 }
+
+void
+VISU_PrsMergerPL
+::Update()
+{
+  Superclass::Update();
+
+  UpdateGeometry();
+  //{
+  //  std::string aFileName = std::string(getenv("HOME"))+"/"+getenv("USER")+"-aScalarsOutput.vtk";
+  //  VISU::WriteToFile(myFieldTransform->GetUnstructuredGridOutput(), aFileName);
+  //}
+  //{
+  //  std::string aFileName = std::string(getenv("HOME"))+"/"+getenv("USER")+"-aGeomDataSet.vtk";
+  //  VISU::WriteToFile(myAppendFilter->GetOutput(), aFileName);
+  //}
+  //{
+  //  std::string aFileName = std::string(getenv("HOME"))+"/"+getenv("USER")+"-myMergeFilter.vtk";
+  //  VISU::WriteToFile(myMergeFilter->GetOutput(), aFileName);
+  //}
+}
+
+VISU_ScalarMapPL::TInsertCustomPL* 
+VISU_PrsMergerPL
+::InsertCustomPL()
+{
+  return GetMergedInput();
+}
+
+vtkPointSet* 
+VISU_PrsMergerPL
+::GetMergedInput()
+{
+  if(myMergeFilter->GetInput())
+    myMergeFilter->Update();
+  return myMergeFilter->GetOutput();
+}
+
+void
+VISU_PrsMergerPL
+::SetInitialRange()
+{
+  myMapper->UseLookupTableScalarRangeOff();
+}
+
+bool
+VISU_PrsMergerPL
+::checkGeometry(const VISU_PipeLine* thePipeLine)
+{
+  const VISU::PIDMapper& aMapper  = thePipeLine->GetIDMapper();
+  int aNbPoints = aMapper->GetVTKOutput()->GetNumberOfPoints();
+  if(aNbPoints < 1)
+    return false;
+  return true;
+}
index a89567162cc30973db1458078a78c4035b43f384..443ccf8bc6d59d0c17f791e5c564cd9bc6252838 100644 (file)
@@ -35,8 +35,6 @@ class VISU_MergeFilter;
 
 class VISU_PrsMergerPL : public VISU_ScalarMapPL
 {
-  typedef VISU_ScalarMapPL TSupperClass;
-
 protected:
   VISU_PrsMergerPL();
   VISU_PrsMergerPL(const VISU_PrsMergerPL&);
@@ -49,7 +47,7 @@ public:
   typedef TVTKSmartPtr<VISU_PipeLine> TPipeLine;
   typedef std::vector<TPipeLine> TPipeLines;
   
-  vtkTypeMacro(VISU_PrsMergerPL,TSupperClass);
+  vtkTypeMacro(VISU_PrsMergerPL, VISU_ScalarMapPL);
   
   static
   VISU_PrsMergerPL*
@@ -59,6 +57,30 @@ public:
   void
   ShallowCopy(VISU_PipeLine *thePipeLine);
 
+  virtual
+  vtkIdType
+  GetNodeObjID(vtkIdType theID);
+
+  virtual
+  vtkIdType
+  GetNodeVTKID(vtkIdType theID);
+
+  virtual
+  vtkFloatingPointType* 
+  GetNodeCoord(vtkIdType theObjID);
+
+  virtual
+  vtkIdType
+  GetElemObjID(vtkIdType theID);
+
+  virtual
+  vtkIdType
+  GetElemVTKID(vtkIdType theID);
+
+  virtual
+  vtkCell*
+  GetElemCell(vtkIdType theObjID);
+
   /*!
    * Add geometry of presentation to myMeshGeometryList.
    * \params theGeometry - visu pipeline with geometry.
@@ -67,7 +89,7 @@ public:
    */
   virtual
   bool
-  SetGeometry(VISU_PipeLine* theGeometry,bool theUpdate=true);
+  SetGeometry(VISU_PipeLine* theGeometry);
 
   /*!
    * Add geometry to back of myMeshGeometryList.
@@ -78,7 +100,7 @@ public:
    */
   virtual
   int
-  AddBackGeometry(VISU_PipeLine* theGeometry,bool theUpdate=true);
+  AddBackGeometry(VISU_PipeLine* theGeometry);
 
   /*!
    * Get geometry id of myMeshGeometryList.
@@ -120,31 +142,10 @@ public:
   int
   GetNbGeometry();
 
-  /*!
-   * Sets scalar values and ids by VISU_ScalarMapPL object.
-   * \params theInput - visu pipeline with scalar values
-   * \params theUpdate - update pipeline if true.
-   * \retval TRUE - if scalars and geometry on the common mesh, esle FALSE.
-   */
-  virtual
-  bool
-  SetScalars(VISU_PipeLine* theInput,bool theUpdate=false);
-  
-  /*!
-   * Gets input VISU_ScalarMapPL, which contain scalar values and ids.
-   */
-  virtual
-  VISU_PipeLine*
-  GetScalars();
-  
-  virtual
-  void
-  Init();
-
   virtual
   void
   Build();
-  
+
   /*!
    * Calculate presentation, by merging of Geometry and Scalar Values.
    */
@@ -158,15 +159,17 @@ public:
   void SetInitialRange();
 
 protected:
-  TPipeLines myMeshGeometryList;
-  vtkSmartPointer<VISU_AppendFilter> myAppendFilter;
-  vtkSmartPointer<VISU_MergeFilter> myMergeFilter;
-  
-  vtkFloatingPointType* myScalarRanges;
-  TPipeLine myScalars;
+  virtual
+  TInsertCustomPL* 
+  InsertCustomPL();
+
+  virtual
+  vtkPointSet* 
+  GetMergedInput();
+
+  void
+  UpdateGeometry();
 
-private:
-  
   /*!
    * Check if thePipeLine and "first element of list myMeshGeometryList" or 
    * "myScalars", has
@@ -176,17 +179,9 @@ private:
   bool
   checkGeometry(const VISU_PipeLine* thePipeLine);
 
-  
-  /*!
-   * Check if thePipeLine and first element of list myMeshGeometryList, has
-   * common DataPoints (simple check number of points).
-   * \retval TRUE - if has common points, esle FALSE.
-   */
-  bool
-  checkScalars(const VISU_PipeLine* thePipeLine);
-
-  void
-  Execute();
+  TPipeLines myMeshGeometryList;
+  vtkSmartPointer<VISU_AppendFilter> myAppendFilter;
+  vtkSmartPointer<VISU_MergeFilter> myMergeFilter;  
 };
 
 #endif
index 1a0e3e4bba196f3aff49a66876fae4217e161135..9ca1f7b69872a91bc92dcbaa3e30b182e952730f 100644 (file)
@@ -26,6 +26,8 @@
 
 #include "VISU_ScalarMapOnDeformedShapePL.hxx"
 #include "VISU_DeformedShapePL.hxx"
+
+#include "VISU_CellDataToPointData.hxx"
 #include "VISU_MergeFilter.hxx"
 
 #include "VISU_PipeLineUtils.hxx"
@@ -34,7 +36,6 @@
 
 #include <vtkWarpVector.h>
 #include <vtkUnstructuredGrid.h>
-#include <vtkCellDataToPointData.h>
 #include <vtkPointDataToCellData.h>
 
 #include "VISU_Convertor.hxx"
@@ -53,10 +54,16 @@ vtkStandardNewMacro(VISU_ScalarMapOnDeformedShapePL)
 VISU_ScalarMapOnDeformedShapePL
 ::VISU_ScalarMapOnDeformedShapePL()
 {
-  myDeformVectors = vtkWarpVector::New();
-  myMergeFilter   = VISU_MergeFilter::New();
+  myWarpVector = vtkWarpVector::New();
+
+  myMergeScalarsFilter = VISU_MergeFilter::New();
+  myMergeScalarsFilter->SetMergingInputs(true);
+
   myExtractorScalars = VISU_Extractor::New();
-  myCellDataToPointData = vtkCellDataToPointData::New();
+
+  myCellDataToPointData = VISU_CellDataToPointData::New();
+
+  myScalars = myMergeFilter->GetOutput();
 }
 
 /*!
@@ -66,11 +73,11 @@ VISU_ScalarMapOnDeformedShapePL
 VISU_ScalarMapOnDeformedShapePL
 ::~VISU_ScalarMapOnDeformedShapePL()
 {
-  myDeformVectors->UnRegisterAllOutputs();
-  myDeformVectors->Delete();
+  myWarpVector->UnRegisterAllOutputs();
+  myWarpVector->Delete();
 
-  myMergeFilter->UnRegisterAllOutputs();
-  myMergeFilter->Delete();
+  myMergeScalarsFilter->UnRegisterAllOutputs();
+  myMergeScalarsFilter->Delete();
   
   myExtractorScalars->UnRegisterAllOutputs();
   myExtractorScalars->Delete();
@@ -79,91 +86,104 @@ VISU_ScalarMapOnDeformedShapePL
   myCellDataToPointData->Delete();
 }
 
-/*!
- * Initial method
- */
+//=======================================================================
 void
 VISU_ScalarMapOnDeformedShapePL
-::Init()
+::Build()
 {
-  if (GetScalarsUnstructuredGrid() == NULL) SetScalars(GetInput2());
-  
-  Superclass::Init();
-  
-  vtkFloatingPointType aScalarRange[2];
-  GetSourceRange(aScalarRange);
-  static double EPS = 1.0 / VTK_LARGE_FLOAT;
-  if(aScalarRange[1] > EPS)
-    SetScale(VISU_DeformedShapePL::GetScaleFactor(GetInput2())/aScalarRange[1]);
-  else
-    SetScale(0.0);
+  Superclass::Build();
 
-  myMapper->SetColorModeToMapScalars();
-  myMapper->ScalarVisibilityOn();
+  VISU::CellDataToPoint(myWarpVector,
+                       myCellDataToPointData,
+                       GetMergedInput());
+  
+  // Sets geometry for merge filter
+  myMergeScalarsFilter->SetGeometry(myWarpVector->GetUnstructuredGridOutput());
 
-  // Sets input for field transformation filter
-  myFieldTransform->SetInput(myExtractor->GetOutput());
+  UpdateScalars();
 
+  vtkDataSet* aScalarsDataSet = myExtractorScalars->GetOutput();
+  myMergeScalarsFilter->SetScalars(aScalarsDataSet);
+  myMergeScalarsFilter->AddField("VISU_CELLS_MAPPER", aScalarsDataSet);
+  myMergeScalarsFilter->AddField("VISU_POINTS_MAPPER", aScalarsDataSet);
 }
 
-/*!
- * Build method
- * Building of deformation and puts result to merge filter.
- */
+//=======================================================================
 void
 VISU_ScalarMapOnDeformedShapePL
-::Build()
+::UpdateScalars()
 {
-  // Set input for extractor
-  myExtractor->SetInput(GetInput2());
-  
-  VISU::CellDataToPoint(myDeformVectors,myCellDataToPointData,
-                       GetInput2(),myFieldTransform);
-  
-  // Sets geometry for merge filter
-  myMergeFilter->SetGeometry(myDeformVectors->GetUnstructuredGridOutput());
-  myMergeFilter->SetScalars(myExtractorScalars->GetOutput());
-  myMergeFilter->AddField("VISU_CELLS_MAPPER", myExtractorScalars->GetOutput());
-  myMergeFilter->Update();
+  vtkPointSet* aScalars = GetScalars();
+  vtkCellData *aInCellData = GetInput()->GetCellData();
+
+  if(aScalars->GetPointData()->GetScalars())
+    myExtractorScalars->SetInput(aScalars);
+  else if(aScalars->GetCellData()->GetScalars() &&
+         !aInCellData->GetAttribute(vtkDataSetAttributes::VECTORS)){
+    //Approximate cell data values to point data by VISU_CellDataToPointData filter.
+    VISU_CellDataToPointData* aCellDataToPointData = VISU_CellDataToPointData::New();
+    aCellDataToPointData->SetInput(aScalars);
+    aCellDataToPointData->Update();
+    myExtractorScalars->SetInput(aCellDataToPointData->GetUnstructuredGridOutput());
+    aCellDataToPointData->Delete();
+  } else {
+    myExtractorScalars->SetInput(aScalars);
+  }
+}
+
 
-  // Sets data to mapper
-  myMapper->SetInput(myMergeFilter->GetOutput());
+//=======================================================================
+VISU_ScalarMapPL::TInsertCustomPL* 
+VISU_ScalarMapOnDeformedShapePL
+::InsertCustomPL()
+{
+  myMapper->SetColorModeToMapScalars();
+  myMapper->ScalarVisibilityOn();
+
+  return myMergeScalarsFilter->GetOutput();
 }
 
-/*!
- *  Update method
- */
 void
 VISU_ScalarMapOnDeformedShapePL
 ::Update()
 {
-  this->UpdateScalars();
-  
-  vtkFloatingPointType* aRange = GetScalarRange();
-  vtkFloatingPointType aScalarRange[2] = {aRange[0], aRange[1]};
-  
-  if(myBarTable->GetScale() == VTK_SCALE_LOG10)
-    VISU_LookupTable::ComputeLogRange(aRange,aScalarRange);
-  myMapperTable->SetRange(aScalarRange);
-
-  myMapperTable->Build();
-  myBarTable->Build();
+  Superclass::Update();
 
-  myMapper->SetLookupTable(myMapperTable);
-  myMapper->SetScalarRange(aScalarRange);
-  
-  VISU_PipeLine::Update();
+  UpdateScalars();
+  //{
+  //  std::string aFileName = std::string(getenv("HOME"))+"/"+getenv("USER")+"-aScalarsOutput2.vtk";
+  //  VISU::WriteToFile(myExtractorScalars->GetUnstructuredGridOutput(), aFileName);
+  //}
+  //{
+  //  std::string aFileName = std::string(getenv("HOME"))+"/"+getenv("USER")+"-aGeomDataSet2.vtk";
+  //  VISU::WriteToFile(myWarpVector->GetUnstructuredGridOutput(), aFileName);
+  //}
+  //{
+  //  std::string aFileName = std::string(getenv("HOME"))+"/"+getenv("USER")+"-myMergeFilter2.vtk";
+  //  VISU::WriteToFile(myMergeScalarsFilter->GetOutput(), aFileName);
+  //}
 }
 
 /*!
- * Update scalars method.
- * Put scalars to merge filter.
+ * Initial method
  */
 void
 VISU_ScalarMapOnDeformedShapePL
-::UpdateScalars()
+::Init()
 {
-  myExtractorScalars->Update();
+  Superclass::Init();
+  
+  vtkFloatingPointType aScalarRange[2];
+  GetSourceRange(aScalarRange);
+
+  vtkDataSet* aDataSet = GetMergedInput();
+  vtkFloatingPointType aScaleFactor = VISU_DeformedShapePL::GetScaleFactor( aDataSet );
+
+  static double EPS = 1.0 / VTK_LARGE_FLOAT;
+  if(fabs(aScalarRange[1]) > EPS)
+    SetScale(aScaleFactor / aScalarRange[1]);
+  else
+    SetScale(0.0);
 }
 
 /*!
@@ -177,7 +197,7 @@ VISU_ScalarMapOnDeformedShapePL
   VISU_ScalarMapOnDeformedShapePL *aPipeLine = dynamic_cast<VISU_ScalarMapOnDeformedShapePL*>(thePipeLine);
   if(aPipeLine){
      SetScale(aPipeLine->GetScale());
-     SetScalars(aPipeLine->GetScalarsUnstructuredGrid());
+     SetScalars(aPipeLine->GetScalars());
   }
   Superclass::ShallowCopy(thePipeLine);
 }
@@ -191,34 +211,14 @@ VISU_ScalarMapOnDeformedShapePL
 ::SetScalars(vtkDataSet *theScalars)
 {
   myScalars = theScalars;
-  vtkUnstructuredGrid* aScalars = GetScalarsUnstructuredGrid();
-  vtkCellData *aInCellData = GetInput()->GetCellData();
-
-  std::string aFileName = std::string(getenv("HOME"))+"/"+getenv("USER")+"-SetScalars.vtk";
-  VISU::WriteToFile(aScalars, aFileName);
-  if(aScalars->GetPointData()->GetScalars())
-    myExtractorScalars->SetInput(aScalars);
-  else if(aScalars->GetCellData()->GetScalars() &&
-         !aInCellData->GetAttribute(vtkDataSetAttributes::VECTORS)){
-    //Approximate cell data values to point data by vtkCellDataToPointData filter.
-    vtkCellDataToPointData* aCellDataToPointData = vtkCellDataToPointData::New();
-    aCellDataToPointData->SetInput(aScalars);
-    aCellDataToPointData->Update();
-    myExtractorScalars->SetInput(aCellDataToPointData->GetUnstructuredGridOutput());
-    aCellDataToPointData->Delete();
-  } else {
-    myExtractorScalars->SetInput(aScalars);
-  }
-  Update();
-  Modified();
 }
 
 /*!
  * Get pointer to input scalars.
  */
-vtkUnstructuredGrid
+vtkPointSet
 VISU_ScalarMapOnDeformedShapePL
-::GetScalarsUnstructuredGrid()
+::GetScalars()
 {
   return myScalars.GetPointer();
 }
@@ -232,7 +232,7 @@ VISU_ScalarMapOnDeformedShapePL
 {
   if(myScaleFactor == theScale) return;
   myScaleFactor = theScale;
-  myDeformVectors->SetScaleFactor(myScaleFactor);
+  myWarpVector->SetScaleFactor(myScaleFactor);
   Modified();
 }
 
@@ -253,8 +253,8 @@ void
 VISU_ScalarMapOnDeformedShapePL
 ::SetMapScale(vtkFloatingPointType theMapScale)
 {
-  TSupperClass::SetMapScale(theMapScale); // enk::added
-  myDeformVectors->SetScaleFactor(myScaleFactor*theMapScale);
+  Superclass::SetMapScale(theMapScale); // enk::added
+  myWarpVector->SetScaleFactor(myScaleFactor*theMapScale);
   Modified();
 }
 
index 6e731ab735e155184aeb070f67a9c147302d5158..686637da89a6a24110e67dcd7eab5e66b38b8718 100644 (file)
 #include "VISU_PrsMergerPL.hxx"
 
 class VISU_MergeFilter;
+class VISU_CellDataToPointData;
+
 class vtkWarpVector;
 class vtkUnstructuredGrid;
-class vtkCellDataToPointData;
-class vtkPointDataToCellData;
 
 class VISU_ScalarMapOnDeformedShapePL : public VISU_PrsMergerPL
 {
-  
-  typedef VISU_PrsMergerPL TSupperClass;
-
 protected:
   VISU_ScalarMapOnDeformedShapePL();
   
@@ -47,7 +44,7 @@ protected:
   
   VISU_ScalarMapOnDeformedShapePL(const VISU_ScalarMapOnDeformedShapePL&);
 public:
-  vtkTypeMacro(VISU_ScalarMapOnDeformedShapePL,VISU_PrsMergerPL);
+  vtkTypeMacro(VISU_ScalarMapOnDeformedShapePL, VISU_PrsMergerPL);
 
   static VISU_ScalarMapOnDeformedShapePL* New();
 
@@ -62,37 +59,41 @@ public:
   virtual void GetSourceRange(vtkFloatingPointType theRange[2]);
 
   virtual void SetScalars(vtkDataSet *theScalars);
-  virtual vtkUnstructuredGrid* GetScalarsUnstructuredGrid();
+  virtual vtkPointSet* GetScalars();
 
 public:
-  //! Redefined method for initialization of the pipeline.
+  //! Redefined method for building of the pipeline.
   virtual
   void
-  Init();
+  Build();
 
-  //! Redefined method for building the pipeline.
+  //! Redefined method for initialization of the pipeline.
   virtual
   void
-  Build();
+  Init();
 
-  //! Redefined method for updating the pipeline.
   virtual
   void
   Update();
 
-  //! Update scalars.
+  virtual
   void
   UpdateScalars();
-  
+
   virtual void SetMapScale(vtkFloatingPointType theMapScale = 1.0);
   
 protected:
+  //! Redefined method for customization of pipeline building
+  virtual
+  TInsertCustomPL*
+  InsertCustomPL();
+
   vtkFloatingPointType myScaleFactor;
-  vtkWarpVector  *myDeformVectors;
-  VISU_MergeFilter *myMergeFilter;
+  vtkWarpVector  *myWarpVector;
+  VISU_MergeFilter *myMergeScalarsFilter;
   vtkSmartPointer<vtkUnstructuredGrid> myScalars;
   VISU_Extractor* myExtractorScalars;
-  vtkCellDataToPointData* myCellDataToPointData;
+  VISU_CellDataToPointData* myCellDataToPointData;
 };
 
 #endif
index 0fa68d13e5fbb0be732175c76d324918ef08ed99..ddf4a6d35519d795119fb0cdeda6b7979d4a8a9e 100644 (file)
@@ -194,13 +194,24 @@ VISU_ScalarMapPL
 
 
 //----------------------------------------------------------------------------
-VISU_ScalarMapPL::THook
+VISU_PipeLine::TInput
 VISU_ScalarMapPL
-::DoHook()
+::GetClippedInput()
+{
+  if(myExtractGeometry->GetInput())
+    myFieldTransform->Update();
+  return myFieldTransform->GetUnstructuredGridOutput();
+}
+
+
+VISU_ScalarMapPL::TInsertCustomPL* 
+VISU_ScalarMapPL
+::InsertCustomPL()
 {
   myMapper->SetColorModeToMapScalars();
   myMapper->ScalarVisibilityOn();
-  return myFieldTransform->GetUnstructuredGridOutput();
+
+  return GetClippedInput();
 }
 
 
@@ -216,7 +227,7 @@ void
 VISU_ScalarMapPL
 ::Build() 
 {
-  myMapper->SetInput(DoHook());
+  myMapper->SetInput(InsertCustomPL());
 }
 
 
index de07ce2a7953a61ebd02466fe26b6ce3bca324de..f989ae1f439b21de570aa209ad5c3bb6cca4efed 100644 (file)
@@ -32,7 +32,7 @@
 #include "VISU_ScalarBarActor.hxx"
 
 class vtkCell;
-class vtkDataSet;
+class vtkPointSet;
 
 class VISU_Extractor;
 class VISU_FieldTransform;
@@ -140,8 +140,15 @@ public:
 
   //----------------------------------------------------------------------------
 protected:
-  typedef vtkDataSet THook;
-  virtual THook* DoHook();
+  typedef vtkPointSet TInsertCustomPL;
+
+  virtual
+  TInsertCustomPL* 
+  InsertCustomPL();
+
+  virtual 
+  TInput* 
+  GetClippedInput();
 
   VISU_LookupTable* myMapperTable;
   VISU_LookupTable* myBarTable;
index c9cdc8eded1c9489320a474a4e98c0909ce7f7dc..65d48171b143ade37e6e44ad47ff203ed827b70f 100644 (file)
@@ -165,7 +165,7 @@ VISU_StreamLinesPL
            int theDirection,
            int isOnlyTry)
 {
-  vtkPointSet* aDataSet = theSource? theSource: myFieldTransform->GetUnstructuredGridOutput();
+  vtkPointSet* aDataSet = theSource? theSource: GetMergedInput();
   aDataSet->Update();
   vtkIdType aNbOfPoints = aDataSet->GetNumberOfPoints();
   vtkPointSet* aPointSet = myExtractor->GetOutput();
@@ -177,7 +177,7 @@ VISU_StreamLinesPL
   if((!isOnlyTry && isAccepted) || (isOnlyTry && isAccepted == 1)){
     mySource = theSource;
     myPercents = thePercents;
-    if(VISU::IsDataOnCells(GetInput2())){
+    if(VISU::IsDataOnCells(GetMergedInput())){
       myCenters->SetInput(aDataSet);
       myCenters->VertexCellsOn();
       aDataSet = myCenters->GetOutput();
@@ -327,7 +327,8 @@ vtkFloatingPointType
 VISU_StreamLinesPL
 ::GetMaxIntegrationStep(vtkPointSet* theDataSet) 
 {
-  if(!theDataSet) return -1.0;
+  if(!theDataSet)
+    return -1.0;
   theDataSet->Update();
   vtkFloatingPointType aLength = theDataSet->GetLength();
   vtkFloatingPointType* aBounds = theDataSet->GetBounds();
@@ -425,7 +426,8 @@ vtkFloatingPointType
 VISU_StreamLinesPL
 ::GetBasePropagationTime(vtkPointSet* theDataSet)
 {
-  if(!theDataSet) return -1.0;
+  if(!theDataSet)
+    return -1.0;
   theDataSet->Update();
   vtkFloatingPointType aPropagationTime = theDataSet->GetLength()/GetVelocityCoeff(theDataSet);
   return aPropagationTime;
@@ -495,28 +497,41 @@ VISU_StreamLinesPL
 }
 
 
+void
+VISU_StreamLinesPL
+::Build()
+{
+  Superclass::Build();
+
+  VISU::CellDataToPoint(myStream,
+                       myCellDataToPointData,
+                       GetMergedInput());
+
+  vtkFloatingPointType aBounds[6];
+  GetMergedInput()->GetBounds(aBounds);
+
+  myGeomFilter->SetExtent(aBounds);
+  myGeomFilter->ExtentClippingOn();
+  myGeomFilter->SetInput(myStream->GetOutput());
+}
+
 void
 VISU_StreamLinesPL
 ::Init()
 {
   Superclass::Init();
-  vtkPointSet* aDataSet = myExtractor->GetOutput();
+
+  vtkPointSet* aDataSet = GetMergedInput();
   vtkFloatingPointType anIntStep = GetBaseIntegrationStep(aDataSet);
   vtkFloatingPointType aPropagationTime = GetBasePropagationTime(aDataSet);
   vtkFloatingPointType aStepLength = GetBaseStepLength(aDataSet);
   SetParams(anIntStep,aPropagationTime,aStepLength);
 }
 
-VISU_ScalarMapPL::THook
+VISU_ScalarMapPL::TInsertCustomPL
 VISU_StreamLinesPL
-::DoHook()
+::InsertCustomPL()
 {
-  GetInput2()->Update();
-  VISU::CellDataToPoint(myStream,myCellDataToPointData,GetInput2(),myFieldTransform);
-  vtkFloatingPointType *aBounds = GetInput2()->GetBounds();
-  myGeomFilter->SetExtent(aBounds);
-  myGeomFilter->ExtentClippingOn();
-  myGeomFilter->SetInput(myStream->GetOutput());
   return myGeomFilter->GetOutput();
 }
 
index 7c020dac23dda544bef424e12aa004051b156cb1..ed1bf9b28354afef893aef8469c95278501c479f 100644 (file)
@@ -129,8 +129,12 @@ public:
 
 public:
   virtual
-  THook* 
-  DoHook();
+  TInsertCustomPL* 
+  InsertCustomPL();
+
+  virtual
+  void
+  Build();
 
   virtual
   void
index 3fa4bd6654f27e2da0eabc70a57075e9111950a6..d772d9bda48b799d1df2b3b2ea7d3fe4380d0c75 100644 (file)
@@ -142,21 +142,33 @@ VISU_VectorsPL
 }
 
 
-VISU_ScalarMapPL::THook* 
+void
 VISU_VectorsPL
-::DoHook()
+::Build()
 {
-  VISU::ToCellCenters(myBaseGlyph,myCenters,GetInput2(),myFieldTransform);
+  Superclass::Build();
+
+  VISU::ToCellCenters(myBaseGlyph,
+                     myCenters,
+                     GetMergedInput());
   myBaseGlyph->SetVectorModeToUseVector();
   myBaseGlyph->SetScaleModeToScaleByVector();
   myBaseGlyph->SetColorModeToColorByScalar();
 
-  VISU::ToCellCenters(myTransformFilter,myCenters,GetInput2(),myFieldTransform);
+  VISU::ToCellCenters(myTransformFilter,
+                     myCenters,
+                     GetMergedInput());
   myTransformedGlyph->SetInput(myTransformFilter->GetOutput());
   myTransformedGlyph->SetVectorModeToUseVector();
   myTransformedGlyph->SetScaleModeToScaleByVector();
   myTransformedGlyph->SetColorModeToColorByScalar();
+}
 
+
+VISU_ScalarMapPL::TInsertCustomPL* 
+VISU_VectorsPL
+::InsertCustomPL()
+{
   return myTransformedGlyph->GetOutput();
 }
 
index fd83f0225301df8a8efbc4b77854eb95e12bb8c5..5245650fab340de76219d374ea6983c505abfd11 100644 (file)
@@ -104,6 +104,10 @@ public:
   void
   Init();
 
+  virtual
+  void
+  Build();
+
   virtual
   void
   Update();
@@ -125,8 +129,8 @@ public:
 
 protected:
   virtual
-  THook
-  DoHook();
+  TInsertCustomPL
+  InsertCustomPL();
 
   GlyphType myTypeGlyph;
   GlyphPos myPosGlyph;
index d67f4bcc22c8372d4a03f078258a206c2ed00506..29b645ce45b65181107cf1f31f78839ab2e1fac0 100644 (file)
@@ -494,9 +494,7 @@ void VisuGUI_SelectionDlg::onSelectionEvent() {
            int aVTKID = anVISUActor->GetElemVTKID(anID);
             if (aCell != NULL) {
               int aNbOfPoints = aCell->GetNumberOfPoints();
-              if ( aNbOfPoints <= 1 ) { // Cell is point
-                clearFields();
-              } else {
+              if ( aNbOfPoints > 0 ) {
                 myCellIDValLbl->setText( QString::number(anID) );
                 myCellScalarValLbl->setText(getValue(aCellData, aVTKID));
                 myCellVectorValLbl->setText(getVector(aCellData, aVTKID));
@@ -550,6 +548,8 @@ void VisuGUI_SelectionDlg::onSelectionEvent() {
         myListPoints->setText(i, 7, getValue(aPntData, id));
         myListPoints->setText(i, 8, getVector(aPntData, id));
       }
+      for(int aColumnId = 0; aColumnId < 9; aColumnId++)
+       myListPoints->adjustColumn(aColumnId);
     }
   } else {
     clearFields();
@@ -569,12 +569,10 @@ void VisuGUI_SelectionDlg::clearFields() {
     myIValLbl->setText( "-" );//ENK: 23.11.2006 - PAL13176
     myJValLbl->setText( "-" );//ENK: 23.11.2006 - PAL13176
     myKValLbl->setText( "-" );//ENK: 23.11.2006 - PAL13176
-    myIDValLbl->setText( "" );
     myScalarValLbl->setText("");
     myVectorValLbl->setText("");
     break;
   case 1:
-    myCellIDValLbl->setText( "" );
     myCellScalarValLbl->setText("");
     myCellVectorValLbl->setText("");
     myListPoints->setNumRows(0);
@@ -589,10 +587,10 @@ void VisuGUI_SelectionDlg::clearFields() {
   }
 }
 
-typedef  vtkIdType (vtkDataSet::* TDataSetMethod)();
+typedef  vtkIdType (VISU_PipeLine::* TGetVTKIdMethod)(vtkIdType theID);
 
 bool onIdEdit (const QString& theText,
-               TDataSetMethod theMethod,
+               TGetVTKIdMethod theMethod,
                bool theIsCell,
               const SalomeApp_Module* theModule,
                LightApp_SelectionMgr* theSelectionMgr,
@@ -634,14 +632,14 @@ bool onIdEdit (const QString& theText,
   }
 
   if (aPrs3d) {
-    int anId = theText.toInt();
-    vtkDataSet* aDataSet = aPrs3d->GetPL()->GetMapper()->GetInput();
-    int aMaxId = (aDataSet->*theMethod)();
-    if (anId < 0) anId = 0;
-    if (anId >= aMaxId) anId = aMaxId - 1;
+    int anObjId = theText.toInt();
+    VISU_PipeLine* aPipeLine = aPrs3d->GetPL();
+    int aVTKId = (aPipeLine->*theMethod)(anObjId);
+    if(aVTKId < 0)
+      return false;
 
     TColStd_MapOfInteger newIndices;
-    newIndices.Add(anId);
+    newIndices.Add(anObjId);
     aSelector->AddOrRemoveIndex(anIO, newIndices, false);
     aViewWindow->highlight(anIO, true, true);
 
@@ -657,9 +655,14 @@ bool onIdEdit (const QString& theText,
 void VisuGUI_SelectionDlg::onPointIdEdit (const QString& theText)
 {
   if (myFl) return;
-  TDataSetMethod aMethod = &vtkDataSet::GetNumberOfPoints;
-  bool anIsSelected = onIdEdit(theText,aMethod,false,myModule,mySelectionMgr,
-                              myMeshName,tr("WRN_NO_AVAILABLE_DATA"),
+  TGetVTKIdMethod aMethod = &VISU_PipeLine::GetNodeVTKID;
+  bool anIsSelected = onIdEdit(theText,
+                              aMethod,
+                              false,
+                              myModule,
+                              mySelectionMgr,
+                              myMeshName,
+                              tr("WRN_NO_AVAILABLE_DATA"),
                               myFieldName);
   if (anIsSelected)
     // as selection manager doesn't send signal currentSelectionChanged()
@@ -671,9 +674,14 @@ void VisuGUI_SelectionDlg::onPointIdEdit (const QString& theText)
 void VisuGUI_SelectionDlg::onCellIdEdit (const QString& theText)
 {
   if (myFl) return;
-  TDataSetMethod aMethod = &vtkDataSet::GetNumberOfCells;
-  bool anIsSelected = onIdEdit(theText,aMethod,true,myModule,mySelectionMgr,
-                              myMeshName,tr("WRN_NO_AVAILABLE_DATA"),
+  TGetVTKIdMethod aMethod = &VISU_PipeLine::GetElemVTKID;
+  bool anIsSelected = onIdEdit(theText,
+                              aMethod,
+                              true,
+                              myModule,
+                              mySelectionMgr,
+                              myMeshName,
+                              tr("WRN_NO_AVAILABLE_DATA"),
                               myFieldName);
   if (anIsSelected)
     // as selection manager doesn't send signal currentSelectionChanged()
index 6b88d23c4788cecf0b68f5cef8a181cc21f042b4..279e186b6f9702c33223f92127bf13719ad6f82f 100644 (file)
@@ -572,6 +572,7 @@ VISU::GaussPoints_i
   try{
     TSuperClass::CreateActor(theActor,theIO);
     theActor->GetPipeLine()->Delete();
+    theActor->SetVTKMapping(true);
     UpdateActor(theActor);
     return true;
   }catch(...){
index 9591257b3ae904ea4f3ae54d6f185d67ffd68c1a..74a41aef4a8572308f09ebca2fca010a16265e83 100644 (file)
@@ -89,8 +89,7 @@ PrsMerger_i(Result_i* theResult,
   Prs3d_i(theResult,theAddToStudy),
   ColoredPrs3d_i(theResult,theAddToStudy),
   ScalarMap_i(theResult,theAddToStudy),
-  myPrsMergerPL(NULL),
-  myScalarsPL(VISU_ScalarMapPL::New())
+  myPrsMergerPL(NULL)
 {
 }
 
@@ -101,8 +100,7 @@ PrsMerger_i(Result_i* theResult,
   Prs3d_i(theResult,theSObject),
   ColoredPrs3d_i(theResult,theSObject),
   ScalarMap_i(theResult,theSObject),
-  myPrsMergerPL(NULL),
-  myScalarsPL(VISU_ScalarMapPL::New())
+  myPrsMergerPL(NULL)
 {
 }
 
@@ -313,7 +311,7 @@ AddMeshOnGroup(const char* theMeshName,
     VISU_MeshPL* aTmpMesh = VISU_MeshPL::New();
     aTmpMesh->SetIDMapper(anIDMapper);
     
-    aRetVal = myPrsMergerPL->AddBackGeometry(aTmpMesh,false);
+    aRetVal = myPrsMergerPL->AddBackGeometry(aTmpMesh);
     
     if(aRetVal >-1 ){
       myMeshPLList.push_back(aTmpMesh);
@@ -387,22 +385,12 @@ SetScalarMap(const char* theMeshName,
   myEntity    = (VISU::TEntity)theEntity;
   myFieldName = theFieldName;
   myIteration = theStampsNum;
-
-  myScalarsPL->SetIDMapper(anIDMapper);
-  myPrsMergerPL->SetScalars(myScalarsPL);
 }
 
 void
 VISU::PrsMerger_i::
 SetScalarMap(VISU_PipeLine* thePipeLine)
-{
-  if (MYDEBUG) MESSAGE("VISU::PrsMerger_i::SetScalarMap");
-  VISU_ScalarMapPL* aInputScalars = dynamic_cast<VISU_ScalarMapPL*>(thePipeLine);
-  VISU::PIDMapper anIDMapper = aInputScalars->GetIDMapper();
-  myScalarsPL->SetIDMapper(anIDMapper);
-  if(aInputScalars)
-    myPrsMergerPL->SetScalars(myScalarsPL);
-}
+{}
 
 void
 VISU::PrsMerger_i::
@@ -533,46 +521,7 @@ bool
 VISU::PrsMerger_i
 ::CheckGroup(const char* theGroupName)
 {
-  if (MYDEBUG) MESSAGE("PrsMerger_i::CheckGroup :|"<<theGroupName<<"|");
-  if(myEntity == NODE_ENTITY)
-    return true;
-  string aMeshName  = myMeshName;
-  string aGroupName = theGroupName;
-  
-  VISU::PIDMapper anIDMapper;
-  anIDMapper = myResult->GetInput()->GetMeshOnGroup(aMeshName,theGroupName);
-  if (MYDEBUG) MESSAGE("anIDMapper="<<anIDMapper);
-  if(!anIDMapper) return false;
-  
-  bool aAllPoints = true;
-  int aNbCellsInGeom     = anIDMapper->GetVTKOutput()->GetNumberOfCells();
-  if(aNbCellsInGeom>0){
-    int aVtkCellType = anIDMapper->GetVTKOutput()->GetCellType(0);
-    if (MYDEBUG) MESSAGE("CellType="<<aVtkCellType);
-    switch(myEntity){
-    case CELL_ENTITY:
-      if(aVtkCellType != VTK_LINE &&
-        aVtkCellType != VTK_POLY_LINE && 
-        aVtkCellType != VTK_VERTEX &&
-        aVtkCellType != VTK_PIXEL)
-       aAllPoints = false;
-      break;
-    case EDGE_ENTITY:
-      if(aVtkCellType == VTK_LINE ||
-        aVtkCellType == VTK_POLY_LINE)
-       aAllPoints = false;
-      break;
-    case FACE_ENTITY:
-      if(aVtkCellType == VTK_TRIANGLE ||
-        aVtkCellType == VTK_TRIANGLE_STRIP ||
-        aVtkCellType == VTK_POLYGON ||
-        aVtkCellType == VTK_QUAD)
-       aAllPoints = false;
-      break;
-    }
-  }
-
-  if (MYDEBUG) MESSAGE("return="<<!aAllPoints);
-  return (!aAllPoints);
+  // Always true, there is no restrictions
+  return true;
 }
 
index bd715b8bc389f17250c03207216ff8c175e8d87c..59cf5cf6c14e09cba887c92bb813bbb53749278c 100644 (file)
@@ -85,7 +85,6 @@ namespace VISU{
     
     VISU_PrsMergerPL* myPrsMergerPL;
     VISU_PrsMergerPL::TPipeLines  myMeshPLList;
-    VISU_ScalarMapPL* myScalarsPL;
     
     SALOMEDS::Color myColor;
     bool myIsColored;
index 27e98bc2bcb4f2a16b0e11d5f96c7543168a4356..ba0475908716a9aac98b1b008c88887a82df71c6 100644 (file)
@@ -286,13 +286,13 @@ VISU::ScalarMap_i
     throw std::runtime_error("There is no TimeStamp with the parameters !!!");
 
   myScalarMapPL->SetIDMapper(anIDMapper);
+  myScalarMapPL->Build();
   // mkr : 23.11.2006 - PAL13908 - save animation range if range is fixed -->
   if ( myIsFixedRange )
     myScalarMapPL->SetScalarMode(0);
   else
     myScalarMapPL->Init();
   // mkr : 23.11.2006 <--
-  myScalarMapPL->Build();
 }
 
 void