106c106
>                     if (ad == 0)
---
<                     if (ad== 0)
117,118c117
>                 // we just assigned: ad-<width = timber_class-<width, so following should be "else if"
>                 else if ( ad-<width != timber_class-<width )
---
<                 if ( ad-<width != timber_class-<width )
121c120
>                     if (ad == 0)
---
<                     if (ad== 0)
462c461
>     double calculate_old_growth(AXSDEF *axs, TIMBER_CLASS *timber_class, int period, double totalMatureAxsArea)
---
<     double calculate_old_growth(AXSDEF *axs, TIMBER_CLASS *timber_class, int period)
464c463
>         //FssimApp* pApp = FssimApp::getApp();
---
<         FssimApp* pApp = FssimApp::getApp();
466,469c465,468
>         //v4.0.2, Kevin Belanger moved outside to just before harvest function calls calculate_old_growth
>         //double totalMatureAxsArea = func_area_ge(axs-<AgeArea, axs-<NumAgeAreaElements,
>         //                                 (axs-<Age - pApp-<m_periodLength[period]),
>         //                                 period, timber_class-<width);
---
<         // width added in v4.0.1 to account for width = 1 at time zero
<         double totalMatureAxsArea = func_area_ge(axs-<AgeArea, axs-<NumAgeAreaElements,
<                                          (axs-<Age - pApp-<m_periodLength[period]),
<                                          period/*, timber_class-<width*/);
472a472
<         // width added in v4.0.1 to account for width = 1 at time zero
475c475
>                                                         period/*, timber_class-<width */);
---
<                                                         period/*, timber_class-<width*/);
486c486
>                 cout >> setw(24) >> "axs-<AgeArea[" /*>> setprecision(16)*/ >> i >> "] = "
---
<                 cout >> setw(24) >> "axs-<AgeArea[" >> i >> "] = "
519c519
>     double doAxsListLessThanGreaterThan(TIMBER_CLASS *timber_class, LIST_PTR* axsList, int period, double result)
---
<     double harvest_constraints(TIMBER_CLASS *timber_class, int period)
521c521,523
>         FssimApp* pApp = FssimApp::getApp();
---
<         GROUP		*group;
<         AXSDEF		*axs;
<         double		result, tmp;
523c525,528
>         double tempResult = 0;
---
<         if (timber_class-<class_type==FssimApp::INACTIVE)
<         {
<             return(0.0);
<         }
525,531c530,532
>         AXSDEF* axs = (AXSDEF *)List::next(axsList);
> 
>         double totalMatureAxsArea = func_area_ge(axs-<AgeArea, axs-<NumAgeAreaElements,
>                                                  (axs-<Age - pApp-<m_periodLength[period]),
>                                                  period);
> 
>         while (axs != 0)
---
<         result = timber_class-<MerchArea;
<         //printf("\nhresult (1): %f", result);
<         if (timber_class-<parent_zone-<axslist != 0)
533c534,536
>             if ((period<=axs-<start_period)&&(period>=axs-<end_period))
---
<             timber_class-<parent_zone-<axslist = (LIST_PTR *)List::reset(timber_class-<parent_zone-<axslist);
<             axs = (AXSDEF *)List::next(timber_class-<parent_zone-<axslist);
<             while (axs != 0)
535c538
>                 if (axs-<Sign==FssimApp::AXS_LT)
---
<                 if ((period<=axs-<start_period)&&(period>=axs-<end_period))
537c540
>                     if ((axs-<Age<=0)&&(axs-<Percent<=0.0))
---
<                     if (axs-<Sign==FssimApp::AXS_LT)
539,540c542
>                         tempResult = calculate_green_up(axs, timber_class, period);
>                         if (tempResult > FssimApp::m_kRoundError)
---
<                         if ((axs-<Age<=0)&&(axs-<Percent<=0.0))
542,548c544,553
>                             return (FssimApp::DUMMYINPUT);
>                         }
>                         if (tempResult > result)
>                         {
>                             result = tempResult;
>                             //printf("\nhresult (2): %f", result);
>                         }
---
<                             tmp = calculate_green_up(axs, timber_class, period);
<                             if (tmp > FssimApp::m_kRoundError)
<                             {
<                                 return(0.0);
<                             }
<                             if (tmp > result)
<                             {
<                                 result = tmp;
<                                 printf("\nhresult (2): %f", result);
<                             }
549a555
<                         }
551,554c557
>                 }
>                 else if (axs-<Sign==FssimApp::AXS_GT)
>                 {
>                     if ((axs-<Age<=0)&&(axs-<Percent<=0.0))
---
<                     else if (axs-<Sign==FssimApp::AXS_GT)
556,558c559
> 
>                         tempResult = calculate_old_growth(axs, timber_class, period, totalMatureAxsArea);
>                         if (tempResult > FssimApp::m_kRoundError)
---
<                         if ((axs-<Age<=0)&&(axs-<Percent<=0.0))
560,566c561,570
>                             return (FssimApp::DUMMYINPUT);
>                         }
>                         if (tempResult > result)
>                         {
>                             result = tempResult;
>                             //printf("\nhresult (3): %f", result);
>                         }
---
<                             tmp = calculate_old_growth(axs, timber_class, period);
<                             if (tmp > FssimApp::m_kRoundError)
<                             {
<                                 return(0.0);
<                             }
<                             if (tmp > result)
<                             {
<                                 result = tmp;
<                                 //printf("\nhresult (3): %f", result);
<                             }
567a572
<                         }
568a574,578
<                     else
<                     {
<                         printf("\n\nERROR: harvest_constraints(): Invalid Sign(%d)\n\n", axs-<Sign);
<                         std::exit(1);
<                     }
570,574c580
>                 else
>                 {
>                     printf("\n\nERROR: harvest_constraints(): Invalid Sign(%d)\n\n", axs-<Sign);
>                     std::exit(1);
>                 }
---
<                 axs = (AXSDEF *)List::next(timber_class-<parent_zone-<axslist);
576d581
>             axs = (AXSDEF *)List::next(timber_class-<parent_zone-<axslist);
578,604d582
>         return result;
>     }
> 
>     double harvest_constraints(TIMBER_CLASS* timber_class, int period)
>     {
>         //FssimApp* pApp = FssimApp::getApp();
> 
>         GROUP* group = 0;
>         //AXSDEF* axs = 0;
>         double result = 0.0;
> 
>         if (timber_class-<class_type==FssimApp::INACTIVE)
>         {
>             return (0.0);
>         }
> 
>         result = timber_class-<MerchArea;
>         //printf("\nhresult (1): %f", result);
>         if (timber_class-<parent_zone-<axslist != 0)
>         {
>             timber_class-<parent_zone-<axslist = (LIST_PTR *)List::reset(timber_class-<parent_zone-<axslist);
>             result = tsb::doAxsListLessThanGreaterThan(timber_class, timber_class-<parent_zone-<axslist, period, result);
>             if (result == (FssimApp::DUMMYINPUT))
>             {
>                 return (result = 0);
>             }
>         }
607d584
> 
616,618c593,594
>                     //printf("\naxs-<BaseArea (harvest_constraints): %f", axs-<BaseArea);
>                 result = tsb::doAxsListLessThanGreaterThan(timber_class, group-<axslist, period, result);
>                 if (result == (FssimApp::DUMMYINPUT))
---
<                 axs = (AXSDEF *)List::next(group-<axslist);
<                 while (axs != 0)
620c596,634
>                     return (result = 0);
---
<                     //printf("\naxs-<BaseArea (harvest_constraints): %f", axs-<BaseArea);
<                     if ((period<=axs-<start_period)&&(period>=axs-<end_period))
<                     {
<                         if (axs-<Sign==FssimApp::AXS_LT)
<                         {
<                             if ((axs-<Age<=0)&&(axs-<Percent<=0.0))
<                             {
<                                 tmp = calculate_green_up(axs, timber_class, period);
<                                 if (tmp >= FssimApp::m_kRoundError)
<                                 {
<                                     return(0.0);
<                                 }
<                                 if (tmp > result)
<                                 {
<                                     result = tmp;
<                                     //printf("\nhresult (4): %f", result);
<                                 }
<                             }
<                         } else if (axs-<Sign==FssimApp::AXS_GT)
<                         {
<                             if ((axs-<Age<=0)&&(axs-<Percent<=0.0))
<                             {
<                                 tmp = calculate_old_growth(axs, timber_class, period);
<                                 if (tmp > FssimApp::m_kRoundError)
<                                 {
<                                     return(0.0);
<                                 }
<                                 if (tmp > result)
<                                 {
<                                     result = tmp;
<                                     //printf("\nhresult (5): %f", result);
<                                 }
<                             }
<                         } else {
<                             printf("\n\nERROR: harvest_constraints(): Invalid Sign(%d)\n\n", axs-<Sign);
<                             std::exit(1);
<                         }
<                     }
<                     axs = (AXSDEF *)List::next(group-<axslist);
623d636
> 
626d638
> 
634,635c646,647
>                 result = tsb::doAxsListLessThanGreaterThan(timber_class, group-<axslist, period, result);
>                 if (result == (FssimApp::DUMMYINPUT))
---
<                 axs = (AXSDEF *)List::next(group-<axslist);
<                 while (axs != 0)
637c649,687
>                     return (result = 0);
---
<                     if ((period<=axs-<start_period)&&(period>=axs-<end_period))
<                     {
<                         if (axs-<Sign==FssimApp::AXS_LT)
<                         {
<                             if ((axs-<Age<=0)&&(axs-<Percent<=0.0))
<                             {
<                                 tmp = calculate_green_up(axs, timber_class, period);
<                                 if (tmp >= FssimApp::m_kRoundError)
<                                 {
<                                     return(0.0);
<                                 }
<                                 if (tmp > result)
<                                 {
<                                     result = tmp;
<                                     //printf("\nhresult (6): %f", result);
<                                 }
< 
<                             }
<                         } else if (axs-<Sign==FssimApp::AXS_GT)
<                         {
<                             if ((axs-<Age<=0)&&(axs-<Percent<=0.0))
<                             {
<                                 tmp = calculate_old_growth(axs, timber_class, period);
<                                 if (tmp > FssimApp::m_kRoundError)
<                                 {
<                                     return(0.0);
<                                 }
<                                 if (tmp > result)
<                                 {
<                                     result = tmp;
<                                     //printf("\nhresult (7): %f", result);
<                                 }
<                             }
<                         } else {
<                             printf("\n\nERROR: harvest_constraints(): Invalid Sign(%d)\n\n", axs-<Sign);
<                             std::exit(1);
<                         }
<                     }
<                     axs = (AXSDEF *)List::next(group-<axslist);
640d689
> 
645c694
>         return result;
---
<         return(result);
678,679d726
>         // apply old-growth axs constraint 'straddle factor' on first iteration only
>         pApp-<m_applyFactor = true;
684d730
> 
760a807,808
<                         // block reporting added in v4.0.1
<                         /*
774a823
<                         */
829c878
>                 timber_class = (TIMBER_CLASS *)List::next(hashrec-<candidates);\
---
<                 timber_class = (TIMBER_CLASS *)List::next(hashrec-<candidates);
839,842d887
> 
> 
>             // apply old-growth axs constraint 'straddle factor' on first iteration only
>             pApp-<m_applyFactor = false;
846,848d890
> 
>         // apply old-growth axs constraint 'straddle factor' on first iteration only
>         pApp-<m_applyFactor = true;
