fancy On-Screen-Display for Paraview

richti83's picture
Submitted by richti83 on Thu, 01/19/2012 - 15:09

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

AttachmentSize
Binary Data InfoLabelFilter.xml_.tar_.gz1.4 KB
Image icon OSD.png400.94 KB
Claudio Wolfer's picture

Claudio Wolfer | Mon, 01/30/2012 - 08:47

Hi Christian

Thanks for programming this filter.
But I don't know how to import this .xml into PV.

Thanks for advice.
Claudio

jtvanlew | Fri, 06/08/2012 - 19:39

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

jon