1 #ifndef CLASSIC_FIELDMAP_HH
2 #define CLASSIC_FIELDMAP_HH
4 #define READ_BUFFER_LENGTH 256
12 #include "gsl/gsl_interp.h"
13 #include "gsl/gsl_spline.h"
70 static void readMap(std::string Filename);
71 static void freeMap(std::string Filename);
73 static std::string
typeset_msg(
const std::string &msg,
const std::string &title);
79 virtual void getFieldDimensions(
double &xIni,
double &xFinal,
double &yIni,
double &yFinal,
double &zIni,
double &zFinal)
const = 0;
80 virtual void swap() = 0;
84 virtual void setEdgeConstants(
const double &bendAngle,
const double &entranceAngle,
const double &exitAngle);
88 std::vector<double> &engeCoeffsExit);
90 double &entranceParameter2,
91 double &entranceParameter3);
93 double &exitParameter2,
94 double &exitParameter3);
100 virtual void getOnaxisEz(std::vector<std::pair<double, double> > & onaxis);
122 void getLine(std::ifstream & in, std::string & buffer) {
126 static void getLine(std::ifstream &in,
int &lines_read, std::string &buffer);
129 bool interpretLine(std::ifstream &in, S &value,
const bool &file_length_known =
true);
130 template<
class S,
class T>
131 bool interpretLine(std::ifstream &in, S &value1,
T &value2,
const bool &file_length_known =
true);
132 template<
class S,
class T,
class U>
133 bool interpretLine(std::ifstream &in, S &value1,
T &value2, U &value3,
const bool &file_length_known =
true);
134 template<
class S,
class T,
class U,
class V>
135 bool interpretLine(std::ifstream &in, S &value1,
T &value2, U &value3, V &value4,
const bool &file_length_known =
true);
137 bool interpretLine(std::ifstream &in, S &value1, S &value2, S &value3, S &value4, S &value5, S &value6,
const bool &file_length_known =
true);
142 const bool &read_all,
143 const std::string &error_msg,
144 const std::string &found);
153 void checkMap(
unsigned int accuracy,
154 std::pair<double, double> fieldDimensions,
156 const std::vector<double> &fourierCoefficients,
157 gsl_spline *splineCoefficients,
158 gsl_interp_accel *splineAccelerator);
160 void checkMap(
unsigned int accuracy,
162 const std::vector<double> &zSampling,
163 const std::vector<double> &fourierCoefficients,
164 gsl_spline *splineCoefficients,
165 gsl_interp_accel *splineAccelerator);
170 const std::pair<double, double> &xrange,
171 const std::pair<double, double> &yrange,
172 const std::pair<double, double> &zrange,
173 const std::vector<Vector_t> &ef,
174 const std::vector<Vector_t> &bf);
static void clearDictionary()
virtual void setFieldLength(const double &)
static void deleteFieldmap(std::string Filename)
virtual void setEdgeConstants(const double &bendAngle, const double &entranceAngle, const double &exitAngle)
virtual void get1DProfile1ExitParam(double &exitParameter1, double &exitParameter2, double &exitParameter3)
virtual void get1DProfile1EntranceParam(double &entranceParameter1, double &entranceParameter2, double &entranceParameter3)
void interpretWarning(const std::ios_base::iostate &state, const bool &read_all, const std::string &error_msg, const std::string &found)
static std::string typeset_msg(const std::string &msg, const std::string &title)
virtual double getFieldGap()
virtual void setFrequency(double freq)=0
static std::map< std::string, FieldmapDescription > FieldmapDictionary
static MapType readHeader(std::string Filename)
bool interpreteEOF(std::ifstream &in)
virtual bool getFieldstrength(const Vector_t &R, Vector_t &E, Vector_t &B) const =0
static char buffer_m[256]
#define READ_BUFFER_LENGTH
std::shared_ptr< _Fieldmap > Fieldmap
_Fieldmap(const std::string &filename)
virtual void get1DProfile1EngeCoeffs(std::vector< double > &engeCoeffsEntry, std::vector< double > &engeCoeffsExit)
virtual void setFieldGap(double gap)
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)
void exceedingValuesWarning()
static std::string alpha_numeric
void disableFieldmapWarning()
virtual bool getFieldDerivative(const Vector_t &R, Vector_t &E, Vector_t &B, const DiffDirection &dir) const =0
void getLine(std::ifstream &in, std::string &buffer)
virtual bool isInside(const Vector_t &) const
virtual void getInfo(Inform *msg)=0
virtual double getFrequency() const =0
virtual void getFieldDimensions(double &zBegin, double &zEnd) const =0
FieldmapDescription(MapType aType, Fieldmap aMap)
virtual void getOnaxisEz(std::vector< std::pair< double, double > > &onaxis)
static std::vector< std::string > getListFieldmapNames()
void missingValuesWarning()
void lowResolutionWarning(double squareError, double maxError)
bool interpretLine(std::ifstream &in, S &value, const bool &file_length_known=true)
void checkMap(unsigned int accuracy, std::pair< double, double > fieldDimensions, double deltaZ, const std::vector< double > &fourierCoefficients, gsl_spline *splineCoefficients, gsl_interp_accel *splineAccelerator)
static Fieldmap getFieldmap(std::string Filename, bool fast=false)