Exodus 7.10

Functions
ex_get_coord.c File Reference
`#include "exodusII.h"`
`#include "exodusII_int.h"`

## Functions
int | ex_get_coord (int exoid, void *x_coor, void *y_coor, void *z_coor)

## Function Documentation

## ◆ ex_get_coord()

int ex_get_coord | ( | int | exoid,
|  | void * | x_coor,
|  | void * | y_coor,
|  | void * | z_coor
| ) |  |

The function ex_get_coord() reads the nodal coordinates of the nodes. Memory must be allocated for the coordinate arrays (x_coor, y_coor, and z_coor) before this call is made. The length of each of these arrays is the number of nodes in the mesh.

Because the coordinates are floating point values, the application code must declare the arrays passed to be the appropriate type (float or double) to match the compute word size passed in ex_create() or ex_open().

Returns
  In case of an error, ex_get_coord() 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()
  - a warning value is returned if nodal coordinates were not stored.

Parameters

  [in] | exoid | exodus file ID returned from a previous call to ex_create() or ex_open().
  [out] | x_coor | Returned X coordinates of the nodes. If this is NULL, the X-coordinates will not be read.
  [out] | y_coor | Returned Y coordinates of the nodes. These are returned only if num_dim > 1; otherwise, pass in NULL. If this is NULL, the Y-coordinates will not be read.
  [out] | z_coor | Returned Z coordinates of the nodes. These are returned only if num_dim > 2; otherwise, pass in NULL. If this is NULL, the Z-coordinates will not be read.

The following code segment will read the nodal coordinates from an open exodus file :

int error, exoid;
double *x, *y, *z;
/* read nodal coordinates values from database */
x = (double *)calloc(num_nodes, sizeof(double));
y = (double *)calloc(num_nodes, sizeof(double));
if (num_dim >= 3)
z = (double *)calloc(num_nodes, sizeof(double));
else
z = 0;
error = ex_get_coord(exoid, x, y, z);
/* Do the same as the previous call in three separate calls */
error = ex_get_coord(exoid, x, NULL, NULL);
error = ex_get_coord(exoid, NULL, y, NULL);
if (num_dim >= 3)
error = ex_get_coord(exoid, NULL, NULL, z);