PageRenderTime 7ms CodeModel.GetById 4ms app.highlight 113ms RepoModel.GetById 1ms app.codeStats 1ms

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

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