MathFunction.hpp
Go to the documentation of this file.
1 // Distributed under the MIT License.
2 // See LICENSE.txt for details.
3 
4 /// \file
5 /// Defines base-class MathFunction.
6 
7 #pragma once
8 
9 #include <memory>
10 
13 
14 /// \ingroup MathFunctionsGroup
15 /// Holds classes implementing MathFunction (functions \f$R^n \to R\f$).
16 namespace MathFunctions {
17 class Gaussian;
18 class PowX;
19 class Sinusoid;
20 } // namespace MathFunctions
21 
22 /*!
23  * \ingroup MathFunctionsGroup
24  * Encodes a function \f$R^n \to R\f$ where n is `VolumeDim`.
25  */
26 template <size_t VolumeDim>
28 
29 /*!
30  * \ingroup MathFunctionsGroup
31  * Partial template specialization of MathFunction which encodes a
32  * function \f$R \to R\f$.
33  */
34 template <>
35 class MathFunction<1> : public PUP::able {
36  public:
37  using creatable_classes =
40 
42 
43  MathFunction() = default;
44  MathFunction(const MathFunction& /*rhs*/) = delete;
45  MathFunction& operator=(const MathFunction& /*rhs*/) = delete;
46  MathFunction(MathFunction&& /*rhs*/) noexcept = default;
47  MathFunction& operator=(MathFunction&& /*rhs*/) noexcept = default;
48  ~MathFunction() override = default;
49 
50  //@{
51  /// Returns the function value at the coordinate 'x'.
52  virtual double operator()(const double& x) const noexcept = 0;
53  virtual DataVector operator()(const DataVector& x) const noexcept = 0;
54  //@}
55 
56  //@{
57  /// Returns the first derivative at 'x'.
58  virtual double first_deriv(const double& x) const noexcept = 0;
59  virtual DataVector first_deriv(const DataVector& x) const noexcept = 0;
60  //@}
61 
62  //@{
63  /// Returns the second derivative at 'x'.
64  virtual double second_deriv(const double& x) const noexcept = 0;
65  virtual DataVector second_deriv(const DataVector& x) const noexcept = 0;
66  //@}
67 
68  //@{
69  /// Returns the third derivative at 'x'.
70  virtual double third_deriv(const double& x) const noexcept = 0;
71  virtual DataVector third_deriv(const DataVector& x) const noexcept = 0;
72  //@}
73 };
74 
Defines MathFunctions::Gaussian.
Gaussian .
Definition: Gaussian.hpp:28
Definition: MathFunction.hpp:27
Defines macros to allow serialization of abstract template base classes.
Defines MathFunctions::Sinusoid.
Sinusoid .
Definition: Sinusoid.hpp:28
Holds classes implementing MathFunction (functions ).
Definition: Gaussian.cpp:11
Power of X .
Definition: PowX.hpp:26
Defines classes for Tensor.
#define WRAPPED_PUPable_abstract(className)
Wraps the Charm++ macro, see the Charm++ documentation.
Definition: CharmPupable.hpp:39
Stores a collection of function values.
Definition: DataVector.hpp:46
Defines MathFunctions::PowX.