A Discrete-Event Network Simulator
API
building-position-allocator.cc
Go to the documentation of this file.
1 /* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
2 /*
3  * Copyright (C) 2012 Centre Tecnologic de Telecomunicacions de Catalunya (CTTC)
4  *
5  * This program is free software; you can redistribute it and/or modify
6  * it under the terms of the GNU General Public License version 2 as
7  * published by the Free Software Foundation;
8  *
9  * This program is distributed in the hope that it will be useful,
10  * but WITHOUT ANY WARRANTY; without even the implied warranty of
11  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12  * GNU General Public License for more details.
13  *
14  * You should have received a copy of the GNU General Public License
15  * along with this program; if not, write to the Free Software
16  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
17  *
18  * Author: Nicola Baldo <nbaldo@cttc.es>
19  * Michele Polese <michele.polese@gmail.com> for the OutdoorPositionAllocator class
20  */
22 #include <ns3/mobility-building-info.h>
23 #include "ns3/mobility-model.h"
24 #include "ns3/buildings-helper.h"
25 #include "ns3/random-variable-stream.h"
26 #include "ns3/double.h"
27 #include "ns3/uinteger.h"
28 #include "ns3/enum.h"
29 #include "ns3/boolean.h"
30 #include "ns3/log.h"
31 #include "ns3/box.h"
32 #include "ns3/building.h"
33 #include "ns3/string.h"
34 #include "ns3/pointer.h"
35 #include <cmath>
36 
37 #include "ns3/building-list.h"
38 
39 namespace ns3 {
40 
41 NS_LOG_COMPONENT_DEFINE ("BuildingPositionAllocator");
42 
43 NS_OBJECT_ENSURE_REGISTERED (RandomBuildingPositionAllocator);
44 
45 
47 {
48  m_rand = CreateObject<UniformRandomVariable> ();
49 }
50 
51 TypeId
53 {
54  static TypeId tid = TypeId ("ns3::RandomBuildingPositionAllocator")
56  .SetGroupName ("Buildings")
57  .AddConstructor<RandomBuildingPositionAllocator> ()
58  .AddAttribute ("WithReplacement",
59  "If true, the building will be randomly selected with replacement. "
60  "If false, no replacement will occur, until the list of buildings "
61  "to select becomes empty, at which point it will be filled again "
62  "with the list of all buildings.",
63  BooleanValue (false),
66  return tid;
67 }
68 
69 Vector
71 {
72  NS_ASSERT_MSG (BuildingList::GetNBuildings () > 0, "no building found");
73  Ptr<Building> b;
75  {
76  uint32_t n = m_rand->GetInteger (0, BuildingList::GetNBuildings () - 1);
78  }
79  else
80  {
82  {
83  for (BuildingList::Iterator bit = BuildingList::Begin (); bit != BuildingList::End (); ++bit)
84  {
85  m_buildingListWithoutReplacement.push_back (*bit);
86  }
87  }
88  uint32_t n = m_rand->GetInteger (0, m_buildingListWithoutReplacement.size () - 1);
91  }
92 
93  Ptr<RandomBoxPositionAllocator> pa = CreateObject<RandomBoxPositionAllocator> ();
94  BoxValue bv;
95  b->GetAttribute ("Boundaries", bv);
96  double x = m_rand->GetValue (bv.Get ().xMin, bv.Get ().xMax);
97  double y = m_rand->GetValue (bv.Get ().yMin, bv.Get ().yMax);
98  double z = m_rand->GetValue (bv.Get ().zMin, bv.Get ().zMax);
99  return Vector (x, y, z);
100 }
101 
102 int64_t
104 {
105  m_rand->SetStream (stream);
106  return 1;
107 }
108 
109 
111 
113 {
114 }
115 
116 TypeId
118 {
119  static TypeId tid = TypeId ("ns3::OutdoorPositionAllocator")
121  .SetGroupName ("Buildings")
122  .AddConstructor<OutdoorPositionAllocator> ()
123  .AddAttribute ("X",
124  "A random variable which represents the x coordinate of a position in a random box.",
125  StringValue ("ns3::UniformRandomVariable[Min=0.0|Max=1.0]"),
127  MakePointerChecker<RandomVariableStream> ())
128  .AddAttribute ("Y",
129  "A random variable which represents the y coordinate of a position in a random box.",
130  StringValue ("ns3::UniformRandomVariable[Min=0.0|Max=1.0]"),
132  MakePointerChecker<RandomVariableStream> ())
133  .AddAttribute ("Z",
134  "A random variable which represents the z coordinate of a position in a random box.",
135  StringValue ("ns3::UniformRandomVariable[Min=0.0|Max=1.0]"),
137  MakePointerChecker<RandomVariableStream> ())
138  .AddAttribute ("MaxAttempts",
139  "Maximum number of attempts for the rejection sampling before giving up.",
140  UintegerValue (1000),
142  MakeUintegerChecker<uint32_t> ())
143  ;
144 
145  return tid;
146 }
147 
148 void
150 {
151  m_x = x;
152 }
153 void
155 {
156  m_y = y;
157 }
158 void
160 {
161  m_z = z;
162 }
163 
164 Vector
166 {
167  NS_ABORT_MSG_IF (BuildingList::GetNBuildings () == 0, "no building found");
168 
169  bool outdoor = false;
170  uint32_t attempts = 0;
171  Vector position = Vector (0,0,0);
172 
173  while (!outdoor && attempts < m_maxAttempts)
174  {
175  // get a random position
176  double x = m_x->GetValue ();
177  double y = m_y->GetValue ();
178  double z = m_z->GetValue ();
179 
180  position = Vector (x, y, z);
181 
182  NS_LOG_INFO ("Position " << position);
183 
184  bool inside = false;
185  for (BuildingList::Iterator bit = BuildingList::Begin (); bit != BuildingList::End (); ++bit)
186  {
187  if ((*bit)->IsInside (position))
188  {
189  NS_LOG_INFO ("Position " << position << " is inside the building with boundaries "
190  << (*bit)->GetBoundaries ().xMin << " " << (*bit)->GetBoundaries ().xMax << " "
191  << (*bit)->GetBoundaries ().yMin << " " << (*bit)->GetBoundaries ().yMax << " "
192  << (*bit)->GetBoundaries ().zMin << " " << (*bit)->GetBoundaries ().zMax);
193  inside = true;
194  break;
195  }
196  }
197 
198  if (inside)
199  {
200  NS_LOG_INFO ("Inside a building, attempt " << attempts << " out of " << m_maxAttempts);
201  attempts++;
202  }
203  else
204  {
205  NS_LOG_INFO ("Outdoor position found " << position);
206  outdoor = true;
207  }
208  }
209 
210  NS_ABORT_MSG_IF (attempts >= m_maxAttempts, "Too many attempts, give up");
211  NS_ABORT_MSG_IF (!outdoor, "Still indoor, give up");
212  return position;
213 }
214 
215 int64_t
217 {
218  m_x->SetStream (stream);
219  m_y->SetStream (stream + 1);
220  m_z->SetStream (stream + 2);
221  return 3;
222 }
223 
224 
226 
227 
229 {
230  m_rand = CreateObject<UniformRandomVariable> ();
231 }
232 
233 TypeId
235 {
236  static TypeId tid = TypeId ("ns3::RandomRoomPositionAllocator")
238  .SetGroupName ("Buildings")
239  .AddConstructor<RandomRoomPositionAllocator> ();
240  return tid;
241 }
242 
243 Vector
245 {
246  NS_LOG_FUNCTION (this);
247  NS_ASSERT_MSG (BuildingList::GetNBuildings () > 0, "no building found");
248 
249  if (m_roomListWithoutReplacement.empty ())
250  {
251  for (BuildingList::Iterator bit = BuildingList::Begin (); bit != BuildingList::End (); ++bit)
252  {
253  NS_LOG_LOGIC ("building " << (*bit)->GetId ());
254  for (uint32_t rx = 1; rx <= (*bit)->GetNRoomsX (); ++rx)
255  {
256  for (uint32_t ry = 1; ry <= (*bit)->GetNRoomsY (); ++ry)
257  {
258  for (uint32_t f = 1; f <= (*bit)->GetNFloors (); ++f)
259  {
260  RoomInfo i;
261  i.roomx = rx;
262  i.roomy = ry;
263  i.floor = f;
264  i.b = *bit;
265  NS_LOG_LOGIC ("adding room (" << rx << ", " << ry << ", " << f << ")");
266  m_roomListWithoutReplacement.push_back (i);
267  }
268  }
269  }
270  }
271  }
272  uint32_t n = m_rand->GetInteger (0,m_roomListWithoutReplacement.size () - 1);
275  NS_LOG_LOGIC ("considering building " << r.b->GetId () << " room (" << r.roomx << ", " << r.roomy << ", " << r.floor << ")");
276 
277  Ptr<RandomBoxPositionAllocator> pa = CreateObject<RandomBoxPositionAllocator> ();
278  BoxValue bv;
279  r.b->GetAttribute ("Boundaries", bv);
280  Box box = bv.Get ();
281  double rdx = (box.xMax - box.xMin) / r.b->GetNRoomsX ();
282  double rdy = (box.yMax - box.yMin) / r.b->GetNRoomsY ();
283  double rdz = (box.zMax - box.zMin) / r.b->GetNFloors ();
284  double x1 = box.xMin + rdx * (r.roomx - 1);
285  double x2 = box.xMin + rdx * r.roomx;
286  double y1 = box.yMin + rdy * (r.roomy -1);
287  double y2 = box.yMin + rdy * r.roomy;
288  double z1 = box.zMin + rdz * (r.floor - 1);
289  double z2 = box.zMin + rdz * r.floor;
290  NS_LOG_LOGIC ("randomly allocating position in "
291  << " (" << x1 << "," << x2 << ") "
292  << "x (" << y1 << "," << y2 << ") "
293  << "x (" << z1 << "," << z2 << ") ");
294 
295  double x = m_rand->GetValue (x1, x2);
296  double y = m_rand->GetValue (y1, y2);
297  double z = m_rand->GetValue (z1, z2);
298 
299  return Vector (x, y, z);
300 }
301 
302 int64_t
304 {
305  m_rand->SetStream (stream);
306  return 1;
307 }
308 
309 
310 
311 
312 
314 
316 {
317  NS_FATAL_ERROR (" Constructor \"SameRoomPositionAllocator ()\" should not be used");
318 }
319 
320 
322  : m_nodes (c)
323 {
324  m_rand = CreateObject<UniformRandomVariable> ();
325  m_nodeIt = m_nodes.Begin ();
326  // this is needed to make sure the building models associated with c have been initialized
327  for (NodeContainer::Iterator it = m_nodes.Begin (); it != m_nodes.End (); ++it)
328  {
330  NS_ASSERT_MSG (mm, "no mobility model aggregated to this node");
332  NS_ASSERT_MSG (bmm, "MobilityBuildingInfo has not been aggregated to this node mobility model");
333  bmm->MakeConsistent (mm);
334  }
335 }
336 
337 TypeId
339 {
340  static TypeId tid = TypeId ("ns3::SameRoomPositionAllocator")
342  .SetGroupName ("Buildings")
343  .AddConstructor<SameRoomPositionAllocator> ();
344  return tid;
345 }
346 
347 Vector
349 {
350  NS_LOG_FUNCTION (this);
351  if (m_nodeIt == m_nodes.End ())
352  {
353  m_nodeIt = m_nodes.Begin ();
354  }
355 
356  NS_ASSERT_MSG (m_nodeIt != m_nodes.End (), "no node in container");
357 
358  NS_LOG_LOGIC ("considering node " << (*m_nodeIt)->GetId ());
359  Ptr<MobilityModel> mm = (*m_nodeIt)->GetObject<MobilityModel> ();
360  NS_ASSERT_MSG (mm, "no mobility model aggregated to this node");
362  NS_ASSERT_MSG (bmm, "MobilityBuildingInfo has not been aggregated to this node mobility model");
363 
364  ++m_nodeIt;
365  uint32_t roomx = bmm->GetRoomNumberX ();
366  uint32_t roomy = bmm->GetRoomNumberY ();
367  uint32_t floor = bmm->GetFloorNumber ();
368  NS_LOG_LOGIC ("considering building " << bmm->GetBuilding ()->GetId () << " room (" << roomx << ", " << roomy << ", " << floor << ")");
369 
370  Ptr<Building> b = bmm->GetBuilding ();
371  Ptr<RandomBoxPositionAllocator> pa = CreateObject<RandomBoxPositionAllocator> ();
372  BoxValue bv;
373  b->GetAttribute ("Boundaries", bv);
374  Box box = bv.Get ();
375  double rdx = (box.xMax - box.xMin) / b->GetNRoomsX ();
376  double rdy = (box.yMax - box.yMin) / b->GetNRoomsY ();
377  double rdz = (box.zMax - box.zMin) / b->GetNFloors ();
378  double x1 = box.xMin + rdx * (roomx - 1);
379  double x2 = box.xMin + rdx * roomx;
380  double y1 = box.yMin + rdy * (roomy -1);
381  double y2 = box.yMin + rdy * roomy;
382  double z1 = box.zMin + rdz * (floor - 1);
383  double z2 = box.zMin + rdz * floor;
384  NS_LOG_LOGIC ("randomly allocating position in "
385  << " (" << x1 << "," << x2 << ") "
386  << "x (" << y1 << "," << y2 << ") "
387  << "x (" << z1 << "," << z2 << ") ");
388 
389  double x = m_rand->GetValue (x1, x2);
390  double y = m_rand->GetValue (y1, y2);
391  double z = m_rand->GetValue (z1, z2);
392 
393  return Vector (x, y, z);
394 }
395 
396 int64_t
398 {
399  m_rand->SetStream (stream);
400  return 1;
401 }
402 
404 
405 
407  uint32_t x,
408  uint32_t y,
409  uint32_t z,
410  Ptr<Building> pbtr)
411 {
412  m_rand = CreateObject<UniformRandomVariable> ();
413  roomx = x;
414  roomy = y;
415  floor = z;
416  bptr = pbtr;
417 }
418 
419 TypeId
421 {
422  static TypeId tid = TypeId ("ns3::FixedRoomPositionAllocator")
424  .SetGroupName ("Buildings")
425  .AddConstructor<SameRoomPositionAllocator> ();
426  return tid;
427 }
428 
429 Vector
431 {
432 
433  NS_LOG_LOGIC ("considering building " << bptr->GetId () << " room (" << roomx << ", " << roomy << ", " << floor << ")");
434 
435  Ptr<RandomBoxPositionAllocator> pa = CreateObject<RandomBoxPositionAllocator> ();
436 
437  Box box = bptr->GetBoundaries ();
438  double rdx = (box.xMax - box.xMin) / bptr->GetNRoomsX ();
439  double rdy = (box.yMax - box.yMin) / bptr->GetNRoomsY ();
440  double rdz = (box.zMax - box.zMin) / bptr->GetNFloors ();
441  double x1 = box.xMin + rdx * (roomx - 1);
442  double x2 = box.xMin + rdx * roomx;
443  double y1 = box.yMin + rdy * (roomy -1);
444  double y2 = box.yMin + rdy * roomy;
445  double z1 = box.zMin + rdz * (floor - 1);
446  double z2 = box.zMin + rdz * floor;
447  NS_LOG_LOGIC ("randomly allocating position in "
448  << " (" << x1 << "," << x2 << ") "
449  << "x (" << y1 << "," << y2 << ") "
450  << "x (" << z1 << "," << z2 << ") ");
451 
452  double x = m_rand->GetValue (x1, x2);
453  double y = m_rand->GetValue (y1, y2);
454  double z = m_rand->GetValue (z1, z2);
455  return Vector (x, y, z);
456 }
457 
458 
459 int64_t
461 {
462  m_rand->SetStream (stream);
463  return 1;
464 }
465 
466 } // namespace ns3
ns3::TypeId
a unique identifier for an interface.
Definition: type-id.h:59
NS_LOG_COMPONENT_DEFINE
#define NS_LOG_COMPONENT_DEFINE(name)
Define a Log component with a specific name.
Definition: log.h:205
ns3::BuildingList::Begin
static Iterator Begin(void)
Definition: building-list.cc:173
ns3::RandomBuildingPositionAllocator
Allocate each position by randomly choosing a building from the list of all buildings,...
Definition: building-position-allocator.h:41
NS_OBJECT_ENSURE_REGISTERED
#define NS_OBJECT_ENSURE_REGISTERED(type)
Register an Object subclass with the TypeId system.
Definition: object-base.h:45
ns3::BooleanValue
AttributeValue implementation for Boolean.
Definition: boolean.h:37
ns3::SameRoomPositionAllocator::AssignStreams
int64_t AssignStreams(int64_t)
Assign a fixed random variable stream number to the random variables used by this model.
Definition: building-position-allocator.cc:397
ns3::RandomBuildingPositionAllocator::m_rand
Ptr< UniformRandomVariable > m_rand
Provides uniform random variables.
Definition: building-position-allocator.h:67
ns3::FixedRoomPositionAllocator
Generate a random position uniformly distributed in the volume of a chosen room inside a chosen build...
Definition: building-position-allocator.h:214
ns3::RandomBuildingPositionAllocator::m_buildingListWithoutReplacement
std::vector< Ptr< Building > > m_buildingListWithoutReplacement
Definition: building-position-allocator.h:64
ns3
Every class exported by the ns3 library is enclosed in the ns3 namespace.
ns3::SameRoomPositionAllocator
Walks a given NodeContainer sequentially, and for each node allocate a new position randomly in the s...
Definition: building-position-allocator.h:179
ns3::Box::zMin
double zMin
The z coordinate of the down bound of the box.
Definition: box.h:118
ns3::RandomBuildingPositionAllocator::RandomBuildingPositionAllocator
RandomBuildingPositionAllocator()
Definition: building-position-allocator.cc:46
ns3::OutdoorPositionAllocator::OutdoorPositionAllocator
OutdoorPositionAllocator()
Definition: building-position-allocator.cc:112
ns3::FixedRoomPositionAllocator::m_rand
Ptr< UniformRandomVariable > m_rand
Provides uniform random variables.
Definition: building-position-allocator.h:254
ns3::Box::xMin
double xMin
The x coordinate of the left bound of the box.
Definition: box.h:110
ns3::Object::GetObject
Ptr< T > GetObject(void) const
Get a pointer to the requested aggregated Object.
Definition: object.h:470
ns3::RandomRoomPositionAllocator::RoomInfo::roomx
uint32_t roomx
Definition: building-position-allocator.h:161
ns3::OutdoorPositionAllocator::m_y
Ptr< RandomVariableStream > m_y
pointer to y's random variable stream
Definition: building-position-allocator.h:123
ns3::OutdoorPositionAllocator::GetNext
virtual Vector GetNext(void) const
Definition: building-position-allocator.cc:165
ns3::RandomRoomPositionAllocator::RoomInfo
Definition: building-position-allocator.h:159
building-position-allocator.h
ns3::MakeBooleanAccessor
Ptr< const AttributeAccessor > MakeBooleanAccessor(T1 a1)
Create an AttributeAccessor for a class data member, or a lone class get functor or set method.
Definition: boolean.h:85
ns3::BuildingList::End
static Iterator End(void)
Definition: building-list.cc:178
ns3::UniformRandomVariable::GetInteger
uint32_t GetInteger(uint32_t min, uint32_t max)
Get the next random value, as an unsigned integer in the specified range .
Definition: random-variable-stream.cc:193
ns3::Box::yMin
double yMin
The y coordinate of the bottom bound of the box.
Definition: box.h:114
ns3::TypeId::SetParent
TypeId SetParent(TypeId tid)
Set the parent TypeId.
Definition: type-id.cc:923
ns3::SameRoomPositionAllocator::m_rand
Ptr< UniformRandomVariable > m_rand
Provides uniform random variables.
Definition: building-position-allocator.h:206
ns3::RandomRoomPositionAllocator::GetTypeId
static TypeId GetTypeId(void)
Definition: building-position-allocator.cc:234
ns3::Ptr
Smart pointer class similar to boost::intrusive_ptr.
Definition: ptr.h:74
ns3::OutdoorPositionAllocator::AssignStreams
int64_t AssignStreams(int64_t stream)
Assign a fixed random variable stream number to the random variables used by this model.
Definition: building-position-allocator.cc:216
NS_FATAL_ERROR
#define NS_FATAL_ERROR(msg)
Report a fatal error with a message and terminate.
Definition: fatal-error.h:165
ns3::BuildingList::Iterator
std::vector< Ptr< Building > >::const_iterator Iterator
Definition: building-list.h:36
ns3::BuildingList::GetNBuildings
static uint32_t GetNBuildings(void)
Definition: building-list.cc:188
ns3::MobilityBuildingInfo
mobility buildings information (to be used by mobility models)
Definition: mobility-building-info.h:49
ns3::RandomRoomPositionAllocator::RandomRoomPositionAllocator
RandomRoomPositionAllocator()
Definition: building-position-allocator.cc:228
ns3::NodeContainer::Begin
Iterator Begin(void) const
Get an iterator which refers to the first Node in the container.
Definition: node-container.cc:77
NS_LOG_INFO
#define NS_LOG_INFO(msg)
Use NS_LOG to output a message of level LOG_INFO.
Definition: log.h:281
ns3::SameRoomPositionAllocator::m_nodes
NodeContainer m_nodes
Definition: building-position-allocator.h:202
ns3::OutdoorPositionAllocator
allocate outdoor positions
Definition: building-position-allocator.h:85
ns3::RandomBuildingPositionAllocator::m_withReplacement
bool m_withReplacement
Definition: building-position-allocator.h:63
ns3::OutdoorPositionAllocator::GetTypeId
static TypeId GetTypeId(void)
Definition: building-position-allocator.cc:117
ns3::MakeBooleanChecker
Ptr< const AttributeChecker > MakeBooleanChecker(void)
Definition: boolean.cc:121
ns3::RandomRoomPositionAllocator::RoomInfo::roomy
uint32_t roomy
Definition: building-position-allocator.h:162
ns3::RandomBuildingPositionAllocator::AssignStreams
int64_t AssignStreams(int64_t stream)
Assign a fixed random variable stream number to the random variables used by this model.
Definition: building-position-allocator.cc:103
NS_ABORT_MSG_IF
#define NS_ABORT_MSG_IF(cond, msg)
Abnormal program termination if a condition is true, with a message.
Definition: abort.h:108
NS_ASSERT_MSG
#define NS_ASSERT_MSG(condition, message)
At runtime, in debugging builds, if this condition is not true, the program prints the message to out...
Definition: assert.h:88
ns3::OutdoorPositionAllocator::SetZ
void SetZ(Ptr< RandomVariableStream > z)
Set the random variable stream object that generates z-positions.
Definition: building-position-allocator.cc:159
ns3::Box::zMax
double zMax
The z coordinate of the up bound of the box.
Definition: box.h:120
NS_LOG_LOGIC
#define NS_LOG_LOGIC(msg)
Use NS_LOG to output a message of level LOG_LOGIC.
Definition: log.h:289
ns3::MakePointerAccessor
Ptr< const AttributeAccessor > MakePointerAccessor(T1 a1)
Create an AttributeAccessor for a class data member, or a lone class get functor or set method.
Definition: pointer.h:227
ns3::StringValue
Hold variables of type string.
Definition: string.h:41
ns3::RandomRoomPositionAllocator::m_roomListWithoutReplacement
std::vector< RoomInfo > m_roomListWithoutReplacement
Definition: building-position-allocator.h:165
ns3::FixedRoomPositionAllocator::roomy
uint32_t roomy
Definition: building-position-allocator.h:248
ns3::RandomRoomPositionAllocator::GetNext
virtual Vector GetNext(void) const
Definition: building-position-allocator.cc:244
ns3::SameRoomPositionAllocator::SameRoomPositionAllocator
SameRoomPositionAllocator()
Definition: building-position-allocator.cc:315
ns3::NodeContainer::Iterator
std::vector< Ptr< Node > >::const_iterator Iterator
Node container iterator.
Definition: node-container.h:42
ns3::OutdoorPositionAllocator::m_z
Ptr< RandomVariableStream > m_z
pointer to z's random variable stream
Definition: building-position-allocator.h:124
ns3::FixedRoomPositionAllocator::bptr
Ptr< Building > bptr
Definition: building-position-allocator.h:251
ns3::OutdoorPositionAllocator::m_maxAttempts
uint32_t m_maxAttempts
maximum number of attempts before giving up
Definition: building-position-allocator.h:126
ns3::FixedRoomPositionAllocator::floor
uint32_t floor
Definition: building-position-allocator.h:249
ns3::RandomRoomPositionAllocator::RoomInfo::b
Ptr< Building > b
Definition: building-position-allocator.h:160
ns3::RandomVariableStream::GetValue
virtual double GetValue(void)=0
Get the next random value as a double drawn from the distribution.
ns3::FixedRoomPositionAllocator::FixedRoomPositionAllocator
FixedRoomPositionAllocator(uint32_t x, uint32_t y, uint32_t z, Ptr< Building > b)
Definition: building-position-allocator.cc:406
ns3::RandomRoomPositionAllocator::AssignStreams
int64_t AssignStreams(int64_t stream)
Assign a fixed random variable stream number to the random variables used by this model.
Definition: building-position-allocator.cc:303
f
double f(double x, void *params)
Definition: 80211b.c:70
ns3::BuildingList::GetBuilding
static Ptr< Building > GetBuilding(uint32_t n)
Definition: building-list.cc:183
ns3::PositionAllocator
Allocate a set of positions.
Definition: position-allocator.h:36
ns3::Box
a 3d box
Definition: box.h:35
ns3::BoxValue
AttributeValue implementation for Box.
Definition: box.h:126
sample-rng-plot.x
list x
Definition: sample-rng-plot.py:34
NS_LOG_FUNCTION
#define NS_LOG_FUNCTION(parameters)
If log level LOG_FUNCTION is enabled, this macro will output all input parameters separated by ",...
Definition: log-macros-enabled.h:244
ns3::MobilityModel
Keep track of the current position and velocity of an object.
Definition: mobility-model.h:40
ns3::NodeContainer
keep track of a set of node pointers.
Definition: node-container.h:39
ns3::NodeContainer::End
Iterator End(void) const
Get an iterator which indicates past-the-last Node in the container.
Definition: node-container.cc:82
ns3::RandomVariableStream::SetStream
void SetStream(int64_t stream)
Specifies the stream number for the RngStream.
Definition: random-variable-stream.cc:100
ns3::UintegerValue
Hold an unsigned integer type.
Definition: uinteger.h:44
ns3::SameRoomPositionAllocator::m_nodeIt
NodeContainer::Iterator m_nodeIt
Definition: building-position-allocator.h:203
ns3::RandomBuildingPositionAllocator::GetNext
virtual Vector GetNext(void) const
Definition: building-position-allocator.cc:70
ns3::OutdoorPositionAllocator::m_x
Ptr< RandomVariableStream > m_x
pointer to x's random variable stream
Definition: building-position-allocator.h:122
ns3::SameRoomPositionAllocator::GetNext
virtual Vector GetNext(void) const
Definition: building-position-allocator.cc:348
ns3::RandomRoomPositionAllocator::RoomInfo::floor
uint32_t floor
Definition: building-position-allocator.h:163
ns3::FixedRoomPositionAllocator::GetNext
virtual Vector GetNext(void) const
Definition: building-position-allocator.cc:430
ns3::RandomRoomPositionAllocator::m_rand
Ptr< UniformRandomVariable > m_rand
Provides uniform random variables.
Definition: building-position-allocator.h:168
ns3::RandomBuildingPositionAllocator::GetTypeId
static TypeId GetTypeId(void)
Definition: building-position-allocator.cc:52
ns3::MakeUintegerAccessor
Ptr< const AttributeAccessor > MakeUintegerAccessor(T1 a1)
Create an AttributeAccessor for a class data member, or a lone class get functor or set method.
Definition: uinteger.h:45
ns3::OutdoorPositionAllocator::SetX
void SetX(Ptr< RandomVariableStream > x)
Set the random variable stream object that generates x-positions.
Definition: building-position-allocator.cc:149
ns3::RandomRoomPositionAllocator
Allocate each position by randomly choosing a room from the list of all buildings,...
Definition: building-position-allocator.h:136
ns3::FixedRoomPositionAllocator::roomx
uint32_t roomx
Definition: building-position-allocator.h:247
ns3::BoxValue::Get
Box Get(void) const
Definition: box.cc:207
ns3::Box::xMax
double xMax
The x coordinate of the right bound of the box.
Definition: box.h:112
ns3::UniformRandomVariable::GetValue
double GetValue(double min, double max)
Get the next random value, as a double in the specified range .
Definition: random-variable-stream.cc:182
ns3::FixedRoomPositionAllocator::AssignStreams
int64_t AssignStreams(int64_t)
Assign a fixed random variable stream number to the random variables used by this model.
Definition: building-position-allocator.cc:460
sample-rng-plot.n
n
Definition: sample-rng-plot.py:37
ns3::SameRoomPositionAllocator::GetTypeId
static TypeId GetTypeId(void)
Definition: building-position-allocator.cc:338
ns3::FixedRoomPositionAllocator::GetTypeId
static TypeId GetTypeId(void)
Definition: building-position-allocator.cc:420
ns3::OutdoorPositionAllocator::SetY
void SetY(Ptr< RandomVariableStream > y)
Set the random variable stream object that generates y-positions.
Definition: building-position-allocator.cc:154
ns3::Box::yMax
double yMax
The y coordinate of the top bound of the box.
Definition: box.h:116