Adding SpringMobilityModel to adjust positions of nodes in large
topologies

Inspired by http://en.wikipedia.org/wiki/Force-based_algorithms_%28graph_drawing%29
diff --git a/utils/spring-mobility-model.h b/utils/spring-mobility-model.h
new file mode 100644
index 0000000..553ab9d
--- /dev/null
+++ b/utils/spring-mobility-model.h
@@ -0,0 +1,94 @@
+/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
+/*
+ * Copyright (c) 2006, 2007 INRIA
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License version 2 as
+ * published by the Free Software Foundation;
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+ *
+ * Author: 
+ */
+#ifndef SPRING_MOBILITY_MODEL_H
+#define SPRING_MOBILITY_MODEL_H
+
+#include "ns3/mobility-model.h"
+#include "ns3/nstime.h"
+#include "ns3/event-id.h"
+
+namespace ns3 {
+
+/**
+ * \ingroup mobility
+ *
+ * \brief 
+ */
+class SpringMobilityModel : public MobilityModel 
+{
+public:
+  static TypeId GetTypeId (void);
+
+  /**
+   * Create a position located at coordinates (0,0,0) with velocity (0,0,0)
+   */
+  SpringMobilityModel ();
+  virtual ~SpringMobilityModel ();
+
+  /**
+   * \brief Attach node by a spring
+   * \param node MobilityModel layer of the attaching node
+   */
+  void
+  AddSpring (Ptr<MobilityModel> node);
+
+private:
+  // from Object
+  virtual void
+  DoStart ();
+
+  // from MobilityModel
+  virtual Vector 
+  DoGetPosition (void) const;
+
+  virtual void 
+  DoSetPosition (const Vector &position);
+
+  virtual Vector 
+  DoGetVelocity (void) const;
+
+  // Updating positions
+  void 
+  Update (void) const;
+
+private:
+  double m_epsilon;
+
+  double m_nodeMass;
+  double m_nodeCharge;
+  double m_springNormalLength;
+  double m_springConstant;
+  double m_dampingFactor;
+
+  static double m_totalKineticEnergy;  
+  
+  mutable Vector m_position;
+  mutable Vector m_velocity;
+  mutable bool m_stable;
+  mutable Time m_lastTime;
+
+  EventId m_updateEvent;
+
+  std::list<Ptr<MobilityModel> > m_springs;
+};
+
+} // namespace ns3
+
+#endif // SPRING_MOBILITY_MODEL_H