[Paraview] Customize programmable filters: copy arrays

Joachim Pouderoux joachim.pouderoux at kitware.com
Tue Nov 17 11:56:54 EST 2015


Dear Jean-Michel,

Yes, use PassData(), it will shallow copy the arrays from the input to the
output, then you can add new arrays to your output. DeepCopy will works too
but the input arrays will be copied and the copy will be affected to the
output. Use it only if you intend to change the arrays after the copy for
instance, to not alter the input arrays.

Best,
Joachim

*Joachim Pouderoux*

*PhD, Technical Expert*
*Kitware SAS <http://www.kitware.fr>*


2015-11-12 11:36 GMT+01:00 Jean-Michel Lucas <jm.lucas at gantha.com>:

> Thank you for your answers, both methods work fine.
>
> I am also adding new variables to the output, so if I understood Dennis'
> answer correctly, I should be using DeepCopy() ? However, using PassData(),
> it seems to me the new variable is only added to the output.
>
>
>
> Jean-Michel
>
>
>
> From: Dennis Conklin <dennis_conklin at goodyear.com>
>
> To: Berk Geveci <berk.geveci at kitware.com>
>
> Cc: "Paraview \(paraview at paraview.org\)" <paraview at paraview.org>
>
> Subject: Re: [Paraview] [EXT] Re: Customize programmable filters: copy
>
>                 arrays
>
> Message-ID:
>
>                 <
> SN1PR0701MB20295E1986716DD199DFBCF59F140 at SN1PR0701MB2029.namprd07.prod.outlook.com
> >
>
>
>
> Content-Type: text/plain; charset="utf-8"
>
>
>
> Berk,
>
>
>
> I generally want to add some new variables to the output ? if I don?t
> DeepCopy, then these new variables get added to the input which violates
> the vtk rule that a filter can?t change the input.
>
>
>
> This is the main reason that I advocate adding the capability for
> PointData and CellData to be partially DeepCopy (new variables added in
> Filter)  and partially ShallowCopy (input variables just along for the
> ride).
>
>
>
> I suspect most filters are going to generate new variables, so DeepCopy
> seems to be appropriate.     Please correct me if I misunderstand this.
>
>
>
> Dennis
>
>
>
> From: Berk Geveci [mailto:berk.geveci at kitware.com]
>
> Sent: Tuesday, November 10, 2015 3:40 PM
>
> To: Dennis Conklin <dennis_conklin at goodyear.com>
>
> Cc: Paraview (paraview at paraview.org) <paraview at paraview.org>
>
> Subject: [EXT] Re: [Paraview] Customize programmable filters: copy arrays
>
>
>
> Don't use DeepCopy() unless you intend to change the values of the output
> arrays. Use ShallowCopy() instead. You don't need CopyStructure() by the
> way. Alternatively, you can use PassData(). Something like this:
>
>
>
> output.GetPointData().PassData(inputs[0].GetPointData())
>
> output.GeCellData().PassData(inputs[0].GetCellData())
>
>
>
>
>
> Best,
>
> -berk
>
>
>
> On Tue, Nov 10, 2015 at 1:49 PM, Dennis Conklin <
> dennis_conklin at goodyear.com<mailto:dennis_conklin at goodyear.com>> wrote:
>
> Jean-Michel,
>
>
>
> I normally just add the following two statements within my Filter:
>
>
>
> output.CopyStructure(inputs[0].VTKObject)
>
> output.DeepCopy(inputs[0].VTKObject)
>
>
>
> Dennis
>
>
>
> _______________________________________________
> 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 ParaView Wiki at:
> http://paraview.org/Wiki/ParaView
>
> Search the list archives at: http://markmail.org/search/?q=ParaView
>
> Follow this link to subscribe/unsubscribe:
> http://public.kitware.com/mailman/listinfo/paraview
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://public.kitware.com/pipermail/paraview/attachments/20151117/23b482fb/attachment.html>


More information about the ParaView mailing list