[vtkusers] VTK parallel I/O

Nico Schlömer nico.schloemer at gmail.com
Sat May 29 04:37:27 EDT 2010


Hi,

I'm just trying to get a grip on VTK's parallel I/O (mostly "O" for
now), and I thought I'd best start off of the vtkXMLImageDataWriter I
already have working here.
My code usually looked like

0. Declare
    vtkSmartPointer<vtkImageData>   imageData_;

1. Manually create a vtkDoubleArray and fill is with data that sits in
another non-VTK array X, e.g.,

    vtkSmartPointer<vtkDoubleArray> scalars =
vtkSmartPointer<vtkDoubleArray>::New();
    for ( int k=0; k<numPoints; k++ )
        scalars->InsertNextValue ( X[k] );
    imageData_->GetPointData()->AddArray ( scalars );

   -- This is already somewhat ugly it seems as the actual data is
stored twice in memory at this point.

2. Set everything else im imageData_

    imageData_->SetOrigin ( 0.0, 0.0, 0.0 );
    [...]

3. Plug the imageData_ into a writer and Write()

    vtkSmartPointer<vtkXMLImageDataWriter> writer =
vtkSmartPointer<vtkXMLImageDataWriter>::New();
    writer->SetFileName ( "myfile.vti" );
    writer->SetInput ( imageData_ );
    writer->Write();

So far, so good.
Now, for doing this in parallel, I'm not really sure how to proceed.
When looking at vtkXMLPImageDataWriter, I see that there is also such
member as SetInput(), but I'm not sure how to create the imageData_
such that the values are stores in parallel. We can assume that X
contains only the values valid for one process only.

Any hints?

Cheers,
Nico



More information about the vtkusers mailing list