-
Notifications
You must be signed in to change notification settings - Fork 5
/
ST_mortality.h
124 lines (109 loc) · 4.03 KB
/
ST_mortality.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
/**
* \file ST_mortality.h
* \brief Functions and variables exported from the \ref MORTALITY module.
*
* \author Chandler Haukap
* \date February 12 2020
* \ingroup MORTALITY
*/
#ifndef MORTALITY_H
#define MORTALITY_H
#include "sw_src/include/generic.h"
#include "sw_src/include/SW_Defines.h"
/* --------------------------- Exported Structs ---------------------------- */
/**
* \brief Information used when simulating the cheatgrass-wildfire loop.
*
* The biggest determinant in cheatgrass driven wildfire is precipitation,
* specifically precipitation in Spring and Winter. This struct stores the
* values from previous Spring and Winter precipitation as well as the running
* averages of both.
*
* Note that "year" in this context refers to the water year, which runs from
* October to September.
*
* \sa _updateCheatgrassPrecip, where this struct is updated each year.
* \author Chandler Haukap
* \date 13 January 2020
* \ingroup MORTALITY
*/
typedef struct CheatgrassPrecip_st {
/** \brief The Spring precipitation in the previous 3 years.
* The array is indexed from newest to oldest, meaning prevSpring[0] is the
* most recent value. */
double prevSprings[3];
/** \brief The precipitation in the last Winter, meaning the Oct-Dec
* precipitation from 2 years ago and the Jan-Mar precipitation from last
* year. */
double lastWinter;
/** \brief The current year's Spring precipitation. */
double currentSpring;
/** \brief The running average of Spring precipitation. */
double springMean;
/** \brief The running average of Winter precipitation. */
double winterMean;
/** \brief The sum of October - December precipitation information from last
* year.
*
* The variable we use to get precipitation information, \ref SXW, stores
* values for the current year, but we need the values from 2 years ago to
* calculate last year's winter precipitation. We therefore store it here,
* even though it does make the struct a little more confusing.
*/
double lastOctThruDec;
/** \brief The sum of October - December precipitation information from the
* current year.
*
* The variable we use to get precipitation information, \ref SXW, stores
* values for the current year, but we need the values from 2 years ago to
* calculate last year's winter precipitation. We therefore store it here,
* even though it does make the struct a little more confusing.
*/
double thisOctThruDec;
/** \brief The sum of January - March precipitation information from last
* year.
*
* The variable we use to get precipitation information, \ref SXW, stores
* values for the current year, but we need the values from 1 year ago to
* calculate last year's winter precipitation. We therefore store it here,
* even though it does make the struct a little more confusing.
*/
double thisJanThruMar;
} CheatgrassPrecip;
/* -------------------------- Exported Functions --------------------------- */
// See ST_mortality.c for definitions and documentation of these functions.
void mort_Main(Bool *killed);
void mort_EndOfYear(void);
void freeMortalityMemory(void);
void proportion_Recovery(void);
void grazing_EndOfYear(void);
void killAnnuals(void);
void killMaxage(void);
void killExtraGrowth(void);
void initCheatgrassPrecip(void);
void setCheatgrassPrecip(CheatgrassPrecip* newCheatgrassPrecip);
CheatgrassPrecip* getCheatgrassPrecip(void);
/* ---------------------------- Exported Enums ----------------------------- */
/**
* \brief All types of mortality.
*
* Used to record what killed an individual.
*
* \sa indiv_st which instantiates this enumerator.
*
* \ingroup MORTALITY
*/
typedef enum {
Slow,
NoResources,
Intrinsic,
Disturbance,
LastMort
} MortalityType;
/* =================================================== */
/* Externed Global Variables */
/* --------------------------------------------------- */
extern sw_random_t mortality_rng;
extern Bool *_SomeKillage;
extern Bool UseCheatgrassWildfire;
#endif