]> SALOME platform Git repositories - modules/visu.git/commitdiff
Salome HOME
Issue 0020901: [CEA 409] Slowness with Streamlines generation V5_1_main_20100609 before_mergefrom_V5_1_4_BR_09Jun10
authorouv <ouv@opencascade.com>
Mon, 7 Jun 2010 09:33:40 +0000 (09:33 +0000)
committerouv <ouv@opencascade.com>
Mon, 7 Jun 2010 09:33:40 +0000 (09:33 +0000)
Point 1 - preference for default value of "Used points" parameter

resources/SalomeApp.xml
src/PIPELINE/VISU_StreamLinesPL.cxx
src/PIPELINE/VISU_StreamLinesPL.hxx
src/VISUGUI/VISU_msg_en.ts
src/VISUGUI/VisuGUI.cxx

index 74dc330c6fcf9cc17a631ce73948ca99b0e8e0f1..cf894dfcc7235fa17130da753128b892fd376379 100644 (file)
     <parameter name="scalar_bar_active_local"    value="0"/>
     <parameter name="scalar_bar_bicolor"         value="1"/>
     <parameter name="scalar_bar_spacing"         value="0.01"/>
+    <parameter name="stream_lines_used_points"   value="0.01"/>
     <parameter name="sweeping_number_cycles" value="1"   />
     <parameter name="sweeping_number_steps"  value="20"  />
     <parameter name="sweeping_time_step"     value="0.2" />
index 6eb70ecc4dd8e6a5286217264ce7231eebd1ff7d..a23956c23ebe973ff162d805610d80cc7177fafa 100644 (file)
@@ -36,6 +36,9 @@
 
 #include "VTKViewer_GeometryFilter.h"
 
+#include <SUIT_Session.h>
+#include <SUIT_ResourceMgr.h>
+
 #include <algorithm>
 
 #include <vtkCell.h>
@@ -68,8 +71,9 @@ VISU_StreamLinesPL
   myCenters = vtkCellCenters::New();
   myGeomFilter = VTKViewer_GeometryFilter::New();
   myPointsFilter = VISU_MaskPointsFilter::New();
-  myPercents = 0.3;
   mySource = NULL;
+
+  myPercents = GetUsedPointsDefault();
 }
 
 
@@ -173,7 +177,7 @@ VISU_StreamLinesPL
   size_t anIsPossible = CheckAvailableMemory(aSize);
   if(!anIsPossible){
     vtkFloatingPointType aMaxStepLength = std::max(GetMaxStepLength(theDataSet),thePropogationTime);
-    vtkFloatingPointType aMinStepLength = GetMinStepLength(theDataSet);
+    vtkFloatingPointType aMinStepLength = GetMinStepLength(theDataSet,thePercents);
     vtkFloatingPointType aDeltaStepLength = (aMaxStepLength - aMinStepLength)/aStepLengthIncrease;
     for(int i = 2, aStepChanged = 1, aPerecentsChanged = 1; aStepChanged || aPerecentsChanged; i++){
       vtkFloatingPointType aStepLength = theStepLength + aDeltaStepLength;
@@ -223,10 +227,12 @@ VISU_StreamLinesPL
                                       thePercents);
 
   thePropogationTime = CorrectPropagationTime(thePropogationTime,
-                                              aPointSet);
+                                              aPointSet,
+                                              thePercents);
 
   theStepLength = CorrectStepLength(theStepLength,
-                                    aPointSet);
+                                    aPointSet,
+                                    thePercents);
 
   size_t anIsAccepted = FindPossibleParams(aPointSet,
                                            theStepLength,
@@ -310,10 +316,11 @@ VISU_StreamLinesPL
 //----------------------------------------------------------------------------
 size_t
 VISU_StreamLinesPL
-::IsPossible(vtkPointSet* theDataSet, 
-             vtkFloatingPointType thePercents)
+::IsPossible(vtkPointSet* theDataSet)
 {
-  vtkFloatingPointType aStepLength = GetBaseStepLength(theDataSet);
+  vtkFloatingPointType aPercents = GetUsedPointsDefault();
+  vtkFloatingPointType aStepLength = GetBaseStepLength(theDataSet,
+                                                       aPercents);
   vtkFloatingPointType aBasePropTime = GetBasePropagationTime(theDataSet);
   VISU_MaskPointsFilter *aPointsFilter = VISU_MaskPointsFilter::New();
   aPointsFilter->SetInput(theDataSet);
@@ -322,7 +329,7 @@ VISU_StreamLinesPL
   size_t aRes = FindPossibleParams(aDataSet,
                                    aStepLength,
                                    aBasePropTime,
-                                   thePercents);
+                                   aPercents);
   aPointsFilter->Delete();
   return aRes;
 }
