VTK/Examples/Cxx/Broken/IO/XMLPUnstructuredGridWriter

From KitwarePublic

Jump to: navigation, search

Even with SetNumberOfPieces(4), only 2 files (Test.pvtu and Test_0.vtu) are generated.

XMLPUnstructuredGridWriter.cxx

#include <vtkSmartPointer.h>
#include <vtkXMLPUnstructuredGridWriter.h>
#include <vtkPointSource.h>
#include <vtkDelaunay3D.h>
 
int main(int, char *[])
{
  vtkSmartPointer<vtkPointSource> pointSource =
    vtkSmartPointer<vtkPointSource>::New();
  pointSource->Update();
 
  vtkSmartPointer<vtkDelaunay3D> delaunay =
    vtkSmartPointer<vtkDelaunay3D>::New();
  delaunay->SetInputConnection(pointSource->GetOutputPort());
  delaunay->Update();
 
  vtkSmartPointer<vtkXMLPUnstructuredGridWriter> writer =
    vtkSmartPointer<vtkXMLPUnstructuredGridWriter>::New();
  writer->SetInputConnection(delaunay->GetOutputPort());
  writer->SetFileName("Test.pvtu");
  writer->SetNumberOfPieces(4);
  writer->Update();
 
  return EXIT_SUCCESS;
}

CMakeLists.txt

cmake_minimum_required(VERSION 2.6)
 
PROJECT(XMLPUnstructuredGridWriter)
 
FIND_PACKAGE(VTK REQUIRED)
INCLUDE(${VTK_USE_FILE})
 
ADD_EXECUTABLE(XMLPUnstructuredGridWriter XMLPUnstructuredGridWriter.cxx)
TARGET_LINK_LIBRARIES(XMLPUnstructuredGridWriter vtkHybrid)
Personal tools