[vtkusers] PVTS, Multiblock or Both

Andy Bauer andy.bauer at kitware.com
Thu Dec 22 17:35:45 EST 2016


If you want to use VTK as an in situ library instead of reading data in
from disk I strongly recommended looking at ParaView Catalyst (
http://www.paraview.org/in-situ/). You can use a vtkTrivialProducer to have
the data layout you want but if I understand what you're trying to do
you'll probably want to use a VTK composite data set with each process
having its own data set.

On Thu, Dec 22, 2016 at 12:07 AM, Philip Sakievich <psakievich at gmail.com>
wrote:

> I'm unclear on how to work with this if I don't specify the local extent.
> In my code I am subdividing my computational domain so the data is unique
> on each processor, doing work and then dumping the results.  It is
> completely distributed and the processors don't share any data except on
> the boundaries.  I already know the global and local extents and now I need
> the local extent in the pvts to line up with the other portions of my
> code.  I don't want the pipeline to give me the local extent unless I can
> get it to match the extent I've already specified.
>
>  At this point, it is almost seeming easier to write a script that writes
> the *pvts for me instead of using the pipeline, but it frustrates me that I
> can't get the pipeline to do what I want. I'm trying to learn VTK in a
> broad sense in my spare time. However, for this specific problem the only
> thing I need is for the PVTS file to have the LocalExtents match my
> datasets on each of the processors. If I can just solve this all of my
> problems will be over. I am still wrapping my head around the pipeline
> concept, but it has been a struggle since there aren't many examples for
> the problem I'm trying to work with.  I'm actually not doing any rendering.
> I'm just managing IO.
>
> I looked at the source you mentioned, but I'm not sure where I am supposed
> to interact with the RequestInformation request. I'm assuming it will be in
> the filter that is the input to vtkXMLPStructuredGridWriter, but I haven't
> really worked with any filters since I've only been doing IO.  With the
> programmable filter example
> <http://www.vtk.org/gitweb?p=VTK.git;a=blob;f=IO/ParallelXML/Testing/Python/testParallelXMLWriters.py>,
> I can get it to write local extents that differ from the WholeExtent but
> they do not match my datasets. (In this case I just copied the execute
> function).
>
> Also, I don't really see why it is necessary to specify the WholeExtent in
> RequestInformation.  I can specify the WholeExtent via vtkStructuredGrid.SetDimensions(),
> or SetExtent and it works fine.  It's just that the LocalExtents aren't
> correct. I think I'm really hitting a roadblock because I don't understand
> how the parallel writer and the partitioning works with the pipeline.
>
> Can you provide some specifics on how the partitioning is supposed to work
> and/or help me modify the code in my previous example to do what I'm
> looking for? Either that or specify an open source code that has
> implemented vtkXMLPStructuredGridWriter that I can review.  My
> application is a CFD solver and it's post processing routines.
>
>
>
> On Mon, Dec 19, 2016 at 7:18 AM, Andy Bauer <andy.bauer at kitware.com>
> wrote:
>
>> You need to specify the WholeExtent in the RequestInformation request.You
>> actually don't specify the local extent, the pipeline will give you that
>> for a source. I'd recommend looking at the Imaging/Core/vtkRTAnalyticSource.cxx
>> class in VTK to see how it's done as a source.
>>
>>
>> On Sun, Dec 18, 2016 at 1:16 AM, Philip Sakievich <psakievich at gmail.com>
>> wrote:
>>
>>> 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
>>>
>>
>>
>
>
> --
> 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/20161222/0d73d289/attachment.html>


More information about the vtkusers mailing list