blob: 5e4b4f61b4672a5fd2809d7e1f445fcc87600686 [file] [log] [blame]
Alexander Afanasyev7dbdcaf2011-12-13 21:40:37 -08001/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
2/*
3 * Copyright (c) 2006, 2007 INRIA
4 *
5 * This program is free software; you can redistribute it and/or modify
6 * it under the terms of the GNU General Public License version 2 as
7 * published by the Free Software Foundation;
8 *
9 * This program is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 * GNU General Public License for more details.
13 *
14 * You should have received a copy of the GNU General Public License
15 * along with this program; if not, write to the Free Software
16 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
17 *
18 * Author: Alexander Afanasyev <alexander.afanasyev@ucla.edu>
19 */
20
21#include "spring-mobility-helper.h"
22#include "spring-mobility-model.h"
23
24namespace ns3 {
25
26void
27SpringMobilityHelper::InstallSprings (Ptr<Node> node1, Ptr<Node> node2)
28{
29 Ptr<SpringMobilityModel> model1, model2;
30 model1 = node1->GetObject<SpringMobilityModel> ();
31 model2 = node2->GetObject<SpringMobilityModel> ();
32
33 NS_ASSERT (model1 != 0 && model2 != 0);
34
35 model1->AddSpring (model2);
36 model2->AddSpring (model1);
37}
38
39void
40SpringMobilityHelper::InstallSprings (TopologyReader::ConstLinksIterator first,
41 TopologyReader::ConstLinksIterator end)
42{
43 for (; first != end; first++)
44 {
45 InstallSprings (first->GetFromNode (),
46 first->GetToNode ());
47 }
48}
49
50} // namespace ns3
51