← Back to team overview

yade-users team mailing list archive



FilterEngine and ColorizedVelocityFilter is my answer on question about how to assign a color to bodies velocity when doing postprocess simulation results. In order to get a worked filters save simulation results (for example, with SQLiteRecorder),
after which load its with SimulationPlayer and add to engines list the desired filters (now it may be ColorizedVelocityFilter or ColorizedLayerFilter or you own). For example from python console do:

colorized_velocity = DeusExMachina('ColorizedVelocityFilter',{'autoScale':False,'minValue':0,'maxValue':1})
o.engines = o.engines +[colorized_velocity]

After this, click on refresh button in the SimulationPlayer filters tab and check "Allow filtration". After this filters will be recognized among another engines to a filter list and  will be setup FilterEngine::isFiltrationAllowed=true. Now after loading each frame will be doing: for each filter in the filter list do filter->action() if filter->isActivated(), how it is occurs for engines during simulation. To activate/deactivate certain filter setup isFilterActivated key, for example


ColorizedVelocityFilter calculate mean velocity of a body on last time interval and assign a color with this body from the color scale.
ColorizedLayerEngine assign a desired color with bodies, who lies in certain layer.

Best regards, Sergei D.