Debian Codegraph @

packages/seacas/applications/exotec2/exotec2.c

raw
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 #include "add_to_log.h" // for add_to_log
10 #include <exodusII.h>
11 #include <stdio.h>
12 #include <stdlib.h>
13 #include <time.h>
14
15 extern void tec(int iexi, const char *filename);
16
17 static void banner()
18 {
19 time_t time_val;
20 struct tm *time_structure;
21 char *asc_time;
22
23 time_val = time((time_t *)NULL);
24 time_structure = localtime(&time_val);
25 asc_time = asctime(time_structure);
26
27 printf(" *** EXOTEC Version 2.03 ***\n");
28 printf(" Revised 2017/08/10\n\n");
29 printf(" EXODUS --> TECPLOT TRANSLATOR\n\n");
30 printf(" Run on %s\n\n", asc_time);
31 }
32
33 int main(int argc, char *argv[])
34 {
35 int exoid;
36 char *filename;
37 int cpu_word_size = 8;
38 int io_word_size = 0;
39 float version = 0.0;
40
41 banner();
42
43 if (argc != 3) {
44 fprintf(stderr, "ERROR: Usage is exotec2 exo_in tec_out\n\n");
45 exit(1);
46 }
47
48 /* Open the files... */
49 filename = argv[1];
50 exoid = ex_open(filename, EX_READ, &cpu_word_size, &io_word_size, &version);
51
52 if (exoid < 0) {
53 fprintf(stderr, "Cannot open file '%s' - exiting.\n", filename);
54 exit(1);
55 }
56
57 /* Write the tec file... */
58 filename = argv[2];
59
60 tec(exoid, filename);
61
62 ex_close(exoid);
63
64 add_to_log(argv[0], 0.0);
65 }