input.h

Go to the documentation of this file.
00001 
00008 #ifndef _INPUT_H
00009 #define _INPUT_H
00010 
00011 #include <iostream>
00012 #include <string>
00013 #include <cstring>
00014 
00015 #include "constants.h"
00016 
00017 using namespace std;
00018 
00025 class Input {
00026  public:
00027   Input() { } 
00028   Input(char** argv, int argc) :
00029     Ekfact(atof(argv[2])),
00030     numr((atoi(argv[3])%2 == 1) ? atoi(argv[3]): atoi(argv[3])+1),
00031     numz((atoi(argv[4])%2 == 1) ? atoi(argv[4]): atoi(argv[4])+1),
00032     D0(atof(argv[5])*1.e28/kpc/kpc*Myr),
00033     zt(atof(argv[6])),
00034     zmax(atof(argv[7])),
00035     delta(atof(argv[8])),
00036     index_radial(atof(argv[9])),
00037 #ifdef HAVE_DS
00038       mx(atof(argv[10])),
00039       taudec(atof(argv[11])),
00040 #else
00041     ab_C(atof(argv[10])),
00042     ab_N(atof(argv[11])),
00043 #endif
00044 #ifdef REAC
00045     vAlfven(atof(argv[12])*km*Myr/kpc),
00046 #endif
00047     v0(atof(argv[13])*km*Myr/kpc),
00048     dvdz(atof(argv[14])*km*Myr/kpc),
00049     etaT(atof(argv[15])),
00050 #ifdef HAVE_DS
00051     sigmav(atof(argv[16])),
00052     dmmode(atoi(argv[17])),
00053     dmprof(DMprofile(atoi(argv[18]))),
00054 #endif
00055     filename(argv[1])
00056       { 
00057 
00058         if (!strcmp(argv[argc-1], "const")) set_profile = Constant;
00059         else if (!strcmp(argv[argc-1], "exp")) set_profile = Exp;
00060         else if (!strcmp(argv[argc-1], "expr")) set_profile = Expr;
00061         else if (!strcmp(argv[argc-1], "radial")) set_profile = Radial;
00062         else if (!strcmp(argv[argc-1], "exp_radial")) set_profile = ExpRadial;
00063         else {
00064           cerr << "What DPerpType did you choose?" << endl;
00065           exit(-2);
00066         }
00067       }
00070   Input(char* run, double& Ekfact_, int& Nr, int& Nz, double& D0_, double& zt_, double& zmax_, double& delta_, double& index_radial_, double& ab_C_, double& ab_N_, double& vA_, double& vC_, double& dvdz_conv_, double etaT_, char* profile) :
00071     Ekfact(Ekfact_),
00072     numr((Nr%2 == 1) ? Nr: Nr+1),
00073     numz((Nz%2 == 1) ? Nz: Nz+1),
00074     D0(D0_*1.e28/kpc/kpc*Myr),
00075     zt(zt_),
00076     zmax(zmax_),
00077     delta(delta_),
00078     index_radial(index_radial_),
00079 #ifndef HAVE_DS
00080     ab_C(ab_C_),
00081     ab_N(ab_N_),
00082 #endif
00083 #ifdef REAC
00084     vAlfven(vA_*km*Myr/kpc),
00085 #endif
00086     v0(vC_*km*Myr/kpc),
00087     dvdz(dvdz_conv_*km*Myr/kpc),
00088     etaT(etaT_),
00089     filename(run)
00090       { 
00091 
00092         int ipos = filename.find(' ');
00093         if (ipos < string::npos) filename.erase(ipos);
00094 
00095         if (!strcmp(profile, "const")) set_profile = Constant;
00096         else if (!strcmp(profile, "exp")) set_profile = Exp;
00097         else if (!strcmp(profile, "expr")) set_profile = Expr;
00098         else if (!strcmp(profile, "radial")) set_profile = Radial;
00099         else if (!strcmp(profile, "exp_radial")) set_profile = ExpRadial;
00100         else {
00101           cerr << "What DPerpType did you choose?" << endl;
00102           exit(-2);
00103         }
00104       }
00107     virtual ~Input() { }
00110     double Ekfact; 
00111     int numr; 
00112     int numz; 
00113     double D0; 
00114     double zt; 
00115     double zmax; 
00116     double delta; 
00117     double index_radial; 
00118     double vAlfven; 
00119     double ab_C; 
00120     double ab_N; 
00121     double v0; 
00122     double dvdz; 
00123     double etaT; 
00124     DPerpType set_profile; 
00125     string filename; 
00126     double mx; 
00127     double taudec; 
00128     double sigmav; 
00129     int dmmode; 
00147     DMprofile dmprof; 
00157 };
00158 
00159 #endif
 All Classes Namespaces Files Functions Variables Enumerations Enumerator
Generated on Mon Sep 27 12:59:56 2010 for DRAGON by  doxygen 1.6.3