1 #ifndef PART_BUNCH_BASE_H
2 #define PART_BUNCH_BASE_H
25 template <
class T,
int,
int>
class FMatrix;
28 template <
class T,
unsigned Dim>
81 std::vector<Distribution *> addedDistributions,
138 void calcLineDensity(
unsigned int nBins, std::vector<double> &lineDensity,
139 std::pair<double, double> &meshInfo);
161 virtual double getPx(
int i);
162 virtual double getPy(
int i);
163 virtual double getPz(
int i);
165 virtual double getPx0(
int i);
166 virtual double getPy0(
int i);
168 virtual double getX(
int i);
169 virtual double getY(
int i);
170 virtual double getZ(
int i);
172 virtual double getX0(
int i);
173 virtual double getY0(
int i);
175 virtual void setZ(
int i,
double zcoo);
203 double &axmax,
double &aymax);
206 double getdT()
const;
382 virtual double getRho(
int x,
int y,
int z) = 0;
392 virtual void swap(
unsigned int i,
unsigned int j);
433 return pbase->getBConds();
437 pbase->setBConds(bc);
451 void destroy(
size_t M,
size_t I,
bool doNow =
false);
685 std::shared_ptr<AbstractParticle<T, Dim> >
pbase;
virtual void swap(unsigned int i, unsigned int j)
double getWorkFunctionRf() const
Need the work function for the Schottky effect calculation (eV)
double dt_m
holds the timestep in seconds
Vector_t get_rprms() const
Vector_t rmin_m
minimal extend of particles
double tEmission_m
in % how much the mesh is enlarged
virtual double getPy0(int i)
ParticleAttrib< Vector_t > P
IpplTimings::TimerRef selfFieldTimer_m
timer for selfField calculation
void switchOffUnitlessPositions(bool use_dt_per_particle=false)
std::vector< size_t > bunchLocalNum_m
std::vector< size_t > bunchTotalNum_m
number of particles per bunch
void setQKs3D(Quaternion_t q)
double spos_m
the position along design trajectory
void getLocalBounds(Vector_t &rmin, Vector_t &rmax)
void setKs3DRefp(Vector_t p)
IpplTimings::TimerRef distrCreate_m
int getLastEmittedEnergyBin()
void destroy(size_t M, size_t I, bool doNow=false)
ParticleAttrib< Vector_t > Ef
ParticleAttrib< Vector_t > Eftmp
void setMinimumNumberOfParticlesPerCore(unsigned int n)
double calcMeanPhi()
calculate average angle of longitudinal direction of bins
std::string getFieldSolverType() const
Return the fieldsolver type if we have a fieldsolver.
void setPType(ParticleType::type)
A templated representation for matrices.
long long getLocalTrackStep() const
ParticleType::type getPType() const
void gatherLoadBalanceStatistics()
The FieldSolver definition.
long long globalTrackStep_m
if multiple TRACK commands
unsigned int getMinimumNumberOfParticlesPerCore() const
void setLocalNum(size_t n)
virtual void set_meshEnlargement(double dh)
void setLocalNumPerBunch(size_t numpart, short n)
A templated representation for vectors.
void setGlobalMeanR(Vector_t globalMeanR)
T::PETE_Expr_t::PETE_Return_t max(const PETE_Expr< T > &expr, NDIndex< D > &loc)
void setDistribution(Distribution *d, std::vector< Distribution * > addedDistributions, size_t &np)
virtual void computeSelfFields_cycl(double gamma)=0
std::unique_ptr< double[]> bingamma_m
holds the gamma of the bin
void setGlobalToLocalQuaternion(Quaternion_t globalToLocalQuaternion)
ParticleAttrib< double > Q
Vector_t get_rrms() const
virtual void updateFields(const Vector_t &hr, const Vector_t &origin)
Vektor< int, 3 > nr_m
meshsize of cartesian mesh
Vector_t eps_norm_m
rms normalized emittance
double t_m
holds the actual time of the integration
int getNumberOfEnergyBins()
double getCouplingConstant() const
virtual void do_binaryRepart()
double couplingConstant_m
FMatrix< double, 2 *Dim, 2 *Dim > moments_m
6x6 matrix of the moments of the beam
const PartData * getReference() const
double get_meanKineticEnergy() const
virtual void setBCForDCBeam()
void setLocalTrackStep(long long n)
step in a TRACK command
ParticleAttrib< short > bunchNum
void calcMomentsInitial()
void setKs3DRefr(Vector_t r)
double centroid_m[2 *Dim]
holds the centroid of the beam
void push_back(OpalParticle p)
Vector_t get_pmean_Distribution() const
double dE_m
energy spread of the beam in MeV
virtual double getY(int i)
Vector_t get_emit() const
Vector_t prms_m
rms momenta
virtual VectorPair_t getEExtrema()=0
calculates back the max/min of the efield on the grid
void setTotalNumPerBunch(size_t numpart, short n)
double dh_m
Mesh enlargement.
int nodes_m
avoid calls to Ippl::getNodes()
size_t getGhostNum() const
FMatrix< double, 2 *Dim, 2 *Dim > getSigmaMatrix()
size_t getTotalNum() const
virtual void resetInterpolationCache(bool clearCache=false)
Vector_t get_prms() const
std::unique_ptr< std::ofstream > f_stream
Vector_t pmean_m
mean momenta
AbstractParticle< T, Dim >::UpdateFlags UpdateFlags_t
virtual void setBCAllOpen()
double getInitialBeta() const
double eKin_m
mean energy of the bunch (MeV)
void setBConds(const ParticleBConds< Position_t, Dimension > &bc)
void ghostDestroy(size_t M, size_t I)
std::unique_ptr< size_t[]> globalPartPerNode_m
IpplTimings::TimerRef distrReload_m
timer for IC, can not be in Distribution.h
Vector_t get_rmean() const
std::shared_ptr< AbstractParticle< T, Dim > > pbase
std::pair< Vector_t, Vector_t > VectorPair_t
void setCouplingConstant(double c)
void calcBeamParameters()
virtual double getPy(int i)
virtual double getGamma(int i)
UnitState_t stateOfLastBoundP_
Vector_t get_pmean() const
Vector_t get_maxExtent() const
ParticleAttrib< short > PType
Vector_t get_halo() const
ParticleLayout< T, Dim > & getLayout()
PartBunchBase(AbstractParticle< T, Dim > *pb)
IpplTimings::TimerRef boundpTimer_m
int stepsPerTurn_m
steps per turn for OPAL-cycl
bool singleInitNode() const
void setUpdateFlag(UpdateFlags_t f, bool val)
void countTotalNumPerBunch()
IpplTimings::TimerRef boundpBoundsTimer_m
OpalParticle get_part(int ii)
virtual double getBeta(int i)
short numBunch_m
current bunch number
Quaternion_t getGlobalToLocalQuaternion()
ParticleAttrib< int > TriID
Defines a structure to hold energy bins and their associated data.
constexpr double c
The velocity of light in m/s.
void setEnergyBins(int numberOfEnergyBins)
size_t getTotalNumPerBunch(short n) const
Vector_t rmean_m
mean position (m)
void setStepsPerTurn(int n)
void get_PBounds(Vector_t &min, Vector_t &max) const
double getChargePerParticle() const
get the macro particle charge
CoordinateSystemTrafo toLabTrafo_m
void setTEmission(double t)
virtual double getY0(int i)
Vector_t rrms_m
rms beam size (m)
std::unique_ptr< Inform > pmsg_m
size_t calcNumPartsOutside(Vector_t x)
returns the number of particles outside of a box defined by x
Vector_t rmax_m
maximal extend of particles
bool lowParticleCount_m
if a local node has less than 2 particles lowParticleCount_m == true
virtual void initialize(FieldLayout_t *fLayout)=0
AbstractParticle< T, Dim >::ParticlePos_t ParticlePos_t
Vector_t get_norm_emit() const
void switchToUnitlessPositions(bool use_dt_per_particle=false)
int myNode_m
avoid calls to Ippl::myNode()
double getInitialGamma() const
virtual void computeSelfFields()=0
void setMass(double mass)
double DDx_m
derivative of the dispersion
double Dx_m
dispersion x & y
Vector_t rprms_m
rms correlation
void setTotalNum(size_t n)
Vector_t get_origin() const
virtual FieldLayout_t & getFieldLayout()=0
FieldSolver * fs_m
stores the used field solver
void maximumAmplitudes(const FMatrix< double, 6, 6 > &D, double &axmax, double &aymax)
Return maximum amplitudes.
size_t getLocalNum() const
Vector_t get_centroid() const
void set_part(FVector< double, 6 > z, int ii)
virtual double getPx0(int i)
size_t getLocalNumPerBunch(short n) const
Inform & print(Inform &os)
IpplTimings::TimerRef histoTimer_m
ParticleAttrib< double > dt
double getCharge() const
get the total charge per simulation particle
bool fixed_grid
if the grid does not have to adapt
void setLocalBinCount(size_t num, int bin)
short getNumBunch() const
void performDestroy(bool updateLocalNum=false)
IpplTimings::TimerRef boundpUpdateTimer_m
ParticleAttrib< double > Phi
bool resetPartBinID2(const double eta)
reset Bin[] for each particle according to the method given in paper PAST-AB(064402) by G...
std::pair< Vector_t, double > getLocalBoundingSphere()
ParticleAttrib< short > cavityGapCrossed
particle just crossed cavity gap (for ParallelCyclotronTracker)
int distDump_m
counter to store the distribution dump
virtual double getPz(int i)
void createWithID(unsigned id)
void globalCreate(size_t np)
virtual double getX0(int i)
Vector_t hr_m
meshspacing of cartesian mesh
AbstractParticle< T, Dim >::ParticleIndex_t ParticleIndex_t
virtual Vector_t get_hr() const
static const unsigned Dimension
void setNumBunch(short n)
double getBinGamma(int bin)
Get gamma of one bin.
Quaternion_t globalToLocalQuaternion_m
AbstractParticle< T, Dim >::Position_t Position_t
double getQ() const
Access to reference data.
size_t getLoadBalance(int p) const
size_t getDestroyNum() const
size_t getNumberOfEmissionSteps()
std::unique_ptr< size_t[]> binemitted_m
std::unique_ptr< LossDataSink > lossDs_m
virtual void setBCAllPeriodic()
ParticleAttrib< int > Bin
void calcGammas()
Compute the gammas of all bins.
virtual void setBinCharge(int bin, double q)
Set the charge of one bin to the value of q and all other to zero.
ParticleType::type refPType_m
virtual double getZ(int i)
ParticleAttrib< Vector_t > Bf
std::pair< Vector_t, double > getBoundingSphere()
ParticleAttrib< double > M
virtual void setSolver(FieldSolver *fs)
long long localTrackStep_m
step in a TRACK command
virtual double getRho(int x, int y, int z)=0
void iterateEmittedBin(int binNumber)
const PartData * reference
void setBeamFrequency(double v)
Timing::TimerRef TimerRef
double getEmissionDeltaT()
IpplTimings::TimerRef statParamTimer_m
double getLaserEnergy() const
Need the laser energy for the Schottky effect calculation (eV)
void get_bounds(Vector_t &rmin, Vector_t &rmax)
virtual void setZ(int i, double zcoo)
Vector_t eps_m
rms emittance (not normalized)
ParticleBConds< Position_t, Dimension > & getBConds()
virtual double getX(int i)
virtual double getPx(int i)
int getStepsPerTurn() const
void calcBeamParametersInitial()
T::PETE_Expr_t::PETE_Return_t min(const PETE_Expr< T > &expr, NDIndex< D > &loc)
bool getUpdateFlag(UpdateFlags_t f) const
Defines a structure to hold energy bins and their associated data for multi-bunch tracking in cyclotr...
void setChargeZeroPart(double q)
void calcLineDensity(unsigned int nBins, std::vector< double > &lineDensity, std::pair< double, double > &meshInfo)
calculates the 1d line density (not normalized) and append it to a file.
double getEkin() const
Need Ek for the Schottky effect calculation (eV)
void setPBins(PartBins *pbin)
void setup(AbstractParticle< T, Dim > *pb)
Vector_t getGlobalMeanR()
ParticleLayout< T, Dim >::Position_t Position_t
void setGlobalTrackStep(long long n)
step in multiple TRACK commands
double calculateAngle(double x, double y)
angle range [0~2PI) degree
void setSteptoLastInj(int n)
virtual void updateDomainLength(Vektor< int, 3 > &grid)=0
size_t emitParticles(double eZ)
Emit particles in the given bin i.e. copy the particles from the bin structure into the particle cont...
long long getGlobalTrackStep() const
void correctEnergy(double avrgp)