Gobelijn API documentation  - generated for commit a0cbea7
 All Classes Namespaces Files Functions Variables Typedefs Friends Macros Pages
OscillatoryFunctor.h
Go to the documentation of this file.
1 #pragma once
2 
9 #include "AQ_Util.h"
10 
11 #include <cmath>
12 #include <functional>
13 
14 namespace UA_CoMP {
15 namespace Num {
16 using std::cos;
17 using std::exp;
18 using std::sin;
24 class OscillatoryFunctor : public std::unary_function<double, double>
25 {
26 public:
27  using Arg = argument_type;
28  using Res = result_type;
29 
32  class Integral : public std::binary_function<Arg, Arg, Res>
33  {
34  public:
36  Integral(Arg a, Arg b) : fA(a), fB(b) {}
37 
39  result_type operator()(Arg a, Arg b) const
40  {
41  return ((exp(fA * b) * (fA * sin(fB * b) - fB * cos(fB * b)) + fB) -
42  (exp(fA * (double)a) * (fA * sin(fB * a) - fB * cos(fB * a)) + fB)) /
43  (fA * fA + fB * fB);
44  }
45 
46  private:
49  };
50 
52  OscillatoryFunctor(argument_type a, argument_type b) : fA(a), fB(b), fIntegral(a, b) {}
53 
55  result_type operator()(argument_type x) const { return exp(fA * x) * sin(fB * x); }
56 
58  Integral getIntegral() const { return fIntegral; }
59 
60 private:
61  double fA;
62  double fB;
64 };
65 
66 } // namespace Num
67 } // namespace UA_CoMP
Integral getIntegral() const
Return the analytic integral object.
OscillatoryFunctor(argument_type a, argument_type b)
Straightforward constructor.
result_type operator()(Arg a, Arg b) const
The definite integral from a to b.
Utilities for the implementation of the Adaptive Quadrature.
result_type operator()(argument_type x) const
Functor evaluation.
Integral(Arg a, Arg b)
Non-default constructor.
Nested class contains the analytic integral of the functor for testing purposes.