]> SALOME platform Git repositories - modules/visu.git/commitdiff
Salome HOME
Fix for issue 0020122: EDF 923 VISU : deformed shape on scalar map, Performance ...
authorouv <ouv@opencascade.com>
Thu, 22 Jan 2009 14:49:21 +0000 (14:49 +0000)
committerouv <ouv@opencascade.com>
Thu, 22 Jan 2009 14:49:21 +0000 (14:49 +0000)
src/PIPELINE/VISU_DeformedShapeAndScalarMapPL.cxx
src/PIPELINE/VISU_DeformedShapeAndScalarMapPL.hxx
src/PIPELINE/VISU_PipeLine.hxx
src/VISUGUI/VisuGUI_CacheDlg.cxx
src/VISUGUI/VisuGUI_Prs3dTools.h
src/VISU_I/VISU_ColoredPrs3dCache_i.cc

index 2165eb1c717bc6b534fbf05d9e97c76ae3e907c2..d52de6e4109cc49787a6d87e356b1a512ae36c28 100644 (file)
 #include "VISU_MergeFilter.hxx"
 #include "VISU_ElnoDisassembleFilter.hxx"
 #include "VISU_PipeLineUtils.hxx"
+#include "SALOME_ExtractGeometry.h"
 
+#include <vtkPlane.h>
 #include <vtkWarpVector.h>
+#include <vtkImplicitBoolean.h>
+#include <vtkImplicitFunction.h>
 #include <vtkUnstructuredGrid.h>
 #include <vtkCellDataToPointData.h>
 #include <vtkPointDataToCellData.h>
+#include <vtkImplicitFunctionCollection.h>
 
 
 //----------------------------------------------------------------------------
@@ -69,6 +74,12 @@ VISU_DeformedShapeAndScalarMapPL
 
   myCellDataToPointData = vtkCellDataToPointData::New();
   myScalarsElnoDisassembleFilter = VISU_ElnoDisassembleFilter::New();
+
+  vtkImplicitBoolean* anImplicitBoolean = vtkImplicitBoolean::New();
+  anImplicitBoolean->SetOperationTypeToIntersection();
+
+  myExtractGeometry = SALOME_ExtractGeometry::New();
+  myExtractGeometry->SetImplicitFunction(anImplicitBoolean);
 }
 
 //----------------------------------------------------------------------------
@@ -203,7 +214,8 @@ VISU_DeformedShapeAndScalarMapPL
 {
   vtkDataSet* aScalars = GetScalars();
   myScalarsElnoDisassembleFilter->SetInput(aScalars);
-  myScalarsExtractor->SetInput(myScalarsElnoDisassembleFilter->GetOutput());
+  myExtractGeometry->SetInput(myScalarsElnoDisassembleFilter->GetOutput());
+  myScalarsExtractor->SetInput(myExtractGeometry->GetOutput());
 
   if(VISU::IsDataOnCells(myScalarsElnoDisassembleFilter->GetOutput()))
     GetMapper()->SetScalarModeToUseCellData();
@@ -224,6 +236,7 @@ VISU_DeformedShapeAndScalarMapPL
   Superclass::DoShallowCopy(thePipeLine, theIsCopyInput);
 
   if(VISU_DeformedShapeAndScalarMapPL *aPipeLine = dynamic_cast<VISU_DeformedShapeAndScalarMapPL*>(thePipeLine)){
+     SetImplicitFunction(aPipeLine->GetImplicitFunction());
      SetScale(aPipeLine->GetScale());
      SetScalars(aPipeLine->GetScalars());
   }
@@ -256,6 +269,67 @@ VISU_DeformedShapeAndScalarMapPL
   return myScalars.GetPointer();
 }
 
