Added VERBOSE CMake option and made various prints optional to clean the output. VERBOSE is by off by default, pass cmake -DVERBOSE=ON to re-enable various non-critical warning and status prints (important warnings are still visible regardless of the flag).

This commit is contained in:
jpekkila
2020-08-21 21:19:42 +03:00
parent 9f676a6d5d
commit d966afe830
11 changed files with 55 additions and 17 deletions

View File

@@ -52,7 +52,7 @@ parse_config(const char* path, AcMeshInfo* config)
FILE* fp;
fp = fopen(path, "r");
// For knowing which .conf file will be used
printf("Config file path: \n %s \n ", path);
printf("Config file path: %s\n", path);
ERRCHK_ALWAYS(fp != NULL);
const size_t BUF_SIZE = 128;
@@ -90,7 +90,7 @@ acLoadConfig(const char* config_path, AcMeshInfo* config)
parse_config(config_path, config);
acUpdateBuiltinParams(config);
#if VERBOSE_PRINTING // Defined in astaroth.h
#if AC_VERBOSE
printf("###############################################################\n");
printf("Config dimensions loaded:\n");
acPrintMeshInfo(*config);
@@ -101,8 +101,10 @@ acLoadConfig(const char* config_path, AcMeshInfo* config)
ERRCHK_ALWAYS(sizeof(*config) % sizeof(uint32_t) == 0);
for (size_t i = 0; i < sizeof(*config) / sizeof(uint32_t); ++i) {
if (((uint32_t*)config)[i] == (uint32_t)0xFFFFFFFF) {
#if AC_VERBOSE
fprintf(stderr, "Some config values may be uninitialized. "
"See that all are defined in astaroth.conf\n");
#endif
retval = AC_FAILURE;
}
}

View File

@@ -949,6 +949,7 @@ solve_beta_step(const AcMesh in, const int step_number, const Scalar dt, const i
static void
checkConfiguration(const AcMeshInfo info)
{
#if AC_VERBOSE
for (int i = 0; i < NUM_REAL_PARAMS; ++i) {
if (!is_valid(info.real_params[i])) {
fprintf(stderr, "WARNING: Passed an invalid value %g to model solver (%s). Skipping.\n",
@@ -973,6 +974,7 @@ checkConfiguration(const AcMeshInfo info)
(double)info.real3_params[i].z, realparam_names[i]);
}
}
#endif
ERRCHK_ALWAYS(is_valid(info.real_params[AC_inv_dsx]));
ERRCHK_ALWAYS(is_valid(info.real_params[AC_inv_dsy]));

View File

@@ -149,6 +149,7 @@ AcResult
acVerifyMesh(const char* label, const AcMesh model, const AcMesh candidate)
{
printf("---Test: %s---\n", label);
fflush(stdout);
printf("Errors at the point of the maximum absolute error:\n");
int errors_found = 0;