OPAL (Object Oriented Parallel Accelerator Library) 2022.1
OPAL
ParticleMatterInteractionHandler.h
Go to the documentation of this file.
1//
2// Class ParticleMatterInteractionHandler
3// Defines the handler for particle-matter interactions in the elements
4//
5// Copyright (c) 200x - 2021, Paul Scherrer Institut, Villigen PSI, Switzerland
6// All rights reserved
7//
8// This file is part of OPAL.
9//
10// OPAL is free software: you can redistribute it and/or modify
11// it under the terms of the GNU General Public License as published by
12// the Free Software Foundation, either version 3 of the License, or
13// (at your option) any later version.
14//
15// You should have received a copy of the GNU General Public License
16// along with OPAL. If not, see <https://www.gnu.org/licenses/>.
17//
18#ifndef PARTICLEMATTERINTERACTIONHANDLER_HH
19#define PARTICLEMATTERINTERACTIONHANDLER_HH
20
22#include "Algorithms/Vektor.h"
23
24#include <string>
25
26class ElementBase;
27
28template <class T, unsigned Dim>
29class PartBunchBase;
30class Inform;
31
33 virtual ~InsideTester() {}
34
35 virtual bool checkHit(const Vector_t& R) = 0;
36};
37
39
40public:
43 virtual void apply(PartBunchBase<double, 3>* bunch,
44 const std::pair<Vector_t, double>& boundingSphere) = 0;
45 virtual const std::string getType() const = 0;
46 virtual void print(Inform& os) = 0;
47 virtual bool stillActive() = 0;
48 virtual double getTime() = 0;
49 virtual std::string getName() = 0;
50 virtual size_t getParticlesInMat() = 0;
51 virtual unsigned getRediffused() = 0;
52 virtual unsigned int getNumEntered() = 0;
53 void setFlagAllParticlesIn(bool p);
54 bool getFlagAllParticlesIn() const;
55 void updateElement(ElementBase* newref);
57
59 Vector_t& P,
60 const double deltat,
61 bool includeFluctuations = true) const = 0;
62
63protected:
65
67
68 const std::string name_m; // label of PARTICLEMATTERINTERACTION
69
70 std::unique_ptr<InsideTester> hitTester_m; // tests whether particles are inside material
71};
72
73inline
75 element_ref_m(elref),
76 allParticleInMat_m(false),
77 name_m(name)
78{}
79
80inline
82 element_ref_m = newref;
83}
84
85inline
87 return element_ref_m;
88}
89
90inline
93}
94
95inline
97 return allParticleInMat_m;
98}
99#endif // PARTICLEMATTERINTERACTION_HH
const std::string name
virtual bool checkHit(const Vector_t &R)=0
virtual size_t getParticlesInMat()=0
virtual unsigned getRediffused()=0
virtual void print(Inform &os)=0
virtual unsigned int getNumEntered()=0
std::unique_ptr< InsideTester > hitTester_m
ParticleMatterInteractionHandler(std::string name, ElementBase *elref)
virtual bool computeEnergyLoss(PartBunchBase< double, 3 > *bunch, Vector_t &P, const double deltat, bool includeFluctuations=true) const =0
virtual std::string getName()=0
bool allParticleInMat_m
if all particles are in matter stay inside the particle matter interaction
virtual const std::string getType() const =0
virtual void apply(PartBunchBase< double, 3 > *bunch, const std::pair< Vector_t, double > &boundingSphere)=0
Definition: Inform.h:42