43#define POWER_LINE_DEBUG 0
50 class PowerLinesHandler;
51 class PowerLineCollector;
153 template <
typename T>
301 bool shouldRenderDebug();
326 template <
typename T>
331 T* asT =
dynamic_cast<T*
>(unit.get());
332 if (unit->getName() == name && asT !=
nullptr)
#define AGXSTREAM_DECLARE_SERIALIZABLE(T)
Use this in a Serializable class to add the required methods Important: Use full namespace in the dec...
Links two connections together.
PowerLine is the base class for a system of power transfer integrated into the rigid body simulation.
void collectConstraintsToHolder()
agx::Constraint::SolveType getSolveType() const
void setUnitPowerLine(agxPowerLine::Unit *unit)
Set the given Unit's PowerLine to this.
void clearAddRemoveCache(ConnectorPtrVector &addedConnectors, UnitPtrVector &addedUnits)
void post(agx::Real time)
static agxPowerLine::PowerLine * find(agxSDK::Simulation *simulation, const agx::Name &name)
Search the given simulation for a power line with the given name.
const Unit * getUnit(const agx::Name &name) const
Find and return the first unit with the given name, if any exist.
static PowerLinePtrVector findAll(const agxSDK::Simulation *simulation)
Finds all powerlines in the given simulation.
virtual void addNotification(agxSDK::Assembly *) override
Called when this assembly is added to another assembly.
void getRoots(agxPowerLine::UnitPtrPowerLinePtrHashVector &units) const
Get pointers to all roots, each connected to a sub graph.
agxPowerLine::Unit * getSource()
bool m_cacheAddsAndRemoves
static PowerLinePtrVector findAll(const agxSDK::Simulation *simulation, const agx::Name &name)
Find all powerlines with given name.
ConnectorBoolHashVector m_tempConnectorHashVector
Unit * getUnit(const agx::Name &name)
Find and return the first unit with the given name, if any exist.
void createConstraintHolder()
Creates a constraint holder for all elementary constraints between the physical dimensions.
virtual void initialize()
bool removeConnector(agxPowerLine::Connector *connector)
bool traverseDimensions(bool(*callback)(agxPowerLine::PhysicalDimension *))
void restorePre46(agxStream::InputArchive &in)
agx::Bool getAddUnitsOnConnect() const
agxPowerLine::SlotMapper * getSlotMapper()
agxPowerLine::SubGraphRefVector m_cachedRemoves
const agxPowerLine::ConnectorRefSet & getConnectors() const
bool add(agxPowerLine::Unit *component)
bool writeDimensionsGraph(const char *path) const
bool remove(agxPowerLine::SubGraph *component)
virtual void addNotification(agxSDK::Simulation *simulation) override
Called when this assembly is added to a simulation (given that it not already is in the simulation).
void setAddUnitsOnConnect(agx::Bool addOnConnect)
Decide if: when units added to this powerLine are to be connected to units not belonging to any power...
SubGraphRouterBoolHashVector m_tempRouterHashVector
void prepareConstraintDimensions()
int getDimensionType(std::string name)
bool cacheRemove(agxPowerLine::SubGraph *component)
bool writeDimensionsGraph(const agx::String &path) const
Write the current graph state of the powerline to a .dot file (path)
agx::observer_ptr< agx::RigidBody > m_parentBody
size_t getNumConnectors() const
virtual void removeNotification(agxSDK::Assembly *) override
Called when this assembly is removed from another assembly.
bool setSource(agxPowerLine::Unit *source)
Set the unit the traverser shall start traversing from.
void insertConnectorTemporary(Connector *connector)
agxPowerLine::SlotMapperRef m_slotMapper
void setSolveType(agx::Constraint::SolveType solveType)
Set the current solve type DIRECT_AND_ITERATIVE is used by default.
virtual bool restore(agxStream::StorageStream &str)
Restores internal data from stream.
bool traverseConnectors(bool(*callback)(agxPowerLine::Connector *))
const agxPowerLine::UnitRefSetVector & getUnits() const
bool removeSubGraph(agxPowerLine::SubGraph *component)
virtual bool store(agxStream::StorageStream &str) const
Stores internal data for this PowerLine into stream.
size_t getNumUnits() const
virtual void removeNotification(agxSDK::Simulation *simulation) override
Called when this assembly is removed from a simulation.
void insertSubGraphRouterTemporary(SubGraph *router)
agx::Constraint::SolveType m_solveType
bool removeUnit(agxPowerLine::Unit *unit)
const agxPowerLine::Unit * getSource() const
agxPowerLine::UnitRefSetVector m_units
agxUtil::ConstraintHolderRef m_constraintHolder
static bool renderDebug()
agxPowerLine::SubGraphRefVector m_cachedAdds
bool traverseUnits(bool(*callback)(agxPowerLine::Unit *))
bool hasCachedOperations() const
agxUtil::ConstraintHolder * getConstraintHolder() const
bool setSource(agxPowerLine::SubGraph *source)
bool add(agxPowerLine::SubGraph *component)
bool pointAddConnector(agxPowerLine::Connector *connector)
static agxPowerLine::PowerLine * find(agxSDK::Assembly *assembly, const agx::Name &name)
Search the given assembly for a power line with the given name.
bool pointAddUnit(agxPowerLine::Unit *unit)
agxPowerLine::ConnectorRefSet m_connectors
bool pointReplace(agxPowerLine::Unit *oldUnit, agxPowerLine::Unit *newUnit)
bool cacheAdd(agxPowerLine::SubGraph *component)
A PowerLinesHandler is a collection of PowerLines that are part of the same agxSDK::Simulation.
The SlotMapper is reponsible for mapping one dimensional dimension states to slots in the RigidBodies...
An assembly is a collection of basic simulation objects, such as rigid bodies, constraints,...
virtual void removeNotification(agxSDK::Simulation *)
Called when this assembly is removed from a simulation.
virtual void addNotification(agxSDK::Simulation *)
Called when this assembly is added to a simulation (given that it not already is in the simulation).
Simulation is a class that bridges the collision space agxCollide::Space and the dynamic simulation s...
Abstract base class for storing/restoring a line/drums with version control.
Utility class to hold custom implementations of constraints.
SolveType
Specifies in what solvers the constraint will be solved.
This class is a combined container which has the find complexity of a HashTable, deterministic iterat...
Representation of a name string.
Vector containing 'raw' data.
agxPowerLine contains a collection of connected components that transport power across a system.
agx::Vector< PowerLineRef > PowerLineRefVector
agx::HashVector< agxPowerLine::Connector *, bool > ConnectorBoolHashVector
agx::observer_ptr< PowerLine > PowerLineObsPtr
agx::HashVector< agxPowerLine::Unit *, agxPowerLine::PowerLine * > UnitPtrPowerLinePtrHashVector
agx::HashVector< agxPowerLine::SubGraph *, bool > SubGraphRouterBoolHashVector
agx::VectorPOD< PowerLine * > PowerLinePtrVector
agx::ref_ptr< PowerLine > PowerLineRef