[vtkusers] Single proxy class for a vector of vtkUnstructuredGrids

David E DeMarle dave.demarle at kitware.com
Thu Jun 14 16:21:13 EDT 2012


If you want lightweight shallow copies, the only option is a
multi-block data set. With that filters can treat the set as one item.
However you won't be able to call GetPoints and get a concatenated
list even with that because the vtkarrays are just references to
contiguous blocks of memory. As such individual elements can not be
shallow copies.

AppendPolyData will give you a contiguous array, but as you note this
is a deep copy of every element.


On Tue, Jun 12, 2012 at 4:46 AM, Andrew Parker
<andy.john.parker at googlemail.com> wrote:
> Does anybody have any further thoughts on this?  In particular a lightweight
> version of vtkappendfilter that does not copy?
>
> Cheers,
> Andy
>
>
> On 11 June 2012 13:54, Andrew Parker <andy.john.parker at googlemail.com>
> wrote:
>>
>> Hi,
>>
>> So that was exactly where I wanted to go, until I found that it was not a
>> true proxy, which is fine it wasn't intended to be, but instead copies
>> everything.  So I have had to delete components to save them being in memory
>> twice.  It is a shame this class cannot behave as is, except only in a
>> "shallow" fashion and not copy the data.  Indeed it would be also useful if
>> it maintained a reference to the original data such that if I called
>> Transform/modified one of the components then the original component would
>> be modified too.
>>
>> Is any of that possible, in particular the lightweight version in terms of
>> memory?
>>
>> Cheers,
>> Andy
>>
>>
>> On 11 June 2012 13:48, Bill Lorensen <bill.lorensen at gmail.com> wrote:
>>>
>>> Take a look at vtkAppendFilter.
>>>
>>> On Mon, Jun 11, 2012 at 4:37 AM, Andrew Parker
>>> <andy.john.parker at googlemail.com> wrote:
>>> > Hi,
>>> >
>>> > I have several vtkUnstructuredGrid(s) that I read in from disk, they
>>> > are
>>> > separate components of a large model.  For various reasons I'd like to
>>> > be
>>> > able to keep them separate but, for the majority of my program proxy
>>> > them
>>> > all by one interface as one single "glued" object of that type, in this
>>> > case
>>> > a single vtkUnstructuredGrid.  For example, if I have a file that I
>>> > read in
>>> > for a nut, and a second file for a bolt, I would like them to remain
>>> > separate, but pass around an object that allowed me to do, say
>>> > GetPoints(),
>>> > on a single vtkUnstructuredGrid object that gave me all the points in
>>> > both
>>> > the nut and bolt meshes.  Actually, I would like to in a sense have the
>>> > whole interface for vtkUnstructuredGrid and anything beneath it, but
>>> > behind
>>> > hold a vector of vtkUnstructuredGrids, or indeed another type,
>>> > vtkpolydata
>>> > for example.
>>> >
>>> > Is this possible?  I do not think the vtkMultiBlock... is what I want.
>>> >  Alternatively, if this is not possible, is there anything that will
>>> > allow
>>> > me to "add" using operator+ for example the nut and bolt together to
>>> > get a
>>> > single mesh back.  This is not really what I want but would suffice.
>>> >
>>> > I would much prefer the former, but the latter is fine if the former is
>>> > not
>>> > possible.
>>> >
>>> > Any help much appreciated.  Again, primary importance is one interface
>>> > that
>>> > under the hood is a vector of said types, where that type need not be a
>>> > vtkunstructuredGrid, but that would be ideal initially....
>>> >
>>> > Cheers again,
>>> > Andy
>>> >
>>> > _______________________________________________
>>> > 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
>>> >
>>> > Follow this link to subscribe/unsubscribe:
>>> > http://www.vtk.org/mailman/listinfo/vtkusers
>>> >
>>>
>>>
>>>
>>> --
>>> Unpaid intern in BillsBasement at noware dot com
>>
>>
>>
>>
>> --
>>
>> __________________________________
>>
>>    Dr Andrew Parker
>>
>>    Em at ilandrew.parker at cantab.net
>>
>>
>
>
>
> --
>
> __________________________________
>
>    Dr Andrew Parker
>
>    Em at ilandrew.parker at cantab.net
>
>
>
> _______________________________________________
> 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
>
> Follow this link to subscribe/unsubscribe:
> http://www.vtk.org/mailman/listinfo/vtkusers
>


David E DeMarle
Kitware, Inc.
R&D Engineer
21 Corporate Drive
Clifton Park, NY 12065-8662
Phone: 518-881-4909



More information about the vtkusers mailing list