GeoModel - GeoModelCore
Variable.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 //----------------------X------------ --------------------------------------//
8 // //
9 // Class Variable //
10 // //
11 // Variable is a function that returns the variable itself. Dimensionality //
12 // is specified in the constructor; if it is greater than one (default) //
13 // it means that the variable is part of a vector. Which part is specified //
14 // by the "selection index" argument to the constructor. //
15 // //
16 // //
17 //--------------------------------------------------------------------------//
18 #ifndef Variable_h
19 #define Variable_h 1
20 #include "GeoGenericFunctions/AbsFunction.h"
21 namespace GeoGenfun {
22 
23  class Variable : public AbsFunction {
24 
25  FUNCTION_OBJECT_DEF(Variable)
26 
27  public:
28 
29  // Constructor
30  Variable(unsigned int selectionIndex=0,
31  unsigned int dimensionality=1);
32 
33  // Copy constructor
34  Variable(const Variable &right);
35 
36  // Destructor
37  virtual ~Variable();
38 
39  // Retrieve function value
40  virtual double operator ()(double argument) const override;
41  virtual double operator ()(const Argument & a) const override;
42 
43  // Get the dimensionality, as specified in the constructor:
44  virtual unsigned int dimensionality() const override;
45 
46  // Get the selectionIndex:
47  unsigned int index() const;
48 
49  // Derivative.
50  virtual Derivative partial (unsigned int) const override;
51 
52  // Does this function have an analytic derivative?
53  virtual bool hasAnalyticDerivative() const override {return true;}
54 
55  private:
56 
57  // It is illegal to assign a fixed constant
58  const Variable & operator=(const Variable &right);
59 
60  // The selection index is used to select a particular element from
61  // the argument. By default it is zero.....
62  unsigned int _selectionIndex;
63 
64  // The dimensionality, length of the argument list:
65  unsigned int _dimensionality;
66 
67  };
68 
69 } // namespace GeoGenfun
70 #endif
Definition: Abs.h:15