[Paraview-developers] C interface to write VTK XML files
Mathieu Malaterre
mathieu.malaterre at kitware.com
Tue Jun 28 10:43:56 EDT 2005
Full documentation can be found in:
VTK/IO/vtkXMLWriterC.h
VTK/IO/vtkXMLWriterC.cxx
A simple test of writing a timestep cube can be found at:
VTK/IO/Testing/Cxx/TestXMLCInterface.c
-------------------------------------------
The basic idea was to provide an OO-like C interface to access the
vtkXML*Writer classes. The C interface hold a reference to the
vtkDataSet you are writting. So the main difference between a C++ code
and the equivalent C code is that you are passing structure directly to
the writer (instead of creating a vtkDataSet).
For example the C++ code:
vtkXMLWriter *writer = vtkXMLWriter::New();
vtkUnstructuredGrid *ug = vtkUnstructuredGrid::New();
writer->SetInput( ug );
writer->SetFileName( "bla.vtu" );
ug->SetPoints( mypoints );
...
writer->Write();
becomes:
vtkXMLWriterC* writer = vtkXMLWriterC_New();
/* #define VTK_UNSTRUCTURED_GRID 4 */
vtkXMLWriterC_SetDataObjectType(writer, 4);
vtkXMLWriterC_SetFileName(writer, "bla.vtu");
vtkXMLWriterC_SetPoints(writer, 10, mypoints_raw_pointer, NPOINTS);
...
vtkXMLWriterC_Write(writer);
Mathieu
More information about the Paraview-developers
mailing list