<div dir="ltr">I put together a Programmable Filter.
I do not know if this is the most efficient way to do it, but it works.
<div class="gmail-post-text"><pre><code>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)
</code></pre>
</div><br><br><div class="gmail_extra"><br><div class="gmail_quote">On Tue, Feb 20, 2018 at 8:37 PM, Santiago Serebrinsky <span dir="ltr"><<a href="mailto:sserebrinsky@gmail.com" target="_blank">sserebrinsky@gmail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr"><p>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).</p>
<p><b>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.</b></p>
<p>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.</p><br><p><b>Mathematical description of an example</b>:</p>
<p>Discontinuous field: u(x,y)</p>
<p>Domain of discontinuity: x axis, y=0</p>
<p>Value of the field on one side of the domain of discontinuity: u(x+,0)</p>
<p>Value of the field on the other side of the domain of discontinuity: u(x-,0)</p>
<p>Jump in the field: d(x) = u(x+,0) - u(x-,0)</p>
<p>The field u is defined on a 2D domain. The field d is defined on a 1D domain (x axis).</p><br><br></div>
</blockquote></div><br></div></div>