[Paraview] Custom plugin reader with time series

Mike Jackson mike.jackson at imts.us
Wed Jul 30 21:12:50 EDT 2008


Can you run ParaView in a debugger or attach to a running instance of  
paraview with a debugger, then trigger the bug? Most debuggers will  
break on a segfault and then you can track down the issue from there.

-- 
Mike Jackson   Senior Research Engineer
Innovative Management & Technology Services


On Jul 30, 2008, at 7:36 PM, Dominik Szczerba wrote:

> Hi again,
>
> Unfortunately, this was a pure coincidence and the problem is  
> somewhere
> else (at the end, a segfault occured as well). I am still very  
> grateful for suggesting this path (deriving from Algorithm and not  
> Reader) as I would not discover the problem without it. I still  
> believe the problem is not on my side. Will eventually report my  
> findings in a new thread.
>
> bye
> Dominik
>
> Dominik Szczerba wrote:
>> Dear Mike,
>> Sorry for warming up the old meal but it is only now that I could  
>> fully appreciate your solution. After long weeks of frustration  
>> with my hdf5 reader derived from vtkDataReader - and subsequent  
>> segfaults reported before - I tried your way of deriving from  
>> UnstructuredGridAlgorithm : and my problem is magically gone, with  
>> no other changes than that. I have not yet tried time series, so  
>> it is not unlikely I will have some questions later. For the  
>> moment, thanks a lot.
>> Dominik
>> Mike Jackson wrote:
>>> Take a look at <http://titanium.imts.us/viewvc/Task_4/ 
>>> PVDislocation/src/DislocationReaders/ 
>>> vtkPrdsMultiOutDislocationReader.cxx?view=markup>
>>>  to see how I did a time series reader.
>>>
>>> Basically in RequestInformation  you will need to determine the the
>>> range of times that your data covers, probably by opening each  
>>> file or
>>> some other means. Then set
>>>     double timeRange[2];
>>>     timeRange[0] = lowestTimeValue
>>>     timeRange[1] = highesetTimeValue
>>>     outInfo->Set(vtkStreamingDemandDrivenPipeline::TIME_RANGE(),
>>> timeRange, 2);
>>>
>>> Also, you will need to have the following in your header:
>>>
>>>    vtkSetMacro(TimeStep, int);
>>>    vtkGetMacro(TimeStep, int);
>>>
>>>  int GetNumberOfTimeSteps();
>>>
>>> Now, down in the RequestData() Method you can get the requested time
>>> step from the
>>> pipeline and then open and read the data from the proper data file.
>>>
>>> int tsLength = outInfo->Length 
>>> (vtkStreamingDemandDrivenPipeline::TIME_STEPS());
>>>   double* steps = outInfo->Get 
>>> (vtkStreamingDemandDrivenPipeline::TIME_STEPS());
>>>   // Check if a particular time was requested.
>>>   if(outInfo->Has 
>>> (vtkStreamingDemandDrivenPipeline::UPDATE_TIME_STEPS()))
>>>   {
>>>     // Get the requested time step. We only supprt requests of a  
>>> single time
>>>     // step in this reader right now
>>>     double *requestedTimeSteps =
>>> outInfo->Get(vtkStreamingDemandDrivenPipeline::UPDATE_TIME_STEPS());
>>>     this->TimeValue = requestedTimeSteps[0];
>>>
>>>     // find the first time value larger than requested time value
>>>     // this logic could be improved
>>>     int cnt = 0;
>>>     while (cnt < tsLength-1 && steps[cnt] < this->TimeValue)
>>>       {
>>>       cnt++;
>>>       }
>>>     this->ActualTimeStep = cnt;
>>>   }
>>>
>>>   if (this->TimeStep > -1)
>>>   {
>>>     this->ActualTimeStep = this->TimeStep;
>>>   }
>>>
>>>   if (this->ActualTimeStep >= this->TimeStepRange[0] &&
>>> this->ActualTimeStep <= this->TimeStepRange[1]) {
>>>     vtkSmartPointer<DislocationReader> reader =
>>> vtkSmartPointer<DislocationReader>::New();
>>>     reader->SetFileName(this->FileName);
>>>     reader->SetTimeStep(this->ActualTimeStep);
>>>     //reader->SetInformationVector(outputVector);
>>>     reader->SetFileOffsets(this->FileOffsets);
>>>     reader->read();
>>>     vtkUnstructuredGrid* grid;
>>>     grid = reader->GetDislocations();
>>>     dislocations->ShallowCopy(grid);
>>>
>>>    // dislocations->SetBlock(0, grid);    // Block 0 is the  
>>> Dislocation Data
>>>     grid = reader->GetSimulationBox();
>>>     simBox->ShallowCopy(grid);
>>>     //dislocations->SetBlock(1, grid); // Block 1 is the  
>>> Simulation Limits
>>>   } else {
>>>       std::cout << "vtkPrdsMultiOutDislocationReader: Timestep  
>>> was out
>>> of Range: " << this->ActualTimeStep << std::endl;
>>>       std::cout << "vtkPrdsMultiOutDislocationReader: Timestep  
>>> Range:"
>>> << this->TimeStepRange[0] << " -> " << this->TimeStepRange[1] <<
>>> std::endl;
>>>       return 0;
>>>   }
>>>
>>>
>>> This code is specific to my case where I have a whole separate  
>>> reader
>>> for my data where I feed it the name of the file to read and then  
>>> tell
>>> it to read the file and get the output. This may also be the case  
>>> for
>>> you also.
>>>
>>> Hope some of the helps.
>>>
>>> Mike
>>>
>>> On Sat, May 10, 2008 at 6:03 AM, Dominik Szczerba
>>> <domi at vision.ee.ethz.ch> wrote:
>>>> Hi,
>>>> I have successfully implemented a reader for my data as a PV  
>>>> plugin. It
>>>> loads separate files correctly, refuses, however, to read the  
>>>> whole series
>>>> (file_01.h5, file_02.h5, etc.). How do I go about achieving the  
>>>> same effect
>>>> as the native readers to have a series as transient data?
>>>> Thanks for any hints.
>>>> -- 
>>>> Dominik Szczerba, Ph.D.
>>>> Computer Vision Lab CH-8092 Zurich
>>>> http://www.vision.ee.ethz.ch/~domi
>>>> _______________________________________________
>
> -- 
> Dominik Szczerba, Ph.D.
> Foundation for Research
> on Information Technologies in Society
> http://www.itis.ethz.ch
>
> _______________________________________________
> ParaView mailing list
> ParaView at paraview.org
> http://www.paraview.org/mailman/listinfo/paraview
>




More information about the ParaView mailing list