Every script should state the API it was programmed for by setting
woo.master.usesApi=10177 # or (1,1,77) which is converted 10000*1+100*1+77
usesApi is smaller than
api, functions which changed their behavior in significant ways (other than fixing bugs) will issue a warning about possibly unexpected result. In that case, this page can be consulted to find out about was to update the code accordingly.
This page keeps track of major (and some minor) API changes for the purposes of updating the code and also for warning when older API is being used, possibly with different results.
This API change was commited Oct 3, 2017
woo.dem.Cp2_HertzMat_HertzPhys. This means that surface energy
surfEnergyand the Carpick-Ogletree-Solmeron
alphaparameter are passed through
woo.dem.HertzMatand can be different for different material, whereas previously they had to be set per-simulation.
woo.models.ContactModelSelectorwill raise an exception when its
surfEnergyare assigned, since that menas the user is not aware of this change.
Migration to the new API means using
woo.dem.HertzMat.alphato the material instance (not to the
woo.dem.Cp2_FrictMat_HertzPhysfunctor) and replacing
woo.models.ContactModelSelectoris used, material types have to be changed but new functors will be returned automatically.
This API change was commited Oct 23, 2015.
woo.dem.Grid1_Sphere.distFactor; accessing thsoe from Python (reading or writing) will raise
ValueErrorimmediately. These values were replaced by
DemField.distFactor, which is read from affected functors directly. This change ensures consistency of
distFactoraccross all functors and makes it easier to change everywhere.
A related change is that
woo.models.ContactModelSelector.distFactoris not set automatically in engines returned from
woo.dem.DemField.minimalEngines; this must be set by hand in
woo.dem.DemField.distFactor. A warning will be issued when API is smaller than 10103 and
This API change was commited Aug 5, 2015.
All “static” classes (i.e. classes with static attributes declared with
WOO_CLASS_BASE_DOC_STATICATTRSand similar) were converted to regular classes with per-instance attributes. It was done for architectural reasons and cleaner interfaces (e.g. saving rendering options along with the simulation). Some backwards-incompatible changes had to be introduced:
woo.dem.Tracermust be instantiated as any other engine, and multiple independent instances may exist. Since
Tracerwas mostly used from the UI (where the internals were adjusted), there are no issues expected.
All rendering classes and functors (
woo.gl.Gl1_DemFieldand all others) were converted to regular classes. Instances of rendering classes are contained in
S.glis automatically created (with defaults) on-demand if not assigned explicitly.
woo.gl.GlSetupcan be instantiated with arbitrary OpenGL functors passed as argument (shown below), and functors are accessed as in
Gl1removed and capital converted to lowercase).
S.glalso defines the
__call__operator, which accepts any GL functor instances, which will replace the ones already existing.
Assigning static attributes will not report any error, but will not do what you expect:
try: # try-block for running in headless mode import woo.gl woo.gl.Renderer.scaleOn=True # creates new class attribute scaleOn, no effect on rendering woo.gl.Gl1_Sphere.quality=5 except ImportError: pass # TODO: show the exception being raised
and should be replaced with
setup of the whole rendering through
try: import woo.gl S.gl=GlSetup(woo.gl.Renderer(scaleOn=True),woo.gl.Gl1_Sphere(quality=5)) except ImportError: pass
replacing only some functors and keeping the rest of
keeping everything (functors and
GlSetup) and only change individual parameters:
Construction (which used to result in assignment of static attributes) will have no effect, as the object will be immediately discarded:
and should be again replaced by using
S.gl=GlSetup(woo.gl.Gl1_DemField(shape='spheroids',colorBy='radius')) ## or S.gl.demField.shape='spheroids' S.gl.demField.colorBy='radius'
Warning will be issued when
Rendereror any GL functor is construted with arguments (such as
Gl1_Sphere(quality=4), but not for
Scene.any, which used to be a list of arbitrary
objectswas removed; it was mostly used for storing OpenGL renderers with the simulation (which is no longer necessary) and is functionally superseded by labeled objects in
Scene.anywas only sparsely documented, it was removed directly and an exception will be raised when accessed.
This API change was commited Jul 28, 2015.
S.dem.par.addnewly may add nodes of particles to
S.dem.nodes, depending on the optional argument
nodes, which is
-1by default. The default (-1) will add the node if it has mass, or prescribed velocity, angular velocity, or imposition; 0 will not add nodes, 1 will add all nodes. If any node is in
S.dem.nodes, it is silently skipped.
This change makes
woo.dem.DemField.collectNodeslargely obsolete, since nodes from particles are collected at the time they are added.
When script uses an older API, warning is issued for every use of
Introduced API versioning
Report issues or inclarities to github.