@@ -489,12 +496,13 @@ VISU_StreamLinesPL
 //----------------------------------------------------------------------------
 vtkFloatingPointType
 VISU_StreamLinesPL
-::GetMinPropagationTime(vtkDataSet* theDataSet)
+::GetMinPropagationTime(vtkDataSet* theDataSet, 
+                        vtkFloatingPointType thePercents)
 {
   if(!theDataSet) 
     return -1.0;
 
-  return GetMinStepLength(theDataSet);
+  return GetMinStepLength(theDataSet, thePercents);
 }
 
 
@@ -503,7 +511,7 @@ vtkFloatingPointType
 VISU_StreamLinesPL
 ::GetMinPropagationTime()
 {
-  return GetMinPropagationTime(GetExtractorFilter()->GetOutput());
+  return GetMinPropagationTime(GetExtractorFilter()->GetOutput(), GetUsedPoints());
 }
 
 
@@ -532,9 +540,10 @@ VISU_StreamLinesPL
 vtkFloatingPointType
 VISU_StreamLinesPL
 ::CorrectPropagationTime(vtkFloatingPointType thePropagationTime, 
-                         vtkDataSet* theDataSet)
+                         vtkDataSet* theDataSet, 
+                         vtkFloatingPointType thePercents)
 {
-  vtkFloatingPointType aMinPropagationTime = GetMinPropagationTime(theDataSet);
+  vtkFloatingPointType aMinPropagationTime = GetMinPropagationTime(theDataSet, thePercents);
   if(aMinPropagationTime > thePropagationTime)
     thePropagationTime = aMinPropagationTime;
 
@@ -573,10 +582,11 @@ VISU_StreamLinesPL
 //----------------------------------------------------------------------------
 vtkFloatingPointType 
 VISU_StreamLinesPL
-::GetMinStepLength(vtkDataSet* theDataSet)
+::GetMinStepLength(vtkDataSet* theDataSet, 
+                   vtkFloatingPointType thePercents)
 {
   static vtkFloatingPointType aNbOfStepsOfIntStep = 1.0E+1;
-  vtkFloatingPointType anIntStep = GetMinIntegrationStep(theDataSet);
+  vtkFloatingPointType anIntStep = GetMinIntegrationStep(theDataSet, thePercents);
   vtkFloatingPointType aStepLength = anIntStep * aNbOfStepsOfIntStep / GetVelocityCoeff(theDataSet);
   return aStepLength;
 }
@@ -587,7 +597,7 @@ vtkFloatingPointType
 VISU_StreamLinesPL
 ::GetMinStepLength()
 {
-  return GetMinStepLength(GetExtractorFilter()->GetOutput());
+  return GetMinStepLength(GetExtractorFilter()->GetOutput(), GetUsedPoints());
 }
 
 
@@ -614,9 +624,10 @@ VISU_StreamLinesPL
 vtkFloatingPointType
 VISU_StreamLinesPL
 ::CorrectStepLength(vtkFloatingPointType theStep, 
-                    vtkDataSet* theDataSet)
+                    vtkDataSet* theDataSet, 
+                    vtkFloatingPointType thePercents)
 {
-  vtkFloatingPointType aMinStep = GetMinStepLength(theDataSet);
+  vtkFloatingPointType aMinStep = GetMinStepLength(theDataSet, thePercents);
   if(theStep < aMinStep) 
     theStep = aMinStep;
 
@@ -631,17 +642,28 @@ VISU_StreamLinesPL
 //----------------------------------------------------------------------------
 vtkFloatingPointType
 VISU_StreamLinesPL
-::GetBaseStepLength(vtkDataSet* theDataSet)
+::GetBaseStepLength(vtkDataSet* theDataSet, 
+                    vtkFloatingPointType thePercents)
 {
   static vtkFloatingPointType anAvgNbOfSteps = 1.0E+2;
   vtkFloatingPointType aPropagationTime = GetBasePropagationTime(theDataSet);
   vtkFloatingPointType aStepLength = aPropagationTime/anAvgNbOfSteps;
-  aStepLength = CorrectStepLength(aStepLength,theDataSet);
+  aStepLength = CorrectStepLength(aStepLength,theDataSet,thePercents);
 
   return aStepLength;
 }
 
 
+//----------------------------------------------------------------------------
+vtkFloatingPointType
+VISU_StreamLinesPL
+::GetUsedPointsDefault()
+{
+  SUIT_ResourceMgr* aResourceMgr = SUIT_Session::session()->resourceMgr();
+  return aResourceMgr->doubleValue("VISU", "stream_lines_used_points", 0.01);
+}
+
+
 //----------------------------------------------------------------------------
 void
 VISU_StreamLinesPL
@@ -650,12 +672,14 @@ VISU_StreamLinesPL
   Superclass::Init();
 
   vtkDataSet* aDataSet = GetExtractorFilter()->GetOutput();
-  vtkFloatingPointType anIntStep = GetBaseIntegrationStep(aDataSet);
+  vtkFloatingPointType anIntStep = GetBaseIntegrationStep(aDataSet, GetUsedPoints());
   vtkFloatingPointType aPropagationTime = GetBasePropagationTime(aDataSet);
-  vtkFloatingPointType aStepLength = GetBaseStepLength(aDataSet);
+  vtkFloatingPointType aStepLength = GetBaseStepLength(aDataSet, GetUsedPoints());
   SetParams(anIntStep,
             aPropagationTime,
-            aStepLength);
+            aStepLength,
+            NULL,
+            GetUsedPoints());
 }
 
 
