AGX Dynamics  2.37.2.0
DimensionStateStorage.h
Go to the documentation of this file.
1 /*
2 Copyright 2007-2024. 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 
18 #ifndef AGXPOWERLINE_DETAIL_DIMENSION_STATE_STORAGE
19 #define AGXPOWERLINE_DETAIL_DIMENSION_STATE_STORAGE
20 
21 
22 #include <agx/Vec3.h>
23 #include <agx/Jacobian.h>
24 
25 #include <agxModel/export.h>
26 
27 
28 
29 namespace agx
30 {
31  class RigidBody;
32 }
33 
34 namespace agxStream
35 {
36  class OutputArchive;
37  class InputArchive;
38  class StorageStream;
39 }
40 
41 
42 namespace agxPowerLine
43 {
44  namespace detail
45  {
46 
53  {
54  Rotational();
55 
56  agx::Vec3 getValue(const agx::RigidBody& body) const;
57 
58  agx::Real getValue(const agx::RigidBody& body, const agx::UInt8 slot) const;
59 
60  agx::Real getValue(const agx::RigidBody& body, const agx::Vec3& worldDirection) const;
61 
62  void setValue(agx::RigidBody& body, const agx::UInt8 slot, const agx::Real angle);
63 
64  void setValue(agx::RigidBody& body, const agx::Vec3& worldDirection, const agx::Real angle);
65 
66  agx::Vec3 getGradient(const agx::RigidBody& body) const;
67 
68  agx::Real getGradient(const agx::RigidBody& body, const agx::UInt8 slot) const;
69 
70  agx::Real getGradient(const agx::RigidBody& body, const agx::Vec3& worldDirection) const;
71 
72  void setGradient(agx::RigidBody& body, const agx::UInt8 slot, const agx::Real angularVelocity);
73 
74  void setGradient(agx::RigidBody& body, const agx::Vec3& worldDirection, const agx::Real angularVelocity);
75 
76  agx::Vec3 getSecondGradient(const agx::RigidBody& body) const;
77 
78  agx::Real getSecondGradient(const agx::RigidBody& body, const agx::UInt8 slot) const;
79 
80  agx::Real getSecondGradient(const agx::RigidBody& body, const agx::Vec3& worldDirection) const;
81 
82  agx::Vec3 getMassProperty(const agx::RigidBody& body) const;
83 
84  agx::Real getMassProperty(const agx::RigidBody& body, agx::UInt8 slot) const;
85 
86  agx::Real getMassProperty(const agx::RigidBody& body, const agx::Vec3& worldDirection) const;
87 
88  bool setMassProperty(agx::RigidBody& body, const agx::Vec3& inertia);
89 
90  bool setMassProperty(agx::RigidBody& body, const agx::UInt8 slot, const agx::Real inertia);
91 
92  bool setMassProperty(agx::RigidBody& body, const agx::Vec3& worldDirection, const agx::Real inertia);
93 
94  agx::Vec3 getAddedLoad(const agx::RigidBody& body) const;
95 
96  agx::Real getAddedLoad(const agx::RigidBody& body, const agx::UInt8 slot) const;
97 
98  agx::Real getAddedLoad(const agx::RigidBody& body, const agx::Vec3& worldDirection) const;
99 
100  void setAddedLoad(agx::RigidBody& body, agx::UInt8 slot, agx::Real load);
101 
102  void setAddedLoad(agx::RigidBody& body, const agx::Vec3& worldDirection, agx::Real load);
103 
104  void addLoad(agx::RigidBody& body, const agx::UInt8 slot, const agx::Real load);
105 
106  void addLoad(agx::RigidBody& body, const agx::Vec3& worldDirection, const agx::Real load);
107 
108  agx::Vec3f getVelocityDamping(const agx::RigidBody& body) const;
109 
110  float getVelocityDamping(const agx::RigidBody& body, const agx::UInt8 slot) const;
111 
112  float getVelocityDamping(const agx::RigidBody& body, const agx::Vec3& worldDirection) const;
113 
114  void setVelocityDamping(agx::RigidBody& body, const agx::UInt8 slot, const float damping);
115 
116  void setVelocityDamping(agx::RigidBody& body, const agx::Vec3& worldDirection, const float damping);
117 
118  void move(agx::RigidBody& oldBody, const agx::UInt8 oldSlot, agx::RigidBody& newBody, const agx::UInt8 newSlot);
119 
120  void writeJacobian(agx::Jacobian6DOFElement& G, const agx::Vec3& jacobian) const;
121 
122  void integrateValue(agx::RigidBody& body, const agx::UInt8 slot, const agx::Real timeStep);
123 
124  void store(agxStream::OutputArchive& out) const;
125  void restore(agxStream::InputArchive& in);
126  void store(agxStream::StorageStream& out, const agx::RigidBody& body, const agx::UInt8 slot) const;
127  void restore(agxStream::StorageStream& in, agx::RigidBody& body, const agx::UInt8 slot);
128  void store(agxStream::StorageStream& out, const agx::RigidBody& body, const agx::Vec3& worldDirection) const;
129  void restore(agxStream::StorageStream& in, agx::RigidBody& body, const agx::Vec3& worldDirection);
130 
131  static bool getAllowPacking();
132 
133  private:
134  agx::Real m_angle;
135  };
136 
137 
144  {
145  agx::Vec3 getValue(const agx::RigidBody& body) const;
146 
147  agx::Real getValue(const agx::RigidBody& body, agx::UInt8 slot) const;
148 
149  agx::Real getValue(const agx::RigidBody& body, const agx::Vec3& worldDirection) const;
150 
151  void setValue(agx::RigidBody& body, const agx::UInt8 slot, const agx::Real position);
152 
153  void setValue(agx::RigidBody& body, const agx::Vec3& worldDirection, const agx::Real position);
154 
155  agx::Vec3 getGradient(const agx::RigidBody& body) const;
156 
157  agx::Real getGradient(const agx::RigidBody& body, const agx::UInt8 slot) const;
158 
159  agx::Real getGradient(const agx::RigidBody& body, const agx::Vec3& worldDirection) const;
160 
161  void setGradient(agx::RigidBody& body, const agx::UInt8 slot, const agx::Real velocity);
162 
163  void setGradient(agx::RigidBody& body, const agx::Vec3& worldDirection, const agx::Real velocity);
164 
165  agx::Vec3 getSecondGradient(const agx::RigidBody& body) const;
166 
167  agx::Real getSecondGradient(const agx::RigidBody& body, const agx::UInt8 slot) const;
168 
169  agx::Real getSecondGradient(const agx::RigidBody& body, const agx::Vec3& worldDirection) const;
170 
171  agx::Vec3 getMassProperty(const agx::RigidBody& body) const;
172 
173  agx::Real getMassProperty(const agx::RigidBody& body, agx::UInt8 slot) const;
174 
175  agx::Real getMassProperty(const agx::RigidBody& body, const agx::Vec3& worldDirection) const;
176 
177  bool setMassProperty(agx::RigidBody& body, const agx::Vec3& mass);
178 
179  bool setMassProperty(agx::RigidBody& body, const agx::UInt8 slot, const agx::Real mass);
180 
181  bool setMassProperty(agx::RigidBody& body, const agx::Vec3& worldDirection, const agx::Real mass);
182 
183  agx::Vec3 getAddedLoad(const agx::RigidBody& body) const;
184 
185  agx::Real getAddedLoad(const agx::RigidBody& body, const agx::UInt8 slot) const;
186 
187  agx::Real getAddedLoad(const agx::RigidBody& body, const agx::Vec3& worldDirection) const;
188 
189  void setAddedLoad(agx::RigidBody& body, agx::UInt8 slot, agx::Real load);
190 
191  void setAddedLoad(agx::RigidBody& body, const agx::Vec3& worldDirection, agx::Real load);
192 
193  void addLoad(agx::RigidBody& body, const agx::UInt8 slot, const agx::Real load);
194 
195  void addLoad(agx::RigidBody& body, const agx::Vec3& worldDirection, const agx::Real load);
196 
197  agx::Vec3f getVelocityDamping(const agx::RigidBody& body) const;
198 
199  float getVelocityDamping(const agx::RigidBody& body, const agx::UInt8 slot) const;
200 
201  float getVelocityDamping(const agx::RigidBody& body, const agx::Vec3& worldDirection) const;
202 
203  void setVelocityDamping(agx::RigidBody& body, const agx::UInt8 slot, const float damping);
204 
205  void setVelocityDamping(agx::RigidBody& body, const agx::Vec3& worldDirection, const float damping);
206 
207  void move(agx::RigidBody& oldBody, const agx::UInt8 oldSlot, agx::RigidBody& newBody, const agx::UInt8 newSlot);
208 
209  void writeJacobian(agx::Jacobian6DOFElement& G, const agx::Vec3& jacobian) const;
210 
211  void integrateValue(agx::RigidBody& body, const agx::UInt8 slot, const agx::Real timeStep);
212 
213  void store(agxStream::OutputArchive& out) const;
214  void restore(agxStream::InputArchive& in);
215  void store(agxStream::StorageStream& out, const agx::RigidBody& body, const agx::UInt8 slot) const;
216  void restore(agxStream::StorageStream& in, agx::RigidBody& body, const agx::UInt8 slot);
217  void store(agxStream::StorageStream& out, const agx::RigidBody& body, const agx::Vec3& worldDirection) const;
218  void restore(agxStream::StorageStream& in, agx::RigidBody& body, const agx::Vec3& worldDirection);
219 
220  static bool getAllowPacking();
221  };
222 
223 
224 
225  }
226 }
227 
228 
229 #endif
RigidBody accessor helper that knows how to extract rotational data from a RigidBody.
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...
uint8_t UInt8
Definition: Integer.h:38
agxPowerLine contains a collection of connected components that transport power across a system...
Definition: MotorUnit.h:23
RigidBody accessor helper that knows how to extract translational data from a RigidBody.
The agx namespace contains the dynamics/math part of the AGX Dynamics API.
The rigid body class, combining a geometric model and a frame of reference.
Definition: RigidBody.h:54
Class for reading a binary stream of serialized data.
Definition: InputArchive.h:51
Abstract base class for storing/restoring a line/drums with version control.
Definition: StorageStream.h:48
Class for writing serialized data in binary format to a stream.
Definition: OutputArchive.h:56
#define AGXMODEL_EXPORT
double Real
Definition: Real.h:42
This namespace contain classes for streaming classes into archives, ASCII, binary for storage (serial...