Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
ElmerCSC
GitHub Repository: ElmerCSC/elmerfem
Path: blob/devel/elmergrid/src/metis-5.1.0/programs/cmpfillin.c
3206 views
1
/*
2
* Copyright 1997, Regents of the University of Minnesota
3
*
4
* cmpfillin.c
5
*
6
* This file takes a graph and a fill-reducing ordering and computes
7
* the fillin.
8
*
9
* Started 9/1/2004
10
* George
11
*
12
* $Id: cmpfillin.c 9982 2011-05-25 17:18:00Z karypis $
13
*
14
*/
15
16
#include "metisbin.h"
17
18
19
20
/*************************************************************************
21
* Let the game begin
22
**************************************************************************/
23
int main(int argc, char *argv[])
24
{
25
idx_t i;
26
idx_t *perm, *iperm;
27
graph_t *graph;
28
params_t params;
29
size_t maxlnz, opc;
30
31
if (argc != 3) {
32
printf("Usage: %s <GraphFile> <PermFile\n", argv[0]);
33
exit(0);
34
}
35
36
params.filename = gk_strdup(argv[1]);
37
graph = ReadGraph(&params);
38
if (graph->nvtxs <= 0) {
39
printf("Empty graph. Nothing to do.\n");
40
exit(0);
41
}
42
if (graph->ncon != 1) {
43
printf("Ordering can only be applied to graphs with one constraint.\n");
44
exit(0);
45
}
46
47
48
/* Read the external iperm vector */
49
perm = imalloc(graph->nvtxs, "main: perm");
50
iperm = imalloc(graph->nvtxs, "main: iperm");
51
ReadPOVector(graph, argv[2], iperm);
52
53
for (i=0; i<graph->nvtxs; i++)
54
perm[iperm[i]] = i;
55
56
printf("**********************************************************************\n");
57
printf("%s", METISTITLE);
58
printf("Graph Information ---------------------------------------------------\n");
59
printf(" Name: %s, #Vertices: %"PRIDX", #Edges: %"PRIDX"\n\n", argv[1],
60
graph->nvtxs, graph->nedges/2);
61
printf("Fillin... -----------------------------------------------------------\n");
62
63
ComputeFillIn(graph, perm, iperm, &maxlnz, &opc);
64
65
printf(" Nonzeros: %6.3le \tOperation Count: %6.3le\n", (double)maxlnz, (double)opc);
66
67
68
printf("**********************************************************************\n");
69
70
FreeGraph(&graph);
71
}
72
73
74
75