14constexpr double M_SQRT3 = 1.732050807568877;
22 {{0.0, 0.0}, {-3.0, 2.0}, {3.0, -2.0}, {-1.5, -2.5}, {1.5, 2.5}, {-4.5, -0.5}, {4.5, 0.5}};
28 {{0.0, 0.0}, {-3.0, -4.0}, {3.0, 4.0}, {-4.5, 3.5}, {4.5, -3.5}, {-7.5, -0.5}, {7.5, 0.5}};
37 static TypeId tid =
TypeId(
"ns3::HexagonalWraparoundModel")
39 .SetGroupName(
"Spectrum")
65 NS_ASSERT((numSites == 1) || (numSites == 7) || (numSites == 19));
101 std::vector<double> virtDists;
107 return (this->GetVirtualPosition(pos, sitePos) - sitePos).GetLength();
109 auto idx = std::min_element(virtDists.begin(), virtDists.end()) - virtDists.begin();
126 std::vector<double> virtDists;
127 virtDists.resize(coeffs.size());
128 std::transform(coeffs.begin(), coeffs.end(), virtDists.begin(), [&](
const Vector2D& coeff) {
129 Vector3D virtPos2 = txPos;
130 virtPos2.x += coeff.x * m_radius;
131 virtPos2.y += coeff.y * m_isd;
132 return static_cast<double>((virtPos2 - rxPos).GetLength());
135 auto idx = std::min_element(virtDists.begin(), virtDists.end()) - virtDists.begin();
137 return txPos + offset;
double m_radius
site radius
Vector3D GetSitePosition(const Vector3D &pos) const
Calculate the site position.
void AddSitePosition(const Vector3D &pos)
Add a site position.
static TypeId GetTypeId()
Register this type with the TypeId system.
Vector3D GetVirtualPosition(const Vector3D txPos, const Vector3D rxPos) const override
Get virtual position of txPos with respect to rxPos.
double m_isd
distance between sites
void SetSitePositions(const std::vector< Vector3D > &positions)
Set site positions.
double CalculateDistance(const Vector3D &a, const Vector3D &b) const
Calculate distance after wraparound between two points.
std::vector< Vector3D > m_sitePositions
site positions
HexagonalWraparoundModel()
Default constructor.
void SetSiteDistance(double isd)
Set site distance.
void SetNumSites(uint8_t numSites)
Set number of sites.
uint8_t m_numSites
number of sites
a unique identifier for an interface.
TypeId SetParent(TypeId tid)
Set the parent TypeId.
WraparoundModel()=default
Default constructor.
#define NS_ASSERT(condition)
At runtime, in debugging builds, if this condition is not true, the program prints the source file,...
#define NS_ASSERT_MSG(condition, message)
At runtime, in debugging builds, if this condition is not true, the program prints the message to out...
#define NS_LOG_COMPONENT_DEFINE(name)
Define a Log component with a specific name.
#define NS_LOG_FUNCTION(parameters)
If log level LOG_FUNCTION is enabled, this macro will output all input parameters separated by ",...
#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.
std::vector< Vector2D > WRAPPING_COEFF_CLUSTER19
Coefficients used to wraparound a cluster with 19 sites (3 rings)
std::vector< Vector2D > WRAPPING_COEFF_CLUSTER7
Coefficients used to wraparound a cluster with 7 sites (1 ring)