AGX Dynamics  2.35.0.1
DotGraphWriter.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
9 having been advised so by Algoryx Simulation AB for a time limited evaluation,
10 or having purchased a 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 
19 #ifndef AGXPOWERLINE_DOT_GRAPH_WRITER_H
20 #define AGXPOWERLINE_DOT_GRAPH_WRITER_H
21 
22 #include <agx/Referenced.h>
23 #include <agx/HashTable.h>
24 #include <agxPowerLine/PowerLine.h>
25 
26 namespace agxPowerLine
27 {
28  class PowerLine;
29 
31 
32 
34  {
35  public:
36  DotGraphWriter(const char* rotRateUnit = "rad/s", const char* transRateUnit = "m/s");
37 
38  void registerUnit(const char* dimensionName, const char* unitName);
39 
40  bool writeDimensionsGraph(const agx::String& filename, const PowerLine* powerline);
41  bool writeDimensionsGraph(const agx::String& filename, const agxPowerLine::Unit* startUnit);
42  bool writeDimensionsGraph(const agx::String& filename, const UnitPtrPowerLinePtrHashVector& roots);
43 
44  //bool writeUnitGraph(const char* filename, agxPowerLine::PowerLine* powerline);
45 
46  protected:
47  virtual ~DotGraphWriter() {}
48 
49  private:
50  void clear();
51  bool writeDimensionsGraph(const agx::String& filename);
52  void visitDimensionConnections( const agxPowerLine::ConnectionRefVector& connections );
53  void visitConnectorDimensions( const agxPowerLine::ConnectionRefVector& connections );
54 
55  private:
57  UnitsTable m_units;
58 
59  typedef agx::Vector<const PhysicalDimension*> DimensionVector;
60  typedef agx::Vector<const Connector*> ConnectorVector;
61 
62  // The index of each dimension and connector in these vectors determines it's
63  // id within the DOT graph. Each dimension and connector may only be represented
64  // once.
65  DimensionVector m_seenDimensions;
66  ConnectorVector m_seenConnectors;
67 
69  typedef agx::HashTable<const agxPowerLine::Connector*, size_t> ConnectorToIndexTable;
70 
71  // The index of each dimension and connector is kept in these hash tables.
72  DimensionToIndexTable m_dimensionToIndexTable;
73  ConnectorToIndexTable m_connectorToIndexTable;
74 
75  typedef agx::Vector<const Unit*> UnitVector;
76 
77  UnitVector m_queue;
78  };
79 }
80 
81 
82 
83 #endif
84 
#define AGX_DECLARE_POINTER_TYPES(type)
Definition: Referenced.h:248
#define AGXMODEL_EXPORT
bool writeDimensionsGraph(const agx::String &filename, const PowerLine *powerline)
bool writeDimensionsGraph(const agx::String &filename, const agxPowerLine::Unit *startUnit)
DotGraphWriter(const char *rotRateUnit="rad/s", const char *transRateUnit="m/s")
void registerUnit(const char *dimensionName, const char *unitName)
bool writeDimensionsGraph(const agx::String &filename, const UnitPtrPowerLinePtrHashVector &roots)
PowerLine is the base class for a system of power transfer integrated into the rigid body simulation.
Definition: PowerLine.h:71
Pure virtual class.
Definition: Unit.h:73
This class is a combined container which has the find complexity of a HashTable, deterministic iterat...
Definition: HashVector.h:41
Inheritance with partial specialization due to bug with ref_ptr containers.
Base class providing referencing counted objects.
Definition: Referenced.h:114
agxPowerLine contains a collection of connected components that transport power across a system.
Definition: MotorUnit.h:24
AGXTERRAIN_EXPORT void clear()