~ubuntu-branches/ubuntu/trusty/scotch/trusty-proposed

« back to all changes in this revision

Viewing changes to src/scotch/mmk_m3.c

  • Committer: Bazaar Package Importer
  • Author(s): "Adam C. Powell, IV", Christophe Trophime, Adam C. Powell, IV
  • Date: 2010-12-29 13:07:19 UTC
  • mfrom: (1.1.6 upstream)
  • Revision ID: james.westby@ubuntu.com-20101229130719-jwalolw5d6av6wqx
Tags: 5.1.11.dfsg-1
[Christophe Trophime]
* New upstream release
* Forward-ported patches to version 5.1.10b.
* Install scotch headers properly.
* Fix chrpath commands in debian/rules.
* Fix (pt)scotch library install paths.
* Fix lintian errors and warnings.

[Adam C. Powell, IV]
* Forward-ported patches to version 5.1.11.

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
/* Copyright 2004,2007,2008 ENSEIRB, INRIA & CNRS
 
1
/* Copyright 2004,2007,2008,2010 ENSEIRB, INRIA & CNRS
2
2
**
3
3
** This file is part of the Scotch software package for static mapping,
4
4
** graph partitioning and sparse matrix ordering.
42
42
/**                                 to   : 17 feb 2004     **/
43
43
/**                # Version 5.0  : from : 13 dec 2007     **/
44
44
/**                                 to   : 16 mar 2008     **/
 
45
/**                # Version 5.1  : from : 01 jul 2010     **/
 
46
/**                                 to   : 15 aug 2010     **/
45
47
/**                                                        **/
46
48
/**   NOTES      : # The nodes and elements of the         **/
47
49
/**                  (dX,dY,dZ) mesh are numbered so that  **/
141
143
          usagePrint (stdout, C_usageList);
142
144
          return     (0);
143
145
        case 'V' :
144
 
          fprintf (stderr, "mmk_m3, version %s - F. Pellegrini\n", SCOTCH_VERSION);
145
 
          fprintf (stderr, "Copyright 2004,2007,2008 ENSEIRB, INRIA & CNRS, France\n");
 
146
          fprintf (stderr, "mmk_m3, version " SCOTCH_VERSION_STRING "\n");
 
147
          fprintf (stderr, "Copyright 2004,2007,2008,2010 ENSEIRB, INRIA & CNRS, France\n");
146
148
          fprintf (stderr, "This software is libre/free software under CeCILL-C -- see the user's manual for more information\n");
147
149
          return  (0);
148
150
        default :
159
161
  n[2] = e[2] + 1;
160
162
  velmnbr = e[0] * e[1] * e[2];
161
163
 
162
 
  fprintf (C_filepntrmshout, "1\n%ld\t%ld\t%ld\n0\t%ld\t000\n", /* Print mesh file header */
163
 
             (long) velmnbr,
164
 
             (long) (n[0] * n[1] * n[2]),
165
 
             (long) ((velmnbr + (n[0] * n[1] * n[2]) -
166
 
                                 (n[0] * n[1] + n[0] * n[2] + n[1] * n[2]) +
167
 
                                  n[0] + n[1] + n[2] - 1) * 8),
168
 
             (long) velmnbr);
 
164
  fprintf (C_filepntrmshout, "1\n" SCOTCH_NUMSTRING "\t" SCOTCH_NUMSTRING "\t" SCOTCH_NUMSTRING "\n0\t" SCOTCH_NUMSTRING "\t000\n", /* Print mesh file header */
 
165
             (SCOTCH_Num) velmnbr,
 
166
             (SCOTCH_Num) (n[0] * n[1] * n[2]),
 
167
             (SCOTCH_Num) ((velmnbr + (n[0] * n[1] * n[2]) -
 
168
                                      (n[0] * n[1] + n[0] * n[2] + n[1] * n[2]) +
 
169
                                       n[0] + n[1] + n[2] - 1) * 8),
 
170
             (SCOTCH_Num) velmnbr);
169
171
 
