Added blitz

This commit is contained in:
Christian
2018-09-17 14:30:47 +02:00
parent f139994714
commit bd644ee60c
1271 changed files with 546295 additions and 98 deletions
+57 -16
View File
@@ -1,26 +1,67 @@
#ifndef PARAMETER_H
#define PARAMETER_H
//
// parameter.h
//
//
// Created by Christian Reiling on 13.09.18.
//
#include <vector>
#ifndef parameter_h
#define parameter_h
#include <iostream>
#include <fstream>
using namespace blitz;
using namespace std;
using namespace blitz;
class Parameter
{
public:
virtual ~Parameter(){};
virtual ~Parameter(){};
Parameter()
{
beschissenegrosseganzzahl = (int)value("beschissenegrosseganzzahl");
totalparticles = value("totalparticles");
dt = value("dt");
BFeld = value("BFeld");
configFilePath = "parameters.cat";
seed = (int)getVariable("seed");
totalParticles = (long int)getVariable("totalParticles");
dt = getVariable("dt");
magFieldSetValue = getVariable("magFieldSetValue");
}
double value(char *str, char* ext = "cat")
double getVariable(string varName) // Reads Parameter from config file
{
string varTemp;
double valueTemp;
ifstream configFile;
configFile.open (configFilePath);
if (!configFile)
{
cout<< configFilePath <<" not found " <<endl;
exit(1);
}
while (configFile >> varTemp >> valueTemp)
{
if (varName.compare(varTemp)==0)
{
configFile.close();
return(valueTemp);
}
configFile.ignore(numeric_limits<streamsize>::max(), '\n'); // jump to end of line
}
configFile.close();
std::cout<< varName << " not found." <<std::endl;
exit(1);
return(0);
}
/*
double value(char *str, char* ext = "cat") // Reads Parameter from config file
{
double temp;
char dummy[256];
@@ -66,14 +107,14 @@ public:
exit(1);
return 0;
}
*/
protected:
long int totalparticles;
string configFilePath;
int seed;
long int totalParticles;
double dt;
double BFeld;
double starttritiumdichte;
int beschissenegrosseganzzahl;
double magFieldSetValue;
};