cpp and h files added#
This commit is contained in:
+59
-60
@@ -11,70 +11,69 @@ class Parameter
|
||||
{
|
||||
public:
|
||||
|
||||
virtual ~Parameter(){};
|
||||
Parameter()
|
||||
{
|
||||
beschissenegrosseganzzahl = (int)value("beschissenegrosseganzzahl");
|
||||
|
||||
totalparticles = value("totalparticles");
|
||||
|
||||
dt = value("dt");
|
||||
|
||||
}
|
||||
|
||||
|
||||
double value(char *str, char* ext = "cat")
|
||||
{
|
||||
double temp;
|
||||
char dummy[256];
|
||||
char fname[256],*pname;
|
||||
FILE *fcat;
|
||||
|
||||
if (getenv("poub") == NULL)
|
||||
{
|
||||
fprintf(stderr,"Environment variable %s not defined.\n","poub");
|
||||
exit(1);
|
||||
}
|
||||
strcpy(fname, getenv("poub"));
|
||||
pname = getenv("pname");
|
||||
if (pname == NULL)
|
||||
{
|
||||
fprintf(stderr,"Environment variable %s not defined.\n","pname");
|
||||
exit(1);
|
||||
}
|
||||
if (!ext)
|
||||
{
|
||||
ext = "cat";
|
||||
}
|
||||
sprintf(fname,"%s/%s.%s",getenv("poub"),getenv("pname"), ext);
|
||||
if (!(fcat = fopen(fname, "r")))
|
||||
{
|
||||
fprintf(stderr,"value: cannot open file %s\n",fname);
|
||||
exit(1);
|
||||
}
|
||||
while (!feof(fcat))
|
||||
{
|
||||
// fscanf(fcat, "'%s%*[^']'%F%*[^']",dummy,&temp); 1
|
||||
fscanf(fcat, "%s = %lf", dummy, &temp);
|
||||
// if (strncmp(dummy, str,strlen(str)) == 0) {
|
||||
if (strcmp(dummy, str) == 0)
|
||||
virtual ~Parameter(){};
|
||||
Parameter()
|
||||
{
|
||||
fclose(fcat);
|
||||
return(temp);
|
||||
beschissenegrosseganzzahl = (int)value("beschissenegrosseganzzahl");
|
||||
totalparticles = value("totalparticles");
|
||||
dt = value("dt");
|
||||
BFeld = value("BFeld");
|
||||
}
|
||||
}
|
||||
fclose(fcat);
|
||||
fprintf(stderr,"variable %s not found\n",str);
|
||||
exit(1);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
|
||||
double value(char *str, char* ext = "cat")
|
||||
{
|
||||
double temp;
|
||||
char dummy[256];
|
||||
char fname[256],*pname;
|
||||
FILE *fcat;
|
||||
|
||||
if (getenv("poub") == NULL)
|
||||
{
|
||||
fprintf(stderr,"Environment variable %s not defined.\n","poub");
|
||||
exit(1);
|
||||
}
|
||||
strcpy(fname, getenv("poub"));
|
||||
pname = getenv("pname");
|
||||
if (pname == NULL)
|
||||
{
|
||||
fprintf(stderr,"Environment variable %s not defined.\n","pname");
|
||||
exit(1);
|
||||
}
|
||||
if (!ext)
|
||||
{
|
||||
ext = "cat";
|
||||
}
|
||||
sprintf(fname,"%s/%s.%s",getenv("poub"),getenv("pname"), ext);
|
||||
if (!(fcat = fopen(fname, "r")))
|
||||
{
|
||||
fprintf(stderr,"value: cannot open file %s\n",fname);
|
||||
exit(1);
|
||||
}
|
||||
while (!feof(fcat))
|
||||
{
|
||||
// fscanf(fcat, "'%s%*[^']'%F%*[^']",dummy,&temp); 1
|
||||
fscanf(fcat, "%s = %lf", dummy, &temp);
|
||||
// if (strncmp(dummy, str,strlen(str)) == 0) {
|
||||
if (strcmp(dummy, str) == 0)
|
||||
{
|
||||
fclose(fcat);
|
||||
return(temp);
|
||||
}
|
||||
}
|
||||
fclose(fcat);
|
||||
fprintf(stderr,"variable %s not found\n",str);
|
||||
|
||||
exit(1);
|
||||
return 0;
|
||||
}
|
||||
|
||||
protected:
|
||||
|
||||
long int totalparticles;
|
||||
double dt;
|
||||
long int totalparticles;
|
||||
double dt;
|
||||
double BFeld;
|
||||
double starttritiumdichte;
|
||||
int beschissenegrosseganzzahl;
|
||||
};
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user