next up previous contents
Next: Construct Graph G1: Up: Graphs of Graphs: Previous: The New ACCESS_GRAPH Class:

The New Run Time Code:

The run() callback is structured as usual in this way

void run(Widget w,XtPointer client_data,XtPointer call_data)
{
  XmPushButtonCallbackStruct *P = (XmPushButtonCallbackStruct *)call_data;
  application_data *T = (application_data *)client_data;
  Vertex center_in,center;
  Display *display = T->display;
  Drawable drawable = T->drawable;
  Pixmap pixmap1 = T->pixmap;
  Pixmap pixmap2 = T->pixmap2;
  GC gc = T->gc;
  
  center.x = 25.0;
  center.y = 25.0;
  Pixel graph_colors[4];
  for(int i=0;i<4;++i)
    graph_colors[i] = T->pParts[i]->pixel;
    
  //instantiate the access functions
  ACCESS_FLOAT *DataFloat = new ACCESS_FLOAT;
  ACCESS_EDGESTRUCT *ES = new ACCESS_EDGESTRUCT;
  ACCESS_NODESTRUCT *NS = new ACCESS_NODESTRUCT;
  ACCESS_GRAPH *A = new ACCESS_GRAPH; 
  
  ...our application code...
  
  //output the graph
  cout << T->T << endl; 
  
  //initialize pixmaps and compute image
  T->T->erase(T->pixmap);
  T->T->draw(T->pixmap);
  T->T->erase(T->pixmap2);
  T->T->draw(T->pixmap2);
  image(w,T);
}

Note we have added appropriate lines to construct needed access method class object pointers. To set up our simulation, we add the following code:



 

Jim Peterson
1999-05-17