GeoModel - GeoModelCore
FixedConstant.cpp
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 #include "GeoGenericFunctions/FixedConstant.h"
8 #include <stdexcept>
9 
10 namespace GeoGenfun {
11 FUNCTION_OBJECT_IMP(FixedConstant)
12 
13 FixedConstant::FixedConstant(double value):
14 _value(value)
15 {
16 }
17 
18 FixedConstant::FixedConstant(const FixedConstant & right):
19 AbsFunction(right), _value(right._value) {
20 }
21 
22 FixedConstant::~FixedConstant()
23 {
24 }
25 
26 double FixedConstant::operator ()(double) const
27 {
28  return _value;
29 }
30 
31 Derivative FixedConstant::partial(unsigned int index) const {
32  if (index!=0) throw std::range_error("FixedConstant: partial derivative index out of range");
33  FixedConstant fPrime(0.0);
34  return Derivative(&fPrime);
35 }
36 
37 } // namespace GeoGenfun
Definition: Abs.h:15