28#ifndef ENDFIELDMODEL_ENDFIELDMODEL_H_
29#define ENDFIELDMODEL_ENDFIELDMODEL_H_
44 virtual std::ostream&
print(std::ostream& out)
const = 0;
78 virtual void rescale(
double scaleFactor) = 0;
105 static std::string
getName(std::shared_ptr<EndFieldModel> efm);
108 static std::map<std::string, std::shared_ptr<EndFieldModel> >
efm_map;
112 (std::vector< std::vector<int> >
vec);
115bool GreaterThan(std::vector<int> v1, std::vector<int> v2);
133template <
class TEMP_ITER>
135 TEMP_ITER b_begin, TEMP_ITER b_end);
153template <
class TEMP_ITER>
155 TEMP_ITER b_begin, TEMP_ITER b_end);
157template <
class TEMP_CLASS>
162template <
class TEMP_ITER>
165 TEMP_ITER a_it = a_begin;
166 TEMP_ITER b_it = b_begin;
167 while (a_it != a_end && b_it != b_end) {
168 if (*a_it != *b_it)
return false;
172 if ( a_it != a_end || b_it != b_end )
return false;
std::vector< std::vector< int > > CompactVector(std::vector< std::vector< int > > vec)
bool IterableEquality(TEMP_ITER a_begin, TEMP_ITER a_end, TEMP_ITER b_begin, TEMP_ITER b_end)
Return a == b if a and b are same size and a[i] == b[i] for all i.
bool GreaterThan(std::vector< int > v1, std::vector< int > v2)
CompactVector helper function, used for sorting.
static std::shared_ptr< EndFieldModel > getEndFieldModel(std::string name)
Look up the EndFieldModel that has a given name.
static std::string getName(std::shared_ptr< EndFieldModel > efm)
Get the name corresponding to a given EndFieldModel.
virtual void rescale(double scaleFactor)=0
Rescale the end field lengths and offsets by a factor x0.
virtual ~EndFieldModel()
Destructor.
virtual double getCentreLength() const =0
Return the nominal flat top length of the magnet.
static std::map< std::string, std::shared_ptr< EndFieldModel > > efm_map
static void setEndFieldModel(std::string name, std::shared_ptr< EndFieldModel > efm)
Add a value to the lookup table.
virtual double getEndLength() const =0
Return the nominal end field length of the magnet.
virtual void setMaximumDerivative(size_t n)=0
Set the maximum derivative that will be required to be calculated.
virtual double function(double x, int n) const =0
Return the value of the function or its n^th derivative.
virtual EndFieldModel * clone() const =0
Inheritable copy constructor - returns a deep copy of the EndFieldModel.
virtual std::ostream & print(std::ostream &out) const =0
Stream a human readable description of the end field model to out.