[Paraview] Can I speed up animations if my mesh structure is constant?

Berk Geveci berk.geveci at kitware.com
Sat Oct 11 15:46:42 EDT 2008


OK, I think I know a way that would improve the performance of the
geometry filter for constant mesh and time variant arrays. This would
probably not work with any other filters. This would only make sense
for unstructured grids (or multi-block of unstructured).

Here is what I propose. Hopefully, one of you has the time and the
desire to hack vtkPVGeometryFilter for this.

* First, we need to detect if the input mesh changed. To do this, the
geom. filter needs to store pointers to the previous input cell array
and points. It also has to store their mtimes.

* Second, the geom. filter has to cache the previous output. It has to
do this by shallow copying it to a polydata stored as a data member.
Note that it only needs to store the geometry not the fields. (hint:
use CopyStructure)

* When the geom. filter executes, it can now detect if the input mesh
changed. If it didn't change, simply shallow copy the geometry to the
output. We would be done if we didn't have the arrays.

* The geom. filter also has to cache vtkOriginalPointIds and
vtkOriginalCellIds from the previous execution. These arrays maps the
output points to input points, output cells to input cells. Using
these arrays, the geom. filter has to copy input arrays to output
arrays (hint: Use CopyAllocate and CopyData).

Things are a bit more complicated for multi-block of ugrids but the
same ideas should apply.

I hope this helps. If anyone manages to get this working, I would be
happy to put it in the cvs.

-berk


On Fri, Oct 10, 2008 at 11:37 AM, Takuya OSHIMA
<oshima at eng.niigata-u.ac.jp> wrote:
> Hi Robert,
>
> I want the skipping PVGeometryFilter feature too. However there has
> been a discussion on this August
> http://www.paraview.org/pipermail/paraview/2008-August/thread.html
> (search for "Caching within a class, avoiding vtkGeometryFilter")
> concluding that there is no immediate solution yet.
>
> Takuya OSHIMA, Ph.D.
> Faculty of Engineering, Niigata University
> 8050 Ikarashi-Ninocho, Nishi-ku, Niigata, 950-2181, JAPAN
>
>
> From: Robert Blake <rblake at jhu.edu>
> Subject: [Paraview] Can I speed up animations if my mesh structure is constant?
> Date: Thu, 9 Oct 2008 18:43:29 -0400
>
>> Is there a way to speed up Paraview when visualizing animate-able
>> point data over a constant unstructured grid?  I've written a simple
>> unstructured grid algorithm with the animate-able integer value XXX:
>>
>> int vtkFakeDataAlgo::RequestData(
>>    vtkInformation *,
>>    vtkInformationVector **inputVector,
>>    vtkInformationVector *outputVector)
>> {
>>    vtkUnstructuredGrid *in  = GetGrid(inputVector[0]);
>>    vtkUnstructuredGrid *out = GetGrid(outputVector);
>>
>>    out->ShallowCopy(in);
>>
>>    vtkIdType N = out->GetNumberOfPoints();
>>
>>    vtkFloatArray *data = vtkFloatArray::New();
>>    data->SetNumberOfComponents(1);
>>    data->SetNumberOfTuples(N);
>>    data->SetName( "FakeData" );
>>
>>    float* ptr = data->GetPointer(0);
>>    for(vtkIdType ii=0; ii<N; ii++) {
>>      ptr[(ii+500*XXX)%N] = ii;
>>    }
>>
>>    out->GetPointData()->AddArray(data);
>>    out->GetPointData()->SetActiveAttribute("FakeData",
>> vtkDataSetAttributes::SCALARS );
>>    data->Delete();
>>
>>    return 1;
>> }
>>
>> To test this code, I set up the following pipeline:
>>   - Read in an unstructured grid
>>   - Attach this filter
>>
>> I'm running this code on a ~4 million node mesh I have.
>> PVGeometryFilter shows me a progress bar in the bottom every time I
>> update XXX.  Due to the size of the mesh, this PVGeometryFilter step
>> takes 5-6 seconds, which in turn makes the animation unbearably
>> slow.  Is there a better way to write this filter?  I assume that
>> PVGeometryFilter is re-calculating the surface of my unstructured
>> mesh every time I update XXX.  Is this true?  If so, how can I avoid
>> this recalculation?
>>
>> ----
>>
>> I created this fake algorithm as a test.  I have time varying data on
>> a 4 million node mesh and a 33 GBs of time-varying point data.  The
>> node locations and connectivity are constant throughout the
>> simulation.  I've had two problems visualizing this in Paraview:
>>   - Based on my understanding of http://paraview.org/Wiki/Talk:VTK/
>> Time_Support, my data set is too large to read in all at once as a
>> TemporalDataSet.  Therefore I have to revert to this hacky approach
>> in order to add data arrays to a constant mesh.  Did I understand the
>> above page correctly?
>> - Every time I change the data array, Paraview has to think for 5-6
>> seconds.  However, I can get real-time visualization if I code things
>> by hand using raw vtk.  I hate to roll my own visualization software
>> though when Paraview has already coded all the Qt widgets.
>>
>> Thanks for any guidance you can give me,
>> Rob
>> _______________________________________________
>> ParaView mailing list
>> ParaView at paraview.org
>> http://www.paraview.org/mailman/listinfo/paraview
> _______________________________________________
> ParaView mailing list
> ParaView at paraview.org
> http://www.paraview.org/mailman/listinfo/paraview
>


More information about the ParaView mailing list