OPAL (Object Oriented Parallel Accelerator Library) 2022.1
OPAL
Public Member Functions | Private Member Functions | Private Attributes | Friends | List of all members
FM1DDynamic_fast Class Reference

#include <FM1DDynamic_fast.h>

Inheritance diagram for FM1DDynamic_fast:
Inheritance graph
[legend]
Collaboration diagram for FM1DDynamic_fast:
Collaboration graph
[legend]

Public Member Functions

virtual bool getFieldstrength (const Vector_t &R, Vector_t &E, Vector_t &B) const
 
virtual bool getFieldDerivative (const Vector_t &R, Vector_t &E, Vector_t &B, const DiffDirection &dir) const
 
virtual void getFieldDimensions (double &zBegin, double &zEnd) const
 
virtual void getFieldDimensions (double &xIni, double &xFinal, double &yIni, double &yFinal, double &zIni, double &zFinal) const
 
virtual void swap ()
 
virtual void getInfo (Inform *)
 
virtual double getFrequency () const
 
virtual void setFrequency (double freq)
 
virtual void getOnaxisEz (std::vector< std::pair< double, double > > &eZ)
 
virtual bool isInside (const Vector_t &r) const
 
- Public Member Functions inherited from Fieldmap
virtual bool getFieldstrength (const Vector_t &R, Vector_t &E, Vector_t &B) const =0
 
virtual bool getFieldDerivative (const Vector_t &R, Vector_t &E, Vector_t &B, const DiffDirection &dir) const =0
 
virtual void getFieldDimensions (double &zBegin, double &zEnd) const =0
 
virtual void getFieldDimensions (double &xIni, double &xFinal, double &yIni, double &yFinal, double &zIni, double &zFinal) const =0
 
virtual void swap ()=0
 
virtual void getInfo (Inform *msg)=0
 
virtual double getFrequency () const =0
 
virtual void setFrequency (double freq)=0
 
virtual void setEdgeConstants (const double &bendAngle, const double &entranceAngle, const double &exitAngle)
 
virtual void setFieldLength (const double &)
 
virtual void get1DProfile1EngeCoeffs (std::vector< double > &engeCoeffsEntry, std::vector< double > &engeCoeffsExit)
 
virtual void get1DProfile1EntranceParam (double &entranceParameter1, double &entranceParameter2, double &entranceParameter3)
 
virtual void get1DProfile1ExitParam (double &exitParameter1, double &exitParameter2, double &exitParameter3)
 
virtual double getFieldGap ()
 
virtual void setFieldGap (double gap)
 
MapType getType ()
 
virtual void getOnaxisEz (std::vector< std::pair< double, double > > &onaxis)
 
virtual bool isInside (const Vector_t &) const
 
virtual void readMap ()=0
 
virtual void freeMap ()=0
 
template<class T >
bool interpretLine (std::ifstream &in, T &value, const bool &file_length_known)
 

Private Member Functions

 FM1DDynamic_fast (std::string aFilename)
 
 ~FM1DDynamic_fast ()
 
virtual void readMap ()
 
virtual void freeMap ()
 
bool checkFileData (std::ifstream &fieldFile, bool parsingPassed)
 
void computeFieldDerivatives (std::vector< double > fourierCoefs, double onAxisFieldP[], double onAxisFieldPP[], double onAxisFieldPPP[])
 
void computeFieldOffAxis (const Vector_t &R, Vector_t &E, Vector_t &B, std::vector< double > fieldComponents) const
 
void computeFieldOnAxis (double z, std::vector< double > &fieldComponents) const
 
std::vector< double > computeFourierCoefficients (double fieldData[])
 
void computeInterpolationVectors (double onAxisFieldP[], double onAxisFieldPP[], double onAxisFieldPPP[])
 
void convertHeaderData ()
 
void normalizeField (double maxEz, std::vector< double > &fourierCoefs)
 
double readFileData (std::ifstream &fieldFile, double fieldData[])
 
double readFileData (std::ifstream &fieldFile, std::vector< std::pair< double, double > > &eZ)
 
bool readFileHeader (std::ifstream &fieldFile)
 
void scaleField (double maxEz, std::vector< std::pair< double, double > > &eZ)
 
void stripFileHeader (std::ifstream &fieldFile)
 
void prepareForMapCheck (std::vector< double > &fourierCoefs)
 

Private Attributes

double frequency_m
 
double twoPiOverLambdaSq_m
 Field angular frequency (Hz). More...
 