170
172
  for (c[2] = 0; c[2] < e[2]; c[2] ++) {          /* Output element neighbor list */
171
173
    for (c[1] = 0; c[1] < e[1]; c[1] ++) {
172
174
      for (c[0] = 0; c[0] < e[0]; c[0] ++)
173
 
        fprintf (C_filepntrmshout, "8\t%ld\t%ld\t%ld\t%ld\t%ld\t%ld\t%ld\t%ld\n", /* Output neighbors of element */
174
 
                  (long) ((c[2] * n[1] + c[1]) * n[0] + c[0]),
175
 
                  (long) ((c[2] * n[1] + c[1]) * n[0] + (c[0] + 1)),
176
 
                  (long) ((c[2] * n[1] + (c[1] + 1)) * n[0] + c[0]),
177
 
                  (long) ((c[2] * n[1] + (c[1] + 1)) * n[0] + (c[0] + 1)),
178
 
                  (long) (((c[2] + 1) * n[1] + c[1]) * n[0] + c[0]),
179
 
                  (long) (((c[2] + 1) * n[1] + c[1]) * n[0] + (c[0] + 1)),
180
 
                  (long) (((c[2] + 1) * n[1] + (c[1] + 1)) * n[0] + c[0]),
181
 
                  (long) (((c[2] + 1) * n[1] + (c[1] + 1)) * n[0] + (c[0] + 1)));
 
175
        fprintf (C_filepntrmshout, "8\t" SCOTCH_NUMSTRING "\t" SCOTCH_NUMSTRING "\t" SCOTCH_NUMSTRING "\t" SCOTCH_NUMSTRING "\t" SCOTCH_NUMSTRING "\t" SCOTCH_NUMSTRING "\t" SCOTCH_NUMSTRING "\t" SCOTCH_NUMSTRING "\n", /* Output neighbors of element */
 
176
                  (SCOTCH_Num) ((c[2] * n[1] + c[1]) * n[0] + c[0]),
 
177
                  (SCOTCH_Num) ((c[2] * n[1] + c[1]) * n[0] + (c[0] + 1)),
 
178
                  (SCOTCH_Num) ((c[2] * n[1] + (c[1] + 1)) * n[0] + c[0]),
 
179
                  (SCOTCH_Num) ((c[2] * n[1] + (c[1] + 1)) * n[0] + (c[0] + 1)),
 
180
                  (SCOTCH_Num) (((c[2] + 1) * n[1] + c[1]) * n[0] + c[0]),
 
181
                  (SCOTCH_Num) (((c[2] + 1) * n[1] + c[1]) * n[0] + (c[0] + 1)),
 
182
                  (SCOTCH_Num) (((c[2] + 1) * n[1] + (c[1] + 1)) * n[0] + c[0]),
 
183
                  (SCOTCH_Num) (((c[2] + 1) * n[1] + (c[1] + 1)) * n[0] + (c[0] + 1)));
182
184
    }
183
185
  }
184
186
  for (c[2] = 0; c[2] < n[2]; c[2] ++) {          /* Output node neighbor list */
191
193
        if (c[2] != 0) {                          /* Output neighbors of nodes */
192
194
          if (c[1] != 0) {
193
195
            if (c[0] != 0)
194
 
              fprintf (C_filepntrmshout, "\t%ld",
195
 
                        (long) (((c[2] - 1) * e[1] + (c[1] - 1)) * e[0] + (c[0] - 1)));
 
196
              fprintf (C_filepntrmshout, "\t" SCOTCH_NUMSTRING,
 
197
                        (SCOTCH_Num) (((c[2] - 1) * e[1] + (c[1] - 1)) * e[0] + (c[0] - 1)));
196
198
            if (c[0] != e[0])
197
 
              fprintf (C_filepntrmshout, "\t%ld",
198
 
                        (long) (((c[2] - 1) * e[1] + (c[1] - 1)) * e[0] + c[0]));
 
199
              fprintf (C_filepntrmshout, "\t" SCOTCH_NUMSTRING,
 
200
                        (SCOTCH_Num) (((c[2] - 1) * e[1] + (c[1] - 1)) * e[0] + c[0]));
199
201
          }
200
202
          if (c[1] != e[1]) {
201
203
            if (c[0] != 0)
202
 
              fprintf (C_filepntrmshout, "\t%ld",
203
 
                        (long) (((c[2] - 1) * e[1] + c[1]) * e[0] + (c[0] - 1)));
 
204
              fprintf (C_filepntrmshout, "\t" SCOTCH_NUMSTRING,
 
205
                        (SCOTCH_Num) (((c[2] - 1) * e[1] + c[1]) * e[0] + (c[0] - 1)));
204
206
            if (c[0] != e[0])
205
 
              fprintf (C_filepntrmshout, "\t%ld",
206
 
                        (long) (((c[2] - 1) * e[1] + c[1]) * e[0] + c[0]));
 
207
              fprintf (C_filepntrmshout, "\t" SCOTCH_NUMSTRING,
 
208
                        (SCOTCH_Num) (((c[2] - 1) * e[1] + c[1]) * e[0] + c[0]));
207
209
          }
208
210
        }
209
211
        if (c[2] != e[2]) {
210
212
          if (c[1] != 0) {
211
213
            if (c[0] != 0)
212
 
              fprintf (C_filepntrmshout, "\t%ld",
213
 
                        (long) ((c[2] * e[1] + (c[1] - 1)) * e[0] + (c[0] - 1)));
 
214
              fprintf (C_filepntrmshout, "\t" SCOTCH_NUMSTRING,
 
215
                        (SCOTCH_Num) ((c[2] * e[1] + (c[1] - 1)) * e[0] + (c[0] - 1)));
214
216
            if (c[0] != e[0])
215
 
              fprintf (C_filepntrmshout, "\t%ld",
216
 
                        (long) ((c[2] * e[1] + (c[1] - 1)) * e[0] + c[0]));
 
217
              fprintf (C_filepntrmshout, "\t" SCOTCH_NUMSTRING,
 
218
                        (SCOTCH_Num) ((c[2] * e[1] + (c[1] - 1)) * e[0] + c[0]));
217
219
          }
218
220
          if (c[1] != e[1]) {
219
221
            if (c[0] != 0)
220
 
              fprintf (C_filepntrmshout, "\t%ld",
221
 
                        (long) ((c[2] * e[1] + c[1]) * e[0] + (c[0] - 1)));
 
222
              fprintf (C_filepntrmshout, "\t" SCOTCH_NUMSTRING,
 
223
                        (SCOTCH_Num) ((c[2] * e[1] + c[1]) * e[0] + (c[0] - 1)));
222
224
            if (c[0] != e[0])
223
 
              fprintf (C_filepntrmshout, "\t%ld",
224
 
                        (long) ((c[2] * e[1] + c[1]) * e[0] + c[0]));
 
225
              fprintf (C_filepntrmshout, "\t" SCOTCH_NUMSTRING,
 
226
                        (SCOTCH_Num) ((c[2] * e[1] + c[1]) * e[0] + c[0]));
225
227
          }
226
228
        }
227
229
        fprintf (C_filepntrmshout, "\n");
229
231
    }
