[vtkusers] "manually" specify extents for vtkXMLPRectilinearGridWriter
Crni Gorac
cgorac at gmail.com
Mon Jul 23 16:28:17 EDT 2012
On Mon, Jul 23, 2012 at 6:50 PM, Andy Bauer <andy.bauer at kitware.com> wrote:
> You'll probably need to set the vtkInformation for the whole extent and the
> extent translator in your pipeline. The easiest way to do this may be by
> using a vtkTrivialProducer or the vtkPVTrivialProducer in Paraview.
>
Thanks for your reply. But I already have vtkRectilinearGrid set as
input to the vtkXMLPRectilinearGridWriter. Here follows relevant
snippets of my code (this code is called from corresponding MPI
processes dong the calculations):
// piece represented by this rectilinear grid is starting at point
(px0,py0,pz0),
// and its size is (pnx,pny,pnz), while the size of the whole computation
// domain is (nx,ny,nz)
vtkRectilinearGrid *grid = vtkRectilinearGrid::New();
grid->SetXCoordinates(x);
grid->SetYCoordinates(y);
grid->SetZCoordinates(z);
grid->SetWholeExtent(0, nx, 0, ny, 0, nz);
grid->SetExtent(px0, px0 + pnx, py0, py0 + pny, pz0, pz0 + pnz);
grid->GetCellData()->SetScalars(p);
// here, npieces is total number of pieces, and piece is index of current piece
// that get written
vtkXMLPRectilinearGridWriter *writer = vtkXMLPRectilinearGridWriter::New();
writer->SetNumberOfPieces(npieces);
writer->SetStartPiece(piece);
writer->SetEndPiece(piece);
writer->SetInput(grid);
writer->SetFileName(filename);
writer->Write();
My problem is that each individual .vtr file has correct WholeExtent
and Extent values (these are as I set them through SetWholeExtent()
and SetExtent() calls above. However, master .pvtr file has both
WholeExtent and Extent set wrong. It seems to me that these get
calculated from this piece information specified through
SetNumberOfPieces()( and SetStartPiece()/SetEndPiece() calls. I need
these calls as .vtr files get corresponding suffixes in its basename
(0, 1, etc.) only if I leave these calls, but I don't know how to tell
VTK to not calculate extents in the master file from these, but to use
WholeExtent/Extent info that I specified for each vtkRectilinearGrid
object.
More information about the vtkusers
mailing list