GeoModel - GeoModelCore
KVector.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/KVector.h"
8 #include "GeoGenericFunctions/FixedConstant.h"
9 #include <stdexcept>
10 namespace GeoGenfun {
11 FUNCTION_OBJECT_IMP(KVector)
12 
13 KVector::KVector(unsigned int dmsnlty, double val):
14  _dimensionality(dmsnlty),
15  _value(val)
16 {}
17 
18 KVector::KVector(const KVector & right):
19  AbsFunction(right),
20  _dimensionality(right._dimensionality),
21  _value(right._value)
22 {
23 }
24 
25 KVector::~KVector() {
26 }
27 
28 double KVector::operator() (double ) const {
29  if (_dimensionality!=1) throw std::runtime_error("GeoGenfun::KVector: dimensionality !=1") ;
30  return _value;
31 }
32 
33 double KVector::operator () (const Argument & a) const {
34 
35  if (_dimensionality!=a.dimension()) {
36  throw std::runtime_error("GeoGenfun::KVector dimensionality mismatch");
37  }
38  return _value;
39 }
40 
41 
42 
43 Derivative KVector::partial(unsigned int ) const {
44 
45  KVector vec(_dimensionality,0.0);
46  return Derivative(&vec);
47 }
48 
49 unsigned int KVector::dimensionality() const {
50  return _dimensionality;
51 }
52 
53 } // namespace GeoGenfun
Definition: Abs.h:15