]> SALOME platform Git repositories - modules/visu.git/commitdiff
Salome HOME
Adjust to last modifications in the V3_2_0_maintainance CVS branch
authorapo <apo@opencascade.com>
Wed, 16 May 2007 11:37:07 +0000 (11:37 +0000)
committerapo <apo@opencascade.com>
Wed, 16 May 2007 11:37:07 +0000 (11:37 +0000)
40 files changed:
src/CONVERTOR/VISU_AppendFilter.cxx
src/CONVERTOR/VISU_AppendFilterUtilities.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_MergeFilterUtilities.cxx
src/CONVERTOR/VISU_PointCoords.cxx
src/OBJECT/VISU_Actor.cxx
src/OBJECT/VISU_GaussPtsAct.cxx
src/PIPELINE/VISUPipeLine.cxx
src/PIPELINE/VISU_ColoredPL.cxx
src/PIPELINE/VISU_ColoredPL.hxx
src/PIPELINE/VISU_CutLinesPL.cxx
src/PIPELINE/VISU_CutPlanesPL.cxx
src/PIPELINE/VISU_DataSetMapperHolder.cxx
src/PIPELINE/VISU_DataSetMapperHolder.hxx
src/PIPELINE/VISU_DeformedShapePL.cxx
src/PIPELINE/VISU_DeformedShapePL.hxx
src/PIPELINE/VISU_Extractor.cxx
src/PIPELINE/VISU_FieldTransform.cxx
src/PIPELINE/VISU_GaussPointsPL.cxx
src/PIPELINE/VISU_IsoSurfacesPL.cxx
src/PIPELINE/VISU_IsoSurfacesPL.hxx
src/PIPELINE/VISU_MapperHolder.cxx
src/PIPELINE/VISU_MapperHolder.hxx
src/PIPELINE/VISU_PipeLineUtils.hxx
src/PIPELINE/VISU_Plot3DPL.cxx
src/PIPELINE/VISU_PolyDataMapperHolder.cxx
src/PIPELINE/VISU_PolyDataMapperHolder.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/VISU_msg_en.po
src/VISUGUI/VisuGUI_Selection.cxx

index 7f7f6e37d46bac76cc4c5ecd6333b69dbea00b22..7207f68b6cfae39e6c5fbbb66c3d9277e81b1da2 100644 (file)
@@ -55,12 +55,14 @@ VISU_AppendFilter
              vtkInformationVector **theInputVector,
              vtkInformationVector *theOutputVector)
 {
-  bool anIsExecuted = VISU::UnstructuredGridRequestData(theInputVector,
-                                                       this->GetNumberOfInputConnections(0),
-                                                       theOutputVector,
-                                                       GetSharedPointSet(),
-                                                       IsMergingInputs(),
-                                                       IsMappingInputs());
+  bool anIsExecuted = false;
+  if(GetNumberOfInputConnections(0) > 1)
+    anIsExecuted = VISU::UnstructuredGridRequestData(theInputVector,
+                                                    this->GetNumberOfInputConnections(0),
+                                                    theOutputVector,
+                                                    GetSharedPointSet(),
+                                                    IsMergingInputs(),
+                                                    IsMappingInputs());
   if(!anIsExecuted)
     anIsExecuted = Superclass::RequestData(theRequest,
                                           theInputVector,
index b739788ea8f994fafd7ca79e2b380dce0dc88de8..18b585713410805b1ebb66fdfca80056d399a5b1 100644 (file)
@@ -57,7 +57,7 @@ namespace
   typedef vtkIdType TInputId;
   typedef std::pair<TInputId, TCellId> TInputCellId;
 
-  typedef vtkIdType TObjectId;
+  typedef std::pair<vtkIdType, vtkIdType> TObjectId; 
   typedef std::map<TObjectId, TInputCellId> TObject2InputIdMap;
   
 
@@ -69,11 +69,12 @@ namespace
   {
     if(vtkDataArray *aDataArray = theCellData->GetArray("VISU_CELLS_MAPPER")){
       if(vtkIntArray *anIntArray = dynamic_cast<vtkIntArray*>(aDataArray)){
-       int aMaxId = anIntArray->GetMaxId();
-       int* aPointer = anIntArray->GetPointer(0);
-       int* anEndPointer = anIntArray->GetPointer(aMaxId + 1);
-       for(vtkIdType aCellId = 0; aPointer != anEndPointer; aPointer++, aCellId++){
-         TObjectId anObjectId = *aPointer;
+        int *aPointer = anIntArray->GetPointer(0);
+        int aNbCells = anIntArray->GetNumberOfTuples();
+       for(vtkIdType aCellId = 0; aCellId < aNbCells; aCellId++){
+          int aObjId = *aPointer++;
+          int anEntity = *aPointer++;
+         TObjectId anObjectId(aObjId, anEntity);
          TObject2InputIdMap::iterator anIter = theResult.find(anObjectId);
          if(anIter != theResult.end())
            continue;
index 6ca427555710870fddfcd94425d725e7baf7a301..e0dd2220e759aa3cddf0f754f5043de3182952ef 100644 (file)
@@ -4,6 +4,7 @@
 // Copyright : Open CASCADE
 
 #include "VISU_CommonCellsFilter.hxx"
+#include "VISU_ConvertorDef.hxx"
 
 // VTK product headers
 #include <vtkUnstructuredGrid.h>
 #include <algorithm>
 #include <vector>
 #include <map>
+#include <set>
+
+#ifdef _DEBUG_
+static int MYDEBUG = 0;
+#else
+static int MYDEBUG = 0;
+#endif
+
+// TTimerLog
+#include "VISU_ConvertorUtils.hxx"
 
 namespace
 {
-  typedef std::vector<int> TSortedArray;
+  typedef std::pair<int,int> TPair;// pair first - object id, second - entity
+  //
+  typedef std::vector<int>  TSortedArrayOne;
+  typedef std::set<TPair>   TSortedArrayPair;
+  typedef std::set<int>     TIdSet;
   typedef std::map<int,int> TId2IdMap;
 
   inline
   void
-  GetSortedArray(vtkIntArray *theArray, 
-                TSortedArray& theSortedArray)
+  GetSortedArrayAsPair(vtkIntArray *theArray, 
+                       TSortedArrayPair& theSortedArray)
+  {
+    TSortedArrayPair aSortedArray;
+    int nbComp = theArray->GetNumberOfComponents();
+    if(nbComp == 2){
+      int aMaxId = theArray->GetNumberOfTuples()*theArray->GetNumberOfComponents();
+      int* aPointer = theArray->GetPointer(0);
+      int* anEndPointer = theArray->GetPointer(aMaxId + 1);
+      for(;aPointer<anEndPointer;){
+        TPair aPair;
+        aPair.first = *aPointer;
+        aPointer++;
+        aPair.second = *aPointer;
+        aPointer++;
+        aSortedArray.insert(aPair);
+      }
+    } else if (nbComp == 1) {
+      int aMaxId = theArray->GetNumberOfTuples();
+      int* aPointer = theArray->GetPointer(0);
+      int* anEndPointer = theArray->GetPointer(aMaxId + 1);
+      for(;aPointer<anEndPointer;){
+        TPair aPair;
+        aPair.first = *aPointer;
+        aPointer++;
+        aPair.second = (int)VISU::NODE_ENTITY;
+        aSortedArray.insert(aPair);
+      }
+      
+    }
+    theSortedArray.swap(aSortedArray);
+  }
+
+  inline
+  void
+  GetSortedArrayOne(vtkIntArray *theArray, 
+                    TSortedArrayOne& theSortedArray)
   {
     int aMaxId = theArray->GetMaxId();
     int* aPointer = theArray->GetPointer(0);
     int* anEndPointer = theArray->GetPointer(aMaxId + 1);
-    TSortedArray aSortedArray(aPointer, anEndPointer);
+    TSortedArrayOne aSortedArray(aPointer, anEndPointer);
     std::sort(aSortedArray.begin(), aSortedArray.end());
     theSortedArray.swap(aSortedArray);
   }
@@ -44,37 +94,46 @@ namespace
   void
   GetIdsForCopy(vtkUnstructuredGrid *inputUGrid, 
                 vtkIntArray* inputPointIds,
-                TSortedArray& outputSortedArray)
+                TSortedArrayOne& outputSortedArray)
   {
     if(inputUGrid){
-      TSortedArray aSortedPointIds;
-      TSortedArray aOutputCellIds;
-      GetSortedArray(inputPointIds,aSortedPointIds);
-      
+      TSortedArrayOne aSortedPointIds;
+      TSortedArrayOne 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();
 
-      TSortedArray aPointCellIds;
       for(int idCell=0;idCell<nbInputCells;idCell++){
-        aPointCellIds.clear();
         vtkCell*   aCell = inputUGrid->GetCell(idCell);
         vtkIdList* ptIds = aCell->GetPointIds();
-        int aMaxId = ptIds->GetNumberOfIds();
-        int* aPointer = ptIds->GetPointer(0);
-        int* anEndPointer = ptIds->GetPointer(aMaxId + 1);
-        TSortedArray aSortedArray(aPointer, anEndPointer);
-        std::sort(aSortedArray.begin(), aSortedArray.end());
-
-        int aMaxLength = std::max(aSortedArray.size(), aSortedPointIds.size());
-        TSortedArray anIntersectionArray(aMaxLength);
-        TSortedArray::iterator anArrayIter = anIntersectionArray.begin();
-        anArrayIter = std::set_intersection(aSortedArray.begin(),
-                                            aSortedArray.end(),
-                                            aSortedPointIds.begin(),
-                                            aSortedPointIds.end(),
-                                            anArrayIter);
-        anIntersectionArray.erase(anArrayIter, anIntersectionArray.end());
-        if(anIntersectionArray.size() == aSortedArray.size())
+        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;
+        
       }
 
       outputSortedArray.swap(aOutputCellIds);
@@ -85,11 +144,16 @@ namespace
   void
   CopyElementsToOutput(vtkUnstructuredGrid* theInputUG,
                        int& theNbElements,
-                       TSortedArray& theElementIdsForCopy,
+                       TSortedArrayOne& theElementIdsForCopy,
                        TId2IdMap& theOldId2NewIdPointsMap,
-                       vtkIntArray* theOuputIDSArray,
                        vtkUnstructuredGrid* theOutputUG)
   {
+    vtkIntArray* theOuputIDSArray = vtkIntArray::New();
+    theOuputIDSArray->SetName("VISU_CELLS_MAPPER");
+    theOuputIDSArray->SetNumberOfComponents(2);
+    theOuputIDSArray->SetNumberOfTuples(theNbElements);
+    int* aOuputIDSPtr = theOuputIDSArray->GetPointer(0);
+    
     vtkIntArray* aInputCellsMapper =
       dynamic_cast<vtkIntArray*>(theInputUG->GetCellData()->GetArray("VISU_CELLS_MAPPER"));
     int* aInputCellsMapperPointer = aInputCellsMapper->GetPointer(0);
@@ -107,13 +171,18 @@ namespace
       const int aOldCellId = theElementIdsForCopy[aCellIndex];
       theOutputUG->InsertNextCell(theInputUG->GetCellType(aOldCellId),
                                   aNewPointIds);
-      if(aInputCellsMapperPointer)
-        theOuputIDSArray->InsertNextValue(aInputCellsMapperPointer[aOldCellId]);
-      else
-        theOuputIDSArray->InsertNextValue(aOldCellId);
+
+      *aOuputIDSPtr = aInputCellsMapperPointer[2*aOldCellId];
+      aOuputIDSPtr++;
+      *aOuputIDSPtr = aInputCellsMapperPointer[2*aOldCellId+1];
+      aOuputIDSPtr++;
       
       aNewPointIds->Delete();
     }
+
+    theOutputUG->GetCellData()->AddArray(theOuputIDSArray);
+    
+    theOuputIDSArray->Delete();
   }
 }
 
@@ -163,6 +232,7 @@ void
 VISU_CommonCellsFilter
 ::Execute()
 {
+  VISU::TTimerLog aTimerLog(MYDEBUG,"VISU_CommonCellsFilter::Execute");
   vtkUnstructuredGrid* anInputProfileUG = this->GetProfileUG();
   vtkUnstructuredGrid* anInputCellsUG   = this->GetCellsUG();
 
@@ -198,9 +268,11 @@ VISU_CommonCellsFilter
           vtkIntArray* aPointIDS =
             dynamic_cast<vtkIntArray*>(aInputCellData->GetArray("VISU_CELLS_MAPPER"));
           if(aPointIDS){
+            int* aPtr = aPointIDS->GetPointer(0);
             aPointIdsForCopy->SetNumberOfIds(aPointIDS->GetNumberOfTuples());
             for(int i=0;i<aPointIDS->GetNumberOfTuples();i++){
-              aPointIdsForCopy->SetId(i,aPointIDS->GetValue(i));
+              aPointIdsForCopy->SetId(i,*aPtr);
+              aPtr++;aPtr++;
             }
             aOutputPointSet->SetNumberOfPoints(aPointIdsForCopy->GetNumberOfIds());
             // aOutputPointSet copy points from anInputProfileUG to aOutputPointSet, which
@@ -218,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);
 
           
@@ -234,7 +310,7 @@ VISU_CommonCellsFilter
           // Calculate output cells
           int nbCells=0;
 
-          TSortedArray aCellIdsForCopy;
+          TSortedArrayOne aCellIdsForCopy;
           
           GetIdsForCopy(anInputCellsUG,aPointIDS,aCellIdsForCopy);
           nbCells = aCellIdsForCopy.size();
@@ -242,22 +318,15 @@ VISU_CommonCellsFilter
           // copy cells to output
           int aAllocMem = nbCells;
           anOutput->Allocate(aAllocMem);
-          vtkIntArray* theOuputIDSArray = vtkIntArray::New();
-          theOuputIDSArray->SetName("VISU_CELLS_MAPPER");
-          theOuputIDSArray->SetNumberOfComponents(1);
-          theOuputIDSArray->SetNumberOfTuples(aAllocMem);
-          
+
           if(nbCells>0 && anInputCellsUG)
             CopyElementsToOutput(anInputCellsUG,
                                  nbCells,
                                  aCellIdsForCopy,
                                  aOldId2NewIdPointsMap,
-                                 theOuputIDSArray,
                                  anOutput);
           
-          anOutput->GetCellData()->AddArray(theOuputIDSArray);
-
-          theOuputIDSArray->Delete();
+          
           aPointIdsForCopy->Delete();
         }
       }
index 88a703b11aef0c45ba35b799e63e3d93e46570bd..35db58b145e883293ccfd3a8234f9e3e2286b048 100644 (file)
@@ -220,9 +220,7 @@ namespace VISU
   {
     theDataSet->Update();
     vtkDataSetAttributes *aDataSetAttributes = theDataSet->GetPointData();
-    if(aDataSetAttributes->GetArray("VISU_POINTS_MAPPER"))
-      return aDataSetAttributes->GetNumberOfArrays() > 1;
-    return aDataSetAttributes->GetNumberOfArrays() > 0;
+    return aDataSetAttributes->GetArray("VISU_FIELD") != NULL;
   }
 
 
@@ -232,26 +230,71 @@ namespace VISU
   {
     theDataSet->Update();
     vtkDataSetAttributes *aDataSetAttributes = theDataSet->GetCellData();
-    if(aDataSetAttributes->GetArray("VISU_CELLS_MAPPER"))
-      return aDataSetAttributes->GetNumberOfArrays() > 1;
-    return aDataSetAttributes->GetNumberOfArrays() > 0;
+    return aDataSetAttributes->GetArray("VISU_FIELD") != NULL;
   }
 
 
   //---------------------------------------------------------------
   vtkIdType
-  GetElemVTKID(vtkDataSet *theDataSet, vtkIdType theID)
+  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)
   {
     theDataSet->Update();
     vtkDataSetAttributes *aDataSetAttributes = theDataSet->GetCellData();
     if(vtkDataArray *aDataArray = aDataSetAttributes->GetArray("VISU_CELLS_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(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;
   }
@@ -263,30 +306,31 @@ namespace VISU
   {
     theDataSet->Update();
     vtkDataSetAttributes *aDataSetAttributes = theDataSet->GetCellData();
-    if(vtkDataArray *aDataArray = aDataSetAttributes->GetArray("VISU_CELLS_MAPPER")){
-      if(vtkIntArray *anIntArray = dynamic_cast<vtkIntArray*>(aDataArray)){
-       return anIntArray->GetValue(theID);
-      }
-    }
+    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;
   }
 
@@ -297,15 +341,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);
+  }
+
+
   //---------------------------------------------------------------
   TGaussPointID
   GetObjID(vtkDataSet *theDataSet, vtkIdType theID)
index f2e04fded0dc45eab3fb4d3a3dfbba2e16304ab2..6455a061eb7c997fe705f77b9419b9043428b70c 100644 (file)
@@ -33,6 +33,7 @@
 #include "VISU_IDMapper.hxx"
 #include "MED_Utilities.hxx"
 
+#include "VTKViewer.h"
 #include <vtkSystemIncludes.h>
 
 #include <string>
@@ -42,6 +43,7 @@ class vtkUnstructuredGrid;
 class vtkPolyData;
 class vtkTimerLog;
 class vtkDataSet;
+class vtkCell;
 
 #ifndef VISU_ENABLE_QUADRATIC
   #define VISU_ENABLE_QUADRATIC
@@ -98,7 +100,7 @@ namespace VISU
   //---------------------------------------------------------------
   VISU_CONVERTOR_EXPORT
   vtkIdType
-  GetElemVTKID(vtkDataSet *theDataSet, vtkIdType theID);
+  GetElemVTKID(vtkDataSet *theDataSet, vtkIdType theID, int theEntity = -1);
 
 
   //---------------------------------------------------------------
@@ -107,6 +109,12 @@ namespace VISU
   GetElemObjID(vtkDataSet *theDataSet, vtkIdType theID);
 
 
+  //---------------------------------------------------------------
+  VISU_CONVERTOR_EXPORT
+  vtkCell* 
+  GetElemCell(vtkDataSet *theDataSet, vtkIdType theObjID);
+
+
   //---------------------------------------------------------------
   VISU_CONVERTOR_EXPORT
   vtkIdType
@@ -119,6 +127,11 @@ namespace VISU
   GetNodeObjID(vtkDataSet *theDataSet, vtkIdType theID);
 
 
+  //---------------------------------------------------------------
+  VISU_CONVERTOR_EXPORT
+  vtkFloatingPointType* 
+  GetNodeCoord(vtkDataSet *theDataSet, vtkIdType theObjID);
+
   //---------------------------------------------------------------
   VISU_CONVERTOR_EXPORT
   TGaussPointID
index 46342752158bbdc0aca553bf053e4b2f81047ffa..9f67b8feff86e802a3fedd8d04c539fd959451a6 100644 (file)
@@ -126,13 +126,16 @@ namespace
 
     {
       int aNbTuples = aNbCells;
+      int anEntity = int(theMeshOnEntity->myEntity);
       vtkIntArray *aDataArray = vtkIntArray::New();
       aDataArray->SetName("VISU_CELLS_MAPPER");
-      aDataArray->SetNumberOfComponents(1);
+      aDataArray->SetNumberOfComponents(2);
       aDataArray->SetNumberOfTuples(aNbTuples);
+      int *aDataArrayPtr = aDataArray->GetPointer(0);
       for(int aTupleId = 0; aTupleId < aNbTuples; aTupleId++){
        int anObjID = theSubMesh->GetElemObjID(aTupleId);
-       aDataArray->SetValue(aTupleId, anObjID);
+        *aDataArrayPtr++ = anObjID;
+        *aDataArrayPtr++ = anEntity;
       }
       theSource->GetCellData()->AddArray(aDataArray);
       aDataArray->Delete();
@@ -176,9 +179,11 @@ namespace
     aMeshID.resize(aNbCells);
 
     vtkIntArray *aDataArray = vtkIntArray::New();
+    int anEntity = int(theMeshOnEntity->myEntity);
     aDataArray->SetName("VISU_CELLS_MAPPER");
-    aDataArray->SetNumberOfComponents(1);
+    aDataArray->SetNumberOfComponents(2);
     aDataArray->SetNumberOfTuples(aNbCells);
+    int *aDataArrayPtr = aDataArray->GetPointer(0);
 
     VISU::TID2ID& anElemObj2VTKID = theFamily->myElemObj2VTKID;
 
@@ -213,9 +218,10 @@ namespace
        PrintCells(aCellId, aConnectivity, anArray[anID]);
        aCellTypesArray->SetValue(aCellId, (unsigned char)aVGeom);
        vtkIdType anObjID = aSubMesh.GetElemObjID(anID);
-       aDataArray->SetValue(aCellId, anObjID);
        anElemObj2VTKID[anObjID] = aCellId;
        aMeshID[aCellId] = anObjID;
+        *aDataArrayPtr++ = anObjID;
+        *aDataArrayPtr++ = anEntity;
       }
     }
 
@@ -303,13 +309,16 @@ namespace
     
     {
       int aNbTuples = aNbCells;
+      int anEntity = int(theMeshOnEntity->myEntity);
       vtkIntArray *aDataArray = vtkIntArray::New();
       aDataArray->SetName("VISU_CELLS_MAPPER");
-      aDataArray->SetNumberOfComponents(1);
+      aDataArray->SetNumberOfComponents(2);
       aDataArray->SetNumberOfTuples(aNbTuples);
+      int *aDataArrayPtr = aDataArray->GetPointer(0);
       for(int aTupleId = 0; aTupleId < aNbTuples; aTupleId++){
        int anObjID = theSubProfile->GetElemObjID(aTupleId);
-       aDataArray->SetValue(aTupleId, anObjID);
+        *aDataArrayPtr++ = anObjID;
+        *aDataArrayPtr++ = anEntity;
       }
       theSource->GetCellData()->AddArray(aDataArray);
       aDataArray->Delete();
@@ -608,6 +617,10 @@ VISU_Convertor_impl
       const VISU::TGeom2SubMesh& aGeom2SubMesh = aMeshOnEntity->myGeom2SubMesh;
       VISU::TGeom2SubMesh::const_iterator anIter = aGeom2SubMesh.begin();
 
+      VISU::TID2ID& anElemObj2VTKID = aMeshOnEntity->myElemObj2VTKID;
+      VISU::TSubMeshArr& aSubMeshArr = aMeshOnEntity->mySubMeshArr;
+      aSubMeshArr.resize(aGeom2SubMesh.size());
+
       for(vtkIdType anID = 0, aCellID = 0; anIter != aGeom2SubMesh.end(); anIter++, anID++){
        VISU::EGeometry aEGeom = anIter->first;
        vtkIdType aVGeom = VISUGeom2VTK(aEGeom);
@@ -626,7 +639,14 @@ VISU_Convertor_impl
        aSubMesh->myStartID = aCellID;
        GetCellsOnSubMesh(aSource, aMeshOnEntity, aSubMesh, aVGeom);
        anAppendFilter->AddInput(aSource.GetPointer());
-       aCellID += aSource->GetNumberOfCells();
+       
+       vtkIdType aNbCells = aSource->GetNumberOfCells();
+       for(vtkIdType aCell = 0; aCell < aNbCells; aCell++, aCellID++){
+         vtkIdType anObjID = aSubMesh->GetElemObjID(aCell);
+         anElemObj2VTKID[anObjID] = aCellID;
+       }
+
+       aSubMeshArr[anID] = aSubMesh;
       }
       aMeshOnEntity->myNamedPointCoords = aMesh->myNamedPointCoords;
       
index 585e7e0eed215b7501efcfeff2480e085e15e5a7..362ebba2a3ae24c1c6cb444d4540a15ea52784bb 100644 (file)
 
 #include <algorithm>
 #include <vector>
+#include <set>
 #include <map>
 
 namespace
 {
   //---------------------------------------------------------------
-  typedef std::vector<int> TSortedArray;
+  typedef int TCellId;
+  typedef int TEntityId;
+  typedef std::pair<TCellId, TEntityId> TObjectId;
+
+  typedef std::set<TObjectId> TObjectIdSet;
+  typedef std::vector<TObjectId> TObjectIdArray;
+
+  typedef int TTupleId;
+  typedef std::map<TObjectId, TTupleId> TObjectId2TupleIdMap;
 
 
   //---------------------------------------------------------------
-  inline
   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);
+    for(; aPointer != anEndPointer; aPointer += 2){
+      TCellId aCellId = *aPointer;
+      TEntityId anEntityId = *(aPointer + 1);
+      TObjectId anObjectId(aCellId, anEntityId);
+      theObjectIdSet.insert(anObjectId);
+    }
   }
 
 
   //---------------------------------------------------------------
-  typedef std::map<int,int> TId2IdMap;
-
-
-  //---------------------------------------------------------------
-  template <class TNumericType>
-  void DeepCopySwitchOnOutput(TNumericType *theInputPtr, 
-                             TNumericType *theOutputPtr,
-                             const TSortedArray& theIntersection,
-                             const TId2IdMap& theObj2VTKMap,
-                             vtkIdType theNbComp)
+  void
+  GetObjectId2TupleIdMap(vtkIntArray *theArray, 
+                       TObjectId2TupleIdMap& theObjectId2TupleIdMap)
   {
-    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++];
-      }
+    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;
     }
   }
 
 
   //---------------------------------------------------------------
-  typedef vtkDataArray* (vtkDataSetAttributes::* TGetAttribute)();
-  typedef int (vtkDataSetAttributes::* TSetAttribute)(vtkDataArray*);
-
+  typedef vtkFieldData* (vtkDataSet::* TGetFieldData)();
 
   //---------------------------------------------------------------
-  inline
-  void
-  CopyArray(vtkDataArray* theDataArray,
-           vtkDataSetAttributes* theOutput, 
-           TSetAttribute theSetAttribute,
-           vtkIdType theFixedNbTuples)
+  struct TGetCellData
   {
-    if(theDataArray){
-      vtkIdType aNbTuples = theDataArray->GetNumberOfTuples();
-      if(theFixedNbTuples == aNbTuples)
-       (theOutput->*theSetAttribute)(theDataArray);
+    vtkFieldData*
+    operator()(vtkDataSet* theDataSet)
+    {
+      return theDataSet->GetCellData();
     }
-  }
+  };
 
 
   //---------------------------------------------------------------
-  inline
-  void
-  CopyAttribute(vtkDataSetAttributes* theInput, 
-               TGetAttribute theGetAttribute,
-               vtkDataSetAttributes* theOutput, 
-               TSetAttribute theSetAttribute,
-               vtkIdType theFixedNbTuples)
+  struct TGetPointData
   {
-    CopyArray((theInput->*theGetAttribute)(),
-             theOutput, theSetAttribute,
-             theFixedNbTuples);
-  }
+    vtkFieldData*
+    operator()(vtkDataSet* theDataSet)
+    {
+      return theDataSet->GetPointData();
+    }
+  };
 
 
   //---------------------------------------------------------------
