34 std::string(
"The \"SPLINE_TIME_DEPENDENCE\" element defines ")+\
35 std::string(
"an array of times and corresponding values for time lookup, ")+\
36 std::string(
"for use in time-dependent elements. Lookup is supported at ")+\
37 std::string(
"first order or third order with quadratic smoothing.");
43 "SPLINE_TIME_DEPENDENCE",
46 std::string(
"Order of the lookup - either 1 for linear interpolation, ")+
47 std::string(
"or 3 for cubic interpolation with quadratic smoothing. ")+
48 std::string(
"Other values make an error."));
51 std::string(
"Array of real times in ns. There must be at least \"ORDER\"+1 ")+
52 std::string(
"elements in the array and they must be strictly monotically ")+
53 std::string(
"increasing"));
56 std::string(
"Array of real values. The length of \"VALUES\" must be the ")+
57 std::string(
"same as the length of \"TIMES\"."));
89 if ((orderReal - 1.) > 1
e-9 && (orderReal - 3.) > 1
e-9) {
91 "SPLINE_TIME_DEPENDENCE \"ORDER\" should be 1 or 3.");
93 size_t order(
floor(orderReal));
96 std::shared_ptr<SplineTimeDependence>
spline =
97 std::make_shared<SplineTimeDependence>(order,
constexpr double e
The value of .
Interface for basic beam line object.
virtual void fillRegisteredAttributes(const ElementBase &, ValueFlag)
Fill in all registered attributes.
ValueFlag
Switch for value desired on ATTLIST command.
The base class for all OPAL exceptions.
std::vector< Attribute > itsAttr
The object attributes (see Attribute.hh).
static const std::string doc_string
virtual ~OpalSplineTimeDependence()
virtual OpalSplineTimeDependence * clone(const std::string &name)
static void setTimeDependence(std::string name, std::shared_ptr< AbstractTimeDependence > time_dep)
const std::string & getOpalName() const
Return object name.
Base class for all beam line elements.
std::vector< double > getRealArray(const Attribute &attr)
Get array value.
virtual void print(std::ostream &) const
void registerOwnership() const
void fillRegisteredAttributes(const ElementBase &base, ValueFlag flag)
OpalSplineTimeDependence()
Attribute makeRealArray(const std::string &name, const std::string &help)
Create real array attribute.
void spline(double x[], double y[], int n, double y2[])
double getReal(const Attribute &attr)
Return real value.
Attribute makeReal(const std::string &name, const std::string &help)
Make real attribute.
static AttCell * registerRealAttribute(const std::string &name)
Register a ``real'' element attribute.
PETE_TUTree< FnFloor, typename T::PETE_Expr_t > floor(const PETE_Expr< T > &l)
virtual void print(std::ostream &) const
Print the object.