index 009424b0230554a3df8bdb9b1499a83af5f1dcb9..b1f71ff618dcc71bede627b88dfbaf75bdf4ae61 100644 (file)
@@ -61,8 +61,8 @@ public:
   SetParams(vtkFloatingPointType theIntStep,
             vtkFloatingPointType thePropogationTime,
             vtkFloatingPointType theStepLength,
-            vtkPointSet* theSource = NULL,
-            vtkFloatingPointType thePercents = 0.3,
+            vtkPointSet* theSource,
+            vtkFloatingPointType thePercents,
             int theDirection = VTK_INTEGRATE_BOTH_DIRECTIONS);
 
   virtual
@@ -159,15 +159,16 @@ public:
   static
   vtkFloatingPointType
   GetMinIntegrationStep(vtkDataSet* theDataSet, 
-                        vtkFloatingPointType thePercents = 0.3);
+                        vtkFloatingPointType thePercents);
   static
   vtkFloatingPointType
   GetBaseIntegrationStep(vtkDataSet* theDataSet, 
-                         vtkFloatingPointType thePercents = 0.3);
+                         vtkFloatingPointType thePercents);
   
   static 
   vtkFloatingPointType
-  GetMinPropagationTime(vtkDataSet* theDataSet);
+  GetMinPropagationTime(vtkDataSet* theDataSet, 
+                        vtkFloatingPointType thePercents);
 
   static
   vtkFloatingPointType
@@ -179,7 +180,8 @@ public:
 
   static
   vtkFloatingPointType
-  GetMinStepLength(vtkDataSet* theDataSet);
+  GetMinStepLength(vtkDataSet* theDataSet, 
+                   vtkFloatingPointType thePercents);
 
   static
   vtkFloatingPointType
@@ -187,7 +189,8 @@ public:
 
   static
   vtkFloatingPointType
-  GetBaseStepLength(vtkDataSet* theDataSet);
+  GetBaseStepLength(vtkDataSet* theDataSet, 
+                    vtkFloatingPointType thePercents);
 
   static
   vtkFloatingPointType