-  vtkDataArray*
-  DeepCopyArray(vtkDataArray* theDataArray,
-               vtkDataSetAttributes* theOutput, 
-               TSetAttribute theSetAttribute,
-               const TSortedArray& theIntersection, 
-               const TId2IdMap& theObj2VTKMap)
+  template<class TGetFieldData>
+  vtkIntArray*
+  GetIDMapper(VISU::TFieldList* theFieldList,
+             TGetFieldData theGetFieldData,
+             const char* theFieldName)
   {
-    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!");
+    VISU::TFieldListIterator anIter(theFieldList);
+    for(anIter.Begin(); !anIter.End() ; anIter.Next()){
+      const char* aFieldName = anIter.Get()->GetName();
+      if(strcmp(aFieldName, theFieldName) == 0){
+       vtkDataSet* aDataSet = anIter.Get()->Ptr;
+       vtkFieldData *aFieldData = theGetFieldData(aDataSet);
+       vtkDataArray *anIDMapper = aFieldData->GetArray(theFieldName);
+       return dynamic_cast<vtkIntArray*>(anIDMapper);
       }
-
-      (theOutput->*theSetAttribute)(aDataArray);
-      aDataArray->Delete();
     }
-    return aDataArray;
+    return NULL;
   }
 
 
   //---------------------------------------------------------------
-  void
-  DeepCopyAttribute(vtkDataSetAttributes* theInput, 
-                   TGetAttribute theGetAttribute,
-                   vtkDataSetAttributes* theOutput, 
-                   TSetAttribute theSetAttribute,
-                   const TSortedArray& theIntersection, 
-                   const TId2IdMap& theObj2VTKMap)
+  template<class TGetFieldData>
+  vtkIntArray*
+  GetIDMapper(vtkDataSet* theIDMapperDataSet,
+             TGetFieldData theGetFieldData,
+             const char* theFieldName)
   {
-    DeepCopyArray((theInput->*theGetAttribute)(),
-                 theOutput, 
-                 theSetAttribute,
-                 theIntersection, 
-                 theObj2VTKMap);
+    vtkFieldData *aFieldData = theGetFieldData(theIDMapperDataSet);
+    vtkDataArray *anIDMapper = aFieldData->GetArray(theFieldName);
+    return dynamic_cast<vtkIntArray*>(anIDMapper);
   }
 
 
   //---------------------------------------------------------------
