#include <iostream>#include "ns3/core-module.h"#include "ns3/network-module.h"#include "ns3/internet-module.h"#include "ns3/point-to-point-module.h"#include "ns3/netanim-module.h"#include "ns3/applications-module.h"#include "ns3/point-to-point-layout-module.h"#include "ns3/mobility-module.h"
using namespace ns3;
int main (int argc, char *argv[]){
uint32_t nLeftLeaf = 5; uint32_t nRightLeaf = 5; uint32_t nLeaf = 0; // If non-zero, number of both left and right std::string animFile = "dumbbell-animation.xml" ; // Name of file for animation output
CommandLine cmd; cmd.AddValue ("nLeftLeaf", "Number of left side leaf nodes", nLeftLeaf); cmd.AddValue ("nRightLeaf","Number of right side leaf nodes", nRightLeaf); cmd.AddValue ("nLeaf", "Number of left and right side leaf nodes", nLeaf); cmd.AddValue ("animFile", "File Name for Animation Output", animFile);
cmd.Parse (argc,argv); if (nLeaf > 0) { nLeftLeaf = nLeaf; nRightLeaf = nLeaf; }
// Create the point-to-point link helpers PointToPointHelper pointToPointRouter; PointToPointHelper pointToPointLeaf;
PointToPointDumbbellHelper d (nLeftLeaf, pointToPointLeaf, nRightLeaf, pointToPointLeaf, pointToPointRouter);
// Set the bounding box for animation d.BoundingBox (1, 1, 100, 100);
// Create the animation object and configure for specified output AnimationInterface anim (animFile); Simulator::Stop (Seconds (100.0)); Simulator::Run (); std::cout << "Animation Trace file created:" << animFile.c_str ()<< std::endl; Simulator::Destroy (); return 0;}
Peter