Path: blob/devel/elmergrid/src/metis-5.1.0/programs/cmpfillin.c
3206 views
/*1* Copyright 1997, Regents of the University of Minnesota2*3* cmpfillin.c4*5* This file takes a graph and a fill-reducing ordering and computes6* the fillin.7*8* Started 9/1/20049* George10*11* $Id: cmpfillin.c 9982 2011-05-25 17:18:00Z karypis $12*13*/1415#include "metisbin.h"16171819/*************************************************************************20* Let the game begin21**************************************************************************/22int main(int argc, char *argv[])23{24idx_t i;25idx_t *perm, *iperm;26graph_t *graph;27params_t params;28size_t maxlnz, opc;2930if (argc != 3) {31printf("Usage: %s <GraphFile> <PermFile\n", argv[0]);32exit(0);33}3435params.filename = gk_strdup(argv[1]);36graph = ReadGraph(¶ms);37if (graph->nvtxs <= 0) {38printf("Empty graph. Nothing to do.\n");39exit(0);40}41if (graph->ncon != 1) {42printf("Ordering can only be applied to graphs with one constraint.\n");43exit(0);44}454647/* Read the external iperm vector */48perm = imalloc(graph->nvtxs, "main: perm");49iperm = imalloc(graph->nvtxs, "main: iperm");50ReadPOVector(graph, argv[2], iperm);5152for (i=0; i<graph->nvtxs; i++)53perm[iperm[i]] = i;5455printf("**********************************************************************\n");56printf("%s", METISTITLE);57printf("Graph Information ---------------------------------------------------\n");58printf(" Name: %s, #Vertices: %"PRIDX", #Edges: %"PRIDX"\n\n", argv[1],59graph->nvtxs, graph->nedges/2);60printf("Fillin... -----------------------------------------------------------\n");6162ComputeFillIn(graph, perm, iperm, &maxlnz, &opc);6364printf(" Nonzeros: %6.3le \tOperation Count: %6.3le\n", (double)maxlnz, (double)opc);656667printf("**********************************************************************\n");6869FreeGraph(&graph);70}7172737475