Re: [Paraview] Create filter with jump in fields

2018-02-21 Thread Santiago Serebrinsky
I put together a Programmable Filter. I do not know if this is the most
efficient way to do it, but it works.

programmableFilter1 =
ProgrammableFilter(Input=[plotOverLineBot,plotOverLineTop])
programmableFilter1.Script = """
import vtk.util.numpy_support as ns
import numpy as np

input_bot = self.GetInputDataObject(0, 0);
input_top = self.GetInputDataObject(0, 1);
output = self.GetPolyDataOutput()
#output.ShallowCopy(input_bot)

npts_bot = input_bot.GetNumberOfPoints()
npts_top = input_top.GetNumberOfPoints()
if ( npts_bot == npts_top ) :
print( "Number of points: " + str(npts_bot) )
u_bot = input_bot.GetPointData().GetArray("displacement")
u_top = input_top.GetPointData().GetArray("displacement")
u_bot_np = ns.vtk_to_numpy(u_bot)
u_top_np = ns.vtk_to_numpy(u_top)
u_jump_np = np.subtract(u_top_np, u_bot_np)
u_jump = ns.numpy_to_vtk(u_jump_np)
u_jump.SetName("displacement jump");
output.GetPointData().AddArray(u_jump)
else :
pass
"""

programmableFilter1.RequestInformationScript = ''
programmableFilter1.RequestUpdateExtentScript = ''
programmableFilter1.PythonPath = ''
RenameSource("Programmable Filter - Jumps", programmableFilter1)




On Tue, Feb 20, 2018 at 8:37 PM, Santiago Serebrinsky <
sserebrin...@gmail.com> wrote:

> I have a dataset with discontinuous displacements across a few surfaces
> (so far I am working in 2D, so these would be lines, 1D). It is input as a
> PVDReader (just in case it makes any difference here, which I doubt).
>
> *Is there any way to programmatically create a new Source with the
> displacement jumps along those lines? Note that this new field would
> probably have to be defined on a domain with a lower dimension, see above.*
>
> So far, I created filters PlotOverLine, on lines slightly below and
> slightly above the prescribed line. But I do not know how to subtract the
> two and place them in a single field over the line.
>
> *Mathematical description of an example*:
>
> Discontinuous field: u(x,y)
>
> Domain of discontinuity: x axis, y=0
>
> Value of the field on one side of the domain of discontinuity: u(x+,0)
>
> Value of the field on the other side of the domain of discontinuity:
> u(x-,0)
>
> Jump in the field: d(x) = u(x+,0) - u(x-,0)
>
> The field u is defined on a 2D domain. The field d is defined on a 1D
> domain (x axis).
>
>
>
___
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:
https://public.kitware.com/mailman/listinfo/paraview


[Paraview] Create filter with jump in fields

2018-02-20 Thread Santiago Serebrinsky
I have a dataset with discontinuous displacements across a few surfaces (so
far I am working in 2D, so these would be lines, 1D). It is input as a
PVDReader (just in case it makes any difference here, which I doubt).

*Is there any way to programmatically create a new Source with the
displacement jumps along those lines? Note that this new field would
probably have to be defined on a domain with a lower dimension, see above.*

So far, I created filters PlotOverLine, on lines slightly below and
slightly above the prescribed line. But I do not know how to subtract the
two and place them in a single field over the line.

*Mathematical description of an example*:

Discontinuous field: u(x,y)

Domain of discontinuity: x axis, y=0

Value of the field on one side of the domain of discontinuity: u(x+,0)

Value of the field on the other side of the domain of discontinuity: u(x-,0)

Jump in the field: d(x) = u(x+,0) - u(x-,0)

The field u is defined on a 2D domain. The field d is defined on a 1D
domain (x axis).
___
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:
https://public.kitware.com/mailman/listinfo/paraview


[Paraview] Paraview programmatically plot quantities over line, using only data on nodes

2018-02-19 Thread Santiago Serebrinsky
Hello,

I have a dataset on a 2D domain. I mean to get an XY plot of data along a
line which contains a number of element edges. I would typically do this
with PlotOverLine.

Now I want to obtain a similar plot, but with my data points located only
at the actual locations of nodes in my mesh. In this way, my XY plot (and
its underlying data) would be directly representative of the mesh
resolution in my original data.

*How can this be done programmatically, 1) from the UI as a macro, 2) from
the UI at the python shell, 3) at the CLI (pvpython myscript.py)?*

I couldn't even find how to do this via GUI. I started by *Select Points On*,
but I couldn't go any further. Moreover, if this is the right way to start,
I wouldn't be able to transfer it to python code, since *Start Trace* does
not include *Select Points On* in the output trace, so I wouldn't know how
to add it to code.
Thanks!
___
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:
https://public.kitware.com/mailman/listinfo/paraview