src/ccpp_fields_idx.c File Reference

Routines and functions to generate and lookup fields/variables needed for the physics routines. More...

#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <err.h>
#include <sysexits.h>
#include <assert.h>
#include "ccpp_fields_idx.h"
Include dependency graph for ccpp_fields_idx.c:

Functions/Subroutines



int ccpp_field_idx_init (void **index)
int ccpp_field_idx_fini (void **index)
int ccpp_field_idx_add (const char *name, void **index)
int ccpp_field_idx_find (const char *name, void **index)
int ccpp_field_idx_sort (void **index)
int ccpp_field_idx_grow (void **index)
int ccpp_field_idx_max (void **index)

Detailed Description

Routines and functions to generate and lookup fields/variables needed for the physics routines.

The fields are stored in an array of C pointers within the ccpp_t type. There is also an index array in this type. We poppulate this index array with the standard name of each variable in the fields array. We use a binary search on the sorted index array to retreive the array index for the field witin the fields array.

TODO


Function Documentation

int ccpp_field_idx_add ( const char *  name,
void **  index 
)

Add/Insert a field into the index.

Parameters:
[in] name The name to add to the index array.
[in,out] index The index array.
Return values:
> 0 The index location.
-1 If there was an error.

Here is the call graph for this function:

Here is the caller graph for this function:

int ccpp_field_idx_find ( const char *  name,
void **  index 
)

Find the index number of a field.

Parameters:
[in] name The field name to find the index array.
[in,out] index The index array.
Return values:
> 0 The position in the index array of the requested field.
-1 If there was an error.

Here is the call graph for this function:

Here is the caller graph for this function:

int ccpp_field_idx_fini ( void **  index  ) 

Finialization routine.

Deallocates the field indices array.

Parameters:
[in] index The index array.
Return values:
0 If it was sucessful.

Here is the caller graph for this function:

int ccpp_field_idx_grow ( void **  index  ) 

Grow the index field array.

Parameters:
[in,out] index The index array.
Return values:
0 If there was no error.

Here is the caller graph for this function:

int ccpp_field_idx_init ( void **  index  ) 

Initialization routine.

Allocates an array for the field indices.

Parameters:
[in,out] index The index array.
Return values:
0 If it was sucessful.
1 If there was an error.

Here is the caller graph for this function:

int ccpp_field_idx_max ( void **  index  ) 

Get the maximum number of fields the index array can hold.

Parameters:
[in,out] index The index array.
Return values:
>= 0 The maximum number of fields.

Here is the caller graph for this function:

int ccpp_field_idx_sort ( void **  index  ) 

Sort the index by calling qsort() and using cmp() as the comparison function.

Parameters:
[in,out] index The index array.
Return values:
0 If there was no error.

Here is the caller graph for this function:

 All Classes Namespaces Files Functions Variables Defines

Generated on 26 Apr 2017 for ccpp by  doxygen 1.6.1