Exodus 7.10

Functions
ex_put_prop_names.c File Reference
`#include "exodusII.h"`
`#include "exodusII_int.h"`
`#include "netcdf.h"`
`#include <stddef.h>`
`#include <stdio.h>`
`#include <string.h>`

## Functions
int | ex_put_prop_names (int exoid, ex_entity_type obj_type, int num_props, char **prop_names)

## Function Documentation

## ◆ ex_put_prop_names()

int ex_put_prop_names | ( | int | exoid,
|  | ex_entity_type | obj_type,
|  | int | num_props,
|  | char ** | prop_names
| ) |  |

The function ex_put_prop_names() writes object property names and allocates space for object property arrays used to assign integer properties to element blocks, node sets, or side sets. The property arrays are initialized to zero (0). Although this function is optional, since ex_put_prop() will allocate space within the data file if it hasn't been previously allocated, it is more efficient to use ex_put_prop_names() if there is more than one property to store.

See also
  Efficiency for a discussion of efficiency issues.

Returns
  In case of an error, ex_put_prop_names() returns a negative number; a warning will return a positive number. Possible causes of errors include:
  - data file not properly opened with call to ex_create() or ex_open()
  - data file opened for read only.
  - data file not initialized properly with call to ex_put_init().
  - invalid object type specified.
  - no object of the specified type is stored in the file.

Parameters

  [in] | exoid | exodus file ID returned from a previous call to ex_create() or ex_open().
  [in] | obj_type | Type of object; use one of the options in the table below.
  [in] | num_props | The number of integer properties to be assigned to all of the objects of the type specified (element blocks, node sets, or side sets).
  [in] | prop_names | Array containing num_props names (of maximum length of `MAX_STR_LENGTH` ) of properties to be stored.

ex_entity_type | description
--- | ---
EX_NODE_SET | Node Set entity type
EX_EDGE_BLOCK | Edge Block entity type
EX_EDGE_SET | Edge Set entity type
EX_FACE_BLOCK | Face Block entity type
EX_FACE_SET | Face Set entity type
EX_ELEM_BLOCK | Element Block entity type
EX_ELEM_SET | Element Set entity type
EX_SIDE_SET | Side Set entity type
EX_ELEM_MAP | Element Map entity type
EX_NODE_MAP | Node Map entity type
EX_EDGE_MAP | Edge Map entity type
EX_FACE_MAP | Face Map entity type

For instance, suppose a user wanted to assign the 1st, 3rd, and 5th element blocks (those element blocks stored 1st, 3rd, and 5th, regardless of their ID) to a group (property) called TOP, and the 2nd, 3rd, and 4th element blocks to a group called LSIDE. This could be accomplished with the following code:

char* prop_names[2];
int top_part[] = {1,0,1,0,1};
int lside_part[] = {0,1,1,1,0};
int id[] = {10, 20, 30, 40, 50};
prop_names[0] = "TOP";
prop_names[1] = "LSIDE";
/* This call to ex_put_prop_names is optional, but more efficient */
ex_put_prop_names (exoid, EX_ELEM_BLOCK, 2, prop_names);
/* The property values can be output individually thus */
for (i=0; i < 5; i++) {
ex_put_prop (exoid, EX_ELEM_BLOCK, id[i], prop_names[0],
top_part[i]);
ex_put_prop (exoid, EX_ELEM_BLOCK, id[i], prop_names[1],
lside_part[i]);
}
/* Alternatively, the values can be output as an array */
ex_put_prop_array (exoid, EX_ELEM_BLOCK, prop_names[0],
top_part);
ex_put_prop_array (exoid, EX_ELEM_BLOCK, prop_names[1],
lside_part);