extractor time steps

Even though programming animatins myself, I am still lost regarding the understanding of “time” in ParaView! But anyway, as long as things are running like I want, I can live with this ignorance… However, they are not!

I have a self-written filter that generates a table as output, one table per timestep. The number of timesteps can be chosen in the properties - let’s assume we make it 6, so the result will be 7 tables, corresponding to 0-1-2-3-4-5-6. For some reason, ParaView wants this to be in a range from 0 to 1, which makes it 0 - 0.16667 - 0.33333 etc. Not a problem, as long as I am getting my 7 tables!

Now I want to write them into a series of 7 CSV files - which looks like a good job for the CSV extractor - right?

And it works indeed - except for the fact that the extractor insists on generating 10 CSV files, no matter what I enter in “Start Time Step”, “End Time Step” and “Frequency”. These would correspond to time steps 0 - 0.11111 - 0.22222 - 0.33333 etc., and my required 7 tables are indeed among the 10 output tables, plus 3 that are duplicates.

My question is now: How can I convince the extractor to extract exactly the 7 tables that I want to generate? Or any other number - whatever is generated by the “table generating filter”?

As I said above: I have no clue what these time figures really do. I entered e.g. StartTimeStep=0, EndTimeStep=1 and Frequency=6 → generates 10 tables. Or I made it StartTimeStep=0, EndTimeStep=6, Frequency=1 → generates 7 tables, but they do not cover the full range… I am indeed a bit lost now!

Any helpful hint?

How do you specify that ? Are you using information keys ?

What I found to be working for a “source” that generates a sequence of output was to do the following within the RequestInformation function:

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);
}

tRange and Steps are both double vectors: tRange is always 0. and 1., and Steps would be something like 0., 0.1666, 0.3333, 0.5 etc. if I actually want it to be 0-1-2- etc. With this I am getting the desired result, but in the animation controls I see these values that I entered in the Steps array.

However, I found now that I could also write a CSV reader that does not even have a RequestInformation function and also in RequestData it does not fiddle around with anything like UPDATE_TIME_STEP() - and there exactly the thing is happening that I would like to achieve: if I have 7 input files, they will be shown as 0-1-2- etc.!

So it looks like I have to “spy” now a little bit how that latter “source” (reader) does the trick indeed.

From what I understand, ParaView actually wants to handle the two possible concepts of “time”: one being a series of objects corresponding to floating point values along a time axis (maybe even if they are not evenly spaced, like 0.0 - 0.1 - 0.25 - 0.3 etc.??) and maybe even interpolate between them if required. The other would be a sequence of objects that are simply numbered: 0 - 1 - 2 etc.

The latter is what best describes my use case, even if the “time objects” are corresponding to time indeed: mining period 1, mining period 2, etc. Even of they are a time sequence, it would not make sense to e.g. interpolate something like “mining period 1.5”.

Now I see what the “reader” is doing:

Within RequestInformation, after doing it’s job, this is what the information object contains:

vtkAtgConstraintsReader::RequestInformation
Debug: Off
Modified Time: 321117
Reference Count: 1
Registered Events: (none)
FILE_SERIES_CURRENT_FILE_NUMBER: 0
DATA_OBJECT: vtkTable(0x562d94bf8300)
FILE_SERIES_FIRST_FILENAME: /home/cornelis/…0.csv
FILE_SERIES_NUMBER_OF_FILES: 8
PRODUCER: vtkPVCompositeDataPipeline(0x562d94be03b0) port 0

In other words: neither TIME_RANGE() nor TIME_STEP() are specified, but rather a FILE_SERIES_NUMBER_OF_FILES key that basically tells us the number of “steps” that we want to achieve.

Within RequestData, this is what we receive - for the first step (from the output vector information object):

vtkAtgConstraintsReader::RequestData
Debug: Off
Modified Time: 391514
Reference Count: 2
Registered Events: (none)
CONSUMERS: vtkPVPostFilterExecutive(0x562d94aa61a0) port 0
UPDATE_NUMBER_OF_GHOST_LEVELS: 0
UPDATE_NUMBER_OF_PIECES: 1
UPDATE_TIME_STEP: 0
TIME_RANGE: 0 0
TIME_STEPS: 0
UPDATE_PIECE_NUMBER: 0
FILE_SERIES_CURRENT_FILE_NUMBER: 0
DATA_OBJECT: vtkTable(0x562d94bf8300)
FILE_SERIES_FIRST_FILENAME: /home/cornelis/…0.csv
FILE_SERIES_NUMBER_OF_FILES: 8
PRODUCER: vtkPVCompositeDataPipeline(0x562d94be03b0) port 0

For the next steps, I see the following change:

TIME_RANGE: 1 1
TIME_STEPS: 1

enz. with RANGE: 2 2, STEPS: 2, etc.

Is this actually what I need to simulate in order to obtain my desired result!?? I am already going to try…

Yes, you need TIME_RANGE and TIME_STEPS

Hmm - well: This I was doing, and this turns out to give me not the result that I always wanted to achieve! Which would be: Having timesteps counted like 0 - 1 - 2 etc…

Strange indeed! But…

…now I realized that I was in RequestData actually shooting into my own foot!

Some years ago I had written some code where I thought that this counting in integer numbers did not work, so I made it always fractions within a range from 0 to 1. Right now I simply copied that code, assuming that this is a must within ParaView: “time ranges have to be 0 to 1”.

Now, in order to check whether it would still work otherwise, I changed my code: In RequestInformation I made TIME_RANGE 0 4 and TIME_STEPS 0 1 2 3 4. Then in RequestData, I obtained an UPDATE_TIME_STEP that was indeed correctly giving me the required sequence: 0 1 2 3 4.

But then I had overlooked a line of code that I had put in “just to play safe”:

reqTime = std::min(std::max(reqTime, 0.), 1.);

And THIS was then actually the very obvious reason why I could never get beyond 1!

(PS: From you I learned once what “rubber ducking” means - here was another example though… Anyway many thanks for playing the “rubber duck” for me again!)

1 Like

Always a pleasure @cobo :slight_smile: