PageRenderTime 49ms CodeModel.GetById 2ms app.highlight 42ms RepoModel.GetById 1ms 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
  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
 59
 60#include <stdlib.h>
 61#include <stdio.h>
 62#include "netcdf.h"
 63#include "exodusII.h"
 64
 65int main (int argc, char **argv)
 66{
 67   int exoid, num_dim, num_nodes, num_elem, num_elem_blk;
 68   int num_elem_in_block[10], num_nodes_per_elem[10];
 69   int num_node_sets, num_side_sets, error;
 70   int i, j, k, m, *elem_map, *connect;
 71   int  node_list[100],elem_list[100],side_list[100];
 72   int ebids[100];
 73   int  num_qa_rec, num_info;
 74   int num_glo_vars, num_nod_vars, num_ele_vars;
 75   int *truth_tab;
 76   int whole_time_step, num_time_steps;
 77   int CPU_word_size,IO_word_size;
 78   int prop_array[2];
 79
 80   double *glob_var_vals, *nodal_var_vals, *elem_var_vals;
 81   double time_value;
 82   double x[100], y[100], z[100];
 83   double attrib[1], dist_fact[100];
 84   char *coord_names[3], *qa_record[2][4], *info[3], *var_names[3];
 85   char *prop_names[2];
 86
 87   ex_opts (EX_VERBOSE | EX_ABORT);
 88
 89/* Specify compute and i/o word size */
 90
 91   CPU_word_size = 8;                   /* double */
 92   IO_word_size = 8;                    /* use double size (8 bytes) */
 93
 94/* create EXODUS II file */
 95
 96   exoid = ex_create ("test.exo",       /* filename path */
 97                       EX_CLOBBER,      /* create mode */
 98                       &CPU_word_size,  /* CPU float word size in bytes */
 99                       &IO_word_size);  /* I/O float word size in bytes */
100   printf ("after ex_create for test.exo, exoid = %d\n", exoid);
101   printf (" cpu word size: %d io word size: %d\n",CPU_word_size,IO_word_size);
102
103   /* ncopts = NC_VERBOSE; */
104
105/* initialize file with parameters */
106
107   num_dim = 3;
108   num_nodes = 26;
109   num_elem = 5;
110   num_elem_blk = 5;
111   num_node_sets = 2;
112   num_side_sets = 5;
113
114   error = ex_put_init (exoid, "This is a test", num_dim, num_nodes, num_elem,
115                        num_elem_blk, num_node_sets, num_side_sets);
116
117   printf ("after ex_put_init, error = %d\n", error);
118
119/* write nodal coordinates values and names to database */
120
121/* Quad #1 */
122   x[0] = 0.0; y[0] = 0.0; z[0] = 0.0;
123   x[1] = 1.0; y[1] = 0.0; z[1] = 0.0;
124   x[2] = 1.0; y[2] = 1.0; z[2] = 0.0;
125   x[3] = 0.0; y[3] = 1.0; z[3] = 0.0;
126
127/* Quad #2 */
128   x[4]  =  1.0; y[4]  =  0.0; z[4]  =  0.0;
129   x[5]  =  2.0; y[5]  =  0.0; z[5]  =  0.0;
130   x[6]  =  2.0; y[6]  =  1.0; z[6]  =  0.0;
131   x[7]  =  1.0; y[7]  =  1.0; z[7]  =  0.0;
132
133/* Hex #1 */
134   x[8]  =  0.0; y[8]  =  0.0; z[8]  =  0.0;
135   x[9]  = 10.0; y[9]  =  0.0; z[9]  =  0.0;
136   x[10] = 10.0; y[10] =  0.0; z[10] =-10.0;
137   x[11] =  1.0; y[11] =  0.0; z[11] =-10.0;
138   x[12] =  1.0; y[12] = 10.0; z[12] =  0.0;
139   x[13] = 10.0; y[13] = 10.0; z[13] =  0.0;
140   x[14] = 10.0; y[14] = 10.0; z[14] =-10.0;
141   x[15] =  1.0; y[15] = 10.0; z[15] =-10.0;
142
143/* Tetra #1 */
144   x[16] =  0.0; y[16] =  0.0; z[16] =  0.0;
145   x[17] =  1.0; y[17] =  0.0; z[17] =  5.0;
146   x[18] = 10.0; y[18] =  0.0; z[18] =  2.0;
147   x[19] =  7.0; y[19] =  5.0; z[19] =  3.0;
148
149/* Wedge #1 */
150   x[20] =  3.0; y[20] =  0.0; z[20] =  6.0;
151   x[21] =  6.0; y[21] =  0.0; z[21] =  0.0;
152   x[22] =  0.0; y[22] =  0.0; z[22] =  0.0;
153   x[23] =  3.0; y[23] =  2.0; z[23] =  6.0;
154   x[24] =  6.0; y[24] =  2.0; z[24] =  2.0;
155   x[25] =  0.0; y[25] =  2.0; z[25] =  0.0;
156
157
158   error = ex_put_coord (exoid, x, y, z);
159   printf ("after ex_put_coord, error = %d\n", error);
160
161
162   coord_names[0] = "xcoor";
163   coord_names[1] = "ycoor";
164   coord_names[2] = "zcoor";
165
166   error = ex_put_coord_names (exoid, coord_names);
167   printf ("after ex_put_coord_names, error = %d\n", error);
168
169
170/* write element order map */
171
172   elem_map = (int *) calloc(num_elem, sizeof(int));
173
174   for (i=1; i<=num_elem; i++)
175   {
176      elem_map[i-1] = i;
177   }
178
179   error = ex_put_map (exoid, elem_map);
180   printf ("after ex_put_map, error = %d\n", error);
181
182   free (elem_map);
183
184
185/* write element block parameters */
186
187   num_elem_in_block[0] = 1;
188   num_elem_in_block[1] = 1;
189   num_elem_in_block[2] = 1;
190   num_elem_in_block[3] = 1;
191   num_elem_in_block[4] = 1;
192
193   num_nodes_per_elem[0] = 4; /* elements in block #1 are 4-node quads  */
194   num_nodes_per_elem[1] = 4; /* elements in block #2 are 4-node quads  */
195   num_nodes_per_elem[2] = 8; /* elements in block #3 are 8-node hexes  */
196   num_nodes_per_elem[3] = 4; /* elements in block #3 are 4-node tetras */
197   num_nodes_per_elem[4] = 6; /* elements in block #3 are 6-node wedges */
198
199   ebids[0] = 10;
200   ebids[1] = 11;
201   ebids[2] = 12;
202   ebids[3] = 13;
203   ebids[4] = 14;
204
205
206   error = ex_put_elem_block (exoid, ebids[0], "quad", num_elem_in_block[0],
207                              num_nodes_per_elem[0], 1);
208   printf ("after ex_put_elem_block, error = %d\n", error);
209
210   error = ex_put_elem_block (exoid, ebids[1], "quad", num_elem_in_block[1],
211                              num_nodes_per_elem[0], 1);
212   printf ("after ex_put_elem_block, error = %d\n", error);
213
214   error = ex_put_elem_block (exoid, ebids[2], "hex", num_elem_in_block[2],
215                               num_nodes_per_elem[2], 1);
216   printf ("after ex_put_elem_block, error = %d\n", error);
217
218   error = ex_put_elem_block (exoid, ebids[3], "tetra", num_elem_in_block[3],
219                               num_nodes_per_elem[3], 1);
220   printf ("after ex_put_elem_block, error = %d\n", error);
221
222   error = ex_put_elem_block (exoid, ebids[4], "wedge", num_elem_in_block[4],
223                               num_nodes_per_elem[4], 1);
224   printf ("after ex_put_elem_block, error = %d\n", error);
225
226
227
228/* write element block properties */
229
230   prop_names[0] = "MATL";
231   prop_names[1] = "DENSITY";
232   error = ex_put_prop_names(exoid,EX_ELEM_BLOCK,2,prop_names);
233   printf ("after ex_put_prop_names, error = %d\n", error);
234
235   error = ex_put_prop(exoid, EX_ELEM_BLOCK, ebids[0], "MATL", 10);
236   printf ("after ex_put_prop, error = %d\n", error);
237   error = ex_put_prop(exoid, EX_ELEM_BLOCK, ebids[1], "MATL", 20);
238   printf ("after ex_put_prop, error = %d\n", error);
239   error = ex_put_prop(exoid, EX_ELEM_BLOCK, ebids[2], "MATL", 30);
240   printf ("after ex_put_prop, error = %d\n", error);
241   error = ex_put_prop(exoid, EX_ELEM_BLOCK, ebids[3], "MATL", 40);
242   printf ("after ex_put_prop, error = %d\n", error);
243   error = ex_put_prop(exoid, EX_ELEM_BLOCK, ebids[4], "MATL", 50);
244   printf ("after ex_put_prop, error = %d\n", error);
245
246
247/* write element connectivity */
248
249   connect = (int *) calloc(8, sizeof(int));
250   connect[0] = 1; connect[1] = 2; connect[2] = 3; connect[3] = 4;
251
252   error = ex_put_elem_conn (exoid, ebids[0], connect);
253   printf ("after ex_put_elem_conn, error = %d\n", error);
254
255   connect[0] = 5; connect[1] = 6; connect[2] = 7; connect[3] = 8;
256
257   error = ex_put_elem_conn (exoid, ebids[1], connect);
258   printf ("after ex_put_elem_conn, error = %d\n", error);
259
260   connect[0] = 9; connect[1] = 10; connect[2] = 11; connect[3] = 12;
261   connect[4] = 13; connect[5] = 14; connect[6] = 15; connect[7] = 16;
262
263   error = ex_put_elem_conn (exoid, ebids[2], connect);
264   printf ("after ex_put_elem_conn, error = %d\n", error);
265
266   connect[0] = 17; connect[1] = 18; connect[2] = 19; connect[3] = 20;
267
268   error = ex_put_elem_conn (exoid, ebids[3], connect);
269   printf ("after ex_put_elem_conn, error = %d\n", error);
270
271   connect[0] = 21; connect[1] = 22; connect[2] = 23;
272   connect[3] = 24; connect[4] = 25; connect[5] = 26;
273
274   error = ex_put_elem_conn (exoid, ebids[4], connect);
275   printf ("after ex_put_elem_conn, error = %d\n", error);
276
277
278   free (connect);
279
280
281/* write element block attributes */
282
283   attrib[0] = 3.14159;
284   error = ex_put_elem_attr (exoid, ebids[0], attrib);
285   printf ("after ex_put_elem_attr, error = %d\n", error);
286
287   attrib[0] = 6.14159;
288   error = ex_put_elem_attr (exoid, ebids[1], attrib);
289   printf ("after ex_put_elem_attr, error = %d\n", error);
290
291   error = ex_put_elem_attr (exoid, ebids[2], attrib);
292   printf ("after ex_put_elem_attr, error = %d\n", error);
293
294   error = ex_put_elem_attr (exoid, ebids[3], attrib);
295   printf ("after ex_put_elem_attr, error = %d\n", error);
296
297   error = ex_put_elem_attr (exoid, ebids[4], attrib);
298   printf ("after ex_put_elem_attr, error = %d\n", error);
299
300
301/* write individual node sets */
302
303   error = ex_put_node_set_param (exoid, 20, 5, 5);
304   printf ("after ex_put_node_set_param, error = %d\n", error);
305
306   node_list[0] = 10; node_list[1] = 11; node_list[2] = 12; 
307   node_list[3] = 13; node_list[4] = 14; 
308
309   dist_fact[0] = 1.0; dist_fact[1] = 2.0; dist_fact[2] = 3.0;
310   dist_fact[3] = 4.0; dist_fact[4] = 5.0;
311
312   error = ex_put_node_set (exoid, 20, node_list);
313   printf ("after ex_put_node_set, error = %d\n", error);
314   error = ex_put_node_set_dist_fact (exoid, 20, dist_fact);
315   printf ("after ex_put_node_set_dist_fact, error = %d\n", error);
316
317   error = ex_put_node_set_param (exoid, 21, 3, 3);
318   printf ("after ex_put_node_set_param, error = %d\n", error);
319
320   node_list[0] = 20; node_list[1] = 21; node_list[2] = 22; 
321
322   dist_fact[0] = 1.1; dist_fact[1] = 2.1; dist_fact[2] = 3.1;
323
324   error = ex_put_node_set (exoid, 21, node_list);
325   printf ("after ex_put_node_set, error = %d\n", error);
326   error = ex_put_node_set_dist_fact (exoid, 21, dist_fact);
327   printf ("after ex_put_node_set_dist_fact, error = %d\n", error);
328
329   error = ex_put_prop(exoid, EX_NODE_SET, 20, "FACE", 4);
330   printf ("after ex_put_prop, error = %d\n", error);
331   error = ex_put_prop(exoid, EX_NODE_SET, 21, "FACE", 5);
332   printf ("after ex_put_prop, error = %d\n", error);
333
334   prop_array[0] = 1000;
335   prop_array[1] = 2000;
336
337   error = ex_put_prop_array(exoid, EX_NODE_SET, "VELOCITY", prop_array);
338   printf ("after ex_put_prop_array, error = %d\n", error);
339
340
341   /* write individual side sets */
342   error = ex_put_side_set_param (exoid, 30, 2, 4);
343   printf ("after ex_put_side_set_param, error = %d\n", error);
344
345   /* side set #1  - quad */
346
347   elem_list[0] = 2; elem_list[1] = 2;
348
349   side_list[0] = 4; side_list[1] = 2;
350
351   dist_fact[0] = 30.0; dist_fact[1] = 30.1; dist_fact[2] = 30.2;
352   dist_fact[3] = 30.3;
353
354   error = ex_put_side_set (exoid, 30, elem_list, side_list);
355   printf ("after ex_put_side_set, error = %d\n", error);
356
357   error = ex_put_side_set_dist_fact (exoid, 30, dist_fact);
358   printf ("after ex_put_side_set_dist_fact, error = %d\n", error);
359
360   /* side set #2  - quad, spanning 2 elements  */
361
362   error = ex_put_side_set_param (exoid, 31, 2, 4);
363   printf ("after ex_put_side_set_param, error = %d\n", error);
364
365   elem_list[0] = 1; elem_list[1] = 2;
366
367   side_list[0] = 2; side_list[1] = 3;
368
369   dist_fact[0] = 31.0; dist_fact[1] = 31.1; dist_fact[2] = 31.2;
370   dist_fact[3] = 31.3;
371
372   error = ex_put_side_set (exoid, 31, elem_list, side_list);
373   printf ("after ex_put_side_set, error = %d\n", error);
374
375   error = ex_put_side_set_dist_fact (exoid, 31, dist_fact);
376   printf ("after ex_put_side_set_dist_fact, error = %d\n", error);
377
378   /* side set #3  - hex */
379   error = ex_put_side_set_param (exoid, 32, 7, 0);
380   printf ("after ex_put_side_set_param, error = %d\n", error);
381
382   elem_list[0] = 3; elem_list[1] = 3;
383   elem_list[2] = 3; elem_list[3] = 3;
384   elem_list[4] = 3; elem_list[5] = 3;
385   elem_list[6] = 3;
386
387   side_list[0] = 5; side_list[1] = 3;
388   side_list[2] = 3; side_list[3] = 2;
389   side_list[4] = 4; side_list[5] = 1;
390   side_list[6] = 6;
391
392   error = ex_put_side_set (exoid, 32, elem_list, side_list);
393   printf ("after ex_put_side_set, error = %d\n", error);
394
395   /* side set #4  - tetras */
396
397   error = ex_put_side_set_param (exoid, 33, 4, 0);
398   printf ("after ex_put_side_set_param, error = %d\n", error);
399
400   elem_list[0] = 4; elem_list[1] = 4;
401   elem_list[2] = 4; elem_list[3] = 4;
402
403   side_list[0] = 1; side_list[1] = 2;
404   side_list[2] = 3; side_list[3] = 4;
405
406   error = ex_put_side_set (exoid, 33, elem_list, side_list);
407   printf ("after ex_put_side_set, error = %d\n", error);
408
409   /* side set #5  - wedges */
410
411   error = ex_put_side_set_param (exoid, 34, 5, 0);
412   printf ("after ex_put_side_set_param, error = %d\n", error);
413
414   elem_list[0] = 5; elem_list[1] = 5;
415   elem_list[2] = 5; elem_list[3] = 5;
416   elem_list[4] = 5;
417
418   side_list[0] = 1; side_list[1] = 2;
419   side_list[2] = 3; side_list[3] = 4;
420   side_list[4] = 5;
421
422   error = ex_put_side_set (exoid, 34, elem_list, side_list);
423   printf ("after ex_put_side_set, error = %d\n", error);
424
425   error = ex_put_prop(exoid, EX_SIDE_SET, 30, "COLOR", 100);
426   printf ("after ex_put_prop, error = %d\n", error);
427
428   error = ex_put_prop(exoid, EX_SIDE_SET, 31, "COLOR", 101);
429   printf ("after ex_put_prop, error = %d\n", error);
430
431   /* END COMMENTED OUT SECTION */
432
433/* write QA records */
434
435   num_qa_rec = 2;
436
437
438   qa_record[0][0] = "TESTWTD";
439   qa_record[0][1] = "testwtd";
440   qa_record[0][2] = "07/07/93";
441   qa_record[0][3] = "15:41:33";
442   qa_record[1][0] = "FASTQ";
443   qa_record[1][1] = "fastq";
444   qa_record[1][2] = "07/07/93";
445   qa_record[1][3] = "16:41:33";
446
447   error = ex_put_qa (exoid, num_qa_rec, qa_record);
448   printf ("after ex_put_qa, error = %d\n", error);
449
450
451/* write information records */
452
453   num_info = 3;
454
455
456   info[0] = "This is the first information record.";
457   info[1] = "This is the second information record.";
458   info[2] = "This is the third information record.";
459
460   error = ex_put_info (exoid, num_info, info);
461   printf ("after ex_put_info, error = %d\n", error);
462
463
464
465/* write results variables parameters and names */
466
467   num_glo_vars = 1;
468
469   var_names[0] = "glo_vars";
470
471   error = ex_put_var_param (exoid, "g", num_glo_vars);
472   printf ("after ex_put_var_param, error = %d\n", error);
473   error = ex_put_var_names (exoid, "g", num_glo_vars, var_names);
474   printf ("after ex_put_var_names, error = %d\n", error);
475
476
477   num_nod_vars = 2;
478
479   var_names[0] = "nod_var0";
480   var_names[1] = "nod_var1";
481
482   error = ex_put_var_param (exoid, "n", num_nod_vars);
483   printf ("after ex_put_var_param, error = %d\n", error);
484   error = ex_put_var_names (exoid, "n", num_nod_vars, var_names);
485   printf ("after ex_put_var_names, error = %d\n", error);
486
487   num_ele_vars = 3;
488
489   var_names[0] = "ele_var0";
490   var_names[1] = "ele_var1";
491   var_names[2] = "ele_var2";
492
493   error = ex_put_var_param (exoid, "e", num_ele_vars);
494   printf ("after ex_put_var_param, error = %d\n", error);
495   error = ex_put_var_names (exoid, "e", num_ele_vars, var_names);
496   printf ("after ex_put_var_names, error = %d\n", error);
497
498
499/* write element variable truth table */
500
501   truth_tab = (int *) calloc ((num_elem_blk*num_ele_vars), sizeof(int));
502
503   k = 0;
504   for (i=0; i<num_elem_blk; i++)
505   {
506      for (j=0; j<num_ele_vars; j++)
507      {
508         truth_tab[k++] = 1;
509      }
510   }
511
512   error = ex_put_elem_var_tab (exoid, num_elem_blk, num_ele_vars, truth_tab);
513   printf ("after ex_put_elem_var_tab, error = %d\n", error);
514
515   free (truth_tab);
516
517
518/* for each time step, write the analysis results;
519 * the code below fills the arrays glob_var_vals, 
520 * nodal_var_vals, and elem_var_vals with values for debugging purposes;
521 * obviously the analysis code will populate these arrays
522 */
523
524   whole_time_step = 1;
525   num_time_steps = 10;
526
527   glob_var_vals = (double *) calloc (num_glo_vars, CPU_word_size);
528   nodal_var_vals = (double *) calloc (num_nodes, CPU_word_size);
529   elem_var_vals = (double *) calloc (4, CPU_word_size);
530
531   for (i=0; i<num_time_steps; i++)
532   {
533     time_value = (double)(i+1)/100.;
534
535/* write time value */
536
537     error = ex_put_time (exoid, whole_time_step, &time_value);
538     printf ("after ex_put_time, error = %d\n", error);
539
540/* write global variables */
541
542     for (j=0; j<num_glo_vars; j++)
543     {
544       glob_var_vals[j] = (float)(j+2) * time_value;
545     }
546
547     error = ex_put_glob_vars (exoid, whole_time_step, num_glo_vars, 
548                               glob_var_vals);
549     printf ("after ex_put_glob_vars, error = %d\n", error);
550
551/* write nodal variables */
552
553     for (k=1; k<=num_nod_vars; k++)
554     {
555       for (j=0; j<num_nodes; j++)
556       {
557         nodal_var_vals[j] = (float)k + ((float)(j+1) * time_value);
558       }
559
560       error = ex_put_nodal_var (exoid, whole_time_step, k, num_nodes,
561                                 nodal_var_vals);
562       printf ("after ex_put_nodal_var, error = %d\n", error);
563     }
564
565/* write element variables */
566
567     for (k=1; k<=num_ele_vars; k++)
568     {
569       for (j=0; j<num_elem_blk; j++)
570       {
571         for (m=0; m<num_elem_in_block[j]; m++)
572         {
573           elem_var_vals[m] = (float)(k+1) + (float)(j+2) + 
574                              ((float)(m+1)*time_value);
575           /* printf("elem_var_vals[%d]: %f\n",m,elem_var_vals[m]); */
576         }
577         error = ex_put_elem_var (exoid, whole_time_step, k, ebids[j],
578                                  num_elem_in_block[j], elem_var_vals);
579         printf ("after ex_put_elem_var, error = %d\n", error);
580       }
581     }
582
583     whole_time_step++;
584
585/* update the data file; this should be done at the end of every time step
586 * to ensure that no data is lost if the analysis dies
587 */
588     error = ex_update (exoid);
589     printf ("after ex_update, error = %d\n", error);
590
591   }
592   free(glob_var_vals);
593   free(nodal_var_vals);
594   free(elem_var_vals);
595
596
597/* close the EXODUS files
598 */
599   error = ex_close (exoid);
600   printf ("after ex_close, error = %d\n", error);
601   return 0;
602}