<div dir="ltr">This is great, thanks for taking time to get this working. I have one question, what is the purpose of the second vtkExtractTimeSteps?<br></div><div class="gmail_extra"><br><div class="gmail_quote">On Tue, May 15, 2018 at 2:13 AM, kenichiro yoshimi <span dir="ltr"><<a href="mailto:rccm.kyoshimi@gmail.com" target="_blank">rccm.kyoshimi@gmail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">Hello Andrew,<br>
<br>
I found a dirty way using vtkTemporalInterpolator and<br>
vtkExtractTimeSteps as follows, and you can set an arbitrary time<br>
value to "specifiedTime" within the code:<br>
<br>
----<br>
#!/usr/bin/env python<br>
import os<br>
import vtk<br>
import numpy as np<br>
<br>
specifiedTime = 0.18<br>
<br>
# Input file and variable<br>
filename = os.path.abspath('mug.e')<br>
nodal_var = 'convected'<br>
<br>
# Read Exodus Data<br>
reader = vtk.vtkExodusIIReader()<br>
reader.SetFileName(filename)<br>
reader.UpdateInformation()<br>
reader.SetTimeStep(10)<br>
reader.SetAllArrayStatus(vtk.<wbr>vtkExodusIIReader.NODAL, 1)<br>
#reader.Update(); print reader<br>
<br>
info = reader.GetExecutive().<wbr>GetOutputInformation().<wbr>GetInformationObject(0)<br>
key = vtk.<wbr>vtkStreamingDemandDrivenPipeli<wbr>ne.TIME_STEPS()<br>
times = np.array([info.Get(key,i) for i in range(info.Length(key))])<br>
index = np.max(np.where(times <= specifiedTime))<br>
<br>
extractTime = vtk.vtkExtractTimeSteps()<br>
extractTime.<wbr>SetInputConnection(0, reader.GetOutputPort(0))<br>
extractTime.<wbr>SetTimeStepIndices(2, [index, index+1])<br>
<br>
# Time interpolation (How do I set this up?)<br>
time = vtk.vtkTemporalInterpolator()<br>
time.SetInputConnection(0, extractTime.GetOutputPort(0))<br>
time.<wbr>SetDiscreteTimeStepInterval(<wbr>specifiedTime - times[index])<br>
time.UpdateTimeStep(<wbr>specifiedTime)<br>
<br>
extractTime2 = vtk.vtkExtractTimeSteps()<br>
extractTime2.<wbr>SetInputConnection(0, time.GetOutputPort(0))<br>
extractTime2.AddTimeStepIndex(<wbr>1)<br>
<br>
# Create Geometry<br>
geometry = vtk.<wbr>vtkCompositeDataGeometryFilter<wbr>()<br>
geometry.SetInputConnection(0, extractTime2.GetOutputPort(0))<br>
geometry.Update()<br>
<br>
writer = vtk.vtkExodusIIWriter()<br>
writer.SetInputConnection(0, geometry.GetOutputPort())<br>
writer.SetFileName('time.e')<br>
writer.WriteAllTimeStepsOn()<br>
writer.Write()<br>
<br>
# Mapper<br>
mapper = vtk.vtkPolyDataMapper()<br>
mapper.SetInputConnection(<wbr>geometry.GetOutputPort())<br>
mapper.SelectColorArray(nodal_<wbr>var)<br>
mapper.<wbr>SetScalarModeToUsePointFieldDa<wbr>ta()<br>
mapper.<wbr>InterpolateScalarsBeforeMappin<wbr>gOn()<br>
<br>
# Actor<br>
actor = vtk.vtkActor()<br>
actor.SetMapper(mapper)<br>
<br>
# Renderer<br>
renderer = vtk.vtkRenderer()<br>
renderer.AddViewProp(actor)<br>
<br>
# Window and Interactor<br>
window = vtk.vtkRenderWindow()<br>
window.AddRenderer(renderer)<br>
window.SetSize(600, 600)<br>
<br>
interactor = vtk.vtkRenderWindowInteractor(<wbr>)<br>
interactor.SetRenderWindow(<wbr>window)<br>
interactor.Initialize()<br>
<br>
# Show the result<br>
window.Render()<br>
interactor.Start()<br>
----<br>
<br>
Best<br>
<div><div class="h5"><br>
2018-05-11 2:06 GMT+09:00 Slaughter, Andrew E <<a href="mailto:andrew.slaughter@inl.gov">andrew.slaughter@inl.gov</a>>:<br>
> I was hoping someone could help me setup interpolation for ExodusII data.<br>
> The attached python scripts (I am using MacOS; python2.7; vtk7.1) reads the<br>
> ExodusII file (mug.e). I would like to be able to set an arbitrary time<br>
> value and have VTK perform the interpolation, would someone please help me<br>
> get this working? I have two versions I am working on, one using<br>
> vtkTemporalInterpolator and the other with vtkInterpolateDataSetAttribute<wbr>s.<br>
> I am happy using either class, I just need it to work.<br>
><br>
> I am aware that some of these features are built into Paraview, but my<br>
> project requires me to make this work with pure VTK.<br>
><br>
> Thanks,<br>
><br>
> Andrew<br>
><br>
</div></div>> ______________________________<wbr>_________________<br>
> Powered by <a href="http://www.kitware.com" rel="noreferrer" target="_blank">www.kitware.com</a><br>
><br>
> Visit other Kitware open-source projects at<br>
> <a href="https://urldefense.proofpoint.com/v2/url?u=http-3A__www.kitware.com_opensource_opensource.html&d=DwIBaQ&c=54IZrppPQZKX9mLzcGdPfFD1hxrcB__aEkJFOKJFd00&r=h7heP8xwI1i_HikChvhFbEBurKirgfOCdwgBxB9lM8c&m=puHckBK1HPjYo6fLuDnW7Rsr9yj_a2niN1Z4KRui5BM&s=E7mpGidBh-HqQHk8zv6FqPKcN2BAfHg5FyshFS96aAM&e=" rel="noreferrer" target="_blank">https://urldefense.proofpoint.<wbr>com/v2/url?u=http-3A__www.<wbr>kitware.com_opensource_<wbr>opensource.html&d=DwIBaQ&c=<wbr>54IZrppPQZKX9mLzcGdPfFD1hxrcB_<wbr>_aEkJFOKJFd00&r=h7heP8xwI1i_<wbr>HikChvhFbEBurKirgfOCdwgBxB9lM8<wbr>c&m=<wbr>puHckBK1HPjYo6fLuDnW7Rsr9yj_<wbr>a2niN1Z4KRui5BM&s=E7mpGidBh-<wbr>HqQHk8zv6FqPKcN2BAfHg5FyshFS96<wbr>aAM&e=</a><br>
><br>
> Please keep messages on-topic and check the VTK FAQ at:<br>
> <a href="https://urldefense.proofpoint.com/v2/url?u=http-3A__www.vtk.org_Wiki_VTK-5FFAQ&d=DwIBaQ&c=54IZrppPQZKX9mLzcGdPfFD1hxrcB__aEkJFOKJFd00&r=h7heP8xwI1i_HikChvhFbEBurKirgfOCdwgBxB9lM8c&m=puHckBK1HPjYo6fLuDnW7Rsr9yj_a2niN1Z4KRui5BM&s=__QxFPfkRQHlaX87BPaTQqC3-xiuwKePex8T9KtAD8Q&e=" rel="noreferrer" target="_blank">https://urldefense.proofpoint.<wbr>com/v2/url?u=http-3A__www.vtk.<wbr>org_Wiki_VTK-5FFAQ&d=DwIBaQ&c=<wbr>54IZrppPQZKX9mLzcGdPfFD1hxrcB_<wbr>_aEkJFOKJFd00&r=h7heP8xwI1i_<wbr>HikChvhFbEBurKirgfOCdwgBxB9lM8<wbr>c&m=<wbr>puHckBK1HPjYo6fLuDnW7Rsr9yj_<wbr>a2niN1Z4KRui5BM&s=__<wbr>QxFPfkRQHlaX87BPaTQqC3-<wbr>xiuwKePex8T9KtAD8Q&e=</a><br>
><br>
> Search the list archives at: <a href="https://urldefense.proofpoint.com/v2/url?u=http-3A__markmail.org_search_-3Fq-3Dvtkusers&d=DwIBaQ&c=54IZrppPQZKX9mLzcGdPfFD1hxrcB__aEkJFOKJFd00&r=h7heP8xwI1i_HikChvhFbEBurKirgfOCdwgBxB9lM8c&m=puHckBK1HPjYo6fLuDnW7Rsr9yj_a2niN1Z4KRui5BM&s=CNEA4K6JVEFn6AGYM0fYeW0rg6ENnWlIx_cTPpb7zHM&e=" rel="noreferrer" target="_blank">https://urldefense.proofpoint.<wbr>com/v2/url?u=http-3A__<wbr>markmail.org_search_-3Fq-<wbr>3Dvtkusers&d=DwIBaQ&c=<wbr>54IZrppPQZKX9mLzcGdPfFD1hxrcB_<wbr>_aEkJFOKJFd00&r=h7heP8xwI1i_<wbr>HikChvhFbEBurKirgfOCdwgBxB9lM8<wbr>c&m=<wbr>puHckBK1HPjYo6fLuDnW7Rsr9yj_<wbr>a2niN1Z4KRui5BM&s=<wbr>CNEA4K6JVEFn6AGYM0fYeW0rg6ENnW<wbr>lIx_cTPpb7zHM&e=</a><br>
><br>
> Follow this link to subscribe/unsubscribe:<br>
> <a href="https://urldefense.proofpoint.com/v2/url?u=https-3A__vtk.org_mailman_listinfo_vtkusers&d=DwIBaQ&c=54IZrppPQZKX9mLzcGdPfFD1hxrcB__aEkJFOKJFd00&r=h7heP8xwI1i_HikChvhFbEBurKirgfOCdwgBxB9lM8c&m=puHckBK1HPjYo6fLuDnW7Rsr9yj_a2niN1Z4KRui5BM&s=DJXa7N2JNLCUAVjyuFKhbN5PDsErajyMP1cjw0MJQyg&e=" rel="noreferrer" target="_blank">https://urldefense.proofpoint.<wbr>com/v2/url?u=https-3A__vtk.<wbr>org_mailman_listinfo_vtkusers&<wbr>d=DwIBaQ&c=<wbr>54IZrppPQZKX9mLzcGdPfFD1hxrcB_<wbr>_aEkJFOKJFd00&r=h7heP8xwI1i_<wbr>HikChvhFbEBurKirgfOCdwgBxB9lM8<wbr>c&m=<wbr>puHckBK1HPjYo6fLuDnW7Rsr9yj_<wbr>a2niN1Z4KRui5BM&s=<wbr>DJXa7N2JNLCUAVjyuFKhbN5PDsEraj<wbr>yMP1cjw0MJQyg&e=</a><br>
><br>
</blockquote></div><br></div>