17#ifndef GREENWAKEFUNCTION_HH
18#define GREENWAKEFUNCTION_HH
32#include <gtest/gtest_prod.h>
48 std::vector<Filter*> filters,
67 FRIEND_TEST(GreenWakeFunctionTest, TestApply);
73 Wake(
double s,
double Z0,
double a,
double sigma,
int acMode,
double tau,
WakeDirection direction)
86 std::complex <double> i(0, 1);
87 std::complex <double> Z(0, 0);
88 double signK = (k > 0 ? 1 : -1);
108 ERRORMSG(
"We should not be here: " << __FILE__ <<
" L" << __LINE__ <<
endl);
141 template<
class F>
double simpson(F& f,
double a,
double b,
unsigned int N) {
146 double h = (b -
a) / N;
149 result += (f(
a) + 4 * f(
a + h / 2) + f(b)) / 2.0;
152 for(
unsigned int i = 1; i < N; ++ i) {
153 result += f(
a + i * h) + 2 * f(
a + (i + 0.5) * h);
189 void compEnergy(
const double K,
const double charge,
const double* lambda,
double* OutEnergy);
190 void compEnergy(
const double K,
const double charge, std::vector<double> lambda,
double* OutEnergy);
FLieGenerator< T, N > real(const FLieGenerator< std::complex< T >, N > &)
Take real part of a complex generator.
std::map< std::string, int > FilterOptions
Tps< T > cos(const Tps< T > &x)
Cosine.
Tps< T > sqrt(const Tps< T > &x)
Square root.
PETE_TUTree< FnAbs, typename T::PETE_Expr_t > abs(const PETE_Expr< T > &l)
Inform & endl(Inform &inf)
constexpr double c
The velocity of light in m/s.
constexpr double pi
The value of.
std::vector< double > FftWField_m
FFT of the zero padded wakefield.
void setWakeFromFile(int NBin, double spacing)
reads in the wakefield from file
int NBin_m
divides the particle bunch in NBin slices
std::string filename_m
filename of the wakefield
static const std::map< WakeDirection, std::string > wakeDirectiontoString_s
void compEnergy(const double K, const double charge, const double *lambda, double *OutEnergy)
just a Testfunction! Calculate the energy of the Wakefunction with the lambda
WakeDirection direction_m
direction either "Longitudinal" - "Transversal"
virtual WakeType getType() const override
void apply(PartBunchBase< double, 3 > *bunch) override
std::vector< double > lineDensity_m
save the line Density of the particle bunch
double simpson(F &f, double a, double b, unsigned int N)
Simpson-Integration from the function f from a to b with N steps.
bool constLength_m
true if the length of the particle bunch is considered as constant
int acMode_m
conductivity either 1="AC" or 2="DC"
double sigma_m
material constant
void CalcWakeFFT(double spacing)
Calculate the FFT of the Wakefunction.
GreenWakeFunction(const std::string &name, std::vector< Filter * > filters, int NBIN, double Z0, double radius, double sigma, int acMode, double tau, WakeDirection direction, bool constLength, std::string fname)
std::vector< Filter * > filters_m
std::pair< int, int > distrIndices(int vectLen)
given a vector of length N, distribute the indexes among the available processors
double tau_m
material constant
static std::string getWakeDirectionString(const WakeDirection &direction)
Wake(double s, double Z0, double a, double sigma, int acMode, double tau, WakeDirection direction)
double tau_
material constant
WakeDirection direction_
direction either 1="Longitudinal" 0= "Transversal"
double operator()(double k)
Used to integrate the function.
int acMode_
conductivity either 1="AC" or 2="DC"
double s_
distance from the particle
double sigma_
material constant