Skip to content
Snippets Groups Projects
Commit aeb19b59 authored by James Willis's avatar James Willis
Browse files

Added a parameter of type double to testParser.

parent d324392c
No related branches found
No related tags found
1 merge request!129Parameter file
...@@ -33,6 +33,7 @@ int main(int argc, char *argv[]) { ...@@ -33,6 +33,7 @@ int main(int argc, char *argv[]) {
int no_of_threads = 0; int no_of_threads = 0;
int no_of_time_steps = 0; int no_of_time_steps = 0;
float max_h = 0.0f; float max_h = 0.0f;
double start_time = 0.0;
char ic_file [PARSER_MAX_LINE_SIZE]; char ic_file [PARSER_MAX_LINE_SIZE];
/* Read the parameter file. */ /* Read the parameter file. */
...@@ -47,14 +48,16 @@ int main(int argc, char *argv[]) { ...@@ -47,14 +48,16 @@ int main(int argc, char *argv[]) {
parser_get_param_int(&param_file,"no_of_threads",&no_of_threads); parser_get_param_int(&param_file,"no_of_threads",&no_of_threads);
parser_get_param_int(&param_file,"no_of_time_steps",&no_of_time_steps); parser_get_param_int(&param_file,"no_of_time_steps",&no_of_time_steps);
parser_get_param_float(&param_file,"max_h",&max_h); parser_get_param_float(&param_file,"max_h",&max_h);
parser_get_param_double(&param_file,"start_time",&start_time);
parser_get_param_string(&param_file,"ic_file",ic_file); parser_get_param_string(&param_file,"ic_file",ic_file);
/* Print the variables to check their values are correct. */ /* Print the variables to check their values are correct. */
printf("no_of_threads: %d, no_of_time_steps: %d, max_h: %f, ic_file: %s\n",no_of_threads, no_of_time_steps, max_h, ic_file); printf("no_of_threads: %d, no_of_time_steps: %d, max_h: %f, start_time: %lf, ic_file: %s\n",no_of_threads, no_of_time_steps, max_h, start_time, ic_file);
assert(no_of_threads == 16); assert(no_of_threads == 16);
assert(no_of_time_steps == 10); assert(no_of_time_steps == 10);
assert(fabs(max_h - 1.1255) < 0.00001); assert(fabs(max_h - 1.1255) < 0.00001);
assert(fabs(start_time - 1.23456789) < 0.00001);
assert(strcmp(ic_file,"ic_file.ini") == 0); /*strcmp returns 0 if correct.*/ assert(strcmp(ic_file,"ic_file.ini") == 0); /*strcmp returns 0 if correct.*/
return 0; return 0;
......
--- ---
no_of_threads: 16 # The number of threads that will be used. no_of_threads: 16 # The number of threads that will be used.
no_of_time_steps: 10 no_of_time_steps: 10
max_h: 1.1255 max_h: 1.1255
start_time: 1.23456789
#Input file #Input file
ic_file: ic_file.ini ic_file: ic_file.ini
... ...
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment