Logo Search packages:      
Sourcecode: yade version File versions  Download package

Classes | Public Member Functions | Public Attributes | Private Member Functions | Static Private Member Functions | Private Attributes

InsertionSortCollider Class Reference

Inheritance diagram for InsertionSortCollider:
Inheritance graph
Collaboration diagram for InsertionSortCollider:
Collaboration graph

List of all members.


struct  Bounds
 struct for storing bounds of bodies More...
struct  VecBounds

Public Member Functions

virtual void action ()
virtual void callPostLoad (void)
virtual void checkPyClassRegistersItself (const std::string &thisClassName) const
void findBoundDispatcherInEnginesIfNoFunctorsAndWarn ()
virtual string getBaseClassName (unsigned int i=0) const
virtual int getBaseClassNumber ()
virtual void invalidatePersistentData ()
virtual bool isActivated ()
bool mayCollide (const Body *, const Body *)
bool operator!= (const Serializable &other)
bool operator== (const Serializable &other)
vector< Body::id_t > probeBoundingVolume (const Bound &)
virtual boost::python::dict pyDict () const
virtual void pyHandleCustomCtorArgs (boost::python::tuple &args, boost::python::dict &kw)
virtual void pyHandleCustomCtorArgs (python::tuple &t, python::dict &d)
virtual void pyRegisterClass (boost::python::object _scope)
virtual void pySetAttr (const std::string &key, const boost::python::object &value)
std::string pyStr ()
 string representation of this object
void pyUpdateAttrs (const boost::python::dict &d)
template<class ArchiveT >
void serialize (ArchiveT &ar, unsigned int version)
bool shouldBeErased (Body::id_t id1, Body::id_t id2, Scene *rb) const
 Predicate called from loop within InteractionContainer::erasePending.
 YADE_CLASS_BASE_DOC (GlobalEngine, Engine,"Engine that will generally affect the whole simulation (contrary to PartialEngine).")
 YADE_CLASS_BASE_DOC_ATTRS (Collider, GlobalEngine,"Abstract class for finding spatial collisions between bodies. \n\n.. admonition:: Special constructor\n\n\tDerived colliders (unless they override ``pyHandleCustomCtorArgs``) can be given list of :yref:`BoundFunctors <BoundFunctor>` which is used to initialize the internal :yref:`boundDispatcher <Collider.boundDispatcher>` instance.",((shared_ptr< BoundDispatcher >, boundDispatcher, new BoundDispatcher, Attr::readonly,":yref:`BoundDispatcher` object that is used for creating :yref:`bounds <Body.bound>` on collider's request as necessary.")))
 YADE_CLASS_BASE_DOC_ATTRS_CTOR_PY (InsertionSortCollider, Collider,"\ Collider with O(n log(n)) complexity, using :yref:`Aabb` for bounds.\ \n\n\ At the initial step, Bodies' bounds (along sortAxis) are first std::sort'ed along one axis (sortAxis), then collided. The initial sort has :math:`O(n^2)` complexity, see `Colliders' performance <https://yade-dem.org/index.php/Colliders_performace>`_ for some information (There are scripts in examples/collider-perf for measurements). \ \n\n \ Insertion sort is used for sorting the bound list that is already pre-sorted from last iteration, where each inversion calls checkOverlap which then handles either overlap (by creating interaction if necessary) or its absence (by deleting interaction if it is only potential). \ \n\n \ Bodies without bounding volume (such as clumps) are handled gracefully and never collide. Deleted bodies are handled gracefully as well.\ \n\n \ This collider handles periodic boundary conditions. There are some limitations, notably:\ \n\n \ #. No body can have Aabb larger than cell's half size in that respective dimension. You get exception it it does and gets in interaction.\ \n\n \ #. No body can travel more than cell's distance in one step; this would mean that the simulation is numerically exploding, and it is only detected in some cases.\ \n\n \ **Stride** can be used to avoid running collider at every step by enlarging the particle's bounds, tracking their velocities and only re-run if they might have gone out of that bounds (see `Verlet list <http://en.wikipedia.org/wiki/Verlet_list>`_ for brief description and background) . This requires cooperation from :yref:`NewtonIntegrator` as well as :yref:`BoundDispatcher`, which will be found among engines automatically (exception is thrown if they are not found).\ \n\n \ If you wish to use strides, set ``sweepLength`` (length by which bounds will be enlarged in all directions) to some value, e.g. 0.05 × typical particle radius. This parameter expresses the tradeoff between many potential interactions (running collider rarely, but with longer exact interaction resolution phase) and few potential interactions (running collider more frequently, but with less exact resolutions of interactions); it depends mainly on packing density and particle radius distribution.\ \n\n \ If you additionally set ``nBins`` to >=1, not all particles will have their bound enlarged by ``sweepLength``; instead, they will be put to bins (in the statistical sense) based on magnitude of their velocity; ``sweepLength`` will only be used for particles in the fastest bin, whereas only proportionally smaller length will be used for slower particles; The coefficient between bin's velocities is given by ``binCoeff``.\ ",((int, sortAxis, 0,,"Axis for the initial contact detection."))((bool, sortThenCollide, false,,"Separate sorting and colliding phase; it is MUCH slower, but all interactions are processed at every step; this effectively makes the collider non-persistent, not remembering last state. (The default behavior relies on the fact that inversions during insertion sort are overlaps of bounding boxes that just started/ceased to exist, and only processes those; this makes the collider much more efficient.)"))((Real, sweepLength,((void)"Stride deactivated",-1),,"Length by which to enlarge particle bounds, to avoid running collider at every step. Stride disabled if negative."))((Real, sweepFactor, 1.05,,"Overestimation factor for the sweep velocity; must be >=1.0. Has no influence on sweepLength, only on the computed stride. [DEPRECATED, is used only when bins are not used]."))((Real, fastestBodyMaxDist,-1,,"Maximum displacement of the fastest body since last run; if >= sweepLength, we could get out of bboxes and will trigger full run. DEPRECATED, was only used without bins. |yupdate|"))((int, nBins, 0,,"Number of velocity bins for striding. If <=0, bin-less strigin is used (this is however DEPRECATED)."))((Real, binCoeff, 5,,"Coefficient of bins for velocities, i.e. if ``binCoeff==5``, successive bins have 5 × smaller velocity peak than the previous one. (Passed to VelocityBins)"))((Real, binOverlap, 0.8,,"Relative bins hysteresis, to avoid moving body back and forth if its velocity is around the border value. (Passed to VelocityBins)"))((Real, maxRefRelStep,.3,,"(Passed to VelocityBins)"))((int, histInterval, 100,,"How often to show velocity bins graphically, if debug logging is enabled for VelocityBins."))((int, numReinit, 0, Attr::readonly,"Cummulative number of bound array re-initialization.")), for(int i=0;i< 3;i++) BB[i].axis=i;periodic=false;strideActive=false;,.def_readonly("strideActive",&InsertionSortCollider::strideActive,"Whether striding is active (read-only; for debugging). |yupdate|").def_readonly("periodic",&InsertionSortCollider::periodic,"Whether the collider is in periodic mode (read-only; for debugging) |yupdate|").def("dumpBounds",&InsertionSortCollider::dumpBounds,"Return representation of the internal sort data. The format is ``([...],[...],[...])`` for 3 axes, where each ``...`` is a list of entries (bounds). The entry is a tuple with the fllowing items:\n\n* coordinate (float)\n* body id (int), but negated for negative bounds\n* period numer (int), if the collider is in the periodic regime."))

