PageRenderTime 78ms CodeModel.GetById 2ms app.highlight 66ms RepoModel.GetById 1ms app.codeStats 1ms

/contrib/exodusii/5.22b/exodus/cbind/test/testrd-long-name.c

https://bitbucket.org/vijaysm/libmesh
C | 1207 lines | 843 code | 244 blank | 120 comment | 146 complexity | dc9ac48720a628f7a6704bf030b96a28 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* testrd - read exodus file test.exo created by testwt
  38*
  39* author - Sandia National Laboratories
  40*          Larry A. Schoof - Original
  41*
  42*          
  43* environment - UNIX
  44*
  45* entry conditions - 
  46*   input parameters:
  47*       int     exoid                   exodus file id
  48*
  49* exit conditions - 
  50*
  51* revision history - 
  52*
  53*
  54*****************************************************************************/
  55
  56#include <stdlib.h>
  57#include <stdio.h>
  58#include <string.h>
  59#include "netcdf.h"
  60#include "exodusII.h"
  61/* #include "drmd.h" */
  62
  63
  64int main (int argc, char **argv)
  65{
  66  int exoid, num_dim, num_nodes, num_elem, num_elem_blk, num_node_sets;
  67  int num_side_sets, error;
  68  int i, j, k, node_ctr;
  69  int *elem_map, *connect, *node_list, *node_ctr_list, *elem_list, *side_list;
  70  int *ids; 
  71  int *num_nodes_per_set = NULL;
  72  int *num_elem_per_set = NULL;
  73  int *num_df_per_set = NULL;
  74  int *node_ind = NULL;
  75  int *elem_ind = NULL;
  76  int *df_ind = NULL;
  77  int num_qa_rec, num_info;
  78  int num_glo_vars, num_nod_vars, num_ele_vars;
  79  int num_nset_vars, num_sset_vars;
  80  int *truth_tab;
  81  int num_time_steps;
  82  int *num_elem_in_block = NULL;
  83  int *num_nodes_per_elem = NULL;
  84  int *num_attr = NULL;
  85  int num_nodes_in_set, num_elem_in_set;
  86  int num_sides_in_set, num_df_in_set;
  87  int list_len, elem_list_len, node_list_len, df_list_len;
  88  int node_num, time_step, var_index, beg_time, end_time, elem_num;
  89  int CPU_word_size,IO_word_size;
  90  int num_props, prop_value, *prop_values;
  91  int idum;
  92  int max_name_length;
  93  
  94  float time_value, *time_values, *var_values;
  95  float *x, *y, *z;
  96  float *attrib, *dist_fact;
  97  float version, fdum;
  98
  99  char *coord_names[3], *qa_record[2][4], *info[3], *var_names[3];
 100  char *block_names[10], *nset_names[10], *sset_names[10];
 101  char *attrib_names[10];
 102  char name[MAX_STR_LENGTH+1];
 103  char title[MAX_LINE_LENGTH+1], elem_type[MAX_STR_LENGTH+1];
 104  char title_chk[MAX_LINE_LENGTH+1];
 105  char *cdum = 0;
 106  char *prop_names[3];
 107
 108  CPU_word_size = 0;                    /* sizeof(float) */
 109  IO_word_size = 0;                     /* use what is stored in file */
 110
 111  ex_opts (EX_VERBOSE | EX_ABORT );
 112
 113  /* open EXODUS II files */
 114  exoid = ex_open ("test.exo",  /* filename path */
 115                   EX_READ,             /* access mode = READ */
 116                   &CPU_word_size,      /* CPU word size */
 117                   &IO_word_size,       /* IO word size */
 118                   &version);           /* ExodusII library version */
 119
 120  printf ("\nafter ex_open\n");
 121  if (exoid < 0) exit(1);
 122
 123
 124				   
 125  printf ("test.exo is an EXODUSII file; version %4.2f\n",
 126          version);
 127  /*   printf ("         CPU word size %1d\n",CPU_word_size);  */
 128  printf ("         I/O word size %1d\n",IO_word_size);
 129  ex_inquire(exoid,EX_INQ_API_VERS, &idum, &version, cdum);
 130  printf ("EXODUSII API; version %4.2f\n", version);
 131
 132  ex_inquire(exoid,EX_INQ_LIB_VERS, &idum, &version, cdum);
 133  printf ("EXODUSII Library API; version %4.2f (%d)\n", version, idum);
 134
 135  /* Query size of names used in this file */
 136  {
 137    int max_all_name_length = ex_inquire_int(exoid, EX_INQ_DB_MAX_ALLOWED_NAME_LENGTH);
 138    int max_use_name_length = ex_inquire_int(exoid, EX_INQ_DB_MAX_USED_NAME_LENGTH);
 139    printf ("This file can use at most %d-character names\n", max_all_name_length);
 140    printf ("The maximum name length used is %d-character names\n", max_use_name_length);
 141
 142    max_name_length = max_use_name_length;
 143    ex_set_max_name_length(exoid, max_name_length);
 144  }
 145  
 146  /* read database parameters */
 147  error = ex_get_init (exoid, title, &num_dim, &num_nodes, &num_elem,
 148                       &num_elem_blk, &num_node_sets, &num_side_sets);
 149
 150  printf ("after ex_get_init, error = %3d\n", error);
 151
 152  printf ("database parameters:\n");
 153  printf ("title =  '%s'\n",title);
 154  printf ("num_dim = %3d\n",num_dim);
 155  printf ("num_nodes = %3d\n",num_nodes);
 156  printf ("num_elem = %3d\n",num_elem);
 157  printf ("num_elem_blk = %3d\n",num_elem_blk);
 158  printf ("num_node_sets = %3d\n",num_node_sets);
 159  printf ("num_side_sets = %3d\n",num_side_sets);
 160
 161  /* Check that ex_inquire gives same title */
 162  error = ex_inquire (exoid, EX_INQ_TITLE, &idum, &fdum, title_chk);
 163  printf ("after ex_inquire, error = %3d\n", error);
 164  if (strcmp(title, title_chk) != 0) {
 165    printf ("error in ex_inquire for EX_INQ_TITLE\n");
 166  }
 167  
 168  /* read nodal coordinates values and names from database */
 169
 170  x = (float *) calloc(num_nodes, sizeof(float));
 171  y = (float *) calloc(num_nodes, sizeof(float));
 172  if (num_dim >= 3)
 173    z = (float *) calloc(num_nodes, sizeof(float));
 174  else
 175    z = 0;
 176
 177  error = ex_get_coord (exoid, x, y, z);
 178  printf ("\nafter ex_get_coord, error = %3d\n", error);
 179
 180  printf ("x coords = \n");
 181  for (i=0; i<num_nodes; i++)
 182    {
 183      printf ("%5.1f\n", x[i]);
 184    }
 185
 186  printf ("y coords = \n");
 187  for (i=0; i<num_nodes; i++)
 188    {
 189      printf ("%5.1f\n", y[i]);
 190    }
 191
 192  if (num_dim >= 3)
 193    {
 194      printf ("z coords = \n");
 195      for (i=0; i<num_nodes; i++)
 196        {
 197          printf ("%5.1f\n", z[i]);
 198        }
 199    }
 200
 201  /*
 202    error = ex_get_1_coord (exoid, 2, x, y, z);
 203    printf ("\nafter ex_get_1_coord, error = %3d\n", error);
 204
 205    printf ("x coord of node 2 = \n");
 206    printf ("%f \n", x[0]);
 207
 208    printf ("y coord of node 2 = \n");
 209    printf ("%f \n", y[0]);
 210  */
 211  free (x);
 212  free (y);
 213  if (num_dim >= 3)
 214    free (z);
 215
 216
 217  for (i=0; i<num_dim; i++)
 218    {
 219      coord_names[i] = (char *) calloc ((max_name_length+1), sizeof(char));
 220    }
 221
 222  error = ex_get_coord_names (exoid, coord_names);
 223  printf ("\nafter ex_get_coord_names, error = %3d\n", error);
 224  printf ("x coord name = '%s'\n", coord_names[0]);
 225  printf ("y coord name = '%s'\n", coord_names[1]);
 226  if (num_dim >2)
 227    printf ("z coord name = '%s'\n", coord_names[2]);
 228
 229  for (i=0; i<num_dim; i++)
 230    free(coord_names[i]);
 231
 232  {
 233    int num_attrs = 0;
 234    error = ex_get_attr_param(exoid, EX_NODAL, 0, &num_attrs);
 235    printf (" after ex_get_attr_param, error = %d\n", error);
 236    printf ("num nodal attributes = %d\n", num_attrs);
 237    if (num_attrs > 0) {
 238      for (j=0; j<num_attrs; j++) {
 239	attrib_names[j] = (char *)calloc ((max_name_length+1), sizeof(char));
 240      }
 241      error = ex_get_attr_names (exoid, EX_NODAL, 0, attrib_names);
 242      printf (" after ex_get_attr_names, error = %d\n", error);
 243      
 244      if (error == 0) {
 245	attrib = (float *) calloc(num_nodes,sizeof(float));
 246	for (j=0; j<num_attrs; j++) {
 247	  printf ("nodal attribute %d = '%s'\n", j, attrib_names[j]);
 248	  error = ex_get_one_attr(exoid, EX_NODAL, 0, j+1, attrib);
 249	  printf (" after ex_get_one_attr, error = %d\n", error);
 250	  for (i=0; i < num_nodes; i++) {
 251	    printf ("%5.1f\n", attrib[i]);
 252	  }
 253	  free(attrib_names[j]);
 254	}
 255	free(attrib);
 256      }
 257    }
 258  }
 259  
 260  /* read element order map */
 261
 262  elem_map = (int *) calloc(num_elem, sizeof(int));
 263
 264  error = ex_get_map (exoid, elem_map);
 265  printf ("\nafter ex_get_map, error = %3d\n", error);
 266
 267  for (i=0; i<num_elem; i++)
 268    {
 269      printf ("elem_map(%d) = %d \n", i, elem_map[i]);
 270    }
 271
 272  free (elem_map);
 273
 274  /* read element block parameters */
 275
 276  if (num_elem_blk > 0) {
 277    ids = (int *) calloc(num_elem_blk, sizeof(int));
 278    num_elem_in_block = (int *) calloc(num_elem_blk, sizeof(int));
 279    num_nodes_per_elem = (int *) calloc(num_elem_blk, sizeof(int));
 280    num_attr = (int *) calloc(num_elem_blk, sizeof(int));
 281     
 282    error = ex_get_elem_blk_ids (exoid, ids);
 283    printf ("\nafter ex_get_elem_blk_ids, error = %3d\n", error);
 284     
 285    for (i=0; i<num_elem_blk; i++) {
 286      block_names[i] = (char *) calloc ((max_name_length+1), sizeof(char));
 287    }
 288
 289    error = ex_get_names(exoid, EX_ELEM_BLOCK, block_names);
 290    printf ("\nafter ex_get_names, error = %3d\n", error);
 291    
 292    for (i=0; i<num_elem_blk; i++)
 293      {
 294	ex_get_name(exoid, EX_ELEM_BLOCK, ids[i], name);
 295	if (strcmp(name, block_names[i]) != 0) {
 296	  printf ("error in ex_get_name for block id %d\n", ids[i]);
 297	}
 298        error = ex_get_elem_block (exoid, ids[i], elem_type,
 299                                   &(num_elem_in_block[i]), 
 300                                   &(num_nodes_per_elem[i]), &(num_attr[i]));
 301        printf ("\nafter ex_get_elem_block, error = %d\n", error);
 302         
 303        printf ("element block id = %2d\n",ids[i]);
 304        printf ("element type = '%s'\n", elem_type);
 305        printf ("num_elem_in_block = %2d\n",num_elem_in_block[i]);
 306        printf ("num_nodes_per_elem = %2d\n",num_nodes_per_elem[i]);
 307        printf ("num_attr = %2d\n",num_attr[i]);
 308        printf ("name = '%s'\n",block_names[i]);
 309	free(block_names[i]);
 310      }
 311     
 312    /* read element block properties */
 313    error = ex_inquire (exoid, EX_INQ_EB_PROP, &num_props, &fdum, cdum);
 314    printf ("\nafter ex_inquire, error = %d\n", error);
 315    printf ("\nThere are %2d properties for each element block\n", num_props);
 316     
 317    for (i=0; i<num_props; i++)
 318      {
 319        prop_names[i] = (char *) calloc ((max_name_length+1), sizeof(char));
 320      }
 321     
 322    error = ex_get_prop_names(exoid,EX_ELEM_BLOCK,prop_names);
 323    printf ("after ex_get_prop_names, error = %d\n", error);
 324     
 325     
 326    for (i=1; i<num_props; i++) /* Prop 1 is id; skip that here */
 327      {
 328        for (j=0; j<num_elem_blk; j++)
 329          {
 330            error = ex_get_prop(exoid, EX_ELEM_BLOCK, ids[j], prop_names[i],
 331                                &prop_value);
 332            if (error == 0)
 333              printf ("element block %2d, property(%2d): '%s'= %5d\n",
 334                      j+1, i+1, prop_names[i], prop_value);
 335            else
 336              printf ("after ex_get_prop, error = %d\n", error);
 337          }
 338      }
 339     
 340    for (i=0; i<num_props; i++)
 341      free(prop_names[i]);
 342  }
 343   
 344  /* read element connectivity */
 345
 346  for (i=0; i<num_elem_blk; i++)
 347    {
 348      if (num_elem_in_block[i] > 0) {
 349	connect = (int *) calloc((num_nodes_per_elem[i] * num_elem_in_block[i]), 
 350				 sizeof(int));
 351	
 352	error = ex_get_elem_conn (exoid, ids[i], connect);
 353	printf ("\nafter ex_get_elem_conn, error = %d\n", error);
 354	
 355	
 356	printf ("connect array for elem block %2d\n", ids[i]);
 357	
 358	for (j=0; j<num_nodes_per_elem[i]; j++)
 359	  {
 360	    printf ("%3d\n", connect[j]);
 361	  }
 362	/*
 363	  error = ex_get_1_elem_conn (exoid, 1, ids[i], connect);
 364	  printf ("\nafter ex_get_elem_conn, error = %d\n", error);
 365	  
 366	  printf ("node list for first element of element block %d \n ", ids[i]);
 367	  for (j=0; j<num_nodes_per_elem[i]; j++)
 368	  {
 369	  printf ("%d \n", connect[j]);
 370	  }
 371	*/
 372	free (connect);
 373      }
 374    }
 375
 376  /* read element block attributes */
 377
 378  for (i=0; i<num_elem_blk; i++)
 379    {
 380      if (num_elem_in_block[i] > 0) {
 381	for (j=0; j<num_attr[i]; j++)
 382	  attrib_names[j] = (char *) calloc ((max_name_length+1), sizeof(char));
 383	
 384	attrib = (float *) calloc(num_attr[i]*num_elem_in_block[i],sizeof(float));
 385	error = ex_get_elem_attr (exoid, ids[i], attrib);
 386	printf ("\n after ex_get_elem_attr, error = %d\n", error);
 387	
 388	if (error == 0) {
 389	  error = ex_get_elem_attr_names (exoid, ids[i], attrib_names);
 390	  printf (" after ex_get_elem_attr_names, error = %d\n", error);
 391	  
 392	  if (error == 0) {
 393	    printf ("element block %d attribute '%s' = %6.4f\n", ids[i], attrib_names[0], *attrib);
 394	  }
 395	}
 396	free (attrib);
 397	for (j=0; j<num_attr[i]; j++)
 398	  free (attrib_names[j]);
 399      }
 400    }
 401      
 402  if (num_elem_blk > 0) {
 403    free (ids);
 404    free (num_nodes_per_elem);
 405    free (num_attr);
 406  }
 407
 408  /* read individual node sets */
 409  if (num_node_sets > 0) {
 410    ids = (int *) calloc(num_node_sets, sizeof(int));
 411
 412    error = ex_get_node_set_ids (exoid, ids);
 413    printf ("\nafter ex_get_node_set_ids, error = %3d\n", error);
 414
 415    for (i=0; i<num_node_sets; i++) {
 416      nset_names[i] = (char *) calloc ((max_name_length+1), sizeof(char));
 417    }
 418
 419    error = ex_get_names(exoid, EX_NODE_SET, nset_names);
 420    printf ("\nafter ex_get_names, error = %3d\n", error);
 421
 422    for (i=0; i<num_node_sets; i++)
 423      {
 424	ex_get_name(exoid, EX_NODE_SET, ids[i], name);
 425	if (strcmp(name, nset_names[i]) != 0) {
 426	  printf ("error in ex_get_name for nodeset id %d\n", ids[i]);
 427	}
 428
 429        error = ex_get_node_set_param (exoid, ids[i], 
 430                                       &num_nodes_in_set, &num_df_in_set);
 431        printf ("\nafter ex_get_node_set_param, error = %3d\n", error);
 432
 433        printf ("\nnode set %2d parameters: \n", ids[i]);
 434        printf ("num_nodes = %2d\n", num_nodes_in_set);
 435	printf ("name = '%s'\n", nset_names[i]);
 436	free(nset_names[i]);
 437        node_list = (int *) calloc(num_nodes_in_set, sizeof(int));
 438        dist_fact = (float *) calloc(num_nodes_in_set, sizeof(float));
 439
 440        error = ex_get_node_set (exoid, ids[i], node_list);
 441        printf ("\nafter ex_get_node_set, error = %3d\n", error);
 442
 443        if (num_df_in_set > 0)
 444          {
 445            error = ex_get_node_set_dist_fact (exoid, ids[i], dist_fact);
 446            printf ("\nafter ex_get_node_set_dist_fact, error = %3d\n", error);
 447          }
 448
 449        printf ("\nnode list for node set %2d\n", ids[i]);
 450
 451        for (j=0; j<num_nodes_in_set; j++)
 452          {
 453            printf ("%3d\n", node_list[j]);
 454          }
 455
 456        if (num_df_in_set > 0)
 457          {
 458            printf ("dist factors for node set %2d\n", ids[i]);
 459
 460            for (j=0; j<num_nodes_in_set; j++)
 461              {
 462                printf ("%5.2f\n", dist_fact[j]);
 463              }
 464          }
 465        else
 466          printf ("no dist factors for node set %2d\n", ids[i]);
 467
 468        free (node_list);
 469        free (dist_fact);
 470
 471	{
 472	  int num_attrs = 0;
 473	  error = ex_get_attr_param(exoid, EX_NODE_SET, ids[i], &num_attrs);
 474	  printf (" after ex_get_attr_param, error = %d\n", error);
 475	  printf ("num nodeset attributes for nodeset %d = %d\n", ids[i], num_attrs);
 476	  if (num_attrs > 0) {
 477	    for (j=0; j<num_attrs; j++) {
 478	      attrib_names[j] = (char *)calloc ((max_name_length+1), sizeof(char));
 479	    }
 480	    error = ex_get_attr_names (exoid, EX_NODE_SET, ids[i], attrib_names);
 481	    printf (" after ex_get_attr_names, error = %d\n", error);
 482	    
 483	    if (error == 0) {
 484	      attrib = (float *) calloc(num_nodes_in_set,sizeof(float));
 485	      for (j=0; j<num_attrs; j++) {
 486		printf ("nodeset attribute %d = '%s'\n", j, attrib_names[j]);
 487		error = ex_get_one_attr(exoid, EX_NODE_SET, ids[i], j+1, attrib);
 488		printf (" after ex_get_one_attr, error = %d\n", error);
 489		for (k=0; k < num_nodes_in_set; k++) {
 490		  printf ("%5.1f\n", attrib[k]);
 491		}
 492		free(attrib_names[j]);
 493	      }
 494	      free(attrib);
 495	    }
 496	  }
 497	}
 498      }
 499    free(ids);
 500
 501    /* read node set properties */
 502    error = ex_inquire (exoid, EX_INQ_NS_PROP, &num_props, &fdum, cdum);
 503    printf ("\nafter ex_inquire, error = %d\n", error);
 504    printf ("\nThere are %2d properties for each node set\n", num_props);
 505
 506    for (i=0; i<num_props; i++)
 507      {
 508        prop_names[i] = (char *) calloc ((max_name_length+1), sizeof(char));
 509      }
 510    prop_values = (int *) calloc (num_node_sets, sizeof(int));
 511
 512    error = ex_get_prop_names(exoid,EX_NODE_SET,prop_names);
 513    printf ("after ex_get_prop_names, error = %d\n", error);
 514
 515
 516    for (i=0; i<num_props; i++)
 517      {
 518        error = ex_get_prop_array(exoid, EX_NODE_SET, prop_names[i],
 519                                  prop_values);
 520        if (error == 0)
 521          for (j=0; j<num_node_sets; j++)
 522            printf ("node set %2d, property(%2d): '%s'= %5d\n",
 523                    j+1, i+1, prop_names[i], prop_values[j]);
 524        else
 525          printf ("after ex_get_prop_array, error = %d\n", error);
 526      }
 527    for (i=0; i<num_props; i++)
 528      free(prop_names[i]);
 529    free(prop_values);
 530
 531    /* read concatenated node sets; this produces the same information as
 532     * the above code which reads individual node sets
 533     */
 534
 535    error = ex_inquire (exoid, EX_INQ_NODE_SETS, &num_node_sets, &fdum, cdum);
 536    printf ("\nafter ex_inquire, error = %3d\n",error);
 537
 538    ids = (int *) calloc(num_node_sets, sizeof(int));
 539    num_nodes_per_set = (int *) calloc(num_node_sets, sizeof(int));
 540    num_df_per_set = (int *) calloc(num_node_sets, sizeof(int));
 541    node_ind = (int *) calloc(num_node_sets, sizeof(int));
 542    df_ind = (int *) calloc(num_node_sets, sizeof(int));
 543
 544    error = ex_inquire (exoid, EX_INQ_NS_NODE_LEN, &list_len, &fdum, cdum);
 545    printf ("\nafter ex_inquire: EX_INQ_NS_NODE_LEN = %d, error = %3d\n",
 546            list_len, error);
 547    node_list = (int *) calloc(list_len, sizeof(int));
 548
 549    error = ex_inquire (exoid, EX_INQ_NS_DF_LEN, &list_len, &fdum, cdum);
 550    printf ("\nafter ex_inquire: EX_INQ_NS_DF_LEN = %d, error = %3d\n",
 551            list_len, error);
 552    dist_fact = (float *) calloc(list_len, sizeof(float));
 553
 554    error = ex_get_concat_node_sets (exoid,ids,num_nodes_per_set,num_df_per_set,
 555                                     node_ind, df_ind, node_list, dist_fact);
 556    printf ("\nafter ex_get_concat_node_sets, error = %3d\n", error);
 557
 558    printf ("\nconcatenated node set info\n");
 559
 560    printf ("ids = \n");
 561    for (i=0; i<num_node_sets; i++) printf ("%3d\n", ids[i]);
 562
 563    printf ("num_nodes_per_set = \n");
 564    for (i=0; i<num_node_sets; i++) printf ("%3d\n", num_nodes_per_set[i]);
 565
 566    printf ("node_ind = \n");
 567    for (i=0; i<num_node_sets; i++) printf ("%3d\n", node_ind[i]);
 568
 569    printf ("node_list = \n");
 570    for (i=0; i<list_len; i++) printf ("%3d\n", node_list[i]);
 571
 572    printf ("dist_fact = \n");
 573    for (i=0; i<list_len; i++) printf ("%5.3f\n", dist_fact[i]);
 574
 575    free (ids);
 576    free (df_ind);
 577    free (node_ind);
 578    free (num_df_per_set);
 579    free (node_list);
 580    free (dist_fact);
 581  }
 582
 583  /* read individual side sets */
 584
 585  if (num_side_sets > 0) {
 586    ids = (int *) calloc(num_side_sets, sizeof(int));
 587    
 588    error = ex_get_side_set_ids (exoid, ids);
 589    printf ("\nafter ex_get_side_set_ids, error = %3d\n", error);
 590    
 591    for (i=0; i<num_side_sets; i++) {
 592      sset_names[i] = (char *) calloc ((max_name_length+1), sizeof(char));
 593    }
 594
 595    error = ex_get_names(exoid, EX_SIDE_SET, sset_names);
 596    printf ("\nafter ex_get_names, error = %3d\n", error);
 597
 598    for (i=0; i<num_side_sets; i++)
 599      {
 600	ex_get_name(exoid, EX_SIDE_SET, ids[i], name);
 601	if (strcmp(name, sset_names[i]) != 0) {
 602	  printf ("error in ex_get_name for sideset id %d\n", ids[i]);
 603	}
 604
 605        error = ex_get_side_set_param (exoid, ids[i], &num_sides_in_set, 
 606                                       &num_df_in_set);
 607        printf ("\nafter ex_get_side_set_param, error = %3d\n", error);
 608        
 609        printf ("side set %2d parameters:\n",ids[i]);
 610	printf ("name = '%s'\n", sset_names[i]);
 611        printf ("num_sides = %3d\n",num_sides_in_set);
 612        printf ("num_dist_factors = %3d\n", num_df_in_set);
 613	free(sset_names[i]);
 614        
 615        
 616        /* Note: The # of elements is same as # of sides!  */
 617        num_elem_in_set = num_sides_in_set;
 618        elem_list = (int *) calloc(num_elem_in_set, sizeof(int));
 619        side_list = (int *) calloc(num_sides_in_set, sizeof(int));
 620        node_ctr_list = (int *) calloc(num_elem_in_set, sizeof(int));
 621        node_list = (int *) calloc(num_elem_in_set*21, sizeof(int));
 622        dist_fact = (float *) calloc(num_df_in_set, sizeof(float));
 623        
 624        error = ex_get_side_set (exoid, ids[i], elem_list, side_list);
 625        printf ("\nafter ex_get_side_set, error = %3d\n", error);
 626        
 627        error = ex_get_side_set_node_list (exoid, ids[i], node_ctr_list,
 628                                           node_list);
 629        printf ("\nafter ex_get_side_set_node_list, error = %3d\n", error);
 630        
 631        if (num_df_in_set > 0)
 632          {
 633            error = ex_get_side_set_dist_fact (exoid, ids[i], dist_fact);
 634            printf ("\nafter ex_get_side_set_dist_fact, error = %3d\n", error);
 635          }
 636        
 637        printf ("element list for side set %2d\n", ids[i]);
 638        for (j=0; j<num_elem_in_set; j++)
 639          {
 640            printf ("%3d\n", elem_list[j]);
 641          }
 642        
 643        printf ("side list for side set %2d\n", ids[i]);
 644        for (j=0; j<num_sides_in_set; j++)
 645          {
 646            printf ("%3d\n", side_list[j]);
 647          }
 648        
 649        node_ctr = 0;
 650        printf ("node list for side set %2d\n", ids[i]);
 651        for (k=0; k<num_elem_in_set; k++)
 652          {
 653            for (j=0; j<node_ctr_list[k]; j++)
 654              {
 655                printf ("%3d\n", node_list[node_ctr+j]);
 656              }
 657            node_ctr += node_ctr_list[k];
 658          }
 659        
 660        if (num_df_in_set > 0)
 661          {
 662            printf ("dist factors for side set %2d\n", ids[i]);
 663            
 664            for (j=0; j<num_df_in_set; j++)
 665              {
 666                printf ("%5.3f\n", dist_fact[j]);
 667              }
 668          }
 669        else
 670          printf ("no dist factors for side set %2d\n", ids[i]);
 671        
 672        free (elem_list);
 673        free (side_list);
 674        free (node_ctr_list);
 675        free (node_list);
 676        free (dist_fact);
 677        
 678      }
 679    
 680    /* read side set properties */
 681    error = ex_inquire (exoid, EX_INQ_SS_PROP, &num_props, &fdum, cdum);
 682    printf ("\nafter ex_inquire, error = %d\n", error);
 683    printf ("\nThere are %2d properties for each side set\n", num_props);
 684    
 685    for (i=0; i<num_props; i++)
 686      {
 687        prop_names[i] = (char *) calloc ((max_name_length+1), sizeof(char));
 688      }
 689    
 690    error = ex_get_prop_names(exoid,EX_SIDE_SET,prop_names);
 691    printf ("after ex_get_prop_names, error = %d\n", error);
 692
 693
 694    for (i=0; i<num_props; i++)
 695      {
 696        for (j=0; j<num_side_sets; j++)
 697          {
 698            error = ex_get_prop(exoid, EX_SIDE_SET, ids[j], prop_names[i],
 699                                &prop_value);
 700            if (error == 0)
 701              printf ("side set %2d, property(%2d): '%s'= %5d\n",
 702                      j+1, i+1, prop_names[i], prop_value);
 703            else
 704              printf ("after ex_get_prop, error = %d\n", error);
 705          }
 706      }
 707    for (i=0; i<num_props; i++)
 708      free(prop_names[i]);
 709    free (ids);
 710
 711    error = ex_inquire (exoid, EX_INQ_SIDE_SETS, &num_side_sets, &fdum, cdum);
 712    printf ("\nafter ex_inquire: EX_INQ_SIDE_SETS = %d,  error = %d\n",
 713            num_side_sets, error);
 714
 715    if (num_side_sets > 0)
 716      {
 717        error = ex_inquire(exoid, EX_INQ_SS_ELEM_LEN, &elem_list_len, &fdum, cdum);
 718        printf ("\nafter ex_inquire: EX_INQ_SS_ELEM_LEN = %d,  error = %d\n",
 719                elem_list_len, error);
 720
 721        error = ex_inquire(exoid, EX_INQ_SS_NODE_LEN, &node_list_len, &fdum, cdum);
 722        printf ("\nafter ex_inquire: EX_INQ_SS_NODE_LEN = %d,  error = %d\n",
 723                node_list_len, error);
 724
 725        error = ex_inquire(exoid, EX_INQ_SS_DF_LEN, &df_list_len, &fdum, cdum);
 726        printf ("\nafter ex_inquire: EX_INQ_SS_DF_LEN = %d,  error = %d\n",
 727                df_list_len, error);
 728      }
 729
 730    /* read concatenated side sets; this produces the same information as
 731     * the above code which reads individual side sets
 732     */
 733
 734    /* concatenated side set read */
 735
 736    if (num_side_sets > 0) {
 737      ids = (int *) calloc(num_side_sets, sizeof(int));
 738      num_elem_per_set = (int *) calloc(num_side_sets, sizeof(int));
 739      num_df_per_set = (int *) calloc(num_side_sets, sizeof(int));
 740      elem_ind = (int *) calloc(num_side_sets, sizeof(int));
 741      df_ind = (int *) calloc(num_side_sets, sizeof(int));
 742      elem_list = (int *) calloc(elem_list_len, sizeof(int));
 743      side_list = (int *) calloc(elem_list_len, sizeof(int));
 744      dist_fact = (float *) calloc(df_list_len, sizeof(float));
 745     
 746      error = ex_get_concat_side_sets (exoid, ids, num_elem_per_set, 
 747                                       num_df_per_set, elem_ind, df_ind, 
 748                                       elem_list, side_list, dist_fact);
 749      printf ("\nafter ex_get_concat_side_sets, error = %3d\n", error);
 750     
 751      printf ("concatenated side set info\n");
 752     
 753      printf ("ids = \n");
 754      for (i=0; i<num_side_sets; i++) printf ("%3d\n", ids[i]);
 755     
 756      printf ("num_elem_per_set = \n");
 757      for (i=0; i<num_side_sets; i++) printf ("%3d\n", num_elem_per_set[i]);
 758     
 759      printf ("num_dist_per_set = \n");
 760      for (i=0; i<num_side_sets; i++) printf ("%3d\n", num_df_per_set[i]);
 761     
 762      printf ("elem_ind = \n");
 763      for (i=0; i<num_side_sets; i++) printf ("%3d\n", elem_ind[i]);
 764     
 765      printf ("dist_ind = \n");
 766      for (i=0; i<num_side_sets; i++) printf ("%3d\n", df_ind[i]);
 767     
 768      printf ("elem_list = \n");
 769      for (i=0; i<elem_list_len; i++) printf ("%3d\n", elem_list[i]);
 770     
 771      printf ("side_list = \n");
 772      for (i=0; i<elem_list_len; i++) printf ("%3d\n", side_list[i]);
 773     
 774      printf ("dist_fact = \n");
 775      for (i=0; i<df_list_len; i++) printf ("%5.3f\n", dist_fact[i]);
 776     
 777      free (ids);
 778      free (num_df_per_set);
 779      free (df_ind);
 780      free (elem_ind);
 781      free (elem_list);
 782      free (side_list);
 783      free (dist_fact);
 784    }
 785  }   
 786  /* end of concatenated side set read */
 787
 788  /* read QA records */
 789
 790  ex_inquire (exoid, EX_INQ_QA, &num_qa_rec, &fdum, cdum);
 791
 792  for (i=0; i<num_qa_rec; i++)
 793    {
 794      for (j=0; j<4; j++)
 795        {
 796          qa_record[i][j] = (char *) calloc ((max_name_length+1), sizeof(char));
 797        }
 798    }
 799
 800  error = ex_get_qa (exoid, qa_record); 
 801  printf ("\nafter ex_get_qa, error = %3d\n", error);
 802
 803  printf ("QA records = \n");
 804  for (i=0; i<num_qa_rec; i++) 
 805    {
 806      for (j=0; j<4; j++)
 807        {
 808          printf (" '%s'\n", qa_record[i][j]);
 809          free(qa_record[i][j]);
 810        }
 811    }
 812
 813  /* read information records */
 814
 815  error = ex_inquire (exoid, EX_INQ_INFO, &num_info, &fdum, cdum);
 816  printf ("\nafter ex_inquire, error = %3d\n", error);
 817
 818  for (i=0; i<num_info; i++)
 819    {
 820      info[i] = (char *) calloc ((MAX_LINE_LENGTH+1), sizeof(char));
 821    }
 822
 823  error = ex_get_info (exoid, info); 
 824  printf ("\nafter ex_get_info, error = %3d\n", error);
 825
 826  printf ("info records = \n");
 827  for (i=0; i<num_info; i++)
 828    {
 829      printf (" '%s'\n", info[i]);
 830      free(info[i]);
 831    }
 832
 833  /* read global variables parameters and names */
 834
 835  error = ex_get_var_param (exoid, "g", &num_glo_vars);
 836  printf ("\nafter ex_get_var_param, error = %3d\n", error);
 837
 838  for (i=0; i<num_glo_vars; i++)
 839    {
 840      var_names[i] = (char *) calloc ((max_name_length+1), sizeof(char));
 841    }
 842
 843  error = ex_get_var_names (exoid, "g", num_glo_vars, var_names);
 844  printf ("\nafter ex_get_var_names, error = %3d\n", error);
 845
 846  printf ("There are %2d global variables; their names are :\n", 
 847          num_glo_vars);
 848  for (i=0; i<num_glo_vars; i++)
 849    {
 850      printf (" '%s'\n", var_names[i]);
 851      free(var_names[i]);
 852    }
 853
 854  /* read nodal variables parameters and names */
 855  num_nod_vars = 0;
 856  if (num_nodes > 0) {
 857    error = ex_get_variable_param (exoid, EX_NODAL, &num_nod_vars);
 858    printf ("\nafter ex_get_var_param, error = %3d\n", error);
 859
 860    for (i=0; i<num_nod_vars; i++)
 861      {
 862        var_names[i] = (char *) calloc ((max_name_length+1), sizeof(char));
 863      }
 864
 865    error = ex_get_variable_names (exoid, EX_NODAL, num_nod_vars, var_names);
 866    printf ("\nafter ex_get_var_names, error = %3d\n", error);
 867
 868    printf ("There are %2d nodal variables; their names are :\n", num_nod_vars);
 869    for (i=0; i<num_nod_vars; i++)
 870      {
 871        printf (" '%s'\n", var_names[i]);
 872        free(var_names[i]);
 873      }
 874  }
 875
 876  /* read element variables parameters and names */
 877
 878  num_ele_vars = 0;
 879  if (num_elem > 0) {
 880    error = ex_get_var_param (exoid, "e", &num_ele_vars);
 881    printf ("\nafter ex_get_var_param, error = %3d\n", error);
 882     
 883    for (i=0; i<num_ele_vars; i++)
 884      {
 885        var_names[i] = (char *) calloc ((max_name_length+1), sizeof(char));
 886      }
 887     
 888    error = ex_get_var_names (exoid, "e", num_ele_vars, var_names);
 889    printf ("\nafter ex_get_var_names, error = %3d\n", error);
 890     
 891    printf ("There are %2d element variables; their names are :\n", 
 892            num_ele_vars);
 893    for (i=0; i<num_ele_vars; i++)
 894      {
 895        printf (" '%s'\n", var_names[i]);
 896        free(var_names[i]);
 897      }
 898
 899    /* read element variable truth table */
 900
 901    if (num_ele_vars > 0) {
 902      truth_tab = (int *) calloc ((num_elem_blk*num_ele_vars), sizeof(int));
 903     
 904      error = ex_get_elem_var_tab (exoid, num_elem_blk, num_ele_vars, truth_tab);
 905      printf ("\nafter ex_get_elem_var_tab, error = %3d\n", error);
 906     
 907      printf ("This is the element variable truth table:\n");
 908     
 909      k = 0;
 910      for (i=0; i<num_elem_blk*num_ele_vars; i++)
 911        {
 912          printf ("%2d\n", truth_tab[k++]);
 913        }
 914      free (truth_tab);
 915    }
 916  }
 917
 918  /* read nodeset variables parameters and names */
 919
 920  num_nset_vars = 0;
 921  if (num_node_sets > 0) {
 922    error = ex_get_var_param (exoid, "m", &num_nset_vars);
 923    printf ("\nafter ex_get_var_param, error = %3d\n", error);
 924     
 925    if (num_nset_vars > 0) {
 926      for (i=0; i<num_nset_vars; i++)
 927	{
 928	  var_names[i] = (char *) calloc ((max_name_length+1), sizeof(char));
 929	}
 930     
 931      error = ex_get_var_names (exoid, "m", num_nset_vars, var_names);
 932      printf ("\nafter ex_get_var_names, error = %3d\n", error);
 933     
 934      printf ("There are %2d nodeset variables; their names are :\n", 
 935	      num_nset_vars);
 936      for (i=0; i<num_nset_vars; i++)
 937	{
 938	  printf (" '%s'\n", var_names[i]);
 939	  free(var_names[i]);
 940	}
 941
 942      /* read nodeset variable truth table */
 943
 944      if (num_nset_vars > 0) {
 945	truth_tab = (int *) calloc ((num_node_sets*num_nset_vars), sizeof(int));
 946     
 947	error = ex_get_nset_var_tab (exoid, num_node_sets, num_nset_vars, truth_tab);
 948	printf ("\nafter ex_get_nset_var_tab, error = %3d\n", error);
 949     
 950	printf ("This is the nodeset variable truth table:\n");
 951     
 952	k = 0;
 953	for (i=0; i<num_node_sets*num_nset_vars; i++)
 954	  {
 955	    printf ("%2d\n", truth_tab[k++]);
 956	  }
 957	free (truth_tab);
 958      }
 959    }
 960  }
 961
 962  /* read sideset variables parameters and names */
 963
 964  num_sset_vars = 0;
 965  if (num_side_sets > 0) {
 966    error = ex_get_var_param (exoid, "s", &num_sset_vars);
 967    printf ("\nafter ex_get_var_param, error = %3d\n", error);
 968     
 969    if (num_sset_vars > 0) {
 970      for (i=0; i<num_sset_vars; i++)
 971	{
 972	  var_names[i] = (char *) calloc ((max_name_length+1), sizeof(char));
 973	}
 974     
 975      error = ex_get_var_names (exoid, "s", num_sset_vars, var_names);
 976      printf ("\nafter ex_get_var_names, error = %3d\n", error);
 977     
 978      printf ("There are %2d sideset variables; their names are :\n", 
 979	      num_sset_vars);
 980      for (i=0; i<num_sset_vars; i++)
 981	{
 982	  printf (" '%s'\n", var_names[i]);
 983	  free(var_names[i]);
 984	}
 985
 986      /* read sideset variable truth table */
 987
 988      if (num_sset_vars > 0) {
 989	truth_tab = (int *) calloc ((num_side_sets*num_sset_vars), sizeof(int));
 990     
 991	error = ex_get_sset_var_tab (exoid, num_side_sets, num_sset_vars, truth_tab);
 992	printf ("\nafter ex_get_sset_var_tab, error = %3d\n", error);
 993     
 994	printf ("This is the sideset variable truth table:\n");
 995     
 996	k = 0;
 997	for (i=0; i<num_side_sets*num_sset_vars; i++)
 998	  {
 999	    printf ("%2d\n", truth_tab[k++]);
1000	  }
1001	free (truth_tab);
1002      }
1003    }
1004  }
1005
1006  /* determine how many time steps are stored */
1007
1008  error = ex_inquire (exoid, EX_INQ_TIME, &num_time_steps, &fdum, cdum);
1009  printf ("\nafter ex_inquire, error = %3d\n", error);
1010  printf ("There are %2d time steps in the database.\n", num_time_steps);
1011
1012  /* read time value at one time step */
1013
1014  time_step = 3;
1015  error = ex_get_time (exoid, time_step, &time_value);
1016  printf ("\nafter ex_get_time, error = %3d\n", error);
1017
1018  printf ("time value at time step %2d = %5.3f\n", time_step, time_value);
1019
1020  /* read time values at all time steps */
1021
1022  time_values = (float *) calloc (num_time_steps, sizeof(float));
1023
1024  error = ex_get_all_times (exoid, time_values);
1025  printf ("\nafter ex_get_all_times, error = %3d\n", error);
1026
1027  printf ("time values at all time steps are:\n");
1028  for (i=0; i<num_time_steps; i++) printf ("%5.3f\n", time_values[i]);
1029
1030  free (time_values);
1031
1032  /* read all global variables at one time step */
1033
1034  var_values = (float *) calloc (num_glo_vars, sizeof(float));
1035
1036  error = ex_get_glob_vars (exoid, time_step, num_glo_vars, var_values);
1037  printf ("\nafter ex_get_glob_vars, error = %3d\n", error);
1038
1039  printf ("global variable values at time step %2d\n", time_step);
1040  for (i=0; i<num_glo_vars; i++) printf ("%5.3f\n", var_values[i]);
1041
1042  free (var_values); 
1043
1044  /* read a single global variable through time */
1045
1046  var_index = 1;
1047  beg_time = 1;
1048  end_time = -1;
1049
1050  var_values = (float *) calloc (num_time_steps, sizeof(float));
1051
1052  error = ex_get_glob_var_time (exoid, var_index, beg_time, end_time, 
1053                                var_values);
1054  printf ("\nafter ex_get_glob_var_time, error = %3d\n", error);
1055
1056  printf ("global variable %2d values through time:\n", var_index);
1057  for (i=0; i<num_time_steps; i++) printf ("%5.3f\n", var_values[i]);
1058
1059  free (var_values); 
1060
1061  /* read a nodal variable at one time step */
1062
1063  if (num_nodes > 0) {
1064    var_values = (float *) calloc (num_nodes, sizeof(float));
1065
1066    error = ex_get_nodal_var (exoid, time_step, var_index, num_nodes, 
1067                              var_values);
1068    printf ("\nafter ex_get_nodal_var, error = %3d\n", error);
1069
1070    printf ("nodal variable %2d values at time step %2d\n", var_index, 
1071            time_step);
1072    for (i=0; i<num_nodes; i++) printf ("%5.3f\n", var_values[i]);
1073
1074    free (var_values); 
1075
1076    /* read a nodal variable through time */
1077
1078    var_values = (float *) calloc (num_time_steps, sizeof(float));
1079
1080    node_num = 1;
1081    error = ex_get_nodal_var_time (exoid, var_index, node_num, beg_time, 
1082                                   end_time, var_values);
1083    printf ("\nafter ex_get_nodal_var_time, error = %3d\n", error);
1084
1085    printf ("nodal variable %2d values for node %2d through time:\n", var_index,
1086            node_num);
1087    for (i=0; i<num_time_steps; i++) printf ("%5.3f\n", var_values[i]);
1088
1089    free (var_values); 
1090  }
1091  /* read an element variable at one time step */
1092
1093  if (num_elem_blk > 0) {
1094    ids = (int *) calloc(num_elem_blk, sizeof(int));
1095     
1096    error = ex_get_elem_blk_ids (exoid, ids);
1097    printf ("\n after ex_get_elem_blk_ids, error = %3d\n", error);
1098     
1099    for (i=0; i<num_elem_blk; i++)
1100      {
1101	if (num_elem_in_block[i] > 0) {
1102	  var_values = (float *) calloc (num_elem_in_block[i], sizeof(float));
1103         
1104	  error = ex_get_elem_var (exoid, time_step, var_index, ids[i], 
1105				   num_elem_in_block[i], var_values);
1106	  printf ("\nafter ex_get_elem_var, error = %3d\n", error);
1107         
1108	  if (!error)
1109	    {
1110	      printf 
1111		("element variable %2d values of element block %2d at time step %2d\n",
1112		 var_index, ids[i], time_step);
1113	      for (j=0; j<num_elem_in_block[i]; j++) 
1114		printf ("%5.3f\n", var_values[j]);
1115	    }
1116         
1117	  free (var_values);
1118	}
1119      }
1120    free (num_elem_in_block);
1121    free(ids);
1122  }
1123  /* read an element variable through time */
1124
1125  if (num_ele_vars > 0) {
1126    var_values = (float *) calloc (num_time_steps, sizeof(float));
1127     
1128    var_index = 2;
1129    elem_num = 2;
1130    error = ex_get_elem_var_time (exoid, var_index, elem_num, beg_time, 
1131                                  end_time, var_values);
1132    printf ("\nafter ex_get_elem_var_time, error = %3d\n", error);
1133     
1134    printf ("element variable %2d values for element %2d through time:\n", 
1135            var_index, elem_num);
1136    for (i=0; i<num_time_steps; i++) printf ("%5.3f\n", var_values[i]);
1137     
1138    free (var_values);
1139  }
1140   
1141  /* read a sideset variable at one time step */
1142
1143  if (num_sset_vars > 0) {
1144    ids = (int *) calloc(num_side_sets, sizeof(int));
1145     
1146    error = ex_get_side_set_ids (exoid, ids);
1147    printf ("\n after ex_get_side_set_ids, error = %3d\n", error);
1148     
1149    for (i=0; i<num_side_sets; i++)
1150      {
1151        var_values = (float *) calloc (num_elem_per_set[i], sizeof(float));
1152         
1153        error = ex_get_sset_var (exoid, time_step, var_index, ids[i], 
1154                                 num_elem_per_set[i], var_values);
1155        printf ("\nafter ex_get_sset_var, error = %3d\n", error);
1156         
1157        if (!error)
1158          {
1159            printf 
1160              ("sideset variable %2d values of sideset %2d at time step %2d\n",
1161               var_index, ids[i], time_step);
1162            for (j=0; j<num_elem_per_set[i]; j++) 
1163              printf ("%5.3f\n", var_values[j]);
1164          }
1165         
1166        free (var_values); 
1167      }
1168    free (num_elem_per_set);
1169    free(ids);
1170  }
1171
1172  /* read a nodeset variable at one time step */
1173
1174  if (num_nset_vars > 0) {
1175    ids = (int *) calloc(num_node_sets, sizeof(int));
1176     
1177    error = ex_get_node_set_ids (exoid, ids);
1178    printf ("\n after ex_get_node_set_ids, error = %3d\n", error);
1179     
1180    for (i=0; i<num_node_sets; i++)
1181      {
1182        var_values = (float *) calloc (num_nodes_per_set[i], sizeof(float));
1183         
1184        error = ex_get_nset_var (exoid, time_step, var_index, ids[i], 
1185                                 num_nodes_per_set[i], var_values);
1186        printf ("\nafter ex_get_nset_var, error = %3d\n", error);
1187         
1188        if (!error)
1189          {
1190            printf 
1191              ("nodeset variable %2d values of nodeset %2d at time step %2d\n",
1192               var_index, ids[i], time_step);
1193            for (j=0; j<num_nodes_per_set[i]; j++) 
1194              printf ("%5.3f\n", var_values[j]);
1195          }
1196         
1197        free (var_values); 
1198      }
1199    free(ids);
1200  }
1201  if (num_node_sets > 0)
1202    free (num_nodes_per_set);
1203
1204  error = ex_close (exoid);
1205  printf ("\nafter ex_close, error = %3d\n", error);
1206  return 0;
1207}