YetAnotherCoupler 2.4.3
Macros | Typedefs | Functions
utils.h File Reference

Utlity functions. More...

#include <stdlib.h>
#include "core/ppm_xfuncs.h"
#include "core/core.h"
Include dependency graph for utils.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Macros

#define YAC_ASSERT(exp, msg)    {if(!((exp))) yac_internal_abort_message(((msg)), __FILE__, __LINE__);}
 
#define YAC_ASSERT_F(exp, format, ...)
 
#define YAC_ABORT(msg)    {yac_abort_message(((msg)), __FILE__, __LINE__);}
 
#define MAX(a, b)   ((a) > (b) ? (a) : (b))
 
#define MIN(a, b)   ((a) < (b) ? (a) : (b))
 
#define ASSERT(c)
 

Typedefs

typedef double(* coordinate_pointer)[3]
 
typedef double const (*const const_coordinate_pointer)[3]
 

Functions

void yac_internal_abort_message (const char *text, const char *file, int line)
 
int yac_file_exists (const char *filename)
 
void yac_abort_message (char *text, char *file, int line)
 
void yac_quicksort_index (int *a, size_t n, int *idx)
 
void yac_quicksort_index_yac_int_size_t (yac_int *a, size_t n, size_t *idx)
 
void yac_quicksort_index_yac_int_yac_int (yac_int *a, size_t n, yac_int *idx)
 
void yac_quicksort_index_size_t_yac_int (size_t *a, size_t n, yac_int *idx)
 
void yac_quicksort_index_yac_int_uint64_t (yac_int *a, size_t n, uint64_t *idx)
 
void yac_quicksort_index_yac_int_int (yac_int *a, size_t n, int *idx)
 
void yac_quicksort_index_size_t_size_t (size_t *a, size_t n, size_t *idx)
 
void yac_quicksort_index_uint64_t_size_t (uint64_t *a, size_t n, size_t *idx)
 
void yac_quicksort_index_int_size_t (int *a, size_t n, size_t *idx)
 
void yac_quicksort_index_size_t_int (size_t *a, size_t n, int *idx)
 
void yac_quicksort_index_size_t_void_p (size_t *a, size_t n, void **idx)
 
void yac_quicksort_index_int_yac_int (int *a, size_t n, yac_int *idx)
 
void yac_quicksort_index_int_double (int *a, size_t n, double *idx)
 
void yac_quicksort_index_size_t_size_t_double (size_t *a, size_t n, size_t *b, double *c)
 
void yac_quicksort_index_yac_int_yac_int_size_t (yac_int *a, size_t n, yac_int *b, size_t *c)
 
void yac_quicksort_index_int_size_t_size_t (int *a, size_t n, size_t *b, size_t *c)
 
void yac_quicksort_index_int_size_t_yac_int (int *a, size_t n, size_t *b, yac_int *c)
 
void yac_mergesort (void *base, size_t num, size_t size, int(*compar)(const void *, const void *))
 
static void yac_remove_duplicates_int (int *array, unsigned *n)
 
static void yac_remove_duplicates_uint (unsigned *array, size_t *n)
 
static void yac_remove_duplicates_double (double *array, size_t *n)
 
static void yac_remove_duplicates_size_t (size_t *array, size_t *n)
 
static void yac_remove_duplicates_size_t_2 (size_t(*array)[2], size_t *n)
 
static void yac_remove_duplicates_size_t_3 (size_t(*array)[3], size_t *n)
 

Detailed Description

Utlity functions.

Small general utility functions:

Version
1.0
Author
Moritz Hanke hanke.nosp@m.@dkr.nosp@m.z.de Rene Redler rene..nosp@m.redl.nosp@m.er@mp.nosp@m.imet.nosp@m..mpg..nosp@m.de

Definition in file utils.h.

Macro Definition Documentation

◆ ASSERT

#define ASSERT (   c)
Value:
if (!(c)) {\
fprintf(stderr, "### Assertion violation: %s in %s:%d\n",\
#c, __FILE__, __LINE__);\
abort ();\
}

Definition at line 323 of file utils.h.

◆ MAX

#define MAX (   a,
 
)    ((a) > (b) ? (a) : (b))
Examples
test_area.c, test_interp_weights_parallel.c, and test_partial_areas.c.

