OPAL (Object Oriented Parallel Accelerator Library)  2.2.0
OPAL
Classes | Public Member Functions | Static Public Member Functions | Protected Member Functions | Static Protected Member Functions | Protected Attributes | Static Private Attributes | List of all members
Fieldmap Class Referenceabstract

#include <Fieldmap.h>

Inheritance diagram for Fieldmap:
Inheritance graph
[legend]

Classes

struct  FieldmapDescription
 
struct  TypeParseTraits
 
struct  TypeParseTraits< double >
 
struct  TypeParseTraits< int >
 
struct  TypeParseTraits< std::string >
 
struct  TypeParseTraits< unsigned int >
 

Public Member Functions

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, double &rBegin, double &rEnd) 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 &r) const
 
virtual void readMap ()=0
 
virtual void freeMap ()=0
 
template<class T >
bool interpreteLine (std::ifstream &in, T &value, const bool &file_length_known)
 

Static Public Member Functions

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

 Fieldmap (const std::string &aFilename)
 
virtual ~Fieldmap ()
 
void getLine (std::ifstream &in, std::string &buffer)
 
template<class S >
bool interpreteLine (std::ifstream &in, S &value, const bool &file_length_known=true)
 
template<class S , class T >
bool interpreteLine (std::ifstream &in, S &value1, T &value2, const bool &file_length_known=true)
 
