17 #ifndef GREENWAKEFUNCTION_HH
18 #define GREENWAKEFUNCTION_HH
31 #ifdef WITH_UNIT_TESTS
32 #include <gtest/gtest_prod.h>
44 std::vector<Filter *> filters,
59 virtual const std::string
getType()
const;
62 #ifdef WITH_UNIT_TESTS
63 FRIEND_TEST(GreenWakeFunctionTest, TestApply);
70 Wake(
double s,
double Z0,
double a,
double sigma,
int acMode,
double tau,
int direction)
83 std::complex <double> i(0, 1);
84 std::complex <double> Z(0, 0);
85 double signK = (k > 0 ? 1 : -1);
105 ERRORMSG(
"We should not be here: " << __FILE__ <<
" L" << __LINE__ <<
endl);
140 template<
class F>
double simpson(F &f,
double a,
double b,
unsigned int N) {
145 double h = (b -
a) / N;
148 result += (f(
a) + 4 * f(
a + h / 2) + f(b)) / 2.0;
151 for(
unsigned int i = 1; i < N; ++ i) {
152 result += f(
a + i * h) + 2 * f(
a + (i + 0.5) * h);
186 void compEnergy(
const double K,
const double charge,
const double *lambda,
double *OutEnergy);
187 void compEnergy(
const double K,
const double charge, std::vector<double> lambda,
double *OutEnergy);
Tps< T > cos(const Tps< T > &x)
Cosine.
Tps< T > sqrt(const Tps< T > &x)
Square root.
FLieGenerator< T, N > real(const FLieGenerator< std::complex< T >, N > &)
Take real part of a complex generator.
std::map< std::string, int > FilterOptions
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 direction_m
direction either 1="Longitudinal" 2= "Transversal"
int NBin_m
divides the particle bunch in NBin slices
std::string filename_m
filename of the wakefield
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
std::vector< double > lineDensity_m
save the line Density of the particle bunch
GreenWakeFunction(const std::string &name, std::vector< Filter * > filters, int NBIN, double Z0, double radius, double sigma, int acMode, double tau, int direction, bool constLength, std::string fname)
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
void apply(PartBunchBase< double, 3 > *bunch)
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.
virtual const std::string getType() const
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
std::vector< Filter * > filters_m
double tau_
material constant
double operator()(double k)
Used to integrate the function.
int direction_
direction either 1="Longitudinal" 0= "Transversal"
int acMode_
conductivity either 1="AC" or 2="DC"
Wake(double s, double Z0, double a, double sigma, int acMode, double tau, int direction)
double s_
distance from the particle
double sigma_
material constant