GeoModel - GeoModelCore
FixedConstant.h
1 //==========================================================================//
2 // Imported from the QAT library (qat.pitt.edu) by the copyright holder //
3 // Joe Boudreau. Software licensed under the terms and conditions of the //
4 // GNU Lesser Public License v3. //
5 //==========================================================================//
6 
7 //----------------------FixedConstant --------------------------------------//
8 // //
9 // Class FixedConstant //
10 // //
11 // FixedConstant allows use to treat "promote" fixed contants to constant //
12 // functions so that they automatically will inherit all the algebraic //
13 // operations we have so painstakingly defined for functions. //
14 // //
15 //--------------------------------------------------------------------------//
16 #ifndef FixedConstant_h
17 #define FixedConstant_h 1
18 
19 #include "GeoGenericFunctions/AbsFunction.h"
20 
21 namespace GeoGenfun {
22 
23  class FixedConstant : public AbsFunction {
24 
25  FUNCTION_OBJECT_DEF(FixedConstant)
26 
27  public:
28 
29  // Constructor
30  FixedConstant(double value);
31 
32  // Copy constructor
33  FixedConstant(const FixedConstant &right);
34 
35  // Destructor
36  virtual ~FixedConstant();
37 
38  // Retrieve function value
39  virtual double operator ()(double argument) const override;
40  virtual double operator ()(const Argument & a) const override {return operator() (a[0]);}
41 
42  // Derivative.
43  virtual Derivative partial (unsigned int) const override;
44 
45  // Does this function have an analytic derivative?
46  virtual bool hasAnalyticDerivative() const override {return true;}
47 
48  private:
49 
50  // It is illegal to assign a fixed constant
51  const FixedConstant & operator=(const FixedConstant &right);
52 
53  // The value of the constant:
54  double _value;
55  };
56 } // namespace GeoGenfun
57 #endif
Definition: Abs.h:15