| 1 |
/* |
| 2 |
* Copyright(C) 1999-2020, 2024 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 "exodusII.h" // for ex_init_params, etc |
| 10 |
#include "exodusII_int.h" |
| 11 |
|
| 12 |
/*! |
| 13 |
\ingroup ModelDescription |
| 14 |
|
| 15 |
The function ex_put_init() writes the initialization parameters to the |
| 16 |
exodus file. This function must be called once (and only once) before |
| 17 |
writing any data to the file. |
| 18 |
|
| 19 |
\return In case of an error, ex_put_init() returns a negative number; |
| 20 |
a warning will return a positive number. Possible causes of errors |
| 21 |
include: |
| 22 |
- data file not properly opened with call to ex_create() or ex_open() |
| 23 |
- data file opened for read only. |
| 24 |
- this routine has been called previously. |
| 25 |
|
| 26 |
\param exoid exodus file ID returned from a previous call to ex_create() |
| 27 |
or ex_open(). |
| 28 |
\param title Database title. Maximum length is #MAX_LINE_LENGTH. |
| 29 |
\param num_dim The dimensionality of the database. This is the number of |
| 30 |
coordinates per node. |
| 31 |
\param num_nodes The number of nodal points. |
| 32 |
\param num_elem The number of elements. |
| 33 |
\param num_elem_blk The number of element blocks. |
| 34 |
\param num_node_sets The number of node sets. |
| 35 |
\param num_side_sets The number of side sets. |
| 36 |
|
| 37 |
The following code segment will initialize an open exodus file with |
| 38 |
the specified parameters: |
| 39 |
|
| 40 |
~~~{.c} |
| 41 |
int num_dim, num_nods, num_el, num_el_blk, num_ns, num_ss, error, exoid; |
| 42 |
|
| 43 |
\comment{initialize file with parameters} |
| 44 |
num_dim = 3; num_nods = 46; num_el = 5; num_el_blk = 5; |
| 45 |
num_ns = 2; num_ss = 5; |
| 46 |
|
| 47 |
error = ex_put_init (exoid, "This is the title", num_dim, |
| 48 |
num_nods, num_el,num_el_blk, num_ns, num_ss); |
| 49 |
~~~ |
| 50 |
|
| 51 |
*/ |
| 52 |
|
| 53 |
int ex_put_init(int exoid, const char *title, int64_t num_dim, int64_t num_nodes, int64_t num_elem, |
| 54 |
int64_t num_elem_blk, int64_t num_node_sets, int64_t num_side_sets) |
| 55 |
{ |
| 56 |
ex_init_params par; |
| 57 |
|
| 58 |
ex_copy_string(par.title, title, MAX_LINE_LENGTH + 1); |
| 59 |
|
| 60 |
par.num_dim = num_dim; |
| 61 |
par.num_nodes = num_nodes; |
| 62 |
par.num_edge = 0; |
| 63 |
par.num_edge_blk = 0; |
| 64 |
par.num_face = 0; |
| 65 |
par.num_face_blk = 0; |
| 66 |
par.num_elem = num_elem; |
| 67 |
par.num_elem_blk = num_elem_blk; |
| 68 |
par.num_node_sets = num_node_sets; |
| 69 |
par.num_edge_sets = 0; |
| 70 |
par.num_face_sets = 0; |
| 71 |
par.num_side_sets = num_side_sets; |
| 72 |
par.num_elem_sets = 0; |
| 73 |
par.num_node_maps = 0; |
| 74 |
par.num_edge_maps = 0; |
| 75 |
par.num_face_maps = 0; |
| 76 |
par.num_elem_maps = 0; |
| 77 |
par.num_assembly = 0; |
| 78 |
|
| 79 |
return ex_put_init_ext(exoid, &par); |
| 80 |
} |