[Paraview] Segmentation Fault when using the vtkPVDReader
Bogdan Daqui Herrera
bdaqui at simscale.de
Thu Oct 23 09:26:58 EDT 2014
Hello all,
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
problems and I am not sure whether there is something I am missing or whether this could be a bug.
I am trying to use the reader in the following manner:
My Code:
vtkSmartPointer <vtkPVDReader> pReader = vtkPVDReader::New();
pReader->SetForceOutputTypeToMultiBlock(1);
pReader->SetFileName("/some/fileName.pvd");
pReader->Update();
vtkMultiBlockDataSet* pMultiBlockDataSet->DeepCopy(vtkMultiBlockDataSet::SafeDownCast(pReader->GetOutputDataObject(0)));
Error:
The error occurs at Update() with the following result:
ERROR: In /misc/dn47/SALOME/PRODUCTS/7x/opt/Ubuntu.13.10.64/7.4.0/tmp/ParaView-4.1.0_SRC/ParaViewCore/VTKExtensions/Default
/vtkXMLCollectionReader.cxx, line 316
vtkPVDReader (0x224d9e0): Error creating "vtkXMLMultiBlockDataReader" using vtkPVInstantiator.
Segmentation fault
Possible error Source
The code concerning line 316 from vtkXMLCollectionReader.cxx is:
// Use the instantiator to create the reader.
vtkObject* o = vtkPVInstantiator::CreateInstance(rname);
vtkXMLReader* reader = vtkXMLReader::SafeDownCast(o);
this->Internal->Readers[index] = reader;
if(reader)
{
reader->Delete();
}
else
{
// The class was not registered with the instantiator.
vtkErrorMacro("Error creating \"" << rname
<< "\" using vtkPVInstantiator.");
if(o)
{
o->Delete();
}
}
}
I have isolated the following lines and tested them independently:
vtkObject* o = vtkPVInstantiator::CreateInstance(rname);
vtkXMLReader* reader = vtkXMLReader::SafeDownCast(o);
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
causing the segmentation fault, when calling a SafeDownCast(o) (which is NULL).
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,
but this fails, as well in my case) would be appreciated.
Kind Regards,
Bogdan
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.
--
Bogdan Daqui
Software Development
SimScale GmbH
Lichtenbergstraße 8
85748 Garching bei München
Phone: +49 (0)89 3398 4078
Email: bdaqui at simscale.de
Amtsgericht München, HRB 201813
Geschäftsführer: Vincenz Dölle & David Heiny
http://www.simscale.de
More information about the ParaView
mailing list