Exodus 7.10

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

## Functions
int | ex_put_prop (int exoid, ex_entity_type obj_type, ex_entity_id obj_id, const char *prop_name, ex_entity_id value)

## Function Documentation

## ◆ ex_put_prop()

int ex_put_prop | ( | int | exoid,
|  | ex_entity_type | obj_type,
|  | ex_entity_id | obj_id,
|  | const char * | prop_name,
|  | ex_entity_id | value
| ) |  |

The function ex_put_prop() stores an integer object property value to a single element block, node set, or side set. Although it is not necessary to invoke ex_put_prop_names(), 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.

It should be noted that the interpretation of the values of the integers stored as properties is left to the application code. In general, a zero (0) means the object does not have the specified property (or is not in the specified group); a nonzero value means the object does have the specified property. When space is allocated for the properties using ex_put_prop_names() or ex_put_prop(), the properties are initialized to zero (0).

Because the ID of an element block, node set, or side set is just another property (named ID), this routine can be used to change the value of an ID. This feature must be used with caution, though, because changing the ID of an object to the ID of another object of the same type (element block, node set, or side set) would cause two objects to have the same ID, and thus only the first would be accessible. Therefore, ex_put_prop() issues a warning if a user attempts to give two objects the same ID.

Returns
  In case of an error, ex_put_prop() 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.
  - a warning is issued if a user attempts to change the ID of an object to the ID of an existing object of the same type.

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] | obj_id | The element block, node set, or side set ID.
  [in] | prop_name | The name of the property for which the value will be stored. Maximum length of this string is `MAX_STR_LENGTH` .
  [in] | value | The value of the property.

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 an example of code to write out an object property, refer to the description for ex_put_prop_names().