1 #ifndef CLASSIC_FIELDMAP_HH
2 #define CLASSIC_FIELDMAP_HH
4 #define READ_BUFFER_LENGTH 256
11 #include "gsl/gsl_interp.h"
12 #include "gsl/gsl_spline.h"
69 static void readMap(std::string Filename);
70 static void freeMap(std::string Filename);
72 static std::string
typeset_msg(
const std::string &msg,
const std::string &title);
76 virtual void getFieldDimensions(
double &zBegin,
double &zEnd,
double &rBegin,
double &rEnd)
const = 0;
77 virtual void getFieldDimensions(
double &xIni,
double &xFinal,
double &yIni,
double &yFinal,
double &zIni,
double &zFinal)
const = 0;
78 virtual void swap() = 0;
82 virtual void setEdgeConstants(
const double &bendAngle,
const double &entranceAngle,
const double &exitAngle);
86 std::vector<double> &engeCoeffsExit);
88 double &entranceParameter2,
89 double &entranceParameter3);
91 double &exitParameter2,
92 double &exitParameter3);
98 virtual void getOnaxisEz(std::vector<std::pair<double, double> > & onaxis);
106 Fieldmap(
const std::string &aFilename);
114 void getLine(std::ifstream &in, std::string &buffer);
115 static void getLine(std::ifstream &in,
int &lines_read, std::string &buffer);
117 bool interpreteLine(std::ifstream &in, S &value,
const bool &file_length_known =
true);
118 template<
class S,
class T>
119 bool interpreteLine(std::ifstream &in, S &value1,
T &value2,
const bool &file_length_known =
true);
120 template<
class S,
class T,
class U>
121 bool interpreteLine(std::ifstream &in, S &value1,
T &value2, U &value3,
const bool &file_length_known =
true);
122 template<
class S,
class T,
class U,
class V>
123 bool interpreteLine(std::ifstream &in, S &value1,
T &value2, U &value3, V &value4,
const bool &file_length_known =
true);
125 bool interpreteLine(std::ifstream &in, S &value1, S &value2, S &value3, S &value4, S &value5, S &value6,
const bool &file_length_known =
true);
129 void interpreteWarning(
const std::string &error_msg,
const std::string &expecting,
const std::string &found);
131 const bool &read_all,
132 const std::string &error_msg,
133 const std::string &found);
142 void checkMap(
unsigned int accuracy,
143 std::pair<double, double> fieldDimensions,
145 const std::vector<double> &fourierCoefficients,
146 gsl_spline *splineCoefficients,
147 gsl_interp_accel *splineAccelerator);
149 void checkMap(
unsigned int accuracy,
151 const std::vector<double> &zSampling,
152 const std::vector<double> &fourierCoefficients,
153 gsl_spline *splineCoefficients,
154 gsl_interp_accel *splineAccelerator);
159 const std::pair<double, double> &xrange,
160 const std::pair<double, double> &yrange,
161 const std::pair<double, double> &zrange,
162 const std::vector<Vector_t> &ef,
163 const std::vector<Vector_t> &bf);
192 Filename_m(aFilename),
virtual void getInfo(Inform *msg)=0
static void clearDictionary()
static MapType readHeader(std::string Filename)
virtual void getOnaxisEz(std::vector< std::pair< double, double > > &onaxis)
virtual double getFieldGap()
virtual bool isInside(const Vector_t &r) const
void disableFieldmapWarning()
virtual void getFieldDimensions(double &zBegin, double &zEnd, double &rBegin, double &rEnd) const =0
FieldmapDescription(MapType aType, Fieldmap *aMap)
static std::string typeset_msg(const std::string &msg, const std::string &title)
static Fieldmap * getFieldmap(std::string Filename, bool fast=false)
static void deleteFieldmap(std::string Filename)
Fieldmap(const std::string &aFilename)
virtual bool getFieldstrength(const Vector_t &R, Vector_t &E, Vector_t &B) const =0
virtual void setFrequency(double freq)=0
static char buffer_m[256]
void missingValuesWarning()
virtual void setFieldGap(double gap)
static std::map< std::string, FieldmapDescription > FieldmapDictionary
bool interpreteEOF(std::ifstream &in)
virtual void setFieldLength(const double &)
virtual void get1DProfile1EntranceParam(double &entranceParameter1, double &entranceParameter2, double &entranceParameter3)
virtual double getFrequency() const =0
void interpreteWarning(const std::string &error_msg, const std::string &expecting, const std::string &found)
virtual void get1DProfile1EngeCoeffs(std::vector< double > &engeCoeffsEntry, std::vector< double > &engeCoeffsExit)
bool interpreteLine(std::ifstream &in, S &value, const bool &file_length_known=true)
static std::vector< std::string > getListFieldmapNames()
virtual void setEdgeConstants(const double &bendAngle, const double &entranceAngle, const double &exitAngle)
static std::string alpha_numeric
void getLine(std::ifstream &in, std::string &buffer)
void exceedingValuesWarning()
void checkMap(unsigned int accuracy, std::pair< double, double > fieldDimensions, double deltaZ, const std::vector< double > &fourierCoefficients, gsl_spline *splineCoefficients, gsl_interp_accel *splineAccelerator)
virtual bool getFieldDerivative(const Vector_t &R, Vector_t &E, Vector_t &B, const DiffDirection &dir) const =0
void lowResolutionWarning(double squareError, double maxError)
#define READ_BUFFER_LENGTH
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)
virtual void get1DProfile1ExitParam(double &exitParameter1, double &exitParameter2, double &exitParameter3)