template<class S , class T , class U >
bool interpreteLine (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 interpreteLine (std::ifstream &in, S &value1, T &value2, U &value3, V &value4, const bool &file_length_known=true)
 
template<class S >
bool interpreteLine (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 interpreteWarning (const std::string &error_msg, const std::string &expecting, const std::string &found)
 
void interpreteWarning (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

static void getLine (std::ifstream &in, int &lines_read, std::string &buffer)
 

Protected Attributes

MapType Type
 
std::string Filename_m
 
int lines_read_m
 
bool normalize_m
 

Static Private Attributes

static char buffer_m [256]
 
static std::string alpha_numeric
 
static std::map< std::string,
FieldmapDescription
FieldmapDictionary = std::map<std::string, Fieldmap::FieldmapDescription>()
 

Detailed Description

Definition at line 60 of file Fieldmap.h.

Constructor & Destructor Documentation

Fieldmap::Fieldmap ( const std::string &  aFilename)
inlineprotected

Definition at line 191 of file Fieldmap.h.

virtual Fieldmap::~Fieldmap ( )
inlineprotectedvirtual

Definition at line 107 of file Fieldmap.h.

Member Function Documentation

void Fieldmap::checkMap ( unsigned int  accuracy,
std::pair< double, double >  fieldDimensions,
double  deltaZ,
const std::vector< double > &  fourierCoefficients,
gsl_spline *  splineCoefficients,
gsl_interp_accel *  splineAccelerator 
)
protected
void Fieldmap::checkMap ( unsigned int  accuracy,
double  length,
const std::vector< double > &  zSampling,
const std::vector< double > &  fourierCoefficients,
gsl_spline *  splineCoefficients,
gsl_interp_accel *  splineAccelerator 
)
protected

Definition at line 459 of file Fieldmap.cpp.

References abs(), cos(), Physics::e, endl(), Filename_m, OpalData::getInstance(), lowResolutionWarning(), IpplInfo::myNode(), Hypervolume::n, pow(), sin(), sqrt(), and Physics::two_pi.

Here is the call graph for this function:

void Fieldmap::clearDictionary ( )
static

Definition at line 271 of file Fieldmap.cpp.

References FieldmapDictionary.

Referenced by main(), and run_opal().

void Fieldmap::deleteFieldmap ( std::string  Filename)
static

Definition at line 267 of file Fieldmap.cpp.

References freeMap().

Here is the call graph for this function:

void Fieldmap::disableFieldmapWarning ( )
protected
void Fieldmap::exceedingValuesWarning ( )
protected

Definition at line 600 of file Fieldmap.cpp.

References Filename_m, and lines_read_m.

Referenced by interpreteEOF().

void Fieldmap::freeMap ( std::string  Filename)
static

Definition at line 425 of file Fieldmap.cpp.

References FieldmapDictionary.

virtual void Fieldmap::freeMap ( )
pure virtual
void Fieldmap::get1DProfile1EngeCoeffs ( std::vector< double > &  engeCoeffsEntry,
std::vector< double > &  engeCoeffsExit 
)
virtual

Reimplemented in FM1DProfile1.

Definition at line 707 of file Fieldmap.cpp.

Referenced by Bend2D::readFieldMap().

void Fieldmap::get1DProfile1EntranceParam ( double &  entranceParameter1,
double &  entranceParameter2,
double &  entranceParameter3 
)
virtual

Reimplemented in FM1DProfile1.

Definition at line 712 of file Fieldmap.cpp.

Referenced by Bend2D::getEntranceFringeFieldLength(), and Bend2D::readFieldMap().

void Fieldmap::get1DProfile1ExitParam ( double &  exitParameter1,
double &  exitParameter2,
double &  exitParameter3 
)
virtual

Reimplemented in FM1DProfile1.

Definition at line 718 of file Fieldmap.cpp.

Referenced by Bend2D::getExitFringeFieldLength(), and Bend2D::readFieldMap().

virtual bool Fieldmap::getFieldDerivative ( const Vector_t R,
Vector_t E,
Vector_t B,
const DiffDirection dir 
) const
pure virtual
virtual void Fieldmap::getFieldDimensions ( double &  zBegin,
double &  zEnd,
double &  rBegin,
double &  rEnd 
) const
pure virtual
virtual void Fieldmap::getFieldDimensions ( double &  xIni,
double &  xFinal,
double &  yIni,
double &  yFinal,
double &  zIni,
double &  zFinal 
) const
pure virtual
double Fieldmap::getFieldGap ( )
virtual

Reimplemented in FM1DProfile1.

Definition at line 724 of file Fieldmap.cpp.

Referenced by Bend2D::setGapFromFieldMap().

Fieldmap * Fieldmap::getFieldmap ( std::string  Filename,
bool  fast = false 
)
static
virtual bool Fieldmap::getFieldstrength ( const Vector_t R,
Vector_t E,
Vector_t B 
) const
pure virtual
virtual double Fieldmap::getFrequency ( ) const
pure virtual
virtual void Fieldmap::getInfo ( Inform msg)
pure virtual
void Fieldmap::getLine ( std::ifstream &  in,
std::string &  buffer 
)
inlineprotected
void Fieldmap::getLine ( std::ifstream &  in,
int &  lines_read,
std::string &  buffer 
)
staticprotected

Definition at line 524 of file Fieldmap.cpp.

References alpha_numeric, buffer_m, and READ_BUFFER_LENGTH.

std::vector< std::string > Fieldmap::getListFieldmapNames ( )
static

Definition at line 259 of file Fieldmap.cpp.

References FieldmapDictionary.

void Fieldmap::getOnaxisEz ( std::vector< std::pair< double, double > > &  onaxis)
virtual
MapType Fieldmap::getType ( )
inline

Definition at line 96 of file Fieldmap.h.

References Type.

bool Fieldmap::interpreteEOF ( std::ifstream &  in)
protected
template<class T >
bool Fieldmap::interpreteLine ( std::ifstream &  in,
T value,
const bool &  file_length_known 
)

Definition at line 12 of file Fieldmap.hpp.

References getLine(), interpreteWarning(), and missingValuesWarning().

Here is the call graph for this function:

template<class S >
bool Fieldmap::interpreteLine ( std::ifstream &  in,
S &  value,
const bool &  file_length_known = true 
)
protected
template<class S , class T >
bool Fieldmap::interpreteLine ( std::ifstream &  in,
S &  value1,
T value2,
const bool &  file_length_known = true 
)
protected

Definition at line 39 of file Fieldmap.hpp.

References getLine(), interpreteWarning(), and missingValuesWarning().

Here is the call graph for this function:

template<class S , class T , class U >
bool Fieldmap::interpreteLine ( std::ifstream &  in,
S &  value1,
T value2,
U &  value3,
const bool &  file_length_known = true 
)
protected

Definition at line 70 of file Fieldmap.hpp.

References getLine(), interpreteWarning(), and missingValuesWarning().

Here is the call graph for this function:

template<class S , class T , class U , class V >
bool Fieldmap::interpreteLine ( std::ifstream &  in,
S &  value1,
T value2,
U &  value3,
V &  value4,
const bool &  file_length_known = true 
)
protected

Definition at line 104 of file Fieldmap.hpp.

References getLine(), interpreteWarning(), and missingValuesWarning().

Here is the call graph for this function:

template<class S >
bool Fieldmap::interpreteLine ( std::ifstream &  in,
S &  value1,
S &  value2,
S &  value3,
S &  value4,
S &  value5,
S &  value6,
const bool &  file_length_known = true 
)
protected

Definition at line 141 of file Fieldmap.hpp.

References getLine(), interpreteWarning(), and missingValuesWarning().

Here is the call graph for this function:

void Fieldmap::interpreteWarning ( const std::string &  error_msg,
const std::string &  expecting,
const std::string &  found 
)
protected

Definition at line 563 of file Fieldmap.cpp.

References Filename_m, and lines_read_m.

Referenced by interpreteLine(), and interpreteWarning().

void Fieldmap::interpreteWarning ( const std::ios_base::iostate &  state,
const bool &  read_all,
const std::string &  error_msg,
const std::string &  found 
)
protected

Definition at line 575 of file Fieldmap.cpp.

References interpreteWarning().

Here is the call graph for this function:

bool Fieldmap::isInside ( const Vector_t r) const
inlinevirtual
void Fieldmap::lowResolutionWarning ( double  squareError,
double  maxError 
)
protected

Definition at line 626 of file Fieldmap.cpp.

References endl(), ERRORMSG, Filename_m, IpplInfo::myNode(), and typeset_msg().

Referenced by checkMap().

Here is the call graph for this function:

void Fieldmap::missingValuesWarning ( )
protected

Definition at line 590 of file Fieldmap.cpp.

References Filename_m, and lines_read_m.

Referenced by interpreteLine().

void Fieldmap::noFieldmapWarning ( )
protected
MapType Fieldmap::readHeader ( std::string  Filename)
static
void Fieldmap::readMap ( std::string  Filename)
static
virtual void Fieldmap::readMap ( )
pure virtual
void Fieldmap::setEdgeConstants ( const double &  bendAngle,
const double &  entranceAngle,
const double &  exitAngle 
)
virtual

Reimplemented in FM1DProfile2.

Definition at line 518 of file Fieldmap.cpp.

void Fieldmap::setFieldGap ( double  gap)
virtual

Reimplemented in FM1DProfile1.

Definition at line 728 of file Fieldmap.cpp.

void Fieldmap::setFieldLength ( const double &  )
virtual

Definition at line 521 of file Fieldmap.cpp.

virtual void Fieldmap::setFrequency ( double  freq)
pure virtual
virtual void Fieldmap::swap ( )
pure virtual
std::string Fieldmap::typeset_msg ( const std::string &  msg,
const std::string &  title 
)
static

Definition at line 647 of file Fieldmap.cpp.

References Physics::c.

Referenced by FMDummy::FMDummy(), FM2DElectroStatic::freeMap(), FM2DMagnetoStatic::freeMap(), FM3DMagnetoStatic::freeMap(), FM3DMagnetoStaticExtended::freeMap(), Astra1DElectroStatic::freeMap(), Astra1DMagnetoStatic::freeMap(), Astra1D_fast::freeMap(), FM3DDynamic::freeMap(), Astra1DDynamic::freeMap(), FM1DProfile2::freeMap(), FM3DMagnetoStaticH5Block::freeMap(), FM2DDynamic::freeMap(), FM3DH5Block_nonscale::freeMap(), FM3DH5Block::freeMap(), FM1DElectroStatic::freeMap(), FM1DElectroStatic_fast::freeMap(), FM1DMagnetoStatic::freeMap(), FM1DMagnetoStatic_fast::freeMap(), FM1DDynamic::freeMap(), FM1DDynamic_fast::freeMap(), TravelingWave::initialise(), RFCavity::initialise(), lowResolutionWarning(), CCollimator::print(), FlexibleCollimator::print(), Astra1DElectroStatic_fast::readMap(), Astra1DMagnetoStatic_fast::readMap(), FM3DMagnetoStatic::readMap(), FM2DMagnetoStatic::readMap(), FM3DMagnetoStaticExtended::readMap(), Astra1DDynamic_fast::readMap(), FM2DElectroStatic::readMap(), Astra1DElectroStatic::readMap(), Astra1DMagnetoStatic::readMap(), FM3DDynamic::readMap(), Astra1DDynamic::readMap(), FM1DProfile2::readMap(), FM3DMagnetoStaticH5Block::readMap(), FM2DDynamic::readMap(), FM3DH5Block_nonscale::readMap(), FM1DMagnetoStatic::readMap(), FM1DElectroStatic_fast::readMap(), FM3DH5Block::readMap(), FM1DMagnetoStatic_fast::readMap(), FM1DElectroStatic::readMap(), FM1DDynamic::readMap(), FM1DDynamic_fast::readMap(), FM1DProfile1::readMap(), and RFCavity::setComponentType().

void Fieldmap::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 
)
protected

Definition at line 732 of file Fieldmap.cpp.

References endl(), Filename_m, and IpplInfo::myNode().

Referenced by FM3DDynamic::readMap().

Here is the call graph for this function:

Member Data Documentation

std::string Fieldmap::alpha_numeric
staticprivate

Definition at line 172 of file Fieldmap.h.

Referenced by getLine(), and interpreteEOF().

char Fieldmap::buffer_m
staticprivate

Definition at line 171 of file Fieldmap.h.

Referenced by getLine(), and interpreteEOF().

std::map< std::string, Fieldmap::FieldmapDescription > Fieldmap::FieldmapDictionary = std::map<std::string, Fieldmap::FieldmapDescription>()
staticprivate

Definition at line 187 of file Fieldmap.h.

Referenced by clearDictionary(), freeMap(), getFieldmap(), getListFieldmapNames(), and readMap().

std::string Fieldmap::Filename_m
protected

Definition at line 110 of file Fieldmap.h.

Referenced by Astra1DDynamic::Astra1DDynamic(), Astra1DDynamic_fast::Astra1DDynamic_fast(), Astra1DElectroStatic::Astra1DElectroStatic(), Astra1DElectroStatic_fast::Astra1DElectroStatic_fast(), Astra1DMagnetoStatic::Astra1DMagnetoStatic(), Astra1DMagnetoStatic_fast::Astra1DMagnetoStatic_fast(), checkMap(), disableFieldmapWarning(), exceedingValuesWarning(), FM1DDynamic::FM1DDynamic(), FM1DDynamic_fast::FM1DDynamic_fast(), FM1DElectroStatic::FM1DElectroStatic(), FM1DElectroStatic_fast::FM1DElectroStatic_fast(), FM1DMagnetoStatic::FM1DMagnetoStatic(), FM1DMagnetoStatic_fast::FM1DMagnetoStatic_fast(), FM1DProfile1::FM1DProfile1(), FM1DProfile2::FM1DProfile2(), FM2DDynamic::FM2DDynamic(), FM2DElectroStatic::FM2DElectroStatic(), FM2DMagnetoStatic::FM2DMagnetoStatic(), FM3DDynamic::FM3DDynamic(), FM3DMagnetoStatic::FM3DMagnetoStatic(), FM3DMagnetoStaticExtended::FM3DMagnetoStaticExtended(), FMDummy::FMDummy(), FM2DElectroStatic::freeMap(), FM2DMagnetoStatic::freeMap(), FM3DMagnetoStatic::freeMap(), Astra1DMagnetoStatic::freeMap(), FM3DMagnetoStaticExtended::freeMap(), Astra1DElectroStatic::freeMap(), FM1DProfile2::freeMap(), Astra1DDynamic::freeMap(), FM3DDynamic::freeMap(), Astra1D_fast::freeMap(), FM3DMagnetoStaticH5Block::freeMap(), FM2DDynamic::freeMap(), FM3DH5Block_nonscale::freeMap(), FM3DH5Block::freeMap(), FM1DElectroStatic::freeMap(), FM1DElectroStatic_fast::freeMap(), FM1DMagnetoStatic::freeMap(), FM1DMagnetoStatic_fast::freeMap(), FM1DDynamic::freeMap(), FM1DDynamic_fast::freeMap(), Astra1DElectroStatic_fast::getInfo(), FM1DProfile2::getInfo(), Astra1DDynamic_fast::getInfo(), FM2DElectroStatic::getInfo(), FM2DMagnetoStatic::getInfo(), FM3DDynamic::getInfo(), Astra1DDynamic::getInfo(), FM3DMagnetoStaticExtended::getInfo(), Astra1DMagnetoStatic_fast::getInfo(), FM3DMagnetoStatic::getInfo(), Astra1DMagnetoStatic::getInfo(), Astra1DElectroStatic::getInfo(), FM3DH5Block_nonscale::getInfo(), FM3DMagnetoStaticH5Block::getInfo(), FM2DDynamic::getInfo(), FM3DH5Block::getInfo(), FM1DDynamic::getInfo(), FM1DElectroStatic_fast::getInfo(), FM1DDynamic_fast::getInfo(), FM1DMagnetoStatic::getInfo(), FM1DElectroStatic::getInfo(), FM1DMagnetoStatic_fast::getInfo(), FM1DProfile1::getInfo(), FM3DDynamic::getOnaxisEz(), Astra1DDynamic_fast::getOnaxisEz(), Astra1DDynamic::getOnaxisEz(), FM1DDynamic::getOnaxisEz(), FM1DDynamic_fast::getOnaxisEz(), interpreteWarning(), lowResolutionWarning(), missingValuesWarning(), noFieldmapWarning(), Astra1DMagnetoStatic_fast::readMap(), Astra1DElectroStatic_fast::readMap(), Astra1DElectroStatic::readMap(), FM3DMagnetoStaticExtended::readMap(), FM2DElectroStatic::readMap(), Astra1DDynamic_fast::readMap(), FM2DMagnetoStatic::readMap(), FM3DMagnetoStatic::readMap(), Astra1DMagnetoStatic::readMap(), FM1DProfile2::readMap(), Astra1DDynamic::readMap(), FM3DDynamic::readMap(), FM3DMagnetoStaticH5Block::readMap(), FM2DDynamic::readMap(), FM3DH5Block_nonscale::readMap(), FM1DElectroStatic_fast::readMap(), FM1DElectroStatic::readMap(), FM1DMagnetoStatic::readMap(), FM1DMagnetoStatic_fast::readMap(), FM3DH5Block::readMap(), FM1DDynamic_fast::readMap(), FM1DDynamic::readMap(), FM1DProfile1::readMap(), and write3DField().

int Fieldmap::lines_read_m
protected
bool Fieldmap::normalize_m
protected
MapType Fieldmap::Type
protected

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