From f4648a008f101eb0bc3749acaf7d27288c914446 Mon Sep 17 00:00:00 2001 From: vsr Date: Tue, 9 Nov 2010 15:48:47 +0000 Subject: [PATCH] 0020901: [CEA 409] Slowness with Streamlines generation Patch for 5.1.3 --- resources/SalomeApp.xml | 1 + src/PIPELINE/VISU_StreamLinesPL.cxx | 70 +++++++++++++++++++---------- src/PIPELINE/VISU_StreamLinesPL.hxx | 36 +++++++++------ src/VISUGUI/VISU_msg_en.ts | 8 ++++ src/VISUGUI/VisuGUI.cxx | 12 +++++ 5 files changed, 90 insertions(+), 37 deletions(-) diff --git a/resources/SalomeApp.xml b/resources/SalomeApp.xml index 590dc43a..cec6090d 100644 --- a/resources/SalomeApp.xml +++ b/resources/SalomeApp.xml @@ -106,6 +106,7 @@ + diff --git a/src/PIPELINE/VISU_StreamLinesPL.cxx b/src/PIPELINE/VISU_StreamLinesPL.cxx index 5ea2c4f9..9c70a80c 100644 --- a/src/PIPELINE/VISU_StreamLinesPL.cxx +++ b/src/PIPELINE/VISU_StreamLinesPL.cxx @@ -34,6 +34,9 @@ #include "VTKViewer_GeometryFilter.h" +#include +#include + #include #include @@ -67,8 +70,9 @@ VISU_StreamLinesPL myCenters = vtkCellCenters::New(); myGeomFilter = VTKViewer_GeometryFilter::New(); myPointsFilter = VISU_MaskPointsFilter::New(); - myPercents = 0.3; mySource = NULL; + + myPercents = GetUsedPointsDefault(); } @@ -172,7 +176,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; @@ -222,10 +226,12 @@ VISU_StreamLinesPL thePercents); thePropogationTime = CorrectPropagationTime(thePropogationTime, - aPointSet); + aPointSet, + thePercents); theStepLength = CorrectStepLength(theStepLength, - aPointSet); + aPointSet, + thePercents); size_t anIsAccepted = FindPossibleParams(aPointSet, theStepLength, @@ -309,10 +315,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); @@ -321,7 +328,7 @@ VISU_StreamLinesPL size_t aRes = FindPossibleParams(aDataSet, aStepLength, aBasePropTime, - thePercents); + aPercents); aPointsFilter->Delete(); return aRes; } @@ -487,12 +494,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); } @@ -501,7 +509,7 @@ vtkFloatingPointType VISU_StreamLinesPL ::GetMinPropagationTime() { - return GetMinPropagationTime(GetExtractorFilter()->GetOutput()); + return GetMinPropagationTime(GetExtractorFilter()->GetOutput(), GetUsedPoints()); } @@ -530,9 +538,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; @@ -571,10 +580,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; } @@ -585,7 +595,7 @@ vtkFloatingPointType VISU_StreamLinesPL ::GetMinStepLength() { - return GetMinStepLength(GetExtractorFilter()->GetOutput()); + return GetMinStepLength(GetExtractorFilter()->GetOutput(), GetUsedPoints()); } @@ -612,9 +622,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; @@ -629,17 +640,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 @@ -648,12 +670,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()); } diff --git a/src/PIPELINE/VISU_StreamLinesPL.hxx b/src/PIPELINE/VISU_StreamLinesPL.hxx index 96d0b608..5b0af6ca 100644 --- a/src/PIPELINE/VISU_StreamLinesPL.hxx +++ b/src/PIPELINE/VISU_StreamLinesPL.hxx @@ -58,8 +58,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 @@ -156,15 +156,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 @@ -176,7 +177,8 @@ public: static vtkFloatingPointType - GetMinStepLength(vtkDataSet* theDataSet); + GetMinStepLength(vtkDataSet* theDataSet, + vtkFloatingPointType thePercents); static vtkFloatingPointType @@ -184,16 +186,16 @@ public: static vtkFloatingPointType - GetBaseStepLength(vtkDataSet* theDataSet); - + GetBaseStepLength(vtkDataSet* theDataSet, + vtkFloatingPointType thePercents); + static vtkFloatingPointType GetVelocityCoeff(vtkDataSet* theDataSet); static size_t - IsPossible(vtkPointSet* theDataSet, - vtkFloatingPointType thePercents = 0.3); + IsPossible(vtkPointSet* theDataSet); protected: VISU_StreamLinesPL(); @@ -211,7 +213,7 @@ protected: GetNecasseryMemorySize(vtkIdType theNbOfPoints, vtkFloatingPointType theStepLength, vtkFloatingPointType thePropogationTime, - vtkFloatingPointType thePercents = 0.3); + vtkFloatingPointType thePercents); static size_t @@ -224,17 +226,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(); vtkStreamLine* myStream; vtkPointSet* mySource; diff --git a/src/VISUGUI/VISU_msg_en.ts b/src/VISUGUI/VISU_msg_en.ts index 70dd065a..01cfaa40 100644 --- a/src/VISUGUI/VISU_msg_en.ts +++ b/src/VISUGUI/VISU_msg_en.ts @@ -393,6 +393,14 @@ number of time stamps or number of components is not the same! VISU_STREAM_LINES Stream Lines + + VISU_STREAM_LINES_PREF + Stream Lines Preferences + + + VISU_STREAM_LINES_USED_POINTS + Used points + VISU_SWEEPING_MODES Mode of the sweeping diff --git a/src/VISUGUI/VisuGUI.cxx b/src/VISUGUI/VisuGUI.cxx index a289d376..a6483624 100644 --- a/src/VISUGUI/VisuGUI.cxx +++ b/src/VISUGUI/VisuGUI.cxx @@ -3869,6 +3869,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" ) ); { -- 2.39.2