Definition at line 319 of file utils.h.

◆ MIN

#define MIN (   a,
 
)    ((a) < (b) ? (a) : (b))

◆ YAC_ABORT

#define YAC_ABORT (   msg)     {yac_abort_message(((msg)), __FILE__, __LINE__);}

Definition at line 93 of file utils.h.

◆ YAC_ASSERT

#define YAC_ASSERT (   exp,
  msg 
)     {if(!((exp))) yac_internal_abort_message(((msg)), __FILE__, __LINE__);}

Definition at line 63 of file utils.h.

◆ YAC_ASSERT_F

#define YAC_ASSERT_F (   exp,
  format,
  ... 
)
Value:
{ \
if(!((exp))) { \
char msg_buffer[1024]; \
int ret = snprintf( \
msg_buffer, sizeof(msg_buffer), ((format)), __VA_ARGS__); \
if ((ret >= 0) && ((size_t)ret < sizeof(msg_buffer))) \
yac_internal_abort_message(((msg_buffer)), __FILE__, __LINE__); \
"an error occured, but error message could not be generated", \
__FILE__, __LINE__); \
} \
}
void yac_internal_abort_message(const char *text, const char *file, int line)
Definition: utils.c:54

Definition at line 66 of file utils.h.

Typedef Documentation

◆ const_coordinate_pointer

typedef double const(* const const_coordinate_pointer)[3]

Definition at line 61 of file utils.h.

◆ coordinate_pointer

typedef double(* coordinate_pointer)[3]

Function Documentation

◆ yac_abort_message()

void yac_abort_message ( char *  text,
char *  file,
int  line 
)

prints a short error message and info from where it was called followed by an exit.

Definition at line 62 of file utils.c.

Here is the call graph for this function:

◆ yac_file_exists()

int yac_file_exists ( const char *  filename)

Definition at line 66 of file utils.c.

Here is the caller graph for this function:

◆ yac_internal_abort_message()

void yac_internal_abort_message ( const char *  text,
const char *  file,
int  line 
)

prints a short error message and info from where it was called followed by an exit.

Definition at line 54 of file utils.c.

Here is the caller graph for this function:

◆ yac_mergesort()

void yac_mergesort ( void *  base,
size_t  num,
size_t  size,
int(*)(const void *, const void *)  compar 
)

Natural Merge sort

Definition at line 173 of file mergesort.c.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ yac_quicksort_index()

void yac_quicksort_index ( int *  a,
size_t  n,
int *  idx 
)
Examples
test_quicksort.c.
Here is the caller graph for this function:

◆ yac_quicksort_index_int_double()

void yac_quicksort_index_int_double ( int *  a,
size_t  n,
double *  idx 
)
Here is the caller graph for this function:

◆ yac_quicksort_index_int_size_t()

void yac_quicksort_index_int_size_t ( int *  a,
size_t  n,
size_t *  idx 
)
Here is the caller graph for this function:

◆ yac_quicksort_index_int_size_t_size_t()

void yac_quicksort_index_int_size_t_size_t ( int *  a,
size_t  n,
size_t *  b,
size_t *  c 
)
Here is the caller graph for this function:

◆ yac_quicksort_index_int_size_t_yac_int()

void yac_quicksort_index_int_size_t_yac_int ( int *  a,
size_t  n,
size_t *  b,
yac_int c 
)
Here is the caller graph for this function:

◆ yac_quicksort_index_int_yac_int()

void yac_quicksort_index_int_yac_int ( int *  a,
size_t  n,
yac_int idx 
)
Here is the caller graph for this function:

◆ yac_quicksort_index_size_t_int()

void yac_quicksort_index_size_t_int ( size_t *  a,
size_t  n,
int *  idx 
)
Here is the caller graph for this function:

◆ yac_quicksort_index_size_t_size_t()

void yac_quicksort_index_size_t_size_t ( size_t *  a,
size_t  n,
size_t *  idx 
)
Here is the caller graph for this function:

