9 #ifndef __SUM_QUANTITY_H 10 #define __SUM_QUANTITY_H 12 #include "../Core/SharedLibraryExportMacros.h" 32 bool delete_inputs=
false)
33 : q1(quantity1), q2(quantity2), destroy_qs(delete_inputs) {}
38 q1->select_interpolation_region(age);
39 q2->select_interpolation_region(age);
44 {
return (*q1)(age)+(*q2)(age);}
60 {
return std::min(q1->next_discontinuity(), q2->next_discontinuity());}
65 if(q1->next_discontinuity() == q2->next_discontinuity()) {
66 q1->enable_next_interpolation_region();
67 q2->enable_next_interpolation_region();
68 }
else if(q1->next_discontinuity() < q2->next_discontinuity())
69 q1->enable_next_interpolation_region();
71 q2->enable_next_interpolation_region();
78 "Called EvolvingStellarQuantity::crossings, which are ill " 85 {
if(destroy_qs) {
delete q1;
delete q2;}}
double range_low() const
The smallest age for which the quantity can be interpolated.
EvolvingStellarQuantity * q1
This quantity will be q1+q2.
brief The smallest age for which the quantity can be interpolated in virtual Gyr double range_low() const
The upper end of the range over which the function is defined.
InterpSolutionIterator crossings(double=0) const
An iterator over the ages where the quantity takes the given y value.
Declares a class implementing the intepolation of a single stellar quantity from stellar evolution tr...
The largest age for which the quantity can be interpolated in virtual Gyr double range_high() const
The lower end of the range over which the function is defined.
double range_high() const
The largest age for which the quantity can be interpolated.
void enable_next_interpolation_region() const
See EvolvingStellarQuantity::enable_next_interpolation_region.
A class for stellar properties that depend on age.
An iterator over a set of solutions to an interpolating function.
bool destroy_qs
Whether to destroy the input quantities on destruction.
double operator()(double age) const
Return the value the quantity takes at the given age.
double next_discontinuity() const
See EvolvingStellarQuantity::next_discontinuity.
A class representing arbitrary order derivatives of a function.
Return the age derivative of the quantity at the given age in virtual Gyr const FunctionDerivatives * deriv(double age) const
Returns a pointer to the derivative of the function.
virtual void select_interpolation_region(double age) const
See EvolvingStellarQuantity::select_interpolation_region.
A clas for stellar quantities that are the sum of two other quantities.
const FunctionDerivatives * deriv(double age) const
Return the age derivative of the quantity at the given age.
SumQuantity(EvolvingStellarQuantity *quantity1, EvolvingStellarQuantity *quantity2, bool delete_inputs=false)
Create a quantity that is (*quantity1)-(*quantity2)
Derivative class for a quantity that is the sum of two other quantities.