tension_spline.cpp
Go to the documentation of this file.
1 
13 /*****************************************************************************
14 ** Includes
15 *****************************************************************************/
16 
17 #include "../../include/ecl/geometry/tension_spline.hpp"
18 
19 /*****************************************************************************
20 ** Namespaces
21 *****************************************************************************/
22 
23 namespace ecl {
24 
25 /*****************************************************************************
26 ** Implementation
27 *****************************************************************************/
28 
29 double TensionSpline::operator()(const double &x) const {
30  ecl_assert_throw( ( ( x >= discretised_domain.front() ) && ( x <= discretised_domain.back() ) ), StandardException(LOC,OutOfRangeError) );
31  int index = 0;
32  while ( x > discretised_domain[index+1] ) {
33  ++index;
34  }
35  return functions[index](tension,x);
36 }
37 
38 double TensionSpline::derivative(const double &x) const {
39  ecl_assert_throw( ( ( x >= discretised_domain.front() ) && ( x <= discretised_domain.back() ) ), StandardException(LOC,OutOfRangeError) );
40  int index = 0;
41  while ( x > discretised_domain[index+1] ) {
42  ++index;
43  }
44  return functions[index].derivative(tension,x);
45 }
46 
47 double TensionSpline::dderivative(const double &x) const {
48  ecl_assert_throw( ( ( x >= discretised_domain.front() ) && ( x <= discretised_domain.back() ) ), StandardException(LOC,OutOfRangeError) );
49  int index = 0;
50  while ( x > discretised_domain[index+1] ) {
51  ++index;
52  }
53  return functions[index].dderivative(tension,x);
54 }
55 
56 } // namespace ecl
ecl::TensionSpline::operator()
double operator()(const double &x) const
Spline function.
Definition: tension_spline.cpp:33
ecl::TensionSpline::discretised_domain
Array< double > discretised_domain
Definition: tension_spline.hpp:216
ecl::TensionSpline::derivative
double derivative(const double &x) const
Spline derivative.
Definition: tension_spline.cpp:42
LOC
#define LOC
ecl::TensionSpline::functions
Array< TensionFunction > functions
Definition: tension_spline.hpp:217
ecl::TensionSpline::tension
double tension
Definition: tension_spline.hpp:218
ecl::Array::back
reference back()
ecl::Array::front
reference front()
ecl_assert_throw
#define ecl_assert_throw(expression, exception)
ecl::TensionSpline::dderivative
double dderivative(const double &x) const
Spline second derivative.
Definition: tension_spline.cpp:51
ecl::OutOfRangeError
OutOfRangeError
ecl
Embedded control libraries.


ecl_geometry
Author(s): Daniel Stonier
autogenerated on Wed Mar 2 2022 00:16:39