![]() |
ALMaSS
1.2 (after EcoStack, March 2024)
The Animal, Landscape and Man Simulation System
|
Provides a flexible curve class which provides a quick way to calculate return values for any given x-vale with a resolution of 10,000 units on the x-axis. More...
#include <CurveClasses.h>
Public Member Functions | |
CurveClass (bool a_reversecurve, double a_MaxX, double a_MinX, const char *a_name) | |
virtual | ~CurveClass () |
virtual double | GetY (double a_X) |
virtual void | WriteDataFile (int a_step) |
Protected Member Functions | |
virtual void | CalculateCurveValues () |
fills in the curve for 10,000 values from MinX to MaxX More... | |
virtual double | DoCalc (double) |
The specific calulation of y for a given x. More... | |
Protected Attributes | |
double | m_parameterMaxX |
A parameter for a the maximum value of X we consider. More... | |
double | m_parameterMinX |
A parameter for a the minimum value of X we consider. More... | |
double | m_step |
The size of each step on the X-axis. More... | |
double | m_step_inv |
The inverse of m_step. More... | |
double * | m_values |
The values of y we store for each X. More... | |
string | m_name |
A scaler for the x-values. More... | |
bool | m_reversecurve |
If true the values fall from 1 to zero, otherwise its zero to 1. More... | |
Provides a flexible curve class which provides a quick way to calculate return values for any given x-vale with a resolution of 10,000 units on the x-axis.
CurveClass::CurveClass | ( | bool | a_reversecurve, |
double | a_MaxX, | ||
double | a_MinX, | ||
const char * | a_name | ||
) |
Make space for the y-values.
|
virtual |
|
protectedvirtual |
fills in the curve for 10,000 values from MinX to MaxX
We set m_step to be the size of each step on the X-axis, assuming 10000 steps over the range minX to maxX.
Calculate the value based on the input paramters.
Referenced by GompertzCurveClass::GompertzCurveClass(), HollingsDiscCurveClass::HollingsDiscCurveClass(), PettiforFeedingTimeCurveClass::PettiforFeedingTimeCurveClass(), Polynomial2CurveClass::Polynomial2CurveClass(), and ThresholdCurveClass::ThresholdCurveClass().
|
inlineprotectedvirtual |
The specific calulation of y for a given x.
Reimplemented in PettiforFeedingTimeCurveClass, HollingsDiscCurveClass, ThresholdCurveClass, Polynomial2CurveClass, and GompertzCurveClass.
|
virtual |
This is the time sensitive method so we avoid division, rather use multiplication by the inverse of m_step. Here we have a choice if a_X is bigger than maxX - either return the value for maxX or return parameter A (asymptote)
If a_X is <= minX then we need to return minX
Otherwise we have to calculate which index is closest to a_X
Find and return the correct Y-value
Referenced by Landscape::SupplyGooseGrazingForageH().
|
virtual |
Opens a stream file and outputs every a_step data points as x & y, tab separated.
Referenced by Landscape::Landscape().
|
protected |
A scaler for the x-values.
A name to identify the curve
|
protected |
A parameter for a the maximum value of X we consider.
|
protected |
A parameter for a the minimum value of X we consider.
|
protected |
If true the values fall from 1 to zero, otherwise its zero to 1.
|
protected |
The size of each step on the X-axis.
|
protected |
The inverse of m_step.
|
protected |
The values of y we store for each X.