◆ yac_quicksort_index_size_t_size_t_double()

void yac_quicksort_index_size_t_size_t_double ( size_t *  a,
size_t  n,
size_t *  b,
double *  c 
)
Here is the caller graph for this function:

◆ yac_quicksort_index_size_t_void_p()

void yac_quicksort_index_size_t_void_p ( size_t *  a,
size_t  n,
void **  idx 
)

◆ yac_quicksort_index_size_t_yac_int()

void yac_quicksort_index_size_t_yac_int ( size_t *  a,
size_t  n,
yac_int idx 
)
Here is the caller graph for this function:

◆ yac_quicksort_index_uint64_t_size_t()

void yac_quicksort_index_uint64_t_size_t ( uint64_t *  a,
size_t  n,
size_t *  idx 
)

◆ yac_quicksort_index_yac_int_int()

void yac_quicksort_index_yac_int_int ( yac_int a,
size_t  n,
int *  idx 
)

◆ yac_quicksort_index_yac_int_size_t()

void yac_quicksort_index_yac_int_size_t ( yac_int a,
size_t  n,
size_t *  idx 
)
Here is the caller graph for this function:

◆ yac_quicksort_index_yac_int_uint64_t()

void yac_quicksort_index_yac_int_uint64_t ( yac_int a,
size_t  n,
uint64_t *  idx 
)

◆ yac_quicksort_index_yac_int_yac_int()

void yac_quicksort_index_yac_int_yac_int ( yac_int a,
size_t  n,
yac_int idx 
)
Here is the caller graph for this function:

◆ yac_quicksort_index_yac_int_yac_int_size_t()

void yac_quicksort_index_yac_int_yac_int_size_t ( yac_int a,
size_t  n,
yac_int b,
size_t *  c 
)
Here is the caller graph for this function:

◆ yac_remove_duplicates_double()

static void yac_remove_duplicates_double ( double *  array,
size_t *  n 
)
inlinestatic

remove duplicated entries from a list of integers

Parameters
[in,out]arrayarray containing a sorted (ascending) list of integers
[in,out]nnumber of entries in array

Definition at line 194 of file utils.h.

Here is the caller graph for this function:

◆ yac_remove_duplicates_int()

static void yac_remove_duplicates_int ( int *  array,
unsigned *  n 
)
inlinestatic

remove duplicated entries from a list of integers

Parameters
[in,out]arrayarray containing a sorted (ascending) list of integers
[in,out]nnumber of entries in array

Definition at line 140 of file utils.h.

Here is the caller graph for this function:

◆ yac_remove_duplicates_size_t()

static void yac_remove_duplicates_size_t ( size_t *  array,
size_t *  n 
)
inlinestatic

remove duplicated entries from a list of integers

Parameters
[in,out]arrayarray containing a sorted (ascending) list of integers
[in,out]nnumber of entries in array

Definition at line 221 of file utils.h.

Here is the caller graph for this function:

◆ yac_remove_duplicates_size_t_2()

static void yac_remove_duplicates_size_t_2 ( size_t(*)  array[2],
size_t *  n 
)
inlinestatic

remove duplicated entries from a list of integers

Parameters
[in,out]arrayarray containing a sorted (ascending) list of integers
[in,out]nnumber of entries in array

Definition at line 248 of file utils.h.

Here is the caller graph for this function:

◆ yac_remove_duplicates_size_t_3()

static void yac_remove_duplicates_size_t_3 ( size_t(*)  array[3],
size_t *  n 
)
inlinestatic

remove duplicated entries from a list of integers

Parameters
[in,out]arrayarray containing a sorted (ascending) list of integers
[in,out]nnumber of entries in array

Definition at line 282 of file utils.h.

Here is the caller graph for this function:

◆ yac_remove_duplicates_uint()

static void yac_remove_duplicates_uint ( unsigned *  array,
size_t *  n 
)
inlinestatic

remove duplicated entries from a list of integers

Parameters
[in,out]arrayarray containing a sorted (ascending) list of integers
[in,out]nnumber of entries in array

Definition at line 167 of file utils.h.