View | Details | Raw Unified | Return to bug 2892
Collapse All | Expand All

(-)i/src/mobility/model/position-allocator.cc (-2 / +7 lines)
 Lines 471-476   UniformDiscPositionAllocator::SetY (double y) Link Here 
471
{
471
{
472
  m_y = y;
472
  m_y = y;
473
}
473
}
474
void
475
UniformDiscPositionAllocator::SetZ (double z)
476
{
477
  m_z = z;
478
}
474
Vector
479
Vector
475
UniformDiscPositionAllocator::GetNext (void) const
480
UniformDiscPositionAllocator::GetNext (void) const
476
{
481
{
 Lines 484-491   UniformDiscPositionAllocator::GetNext (void) const Link Here 
484
489
485
  x += m_x;
490
  x += m_x;
486
  y += m_y;
491
  y += m_y;
487
  NS_LOG_DEBUG ("Disc position x=" << x << ", y=" << y);
492
  NS_LOG_DEBUG ("Disc position x=" << x << ", y=" << y << ", z=" << m_z);
488
  return Vector (x, y, 0.0);
493
  return Vector (x, y, m_z);
489
}
494
}
490
495
491
int64_t
496
int64_t
(-)i/src/mobility/model/position-allocator.h (-10 / +19 lines)
 Lines 309-320   private: Link Here 
309
 * \brief Allocate the positions uniformely (with constant density) randomly within a disc.
309
 * \brief Allocate the positions uniformely (with constant density) randomly within a disc.
310
 *
310
 *
311
 * UniformDiscPositionAllocator allocates the positions randomly within a disc \f$ D \f$ lying on the
311
 * UniformDiscPositionAllocator allocates the positions randomly within a disc \f$ D \f$ lying on the
312
 * plane \f$ z=0 \f$ and having center at coordinates \f$ (x,y,0) \f$
312
 * plane \f$ z \f$ and having center at coordinates \f$ (x,y,z) \f$
313
 * and radius \f$ \rho \f$. The random positions are chosen such that,
313
 * and radius \f$ \rho \f$. The random positions are chosen such that,
314
 * for any subset \f$ S \subset D \f$, the expected value of the
314
 * for any subset \f$ S \subset D \f$, the expected value of the
315
 * fraction of points which fall into \f$ S \subset D \f$ corresponds
315
 * fraction of points which fall into \f$ S \subset D \f$ corresponds
316
 * to \f$ \frac{|S|}{|D|} \f$, i.e., to the ratio of the area of the
316
 * to \f$ \frac{|S|}{|D|} \f$, i.e., to the ratio of the area of the
317
 * subset to the area of the whole disc. 
317
 * subset to the area of the whole disc.
318
 *
318
 *
319
 * \note using UniformDiscPositionAllocator is not equivalent to using
319
 * \note using UniformDiscPositionAllocator is not equivalent to using
320
 * a RandomDiscPositionAllocator with a uniformly-distributed radius,
320
 * a RandomDiscPositionAllocator with a uniformly-distributed radius,
 Lines 329-359   public: Link Here 
329
   * \return the object TypeId
329
   * \return the object TypeId
330
   */
330
   */
331
  static TypeId GetTypeId (void);
331
  static TypeId GetTypeId (void);
332
333
  /**
334
   * \brief Constructor
335
   */
332
  UniformDiscPositionAllocator ();
336
  UniformDiscPositionAllocator ();
333
  virtual ~UniformDiscPositionAllocator ();
337
  virtual ~UniformDiscPositionAllocator ();
334
338
335
  /** 
339
  /**
336
   * \param rho the value of the radius of the disc
340
   * \param rho the value of the radius of the disc
337
   */
341
   */
338
  void SetRho (double rho);
342
  void SetRho (double rho);
339
343
340
  /** 
344
  /**
341
   * \param x  the X coordinate of the center of the disc
345
   * \param x  the X coordinate of the center of the disc
342
   */
346
   */
343
  void SetX (double x);
347
  void SetX (double x);
344
348
345
  /** 
349
  /**
346
   * \param y   the Y coordinate of the center of the disc 
350
   * \param y   the Y coordinate of the center of the disc
347
   */
351
   */
348
  void SetY (double y);
352
  void SetY (double y);
353
  /**
354
   * \param z   the Z coordinate of all the points
355
   */
356
  void SetZ (double z);
349
357
350
  virtual Vector GetNext (void) const;
358
  virtual Vector GetNext (void) const;
351
  virtual int64_t AssignStreams (int64_t stream);
359
  virtual int64_t AssignStreams (int64_t stream);
352
private:
360
private:
353
  Ptr<UniformRandomVariable> m_rv;  //!< pointer to uniform random variable 
361
  Ptr<UniformRandomVariable> m_rv;  //!< pointer to uniform random variable
354
  double m_rho; //!< value of the radius of the disc
362
  double m_rho {0.0}; //!< value of the radius of the disc
355
  double m_x;  //!< x coordinate of center of disc
363
  double m_x   {0.0}; //!< x coordinate of center of disc
356
  double m_y;  //!< y coordinate of center of disc
364
  double m_y   {0.0}; //!< y coordinate of center of disc
365
  double m_z   {0.0}; //!< z coordinate of the points
357
};
366
};
358
367
359
} // namespace ns3
368
} // namespace ns3

Return to bug 2892