13#include "ns3/config.h"
14#include "ns3/hierarchical-mobility-model.h"
16#include "ns3/mobility-model.h"
18#include "ns3/pointer.h"
19#include "ns3/position-allocator.h"
20#include "ns3/simulator.h"
21#include "ns3/string.h"
72 NS_ABORT_MSG_IF(!child,
"Member mobility factory did not produce a MobilityModel");
76 child->SetPosition(position);
78 hierarchical->SetChild(child);
79 NS_LOG_DEBUG(
"node=" << node <<
", mob=" << hierarchical);
80 node->AggregateObject(hierarchical);
93 for (
auto i = c.
Begin(); i != c.
End(); ++i)
102 int64_t currentStream = stream;
104 bool firstNode =
true;
106 for (
auto i = c.
Begin(); i != c.
End(); ++i)
117 currentStream += mobility->GetParent()->AssignStreams(currentStream);
120 currentStream += mobility->GetChild()->AssignStreams(currentStream);
122 return (currentStream - stream);
int64_t AssignStreams(NodeContainer c, int64_t stream)
Assign a fixed random variable stream number to the random variables used by the mobility models on t...
ObjectFactory m_memberMobilityFactory
Object factory to create member mobility models.
void SetMemberPositionAllocator(Ptr< PositionAllocator > allocator)
Set the position allocator which will be used to allocate the initial position of the member mobility...
void Install(Ptr< Node > node)
Install and configure a hierarchical mobility model to the given node, based on the configured refere...
void SetReferenceMobilityModel(Ptr< MobilityModel > mobility)
Set the reference mobility model which will be installed as the parent mobility model during GroupMob...
bool m_referencePositionSet
flag for avoiding multiple SetPosition calls on the reference model
~GroupMobilityHelper()
Destroy a group mobility helper.
Ptr< PositionAllocator > m_referencePosition
Position allocator for use as reference position allocator.
Ptr< PositionAllocator > m_memberPosition
Position allocator for use as member position allocator.
void SetReferencePositionAllocator(Ptr< PositionAllocator > allocator)
Set the position allocator which will be used to allocate the initial position of the reference mobil...
Ptr< MobilityModel > m_referenceMobility
Reference mobility model.
GroupMobilityHelper()
Construct a group mobility helper.
Hierarchical mobility model.
Keep track of the current position and velocity of an object.
static Ptr< T > Find(std::string path)
Given a name path string, look to see if there's an object in the system with that associated to it.
keep track of a set of node pointers.
Iterator End() const
Get an iterator which indicates past-the-last Node in the container.
Iterator Begin() const
Get an iterator which refers to the first Node in the container.
Ptr< Object > Create() const
Create an Object instance of the configured TypeId.
bool IsTypeIdSet() const
Check if the ObjectFactory has been configured with a TypeId.
Ptr< T > GetObject() const
Get a pointer to the requested aggregated Object.
Smart pointer class similar to boost::intrusive_ptr.
#define NS_ABORT_MSG_UNLESS(cond, msg)
Abnormal program termination if a condition is false, with a message.
#define NS_FATAL_ERROR(msg)
Report a fatal error with a message and terminate.
#define NS_ABORT_MSG_IF(cond, msg)
Abnormal program termination if a condition is true, with a message.
#define NS_LOG_COMPONENT_DEFINE(name)
Define a Log component with a specific name.
#define NS_LOG_TEMPLATE_DEFINE(name)
Initialize a reference to a Log component.
#define NS_LOG_DEBUG(msg)
Use NS_LOG to output a message of level LOG_DEBUG.
Ptr< T > CreateObject(Args &&... args)
Create an object by type, with varying number of constructor parameters.
Every class exported by the ns3 library is enclosed in the ns3 namespace.