| 1 |
/* |
| 2 |
* Copyright(C) 1999-2020 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 |
* testcp_lrg - copy file test.exo created by testwt, normal_model to large_model |
| 11 |
* |
| 12 |
* author - Sandia National Laboratories |
| 13 |
* Larry A. Schoof - Original |
| 14 |
* |
| 15 |
* |
| 16 |
* environment - UNIX |
| 17 |
* |
| 18 |
* entry conditions - |
| 19 |
* input parameters: |
| 20 |
* |
| 21 |
* exit conditions - |
| 22 |
* |
| 23 |
* revision history - |
| 24 |
* |
| 25 |
*****************************************************************************/ |
| 26 |
|
| 27 |
#include "exodusII.h" |
| 28 |
#include <stdio.h> |
| 29 |
#include <stdlib.h> |
| 30 |
|
| 31 |
int main(int argc, char **argv) |
| 32 |
{ |
| 33 |
int exoid, exoid1, error, idum; |
| 34 |
int CPU_word_size, IO_word_size; |
| 35 |
|
| 36 |
float version; |
| 37 |
|
| 38 |
char *cdum = NULL; |
| 39 |
|
| 40 |
ex_opts(EX_VERBOSE | EX_ABORT); |
| 41 |
|
| 42 |
/* open EXODUS II files */ |
| 43 |
|
| 44 |
CPU_word_size = 0; /* sizeof(float) */ |
| 45 |
IO_word_size = 0; /* use size in file */ |
| 46 |
|
| 47 |
exoid = ex_open("testcp.exo", /* filename path */ |
| 48 |
EX_READ, /* access mode = READ */ |
| 49 |
&CPU_word_size, /* CPU word size */ |
| 50 |
&IO_word_size, /* IO word size */ |
| 51 |
&version); /* ExodusII library version */ |
| 52 |
|
| 53 |
printf("\nafter ex_open\n"); |
| 54 |
if (exoid < 0) { |
| 55 |
exit(1); |
| 56 |
} |
| 57 |
|
| 58 |
printf("test.exo is an EXODUSII file; version %4.2f\n", version); |
| 59 |
printf(" CPU word size %1d\n", CPU_word_size); |
| 60 |
printf(" I/O word size %1d\n", IO_word_size); |
| 61 |
ex_inquire(exoid, EX_INQ_API_VERS, &idum, &version, cdum); |
| 62 |
printf("EXODUSII API; version %4.2f\n", version); |
| 63 |
|
| 64 |
CPU_word_size = 8; /* this really shouldn't matter for |
| 65 |
the copy but tests the conversion |
| 66 |
routines */ |
| 67 |
IO_word_size = 4; |
| 68 |
|
| 69 |
exoid1 = ex_create("testcp_nl.exo", /* filename */ |
| 70 |
EX_CLOBBER | EX_LARGE_MODEL, /* OK to overwrite, large */ |
| 71 |
&CPU_word_size, /* CPU float word size in bytes */ |
| 72 |
&IO_word_size); /* I/O float word size in bytes */ |
| 73 |
|
| 74 |
printf("\nafter ex_create, exoid = %3d\n", exoid1); |
| 75 |
if (exoid1 < 0) { |
| 76 |
exit(1); |
| 77 |
} |
| 78 |
|
| 79 |
printf(" CPU word size %1d\n", CPU_word_size); |
| 80 |
printf(" I/O word size %1d\n", IO_word_size); |
| 81 |
|
| 82 |
error = ex_copy(exoid, exoid1); |
| 83 |
printf("\nafter ex_copy, error = %3d\n", error); |
| 84 |
|
| 85 |
error = ex_close(exoid); |
| 86 |
printf("\nafter ex_close, error = %3d\n", error); |
| 87 |
|
| 88 |
error = ex_close(exoid1); |
| 89 |
printf("\nafter ex_close, error = %3d\n", error); |
| 90 |
return 0; |
| 91 |
} |