NUM_INT_PARAM_TYPES is now NUM_INT_PARAMS etc, replaced these throughout the project

This commit is contained in:
jpekkila
2019-07-22 19:53:45 +03:00
parent 074eae0bae
commit 85883dbc38
2 changed files with 8 additions and 8 deletions

View File

@@ -273,20 +273,20 @@ typedef enum {
*/ */
typedef enum { typedef enum {
AC_FOR_INT_PARAM_TYPES(AC_GEN_ID), AC_FOR_INT_PARAM_TYPES(AC_GEN_ID),
NUM_INT_PARAM_TYPES NUM_INT_PARAMS
} AcIntParam; } AcIntParam;
typedef enum { typedef enum {
AC_FOR_REAL_PARAM_TYPES(AC_GEN_ID), AC_FOR_REAL_PARAM_TYPES(AC_GEN_ID),
NUM_REAL_PARAM_TYPES NUM_REAL_PARAMS
} AcRealParam; } AcRealParam;
extern const char* intparam_names[]; // Defined in astaroth.cu extern const char* intparam_names[]; // Defined in astaroth.cu
extern const char* realparam_names[]; // Defined in astaroth.cu extern const char* realparam_names[]; // Defined in astaroth.cu
typedef struct { typedef struct {
int int_params[NUM_INT_PARAM_TYPES]; int int_params[NUM_INT_PARAMS];
AcReal real_params[NUM_REAL_PARAM_TYPES]; AcReal real_params[NUM_REAL_PARAMS];
} AcMeshInfo; } AcMeshInfo;
/* /*

View File

@@ -37,9 +37,9 @@
static inline void static inline void
print(const AcMeshInfo& config) print(const AcMeshInfo& config)
{ {
for (int i = 0; i < NUM_INT_PARAM_TYPES; ++i) for (int i = 0; i < NUM_INT_PARAMS; ++i)
printf("[%s]: %d\n", intparam_names[i], config.int_params[i]); printf("[%s]: %d\n", intparam_names[i], config.int_params[i]);
for (int i = 0; i < NUM_REAL_PARAM_TYPES; ++i) for (int i = 0; i < NUM_REAL_PARAMS; ++i)
printf("[%s]: %g\n", realparam_names[i], double(config.real_params[i])); printf("[%s]: %g\n", realparam_names[i], double(config.real_params[i]));
} }
@@ -77,9 +77,9 @@ parse_config(const char* path, AcMeshInfo* config)
continue; continue;
int idx = -1; int idx = -1;
if ((idx = find_str(keyword, intparam_names, NUM_INT_PARAM_TYPES)) >= 0) if ((idx = find_str(keyword, intparam_names, NUM_INT_PARAMS)) >= 0)
config->int_params[idx] = atoi(value); config->int_params[idx] = atoi(value);
else if ((idx = find_str(keyword, realparam_names, NUM_REAL_PARAM_TYPES)) >= 0) else if ((idx = find_str(keyword, realparam_names, NUM_REAL_PARAMS)) >= 0)
config->real_params[idx] = AcReal(atof(value)); config->real_params[idx] = AcReal(atof(value));
} }