1
/* Copyright 2004,2007,2008 ENSEIRB, INRIA & CNRS
1
/* Copyright 2004,2007,2008,2010 ENSEIRB, INRIA & CNRS
3
3
** This file is part of the Scotch software package for static mapping,
4
4
** graph partitioning and sparse matrix ordering.
141
143
usagePrint (stdout, C_usageList);
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");
160
162
velmnbr = e[0] * e[1] * e[2];
162
fprintf (C_filepntrmshout, "1\n%ld\t%ld\t%ld\n0\t%ld\t000\n", /* Print mesh file header */
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),
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);
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)));
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 */
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]));
200
202
if (c[1] != e[1]) {
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]));
209
211
if (c[2] != e[2]) {
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]));
218
220
if (c[1] != e[1]) {
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]));
227
229
fprintf (C_filepntrmshout, "\n");
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]));
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]),
242
(long) (e[1] - 1 - c[1]),
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]),
244
(SCOTCH_Num) (e[1] - 1 - c[1]),
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]),
252
(long) (e[1] - c[1]),
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]),
254
(SCOTCH_Num) (e[1] - c[1]),