| 1 |
/* |
| 2 |
* Copyright (c) 1998 Sandia Corporation. Under the terms of Contract |
| 3 |
* DE-AC04-94AL85000 with Sandia Corporation, the U.S. Governement |
| 4 |
* retains certain rights in this software. |
| 5 |
* |
| 6 |
* Redistribution and use in source and binary forms, with or without |
| 7 |
* modification, are permitted provided that the following conditions are |
| 8 |
* met: |
| 9 |
* |
| 10 |
* * Redistributions of source code must retain the above copyright |
| 11 |
* notice, this list of conditions and the following disclaimer. |
| 12 |
* |
| 13 |
* * Redistributions in binary form must reproduce the above |
| 14 |
* copyright notice, this list of conditions and the following |
| 15 |
* disclaimer in the documentation and/or other materials provided |
| 16 |
* with the distribution. |
| 17 |
* |
| 18 |
* * Neither the name of Sandia Corporation nor the names of its |
| 19 |
* contributors may be used to endorse or promote products derived |
| 20 |
* from this software without specific prior written permission. |
| 21 |
* |
| 22 |
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS |
| 23 |
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT |
| 24 |
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR |
| 25 |
* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT |
| 26 |
* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, |
| 27 |
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT |
| 28 |
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, |
| 29 |
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY |
| 30 |
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT |
| 31 |
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE |
| 32 |
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
| 33 |
* |
| 34 |
*/ |
| 35 |
/*==================================================================== |
| 36 |
* ------------------------ |
| 37 |
* | CVS File Information | |
| 38 |
* ------------------------ |
| 39 |
* |
| 40 |
* $RCSfile: ne_jack.src,v $ |
| 41 |
* |
| 42 |
* $Author: gdsjaar $ |
| 43 |
* |
| 44 |
* $Date: 2007/10/31 21:39:17 $ |
| 45 |
* |
| 46 |
* $Revision: 1.14 $ |
| 47 |
* |
| 48 |
*====================================================================*/ |
| 49 |
/* |
| 50 |
* OVERVIEW |
| 51 |
* |
| 52 |
* This file contains jacket routines written in C for interfacing Fortran |
| 53 |
* NemesisI function calls to the actual C binding for NemsisI. This code |
| 54 |
* is written explicitly for DARWIN. In general, these functions handle |
| 55 |
* character-string parameter conventions, convert between |
| 56 |
* column-major-order arrays and row-major-order arrays, and map between |
| 57 |
* array indices beginning at one and array indices beginning at zero. |
| 58 |
* |
| 59 |
*/ |
| 60 |
|
| 61 |
/* LINTLIBRARY */ |
| 62 |
#include <ctype.h> |
| 63 |
#include <string.h> |
| 64 |
#include <stdio.h> |
| 65 |
#include <stdlib.h> |
| 66 |
#include "netcdf.h" |
| 67 |
#include "exodusII.h" |
| 68 |
#include "exodusII_int.h" |
| 69 |
|
| 70 |
/* |
| 71 |
* The Build64 is for the "normal" SEACAS build which uses compiler |
| 72 |
* options to change reals and integers into 8-byte quantities. The |
| 73 |
* routines in addrwrap.F are used to down-convert the 8-byte integers |
| 74 |
* into 4-byte integers which then call through to the routines in |
| 75 |
* this file which have a '4' or '4_' appended to the routine name. |
| 76 |
* These routines then call through to the C API routines. |
| 77 |
* |
| 78 |
* If DEFAULT_REAL_INT is defined, then the build is to build a |
| 79 |
* fortran library interface that takes 4-byte ints and either 4-byte |
| 80 |
* or 8-byte floating point (real/double) variables. In this case, the |
| 81 |
* addrwrap routines are not built and a fortran client will call the |
| 82 |
* routines in this file directly. |
| 83 |
* |
| 84 |
*/ |
| 85 |
#if defined(Build64) && !defined(DEFAULT_REAL_INT) |
| 86 |
/* 64-bit */ |
| 87 |
typedef double real; |
| 88 |
typedef ex_entity_id entity_id; |
| 89 |
#ifdef ADDC_ |
| 90 |
#define F2C(name) name##4_ |
| 91 |
#else |
| 92 |
#define F2C(name) name##4 |
| 93 |
#endif |
| 94 |
|
| 95 |
#else |
| 96 |
/* 32-bit */ |
| 97 |
typedef float real; |
| 98 |
typedef int entity_id; |
| 99 |
#ifdef ADDC_ |
| 100 |
#define F2C(name) name##_ |
| 101 |
#else |
| 102 |
#define F2C(name) name |
| 103 |
#endif |
| 104 |
#endif |
| 105 |
|
| 106 |
|
| 107 |
|
| 108 |
extern int ncopts; /* default is (NC_FATAL | NC_VERBOSE) */ |
| 109 |
extern int exerrval; /* global int that contains a Exodus-specific error code */ |
| 110 |
|
| 111 |
/* blank fill C string to make FORTRAN string */ |
| 112 |
static void |
| 113 |
ex_fcdcpy (char *fstring, size_t fslen, char *sstring) |
| 114 |
/* output string to be blank-filled */ |
| 115 |
/* length of output string */ |
| 116 |
/* input string, null-terminated */ |
| 117 |
{ |
| 118 |
size_t i, len = strlen(sstring); |
| 119 |
|
| 120 |
for (i = 0; i < len; i++) |
| 121 |
*(fstring + i) = *(sstring + i); |
| 122 |
for (i = len; i < fslen; i++) |
| 123 |
*(fstring + i) = ' '; |
| 124 |
} |
| 125 |
|
| 126 |
/* copy function used to copy strings and strip trailing blanks */ |
| 127 |
static void |
| 128 |
ex_fstrncpy (char *target, char *source, size_t maxlen) |
| 129 |
/* space to be copied into */ |
| 130 |
/* string to be copied */ |
| 131 |
/* maximum length of *source */ |
| 132 |
{ |
| 133 |
while (maxlen-- && *source != '\0') |
| 134 |
*target++ = *source++; |
| 135 |
while (*(--target) == ' '); /* strip blanks */ |
| 136 |
*(++target) = '\0'; /* insert new EOS marker */ |
| 137 |
} |
| 138 |
|
| 139 |
/* Above are utility functions used below */ |
| 140 |
/* ======================================================================== */ |
| 141 |
/* Below are the nemesis API functions */ |
| 142 |
/* |
| 143 |
* Adding a new function: |
| 144 |
* + Protect the name with the f2c (uppercase) macro which will add/not add '4' and or '_' |
| 145 |
* depending on the compilation mode. |
| 146 |
* |
| 147 |
* + float/double arguments are declared as 'real' which will be replaced with float or double. |
| 148 |
* |
| 149 |
* + If there are any character arguments 'X', then add an int* argument 'Xlen' at end of argument list |
| 150 |
* This will contain the length of the passed in character argument. |
| 151 |
* |
| 152 |
* + Look at existing functions for guidance... |
| 153 |
*/ |
| 154 |
|
| 155 |
/* |
| 156 |
* Get initial information from nemesis file |
| 157 |
*/ |
| 158 |
void |
| 159 |
F2C(negii)(int *idne, |
| 160 |
int *nproc, |
| 161 |
int *nproc_in_f, |
| 162 |
char *ftype, |
| 163 |
int *ierr, |
| 164 |
size_t ftypelen) |
| 165 |
{ |
| 166 |
size_t slen = 1; |
| 167 |
char *file_type; |
| 168 |
|
| 169 |
/* WARNING: ftypelen SHOULD be 1, but may not be depending on how |
| 170 |
the Fortran programmer passed it. It is best at |
| 171 |
this time to hard code it per NEPII spec. */ |
| 172 |
if (ftypelen != 1) { |
| 173 |
#if defined(EXODUS_STRING_LENGTH_WARNING) |
| 174 |
char errmsg[MAX_ERR_LENGTH]; |
| 175 |
sprintf(errmsg,"Warning: file type string length is %d in file id %d\n", |
| 176 |
ftypelen, *idne); |
| 177 |
ex_err("negii",errmsg,EX_MSG); |
| 178 |
#endif |
| 179 |
slen = ftypelen; |
| 180 |
} |
| 181 |
|
| 182 |
file_type = (char *) malloc((slen+1)*sizeof(char)); |
| 183 |
|
| 184 |
if ((*ierr = ex_get_init_info(*idne, nproc, nproc_in_f, file_type)) != 0) { |
| 185 |
char errmsg[MAX_ERR_LENGTH]; |
| 186 |
sprintf(errmsg, |
| 187 |
"Error: failed to get initial information from file id %d", |
| 188 |
*idne); |
| 189 |
ex_err("negii",errmsg,EX_MSG); |
| 190 |
} |
| 191 |
|
| 192 |
if (*ierr == 0) |
| 193 |
ex_fcdcpy (ftype, slen, file_type); |
| 194 |
|
| 195 |
free(file_type); |
| 196 |
} |
| 197 |
|
| 198 |
/* |
| 199 |
* Write initial information from nemesis file |
| 200 |
*/ |
| 201 |
void |
| 202 |
F2C(nepii)(int *idne, |
| 203 |
int *nproc, |
| 204 |
int *nproc_in_f, |
| 205 |
char *ftype, |
| 206 |
int *ierr, |
| 207 |
size_t ftypelen) |
| 208 |
{ |
| 209 |
|
| 210 |
char errmsg[MAX_ERR_LENGTH]; |
| 211 |
|
| 212 |
size_t slen = 1; |
| 213 |
char *file_type; |
| 214 |
|
| 215 |
/* WARNING: ftypelen SHOULD be 1, but may not be depending on how |
| 216 |
the Fortran programmer passed it. It is best at |
| 217 |
this time to hard code it per NEPII spec. */ |
| 218 |
if (ftypelen != 1) { |
| 219 |
slen = ftypelen; |
| 220 |
#if defined(EXODUS_STRING_LENGTH_WARNING) |
| 221 |
sprintf(errmsg,"Warning: file type string length is %d in file id %d\n", |
| 222 |
ftypelen, *idne); |
| 223 |
ex_err("nepii",errmsg,EX_MSG); |
| 224 |
#endif |
| 225 |
} |
| 226 |
|
| 227 |
file_type = (char *) malloc((slen+1)*sizeof(char)); |
| 228 |
|
| 229 |
ex_fstrncpy (file_type, ftype, slen); |
| 230 |
|
| 231 |
if ((*ierr = ex_put_init_info(*idne, *nproc, *nproc_in_f, file_type)) != 0) |
| 232 |
{ |
| 233 |
sprintf(errmsg, |
| 234 |
"Error: failed to put initial information in file id %d", |
| 235 |
*idne); |
| 236 |
ex_err("nepii",errmsg,EX_MSG); |
| 237 |
} |
| 238 |
|
| 239 |
free(file_type); |
| 240 |
} |
| 241 |
|
| 242 |
/* |
| 243 |
* Read initial global information |
| 244 |
*/ |
| 245 |
void |
| 246 |
F2C(negig)(int *idne, |
| 247 |
void_int *nnodes_g, |
| 248 |
void_int *nelems_g, |
| 249 |
void_int *nelem_blks_g, |
| 250 |
void_int *nnode_sets_g, |
| 251 |
void_int *nside_sets_g, |
| 252 |
int *ierr) |
| 253 |
{ |
| 254 |
if ((*ierr = ex_get_init_global(*idne, nnodes_g, nelems_g, nelem_blks_g, |
| 255 |
nnode_sets_g, nside_sets_g)) != 0) { |
| 256 |
char errmsg[MAX_ERR_LENGTH]; |
| 257 |
sprintf(errmsg, |
| 258 |
"Error: failed to read initial global information from file id %d", |
| 259 |
*idne); |
| 260 |
ex_err("negig",errmsg,EX_MSG); |
| 261 |
} |
| 262 |
} |
| 263 |
|
| 264 |
/* |
| 265 |
* Write initial global information |
| 266 |
*/ |
| 267 |
void |
| 268 |
F2C(nepig)(int *idne, |
| 269 |
void_int *nnodes_g, |
| 270 |
void_int *nelems_g, |
| 271 |
void_int *nelem_blks_g, |
| 272 |
void_int *nnode_sets_g, |
| 273 |
void_int *nside_sets_g, |
| 274 |
int *ierr) |
| 275 |
{ |
| 276 |
if (ex_int64_status(*idne) & EX_BULK_INT64_API) { |
| 277 |
int64_t *n_nnodes_g = (int64_t*)nnodes_g; |
| 278 |
int64_t *n_nelems_g = (int64_t*)nelems_g; |
| 279 |
int64_t *n_nelem_blks_g = (int64_t*)nelem_blks_g; |
| 280 |
int64_t *n_nnode_sets_g = (int64_t*)nnode_sets_g; |
| 281 |
int64_t *n_nside_sets_g = (int64_t*)nside_sets_g; |
| 282 |
*ierr = ex_put_init_global(*idne, *n_nnodes_g, *n_nelems_g, *n_nelem_blks_g, |
| 283 |
*n_nnode_sets_g, *n_nside_sets_g); |
| 284 |
} else { |
| 285 |
int *n_nnodes_g = (int*)nnodes_g; |
| 286 |
int *n_nelems_g = (int*)nelems_g; |
| 287 |
int *n_nelem_blks_g = (int*)nelem_blks_g; |
| 288 |
int *n_nnode_sets_g = (int*)nnode_sets_g; |
| 289 |
int *n_nside_sets_g = (int*)nside_sets_g; |
| 290 |
*ierr = ex_put_init_global(*idne, *n_nnodes_g, *n_nelems_g, *n_nelem_blks_g, |
| 291 |
*n_nnode_sets_g, *n_nside_sets_g); |
| 292 |
} |
| 293 |
|
| 294 |
if (*ierr != 0) { |
| 295 |
char errmsg[MAX_ERR_LENGTH]; |
| 296 |
sprintf(errmsg, |
| 297 |
"Error: failed to store initial global information in file id %d", |
| 298 |
*idne); |
| 299 |
ex_err("nepig",errmsg,EX_MSG); |
| 300 |
} |
| 301 |
} |
| 302 |
|
| 303 |
/* |
| 304 |
* Read load balance parameters |
| 305 |
*/ |
| 306 |
void |
| 307 |
F2C(neglbp)(int *idne, |
| 308 |
void_int *nint_nodes, |
| 309 |
void_int *nbor_nodes, |
| 310 |
void_int *next_nodes, |
| 311 |
void_int *nint_elems, |
| 312 |
void_int *nbor_elems, |
| 313 |
void_int *nnode_cmaps, |
| 314 |
void_int *nelem_cmaps, |
| 315 |
int *processor, |
| 316 |
int *ierr) |
| 317 |
{ |
| 318 |
if ((*ierr = ex_get_loadbal_param(*idne, nint_nodes, nbor_nodes, |
| 319 |
next_nodes, nint_elems, nbor_elems, |
| 320 |
nnode_cmaps, nelem_cmaps, *processor)) != 0) { |
| 321 |
char errmsg[MAX_ERR_LENGTH]; |
| 322 |
sprintf(errmsg, |
| 323 |
"Error: failed to read load balance parameters from file id %d", |
| 324 |
*idne); |
| 325 |
ex_err("neglbp",errmsg,EX_MSG); |
| 326 |
} |
| 327 |
} |
| 328 |
|
| 329 |
/* |
| 330 |
* Write load balance parameters |
| 331 |
*/ |
| 332 |
void |
| 333 |
F2C(neplbp)(int *idne, |
| 334 |
void_int *nint_nodes, |
| 335 |
void_int *nbor_nodes, |
| 336 |
void_int *next_nodes, |
| 337 |
void_int *nint_elems, |
| 338 |
void_int *nbor_elems, |
| 339 |
void_int *nnode_cmaps, |
| 340 |
void_int *nelem_cmaps, |
| 341 |
int *processor, |
| 342 |
int *ierr) |
| 343 |
{ |
| 344 |
if (ex_int64_status(*idne) & EX_BULK_INT64_API) { |
| 345 |
int64_t *n_nint_nodes = (int64_t*)nint_nodes; |
| 346 |
int64_t *n_nbor_nodes = (int64_t*)nbor_nodes; |
| 347 |
int64_t *n_next_nodes = (int64_t*)next_nodes; |
| 348 |
int64_t *n_nint_elems = (int64_t*)nint_elems; |
| 349 |
int64_t *n_nbor_elems = (int64_t*)nbor_elems; |
| 350 |
int64_t *n_nnode_cmaps = (int64_t*)nnode_cmaps; |
| 351 |
int64_t *n_nelem_cmaps = (int64_t*)nelem_cmaps; |
| 352 |
*ierr = ex_put_loadbal_param(*idne, *n_nint_nodes, *n_nbor_nodes, |
| 353 |
*n_next_nodes, *n_nint_elems, *n_nbor_elems, |
| 354 |
*n_nnode_cmaps, *n_nelem_cmaps, |
| 355 |
*processor); |
| 356 |
} else { |
| 357 |
int *n_nint_nodes = (int*)nint_nodes; |
| 358 |
int *n_nbor_nodes = (int*)nbor_nodes; |
| 359 |
int *n_next_nodes = (int*)next_nodes; |
| 360 |
int *n_nint_elems = (int*)nint_elems; |
| 361 |
int *n_nbor_elems = (int*)nbor_elems; |
| 362 |
int *n_nnode_cmaps = (int*)nnode_cmaps; |
| 363 |
int *n_nelem_cmaps = (int*)nelem_cmaps; |
| 364 |
*ierr = ex_put_loadbal_param(*idne, *n_nint_nodes, *n_nbor_nodes, |
| 365 |
*n_next_nodes, *n_nint_elems, *n_nbor_elems, |
| 366 |
*n_nnode_cmaps, *n_nelem_cmaps, |
| 367 |
*processor); |
| 368 |
} |
| 369 |
if (*ierr != 0) { |
| 370 |
char errmsg[MAX_ERR_LENGTH]; |
| 371 |
sprintf(errmsg, |
| 372 |
"Error: failed to store load balance parameters in file id %d", |
| 373 |
*idne); |
| 374 |
ex_err("neplbp",errmsg,EX_MSG); |
| 375 |
} |
| 376 |
} |
| 377 |
|
| 378 |
/* |
| 379 |
* Write concatenated load balance parameters |
| 380 |
*/ |
| 381 |
void |
| 382 |
F2C(neplbpc)(int *idne, |
| 383 |
void_int *nint_nodes, |
| 384 |
void_int *nbor_nodes, |
| 385 |
void_int *next_nodes, |
| 386 |
void_int *nint_elems, |
| 387 |
void_int *nbor_elems, |
| 388 |
void_int *nnode_cmaps, |
| 389 |
void_int *nelem_cmaps, |
| 390 |
int *ierr) |
| 391 |
{ |
| 392 |
if ((*ierr = ex_put_loadbal_param_cc(*idne, nint_nodes, nbor_nodes, |
| 393 |
next_nodes, nint_elems, nbor_elems, |
| 394 |
nnode_cmaps, nelem_cmaps)) != 0) { |
| 395 |
char errmsg[MAX_ERR_LENGTH]; |
| 396 |
sprintf(errmsg, |
| 397 |
"Error: failed to store load balance parameters in file id %d", |
| 398 |
*idne); |
| 399 |
ex_err("neplbpc",errmsg,EX_MSG); |
| 400 |
} |
| 401 |
} |
| 402 |
|
| 403 |
/* |
| 404 |
* Read global node set parameters |
| 405 |
*/ |
| 406 |
void |
| 407 |
F2C(negnspg)(int *idne, |
| 408 |
void_int *ns_ids_glob, |
| 409 |
void_int *ns_n_cnt_glob, |
| 410 |
void_int *ns_df_cnt_glob, |
| 411 |
int *ierr) |
| 412 |
{ |
| 413 |
if ((*ierr = ex_get_ns_param_global(*idne, ns_ids_glob, ns_n_cnt_glob, ns_df_cnt_glob)) != 0) { |
| 414 |
char errmsg[MAX_ERR_LENGTH]; |
| 415 |
sprintf(errmsg, |
| 416 |
"Error: failed to read global node set parameters from file id %d", |
| 417 |
*idne); |
| 418 |
ex_err("negnspg",errmsg,EX_MSG); |
| 419 |
} |
| 420 |
} |
| 421 |
|
| 422 |
/* |
| 423 |
* Write global node set parameters |
| 424 |
*/ |
| 425 |
void |
| 426 |
F2C(nepnspg)(int *idne, |
| 427 |
void_int *global_ids, |
| 428 |
void_int *global_n_cnts, |
| 429 |
void_int *global_df_cnts, |
| 430 |
int *ierr) |
| 431 |
{ |
| 432 |
if ((*ierr = ex_put_ns_param_global(*idne, global_ids, global_n_cnts, global_df_cnts)) != 0) |
| 433 |
{ |
| 434 |
char errmsg[MAX_ERR_LENGTH]; |
| 435 |
sprintf(errmsg, |
| 436 |
"Error: failed to store global node set parameters in file id %d", |
| 437 |
*idne); |
| 438 |
ex_err("nepnspg",errmsg,EX_MSG); |
| 439 |
} |
| 440 |
} |
| 441 |
|
| 442 |
/* |
| 443 |
* Read global side set parameters |
| 444 |
*/ |
| 445 |
void |
| 446 |
F2C(negsspg)(int *idne, |
| 447 |
void_int *ss_ids_glob, |
| 448 |
void_int *ss_n_cnt_glob, |
| 449 |
void_int *ss_df_cnt_glob, |
| 450 |
int *ierr) |
| 451 |
{ |
| 452 |
|
| 453 |
if ((*ierr = ex_get_ss_param_global(*idne, ss_ids_glob, ss_n_cnt_glob, ss_df_cnt_glob)) != 0) |
| 454 |
{ |
| 455 |
char errmsg[MAX_ERR_LENGTH]; |
| 456 |
sprintf(errmsg, |
| 457 |
"Error: failed to read global side set parameters from file id %d", |
| 458 |
*idne); |
| 459 |
ex_err("negsspg",errmsg,EX_MSG); |
| 460 |
} |
| 461 |
} |
| 462 |
|
| 463 |
/* |
| 464 |
* Write global side set parameters |
| 465 |
*/ |
| 466 |
void |
| 467 |
F2C(nepsspg)(int *idne, |
| 468 |
void_int *global_ids, |
| 469 |
void_int *global_el_cnts, |
| 470 |
void_int *global_df_cnts, |
| 471 |
int *ierr) |
| 472 |
{ |
| 473 |
if ((*ierr = ex_put_ss_param_global(*idne, global_ids, global_el_cnts, global_df_cnts)) != 0) { |
| 474 |
char errmsg[MAX_ERR_LENGTH]; |
| 475 |
sprintf(errmsg, |
| 476 |
"Error: failed to store global side set parameters in file id %d", |
| 477 |
*idne); |
| 478 |
ex_err("nepsspg",errmsg,EX_MSG); |
| 479 |
} |
| 480 |
} |
| 481 |
|
| 482 |
/* |
| 483 |
* Read global element block information |
| 484 |
*/ |
| 485 |
void |
| 486 |
F2C(negebig)(int *idne, |
| 487 |
void_int *el_blk_ids, |
| 488 |
void_int *el_blk_cnts, |
| 489 |
int *ierr) |
| 490 |
{ |
| 491 |
if ((*ierr = ex_get_eb_info_global(*idne, el_blk_ids, el_blk_cnts)) != 0) { |
| 492 |
char errmsg[MAX_ERR_LENGTH]; |
| 493 |
sprintf(errmsg, |
| 494 |
"Error: failed to read global element block info from file id %d", |
| 495 |
*idne); |
| 496 |
ex_err("negebig",errmsg,EX_MSG); |
| 497 |
} |
| 498 |
} |
| 499 |
|
| 500 |
/* |
| 501 |
* Write global element block information |
| 502 |
*/ |
| 503 |
void |
| 504 |
F2C(nepebig)(int *idne, |
| 505 |
void_int *el_blk_ids, |
| 506 |
void_int *el_blk_cnts, |
| 507 |
int *ierr) |
| 508 |
{ |
| 509 |
if ((*ierr = ex_put_eb_info_global(*idne, el_blk_ids, el_blk_cnts)) != 0) { |
| 510 |
char errmsg[MAX_ERR_LENGTH]; |
| 511 |
sprintf(errmsg, |
| 512 |
"Error: failed to store global element block info in file id %d", |
| 513 |
*idne); |
| 514 |
ex_err("nepebig",errmsg,EX_MSG); |
| 515 |
} |
| 516 |
} |
| 517 |
|
| 518 |
/* |
| 519 |
* Read side set element list and side set side list |
| 520 |
*/ |
| 521 |
void |
| 522 |
F2C(negnss)(int *idne, |
| 523 |
entity_id *ss_id, |
| 524 |
void_int *start, |
| 525 |
void_int *count, |
| 526 |
void_int *ss_elem_list, |
| 527 |
void_int *ss_side_list, |
| 528 |
int *ierr) |
| 529 |
{ |
| 530 |
int64_t st, cnt; |
| 531 |
if (ex_int64_status(*idne) & EX_BULK_INT64_API) { |
| 532 |
st = *(int64_t*)start; |
| 533 |
cnt = *(int64_t*)count; |
| 534 |
} else { |
| 535 |
st = *(int*)start; |
| 536 |
cnt = *(int*)count; |
| 537 |
} |
| 538 |
|
| 539 |
if ((*ierr = ex_get_n_side_set(*idne, *ss_id, st, cnt, ss_elem_list, ss_side_list)) != 0) { |
| 540 |
char errmsg[MAX_ERR_LENGTH]; |
| 541 |
sprintf(errmsg, |
| 542 |
"Error: failed to read side set element list from file id %d", |
| 543 |
*idne); |
| 544 |
ex_err("negnss",errmsg,EX_MSG); |
| 545 |
} |
| 546 |
} |
| 547 |
|
| 548 |
/* |
| 549 |
* Write side set element list and side set side list |
| 550 |
*/ |
| 551 |
void |
| 552 |
F2C(nepnss)(int *idne, |
| 553 |
entity_id *ss_id, |
| 554 |
void_int *start, |
| 555 |
void_int *count, |
| 556 |
void_int *ss_elem_list, |
| 557 |
void_int *ss_side_list, |
| 558 |
int *ierr) |
| 559 |
{ |
| 560 |
int64_t st, cnt; |
| 561 |
if (ex_int64_status(*idne) & EX_BULK_INT64_API) { |
| 562 |
st = *(int64_t*)start; |
| 563 |
cnt = *(int64_t*)count; |
| 564 |
} else { |
| 565 |
st = *(int*)start; |
| 566 |
cnt = *(int*)count; |
| 567 |
} |
| 568 |
|
| 569 |
if ((*ierr = ex_put_n_side_set(*idne, *ss_id, st, cnt, ss_elem_list, ss_side_list)) != 0) { |
| 570 |
char errmsg[MAX_ERR_LENGTH]; |
| 571 |
sprintf(errmsg, |
| 572 |
"Error: failed to write side set element list to file id %d", |
| 573 |
*idne); |
| 574 |
ex_err("nepnss",errmsg,EX_MSG); |
| 575 |
} |
| 576 |
} |
| 577 |
|
| 578 |
/* |
| 579 |
* Read side set distribution factor |
| 580 |
*/ |
| 581 |
void |
| 582 |
F2C(negnssd)(int *idne, |
| 583 |
entity_id *ss_id, |
| 584 |
void_int *start, |
| 585 |
void_int *count, |
| 586 |
real *ss_df, |
| 587 |
int *ierr) |
| 588 |
{ |
| 589 |
int64_t st, cnt; |
| 590 |
if (ex_int64_status(*idne) & EX_BULK_INT64_API) { |
| 591 |
st = *(int64_t*)start; |
| 592 |
cnt = *(int64_t*)count; |
| 593 |
} else { |
| 594 |
st = *(int*)start; |
| 595 |
cnt = *(int*)count; |
| 596 |
} |
| 597 |
|
| 598 |
if ((*ierr = ex_get_n_side_set_df(*idne, *ss_id, st, cnt, ss_df)) != 0) { |
| 599 |
char errmsg[MAX_ERR_LENGTH]; |
| 600 |
sprintf(errmsg, |
| 601 |
"Error: failed to read side set dist factor from file id %d", |
| 602 |
*idne); |
| 603 |
ex_err("negnssd",errmsg,EX_MSG); |
| 604 |
} |
| 605 |
} |
| 606 |
|
| 607 |
/* |
| 608 |
* Write side set distribution factor |
| 609 |
*/ |
| 610 |
void |
| 611 |
F2C(nepnssd)(int *idne, |
| 612 |
entity_id *ss_id, |
| 613 |
void_int *start, |
| 614 |
void_int *count, |
| 615 |
real *ss_df, |
| 616 |
int *ierr) |
| 617 |
{ |
| 618 |
int64_t st, cnt; |
| 619 |
if (ex_int64_status(*idne) & EX_BULK_INT64_API) { |
| 620 |
st = *(int64_t*)start; |
| 621 |
cnt = *(int64_t*)count; |
| 622 |
} else { |
| 623 |
st = *(int*)start; |
| 624 |
cnt = *(int*)count; |
| 625 |
} |
| 626 |
|
| 627 |
if ((*ierr = ex_put_n_side_set_df(*idne, *ss_id, st, cnt, ss_df)) != 0) { |
| 628 |
char errmsg[MAX_ERR_LENGTH]; |
| 629 |
sprintf(errmsg, |
| 630 |
"Error: failed to write side set dist factor to file id %d", |
| 631 |
*idne); |
| 632 |
ex_err("nepnssd",errmsg,EX_MSG); |
| 633 |
} |
| 634 |
} |
| 635 |
|
| 636 |
/* |
| 637 |
* Read node set list for a single node set |
| 638 |
*/ |
| 639 |
void |
| 640 |
F2C(negnns)(int *idne, |
| 641 |
entity_id *ns_id, |
| 642 |
void_int *start, |
| 643 |
void_int *count, |
| 644 |
void_int *ns_node_list, |
| 645 |
int *ierr) |
| 646 |
{ |
| 647 |
int64_t st, cnt; |
| 648 |
if (ex_int64_status(*idne) & EX_BULK_INT64_API) { |
| 649 |
st = *(int64_t*)start; |
| 650 |
cnt = *(int64_t*)count; |
| 651 |
} else { |
| 652 |
st = *(int*)start; |
| 653 |
cnt = *(int*)count; |
| 654 |
} |
| 655 |
|
| 656 |
if ((*ierr = ex_get_n_node_set(*idne, *ns_id, st, cnt,ns_node_list)) != 0) { |
| 657 |
char errmsg[MAX_ERR_LENGTH]; |
| 658 |
sprintf(errmsg, |
| 659 |
"Error: failed to read node set node list from file id %d", |
| 660 |
*idne); |
| 661 |
ex_err("negnns",errmsg,EX_MSG); |
| 662 |
} |
| 663 |
} |
| 664 |
|
| 665 |
/* |
| 666 |
* Write node set list for a single node set |
| 667 |
*/ |
| 668 |
void |
| 669 |
F2C(nepnns)(int *idne, |
| 670 |
entity_id *ns_id, |
| 671 |
void_int *start, |
| 672 |
void_int *count, |
| 673 |
void_int *ns_node_list, |
| 674 |
int *ierr) |
| 675 |
{ |
| 676 |
int64_t st, cnt; |
| 677 |
if (ex_int64_status(*idne) & EX_BULK_INT64_API) { |
| 678 |
st = *(int64_t*)start; |
| 679 |
cnt = *(int64_t*)count; |
| 680 |
} else { |
| 681 |
st = *(int*)start; |
| 682 |
cnt = *(int*)count; |
| 683 |
} |
| 684 |
|
| 685 |
if ((*ierr = ex_put_n_node_set(*idne, *ns_id, st, cnt, ns_node_list)) != 0) { |
| 686 |
char errmsg[MAX_ERR_LENGTH]; |
| 687 |
sprintf(errmsg, |
| 688 |
"Error: failed to write node set node list to file id %d", |
| 689 |
*idne); |
| 690 |
ex_err("nepnns",errmsg,EX_MSG); |
| 691 |
} |
| 692 |
} |
| 693 |
|
| 694 |
/* |
| 695 |
* Read node set distribution factor |
| 696 |
*/ |
| 697 |
void |
| 698 |
F2C(negnnsd)(int *idne, |
| 699 |
entity_id *ns_id, |
| 700 |
void_int *start, |
| 701 |
void_int *count, |
| 702 |
real *ns_df, |
| 703 |
int *ierr) |
| 704 |
{ |
| 705 |
int64_t st, cnt; |
| 706 |
if (ex_int64_status(*idne) & EX_BULK_INT64_API) { |
| 707 |
st = *(int64_t*)start; |
| 708 |
cnt = *(int64_t*)count; |
| 709 |
} else { |
| 710 |
st = *(int*)start; |
| 711 |
cnt = *(int*)count; |
| 712 |
} |
| 713 |
|
| 714 |
if ((*ierr = ex_get_n_node_set_df(*idne, *ns_id, st, cnt, ns_df)) != 0) { |
| 715 |
char errmsg[MAX_ERR_LENGTH]; |
| 716 |
sprintf(errmsg, |
| 717 |
"Error: failed to read node set dist factor from file id %d", |
| 718 |
*idne); |
| 719 |
ex_err("negnnsd",errmsg,EX_MSG); |
| 720 |
} |
| 721 |
} |
| 722 |
|
| 723 |
/* |
| 724 |
* Write node set distribution factor |
| 725 |
*/ |
| 726 |
void |
| 727 |
F2C(nepnnsd)(int *idne, |
| 728 |
entity_id *ns_id, |
| 729 |
void_int *start, |
| 730 |
void_int *count, |
| 731 |
real *ns_df, |
| 732 |
int *ierr) |
| 733 |
{ |
| 734 |
int64_t st, cnt; |
| 735 |
if (ex_int64_status(*idne) & EX_BULK_INT64_API) { |
| 736 |
st = *(int64_t*)start; |
| 737 |
cnt = *(int64_t*)count; |
| 738 |
} else { |
| 739 |
st = *(int*)start; |
| 740 |
cnt = *(int*)count; |
| 741 |
} |
| 742 |
|
| 743 |
if ((*ierr = ex_put_n_node_set_df(*idne, *ns_id, st, cnt, ns_df)) != 0) { |
| 744 |
char errmsg[MAX_ERR_LENGTH]; |
| 745 |
sprintf(errmsg, |
| 746 |
"Error: failed to write node set dist factor to file id %d", |
| 747 |
*idne); |
| 748 |
ex_err("nepnnsd",errmsg,EX_MSG); |
| 749 |
} |
| 750 |
} |
| 751 |
|
| 752 |
/* |
| 753 |
* Read coordinates of the nodes |
| 754 |
*/ |
| 755 |
void |
| 756 |
F2C(negcor)(int *idne, |
| 757 |
void_int *start, |
| 758 |
void_int *count, |
| 759 |
real *x_coor, |
| 760 |
real *y_coor, |
| 761 |
real *z_coor, |
| 762 |
int *ierr) |
| 763 |
{ |
| 764 |
int64_t st, cnt; |
| 765 |
if (ex_int64_status(*idne) & EX_BULK_INT64_API) { |
| 766 |
st = *(int64_t*)start; |
| 767 |
cnt = *(int64_t*)count; |
| 768 |
} else { |
| 769 |
st = *(int*)start; |
| 770 |
cnt = *(int*)count; |
| 771 |
} |
| 772 |
|
| 773 |
if ((*ierr = ex_get_n_coord(*idne, st, cnt, x_coor, y_coor, z_coor)) != 0) { |
| 774 |
char errmsg[MAX_ERR_LENGTH]; |
| 775 |
sprintf(errmsg, |
| 776 |
"Error: failed to read node coordinates from file id %d", |
| 777 |
*idne); |
| 778 |
ex_err("negcor",errmsg,EX_MSG); |
| 779 |
} |
| 780 |
} |
| 781 |
|
| 782 |
/* |
| 783 |
* Write coordinates of the nodes |
| 784 |
*/ |
| 785 |
void |
| 786 |
F2C(nepcor)(int *idne, |
| 787 |
void_int *start, |
| 788 |
void_int *count, |
| 789 |
real *x_coor, |
| 790 |
real *y_coor, |
| 791 |
real *z_coor, |
| 792 |
int *ierr) |
| 793 |
{ |
| 794 |
int64_t st, cnt; |
| 795 |
if (ex_int64_status(*idne) & EX_BULK_INT64_API) { |
| 796 |
st = *(int64_t*)start; |
| 797 |
cnt = *(int64_t*)count; |
| 798 |
} else { |
| 799 |
st = *(int*)start; |
| 800 |
cnt = *(int*)count; |
| 801 |
} |
| 802 |
|
| 803 |
if ((*ierr = ex_put_n_coord(*idne, st, cnt, x_coor, y_coor, z_coor)) != 0) { |
| 804 |
char errmsg[MAX_ERR_LENGTH]; |
| 805 |
sprintf(errmsg, |
| 806 |
"Error: failed to write node coordinates to file id %d", |
| 807 |
*idne); |
| 808 |
ex_err("nepcor",errmsg,EX_MSG); |
| 809 |
} |
| 810 |
} |
| 811 |
|
| 812 |
/* |
| 813 |
* Read an element block's connectivity list |
| 814 |
*/ |
| 815 |
void |
| 816 |
F2C(negnec)(int *idne, |
| 817 |
entity_id *elem_blk_id, |
| 818 |
void_int *start, |
| 819 |
void_int *count, |
| 820 |
void_int *connect, |
| 821 |
int *ierr) |
| 822 |
{ |
| 823 |
int64_t st, cnt; |
| 824 |
if (ex_int64_status(*idne) & EX_BULK_INT64_API) { |
| 825 |
st = *(int64_t*)start; |
| 826 |
cnt = *(int64_t*)count; |
| 827 |
} else { |
| 828 |
st = *(int*)start; |
| 829 |
cnt = *(int*)count; |
| 830 |
} |
| 831 |
|
| 832 |
if ((*ierr = ex_get_n_elem_conn(*idne, *elem_blk_id, st, cnt, connect)) != 0) { |
| 833 |
char errmsg[MAX_ERR_LENGTH]; |
| 834 |
sprintf(errmsg, |
| 835 |
"Error: failed to read element block connectivity from file id %d", |
| 836 |
*idne); |
| 837 |
ex_err("negnec",errmsg,EX_MSG); |
| 838 |
} |
| 839 |
} |
| 840 |
|
| 841 |
/* |
| 842 |
* Write an element block's connectivity list |
| 843 |
*/ |
| 844 |
void |
| 845 |
F2C(nepnec)(int *idne, |
| 846 |
entity_id *elem_blk_id, |
| 847 |
void_int *start, |
| 848 |
void_int *count, |
| 849 |
void_int *connect, |
| 850 |
int *ierr) |
| 851 |
{ |
| 852 |
int64_t st, cnt; |
| 853 |
if (ex_int64_status(*idne) & EX_BULK_INT64_API) { |
| 854 |
st = *(int64_t*)start; |
| 855 |
cnt = *(int64_t*)count; |
| 856 |
} else { |
| 857 |
st = *(int*)start; |
| 858 |
cnt = *(int*)count; |
| 859 |
} |
| 860 |
|
| 861 |
if ((*ierr = ex_put_n_elem_conn(*idne, *elem_blk_id, st, cnt, connect)) != 0) { |
| 862 |
char errmsg[MAX_ERR_LENGTH]; |
| 863 |
sprintf(errmsg, |
| 864 |
"Error: failed to write element block connectivity to file id %d", |
| 865 |
*idne); |
| 866 |
ex_err("negnec",errmsg,EX_MSG); |
| 867 |
} |
| 868 |
} |
| 869 |
|
| 870 |
/* |
| 871 |
* Read an element block's attributes |
| 872 |
*/ |
| 873 |
void |
| 874 |
F2C(negneat)(int *idne, |
| 875 |
entity_id *elem_blk_id, |
| 876 |
void_int *start, |
| 877 |
void_int *count, |
| 878 |
real *attrib, |
| 879 |
int *ierr) |
| 880 |
{ |
| 881 |
int64_t st, cnt; |
| 882 |
if (ex_int64_status(*idne) & EX_BULK_INT64_API) { |
| 883 |
st = *(int64_t*)start; |
| 884 |
cnt = *(int64_t*)count; |
| 885 |
} else { |
| 886 |
st = *(int*)start; |
| 887 |
cnt = *(int*)count; |
| 888 |
} |
| 889 |
|
| 890 |
if ((*ierr = ex_get_n_elem_attr(*idne, *elem_blk_id, st, cnt, attrib)) != 0) { |
| 891 |
char errmsg[MAX_ERR_LENGTH]; |
| 892 |
sprintf(errmsg, |
| 893 |
"Error: failed to read element block attribute from file id %d", |
| 894 |
*idne); |
| 895 |
ex_err("negneat",errmsg,EX_MSG); |
| 896 |
} |
| 897 |
} |
| 898 |
|
| 899 |
/* |
| 900 |
* Write an element block's attributes |
| 901 |
*/ |
| 902 |
void |
| 903 |
F2C(nepneat)(int *idne, |
| 904 |
entity_id *elem_blk_id, |
| 905 |
void_int *start, |
| 906 |
void_int *count, |
| 907 |
real *attrib, |
| 908 |
int *ierr) |
| 909 |
{ |
| 910 |
int64_t st, cnt; |
| 911 |
if (ex_int64_status(*idne) & EX_BULK_INT64_API) { |
| 912 |
st = *(int64_t*)start; |
| 913 |
cnt = *(int64_t*)count; |
| 914 |
} else { |
| 915 |
st = *(int*)start; |
| 916 |
cnt = *(int*)count; |
| 917 |
} |
| 918 |
|
| 919 |
if ((*ierr = ex_put_n_elem_attr(*idne, *elem_blk_id, st, cnt, attrib)) != 0) { |
| 920 |
char errmsg[MAX_ERR_LENGTH]; |
| 921 |
sprintf(errmsg, |
| 922 |
"Error: failed to write element block attribute to file id %d", |
| 923 |
*idne); |
| 924 |
ex_err("nepneat",errmsg,EX_MSG); |
| 925 |
} |
| 926 |
} |
| 927 |
|
| 928 |
/* |
| 929 |
* Read the element type for a specific element block |
| 930 |
*/ |
| 931 |
void |
| 932 |
F2C(negelt)(int *idne, |
| 933 |
entity_id *elem_blk_id, |
| 934 |
char *elem_type, |
| 935 |
int *ierr, |
| 936 |
size_t elem_typelen) |
| 937 |
{ |
| 938 |
size_t slen = MAX_STR_LENGTH; |
| 939 |
char *etype; |
| 940 |
|
| 941 |
/* WARNING: ftypelen SHOULD be MAX_STR_LENGTH, but may not be depending |
| 942 |
on how the Fortran programmer passed it. It is best at |
| 943 |
this time to hard code it per NEMESIS spec. */ |
| 944 |
if (elem_typelen != MAX_STR_LENGTH) { |
| 945 |
#if defined(EXODUS_STRING_LENGTH_WARNING) |
| 946 |
char errmsg[MAX_ERR_LENGTH]; |
| 947 |
sprintf(errmsg,"Warning: element type string length is %d in file id %d\n", |
| 948 |
elem_typelen, *idne); |
| 949 |
ex_err("negelt",errmsg,EX_MSG); |
| 950 |
#endif |
| 951 |
slen = elem_typelen; |
| 952 |
} |
| 953 |
|
| 954 |
etype = (char *) malloc((slen+1)*sizeof(char)); |
| 955 |
|
| 956 |
if ((*ierr = ex_get_elem_type(*idne, *elem_blk_id, etype)) != 0) { |
| 957 |
char errmsg[MAX_ERR_LENGTH]; |
| 958 |
sprintf(errmsg, |
| 959 |
"Error: failed to read element block type from file id %d", |
| 960 |
*idne); |
| 961 |
ex_err("negelt",errmsg,EX_MSG); |
| 962 |
} |
| 963 |
|
| 964 |
if (*ierr == 0) |
| 965 |
ex_fcdcpy (elem_type, slen, etype); |
| 966 |
|
| 967 |
free(etype); |
| 968 |
} |
| 969 |
|
| 970 |
/* |
| 971 |
* Read a variable for an element block |
| 972 |
*/ |
| 973 |
void |
| 974 |
F2C(negnev)(int *idne, |
| 975 |
int *time_step, |
| 976 |
int *elem_var_index, |
| 977 |
entity_id *elem_blk_id, |
| 978 |
void_int *num_elem_this_blk, |
| 979 |
void_int *start, |
| 980 |
void_int *count, |
| 981 |
real *elem_var_vals, |
| 982 |
int *ierr) |
| 983 |
{ |
| 984 |
int64_t st, cnt, ne; |
| 985 |
if (ex_int64_status(*idne) & EX_BULK_INT64_API) { |
| 986 |
st = *(int64_t*)start; |
| 987 |
cnt = *(int64_t*)count; |
| 988 |
ne = *(int64_t*)num_elem_this_blk; |
| 989 |
} else { |
| 990 |
st = *(int*)start; |
| 991 |
cnt = *(int*)count; |
| 992 |
ne = *(int*)num_elem_this_blk; |
| 993 |
} |
| 994 |
|
| 995 |
if ((*ierr = ex_get_n_elem_var(*idne, *time_step, *elem_var_index, |
| 996 |
*elem_blk_id, ne, st, cnt, elem_var_vals)) != 0) { |
| 997 |
char errmsg[MAX_ERR_LENGTH]; |
| 998 |
sprintf(errmsg, |
| 999 |
"Error: failed to read element block variable from file id %d", |
| 1000 |
*idne); |
| 1001 |
ex_err("negnec",errmsg,EX_MSG); |
| 1002 |
} |
| 1003 |
} |
| 1004 |
|
| 1005 |
/* |
| 1006 |
* Write a variable slab for an element block |
| 1007 |
*/ |
| 1008 |
void |
| 1009 |
F2C(nepevs)(int *idne, |
| 1010 |
int *time_step, |
| 1011 |
int *elem_var_index, |
| 1012 |
entity_id *elem_blk_id, |
| 1013 |
void_int *start, |
| 1014 |
void_int *count, |
| 1015 |
real *elem_var_vals, |
| 1016 |
int *ierr) |
| 1017 |
{ |
| 1018 |
int64_t st, cnt; |
| 1019 |
if (ex_int64_status(*idne) & EX_BULK_INT64_API) { |
| 1020 |
st = *(int64_t*)start; |
| 1021 |
cnt = *(int64_t*)count; |
| 1022 |
} else { |
| 1023 |
st = *(int*)start; |
| 1024 |
cnt = *(int*)count; |
| 1025 |
} |
| 1026 |
|
| 1027 |
if ((*ierr = ex_put_elem_var_slab(*idne, *time_step, *elem_var_index, |
| 1028 |
*elem_blk_id, st, cnt, elem_var_vals)) != 0) { |
| 1029 |
char errmsg[MAX_ERR_LENGTH]; |
| 1030 |
sprintf(errmsg, |
| 1031 |
"Error: failed to write elem block variable slab to file id %d", |
| 1032 |
*idne); |
| 1033 |
ex_err("negnec",errmsg,EX_MSG); |
| 1034 |
} |
| 1035 |
} |
| 1036 |
|
| 1037 |
/* |
| 1038 |
* Read the values of a single nodal variable for a single time step |
| 1039 |
*/ |
| 1040 |
void |
| 1041 |
F2C(negnnv)(int *idne, |
| 1042 |
int *time_step, |
| 1043 |
int *nodal_var_index, |
| 1044 |
void_int *start, |
| 1045 |
void_int *count, |
| 1046 |
real *nodal_vars, |
| 1047 |
int *ierr) |
| 1048 |
{ |
| 1049 |
int64_t st, cnt; |
| 1050 |
if (ex_int64_status(*idne) & EX_BULK_INT64_API) { |
| 1051 |
st = *(int64_t*)start; |
| 1052 |
cnt = *(int64_t*)count; |
| 1053 |
} else { |
| 1054 |
st = *(int*)start; |
| 1055 |
cnt = *(int*)count; |
| 1056 |
} |
| 1057 |
|
| 1058 |
if ((*ierr = ex_get_n_nodal_var(*idne, *time_step, *nodal_var_index, |
| 1059 |
st, cnt, nodal_vars)) != 0) { |
| 1060 |
char errmsg[MAX_ERR_LENGTH]; |
| 1061 |
sprintf(errmsg, |
| 1062 |
"Error: failed to read nodal variable from file id %d", |
| 1063 |
*idne); |
| 1064 |
ex_err("negnnv",errmsg,EX_MSG); |
| 1065 |
} |
| 1066 |
} |
| 1067 |
|
| 1068 |
/* |
| 1069 |
* Write nodal variable slab |
| 1070 |
*/ |
| 1071 |
void |
| 1072 |
F2C(nepnvs)(int *idne, |
| 1073 |
int *time_step, |
| 1074 |
int *nodal_var_index, |
| 1075 |
void_int *start, |
| 1076 |
void_int *count, |
| 1077 |
real *nodal_var_vals, |
| 1078 |
int *ierr) |
| 1079 |
{ |
| 1080 |
int64_t st, cnt; |
| 1081 |
if (ex_int64_status(*idne) & EX_BULK_INT64_API) { |
| 1082 |
st = *(int64_t*)start; |
| 1083 |
cnt = *(int64_t*)count; |
| 1084 |
} else { |
| 1085 |
st = *(int*)start; |
| 1086 |
cnt = *(int*)count; |
| 1087 |
} |
| 1088 |
|
| 1089 |
if ((*ierr = ex_put_nodal_var_slab(*idne, *time_step, *nodal_var_index, |
| 1090 |
st, cnt, nodal_var_vals)) != 0) { |
| 1091 |
char errmsg[MAX_ERR_LENGTH]; |
| 1092 |
sprintf(errmsg, |
| 1093 |
"Error: failed to write nodal variable slab to file id %d", |
| 1094 |
*idne); |
| 1095 |
ex_err("nepnvs",errmsg,EX_MSG); |
| 1096 |
} |
| 1097 |
} |
| 1098 |
|
| 1099 |
/* |
| 1100 |
* Read the element numbering map |
| 1101 |
*/ |
| 1102 |
void |
| 1103 |
F2C(negnenm)(int *idne, |
| 1104 |
void_int *starte, |
| 1105 |
void_int *num_ent, |
| 1106 |
void_int *elem_map, |
| 1107 |
int *ierr) |
| 1108 |
{ |
| 1109 |
int64_t st, cnt; |
| 1110 |
if (ex_int64_status(*idne) & EX_BULK_INT64_API) { |
| 1111 |
st = *(int64_t*)starte; |
| 1112 |
cnt = *(int64_t*)num_ent; |
| 1113 |
} else { |
| 1114 |
st = *(int*)starte; |
| 1115 |
cnt = *(int*)num_ent; |
| 1116 |
} |
| 1117 |
|
| 1118 |
if ((*ierr = ex_get_n_elem_num_map(*idne, st, cnt, elem_map)) != 0) { |
| 1119 |
char errmsg[MAX_ERR_LENGTH]; |
| 1120 |
sprintf(errmsg, |
| 1121 |
"Error: failed to read element numbering map from file id %d", |
| 1122 |
*idne); |
| 1123 |
ex_err("negnenm",errmsg,EX_MSG); |
| 1124 |
} |
| 1125 |
} |
| 1126 |
|
| 1127 |
/* |
| 1128 |
* Write the element numbering map |
| 1129 |
*/ |
| 1130 |
void |
| 1131 |
F2C(nepnenm)(int *idne, |
| 1132 |
void_int *starte, |
| 1133 |
void_int *num_ent, |
| 1134 |
void_int *elem_map, |
| 1135 |
int *ierr) |
| 1136 |
{ |
| 1137 |
int64_t st, cnt; |
| 1138 |
if (ex_int64_status(*idne) & EX_BULK_INT64_API) { |
| 1139 |
st = *(int64_t*)starte; |
| 1140 |
cnt = *(int64_t*)num_ent; |
| 1141 |
} else { |
| 1142 |
st = *(int*)starte; |
| 1143 |
cnt = *(int*)num_ent; |
| 1144 |
} |
| 1145 |
|
| 1146 |
if ((*ierr = ex_put_n_elem_num_map(*idne, st, cnt, elem_map)) != 0) { |
| 1147 |
char errmsg[MAX_ERR_LENGTH]; |
| 1148 |
sprintf(errmsg, |
| 1149 |
"Error: failed to write element numbering map to file id %d", |
| 1150 |
*idne); |
| 1151 |
ex_err("nepnenm",errmsg,EX_MSG); |
| 1152 |
} |
| 1153 |
} |
| 1154 |
|
| 1155 |
/* |
| 1156 |
* Read the node numbering map |
| 1157 |
*/ |
| 1158 |
void |
| 1159 |
F2C(negnnnm)(int *idne, |
| 1160 |
void_int *startn, |
| 1161 |
void_int *num_ent, |
| 1162 |
void_int *node_map, |
| 1163 |
int *ierr) |
| 1164 |
{ |
| 1165 |
int64_t st, cnt; |
| 1166 |
if (ex_int64_status(*idne) & EX_BULK_INT64_API) { |
| 1167 |
st = *(int64_t*)startn; |
| 1168 |
cnt = *(int64_t*)num_ent; |
| 1169 |
} else { |
| 1170 |
st = *(int*)startn; |
| 1171 |
cnt = *(int*)num_ent; |
| 1172 |
} |
| 1173 |
|
| 1174 |
if ((*ierr = ex_get_n_node_num_map(*idne, st, cnt, node_map)) != 0) { |
| 1175 |
char errmsg[MAX_ERR_LENGTH]; |
| 1176 |
sprintf(errmsg, |
| 1177 |
"Error: failed to read node numbering map from file id %d", |
| 1178 |
*idne); |
| 1179 |
ex_err("negnnnm",errmsg,EX_MSG); |
| 1180 |
} |
| 1181 |
} |
| 1182 |
|
| 1183 |
/* |
| 1184 |
* Write the node numbering map |
| 1185 |
*/ |
| 1186 |
void |
| 1187 |
F2C(nepnnnm)(int *idne, |
| 1188 |
void_int *startn, |
| 1189 |
void_int *num_ent, |
| 1190 |
void_int *node_map, |
| 1191 |
int *ierr) |
| 1192 |
{ |
| 1193 |
int64_t st, cnt; |
| 1194 |
if (ex_int64_status(*idne) & EX_BULK_INT64_API) { |
| 1195 |
st = *(int64_t*)startn; |
| 1196 |
cnt = *(int64_t*)num_ent; |
| 1197 |
} else { |
| 1198 |
st = *(int*)startn; |
| 1199 |
cnt = *(int*)num_ent; |
| 1200 |
} |
| 1201 |
|
| 1202 |
if ((*ierr = ex_put_n_node_num_map(*idne, st, cnt, node_map)) != 0) { |
| 1203 |
char errmsg[MAX_ERR_LENGTH]; |
| 1204 |
sprintf(errmsg, |
| 1205 |
"Error: failed to write node numbering map to file id %d", |
| 1206 |
*idne); |
| 1207 |
ex_err("nepnnnm",errmsg,EX_MSG); |
| 1208 |
} |
| 1209 |
} |
| 1210 |
|
| 1211 |
/* |
| 1212 |
* Read the node map for a processor |
| 1213 |
*/ |
| 1214 |
void |
| 1215 |
F2C(negnm)(int *idne, |
| 1216 |
void_int *node_mapi, |
| 1217 |
void_int *node_mapb, |
| 1218 |
void_int *node_mape, |
| 1219 |
int *processor, |
| 1220 |
int *ierr) |
| 1221 |
{ |
| 1222 |
if ((*ierr = ex_get_processor_node_maps(*idne, node_mapi, node_mapb, node_mape, *processor)) != 0) { |
| 1223 |
char errmsg[MAX_ERR_LENGTH]; |
| 1224 |
sprintf(errmsg, |
| 1225 |
"Error: failed to read processor node map from file id %d", |
| 1226 |
*idne); |
| 1227 |
ex_err("negnm",errmsg,EX_MSG); |
| 1228 |
} |
| 1229 |
} |
| 1230 |
|
| 1231 |
/* |
| 1232 |
* Write a node map for a processor |
| 1233 |
*/ |
| 1234 |
void |
| 1235 |
F2C(nepnm)(int *idne, |
| 1236 |
void_int *node_mapi, |
| 1237 |
void_int *node_mapb, |
| 1238 |
void_int *node_mape, |
| 1239 |
int *processor, |
| 1240 |
int *ierr) |
| 1241 |
{ |
| 1242 |
if ((*ierr = ex_put_processor_node_maps(*idne, node_mapi, node_mapb, node_mape, *processor)) != 0) { |
| 1243 |
char errmsg[MAX_ERR_LENGTH]; |
| 1244 |
sprintf(errmsg, |
| 1245 |
"Error: failed to write processor node map to file id %d", |
| 1246 |
*idne); |
| 1247 |
ex_err("nepnm",errmsg,EX_MSG); |
| 1248 |
} |
| 1249 |
} |
| 1250 |
|
| 1251 |
/* |
| 1252 |
* Read the element map for a processor |
| 1253 |
*/ |
| 1254 |
void |
| 1255 |
F2C(negem)(int *idne, |
| 1256 |
void_int *elem_mapi, |
| 1257 |
void_int *elem_mapb, |
| 1258 |
int *processor, |
| 1259 |
int *ierr) |
| 1260 |
{ |
| 1261 |
if ((*ierr = ex_get_processor_elem_maps(*idne, elem_mapi, elem_mapb, *processor)) != 0) { |
| 1262 |
char errmsg[MAX_ERR_LENGTH]; |
| 1263 |
sprintf(errmsg, |
| 1264 |
"Error: failed to read processor element map from file id %d", |
| 1265 |
*idne); |
| 1266 |
ex_err("negem",errmsg,EX_MSG); |
| 1267 |
} |
| 1268 |
} |
| 1269 |
|
| 1270 |
/* |
| 1271 |
* Write the element map for a processor |
| 1272 |
*/ |
| 1273 |
void |
| 1274 |
F2C(nepem)(int *idne, |
| 1275 |
void_int *elem_mapi, |
| 1276 |
void_int *elem_mapb, |
| 1277 |
int *processor, |
| 1278 |
int *ierr) |
| 1279 |
{ |
| 1280 |
if ((*ierr = ex_put_processor_elem_maps(*idne, elem_mapi, elem_mapb, *processor)) != 0) { |
| 1281 |
char errmsg[MAX_ERR_LENGTH]; |
| 1282 |
sprintf(errmsg, |
| 1283 |
"Error: failed to write processor element map to file id %d", |
| 1284 |
*idne); |
| 1285 |
ex_err("nepem",errmsg,EX_MSG); |
| 1286 |
} |
| 1287 |
} |
| 1288 |
|
| 1289 |
/* |
| 1290 |
* Read the communications map parameters for a single processor |
| 1291 |
*/ |
| 1292 |
void |
| 1293 |
F2C(negcmp)(int *idne, |
| 1294 |
void_int *ncmap_ids, |
| 1295 |
void_int *ncmap_node_cnts, |
| 1296 |
void_int *ecmap_ids, |
| 1297 |
void_int *ecmap_elem_cnts, |
| 1298 |
int *processor, |
| 1299 |
int *ierr) |
| 1300 |
{ |
| 1301 |
if ((*ierr = ex_get_cmap_params(*idne, ncmap_ids, ncmap_node_cnts, |
| 1302 |
ecmap_ids, ecmap_elem_cnts, *processor)) != 0) { |
| 1303 |
char errmsg[MAX_ERR_LENGTH]; |
| 1304 |
sprintf(errmsg, |
| 1305 |
"Error: failed to read comm map parameters from file id %d", |
| 1306 |
*idne); |
| 1307 |
ex_err("negcmp",errmsg,EX_MSG); |
| 1308 |
} |
| 1309 |
} |
| 1310 |
|
| 1311 |
/* |
| 1312 |
* Write the communications map parameters for a single processor |
| 1313 |
*/ |
| 1314 |
void |
| 1315 |
F2C(nepcmp)(int *idne, |
| 1316 |
void_int *nmap_ids, |
| 1317 |
void_int *nmap_node_cnts, |
| 1318 |
void_int *emap_ids, |
| 1319 |
void_int *emap_elem_cnts, |
| 1320 |
int *processor, |
| 1321 |
int *ierr) |
| 1322 |
{ |
| 1323 |
if ((*ierr = ex_put_cmap_params(*idne, nmap_ids, nmap_node_cnts, |
| 1324 |
emap_ids, emap_elem_cnts, *processor)) != 0) { |
| 1325 |
char errmsg[MAX_ERR_LENGTH]; |
| 1326 |
sprintf(errmsg, |
| 1327 |
"Error: failed to write comm map parameters to file id %d", |
| 1328 |
*idne); |
| 1329 |
ex_err("nepcmp",errmsg,EX_MSG); |
| 1330 |
} |
| 1331 |
} |
| 1332 |
|
| 1333 |
/* |
| 1334 |
* Write the communications map parameters for all processors |
| 1335 |
*/ |
| 1336 |
void |
| 1337 |
F2C(nepcmpc)(int *idne, |
| 1338 |
void_int *nmap_ids, |
| 1339 |
void_int *nmap_node_cnts, |
| 1340 |
void_int *nproc_ptrs, |
| 1341 |
void_int *emap_ids, |
| 1342 |
void_int *emap_elem_cnts, |
| 1343 |
void_int *eproc_ptrs, |
| 1344 |
int *ierr) |
| 1345 |
{ |
| 1346 |
if ((*ierr = ex_put_cmap_params_cc(*idne, nmap_ids, nmap_node_cnts, |
| 1347 |
nproc_ptrs, emap_ids, emap_elem_cnts, |
| 1348 |
eproc_ptrs)) != 0) { |
| 1349 |
char errmsg[MAX_ERR_LENGTH]; |
| 1350 |
sprintf(errmsg, |
| 1351 |
"Error: failed to write comm map parameters to file id %d", |
| 1352 |
*idne); |
| 1353 |
ex_err("nepcmpc",errmsg,EX_MSG); |
| 1354 |
} |
| 1355 |
} |
| 1356 |
|
| 1357 |
/* |
| 1358 |
* Read the nodal communications map for a single processor |
| 1359 |
*/ |
| 1360 |
void |
| 1361 |
F2C(negncm)(int *idne, |
| 1362 |
entity_id *map_id, |
| 1363 |
void_int *node_ids, |
| 1364 |
void_int *proc_ids, |
| 1365 |
int *processor, |
| 1366 |
int *ierr) |
| 1367 |
{ |
| 1368 |
if ((*ierr = ex_get_node_cmap(*idne, *map_id, node_ids, proc_ids, *processor)) != 0) { |
| 1369 |
char errmsg[MAX_ERR_LENGTH]; |
| 1370 |
sprintf(errmsg, |
| 1371 |
"Error: failed to read nodal communications map from file id %d", |
| 1372 |
*idne); |
| 1373 |
ex_err("negncm",errmsg,EX_MSG); |
| 1374 |
} |
| 1375 |
} |
| 1376 |
|
| 1377 |
/* |
| 1378 |
* Write the nodal communications map for a single processor |
| 1379 |
*/ |
| 1380 |
void |
| 1381 |
F2C(nepncm)(int *idne, |
| 1382 |
entity_id *map_id, |
| 1383 |
void_int *node_ids, |
| 1384 |
void_int *proc_ids, |
| 1385 |
int *processor, |
| 1386 |
int *ierr) |
| 1387 |
{ |
| 1388 |
if ((*ierr = ex_put_node_cmap(*idne, *map_id, node_ids, proc_ids, *processor)) != 0) { |
| 1389 |
char errmsg[MAX_ERR_LENGTH]; |
| 1390 |
sprintf(errmsg, |
| 1391 |
"Error: failed to write nodal communications map to file id %d", |
| 1392 |
*idne); |
| 1393 |
ex_err("nepncm",errmsg,EX_MSG); |
| 1394 |
} |
| 1395 |
} |
| 1396 |
|
| 1397 |
/* |
| 1398 |
* Read the elemental communications map for a single processor |
| 1399 |
*/ |
| 1400 |
void |
| 1401 |
F2C(negecm)(int *idne, |
| 1402 |
entity_id *map_id, |
| 1403 |
void_int *elem_ids, |
| 1404 |
void_int *side_ids, |
| 1405 |
void_int *proc_ids, |
| 1406 |
int *processor, |
| 1407 |
int *ierr) |
| 1408 |
{ |
| 1409 |
if ((*ierr = ex_get_elem_cmap(*idne, *map_id, elem_ids, side_ids, proc_ids, *processor)) != 0) { |
| 1410 |
char errmsg[MAX_ERR_LENGTH]; |
| 1411 |
sprintf(errmsg, |
| 1412 |
"Error: failed to read elemental comm map from file id %d", |
| 1413 |
*idne); |
| 1414 |
ex_err("negecm",errmsg,EX_MSG); |
| 1415 |
} |
| 1416 |
} |
| 1417 |
|
| 1418 |
/* |
| 1419 |
* Write the elemental communications map for a single processor |
| 1420 |
*/ |
| 1421 |
void |
| 1422 |
F2C(nepecm)(int *idne, |
| 1423 |
entity_id *map_id, |
| 1424 |
void_int *elem_ids, |
| 1425 |
void_int *side_ids, |
| 1426 |
void_int *proc_ids, |
| 1427 |
int *processor, |
| 1428 |
int *ierr) |
| 1429 |
{ |
| 1430 |
if ((*ierr = ex_put_elem_cmap(*idne, *map_id, elem_ids, side_ids, proc_ids, *processor)) != 0) { |
| 1431 |
char errmsg[MAX_ERR_LENGTH]; |
| 1432 |
sprintf(errmsg, |
| 1433 |
"Error: failed to write elemental comm map to file id %d", |
| 1434 |
*idne); |
| 1435 |
ex_err("nepecm",errmsg,EX_MSG); |
| 1436 |
} |
| 1437 |
} |
| 1438 |
|