230
232
  }
231
233
 
232
 
  if (flagval & C_FLAGGEOOUT) {                   /* If geometry is wanted       */
233
 
    fprintf (C_filepntrgeoout, "3\n%ld\n",        /* Output geometry file header */
234
 
              (long) (velmnbr + n[0] * n[1] * n[2]));
 
234
  if (flagval & C_FLAGGEOOUT) {                   /* If geometry is wanted                 */
 
235
    fprintf (C_filepntrgeoout, "3\n" SCOTCH_NUMSTRING "\n", /* Output geometry file header */
 
236
              (SCOTCH_Num) (velmnbr + n[0] * n[1] * n[2]));
235
237
 
236
238
    for (c[2] = 0; c[2] < e[2]; c[2] ++) {        /* Output element coordinates */
237
239
      for (c[1] = 0; c[1] < e[1]; c[1] ++) {
238
240
        for (c[0] = 0; c[0] < e[0]; c[0] ++)
239
 
          fprintf (C_filepntrgeoout, "%ld\t%ld.5\t%ld.5\t%ld.5\n",
240
 
                    (long) (((c[2] * e[1]) + c[1]) * e[0] + c[0]),
241
 
                    (long) c[0],
242
 
                    (long) (e[1] - 1 - c[1]),
243
 
                    (long) c[2]);
 
241
          fprintf (C_filepntrgeoout, SCOTCH_NUMSTRING "\t" SCOTCH_NUMSTRING ".5\t" SCOTCH_NUMSTRING ".5\t" SCOTCH_NUMSTRING ".5\n",
 
242
                    (SCOTCH_Num) (((c[2] * e[1]) + c[1]) * e[0] + c[0]),
 
243
                    (SCOTCH_Num) c[0],
 
244
                    (SCOTCH_Num) (e[1] - 1 - c[1]),
 
245
                    (SCOTCH_Num) c[2]);
244
246
      }
245
247
    }
246
248
    for (c[2] = 0; c[2] <= e[2]; c[2] ++) {       /* Output node coordinates */
247
249
      for (c[1] = 0; c[1] <= e[1]; c[1] ++) {
248
250
        for (c[0] = 0; c[0] <= e[0]; c[0] ++)
249
 
          fprintf (C_filepntrgeoout, "%ld\t%ld\t%ld\t%ld\n",
250
 
                    (long) (velmnbr + ((c[2] * n[1]) + c[1]) * n[0] + c[0]),
251
 
                    (long) c[0],
252
 
                    (long) (e[1] - c[1]),
253
 
                    (long) c[2]);
 
251
          fprintf (C_filepntrgeoout, SCOTCH_NUMSTRING "\t" SCOTCH_NUMSTRING "\t" SCOTCH_NUMSTRING "\t" SCOTCH_NUMSTRING "\n",
 
252
                    (SCOTCH_Num) (velmnbr + ((c[2] * n[1]) + c[1]) * n[0] + c[0]),
 
253
                    (SCOTCH_Num) c[0],
 
254
                    (SCOTCH_Num) (e[1] - c[1]),
 
255
                    (SCOTCH_Num) c[2]);
254
256
      }
255
257
    }
256
258
  }