// Add a node to the graph with no edges.
void
vt_graph_impl::add_node (const char * name)
{
  Supports_Test::Node * new_node = 0;
  ACE_NEW (new_node, node_impl (name));
  nodes_ ().length (nodes_ ().length () + 1);
  nodes_ ()[nodes_ ().length () - 1] = new_node;
}
// Creates a vt_graph_impl with the given number of nodes. There will be one
// root node and the rest will be children of it.
vt_graph_impl::vt_graph_impl (int num_nodes)
{
  nodes_ ().length (0);
  add_node ("ROOT");
  for (int i = 1; i < num_nodes; i++)
    {
      add_node ("CHILD");
      nodes_ ()[0]->add_edge (nodes_ ()[i]);
    }
}
// Print out information about each node.
void
vt_graph_impl::print (void)
{
  ACE_DEBUG ((LM_DEBUG,
              "Printing graph data...\n"));

  ACE_DEBUG ((LM_DEBUG,
              "Number of nodes: [%d]\n", nodes_ ().length ()));

  for (size_t i = 0; i < nodes_ ().length (); i++)
    nodes_ ()[i]->print ();
}
void DomainUnstructured::compute_cell_center_coordinates(TabType & coord, entier index_begin) const
{
  const entier dim = nodes_.dimension(1);
  const entier nb_elem = elements_.dimension(0);
  const entier nb_som_elem = elements_.dimension(1);
  const double facteur = 1. / (double) nb_som_elem;
  double tmp[3];
  for (int i = 0; i < nb_elem; i++) {
    int j, k;
    tmp[0] = tmp[1] = tmp[2] = 0.;
    for (j = 0; j < nb_som_elem; j++) {
      int som = elements_(i, j);
      for (k = 0; k < loop_max(dim, 3); k++) {
        tmp[k] += nodes_(som, k);
        break_loop(k, dim);
      }
    }
    for (k = 0; k < loop_max(dim, 3); k++) {
      coord(index_begin + i, k) = tmp[k] * facteur;
      break_loop(k, dim);
    }
  }
}
// Get the number of nodes in the vt_graph.
CORBA::Long vt_graph_impl::size (void)
{
  return nodes_ ().length ();
}