-  inline
-  void
-  DeepCopyDataSetAttribute(vtkDataSet* theInput,
-                          TGetAttribute theGetAttribute,
-                          vtkDataSet* theOutput, 
-                          TSetAttribute theSetAttribute,
-                          const TSortedArray& theIntersection, 
-                          const TId2IdMap& theObj2VTKMap)
+  bool
+  IsDifferent(vtkIntArray *theFirstIDMapper,
+             vtkIntArray *theSecondIDMapper)
   {
-    CopyAttribute(theInput->GetPointData(), 
-                 theGetAttribute,
-                 theOutput->GetPointData(), 
-                 theSetAttribute,
-                 theInput->GetNumberOfPoints());
-    DeepCopyAttribute(theInput->GetCellData(), 
-                     theGetAttribute,
-                     theOutput->GetCellData(), 
-                     theSetAttribute,
-                     theIntersection, 
-                     theObj2VTKMap);
+    vtkIdType aFirstNbTuples = theFirstIDMapper->GetNumberOfTuples();
+    vtkIdType aSecondNbTuples = theSecondIDMapper->GetNumberOfTuples();
+    if(aFirstNbTuples != aSecondNbTuples)
+      return true;
+
+    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;
+    }
+    
+    return false;
   }
 
 
   //---------------------------------------------------------------
   inline
   void
-  DeepCopyField(vtkDataSetAttributes* theInput, 
-               const char* theFieldName, 
-               vtkDataSetAttributes* theOutput, 
-               const TSortedArray& theIntersection,
-               const TId2IdMap& theObj2VTKMap)
+  GetIntersection(vtkIntArray *theFirstIDMapper,
+                 vtkIntArray *theSecondIDMapper,
+                 TObjectIdArray& theResult)
   {
-    vtkDataArray* aDataArray = 
-      DeepCopyArray(theInput->GetArray(theFieldName), 
-                   theOutput, 
-                   &vtkFieldData::AddArray,
-                   theIntersection,
-                   theObj2VTKMap);
-    if(aDataArray)
-      aDataArray->SetName(theFieldName);
+    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());
   }
 
 
   //---------------------------------------------------------------
-  inline
-  void
-  CopyField(vtkDataSetAttributes* theInput, 
-           const char* theFieldName, 
-           vtkDataSetAttributes* theOutput,
-           vtkIdType theFixedNbTuples)
+  template<class TDataSet>
+  void 
+  CopyDataOnCells(TDataSet *theInput,
+                 vtkIntArray *theGeometryCellMapper,
+                 vtkIntArray *theDataCellMapper,
+                 vtkDataSet* theScalarsDataSet,
+                 vtkDataSet* theVectorsDataSet,
+                 vtkDataSet* theNormalsDataSet,
+                 vtkDataSet* theTCoordsDataSet,
+                 vtkDataSet* theTensorsDataSet,
+                 VISU::TFieldList* theFieldList,
+                 TDataSet *theOutput)
   {
-    CopyArray(theInput->GetArray(theFieldName),
-             theOutput,
-             &vtkDataSetAttributes::AddArray,
-             theFixedNbTuples);
-  }
-
+    if(IsDifferent(theGeometryCellMapper, theDataCellMapper)){
+      TObjectIdArray anIntersection;
+      GetIntersection(theGeometryCellMapper,
+                     theDataCellMapper,
+                     anIntersection);
+    
+      TObjectId2TupleIdMap aGeomObjectId2TupleIdMap;
+      GetObjectId2TupleIdMap(theGeometryCellMapper, aGeomObjectId2TupleIdMap);
+      
+      TObjectId2TupleIdMap aDataObjectId2TupleIdMap;
+      GetObjectId2TupleIdMap(theDataCellMapper, aDataObjectId2TupleIdMap);
+      
+      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();
 
-  //---------------------------------------------------------------
-  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);
+      theOutput->SetPoints(theInput->GetPoints());
+    }else{
+      theOutput->CopyStructure(theInput);
+      theOutput->GetCellData()->ShallowCopy(theScalarsDataSet->GetCellData());
+    }
+    theOutput->GetPointData()->ShallowCopy(theInput->GetPointData());
   }
-
-
+  
+  
   //---------------------------------------------------------------
-  inline
-  void
-  DeepCopyDataSetAttributes(vtkDataSet *theFilterOutput, 
-                           vtkDataSet* theScalarsDataSet,
-                           vtkDataSet* theVectorsDataSet,
-                           vtkDataSet* theNormalsDataSet,
-                           vtkDataSet* theTCoordsDataSet,
-                           vtkDataSet* theTensorsDataSet,
-                           VISU::TFieldList* theFieldList,
-                           const TSortedArray& theIntersection, 
-                           const TId2IdMap& theObj2VTKMap)
+  template<class TDataSet>
+  void 
+  CopyDataOnPoints(TDataSet *theInput,
+                  vtkIntArray *theGeometryPointMapper,
+                  vtkIntArray *theDataPointMapper,
+                  vtkDataSet* theScalarsDataSet,
+                  vtkDataSet* theVectorsDataSet,
+                  vtkDataSet* theNormalsDataSet,
+                  vtkDataSet* theTCoordsDataSet,
+                  vtkDataSet* theTensorsDataSet,
+                  VISU::TFieldList* theFieldList,
+                  TDataSet *theOutput)
   {
-    if(theScalarsDataSet)
-      DeepCopyDataSetAttribute(theScalarsDataSet, 
-                              &vtkDataSetAttributes::GetScalars,
-                              theFilterOutput, 
-                              &vtkDataSetAttributes::SetScalars,
-                              theIntersection, 
-                              theObj2VTKMap);
-    
-    if(theVectorsDataSet)
-      DeepCopyDataSetAttribute(theVectorsDataSet, 
-                              &vtkDataSetAttributes::GetVectors,
-                              theFilterOutput, 
-                              &vtkDataSetAttributes::SetVectors,
-                              theIntersection, 
-                              theObj2VTKMap);
-    
-    if(theNormalsDataSet)
-      DeepCopyDataSetAttribute(theNormalsDataSet, 
-                              &vtkDataSetAttributes::GetNormals,
-                              theFilterOutput, 
-                              &vtkDataSetAttributes::SetNormals,
-                              theIntersection, 
-                              theObj2VTKMap);
-    
-    if(theTCoordsDataSet)
-      DeepCopyDataSetAttribute(theTCoordsDataSet, 
-                              &vtkDataSetAttributes::GetTCoords,
-                              theFilterOutput, 
-                              &vtkDataSetAttributes::SetTCoords,
-                              theIntersection, 
-                              theObj2VTKMap);
-    
-    if(theTensorsDataSet)
-      DeepCopyDataSetAttribute(theTensorsDataSet, 
-                              &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);
+    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();
+      
+      // Copy geometry points
+      // 1. Create vtkPoints instance of the same data type
+      vtkPointSet* aScalarsDataSet = dynamic_cast<vtkPointSet*>(theScalarsDataSet);
+      vtkPoints* anGeometryPoints = theInput->GetPoints();
+      vtkPoints* aDataPoints = aScalarsDataSet->GetPoints();
+      vtkPoints* anOutputPoints = vtkPoints::New(aDataPoints->GetDataType());
+      theOutput->SetPoints(anOutputPoints);
+      anOutputPoints->Delete();
+
+      // 2. Perform mapping of geometry points
+      TObjectId2TupleIdMap aGeomObjectId2TupleIdMap;
+      GetObjectId2TupleIdMap(theGeometryPointMapper, aGeomObjectId2TupleIdMap);
+
+      // 3. Loop over all data points
+      int aNbDataPoints = theDataPointMapper->GetNumberOfTuples();
+      anOutputPoints->SetNumberOfPoints(aNbDataPoints);
+      for(int aPointId = 0; aPointId < aNbDataPoints; aPointId++){
+       int* aPointer = theDataPointMapper->GetPointer(aPointId * 2);
+       TCellId aCellId = *aPointer;
+       TEntityId anEntityId = *(aPointer + 1);
+       TObjectId anObjectId(aCellId, anEntityId);
+       TObjectId2TupleIdMap::iterator anIter = aGeomObjectId2TupleIdMap.find(anObjectId);
+       if(anIter != aDataObjectId2PointIdMap.end()){
+         // If the point exists in the geometry put it to output
+         int aGeometryPointId = anIter->second;
+         vtkFloatingPointType aCoords[3];
+         anGeometryPoints->GetPoint(aGeometryPointId, aCoords);
+         anOutputPoints->SetPoint(aPointId, aCoords);
+       }else{
+         // If no, the point from data should be used
+         vtkFloatingPointType aCoords[3];
+         aDataPoints->GetPoint(aPointId, aCoords);
+         anOutputPoints->SetPoint(aPointId, aCoords);
+       }
+      }
+    }else{
+      theOutput->CopyStructure(theInput);
+      theOutput->GetCellData()->ShallowCopy(theInput->GetCellData());
     }
+    theOutput->GetPointData()->ShallowCopy(theScalarsDataSet->GetPointData());
   }
 
 
   //---------------------------------------------------------------
+  typedef vtkDataArray* (vtkDataSetAttributes::* TGetAttribute)();
+  typedef int (vtkDataSetAttributes::* TSetAttribute)(vtkDataArray*);
+
   inline
   void
-  GetIdsForCopy(vtkDataSet* theInputDataSet, 
-                vtkIntArray* inputPointIds,
-                TSortedArray& outputSortedArray)
+  CopyArray(vtkDataArray* theDataArray,
+           vtkDataSetAttributes* theOutput, 
+           TSetAttribute theSetAttribute,
+           vtkIdType theFixedNbTuples)
   {
-    if(theInputDataSet){
-      TSortedArray aSortedPointIds;
-      TSortedArray aOutputCellIds;
-      GetSortedArray(inputPointIds,aSortedPointIds);
-      
-      int nbInputCells = theInputDataSet->GetNumberOfCells();
-
-      TSortedArray aPointCellIds;
-      for(int idCell=0;idCell<nbInputCells;idCell++){
-        aPointCellIds.clear();
-        vtkCell*   aCell = theInputDataSet->GetCell(idCell);
-        vtkIdList* ptIds = aCell->GetPointIds();
-        int aMaxId = ptIds->GetNumberOfIds();
-        int* aPointer = ptIds->GetPointer(0);
-        int* anEndPointer = ptIds->GetPointer(aMaxId + 1);
-        TSortedArray aSortedArray(aPointer, anEndPointer);
-        std::sort(aSortedArray.begin(), aSortedArray.end());
-
-        int aMaxLength = std::max(aSortedArray.size(), aSortedPointIds.size());
-        TSortedArray anIntersectionArray(aMaxLength);
-        TSortedArray::iterator anArrayIter = anIntersectionArray.begin();
-        anArrayIter = std::set_intersection(aSortedArray.begin(),
-                                            aSortedArray.end(),
-                                            aSortedPointIds.begin(),
-                                            aSortedPointIds.end(),
-                                            anArrayIter);
-        anIntersectionArray.erase(anArrayIter, anIntersectionArray.end());
-        if(anIntersectionArray.size() == aSortedArray.size())
-          aOutputCellIds.push_back(idCell);
-      }
-
-      outputSortedArray.swap(aOutputCellIds);
+    if(theDataArray){
+      vtkIdType aNbTuples = theDataArray->GetNumberOfTuples();
+      if(theFixedNbTuples == aNbTuples)
+       (theOutput->*theSetAttribute)(theDataArray);
     }
   }
 
 
   //---------------------------------------------------------------
-  template<class TDataSet>
+  inline
   void
-  CopyElementsToOutput(vtkDataSet* theInputDataSet,
-                       int& theNbElements,
-                       TSortedArray& theElementIdsForCopy,
-                       TId2IdMap& theOldId2NewIdPointsMap,
-                       vtkIntArray* theOuputIDSArray,
-                       TDataSet* theOutputDataSet)
+  CopyAttribute(vtkDataSetAttributes* theInput, 
+               TGetAttribute theGetAttribute,
+               vtkDataSetAttributes* theOutput, 
+               TSetAttribute theSetAttribute,
+               vtkIdType theFixedNbTuples)
   {
-    vtkIntArray* aInputCellsMapper =
-      dynamic_cast<vtkIntArray*>(theInputDataSet->GetCellData()->GetArray("VISU_CELLS_MAPPER"));
-    
-    int* aInputCellsMapperPointer = aInputCellsMapper->GetPointer(0);
-    
-    for(int aCellIndex=0;aCellIndex<theNbElements;aCellIndex++){
-      int aCellId = theElementIdsForCopy[aCellIndex];
-      vtkIdList* aOldPointIds = theInputDataSet->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);
-      }
-      const int aOldCellId = theElementIdsForCopy[aCellIndex];
-      theOutputDataSet->InsertNextCell(theInputDataSet->GetCellType(aOldCellId),
-                                      aNewPointIds);
-      if(aInputCellsMapperPointer)
-        theOuputIDSArray->InsertNextValue(aInputCellsMapperPointer[aOldCellId]);
-      else
-        theOuputIDSArray->InsertNextValue(aOldCellId);
-      
-      aNewPointIds->Delete();
-    }
-    theOutputDataSet->GetCellData()->AddArray(theOuputIDSArray);
+    CopyArray((theInput->*theGetAttribute)(),
+             theOutput, theSetAttribute,
+             theFixedNbTuples);
   }
 
 
@@ -430,6 +409,21 @@ namespace
   }
 
 
+  //---------------------------------------------------------------
+  inline
+  void
+  CopyField(vtkDataSetAttributes* theInput, 
+           const char* theFieldName, 
+           vtkDataSetAttributes* theOutput,
+           vtkIdType theFixedNbTuples)
+  {
+    CopyArray(theInput->GetArray(theFieldName),
+             theOutput,
+             &vtkDataSetAttributes::AddArray,
+             theFixedNbTuples);
+  }
+
+
   //---------------------------------------------------------------
   inline
   void
@@ -439,312 +433,154 @@ 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);
+    }
   }
 
-
   //---------------------------------------------------------------
-  struct TGetCellData
+  void
+  BasicExecute(vtkDataSet *theInput,
+              vtkDataSet* theScalarsDataSet,
+              vtkDataSet* theVectorsDataSet,
+              vtkDataSet* theNormalsDataSet,
+              vtkDataSet* theTCoordsDataSet,
+              vtkDataSet* theTensorsDataSet,
+              VISU::TFieldList* theFieldList,
+              vtkDataSet *theOutput)
   {
-    vtkFieldData*
-    operator()(vtkDataSet* theDataSet)
-    {
-      return theDataSet->GetCellData();
-    }
-  };
+    theOutput->CopyStructure(theInput);
 
