OPAL (Object Oriented Parallel Accelerator Library) 2022.1
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) 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)
 

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 ()=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

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, FieldmapDescriptionFieldmapDictionary = std::map<std::string, Fieldmap::FieldmapDescription>()
 

Detailed Description

Definition at line 60 of file Fieldmap.h.

Constructor & Destructor Documentation

◆ Fieldmap() [1/2]

Fieldmap::Fieldmap ( )
protecteddelete

◆ Fieldmap() [2/2]

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

Definition at line 109 of file Fieldmap.h.

◆ ~Fieldmap()

virtual Fieldmap::~Fieldmap ( )
inlineprotectedvirtual

Definition at line 114 of file Fieldmap.h.

Member Function Documentation

◆ checkMap() [1/2]

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

◆ checkMap() [2/2]

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

◆ clearDictionary()

void Fieldmap::clearDictionary ( )
static

Definition at line 275 of file Fieldmap.cpp.

References FieldmapDictionary.

Referenced by opalMain(), and run_opal().

◆ deleteFieldmap()

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

Definition at line 271 of file Fieldmap.cpp.

References freeMap().

Here is the call graph for this function:

◆ disableFieldmapWarning()

void Fieldmap::disableFieldmapWarning ( )
protected

◆ exceedingValuesWarning()

void Fieldmap::exceedingValuesWarning ( )
protected

Definition at line 603 of file Fieldmap.cpp.

References Filename_m, and lines_read_m.

Referenced by interpreteEOF().

◆ freeMap() [1/2]

virtual void Fieldmap::freeMap ( )
pure virtual

◆ freeMap() [2/2]

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

Definition at line 433 of file Fieldmap.cpp.

References FieldmapDictionary.

◆ get1DProfile1EngeCoeffs()

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

Reimplemented in FM1DProfile1.

Definition at line 712 of file Fieldmap.cpp.

Referenced by Bend2D::readFieldMap().

◆ get1DProfile1EntranceParam()

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

Reimplemented in FM1DProfile1.

Definition at line 717 of file Fieldmap.cpp.

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

◆ get1DProfile1ExitParam()

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

Reimplemented in FM1DProfile1.

Definition at line 723 of file Fieldmap.cpp.

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

◆ getFieldDerivative()

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

◆ getFieldDimensions() [1/2]

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

◆ getFieldDimensions() [2/2]

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

◆ getFieldGap()

double Fieldmap::getFieldGap ( )
virtual

Reimplemented in FM1DProfile1.

Definition at line 729 of file Fieldmap.cpp.

Referenced by Bend2D::setGapFromFieldMap().

◆ getFieldmap()

Fieldmap * Fieldmap::getFieldmap ( std::string  Filename,
bool  fast = false 
)
static

◆ getFieldstrength()

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

◆ getFrequency()

virtual double Fieldmap::getFrequency ( ) const
pure virtual

◆ getInfo()

virtual void Fieldmap::getInfo ( Inform msg)
pure virtual

◆ getLine() [1/2]

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

Definition at line 536 of file Fieldmap.cpp.

References alpha_numeric, buffer_m, and READ_BUFFER_LENGTH.

◆ getLine() [2/2]

void Fieldmap::getLine ( std::ifstream &  in,
std::string &  buffer 
)
inlineprotected

◆ getListFieldmapNames()

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

Definition at line 263 of file Fieldmap.cpp.

References FieldmapDictionary.

◆ getOnaxisEz()

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

◆ getType()

MapType Fieldmap::getType ( )
inline

Definition at line 97 of file Fieldmap.h.

References Type.

◆ interpreteEOF()

bool Fieldmap::interpreteEOF ( std::ifstream &  in)
protected

◆ interpretLine() [1/6]

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

◆ interpretLine() [2/6]

