<div dir="ltr">If you provide the stack trace, that may be helpful.<div><br></div><div>Seb</div></div><div class="gmail_extra"><br><div class="gmail_quote">On Thu, Oct 23, 2014 at 10:36 AM, Bogdan Daqui Herrera <span dir="ltr"><<a href="mailto:bdaqui@simscale.de" target="_blank">bdaqui@simscale.de</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">Hi Seb,<br>
<br>
Thanks for the quick reply. Yes the project is managed with CMake. I have not however been able to find the relevant posts by Marcus (in the users list). Is<br>
that in the users or developers mailing list?<br>
<br>
It does sound like it could be a problem with some initialization, as you can see below.<br>
<br>
One short update, it looks like setting ForceMultiBlockDataSet Output with:<br>
pReader->SetForceOutputTypeToMultiBlock(1);<br>
leads to the segmentation fault at Update() (The deepcopy is never reached). With or without setting the previous line, the error<br>
vtkPVDReader (0x1cb49e0): Error creating "vtkXMLMultiBlockDataReader" using vtkPVInstantiator.<br>
<br>
The code looks like this now:<br>
vtkSmartPointer < vtkPVDReader > pReader = vtkSmartPointer < vtkPVDReader >::New();<br>
pReader->SetFileName("/some/file.pvd");<br>
pReader->Update(); (where the error is triggered)<br>
<br>
Kind Regards,<br>
Bogdan<br>
<span class=""><br>
On 10/23/2014 04:47 PM, Sebastien Jourdain wrote:<br>
> Hi Bogdan,<br>
><br>
> here are some issue in your code:<br>
><br>
> vtkSmartPointer <vtkPVDReader> pReader = vtkPVDReader::New(); // <== Memory LEAK<br>
> // Should be either<br>
> // vtkNew<vtkPVDReader> pReader;<br>
> // vtkSmartPointer<vtkPVDReader> pReader = vtkSmartPointer<vtkPVDReader>::New()<br>
><br>
> Then here on a "NULL" object you try to call a method.<br>
><br>
> vtkMultiBlockDataSet* pMultiBlockDataSet->DeepCopy(vtkMultiBlockDataSet::SafeDownCast(pReader->GetOutputDataObject(0)));<br>
><br>
> Should be something like that:<br>
><br>
> vtkNew< vtkMultiBlockDataSet > pMultiBlockDataSet;<br>
> pMultiBlockDataSet->DeepCopy(vtkMultiBlockDataSet::SafeDownCast(pReader->GetOutputDataObject(0)));<br>
><br>
> Then you might have some other issue where pReader output being empty/null, but for that I don't know.<br>
><br>
> Are you managing your project with CMake? Did you include the necessary file with the proper dependency declaration. This seems to be related to the factory not<br>
> being properly initialized. You can search the mailing list, Marcus did answer several questions about that.<br>
><br>
> Seb<br>
><br>
><br>
><br>
</span><div><div class="h5">> On Thu, Oct 23, 2014 at 7:26 AM, Bogdan Daqui Herrera <<a href="mailto:bdaqui@simscale.de">bdaqui@simscale.de</a> <mailto:<a href="mailto:bdaqui@simscale.de">bdaqui@simscale.de</a>>> wrote:<br>
><br>
> Hello all,<br>
><br>
> I am attempting to write some code in c++ which uses the vtkPVDReader from the paraview library to read a series of vtm files. However I am encountering some<br>
> problems and I am not sure whether there is something I am missing or whether this could be a bug.<br>
><br>
> I am trying to use the reader in the following manner:<br>
> My Code:<br>
> vtkSmartPointer <vtkPVDReader> pReader = vtkPVDReader::New();<br>
> pReader->SetForceOutputTypeToMultiBlock(1);<br>
> pReader->SetFileName("/some/fileName.pvd");<br>
> pReader->Update();<br>
> vtkMultiBlockDataSet* pMultiBlockDataSet->DeepCopy(vtkMultiBlockDataSet::SafeDownCast(pReader->GetOutputDataObject(0)));<br>
><br>
> Error:<br>
> The error occurs at Update() with the following result:<br>
> ERROR: In /misc/dn47/SALOME/PRODUCTS/7x/opt/Ubuntu.13.10.64/7.4.0/tmp/ParaView-4.1.0_SRC/ParaViewCore/VTKExtensions/Default<br>
> /vtkXMLCollectionReader.cxx, line 316<br>
> vtkPVDReader (0x224d9e0): Error creating "vtkXMLMultiBlockDataReader" using vtkPVInstantiator.<br>
> Segmentation fault<br>
><br>
> Possible error Source<br>
> The code concerning line 316 from vtkXMLCollectionReader.cxx is:<br>
><br>
> // Use the instantiator to create the reader.<br>
> vtkObject* o = vtkPVInstantiator::CreateInstance(rname);<br>
> vtkXMLReader* reader = vtkXMLReader::SafeDownCast(o);<br>
> this->Internal->Readers[index] = reader;<br>
> if(reader)<br>
> {<br>
> reader->Delete();<br>
> }<br>
> else<br>
> {<br>
> // The class was not registered with the instantiator.<br>
> vtkErrorMacro("Error creating \"" << rname<br>
> << "\" using vtkPVInstantiator.");<br>
> if(o)<br>
> {<br>
> o->Delete();<br>
> }<br>
> }<br>
> }<br>
><br>
> I have isolated the following lines and tested them independently:<br>
> vtkObject* o = vtkPVInstantiator::CreateInstance(rname);<br>
> vtkXMLReader* reader = vtkXMLReader::SafeDownCast(o);<br>
><br>
> The pointer "vtkObject* o" is NULL regardless of the class name I pass to instantiate, and I can imagine something like that happening in the library, too and<br>
> causing the segmentation fault, when calling a SafeDownCast(o) (which is NULL).<br>
><br>
><br>
> Any suggestions on how to deal with this problem or if you would be so kind to point me to an example for an alternative solution (Could be vtkFileSeriesReader,<br>
> but this fails, as well in my case) would be appreciated.<br>
><br>
> Kind Regards,<br>
> Bogdan<br>
><br>
> P.S.: Using the PVDReader from python code works flawlessly, which is also quite confusing, as to why it would fail in the C++ code.<br>
><br>
> --<br>
> Bogdan Daqui<br>
> Software Development<br>
><br>
> SimScale GmbH<br>
> Lichtenbergstraße 8<br>
> 85748 Garching bei München<br>
><br>
> Phone: +49 (0)89 3398 4078<br>
</div></div>> Email: <a href="mailto:bdaqui@simscale.de">bdaqui@simscale.de</a> <mailto:<a href="mailto:bdaqui@simscale.de">bdaqui@simscale.de</a>><br>
<span class="">><br>
> Amtsgericht München, HRB 201813<br>
> Geschäftsführer: Vincenz Dölle & David Heiny<br>
><br>
> <a href="http://www.simscale.de" target="_blank">http://www.simscale.de</a><br>
> _______________________________________________<br>
</span>> Powered by <a href="http://www.kitware.com" target="_blank">www.kitware.com</a> <<a href="http://www.kitware.com" target="_blank">http://www.kitware.com</a>><br>
<div class="HOEnZb"><div class="h5">><br>
> Visit other Kitware open-source projects at <a href="http://www.kitware.com/opensource/opensource.html" target="_blank">http://www.kitware.com/opensource/opensource.html</a><br>
><br>
> Please keep messages on-topic and check the ParaView Wiki at: <a href="http://paraview.org/Wiki/ParaView" target="_blank">http://paraview.org/Wiki/ParaView</a><br>
><br>
> Follow this link to subscribe/unsubscribe:<br>
> <a href="http://public.kitware.com/mailman/listinfo/paraview" target="_blank">http://public.kitware.com/mailman/listinfo/paraview</a><br>
><br>
><br>
</div></div></blockquote></div><br></div>