[Paraview-developers] Some documentation on MTime handling?
Cornelis Bockemühl
cornelis.bockemuehl at gmail.com
Tue Mar 20 13:19:04 EDT 2018
My short question is: I am having some problems to understand time
handling in VTK, so I would like to find some documentations that can
enlighten me! So far my Google research has only shown me that a) there
have been different approaches in the past (which I do not need to
understand) and b) there are many more options available than I will
ever need to use...
The specific problem that I am dealing with is in a project. In a
filter that is supposed to run inside ParaView I am programmatically
generating a time series of unsigned grids and tables, i.e. the filter
has several several output ports that all have to change per time step.
Empirically I found out that I have to put this code into
RequestInformation:
// tell the caller that we can provide time varying data and specif
y the range
double tRange[] = {0., 1.};
// generate a vector with the steps - from 0 to NumSteps
Steps.resize(NumPeriods + 1);
for(int s = 0; s <= NumPeriods; ++s)
Steps[s] = (double)s / (double)NumPeriods;
for(int n = 0; n < GetNumberOfOutputPorts(); ++n)
{
vtkInformation* info = outputVector->GetInformationObject(n);
info->Set(vtkStreamingDemandDrivenPipeline::TIME_RANGE(), tRange, 2);
info->Set(vtkStreamingDemandDrivenPipeline::TIME_STEPS(), Steps.data(), Steps.size());
info->Set(CAN_HANDLE_PIECE_REQUEST(), 1);
}
Some of the calculations are a bit tedious, so I am caching many data
in the filter object, but not more than so far required. This means
that in RequestData a decision has to be taken if more data need to be
calculated first, or else directly copy from the cached data, like for
example this:
- jump to step 5 of 20 directly -> calculate steps 1 - 2 - 3 - 4 - 5
internally, then copy data from step 5 to the output ports
- jump back to step 3 -> simply copy the data from step 3 to the output
ports
- jump to step 7 -> calculate steps 6 - 7, then copy etc.
During the calculations I am using other filters for some data
processing, not attached to the pipeline, for some data
transformations. For some time this worked now "somehow", but now I am
suddenly getting crashes in one of these "detached filters" - when some
"trivial producer" wants to ask for MTime - which is completely
irrelevant in that context...
In other words: I am now a bit confused - and at the same time I am
afraid that I cannot easily strip down my problem to a size that I can
easily share!
Specifically I am not sure which way to try further:
- somehow "tell the filters" that they should not care about time?
- reconsider my caching because maybe it interferes with some similar
functionality that is already built into ParaView?
- somehow "tell" the output unstructured grids and tables which is
their current MTime? But so far I thought I had understood that this is
managed by ParaView, not by the data objects...
...but then some of the data objects have a GetMTime function, but no
way to explicitly set this fabulous MTime: where does it come from?
Actually such a call is the location where the program crashes!
Regards,
Cornelis Bockemühl
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://public.kitware.com/pipermail/paraview-developers/attachments/20180320/919983a4/attachment.html>
More information about the Paraview-developers
mailing list