18.2.180. PMIx_Coord_create

PMIx_Coord_create — Allocate and initialize an array of pmix_coord_t(5) structures.

18.2.180.1. SYNOPSIS

#include <pmix.h>

pmix_coord_t* PMIx_Coord_create(size_t dims,
                                size_t number);

18.2.180.1.1. Python Syntax

No Python equivalent

18.2.180.2. INPUT PARAMETERS

  • dims: Number of dimensions to allocate for the coordinate array of the created structure(s).

  • number: Number of pmix_coord_t(5) structures to allocate.

18.2.180.3. DESCRIPTION

Allocate a contiguous array of number pmix_coord_t structures on the heap. The view field is set to PMIX_COORD_VIEW_UNDEF and the dims field to dims. When dims is non-zero, a dims-element array of uint32_t coordinate values is allocated and zero-initialized and attached via the coord pointer; when dims is zero, coord is left NULL.

If number is zero, no allocation is performed and NULL is returned.

18.2.180.4. RETURN VALUE

Returns a pointer to the newly allocated array, or NULL if number is zero or the allocation fails.

18.2.180.5. NOTES

An array obtained from PMIx_Coord_create must be released with PMIx_Coord_free(3), which destructs each element’s coordinate array and frees the array storage itself. Pass the same number used at creation.

The convenience macro PMIX_COORD_CREATE is provided as a wrapper around this function.

18.2.180.6. EXAMPLES

Create a single three-dimensional coordinate and release it:

pmix_coord_t *coord;

coord = PMIx_Coord_create(3, 1);
coord->view = PMIX_COORD_LOGICAL_VIEW;
coord->coord[0] = 0;
coord->coord[1] = 1;
coord->coord[2] = 2;
/* ... use the coordinate ... */
PMIx_Coord_free(coord, 1);