[Paraview-developers] Reading PVD file from code

iusadhfoias sidufasipudf asduifhssauidf at gmail.com
Fri Jun 1 14:12:20 EDT 2018


Hello rclaveria,
iterating through the file collection has to be done on the client side. It
seems like you are only programming server side code. Paraview is very
limited by design if you want to change the client from the server.
Everything action has to be initiated from the client.
Have a look at the PVDReader section
of ParaView/ParaViewCore/ServerManager/SMApplication/Resources/readers.xml
and write a client side proxy that invokes the required operations.

The following can't be discussed as is. Obviously, those lines won't
compile without more context. Either show the complete file, or at least
the compiler output.
"The following piece of code doesn't even compile:
        vtkDataObject* outputreader = reader->SetUpOutput();
        output->DeepCopy(outputreader);"

Regards,
Jussuf


On Thu, May 31, 2018 at 12:13 AM, rclaveria <rclaveria at dim.uchile.cl> wrote:

> Hello,
>
> I'm writing a Paraview plugin in C++ (a source, to be precise) where I
> generate a mesh from external code and save it in PVD format. Then I have
> to read the newly created file and load it into the output, in order to
> display the mesh on the main Paraview screen.
>
> I've written other source algorithms which rely on reading files but I've
> always read .vtk format so far. That was not a problem since I can read
> them with vtkGenericDataObjectReader within the  RequestData function:
>
>         vtkSmartPointer<vtkGenericDataObjectReader> reader =
>            vtkSmartPointer<vtkGenericDataObjectReader>::New();
>         std::string inputFilename = dir.toStdString() + "file.vtk";
>         reader->SetFileName(inputFilename.c_str());
>         reader->Update();
>         vtkUnstructuredGrid* outputreader = reader->GetUnstructuredGridOut
> put();
>         output->DeepCopy(outputreader);
>
> With pvd files, however, is not equally simple to load a file into the
> output. The following piece of code works well for the reading part:
>
>         vtkSmartPointer<vtkPVDReader> reader =
>            vtkSmartPointer<vtkPVDReader>::New();
>         std::string inputFilename = dir.toStdString() + "file.pvd";
>         reader->SetFileName(inputFilename.c_str());
>         reader->Update();
>
> But I don't know how to show the first file of the collection on the
> screen (pvd is a list of objects rather than a single file) and activate
> the "animation" on the VCR menu (one can put plays and the whole sequence
> displays). In other words, my code intends to replicate what happens when
> the user opens a .pvd file from the "File -> Open" menu, but I don't manage
> to do it. The following piece of code doesn't even compile:
>
>         vtkDataObject* outputreader = reader->SetUpOutput();
>         output->DeepCopy(outputreader);
>
> I'd be grateful to get some help with this issue.
>
> Regards,
> R
> _______________________________________________
> Powered by www.kitware.com
>
> Visit other Kitware open-source projects at http://www.kitware.com/opensou
> rce/opensource.html
>
> Search the list archives at: http://markmail.org/search/?q=
> Paraview-developers
>
> Follow this link to subscribe/unsubscribe:
> https://public.kitware.com/mailman/listinfo/paraview-developers
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://public.kitware.com/pipermail/paraview-developers/attachments/20180601/39c73313/attachment.html>


More information about the Paraview-developers mailing list