+//----------------------------------------------------------------------------
+/*!
+ * Removes all clipping planes (for myScalars)
+ */
+void
+VISU_DeformedShapeAndScalarMapPL
+::RemoveAllClippingPlanes()
+{
+  if(vtkImplicitBoolean* aBoolean = myExtractGeometry->GetImplicitBoolean()){
+    vtkImplicitFunctionCollection* aFunction = aBoolean->GetFunction();
+    aFunction->RemoveAllItems();
+    aBoolean->Modified();
+  }
+  Superclass::RemoveAllClippingPlanes();
+}
+
+//----------------------------------------------------------------------------
+/*!
+ * Adds a clipping plane (for myScalars)
+ */
+bool 
+VISU_DeformedShapeAndScalarMapPL
+::AddClippingPlane(vtkPlane* thePlane)
+{
+  if (thePlane) {
+    if (vtkImplicitBoolean* aBoolean = myExtractGeometry->GetImplicitBoolean()) {
+      vtkImplicitFunctionCollection* aFunction = aBoolean->GetFunction();
+      aFunction->AddItem(thePlane);
+
+      // Check, that at least one cell present after clipping.
+      // This check was introduced because of bug IPAL8849.
+      vtkDataSet* aClippedDataSet = GetClippedInput();
+      if(aClippedDataSet->GetNumberOfCells() < 1)
+        return false;
+    }
+  }
+  return Superclass::AddClippingPlane(thePlane);
+}
+
+//----------------------------------------------------------------------------
+/*!
+ * Sets implicit function of clipping
+ */
+void
+VISU_DeformedShapeAndScalarMapPL
+::SetImplicitFunction(vtkImplicitFunction *theFunction)
+{
+  myExtractGeometry->SetImplicitFunction(theFunction);
+} 
+
+//----------------------------------------------------------------------------
+/*!
+ * Gets implicit function of clipping
+ */
+vtkImplicitFunction * 
+VISU_DeformedShapeAndScalarMapPL
+::GetImplicitFunction()
+{
+  return myExtractGeometry->GetImplicitFunction();
+}
+
 //----------------------------------------------------------------------------
 /*!
  * Sets scale for deformed shape
index 720b531ea5feb3ba81ecb08532388e652f594aad..7a9694020a16539028032bc8f009ef36a4d74612 100644 (file)
@@ -36,6 +36,8 @@ class vtkUnstructuredGrid;
 class vtkCellDataToPointData;
 class vtkPointDataToCellData;
 class VISU_ElnoDisassembleFilter;
+class SALOME_ExtractGeometry;
+class vtkImplicitFunction;
 
 
 //----------------------------------------------------------------------------
@@ -88,6 +90,22 @@ public:
   vtkDataSet* 
   GetScalars();
 
+  virtual
+  void 
+  RemoveAllClippingPlanes();
+
+  virtual
+  bool
+  AddClippingPlane(vtkPlane* thePlane);
+
+  virtual
+  void
+  SetImplicitFunction(vtkImplicitFunction *theFunction);
+
+  virtual
+  vtkImplicitFunction* 
+  GetImplicitFunction();
+
 public:
   //! Redefined method for initialization of the pipeline.
   virtual
@@ -144,6 +162,7 @@ private:
   VISU_FieldTransform* myScalarsFieldTransform;
   VISU_Extractor* myScalarsExtractor;
   VISU_ElnoDisassembleFilter* myScalarsElnoDisassembleFilter;
+  SALOME_ExtractGeometry* myExtractGeometry;
 };
 
 #endif
index 9bdc8a9a82d270922baf4ca183fe0df58c368a1c..14a5a1b8bf2a8e6a3269515cf53964d7d2337285 100644 (file)
@@ -146,13 +146,13 @@ public:
   SetExtractBoundaryCells(bool theMode);
 
   //----------------------------------------------------------------------------
-  void 
+  virtual void 
   RemoveAllClippingPlanes();
 
   vtkIdType
   GetNumberOfClippingPlanes();
 
-  bool
+  virtual bool
   AddClippingPlane(vtkPlane* thePlane);
 
   virtual
index ed5f0bfab55452ef3bc85a53451068aca0b68cdf..78d1a34dc93ab199857dcef7f6f848b58a6bac73 100644 (file)
@@ -66,7 +66,7 @@ VisuGUI_CacheDlg::VisuGUI_CacheDlg( VISU::ColoredPrs3dCache_var theCache,
   long aMb = 1024 * 1024;
   bool isLimitedMemory = myCache->GetMemoryMode() == VISU::ColoredPrs3dCache::LIMITED;
   double aLimitedMemory = myCache->GetLimitedMemory();
-  double aFreeMemory = (double)VISU_PipeLine::GetAvailableMemory( 2048 * aMb ) / (double)aMb;
+  double aFreeMemory = (double)VISU_PipeLine::GetAvailableMemory( 8192 * aMb ) / (double)aMb;
   double anUsedMemory = myCache->GetMemorySize();
   double aLimitedMemoryMax = 
 #ifdef WNT
index 305a9898b03fe8ada0c2e45f0b1e6c69d5642294..8e7aafdfb71b37f08909cfee28d41f851cbcf8e2 100644 (file)
@@ -144,7 +144,7 @@ namespace VISU
        if( anEnlargeType == VISU::ColoredPrs3dCache::IMPOSSIBLE )
        {
          size_t aMb = 1024 * 1024;
-         double aFreeMemory = double(VISU_PipeLine::GetAvailableMemory(2048*aMb)) / double(aMb);
+         double aFreeMemory = double(VISU_PipeLine::GetAvailableMemory(8192*aMb)) / double(aMb);
 
          CORBA::Float aNecessaryMemory = aRequiredMemory - aFreeMemory - anUsedMemory;
          SUIT_MessageBox::warn1(GetDesktop(theModule),
index 534c49a57f82df3de83e64b365dd6add25b92e4b..bc7cb43d027ec98bfac0ce225711f8d30a32fe99 100644 (file)
@@ -349,7 +349,7 @@ VISU::ColoredPrs3dCache_i
       theRequiredMemory = int( aMemoryUsed + aMemoryNeeded ) + 1;
 
       size_t aMb = 1024 * 1024;
-      double aFreeMemory = double(VISU_PipeLine::GetAvailableMemory(2048*aMb)) / double(aMb);
+      double aFreeMemory = double(VISU_PipeLine::GetAvailableMemory(8192*aMb)) / double(aMb);
       anEnlargeType = aMemoryNeeded < aFreeMemory ?
        VISU::ColoredPrs3dCache::ENLARGE : VISU::ColoredPrs3dCache::IMPOSSIBLE;
     }
@@ -444,7 +444,7 @@ VISU::ColoredPrs3dCache_i
     return;
 
   size_t aMb = 1024 * 1024;
-  double aFreeMemory = double(VISU_PipeLine::GetAvailableMemory(2048*aMb)) / double(aMb);
+  double aFreeMemory = double(VISU_PipeLine::GetAvailableMemory(8192*aMb)) / double(aMb);
   CORBA::Float aMemoryUsed = GetDeviceMemorySize();
   CORBA::Float aMemoryNeeded = theMemorySize - aMemoryUsed;
   if( aMemoryNeeded > aFreeMemory )