Major changes:
- Added individul operators for species and better selecting process. - Switched to C arrays for main loop operations and calculating array indizes using knowledge of binning instead of doing sorted search - Added Recombination - Reworked elastic scattering kinematics - Added inelastic scattering kinematics
This commit is contained in:
@@ -0,0 +1,64 @@
|
||||
//
|
||||
// manager_base.h
|
||||
// mc_electron
|
||||
//
|
||||
// Created by Christian Reiling on 17.05.19.
|
||||
// Copyright © 2019 Christian Reiling. All rights reserved.
|
||||
//
|
||||
|
||||
#ifndef manager_base_h
|
||||
#define manager_base_h
|
||||
|
||||
#include <vector>
|
||||
#include <sstream>
|
||||
|
||||
#include "particle.hpp"
|
||||
|
||||
|
||||
template <class T>
|
||||
class Manager_Base {
|
||||
private:
|
||||
std::vector<T*> Processes;
|
||||
|
||||
public:
|
||||
Manager_Base() {};
|
||||
|
||||
void add(T* addProc);
|
||||
bool exists(species this_species);
|
||||
T* find(species this_species);
|
||||
};
|
||||
|
||||
template <class T>
|
||||
inline void Manager_Base<T>::add(T* add) {
|
||||
if (exists(add->get_species())) {
|
||||
std::stringstream ss;
|
||||
ss<<"Manager_Base::add_Process: Dublicate Insert of Process for this Species.";
|
||||
throw MyException (ss.str());
|
||||
}
|
||||
Processes.push_back(add);
|
||||
}
|
||||
|
||||
template <class T>
|
||||
inline bool Manager_Base<T>::exists(species this_species) {
|
||||
for (typename std::vector<T*>::iterator Itr = Processes.begin(); Itr!=Processes.end(); Itr++) {
|
||||
if ((*Itr)->get_species() == this_species) {
|
||||
return (true);
|
||||
}
|
||||
}
|
||||
return (false);
|
||||
}
|
||||
|
||||
template <class T>
|
||||
inline T* Manager_Base<T>::find(species this_species) {
|
||||
for (typename std::vector<T*>::iterator Itr = Processes.begin(); Itr!=Processes.end(); Itr++) {
|
||||
if ((*Itr)->get_species() == this_species) {
|
||||
return (*Itr);
|
||||
}
|
||||
}
|
||||
std::stringstream ss;
|
||||
ss<<"Manager_Base::find(): No Process for this_species implemented.\n";
|
||||
throw MyException(ss.str());
|
||||
}
|
||||
|
||||
|
||||
#endif /* manager_base_h */
|
||||
Reference in New Issue
Block a user