I've been using the time series reader with vtkDataObject to read pure time-varying field data to merge into a non time-varying dataset with vtkMergeDataObjectFilter. I've found it doesn't report the time steps and time range from the data object.
This can be solved by adding a RequestInformation() method that propagates time; this largely copied from vtkProbeFilter:
int vtkMergeDataObjectFilter::RequestInformation(
vtkInformation _vtkNotUsed(request),
vtkInformationVector _inputVector,
vtkInformationVector outputVector)
{
if (this->GetNumberOfInputConnections(1) > 0)
{
// get the info objects
vtkInformation outInfo = outputVector->GetInformationObject(0);
vtkInformation dataObjectInfo = inputVector[1]->GetInformationObject(0);
outInfo->CopyEntry(dataObjectInfo,
vtkStreamingDemandDrivenPipeline::TIME_STEPS());
outInfo->CopyEntry(dataObjectInfo,
vtkStreamingDemandDrivenPipeline::TIME_RANGE());
}
return 1;
}
Even though this works for my data, I'm unsatisfied by this code and have some questions:
What happens if the input is time-varying but the data object is not?
What happens if both are time-varying but with different time steps and range?
Are there standard methods for merging time information from two sources?
I've been using the time series reader with vtkDataObject to read pure time-varying field data to merge into a non time-varying dataset with vtkMergeDataObjectFilter. I've found it doesn't report the time steps and time range from the data object.
This can be solved by adding a RequestInformation() method that propagates time; this largely copied from vtkProbeFilter:
int vtkMergeDataObjectFilter::RequestInformation( vtkInformation _vtkNotUsed(request), vtkInformationVector _inputVector, vtkInformationVector outputVector) { if (this->GetNumberOfInputConnections(1) > 0) { // get the info objects vtkInformation outInfo = outputVector->GetInformationObject(0); vtkInformation dataObjectInfo = inputVector[1]->GetInformationObject(0); outInfo->CopyEntry(dataObjectInfo, vtkStreamingDemandDrivenPipeline::TIME_STEPS()); outInfo->CopyEntry(dataObjectInfo, vtkStreamingDemandDrivenPipeline::TIME_RANGE()); } return 1; }
Even though this works for my data, I'm unsatisfied by this code and have some questions: What happens if the input is time-varying but the data object is not? What happens if both are time-varying but with different time steps and range? Are there standard methods for merging time information from two sources?