@@ -195,8 +198,7 @@ public:
 
   static
   size_t
-  IsPossible(vtkPointSet* theDataSet, 
-             vtkFloatingPointType thePercents = 0.3);
+  IsPossible(vtkPointSet* theDataSet);
 
 protected:
   VISU_StreamLinesPL();
@@ -214,7 +216,7 @@ protected:
   GetNecasseryMemorySize(vtkIdType theNbOfPoints, 
                          vtkFloatingPointType theStepLength, 
                          vtkFloatingPointType thePropogationTime, 
-                         vtkFloatingPointType thePercents = 0.3);
+                         vtkFloatingPointType thePercents);
 
   static
   size_t
@@ -227,17 +229,23 @@ protected:
   vtkFloatingPointType
   CorrectIntegrationStep(vtkFloatingPointType theStep, 
                          vtkDataSet* theDataSet, 
-                         vtkFloatingPointType thePercents = 0.3);
+                         vtkFloatingPointType thePercents);
 
   static 
   vtkFloatingPointType
   CorrectPropagationTime(vtkFloatingPointType thePropagationTime, 
-                         vtkDataSet* theDataSet);
+                         vtkDataSet* theDataSet, 
+                         vtkFloatingPointType thePercents);
 
   static
   vtkFloatingPointType
   CorrectStepLength(vtkFloatingPointType theStep, 
-                    vtkDataSet* theDataSet);
+                    vtkDataSet* theDataSet, 
+                    vtkFloatingPointType thePercents);
+
+  static
+  vtkFloatingPointType
+  GetUsedPointsDefault();
 
   VISU_StreamLine* myStream;
   vtkPointSet* mySource;
index 7c4cfd7a0166d6eb39ab4b42032e41fc9de1eee5..dc6074dd3102740b143b2f86b4a1fd4443ac0e64 100644 (file)
@@ -413,6 +413,18 @@ number of time stamps or number of components is not the same!</translation>
             <source>VISU_STREAM_LINES</source>
             <translation>Stream Lines</translation>
         </message>
+        <message>
+            <source>VISU_STREAM_LINES_PREF</source>
+            <translation>Stream Lines Preferences</translation>
+        </message>
+        <message>
+            <source>VISU_STREAM_LINES_PREF</source>
+            <translation>Stream Lines Preferences</translation>
+        </message>
+        <message>
+            <source>VISU_STREAM_LINES_USED_POINTS</source>
+            <translation>Used points</translation>
+        </message>
         <message>
             <source>VISU_SWEEPING_MODES</source>
             <translation>Mode of the sweeping </translation>
index 8cc895f5d8cb8ee0ab04d03b63e14c920d3e0748..fd2a36c3f953cdf46ad3f9dede37166a587b23aa 100644 (file)
@@ -3998,6 +3998,18 @@ void VisuGUI::createPreferences()
   addPreference( tr( "Generate data table" ), cutLineGr, LightApp_Preferences::Bool, "VISU", "generate_data_table" );
   addPreference( tr( "Generate curves" ), cutLineGr, LightApp_Preferences::Bool, "VISU", "generate_curves" );
 
+  // TAB: "StreamLines"
+  int streamLinesTab = addPreference( tr( "VISU_STREAM_LINES" ) );
+
+  // group: "StreamLines preferences"
+  int streamLinesGr = addPreference( tr( "VISU_STREAM_LINES_PREF" ), streamLinesTab );
+  setPreferenceProperty( cutLineGr, "columns", 1 );
+  int usedPoints = addPreference( tr( "VISU_STREAM_LINES_USED_POINTS" ), streamLinesGr,
+                                  LightApp_Preferences::DblSpin, "VISU", "stream_lines_used_points" );
+  setPreferenceProperty( usedPoints, "min",  0 );
+  setPreferenceProperty( usedPoints, "max",  1 );
+  setPreferenceProperty( usedPoints, "step", 0.1 );
+
   // TAB: "Sweep, Animation, 3D Cache"
   int animationTab = addPreference( tr( "Sweep, Animation" ) );
   {