20 #ifndef POSITION_ALLOCATOR_H
21 #define POSITION_ALLOCATOR_H
23 #include "ns3/object.h"
24 #include "ns3/random-variable-stream.h"
25 #include "ns3/vector.h"
101 void Add (
const std::string filePath,
103 char delimiter =
',');
113 virtual Vector
GetNext (
void)
const;
166 void SetZ (
double z);
179 void SetN (uint32_t n);
204 uint32_t
GetN (
void)
const;
211 virtual Vector
GetNext (
void)
const;
253 void SetZ (
double z);
255 virtual Vector
GetNext (
void)
const;
295 virtual Vector
GetNext (
void)
const;
341 void SetX (
double x);
345 void SetY (
double y);
349 void SetZ (
double z);
351 virtual Vector
GetNext (
void)
const;
399 void SetX (
double x);
404 void SetY (
double y);
409 void SetZ (
double z);
411 virtual Vector
GetNext (
void)
const;
Allocate positions on a rectangular 2d grid.
void SetDeltaX(double deltaX)
double m_deltaX
x interval between two consecutive x positions
double GetMinX(void) const
double m_deltaY
y interval between two consecutive y positions
uint32_t GetN(void) const
LayoutType
Determine whether positions are allocated row first or column first.
@ COLUMN_FIRST
In column-first mode, positions are allocated on the first column until N positions have been allocat...
@ ROW_FIRST
In row-first mode, positions are allocated on the first row until N positions have been allocated.
virtual Vector GetNext(void) const
virtual int64_t AssignStreams(int64_t stream)
Assign a fixed random variable stream number to the random variables used by this model.
void SetMinY(double yMin)
uint32_t m_current
currently position
void SetDeltaY(double deltaY)
enum LayoutType m_layoutType
currently selected layout type
double m_yMin
minimum boundary on y positions
double m_z
z coordinate of all the positions generated
double GetDeltaX(void) const
void SetLayoutType(enum LayoutType layoutType)
double GetDeltaY(void) const
static TypeId GetTypeId(void)
Register this type with the TypeId system.
double GetMinY(void) const
double m_xMin
minimum boundary on x positions
uint32_t m_n
number of positions to allocate on each row or column
enum LayoutType GetLayoutType(void) const
void SetMinX(double xMin)
Allocate positions from a deterministic list specified by the user.
void Add(Vector v)
Add a position to the list of positions.
std::vector< Vector >::const_iterator m_current
vector iterator
std::vector< Vector > m_positions
vector of positions
static TypeId GetTypeId(void)
Register this type with the TypeId system.
uint32_t GetSize(void) const
Return the number of positions stored.
virtual Vector GetNext(void) const
virtual int64_t AssignStreams(int64_t stream)
Assign a fixed random variable stream number to the random variables used by this model.
A base class which provides memory management and object aggregation.
Allocate a set of positions.
virtual int64_t AssignStreams(int64_t stream)=0
Assign a fixed random variable stream number to the random variables used by this model.
virtual ~PositionAllocator()
virtual Vector GetNext(void) const =0
static TypeId GetTypeId(void)
Register this type with the TypeId system.
Allocate random positions within a 3D box according to a set of three random variables.
void SetZ(Ptr< RandomVariableStream > z)
Set the random variable stream object that generates z-positions.
virtual int64_t AssignStreams(int64_t stream)
Assign a fixed random variable stream number to the random variables used by this model.
Ptr< RandomVariableStream > m_x
pointer to x's random variable stream
Ptr< RandomVariableStream > m_y
pointer to y's random variable stream
virtual Vector GetNext(void) const
void SetX(Ptr< RandomVariableStream > x)
Set the random variable stream object that generates x-positions.
static TypeId GetTypeId(void)
Register this type with the TypeId system.
void SetY(Ptr< RandomVariableStream > y)
Set the random variable stream object that generates y-positions.
virtual ~RandomBoxPositionAllocator()
Ptr< RandomVariableStream > m_z
pointer to z's random variable stream
RandomBoxPositionAllocator()
Allocate random positions within a disc according to a given distribution for the polar coordinates o...
RandomDiscPositionAllocator()
double m_y
y coordinate of center of disc
Ptr< RandomVariableStream > m_rho
pointer to rho's random variable stream
void SetRho(Ptr< RandomVariableStream > rho)
Set the random variable that generates position radius, in meters.
virtual ~RandomDiscPositionAllocator()
static TypeId GetTypeId(void)
Register this type with the TypeId system.
double m_x
x coordinate of center of disc
void SetTheta(Ptr< RandomVariableStream > theta)
Set the random variable that generates position angle, in radians.
virtual Vector GetNext(void) const
Ptr< RandomVariableStream > m_theta
pointer to theta's random variable stream
double m_z
z coordinate of the disc
virtual int64_t AssignStreams(int64_t stream)
Assign a fixed random variable stream number to the random variables used by this model.
Allocate random positions within a rectangle according to a pair of random variables.
static TypeId GetTypeId(void)
Register this type with the TypeId system.
virtual int64_t AssignStreams(int64_t stream)
Assign a fixed random variable stream number to the random variables used by this model.
RandomRectanglePositionAllocator()
virtual ~RandomRectanglePositionAllocator()
virtual Vector GetNext(void) const
Ptr< RandomVariableStream > m_y
pointer to y's random variable stream
Ptr< RandomVariableStream > m_x
pointer to x's random variable stream
void SetY(Ptr< RandomVariableStream > y)
Set the random variable stream object that generates y-positions.
void SetX(Ptr< RandomVariableStream > x)
Set the random variable stream object that generates x-positions.
double m_z
z coordinate of all the positions generated
a unique identifier for an interface.
Every class exported by the ns3 library is enclosed in the ns3 namespace.
list x
Random number samples.