19 #include <agx/config/AGX_USE_WEBSOCKETS.h> 45 # pragma warning(push) 46 # pragma warning( disable : 4290 ) // C++ exception specification ignored except to indicate a function is not __declspec(nothrow) 56 class ParticleEmitter;
57 class RigidBodyEmitter;
62 class StabilityReport;
70 class AngularLockJoint;
71 class CylindricalJoint;
73 class PrismaticUniversalJoint;
83 class RemoteDebugClient;
98 class SurfaceVelocityConveyorBelt;
109 class SimulationFrameReader;
110 class SimulationFrameWriter;
112 class SimulationFrameWriter;
113 class GuiEventAdapterImplementation;
115 class MergeSplitHandler;
116 class TerrainInstance;
252 bool remove(
agx::RigidBody* body,
bool removeGeometries = true );
353 bool add( agxControl::Action* action );
360 bool remove( agxControl::Action* action );
367 bool add( agxControl::Operation* operation );
374 bool remove( agxControl::Operation* operation );
397 bool add(
agx::Emitter* emitter,
bool addGeometries=
true);
406 bool remove(
agx::Emitter* emitter,
bool removeGeometries=
true);
468 bool setUniformGravity(
const agx::Vec3& g );
643 template <
typename T >
654 template <
typename T >
655 const T* getConstraint(
const agx::Uuid& uuid)
const;
665 template <
typename T >
666 T* getConstraint(
const agx::Name& name );
676 template <
typename T >
677 const T* getConstraint(
const agx::Name& name )
const;
679 #define GETCONSTRAINT_TYPE(CLASS_NAME, TYPENAME) \ 680 CLASS_NAME *get ## TYPENAME(const agx::Name& name); \ 681 CLASS_NAME *get ##TYPENAME(const agx::Uuid& uuid); 693 #undef GETCONSTRAINT_TYPE 846 #if AGX_USE_WEBSOCKETS() 850 agx::RemoteSolver* getRemoteSolver();
855 const agx::RemoteSolver* getRemoteSolver()
const;
941 bool addEventListener(
agxSDK::EventListener* listener,
int priority = EventManager::DEFAULT_PRIORITY );
966 bool triggerEvent(
const GuiEvent& e );
974 enum CleanupSelectionMask {
975 STEP_LISTENERS = 0x1,
976 CONTACT_LISTENERS = 0x2,
978 LISTENERS = STEP_LISTENERS | CONTACT_LISTENERS | GUI_LISTENERS,
983 PARTICLE_SYSTEMS = 0x2000,
984 CONTACT_DATA = 0x4000,
985 CLEANUP_ALL = LISTENERS | SYSTEM | SPACE | MATERIALS | ASSEMBLIES | PARTICLE_SYSTEMS | CONTACT_DATA
993 STEP_LISTENERS = EventManager::STEP_LISTENERS,
994 CONTACT_LISTENERS = EventManager::CONTACT_LISTENERS,
995 GUI_LISTENERS = EventManager::GUI_LISTENERS,
996 LISTENERS = EventManager::LISTENERS,
1000 ASSEMBLIES = 0x1000,
1001 PARTICLE_SYSTEMS = 0x2000,
1002 CONTACT_DATA = 0x4000,
1003 PLOTSYSTEM = 0x8000,
1004 CLEANUP_ALL = LISTENERS | SYSTEM | SPACE | MATERIALS | ASSEMBLIES | PARTICLE_SYSTEMS | CONTACT_DATA | PLOTSYSTEM
1014 READ_TIMESTEP = 0x1,
1015 READ_TIMESTAMP = 0x2,
1018 READ_ALL = READ_TIMESTEP + READ_TIMESTAMP + READ_GRAVITY + READ_SOLVER,
1019 READ_DEFAULT = READ_TIMESTEP + READ_GRAVITY + READ_SOLVER
1029 void cleanup(
agx::UInt selection = CLEANUP_ALL,
bool fast=
false );
1041 agxControl::ActionManager* getActionManager();
1046 void clearContactData();
1051 agx::Solver* getSolver();
1056 const agx::Solver* getSolver()
const;
1061 void setPreIntegratePositions(
bool flag );
1066 bool getPreIntegratePositions()
const;
1105 void setStatisticsPath(
const agx::String& path );
1110 void setStatisticsInterval(
agx::Real interval );
1117 void setEnableStatistics(
bool enable );
1120 bool getEnableStatistics()
const;
1123 void setEnableStatisticsRendering(
bool enable );
1126 bool getEnableStatisticsRendering()
const;
1131 void setProfilingFrequency(
agx::Real frequency);
1136 agx::Real getProfilingFrequency()
const;
1141 const AssemblyHash& getAssemblies()
const;
1235 size_t write( std::ostream& stream,
bool binary )
const;
1261 bool restore(std::istream& stream,
bool isBinary,
agx::UInt selection = READ_DEFAULT);
1302 void setEnableRemoteDebugging(
bool flag,
agx::Int16 port = -1,
bool useCompression =
false,
bool waitForSynchronization =
true );
1307 bool getEnableRemoteDebugging()
const;
1313 void setRemoteDebuggingTimeStep(
agx::Real timeStep );
1318 agx::Real getRemoteDebuggingTimeStep()
const;
1328 void setContactReductionBinResolution(
agx::UInt8 binResolution );
1333 agx::UInt8 getContactReductionBinResolution()
const;
1340 void setContactReductionThreshold(
agx::UInt threshold);
1345 agx::UInt getContactReductionThreshold()
const;
1377 void updateRenderManager();
1382 void updateStatisticsRenderData();
1393 void garbageCollect();
1424 void sendSimulation();
1449 void updateActionManager();
1476 void renderComponents();
1477 void createRenderTask();
1478 agx::SolveModel* getSolveModel(
const agx::Name& name);
1480 const agx::SolveModelRefVector& getSolveModels()
const;
1482 #if AGX_USE_WEBSOCKETS() 1483 void setRemoteSolver(agx::RemoteSolver* remoteSolver);
1499 void setEnableSimulationStatisticsListener(
bool flag );
1504 void addSolveModel(agx::SolveModel* model);
1505 void removeSolveModel(agx::SolveModel* model);
1508 bool getUseComplexImpactStage()
const;
1509 void setUseComplexImpactStage(
bool flag);
1538 void resetTaskTimers();
1543 void dumpTaskTimers(
const agx::String& filePath =
"BufferAllocations.xml");
1548 void dumpMemoryUsage(
const agx::String& filePath =
"TaskTimers.xml");
1552 bool allowCreateParticles()
const;
1564 friend class GuiEventAdapterImplementation;
1582 void initConfiguration();
1585 void updateStatisticsEnable();
1587 void setEnableComputeAllConstraintForces(
bool flag);
1588 bool getEnableComputeAllConstraintForces()
const;
1591 void resetGraphStatistics();
1597 void setupStatisticsLogging();
1599 void updateConstraintForceData();
1601 void createUpdateTask();
1603 void generateContactMaterials();
1605 void prepareContacts();
1606 void triggerParticleContactSensors();
1607 void triggerPreStepEvents();
1608 void triggerPostStepEvents();
1609 void triggerLastStepEvents();
1610 void terrainPostUpdate();
1612 void resetDirtyMaterials();
1613 void updateRemoteDebugger();
1614 void recordStatistics();
1615 void recordPlaybackStatistics();
1616 void recordParticleCount();
1617 void recordWarmStartingData();
1618 void printStatistics();
1622 void pruneContacts();
1623 void contactPointReduction();
1624 void updateSleepState();
1625 void triggerPreCollideStepEvent();
1626 void triggerSeparationContactEventListeners();
1627 void triggerContactEventListeners();
1628 void assignContactMaterials();
1631 void applyPreIntegrationSettings();
1634 friend class agx::Solver;
1635 void registerParticleSystemPointers();
1636 void unregisterParticleSystemPointers();
1641 class StatisticsWriter;
1645 #if AGX_USE_WEBSOCKETS() 1646 friend class agx::RemoteSolver;
1650 void setHasJournal(
bool flag);
1651 void preStoreSynchronization();
1654 StatisticsWriter* m_statWriter;
1658 AssemblyHash m_assemblies;
1667 bool m_stepToStarted;
1669 EventManagerRef m_eventManager;
1672 agxControl::ActionManagerRef m_actionManager;
1692 bool m_preIntegrate;
1694 bool m_allowCreateParticles;
1702 agx::SolveModelTable m_solveModelTable;
1703 agx::SolveModelRefVector m_solveModels;
1712 void* m_remoteSolver;
1715 bool m_enableComputeAllConstraintForces;
1716 bool m_inDestructor;
1721 ParticleContactSensorTable m_particleContactSensorTable;
1724 RestoreListenerHash m_restoreListeners;
1730 StabilityReportContainer m_stabilityReports;
1734 MergedBodiesContainer m_mergedBodies;
1737 MergeSplitHandlerPointer m_mergeSplitHandler;
1747 bool m_disableGeometryAutoAdd;
1760 return m_clock->getTime();
1765 return m_space.get();
1770 return m_space.get();
1775 return m_system.get();
1780 return m_system.get();
1785 if (m_system)
return m_system->getTimeGovernor()->getTimeStep();
1801 return m_allowCreateParticles;
1806 return m_solveModels;
1809 template<
typename T >
1812 return dynamic_cast< T*
>( this->getConstraint( uuid ) );
1815 template<
typename T >
1816 const T* Simulation::getConstraint(
const agx::Uuid& uuid )
const 1818 return dynamic_cast< const T*
>( this->getConstraint( uuid ) );
1821 template<
typename T >
1824 return dynamic_cast< T*
>( this->getConstraint( name ) );
1827 template<
typename T >
1828 const T* Simulation::getConstraint(
const agx::Name& name )
const 1830 return dynamic_cast< const T*
>( this->getConstraint( name ) );
1835 # pragma warning(pop) // C++ exception specification ignored except to indicate a function is not __declspec(nothrow). Restored. agxTerrain::Terrain instance in a simulation, receiving step and contact callbacks in a controllable ...
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...
This class is for detecting and handling particle collisions with geometries in the simulation...
Containins classes for sending/reading data over sockets as well as compression functionality.
agx::Event2< Simulation *, agx::RigidBody * > RigidBodyEvent
MaterialEvent removeMaterialEvent
AGXTERRAIN_EXPORT void clear()
void AGXPHYSICS_EXPORT init()
Initialize AGX Dynamics API including thread resources and must be executed before using the AGX API...
agx::Event2< Simulation *, agx::Constraint * > ConstraintEvent
bool AGXPHYSICS_EXPORT read(const std::string &filename, agxStream::SerializablePtrVector &readObjects)
Open and read serializable objects from a file on disk with previously stored objects.
agx::Thread is a representation of an OS specific implementation of a computational thread...
agx::Constraint2DOF * getConstraint2DOF(const agx::Name &name)
RigidBodyEvent removeRigidBodyEvent
agx::Event2< Simulation *, agxCollide::Geometry * > GeometryEvent
Data storage for a collection of entity instances of a specified EntityModel.
Base class for a merge split algorithm handling a set of merged bodies.
Namespace contains functionality related to plotting.
A component is an object containing other objects, enabling hierarchical structuring.
A model is an abstract representation of the class of an agx::Object.
This namespace consists of a set of classes for handling geometric intersection tests including boole...
This joint will preserve the initial distance between a body and a point in world coordinate or betwe...
A class holding 4 dimensional vectors and providing basic arithmetic.
MaterialEvent addMaterialEvent
agx::Event2< Simulation *, agx::Material * > MaterialEvent
Specialization for constraints that have two degree of freedom such as Cylindrical.
Keeps track of the energy flow in the system.
#define AGXPHYSICS_EXPORT
agx::ref_ptr< Frame > FrameRef
The base class for a constraint.
Class for receiving serialized agxSDK::Simulation:s from remote host.
#define AGX_DECLARE_POINTER_TYPES(type)
Specialization for constraints that have only one degree of freedom such as Hinge and Prismatic...
Namespace containing classes for handling debug rendering of collision geometries, constraints, contacts and rigid bodies.
A representation of a generic task.
Representation of a name string.
The Timer class permits timing execution speed with the same refinement as the built in hardware cloc...
Class for managing the rendering of geometries, shapes, rigid bodies, constraints etc...
A Prismatic Universal Joint has two translational dof's constrained.
Spawns new bodys inside a given volume.
This class will collect statistics and sizes of a simulation.
class for serializing a simulation into a series for files on disk <filename>_0001.agx etc.
RigidBodyEvent addRigidBodyEvent
Contain classes for higher level modeling primitives, such as Tree, Terrain etc.
The geometry representation used by the collision detection engine.
The base class for interactions.
Structure holding several "normal" rigid bodies.
agx::HashVector< agxSDK::Assembly *, agxSDK::AssemblyRef > AssemblyHash
Constraint that removes all 6 DOF between two bodies, or one body and the world.
A basic particle system that contains all the storages and buffers required for basic operation and a...
Class which will go through contacting/separating bodies and determine if the bodies can be merged (g...
Interface and placeholder of controllers/helpers for wires.
Constraint that removes the three translation DOF between two bodies (or one and the world)...
This class contains all Geometries and performs Broad Phase and Narrow Phase collision detection to c...
The agx namespace contains the dynamics/math part of the AGX Dynamics API.
Implements a Wire model with adaptive resolution.
A Universal Joint has one fixed relative point, the 3 translational dof's, and one constrained axis (...
GeometryEvent removeGeometryEvent
bool AGXPHYSICS_EXPORT write(const std::string &filename, const agxStream::Serializable *data)
Write a Serializable object to a file.
JournalAttachEvent journalAttachedEvent
ReadSelectionMask
Enum for specifying some additional, part of a simulation that can be restored from a serialization...
agx::Event2< Simulation *, agx::ContactMaterial * > ContactMaterialEvent
CleanupSelectionMask
Specification of what should be cleaned up from a simulation during a call to the cleanup() method...
ContactMaterialEvent removeContactMaterialEvent
The hinge constraint between two rigid bodies or one rigid body and the world.
Constraint that removes 3 DOF (rotational degrees of freedom) between two bodies, or one body and the...
A prismatic joint keeps a fixed relative orientation between the attached bodies but allows them to s...
The rigid body class, combining a geometric model and a frame of reference.
Main material class which acts as a holder of a Surface Material and a Bulk material.
ContactMaterialEvent addContactMaterialEvent
A cylindrical joint is similar to a prismatic joint but with an extra degree of freedom free (rotatio...
agx::Constraint1DOF * getConstraint1DOF(const agx::Name &name)
The complete physical system with bodies, interactions, data layout, time stepper, and solver.
GeometryEvent addGeometryEvent
agx::HashTable< agxCollide::Geometry *, agx::ref_ptr< Geometry > > GeometryTable
A UUID, or Universally unique identifier, is intended to uniquely identify information in a distribut...
Class for listening to the restore of Serializable objects.
This class is an abstract base class for all classes that can be stored and retrieved from an Archive...
Class for writing serialized data in binary format to a stream.
An EventListener can be associated to a Simulation and triggered upon various events.
Simulation unique manager that handles logics around and parameters in contact materials given two ag...
Simulation is a class that bridges the collision space agxCollide::Space and the dynamic simulation s...
The class GravityField is responsible for calculating and applying a gravity force on a set of bodies...
Clock class keeps representation of virtual/simulated time.
ConstraintEvent removeConstraintEvent
ConstraintEvent addConstraintEvent
Interface class used by internal objects running in parallel.
Inheritance with partial specialization due to bug with ref_ptr containers.
An agx::Device is an abstract representation of a device on which data can be stored and processed...
The agxSDK namespace contain classes to bridge the collision detection system and the dynamical simul...
#define GETCONSTRAINT_TYPE(CLASS_NAME, TYPENAME)
agx::Event2< Simulation *, agx::Journal * > JournalAttachEvent
An assembly is a collection of basic simulation objects, such as rigid bodies, constraints, geometries.
With this class you can attach an ObserverFrame object relative to a RigidBody.