[Paraview] [xdmf] - vtkXdmfReader - time support
John Biddiscombe
biddisco at cscs.ch
Thu May 15 11:14:11 EDT 2008
Eric
It's a problem I'm aware of. When multiple streams of data inhabit
different time frames or integrals/multiples of time,
1) paraview iterates over all and we need a new time mode which only
steps of the time from the selected pipeline/filter
2) if the time is set and the filter doesn't have it - then your fix
should be used. However, I put in the WithinTolerance function at an
early stage of the time implementation and never really intended it to
stay there. I think the best strategy would be to add a couple of
methods to vtkAlgorithm that are something like
GetTimeStep(double "some value passed in by the pipelie")
SetTimeStepFetchMode(nearest, next above, next below - default, next below)
and any reader/algorithm which support time can make sure that the
correct default and time values are setup. We'd need to add such
lovelies as vtkstd::vector<double> TimeStepValues to vtkAlgorithm - but
at least it'd save adding time step checking code into every time based
filter/reader.
Comments anyone? (I currently have the WithinTolerance or similar
functions in about ten different classes and abstracting them out would
be nice)
JB
> Hey John,
>
> First, thanks a lot for putting in all this work on the VTK Xdmf
> reader/writer! It's really great to have Xdmf time support from within
> ParaView. I just got around to testing the new functionality with our
> data, and an issue came up that people may want to chime in on:
>
> Our data is a combination of two grids, one of which has been dumped
> from the simulation at a higher time resolution than the other. When
> simultaneously viewing both data sets in ParaView using the current
> vtkXdmfReader, the lower time-resolution data jumps back to time step
> zero if the requested (finer resolution) time step can't be found in
> the set. If I look at the same data with pvd files describing the time
> steps, ParaView displays the previous existing time step until an
> updated one is encountered.
>
> In vtkXdmfReader::RequestData(), would it make sense to find the first
> existing time step which is greater than the requested time (instead
> of trying to find an existing one that matches WithinTolerance()), or
> would this screw up other things? (I'll attach a diff of the simplest
> thing I could think of to test what it would look like.)
>
> It seems that within the new Xdmf time specification, maybe I should
> be using TimeType="Range" to span the times for which each lower
> time-resolution data set are valid, but I'm not sure that that's
> supported yet in the reader, and maybe the default behavior of the
> reader should still be different...?
>
> Thanks,
> -Eric
>
> ------------------------------------------------------
> Eric E Monson
> Duke Visualization Technology Group
>
> ===================
> --- vtkXdmfReader.cxx 2008-04-11 13:55:04.000000000 -0400
> +++ vtkXdmfReader_orig.cxx 2008-05-13 14:56:54.000000000 -0400
> @@ -2901,6 +2901,17 @@
> }
> };
> //----------------------------------------------------------------------------
>
> +class GreaterThan: public vtkstd::binary_function<double, double, bool>
> +{
> +public:
> + result_type operator()(first_argument_type a,
> second_argument_type b) const
> + {
> + // a will be the time values from the data set, and b will be the
> requested time
> + bool result = (a + 1E-6 >= b);
> + return (result_type)result;
> + }
> +};
> +//----------------------------------------------------------------------------
>
> int vtkXdmfReader::RequestData(
> vtkInformation *vtkNotUsed(request),
> vtkInformationVector **vtkNotUsed(inputVector),
> @@ -2963,10 +2974,13 @@
> if
> (outInfo->Has(vtkStreamingDemandDrivenPipeline::UPDATE_TIME_STEPS()))
> {
> double requestedTimeValue =
> outInfo->Get(vtkStreamingDemandDrivenPipeline::UPDATE_TIME_STEPS())[0];
> + // Changing reader so that it loads the next time step greater
> than the requested
> + // one rather than defaulting to time step 0 for an
> non-matching requested times...
> this->ActualTimeStep = vtkstd::find_if(
> this->Internals->TimeValues.begin(),
> this->Internals->TimeValues.end(),
> - vtkstd::bind2nd( WithinTolerance( ), requestedTimeValue ))
> + // vtkstd::bind2nd( WithinTolerance( ), requestedTimeValue ))
> + vtkstd::bind2nd( GreaterThan( ), requestedTimeValue ))
> - this->Internals->TimeValues.begin();
> }
> // last check to stop dodgy crashes
>
>
--
John Biddiscombe, email:biddisco @ cscs.ch
http://www.cscs.ch/about/BJohn.php
CSCS, Swiss National Supercomputing Centre | Tel: +41 (91) 610.82.07
Via Cantonale, 6928 Manno, Switzerland | Fax: +41 (91) 610.82.82
More information about the ParaView
mailing list