GeoModel - GeoModelCore
ConstPlusFunction.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/ConstPlusFunction.h"
8 namespace GeoGenfun {
9 FUNCTION_OBJECT_IMP(ConstPlusFunction)
10 
11 ConstPlusFunction::ConstPlusFunction(double constant, const AbsFunction *arg):
12  _constant(constant),
13  _arg(arg->clone())
14 {
15 }
16 
17 ConstPlusFunction::ConstPlusFunction(const ConstPlusFunction & right) :
18 AbsFunction(right),
19 _constant(right._constant),
20 _arg(right._arg->clone())
21 {}
22 
23 unsigned int ConstPlusFunction::dimensionality() const {
24  return _arg->dimensionality();
25 }
26 
27 ConstPlusFunction::~ConstPlusFunction()
28 {
29  delete _arg;
30 }
31 
32 
33 
34 double ConstPlusFunction::operator ()(double x) const
35 {
36  return _constant + (*_arg)(x);
37 }
38 
39 
40 double ConstPlusFunction::operator ()(const Argument & x) const
41 {
42  return _constant + (*_arg)(x);
43 }
44 
45 
46 Derivative ConstPlusFunction::partial(unsigned int index) const {
47  const Derivative & d=_arg->partial(index);
48  return d;
49 }
50 
51 
52 } // namespace GeoGenfun
Definition: Abs.h:15