Gromacs  2020.4
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
Functions
#include "gmxpre.h"
#include "selvalue.h"
#include "gromacs/selection/indexutil.h"
#include "gromacs/utility/gmxassert.h"
#include "gromacs/utility/smalloc.h"
#include "position.h"
+ Include dependency graph for selvalue.cpp:

Description

Implements functions in selvalue.h.

Author
Teemu Murtola teemu.nosp@m..mur.nosp@m.tola@.nosp@m.gmai.nosp@m.l.com

Functions

void _gmx_selvalue_clear (gmx_ana_selvalue_t *val)
 Initializes an empty selection value structure. More...
 
void _gmx_selvalue_free (gmx_ana_selvalue_t *val)
 Frees memory allocated for a selection value structure. More...
 
void _gmx_selvalue_reserve (gmx_ana_selvalue_t *val, int n)
 Reserve memory for storing selection values. More...
 
void _gmx_selvalue_getstore_and_release (gmx_ana_selvalue_t *val, void **ptr, int *nalloc)
 Gets and releases the memory pointer for storing selection values. More...
 
void _gmx_selvalue_setstore (gmx_ana_selvalue_t *val, void *ptr)
 Sets the memory for storing selection values. More...
 
void _gmx_selvalue_setstore_alloc (gmx_ana_selvalue_t *val, void *ptr, int nalloc)
 Sets the memory for storing selection values and marks it for automatic freeing. More...
 

Function Documentation

void _gmx_selvalue_clear ( gmx_ana_selvalue_t val)

Initializes an empty selection value structure.

Parameters
[out]valOutput structure

The type of val is not touched. Any contents of val are discarded without freeing.

void _gmx_selvalue_free ( gmx_ana_selvalue_t val)

Frees memory allocated for a selection value structure.

Parameters
[in,out]valValues to free.

The type of val is not touched. If memory is not allocated, the value pointers are simply cleared without freeing.

void _gmx_selvalue_getstore_and_release ( gmx_ana_selvalue_t val,
void **  ptr,
int *  nalloc 
)

Gets and releases the memory pointer for storing selection values.

Parameters
[in,out]valValue structure to release.
[out]ptrPointer where the values are stored.
[out]nallocPointer where the values are stored.

Returns the pointer where values of val were stored in ptr and nalloc, and clears the memory in val.

void _gmx_selvalue_reserve ( gmx_ana_selvalue_t val,
int  n 
)

Reserve memory for storing selection values.

Parameters
[in,out]valValue structure to allocate.
[in]nMaximum number of values needed.

Reserves memory for the values within val to store at least n values, of the type specified in the val structure.

If the type is POS_VALUE or GROUP_VALUE, memory is reserved for the data structures, but no memory is reserved inside these newly allocated data structures. Similarly, for STR_VALUE values, the pointers are set to NULL. For other values, the memory is uninitialized.

void _gmx_selvalue_setstore ( gmx_ana_selvalue_t val,
void *  ptr 
)

Sets the memory for storing selection values.

Parameters
[in,out]valValue structure to set storage for.
[in]ptrPointer where the values should be stored.

Automatic memory management is disabled for ptr. Asserts if val had a previous storage that it owned, as that would result in a memory leak.

void _gmx_selvalue_setstore_alloc ( gmx_ana_selvalue_t val,
void *  ptr,
int  nalloc 
)

Sets the memory for storing selection values and marks it for automatic freeing.

Parameters
[in,out]valValue structure to set storage for.
[in]ptrPointer where the values should be stored.
[in]nallocNumber of values allocated for ptr.

Asserts if val had a previous storage that it owned, as that would result in a memory leak.