1 #ifndef WAKEFUNCTION_HH
2 #define WAKEFUNCTION_HH
9 template <
class T,
unsigned Dim>
21 virtual const std::string
getType()
const = 0;
35 LineDensity(
int size = 0,
double defaultValue = 0.0) : std::vector<double>(size, defaultValue) {}
40 const size_t size = this->size();
41 if(firstDerivative.size() != size)
42 firstDerivative.resize(size, 0.0);
44 firstDerivative[0] = ((*this)[1] - (*this)[0]) / hz;
45 for(
unsigned int i = 1; i + 1 < size; ++i)
46 firstDerivative[i] = ((*
this)[i + 1] - (*this)[i - 1]) / hz;
47 firstDerivative[size - 1] = ((*this)[size - 1] - (*this)[size - 2]) / hz;
50 #endif // WAKEFUNCTION_HH
const unsigned int nBins_m
Interface for basic beam line object.
virtual const std::string getType() const =0
const std::string & getName() const
virtual void apply(PartBunchBase< double, 3 > *bunch)=0
LineDensity(int size=0, double defaultValue=0.0)
virtual void initialize(const ElementBase *ref)
WakeFunction(std::string name, ElementBase *elref, unsigned int n)
void getFirstDerivative(std::vector< double > &firstDerivative, const double &hz)