[vtkusers] Setting extent of pieces in *pvts files vtk-7.0

Philip Sakievich psakievich at gmail.com
Tue Sep 6 00:37:20 EDT 2016


All,

I am trying to integrate vtk xml files into a parallel code I am using for
research.  I am not the original developer, but I am introducing new
functionality for post processing. I am able to write the *vts files
locally on each processor, and set the grid's extent for each of these
files.  I am trying to write the *pvts file on rank 0, but I haven't
figured out how to set the extent in this file so the defined pieces match
the individual vts files.  I am probably just missing a function call, so
if someone could help me out that would be great.  I have not been able to
find any examples online thus far.

Here is a section of the c++ code with the writer objects is included
below. I am calling this as a function from fortran (the main code is all
fortran) and I am passing the MPI rank as nPartition. Right now I only get
the extent of the grid stored on rank0 because that is where I am
generating the *pvts file.  The other files/pieces totally omit the extent
parameter and it won't read into paraview unless they are correct.

///---------------CODE SNIPPET------------------------------
        //Step 5: Setup writer object and write file
        int ext[6]={7,14,0,31,0,7};
        if(*nPartition==1)
                sGrid->SetExtent(ext); //THIS WORKS FOR THE *VTS FILES
        if(*nPartition!=0)
        {
                vtkSmartPointer<vtkXMLStructuredGridWriter> writer =
                        vtkSmartPointer<vtkXMLStructuredGridWriter>::New();
                writer->SetFileName(&stFileName[0]);
                writer->SetInputData(sGrid);
                writer->Write();
        }
        //Step 6: If partition zero write pvts vile
        if(*nPartition==0)
        {
                stPFileName+=".pvts";
                vtkSmartPointer<vtkXMLPStructuredGridWriter> pwriter =
                        vtkSmartPointer<vtkXMLPStructuredGridWriter>::New();
                pwriter->SetFileName(&stPFileName[0]);
                pwriter->SetInputData(sGrid);
                pwriter->SetNumberOfPieces(8);
                //pwriter->SetUpdateExtent(1,ext); //THIS DOESN'T SEEM TO
DO ANYTHING, INHERITED FROM vtkAlgorthim
                pwriter->Write();
        }

///---------------CODE SNIPPET------------------------------
///---------------PVTS FILE OUTPUT------------------------
<?xml version="1.0"?>
<VTKFile type="PStructuredGrid" version="0.1" byte_order="LittleEndian"
header_type="UInt32" compressor="vtkZLibDataCompressor">
  <PStructuredGrid WholeExtent="0 7 0 31 0 7" GhostLevel="0"> //NEED TO
MODIFY WHOLE EXTENT TOO
    <PPointData Scalars="temperature" Vectors="velocity">
      <PDataArray type="Float64" Name="velocity" NumberOfComponents="3"/>
      <PDataArray type="Float64" Name="pressure"/>
      <PDataArray type="Float64" Name="temperature"/>
    </PPointData>
    <PPoints>
      <PDataArray type="Float32" Name="Points" NumberOfComponents="3"/>
    </PPoints>
    <Piece Extent="0 7 0 31 0 7" Source="test_0.vts"/>
    <Piece Source="test_1.vts"/>
    <Piece Source="test_2.vts"/> //MISSING EXTENT HERE!!!
    <Piece Source="test_3.vts"/>
    <Piece Source="test_4.vts"/>
    <Piece Source="test_5.vts"/>
    <Piece Source="test_6.vts"/>
    <Piece Source="test_7.vts"/>
  </PStructuredGrid>
</VTKFile>--
///---------------PVTS FILE OUTPUT------------------------

Thanks,


Phil S
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://public.kitware.com/pipermail/vtkusers/attachments/20160905/b30a2cb7/attachment.html>


More information about the vtkusers mailing list