AGXDynamics  2.35.0.3
ConstraintLogListener.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 #ifndef AGXSDK_CONSTRAINTLOGLISTENER_H
18 #define AGXSDK_CONSTRAINTLOGLISTENER_H
19 
20 #include <agxSDK/agxSDK.h>
21 #include <agxSDK/LogListener.h>
22 #include <agx/Constraint.h>
23 #include <agx/TimeStamp.h>
24 #include <string>
25 
26 
27 namespace agxSDK
28 {
31  {
32  public:
33 
41  ConstraintLogListener(const std::string& fileName = "",
42  bool newFilePerTimeStep = false,
43  const std::string& valueSeparator = "\t");
44 
50  inline void addConstraint( agx::Constraint* constraint, int bodyIndex = 0);
51 
52 
53  protected:
54  virtual void obtainHeader( std::stringstream& header );
55  virtual void collectData ( std::stringstream& data, const agx::TimeStamp& /*time*/ );
56 
57 
58  protected:
59  typedef std::pair<agx::observer_ptr<agx::Constraint>, int> AttachedConstrait;
61  };
62 
64 
66  int bodyIndex /*=0*/)
67  {
68  m_constraints.push_back( AttachedConstrait( constraint, bodyIndex ) );
69  constraint->setEnableComputeForces( true );
70  }
71 }
72 
73 #endif /* AGXSDK_CONSTRAINTLOGLISTENER_H */
agx::Constraint::setEnableComputeForces
void setEnableComputeForces(agx::Bool enable)
Enable (or disable) computation of the forces applied to the dynamic bodies in this constraint.
agx::Vector< AttachedConstrait >
agxSDK::ConstraintLogListener::m_constraints
agx::Vector< AttachedConstrait > m_constraints
Definition: ConstraintLogListener.h:60
Constraint.h
agxSDK::ConstraintLogListenerRef
agx::ref_ptr< ConstraintLogListener > ConstraintLogListenerRef
Definition: ConstraintLogListener.h:63
AGXPHYSICS_EXPORT
#define AGXPHYSICS_EXPORT
agx::ref_ptr
Smart pointer for handling referenced counted objects.
Definition: ref_ptr.h:29
agxSDK::ConstraintLogListener::AttachedConstrait
std::pair< agx::observer_ptr< agx::Constraint >, int > AttachedConstrait
Definition: ConstraintLogListener.h:59
agxSDK::LogListener
Abstract class for logging properties per time step to a file/standard out.
Definition: LogListener.h:29
LogListener.h
agx::TimeStamp
agx::Real TimeStamp
Definition: TimeStamp.h:26
agx::Constraint
The base class for a constraint.
Definition: Constraint.h:88
agxSDK::ConstraintLogListener
Class that will log various properties of constraints.
Definition: ConstraintLogListener.h:30
agxSDK
The agxSDK namespace contain classes to bridge the collision detection system and the dynamical simul...
Definition: Constraint.h:30
agxSDK::ConstraintLogListener::addConstraint
void addConstraint(agx::Constraint *constraint, int bodyIndex=0)
Adds a constraint for logging.
Definition: ConstraintLogListener.h:65
TimeStamp.h
agxSDK.h
agx::Vector::push_back
void push_back(const T2 &value)
Definition: Vector.h:715