AGX Dynamics  2.35.0.1
PowerLineConstraints.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 AGXPOWERLINE_POWER_LINE_CONSTRAINTS_H
18 #define AGXPOWERLINE_POWER_LINE_CONSTRAINTS_H
19 
20 #include <agxModel/export.h>
21 #include <agxPowerLine/PowerLine.h>
22 
24 
25 #include <agx/RigidBody.h>
28 
29 namespace agxPowerLine
30 {
32 
39  {
40  public:
41 
46 
50  virtual size_t getJacobian( agx::Jacobian6DOFElement* /*G*/,
51  const RigidBodyPtrIntHashVector& /*bodyToIndexTable*/,
52  const agx::ConstraintRigidBodyContainer& /*bodies*/,
53  const PhysicalDimensionPtrIntTable& /*dimensions*/,
54  const agx::Real /*dt*/ ) = 0;
55 
56 
57  virtual void getJacobian(const agxPowerLine::PhysicalDimension* dimension, agx::Jacobian6DOFElement& G) const = 0;
58 
62  virtual agx::UInt getViolation( agx::Real* /*g*/, agx::UInt /*row*/ ) override;
63 
67  void setConnector(Connector* connector);
69  const Connector* getConnector() const;
70 
74  virtual bool isValid() const;
75 
79  virtual void store( agxStream::OutputArchive& out ) const override;
80 
84  virtual void restore( agxStream::InputArchive& in ) override;
85 
86 
88 
89 
90  protected:
95 
96  protected:
98 
100 
105  agx::UInt /*numBlocks*/,
106  agx::UInt /*row*/,
107  agx::GWriteState::Enum /*writeState*/ ) override;
108  };
109 
110 
115  {
116  public:
121 
125  virtual size_t getJacobian(
127  const RigidBodyPtrIntHashVector& bodyToIndexTable,
128  const agx::ConstraintRigidBodyContainer& bodies,
129  const PhysicalDimensionPtrIntTable& dimensions,
130  const agx::Real dt ) override;
131 
132 
133  virtual void getJacobian(
134  const agxPowerLine::PhysicalDimension* dimension,
135  agx::Jacobian6DOFElement& G) const override;
136 
137  protected:
139 
141 
142  protected:
143 
144  };
145 
146 
151  {
152  public:
157 
159 
163  virtual bool updateValid() override;
164 
165  virtual void prepareDimensions();
166 
170  virtual size_t updateJacobian( agx::Jacobian6DOFElement* jacobians ) override;
171 
173 
177  virtual void preSystemCallback( agx::DynamicsSystem* system ) override;
178 
182  virtual void postSystemCallback( agx::DynamicsSystem* system ) override;
183 
189 
194 
198  void setCompliance( agx::Real compliance );
199 
204 
205 
209  void add(PhysicalDimension* dimension);
210 
211 
212  virtual void storeLightData(agxStream::StorageStream& str) const override;
213  virtual void restoreLightData(agxStream::StorageStream& str) override;
214 
216 
217  protected:
218 
220 
221  void initialize();
222 
223  protected:
229  };
230 
231 
232 
237  {
238  public:
241 
242  protected:
244  };
245 
247 
248 
249 
254  {
255  public:
258 
259  protected:
261  };
262 
263 
264 
269  {
270  public:
272 
276  virtual bool isValid() const override;
277  };
278 
280 
281 
286  {
287  public:
289  };
290 
291 
294  {
295  public:
298  protected:
300  };
301 
302 
303 
305  {
306  public:
309 
310  protected:
312  };
313 
314 
315 }
316 
317 #endif // AGXMODEL_POWER_LINE_CONSTRAINTS_H
#define AGXSTREAM_DECLARE_SERIALIZABLE(T)
Use this in a Serializable class to add the required methods Important: Use full namespace in the dec...
Definition: Serializable.h:207
#define AGXMODEL_EXPORT
Links two connections together.
Definition: Connector.h:54
An elementary gear constraint constrains the velocity of the rotational dimensions of a number bodies...
An elementary gear constraint constrains the velocity of the rotational dimensions of a number bodies...
virtual bool isValid() const override
Check if the dimensions of the constraint are legit.
virtual bool isValid() const
Check if the dimensions of the constraint are legit.
ElementaryPhysicalDimensionConstraint()
Constructor for pure virtual function.
virtual size_t getJacobian(agx::Jacobian6DOFElement *, const RigidBodyPtrIntHashVector &, const agx::ConstraintRigidBodyContainer &, const PhysicalDimensionPtrIntTable &, const agx::Real)=0
getJacobian must be implemented for all classes that inherits from this.
virtual void getJacobian(const agxPowerLine::PhysicalDimension *dimension, agx::Jacobian6DOFElement &G) const =0
AGXSTREAM_DECLARE_ABSTRACT_SERIALIZABLE(agxPowerLine::ElementaryPhysicalDimensionConstraint)
virtual agx::UInt getViolation(agx::Real *, agx::UInt) override
virtual agx::UInt getJacobian(agx::Jacobian6DOFElement *, agx::UInt, agx::UInt, agx::GWriteState::Enum) override
Forced inheritance from agx::ElementaryConstraint.
virtual void store(agxStream::OutputArchive &out) const override
Store this object to stream.
virtual void restore(agxStream::InputArchive &in) override
Restore this object from stream.
void setConnector(Connector *connector)
Set a pointer to the connector that will define this constraint.
Elementary constraint for constraining an arbitrary number of ONE specific PhysicalDimension::Type.
virtual void getJacobian(const agxPowerLine::PhysicalDimension *dimension, agx::Jacobian6DOFElement &G) const override
virtual size_t getJacobian(agx::Jacobian6DOFElement *G, const RigidBodyPtrIntHashVector &bodyToIndexTable, const agx::ConstraintRigidBodyContainer &bodies, const PhysicalDimensionPtrIntTable &dimensions, const agx::Real dt) override
Implementation of getJacobian for a multi body constraint for the power line, where all dimensions ha...
Constraint implementation that constrains the velocity of the rotational dimensions of a number bodie...
Constraint implementation that constrains the velocity of the rotational dimensions of a number bodie...
Constraint implementation for constraining a number of physical dimensions of the same type.
virtual void preSystemCallback(agx::DynamicsSystem *system) override
Prepare system before solve.
void setCompliance(agx::Real compliance)
Set the compliance of the constraint.
virtual size_t updateJacobian(agx::Jacobian6DOFElement *jacobians) override
Update the jacobians of the included dimensions.
virtual void postSystemCallback(agx::DynamicsSystem *system) override
Prepare system after solve.
PhysicalDimensionMultiBodyConstraintImplementation(ElementaryPhysicalDimensionConstraint *elementaryConstraint)
virtual bool updateValid() override
Test if the constraint is still valid.
virtual void restoreLightData(agxStream::StorageStream &str) override
virtual void storeLightData(agxStream::StorageStream &str) const override
void add(PhysicalDimension *dimension)
Add a physical dimension to the constraint.
void setConnector(agxPowerLine::Connector *connector)
ElementaryPhysicalDimensionConstraint * getElementaryConstraint() const
agx::Vector< agx::observer_ptr< agx::RigidBody > > m_observedBodies
Class for reading a binary stream of serialized data.
Definition: InputArchive.h:52
Class for writing serialized data in binary format to a stream.
Definition: OutputArchive.h:57
This class is an abstract base class for all classes that can be stored and retrieved from an Archive...
Definition: Serializable.h:45
Abstract base class for storing/restoring a line/drums with version control.
Definition: StorageStream.h:49
virtual agx::ElementaryConstraint * getElementaryConstraint(const agx::UInt index) const
The complete physical system with bodies, interactions, data layout, time stepper,...
Helper class to hold data that is general for elementary constraints.
Smart pointer for handling referenced counted objects.
Definition: ref_ptr.h:30
agxPowerLine contains a collection of connected components that transport power across a system.
Definition: MotorUnit.h:24
agx::ref_ptr< ElementaryGearConstraint > GearConstraintRef
agx::HashVector< PhysicalDimension *, int > PhysicalDimensionPtrIntTable
agx::ref_ptr< ElementaryHolonomicGearConstraint > HolonomicGearConstraintRef
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.
uint32_t UInt
Definition: Integer.h:34
double Real
Definition: Real.h:42