Debian Codegraph @

packages/seacas/libraries/exodus/src/ex_put_loadbal_param.c

raw
1 /*
2 * Copyright(C) 1999-2021 National Technology & Engineering Solutions
3 * of Sandia, LLC (NTESS). Under the terms of Contract DE-NA0003525 with
4 * NTESS, the U.S. Government retains certain rights in this software.
5 *
6 * See packages/seacas/LICENSE for details
7 */
8 /*****************************************************************************/
9 /*****************************************************************************/
10 /*****************************************************************************/
11 /* Function(s) contained in this file:
12 * ex_put_loadbal_param()
13 *****************************************************************************
14 * This function outputs the load balance parameters.
15 *****************************************************************************
16 * Variable Index:
17 * exoid - The NetCDF ID of an already open NemesisI file.
18 * num_int_nodes - The number of internal FEM nodes.
19 * num_bor_nodes - The number of border FEM nodes.
20 * num_ext_nodes - The number of external FEM nodes.
21 * num_int_elems - The number of internal FEM elements.
22 * num_bor_elems - The number of border FEM elements.
23 * num_node_cmaps - The number of nodal communication maps.
24 * num_elem_cmaps - The number of elemental communication maps.
25 * processor - The processor the file being read was written for.
26 */
27 /*****************************************************************************/
28 /*****************************************************************************/
29 /*****************************************************************************/
30
31 #include <exodusII.h> // for ex_err, etc
32 #include <exodusII_int.h> // for exi_leavedef, EX_FATAL, etc
33
34 /*!
35 * \ingroup ModelDescription
36 * \undoc
37 */
38 int ex_put_loadbal_param(int exoid, int64_t num_int_nodes, int64_t num_bor_nodes,
39 int64_t num_ext_nodes, int64_t num_int_elems, int64_t num_bor_elems,
40 int64_t num_node_cmaps, int64_t num_elem_cmaps, int processor)
41 {
42 int status, varid;
43 int dimid_npf, dimid[3];
44 int varid_nm[3], varid_em[2];
45 char ftype[2];
46
47 int nmstat, ltempsv;
48
49 char errmsg[MAX_ERR_LENGTH];
50
51 int id_type = NC_INT;
52 int map_type = NC_INT;
53 if (ex_int64_status(exoid) & EX_IDS_INT64_DB) {
54 id_type = NC_INT64;
55 }
56 if (ex_int64_status(exoid) & EX_MAPS_INT64_DB) {
57 map_type = NC_INT64;
58 }
59 EX_UNUSED(processor);
60 /*-----------------------------Execution begins-----------------------------*/
61
62 EX_FUNC_ENTER();
63 if (exi_check_valid_file_id(exoid, __func__) == EX_FATAL) {
64 EX_FUNC_LEAVE(EX_FATAL);
65 }
66
67 /* Get the file type */
68 if (exi_get_file_type(exoid, ftype) != EX_NOERR) {
69 snprintf(errmsg, MAX_ERR_LENGTH, "ERROR: failed to get file type from file ID %d\n", exoid);
70 ex_err_fn(exoid, __func__, errmsg, EX_BADPARAM);
71 EX_FUNC_LEAVE(EX_FATAL);
72 }
73
74 /* make sure that this is a parallel file */
75 if (ftype[0] != 'p') {
76 snprintf(errmsg, MAX_ERR_LENGTH,
77 "ERROR: function for use with parallel files only, file ID %d\n", exoid);
78 ex_err_fn(exoid, __func__, errmsg, EX_BADPARAM);
79 EX_FUNC_LEAVE(EX_FATAL);
80 }
81
82 /*
83 * Get the dimension ID for the number of processors storing
84 * information in this file.
85 */
86 if ((status = nc_inq_dimid(exoid, DIM_NUM_PROCS_F, &dimid_npf)) != NC_NOERR) {
87 snprintf(errmsg, MAX_ERR_LENGTH, "ERROR: failed to find dimension ID for \"%s\" in file ID %d",
88 DIM_NUM_PROCS_F, exoid);
89 ex_err_fn(exoid, __func__, errmsg, status);
90 EX_FUNC_LEAVE(EX_FATAL);
91 }
92
93 /* Put NetCDF file into define mode */
94 if ((status = exi_redef(exoid, __func__)) != NC_NOERR) {
95 snprintf(errmsg, MAX_ERR_LENGTH, "ERROR: failed to put file id %d into define mode", exoid);
96 ex_err_fn(exoid, __func__, errmsg, status);
97 EX_FUNC_LEAVE(EX_FATAL);
98 }
99
100 /* Output the file version */
101 if ((status = exi_put_nemesis_version(exoid)) < 0) {
102 exi_leavedef(exoid, __func__);
103 EX_FUNC_LEAVE(status);
104 }
105
106 /* Define the status variables for the nodal vectors */
107 if (nc_inq_varid(exoid, VAR_INT_N_STAT, &varid) != NC_NOERR) {
108 if ((status = nc_def_var(exoid, VAR_INT_N_STAT, NC_INT, 1, &dimid_npf, &varid)) != NC_NOERR) {
109 snprintf(errmsg, MAX_ERR_LENGTH, "ERROR: failed to define variable \"%s\" in file ID %d",
110 VAR_INT_N_STAT, exoid);
111 ex_err_fn(exoid, __func__, errmsg, status);
112 /* Leave define mode before returning */
113 exi_leavedef(exoid, __func__);
114
115 EX_FUNC_LEAVE(EX_FATAL);
116 }
117 }
118
119 /* Set the dimension for status vectors */
120 if (nc_inq_varid(exoid, VAR_BOR_N_STAT, &varid) != NC_NOERR) {
121 if ((status = nc_def_var(exoid, VAR_BOR_N_STAT, NC_INT, 1, &dimid_npf, &varid)) != NC_NOERR) {
122 snprintf(errmsg, MAX_ERR_LENGTH, "ERROR: failed to define variable \"%s\" in file ID %d",
123 VAR_BOR_N_STAT, exoid);
124 ex_err_fn(exoid, __func__, errmsg, status);
125 /* Leave define mode before returning */
126 exi_leavedef(exoid, __func__);
127
128 EX_FUNC_LEAVE(EX_FATAL);
129 }
130 }
131
132 if (nc_inq_varid(exoid, VAR_EXT_N_STAT, &varid) != NC_NOERR) {
133 if ((status = nc_def_var(exoid, VAR_EXT_N_STAT, NC_INT, 1, &dimid_npf, &varid)) != NC_NOERR) {
134 snprintf(errmsg, MAX_ERR_LENGTH, "ERROR: failed to define variable \"%s\" in file ID %d",
135 VAR_EXT_N_STAT, exoid);
136 ex_err_fn(exoid, __func__, errmsg, status);
137 /* Leave define mode before returning */
138 exi_leavedef(exoid, __func__);
139
140 EX_FUNC_LEAVE(EX_FATAL);
141 }
142 }
143
144 /* Define the variable IDs for the elemental status vectors */
145 if (nc_inq_varid(exoid, VAR_INT_E_STAT, &varid) != NC_NOERR) {
146 if ((status = nc_def_var(exoid, VAR_INT_E_STAT, NC_INT, 1, &dimid_npf, &varid)) != NC_NOERR) {
147 snprintf(errmsg, MAX_ERR_LENGTH, "ERROR: failed to define variable \"%s\" in file ID %d",
148 VAR_INT_E_STAT, exoid);
149 ex_err_fn(exoid, __func__, errmsg, status);
150 /* Leave define mode before returning */
151 exi_leavedef(exoid, __func__);
152
153 EX_FUNC_LEAVE(EX_FATAL);
154 }
155 }
156
157 if (nc_inq_varid(exoid, VAR_BOR_E_STAT, &varid) != NC_NOERR) {
158 if ((status = nc_def_var(exoid, VAR_BOR_E_STAT, NC_INT, 1, &dimid_npf, &varid)) != NC_NOERR) {
159 snprintf(errmsg, MAX_ERR_LENGTH, "ERROR: Failed to define variable \"%s\" in file ID %d",
160 VAR_BOR_E_STAT, exoid);
161 ex_err_fn(exoid, __func__, errmsg, status);
162 /* Leave define mode before returning */
163 exi_leavedef(exoid, __func__);
164
165 EX_FUNC_LEAVE(EX_FATAL);
166 }
167 }
168
169 /* Get the variable ID for the nodal status vectors */
170 if ((status = nc_inq_varid(exoid, VAR_INT_N_STAT, &varid_nm[0])) != NC_NOERR) {
171 snprintf(errmsg, MAX_ERR_LENGTH, "ERROR: failed to find variable ID for \"%s\" in file ID %d",
172 VAR_INT_N_STAT, exoid);
173 ex_err_fn(exoid, __func__, errmsg, status);
174 /* Leave define mode before returning */
175 exi_leavedef(exoid, __func__);
176
177 EX_FUNC_LEAVE(EX_FATAL);
178 }
179
180 if ((status = nc_inq_varid(exoid, VAR_BOR_N_STAT, &varid_nm[1])) != NC_NOERR) {
181 snprintf(errmsg, MAX_ERR_LENGTH, "ERROR: failed to find variable ID for \"%s\" in file ID %d",
182 VAR_BOR_N_STAT, exoid);
183 ex_err_fn(exoid, __func__, errmsg, status);
184 /* Leave define mode before returning */
185 exi_leavedef(exoid, __func__);
186
187 EX_FUNC_LEAVE(EX_FATAL);
188 }
189
190 if ((status = nc_inq_varid(exoid, VAR_EXT_N_STAT, &varid_nm[2])) != NC_NOERR) {
191 snprintf(errmsg, MAX_ERR_LENGTH, "ERROR: failed to find variable ID for \"%s\" in file ID %d",
192 VAR_EXT_N_STAT, exoid);
193 ex_err_fn(exoid, __func__, errmsg, status);
194 /* Leave define mode before returning */
195 exi_leavedef(exoid, __func__);
196
197 EX_FUNC_LEAVE(EX_FATAL);
198 }
199
200 /* Define variable for the internal element information */
201 if (num_int_elems > 0) {
202 ltempsv = num_int_elems;
203 if ((status = nc_def_dim(exoid, DIM_NUM_INT_ELEMS, ltempsv, &dimid[0])) != NC_NOERR) {
204 snprintf(errmsg, MAX_ERR_LENGTH, "ERROR: failed to dimension \"%s\" in file id %d",
205 DIM_NUM_INT_ELEMS, exoid);
206 ex_err_fn(exoid, __func__, errmsg, status);
207 /* Leave define mode before returning */
208 exi_leavedef(exoid, __func__);
209
210 EX_FUNC_LEAVE(EX_FATAL);
211 }
212
213 if ((status = nc_def_var(exoid, VAR_ELEM_MAP_INT, map_type, 1, dimid, &varid)) != NC_NOERR) {
214 snprintf(errmsg, MAX_ERR_LENGTH, "ERROR: failed to define variable \"%s\" in file ID %d",
215 VAR_ELEM_MAP_INT, exoid);
216 ex_err_fn(exoid, __func__, errmsg, status);
217 /* Leave define mode before returning */
218 exi_leavedef(exoid, __func__);
219
220 EX_FUNC_LEAVE(EX_FATAL);
221 }
222 exi_compress_variable(exoid, varid, 1);
223
224 } /* End "if (num_int_elems > 0)" */
225
226 /* Get the variable IDs for the elemental status vectors */
227 if ((status = nc_inq_varid(exoid, VAR_INT_E_STAT, &varid_em[0])) != NC_NOERR) {
228 snprintf(errmsg, MAX_ERR_LENGTH, "ERROR: failed to find variable ID for \"%s\" in file ID %d",
229 VAR_INT_E_STAT, exoid);
230 ex_err_fn(exoid, __func__, errmsg, status);
231 /* Leave define mode before returning */
232 exi_leavedef(exoid, __func__);
233
234 EX_FUNC_LEAVE(EX_FATAL);
235 }
236
237 if ((status = nc_inq_varid(exoid, VAR_BOR_E_STAT, &varid_em[1])) != NC_NOERR) {
238 snprintf(errmsg, MAX_ERR_LENGTH, "ERROR: failed to find variable ID for \"%s\" in file ID %d",
239 VAR_BOR_E_STAT, exoid);
240 ex_err_fn(exoid, __func__, errmsg, status);
241 /* Leave define mode before returning */
242 exi_leavedef(exoid, __func__);
243
244 EX_FUNC_LEAVE(EX_FATAL);
245 }
246
247 /* Define variable for the border element information */
248 if (num_bor_elems > 0) {
249 ltempsv = num_bor_elems;
250 if ((status = nc_def_dim(exoid, DIM_NUM_BOR_ELEMS, ltempsv, &dimid[0])) != NC_NOERR) {
251 snprintf(errmsg, MAX_ERR_LENGTH, "ERROR: failed to dimension \"%s\" in file id %d",
252 DIM_NUM_BOR_ELEMS, exoid);
253 ex_err_fn(exoid, __func__, errmsg, status);
254 /* Leave define mode before returning */
255 exi_leavedef(exoid, __func__);
256
257 EX_FUNC_LEAVE(EX_FATAL);
258 }
259
260 if ((status = nc_def_var(exoid, VAR_ELEM_MAP_BOR, map_type, 1, dimid, &varid)) != NC_NOERR) {
261 snprintf(errmsg, MAX_ERR_LENGTH, "ERROR: failed to define variable \"%s\" in file ID %d",
262 VAR_ELEM_MAP_BOR, exoid);
263 ex_err_fn(exoid, __func__, errmsg, status);
264 /* Leave define mode before returning */
265 exi_leavedef(exoid, __func__);
266
267 EX_FUNC_LEAVE(EX_FATAL);
268 }
269 exi_compress_variable(exoid, varid, 1);
270
271 } /* End "if (num_bor_elems > 0)" */
272
273 if (num_int_nodes > 0) {
274 /* Define variable for vector of internal FEM node IDs */
275 ltempsv = num_int_nodes;
276 if ((status = nc_def_dim(exoid, DIM_NUM_INT_NODES, ltempsv, &dimid[0])) != NC_NOERR) {
277 snprintf(errmsg, MAX_ERR_LENGTH, "ERROR: failed to dimension \"%s\" in file id %d",
278 DIM_NUM_INT_NODES, exoid);
279 ex_err_fn(exoid, __func__, errmsg, status);
280 /* Leave define mode before returning */
281 exi_leavedef(exoid, __func__);
282
283 EX_FUNC_LEAVE(EX_FATAL);
284 }
285
286 if ((status = nc_def_var(exoid, VAR_NODE_MAP_INT, map_type, 1, &dimid[0], &varid)) !=
287 NC_NOERR) {
288 snprintf(errmsg, MAX_ERR_LENGTH, "ERROR: failed to define variable \"%s\" in file ID %d",
289 VAR_NODE_MAP_INT, exoid);
290 ex_err_fn(exoid, __func__, errmsg, status);
291 /* Leave define mode before returning */
292 exi_leavedef(exoid, __func__);
293
294 EX_FUNC_LEAVE(EX_FATAL);
295 }
296 exi_compress_variable(exoid, varid, 1);
297
298 } /* End "if (num_int_nodes > 0)" */
299
300 if (num_bor_nodes > 0) {
301 /* Define variable for vector of border FEM node IDs */
302 ltempsv = num_bor_nodes;
303 if ((status = nc_def_dim(exoid, DIM_NUM_BOR_NODES, ltempsv, &dimid[1])) != NC_NOERR) {
304 snprintf(errmsg, MAX_ERR_LENGTH, "ERROR: failed to dimension \"%s\" in file id %d",
305 DIM_NUM_BOR_NODES, exoid);
306 ex_err_fn(exoid, __func__, errmsg, status);
307 /* Leave define mode before returning */
308 exi_leavedef(exoid, __func__);
309
310 EX_FUNC_LEAVE(EX_FATAL);
311 }
312
313 if ((status = nc_def_var(exoid, VAR_NODE_MAP_BOR, map_type, 1, &dimid[1], &varid)) !=
314 NC_NOERR) {
315 snprintf(errmsg, MAX_ERR_LENGTH, "ERROR: failed to define variable \"%s\" in file ID %d",
316 VAR_NODE_MAP_BOR, exoid);
317 ex_err_fn(exoid, __func__, errmsg, status);
318 /* Leave define mode before returning */
319 exi_leavedef(exoid, __func__);
320
321 EX_FUNC_LEAVE(EX_FATAL);
322 }
323 exi_compress_variable(exoid, varid, 1);
324
325 } /* End "if (num_bor_nodes > 0)" */
326
327 if (num_ext_nodes > 0) {
328 /* Define dimension for vector of external FEM node IDs */
329 ltempsv = num_ext_nodes;
330 if ((status = nc_def_dim(exoid, DIM_NUM_EXT_NODES, ltempsv, &dimid[2])) != NC_NOERR) {
331 snprintf(errmsg, MAX_ERR_LENGTH, "ERROR: failed to dimension \"%s\" in file id %d",
332 DIM_NUM_EXT_NODES, exoid);
333 ex_err_fn(exoid, __func__, errmsg, status);
334 /* Leave define mode before returning */
335 exi_leavedef(exoid, __func__);
336
337 EX_FUNC_LEAVE(EX_FATAL);
338 }
339
340 if ((status = nc_def_var(exoid, VAR_NODE_MAP_EXT, map_type, 1, &dimid[2], &varid)) !=
341 NC_NOERR) {
342 snprintf(errmsg, MAX_ERR_LENGTH, "ERROR: failed to define variable \"%s\" in file ID %d",
343 VAR_NODE_MAP_EXT, exoid);
344 ex_err_fn(exoid, __func__, errmsg, status);
345 /* Leave define mode before returning */
346 exi_leavedef(exoid, __func__);
347
348 EX_FUNC_LEAVE(EX_FATAL);
349 }
350 exi_compress_variable(exoid, varid, 1);
351
352 } /* End "if (num_ext_nodes > 0)" */
353
354 /* Add the nodal communication map count */
355 if (num_node_cmaps > 0) {
356 ltempsv = num_node_cmaps;
357 if ((status = nc_def_dim(exoid, DIM_NUM_N_CMAPS, ltempsv, &dimid[0])) != NC_NOERR) {
358 snprintf(errmsg, MAX_ERR_LENGTH, "ERROR: failed to add dimension \"%s\" in file ID %d",
359 DIM_NUM_N_CMAPS, exoid);
360 ex_err_fn(exoid, __func__, errmsg, status);
361 /* Leave define mode before returning */
362 exi_leavedef(exoid, __func__);
363
364 EX_FUNC_LEAVE(EX_FATAL);
365 }
366
367 /* Add the ID vector */
368 if ((status = nc_def_var(exoid, VAR_N_COMM_IDS, id_type, 1, dimid, &varid)) != NC_NOERR) {
369 snprintf(errmsg, MAX_ERR_LENGTH, "ERROR: failed to define variable \"%s\" in file ID %d",
370 VAR_N_COMM_IDS, exoid);
371 ex_err_fn(exoid, __func__, errmsg, status);
372 /* Leave define mode before returning */
373 exi_leavedef(exoid, __func__);
374
375 EX_FUNC_LEAVE(EX_FATAL);
376 }
377 exi_compress_variable(exoid, varid, 1);
378
379 /* Add the status vector */
380 if ((status = nc_def_var(exoid, VAR_N_COMM_STAT, NC_INT, 1, dimid, &varid)) != NC_NOERR) {
381 snprintf(errmsg, MAX_ERR_LENGTH, "ERROR: failed to define variable \"%s\" in file ID %d",
382 VAR_N_COMM_STAT, exoid);
383 ex_err_fn(exoid, __func__, errmsg, status);
384 /* Leave define mode before returning */
385 exi_leavedef(exoid, __func__);
386
387 EX_FUNC_LEAVE(EX_FATAL);
388 }
389
390 } /* End "if (num_node_cmaps > 0)" */
391
392 /* Add the nodal communication map count */
393 if (num_elem_cmaps > 0) {
394 ltempsv = num_elem_cmaps;
395 if ((status = nc_def_dim(exoid, DIM_NUM_E_CMAPS, ltempsv, &dimid[0])) != NC_NOERR) {
396 snprintf(errmsg, MAX_ERR_LENGTH, "ERROR: failed to add dimension \"%s\" in file ID %d",
397 DIM_NUM_E_CMAPS, exoid);
398 ex_err_fn(exoid, __func__, errmsg, status);
399 /* Leave define mode before returning */
400 exi_leavedef(exoid, __func__);
401
402 EX_FUNC_LEAVE(EX_FATAL);
403 }
404
405 /* Add variables for elemental communication maps */
406 if ((status = nc_def_var(exoid, VAR_E_COMM_IDS, id_type, 1, dimid, &varid)) != NC_NOERR) {
407 snprintf(errmsg, MAX_ERR_LENGTH, "ERROR: failed to define variable \"%s\" in file ID %d",
408 VAR_E_COMM_IDS, exoid);
409 ex_err_fn(exoid, __func__, errmsg, status);
410 /* Leave define mode before returning */
411 exi_leavedef(exoid, __func__);
412
413 EX_FUNC_LEAVE(EX_FATAL);
414 }
415 exi_compress_variable(exoid, varid, 1);
416
417 if ((status = nc_def_var(exoid, VAR_E_COMM_STAT, NC_INT, 1, dimid, &varid)) != NC_NOERR) {
418 snprintf(errmsg, MAX_ERR_LENGTH, "ERROR: failed to define variable \"%s\" in file ID %d",
419 VAR_E_COMM_STAT, exoid);
420 ex_err_fn(exoid, __func__, errmsg, status);
421 /* Leave define mode before returning */
422 exi_leavedef(exoid, __func__);
423
424 EX_FUNC_LEAVE(EX_FATAL);
425 }
426
427 } /* End "if (num_elem_cmaps > 0)" */
428
429 /* Leave define mode */
430 if (exi_leavedef(exoid, __func__) != EX_NOERR) {
431 EX_FUNC_LEAVE(EX_FATAL);
432 }
433
434 /*
435 ** Set up status vector for internal node map
436 ** NOTE(9/26/96): this function is no longer valid
437 ** for scaler files, so no need to check for file type
438 */
439 if (num_int_nodes == 0) {
440 /* NULL set for internal nodes */
441 nmstat = 0;
442 if ((status = nc_put_var_int(exoid, varid_nm[0], &nmstat)) != NC_NOERR) {
443 snprintf(errmsg, MAX_ERR_LENGTH,
444 "ERROR: failed to output status for int node map in file ID %d", exoid);
445 ex_err_fn(exoid, __func__, errmsg, status);
446 EX_FUNC_LEAVE(EX_FATAL);
447 }
448 }
449 else {
450 nmstat = 1;
451 if ((status = nc_put_var_int(exoid, varid_nm[0], &nmstat)) != NC_NOERR) {
452 snprintf(errmsg, MAX_ERR_LENGTH,
453 "ERROR: failed to output status for int node map in file ID %d", exoid);
454 ex_err_fn(exoid, __func__, errmsg, status);
455 EX_FUNC_LEAVE(EX_FATAL);
456 }
457
458 } /* End "if (num_int_nodes == 0)" */
459
460 /* Set up status vector for border node map */
461 if (num_bor_nodes == 0) {
462 /* NULL set for border nodes */
463 nmstat = 0;
464 if ((status = nc_put_var_int(exoid, varid_nm[1], &nmstat)) != NC_NOERR) {
465 snprintf(errmsg, MAX_ERR_LENGTH,
466 "ERROR: failed to output status for bor node map in file ID %d", exoid);
467 ex_err_fn(exoid, __func__, errmsg, status);
468 EX_FUNC_LEAVE(EX_FATAL);
469 }
470 }
471 else {
472 /* Set the status indicating non-NULL size */
473 nmstat = 1;
474 if ((status = nc_put_var_int(exoid, varid_nm[1], &nmstat)) != NC_NOERR) {
475 snprintf(errmsg, MAX_ERR_LENGTH,
476 "ERROR: failed to output status for bor node map in file ID %d", exoid);
477 ex_err_fn(exoid, __func__, errmsg, status);
478 EX_FUNC_LEAVE(EX_FATAL);
479 }
480
481 } /* End "if (num_bor_nodes == 0)" */
482
483 /* Set up status vector for external node map */
484 if (num_ext_nodes == 0) {
485 /* NULL set for external nodes */
486 nmstat = 0;
487 if ((status = nc_put_var_int(exoid, varid_nm[2], &nmstat)) != NC_NOERR) {
488 snprintf(errmsg, MAX_ERR_LENGTH,
489 "ERROR: failed to output status for ext node map in file ID %d", exoid);
490 ex_err_fn(exoid, __func__, errmsg, status);
491 EX_FUNC_LEAVE(EX_FATAL);
492 }
493 }
494 else {
495 /* Set the status indicating non-NULL size */
496 nmstat = 1;
497 if ((status = nc_put_var_int(exoid, varid_nm[2], &nmstat)) != NC_NOERR) {
498 snprintf(errmsg, MAX_ERR_LENGTH,
499 "ERROR: failed to output status for ext node map in file ID %d", exoid);
500 ex_err_fn(exoid, __func__, errmsg, status);
501 EX_FUNC_LEAVE(EX_FATAL);
502 }
503
504 } /* End "if (num_ext_nodes == 0)" */
505
506 /* Set up status vector for internal element map */
507 if (num_int_elems == 0) {
508 /* NULL set for internal elements */
509 nmstat = 0;
510 if ((status = nc_put_var_int(exoid, varid_em[0], &nmstat)) != NC_NOERR) {
511 snprintf(errmsg, MAX_ERR_LENGTH,
512 "ERROR: failed to output status for int elem map in file ID %d", exoid);
513 ex_err_fn(exoid, __func__, errmsg, status);
514 EX_FUNC_LEAVE(EX_FATAL);
515 }
516 }
517 else {
518 /* Set the status indicating non-NULL size */
519 nmstat = 1;
520 if ((status = nc_put_var_int(exoid, varid_em[0], &nmstat)) != NC_NOERR) {
521 snprintf(errmsg, MAX_ERR_LENGTH,
522 "ERROR: failed to output status for int elem map in file ID %d", exoid);
523 ex_err_fn(exoid, __func__, errmsg, status);
524 EX_FUNC_LEAVE(EX_FATAL);
525 }
526
527 } /* End "if (num_int_elems == 0)" */
528
529 /* Set up status vector for border element map */
530 if (num_bor_elems == 0) {
531 /* NULL set for internal elements */
532 nmstat = 0;
533 if ((status = nc_put_var_int(exoid, varid_em[1], &nmstat)) != NC_NOERR) {
534 snprintf(errmsg, MAX_ERR_LENGTH,
535 "ERROR: failed to output status for bor elem map in file ID %d", exoid);
536 ex_err_fn(exoid, __func__, errmsg, status);
537 EX_FUNC_LEAVE(EX_FATAL);
538 }
539 }
540 else {
541 /* Set the status indicating non-NULL size */
542 nmstat = 1;
543 if ((status = nc_put_var_int(exoid, varid_em[1], &nmstat)) != NC_NOERR) {
544 snprintf(errmsg, MAX_ERR_LENGTH,
545 "ERROR: failed to output status for bor elem map in file ID %d", exoid);
546 ex_err_fn(exoid, __func__, errmsg, status);
547 EX_FUNC_LEAVE(EX_FATAL);
548 }
549
550 } /* End "if (num_bor_elems == 0)" */
551
552 EX_FUNC_LEAVE(EX_NOERR);
553 }