samples/main-grid-topology.cc
changeset 2231 a5b898c1ee2c
parent 2230 9f13ac3291e0
child 2249 3a1da26d61dc
equal deleted inserted replaced
2230:9f13ac3291e0 2231:a5b898c1ee2c
    37   // iterate our nodes and print their position.
    37   // iterate our nodes and print their position.
    38   for (std::vector<Ptr<Object> >::const_iterator j = nodes.begin ();
    38   for (std::vector<Ptr<Object> >::const_iterator j = nodes.begin ();
    39        j != nodes.end (); j++)
    39        j != nodes.end (); j++)
    40     {
    40     {
    41       Ptr<Object> object = *j;
    41       Ptr<Object> object = *j;
    42       Ptr<MobilityModel> position = object->QueryInterface<MobilityModel> (MobilityModel::iid);
    42       Ptr<MobilityModel> position = object->QueryInterface<MobilityModel> ();
    43       NS_ASSERT (position != 0);
    43       NS_ASSERT (position != 0);
    44       Vector pos = position->GetPosition ();
    44       Vector pos = position->GetPosition ();
    45       std::cout << "x=" << pos.x << ", y=" << pos.y << ", z=" << pos.z << std::endl;
    45       std::cout << "x=" << pos.x << ", y=" << pos.y << ", z=" << pos.z << std::endl;
    46     }
    46     }
    47 
    47