mpacts.contact.detectors. supercontactdetector

In order to be able to use this module import it like this:

import mpacts.contact.detectors.supercontactdetector
#or assign it to a shorter name
import mpacts.contact.detectors.supercontactdetector as sup

SuperContactDetectorAABB

class mpacts.contact.detectors.supercontactdetector.SuperContactDetectorAABB(name, parent, **kwargs)

Bases: mpacts.core.command.PythonCommand

Makes all needed contact detectors in the heuristically most efficient way.

Specifically, this “Super contact detector” uses brute-force, sweep-and-prune or multigrid-contact detection, depending on the number/range of pre-calculated axis-aligned bounding boxes (AABBs).

Parameters:

  • name (common part of the) name of the generated CDs as well as this->name()
  • parent should almost always be the simulation object (mysim).
  • cmodels list of contact models
  • margins either one scalar >0., then the same margin is added everywhere, or dictionary with keys corresponding to the full names of the particle containers (as in: pc.path(pc.root_node()) ). If the list of pcs is incomplete, we take the largest margin for all others.
  • keep_distance alias for margins.
  • update_every number of time steps in between full contact detections
  • update_every alias for update_every, for historical reasons ;-).
  • gate by default, ExecuteOnce, but you can re-execute this command, if your particle numbers vary.
SuperContactDetectorAABB(name, parent, **kwargs)
add_aabb_generators()

add generators, should be safe to call repeatedly since we check if the name exists...

execute()

The overloaded function making the actual contact-detection commands

make_BruteforceCD(cmodel)
make_CD(cmodel, aabbprops1, aabbprops2)

Make a single contact detector for a given contact model

heuristic guesses for what’s best - this should be tested and extended!

make_MGridCD(cmodel)
make_SAPCD(cmodel)
make_members(**kwargs)

Set necessary member variables: cmodels_, margins_, update_every_, pcs_, pcnames_