[2051] | 1 | /* |
---|
| 2 | * Copyright 1997, Regents of the University of Minnesota |
---|
| 3 | * |
---|
| 4 | * fortran.c |
---|
| 5 | * |
---|
| 6 | * This file contains code for the fortran to C interface |
---|
| 7 | * |
---|
| 8 | * Started 8/19/97 |
---|
| 9 | * George |
---|
| 10 | * |
---|
| 11 | * $Id: fortran.c,v 1.1 1998/11/27 17:59:14 karypis Exp $ |
---|
| 12 | * |
---|
| 13 | */ |
---|
| 14 | |
---|
| 15 | #include <metis.h> |
---|
| 16 | |
---|
| 17 | |
---|
| 18 | /************************************************************************* |
---|
| 19 | * This function changes the numbering to start from 0 instead of 1 |
---|
| 20 | **************************************************************************/ |
---|
| 21 | void Change2CNumbering(int nvtxs, idxtype *xadj, idxtype *adjncy) |
---|
| 22 | { |
---|
| 23 | int i, nedges; |
---|
| 24 | |
---|
| 25 | for (i=0; i<=nvtxs; i++) |
---|
| 26 | xadj[i]--; |
---|
| 27 | |
---|
| 28 | nedges = xadj[nvtxs]; |
---|
| 29 | for (i=0; i<nedges; i++) |
---|
| 30 | adjncy[i]--; |
---|
| 31 | } |
---|
| 32 | |
---|
| 33 | /************************************************************************* |
---|
| 34 | * This function changes the numbering to start from 1 instead of 0 |
---|
| 35 | **************************************************************************/ |
---|
| 36 | void Change2FNumbering(int nvtxs, idxtype *xadj, idxtype *adjncy, idxtype *vector) |
---|
| 37 | { |
---|
| 38 | int i, nedges; |
---|
| 39 | |
---|
| 40 | for (i=0; i<nvtxs; i++) |
---|
| 41 | vector[i]++; |
---|
| 42 | |
---|
| 43 | nedges = xadj[nvtxs]; |
---|
| 44 | for (i=0; i<nedges; i++) |
---|
| 45 | adjncy[i]++; |
---|
| 46 | |
---|
| 47 | for (i=0; i<=nvtxs; i++) |
---|
| 48 | xadj[i]++; |
---|
| 49 | } |
---|
| 50 | |
---|
| 51 | /************************************************************************* |
---|
| 52 | * This function changes the numbering to start from 1 instead of 0 |
---|
| 53 | **************************************************************************/ |
---|
| 54 | void Change2FNumbering2(int nvtxs, idxtype *xadj, idxtype *adjncy) |
---|
| 55 | { |
---|
| 56 | int i, nedges; |
---|
| 57 | |
---|
| 58 | nedges = xadj[nvtxs]; |
---|
| 59 | for (i=0; i<nedges; i++) |
---|
| 60 | adjncy[i]++; |
---|
| 61 | |
---|
| 62 | for (i=0; i<=nvtxs; i++) |
---|
| 63 | xadj[i]++; |
---|
| 64 | } |
---|
| 65 | |
---|
| 66 | |
---|
| 67 | |
---|
| 68 | /************************************************************************* |
---|
| 69 | * This function changes the numbering to start from 1 instead of 0 |
---|
| 70 | **************************************************************************/ |
---|
| 71 | void Change2FNumberingOrder(int nvtxs, idxtype *xadj, idxtype *adjncy, idxtype *v1, idxtype *v2) |
---|
| 72 | { |
---|
| 73 | int i, nedges; |
---|
| 74 | |
---|
| 75 | for (i=0; i<nvtxs; i++) { |
---|
| 76 | v1[i]++; |
---|
| 77 | v2[i]++; |
---|
| 78 | } |
---|
| 79 | |
---|
| 80 | nedges = xadj[nvtxs]; |
---|
| 81 | for (i=0; i<nedges; i++) |
---|
| 82 | adjncy[i]++; |
---|
| 83 | |
---|
| 84 | for (i=0; i<=nvtxs; i++) |
---|
| 85 | xadj[i]++; |
---|
| 86 | |
---|
| 87 | } |
---|
| 88 | |
---|
| 89 | |
---|
| 90 | |
---|
| 91 | /************************************************************************* |
---|
| 92 | * This function changes the numbering to start from 0 instead of 1 |
---|
| 93 | **************************************************************************/ |
---|
| 94 | void ChangeMesh2CNumbering(int n, idxtype *mesh) |
---|
| 95 | { |
---|
| 96 | int i; |
---|
| 97 | |
---|
| 98 | for (i=0; i<n; i++) |
---|
| 99 | mesh[i]--; |
---|
| 100 | |
---|
| 101 | } |
---|
| 102 | |
---|
| 103 | |
---|
| 104 | /************************************************************************* |
---|
| 105 | * This function changes the numbering to start from 1 instead of 0 |
---|
| 106 | **************************************************************************/ |
---|
| 107 | void ChangeMesh2FNumbering(int n, idxtype *mesh, int nvtxs, idxtype *xadj, idxtype *adjncy) |
---|
| 108 | { |
---|
| 109 | int i, nedges; |
---|
| 110 | |
---|
| 111 | for (i=0; i<n; i++) |
---|
| 112 | mesh[i]++; |
---|
| 113 | |
---|
| 114 | nedges = xadj[nvtxs]; |
---|
| 115 | for (i=0; i<nedges; i++) |
---|
| 116 | adjncy[i]++; |
---|
| 117 | |
---|
| 118 | for (i=0; i<=nvtxs; i++) |
---|
| 119 | xadj[i]++; |
---|
| 120 | |
---|
| 121 | } |
---|
| 122 | |
---|
| 123 | |
---|
| 124 | /************************************************************************* |
---|
| 125 | * This function changes the numbering to start from 1 instead of 0 |
---|
| 126 | **************************************************************************/ |
---|
| 127 | void ChangeMesh2FNumbering2(int n, idxtype *mesh, int ne, int nn, idxtype *epart, idxtype *npart) |
---|
| 128 | { |
---|
| 129 | int i, nedges; |
---|
| 130 | |
---|
| 131 | for (i=0; i<n; i++) |
---|
| 132 | mesh[i]++; |
---|
| 133 | |
---|
| 134 | for (i=0; i<ne; i++) |
---|
| 135 | epart[i]++; |
---|
| 136 | |
---|
| 137 | for (i=0; i<nn; i++) |
---|
| 138 | npart[i]++; |
---|
| 139 | |
---|
| 140 | } |
---|
| 141 | |
---|