+    vtkIdType aNbPoints = theInput->GetNumberOfPoints();
+    vtkIdType aNbCells = theInput->GetNumberOfCells();
+  
+    // merge data only if it is consistent
+    if(theScalarsDataSet)
+      CopyDataSetAttribute(theScalarsDataSet, 
+                          &vtkDataSetAttributes::GetScalars,
+                          theOutput,
+                          &vtkDataSetAttributes::SetScalars,
+                          aNbPoints,
+                          aNbCells);
 
-  //---------------------------------------------------------------
-  struct TGetPointData
-  {
-    vtkFieldData*
-    operator()(vtkDataSet* theDataSet)
-    {
-      return theDataSet->GetPointData();
-    }
-  };
+    if(theVectorsDataSet)
+      CopyDataSetAttribute(theVectorsDataSet, 
+                          &vtkDataSetAttributes::GetVectors,
+                          theOutput, 
+                          &vtkDataSetAttributes::SetVectors,
+                          aNbPoints, 
+                          aNbCells);
 
+    if(theNormalsDataSet)
+      CopyDataSetAttribute(theNormalsDataSet,
+                          &vtkDataSetAttributes::GetNormals,
+                          theOutput,
+                          &vtkDataSetAttributes::SetNormals,
+                          aNbPoints,
+                          aNbCells);
 
-  //---------------------------------------------------------------
-  typedef vtkFieldData* (vtkDataSet::* TGetFieldData)();
+    if(theTCoordsDataSet)
+      CopyDataSetAttribute(theTCoordsDataSet,
+                          &vtkDataSetAttributes::GetTCoords,
+                          theOutput,
+                          &vtkDataSetAttributes::SetTCoords,
+                          aNbPoints, 
+                          aNbCells);
+    
+    if(theTensorsDataSet)
+      CopyDataSetAttribute(theTensorsDataSet, 
+                          &vtkDataSetAttributes::GetTensors,
+                          theOutput, 
+                          &vtkDataSetAttributes::SetTensors,
+                          aNbPoints, 
+                          aNbCells);
 
-  template<class TGetFieldData>
-  vtkIntArray*
-  GetIDMapper(VISU::TFieldList* theFieldList,
-             TGetFieldData theGetFieldData,
-             const char* theFieldName)
-  {
     VISU::TFieldListIterator anIter(theFieldList);
     for(anIter.Begin(); !anIter.End() ; anIter.Next()){
+      vtkDataSet *aDataSet = anIter.Get()->Ptr;
       const char* aFieldName = anIter.Get()->GetName();
-      if(strcmp(aFieldName, theFieldName) == 0){
-       vtkDataSet* aDataSet = anIter.Get()->Ptr;
-       vtkFieldData *aFieldData = theGetFieldData(aDataSet);
-       vtkDataArray *anIDMapper = aFieldData->GetArray(aFieldName);
-       return dynamic_cast<vtkIntArray*>(anIDMapper);
-      }
+      CopyDataSetField(aDataSet, 
+                      aFieldName, 
+                      theOutput, 
+                      aNbPoints, 
+                      aNbCells);
     }
-    return NULL;
   }
 
 
   //---------------------------------------------------------------
   template<class TDataSet>
-  bool
+  bool 
   Execute(TDataSet *theInput,
-         TDataSet *theOutput,
          vtkDataSet* theScalarsDataSet,
          vtkDataSet* theVectorsDataSet,
          vtkDataSet* theNormalsDataSet,
          vtkDataSet* theTCoordsDataSet,
          vtkDataSet* theTensorsDataSet,
          VISU::TFieldList* theFieldList,
-         bool theIsMergingInputs)
+         bool theIsMergingInputs,
+         TDataSet *theOutput)
   {
-    vtkCellData *aCellData = theInput->GetCellData();
-    if(vtkDataArray *aCellMapper = aCellData->GetArray("VISU_CELLS_MAPPER")){
-      vtkIntArray *aGeometryCellMapper = dynamic_cast<vtkIntArray*>(aCellMapper);
-      vtkIdType aGeomNbCells = aGeometryCellMapper->GetNumberOfTuples();
-
-      vtkPointData *aPointData = theInput->GetPointData();
-      vtkDataArray *aPointMapper = aPointData->GetArray("VISU_POINTS_MAPPER");
-      vtkIntArray *aGeometryPointMapper = dynamic_cast<vtkIntArray*>(aPointMapper);
-      vtkIdType aGeomNbPoints = aGeometryPointMapper->GetNumberOfTuples();
-    
-    
-      vtkIntArray* aDataPointMapper = GetIDMapper(theFieldList,
-                                                 TGetPointData(),
-                                                 "VISU_POINTS_MAPPER");
-      vtkIdType aDataNbPoints = aDataPointMapper->GetNumberOfTuples();
-      
-      vtkIntArray* aDataCellMapper = GetIDMapper(theFieldList,
-                                                TGetCellData(),
-                                                "VISU_CELLS_MAPPER");
-      vtkIdType aDataNbCells = aDataCellMapper->GetNumberOfTuples();
-
-      if(aDataNbPoints == aGeomNbPoints){
-       bool anIsDifferent = aDataCellMapper && aDataNbCells != aGeomNbCells;
-       if(anIsDifferent || theIsMergingInputs){
-         TSortedArray aGeometryCellArray;
-         GetSortedArray(aGeometryCellMapper, aGeometryCellArray);
-         
-         TSortedArray aDataCellArray;
-         GetSortedArray(aDataCellMapper, 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 || theIsMergingInputs){
-           {
-             TId2IdMap anObj2VTKGeometryMap;
-             vtkIdType aNbCells = aGeometryCellMapper->GetNumberOfTuples();
-             for(int aCellId = 0; aCellId < aNbCells; aCellId++){
-               vtkIdType anObjID = aGeometryCellMapper->GetValue(aCellId);
-               anObj2VTKGeometryMap[anObjID] = aCellId;
-             }
-             
-             vtkIdType aNbTuples = anIntersectionArray.size();
-             theOutput->Allocate(aNbTuples);
-             vtkIdList *aCellIds = vtkIdList::New();
-             for(int aTupleId = 0; aTupleId < aNbTuples; aTupleId++){
-               vtkIdType anObjID = anIntersectionArray[aTupleId];
-               vtkIdType aCellId = anObj2VTKGeometryMap[anObjID];
-               vtkCell *aCell = theInput->GetCell(aCellId);
-               aCellIds->Reset();
-               vtkIdType aNbPointIds = aCell->PointIds->GetNumberOfIds();
-               for(vtkIdType aPointId = 0; aPointId < aNbPointIds; aPointId++)
-                 aCellIds->InsertNextId(aCell->GetPointIds()->GetId(aPointId));
-               theOutput->InsertNextCell(theInput->GetCellType(aCellId), aCellIds);
-             }
-             aCellIds->Delete();
-             theOutput->SetPoints(theInput->GetPoints());
-           }
-           {
-             TId2IdMap anObj2VTKDataMap;
-             vtkIdType aNbCells = aDataCellMapper->GetNumberOfTuples();
-             for(int aCellId = 0; aCellId < aNbCells; aCellId++){
-               vtkIdType anObjID = aDataCellMapper->GetValue(aCellId);
-               anObj2VTKDataMap[anObjID] = aCellId;
-             }
-             
-             DeepCopyDataSetAttributes(theOutput, 
-                                       theScalarsDataSet,
-                                       theVectorsDataSet,
-                                       theNormalsDataSet,
-                                       theTCoordsDataSet,
-                                       theTensorsDataSet,
-                                       theFieldList,
-                                       anIntersectionArray, 
-                                       anObj2VTKDataMap);
-           }
-           return true;
-         }
-       }
-      }else if(aDataNbPoints < aGeomNbPoints){
-       vtkIntArray* aDataPointMapper = NULL;
-       vtkPointData* aInputScalarsPointData = theScalarsDataSet->GetPointData();
-       VISU::TFieldListIterator anIter(theFieldList);
-       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(theFieldList);
-       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;
-         }
+    if(theIsMergingInputs){
+      vtkCellData *aCellData = theInput->GetCellData();
+      if(vtkDataArray *aCellMapper = aCellData->GetArray("VISU_CELLS_MAPPER")){
+       bool anIsDataOnCells = false;
+       if(vtkDataSet* aDataSet = theScalarsDataSet)
+         if(vtkCellData* aCellData = aDataSet->GetCellData())
+           anIsDataOnCells = (aCellData->GetArray("VISU_FIELD") != NULL);
+       if(anIsDataOnCells){
+         vtkIntArray *aGeometryCellMapper = dynamic_cast<vtkIntArray*>(aCellMapper);
+         vtkIntArray* aDataCellMapper = GetIDMapper(theFieldList,
+                                                    TGetCellData(),
+                                                    "VISU_CELLS_MAPPER");
+         CopyDataOnCells(theInput,
+                         aGeometryCellMapper,
+                         aDataCellMapper,
+                         theScalarsDataSet,
+                         theVectorsDataSet,
+                         theNormalsDataSet,
+                         theTCoordsDataSet,
+                         theTensorsDataSet,
+                         theFieldList,
+                         theOutput);
+       }else{
+         vtkPointData *aPointData = theInput->GetPointData();
+         vtkDataArray *aPointMapper = aPointData->GetArray("VISU_POINTS_MAPPER");
+         vtkIntArray *aGeometryPointMapper = dynamic_cast<vtkIntArray*>(aPointMapper);
+         vtkIntArray* aDataPointMapper = GetIDMapper(theFieldList,
+                                                     TGetPointData(),
+                                                     "VISU_POINTS_MAPPER");
+         CopyDataOnPoints(theInput,
+                          aGeometryPointMapper,
+                          aDataPointMapper,
+                          theScalarsDataSet,
+                          theVectorsDataSet,
+                          theNormalsDataSet,
+                          theTCoordsDataSet,
+                          theTensorsDataSet,
+                          theFieldList,
+                          theOutput);
        }
-       
-       bool anIsDifferent = aDataPointMapper &&
-         aDataPointMapper->GetNumberOfTuples() != aGeometryPointMapper->GetNumberOfTuples();
-       if(anIsDifferent){
-         TSortedArray aGeometryPointArray;
-         GetSortedArray(aGeometryPointMapper, aGeometryPointArray);
-         
-         TSortedArray aDataPointArray;
-         GetSortedArray(aDataPointMapper, aDataPointArray);
-         
-         int aMaxLength = std::max(aGeometryPointArray.size(), aDataPointArray.size());
-         TSortedArray anIntersectionArray(aMaxLength);
-         TSortedArray::iterator anArrayIter = anIntersectionArray.begin();
-         anArrayIter = std::set_intersection(aGeometryPointArray.begin(),
-                                             aGeometryPointArray.end(),
-                                             aDataPointArray.begin(),
-                                             aDataPointArray.end(),
-                                             anArrayIter);
-         
-         anIntersectionArray.erase(anArrayIter, anIntersectionArray.end());
-         
-         {
-           TId2IdMap anObj2VTKGeometryMap;
-           vtkIdType aNbCells = aDataPointMapper/*aGeometryPointMapper*/->GetNumberOfTuples();
-           for(int aCellId = 0; aCellId < aNbCells; aCellId++){
-             vtkIdType anObjID = aDataPointMapper/*aGeometryPointMapper*/->GetValue(aCellId);
-             anObj2VTKGeometryMap[anObjID] = aCellId;
-           }
-           
-           vtkIdType aNbTuples = anIntersectionArray.size();
-           
-           if(aNbTuples == aDataNbPoints){
-             vtkPointSet* aScalarsPointSet = vtkPointSet::SafeDownCast(theScalarsDataSet);
-             theOutput->SetPoints(aScalarsPointSet->GetPoints());
-             theOutput->GetPointData()->ShallowCopy(aScalarsPointSet->GetPointData());
-             
-             // Calculate output cells
-             int nbCells=0;
-             TSortedArray aCellIdsForCopy;
-             GetIdsForCopy(theInput, aDataPointMapper, aCellIdsForCopy);
-             nbCells = aCellIdsForCopy.size();
-             
-             // copy cells to output
-             theOutput->Allocate(nbCells);
-             vtkIntArray* theOuputIDSArray = vtkIntArray::New();
-             theOuputIDSArray->SetName("VISU_CELLS_MAPPER");
-             theOuputIDSArray->SetNumberOfComponents(1);
-             theOuputIDSArray->SetNumberOfTuples(nbCells);
-             
-             if(nbCells>0)
-               CopyElementsToOutput(theInput,
-                                    nbCells,
-                                    aCellIdsForCopy,
-                                    anObj2VTKGeometryMap,
-                                    theOuputIDSArray,
-                                    theOutput);
-             theOuputIDSArray->Delete();
-             return true;
-           } else {
-             // not implemented yet
-           }
-         }
-       }
-      }
-    }
-    {
-      theOutput->CopyStructure(theInput);
-      vtkIdType aNbPoints = theOutput->GetNumberOfPoints();
-      vtkIdType aNbCells = theOutput->GetNumberOfCells();
-      
-      // merge data only if it is consistent
-      if(theScalarsDataSet)
-       CopyDataSetAttribute(theScalarsDataSet, 
-                            &vtkDataSetAttributes::GetScalars,
-                            theOutput,
-                            &vtkDataSetAttributes::SetScalars,
-                            aNbPoints,
-                            aNbCells);
-      
-      if(theVectorsDataSet)
-       CopyDataSetAttribute(theVectorsDataSet, 
-                            &vtkDataSetAttributes::GetVectors,
-                            theOutput, 
-                            &vtkDataSetAttributes::SetVectors,
-                            aNbPoints, 
-                            aNbCells);
-      
-      if(theNormalsDataSet)
-       CopyDataSetAttribute(theNormalsDataSet,
-                            &vtkDataSetAttributes::GetNormals,
-                            theOutput,
-                            &vtkDataSetAttributes::SetNormals,
-                            aNbPoints,
-                            aNbCells);
-      
-      if(theTCoordsDataSet)
-       CopyDataSetAttribute(theTCoordsDataSet,
-                            &vtkDataSetAttributes::GetTCoords,
-                            theOutput,
-                            &vtkDataSetAttributes::SetTCoords,
-                            aNbPoints, 
-                            aNbCells);
-      
-      if(theTensorsDataSet)
-       CopyDataSetAttribute(theTensorsDataSet, 
-                            &vtkDataSetAttributes::GetTensors,
-                            theOutput, 
-                            &vtkDataSetAttributes::SetTensors,
-                            aNbPoints, 
-                            aNbCells);
-      
-      VISU::TFieldListIterator anIter(theFieldList);
-      for(anIter.Begin(); !anIter.End() ; anIter.Next()){
-       vtkDataSet *aDataSet = anIter.Get()->Ptr;
-       const char* aFieldName = anIter.Get()->GetName();
-       CopyDataSetField(aDataSet, 
-                        aFieldName, 
-                        theOutput, 
-                        aNbPoints, 
-                        aNbCells);
       }
+    }else{
+      BasicExecute(theInput,
+                  theScalarsDataSet,
+                  theVectorsDataSet,
+                  theNormalsDataSet,
+                  theTCoordsDataSet,
+                  theTensorsDataSet,
+                  theFieldList,
+                  theOutput);
     }
     return true;
-  } 
-    
-  //---------------------------------------------------------------
+  }
 }
 
 
