source: inundation-numpy-branch/pymetis/metis-4.0/Programs/oemetis.c @ 3236

Last change on this file since 3236 was 2051, checked in by jack, 19 years ago

Python interface to metis. Currently provides only the
METIS_PartMeshNodal function, since that is what is currently needed for partitioning.
Module name is metis.

File size: 2.5 KB
Line 
1/*
2 * Copyright 1997, Regents of the University of Minnesota
3 *
4 * oemetis.c
5 *
6 * This file contains the driving routine for multilevel method
7 *
8 * Started 8/28/94
9 * George
10 *
11 * $Id: oemetis.c,v 1.1 1998/11/27 17:59:37 karypis Exp $
12 *
13 */
14
15#include <metis.h>
16
17
18
19/*************************************************************************
20* Let the game begin
21**************************************************************************/
22main(int argc, char *argv[])
23{
24  int i, options[10];
25  idxtype *perm, *iperm;
26  GraphType graph;
27  char filename[256];
28  int numflag = 0, wgtflag;
29  timer TOTALTmr, METISTmr, IOTmr, SMBTmr;
30
31
32  if (argc != 2) {
33    printf("Usage: %s <GraphFile>\n",argv[0]);
34    exit(0);
35  }
36   
37  strcpy(filename, argv[1]);
38
39  cleartimer(TOTALTmr);
40  cleartimer(METISTmr);
41  cleartimer(IOTmr);
42  cleartimer(SMBTmr);
43
44  starttimer(TOTALTmr);
45  starttimer(IOTmr);
46  ReadGraph(&graph, filename, &wgtflag);
47  if (graph.nvtxs <= 0) {
48    printf("Empty graph. Nothing to do.\n");
49    exit(0);
50  }
51  if (graph.ncon != 1) {
52    printf("Ordering can only be applied to graphs with one constraint.\n");
53    exit(0);
54  }
55  stoptimer(IOTmr);
56
57  /* Ordering does not use weights! */
58  GKfree(&graph.vwgt, &graph.adjwgt, LTERM);
59
60  printf("**********************************************************************\n");
61  printf("%s", METISTITLE);
62  printf("Graph Information ---------------------------------------------------\n");
63  printf("  Name: %s, #Vertices: %d, #Edges: %d\n\n", filename, graph.nvtxs, graph.nedges/2);
64  printf("Edge-Based Ordering... ----------------------------------------------\n");
65
66  perm = idxmalloc(graph.nvtxs, "main: perm");
67  iperm = idxmalloc(graph.nvtxs, "main: iperm");
68  options[0] = 0;
69
70  starttimer(METISTmr);
71  METIS_EdgeND(&graph.nvtxs, graph.xadj, graph.adjncy, &numflag, options, perm, iperm);
72  stoptimer(METISTmr);
73
74  starttimer(IOTmr);
75  WritePermutation(filename, iperm, graph.nvtxs); 
76  stoptimer(IOTmr);
77
78  starttimer(SMBTmr);
79  ComputeFillIn(&graph, iperm);
80  stoptimer(SMBTmr);
81
82  stoptimer(TOTALTmr);
83
84  printf("\nTiming Information --------------------------------------------------\n");
85  printf("  I/O:                     \t %7.3f\n", gettimer(IOTmr));
86  printf("  Ordering:                \t %7.3f   (OEMETIS time)\n", gettimer(METISTmr));
87  printf("  Symbolic Factorization:  \t %7.3f\n", gettimer(SMBTmr));
88  printf("  Total:                   \t %7.3f\n", gettimer(TOTALTmr));
89  printf("**********************************************************************\n");
90
91
92  GKfree(&graph.xadj, &graph.adjncy, &perm, &iperm, LTERM);
93} 
94
95
Note: See TracBrowser for help on using the repository browser.