PageRenderTime 117ms CodeModel.GetById 2ms app.highlight 105ms RepoModel.GetById 1ms app.codeStats 0ms

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

https://bitbucket.org/vijaysm/libmesh
C | 1279 lines | 821 code | 347 blank | 111 comment | 11 complexity | fdf1f1d87e98c8af66a06ce47a94b712 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* testwt2 - 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. It tests multiple simultaneous output files.
  55*
  56*
  57*****************************************************************************/
  58
  59#define EX_TEST_INDIV_NODESET
  60#define EX_TEST_INDIV_SIDESET
  61
  62#include <stdlib.h>
  63#include <stdio.h>
  64#include "exodusII.h"
  65#include "netcdf.h"
  66int main (int argc, char **argv)
  67{
  68   int exoid, num_dim, num_nodes, num_elem, num_elem_blk;
  69   int exoid2, num_dim2, num_nodes2, num_elem2,num_elem_blk2;
  70   int num_elem_in_block[10], num_node_sets, num_nodes_per_elem[10];
  71   int num_elem_in_block2[10], num_node_sets2, num_nodes_per_elem2[10];
  72   int num_side_sets, error;
  73   int num_side_sets2;
  74   int i, j, k, m;
  75   int *elem_map, *connect, node_list[100],elem_list[100],side_list[100];
  76   int *elem_map2, *connect2, node_list2[100],elem_list2[100],side_list2[100];
  77   int ebids[10];
  78   int ebids2[10];
  79   int num_qa_rec, num_info;
  80   int num_qa_rec2,num_info2;
  81   int num_glo_vars, num_nod_vars, num_ele_vars;
  82   int num_glo_vars2, num_nod_vars2, num_ele_vars2;
  83   int *truth_tab;
  84   int whole_time_step, num_time_steps;
  85   int CPU_word_size,IO_word_size;
  86   int prop_array[2];
  87
  88   float *glob_var_vals, *nodal_var_vals, *elem_var_vals;
  89   float time_value;
  90   float time_value2;
  91   float x[100], y[100], z[100];
  92   float attrib[1], dist_fact[100];
  93   float attrib2[1], dist_fact2[100];
  94   char *coord_names[3], *qa_record[2][4], *info[3], *var_names[3];
  95   char *coord_names2[3], *qa_record2[2][4], *info2[3], *var_names2[3];
  96   char *prop_names[2];
  97
  98   ex_opts (EX_VERBOSE | EX_ABORT);
  99
 100/* Specify compute and i/o word size */
 101
 102   CPU_word_size = 0;                   /* sizeof(float) */
 103   IO_word_size = 4;                    /* (4 bytes) */
 104
 105/* create EXODUS II files (a "regular" and a "history") */
 106
 107   exoid = ex_create ("test.exo",       /* filename path */
 108                       EX_CLOBBER,      /* create mode */
 109                       &CPU_word_size,  /* CPU float word size in bytes */
 110                       &IO_word_size);  /* I/O float word size in bytes */
 111   printf ("after ex_create for test.exo, exoid = %d\n", exoid);
 112   printf (" cpu word size: %d io word size: %d\n",CPU_word_size,IO_word_size);
 113
 114   exoid2= ex_create ("test2.exo",      /* filename path */
 115                       EX_CLOBBER,      /* create mode */
 116                       &CPU_word_size,  /* CPU float word size in bytes */
 117                       &IO_word_size);  /* I/O float word size in bytes */
 118   printf ("after ex_create for test2.exo, exoid = %d\n", exoid2);
 119
 120   /* ncopts = NC_VERBOSE; */
 121
 122/* initialize file with parameters */
 123
 124   num_dim = 3;
 125   num_nodes = 26;
 126   num_elem = 5;
 127   num_elem_blk = 5;
 128   num_node_sets = 2;
 129   num_side_sets = 5;
 130
 131   error = ex_put_init (exoid, "This is a test", num_dim, num_nodes, num_elem,
 132                        num_elem_blk, num_node_sets, num_side_sets);
 133
 134   printf ("after ex_put_init, error = %d\n", error);
 135
 136
 137
 138/* initialize file 2 with parameters */
 139
 140   num_dim2 = 3;
 141   num_nodes2 = 26;
 142   num_elem2 = 5;
 143   num_elem_blk2 = 5;
 144   num_node_sets2 = 2;
 145   num_side_sets2 = 5;
 146
 147   error = ex_put_init (exoid2, "This is test 2",num_dim2,num_nodes2,num_elem2,
 148                        num_elem_blk2, num_node_sets2, num_side_sets2);
 149
 150   printf ("after ex_put_init (2), error = %d\n", error);
 151
 152/* write nodal coordinates values and names to database */
 153
 154/* Quad #1 */
 155   x[0] = 0.0; y[0] = 0.0; z[0] = 0.0;
 156   x[1] = 1.0; y[1] = 0.0; z[1] = 0.0;
 157   x[2] = 1.0; y[2] = 1.0; z[2] = 0.0;
 158   x[3] = 0.0; y[3] = 1.0; z[3] = 0.0;
 159
 160/* Quad #2 */
 161   x[4]  =  1.0; y[4]  =  0.0; z[4]  =  0.0;
 162   x[5]  =  2.0; y[5]  =  0.0; z[5]  =  0.0;
 163   x[6]  =  2.0; y[6]  =  1.0; z[6]  =  0.0;
 164   x[7]  =  1.0; y[7]  =  1.0; z[7]  =  0.0;
 165
 166/* Hex #1 */
 167   x[8]  =  0.0; y[8]  =  0.0; z[8]  =  0.0;
 168   x[9]  = 10.0; y[9]  =  0.0; z[9]  =  0.0;
 169   x[10] = 10.0; y[10] =  0.0; z[10] =-10.0;
 170   x[11] =  1.0; y[11] =  0.0; z[11] =-10.0;
 171   x[12] =  1.0; y[12] = 10.0; z[12] =  0.0;
 172   x[13] = 10.0; y[13] = 10.0; z[13] =  0.0;
 173   x[14] = 10.0; y[14] = 10.0; z[14] =-10.0;
 174   x[15] =  1.0; y[15] = 10.0; z[15] =-10.0;
 175
 176/* Tetra #1 */
 177   x[16] =  0.0; y[16] =  0.0; z[16] =  0.0;
 178   x[17] =  1.0; y[17] =  0.0; z[17] =  5.0;
 179   x[18] = 10.0; y[18] =  0.0; z[18] =  2.0;
 180   x[19] =  7.0; y[19] =  5.0; z[19] =  3.0;
 181
 182/* Wedge #1 */
 183   x[20] =  3.0; y[20] =  0.0; z[20] =  6.0;
 184   x[21] =  6.0; y[21] =  0.0; z[21] =  0.0;
 185   x[22] =  0.0; y[22] =  0.0; z[22] =  0.0;
 186   x[23] =  3.0; y[23] =  2.0; z[23] =  6.0;
 187   x[24] =  6.0; y[24] =  2.0; z[24] =  2.0;
 188   x[25] =  0.0; y[25] =  2.0; z[25] =  0.0;
 189
 190   error = ex_put_coord (exoid, x, y, z);
 191   printf ("after ex_put_coord, error = %d\n", error);
 192
 193/* write nodal coordinates values and names to database 2 */
 194
 195   error = ex_put_coord (exoid2, x, y, z);
 196   printf ("after ex_put_coord (2), error = %d\n", error);
 197
 198   coord_names[0] = "xcoor";
 199   coord_names[1] = "ycoor";
 200   coord_names[2] = "zcoor";
 201
 202   error = ex_put_coord_names (exoid, coord_names);
 203   printf ("after ex_put_coord_names, error = %d\n", error);
 204
 205   coord_names2[0] = "xcoor";
 206   coord_names2[1] = "ycoor";
 207   coord_names2[2] = "zcoor";
 208
 209   error = ex_put_coord_names (exoid2, coord_names2);
 210   printf ("after ex_put_coord_names (2), error = %d\n", error);
 211
 212
 213/* write element order map */
 214
 215   elem_map = (int *) calloc(num_elem, sizeof(int));
 216
 217   for (i=1; i<=num_elem; i++)
 218   {
 219      elem_map[i-1] = i;
 220   }
 221
 222   error = ex_put_map (exoid, elem_map);
 223   printf ("after ex_put_map, error = %d\n", error);
 224
 225   free (elem_map);
 226
 227   elem_map2= (int *) calloc(num_elem2, sizeof(int));
 228
 229   for (i=1; i<=num_elem2; i++)
 230   {
 231      elem_map2[i-1] = i;
 232   }
 233
 234   error = ex_put_map (exoid2, elem_map2);
 235   printf ("after ex_put_map (2), error = %d\n", error);
 236
 237   free (elem_map2);
 238
 239
 240/* write element block parameters */
 241
 242   num_elem_in_block[0] = 1;
 243   num_elem_in_block[1] = 1;
 244   num_elem_in_block[2] = 1;
 245   num_elem_in_block[3] = 1;
 246   num_elem_in_block[4] = 1;
 247
 248   num_nodes_per_elem[0] = 4; /* elements in block #1 are 4-node quads  */
 249   num_nodes_per_elem[1] = 4; /* elements in block #2 are 4-node quads  */
 250   num_nodes_per_elem[2] = 8; /* elements in block #3 are 8-node hexes  */
 251   num_nodes_per_elem[3] = 4; /* elements in block #3 are 4-node tetras */
 252   num_nodes_per_elem[4] = 6; /* elements in block #3 are 6-node wedges */
 253
 254   ebids[0] = 10;
 255   ebids[1] = 11;
 256   ebids[2] = 12;
 257   ebids[3] = 13;
 258   ebids[4] = 14;
 259
 260   error = ex_put_elem_block (exoid, ebids[0], "quad", num_elem_in_block[0],
 261                              num_nodes_per_elem[0], 1);
 262   printf ("after ex_put_elem_block, error = %d\n", error);
 263
 264   error = ex_put_elem_block (exoid, ebids[1], "quad", num_elem_in_block[1],
 265                              num_nodes_per_elem[1], 1);
 266   printf ("after ex_put_elem_block, error = %d\n", error);
 267
 268   error = ex_put_elem_block (exoid, ebids[2], "hex", num_elem_in_block[2],
 269                               num_nodes_per_elem[2], 1);
 270   printf ("after ex_put_elem_block, error = %d\n", error);
 271
 272   error = ex_put_elem_block (exoid, ebids[3], "tetra", num_elem_in_block[3],
 273                               num_nodes_per_elem[3], 1);
 274   printf ("after ex_put_elem_block, error = %d\n", error);
 275
 276   error = ex_put_elem_block (exoid, ebids[4], "wedge", num_elem_in_block[4],
 277                               num_nodes_per_elem[4], 1);
 278   printf ("after ex_put_elem_block, error = %d\n", error);
 279
 280/* write element block properties */
 281
 282   prop_names[0] = "MATL";
 283   prop_names[1] = "DENSITY";
 284   error = ex_put_prop_names(exoid,EX_ELEM_BLOCK,2,prop_names);
 285   printf ("after ex_put_prop_names, error = %d\n", error);
 286
 287   error = ex_put_prop(exoid, EX_ELEM_BLOCK, ebids[0], "MATL", 10);
 288   printf ("after ex_put_prop, error = %d\n", error);
 289   error = ex_put_prop(exoid, EX_ELEM_BLOCK, ebids[1], "MATL", 20);
 290   printf ("after ex_put_prop, error = %d\n", error);
 291   error = ex_put_prop(exoid, EX_ELEM_BLOCK, ebids[2], "MATL", 30);
 292   printf ("after ex_put_prop, error = %d\n", error);
 293   error = ex_put_prop(exoid, EX_ELEM_BLOCK, ebids[3], "MATL", 40);
 294   printf ("after ex_put_prop, error = %d\n", error);
 295   error = ex_put_prop(exoid, EX_ELEM_BLOCK, ebids[4], "MATL", 50);
 296   printf ("after ex_put_prop, error = %d\n", error);
 297
 298
 299
 300   num_elem_in_block2[0] = 1;
 301   num_elem_in_block2[1] = 1;
 302   num_elem_in_block2[2] = 1;
 303   num_elem_in_block2[3] = 1;
 304   num_elem_in_block2[4] = 1;
 305
 306   num_nodes_per_elem2[0] = 4; /* elements in block #1 are 4-node quads  */
 307   num_nodes_per_elem2[1] = 4; /* elements in block #2 are 4-node quads  */
 308   num_nodes_per_elem2[2] = 8; /* elements in block #3 are 8-node hexes  */
 309   num_nodes_per_elem2[3] = 4; /* elements in block #3 are 4-node tetras */
 310   num_nodes_per_elem2[4] = 6; /* elements in block #3 are 6-node wedges */
 311
 312   ebids2[0] = 10;
 313   ebids2[1] = 11;
 314   ebids2[2] = 12;
 315   ebids2[3] = 13;
 316   ebids2[4] = 14;
 317
 318
 319   error = ex_put_elem_block (exoid2, ebids2[0], "quad", num_elem_in_block2[0],
 320                              num_nodes_per_elem2[0], 1);
 321   printf ("after ex_put_elem_block (2), error = %d\n", error);
 322
 323   error = ex_put_elem_block (exoid2, ebids2[1], "quad", num_elem_in_block2[1],
 324                              num_nodes_per_elem2[1], 1);
 325   printf ("after ex_put_elem_blocki (2), error = %d\n", error);
 326
 327   error = ex_put_elem_block (exoid2, ebids2[2], "hex", num_elem_in_block2[2],
 328                               num_nodes_per_elem2[2], 1);
 329   printf ("after ex_put_elem_blocki (2), error = %d\n", error);
 330
 331   error = ex_put_elem_block (exoid2, ebids2[3], "tetra", num_elem_in_block2[3],
 332                               num_nodes_per_elem2[3], 1);
 333   printf ("after ex_put_elem_block (2), error = %d\n", error);
 334
 335   error = ex_put_elem_block (exoid2, ebids2[4], "wedge", num_elem_in_block2[4],
 336                               num_nodes_per_elem2[4], 1);
 337   printf ("after ex_put_elem_block (2), error = %d\n", error);
 338
 339
 340/* write element block properties for file 2 */
 341
 342   prop_names[0] = "MATL";
 343   prop_names[1] = "DENSITY";
 344   error = ex_put_prop_names(exoid2,EX_ELEM_BLOCK,2,prop_names);
 345   printf ("after ex_put_prop_names (2), error = %d\n", error);
 346
 347   error = ex_put_prop(exoid2, EX_ELEM_BLOCK, ebids[0], "MATL", 100);
 348   printf ("after ex_put_prop (2), error = %d\n", error);
 349   error = ex_put_prop(exoid2, EX_ELEM_BLOCK, ebids[1], "MATL", 200);
 350   printf ("after ex_put_prop (2), error = %d\n", error);
 351   error = ex_put_prop(exoid2, EX_ELEM_BLOCK, ebids[2], "MATL", 300);
 352   printf ("after ex_put_prop (2), error = %d\n", error);
 353   error = ex_put_prop(exoid2, EX_ELEM_BLOCK, ebids[3], "MATL", 400);
 354   printf ("after ex_put_prop (2), error = %d\n", error);
 355   error = ex_put_prop(exoid2, EX_ELEM_BLOCK, ebids[4], "MATL", 500);
 356   printf ("after ex_put_prop (2), error = %d\n", error);
 357
 358/* write element connectivity */
 359
 360   connect = (int *) calloc(8, sizeof(int));
 361   connect[0] = 1; connect[1] = 2; connect[2] = 3; connect[3] = 4;
 362
 363   error = ex_put_elem_conn (exoid, ebids[0], connect);
 364   printf ("after ex_put_elem_conn, error = %d\n", error);
 365
 366   connect[0] = 5; connect[1] = 6; connect[2] = 7; connect[3] = 8;
 367
 368   error = ex_put_elem_conn (exoid, ebids[1], connect);
 369   printf ("after ex_put_elem_conn, error = %d\n", error);
 370
 371   connect[0] = 9; connect[1] = 10; connect[2] = 11; connect[3] = 12;
 372   connect[4] = 13; connect[5] = 14; connect[6] = 15; connect[7] = 16;
 373
 374   error = ex_put_elem_conn (exoid, ebids[2], connect);
 375   printf ("after ex_put_elem_conn, error = %d\n", error);
 376
 377   connect[0] = 17; connect[1] = 18; connect[2] = 19; connect[3] = 20;
 378
 379   error = ex_put_elem_conn (exoid, ebids[3], connect);
 380   printf ("after ex_put_elem_conn, error = %d\n", error);
 381
 382   connect[0] = 21; connect[1] = 22; connect[2] = 23;
 383   connect[3] = 24; connect[4] = 25; connect[5] = 26;
 384
 385   error = ex_put_elem_conn (exoid, ebids[4], connect);
 386   printf ("after ex_put_elem_conn, error = %d\n", error);
 387
 388   free (connect);
 389
 390   connect2 = (int *) calloc(8, sizeof(int));
 391   connect2[0] = 1; connect2[1] = 2; connect2[2] = 3; connect2[3] = 4;
 392
 393   error = ex_put_elem_conn (exoid2, ebids2[0], connect2);
 394   printf ("after ex_put_elem_conn (2), error = %d\n", error);
 395
 396   connect2[0] = 5; connect2[1] = 6; connect2[2] = 7; connect2[3] = 8;
 397
 398   error = ex_put_elem_conn (exoid2, ebids2[1], connect2);
 399   printf ("after ex_put_elem_conn (2), error = %d\n", error);
 400
 401   connect2[0] = 9; connect2[1] = 10; connect2[2] = 11; connect2[3] = 12;
 402   connect2[4] = 13; connect2[5] = 14; connect2[6] = 15; connect2[7] = 16;
 403
 404   error = ex_put_elem_conn (exoid2, ebids2[2], connect2);
 405   printf ("after ex_put_elem_conn (2), error = %d\n", error);
 406
 407   connect2[0] = 17; connect2[1] = 18; connect2[2] = 19; connect2[3] = 20;
 408
 409   error = ex_put_elem_conn (exoid2, ebids2[3], connect2);
 410   printf ("after ex_put_elem_conn (2), error = %d\n", error);
 411
 412   connect2[0] = 21; connect2[1] = 22; connect2[2] = 23;
 413   connect2[3] = 24; connect2[4] = 25; connect2[5] = 26;
 414
 415   error = ex_put_elem_conn (exoid2, ebids2[4], connect2);
 416   printf ("after ex_put_elem_conn (2), error = %d\n", error);
 417
 418
 419   free (connect2);
 420
 421
 422/* write element block attributes */
 423
 424   attrib[0] = 3.14159;
 425   error = ex_put_elem_attr (exoid, ebids[0], attrib);
 426   printf ("after ex_put_elem_attr, error = %d\n", error);
 427
 428   attrib[0] = 6.14159;
 429   error = ex_put_elem_attr (exoid, ebids[1], attrib);
 430   printf ("after ex_put_elem_attr, error = %d\n", error);
 431
 432   error = ex_put_elem_attr (exoid, ebids[2], attrib);
 433   printf ("after ex_put_elem_attr, error = %d\n", error);
 434
 435   error = ex_put_elem_attr (exoid, ebids[3], attrib);
 436   printf ("after ex_put_elem_attr, error = %d\n", error);
 437
 438   error = ex_put_elem_attr (exoid, ebids[4], attrib);
 439   printf ("after ex_put_elem_attr, error = %d\n", error);
 440
 441   attrib2[0] = 3.;
 442   error = ex_put_elem_attr (exoid2, ebids2[0], attrib2);
 443   printf ("after ex_put_elem_attr (2), error = %d\n", error);
 444
 445   attrib2[0] = 6.;
 446   error = ex_put_elem_attr (exoid2, ebids2[1], attrib2);
 447   printf ("after ex_put_elem_attr (2), error = %d\n", error);
 448
 449   error = ex_put_elem_attr (exoid2, ebids2[2], attrib2);
 450   printf ("after ex_put_elem_attr (2), error = %d\n", error);
 451
 452   error = ex_put_elem_attr (exoid2, ebids2[3], attrib2);
 453   printf ("after ex_put_elem_attr (2), error = %d\n", error);
 454
 455   error = ex_put_elem_attr (exoid2, ebids2[4], attrib2);
 456   printf ("after ex_put_elem_attr (2), error = %d\n", error);
 457
 458#ifdef EX_TEST_INDIV_NODESET
 459/* write individual node sets */
 460
 461   error = ex_put_node_set_param (exoid, 20, 5, 5);
 462   printf ("after ex_put_node_set_param, error = %d\n", error);
 463
 464   node_list[0] = 10; node_list[1] = 11; node_list[2] = 12; 
 465   node_list[3] = 13; node_list[4] = 14; 
 466
 467   dist_fact[0] = 1.0; dist_fact[1] = 2.0; dist_fact[2] = 3.0;
 468   dist_fact[3] = 4.0; dist_fact[4] = 5.0;
 469
 470   error = ex_put_node_set (exoid, 20, node_list);
 471   printf ("after ex_put_node_set, error = %d\n", error);
 472   error = ex_put_node_set_dist_fact (exoid, 20, dist_fact);
 473   printf ("after ex_put_node_set, error = %d\n", error);
 474
 475   error = ex_put_node_set_param (exoid, 21, 3, 3);
 476   printf ("after ex_put_node_set_param, error = %d\n", error);
 477
 478   node_list[0] = 20; node_list[1] = 21; node_list[2] = 22; 
 479
 480   dist_fact[0] = 1.1; dist_fact[1] = 2.1; dist_fact[2] = 3.1;
 481
 482   error = ex_put_node_set (exoid, 21, node_list);
 483   printf ("after ex_put_node_set, error = %d\n", error);
 484   error = ex_put_node_set_dist_fact (exoid, 21, dist_fact);
 485   printf ("after ex_put_node_set, error = %d\n", error);
 486
 487   error = ex_put_prop(exoid, EX_NODE_SET, 20, "FACE", 4);
 488   printf ("after ex_put_prop, error = %d\n", error);
 489
 490   error = ex_put_prop(exoid, EX_NODE_SET, 21, "FACE", 5);
 491   printf ("after ex_put_prop, error = %d\n", error);
 492
 493   prop_array[0] = 1000;
 494   prop_array[1] = 2000;
 495
 496   error = ex_put_prop_array(exoid, EX_NODE_SET, "VELOCITY", prop_array);
 497   printf ("after ex_put_prop_array, error = %d\n", error);
 498
 499/* file 2 */
 500   error = ex_put_node_set_param (exoid2, 20, 5, 5);
 501   printf ("after ex_put_node_set_param (2), error = %d\n", error);
 502
 503   node_list2[0] = 10; node_list2[1] = 11; node_list2[2] = 12; 
 504   node_list2[3] = 13; node_list2[4] = 14; 
 505
 506   dist_fact2[0] = 1.0; dist_fact2[1] = 2.0; dist_fact2[2] = 3.0;
 507   dist_fact2[3] = 4.0; dist_fact2[4] = 5.0;
 508
 509   error = ex_put_node_set (exoid2, 20, node_list2);
 510   printf ("after ex_put_node_set (2), error = %d\n", error);
 511   error = ex_put_node_set_dist_fact (exoid2, 20, dist_fact2);
 512   printf ("after ex_put_node_set (2), error = %d\n", error);
 513
 514   error = ex_put_node_set_param (exoid2, 21, 3, 3);
 515   printf ("after ex_put_node_set_param (2), error = %d\n", error);
 516
 517   node_list2[0] = 20; node_list2[1] = 21; node_list2[2] = 22; 
 518
 519   dist_fact2[0] = 1.1; dist_fact2[1] = 2.1; dist_fact2[2] = 3.1;
 520
 521   error = ex_put_node_set (exoid2, 21, node_list2);
 522   printf ("after ex_put_node_set (2), error = %d\n", error);
 523   error = ex_put_node_set_dist_fact (exoid2, 21, dist_fact2);
 524   printf ("after ex_put_node_set (2), error = %d\n", error);
 525
 526   error = ex_put_prop(exoid2, EX_NODE_SET, 20, "FACE", 4);
 527   printf ("after ex_put_prop (2), error = %d\n", error);
 528
 529   error = ex_put_prop(exoid2, EX_NODE_SET, 21, "FACE", 5);
 530   printf ("after ex_put_prop (2), error = %d\n", error);
 531
 532   prop_array[0] = 1000;
 533   prop_array[1] = 2000;
 534
 535   error = ex_put_prop_array(exoid2, EX_NODE_SET, "VELOCITY", prop_array);
 536   printf ("after ex_put_prop (2), error = %d\n", error);
 537
 538#else /* EX_TEST_INDIV_NODESET */
 539/* write concatenated node sets; this produces the same information as
 540 * the above code which writes individual node sets
 541 */
 542
 543   ids[0] = 20; ids[1] = 21;
 544
 545   num_nodes_per_set[0] = 5; num_nodes_per_set[1] = 3;
 546
 547   node_ind[0] = 0; node_ind[1] = 5;
 548
 549   node_list[0] = 10; node_list[1] = 11; node_list[2] = 12; 
 550   node_list[3] = 13; node_list[4] = 14; 
 551   node_list[5] = 20; node_list[6] = 21; node_list[7] = 22;
 552
 553   num_df_per_set[0] = 5; num_df_per_set[1] = 3;
 554
 555   df_ind[0] = 0; df_ind[1] = 5;
 556
 557   dist_fact[0] = 1.0; dist_fact[1] = 2.0; dist_fact[2] = 3.0; 
 558   dist_fact[3] = 4.0; dist_fact[4] = 5.0; 
 559   dist_fact[5] = 1.1; dist_fact[6] = 2.1; dist_fact[7] = 3.1;
 560
 561   prop_array[0] = 1000;
 562   prop_array[1] = 2000;
 563
 564   error = ex_put_concat_node_sets (exoid, ids, num_nodes_per_set,
 565                                    num_df_per_set, node_ind,
 566                                    df_ind, node_list, dist_fact);
 567   printf ("after ex_put_concat_node_sets, error = %d\n", error);
 568
 569   error = ex_put_prop(exoid, EX_NODE_SET, 20, "FACE", 4);
 570   printf ("after ex_put_prop, error = %d\n", error);
 571   error = ex_put_prop(exoid, EX_NODE_SET, 21, "FACE", 5);
 572   printf ("after ex_put_prop, error = %d\n", error);
 573
 574   error = ex_put_prop_array(exoid, EX_NODE_SET, "VELOCITY", prop_array);
 575   printf ("after ex_put_prop_array, error = %d\n", error);
 576
 577   error = ex_put_concat_node_sets (exoid2, ids, num_nodes_per_set,
 578                                    num_df_per_set, node_ind,
 579                                    df_ind, node_list, dist_fact);
 580   printf ("after ex_put_concat_node_sets, error = %d\n", error);
 581
 582
 583   error = ex_put_prop(exoid2, EX_NODE_SET, 20, "FACE", 4);
 584   printf ("after ex_put_prop, error = %d\n", error);
 585   error = ex_put_prop(exoid2, EX_NODE_SET, 21, "FACE", 5);
 586   printf ("after ex_put_prop, error = %d\n", error);
 587
 588   error = ex_put_prop_array(exoid2, EX_NODE_SET, "VELOCITY", prop_array);
 589   printf ("after ex_put_prop_array, error = %d\n", error);
 590
 591#endif /* EX_TEST_INDIV_NODESET */
 592
 593#ifdef EX_TEST_INDIV_SIDESET
 594/* write individual side sets */
 595
 596   error = ex_put_side_set_param (exoid, 30, 2, 4);
 597   printf ("after ex_put_side_set_param, error = %d\n", error);
 598
 599   elem_list[0] = 2; elem_list[1] = 2;
 600
 601   side_list[0] = 4; side_list[1] = 2;
 602
 603   dist_fact[0] = 30.0; dist_fact[1] = 30.1; dist_fact[2] = 30.2;
 604   dist_fact[3] = 30.3;
 605
 606   error = ex_put_side_set (exoid, 30, elem_list, side_list);
 607   printf ("after ex_put_side_set, error = %d\n", error);
 608
 609   error = ex_put_side_set_dist_fact (exoid, 30, dist_fact);
 610   printf ("after ex_put_side_set_dist_fact, error = %d\n", error);
 611
 612
 613   error = ex_put_side_set_param (exoid, 31, 2, 4);
 614   printf ("after ex_put_side_set_param, error = %d\n", error);
 615
 616   elem_list[0] = 1; elem_list[1] = 2;
 617
 618   side_list[0] = 2; side_list[1] = 3;
 619
 620   dist_fact[0] = 31.0; dist_fact[1] = 31.1; dist_fact[2] = 31.2;
 621   dist_fact[3] = 31.3;
 622
 623   error = ex_put_side_set (exoid, 31, elem_list, side_list);
 624   printf ("after ex_put_side_set, error = %d\n", error);
 625
 626   error = ex_put_side_set_dist_fact (exoid, 31, dist_fact);
 627   printf ("after ex_put_side_set_dist_fact, error = %d\n", error);
 628
 629   /* side set #3  - hex */
 630
 631   error = ex_put_side_set_param (exoid, 32, 7, 0);
 632   printf ("after ex_put_side_set_param, error = %d\n", error);
 633
 634   elem_list[0] = 3; elem_list[1] = 3;
 635   elem_list[2] = 3; elem_list[3] = 3;
 636   elem_list[4] = 3; elem_list[5] = 3;
 637   elem_list[6] = 3;
 638
 639   side_list[0] = 5; side_list[1] = 3;
 640   side_list[2] = 3; side_list[3] = 2;
 641   side_list[4] = 4; side_list[5] = 1;
 642   side_list[6] = 6;
 643
 644   error = ex_put_side_set (exoid, 32, elem_list, side_list);
 645   printf ("after ex_put_side_set, error = %d\n", error);
 646
 647   /* side set #4  - tetras */
 648
 649   error = ex_put_side_set_param (exoid, 33, 4, 0);
 650   printf ("after ex_put_side_set_param, error = %d\n", error);
 651
 652   elem_list[0] = 4; elem_list[1] = 4;
 653   elem_list[2] = 4; elem_list[3] = 4;
 654
 655   side_list[0] = 1; side_list[1] = 2;
 656   side_list[2] = 3; side_list[3] = 4;
 657
 658   error = ex_put_side_set (exoid, 33, elem_list, side_list);
 659   printf ("after ex_put_side_set, error = %d\n", error);
 660
 661   /* side set #5  - wedges */
 662
 663   error = ex_put_side_set_param (exoid, 34, 5, 0);
 664   printf ("after ex_put_side_set_param, error = %d\n", error);
 665
 666   elem_list[0] = 5; elem_list[1] = 5;
 667   elem_list[2] = 5; elem_list[3] = 5;
 668   elem_list[4] = 5;
 669
 670   side_list[0] = 1; side_list[1] = 2;
 671   side_list[2] = 3; side_list[3] = 4;
 672   side_list[4] = 5;
 673
 674   error = ex_put_side_set (exoid, 34, elem_list, side_list);
 675   printf ("after ex_put_side_set, error = %d\n", error);
 676
 677/* file 2 */
 678   error = ex_put_side_set_param (exoid2, 30, 2, 4);
 679   printf ("after ex_put_side_set_param (2), error = %d\n", error);
 680
 681   elem_list2[0] = 2; elem_list2[1] = 2;
 682
 683   side_list2[0] = 4; side_list2[1] = 2;
 684
 685   dist_fact2[0] = 30.0; dist_fact2[1] = 30.1; dist_fact2[2] = 30.2;
 686   dist_fact2[3] = 30.3;
 687
 688   error = ex_put_side_set (exoid2, 30, elem_list2, side_list2);
 689   printf ("after ex_put_side_set (2), error = %d\n", error);
 690
 691   error = ex_put_side_set_dist_fact (exoid2, 30, dist_fact2);
 692   printf ("after ex_put_side_set_dist_fact (2), error = %d\n", error);
 693
 694
 695   error = ex_put_side_set_param (exoid2, 31, 2, 4);
 696   printf ("after ex_put_side_set_param (2), error = %d\n", error);
 697
 698   elem_list2[0] = 1; elem_list2[1] = 2;
 699
 700   side_list2[0] = 2; side_list2[1] = 3;
 701
 702   dist_fact2[0] = 31.0; dist_fact2[1] = 31.1; dist_fact2[2] = 31.2;
 703   dist_fact2[3] = 31.3;
 704
 705   error = ex_put_side_set (exoid2, 31, elem_list2, side_list2);
 706   printf ("after ex_put_side_set (2), error = %d\n", error);
 707
 708   error = ex_put_side_set_dist_fact (exoid2, 31, dist_fact2);
 709   printf ("after ex_put_side_set_dist_fact (2), error = %d\n", error);
 710
 711
 712   /* side set #3  - hex */
 713
 714   error = ex_put_side_set_param (exoid2, 32, 7, 0);
 715   printf ("after ex_put_side_set_param (2), error = %d\n", error);
 716
 717   elem_list2[0] = 3; elem_list2[1] = 3;
 718   elem_list2[2] = 3; elem_list2[3] = 3;
 719   elem_list2[4] = 3; elem_list2[5] = 3;
 720   elem_list2[6] = 3;
 721
 722   side_list2[0] = 5; side_list2[1] = 3;
 723   side_list2[2] = 3; side_list2[3] = 2;
 724   side_list2[4] = 4; side_list2[5] = 1;
 725   side_list2[6] = 6;
 726
 727   error = ex_put_side_set (exoid2, 32, elem_list2, side_list2);
 728   printf ("after ex_put_side_set (2), error = %d\n", error);
 729
 730
 731   /* side set #4  - tetras */
 732
 733   error = ex_put_side_set_param (exoid2, 33, 4, 0);
 734   printf ("after ex_put_side_set_param (2), error = %d\n", error);
 735
 736   elem_list2[0] = 4; elem_list2[1] = 4;
 737   elem_list2[2] = 4; elem_list2[3] = 4;
 738
 739   side_list2[0] = 1; side_list2[1] = 2;
 740   side_list2[2] = 3; side_list2[3] = 4;
 741
 742   error = ex_put_side_set (exoid2, 33, elem_list2, side_list2);
 743   printf ("after ex_put_side_set (2), error = %d\n", error);
 744
 745
 746   /* side set #5  - wedges */
 747
 748   error = ex_put_side_set_param (exoid2, 34, 5, 0);
 749   printf ("after ex_put_side_set_param (2), error = %d\n", error);
 750
 751   elem_list2[0] = 5; elem_list2[1] = 5;
 752   elem_list2[2] = 5; elem_list2[3] = 5;
 753   elem_list2[4] = 5;
 754
 755   side_list2[0] = 1; side_list2[1] = 2;
 756   side_list2[2] = 3; side_list2[3] = 4;
 757   side_list2[4] = 5;
 758
 759   error = ex_put_side_set (exoid2, 34, elem_list2, side_list2);
 760   printf ("after ex_put_side_set (2), error = %d\n", error);
 761
 762#else /* EX_TEST_INDIV_SIDESET */
 763
 764/* write concatenated side sets; this produces the same information as
 765 * the above code which writes individual side sets
 766 */
 767
 768   ids[0] = 30;
 769   ids[1] = 31;
 770   ids[2] = 32;
 771   ids[3] = 33;
 772   ids[4] = 34;
 773
 774   node_list[0] = 8; node_list[1] = 5;
 775   node_list[2] = 6; node_list[3] = 7;
 776
 777   node_list[4] = 2; node_list[5] = 3;
 778   node_list[6] = 7; node_list[7] = 8;
 779
 780   node_list[8] = 9; node_list[9] = 12;
 781   node_list[10] = 11; node_list[11] = 10;
 782
 783   node_list[12] = 11; node_list[13] = 12;
 784   node_list[14] = 16; node_list[15] = 15;
 785
 786   node_list[16] = 16; node_list[17] = 15;
 787   node_list[18] = 11; node_list[19] = 12;
 788
 789   node_list[20] = 10; node_list[21] = 11;
 790   node_list[22] = 15; node_list[23] = 14;
 791
 792   node_list[24] = 13; node_list[25] = 16;
 793   node_list[26] = 12; node_list[27] =  9;
 794
 795   node_list[28] = 14; node_list[29] = 13;
 796   node_list[30] =  9; node_list[31] = 10;
 797
 798   node_list[32] = 16; node_list[33] = 13;
 799   node_list[34] = 14; node_list[35] = 15;
 800
 801   node_list[36] = 17; node_list[37] = 18;
 802   node_list[38] = 20;
 803
 804   node_list[39] = 18; node_list[40] = 19;
 805   node_list[41] = 20;
 806
 807   node_list[42] = 20; node_list[43] = 19;
 808   node_list[44] = 17;
 809
 810   node_list[45] = 19; node_list[46] = 18;
 811   node_list[47] = 17;
 812
 813   node_list[48] = 25; node_list[49] = 24;
 814   node_list[50] = 21; node_list[51] = 22;
 815
 816   node_list[52] = 26; node_list[53] = 25;
 817   node_list[54] = 22; node_list[55] = 23;
 818
 819   node_list[56] = 26; node_list[57] = 23;
 820   node_list[58] = 21; node_list[59] = 24;
 821
 822   node_list[60] = 23; node_list[61] = 22;
 823   node_list[62] = 21;
 824
 825   node_list[63] = 24; node_list[64] = 25;
 826   node_list[65] = 26;
 827
 828   node_ind[0] = 0;
 829   node_ind[1] = 4;
 830   node_ind[2] = 8;
 831   node_ind[3] = 36;
 832   node_ind[4] = 47;
 833
 834   num_elem_per_set[0] = 2;
 835   num_elem_per_set[1] = 2;
 836   num_elem_per_set[2] = 7;
 837   num_elem_per_set[3] = 4;
 838   num_elem_per_set[4] = 5;
 839
 840   num_nodes_per_set[0] = 4;
 841   num_nodes_per_set[1] = 4;
 842   num_nodes_per_set[2] = 28;
 843   num_nodes_per_set[3] = 12;
 844   num_nodes_per_set[4] = 18;
 845
 846   elem_ind[0] = 0;
 847   elem_ind[1] = 2;
 848   elem_ind[2] = 4;
 849   elem_ind[3] = 11;
 850   elem_ind[4] = 15;
 851
 852   elem_list[0] = 2; elem_list[1] = 2;
 853   elem_list[2] = 1; elem_list[3] = 2;
 854   elem_list[4] = 3; elem_list[5] = 3;
 855   elem_list[6] = 3; elem_list[7] = 3;
 856   elem_list[8] = 3; elem_list[9] = 3;
 857   elem_list[10] = 3; elem_list[11] = 4;
 858   elem_list[12] = 4; elem_list[13] = 4;
 859   elem_list[14] = 4; elem_list[15] = 5;
 860   elem_list[16] = 5; elem_list[17] = 5;
 861   elem_list[18] = 5; elem_list[19] = 5;
 862
 863   error = ex_cvt_nodes_to_sides(exoid,
 864                         num_elem_per_set,
 865                         num_nodes_per_set,
 866                         elem_ind,
 867                         node_ind,
 868                         elem_list,
 869                         node_list,
 870                         side_list);
 871   printf ("after ex_cvt_nodes_to_sides, error = %d\n", error);
 872
 873   num_df_per_set[0] = 4;
 874   num_df_per_set[1] = 4;
 875   num_df_per_set[2] = 0;
 876   num_df_per_set[3] = 0;
 877   num_df_per_set[4] = 0;
 878
 879   df_ind[0] = 0;
 880   df_ind[1] = 4;
 881
 882   dist_fact[0] = 30.0; dist_fact[1] = 30.1;
 883   dist_fact[2] = 30.2; dist_fact[3] = 30.3;
 884
 885   dist_fact[4] = 31.0; dist_fact[5] = 31.1;
 886   dist_fact[6] = 31.2; dist_fact[7] = 31.3;
 887
 888   error = ex_put_concat_side_sets (exoid, ids, num_elem_per_set,
 889                                    num_df_per_set, elem_ind, df_ind,
 890                                    elem_list, side_list, dist_fact);
 891   printf ("after ex_put_concat_side_sets, error = %d\n", error);
 892
 893/* file 2 */
 894
 895   ids2[0] = 30;
 896   ids2[1] = 31;
 897   ids2[2] = 32;
 898   ids2[3] = 33;
 899   ids2[4] = 34;
 900
 901   node_list2[0] = 8; node_list2[1] = 5;
 902   node_list2[2] = 6; node_list2[3] = 7;
 903
 904   node_list2[4] = 2; node_list2[5] = 3;
 905   node_list2[6] = 7; node_list2[7] = 8;
 906
 907   node_list2[8] = 9; node_list2[9] = 12;
 908   node_list2[10] = 11; node_list2[11] = 10;
 909
 910   node_list2[12] = 11; node_list2[13] = 12;
 911   node_list2[14] = 16; node_list2[15] = 15;
 912
 913   node_list2[16] = 16; node_list2[17] = 15;
 914   node_list2[18] = 11; node_list2[19] = 12;
 915
 916   node_list2[20] = 10; node_list2[21] = 11;
 917   node_list2[22] = 15; node_list2[23] = 14;
 918
 919   node_list2[24] = 13; node_list2[25] = 16;
 920   node_list2[26] = 12; node_list2[27] =  9;
 921
 922   node_list2[28] = 14; node_list2[29] = 13;
 923   node_list2[30] =  9; node_list2[31] = 10;
 924
 925   node_list2[32] = 16; node_list2[33] = 13;
 926   node_list2[34] = 14; node_list2[35] = 15;
 927
 928   node_list2[36] = 17; node_list2[37] = 18;
 929   node_list2[38] = 20;
 930
 931   node_list2[39] = 18; node_list2[40] = 19;
 932   node_list2[41] = 20;
 933
 934   node_list2[42] = 20; node_list2[43] = 19;
 935   node_list2[44] = 17;
 936
 937   node_list2[45] = 19; node_list2[46] = 18;
 938   node_list2[47] = 17;
 939
 940   node_list2[48] = 25; node_list2[49] = 24;
 941   node_list2[50] = 21; node_list2[51] = 22;
 942
 943   node_list2[52] = 26; node_list2[53] = 25;
 944   node_list2[54] = 22; node_list2[55] = 23;
 945
 946   node_list2[56] = 26; node_list2[57] = 23;
 947   node_list2[58] = 21; node_list2[59] = 24;
 948
 949   node_list2[60] = 23; node_list2[61] = 22;
 950   node_list2[62] = 21;
 951
 952   node_list2[63] = 24; node_list2[64] = 25;
 953   node_list2[65] = 26;
 954
 955   node_ind2[0] = 0;
 956   node_ind2[1] = 4;
 957   node_ind2[2] = 8;
 958   node_ind2[3] = 36;
 959   node_ind2[4] = 47;
 960
 961   num_elem_per_set2[0] = 2;
 962   num_elem_per_set2[1] = 2;
 963   num_elem_per_set2[2] = 7;
 964   num_elem_per_set2[3] = 4;
 965   num_elem_per_set2[4] = 5;
 966
 967   num_nodes_per_set2[0] = 4;
 968   num_nodes_per_set2[1] = 4;
 969   num_nodes_per_set2[2] = 28;
 970   num_nodes_per_set2[3] = 12;
 971   num_nodes_per_set2[4] = 18;
 972
 973   elem_ind2[0] = 0;
 974   elem_ind2[1] = 2;
 975   elem_ind2[2] = 4;
 976   elem_ind2[3] = 11;
 977   elem_ind2[4] = 15;
 978
 979   elem_list2[0] = 2; elem_list2[1] = 2;
 980   elem_list2[2] = 1; elem_list2[3] = 2;
 981   elem_list2[4] = 3; elem_list2[5] = 3;
 982   elem_list2[6] = 3; elem_list2[7] = 3;
 983   elem_list2[8] = 3; elem_list2[9] = 3;
 984   elem_list2[10] = 3; elem_list2[11] = 4;
 985   elem_list2[12] = 4; elem_list2[13] = 4;
 986   elem_list2[14] = 4; elem_list2[15] = 5;
 987   elem_list2[16] = 5; elem_list2[17] = 5;
 988   elem_list2[18] = 5; elem_list2[19] = 5;
 989
 990   error = ex_cvt_nodes_to_sides(exoid,
 991                         num_elem_per_set2,
 992                         num_nodes_per_set2,
 993                         elem_ind2,
 994                         node_ind2,
 995                         elem_list2,
 996                         node_list2,
 997                         side_list2);
 998   printf ("after ex_cvt_nodes_to_sides (2), error = %d\n", error);
 999
1000   num_df_per_set2[0] = 4;
1001   num_df_per_set2[1] = 4;
1002   num_df_per_set2[2] = 0;
1003   num_df_per_set2[3] = 0;
1004   num_df_per_set2[4] = 0;
1005
1006   df_ind2[0] = 0;
1007   df_ind2[1] = 4;
1008
1009   dist_fact2[0] = 30.0; dist_fact2[1] = 30.1;
1010   dist_fact2[2] = 30.2; dist_fact2[3] = 30.3;
1011
1012   dist_fact2[4] = 31.0; dist_fact2[5] = 31.1;
1013   dist_fact2[6] = 31.2; dist_fact2[7] = 31.3;
1014
1015   error = ex_put_concat_side_sets (exoid2, ids2, num_elem_per_set2,
1016                                    num_df_per_set2, elem_ind2, df_ind2,
1017                                    elem_list2, side_list2, dist_fact2);
1018   printf ("after ex_put_concat_side_sets (2), error = %d\n", error);
1019
1020
1021#endif /* EX_TEST_INDIV_SIDESET */
1022
1023   error = ex_put_prop(exoid, EX_SIDE_SET, 30, "COLOR", 100);
1024   printf ("after ex_put_prop, error = %d\n", error);
1025
1026   error = ex_put_prop(exoid, EX_SIDE_SET, 31, "COLOR", 101);
1027   printf ("after ex_put_prop, error = %d\n", error);
1028
1029   error = ex_put_prop(exoid2, EX_SIDE_SET, 30, "COLOR", 100);
1030   printf ("after ex_put_prop (2), error = %d\n", error);
1031
1032   error = ex_put_prop(exoid2, EX_SIDE_SET, 31, "COLOR", 101);
1033   printf ("after ex_put_prop (2), error = %d\n", error);
1034
1035
1036/* write QA records */
1037
1038   num_qa_rec = 2;
1039
1040
1041   qa_record[0][0] = "TESTWT2";
1042   qa_record[0][1] = "testwt2";
1043   qa_record[0][2] = "07/07/93";
1044   qa_record[0][3] = "15:41:33";
1045   qa_record[1][0] = "FASTQ";
1046   qa_record[1][1] = "fastq";
1047   qa_record[1][2] = "07/07/93";
1048   qa_record[1][3] = "16:41:33";
1049
1050   error = ex_put_qa (exoid, num_qa_rec, qa_record);
1051   printf ("after ex_put_qa, error = %d\n", error);
1052
1053   num_qa_rec2 = 2;
1054
1055   qa_record2[0][0] = "TESTWT2";
1056   qa_record2[0][1] = "testwt2";
1057   qa_record2[0][2] = "07/07/93";
1058   qa_record2[0][3] = "15:41:33";
1059   qa_record2[1][0] = "FASTQ";
1060   qa_record2[1][1] = "fastq";
1061   qa_record2[1][2] = "07/07/93";
1062   qa_record2[1][3] = "16:41:33";
1063
1064   error = ex_put_qa (exoid2, num_qa_rec2, qa_record2);
1065   printf ("after ex_put_qa (2), error = %d\n", error);
1066
1067
1068/* write information records */
1069
1070   num_info = 3;
1071
1072   info[0] = "This is the first information record.";
1073   info[1] = "This is the second information record.";
1074   info[2] = "This is the third information record.";
1075
1076   error = ex_put_info (exoid, num_info, info);
1077   printf ("after ex_put_info, error = %d\n", error);
1078
1079   num_info2 = 3;
1080
1081   info2[0] = "This is the first information record.";
1082   info2[1] = "This is the second information record.";
1083   info2[2] = "This is the third information record.";
1084
1085   error = ex_put_info (exoid2, num_info2, info2);
1086   printf ("after ex_put_info (2), error = %d\n", error);
1087
1088
1089/* write results variables parameters and names */
1090
1091   num_glo_vars = 1;
1092
1093   var_names[0] = "glo_vars";
1094
1095   error = ex_put_var_param (exoid, "g", num_glo_vars);
1096   printf ("after ex_put_var_param, error = %d\n", error);
1097   error = ex_put_var_names (exoid, "g", num_glo_vars, var_names);
1098   printf ("after ex_put_var_names, error = %d\n", error);
1099
1100   num_glo_vars2 = 1;
1101
1102   var_names2[0] = "glo_vars";
1103
1104   error = ex_put_var_param (exoid2, "g", num_glo_vars2);
1105   printf ("after ex_put_var_param (2), error = %d\n", error);
1106   error = ex_put_var_names (exoid2, "g", num_glo_vars2, var_names2);
1107   printf ("after ex_put_var_names (2), error = %d\n", error);
1108
1109   num_nod_vars = 2;
1110
1111   var_names[0] = "nod_var0";
1112   var_names[1] = "nod_var1";
1113
1114   error = ex_put_var_param (exoid, "n", num_nod_vars);
1115   printf ("after ex_put_var_param, error = %d\n", error);
1116   error = ex_put_var_names (exoid, "n", num_nod_vars, var_names);
1117   printf ("after ex_put_var_names, error = %d\n", error);
1118
1119   num_nod_vars2 = 2;
1120
1121   var_names2[0] = "nod_var0";
1122   var_names2[1] = "nod_var1";
1123
1124   error = ex_put_var_param (exoid2, "n", num_nod_vars2);
1125   printf ("after ex_put_var_param (2), error = %d\n", error);
1126   error = ex_put_var_names (exoid2, "n", num_nod_vars2, var_names2);
1127   printf ("after ex_put_var_names (2), error = %d\n", error);
1128
1129
1130   num_ele_vars = 3;
1131
1132   var_names[0] = "ele_var0";
1133   var_names[1] = "ele_var1";
1134   var_names[2] = "ele_var2";
1135
1136   error = ex_put_var_param (exoid, "e", num_ele_vars);
1137   printf ("after ex_put_var_param, error = %d\n", error);
1138   error = ex_put_var_names (exoid, "e", num_ele_vars, var_names);
1139   printf ("after ex_put_var_names, error = %d\n", error);
1140
1141   num_ele_vars2 = 3;
1142
1143   var_names2[0] = "ele_var20";
1144   var_names2[1] = "ele_var21";
1145   var_names2[2] = "ele_var22";
1146
1147   error = ex_put_var_param (exoid2, "e", num_ele_vars2);
1148   printf ("after ex_put_var_param (2), error = %d\n", error);
1149   error = ex_put_var_names (exoid2, "e", num_ele_vars, var_names);
1150   printf ("after ex_put_var_names (2), error = %d\n", error);
1151
1152
1153
1154/* write element variable truth table */
1155
1156   truth_tab = (int *) calloc ((num_elem_blk*num_ele_vars), sizeof(int));
1157
1158   k = 0;
1159   for (i=0; i<num_elem_blk; i++)
1160   {
1161      for (j=0; j<num_ele_vars; j++)
1162      {
1163         truth_tab[k++] = 1;
1164      }
1165   }
1166
1167   error = ex_put_elem_var_tab (exoid, num_elem_blk, num_ele_vars, truth_tab);
1168   printf ("after ex_put_elem_var_tab, error = %d\n", error);
1169
1170   error = ex_put_elem_var_tab (exoid2, num_elem_blk, num_ele_vars, truth_tab);
1171   printf ("after ex_put_elem_var_tab (2), error = %d\n", error);
1172
1173   free (truth_tab);
1174
1175
1176/* for each time step, write the analysis results;
1177 * the code below fills the arrays hist_var_vals, glob_var_vals, 
1178 * nodal_var_vals, and elem_var_vals with values for debugging purposes;
1179 * obviously the analysis code will populate these arrays
1180 */
1181
1182   whole_time_step = 1;
1183   num_time_steps = 10;
1184
1185   glob_var_vals = (float *) calloc (num_glo_vars, sizeof(CPU_word_size));
1186   nodal_var_vals = (float *) calloc (num_nodes, sizeof(CPU_word_size));
1187   elem_var_vals = (float *) calloc (4, sizeof(CPU_word_size));
1188
1189   for (i=0; i<num_time_steps; i++)
1190   {
1191     time_value = (float)(i+1)/100.;
1192     time_value2 = (float)(i+1)/100.;
1193
1194/* write time value to regular file */
1195
1196     error = ex_put_time (exoid, whole_time_step, &time_value);
1197     printf ("after ex_put_time, error = %d\n", error);
1198
1199     error = ex_put_time (exoid2, whole_time_step, &time_value2);
1200     printf ("after ex_put_time (2), error = %d\n", error);
1201
1202/* write global variables */
1203
1204     for (j=0; j<num_glo_vars; j++)
1205     {
1206       glob_var_vals[j] = (float)(j+2) * time_value;
1207     } 
1208
1209     error = ex_put_glob_vars (exoid, whole_time_step, num_glo_vars, 
1210                               glob_var_vals);
1211     printf ("after ex_put_glob_vars, error = %d\n", error);
1212
1213     error = ex_put_glob_vars (exoid2, whole_time_step, num_glo_vars, 
1214                               glob_var_vals);
1215     printf ("after ex_put_glob_vars (2), error = %d\n", error);
1216
1217/* write nodal variables */
1218
1219     for (k=1; k<=num_nod_vars; k++)
1220     {
1221       for (j=0; j<num_nodes; j++)
1222       {
1223         nodal_var_vals[j] = (float)k + ((float)(j+1) * time_value);
1224       }
1225
1226       error = ex_put_nodal_var (exoid, whole_time_step, k, num_nodes,
1227                                 nodal_var_vals);
1228       printf ("after ex_put_nodal_var, error = %d\n", error);
1229
1230       error = ex_put_nodal_var (exoid2, whole_time_step, k, num_nodes,
1231                                 nodal_var_vals);
1232       printf ("after ex_put_nodal_var (2), error = %d\n", error);
1233     } 
1234
1235/* write element variables */
1236
1237     for (k=1; k<=num_ele_vars; k++)
1238     {
1239       for (j=0; j<num_elem_blk; j++)
1240       {
1241         for (m=0; m<num_elem_in_block[j]; m++)
1242         {
1243           elem_var_vals[m] = (float)(k+1) + (float)(j+2) + 
1244                              ((float)(m+1)*time_value);
1245           /* printf("elem_var_vals[%d]: %f\n",m,elem_var_vals[m]); */
1246         }
1247         error = ex_put_elem_var (exoid, whole_time_step, k, ebids[j],
1248                                  num_elem_in_block[j], elem_var_vals);
1249         printf ("after ex_put_elem_var, error = %d\n", error);
1250
1251         error = ex_put_elem_var (exoid2, whole_time_step, k, ebids[j],
1252                                  num_elem_in_block[j], elem_var_vals);
1253         printf ("after ex_put_elem_var (2), error = %d\n", error);
1254       }
1255     }
1256
1257     whole_time_step++;
1258
1259/* update the data file; this should be done at the end of every time step
1260 * to ensure that no data is lost if the analysis dies
1261 */
1262     error = ex_update (exoid);
1263     printf ("after ex_update, error = %d\n", error);
1264     error = ex_update (exoid2);
1265     printf ("after ex_update (2), error = %d\n", error);
1266   }
1267   free(glob_var_vals);
1268   free(nodal_var_vals);
1269   free(elem_var_vals);
1270
1271
1272/* close the EXODUS files
1273 */
1274   error = ex_close (exoid);
1275   printf ("after ex_close, error = %d\n", error);
1276   error = ex_close (exoid2);
1277   printf ("after ex_close (2), error = %d\n", error);
1278   return 0;
1279}