@@ -764,14 +600,14 @@ namespace VISU
          bool theIsMergingInputs)
   {
     return ::Execute(theInput,
-                    theOutput,
                     theScalarsDataSet,
                     theVectorsDataSet,
                     theNormalsDataSet,
                     theTCoordsDataSet,
                     theTensorsDataSet,
                     theFieldList,
-                    theIsMergingInputs);
+                    theIsMergingInputs,
+                    theOutput);
   }
 
 
@@ -788,14 +624,14 @@ namespace VISU
          bool theIsMergingInputs)
   {
     return ::Execute(theInput,
-                    theOutput,
                     theScalarsDataSet,
                     theVectorsDataSet,
                     theNormalsDataSet,
                     theTCoordsDataSet,
                     theTensorsDataSet,
                     theFieldList,
-                    theIsMergingInputs);
+                    theIsMergingInputs,
+                    theOutput);
   }
 
 
index 59bdb6399aee22c64868bb5dbb11a7ddc1cd3cb3..bfdf7aeffd6420b2c43c6fcc6b980f345c0cdb25 100644 (file)
@@ -373,13 +373,16 @@ namespace VISU
       
       {
        vtkIdType aNbTuples = GetNbPoints();
+       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 = GetObjID(aTupleId);
-         aDataArray->SetValue(aTupleId, anObjID);
+         *aPtr++ = anObjID;
+         *aPtr++ = anEntity;
        }
        myPointSet->GetPointData()->AddArray(aDataArray);
        aDataArray->Delete();
index d3632dcb2b3337a1df07c988fdbbe9f76e99e05d..853d56c5b737bc52d59f2efb7b3413131b2c7062 100644 (file)
@@ -425,12 +425,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
@@ -440,7 +435,7 @@ VISU_Actor
   if(myIsVTKMapping)
     return theID;
 
-  return GetCurrentPL()->GetNodeVTKID(theID);
+  return VISU::GetNodeVTKID(GetMapper()->GetInput(), theID);
 }
 
 vtkFloatingPointType*
@@ -450,7 +445,7 @@ VISU_Actor
   if(myIsVTKMapping)
     return Superclass::GetNodeCoord(theObjID);
 
-  return GetCurrentPL()->GetNodeCoord(theObjID);
+  return VISU::GetNodeCoord(GetInput(), theObjID);
 }
 
 
@@ -462,12 +457,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
@@ -477,7 +467,7 @@ VISU_Actor
   if(myIsVTKMapping)
     return theID;
 
-  return GetCurrentPL()->GetElemVTKID(theID);
+  return VISU::GetElemVTKID(GetMapper()->GetInput(), theID);
 }
 
 vtkCell* 
@@ -487,7 +477,7 @@ VISU_Actor
   if(myIsVTKMapping)
     return Superclass::GetElemCell(theObjID);
 
-  return GetCurrentPL()->GetElemCell(theObjID);
+  return VISU::GetElemCell(GetInput(), theObjID);
 }
 
 
index 18c8a26cd2db0b99d92945ff79d24ab2aee016a6..ea046177d4eec19beaa9e45889ff0a63550b3f05 100644 (file)
@@ -854,6 +854,8 @@ VISU_GaussPtsAct
        anInteractor->SetDolly(aDollyWas);
        anInteractor->SetNumberOfFlyFrames(aNumberOfFlyFramesWas);
        
+       anInteractor->InvokeEvent(SVTK::ChangeRotationPoint, aNodeCoord);
+
        mySelectionMode = aSelectionMode;
 
        ChangeZoom(myPickingSettings,
index 7a07a67685d4bfe9e7f3fd71e47a9688499f0658..100ad4b0baba789f58b5c13244c80fe17ba7b46e 100644 (file)
 #include "VISU_VectorsPL.hxx"
 #include "VISU_StreamLinesPL.hxx"
 #include "VISU_GaussPointsPL.hxx"
+#include "VISU_ScalarMapOnDeformedShapePL.hxx"
 #include "VISU_Plot3DPL.hxx"
 #include "VISU_ScalarBarActor.hxx"
 
 #include "VISU_Convertor.hxx"
 #include "VISU_ConvertorUtils.hxx"
 
-typedef VISU_ScalarMapPL TPresent;
+typedef VISU_ScalarMapOnDeformedShapePL TPresent;
 
 #include <vtkUnstructuredGrid.h>
 #include <vtkDataSetMapper.h>
@@ -133,10 +134,17 @@ CreateColoredPL(VISU_Convertor* theConvertor,
                                     theFieldName,
                                     theTimeStampNumber);
   aPresent->SetUnstructuredGridIDMapper(anUnstructuredGridIDMapper);
+
   //aPresent->ClearGeometry();
   //{
   //  VISU::PUnstructuredGridIDMapper anIDMapper = 
   //    theConvertor->GetMeshOnGroup(theMeshName,
+  //                              "groupe1");
+  //  aPresent->AddGeometry(anIDMapper->GetOutput());
+  //}
+  //{
+  //  VISU::PUnstructuredGridIDMapper anIDMapper = 
+  //    theConvertor->GetMeshOnGroup(theMeshName,
   //                              "TUBEH                                                                           ");
   //  aPresent->AddGeometry(anIDMapper->GetOutput());
   //}
@@ -146,6 +154,7 @@ CreateColoredPL(VISU_Convertor* theConvertor,
   //                              "STRI                                                                            ");
   //  aPresent->AddGeometry(anIDMapper->GetOutput());
   //}
+  aPresent->Update();
   return aPresent;
 }
 
index d58cfb934c23c5ceba99f2382a736761ee477406..2020ef0644aeca1149b843a893ad28e6729d52ac 100644 (file)
@@ -28,6 +28,7 @@
 
 #include "VISU_ColoredPL.hxx"
 #include "VISU_Extractor.hxx"
+#include "VISU_FieldTransform.hxx"
 #include "VISU_LookupTable.hxx"
 #include "VISU_MapperHolder.hxx"
 
@@ -88,25 +89,42 @@ VISU_ColoredPL
   return myExtractor->GetScalarMode();
 }
 
+
+//----------------------------------------------------------------------------
 void
 VISU_ColoredPL
