12#include "gadgetconfig.h"
21#include "../data/allvars.h"
22#include "../data/dtypes.h"
23#include "../data/mymalloc.h"
25#include "../io/parameters.h"
26#include "../main/main.h"
27#include "../mpi_utils/shared_mem_handler.h"
28#include "../system/system.h"
36 Terminate(
"parameter '%s' too long", name);
70 if(
sizeof(
long long) != 8)
71 Terminate(
"\nType `long long' is not 64 bit on this platform. Stopping.\n\n");
74 Terminate(
"\nType `int' is not 32 bit on this platform. Stopping.\n\n");
76 if(
sizeof(
float) != 4)
77 Terminate(
"\nType `float' is not 32 bit on this platform. Stopping.\n\n");
79 if(
sizeof(
double) != 8)
80 Terminate(
"\nType `double' is not 64 bit on this platform. Stopping.\n\n");
84 if((fd = fopen(fname,
"r")))
86 sprintf(buf,
"%s%s", fname,
"-usedvalues");
87 if(!(fdout = fopen(buf,
"w")))
89 printf(
"error opening file '%s' \n", buf);
94 printf(
"Obtaining parameters from file '%s':\n\n", fname);
102 if(sscanf(buf,
"%s%s%s", buf1, buf2, buf3) < 2)
105 if(buf1[0] ==
'%' || buf1[0] ==
'#')
112 if(param_handled[i] == 0)
115 param_handled[i] = 1;
134 fprintf(stdout,
" ");
138 if(strcmp(buf2,
"OUTPUT_DIR") == 0)
140 if(getenv(
"OUTPUT_DIR"))
141 strcpy(buf2, getenv(
"OUTPUT_DIR"));
143 Terminate(
"no environment variable OUTPUT_DIR found");
147 fprintf(fdout, buf3, buf1, buf2);
148 fprintf(stdout,
" ");
149 fprintf(stdout, buf3, buf1, buf2);
155 fprintf(stdout,
" ");
162 fprintf(stdout,
"Error in file %s: Tag '%s' multiply defined.\n", fname, buf1);
167 fprintf(stdout,
"Error in file %s: Tag '%s' not allowed\n", fname, buf1);
178 printf(
"Parameter file %s not found.\n", fname);
184 if(param_handled[i] != 1)
186 printf(
"Error. I miss a value for tag '%s' in parameter file '%s'.\n",
ParametersTag[i], fname);
199 mkdir(dirname, 02755);
201 sprintf(buf,
"%s%s", dirname, fname);
202 FILE *fdout = fopen(buf,
"w");
char ParametersType[MAX_PARAMETERS]
char ParametersTag[MAX_PARAMETERS][MAXLEN_PARAM_TAG]
void add_param(const char *name, void *buf, int type, int flag)
int ParameterSequence[MAX_PARAMETERS]
void write_used_parameters(const char *dirname, const char *fname)
int read_parameter_file(const char *fname)
This function parses the parameter file.
void * ParametersValue[MAX_PARAMETERS]
char ParametersChangeable[MAX_PARAMETERS]
#define MAXLEN_PATH_EXTRA
#define MAXLEN_PARAM_VALUE