template<class S >
bool Fieldmap::interpretLine ( 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(), interpretWarning(), and missingValuesWarning().

Here is the call graph for this function:

◆ interpretLine() [3/6]

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

Definition at line 39 of file Fieldmap.hpp.

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

Here is the call graph for this function:

◆ interpretLine() [4/6]

template<class S , class T , class U >
bool Fieldmap::interpretLine ( 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(), interpretWarning(), and missingValuesWarning().

Here is the call graph for this function:

◆ interpretLine() [5/6]

template<class S , class T , class U , class V >
bool Fieldmap::interpretLine ( 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(), interpretWarning(), and missingValuesWarning().

Here is the call graph for this function:

◆ interpretLine() [6/6]

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

Definition at line 12 of file Fieldmap.hpp.

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

Here is the call graph for this function:

◆ interpretWarning()

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

Definition at line 574 of file Fieldmap.cpp.

References endl(), Filename_m, and lines_read_m.

Referenced by interpretLine().

Here is the call graph for this function:

◆ isInside()

virtual bool Fieldmap::isInside ( const Vector_t ) const
inlinevirtual

◆ lowResolutionWarning()

void Fieldmap::lowResolutionWarning ( double  squareError,
double  maxError 
)
protected

Definition at line 629 of file Fieldmap.cpp.

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

Referenced by checkMap().

Here is the call graph for this function:

◆ missingValuesWarning()

void Fieldmap::missingValuesWarning ( )
protected

Definition at line 593 of file Fieldmap.cpp.

References Filename_m, and lines_read_m.

Referenced by interpretLine().

◆ noFieldmapWarning()

void Fieldmap::noFieldmapWarning ( )
protected

◆ readHeader()

MapType Fieldmap::readHeader ( std::string  Filename)
static

◆ readMap() [1/2]

virtual void Fieldmap::readMap ( )
pure virtual

◆ readMap() [2/2]

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

◆ setEdgeConstants()

void Fieldmap::setEdgeConstants ( const double &  bendAngle,
const double &  entranceAngle,
const double &  exitAngle 
)
virtual

Reimplemented in FM1DProfile2.

Definition at line 530 of file Fieldmap.cpp.

◆ setFieldGap()

void Fieldmap::setFieldGap ( double  gap)
virtual

Reimplemented in FM1DProfile1.

Definition at line 733 of file Fieldmap.cpp.

◆ setFieldLength()

void Fieldmap::setFieldLength ( const double &  )
virtual

Definition at line 533 of file Fieldmap.cpp.

◆ setFrequency()

virtual void Fieldmap::setFrequency ( double  freq)
pure virtual

◆ swap()

virtual void Fieldmap::swap ( )
pure virtual

◆ typeset_msg()

std::string Fieldmap::typeset_msg ( const std::string &  msg,
const std::string &  title 
)
static

Definition at line 652 of file Fieldmap.cpp.

References Physics::c.

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

◆ write3DField()

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 737 of file Fieldmap.cpp.

References Util::combineFilePath(), endl(), Filename_m, OpalData::getAuxiliaryOutputDirectory(), OpalData::getInstance(), IpplInfo::myNode(), and PAssert.

Referenced by FM3DDynamic::readMap().

Here is the call graph for this function:

Member Data Documentation

◆ alpha_numeric

std::string Fieldmap::alpha_numeric
staticprivate

Definition at line 182 of file Fieldmap.h.

Referenced by getLine(), and interpreteEOF().

◆ buffer_m

char Fieldmap::buffer_m
staticprivate

Definition at line 181 of file Fieldmap.h.

Referenced by getLine(), and interpreteEOF().

◆ FieldmapDictionary

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

Definition at line 197 of file Fieldmap.h.

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

◆ Filename_m

std::string Fieldmap::Filename_m
protected

Definition at line 117 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(), FM3DH5BlockBase::closeFile(), 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(), Astra1D_fast::freeMap(), Astra1DDynamic::freeMap(), Astra1DElectroStatic::freeMap(), Astra1DMagnetoStatic::freeMap(), FM1DDynamic::freeMap(), FM1DDynamic_fast::freeMap(), FM1DElectroStatic::freeMap(), FM1DElectroStatic_fast::freeMap(), FM1DMagnetoStatic::freeMap(), FM1DMagnetoStatic_fast::freeMap(), FM1DProfile2::freeMap(), FM2DDynamic::freeMap(), FM2DElectroStatic::freeMap(), FM2DMagnetoStatic::freeMap(), FM3DDynamic::freeMap(), FM3DH5Block::freeMap(), FM3DH5Block_nonscale::freeMap(), FM3DMagnetoStatic::freeMap(), FM3DMagnetoStaticExtended::freeMap(), FM3DMagnetoStaticH5Block::freeMap(), FM3DH5BlockBase::getFieldInfo(), Astra1DDynamic::getInfo(), Astra1DDynamic_fast::getInfo(), Astra1DElectroStatic::getInfo(), Astra1DElectroStatic_fast::getInfo(), Astra1DMagnetoStatic::getInfo(), Astra1DMagnetoStatic_fast::getInfo(), FM1DDynamic::getInfo(), FM1DDynamic_fast::getInfo(), FM1DElectroStatic::getInfo(), FM1DElectroStatic_fast::getInfo(), FM1DMagnetoStatic::getInfo(), FM1DMagnetoStatic_fast::getInfo(), FM1DProfile1::getInfo(), FM1DProfile2::getInfo(), FM2DDynamic::getInfo(), FM2DElectroStatic::getInfo(), FM2DMagnetoStatic::getInfo(), FM3DDynamic::getInfo(), FM3DH5BlockBase::getInfo(), FM3DMagnetoStatic::getInfo(), FM3DMagnetoStaticExtended::getInfo(), FM3DH5BlockBase::getNumSteps(), FM1DDynamic::getOnaxisEz(), FM1DDynamic_fast::getOnaxisEz(), Astra1DDynamic::getOnaxisEz(), Astra1DDynamic_fast::getOnaxisEz(), FM3DDynamic::getOnaxisEz(), FM3DH5BlockBase::getResonanceFrequency(), interpretWarning(), lowResolutionWarning(), missingValuesWarning(), noFieldmapWarning(), FM3DH5BlockBase::readField(), Astra1DDynamic::readMap(), Astra1DDynamic_fast::readMap(), Astra1DElectroStatic::readMap(), Astra1DElectroStatic_fast::readMap(), Astra1DMagnetoStatic::readMap(), Astra1DMagnetoStatic_fast::readMap(), FM1DDynamic::readMap(), FM1DDynamic_fast::readMap(), FM1DElectroStatic::readMap(), FM1DElectroStatic_fast::readMap(), FM1DMagnetoStatic::readMap(), FM1DMagnetoStatic_fast::readMap(), FM1DProfile1::readMap(), FM1DProfile2::readMap(), FM2DDynamic::readMap(), FM2DElectroStatic::readMap(), FM2DMagnetoStatic::readMap(), FM3DDynamic::readMap(), FM3DH5Block::readMap(), FM3DH5Block_nonscale::readMap(), FM3DMagnetoStatic::readMap(), FM3DMagnetoStaticExtended::readMap(), FM3DMagnetoStaticH5Block::readMap(), FM3DH5BlockBase::setStep(), and write3DField().

◆ lines_read_m

int Fieldmap::lines_read_m
protected

◆ normalize_m

bool Fieldmap::normalize_m
protected

◆ Type

MapType Fieldmap::Type
protected

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