AGX Dynamics  2.35.0.1
SubGraph.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 
18 #ifndef AGXPOWERLINE_SUB_GRAPH_ROUTER_H
19 #define AGXPOWERLINE_SUB_GRAPH_ROUTER_H
20 
21 #include <agxModel/export.h>
22 #include <agx/Constraint.h>
23 
24 namespace agx
25 {
26  class RigidBody;
27 }
28 
29 namespace agxPowerLine
30 {
31  class PowerLine;
32  class PhysicalDimension;
33  class Connector;
34  class Unit;
35 
38 
43 }
44 
45 namespace agxUtil
46 {
47  class ConstraintHolder;
48 }
49 
50 namespace agxPowerLine
51 {
52 
55 
56 
61  {
62  public:
63 
65 
70  void setName(const agx::Name& name);
71 
75  const agx::Name& getName() const;
76 
78  const SubGraph* getEnclosingGraph() const;
79 
84 
89 
91  const Unit* getEnclosingUnit() const;
92 
95 
99  bool isEnclosedWithin(const SubGraph* component) const;
100 
105  virtual void getConnectorsRecursive(ConnectorPtrVector& connectors);
106 
111  virtual void getUnitsRecursive(UnitPtrVector& units);
112 
113 
114  // Methods called by the rest of the PowerLine frame work.
115  public:
116 
117  virtual bool addNotification(agxSDK::Simulation* simulation) = 0;
118 
119  virtual void prepareForStore();
120  virtual void prepareForRestore();
121 
122 
125  virtual bool removeNotification(agxUtil::ConstraintHolder* holder, agxSDK::Simulation* simulation) = 0;
126 
127 
129 
140  virtual bool preUpdate(agx::Real timeStep);
141  virtual bool postUpdate(agx::Real timeStep);
142 
146  virtual bool store(agxStream::StorageStream& str) const;
147 
151  virtual bool restore(agxStream::StorageStream& str);
152 
154  virtual void restore(agxStream::InputArchive& in) override;
155  virtual void store(agxStream::OutputArchive& out) const override;
156 
157  protected:
158  virtual ~SubGraph();
159 
162 
165 
167 
168  protected:
174  };
175 
176 
177 }
178 
179 #endif
#define AGX_DECLARE_POINTER_TYPES(type)
Definition: Referenced.h:248
#define AGXMODEL_EXPORT
#define AGX_DECLARE_VECTOR_TYPES(type)
Definition: agx/Vector.h:34
Links two connections together.
Definition: Connector.h:54
PowerLine is the base class for a system of power transfer integrated into the rigid body simulation.
Definition: PowerLine.h:71
virtual void prepareForStore()
bool isEnclosedWithin(const SubGraph *component) const
AGXSTREAM_DECLARE_ABSTRACT_SERIALIZABLE(agxPowerLine::SubGraph)
void addInternalUnit(agxPowerLine::Unit *unit)
SubGraphObserver m_enclosingGraph
Definition: SubGraph.h:169
const agxPowerLine::UnitRefVector & getInternalUnits() const
virtual bool preUpdate(agx::Real timeStep)
virtual void store(agxStream::OutputArchive &out) const override
virtual bool restore(agxStream::StorageStream &str)
Restores internal data from stream.
SubGraph * getRootEnclosingGraph()
Connector * getEnclosingConnector()
virtual void getUnitsRecursive(UnitPtrVector &units)
Fill the given vector with the Units that are held by this SubGraph.
ConnectorRefVector m_internalConnectors
Definition: SubGraph.h:171
const agx::Name & getName() const
const SubGraph * getEnclosingGraph() const
void setName(const agx::Name &name)
Set the name of this power line component.
const Connector * getEnclosingConnector() const
virtual void restore(agxStream::InputArchive &in) override
virtual void getConnectorsRecursive(ConnectorPtrVector &connectors)
Fill the given vector with the Connectors that are held by this SubGraph.
void removeInternalConnector(agxPowerLine::Connector *connector)
virtual bool removeNotification(agxUtil::ConstraintHolder *holder, agxSDK::Simulation *simulation)=0
PowerLine * m_powerLine
Definition: SubGraph.h:172
const agxPowerLine::ConnectorRefVector & getInternalConnectors() const
virtual bool postUpdate(agx::Real timeStep)
const SubGraph * getRootEnclosingGraph() const
void addInternalConnector(agxPowerLine::Connector *connector)
UnitRefVector m_internalUnits
Definition: SubGraph.h:170
void removeInternalUnit(agxPowerLine::Unit *unit)
agx::Bool replaceInternalUnit(agxPowerLine::Unit *oldUnit, agxPowerLine::Unit *newUnit)
const Unit * getEnclosingUnit() const
virtual bool store(agxStream::StorageStream &str) const
Stores internal data into stream.
virtual void prepareForRestore()
virtual bool addNotification(agxSDK::Simulation *simulation)=0
SubGraph * getEnclosingGraph()
Pure virtual class.
Definition: Unit.h:73
Simulation is a class that bridges the collision space agxCollide::Space and the dynamic simulation s...
Definition: Simulation.h:127
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
Utility class to hold custom implementations of constraints.
Definition: agxUtil.h:464
Representation of a name string.
Definition: Name.h:33
Base class providing referencing counted objects.
Definition: Referenced.h:114
Templated vector class.
Definition: agx/Vector.h:53
agxPowerLine contains a collection of connected components that transport power across a system.
Definition: MotorUnit.h:24
agx::Vector< UnitRef > UnitRefVector
agx::Vector< ConnectorRef > ConnectorRefVector
Definition: Connector.h:406
agx::ref_ptr< Unit > UnitRef
agx::Vector< Connector * > ConnectorPtrVector
Definition: Connector.h:402
agx::ref_ptr< Connector > ConnectorRef
Definition: Connector.h:405
agx::Vector< Unit * > UnitPtrVector
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.
The agxUtil namespace contain classes and methods for utility functionality.
The agx namespace contains the dynamics/math part of the AGX Dynamics API.
bool Bool
Definition: Integer.h:48
double Real
Definition: Real.h:42