LandscapeDNDC 1.37.0
Loading...
Searching...
No Matches
event-graze.h
1/*
2 * SPDX-FileCopyrightText: Karlsruhe Institute of Technology (KIT)
3 * SPDX-License-Identifier: LicenseRef-Crabmeat
4 * This file is part of Crabmeat. Redistribution or commercial use is
5 * prohibited without express written permission. See LICENCE.
6 */
7
17
18#ifndef LDNDC_INPUT_EVENT_GRAZE_H_
19#define LDNDC_INPUT_EVENT_GRAZE_H_
20
21#include "event/events/eventbase.h"
22
23
24#ifdef __this_event_name
25# undef __this_event_name
26#endif
27#define __this_event_name graze
28
29namespace ldndc{
30namespace event{
31
32struct CBM_API __event_attrib_class_name(__this_event_name) : event_attribute_t
33{
34 enum livestock_type_e
35 {
36 LIVESTOCK_CATTLE,
37 LIVESTOCK_HORSE,
38 LIVESTOCK_SHEEP,
39 LIVESTOCK_GENERIC,
40
41 LIVESTOCK_CNT,
42 LIVESTOCK_NONE
43 };
44 static char const * LIVESTOCK_NAMES[LIVESTOCK_CNT];
45
46 struct livestock_info_t
47 {
48 livestock_info_t();
49 static livestock_info_t properties_from_type(
50 livestock_type_e);
51
53 double demand_carbon;
54
56 double excreta_carbon;
58 double excreta_nitrogen;
60 double urine_fraction;
61 };
62 static livestock_info_t const LIVESTOCK_DEFAULTS[LIVESTOCK_CNT];
63
64 __event_attrib_class_name(__this_event_name)();
65 ~__event_attrib_class_name(__this_event_name)();
66
68 livestock_type_e type;
69
71 livestock_info_t properties;
72
74 double head_count;
76 double grazing_hours;
78 double remains_relative;
79};
80class CBM_API __event_class_name(__this_event_name) : public Event
81{
82 EVENT_COMMON_DECL(__this_event_name)
83
84 public:
85 attributes_type::livestock_type_e livestock_type() const { return this->attribs_->type; }
86 char const * livestock_name()
87 const
88 {
89 if ( this->livestock_type() < attributes_type::LIVESTOCK_CNT)
90 {
91 return attributes_type::LIVESTOCK_NAMES[this->livestock_type()];
92 }
93 return invalid_str;
94 }
95 attributes_type::livestock_info_t const & livestock_properties() const
96 { return this->attribs_->properties; }
97
98 double head_count() const
99 { return this->attribs_->head_count; }
100 bool have_livestock() const
101 { return this->head_count() > 0.0; }
102 double grazing_hours() const
103 { return this->attribs_->grazing_hours; }
104 double remains_relative() const
105 { return this->attribs_->remains_relative; }
106};
107}}
108
109#endif /* !LDNDC_INPUT_EVENT_GRAZE_H_ */
110
Spatially explicit groundwater model.
Definition airchemistryput.h:21