Wiki

Clone wiki

GHOST / Coding

Function naming

All non-static funtion names should be written in lower camelCase. Functions which are applied to dense or sparse matrices are invoked via function pointers on the data structure, e.g., vec->toFile().

All other non-static GHOST function start with the lower case prefix ghost_ followed by the function name in lower camelCase, e.g., ghost_printMatrixInfo().

Return values

All non-static functions where an error can occur should return an ghost_error_t. Exceptions:

  • Functions which return a state of an object, e.g., ghost_task_state_t ghost_task_test(ghost_task_t *). Here, a possible error (e.g, the given task is NULL) is encoded in the ghost_task_state_t.

  • Function which return a string, e.g., char * ghost_strerror(ghost_error_t). Here, a possible error is encoded in the string.

Style

Indentation should be done following the 1TBS style. The indent size is four spaces.

Header files

All application-relevant include files should be included in ghost.h. Thus, applications are only required to include ghost.h.

However, any source or header file of GHOST itself should not include ghost.h. Instead, only the required headers should be included.

ghost_config.h has ot be included before ghost_types.h. In between those two includes it is possible to manipulate the settings from ghost_config.h. For example, when inside a CUDA .cu file, one might want to disable MPI by #undef GHOST_HAVE_MPI.

Updated