5#ifndef INTERP_METHOD_CONFIG_INTERNAL_H
6#define INTERP_METHOD_CONFIG_INTERNAL_H
39 int (*
compare)(
void const *a,
void const *b);
60 void *
buffer,
int buffer_size,
int *position, MPI_Comm comm);
90#define CHECK_BASIC(FIELD) \
91 if ((a->FIELD) != (b->FIELD)) \
92 return ((a->FIELD) > (b->FIELD)) - ((a->FIELD) < (b->FIELD))
94#define CHECK_INT CHECK_BASIC
95#define CHECK_SIZE_T CHECK_BASIC
96#define CHECK_DOUBLE CHECK_BASIC
97#define CHECK_ENUM CHECK_BASIC
99#define CHECK_ANGLE(FIELD) \
100 if (fabs((a->FIELD) - (b->FIELD)) > yac_angle_tol) \
101 return ((a->FIELD) > (b->FIELD)) - ((a->FIELD) < (b->FIELD))
103#define RETURN_ON_DIFFERENT(expr) \
104 do { int ret; if ((ret = (expr))) return ret; } while(0)
107#define CHECK_DOUBLE_NAN(FIELD) \
108 RETURN_ON_DIFFERENT(memcmp(&(a->FIELD), &(b->FIELD), sizeof(a->FIELD)))
110#define CHECK_STRUCT(PTR_FIELD, CMP_ROUTINE) \
111 RETURN_ON_DIFFERENT(CMP_ROUTINE(a->PTR_FIELD, b->PTR_FIELD))
113#define CHECK_NULL_POINTER(FIELD) \
114 RETURN_ON_DIFFERENT((a->FIELD == NULL) - (b->FIELD == NULL))
116#define CHECK_STRING(FIELD) \
118 CHECK_NULL_POINTER(FIELD); \
119 if (a->FIELD != NULL) RETURN_ON_DIFFERENT(strcmp(a->FIELD, b->FIELD)); \
122#define DEF_INTERP_METHOD_CONFIG_TYPE(TYPE) \
123 const struct yac_interp_method_config_ ## TYPE *config_ ## TYPE = \
124 (const struct yac_interp_method_config_ ## TYPE *)config;
126#define DEF_INTERP_METHOD_CONFIG_COMPARE_TYPE(TYPE) \
127 const struct yac_interp_method_config_ ## TYPE *a = \
128 (const struct yac_interp_method_config_ ## TYPE *)a_; \
129 const struct yac_interp_method_config_ ## TYPE *b = \
130 (const struct yac_interp_method_config_ ## TYPE *)b_;
void(* pack)(struct yac_interp_method_config const *config, void *buffer, int buffer_size, int *position, MPI_Comm comm)
int(* compare)(void const *a, void const *b)
enum yac_interpolation_list(* get_type)(void)
size_t(* get_pack_size)(struct yac_interp_method_config const *config, MPI_Comm comm)
struct yac_interp_method_config_vtable const * vtable
static struct yac_interp_method_config * config