[vtkusers] reading a vtk file with time steps

francesco.argese kekko84 at gmail.com
Thu May 7 05:27:48 EDT 2015


Hello,

I'm trying to read a vtk file with time steps obtained through a CAE
simulation done with OpenFoam and resulting in a vtk output (through command
foamToVtk).

If I read it using ParaView I'm able to see time steps and to run
simulation.

I'm trying to convert it to another format so I need to retrieve polygons of
each time step. At the moment I'm using a vtkGenericDataObjectReader but it
seems not having support for time steps. Are there other readers that can
allow to read these information? I've already used LsDynaReader succeding in
this operation and I'm thinking using directly OpenFOAMReader but I have not
understod which is the input parameter to load it.

Any suggestions? Below the code I'm using to do these tests.

Thank you in advance,
Francesco

       // Get all data from the file
	mVtkReader = vtkSmartPointer<vtkGenericDataObjectReader>::New();
	mVtkReader->SetFileName(fileAbsPath.c_str());
	mVtkReader->Update();

	if( mVtkReader->GetErrorCode() != vtkErrorCode::NoError )
	{
		std::cout << "Output is a unstructured grid" << std::endl;
		return false;
	}

       if (mVtkReader->IsFileUnstructuredGrid())
	{	
		std::cout << "File is an unstructured grid" << std::endl;
		vtkUnstructuredGrid *uGrid = mVtkReader->GetUnstructuredGridOutput();

		// Create a mapper and actor
		vtkSmartPointer<vtkDataSetMapper> mapper =
vtkSmartPointer<vtkDataSetMapper>::New();
		mapper->SetInputConnection(mVtkReader->GetOutputPort());
		vtkSmartPointer<vtkActor> actor = vtkSmartPointer<vtkActor>::New();
		actor->SetMapper(mapper);
        }



--
View this message in context: http://vtk.1045678.n5.nabble.com/reading-a-vtk-file-with-time-steps-tp5731806.html
Sent from the VTK - Users mailing list archive at Nabble.com.


More information about the vtkusers mailing list