Planetary Orbital Evolution due to Tides
Orbital evolution of two objects experiencing tides
SumDerivatives.h
Go to the documentation of this file.
1 
9 #ifndef __SUM_DERIVATIVES_H
10 #define __SUM_DERIVATIVES_H
11 
12 #include "../Core/SharedLibraryExportMacros.h"
13 #include "../Core/Functions.h"
14 
15 namespace StellarEvolution {
16 
21  class LIB_LOCAL SumDerivatives : public FunctionDerivatives {
22  private:
24  const FunctionDerivatives *q1_deriv,
25 
27  *q2_deriv;
28 
32  public:
36  const FunctionDerivatives *derivative1,
37 
39  const FunctionDerivatives *derivative2,
40 
42  bool delete_inputs=true)
43  : q1_deriv(derivative1), q2_deriv(derivative2),
44  destroy_derivs(delete_inputs) {}
45 
47  double order(unsigned deriv_order=1) const
48  {return q1_deriv->order(deriv_order)+q2_deriv->order(deriv_order);}
49 
52  {if(destroy_derivs) {delete q1_deriv; delete q2_deriv;}}
53  }; //End SumDerivatives class declaration.
54 
55 } //End StellarEvolution namespace.
56 
57 #endif
bool destroy_derivs
Whether to delete the input derivative when the object is destroyed.
virtual double order(unsigned deriv_order=1) const =0
Derivative of the given order of the function with respect to its argument.
SumDerivatives(const FunctionDerivatives *derivative1, const FunctionDerivatives *derivative2, bool delete_inputs=true)
Create a derivative object for a sum of two quantities: q1+q2.
A class representing arbitrary order derivatives of a function.
Definition: Functions.h:66
double order(unsigned deriv_order=1) const
The deriv_order-th derivative.
const FunctionDerivatives * q2_deriv
The derivatives of the second quantity in the sum.
Derivative class for a quantity that is the sum of two other quantities.