[vtkusers] Error porting from VTK 5.10 to VTK 6.1
Cory Quammen
cory.quammen at kitware.com
Thu Nov 5 13:18:54 EST 2015
Could you provide some more information that might be helpful for debugging:
1). Are you using CMake to configure your project?
2). Could you provide a stack trace?
Thanks,
Cory
On Thu, Nov 5, 2015 at 11:55 AM, francesco.argese <kekko84 at gmail.com> wrote:
> Hello,
>
> I'm having problems trying to port an application from VTK 5.10 to VTK 6.1.
>
> The application is a simple LSDyna reader which loads the frames of the
> animation and stores them in a vector of actors; then it uses them for a
> conversion.
>
> The only modification needed to compile the code with VTK 6.1 is the
> following one:
> #ifdef __VTK_5__
> mapper.at(k)->SetInput(myData.at(k).GetPointer());
> #else
> mapper.at(k)->SetInputData(myData.at(k).GetPointer());
> #endif
>
> The error at runtime is generated when I call SetMapper function.
>
> The entire code with a note on the runtime error is below.
>
> What could be the problem?
>
> Francesco
>
>
> ---------------------------- CODE (BEGIN)
> -----------------------------------------
> int main(int argc, char **argv)
> {
> // 0) Parse command line arguments. First argument is path of dir
> containing LS-DYNA files
> if(argc != 2)
> {
> std::cout << "Usage: " << argv[0] << " directory path" <<
> std::endl;
> return EXIT_FAILURE;
> }
> std::string dir= argv[1]; // Save command-line argument to dir
> variable
>
> // 1) Use lsDyna reader to read file from lsDyna output
> vtkSmartPointer<vtkLSDynaReader> reader =
> vtkSmartPointer<vtkLSDynaReader>::New();
> reader->SetFileName(dir.c_str());
> reader->Update();
>
> // Extract a vector of actors from lsDynaReader
> std::vector<std::vector<vtkSmartPointer<vtkActor>>>
> vectorOfFrames;
> // every frame is a vector of actor
> for(unsigned int i = 0; i < reader->GetNumberOfTimeSteps(); i++)
> // loop
> over frames
> {
> // Set frame number and update
> reader->SetTimeStep(i);
> reader->Update();
>
> vtkMultiBlockDataSet* mbds = reader->GetOutput();
>
> std::vector<vtkSmartPointer<vtkDataSetMapper>> mapper;
> std::vector<vtkSmartPointer<vtkDataSet>> myData;
>
> std::vector<vtkSmartPointer<vtkActor>>
> actorsForThisFrame;
>
> for(unsigned int k=0; k<=mbds->GetNumberOfBlocks(); k++)
> {
> // Define a new mapper (process object to be
> related to the new vtkActor)
> and add it to vector of mappers
> vtkSmartPointer<vtkDataSetMapper> newMapper =
> vtkSmartPointer<vtkDataSetMapper>::New();
> // newMapper->SetScalarRange(0, 10);
> mapper.push_back(newMapper);
>
> // Take vtkDataSet extracted from
> multiBlockDataset extracted from
> lsDynaReader
> myData.push_back((vtkDataSet *)mbds->GetBlock(k));
>
> // Set dataset inserted as last mapper input
> #ifdef __VTK_5__
> mapper.at
> (k)->SetInput(myData.at(k).GetPointer());
> #else
> mapper.at
> (k)->SetInputData(myData.at(k).GetPointer());
> #endif
>
> // add a new vtkactor to vector of vtkActors
>
> actorsForThisFrame.push_back(vtkSmartPointer<vtkActor>::New());
>
> // Set mapper created as mapper of the vtkActor
> actorsForThisFrame.at(k)->SetMapper(mapper.at(k).GetPointer());
> // Here
> there is the run time error!!!
> }
>
> vectorOfFrames.push_back(actorsForThisFrame);
> }
> ---------------------------- CODE (END)
> -----------------------------------------
>
>
>
> --
> View this message in context:
> http://vtk.1045678.n5.nabble.com/Error-porting-from-VTK-5-10-to-VTK-6-1-tp5734818.html
> Sent from the VTK - Users mailing list archive at Nabble.com.
> _______________________________________________
> Powered by www.kitware.com
>
> Visit other Kitware open-source projects at
> http://www.kitware.com/opensource/opensource.html
>
> Please keep messages on-topic and check the VTK FAQ at:
> http://www.vtk.org/Wiki/VTK_FAQ
>
> Search the list archives at: http://markmail.org/search/?q=vtkusers
>
> Follow this link to subscribe/unsubscribe:
> http://public.kitware.com/mailman/listinfo/vtkusers
>
--
Cory Quammen
R&D Engineer
Kitware, Inc.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://public.kitware.com/pipermail/vtkusers/attachments/20151105/4db70e10/attachment.html>
More information about the vtkusers
mailing list