ALMaSS Rabbit ODdox  1.1
The rabbit model description following ODdox protocol
croprotation.h
Go to the documentation of this file.
1 //
2 // croprotation.h
3 //
4 /*
5 *******************************************************************************************************
6 Copyright (c) 2011, Christopher John Topping, University of Aarhus
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 #include "tov_declaration.h"
34 
35 extern class CropRotation *g_rotation;
36 
37 const int NoFarmTypes = 2;
38 
39 struct Rotation
40 {
43  int Percent[ NoFarmTypes ][4];
44 };
45 
46 struct Starter
47 {
50 };
51 
53 {
54  vector< Rotation* > m_rots;
55  vector< Starter* > m_start;
56 
57 public:
58  TTypesOfVegetation GetNextCrop( int a_farmtype, int a_current_crop );
59  TTypesOfVegetation GetFirstCrop( int a_farmtype, bool *a_low_nutrient );
60  CropRotation( int a_num_crops );
61  ~CropRotation( void );
62 };
63 
65 {
68  unsigned m_activity;
70 };
71 
72 #ifdef __NEWCropactivityCODE
73 
75 class CropManagementActivity
76 {
77 protected:
79  FarmToDo m_activitytype;
81  double m_amount;
83  double m_baseprobability;
85  unsigned m_startdate;
87  unsigned m_activityperiod;
89  unsigned m_activityID;
91  vector<unsigned> m_NextActivities;
93  vector<double> m_NextActivitiesProbs;
95  vector<ManagementDependency>m_dependencies;
97  bool m_finishedornot;
98 public:
100  CropManagementActivity(FarmToDo a_activitytype,
101  double a_amount,
102  double a_baseprobability,
103  unsigned a_startdate,
104  unsigned a_activityperiod,
105  unsigned a_activityID,
106  vector<unsigned> a_NextActivities,
107  vector<double> a_NextActivitiesProbs,
108  vector<ManagementDependency>a_dependencies)
109  {
110  m_finishedornot = false;
111  m_activitytype = a_activitytype;
112  m_amount = a_amount;
113  m_baseprobability = a_baseprobability;
114  m_startdate = a_startdate;
115  m_activityperiod = a_activityperiod;
116  m_activityID = a_activityID;
117  m_NextActivities = a_NextActivities;
118  m_NextActivitiesProbs = a_NextActivitiesProbs;
119  m_dependencies = a_dependencies;
120  }
122  unsigned DoManagement();
123 };
124 #endif
125 
126 #endif // CROPROTATION_H
127 
CropRotation::m_start
vector< Starter * > m_start
Definition: croprotation.h:55
Rotation
Definition: croprotation.h:39
ManagementDependency
Definition: croprotation.h:64
CropRotation::CropRotation
CropRotation(int a_num_crops)
Definition: croprotation.cpp:42
Starter
Definition: croprotation.h:46
Rotation::NewCrop
TTypesOfVegetation NewCrop[NoFarmTypes][4]
Definition: croprotation.h:42
NoFarmTypes
const int NoFarmTypes
Definition: croprotation.h:37
CropRotation::GetFirstCrop
TTypesOfVegetation GetFirstCrop(int a_farmtype, bool *a_low_nutrient)
Definition: croprotation.cpp:126
ManagementDependency::m_condition
bool m_condition
Definition: croprotation.h:69
Rotation::Percent
int Percent[NoFarmTypes][4]
Definition: croprotation.h:43
CropRotation
Definition: croprotation.h:52
Rotation::CropNum
TTypesOfVegetation CropNum[NoFarmTypes]
Definition: croprotation.h:41
TTypesOfVegetation
TTypesOfVegetation
Definition: tov_declaration.h:30
ManagementDependency::m_activity
unsigned m_activity
Definition: croprotation.h:68
CropRotation::GetNextCrop
TTypesOfVegetation GetNextCrop(int a_farmtype, int a_current_crop)
Definition: croprotation.cpp:105
Starter::CropNum
TTypesOfVegetation CropNum[NoFarmTypes]
Definition: croprotation.h:48
CropRotation::~CropRotation
~CropRotation(void)
Definition: croprotation.cpp:95
FarmToDo
FarmToDo
Definition: treatment.h:31
Starter::Percent
int Percent[NoFarmTypes]
Definition: croprotation.h:49
tov_declaration.h
g_rotation
class CropRotation * g_rotation
Definition: croprotation.cpp:38
CropRotation::m_rots
vector< Rotation * > m_rots
Definition: croprotation.h:54