Today I want to show you how to make fancy OSD-Information in PV3.12.
1st I made a new Custom Filter based on a programmable py-Filter.
I learned how to access the PV-Pipeline and getting Information about the current Timestep and number of points
COUNT=input.GetNumberOfPoints()
def GetUpdateTimesteps(algorithm):
executive = algorithm.GetExecutive()
outInfo = executive.GetOutputInformation(0)
if not outInfo.Has(executive.UPDATE_TIME_STEPS()):
return []
count = outInfo.Length(executive.UPDATE_TIME_STEPS())
timesteps = [outInfo.Get(executive.UPDATE_TIME_STEPS(), cc)
for cc in range(count)]
return timesteps
From the inputskript I know the simulation-Timestep and the dump-timestep so I can calculate simtime
timestep=0.000007
dumpstep=500
[...]
TS=GetUpdateTimesteps(self)[0]
simtime=TS*dumpstep*timestep+dumpstep*timestep
fc=TS*dumpstep+dumpstep #filecounter
Aditionaly I liked to know, how long the CPU time was. The easiest way is to look at the timesteps of the dumpfile
file_stats = os.stat("post/"+filename)
ct=time.strftime("%d.%m.%Y %H:%M:%S",time.localtime(file_stats[stat.ST_MTIME]))
filename0="dump_%i.liggghts" % dumpstep
file_stats0 = os.stat("post/"+filename0)
lt=time.localtime(file_stats[stat.ST_MTIME]-file_stats0[stat.ST_MTIME])
diff_sek = file_stats[stat.ST_MTIME]-file_stats0[stat.ST_MTIME]
lt=diff_time(diff_sek)
ct0="%i %02i:%02i:%02i" % (lt[1],lt[2],lt[3],lt[4])
At the end just put all together
outputarray = vtk.vtkStringArray()
outputarray.SetName("Text")
outputarray.SetNumberOfTuples(1)
outputarray.SetValue(0,"%s\r\n%s\r\nt=%1.4fs\r\nN=%1.0f\r\nLIGGGHTS 1.5" % (filename,ct0,simtime,COUNT))
output.GetRowData().AddArray(outputarray)
I attached a InfoLabelFilter.xml that you can import to PV and add via Sources->Filters->Alphabetical->Infolabelfilter
You have to change timestep and dumpstep in the head to your needs.
Greez,
Christian
Attachment | Size |
---|---|
![]() | 1.4 KB |
![]() | 400.94 KB |
ckloss | Sat, 01/21/2012 - 22:49
That looks very nice - thanks
That looks very nice - thanks for sharing this!
Cheers, Christoph
Claudio Wolfer | Mon, 01/30/2012 - 08:47
Import in PV
Hi Christian
Thanks for programming this filter.
But I don't know how to import this .xml into PV.
Thanks for advice.
Claudio
richti83 | Mon, 01/30/2012 - 11:50
in Paraview Menu:
in Paraview Menu: Tools->Manage Custom Filters->Import :-)
jtvanlew | Fri, 06/08/2012 - 19:39
Hi Christian, From your
Hi Christian,
From your screenshot, this looks like an excellent little addition. Thanks for putting this together.
Can anyone else chime in with some advice here? I had to alter a few lines in the filter to match my dump filename and the timestep/dump step. I think I've got it all cleaned up now but when I apply the filter I get this error
ERROR: In /Source/ParaView/release/ParaView/VTK/Rendering/vtkOpenGLTexture.cxx, line 196
vtkOpenGLTexture (0x12ddd41c0): No scalar values found for texture input!
Then every time I manipulate the image in paraview's viewer, that error continuously pops up. As soon as I delete the filter, those errors go away. I did a little Google'ing on lines from the error but nothing popped out to me as being applicable.
If it matters, I'm using a mac OS X 10.6.8 with Paraview 3.14.1