A Discrete-Event Network Simulator
API
Loading...
Searching...
No Matches
building.h
Go to the documentation of this file.
1/*
2 * Copyright (c) 2011 Centre Tecnologic de Telecomunicacions de Catalunya (CTTC)
3 *
4 * SPDX-License-Identifier: GPL-2.0-only
5 *
6 * Author: Marco Miozzo <marco.miozzo@cttc.es>
7 *
8 */
9#ifndef BUILDING_H
10#define BUILDING_H
11
12#include <ns3/attribute-helper.h>
13#include <ns3/attribute.h>
14#include <ns3/box.h>
15#include <ns3/object.h>
16#include <ns3/simple-ref-count.h>
17#include <ns3/vector.h>
18
19namespace ns3
20{
21
22/**
23 * \defgroup buildings Buildings
24 *
25 * The models to define 3d buildings, associated channel models, and mobility.
26 */
27
28/**
29 * \ingroup buildings
30 * \brief a 3d building block
31 */
32class Building : public Object
33{
34 public:
35 /**
36 * \brief Get the type ID.
37 * \return The object TypeId.
38 */
39 static TypeId GetTypeId();
40 void DoDispose() override;
41
42 /**
43 * Building type enum
44 */
51
52 /**
53 * External building wall type enum
54 */
62
63 /**
64 * Construct a simple building with 1 room and 1 floor
65 *
66 * \param xMin x coordinates of left boundary.
67 * \param xMax x coordinates of right boundary.
68 * \param yMin y coordinates of bottom boundary.
69 * \param yMax y coordinates of top boundary.
70 * \param zMin z coordinates of down boundary.
71 * \param zMax z coordinates of up boundary.
72 *
73 */
74 Building(double xMin, double xMax, double yMin, double yMax, double zMin, double zMax);
75
76 /**
77 * Create a zero-sized building located at coordinates (0.0,0.0,0.0)
78 * and with 1 floors and 1 room.
79 */
80 Building();
81
82 /**
83 * Destructor
84 *
85 */
86 ~Building() override;
87
88 /**
89 * \return the unique id of this Building. This unique id happens to
90 * be also the index of the Building into the BuildingList.
91 */
92 uint32_t GetId() const;
93
94 /**
95 * Set the boundaries of the building
96 *
97 * \param box the Box defining the boundaries of the building
98 */
99 void SetBoundaries(Box box);
100
101 /**
102 * \param t the type of building (i.e., Residential, Office, Commercial)
103 *
104 * This method allows to set building type (default is Residential)
105 */
107
108 /**
109 * \param t the type of external walls (i.e., Wood, ConcreteWithWindows,
110 * ConcreteWithoutWindows and StoneBlocks), used for evaluating the loss
111 * due to the penetration of external walls in outdoor <-> indoor comm.
112 *
113 * This method allows to set external walls type (default is Residential)
114 */
116
117 /**
118 * \param nfloors the number of floors in the building
119 *
120 * This method allows to set the number of floors in the building
121 * (default is 1)
122 */
123 void SetNFloors(uint16_t nfloors);
124
125 /**
126 * \param nroomx the number of rooms along the x axis
127 *
128 * This method allows to set the number of rooms along the x-axis
129 */
130 void SetNRoomsX(uint16_t nroomx);
131
132 /**
133 * \param nroomy the number of floors in the building
134 *
135 * This method allows to set the number of rooms along the y-axis
136 */
137 void SetNRoomsY(uint16_t nroomy);
138
139 /**
140 *
141 * \return the boundaries of the building
142 */
143 Box GetBoundaries() const;
144
145 /**
146 * \return the type of building
147 */
148 BuildingType_t GetBuildingType() const;
149
150 /**
151 * \return the type of external walls of the building
152 */
153 ExtWallsType_t GetExtWallsType() const;
154
155 /**
156 * \return the number of floors of the building
157 */
158 uint16_t GetNFloors() const;
159
160 /**
161 * \return the number of rooms along the x-axis of the building
162 */
163 uint16_t GetNRoomsX() const;
164
165 /**
166 * \return the number of rooms along the y-axis
167 */
168 uint16_t GetNRoomsY() const;
169
170 /**
171 *
172 *
173 * \param position some position
174 *
175 * \return true if the position fall inside the building, false otherwise
176 */
177 bool IsInside(Vector position) const;
178
179 /**
180 *
181 *
182 * \param position a position inside the building
183 *
184 * \return the number of the room along the X axis where the
185 * position falls
186 */
187 uint16_t GetRoomX(Vector position) const;
188
189 /**
190 *
191 *
192 * \param position a position inside the building
193 *
194 * \return the number of the room along the Y axis where the
195 * position falls
196 */
197 uint16_t GetRoomY(Vector position) const;
198
199 /**
200 *
201 * \param position a position inside the building
202 *
203 * \return the floor where the position falls
204 */
205 uint16_t GetFloor(Vector position) const;
206 /**
207 * \brief Checks if a line-segment between position l1 and position l2
208 * intersects a building.
209 *
210 * \param l1 position
211 * \param l2 position
212 * \return true if there is a intersection, false otherwise
213 */
214 bool IsIntersect(const Vector& l1, const Vector& l2) const;
215
216 private:
217 Box m_buildingBounds; //!< Building boundaries
218
219 /**
220 * number of floors, must be greater than 0, and 1 means only one floor
221 * (i.e., groundfloor)
222 */
223 uint16_t m_floors;
224 uint16_t m_roomsX; //!< X Room coordinate
225 uint16_t m_roomsY; //!< Y Room coordinate
226
227 uint32_t m_buildingId; //!< Building ID number
228 BuildingType_t m_buildingType; //!< Building type
229 ExtWallsType_t m_externalWalls; //!< External building wall type
230};
231
232} // namespace ns3
233
234#endif /* BUILDING_H */
a 3d box
Definition box.h:24
a 3d building block
Definition building.h:33
Building()
Create a zero-sized building located at coordinates (0.0,0.0,0.0) and with 1 floors and 1 room.
Definition building.cc:107
uint32_t GetId() const
Definition building.cc:125
uint16_t GetNRoomsY() const
Definition building.cc:205
uint32_t m_buildingId
Building ID number.
Definition building.h:227
BuildingType_t m_buildingType
Building type.
Definition building.h:228
ExtWallsType_t GetExtWallsType() const
Definition building.cc:187
ExtWallsType_t
External building wall type enum.
Definition building.h:56
@ ConcreteWithWindows
Definition building.h:58
@ ConcreteWithoutWindows
Definition building.h:59
ExtWallsType_t m_externalWalls
External building wall type.
Definition building.h:229
void SetBuildingType(Building::BuildingType_t t)
Definition building.cc:139
uint16_t GetNFloors() const
Definition building.cc:193
void SetBoundaries(Box box)
Set the boundaries of the building.
Definition building.cc:132
BuildingType_t GetBuildingType() const
Definition building.cc:181
void SetNRoomsX(uint16_t nroomx)
Definition building.cc:160
bool IsIntersect(const Vector &l1, const Vector &l2) const
Checks if a line-segment between position l1 and position l2 intersects a building.
Definition building.cc:280
uint16_t GetRoomY(Vector position) const
Definition building.cc:238
void SetExtWallsType(Building::ExtWallsType_t t)
Definition building.cc:146
uint16_t m_floors
number of floors, must be greater than 0, and 1 means only one floor (i.e., groundfloor)
Definition building.h:223
void DoDispose() override
Destructor implementation.
Definition building.cc:119
void SetNRoomsY(uint16_t nroomy)
Definition building.cc:167
Box GetBoundaries() const
Definition building.cc:174
uint16_t m_roomsX
X Room coordinate.
Definition building.h:224
~Building() override
Destructor.
Definition building.cc:113
uint16_t GetFloor(Vector position) const
Definition building.cc:259
uint16_t GetNRoomsX() const
Definition building.cc:199
uint16_t m_roomsY
Y Room coordinate.
Definition building.h:225
bool IsInside(Vector position) const
Definition building.cc:211
void SetNFloors(uint16_t nfloors)
Definition building.cc:153
Box m_buildingBounds
Building boundaries.
Definition building.h:217
uint16_t GetRoomX(Vector position) const
Definition building.cc:217
BuildingType_t
Building type enum.
Definition building.h:46
static TypeId GetTypeId()
Get the type ID.
Definition building.cc:30
A base class which provides memory management and object aggregation.
Definition object.h:78
a unique identifier for an interface.
Definition type-id.h:48
Every class exported by the ns3 library is enclosed in the ns3 namespace.