PageRenderTime 124ms CodeModel.GetById 3ms app.highlight 111ms RepoModel.GetById 1ms app.codeStats 0ms

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

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