Release v2.0.0
What's Changed
- Add Warning in case of running into floating point arithmetic issues
- Add class
GravityEvaluable
to cache common properties in multi-point evaluation - Add option to disable the
parallelisation
(if built with any) during runtime
Details
This change included a small change to the Python API, which might break current code!
- The naming of the arguments changed
- The evaluate method takes
vertices
andfaces
as a tuple now, rather than as separate arguments
import polyhedral_gravity as model
# The "free function" evaluate has now always three arguments (or an optional fourth one)
# The keywords of the signature are now always the SAME!
# So the third argument takes computation_points or a SINGLE computation_point
# Optionally with the keyword prefix
# The "parallel" argument allows to disable the parallelization
model.evaluate(polyhedral_source=(vertices, faces), density=1.0, computation_points=[..], parallel=True)
# Removed signature (vertices and faces as separate arguments)
# model.evaluate(vertices, faces, density=1.0, computation_points=[..])
GravityEvaluable
speeds up the runtime by around factor 30 if one wants to compute multiple points one by one - e.g. when propagating a trajectory.
import polyhedral_gravity as model
# Construction like above, but only with the two "persistent" arguments
evaluable = model.GravityEvaluable((vertices, faces), density)
for i in range(N):
# The second argument is optional and defaults to True
evaluable(computation_points[i], parallel=True)
Results from comparing the old & new interface (N=1, so small runtime differences are not really expressive)
1000 random sampled points around Eros using Apple Clang 14, M1 Pro and the TBB Backend.
######## Old Single-Point ########
--> 1000 times 1 point with old interface
--> Time taken: 7862.830 microseconds per point
######## Old Multi-Point ########
--> 1 time N points with old interface
--> Time taken: 271.561 microseconds per point
######## GravityEvaluable (Single-Point) #########
--> 1000 times 1 point with GravityEvaluable
--> Time taken: 331.350 microseconds per point
######## GravityEvaluable (Multi-Point) ########
--> 1 time 1000 points with GravityEvaluable
--> Time taken: 255.692 microseconds per point
Full Changelog: v1.2.1...v2.0.0
EDIT: This is a re-release including fixes for the conda-deployment