Public Attributes

shared_ptr< TimingDeltastimingDeltas
 precise profiling information (timing of fragments of the engine)
TimingInfo timingInfo
 high-level profiling information; not serializable

Private Member Functions

python::tuple dumpBounds ()
void handleBoundInversion (Body::id_t, Body::id_t, InteractionContainer *, Scene *)
void handleBoundInversionPeri (Body::id_t, Body::id_t, InteractionContainer *, Scene *)
void insertionSort (VecBounds &v, InteractionContainer *, Scene *, bool doCollide=true)
void insertionSortPeri (VecBounds &v, InteractionContainer *, Scene *, bool doCollide=true)
bool spatialOverlap (Body::id_t, Body::id_t) const
bool spatialOverlapPeri (Body::id_t, Body::id_t, Scene *, Vector3i &) const
 return true if bodies bb overlap in all 3 dimensions

Static Private Member Functions

static Real cellWrap (const Real, const Real, const Real, int &)
static Real cellWrapRel (const Real, const Real, const Real)

Private Attributes

VecBounds BB [3]
 storage for bounds
std::vector< Real > maxima
 storage for bb maxima and minima
std::vector< Real > minima
shared_ptr< NewtonIntegratornewton
bool periodic
 Whether the Scene was periodic (to detect the change, which shouldn't happen, but shouldn't crash us either)
bool strideActive

Detailed Description

Definition at line 86 of file InsertionSortCollider.hpp.

The documentation for this class was generated from the following files:

Generated by  Doxygen 1.6.0   Back to index