<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=us-ascii">
</head>
<body style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space; color: rgb(0, 0, 0); font-size: 14px; font-family: Georgia, sans-serif; ">
<div>Hi - I'm trying to project a dataset from one mesh (stored in an Exodus II file) onto another mesh (also, stored on an Exodus II file). I was hoping that I could do it with vtkProbe, in a fashion somewhat similar to: <a href="http://www.vtk.org/Wiki/VTK/Examples/Cxx/PolyData/InterpolateMeshOnGrid">http://www.vtk.org/Wiki/VTK/Examples/Cxx/PolyData/InterpolateMeshOnGrid</a>,
and I am hoping that it is just a simple oversight on my part. I wasn't sure if the mailing list took attachments ... I tried not to make them large.</div>
<div><br>
</div>
<div>(note that the "g" extension, namely the Genesis file format, is readable with the vtkExodusIIReader).</div>
<div>The script I was using doesn't seem to map anything at all I just get zero data?</div>
<div><br>
</div>
<div>
<div>
<div>import vtk</div>
<div>from math import exp, hypot</div>
<div><br>
</div>
<div>rdr1 = vtk.vtkExodusIIReader()</div>
<div>rdr1.SetFileName("waffly.g")</div>
<div>rdr1.Update()</div>
<div><br>
</div>
<div>rdr2 = vtk.vtkExodusIIReader()</div>
<div>rdr2.SetFileName("roundish.g")</div>
<div>rdr2.Update()</div>
<div><br>
</div>
<div>spot = vtk.vtkFloatArray()</div>
<div>spot.SetName("Gaussian Spot")</div>
<div>inputdata = rdr2.GetOutput().GetBlock(0).GetBlock(0)</div>
<div>outputdata = rdr1.GetOutput().GetBlock(0).GetBlock(0)</div>
<div><br>
</div>
<div>for i in range(inputdata.GetNumberOfPoints()):</div>
<div> x, y = inputdata.GetPoint(i)[:2]</div>
<div> r = hypot(x, y)</div>
<div> spot.InsertValue(i, exp(-r**2))</div>
<div><br>
</div>
<div>inputdata.GetPointData().SetScalars(spot)</div>
<div><br>
</div>
<div>#-------------#</div>
<div># Probe Stuff #</div>
<div>#-------------#</div>
<div>p = vtk.vtkProbeFilter()</div>
<div>p.SetInputData(outputdata)</div>
<div>p.SetSourceData(inputdata) # <-has scalars you want</div>
<div>p.Update()</div>
<div><br>
</div>
<div>#-----------------#</div>
<div># Rendering stuff #</div>
<div>#-----------------#</div>
<div>mapper1 = vtk.vtkDataSetMapper()</div>
<div>mapper1.SetInputData(inputdata)</div>
<div><br>
</div>
<div>mapper2 = vtk.vtkDataSetMapper()</div>
<div>mapper2.SetInputData(outputdata)</div>
<div><br>
</div>
<div>actor1 = vtk.vtkActor()</div>
<div>actor1.SetMapper(mapper1)</div>
<div><br>
</div>
<div>actor2 = vtk.vtkActor()</div>
<div>actor2.SetMapper(mapper2)</div>
<div><br>
</div>
<div>left_ren = vtk.vtkRenderer()</div>
<div>left_ren.SetViewport(0.0, 0.0, 0.5, 1.0)</div>
<div>left_ren.AddActor(actor1)</div>
<div><br>
</div>
<div>right_ren = vtk.vtkRenderer()</div>
<div>right_ren.SetViewport(0.5, 0.0, 1.0, 1.0)</div>
<div>right_ren.SetActiveCamera(left_ren.GetActiveCamera())</div>
<div>right_ren.AddActor(actor2)</div>
<div><br>
</div>
<div>renw = vtk.vtkRenderWindow()</div>
<div>renw.AddRenderer(left_ren)</div>
<div>renw.AddRenderer(right_ren)</div>
<div>renw.SetSize(800, 400)</div>
<div><br>
</div>
<div>iren = vtk.vtkRenderWindowInteractor()</div>
<div>iren.SetRenderWindow(renw)</div>
<div><br>
</div>
<div>left_ren.ResetCamera()</div>
<div>renw.Render()</div>
<div>iren.Start()</div>
</div>
</div>
</body>
</html>