-::SetScalarMode(int theScalarMode)
+::SetScalarMode(int theScalarMode,
+               vtkDataSet *theInput,
+               VISU_Extractor* theExtractor)
 {
-  if(vtkDataSet *anInput = GetInput()){
-    if(VISU::IsDataOnPoints(anInput)){
-      vtkPointData *aPointData = anInput->GetPointData();
-      if(!aPointData->GetAttribute(vtkDataSetAttributes::VECTORS))
-       if(theScalarMode == 0)
+  if(theInput){
+    if(VISU::IsDataOnPoints(theInput)){
+      vtkPointData *aPointData = theInput->GetPointData();
+      if(!aPointData->GetAttribute(vtkDataSetAttributes::VECTORS)) {
+       if(theScalarMode == 0){
          return;
-    }else{
-      vtkCellData *aCellData = anInput->GetCellData();
-      if(!aCellData->GetAttribute(vtkDataSetAttributes::VECTORS))
-       if(theScalarMode == 0)
+       }
+      }
+    } else {
+      vtkCellData *aCellData = theInput->GetCellData();
+      if(!aCellData->GetAttribute(vtkDataSetAttributes::VECTORS)){
+       if(theScalarMode==0){
          return;
+       }
+      }
     }
   }
 
-  myExtractor->SetScalarMode(theScalarMode);
+  theExtractor->SetScalarMode(theScalarMode);
+}
+
+
+//----------------------------------------------------------------------------
+void
+VISU_ColoredPL
+::SetScalarMode(int theScalarMode)
+{
+  SetScalarMode(theScalarMode, GetInput(), myExtractor);
 }
 
 
@@ -132,7 +150,11 @@ void
 VISU_ColoredPL
 ::SetScaling(int theScaling) 
 {
+  if(GetScaling() == theScaling)
+    return;
+
   myBarTable->SetScale(theScaling);
+
   if(theScaling == VTK_SCALE_LOG10)
     myFieldTransform->SetScalarTransform(&(VISU_FieldTransform::Log10));
   else
@@ -174,10 +196,12 @@ VISU_ColoredPL
 }
 
 //----------------------------------------------------------------------------
-vtkDataSet* 
+vtkPointSet* 
 VISU_ColoredPL
-::InsertCustomPL()
+::GetClippedInput()
 {
+  if(GetFieldTransformFilter()->GetInput())
+    GetFieldTransformFilter()->Update();
   return GetFieldTransformFilter()->GetUnstructuredGridOutput();
 }
 
@@ -187,7 +211,7 @@ void
 VISU_ColoredPL
 ::Build() 
 {
-  myExtractor->SetInput(GetClippedInput());
+  myExtractor->SetInput(Superclass::GetClippedInput());
   myFieldTransform->SetInput(myExtractor->GetOutput());
 
   GetMapperHolder()->SetLookupTable(GetMapperTable());
@@ -202,7 +226,7 @@ void
 VISU_ColoredPL
 ::Update() 
 { 
-  vtkFloatingPointType *aRange = myFieldTransform->GetScalarRange();
+  vtkFloatingPointType *aRange = GetScalarRange();
   vtkFloatingPointType aScalarRange[2] = {aRange[0], aRange[1]};
   if(myBarTable->GetScale() == VTK_SCALE_LOG10)
     VISU_LookupTable::ComputeLogRange(aRange,aScalarRange);
index e8a9f02f54037c8113fc1298ff670bd24ed8c1a5..bb683e0e949a6233447fe3efccc9ad6836bac756 100644 (file)
@@ -142,8 +142,15 @@ protected:
 
   //----------------------------------------------------------------------------
   virtual 
-  vtkDataSet* 
-  InsertCustomPL();
+  vtkPointSet* 
+  GetClippedInput();
+
+  //----------------------------------------------------------------------------
+  static
+  void
+  SetScalarMode(int theScalarMode,
+               vtkDataSet *theInput,
+               VISU_Extractor* theExtractor);
 
 private:
   vtkSmartPointer<VISU_LookupTable> myMapperTable;
index 0d3487ee2cefc3c37dd508e76309da6faf0ab317..7727e4c507330f0302f0612bc239ad10d56a8ee7 100644 (file)
@@ -25,6 +25,7 @@
 
 
 #include "VISU_CutLinesPL.hxx"
+#include "VISU_FieldTransform.hxx"
 #include "VISU_PipeLineUtils.hxx"
 #include "VTKViewer_GeometryFilter.h"
 
@@ -103,7 +104,7 @@ VISU_CutLinesPL
   vtkFloatingPointType aPosition = myPosition;
   if(myCondition){
       vtkFloatingPointType aBounds[6];
-      GetClippedInput()->GetBounds(aBounds);
+      GetMergedInput()->GetBounds(aBounds);
 
       vtkFloatingPointType aDir[3];
       GetDir(aDir,
@@ -153,16 +154,16 @@ VISU_CutLinesPL
 
   //Build base plane
   vtkFloatingPointType aBaseBounds[6];
-  GetClippedInput()->GetBounds(aBaseBounds);
+  GetMergedInput()->GetBounds(aBaseBounds);
 
   vtkFloatingPointType aDir[2][3];
   GetDir(aDir[0],
         myAng[0],
         myBasePlane[0]);
 
-  vtkUnstructuredGrid* aGrid = GetFieldTransformFilter()->GetUnstructuredGridOutput();
   CutWithPlanes(anAppendPolyData,
-               aGrid,1,
+               GetMergedInput(),
+               1,
                aDir[0],
                aBaseBounds,
                myPosition,
@@ -173,7 +174,7 @@ VISU_CutLinesPL
   aDataSet->Update();
 
   if(aDataSet->GetNumberOfCells() == 0)
-    aDataSet = aGrid;
+    aDataSet = GetMergedInput();
 
   vtkFloatingPointType aBounds[6];
   aDataSet->GetBounds(aBounds);
@@ -190,6 +191,10 @@ VISU_CutLinesPL
                                  myPartPosition,
                                  myPartCondition,
                                  myDisplacement[1]);
+  //{
+  //  std::string aFileName = std::string(getenv("HOME"))+"/"+getenv("USER")+"-myAppendPolyData.vtk";
+  //  VISU::WriteToFile(myAppendPolyData->GetOutput(), aFileName);
+  //}
   anAppendPolyData->Delete();
 
   //Calculate values for building of table
index 1c238bcbbf7134837fd3e7a73bf36d21c9dc7b78..431080eeb0b09436c5158e861e3b474fd08289d7 100644 (file)
@@ -26,6 +26,7 @@
 
 
 #include "VISU_CutPlanesPL.hxx"
+#include "VISU_FieldTransform.hxx"
 #include "VISU_PipeLineUtils.hxx"
 #include "VTKViewer_GeometryFilter.h"
 
@@ -131,11 +132,10 @@ VISU_CutPlanesPL
         myBasePlane[0]);
 
   vtkFloatingPointType aBounds[6];
-  GetClippedInput()->GetBounds(aBounds);
+  GetMergedInput()->GetBounds(aBounds);
 
-  vtkDataSet* aDataSet = GetFieldTransformFilter()->GetUnstructuredGridOutput();
   CutWithPlanes(myAppendPolyData,
-               aDataSet,
+               GetMergedInput(),
                myNbParts,
                aDir,
                aBounds,
@@ -382,7 +382,7 @@ VISU_CutPlanesPL
   vtkFloatingPointType aPosition = myPartPosition[thePartNumber];
   if(myPartCondition[thePartNumber]){
       vtkFloatingPointType aDir[3], aBounds[6], aBoundPrj[3];
-      GetClippedInput()->GetBounds(aBounds);
+      GetMergedInput()->GetBounds(aBounds);
 
       GetDir(aDir,
             myAng[theNum],
index 7ead8b3792641ab0960505d8244c678206ee85f0..313c6d683595e6f37b4d510adecc54123e2f4434 100644 (file)
@@ -144,13 +144,13 @@ VISU_DataSetMapperHolder
 
 
 //----------------------------------------------------------------------------
-vtkDataSet* 
+vtkPointSet* 
 VISU_DataSetMapperHolder
 ::GetClippedInput()
 {
-  vtkUnstructuredGrid* aDataSet = myExtractGeometry->GetOutput();
-  aDataSet->Update();
-  return aDataSet;
+  if(myExtractGeometry->GetInput())
+    myExtractGeometry->Update();
+  return myExtractGeometry->GetOutput();
 }
 
 
index a53749f6e8d6703ec73fb450915af147e8eb6a4c..45fa07fe6d703347cb8f0a29d564f2ca1bc360a0 100644 (file)
@@ -152,7 +152,7 @@ protected:
   SetLookupTable(VISU_LookupTable* theLookupTable);
 
   virtual
-  vtkDataSet* 
+  vtkPointSet* 
   GetClippedInput();
 
 private:
index 6d45630ac48d45e7cc06890d10ac8ea6a7d90e34..168963929994af3d2212a1be2a419aa421110fde 100644 (file)
@@ -100,6 +100,24 @@ VISU_DeformedShapePL
 }
 
 
+//----------------------------------------------------------------------------
+vtkFloatingPointType
+VISU_DeformedShapePL
+::GetDefaultScale(VISU_ScalarMapPL* theScalarMapPL)
+{
+  vtkFloatingPointType aSourceRange[2];
+  theScalarMapPL->GetSourceRange(aSourceRange);
+  
+  static vtkFloatingPointType EPS = 1.0 / VTK_LARGE_FLOAT;
+  if(fabs(aSourceRange[1]) > EPS){
+    vtkDataSet* aDataSet = theScalarMapPL->GetMergedInput();
+    vtkFloatingPointType aScaleFactor = VISU_DeformedShapePL::GetScaleFactor(aDataSet);
+    return aScaleFactor / aSourceRange[1];
+  }
+  return 0.0;
+}
+
+
 //----------------------------------------------------------------------------
 void
 VISU_DeformedShapePL
@@ -129,17 +147,20 @@ VISU_DeformedShapePL
 {
   Superclass::Init();
 
-  vtkFloatingPointType aScalarRange[2];
-  GetSourceRange(aScalarRange);
+  SetScale(VISU_DeformedShapePL::GetDefaultScale(this));
+}
 
-  vtkDataSet* aDataSet = GetClippedInput();
-  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);
+//----------------------------------------------------------------------------
+void
+VISU_DeformedShapePL
+::Update()
+{
+  Superclass::Update();
+  //{
+  //  std::string aFileName = std::string(getenv("HOME"))+"/"+getenv("USER")+"-myWarpVector.vtk";
+  //  VISU::WriteToFile(myWarpVector->GetUnstructuredGridOutput(), aFileName);
+  //}
 }
 
 
@@ -150,8 +171,8 @@ VISU_DeformedShapePL
 {
   VISU::CellDataToPoint(myWarpVector,
                        myCellDataToPointData,
-                       GetClippedInput(),
-                       GetFieldTransformFilter());
+                       GetMergedInput());
+
   return myWarpVector->GetOutput();
 }
 
index 2550a34008c01326c27000856cdaf5e718f4bae4..e09b4cf78a19499b21685b344c0b6a78abfed65c 100644 (file)
@@ -57,6 +57,10 @@ public:
   void
   Init();
 
+  virtual
+  void
+  Update();
+
   //! Gets memory size used by the instance (bytes).
   virtual
   unsigned long int
@@ -70,6 +74,10 @@ public:
   vtkFloatingPointType
   GetScaleFactor(vtkDataSet* theDataSet);
 
+  static
+  vtkFloatingPointType 
+  GetDefaultScale(VISU_ScalarMapPL* theScalarMapPL);
+  
 protected:
   VISU_DeformedShapePL();
   VISU_DeformedShapePL(const VISU_DeformedShapePL&);
index d96e2f7159f80c31f5c7e985aa8a618f5dd2731e..e44145e30dccbdaaa385401558b0beab5ad32c2a 100644 (file)
@@ -168,41 +168,28 @@ VISU_Extractor
              vtkInformationVector **theInputVector,
              vtkInformationVector *theOutputVector)
 {
-  vtkDataSet *input = VISU::GetInput(theInputVector, 0);
-  vtkDataSet *output = VISU::GetOutput(theOutputVector);
-
-  output->CopyStructure(input);
-  if(VISU::IsDataOnPoints(input)){
-    output->GetPointData()->CopyVectorsOn();
-    output->GetPointData()->CopyScalarsOff();
-
-    vtkIdType aNbOfTuples = input->GetNumberOfPoints();
-    vtkPointData *inData = input->GetPointData(), *outData = output->GetPointData();
-    if(inData->GetAttribute(vtkDataSetAttributes::VECTORS))
-      ExecuteScalars(aNbOfTuples, myScalarMode, inData, outData);
-    else
-      output->GetPointData()->CopyScalarsOn();
-    outData->PassData(inData);
-    outData->AddArray(inData->GetArray("VISU_FIELD"));
-  }else{
-    output->GetCellData()->CopyVectorsOn();
-    output->GetCellData()->CopyScalarsOff();
-
-    vtkIdType aNbOfTuples = input->GetNumberOfCells();
-    vtkCellData *inData = input->GetCellData(), *outData = output->GetCellData();
-    if(inData->GetAttribute(vtkDataSetAttributes::VECTORS))
-      ExecuteScalars(aNbOfTuples, myScalarMode, inData, outData);
-    else
-      output->GetCellData()->CopyScalarsOn();
-    outData->PassData(inData);
-    outData->AddArray(inData->GetArray("VISU_FIELD"));
+  vtkDataSet *anInput = VISU::GetInput(theInputVector, 0);
+  vtkDataSet *anOutput = VISU::GetOutput(theOutputVector);
+
+  anOutput->CopyStructure(anInput);
+
+  vtkPointData *anInputPointData = anInput->GetPointData();
+  vtkPointData *anOutputPointData = anOutput->GetPointData();
+  anOutputPointData->PassData(anInputPointData); 
+  if(VISU::IsDataOnPoints(anInput)){
+    int aNbElems = anInput->GetNumberOfPoints();
+    if(anInputPointData->GetAttribute(vtkDataSetAttributes::VECTORS))
+      ExecuteScalars(aNbElems, myScalarMode, anInputPointData, anOutputPointData);
+  }
+  
+  vtkCellData *anInputCellData = anInput->GetCellData();
+  vtkCellData *anOutputCellData = anOutput->GetCellData();
+  anOutputCellData->PassData(anInputCellData); 
+  if(VISU::IsDataOnCells(anInput)){
+    int aNbElems = anInput->GetNumberOfCells();
+    if(anInputCellData->GetAttribute(vtkDataSetAttributes::VECTORS))
+      ExecuteScalars(aNbElems, myScalarMode, anInputCellData, anOutputCellData);
   }
-
-  if(vtkDataArray *aDataArray = input->GetCellData()->GetArray("VISU_CELLS_MAPPER"))
-    output->GetCellData()->AddArray(aDataArray);
-
-  if(vtkDataArray *aDataArray = input->GetPointData()->GetArray("VISU_POINTS_MAPPER"))
-    output->GetPointData()->AddArray(aDataArray);
 
   return 1;
 }
index ebba6c1c8876246660d45f57b679568c2b383aec..7816f8efed11371c8e0f525a566acad4120c6f7f 100644 (file)
@@ -22,6 +22,7 @@
 
 #include "VISU_FieldTransform.hxx"
 #include "VTKViewer_Transform.h"
+#include "VISU_PipeLineUtils.hxx"
 
 #include <vtkObjectFactory.h>
 #include <vtkPointData.h>
@@ -127,10 +128,7 @@ void
 VISU_FieldTransform
 ::SetScalarRange(vtkFloatingPointType theScalarRange[2]) 
 {
-  vtkFloatingPointType aDelta = 
-    fabs(myScalarRange[0] - theScalarRange[0]) + 
-    fabs(myScalarRange[1] - theScalarRange[1]);
-  if(aDelta < Tolerance)
+  if(VISU::CheckIsSameRange(theScalarRange, myScalarRange))
     return;
 
   myScalarRange[0] = theScalarRange[0];
index 982ee719eb4f0826480a1353ef979db01d356ef4..1d8bcbe5915d0c71b4d878480885ae699ab79ff0 100644 (file)
@@ -30,6 +30,7 @@
 #include "VISU_PointSpriteMapperHolder.hxx"
 #include "VISU_OpenGLPointSpriteMapper.hxx"
 #include "VISU_DeformedShapePL.hxx"
+#include "VISU_FieldTransform.hxx"
 #include "VISU_LookupTable.hxx"
 
 #include "VISU_PipeLineUtils.hxx"
index 950330c2330465140f3667c32dc3c3cd1ade7976..aaf427b7d0344ce1da49751cb5744bd1476355ee 100644 (file)
@@ -156,25 +156,25 @@ VISU_IsoSurfacesPL
 }
 
 //----------------------------------------------------------------------------
-
-vtkDataSet* 
+void
 VISU_IsoSurfacesPL
-::InsertCustomPL()
+::Build()
 {
+  Superclass::Build();
+
   VISU::CellDataToPoint(myContourFilter,
                        myCellDataToPointData,
-                       GetClippedInput(),
-                       GetFieldTransformFilter());
-  return myContourFilter->GetOutput();
+                       GetMergedInput());
 }
 
 
 //----------------------------------------------------------------------------
-void
+
+vtkDataSet* 
 VISU_IsoSurfacesPL
-::Update()
+::InsertCustomPL()
 {
-  Superclass::Update();
+  return myContourFilter->GetOutput();
 }
 
 
index 8dd9f41d09d893b3412a6eb8d95d07ebaeecf952..d53aeb3545bce0da0fc39d6a25c8c68952ae9f91 100644 (file)
@@ -75,7 +75,7 @@ public:
 
   virtual
   void
-  Update();
+  Build();
 
   //! Gets memory size used by the instance (bytes).
   virtual
index 857daad939baccaf332e084d148a805fb09a70e1..dc0254997046c48a7c29e606896c146caa074c7e 100644 (file)
@@ -124,6 +124,9 @@ void
 VISU_MapperHolder
 ::SetIDMapper(const VISU::PIDMapper& theIDMapper)
 {
+  if(myIDMapper == theIDMapper)
+    return;
+
   myIDMapper = theIDMapper;
 
   if(myPipeLine && GetInput())
index 22ea018a59eed0133460a7af554fc1eef52d90f4..756abdeed99bba7a2990864f94bf774978cab4da 100644 (file)
@@ -145,7 +145,7 @@ public:
   SetLookupTable(VISU_LookupTable* theLookupTable) = 0;
 
   virtual
-  vtkDataSet* 
+  vtkPointSet* 
   GetClippedInput() = 0;
 
   //----------------------------------------------------------------------------
index 0df2f53e59542d34d957b0de075121ec72845951..5622c0ed778e117ccebfd90d1672f91b847743b3 100644 (file)
@@ -28,7 +28,6 @@
 #define VISU_PipeLineUtils_HeaderFile
 
 #include "VISUPipeline.hxx"
-#include "VISU_FieldTransform.hxx"
 #include "VISU_ConvertorUtils.hxx"
 
 #include <vtkProperty.h>
@@ -74,39 +73,37 @@ namespace VISU
 
 
   //----------------------------------------------------------------------------
-  template<class TEndFilter> 
+  template<class TOutputFilter> 
   void
-  CellDataToPoint(TEndFilter* theEndFilter, 
-                 vtkCellDataToPointData *theFilter,
-                 vtkDataSet* theDataSet,
-                 VISU_FieldTransform *theFieldTransform)
+  CellDataToPoint(TOutputFilter* theOutputFilter, 
+                 vtkCellDataToPointData *theCellDataToPointData,
+                 vtkDataSet* theDataSet)
+
   {
     if(VISU::IsDataOnCells(theDataSet)){
-      theFilter->SetInput(theFieldTransform->GetUnstructuredGridOutput());
-      theFilter->PassCellDataOn();
-      theEndFilter->SetInput(theFilter->GetUnstructuredGridOutput());
+      theCellDataToPointData->SetInput(theDataSet);
+      theCellDataToPointData->PassCellDataOn();
+      theOutputFilter->SetInput(theCellDataToPointData->GetUnstructuredGridOutput());
     }else
-      theEndFilter->SetInput(theFieldTransform->GetUnstructuredGridOutput());
+      theOutputFilter->SetInput(theDataSet);
   }
 
-
   //----------------------------------------------------------------------------
-  template<class TEndFilter> 
+  template<class TOutputFilter> 
   void
-  ToCellCenters(TEndFilter* theEndFilter, 
-               vtkCellCenters *theFilter,
-               vtkDataSet* theDataSet,
-               VISU_FieldTransform *theFieldTransform)
+  ToCellCenters(TOutputFilter* theOutputFilter, 
+               vtkCellCenters *theCellCenters,
+               vtkDataSet* theDataSet)
+
   {
     if(VISU::IsDataOnCells(theDataSet)){
-      theFilter->SetInput(theFieldTransform->GetUnstructuredGridOutput());
-      theFilter->VertexCellsOn();
-      theEndFilter->SetInput(theFilter->GetOutput());
+      theCellCenters->SetInput(theDataSet);
+      theCellCenters->VertexCellsOn();
+      theOutputFilter->SetInput(theCellCenters->GetOutput());
     }else
-      theEndFilter->SetInput(theFieldTransform->GetUnstructuredGridOutput());
+      theOutputFilter->SetInput(theDataSet);
   }
 
-
   //----------------------------------------------------------------------------
   //! Checks whether the float values are the same or not
   bool
index 7f606c7bed49a0530925bf3a15c0eedf5c7177cd..5b26e979fc4ee9865aa3d6ca0921b2aeb7988e08 100644 (file)
@@ -159,8 +159,8 @@ VISU_Plot3DPL
 {
   Superclass::Init();
 
-  myOrientation = GetOrientation(GetClippedInput());
-  SetScaleFactor(GetScaleFactor(GetClippedInput()));
+  myOrientation = GetOrientation(GetMergedInput());
+  SetScaleFactor(GetScaleFactor(GetMergedInput()));
 }
 
 
@@ -184,13 +184,12 @@ VISU_Plot3DPL
 
   vtkPolyData* aPolyData = 0;
   vtkCutter *aCutPlane = 0;
-  vtkUnstructuredGrid* anUnstructuredGrid =
-    GetFieldTransformFilter()->GetUnstructuredGridOutput();
+  vtkDataSet* aDataSet = GetMergedInput();
 
   if ( !IsPlanarInput() )
   {
     aCutPlane = vtkCutter::New();
-    aCutPlane->SetInput(anUnstructuredGrid);
+    aCutPlane->SetInput(aDataSet);
 
     vtkPlane *aPlane = vtkPlane::New();
     aPlane->SetOrigin(anOrigin);
@@ -204,7 +203,7 @@ VISU_Plot3DPL
   }
 
   if ( !aPolyData || aPolyData->GetNumberOfCells() == 0 ) {
-    myGeometryFilter->SetInput(anUnstructuredGrid);
+    myGeometryFilter->SetInput(aDataSet);
     aPolyData = myGeometryFilter->GetOutput();
     aPolyData->Update();
   }
@@ -442,7 +441,7 @@ VISU_Plot3DPL
 
   if ( theCenterOrigine ) {
     // move theOrigin to the center of aBounds projections to the plane
-    GetClippedInput()->GetBounds(aBounds);
+    GetMergedInput()->GetBounds(aBounds);
     vtkFloatingPointType boundPoints[8][3] = {
       {aBounds[0],aBounds[2],aBounds[4]},
       {aBounds[1],aBounds[2],aBounds[4]},
index 2045f71293157bc0d44459c522b7209d921867a9..0b9cd22766a47430e96165a29f0e401554023c34 100644 (file)
@@ -144,13 +144,13 @@ VISU_PolyDataMapperHolder
 
 
 //----------------------------------------------------------------------------
-vtkDataSet* 
+vtkPointSet* 
 VISU_PolyDataMapperHolder
 ::GetClippedInput()
 {
-  vtkPolyData* aDataSet = myExtractPolyDataGeometry->GetOutput();
-  aDataSet->Update();
-  return aDataSet;
+  if(myExtractPolyDataGeometry->GetInput())
+    myExtractPolyDataGeometry->Update();
+  return myExtractPolyDataGeometry->GetOutput();
 }
 
 
index 077dd91c4d2560cb35877769b770b8c9110dfed8..dc9848eccc1ebfbd02123f08b4312d89b1f68482 100644 (file)
@@ -152,7 +152,7 @@ protected:
   SetLookupTable(VISU_LookupTable* theLookupTable);
 
   virtual
-  vtkDataSet* 
+  vtkPointSet* 
   GetClippedInput();
 
 private:
index db6a3cb3572c09dbb95dff9af1dbc9fa0d3fefac..65ece9556b7122f194011d396ba49ff0b8607998 100644 (file)
@@ -25,6 +25,7 @@
 // Module : VISU
 
 #include "VISU_ScalarMapOnDeformedShapePL.hxx"
+#include "VISU_FieldTransform.hxx"
 #include "VISU_Extractor.hxx"
 #include "VISU_LookupTable.hxx"
 #include "VISU_DeformedShapePL.hxx"
@@ -48,18 +49,23 @@ vtkStandardNewMacro(VISU_ScalarMapOnDeformedShapePL)
  * Constructor. Creating new instances of vtkWarpVector,vtkMergeFilter,vtkUnstructuredGrid
  * Where:
  * \li myDeformVectors is vtkWarpVector  - deformation vectors data
- * \li myMergeFilter   is vtkMergeFilter - merge filter.
+ * \li myScalarsMergeFilter   is vtkMergeFilter - merge filter.
  * Merge filter which unify the deformation and scalars
  * \li myScalars is vtk shared pointer to vtkUnstructuredGrid - scalars data
 */
 VISU_ScalarMapOnDeformedShapePL
-::VISU_ScalarMapOnDeformedShapePL()
+::VISU_ScalarMapOnDeformedShapePL():
+  myScaleFactor(0.0)
 {
-  SetIsShrinkable(true);
+  myWarpVector = vtkWarpVector::New();
+
+  myScalarsMergeFilter = VISU_MergeFilter::New();
+  myScalarsMergeFilter->SetMergingInputs(true);
+
+  myScalarsExtractor = VISU_Extractor::New();
+
+  myScalarsFieldTransform = VISU_FieldTransform::New();
 
-  myDeformVectors = vtkWarpVector::New();
-  myMergeFilter   = VISU_MergeFilter::New();
-  myExtractorScalars = VISU_Extractor::New();
   myCellDataToPointData = vtkCellDataToPointData::New();
 }
 
@@ -71,20 +77,14 @@ VISU_ScalarMapOnDeformedShapePL
 VISU_ScalarMapOnDeformedShapePL
 ::~VISU_ScalarMapOnDeformedShapePL()
 {
-  // commented: porting to vtk5.0
-  //  myDeformVectors->UnRegisterAllOutputs();
-  myDeformVectors->Delete();
+  myWarpVector->Delete();
 
-  // commented: porting to vtk5.0
-  //  myMergeFilter->UnRegisterAllOutputs();
-  myMergeFilter->Delete();
+  myScalarsMergeFilter->Delete();
   
-  // commented: porting to vtk5.0
-  //  myExtractorScalars->UnRegisterAllOutputs();
-  myExtractorScalars->Delete();
+  myScalarsExtractor->Delete();
+
+  myScalarsFieldTransform->Delete();
 
-  // commented: porting to vtk5.0
-  //  myCellDataToPointData->UnRegisterAllOutputs();
   myCellDataToPointData->Delete();
 }
 
@@ -96,22 +96,9 @@ void
 VISU_ScalarMapOnDeformedShapePL
 ::Init()
 {
-  if(GetScalars() == NULL) 
-    SetScalars(GetClippedInput());
-  
   Superclass::Init();
   
-  vtkFloatingPointType aScalarRange[2];
-  GetSourceRange(aScalarRange);
-
-  static double EPS = 1.0 / VTK_LARGE_FLOAT;
-  if(aScalarRange[1] > EPS)
-    SetScale(VISU_DeformedShapePL::GetScaleFactor(GetClippedInput()) / aScalarRange[1]);
-  else
-    SetScale(0.0);
-
-  GetMapper()->SetColorModeToMapScalars();
-  GetMapper()->ScalarVisibilityOn();
+  SetScale(VISU_DeformedShapePL::GetDefaultScale(this));
 }
 
 //----------------------------------------------------------------------------
@@ -123,21 +110,40 @@ void
 VISU_ScalarMapOnDeformedShapePL
 ::Build()
 {
-  VISU::CellDataToPoint(myDeformVectors,
+  Superclass::Build();
+}
+
+
+//----------------------------------------------------------------------------
+vtkDataSet* 
+VISU_ScalarMapOnDeformedShapePL
+::InsertCustomPL()
+{
+  GetMapper()->SetColorModeToMapScalars();
+  GetMapper()->ScalarVisibilityOn();
+
+  VISU::CellDataToPoint(myWarpVector,
                        myCellDataToPointData,
-                       GetClippedInput(),
-                       GetFieldTransformFilter());
+                       GetMergedInput());
   
+  myScalars = GetMergedInput();
+
+  UpdateScalars();
+
+  myScalarsFieldTransform->SetInput(myScalarsExtractor->GetOutput());
+
   // Sets geometry for merge filter
-  myMergeFilter->SetGeometry(myDeformVectors->GetUnstructuredGridOutput());
-  myMergeFilter->SetScalars(myExtractorScalars->GetOutput());
-  myMergeFilter->AddField("VISU_CELLS_MAPPER", myExtractorScalars->GetOutput());
-  myMergeFilter->Update();
+  myScalarsMergeFilter->SetGeometry(myWarpVector->GetUnstructuredGridOutput());
 
-  // Sets data to mapper
-  GetDataSetMapper()->SetInput(myMergeFilter->GetOutput());
+  vtkDataSet* aScalarsDataSet = myScalarsFieldTransform->GetOutput();
+  myScalarsMergeFilter->SetScalars(aScalarsDataSet);
+  myScalarsMergeFilter->AddField("VISU_CELLS_MAPPER", aScalarsDataSet);
+  myScalarsMergeFilter->AddField("VISU_POINTS_MAPPER", aScalarsDataSet);
+
+  return myScalarsMergeFilter->GetOutput();
 }
 
+
 //----------------------------------------------------------------------------
 /*!
  *  Update method
@@ -146,22 +152,21 @@ void
 VISU_ScalarMapOnDeformedShapePL
 ::Update()
 {
-  this->UpdateScalars();
-  
-  vtkFloatingPointType* aRange = GetScalarRange();
-  vtkFloatingPointType aScalarRange[2] = {aRange[0], aRange[1]};
-  
-  if(GetBarTable()->GetScale() == VTK_SCALE_LOG10)
-    VISU_LookupTable::ComputeLogRange(aRange,aScalarRange);
-  GetMapperTable()->SetRange(aScalarRange);
-
-  GetMapperTable()->Build();
-  GetBarTable()->Build();
-
-  GetMapper()->SetLookupTable(GetMapperTable());
-  GetMapper()->SetScalarRange(aScalarRange);
-  
-  VISU_PipeLine::Update();
+  Superclass::Update();
+
+  UpdateScalars();
+  //{
+  //  std::string aFileName = std::string(getenv("HOME"))+"/"+getenv("USER")+"-myScalarsExtractor.vtk";
+  //  VISU::WriteToFile(myScalarsExtractor->GetUnstructuredGridOutput(), aFileName);
+  //}
+  //{
+  //  std::string aFileName = std::string(getenv("HOME"))+"/"+getenv("USER")+"-myWarpVector.vtk";
+  //  VISU::WriteToFile(myWarpVector->GetUnstructuredGridOutput(), aFileName);
+  //}
+  //{
+  //  std::string aFileName = std::string(getenv("HOME"))+"/"+getenv("USER")+"-myScalarsMergeFilter.vtk";
+  //  VISU::WriteToFile(myScalarsMergeFilter->GetUnstructuredGridOutput(), aFileName);
+  //}
 }
 
 //----------------------------------------------------------------------------
@@ -171,13 +176,13 @@ VISU_ScalarMapOnDeformedShapePL
 {
   unsigned long int aSize = Superclass::GetMemorySize();
 
-  if(vtkDataSet* aDataSet = myDeformVectors->GetOutput())
+  if(vtkDataSet* aDataSet = myWarpVector->GetOutput())
     aSize += aDataSet->GetActualMemorySize() * 1024;
   
-  if(vtkDataSet* aDataSet = myExtractorScalars->GetOutput())
+  if(vtkDataSet* aDataSet = myScalarsExtractor->GetOutput())
     aSize += aDataSet->GetActualMemorySize() * 1024;
 
-  if(vtkDataSet* aDataSet = myMergeFilter->GetOutput())
+  if(vtkDataSet* aDataSet = myScalarsMergeFilter->GetOutput())
     aSize += aDataSet->GetActualMemorySize() * 1024;
 
   if(myCellDataToPointData->GetInput())
@@ -196,7 +201,13 @@ void
 VISU_ScalarMapOnDeformedShapePL
 ::UpdateScalars()
 {
-  myExtractorScalars->Update();
+  vtkDataSet* aScalars = GetScalars();
+  myScalarsExtractor->SetInput(aScalars);
+
+  if(VISU::IsDataOnCells(aScalars))
+    GetMapper()->SetScalarModeToUseCellData();
+  else
+    GetMapper()->SetScalarModeToUsePointData();
 }
 
 //----------------------------------------------------------------------------
@@ -227,22 +238,6 @@ VISU_ScalarMapOnDeformedShapePL
 ::SetScalars(vtkDataSet *theScalars)
 {
   myScalars = theScalars;
-  vtkCellData *aCellData = GetInput()->GetCellData();
-  bool anIsVectorsOnCells = aCellData->GetAttribute(vtkDataSetAttributes::VECTORS);
-
-  if(VISU::IsDataOnPoints(theScalars))
-    myExtractorScalars->SetInput(theScalars);
-  else if(VISU::IsDataOnCells(theScalars) && !anIsVectorsOnCells){
-    //Approximate cell data values to point data by vtkCellDataToPointData filter.
-    vtkCellDataToPointData* aCellDataToPointData = vtkCellDataToPointData::New();
-    aCellDataToPointData->SetInput(theScalars);
-    aCellDataToPointData->Update();
-    myExtractorScalars->SetInput(aCellDataToPointData->GetOutput());
-    aCellDataToPointData->Delete();
-  } else {
-    myExtractorScalars->SetInput(theScalars);
-  }
-  Update();
 }
 
 //----------------------------------------------------------------------------
@@ -267,7 +262,7 @@ VISU_ScalarMapOnDeformedShapePL
   if(VISU::CheckIsSameValue(myScaleFactor, theScale))
     return;
 
-  myDeformVectors->SetScaleFactor(myScaleFactor);
+  myWarpVector->SetScaleFactor(theScale);
   myScaleFactor = theScale;
 }
 
@@ -279,7 +274,7 @@ vtkFloatingPointType
 VISU_ScalarMapOnDeformedShapePL
 ::GetScale() 
 {
-  return myDeformVectors->GetScaleFactor();
+  return myWarpVector->GetScaleFactor();
 }
 
 //----------------------------------------------------------------------------
@@ -291,7 +286,7 @@ VISU_ScalarMapOnDeformedShapePL
 ::SetMapScale(vtkFloatingPointType theMapScale)
 {
   Superclass::SetMapScale(theMapScale);
-  myDeformVectors->SetScaleFactor(myScaleFactor*theMapScale);
+  myWarpVector->SetScaleFactor(myScaleFactor*theMapScale);
 }
 
 //----------------------------------------------------------------------------
@@ -302,7 +297,7 @@ int
 VISU_ScalarMapOnDeformedShapePL
 ::GetScalarMode()
 {
-  return myExtractorScalars->GetScalarMode();
+  return myScalarsExtractor->GetScalarMode();
 }
 
 //----------------------------------------------------------------------------
@@ -313,10 +308,48 @@ void
 VISU_ScalarMapOnDeformedShapePL
 ::SetScalarMode(int theScalarMode)
 {
-  myExtractorScalars->SetScalarMode(theScalarMode);
-  Modified();
+  VISU_ScalarMapPL::SetScalarMode(theScalarMode, GetScalars(), myScalarsExtractor);
 }
 
+//----------------------------------------------------------------------------
+void
+VISU_ScalarMapOnDeformedShapePL
+::SetScaling(int theScaling) 
+{
+  if(GetScaling() == theScaling)
+    return;
+
+  GetBarTable()->SetScale(theScaling);
+
+  if(theScaling == VTK_SCALE_LOG10)
+    myScalarsFieldTransform->SetScalarTransform(&(VISU_FieldTransform::Log10));
+  else
+    myScalarsFieldTransform->SetScalarTransform(&(VISU_FieldTransform::Ident));
+}
+
+
+//----------------------------------------------------------------------------
+void
+VISU_ScalarMapOnDeformedShapePL
+::SetScalarRange(vtkFloatingPointType theRange[2])
+{
+  if(VISU::CheckIsSameRange(theRange, GetScalarRange()))
+    return;
+
+  myScalarsFieldTransform->SetScalarRange(theRange);
+  GetBarTable()->SetRange(theRange);
+}
+
+
+//----------------------------------------------------------------------------
+vtkFloatingPointType* 
+VISU_ScalarMapOnDeformedShapePL
+::GetScalarRange() 
+{
+  return myScalarsFieldTransform->GetScalarRange();
+}
+
+
 //----------------------------------------------------------------------------
 /*!
  * Gets ranges of extracted scalars
@@ -328,6 +361,6 @@ void
 VISU_ScalarMapOnDeformedShapePL
 ::GetSourceRange(vtkFloatingPointType theRange[2])
 {
-  myExtractorScalars->Update();
-  myExtractorScalars->GetUnstructuredGridOutput()->GetScalarRange(theRange);
+  myScalarsExtractor->Update();
+  myScalarsExtractor->GetUnstructuredGridOutput()->GetScalarRange(theRange);
 }
index ee0688235e07c26adbe4966ce6c0b75650ffec25..041a37d21082088c2b5b983b7ecd669cb35c1b77 100644 (file)
@@ -63,6 +63,18 @@ public:
   void
   SetScalarMode(int theScalarMode = 0);
 
+  virtual
+  void
+  SetScaling(int theScaling);
+  
+  virtual
+  void
+  SetScalarRange(vtkFloatingPointType theRange[2]);
+
+  virtual
+  vtkFloatingPointType* 
+  GetScalarRange();
+
   virtual
   void
   GetSourceRange(vtkFloatingPointType theRange[2]);
@@ -110,19 +122,25 @@ protected:
   virtual
   ~VISU_ScalarMapOnDeformedShapePL();
   
-  VISU_ScalarMapOnDeformedShapePL(const VISU_ScalarMapOnDeformedShapePL&);
+  virtual
+  vtkDataSet* 
+  InsertCustomPL();
 
   virtual
   void
   DoShallowCopy(VISU_PipeLine *thePipeLine,
                bool theIsCopyInput);
 
+private:
+  VISU_ScalarMapOnDeformedShapePL(const VISU_ScalarMapOnDeformedShapePL&);
+
   vtkFloatingPointType myScaleFactor;
-  vtkWarpVector  *myDeformVectors;
-  VISU_MergeFilter *myMergeFilter;
-  vtkSmartPointer<vtkDataSet> myScalars;
-  VISU_Extractor* myExtractorScalars;
+  vtkWarpVector  *myWarpVector;
+  VISU_MergeFilter *myScalarsMergeFilter;
+  vtkSmartPointer<vtkUnstructuredGrid> myScalars;
   vtkCellDataToPointData* myCellDataToPointData;
+  VISU_FieldTransform* myScalarsFieldTransform;
+  VISU_Extractor* myScalarsExtractor;
 };
 
 #endif
index 8f5d375476a294d992032e8889ac5e4c8a92aec5..8faea8530e73bd8c793a8d13d10f6752e4692108 100644 (file)
@@ -85,10 +85,45 @@ VISU_ScalarMapPL
 {
   Superclass::Build();
 
+  SetSourceGeometry();
+
+  vtkPointSet* aDataSet = GetClippedInput();
+  myAppendFilter->SetSharedPointSet(aDataSet);
+
+  myMergeFilter->SetGeometry(myAppendFilter->GetOutput());
+  myMergeFilter->SetScalars(aDataSet);
+  myMergeFilter->SetVectors(aDataSet);
+
+  myMergeFilter->RemoveFields();
+  myMergeFilter->AddField("VISU_FIELD", aDataSet);
+  myMergeFilter->AddField("VISU_CELLS_MAPPER", aDataSet);
+  myMergeFilter->AddField("VISU_POINTS_MAPPER", aDataSet);
+
   GetDataSetMapper()->SetInput(InsertCustomPL());
 }
 
 
+//----------------------------------------------------------------------------
+void
+VISU_ScalarMapPL
+::Update() 
+{
+  Superclass::Update();
+  //{
+  //  std::string aFileName = std::string(getenv("HOME"))+"/"+getenv("USER")+"-aScalarsOutput.vtk";
+  //  VISU::WriteToFile(GetFieldTransformFilter()->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->GetUnstructuredGridOutput(), aFileName);
+  //}
+}
+
+
 //----------------------------------------------------------------------------
 void
 VISU_ScalarMapPL
@@ -117,7 +152,7 @@ VISU_ScalarMapPL
 {
   if(IsExternalGeometryUsed()){
     ClearGeometry();
-    myAppendFilter->AddInput(Superclass::InsertCustomPL());
+    myAppendFilter->AddInput(GetClippedInput());
   }
 }
 
@@ -155,8 +190,7 @@ bool
 VISU_ScalarMapPL
 ::IsExternalGeometryUsed()
 {
-  vtkDataObject* aDataObject = myAppendFilter->GetInput();
-  return aDataObject && aDataObject != Superclass::InsertCustomPL();
+  return myAppendFilter->GetInput() != GetClippedInput();
 }
 
 
@@ -174,19 +208,17 @@ vtkDataSet*
 VISU_ScalarMapPL
 ::InsertCustomPL()
 {
-  vtkDataSet* aDataSet = Superclass::InsertCustomPL();
-  myAppendFilter->AddInput(aDataSet);
-
-  vtkPointSet* aPointSet = GetDataSetMapperHolder()->GetUnstructuredGridInput();
-  myAppendFilter->SetSharedPointSet(aPointSet);
+  return GetMergedInput();
+}
 
-  myMergeFilter->SetGeometry(myAppendFilter->GetOutput());
-  myMergeFilter->SetScalars(aDataSet);
-  myMergeFilter->SetVectors(aDataSet);
-  myMergeFilter->AddField("VISU_FIELD", aDataSet);
-  myMergeFilter->AddField("VISU_CELLS_MAPPER", aDataSet);
-  myMergeFilter->AddField("VISU_POINTS_MAPPER", aDataSet);
 
+//----------------------------------------------------------------------------
+vtkDataSet* 
+VISU_ScalarMapPL
+::GetMergedInput()
+{
+  if(myMergeFilter->GetInput())
+    myMergeFilter->Update();
   return myMergeFilter->GetOutput();
 }
 
index 01c6ab668f6aa714074b8a1f751f9f123ff7c1c8..130207935d7990878e208c34fb1e289df8c9209c 100644 (file)
@@ -48,6 +48,10 @@ public:
   VISU_ScalarMapPL* 
   New();
 
+  virtual
+  void
+  Update();
+
   virtual
   void
   SetSourceGeometry();
@@ -71,6 +75,11 @@ public:
   void
   ClearGeometry();
 
+  //----------------------------------------------------------------------------
+  virtual 
+  vtkDataSet* 
+  GetMergedInput();
+
 protected:
   //----------------------------------------------------------------------------
   VISU_ScalarMapPL();
index bdcbbf094c66739c94e43c9dd2ad04056fb1d3d2..5eebee0b8b869db3082ff39af40c06ce82812049 100644 (file)
@@ -27,6 +27,7 @@
 
 #include "VISU_StreamLinesPL.hxx"
 #include "VISU_Extractor.hxx"
+#include "VISU_FieldTransform.hxx"
 #include "VISU_UsedPointsFilter.hxx"
 #include "VTKViewer_GeometryFilter.h"
 
@@ -186,10 +187,9 @@ VISU_StreamLinesPL
            vtkDataSet* theSource,
            vtkFloatingPointType thePercents,
            int theDirection,
-           int isOnlyTry)
+           int theIsOnlyTry)
 {
-  vtkDataSet* aDataSet = theSource? theSource: 
-    GetFieldTransformFilter()->GetUnstructuredGridOutput();
+  vtkDataSet* aDataSet = theSource? theSource: GetMergedInput();
   aDataSet->Update();
 
   vtkIdType aNbOfPoints = aDataSet->GetNumberOfPoints();
@@ -207,15 +207,15 @@ VISU_StreamLinesPL
   theStepLength = CorrectStepLength(theStepLength,
                                    aPointSet);
 
-  size_t isAccepted = FindPossibleParams(aPointSet,
-                                        theStepLength,
-                                        thePropogationTime,
-                                        thePercents);
+  size_t anIsAccepted = FindPossibleParams(aPointSet,
+                                          theStepLength,
+                                          thePropogationTime,
+                                          thePercents);
 
-  if((!isOnlyTry && isAccepted) || (isOnlyTry && isAccepted == 1)){
+  if((!theIsOnlyTry && anIsAccepted) || (theIsOnlyTry && anIsAccepted == 1)){
     mySource = theSource;
     myPercents = thePercents;
-    if(VISU::IsDataOnCells(GetClippedInput())){
+    if(VISU::IsDataOnCells(GetMergedInput())){
       myCenters->SetInput(aDataSet);
       myCenters->VertexCellsOn();
       aDataSet = myCenters->GetOutput();
@@ -232,7 +232,7 @@ VISU_StreamLinesPL
     myStream->Modified();
     Modified();
   }
-  return isAccepted;
+  return anIsAccepted;
 }
 
 
@@ -638,22 +638,26 @@ VISU_StreamLinesPL
 
 
 //----------------------------------------------------------------------------
-vtkDataSet* 
+void
 VISU_StreamLinesPL
-::InsertCustomPL()
+::Build()
 {
-  GetClippedInput()->Update();
+  Superclass::Build();
 
   VISU::CellDataToPoint(myStream,
                        myCellDataToPointData,
-                       GetClippedInput(),
-                       GetFieldTransformFilter());
+                       GetMergedInput());
 
-  vtkFloatingPointType *aBounds = GetClippedInput()->GetBounds();
-  myGeomFilter->SetExtent(aBounds);
-  myGeomFilter->ExtentClippingOn();
   myGeomFilter->SetInput(myStream->GetOutput());
+  myGeomFilter->ExtentClippingOn();
+}
+
 
+//----------------------------------------------------------------------------
+vtkDataSet* 
+VISU_StreamLinesPL
+::InsertCustomPL()
+{
   return myGeomFilter->GetOutput();
 }
 
@@ -665,7 +669,18 @@ VISU_StreamLinesPL
 {
   try{
     Superclass::Update();
+
+    vtkFloatingPointType aBounds[6];
+    GetMergedInput()->GetBounds(aBounds);
+    myGeomFilter->SetExtent(aBounds);
+    //{
+    //  std::string aFileName = std::string(getenv("HOME"))+"/"+getenv("USER")+"-myStream.vtk";
+    //  VISU::WriteToFile(myStream->GetOutput(), aFileName);
+    //}
+  }catch(std::exception& exc){
+    MSG(true, "Follow exception was occured :\n"<<exc.what());
   }catch(...){
+    MSG(MYDEBUG,"Unknown exception was occured\n");
   }
 }
 
index e673d7c755553aaf6c2f15ef2946b78cef9cc1d1..9411e34194c7af99582417bbab43430cdb1f485e 100644 (file)
@@ -126,6 +126,10 @@ public:
   void
   Init();
 
+  virtual
+  void
+  Build();
+
   virtual
   void
   Update();
index 66ad29faa82fbfbd29b4271eeffaaea4ba0cee61..f06301f62a2d6400e49b8cf755e3eb90ff55b925 100644 (file)
@@ -26,6 +26,7 @@
 
 
 #include "VISU_VectorsPL.hxx"
+#include "VISU_FieldTransform.hxx"
 #include "VISU_PipeLineUtils.hxx"
 #include "VTKViewer_TransformFilter.h"
 #include "VTKViewer_Transform.h"
@@ -190,39 +191,34 @@ VISU_VectorsPL
 
 
 //----------------------------------------------------------------------------
-vtkDataSet* 
+void
 VISU_VectorsPL
-::GetOutput()
+::Build()
 {
-  myBaseGlyph->Update();
-  return myBaseGlyph->GetOutput();
-}
+  Superclass::Build();
 
-
-//----------------------------------------------------------------------------
-vtkDataSet* 
-VISU_VectorsPL
-::InsertCustomPL()
-{
   VISU::ToCellCenters(myBaseGlyph,
                      myCenters,
-                     GetClippedInput(),
-                     GetFieldTransformFilter());
-
+                     GetMergedInput());
   myBaseGlyph->SetVectorModeToUseVector();
   myBaseGlyph->SetScaleModeToScaleByVector();
   myBaseGlyph->SetColorModeToColorByScalar();
 
   VISU::ToCellCenters(myTransformFilter,
                      myCenters,
-                     GetClippedInput(),
-                     GetFieldTransformFilter());
-
+                     GetMergedInput());
   myTransformedGlyph->SetInput(myTransformFilter->GetOutput());
   myTransformedGlyph->SetVectorModeToUseVector();
   myTransformedGlyph->SetScaleModeToScaleByVector();
   myTransformedGlyph->SetColorModeToColorByScalar();
+}
+
 
+//----------------------------------------------------------------------------
+vtkDataSet* 
+VISU_VectorsPL
+::InsertCustomPL()
+{
   return myTransformedGlyph->GetOutput();
 }
 
@@ -308,6 +304,16 @@ VISU_VectorsPL
 }
 
 
+//----------------------------------------------------------------------------
+vtkDataSet* 
+VISU_VectorsPL
+::GetOutput()
+{
+  myBaseGlyph->Update();
+  return myBaseGlyph->GetOutput();
+}
+
+
 //----------------------------------------------------------------------------
 void
 VISU_VectorsPL
index 9e480e68591a9cec4a083a7c8dc22e7ba491fabc..cbdcd300adee9757dcd67e8a3928b484ab13859d 100644 (file)
@@ -84,6 +84,10 @@ public:
   void
   Init();
 
+  virtual
+  void
+  Build();
+
   virtual
   void
   Update();
index 2836e8261c0f2fc0f4daab0996e21e68088107b0..f23dbd24a3815c04395ed60b934b15e9139ab7bd 100644 (file)
@@ -675,10 +675,10 @@ msgid "VisuGUI_ScalarMapOnDeformedShapeDlg::SCALE_FACTOR"
 msgstr "Scale Factor:"
 
 msgid "VisuGUI_ScalarMapOnDeformedShapeDlg::FIELD_ITEM"
-msgstr "Fields"
+msgstr "Scalar Field:"
 
 msgid "VisuGUI_ScalarMapOnDeformedShapeDlg::TIMESTAMP_ITEM"
-msgstr "Time stamp"
+msgstr "Current Time Stamp:"
 
 #: VisuGUI_EditContainerDlg.cxx
 
index 710582cafd75300206709239b0ba23ab5c1f0e56..0e74d23170e03ed836330c422c003b51a36fd7d2 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->GetPipeLine()->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->GetPipeLine();
+    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()