|
|
|
1 |
/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */ |
2 |
/* |
3 |
* This program is free software; you can redistribute it and/or modify |
4 |
* it under the terms of the GNU General Public License version 2 as |
5 |
* published by the Free Software Foundation; |
6 |
* |
7 |
* This program is distributed in the hope that it will be useful, |
8 |
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
9 |
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
10 |
* GNU General Public License for more details. |
11 |
* |
12 |
* You should have received a copy of the GNU General Public License |
13 |
* along with this program; if not, write to the Free Software |
14 |
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA |
15 |
* |
16 |
* Author: Andrea Sacco <andrea.sacco85@gmail.com> |
17 |
*/ |
18 |
#ifndef AUV_POSITION_ALLOCATOR_H |
19 |
#define AUV_POSITION_ALLOCATOR_H |
20 |
|
21 |
#include "ns3/position-allocator.h" |
22 |
|
23 |
namespace ns3 { |
24 |
|
25 |
/** |
26 |
* \ingroup mobility |
27 |
* \brief Allocate positions on a rectangular 2d grid |
28 |
* delimited by a circle. |
29 |
*/ |
30 |
class DiskGridPositionAllocator : public PositionAllocator |
31 |
{ |
32 |
public: |
33 |
/** |
34 |
* Register this type with the TypeId system. |
35 |
* \return the object TypeId |
36 |
*/ |
37 |
static TypeId GetTypeId (void); |
38 |
DiskGridPositionAllocator (); |
39 |
virtual ~DiskGridPositionAllocator (); |
40 |
|
41 |
/** |
42 |
* \brief Set the radius of the disc delimiting the grid. |
43 |
* \param rho The radius of the disc. |
44 |
*/ |
45 |
void SetRho (double rho); |
46 |
/** |
47 |
* \brief Set the X coordinate of the center of the disc. |
48 |
* \param x The X coordinate of the center of the disc. |
49 |
*/ |
50 |
void SetX (double x); |
51 |
/** |
52 |
* \brief Set the Y coordinate of the center of the disc. |
53 |
* \param y The Y coordinate of the center of the disc. |
54 |
*/ |
55 |
void SetY (double y); |
56 |
/** |
57 |
* \brief Set the Z coordinate of the center of the disc. |
58 |
* \param z The Z coordinate of the center of the disc. |
59 |
*/ |
60 |
void SetZ (double z); |
61 |
/** |
62 |
* \brief Set the number of subintervals into which the horizontal |
63 |
* radius should be divided. |
64 |
* \param intervals The number of subintervals into which the horizontal |
65 |
* radius should be divided. |
66 |
*/ |
67 |
void SetIntervals (uint32_t intervals); |
68 |
/** |
69 |
* \brief Get the radius of the disc delimiting the grid. |
70 |
* \return The radius of the disc. |
71 |
*/ |
72 |
double GetRho () const; |
73 |
/** |
74 |
* \brief Get the X coordinate of the center of the disc. |
75 |
* \return the X coordinate of the center of the disc. |
76 |
*/ |
77 |
double GetX () const; |
78 |
/** |
79 |
* \brief Get the Y coordinate of the center of the disc. |
80 |
* \return The Y coordinate of the center of the disc. |
81 |
*/ |
82 |
double GetY () const; |
83 |
/** |
84 |
* \brief Get the Z coordinate of the center of the disc. |
85 |
* \return The Z coordinate of the center of the disc. |
86 |
*/ |
87 |
double GetZ () const; |
88 |
/** |
89 |
* \brief Get the number of subintervals into which the horizontal |
90 |
* radius should be divided. |
91 |
* \return The number of subintervals into which the horizontal |
92 |
* radius should be divided. |
93 |
*/ |
94 |
uint32_t GetIntervals () const; |
95 |
|
96 |
/** |
97 |
* \brief Get the number of points in the grid. |
98 |
* \return The number of points in the grid. |
99 |
*/ |
100 |
uint32_t GetN () const; |
101 |
|
102 |
virtual Vector GetNext (void) const; |
103 |
virtual int64_t AssignStreams (int64_t stream); |
104 |
|
105 |
private: |
106 |
/** |
107 |
* \brief calculates the positions |
108 |
*/ |
109 |
void CalculatePositions (); |
110 |
|
111 |
private: |
112 |
std::vector<Vector> m_positions; //!< vector of positions |
113 |
mutable std::vector<Vector>::const_iterator m_current; //!< vector iterator |
114 |
double m_x; //!< x coordinate of center of disc |
115 |
double m_y; //!< y coordinate of center of disc |
116 |
double m_z; //!< z coordinate of center of disc |
117 |
double m_rho; //!< value of the radius of the disc |
118 |
uint32_t m_intervals; //!< number of subintervals |
119 |
uint32_t m_count; //!< number of points |
120 |
}; |
121 |
|
122 |
} // namespace ns3 |
123 |
|
124 |
#endif /* AUV_POSITION_ALLOCATOR_H */ |