Removed std:: and using namespace std
This commit is contained in:
@@ -21,7 +21,7 @@ void Simulation::doit() {
|
||||
particleQue.push_back(inject());
|
||||
numInjectedParticles++;
|
||||
if (numInjectedParticles%100 == 0){
|
||||
std::cout<<numInjectedParticles<<"/"<<numTotalParticles<<std::endl;
|
||||
cout<<numInjectedParticles<<"/"<<numTotalParticles<<endl;
|
||||
}
|
||||
}
|
||||
ScatT2 = Kat.getT2AverScatPart(particleQue.front().getLoc_m(), &rngUni);
|
||||
@@ -45,7 +45,7 @@ void Simulation::doit() {
|
||||
case 3: // Recombination
|
||||
break;
|
||||
default:
|
||||
std::cerr<<"getprocess() returned unknown event"<<std::endl;
|
||||
cerr<<"getprocess() returned unknown event"<<endl;
|
||||
break;
|
||||
}
|
||||
if (checkTermination (particleQue.front())) {
|
||||
@@ -80,7 +80,7 @@ Particle Simulation::inject() {
|
||||
Ekin_eV = getRandEnergyMaxwell(MBTemp_K,me_eV, &rngNormal);
|
||||
break;
|
||||
default:
|
||||
std::cerr<<"Invalid Injection Method./n";
|
||||
cerr<<"Invalid Injection Method./n";
|
||||
exit(1);
|
||||
break;
|
||||
}
|
||||
@@ -188,7 +188,7 @@ bool Simulation::checkTermination(Particle termPart) {
|
||||
EKin_eV = termPart.getKinEnergy_eV();
|
||||
ETemp_eV = 3./2.*kb_eVK*wgtsTemp_K;
|
||||
if (ETemp_eV<0) {
|
||||
std::cerr<<"Simulation::checkTermination: ETemp_eV < 0." <<std::endl;
|
||||
cerr<<"Simulation::checkTermination: ETemp_eV < 0." <<endl;
|
||||
exit(1);
|
||||
}
|
||||
|
||||
@@ -205,37 +205,37 @@ void Simulation::initLogger(void) {
|
||||
zLogValues.clear();
|
||||
logging = true;
|
||||
if (numberZBins < 1) {
|
||||
std::cout<<"Logging turned off."<<std::endl;
|
||||
cout<<"Logging turned off."<<endl;
|
||||
logging = false;
|
||||
return;
|
||||
} else if (numberZBins == 1) {
|
||||
std::cout<<"Logging 1 z-Value: "<<wgtsLength_m<<std::endl;
|
||||
cout<<"Logging 1 z-Value: "<<wgtsLength_m<<endl;
|
||||
zLogValues.push_back(wgtsLength_m);
|
||||
} else {
|
||||
for (int i = 0;i<numberZBins;i++) {
|
||||
zLogValues.push_back( i*wgtsLength_m/(numberZBins-1) );
|
||||
}
|
||||
std::cout<<"Logging "<<numberZBins<<" z-Values."<<std::endl;
|
||||
cout<<"Logging "<<numberZBins<<" z-Values."<<endl;
|
||||
}
|
||||
|
||||
std::string dirname = getDirName();
|
||||
outStream = new std::ofstream [numberZBins];
|
||||
string dirname = getDirName();
|
||||
outStream = new ofstream [numberZBins];
|
||||
|
||||
for (int i = 0; i < numberZBins; i++)
|
||||
{
|
||||
std::string fileName = dirname + "/z=" + std::to_string(zLogValues[i]) + ".dat";
|
||||
string fileName = dirname + "/z=" + to_string(zLogValues[i]) + ".dat";
|
||||
outStream[i].open(fileName);
|
||||
}
|
||||
}
|
||||
std::string Simulation::getDirName() {
|
||||
std::string poub = getenv("poub");
|
||||
std::string pname = getenv("pname");
|
||||
string Simulation::getDirName() {
|
||||
string poub = getenv("poub");
|
||||
string pname = getenv("pname");
|
||||
int i = 1;
|
||||
std::string dirname;
|
||||
string dirname;
|
||||
struct stat statbuf;
|
||||
int isDir;
|
||||
do {
|
||||
dirname = poub + "/" + pname + "_" + getTimeString() + "_" + std::to_string(i++);
|
||||
dirname = poub + "/" + pname + "_" + getTimeString() + "_" + to_string(i++);
|
||||
isDir = 0;
|
||||
if (stat(dirname.c_str(), &statbuf) != -1) {
|
||||
if (S_ISDIR(statbuf.st_mode)) {
|
||||
@@ -245,20 +245,20 @@ std::string Simulation::getDirName() {
|
||||
} while ( isDir == 1 );
|
||||
|
||||
if (mkdir(dirname.c_str(), S_IRWXU | S_IRWXG | S_IROTH | S_IXOTH) != 0) {
|
||||
std::cerr<<"Simulation::initLogger: Could not create folder "<<dirname.c_str()<<" for Logging."<<std::endl;
|
||||
cerr<<"Simulation::initLogger: Could not create folder "<<dirname.c_str()<<" for Logging."<<endl;
|
||||
exit(1);
|
||||
}
|
||||
return(dirname);
|
||||
}
|
||||
|
||||
std::string Simulation::getTimeString() {
|
||||
string Simulation::getTimeString() {
|
||||
time_t rawtime;
|
||||
struct tm * timeinfo;
|
||||
char buffer[80];
|
||||
time (&rawtime);
|
||||
timeinfo = localtime(&rawtime);
|
||||
strftime(buffer,sizeof(buffer),"%Y%m%d",timeinfo);
|
||||
std::string str(buffer);
|
||||
string str(buffer);
|
||||
return(str);
|
||||
}
|
||||
void Simulation::logParticle(Particle *logPart,blitz::TinyVector<double,3> oldLoc_m) {
|
||||
@@ -269,12 +269,12 @@ void Simulation::logParticle(Particle *logPart,blitz::TinyVector<double,3> oldLo
|
||||
|
||||
double zold = oldLoc_m[2];
|
||||
double znew = logPart->getLoc_m()[2];
|
||||
double zmin = std::min(zold,znew);
|
||||
double zmax = std::max(zold,znew);
|
||||
double zmin = min(zold,znew);
|
||||
double zmax = max(zold,znew);
|
||||
|
||||
for (int i=0;i<numberZBins;i++) {
|
||||
if (zLogValues[i]>=zmin && zLogValues[i]<=zmax) {
|
||||
outStream[i]<<*logPart<<std::endl; // Location wrong, because it s the new Location.
|
||||
outStream[i]<<*logPart<<endl; // Location wrong, because it s the new Location.
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user