PageRenderTime 73ms CodeModel.GetById 9ms RepoModel.GetById 0ms app.codeStats 0ms

/contrib/exodusii/5.22b/exodus/cbind/test/testwtd.c

https://bitbucket.org/vijaysm/libmesh
C | 602 lines | 340 code | 163 blank | 99 comment | 10 complexity | eb89bbc881230fb25eabaa528b642141 MD5 | raw file
Possible License(s): LGPL-2.1, BSD-3-Clause, GPL-3.0, MPL-2.0-no-copyleft-exception, GPL-2.0
  1. /*
  2. * Copyright (c) 2005 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. * testwtd - test write an ExodusII database file
  38. *
  39. * author - Sandia National Laboratories
  40. * Larry A. Schoof - Original
  41. * Vic Yarberry - Added headers and error logging
  42. * 7/7/93 Modified for use with Exodus 2.00
  43. *
  44. *
  45. * environment - UNIX
  46. *
  47. * entry conditions -
  48. *
  49. * exit conditions -
  50. *
  51. * revision history -
  52. *
  53. * This is a test program for the C binding of the EXODUS II
  54. * database write routines.
  55. *
  56. *
  57. *****************************************************************************/
  58. #include <stdlib.h>
  59. #include <stdio.h>
  60. #include "netcdf.h"
  61. #include "exodusII.h"
  62. int main (int argc, char **argv)
  63. {
  64. int exoid, num_dim, num_nodes, num_elem, num_elem_blk;
  65. int num_elem_in_block[10], num_nodes_per_elem[10];
  66. int num_node_sets, num_side_sets, error;
  67. int i, j, k, m, *elem_map, *connect;
  68. int node_list[100],elem_list[100],side_list[100];
  69. int ebids[100];
  70. int num_qa_rec, num_info;
  71. int num_glo_vars, num_nod_vars, num_ele_vars;
  72. int *truth_tab;
  73. int whole_time_step, num_time_steps;
  74. int CPU_word_size,IO_word_size;
  75. int prop_array[2];
  76. double *glob_var_vals, *nodal_var_vals, *elem_var_vals;
  77. double time_value;
  78. double x[100], y[100], z[100];
  79. double attrib[1], dist_fact[100];
  80. char *coord_names[3], *qa_record[2][4], *info[3], *var_names[3];
  81. char *prop_names[2];
  82. ex_opts (EX_VERBOSE | EX_ABORT);
  83. /* Specify compute and i/o word size */
  84. CPU_word_size = 8; /* double */
  85. IO_word_size = 8; /* use double size (8 bytes) */
  86. /* create EXODUS II file */
  87. exoid = ex_create ("test.exo", /* filename path */
  88. EX_CLOBBER, /* create mode */
  89. &CPU_word_size, /* CPU float word size in bytes */
  90. &IO_word_size); /* I/O float word size in bytes */
  91. printf ("after ex_create for test.exo, exoid = %d\n", exoid);
  92. printf (" cpu word size: %d io word size: %d\n",CPU_word_size,IO_word_size);
  93. /* ncopts = NC_VERBOSE; */
  94. /* initialize file with parameters */
  95. num_dim = 3;
  96. num_nodes = 26;
  97. num_elem = 5;
  98. num_elem_blk = 5;
  99. num_node_sets = 2;
  100. num_side_sets = 5;
  101. error = ex_put_init (exoid, "This is a test", num_dim, num_nodes, num_elem,
  102. num_elem_blk, num_node_sets, num_side_sets);
  103. printf ("after ex_put_init, error = %d\n", error);
  104. /* write nodal coordinates values and names to database */
  105. /* Quad #1 */
  106. x[0] = 0.0; y[0] = 0.0; z[0] = 0.0;
  107. x[1] = 1.0; y[1] = 0.0; z[1] = 0.0;
  108. x[2] = 1.0; y[2] = 1.0; z[2] = 0.0;
  109. x[3] = 0.0; y[3] = 1.0; z[3] = 0.0;
  110. /* Quad #2 */
  111. x[4] = 1.0; y[4] = 0.0; z[4] = 0.0;
  112. x[5] = 2.0; y[5] = 0.0; z[5] = 0.0;
  113. x[6] = 2.0; y[6] = 1.0; z[6] = 0.0;
  114. x[7] = 1.0; y[7] = 1.0; z[7] = 0.0;
  115. /* Hex #1 */
  116. x[8] = 0.0; y[8] = 0.0; z[8] = 0.0;
  117. x[9] = 10.0; y[9] = 0.0; z[9] = 0.0;
  118. x[10] = 10.0; y[10] = 0.0; z[10] =-10.0;
  119. x[11] = 1.0; y[11] = 0.0; z[11] =-10.0;
  120. x[12] = 1.0; y[12] = 10.0; z[12] = 0.0;
  121. x[13] = 10.0; y[13] = 10.0; z[13] = 0.0;
  122. x[14] = 10.0; y[14] = 10.0; z[14] =-10.0;
  123. x[15] = 1.0; y[15] = 10.0; z[15] =-10.0;
  124. /* Tetra #1 */
  125. x[16] = 0.0; y[16] = 0.0; z[16] = 0.0;
  126. x[17] = 1.0; y[17] = 0.0; z[17] = 5.0;
  127. x[18] = 10.0; y[18] = 0.0; z[18] = 2.0;
  128. x[19] = 7.0; y[19] = 5.0; z[19] = 3.0;
  129. /* Wedge #1 */
  130. x[20] = 3.0; y[20] = 0.0; z[20] = 6.0;
  131. x[21] = 6.0; y[21] = 0.0; z[21] = 0.0;
  132. x[22] = 0.0; y[22] = 0.0; z[22] = 0.0;
  133. x[23] = 3.0; y[23] = 2.0; z[23] = 6.0;
  134. x[24] = 6.0; y[24] = 2.0; z[24] = 2.0;
  135. x[25] = 0.0; y[25] = 2.0; z[25] = 0.0;
  136. error = ex_put_coord (exoid, x, y, z);
  137. printf ("after ex_put_coord, error = %d\n", error);
  138. coord_names[0] = "xcoor";
  139. coord_names[1] = "ycoor";
  140. coord_names[2] = "zcoor";
  141. error = ex_put_coord_names (exoid, coord_names);
  142. printf ("after ex_put_coord_names, error = %d\n", error);
  143. /* write element order map */
  144. elem_map = (int *) calloc(num_elem, sizeof(int));
  145. for (i=1; i<=num_elem; i++)
  146. {
  147. elem_map[i-1] = i;
  148. }
  149. error = ex_put_map (exoid, elem_map);
  150. printf ("after ex_put_map, error = %d\n", error);
  151. free (elem_map);
  152. /* write element block parameters */
  153. num_elem_in_block[0] = 1;
  154. num_elem_in_block[1] = 1;
  155. num_elem_in_block[2] = 1;
  156. num_elem_in_block[3] = 1;
  157. num_elem_in_block[4] = 1;
  158. num_nodes_per_elem[0] = 4; /* elements in block #1 are 4-node quads */
  159. num_nodes_per_elem[1] = 4; /* elements in block #2 are 4-node quads */
  160. num_nodes_per_elem[2] = 8; /* elements in block #3 are 8-node hexes */
  161. num_nodes_per_elem[3] = 4; /* elements in block #3 are 4-node tetras */
  162. num_nodes_per_elem[4] = 6; /* elements in block #3 are 6-node wedges */
  163. ebids[0] = 10;
  164. ebids[1] = 11;
  165. ebids[2] = 12;
  166. ebids[3] = 13;
  167. ebids[4] = 14;
  168. error = ex_put_elem_block (exoid, ebids[0], "quad", num_elem_in_block[0],
  169. num_nodes_per_elem[0], 1);
  170. printf ("after ex_put_elem_block, error = %d\n", error);
  171. error = ex_put_elem_block (exoid, ebids[1], "quad", num_elem_in_block[1],
  172. num_nodes_per_elem[0], 1);
  173. printf ("after ex_put_elem_block, error = %d\n", error);
  174. error = ex_put_elem_block (exoid, ebids[2], "hex", num_elem_in_block[2],
  175. num_nodes_per_elem[2], 1);
  176. printf ("after ex_put_elem_block, error = %d\n", error);
  177. error = ex_put_elem_block (exoid, ebids[3], "tetra", num_elem_in_block[3],
  178. num_nodes_per_elem[3], 1);
  179. printf ("after ex_put_elem_block, error = %d\n", error);
  180. error = ex_put_elem_block (exoid, ebids[4], "wedge", num_elem_in_block[4],
  181. num_nodes_per_elem[4], 1);
  182. printf ("after ex_put_elem_block, error = %d\n", error);
  183. /* write element block properties */
  184. prop_names[0] = "MATL";
  185. prop_names[1] = "DENSITY";
  186. error = ex_put_prop_names(exoid,EX_ELEM_BLOCK,2,prop_names);
  187. printf ("after ex_put_prop_names, error = %d\n", error);
  188. error = ex_put_prop(exoid, EX_ELEM_BLOCK, ebids[0], "MATL", 10);
  189. printf ("after ex_put_prop, error = %d\n", error);
  190. error = ex_put_prop(exoid, EX_ELEM_BLOCK, ebids[1], "MATL", 20);
  191. printf ("after ex_put_prop, error = %d\n", error);
  192. error = ex_put_prop(exoid, EX_ELEM_BLOCK, ebids[2], "MATL", 30);
  193. printf ("after ex_put_prop, error = %d\n", error);
  194. error = ex_put_prop(exoid, EX_ELEM_BLOCK, ebids[3], "MATL", 40);
  195. printf ("after ex_put_prop, error = %d\n", error);
  196. error = ex_put_prop(exoid, EX_ELEM_BLOCK, ebids[4], "MATL", 50);
  197. printf ("after ex_put_prop, error = %d\n", error);
  198. /* write element connectivity */
  199. connect = (int *) calloc(8, sizeof(int));
  200. connect[0] = 1; connect[1] = 2; connect[2] = 3; connect[3] = 4;
  201. error = ex_put_elem_conn (exoid, ebids[0], connect);
  202. printf ("after ex_put_elem_conn, error = %d\n", error);
  203. connect[0] = 5; connect[1] = 6; connect[2] = 7; connect[3] = 8;
  204. error = ex_put_elem_conn (exoid, ebids[1], connect);
  205. printf ("after ex_put_elem_conn, error = %d\n", error);
  206. connect[0] = 9; connect[1] = 10; connect[2] = 11; connect[3] = 12;
  207. connect[4] = 13; connect[5] = 14; connect[6] = 15; connect[7] = 16;
  208. error = ex_put_elem_conn (exoid, ebids[2], connect);
  209. printf ("after ex_put_elem_conn, error = %d\n", error);
  210. connect[0] = 17; connect[1] = 18; connect[2] = 19; connect[3] = 20;
  211. error = ex_put_elem_conn (exoid, ebids[3], connect);
  212. printf ("after ex_put_elem_conn, error = %d\n", error);
  213. connect[0] = 21; connect[1] = 22; connect[2] = 23;
  214. connect[3] = 24; connect[4] = 25; connect[5] = 26;
  215. error = ex_put_elem_conn (exoid, ebids[4], connect);
  216. printf ("after ex_put_elem_conn, error = %d\n", error);
  217. free (connect);
  218. /* write element block attributes */
  219. attrib[0] = 3.14159;
  220. error = ex_put_elem_attr (exoid, ebids[0], attrib);
  221. printf ("after ex_put_elem_attr, error = %d\n", error);
  222. attrib[0] = 6.14159;
  223. error = ex_put_elem_attr (exoid, ebids[1], attrib);
  224. printf ("after ex_put_elem_attr, error = %d\n", error);
  225. error = ex_put_elem_attr (exoid, ebids[2], attrib);
  226. printf ("after ex_put_elem_attr, error = %d\n", error);
  227. error = ex_put_elem_attr (exoid, ebids[3], attrib);
  228. printf ("after ex_put_elem_attr, error = %d\n", error);
  229. error = ex_put_elem_attr (exoid, ebids[4], attrib);
  230. printf ("after ex_put_elem_attr, error = %d\n", error);
  231. /* write individual node sets */
  232. error = ex_put_node_set_param (exoid, 20, 5, 5);
  233. printf ("after ex_put_node_set_param, error = %d\n", error);
  234. node_list[0] = 10; node_list[1] = 11; node_list[2] = 12;
  235. node_list[3] = 13; node_list[4] = 14;
  236. dist_fact[0] = 1.0; dist_fact[1] = 2.0; dist_fact[2] = 3.0;
  237. dist_fact[3] = 4.0; dist_fact[4] = 5.0;
  238. error = ex_put_node_set (exoid, 20, node_list);
  239. printf ("after ex_put_node_set, error = %d\n", error);
  240. error = ex_put_node_set_dist_fact (exoid, 20, dist_fact);
  241. printf ("after ex_put_node_set_dist_fact, error = %d\n", error);
  242. error = ex_put_node_set_param (exoid, 21, 3, 3);
  243. printf ("after ex_put_node_set_param, error = %d\n", error);
  244. node_list[0] = 20; node_list[1] = 21; node_list[2] = 22;
  245. dist_fact[0] = 1.1; dist_fact[1] = 2.1; dist_fact[2] = 3.1;
  246. error = ex_put_node_set (exoid, 21, node_list);
  247. printf ("after ex_put_node_set, error = %d\n", error);
  248. error = ex_put_node_set_dist_fact (exoid, 21, dist_fact);
  249. printf ("after ex_put_node_set_dist_fact, error = %d\n", error);
  250. error = ex_put_prop(exoid, EX_NODE_SET, 20, "FACE", 4);
  251. printf ("after ex_put_prop, error = %d\n", error);
  252. error = ex_put_prop(exoid, EX_NODE_SET, 21, "FACE", 5);
  253. printf ("after ex_put_prop, error = %d\n", error);
  254. prop_array[0] = 1000;
  255. prop_array[1] = 2000;
  256. error = ex_put_prop_array(exoid, EX_NODE_SET, "VELOCITY", prop_array);
  257. printf ("after ex_put_prop_array, error = %d\n", error);
  258. /* write individual side sets */
  259. error = ex_put_side_set_param (exoid, 30, 2, 4);
  260. printf ("after ex_put_side_set_param, error = %d\n", error);
  261. /* side set #1 - quad */
  262. elem_list[0] = 2; elem_list[1] = 2;
  263. side_list[0] = 4; side_list[1] = 2;
  264. dist_fact[0] = 30.0; dist_fact[1] = 30.1; dist_fact[2] = 30.2;
  265. dist_fact[3] = 30.3;
  266. error = ex_put_side_set (exoid, 30, elem_list, side_list);
  267. printf ("after ex_put_side_set, error = %d\n", error);
  268. error = ex_put_side_set_dist_fact (exoid, 30, dist_fact);
  269. printf ("after ex_put_side_set_dist_fact, error = %d\n", error);
  270. /* side set #2 - quad, spanning 2 elements */
  271. error = ex_put_side_set_param (exoid, 31, 2, 4);
  272. printf ("after ex_put_side_set_param, error = %d\n", error);
  273. elem_list[0] = 1; elem_list[1] = 2;
  274. side_list[0] = 2; side_list[1] = 3;
  275. dist_fact[0] = 31.0; dist_fact[1] = 31.1; dist_fact[2] = 31.2;
  276. dist_fact[3] = 31.3;
  277. error = ex_put_side_set (exoid, 31, elem_list, side_list);
  278. printf ("after ex_put_side_set, error = %d\n", error);
  279. error = ex_put_side_set_dist_fact (exoid, 31, dist_fact);
  280. printf ("after ex_put_side_set_dist_fact, error = %d\n", error);
  281. /* side set #3 - hex */
  282. error = ex_put_side_set_param (exoid, 32, 7, 0);
  283. printf ("after ex_put_side_set_param, error = %d\n", error);
  284. elem_list[0] = 3; elem_list[1] = 3;
  285. elem_list[2] = 3; elem_list[3] = 3;
  286. elem_list[4] = 3; elem_list[5] = 3;
  287. elem_list[6] = 3;
  288. side_list[0] = 5; side_list[1] = 3;
  289. side_list[2] = 3; side_list[3] = 2;
  290. side_list[4] = 4; side_list[5] = 1;
  291. side_list[6] = 6;
  292. error = ex_put_side_set (exoid, 32, elem_list, side_list);
  293. printf ("after ex_put_side_set, error = %d\n", error);
  294. /* side set #4 - tetras */
  295. error = ex_put_side_set_param (exoid, 33, 4, 0);
  296. printf ("after ex_put_side_set_param, error = %d\n", error);
  297. elem_list[0] = 4; elem_list[1] = 4;
  298. elem_list[2] = 4; elem_list[3] = 4;
  299. side_list[0] = 1; side_list[1] = 2;
  300. side_list[2] = 3; side_list[3] = 4;
  301. error = ex_put_side_set (exoid, 33, elem_list, side_list);
  302. printf ("after ex_put_side_set, error = %d\n", error);
  303. /* side set #5 - wedges */
  304. error = ex_put_side_set_param (exoid, 34, 5, 0);
  305. printf ("after ex_put_side_set_param, error = %d\n", error);
  306. elem_list[0] = 5; elem_list[1] = 5;
  307. elem_list[2] = 5; elem_list[3] = 5;
  308. elem_list[4] = 5;
  309. side_list[0] = 1; side_list[1] = 2;
  310. side_list[2] = 3; side_list[3] = 4;
  311. side_list[4] = 5;
  312. error = ex_put_side_set (exoid, 34, elem_list, side_list);
  313. printf ("after ex_put_side_set, error = %d\n", error);
  314. error = ex_put_prop(exoid, EX_SIDE_SET, 30, "COLOR", 100);
  315. printf ("after ex_put_prop, error = %d\n", error);
  316. error = ex_put_prop(exoid, EX_SIDE_SET, 31, "COLOR", 101);
  317. printf ("after ex_put_prop, error = %d\n", error);
  318. /* END COMMENTED OUT SECTION */
  319. /* write QA records */
  320. num_qa_rec = 2;
  321. qa_record[0][0] = "TESTWTD";
  322. qa_record[0][1] = "testwtd";
  323. qa_record[0][2] = "07/07/93";
  324. qa_record[0][3] = "15:41:33";
  325. qa_record[1][0] = "FASTQ";
  326. qa_record[1][1] = "fastq";
  327. qa_record[1][2] = "07/07/93";
  328. qa_record[1][3] = "16:41:33";
  329. error = ex_put_qa (exoid, num_qa_rec, qa_record);
  330. printf ("after ex_put_qa, error = %d\n", error);
  331. /* write information records */
  332. num_info = 3;
  333. info[0] = "This is the first information record.";
  334. info[1] = "This is the second information record.";
  335. info[2] = "This is the third information record.";
  336. error = ex_put_info (exoid, num_info, info);
  337. printf ("after ex_put_info, error = %d\n", error);
  338. /* write results variables parameters and names */
  339. num_glo_vars = 1;
  340. var_names[0] = "glo_vars";
  341. error = ex_put_var_param (exoid, "g", num_glo_vars);
  342. printf ("after ex_put_var_param, error = %d\n", error);
  343. error = ex_put_var_names (exoid, "g", num_glo_vars, var_names);
  344. printf ("after ex_put_var_names, error = %d\n", error);
  345. num_nod_vars = 2;
  346. var_names[0] = "nod_var0";
  347. var_names[1] = "nod_var1";
  348. error = ex_put_var_param (exoid, "n", num_nod_vars);
  349. printf ("after ex_put_var_param, error = %d\n", error);
  350. error = ex_put_var_names (exoid, "n", num_nod_vars, var_names);
  351. printf ("after ex_put_var_names, error = %d\n", error);
  352. num_ele_vars = 3;
  353. var_names[0] = "ele_var0";
  354. var_names[1] = "ele_var1";
  355. var_names[2] = "ele_var2";
  356. error = ex_put_var_param (exoid, "e", num_ele_vars);
  357. printf ("after ex_put_var_param, error = %d\n", error);
  358. error = ex_put_var_names (exoid, "e", num_ele_vars, var_names);
  359. printf ("after ex_put_var_names, error = %d\n", error);
  360. /* write element variable truth table */
  361. truth_tab = (int *) calloc ((num_elem_blk*num_ele_vars), sizeof(int));
  362. k = 0;
  363. for (i=0; i<num_elem_blk; i++)
  364. {
  365. for (j=0; j<num_ele_vars; j++)
  366. {
  367. truth_tab[k++] = 1;
  368. }
  369. }
  370. error = ex_put_elem_var_tab (exoid, num_elem_blk, num_ele_vars, truth_tab);
  371. printf ("after ex_put_elem_var_tab, error = %d\n", error);
  372. free (truth_tab);
  373. /* for each time step, write the analysis results;
  374. * the code below fills the arrays glob_var_vals,
  375. * nodal_var_vals, and elem_var_vals with values for debugging purposes;
  376. * obviously the analysis code will populate these arrays
  377. */
  378. whole_time_step = 1;
  379. num_time_steps = 10;
  380. glob_var_vals = (double *) calloc (num_glo_vars, CPU_word_size);
  381. nodal_var_vals = (double *) calloc (num_nodes, CPU_word_size);
  382. elem_var_vals = (double *) calloc (4, CPU_word_size);
  383. for (i=0; i<num_time_steps; i++)
  384. {
  385. time_value = (double)(i+1)/100.;
  386. /* write time value */
  387. error = ex_put_time (exoid, whole_time_step, &time_value);
  388. printf ("after ex_put_time, error = %d\n", error);
  389. /* write global variables */
  390. for (j=0; j<num_glo_vars; j++)
  391. {
  392. glob_var_vals[j] = (float)(j+2) * time_value;
  393. }
  394. error = ex_put_glob_vars (exoid, whole_time_step, num_glo_vars,
  395. glob_var_vals);
  396. printf ("after ex_put_glob_vars, error = %d\n", error);
  397. /* write nodal variables */
  398. for (k=1; k<=num_nod_vars; k++)
  399. {
  400. for (j=0; j<num_nodes; j++)
  401. {
  402. nodal_var_vals[j] = (float)k + ((float)(j+1) * time_value);
  403. }
  404. error = ex_put_nodal_var (exoid, whole_time_step, k, num_nodes,
  405. nodal_var_vals);
  406. printf ("after ex_put_nodal_var, error = %d\n", error);
  407. }
  408. /* write element variables */
  409. for (k=1; k<=num_ele_vars; k++)
  410. {
  411. for (j=0; j<num_elem_blk; j++)
  412. {
  413. for (m=0; m<num_elem_in_block[j]; m++)
  414. {
  415. elem_var_vals[m] = (float)(k+1) + (float)(j+2) +
  416. ((float)(m+1)*time_value);
  417. /* printf("elem_var_vals[%d]: %f\n",m,elem_var_vals[m]); */
  418. }
  419. error = ex_put_elem_var (exoid, whole_time_step, k, ebids[j],
  420. num_elem_in_block[j], elem_var_vals);
  421. printf ("after ex_put_elem_var, error = %d\n", error);
  422. }
  423. }
  424. whole_time_step++;
  425. /* update the data file; this should be done at the end of every time step
  426. * to ensure that no data is lost if the analysis dies
  427. */
  428. error = ex_update (exoid);
  429. printf ("after ex_update, error = %d\n", error);
  430. }
  431. free(glob_var_vals);
  432. free(nodal_var_vals);
  433. free(elem_var_vals);
  434. /* close the EXODUS files
  435. */
  436. error = ex_close (exoid);
  437. printf ("after ex_close, error = %d\n", error);
  438. return 0;
  439. }