AGX Dynamics  2.35.0.1
MergeSplitHandler.h
Go to the documentation of this file.
1 /*
2 Copyright 2007-2022. Algoryx Simulation AB.
3 
4 All AGX source code, intellectual property, documentation, sample code,
5 tutorials, scene files and technical white papers, are copyrighted, proprietary
6 and confidential material of Algoryx Simulation AB. You may not download, read,
7 store, distribute, publish, copy or otherwise disseminate, use or expose this
8 material unless having a written signed agreement with Algoryx Simulation AB, or having been
9 advised so by Algoryx Simulation AB for a time limited evaluation, or having purchased a
10 valid commercial license from Algoryx Simulation AB.
11 
12 Algoryx Simulation AB disclaims all responsibilities for loss or damage caused
13 from using this software, unless otherwise stated in written agreements with
14 Algoryx Simulation AB.
15 */
16 
17 #pragma once
18 
21 
22 #include <agxCollide/Space.h>
23 
24 namespace agxWire
25 {
26  class Wire;
27 }
28 
29 namespace agxSDK
30 {
35  {
36  public:
39 
40  public:
48 
53  static const agxSDK::MergeSplitProperties* getProperties( const agx::RigidBody* rb );
54 
59  static agxSDK::MergeSplitProperties* getProperties( agx::RigidBody* rb );
60 
71 
78  static const agxSDK::MergeSplitProperties* getProperties( const agxCollide::Geometry* geometry );
79 
86  static agxSDK::MergeSplitProperties* getProperties( agxCollide::Geometry* geometry );
87 
95 
101  static agxSDK::MergeSplitProperties* getProperties( agx::Constraint* constraint );
102 
108  static const agxSDK::MergeSplitProperties* getProperties( const agx::Constraint* constraint );
109 
118 
124  static agxSDK::MergeSplitProperties* getProperties( agx::ConstraintImplementation* constraint );
125 
131  static const agxSDK::MergeSplitProperties* getProperties( const agx::ConstraintImplementation* constraint );
132 
140 
146 
152 
159  static void transferProperties( const agxCollide::Geometry* source, agxCollide::Geometry* destination );
160 
167  static void transferProperties( const agx::RigidBody* source, agx::RigidBody* destination );
168 
174  static void transferProperties( const agxWire::Wire* wire, agx::RigidBody* rb );
175 
181  static void transferProperties( const agxWire::Wire* wire, agx::Constraint* constraint );
182 
189 
196 
197  public:
202  void setEnable( agx::Bool enable );
203 
208 
214 
219 
225 
230 
236 
241 
247 
252 
253 
259 
264 
278  void setEnableMergePair(const agx::Name& group1, const agx::Name& group2, agx::Bool enable);
279 
293  void setEnableMergePair(agx::UInt32 group1, agx::UInt32 group2, agx::Bool enable);
294 
308  void setEnableMergePair(agx::UInt32 group1, const agx::Name& group2, agx::Bool enable);
309 
323  void setEnableMergePair(const agx::Name& group1, agx::UInt32 group2, agx::Bool enable);
324 
326  agx::Bool getEnableMergePair(const agx::Name& group1, const agx::Name& group2);
327 
330 
333 
336 
342  agx::Bool add( agxSDK::MergeSplitAlgorithm* mergeSplitAlgorithm );
343 
350 
355 
360 
367 
374 
380  void registerMergedBody( agx::MergedBody* mergedBody );
381 
388 
395 
402 
406  agx::Bool mayMerge( const agx::RigidBody* rb1, const agx::RigidBody* rb2 ) const;
407 
411  agx::Bool mayMerge( const agxCollide::Geometry* geometry1, const agxCollide::Geometry* geometry2 ) const;
412 
418  const agx::RigidBody* rb2,
419  const agxSDK::MergeSplitProperties* p2 ) const;
420 
424  agx::Bool maySplit( const agx::RigidBody* rb ) const;
425 
429  agx::Bool maySplit( const agx::RigidBody* rb, const agxSDK::MergeSplitProperties* properties ) const;
430 
434  agx::Bool mayMergeProperties( const agxSDK::MergeSplitProperties* properties ) const;
435 
439  agx::Bool maySplitProperties( const agxSDK::MergeSplitProperties* properties ) const;
440 
445 
449  bool writeConnectivityGraph(const char* filename) const;
450 
451 #ifndef SWIG
457 
461  template<typename T>
462  T* getAlgorithm() const;
463 #endif
464 
465  public:
467  static void storePersistentData( const agx::RigidBody* rb, agxStream::OutputArchive& out );
468  static void storePersistentData( const agxCollide::Geometry* geometry, agxStream::OutputArchive& out );
469  static void storePersistentData( const agx::HighLevelConstraintImplementation* constraint, agxStream::OutputArchive& out );
470  static void storePersistentData( const agxWire::Wire* wire, agxStream::OutputArchive& out );
471 
472  static void restorePersistentData( agx::RigidBody* rb, agxStream::InputArchive& in );
473  static void restorePersistentData( agxCollide::Geometry* geometry, agxStream::InputArchive& in );
474  static void restorePersistentData( agx::HighLevelConstraintImplementation* constraint, agxStream::InputArchive& in );
475  static void restorePersistentData( agxWire::Wire* wire, agxStream::InputArchive& in );
476 
477  template< typename T >
478  static T* getOrCreateCustomData( agx::HighLevelConstraintImplementation* constraint );
479 
480  template< typename T >
481  static T* getCustomData( const agx::HighLevelConstraintImplementation* constraint );
482 
483  static agx::Bool isMergedGranulate( const agx::RigidBody* rb );
484  static void setIsMergedGranulate( agx::RigidBody* rb, agx::Bool flag );
486 
487  public:
492  virtual void postIntegrate();
494 
495  public:
500  void postSolve( const agxSDK::MergeSplitPostSolveData& postSolveData );
501 
505  template<typename T, typename ObjT>
506  const T* getThresholds( ObjT obj, agxSDK::MergeSplitAlgorithm::Callback callback ) const;
507 
511  template<typename T>
512  const T* getThresholdsFromProperties( const agxSDK::MergeSplitProperties* properties, agxSDK::MergeSplitAlgorithm::Callback callback ) const;
513 
517  agx::Bool isDefault( const agxSDK::MergeSplitThresholds* thresholds, agxSDK::MergeSplitAlgorithm::Callback callback ) const;
519 
520  protected:
524  virtual ~MergeSplitHandler();
525 
529  virtual void preCollide();
530 
535  virtual void separations(const agxCollide::SeparationPairVector& separations);
536 
540  virtual void preStep();
541 
545  virtual void postStep();
546 
551  virtual void reset( agx::Bool resetState = true );
552 
556  virtual void mergeSplitBegin();
557 
561  virtual void mergeSplitEnd();
562 
566  virtual void store( agxStream::OutputArchive& out ) const;
567 
571  virtual void restore( agxStream::InputArchive& in );
572 
573  private:
577  enum EState
578  {
579  ENABLED = 1 << 0,
580  GLOBAL_MERGE_ENABLED = 1 << 1,
581  GLOBAL_SPLIT_ENABLED = 1 << 2,
582  SERIALIZATION_ENABLED = 1 << 3,
583  SPLIT_ON_SEPARATION = 1 << 4,
584  IN_POST_SOLVE = 1 << 5
585  };
586  typedef agx::BitState< EState, agx::Int32 > State;
587 
591  struct HandlerData : public agx::ICloneable
592  {
594  };
595 
602  struct MergeableHandlerData : public HandlerData
603  {
604  enum EState
605  {
606  MERGED_BY_HANDLER = 1 << 0,
607  MERGED_GRANULATE = 1 << 1
608  };
609  typedef agx::BitState< EState, agx::Int32 > State;
610 
611  State state;
612  MergeSplitHandler* handler;
613 
614  protected:
615  MergeableHandlerData() : state(), handler( nullptr ) {}
616  virtual ~MergeableHandlerData() {}
617 
618  private:
619  virtual agx::ICloneableRef clone( agx::ICloneable* /*child*/ ) override
620  {
621  // It's not supported to clone a merged object?
622  // Implement this if the object is cloneable.
623  return agx::ICloneableRef( nullptr );
624  }
625  };
626  typedef agx::ref_ptr<MergeableHandlerData> HandlerDataRef;
627 
631  struct BodyHandlerData : public MergeableHandlerData
632  {
633  protected:
634  virtual ~BodyHandlerData() {}
635  };
636 
640  struct GeometryHandlerData : public MergeableHandlerData
641  {
642  protected:
643  virtual ~GeometryHandlerData() {}
644  };
645 
649  struct ConstraintHandlerData : public MergeableHandlerData
650  {
652 
653  protected:
654  virtual ~ConstraintHandlerData() {}
655  };
656  typedef agx::ref_ptr< ConstraintHandlerData > ConstraintHandlerDataRef;
657 
661  struct WireHandlerData : public HandlerData
662  {
663  virtual agx::ICloneableRef clone( agx::ICloneable* child ) override
664  {
665  if ( child == nullptr )
666  child = new WireHandlerData();
667 
668  child->as<WireHandlerData>()->properties = properties->clone()->as<MergeSplitProperties>();
669 
670  return agx::ICloneableRef( child );
671  }
672  };
673 
674  private:
675  using MergeSplitThresholdsContainer = agx::Vector<MergeSplitThresholdsRef>;
676 
677  private:
681  template<typename DataT, typename ObjT>
682  static DataT* getHandlerData( const ObjT& obj );
683 
687  template<typename DataT, typename ObjT>
688  static DataT* getOrCreateHandlerData( ObjT obj );
689 
693  template<typename DataT, typename SourceT, typename DestT>
694  static void _transferProperties( const SourceT* source, DestT* destination );
695 
699  static void setDefaultState( State& state );
700 
701  private:
702  friend class Simulation;
707  MergeSplitHandler( agxSDK::Simulation* simulation );
708 
712  void onRemove( agx::Constraint* constraint );
713 
714  friend class MergeSplitMergedBodyListener;
718  void onAddToMergedBody( agx::RigidBody* rb, const agx::MergedBody* mergedBody );
719 
723  void onRemovedFromMergedBody( agx::RigidBody* rb, const agx::MergedBody* mergedBody );
724 
728  void onAddToMergedBody( agx::MergedBody::EdgeInteraction* edge, const agx::MergedBody* mergedBody );
729 
733  void onRemovedFromMergedBody( const agx::MergedBody::EdgeInteractionRefContainer& edges, const agx::MergedBody* mergedBody );
734 
738  void onMovedFromToMergedBody( const agx::MergedBody::EdgeInteractionRefContainer& edges, const agx::MergedBody* fromMergedBody, const agx::MergedBody* toMergedBody );
739 
740  private:
744  void clearAndAddDefaultAlgorithms();
745 
749  void handlePossibleGranulateBodies(bool updateSpace);
750 
754  agx::Bool getMergedByHandler( const agx::RigidBody* rb ) const;
755 
762  void updateMergedBodiesSimulationState( agx::Bool commitGeneratedInteractions );
763 
767  void performIslandSplitting();
768 
772  agx::Bool apply( const agxSDK::MergeSplitAction& action );
773 
777  agx::Bool merge( const agxSDK::MergeSplitAction& action );
778 
782  agx::Bool split( const agxSDK::MergeSplitAction& action );
783 
784  private:
785  agxSDK::Simulation* m_simulation;
786  State m_state;
787  MergeSplitAlgorithmContainer m_mergeSplitAlgorithms;
788  MergedBodyRefContainer m_mergedBodies;
789  MergeSplitActionContainer m_currentActions;
790  agx::MergedBody::ListenerRef m_mergedBodyListener;
791  MergeSplitThresholdsContainer m_globalThresholds;
792  MergeIgnoreFilter m_mergeIgnoreFilter;
793 
794  agx::RigidBodyRefVector m_possibleGranulateBodies;
795  };
796 
798  {
799  const HandlerData* data = getHandlerData<HandlerData>( rb );
800  return data != nullptr ? data->properties : nullptr;
801  }
802 
804  {
805  HandlerData* data = getHandlerData<HandlerData>(rb);
806  return data != nullptr ? data->properties : nullptr;
807  }
808 
810  {
811  const HandlerData* data = getHandlerData<HandlerData>( geometry );
812  if ( data != nullptr && data->properties != nullptr )
813  return data->properties;
814  return geometry != nullptr ? MergeSplitHandler::getProperties( geometry->getRigidBody() ) : nullptr;
815  }
816 
818  {
819  const HandlerData* data = getHandlerData<HandlerData>( geometry );
820  if ( data != nullptr && data->properties != nullptr )
821  return data->properties;
822 
823  // Special case so that the user doesn't have to call getOrCreateProperties for the geometry
824  // when the properties are inherited. That's why we have to const_cast this case.
825  return geometry != nullptr ? const_cast<MergeSplitProperties*>( MergeSplitHandler::getProperties( geometry->getRigidBody() ) ) : nullptr;
826  }
827 
829  {
830  return constraint != nullptr ? MergeSplitHandler::getProperties( constraint->getRep() ) : nullptr;
831  }
832 
834  {
835  return constraint != nullptr ? MergeSplitHandler::getProperties( constraint->getRep() ) : nullptr;
836  }
837 
839  {
840  const HandlerData* data = getHandlerData<HandlerData>( constraint );
841  return data != nullptr ? data->properties : nullptr;
842  }
843 
845  {
846  const HandlerData* data = getHandlerData<HandlerData>( constraint );
847  return data != nullptr ? data->properties : nullptr;
848  }
849 
850  inline agx::Bool MergeSplitHandler::getMergedByHandler( const agx::RigidBody* rb ) const
851  {
852  const MergeableHandlerData* handlerData = getHandlerData<MergeableHandlerData>( rb );
853  return handlerData != nullptr && handlerData->state.Is( MergeableHandlerData::MERGED_BY_HANDLER ) && handlerData->handler == this;
854  }
855 
856  template<typename DataT, typename ObjT>
857  inline DataT* MergeSplitHandler::getHandlerData( const ObjT& obj )
858  {
859  return agx::InternalData::get<DataT>( obj, agx::InternalData::MERGE_SPLIT );
860  }
861 
862  template<typename DataT, typename ObjT>
863  inline DataT* MergeSplitHandler::getOrCreateHandlerData( ObjT obj )
864  {
865  agxAssert( obj != nullptr );
866  return agx::InternalData::getOrCreate<DataT>( obj, agx::InternalData::MERGE_SPLIT );
867  }
868 
869  template<typename DataT, typename SourceT, typename DestT>
870  void MergeSplitHandler::_transferProperties( const SourceT* source, DestT* destination )
871  {
872  if ( static_cast<const void*>( source ) == static_cast<void*>( destination ) ||
873  source == nullptr ||
874  destination == nullptr )
875  return;
876 
877  const auto sourceData = MergeSplitHandler::getHandlerData<HandlerData>( source );
878  if ( sourceData == nullptr )
879  return;
880 
881  auto destinationData = MergeSplitHandler::getOrCreateHandlerData<DataT>( destination );
882  destinationData->properties = sourceData->properties;
883  }
884 
885  template< typename T >
886  T* MergeSplitHandler::getOrCreateCustomData( agx::HighLevelConstraintImplementation* constraint )
887  {
888  ConstraintHandlerData* data = MergeSplitHandler::getOrCreateHandlerData<ConstraintHandlerData>( constraint );
889  if ( data->customData == nullptr )
890  data->customData = new T();
891 
892  return data->customData->as<T>();
893  }
894 
895  template< typename T >
896  T* MergeSplitHandler::getCustomData( const agx::HighLevelConstraintImplementation* constraint )
897  {
898  const ConstraintHandlerData* data = MergeSplitHandler::getHandlerData<ConstraintHandlerData>( constraint );
899  return data != nullptr && data->customData != nullptr ? data->customData->as<T>() : nullptr;
900  }
901 
902  inline agx::Bool MergeSplitHandler::isMergedGranulate( const agx::RigidBody* rb )
903  {
904  const BodyHandlerData* data = getHandlerData<BodyHandlerData>( rb );
905  return data != nullptr && data->state.Is( MergeableHandlerData::MERGED_GRANULATE );
906  }
907 
908  inline void MergeSplitHandler::setIsMergedGranulate( agx::RigidBody* rb, agx::Bool flag )
909  {
910  BodyHandlerData* data = getOrCreateHandlerData<BodyHandlerData>( rb );
911  data->state.update( MergeableHandlerData::MERGED_GRANULATE, flag );
912  }
913 
914  template<typename T>
916  {
917  for ( const auto& algorithm : m_mergeSplitAlgorithms )
918  if ( algorithm->template is<T>() )
919  return algorithm->template as<T>();
920  return nullptr;
921  }
922 
923  template<typename T, typename ObjT>
924  const T* MergeSplitHandler::getThresholds( const ObjT obj, MergeSplitAlgorithm::Callback callback ) const
925  {
926  return getThresholdsFromProperties<T>( getProperties( obj ), callback );
927  }
928 
929  template<typename T>
930  const T* MergeSplitHandler::getThresholdsFromProperties( const MergeSplitProperties* properties,
931  MergeSplitAlgorithm::Callback callback ) const
932  {
933  const T* thresholds = nullptr;
934  const auto callbackIndex = MergeSplitProperties::findCallbackIndex( callback );
935  if ( properties == nullptr || (thresholds = properties->getMergeSplitThresholds<T>( callbackIndex )) == nullptr )
936  thresholds = (T*)m_globalThresholds[ callbackIndex ].get();
937 
938  return thresholds;
939  }
940 
941  inline agx::Bool MergeSplitHandler::isDefault( const MergeSplitThresholds* thresholds, MergeSplitAlgorithm::Callback callback ) const
942  {
943  return thresholds != nullptr && thresholds == m_globalThresholds[ MergeSplitProperties::findCallbackIndex( callback ) ];
944  }
945 
947  {
948  return ( properties != nullptr && properties->getEnableMerge() ) || // Merge enabled in properties?
949  ( properties == nullptr && m_state.Is( GLOBAL_MERGE_ENABLED ) ); // Only check global flag if this object hasn't got properties!
950 
951  }
952 
954  {
955  return ( properties != nullptr && properties->getEnableSplit() ) || // Enabled in properties?
956  ( properties == nullptr && m_state.Is( GLOBAL_SPLIT_ENABLED ) ); // Only check global flag if this object hasn't got properties!
957 
958  }
959 }
#define AGXPHYSICS_EXPORT
The geometry representation used by the collision detection engine.
Definition: Geometry.h:93
agx::RigidBody * getRigidBody()
Definition: Geometry.h:850
Specific thresholds used to split and merge objects given constraints.
Specific thresholds used to merge and split given geometry contacts.
A collection of merge ignore group ID pairs for which merge should be rejected.
Object containing merge-split actions to be processed by the agxSDK::MergeSplitHandler.
Data for merge or split actions created in an implementation of an agxSDK::MergeSplitAlgorithm.
Stateless base class for merge and split of interactions.
Base class for a merge split algorithm handling a set of merged bodies.
void setEnableMergePair(agx::UInt32 group1, agx::UInt32 group2, agx::Bool enable)
If enable is false, from now on reject merges between bodies in the two groups even when the MergeSpl...
agx::Bool maySplitProperties(const agxSDK::MergeSplitProperties *properties) const
agx::Bool merge(agx::MergedBody::EdgeInteraction *edgeInteraction)
Merge bodies given an edge interaction.
agx::Bool getEnableMergePair(agx::UInt32 group1, agx::UInt32 group2)
agx::Bool mayMerge(const agx::RigidBody *rb1, const agx::RigidBody *rb2) const
static agxSDK::MergeSplitProperties * getOrCreateProperties(agx::RigidBody *rb)
Creates (or returns already present) merge-split parameters given a rigid body.
static agxSDK::MergeSplitProperties * getOrCreateProperties(agx::Constraint *constraint)
Creates (or returns already present) merge-split parameters given a constraint.
agx::Bool getEnableGlobalMergeSplit() const
void setEnableMergePair(const agx::Name &group1, const agx::Name &group2, agx::Bool enable)
If enable is false, from now on reject merges between bodies in the two groups even when the MergeSpl...
agx::Bool mayMergeProperties(const agxSDK::MergeSplitProperties *properties) const
static const agxSDK::MergeSplitProperties * getProperties(const agx::RigidBody *rb)
agx::Bool maySplit(const agx::RigidBody *rb, const agxSDK::MergeSplitProperties *properties) const
void setEnable(agx::Bool enable)
Enable/disable merge split.
agx::Bool remove(agxSDK::MergeSplitAlgorithm *mergeSplitAlgorithm)
Remove split algorithm.
agx::Bool getEnableGlobalSplit() const
void setEnableSerialization(agx::Bool enable)
Enable/disable serialization of this object.
agx::Vector< agx::MergedBodyRef > MergedBodyRefContainer
void traverse(agx::MergedBody::EdgeInteractionVisitor visitor) const
Traverse all edges currently active in all merged bodies handled by this handler.
static void transferProperties(const agxWire::Wire *wire, agx::Constraint *constraint)
Transfers merge-split properties from the wire to the constraint.
static agxSDK::MergeSplitProperties * getProperties(agxWire::Wire *wire)
static agxSDK::MergeSplitProperties * getOrCreateProperties(agxCollide::Geometry *geometry)
Creates (or returns already present) merge-split parameters given a geometry.
static agx::Bool isMergedByHandler(const agx::RigidBody *rb)
Determine if a body is merged explicitly (added to an agx::MergedBody by the user) or merged by an ag...
void setEnableGlobalSplit(agx::Bool enable)
Enable/disable global split for all objects not having their MergeSplitProperties set.
agx::Bool getEnableMergePair(const agx::Name &group1, const agx::Name &group2)
agx::Bool getEnableGlobalMerge() const
agx::Bool mayMerge(const agxCollide::Geometry *geometry1, const agxCollide::Geometry *geometry2) const
const MergedBodyRefContainer & getMergedBodies() const
static agxSDK::MergeSplitProperties * getOrCreateProperties(agxWire::Wire *wire)
Creates (or returns already present) merge-split parameters given a wire.
void registerMergedBody(agx::MergedBody *mergedBody)
Register merged body to this merge-split handler.
agx::Bool getEnableSerialization() const
agx::Bool getEnableMergePair(const agx::Name &group1, agx::UInt32 group2)
agxSDK::GeometryContactMergeSplitThresholds * getGlobalContactThresholds() const
Global thresholds for contacts.
MergeSplitAlgorithmContainer getAlgorithms() const
agxSDK::ConstraintMergeSplitThresholds * getGlobalConstraintThresholds() const
Global thresholds for constraints.
agx::Bool mayMerge(const agx::RigidBody *rb1, const agxSDK::MergeSplitProperties *p1, const agx::RigidBody *rb2, const agxSDK::MergeSplitProperties *p2) const
agxSDK::WireMergeSplitThresholds * getGlobalWireThresholds() const
Global thresholds for wires.
void setEnableGlobalMerge(agx::Bool enable)
Enable/disable global merge for all objects not having their MergeSplitProperties set.
static void transferProperties(const agx::RigidBody *source, agx::RigidBody *destination)
Transfers merge-split properties from source rigid body to another rigid body instance.
agx::Vector< agxSDK::MergeSplitAlgorithmRef > MergeSplitAlgorithmContainer
static void transferProperties(const agxWire::Wire *wire, agx::RigidBody *rb)
Transfers merge-split properties from the wire to the rigid body.
agx::Bool getEnableSplitOnSeparation() const
void setEnableMergePair(const agx::Name &group1, agx::UInt32 group2, agx::Bool enable)
If enable is false, from now on reject merges between bodies in the two groups even when the MergeSpl...
static const agxSDK::MergeSplitProperties * getProperties(const agxWire::Wire *wire)
agx::Bool add(agxSDK::MergeSplitAlgorithm *mergeSplitAlgorithm)
Add new merge-split algorithm.
void setEnableMergePair(agx::UInt32 group1, const agx::Name &group2, agx::Bool enable)
If enable is false, from now on reject merges between bodies in the two groups even when the MergeSpl...
bool writeConnectivityGraph(const char *filename) const
Write the MergedBody graph as a .dot file to disk.
const agxSDK::Simulation * getSimulation() const
void setEnableGlobalMergeSplit(agx::Bool enable)
Enable/disable global merge and split for all objects not having their MergeSplitProperties set.
agx::MergedBodyRef createMergedBody() const
Creates a new, empty, merged body object associated to this merge split handler.
agx::Bool getEnableMergePair(agx::UInt32 group1, const agx::Name &group2)
static void transferProperties(const agxCollide::Geometry *source, agxCollide::Geometry *destination)
Transfers merge-split properties from source geometry to another geometry instance.
static agx::Bool split(agx::RigidBody *rb)
Split a rigid body that has been merged by a merge split handler.
agx::Bool getEnable() const
static agxSDK::MergeSplitProperties * getOrCreateProperties(agx::ConstraintImplementation *constraint)
Creates (or returns already present) merge-split parameters given a constraint implementation.
void setEnableSplitOnSeparation(agx::Bool enable)
Enable/disable split on separation events from Space.
agx::Bool maySplit(const agx::RigidBody *rb) const
static agx::UInt findCallbackIndex(agxSDK::MergeSplitAlgorithm::Callback callback)
Maps given callback to an index (0, 1, 2, ...).
Base class for thresholds/constants/values used in agxSDK::MergeSplitAlgorithm.
Simulation is a class that bridges the collision space agxCollide::Space and the dynamic simulation s...
Definition: Simulation.h:127
Specific thresholds used to split and merge objects given wires.
Interface and placeholder of controllers/helpers for wires.
Definition: Wire.h:62
The base class for a constraint.
Definition: Constraint.h:89
agx::ConstraintImplementation * getRep()
Definition: Constraint.h:872
Interface class for a cloneable reference counted object.
Definition: ICloneable.h:30
@ MERGE_SPLIT
AMOR related data.
Definition: InternalData.h:43
Structure holding several "normal" rigid bodies.
Definition: MergedBody.h:56
std::function< void(EdgeInteraction *) > EdgeInteractionVisitor
Definition: MergedBody.h:108
EdgeInteraction(agx::RigidBody *rb1, agx::RigidBody *rb2, InteractionTag tag, agx::Bool valid=true)
Construct given two rigid bodies and a valid flag.
Representation of a name string.
Definition: Name.h:33
Base class providing referencing counted objects.
Definition: Referenced.h:114
T * as()
Subclass casting.
The rigid body class, combining a geometric model and a frame of reference.
Definition: RigidBody.h:55
#define agxAssert(expr)
Definition: debug.h:143
#define DOXYGEN_END_INTERNAL_BLOCK()
Definition: macros.h:97
#define DOXYGEN_START_INTERNAL_BLOCK()
Definition: macros.h:96
#define AGX_FORCE_INLINE
Definition: macros.h:58
This namespace consists of a set of classes for handling geometric intersection tests including boole...
agx::Vector< agx::Physics::GeometryPairPtr, agxData::BufferProxyAllocator > SeparationPairVector
Definition: Space.h:66
The agxSDK namespace contain classes to bridge the collision detection system and the dynamical simul...
Definition: Constraint.h:31
This namespace contain classes for streaming classes into archives, ASCII, binary for storage (serial...
InputRef< T > in(const char *name, T &obj)
Create an object with a name and a reference to the object that should be restored (usually a pointer...
Definition: InputArchive.h:400
OutputRef< Serializable > out(const char *name, const Serializable *obj)
Return an object that contain the name and the object that should be serialized to an archive.
Implements a Wire model with adaptive resolution.
Definition: MergedBody.h:40
The agx namespace contains the dynamics/math part of the AGX Dynamics API.
uint32_t UInt32
Definition: Integer.h:40
bool Bool
Definition: Integer.h:48
agx::ref_ptr< ICloneable > ICloneableRef
Definition: ICloneable.h:24