[Paraview] Problem with custom time-aware reader

Moreland, Kenneth kmorel at sandia.gov
Fri Sep 4 00:46:46 EDT 2009


You have the basic idea.  The seg fault is probably happening because the destructor of you class is trying to free the pointer you set to it, which is probably actually pointing to some spot on the stack.

You are probably not seeing this mapping/lookup in the VTK IO classes because you are looking at classes that do not directly support time (such as the legacy readers and XML readers).  Those readers read exactly one file with one time step in it.  ParaView has a magic meta reader called a FileSeriesReader that takes a real reader and a collection of files and multiplexes the files to the reader based on the time.

In retrospect, this is probably an easier way to go (assuming your final reader is a file series like this).  Documentation on using the FileSeriesReader is on the Wiki at

http://www.paraview.org/Wiki/Restarted_Simulation_Readers#Customized_Restart_Reader

-Ken


On 9/3/09 12:42 PM, "Karl König" <kkoenig11 at web.de> wrote:

Hi Ken,

> Everything looks like it is working fine to me.  It looks like you are
> getting the right time value in RequestData, you are finding the right
> time index, and you are setting the right time value in the output data.
>
> The only thing wrong I see is that it is always printing out the
> filename for the last file.  But I don't see anywhere in RequestData
> where you translated the time index to a file name.  At some point,
> probably in RequestInformation, FileName is set to the last file.  That
> never is overridden in RequestData.

So, essentially what you are suggesting is to create a mapping
timeStepValue -> FileName in RequestInformation and to set
this->FileName depending on the value of
outInfo->Get(vtkStreamingDemandDrivenPipeline::UPDATE_TIME_STEPS())[0]
in RequestData?

I didn't see anything like that happen in any of the other readers in
directory ParaView3/VTK/IO. So, I assumed some magic happening when
invoking
  output->GetInformation()->Set(
     vtkDataObject::DATA_TIME_STEPS(),
     &TimeStepValues[this->ActualTimeStep], 1);

After all, this->FileName gets automagically set before invoking
RequestInformation.

So, I have to set this->FileName manually? Actually, I tried that
already before posting. At the end of RequestData I set brutally

----- cut ---
  this->FileName = "file0.foo";
  std::cout << "RequestData: Got request for opening file <"
            << this->FileName << ">..."  << endl;
  this->UpdateProgress(1.0);
  return 1;
}
----- cut ---

That works, the correct file is opened, but it has the side effect of
segfaulting ParaView as soon as I disconnect from the server or delete
the reader object.
(Using the mapping timeStepValue -> FileName instead of hardcoding
FileName had the same effect.)

Karl


> On 9/3/09 9:19 AM, "Karl König" <kkoenig11 at web.de> wrote:
>
>     Hi,
>
>     I have a problem with a custom time-aware reader which I seem to cannot
>     work out on my own. I'm hoping someone on this list can shed some light
>     on the problem.
>
>     The reader is designed following John's excellent tutorial
>     (http://www.paraview.org/Wiki/images/2/20/IEEE08_Time-In-ParaView.ppt)
>     and has been boiled down for this question to its essentials:
>
>     Read in a sequence of plain ASCII text files, each of them containing
>     exactly one floating point value, nothing more. The values are
>     interpreted as time step values.
>
>     The problem is that all files of the file series are inspected in method
>     RequestInformation, time information is displayed correctly in the
>     Information tab, I can walk through the files using VCR controls and
>     current data time step is properly increased/decreased. The problem,
>     though, is that for every time step the very same file - always the last
>     file of the file series - is loaded in RequestData.
>
>     Here is the recipe to reproduce:
>     Unpack and compile the attached plugin in the usual manner using
>       mkdir build; cd build
>       cmake .. -DCMAKE_BUILD_TYPE=Release
>                -DParaView_DIR=/path/to/paraview/build/dir
>     and load it into ParaView 3.6.1 or 3.7-cvs.
>
>     Create a sample input file series via:
>       for i in $(seq 0 9); do echo "0.${i}00" > file${i}.foo ; done
>     (there is already such a file series in the tarball)
>
>     Open the collapsed file series "file..foo" in the file open dialog. On
>     standard output it will be shown that method RequestInformation is
>     called for all files of the sequence once, and an additional time for
>     the last file. (I probably could work around that by storing the name of
>     the last file being parsed and comparing it to the current file name.
>     But that's of minor interest.)
>     Click on the Apply button and walk through the files. On standard output
>     it will be reported that this->FileName does not change at all. I fail
>     to understand why. Am I missing some callback routine? According to my
>     understanding
>
>     output->GetInformation()->Set(
>        vtkDataObject::DATA_TIME_STEPS(),
>        &TimeStepValues[this->ActualTimeStep], 1);
>
>     in RequestData should do the magic, but it does not. Does anyone have an
>     idea?
>
>     Thanks a lot in advance.
>     Karl
>
>
>
>    ****      Kenneth Moreland
>     ***      Sandia National Laboratories
> ***********
> *** *** ***  email: kmorel at sandia.gov
> **  ***  **  phone: (505) 844-8919
>     ***      web:   http://www.cs.unm.edu/~kmorel




   ****      Kenneth Moreland
    ***      Sandia National Laboratories
***********
*** *** ***  email: kmorel at sandia.gov
**  ***  **  phone: (505) 844-8919
    ***      web:   http://www.cs.unm.edu/~kmorel

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.paraview.org/pipermail/paraview/attachments/20090903/4f82b45f/attachment.htm>


More information about the ParaView mailing list