10#include "ns3/csv-reader.h" 
   11#include "ns3/double.h" 
   14#include "ns3/pointer.h" 
   15#include "ns3/string.h" 
   16#include "ns3/uinteger.h" 
   50                            .SetGroupName(
"Mobility")
 
 
   71    NS_LOG_FUNCTION(
this << filePath << std::string(
"'") + delimiter + 
"'");
 
   86        NS_LOG_INFO(
"read x: " << x << (ok ? 
" ok" : 
" FAIL"));
 
   89        NS_LOG_INFO(
"read y = " << y << (ok ? 
" ok" : 
" FAIL"));
 
   94            NS_LOG_INFO(
"read z = " << z << (ok ? 
" ok" : 
" FAIL"));
 
 
  139        TypeId(
"ns3::GridPositionAllocator")
 
  141            .SetGroupName(
"Mobility")
 
  143            .AddAttribute(
"GridWidth",
 
  144                          "The number of objects laid out on a line.",
 
  148            .AddAttribute(
"MinX",
 
  149                          "The x coordinate where the grid starts.",
 
  153            .AddAttribute(
"MinY",
 
  154                          "The y coordinate where the grid starts.",
 
  159                          "The z coordinate of all the positions allocated.",
 
  163            .AddAttribute(
"DeltaX",
 
  164                          "The x space between objects.",
 
  168            .AddAttribute(
"DeltaY",
 
  169                          "The y space between objects.",
 
  173            .AddAttribute(
"LayoutType",
 
  174                          "The type of layout.",
 
 
  281    return Vector(x, y, 
m_z);
 
 
  296        TypeId(
"ns3::RandomRectanglePositionAllocator")
 
  298            .SetGroupName(
"Mobility")
 
  301                          "A random variable which represents the x coordinate of a position in a " 
  303                          StringValue(
"ns3::UniformRandomVariable[Min=0.0|Max=1.0]"),
 
  307                          "A random variable which represents the y coordinate of a position in a " 
  309                          StringValue(
"ns3::UniformRandomVariable[Min=0.0|Max=1.0]"),
 
  313                          "The z coordinate of all the positions allocated.",
 
 
  351    return Vector(x, y, 
m_z);
 
 
  368        TypeId(
"ns3::RandomBoxPositionAllocator")
 
  370            .SetGroupName(
"Mobility")
 
  373                          "A random variable which represents the x coordinate of a position in a " 
  375                          StringValue(
"ns3::UniformRandomVariable[Min=0.0|Max=1.0]"),
 
  379                          "A random variable which represents the y coordinate of a position in a " 
  381                          StringValue(
"ns3::UniformRandomVariable[Min=0.0|Max=1.0]"),
 
  385                          "A random variable which represents the z coordinate of a position in a " 
  387                          StringValue(
"ns3::UniformRandomVariable[Min=0.0|Max=1.0]"),
 
 
  425    return Vector(x, y, z);
 
 
  443        TypeId(
"ns3::RandomDiscPositionAllocator")
 
  445            .SetGroupName(
"Mobility")
 
  447            .AddAttribute(
"Theta",
 
  448                          "A random variable which represents the angle (gradients) of a position " 
  450                          StringValue(
"ns3::UniformRandomVariable[Min=0.0|Max=6.2830]"),
 
  455                "A random variable which represents the radius of a position in a random disc.",
 
  456                StringValue(
"ns3::UniformRandomVariable[Min=0.0|Max=200.0]"),
 
  460                          "The x coordinate of the center of the random position disc.",
 
  465                          "The y coordinate of the center of the random position disc.",
 
  470                          "The z coordinate of all the positions in the disc.",
 
 
  520    double x = 
m_x + std::cos(theta) * rho;
 
  521    double y = 
m_y + std::sin(theta) * rho;
 
  523    return Vector(x, y, 
m_z);
 
 
  539    static TypeId tid = 
TypeId(
"ns3::UniformDiscPositionAllocator")
 
  541                            .SetGroupName(
"Mobility")
 
  544                                          "The radius of the disc",
 
  549                                          "The x coordinate of the center of the  disc.",
 
  554                                          "The y coordinate of the center of the  disc.",
 
  559                                          "The z coordinate of all the positions in the disc.",
 
 
  608    } 
while (std::sqrt(x * x + y * y) > 
m_rho);
 
  613    return Vector(x, y, 
m_z);
 
 
  619    m_rv->SetStream(stream);
 
 
Provides functions for parsing and extracting data from Comma Separated Value (CSV) formatted text fi...
bool GetValue(std::size_t columnIndex, T &value) const
Attempt to convert from the string data in the specified column to the specified data type.
std::size_t RowNumber() const
The number of lines that have been read.
std::size_t ColumnCount() const
Returns the number of columns in the csv data.
bool FetchNextRow()
Reads one line from the input until a new line is encountered.
This class can be used to hold variables of floating point type such as 'double' or 'float'.
Hold variables of type enum.
Allocate positions on a rectangular 2d grid.
void SetDeltaX(double deltaX)
double m_deltaX
x interval between two consecutive x positions
double m_deltaY
y interval between two consecutive y positions
LayoutType GetLayoutType() 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.
void SetMinY(double yMin)
int64_t AssignStreams(int64_t stream) override
Assign a fixed random variable stream number to the random variables used by this model.
uint32_t m_current
currently position
void SetDeltaY(double deltaY)
double m_yMin
minimum boundary on y positions
Vector GetNext() const override
double m_z
z coordinate of all the positions generated
LayoutType m_layoutType
currently selected layout type
double m_xMin
minimum boundary on x positions
uint32_t m_n
number of positions to allocate on each row or column
static TypeId GetTypeId()
Register this type with the TypeId system.
void SetLayoutType(LayoutType layoutType)
void SetMinX(double xMin)
Allocate positions from a deterministic list specified by the user.
int64_t AssignStreams(int64_t stream) override
Assign a fixed random variable stream number to the random variables used by this model.
void Add(Vector v)
Add a position to the list of positions.
uint32_t GetSize() const
Return the number of positions stored.
static TypeId GetTypeId()
Register this type with the TypeId system.
std::vector< Vector >::const_iterator m_current
vector iterator
Vector GetNext() const override
std::vector< Vector > m_positions
vector of positions
A base class which provides memory management and object aggregation.
Allocate a set of positions.
static TypeId GetTypeId()
Register this type with the TypeId system.
~PositionAllocator() override
Smart pointer class similar to boost::intrusive_ptr.
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.
Ptr< RandomVariableStream > m_x
pointer to x's random variable stream
Ptr< RandomVariableStream > m_y
pointer to y's random variable stream
void SetX(Ptr< RandomVariableStream > x)
Set the random variable stream object that generates x-positions.
int64_t AssignStreams(int64_t stream) override
Assign a fixed random variable stream number to the random variables used by this model.
void SetY(Ptr< RandomVariableStream > y)
Set the random variable stream object that generates y-positions.
Vector GetNext() const override
~RandomBoxPositionAllocator() override
static TypeId GetTypeId()
Register this type with the TypeId system.
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...
Vector GetNext() const override
~RandomDiscPositionAllocator() override
RandomDiscPositionAllocator()
double m_y
y coordinate of center of disc
Ptr< RandomVariableStream > m_rho
pointer to rho's random variable stream
static TypeId GetTypeId()
Register this type with the TypeId system.
void SetRho(Ptr< RandomVariableStream > rho)
Set the random variable that generates position radius, in meters.
double m_x
x coordinate of center of disc
void SetTheta(Ptr< RandomVariableStream > theta)
Set the random variable that generates position angle, in radians.
int64_t AssignStreams(int64_t stream) override
Assign a fixed random variable stream number to the random variables used by this model.
Ptr< RandomVariableStream > m_theta
pointer to theta's random variable stream
double m_z
z coordinate of the disc
Allocate random positions within a rectangle according to a pair of random variables.
int64_t AssignStreams(int64_t stream) override
Assign a fixed random variable stream number to the random variables used by this model.
Vector GetNext() const override
RandomRectanglePositionAllocator()
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.
static TypeId GetTypeId()
Register this type with the TypeId system.
~RandomRectanglePositionAllocator() override
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
virtual double GetValue()=0
Get the next random value drawn from the distribution.
void SetStream(int64_t stream)
Specifies the stream number for the RngStream.
Hold variables of type string.
a unique identifier for an interface.
TypeId SetParent(TypeId tid)
Set the parent TypeId.
Hold an unsigned integer type.
#define NS_ASSERT_MSG(condition, message)
At runtime, in debugging builds, if this condition is not true, the program prints the message to out...
Ptr< const AttributeChecker > MakeDoubleChecker()
Ptr< const AttributeAccessor > MakeDoubleAccessor(T1 a1)
Create an AttributeAccessor for a class data member, or a lone class get functor or set method.
Ptr< const AttributeAccessor > MakeEnumAccessor(T1 a1)
Create an AttributeAccessor for a class data member, or a lone class get functor or set method.
Ptr< const AttributeAccessor > MakePointerAccessor(T1 a1)
Create an AttributeAccessor for a class data member, or a lone class get functor or set method.
Ptr< AttributeChecker > MakePointerChecker()
Create a PointerChecker for a type.
Ptr< const AttributeChecker > MakeUintegerChecker()
Ptr< const AttributeAccessor > MakeUintegerAccessor(T1 a1)
Create an AttributeAccessor for a class data member, or a lone class get functor or set method.
#define NS_LOG_COMPONENT_DEFINE(name)
Define a Log component with a specific name.
#define NS_LOG_DEBUG(msg)
Use NS_LOG to output a message of level LOG_DEBUG.
#define NS_LOG_LOGIC(msg)
Use NS_LOG to output a message of level LOG_LOGIC.
#define NS_LOG_FUNCTION(parameters)
If log level LOG_FUNCTION is enabled, this macro will output all input parameters separated by ",...
#define NS_LOG_INFO(msg)
Use NS_LOG to output a message of level LOG_INFO.
Ptr< T > CreateObject(Args &&... args)
Create an object by type, with varying number of constructor parameters.
#define NS_OBJECT_ENSURE_REGISTERED(type)
Register an Object subclass with the TypeId system.
Every class exported by the ns3 library is enclosed in the ns3 namespace.
Ptr< const AttributeChecker > MakeEnumChecker(T v, std::string n, Ts... args)
Make an EnumChecker pre-configured with a set of allowed values by name.