double rBegin_m
 2 Pi divided by the field RF wavelength squared. More...
 
double rEnd_m
 Minimum radius of field. More...
 
double zBegin_m
 Maximum radius of field. More...
 
double zEnd_m
 Longitudinal start of field. More...
 
double length_m
 Longitudinal end of field. More...
 
unsigned int numberOfGridPoints_m
 Field length. More...
 
double deltaZ_m
 Number of grid points in field input file. More...
 
unsigned int accuracy_m
 Field grid point spacing. More...
 
double * onAxisField_m
 
gsl_spline * onAxisFieldInterpolants_m
 On axis field data. More...
 
gsl_spline * onAxisFieldPInterpolants_m
 On axis field interpolation structure. More...
 
gsl_spline * onAxisFieldPPInterpolants_m
 On axis field first derivative interpolation structure. More...
 
gsl_spline * onAxisFieldPPPInterpolants_m
 On axis field second derivative interpolation structure. More...
 
gsl_interp_accel * onAxisFieldAccel_m
 On axis field third derivative interpolation structure. More...
 
gsl_interp_accel * onAxisFieldPAccel_m
 
gsl_interp_accel * onAxisFieldPPAccel_m
 
gsl_interp_accel * onAxisFieldPPPAccel_m
 

Friends

class Fieldmap
 

Additional Inherited Members

- Static Public Member Functions inherited from Fieldmap
static FieldmapgetFieldmap (std::string Filename, bool fast=false)
 
static std::vector< std::string > getListFieldmapNames ()
 
static void deleteFieldmap (std::string Filename)
 
static void clearDictionary ()
 
static MapType readHeader (std::string Filename)
 
static void readMap (std::string Filename)
 
static void freeMap (std::string Filename)
 
static std::string typeset_msg (const std::string &msg, const std::string &title)
 
- Protected Member Functions inherited from Fieldmap
 Fieldmap ()=delete
 
 Fieldmap (const std::string &aFilename)
 
virtual ~Fieldmap ()
 
void getLine (std::ifstream &in, std::string &buffer)
 
template<class S >
bool interpretLine (std::ifstream &in, S &value, const bool &file_length_known=true)
 
template<class S , class T >
bool interpretLine (std::ifstream &in, S &value1, T &value2, const bool &file_length_known=true)
 
template<class S , class T , class U >
bool interpretLine (std::ifstream &in, S &value1, T &value2, U &value3, const bool &file_length_known=true)
 
template<class S , class T , class U , class V >
bool interpretLine (std::ifstream &in, S &value1, T &value2, U &value3, V &value4, const bool &file_length_known=true)
 
template<class S >
bool interpretLine (std::ifstream &in, S &value1, S &value2, S &value3, S &value4, S &value5, S &value6, const bool &file_length_known=true)
 
bool interpreteEOF (std::ifstream &in)
 
void interpretWarning (const std::ios_base::iostate &state, const bool &read_all, const std::string &error_msg, const std::string &found)
 
void missingValuesWarning ()
 
void exceedingValuesWarning ()
 
void disableFieldmapWarning ()
 
void noFieldmapWarning ()
 
void lowResolutionWarning (double squareError, double maxError)
 
void checkMap (unsigned int accuracy, std::pair< double, double > fieldDimensions, double deltaZ, const std::vector< double > &fourierCoefficients, gsl_spline *splineCoefficients, gsl_interp_accel *splineAccelerator)
 
void checkMap (unsigned int accuracy, double length, const std::vector< double > &zSampling, const std::vector< double > &fourierCoefficients, gsl_spline *splineCoefficients, gsl_interp_accel *splineAccelerator)
 
void write3DField (unsigned int nx, unsigned int ny, unsigned int nz, const std::pair< double, double > &xrange, const std::pair< double, double > &yrange, const std::pair< double, double > &zrange, const std::vector< Vector_t > &ef, const std::vector< Vector_t > &bf)
 
- Static Protected Member Functions inherited from Fieldmap
static void getLine (std::ifstream &in, int &lines_read, std::string &buffer)
 
- Protected Attributes inherited from Fieldmap
MapType Type
 
std::string Filename_m
 
int lines_read_m
 
bool normalize_m
 

Detailed Description

Definition at line 6 of file FM1DDynamic_fast.h.

Constructor & Destructor Documentation

◆ FM1DDynamic_fast()

FM1DDynamic_fast::FM1DDynamic_fast ( std::string  aFilename)
private

◆ ~FM1DDynamic_fast()

FM1DDynamic_fast::~FM1DDynamic_fast ( )
private

