AGX Dynamics 2.42.3.1
Loading...
Searching...
No Matches
PhysicalDimension.h
Go to the documentation of this file.
1/*
2Copyright 2007-2025. Algoryx Simulation AB.
3
4All AGX source code, intellectual property, documentation, sample code,
5tutorials, scene files and technical white papers, are copyrighted, proprietary
6and confidential material of Algoryx Simulation AB. You may not download, read,
7store, distribute, publish, copy or otherwise disseminate, use or expose this
8material unless having a written signed agreement with Algoryx Simulation AB, or having been
9advised so by Algoryx Simulation AB for a time limited evaluation, or having purchased a
10valid commercial license from Algoryx Simulation AB.
11
12Algoryx Simulation AB disclaims all responsibilities for loss or damage caused
13from using this software, unless otherwise stated in written agreements with
14Algoryx Simulation AB.
15*/
16
17#pragma once
18
19#include <agxModel/export.h>
20#include <agxPowerLine/Sides.h>
22
25
26#include <agxUtil/agxUtil.h>
27
28#include <agx/RigidBody.h>
29#include <agx/agx_hash_types.h>
32
33#include <string>
34
35
36
37#if defined(_MSC_VER)
38#pragma warning( push )
39#pragma warning( disable : 4589 ) // Disable: 4589: Constructor of abstract class 'agx::FrictionModel' ignores initializer for virtual base class 'agxStream::Serializable'
40#endif
41
42
43namespace agxPowerLine
44{
45 namespace detail
46 {
47 class ConnectionOperations;
48 class AbstractDimensionState1Dof;
49 class AbstractDimensionState3Dof;
51 }
52}
53
54namespace agxPowerLine
55{
56 class Connection;
57 class Connector;
58 class Unit;
59 class PowerLine;
60 class PowerGenerator;
61 class LookupTable;
62 class PhysicalDimensionMultiBodyConstraintImplementation;
63
75
76
78 typedef std::pair<agxPowerLine::PhysicalDimension*, agxPowerLine::Side> DimensionAndSide;
79
93 {
94 public:
95 typedef int Type;
97
104 virtual void calculateJacobian(
106 const agx::Real ratio,
107 const size_t index) const;
108
115
116
117
122 virtual agx::Real getValue() const ;
123 virtual void setValue(agx::Real value);
124 virtual agx::Real getGradient() const;
125 virtual void setGradient( agx::Real value);
127
141 const agx::Name& getName() const;
142 void setName(const agx::Name& name);
143
144
152
161
170
171
175 bool hasReservedBody() const;
176
182
187 bool isExternalBody() const;
188
192 virtual agx::Real getMassProperty() const;
193
197 virtual void setMassProperty(agx::Real massProperty);
198
199
203 virtual agx::Real getInputLoad() const;//Torque(rotational dimension), Force(translational dimension)...
204 virtual agx::Real getOutputLoad() const;//Torque(rotational dimension), Force(translational dimension)...
205
206
210 virtual void addLoad(agx::Real load);
211
212
216 virtual agx::Real getPowerIn() const;
217 virtual agx::Real getPowerOut() const;
218
223
228
230
231 void setVelocityDamping(float damping);
232 float getVelocityDamping() const;
233
237 virtual void renderDebug();
238
242 virtual void clear();
243
247 size_t getNumConnections() const;
248
252 const agxPowerLine::Connection* getInputConnection(size_t inputIndex = 0) const;
253 const agxPowerLine::Connection* getOutputConnection(size_t outputIndex = 0) const;
254
259
260 const Connection* getOutputConnection(const Connector* connector ) const;
261 const Connection* getInputConnection(const Connector* connector ) const;
262 const Connection* getOutputConnection(const Unit* unit) const;
263 const Connection* getInputConnection(const Unit* unit ) const;
264
273 const Connection* getConnection(const Connector* connector, agxPowerLine::Side side) const;
274
279
281
282
283 size_t getBodyIndexIn(const RigidBodyPtrIntHashVector& bodyToIndexTable);
284
292
301
302
311
312
316 virtual bool store(agxStream::StorageStream& str) const;
317
322
323
325 virtual void store(agxStream::OutputArchive& out) const override;
326 virtual void restore(agxStream::InputArchive& in) override;
327 void restore(agxStream::InputArchive& in, agx::RigidBody*& body, bool& externalBody);
328
329
330
346 virtual std::string getTypeName() const;
347
348
353
354
377 static std::string getStaticTypeName();
378
380
385
386
387 protected:
389
391 agxPowerLine::Unit* unit,
394
396
403 bool restore(agxStream::StorageStream& in, const agx::Vec3* direction);
404
405 friend class Unit;
406 friend class Connector;
407
410
416
423
425
430 virtual void removeNotification(agxSDK::Simulation* simulation, agxUtil::ConstraintHolder* constraintHolder);
431
434
439
440 protected:
443
444 protected:
451 };
452
459
460
462}
463
464#if defined(_MSC_VER)
465#pragma warning( pop )
466#endif
#define AGXMODEL_EXPORT
Links two connections together.
Definition: Connector.h:53
Constraint implementation for constraining a number of physical dimensions of the same type.
const agxPowerLine::Connection * getInputConnection(size_t inputIndex=0) const
Traversing helper functions.
agxPowerLine::Unit * getUnit()
static std::string getStaticTypeName()
Returns the dimension type name of PhysicalDimension.
const agxPowerLine::detail::DimensionState * getState() const
const Connection * getOutputConnection(const Connector *connector) const
agxPowerLine::detail::AbstractDimensionState1Dof * get1DofState()
Access the DimensionState as a 1-dimensional state.
size_t getNumOutputConnections() const
virtual void calculateJacobian(agx::Jacobian6DOFElement *G, const agx::Real ratio, const size_t index) const
Calculates jacobian for a physical dimension.
AGXSTREAM_DECLARE_ABSTRACT_SERIALIZABLE(agxPowerLine::PhysicalDimension)
size_t getNumConnections(agxPowerLine::Side side) const
const agx::Name & getName() const
Returns the name of this PhysicalDimension instance.
virtual agx::Real getPowerOut() const
agxPowerLine::PhysicalDimension::Type getType() const
returns the PhysicalDimension::Type of this dimension
const Connection * getOutputConnection(const Unit *unit) const
Connection * getInputConnection(const Connector *connector)
virtual void store(agxStream::OutputArchive &out) const override
agxPowerLine::detail::DimensionState * getState()
Provides direct access to the underlying DimensionState.
virtual void addLoad(agx::Real load)
Add a load to the dimension.
void addToListOfDimensions()
Add to singleton that controls the different types of physical dimensions.
agxPowerLine::detail::AbstractDimensionState3Dof * get3DofState()
Access the DimensionState as a 3-dimensional state.
const agxPowerLine::ConnectionRefVector & getOutputConnections() const
virtual agx::Real getInputLoad() const
return the load in/out
bool removeInputConnection(Connection *connection)
const agxPowerLine::Connection * getOutputConnection(size_t outputIndex=0) const
void addNotification(agxPowerLine::PowerLine *powerLine)
void removeNotification(agxSDK::Simulation *simulation)
virtual agx::Real getValue() const
Physical properties of the dimension.
void restore(agxStream::InputArchive &in, agx::RigidBody *&body, bool &externalBody)
virtual void clear()
Clear all reference pointers.
size_t getNumInputConnections() const
PhysicalDimension::Type m_type
static int getNumberOfPhysicalDimensions()
agx::RigidBody * getReservedBody()
Return a body that is guaranteed to not be shared with any other PhysicalDimension.
bool removeOutputConnection(Connection *connection)
ConnectionRefVector m_inputConnections
ConnectionRefVector m_outputConnections
virtual void restore(agxStream::InputArchive &in) override
agxPowerLine::ConnectionRefVector & getConnectionsWritable(agxPowerLine::Side side)
const Connection * getInputConnection(const Unit *unit) const
void addNotification(agxSDK::Simulation *simulation)
Called when the Unit owning this PhysicalDimension is added to a simulation.
agxPowerLine::Connection * getInputConnection(size_t inputIndex=0)
Connection * getOutputConnection(const Unit *unit)
agxPowerLine::Connection * getOutputConnection(size_t outputIndex=0)
virtual void setGradient(agx::Real value)
bool connect(agxPowerLine::PhysicalDimension *otherDimension, agxPowerLine::Connector *connector)
Connect to another dimension for possible power transfer.
agx::Vec3 getWorldDirection() const
agxPowerLine::PhysicalDimensionMultiBodyConstraintImplementation * getConstraint(size_t outputConnection=0) const
const agx::RigidBody * getReservedBody() const
virtual agx::Real getSecondGradient() const
const Connection * getInputConnection(const Connector *connector) const
virtual void setValue(agx::Real value)
PhysicalDimension(agxPowerLine::Unit *unit, agxPowerLine::PhysicalDimension::Type type, agxPowerLine::detail::DimensionState *state)
const agxPowerLine::ConnectionRefVector & getInputConnections() const
virtual std::string getTypeName() const
Returns the dimension type name of this PhysicalDimension instance.
bool restore(agxStream::StorageStream &in, const agx::Vec3 *direction)
Some serialization versions stored the dimension axis direction in classes deriving from PhysicalDime...
agx::RigidBody * getOrReserveBody()
Return a body that is guaranteed to not be shared with any other PhysicalDimension.
void setName(const agx::Name &name)
virtual void setMassProperty(agx::Real massProperty)
Set the mass property of the dimension.
const agxPowerLine::ConnectionRefVector & getConnections(agxPowerLine::Side side) const
agxPowerLine::detail::PhysicalDimensionStateRef m_state
virtual void renderDebug()
Implement this to render Your physical dimension.
virtual bool store(agxStream::StorageStream &str) const
Stores internal data into stream.
static agxPowerLine::PhysicalDimension::Type getStaticType()
virtual agx::Real getGradient() const
void reserveBody()
Ensure that this PhysicalDimension does not share it's body with any other PhysicalDimension.
virtual bool restore(agxStream::StorageStream &in)
Restores internal data from stream.
bool isExternalBody() const
Return true if the body that defines the dimension was given to the Power- Line, false if the body wa...
const agxPowerLine::detail::AbstractDimensionState3Dof * get3DofState() const
Connection * getInputConnection(const Unit *unit)
const agxPowerLine::Unit * getUnit() const
Returns pointer to the Unit that contains this dimension.
size_t getBodyIndexIn(const RigidBodyPtrIntHashVector &bodyToIndexTable)
const agxPowerLine::detail::AbstractDimensionState1Dof * get1DofState() const
Connection * getOutputConnection(const Connector *connector)
Connection * getConnection(const Connector *connector, agxPowerLine::Side side)
Find the Connection object on the given side that connects to the given Connectors.
agxPowerLine::PhysicalDimensionMultiBodyConstraintImplementation * getInputConstraint(size_t inputConnection=0) const
virtual void removeNotification(agxSDK::Simulation *simulation, agxUtil::ConstraintHolder *constraintHolder)
Remove the PhysicalDimension from the simulation.
virtual agx::Real getMassProperty() const
returns the mass property of the dimension body.
virtual agx::Real getOutputLoad() const
void removeNotification(agxPowerLine::PowerLine *powerLine)
const Connection * getConnection(const Connector *connector, agxPowerLine::Side side) const
virtual agx::Real getPowerIn() const
return the power in/out
void setVelocityDamping(float damping)
PowerLine is the base class for a system of power transfer integrated into the rigid body simulation.
Definition: PowerLine.h:66
Pure virtual class.
Definition: Unit.h:72
Base class for the two one dimensional dimension state classes.
Base class for the two three dimensional dimension state classes.
A DimensionState is the data carrier of a PhysicalDimension.
Simulation is a class that bridges the collision space agxCollide::Space and the dynamic simulation s...
Definition: Simulation.h:131
Class for reading a binary stream of serialized data.
Definition: InputArchive.h:51
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:44
Abstract base class for storing/restoring a line/drums with version control.
Definition: StorageStream.h:49
Utility class to hold custom implementations of constraints.
Definition: agxUtil.h:523
This class is a combined container which has the find complexity of a HashTable, deterministic iterat...
Definition: HashVector.h:41
Representation of a name string.
Definition: Name.h:33
Base class providing referencing counted objects.
Definition: Referenced.h:120
The rigid body class, combining a geometric model and a frame of reference.
Definition: RigidBody.h:49
This class is a combined container which has the find complexity of a HashTable, deterministic iterat...
Definition: SetVector.h:38
Templated vector class.
Definition: agx/Vector.h:53
Smart pointer for observed objects, that automatically set pointers to them to null when they deleted...
Definition: observer_ptr.h:61
agxPowerLine contains a collection of connected components that transport power across a system.
Definition: MotorUnit.h:24
agx::HashVector< agx::RigidBody *, int > RigidBodyPtrIntHashVector
agx::observer_ptr< Connector > ConnectorObserver
agx::Vector< PhysicalDimension * > PhysicalDimensionPtrVector
agx::SetVector< PhysicalDimension * > PhysicalDimensionPtrSetVector
std::pair< agxPowerLine::PhysicalDimension *, agxPowerLine::Side > DimensionAndSide
agx::Vector< ConnectionPtr > ConnectionPtrVector
Connection * ConnectionPtr
const PhysicalDimensionRef ConstPhysicalDimensionRef
agx::ref_ptr< LookupTable > LookupTableRef
agx::Vector< ConstPhysicalDimensionRef > ConstPhysicalDimensionRefVector
agx::ref_ptr< PhysicalDimension > PhysicalDimensionRef
agx::ref_ptr< PowerGenerator > PowerGeneratorRef
agx::ref_ptr< Connection > ConnectionRef
agx::ref_ptr< Connector > ConnectorRef
Definition: Connector.h:404
agx::Vector< PhysicalDimensionRef > PhysicalDimensionRefVector
agx::Vector< Unit * > UnitPtrVector
AGXMODEL_EXPORT agx::RigidBody * createDimensionBody(const agx::Name &name)
agx::observer_ptr< PowerGenerator > PowerGeneratorObserver
agx::Vector< ConnectionRef > ConnectionRefVector
double Real
Definition: Real.h:41