Added myexeption to throw errors and show using MyExeption class.
This commit is contained in:
@@ -9,6 +9,7 @@
|
||||
|
||||
#include "simulation.hpp"
|
||||
|
||||
#include "myexeption.h"
|
||||
|
||||
using namespace std;
|
||||
|
||||
@@ -52,7 +53,7 @@ void Simulation::doTC6() {
|
||||
blitz::TinyVector <double,3> loc_m;
|
||||
while ( (numberElectrons < numTotalElectrons) || (electronQue.size() > 0) ) {
|
||||
if (!electronQue.empty()) {
|
||||
throw ("Simulation::doTC6: electronQue should be empty");
|
||||
throw MyException("Simulation::doTC6: electronQue should be empty");
|
||||
}
|
||||
|
||||
electronQue.push_back(Kat.injectElectron(numberElectrons, &rngUni, &rngNormal));
|
||||
@@ -69,7 +70,7 @@ void Simulation::doTC6() {
|
||||
} else {
|
||||
stringstream ss;
|
||||
ss<<"Simulation::doTC6(): propagationMethod= "<<propagationMethod<<" not valid.";
|
||||
throw (ss.str());
|
||||
throw MyException(ss.str());
|
||||
}
|
||||
|
||||
|
||||
@@ -78,7 +79,7 @@ void Simulation::doTC6() {
|
||||
case 0: //Moved Outside
|
||||
break;
|
||||
case 1: // Elastic Scattering
|
||||
throw ("Simulation::doTC6(): Elastic Scattering should be turned off.");
|
||||
throw MyException("Simulation::doTC6(): Elastic Scattering should be turned off.");
|
||||
break;
|
||||
case 2: // Ionization
|
||||
electronQue.push_back( electronQue.front().do_Ionization(Kat.getTotSpeedT2_ms(loc_m, &rngUni, &rngNormal), numberElectrons, &rngUni) );
|
||||
@@ -86,7 +87,7 @@ void Simulation::doTC6() {
|
||||
electronQue.pop_front();
|
||||
break;
|
||||
default:
|
||||
throw ("Simulation::doit(): getprocess() returned unknown event");
|
||||
throw MyException("Simulation::doit(): getprocess() returned unknown event");
|
||||
break;
|
||||
}
|
||||
|
||||
@@ -115,7 +116,7 @@ void Simulation::move_electron(Electron *moveElectron) {
|
||||
} else {
|
||||
stringstream ss;
|
||||
ss<<"Simulation::doit(): propagationMethod= "<<propagationMethod<<" not valid.";
|
||||
throw (ss.str());
|
||||
throw MyException(ss.str());
|
||||
}
|
||||
}
|
||||
|
||||
@@ -135,7 +136,7 @@ void Simulation::do_interaction(Electron *interactElectron) {
|
||||
case 3: // Recombination
|
||||
break;
|
||||
default:
|
||||
throw ("Simulation::doit(): getprocess() returned unknown event");
|
||||
throw MyException("Simulation::doit(): getprocess() returned unknown event");
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user