Definition at line 44 of file FM1DDynamic_fast.cpp.

References freeMap().

Here is the call graph for this function:

Member Function Documentation

◆ checkFileData()

bool FM1DDynamic_fast::checkFileData ( std::ifstream &  fieldFile,
bool  parsingPassed 
)
private

Definition at line 159 of file FM1DDynamic_fast.cpp.

References Fieldmap::interpreteEOF(), and numberOfGridPoints_m.

Referenced by FM1DDynamic_fast().

Here is the call graph for this function:

◆ computeFieldDerivatives()

void FM1DDynamic_fast::computeFieldDerivatives ( std::vector< double >  fourierCoefs,
double  onAxisFieldP[],
double  onAxisFieldPP[],
double  onAxisFieldPPP[] 
)
private

Definition at line 171 of file FM1DDynamic_fast.cpp.

References accuracy_m, cos(), deltaZ_m, length_m, Hypervolume::n, numberOfGridPoints_m, Physics::pi, pow(), sin(), and Physics::two_pi.

Referenced by readMap().

Here is the call graph for this function:

◆ computeFieldOffAxis()

void FM1DDynamic_fast::computeFieldOffAxis ( const Vector_t R,
Vector_t E,
Vector_t B,
std::vector< double >  fieldComponents 
) const
private

Definition at line 207 of file FM1DDynamic_fast.cpp.

References frequency_m, pow(), Attrib::Distribution::R, and twoPiOverLambdaSq_m.

Referenced by getFieldstrength().

Here is the call graph for this function:

◆ computeFieldOnAxis()

void FM1DDynamic_fast::computeFieldOnAxis ( double  z,
std::vector< double > &  fieldComponents 
) const
private

◆ computeFourierCoefficients()

std::vector< double > FM1DDynamic_fast::computeFourierCoefficients ( double  fieldData[])
private

Definition at line 245 of file FM1DDynamic_fast.cpp.

References accuracy_m, and numberOfGridPoints_m.

Referenced by readMap().

◆ computeInterpolationVectors()

void FM1DDynamic_fast::computeInterpolationVectors ( double  onAxisFieldP[],
double  onAxisFieldPP[],
double  onAxisFieldPPP[] 
)
private

◆ convertHeaderData()

void FM1DDynamic_fast::convertHeaderData ( )
private

Definition at line 310 of file FM1DDynamic_fast.cpp.

References Physics::c, Units::cm2m, frequency_m, Units::MHz2Hz, pow(), rBegin_m, rEnd_m, Physics::two_pi, twoPiOverLambdaSq_m, zBegin_m, and zEnd_m.

Referenced by FM1DDynamic_fast().

Here is the call graph for this function:

◆ freeMap()

void FM1DDynamic_fast::freeMap ( )
privatevirtual

◆ getFieldDerivative()

bool FM1DDynamic_fast::getFieldDerivative ( const Vector_t R,
Vector_t E,
Vector_t B,
const DiffDirection dir 
) const
virtual

◆ getFieldDimensions() [1/2]

void FM1DDynamic_fast::getFieldDimensions ( double &  xIni,
double &  xFinal,
double &  yIni,
double &  yFinal,
double &  zIni,
double &  zFinal 
) const
virtual

Implements Fieldmap.

Definition at line 126 of file FM1DDynamic_fast.cpp.

◆ getFieldDimensions() [2/2]

void FM1DDynamic_fast::getFieldDimensions ( double &  zBegin,
double &  zEnd 
) const
virtual

Implements Fieldmap.

Definition at line 121 of file FM1DDynamic_fast.cpp.

References zBegin_m, and zEnd_m.

◆ getFieldstrength()

bool FM1DDynamic_fast::getFieldstrength ( const Vector_t R,
Vector_t E,
Vector_t B 
) const
virtual

Implements Fieldmap.

Definition at line 100 of file FM1DDynamic_fast.cpp.

References computeFieldOffAxis(), computeFieldOnAxis(), Attrib::Distribution::R, and zBegin_m.

Here is the call graph for this function:

◆ getFrequency()

double FM1DDynamic_fast::getFrequency ( ) const
virtual

Implements Fieldmap.

Definition at line 140 of file FM1DDynamic_fast.cpp.

References frequency_m.

◆ getInfo()

void FM1DDynamic_fast::getInfo ( Inform msg)
virtual

Implements Fieldmap.

Definition at line 133 of file FM1DDynamic_fast.cpp.

