LandscapeDNDC 1.37.0
Loading...
Searching...
No Matches
event-graze.h
1
10
11#ifndef LDNDC_INPUT_EVENT_GRAZE_H_
12#define LDNDC_INPUT_EVENT_GRAZE_H_
13
14#include "event/events/eventbase.h"
15
16
17#ifdef __this_event_name
18# undef __this_event_name
19#endif
20#define __this_event_name graze
21
22namespace ldndc{
23namespace event{
24
25struct CBM_API __event_attrib_class_name(__this_event_name) : event_attribute_t
26{
27 enum livestock_type_e
28 {
29 LIVESTOCK_CATTLE,
30 LIVESTOCK_HORSE,
31 LIVESTOCK_SHEEP,
32 LIVESTOCK_GENERIC,
33
34 LIVESTOCK_CNT,
35 LIVESTOCK_NONE
36 };
37 static char const * LIVESTOCK_NAMES[LIVESTOCK_CNT];
38
39 struct livestock_info_t
40 {
41 livestock_info_t();
42 static livestock_info_t properties_from_type(
43 livestock_type_e);
44
46 double demand_carbon;
47
49 double excreta_carbon;
51 double excreta_nitrogen;
53 double urine_fraction;
54 };
55 static livestock_info_t const LIVESTOCK_DEFAULTS[LIVESTOCK_CNT];
56
57 __event_attrib_class_name(__this_event_name)();
58 ~__event_attrib_class_name(__this_event_name)();
59
61 livestock_type_e type;
62
64 livestock_info_t properties;
65
67 double head_count;
69 double grazing_hours;
71 double remains_relative;
72};
73class CBM_API __event_class_name(__this_event_name) : public Event
74{
75 EVENT_COMMON_DECL(__this_event_name)
76
77 public:
78 attributes_type::livestock_type_e livestock_type() const { return this->attribs_->type; }
79 char const * livestock_name()
80 const
81 {
82 if ( this->livestock_type() < attributes_type::LIVESTOCK_CNT)
83 {
84 return attributes_type::LIVESTOCK_NAMES[this->livestock_type()];
85 }
86 return invalid_str;
87 }
88 attributes_type::livestock_info_t const & livestock_properties() const
89 { return this->attribs_->properties; }
90
91 double head_count() const
92 { return this->attribs_->head_count; }
93 bool have_livestock() const
94 { return this->head_count() > 0.0; }
95 double grazing_hours() const
96 { return this->attribs_->grazing_hours; }
97 double remains_relative() const
98 { return this->attribs_->remains_relative; }
99};
100}}
101
102#endif /* !LDNDC_INPUT_EVENT_GRAZE_H_ */
103
Spatially explicit groundwater model.
Definition airchemistryput.h:15