File failed to load: https://cdnjs.cloudflare.com/ajax/libs/mathjax/2.7.5/extensions/ams.js
ALMaSS  1.2 (after EcoStack, March 2024)
The Animal, Landscape and Man Simulation System
All Classes Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
Croprotation.h
Go to the documentation of this file.
1 //
2 // Croprotation.h
3 //
4 /*
5 *******************************************************************************************************
6 Copyright (c) 2011, Christopher John Topping, Aarhus University
7 All rights reserved.
8 
9 Redistribution and use in source and binary forms, with or without modification, are permitted provided
10 that the following conditions are met:
11 
12 Redistributions of source code must retain the above copyright notice, this list of conditions and the
13 following disclaimer.
14 Redistributions in binary form must reproduce the above copyright notice, this list of conditions and
15 the following disclaimer in the documentation and/or other materials provided with the distribution.
16 
17 THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR
18 IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
19 FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS
20 BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
21 BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR
22 BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
23 LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
24 SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
25 ********************************************************************************************************
26 */
27 
28 
29 #ifndef CROPROTATION_H
30 #define CROPROTATION_H
31 
32 #include <vector>
33 
34 extern class CropRotation *g_rotation;
35 
36 const int NoFarmTypes = 2;
37 
38 struct Rotation
39 {
42  int Percent[ NoFarmTypes ][4];
43 };
44 
45 struct Starter
46 {
49 };
50 
52 {
53  vector< Rotation* > m_rots;
54  vector< Starter* > m_start;
55 
56 public:
57  TTypesOfVegetation GetNextCrop( int a_farmtype, int a_current_crop );
58  TTypesOfVegetation GetFirstCrop( int a_farmtype, bool *a_low_nutrient );
59  CropRotation( int a_num_crops );
60  ~CropRotation( void );
61 };
62 
64 {
67  unsigned m_activity;
69 };
70 
71 #ifdef __NEWCropactivityCODE
72 
74 class CropManagementActivity
75 {
76 protected:
78  FarmToDo m_activitytype;
80  double m_amount;
82  double m_baseprobability;
84  unsigned m_startdate;
86  unsigned m_activityperiod;
88  unsigned m_activityID;
90  vector<unsigned> m_NextActivities;
92  vector<double> m_NextActivitiesProbs;
94  vector<ManagementDependency>m_dependencies;
96  bool m_finishedornot;
97 public:
99  CropManagementActivity(FarmToDo a_activitytype,
100  double a_amount,
101  double a_baseprobability,
102  unsigned a_startdate,
103  unsigned a_activityperiod,
104  unsigned a_activityID,
105  vector<unsigned> a_NextActivities,
106  vector<double> a_NextActivitiesProbs,
107  vector<ManagementDependency>a_dependencies)
108  {
109  m_finishedornot = false;
110  m_activitytype = a_activitytype;
111  m_amount = a_amount;
112  m_baseprobability = a_baseprobability;
113  m_startdate = a_startdate;
114  m_activityperiod = a_activityperiod;
115  m_activityID = a_activityID;
116  m_NextActivities = a_NextActivities;
117  m_NextActivitiesProbs = a_NextActivitiesProbs;
118  m_dependencies = a_dependencies;
119  }
121  unsigned DoManagement();
122 };
123 #endif
124 
125 #endif // CROPROTATION_H
126 
CropRotation::m_start
vector< Starter * > m_start
Definition: Croprotation.h:54
WARN_FILE
Definition: MapErrorMsg.h:37
Rotation
Definition: Croprotation.h:38
ManagementDependency
Definition: Croprotation.h:63
CropRotation::CropRotation
CropRotation(int a_num_crops)
Definition: Croprotation.cpp:42
Starter
Definition: Croprotation.h:45
NoFarmTypes
const int NoFarmTypes
Definition: Croprotation.h:36
CfgStr::value
char * value() const
Definition: Configurator.h:182
Rotation::NewCrop
TTypesOfVegetation NewCrop[NoFarmTypes][4]
Definition: Croprotation.h:41
CropRotation::GetFirstCrop
TTypesOfVegetation GetFirstCrop(int a_farmtype, bool *a_low_nutrient)
Definition: Croprotation.cpp:126
g_rotation
class CropRotation * g_rotation
Definition: Croprotation.cpp:38
CfgStr
String configurator entry class.
Definition: Configurator.h:173
PlantGrowthData::GetNumCrops
int GetNumCrops()
Definition: Plants.h:150
ManagementDependency::m_condition
bool m_condition
Definition: Croprotation.h:68
ls.h
FarmToDo
FarmToDo
Definition: Treatment.h:31
Rotation::Percent
int Percent[NoFarmTypes][4]
Definition: Croprotation.h:42
Configurator.h
l_map_rotation_files_prefix
CfgStr l_map_rotation_files_prefix("MAP_ROTATION_FILES_PREFIX", CFG_CUSTOM, "")
CropRotation
Definition: Croprotation.h:51
Rotation::CropNum
TTypesOfVegetation CropNum[NoFarmTypes]
Definition: Croprotation.h:40
PlantGrowthData::GetNutStatus
bool GetNutStatus(int a_plant_num)
Definition: Plants.h:185
ManagementDependency::m_activity
unsigned m_activity
Definition: Croprotation.h:67
MapErrorMsg::Warn
void Warn(MapErrorState a_level, std::string a_msg1, std::string a_msg2)
Definition: MapErrorMsg.cpp:69
CropRotation::GetNextCrop
TTypesOfVegetation GetNextCrop(int a_farmtype, int a_current_crop)
Definition: Croprotation.cpp:105
MapErrorMsg.h
g_msg
MapErrorMsg * g_msg
Definition: MapErrorMsg.cpp:41
TTypesOfVegetation
TTypesOfVegetation
Values that represent the types of vegetation that are represented in ALMaSS.
Definition: LandscapeFarmingEnums.h:192
Starter::CropNum
TTypesOfVegetation CropNum[NoFarmTypes]
Definition: Croprotation.h:47
CFG_CUSTOM
Definition: Configurator.h:70
g_random_fnc
int g_random_fnc(const int a_range)
Definition: ALMaSS_Random.cpp:74
CropRotation::~CropRotation
~CropRotation(void)
Definition: Croprotation.cpp:95
Starter::Percent
int Percent[NoFarmTypes]
Definition: Croprotation.h:48
g_rotation
class CropRotation * g_rotation
Definition: Croprotation.cpp:38
WARN_BUG
Definition: MapErrorMsg.h:34
g_crops
class PlantGrowthData * g_crops
Definition: Plants.cpp:40
CropRotation::m_rots
vector< Rotation * > m_rots
Definition: Croprotation.h:53