References endl(), Fieldmap::Filename_m, zBegin_m, and zEnd_m.

Here is the call graph for this function:

◆ getOnaxisEz()

void FM1DDynamic_fast::getOnaxisEz ( std::vector< std::pair< double, double > > &  eZ)
virtual

Reimplemented from Fieldmap.

Definition at line 148 of file FM1DDynamic_fast.cpp.

References Fieldmap::Filename_m, numberOfGridPoints_m, readFileData(), scaleField(), and stripFileHeader().

Here is the call graph for this function:

◆ isInside()

bool FM1DDynamic_fast::isInside ( const Vector_t r) const
inlinevirtual

Reimplemented from Fieldmap.

Definition at line 79 of file FM1DDynamic_fast.h.

References zBegin_m, and zEnd_m.

◆ normalizeField()

void FM1DDynamic_fast::normalizeField ( double  maxEz,
std::vector< double > &  fourierCoefs 
)
private

Definition at line 324 of file FM1DDynamic_fast.cpp.

References numberOfGridPoints_m, onAxisField_m, and Units::Vpm2MVpm.

Referenced by readMap().

◆ prepareForMapCheck()

void FM1DDynamic_fast::prepareForMapCheck ( std::vector< double > &  fourierCoefs)
private

Definition at line 434 of file FM1DDynamic_fast.cpp.

References accuracy_m, Fieldmap::checkMap(), deltaZ_m, length_m, numberOfGridPoints_m, onAxisFieldAccel_m, and onAxisFieldInterpolants_m.

Referenced by readMap().

Here is the call graph for this function:

◆ readFileData() [1/2]

double FM1DDynamic_fast::readFileData ( std::ifstream &  fieldFile,
double  fieldData[] 
)
private

Definition at line 336 of file FM1DDynamic_fast.cpp.

References abs(), Fieldmap::normalize_m, and numberOfGridPoints_m.

Referenced by getOnaxisEz(), and readMap().

Here is the call graph for this function:

◆ readFileData() [2/2]

double FM1DDynamic_fast::readFileData ( std::ifstream &  fieldFile,
std::vector< std::pair< double, double > > &  eZ 
)
private

Definition at line 352 of file FM1DDynamic_fast.cpp.

References abs(), Fieldmap::normalize_m, numberOfGridPoints_m, zBegin_m, and zEnd_m.

Here is the call graph for this function:

◆ readFileHeader()

bool FM1DDynamic_fast::readFileHeader ( std::ifstream &  fieldFile)
private

Definition at line 370 of file FM1DDynamic_fast.cpp.

References accuracy_m, Physics::e, frequency_m, Fieldmap::normalize_m, numberOfGridPoints_m, rBegin_m, rEnd_m, Util::toUpper(), zBegin_m, and zEnd_m.

Referenced by FM1DDynamic_fast().

Here is the call graph for this function:

◆ readMap()

void FM1DDynamic_fast::readMap ( )
privatevirtual

◆ scaleField()

void FM1DDynamic_fast::scaleField ( double  maxEz,
std::vector< std::pair< double, double > > &  eZ 
)
private

Definition at line 416 of file FM1DDynamic_fast.cpp.

References Fieldmap::normalize_m, and numberOfGridPoints_m.

Referenced by getOnaxisEz().

◆ setFrequency()

void FM1DDynamic_fast::setFrequency ( double  freq)
virtual

Implements Fieldmap.

Definition at line 144 of file FM1DDynamic_fast.cpp.

References frequency_m.

◆ stripFileHeader()

void FM1DDynamic_fast::stripFileHeader ( std::ifstream &  fieldFile)
private

Definition at line 424 of file FM1DDynamic_fast.cpp.

References Fieldmap::getLine().

Referenced by getOnaxisEz(), and readMap().

Here is the call graph for this function:

◆ swap()

void FM1DDynamic_fast::swap ( )
virtual

Implements Fieldmap.

Definition at line 130 of file FM1DDynamic_fast.cpp.

Friends And Related Function Documentation

◆ Fieldmap

friend class Fieldmap
friend

Definition at line 76 of file FM1DDynamic_fast.h.

Member Data Documentation

◆ accuracy_m

unsigned int FM1DDynamic_fast::accuracy_m
private

Field grid point spacing.

Definition at line 62 of file FM1DDynamic_fast.h.

Referenced by computeFieldDerivatives(), computeFourierCoefficients(), prepareForMapCheck(), and readFileHeader().

◆ deltaZ_m

double FM1DDynamic_fast::deltaZ_m
private

