[Paraview] [xdmf] - vtkXdmfReader - time support

Eric E. Monson emonson at cs.duke.edu
Tue May 13 15:07:03 EDT 2008


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




More information about the ParaView mailing list