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