Hi,
We added some functionality we were hoping you could add to the Paraview
source for next release. It adds a "Keep Random Points" checkbox to the
glyph filter such that if both "Mask Points" and "Random Mode" are
checked, it will maintain the same random points across all timesteps
rather than the default method of choosing a new set of random points
for each timestep. It is only useful if the same points are referenced
in the same order for each timestep. It should work cross platform.

You can see a comparison of current random and mask points

https://snoid.sv.vt.edu/~shpatric/100mb-random.avi

and random and mask points with keep random points

https://snoid.sv.vt.edu/~shpatric/100mb-random-kept.avi

A patch is attached.

If you have any questions, please let me know.

Thanks,
Pat
--- ParaView-3.14.1-Source.orig/ParaViewCore/ServerImplementation/Resources/filters.xml	2012-04-02 12:56:24.000000000 -0400
+++ ParaView-3.14.1-Source/ParaViewCore/ServerImplementation/Resources/filters.xml	2012-05-14 13:33:56.000000000 -0400
@@ -5500,6 +5500,18 @@
 	 If the value of this property is 1, then the points to glyph are chosen randomly. Otherwise the point ids chosen are evenly spaced.
        </Documentation>
      </IntVectorProperty>
+
+     <IntVectorProperty
+       name="KeepRandomPoints"
+       command="SetKeepRandomPoints"
+       number_of_elements="1"
+       default_values="0" >
+       <BooleanDomain name="bool"/>
+       <Documentation>
+         If the value of this property is 1 and RandomMode is 1, then the the randomly chosen points to glyph are saved and reused for other timesteps. This is only useful if the coordinates are the same and in the same order between timesteps.
+       </Documentation>
+     </IntVectorProperty>
+
    <Hints>
      <!-- Visibility Element can be used to suggest the GUI about
 	  visibility of this filter (or its input) on creation.
@@ -5680,6 +5692,17 @@
 	 If the value of this property is 1, then the points to glyph are chosen randomly. Otherwise the point ids chosen are evenly spaced.
        </Documentation>
      </IntVectorProperty>
+
+     <IntVectorProperty
+       name="KeepRandomPoints"
+       command="SetKeepRandomPoints"
+       number_of_elements="1"
+       default_values="0" >
+       <BooleanDomain name="bool"/>
+       <Documentation>
+         If the value of this property is 1 and RandomMode is 1, then the the randomly chosen points to glyph are saved and reused for other timesteps. This is only useful if the coordinates are the same and in the same order between timesteps.
+       </Documentation>
+     </IntVectorProperty>
    <Hints>
      <!-- Visibility Element can be used to suggest the GUI about
 	  visibility of this filter (or its input) on creation.
diff -Naur ParaView-3.14.1-Source.orig/ParaViewCore/VTKExtensions/vtkPVGlyphFilter.cxx ParaView-3.14.1-Source/ParaViewCore/VTKExtensions/vtkPVGlyphFilter.cxx
--- ParaView-3.14.1-Source.orig/ParaViewCore/VTKExtensions/vtkPVGlyphFilter.cxx	2012-04-02 12:56:24.000000000 -0400
+++ ParaView-3.14.1-Source/ParaViewCore/VTKExtensions/vtkPVGlyphFilter.cxx	2012-05-22 09:39:08.000000000 -0400
@@ -50,6 +50,8 @@
     vtkMultiProcessController::GetGlobalController()->GetNumberOfProcesses() : 1;
   this->UseMaskPoints = 1;
   this->InputIsUniformGrid = 0;
+  this->KeepRandomPoints = 0;
+  this->MaximumNumberOfPointsOld = 0;
 
   this->BlockOnRatio = 0;
   this->BlockMaxNumPts = 0;
@@ -102,6 +104,18 @@
 }
 
 //----------------------------------------------------------------------------
+void vtkPVGlyphFilter::SetKeepRandomPoints(int keepRandomPoints)
+{
+  if( keepRandomPoints == this->KeepRandomPoints )
+  {
+    // no change
+    return;
+  }
+  this->KeepRandomPoints = keepRandomPoints;
+  this->Modified();
+}
+
+//----------------------------------------------------------------------------
 int vtkPVGlyphFilter::FillInputPortInformation(int port,
                                                vtkInformation* info)
 {
@@ -460,12 +474,14 @@
     return;
     }
 
-  //Reset the random points vector
-  this->RandomPtsInDataset.clear();
-
   this->BlockPointCounter = 0;
   this->BlockNumGlyphedPts = 0;
 
+  if( !this->KeepRandomPoints || !this->RandomPtsInDataset.size() || this->MaximumNumberOfPoints != this->MaximumNumberOfPointsOld )
+  {
+  //Reset the random points vector
+  this->RandomPtsInDataset.clear();
+
   //Populate Random points in the vector if random mode selected
   if(this->RandomMode)
     {
@@ -483,6 +499,8 @@
     std::sort( this->RandomPtsInDataset.begin(), this->RandomPtsInDataset.end() );
     }
 
+    this->MaximumNumberOfPointsOld = this->MaximumNumberOfPoints;
+  }
 
   // Identify the first point to glyph.
   if(this->RandomMode && this->RandomPtsInDataset.size() > 0) // FIXME this was a quick fix to prevent some test failure with mpi pvcrs.FindDataDialog.Flow
diff -Naur ParaView-3.14.1-Source.orig/ParaViewCore/VTKExtensions/vtkPVGlyphFilter.h ParaView-3.14.1-Source/ParaViewCore/VTKExtensions/vtkPVGlyphFilter.h
--- ParaView-3.14.1-Source.orig/ParaViewCore/VTKExtensions/vtkPVGlyphFilter.h	2012-04-02 12:55:26.000000000 -0400
+++ ParaView-3.14.1-Source/ParaViewCore/VTKExtensions/vtkPVGlyphFilter.h	2012-05-14 13:33:56.000000000 -0400
@@ -58,6 +58,9 @@
   // vtkUniformGrid.
   virtual int IsPointVisible(vtkDataSet* ds, vtkIdType ptId);
 
+  void SetKeepRandomPoints(int keepRandomPoints);
+  vtkGetMacro(KeepRandomPoints,int);
+
 protected:
   vtkPVGlyphFilter();
   ~vtkPVGlyphFilter();
@@ -100,6 +103,10 @@
   int RandomMode;
 
   virtual void ReportReferences(vtkGarbageCollector*);
+
+  int KeepRandomPoints;
+  vtkIdType MaximumNumberOfPointsOld;
+
 private:
   vtkPVGlyphFilter(const vtkPVGlyphFilter&);  // Not implemented.
   void operator=(const vtkPVGlyphFilter&);  // Not implemented.

_______________________________________________
Powered by www.kitware.com

Visit other Kitware open-source projects at 
http://www.kitware.com/opensource/opensource.html

Please keep messages on-topic and check the ParaView Wiki at: 
http://paraview.org/Wiki/ParaView

Follow this link to subscribe/unsubscribe:
http://www.paraview.org/mailman/listinfo/paraview

Reply via email to