28 #define _CRT_SECURE_NO_DEPRECATE 42 int a_phase,
int a_type )
50 unsigned int oldindex=0, newindex=0;
52 if (
m_growth[ index ]->m_dds[ a_phase ][ 0 ] == 99999 ) {
60 if (
m_growth[ index ]->m_dds[ a_phase ][ i+1 ] > a_ddegs ) {
68 if (
m_growth[ index ]->m_dds[ a_phase ][ i+1 ] > a_yddegs ) {
77 if ( newindex > oldindex ) {
82 m_growth[ index ]->m_dds[ a_phase ][ newindex ] - a_yddegs;
84 m_growth[ index ]->m_slopes[ a_phase ][ a_type ][oldindex]*
89 m_growth[ index ]->m_dds[ a_phase ][ newindex ];
91 m_growth[ index ]->m_slopes[ a_phase ][ a_type ][ newindex ]*
95 diff =
m_growth[ index ]->m_slopes[ a_phase ][ a_type ][ newindex ] *
103 int a_plant,
int a_phase )
105 return FindDiff( a_ddegs, a_yddegs, a_plant, a_phase, 0 );
110 int a_plant,
int a_phase )
112 return FindDiff( a_ddegs, a_yddegs, a_plant, a_phase, 1 );
117 int a_plant,
int a_phase )
119 return FindDiff( a_ddegs , a_yddegs, a_plant, a_phase, 2 );
129 for (
unsigned int i=0; i<201; i++) {
133 m_ifile = fopen(a_cropcurvefile,
"r" );
140 fscanf(
m_ifile ,
"%d", &NoPlants );
154 fscanf(
m_ifile,
"%d", &ThisPlant);
157 if ( ThisPlant < 0 || ThisPlant > 200 ) {
159 " specified in", a_cropcurvefile );
166 if ( ThisPlant > 100 ) {
177 unsigned int NoPlants =
FindCropNum( a_vegcurvefile );
179 for (
unsigned int i=0; i<NoPlants; i++) {
185 for (
unsigned int j=0; j<5; j++) {
191 fscanf(
m_ifile,
"%d", &entry );
192 float f1=0,f2=0,f0=0;
195 m_growth[ i ]->m_start_valid[j] =
true;
196 fscanf(
m_ifile,
"%g %g %g",&f1,&f0,&f2);
202 m_growth[ i ]->m_dds[j][lk] = (double)entry;
203 fscanf(
m_ifile,
"%g %g %g",&f1,&f0,&f2);
217 for (
unsigned int i=0; i<
m_growth.size(); i++ )
223 for (
unsigned int j=0; j<5; j++) {
224 m_start_valid[j] =
false;
225 for (
unsigned int k=0; k<3; k++) {
235 switch (VegReference)
355 sprintf( error_num,
"%d", VegReference );
357 "CropData::VegTypeToCurveNum(): Unknown vegetation type:",
368 return p-> m_start_valid[ a_phase ];
int VegTypeToCurveNum(TTypesOfVegetation VegReference)
double FindDiff(double a_ddegs, double a_yddegs, int a_plant, int a_phase, int a_type)
double GetLAtotalDiff(double a_ddegs, double a_yddegs, int a_plant, int a_phase)
unsigned int FindCropNum(const char *a_cropcurvefile)
void FloatToDouble(double &, float)
vector< CropGrowth * > m_growth
class MapErrorMsg * g_msg
double GetHeightDiff(double a_ddegs, double a_yddegs, int a_plant, int a_phase)
bool StartValid(int a_veg_type, int a_phase)
void SetVegNum(unsigned int a_i, const char *a_cropcurvefile)
void Warn(MapErrorState a_level, std::string a_msg1, std::string a_msg2)
const unsigned int MaxNoInflections
CropData(const char *a_cropcurvefile)
double GetLAgreenDiff(double a_ddegs, double a_yddegs, int a_plant, int a_phase)