[vtkusers] PVTS, Multiblock or Both

Philip Sakievich psakievich at gmail.com
Sun Dec 18 01:16:16 EST 2016


Andy and community,

I have read about the concept of whole extent vs extent, but the one thing
I don't seem to be able to determine is how to set the  whole extent to be
different.  I tried using vtkStructuredGrid.Crop() but nothing is happening.

In the code snippet below, I have previously declared points local to each
processor.  I now want to populate a structured grid and write a *pvts that
ties them all together.  When I run this code the pvts writes itself and
the files, but they all have the same whole extent and extent.  Nothing is
cropped to the desired local extent.  What am I doing wrong?  How do I
specify a whole extent that is uniform across all processors, and a local
extent that is specific to each one?

#create grid and filter for processing to writer
pf=vtk.vtkProgrammableFilter()
sg=vtk.vtkStructuredGrid()

#set extent global
sg.SetExtent(0,15,0,32,0,15)

#set extent local
if rank==0:
   lE=np.array([0,8,0,32,0,8],dtype=int)
   sg.Crop(lE)
if rank==1:
   lE=np.array([0,8,0,32,7,15],dtype=int)
   sg.Crop(lE)
if rank==2:
   lE=np.array([7,15,0,32,0,8],dtype=int)
   sg.Crop(lE)
if rank==3:
   lE=np.array([7,15,0,32,7,15],dtype=int)
   sg.Crop(lE)

sg.SetPoints(pnts)
pf.SetInputData(sg)

writer=vtk.vtkXMLPStructuredGridWriter()
writer.SetInputConnection(pf.GetOutputPort())
writer.SetController(contr)
writer.SetDataModeToAscii()
writer.SetFileName('testgrid.pvts')
writer.SetNumberOfPieces(nranks)
writer.SetStartPiece(rank)
writer.SetEndPiece(rank)
writer.Write()

Thanks,

Phil

On Tue, Dec 13, 2016 at 7:31 AM, Andy Bauer <andy.bauer at kitware.com> wrote:

> Hi,
>
> I would recommend using the pvts format since that is the best format for
> storing structured grids. If you read it back in it will know how to
> properly partition the data set for different amounts of processes as well
> as do things like ghost cells, extract surfaces, etc.
>
> For topologically structured grids like vtkStructuredGrid there are two
> types of extents, "whole extent" describes the beginning and ending node
> (inclusive) in each direction for the entire grid while "extent" refers to
> each process's (or pieces if you're serial but doing streaming) partition
> of the grid. I believe this should be explained in the VTK User's Guide
> which is now available for free as a pdf download.
>
> Cheers,
> Andy
>
> On Tue, Dec 13, 2016 at 10:21 AM, Philip Sakievich <psakievich at gmail.com>
> wrote:
>
>> Greetings,
>>
>> I am reasonably new to vtk and I am mainly using it to manage datasets on
>> structured grids.
>>
>> I am trying to write data for a structured grid in parallel python via
>> MPI.  Each process has a separate portion of the grid, and I'm trying to
>> figure out how to set up the write process. I was following this example:
>>
>> http://www.vtk.org/gitweb?p=VTK.git;a=blob;f=IO/ParallelXML/
>> Testing/Python/testParallelXMLWriters.py
>>
>> But then I realized that in this case each process has the entire grid,
>> and each processor is just writing a portion of the data it contains.  So
>> do I need to use a multiblock data set?  Can someone please provide a
>> simple example of how to write a structured grid in parallel provided each
>> process has the local extent correctly specified?
>>
>> Thanks
>>
>> --
>> Phil Sakievich
>>
>> PhD Candidate - Mechanical Engineering
>> Arizona State University - Ira A. Fulton School for Engineering of Matter
>> Transport and Energy
>> Tempe, Arizona
>>
>> _______________________________________________
>> Powered by www.kitware.com
>>
>> Visit other Kitware open-source projects at
>> http://www.kitware.com/opensource/opensource.html
>>
>> Please keep messages on-topic and check the VTK FAQ at:
>> http://www.vtk.org/Wiki/VTK_FAQ
>>
>> Search the list archives at: http://markmail.org/search/?q=vtkusers
>>
>> Follow this link to subscribe/unsubscribe:
>> http://public.kitware.com/mailman/listinfo/vtkusers
>>
>>
>


-- 
Phil Sakievich

PhD Candidate - Mechanical Engineering
Arizona State University - Ira A. Fulton School for Engineering of Matter
Transport and Energy
Tempe, Arizona
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://public.kitware.com/pipermail/vtkusers/attachments/20161217/82484908/attachment.html>


More information about the vtkusers mailing list