From b0fd4d2e2aed73b50eb296142a1cf6fe49853c17 Mon Sep 17 00:00:00 2001 From: Tommaso Pecorella Date: Sun, 6 Nov 2011 17:46:16 +0100 Subject: [PATCH 1/2] Topology reader docs fixings --- doc/models/source/index.rst | 1 + src/topology-read/doc/topology.h | 18 +------- src/topology-read/doc/topology.rst | 45 +++++++++++++++++++ .../helper/topology-reader-helper.h | 2 + .../model/inet-topology-reader.h | 3 +- .../model/orbis-topology-reader.h | 3 +- .../model/rocketfuel-topology-reader.h | 3 +- src/topology-read/model/topology-reader.h | 12 +++++ 8 files changed, 67 insertions(+), 20 deletions(-) create mode 100644 src/topology-read/doc/topology.rst diff --git a/doc/models/source/index.rst b/doc/models/source/index.rst index 1e34722ba..fa7dd59c3 100644 --- a/doc/models/source/index.rst +++ b/doc/models/source/index.rst @@ -38,6 +38,7 @@ This document is written in `reStructuredText ::const_iterator ConstAttributesIterator; + /** + * \brief Constructor + * \param fromPtr Ptr to the node the link is orginating from + * \param fromName name of the node the link is orginating from + * \param toPtr Ptr to the node the link is directed to + * \param toName name of the node the link is directed to + */ Link ( Ptr fromPtr, std::string fromName, Ptr toPtr, std::string toName ); /** From 6f5bb7d985072e266460f1b845a60692097fa71f Mon Sep 17 00:00:00 2001 From: Tommaso Pecorella Date: Thu, 17 Nov 2011 19:02:45 +0100 Subject: [PATCH 2/2] Added MobilityModel::GetRelativeSpeed() - proposed by Jens Mittag. --- CHANGES.html | 1 + src/mobility/model/mobility-model.cc | 9 +++++++++ src/mobility/model/mobility-model.h | 6 ++++++ 3 files changed, 16 insertions(+) diff --git a/CHANGES.html b/CHANGES.html index 2e6093b9b..56489da3c 100644 --- a/CHANGES.html +++ b/CHANGES.html @@ -76,6 +76,7 @@ instead of CXXDEFINES

New API:

    +
  • In the mobility module, there is a new API MobilityModel::GetRelativeSpeed() returning the relative speed of two objects. Proposed by Jens Mittag.

Changes to existing API:

diff --git a/src/mobility/model/mobility-model.cc b/src/mobility/model/mobility-model.cc index 9c64da2d5..31397ed46 100644 --- a/src/mobility/model/mobility-model.cc +++ b/src/mobility/model/mobility-model.cc @@ -83,6 +83,15 @@ MobilityModel::GetDistanceFrom (Ptr other) const return CalculateDistance (position, oPosition); } +double +MobilityModel::GetRelativeSpeed (Ptr other) const +{ + double x = GetVelocity().x - other->GetVelocity().x; + double y = GetVelocity().y - other->GetVelocity().y; + double z = GetVelocity().z - other->GetVelocity().z; + return sqrt( (x*x) + (y*y) + (z*z) ); +} + void MobilityModel::NotifyCourseChange (void) const { diff --git a/src/mobility/model/mobility-model.h b/src/mobility/model/mobility-model.h index cd9423314..48e3d1f4a 100644 --- a/src/mobility/model/mobility-model.h +++ b/src/mobility/model/mobility-model.h @@ -60,6 +60,12 @@ public: * \return the distance between the two objects. Unit is meters. */ double GetDistanceFrom (Ptr position) const; + /** + * \param other reference to another object's mobility model + * \return the relative speed between the two objects. Unit is meters/s. + */ + double GetRelativeSpeed (Ptr other) const; + protected: /** * Must be invoked by subclasses when the course of the