CLHEP VERSION Reference Documentation
   
CLHEP Home Page     CLHEP Documentation     CLHEP Bug Reports

GenericFunctions/FixedConstant.hh
Go to the documentation of this file.
1 // -*- C++ -*-
2 // $Id: FixedConstant.hh,v 1.2 2003/09/06 14:04:13 boudreau Exp $
3 //----------------------FixedConstant --------------------------------------//
4 // //
5 // Class FixedConstant //
6 // Joe Boudreau, Petar Maksimovic, Nov. 1999 //
7 // //
8 // FixedConstant allows use to treat "promote" fixed contants to constant //
9 // functions so that they automatically will inherit all the algebraic //
10 // operations we have so painstakingly defined for functions. //
11 // //
12 //--------------------------------------------------------------------------//
13 #ifndef FixedConstant_h
14 #define FixedConstant_h 1
16 
17 namespace Genfun {
18 
23  class FixedConstant : public AbsFunction {
24 
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;
40  virtual double operator ()(const Argument & a) const {return operator() (a[0]);}
41 
42  // Derivative.
43  Derivative partial (unsigned int) const;
44 
45  // Does this function have an analytic derivative?
46  virtual bool hasAnalyticDerivative() const {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 Genfun
57 #endif