17#ifndef AGXSDK_SIMULATIONSTATISTICSLISTENER_H
18#define AGXSDK_SIMULATIONSTATISTICSLISTENER_H
292 m_parent(parent), m_name(id)
304 m_group->addObject( m_value );
307 m_group->addObject( m_time );
310 m_group->addObject( body1 );
312 m_group->addObject( body2 );
314 m_group->addObject( geometry1 );
316 m_group->addObject( geometry2 );
335 return m_value->get();
341 m_value->set(m_value->get()+1);
#define AGXSTREAM_DECLARE_SERIALIZABLE(T)
Use this in a Serializable class to add the required methods Important: Use full namespace in the dec...
#define AGXPHYSICS_EXPORT
The geometry representation used by the collision detection engine.
Only use as member allocated variable.
This class will collect statistics and sizes of a simulation.
RealStatisticsListenerData getMaxConstraintViolation() const
void reset()
Reset the statistics.
virtual ~SimulationStatisticsListener()
Destructor.
bool calculateFeatures(const agx::RigidBody *body, agx::Real &smallestFeature, const agxCollide::Geometry *&smallestFeatureGeometry, agx::Real &largestFeature, const agxCollide::Geometry *&largestFeatureGeometry, agx::Vec3 &pointRelativeBody)
RealStatisticsListenerData getMinContactFeature() const
RealStatisticsListenerData getMaxContactSpeed() const
virtual void post(const agx::TimeStamp &) override
Called after a step is taken in the simulation Implement this method in the derived class to get call...
virtual void addNotification() override
Called when this listener is added to the simulation.
agx::UInt32 getNumShapes() const
agx::String getReport() const
Get a report in string format.
RealStatisticsListenerData getMaxLinearSpeed() const
void updateContactData(agx::Real time)
StatisticsDataRef m_statisticsData
RealStatisticsListenerData getMinFeature() const
bool calculateShapeFeatures(const agxCollide::Shape *shape, const agx::RigidBody *body, agx::Real &smallestFeature, agx::Real &largestFeature, agx::Vec3 &largestFeaturePointRelBody, agx::Real &largestDistance)
RealStatisticsListenerData getMaxContactSpeedFeatureRatio() const
SimulationStatisticsListener()
agx::UInt32 getNumContacts() const
virtual void pre(const agx::TimeStamp &) override
Called before a step is taken in the simulation Implement this method in the derived class to get cal...
agx::UInt32 getTotalNumContacts() const
agx::UInt32 m_numTimeSteps
RealStatisticsListenerData getMaxAngularSpeed() const
agx::Real getDuration() const
RealStatisticsListenerData getMaxFeatureSpeed() const
agx::UInt32 getMaxNumContactsPerTimeStep() const
RealStatisticsListenerData getMaxPenetrationDepth() const
agx::UInt32 getNumRigidBodies() const
RealStatisticsListenerData getMaxFeature() const
virtual void removeNotification() override
Called when this listener is removed from the simulation.
agx::UInt32 getNumTriangles() const
void collectSystemData(agx::Real time=0)
Method that will given the current Simulation count number of bodies, constraints and collect number ...
agx::UInt32 getNumConstraints() const
Simulation is a class that bridges the collision space agxCollide::Space and the dynamic simulation s...
Store all the various statistics of a simulation.
UInt32StatisticsListenerData totalNumContacts
RealStatisticsListenerData minFeature
RealStatisticsListenerData maxContactSpeed
agx::observer_ptr< agxSDK::Simulation > m_simulation
UInt32StatisticsListenerData numShapes
agxSDK::Simulation * getSimulation()
RealStatisticsListenerData maxContactSpeedFeatureRatio
UInt32StatisticsListenerData numContacts
RealStatisticsListenerData maxFeatureSpeed
UInt32StatisticsListenerData numBodies
void setSimulation(agxSDK::Simulation *sim)
RealStatisticsListenerData minContactFeature
RealStatisticsListenerData maxPenetrationDepth
RealStatisticsListenerData maxAngularSpeed
UInt32StatisticsListenerData maxNumContactsPerTimestep
RealStatisticsListenerData maxFeature
agx::ComponentRef m_dataRoot
StatisticsData()
Constructor.
void store(agxStream::OutputArchive &out) const
Serialization store.
agx::Component * getDataRoot()
virtual ~StatisticsData()
RealStatisticsListenerData maxConstraintViolation
UInt32StatisticsListenerData numConstraints
void restore(agxStream::InputArchive &in)
Serialization restore.
RealStatisticsListenerData maxLinearSpeed
UInt32StatisticsListenerData numTriangles
Class for storing min/max values together with a ID for the associated RigidBody/Geometry.
void reset(T val=0)
reset the value to the given value
void set(T val)
Set the value explicitly without comparison.
T compareAndStoreMin(agx::Real time, T val, const agx::RigidBody *b1, const agx::RigidBody *b2=nullptr)
will compare val with the previous value and store time, value, and bodies if val is lower than the p...
agx::UInt64 getBody2() const
void store(agxStream::OutputArchive &out) const
Serialization store.
StatisticsListenerData(StatisticsData *parent, const agx::String &id)
agx::UInt64 getGeometry1() const
void inc()
Increment by one.
void restore(agxStream::InputArchive &in)
Serialization restore.
T compareAndStoreMax(agx::Real time, T val, const agxCollide::Geometry *geom1, const agxCollide::Geometry *geom2=nullptr)
will compare val with the previous value and store time, value, and geometries if val is larger than ...
T compareAndStoreMax(agx::Real time, T val, const agx::RigidBody *b1=nullptr, const agx::RigidBody *b2=nullptr)
will compare val with the previous value and store time, value, and bodies if val is larger than the ...
agx::UInt64 getGeometry2() const
T compareAndStoreMin(agx::Real time, T val, const agxCollide::Geometry *geom1, const agxCollide::Geometry *geom2=nullptr)
will compare val with the previous value and store time, value, and geometries if val is lower than t...
agx::UInt64 getBody1() const
void set(agx::Real time, T val)
Set the value explicitly without comparison including the time.
agx::Real getTime() const
Derive from this class to implement a listener for simulation step events.
Class for writing serialized data in binary format to a stream.
A component is an object containing other objects, enabling hierarchical structuring.
virtual void addObject(agx::Object *object, bool assignContext=true)
Add an object to the component.
Base class providing referencing counted objects.
The rigid body class, combining a geometric model and a frame of reference.
Smart pointer for observed objects, that automatically set pointers to them to null when they deleted...
The agxSDK namespace contain classes to bridge the collision detection system and the dynamical simul...
agx::ref_ptr< StatisticsData > StatisticsDataRef
agx::ref_ptr< SimulationStatisticsListener > SimulationStatisticsListenerRef
StatisticsListenerData< agx::Real > RealStatisticsListenerData
StatisticsListenerData< agx::UInt32 > UInt32StatisticsListenerData
This namespace contain classes for streaming classes into archives, ASCII, binary for storage (serial...
AGXCORE_EXPORT const InvalidIndexStruct InvalidIndex