Number of grid points in field input file.

Definition at line 61 of file FM1DDynamic_fast.h.

Referenced by computeFieldDerivatives(), computeInterpolationVectors(), FM1DDynamic_fast(), and prepareForMapCheck().

◆ frequency_m

double FM1DDynamic_fast::frequency_m
private

◆ length_m

double FM1DDynamic_fast::length_m
private

Longitudinal end of field.

Definition at line 59 of file FM1DDynamic_fast.h.

Referenced by computeFieldDerivatives(), FM1DDynamic_fast(), and prepareForMapCheck().

◆ numberOfGridPoints_m

unsigned int FM1DDynamic_fast::numberOfGridPoints_m
private

◆ onAxisField_m

double* FM1DDynamic_fast::onAxisField_m
private

◆ onAxisFieldAccel_m

gsl_interp_accel* FM1DDynamic_fast::onAxisFieldAccel_m
private

On axis field third derivative interpolation structure.

Corresponding interpolation evaluation accelerators.

Definition at line 71 of file FM1DDynamic_fast.h.

Referenced by computeFieldOnAxis(), computeInterpolationVectors(), freeMap(), and prepareForMapCheck().

◆ onAxisFieldInterpolants_m

gsl_spline* FM1DDynamic_fast::onAxisFieldInterpolants_m
private

On axis field data.

Definition at line 65 of file FM1DDynamic_fast.h.

Referenced by computeFieldOnAxis(), computeInterpolationVectors(), freeMap(), and prepareForMapCheck().

◆ onAxisFieldPAccel_m

gsl_interp_accel* FM1DDynamic_fast::onAxisFieldPAccel_m
private

◆ onAxisFieldPInterpolants_m

gsl_spline* FM1DDynamic_fast::onAxisFieldPInterpolants_m
private

On axis field interpolation structure.

Definition at line 66 of file FM1DDynamic_fast.h.

Referenced by computeFieldOnAxis(), computeInterpolationVectors(), freeMap(), and getFieldDerivative().

◆ onAxisFieldPPAccel_m

gsl_interp_accel* FM1DDynamic_fast::onAxisFieldPPAccel_m
private

Definition at line 73 of file FM1DDynamic_fast.h.

Referenced by computeFieldOnAxis(), computeInterpolationVectors(), and freeMap().

◆ onAxisFieldPPInterpolants_m

gsl_spline* FM1DDynamic_fast::onAxisFieldPPInterpolants_m
private

On axis field first derivative interpolation structure.

Definition at line 67 of file FM1DDynamic_fast.h.

Referenced by computeFieldOnAxis(), computeInterpolationVectors(), and freeMap().

◆ onAxisFieldPPPAccel_m

gsl_interp_accel* FM1DDynamic_fast::onAxisFieldPPPAccel_m
private

Definition at line 74 of file FM1DDynamic_fast.h.

Referenced by computeFieldOnAxis(), computeInterpolationVectors(), and freeMap().

◆ onAxisFieldPPPInterpolants_m

gsl_spline* FM1DDynamic_fast::onAxisFieldPPPInterpolants_m
private

On axis field second derivative interpolation structure.

Definition at line 68 of file FM1DDynamic_fast.h.

Referenced by computeFieldOnAxis(), computeInterpolationVectors(), and freeMap().

◆ rBegin_m

double FM1DDynamic_fast::rBegin_m
private

2 Pi divided by the field RF wavelength squared.

Definition at line 55 of file FM1DDynamic_fast.h.

Referenced by convertHeaderData(), and readFileHeader().

◆ rEnd_m

double FM1DDynamic_fast::rEnd_m
private

Minimum radius of field.

Definition at line 56 of file FM1DDynamic_fast.h.

Referenced by convertHeaderData(), and readFileHeader().

◆ twoPiOverLambdaSq_m

double FM1DDynamic_fast::twoPiOverLambdaSq_m
private

Field angular frequency (Hz).

Definition at line 53 of file FM1DDynamic_fast.h.

Referenced by computeFieldOffAxis(), and convertHeaderData().

◆ zBegin_m

double FM1DDynamic_fast::zBegin_m
private

◆ zEnd_m

double FM1DDynamic_fast::zEnd_m
private

Longitudinal start of field.

Definition at line 58 of file FM1DDynamic_fast.h.

Referenced by convertHeaderData(), FM1DDynamic_fast(), getFieldDimensions(), getInfo(), isInside(), readFileData(), and readFileHeader().


The documentation for this class was generated from the following files: