コード例 #1
0
        public override int harvestStand(Stand stand)
        {
            SitesCut += stand.numberOfActiveSites();
            Ldpoint pt = new Ldpoint();
            int     i;
            int     j;
            double  TmpBasalAreaS;
            double  TmpBasalAreaS_avg;
            double  BA_toCut;
            double  shareCut_ACell;

            TmpBasalAreaS = 0;

            for (StandIterator it = new StandIterator(stand); it.moreSites(); it.gotoNextSite())
            {
                pt             = it.getCurrentSite();
                i              = pt.y;
                j              = pt.x;
                TmpBasalAreaS += GetBAinACell(i, j);
            }
            TmpBasalAreaS_avg = TmpBasalAreaS / BoundedPocketStandHarvester.pCoresites.CellSize / BoundedPocketStandHarvester.pCoresites.CellSize / stand.numberOfActiveSites() * 10000;

            if (TmpBasalAreaS_avg <= Mininum_BA)
            {
            }
            else
            { //Cut trees here
                //printf("Enough to Harvest\n");
                StandsCut++;
                itsStands.Add(stand.getId()); //Add By Qia on June 01 2012
                BA_toCut = TmpBasalAreaS_avg - TargetVolume;
                if (BA_toCut < 0.0)
                {
                    BA_toCut = TmpBasalAreaS_avg;
                }
                BA_toCut = BA_toCut * BoundedPocketStandHarvester.pCoresites.CellSize * BoundedPocketStandHarvester.pCoresites.CellSize * stand.numberOfActiveSites() / 10000;

                for (StandIterator it = new StandIterator(stand); it.moreSites(); it.gotoNextSite())
                {
                    pt             = it.getCurrentSite();
                    i              = pt.y;
                    j              = pt.x;
                    shareCut_ACell = GetBAinACell(i, j) / TmpBasalAreaS * BA_toCut;
                    if (shareCut_ACell > 0)
                    {
                        double shareCut = 0.0;
                        shareCut = CutShareBAinACell_LifeSpanPercent(i, j, shareCut_ACell);
                        BoundedPocketStandHarvester.pHarvestsites[i, j].harvestType = (short)GetUserInputId();
                        BoundedPocketStandHarvester.pHarvestsites[i, j].lastHarvest = (short)BoundedPocketStandHarvester.currentDecade;
                    }
                    else
                    {
                        BoundedPocketStandHarvester.pHarvestsites.SetValueHarvestBA(i, j, shareCut_ACell);
                    }
                }
            }
            //return StandsCut;

            return(1);
        }
コード例 #2
0
        public override int harvestStand(Stand stand)
        {
            //printf("before harvest standID: %d, stocking: %lf\n",stand->getId(),computeStandStocking(stand));
            SitesCut += stand.numberOfActiveSites();
            //printf("sitesinstand:%d SitesCut:%d Target:%d\n",stand->numberOfActiveSites(),SitesCut,itsTargetCut);
            Ldpoint pt = new Ldpoint();
            int     m;
            int     k;
            int     i;
            int     j;
            double  TmpStockingS;
            double  TmpStockingS_avg;
            double  Stocking_toCut;
            double  shareCut_ACell;

            TmpStockingS = 0;
            for (StandIterator it = new StandIterator(stand); it.moreSites(); it.gotoNextSite())
            {
                pt            = it.getCurrentSite();
                i             = pt.y;
                j             = pt.x;
                TmpStockingS += GetStockinginACell(i, j);
            }
            TmpStockingS = TmpStockingS / stand.numberOfActiveSites();
            //TmpStockingS_avg = TmpStockingS / pCoresites->CellSize/pCoresites->CellSize/stand->numberOfActiveSites()*10000;
            TmpStockingS_avg = TmpStockingS / stand.numberOfActiveSites();
            if (TmpStockingS <= Mininum_Stocking)
            {
            }
            else
            { //Cut trees here
                //printf("Enough to Harvest\n");
                StandsCut++;
                itsStands.Add(stand.getId()); //Add By Qia on June 01 2012
                Stocking_toCut = TmpStockingS - TargetStocking;
                //Stocking_toCut = Stocking_toCut * pCoresites->CellSize * pCoresites->CellSize * stand->numberOfActiveSites()/10000;
                for (StandIterator it = new StandIterator(stand); it.moreSites(); it.gotoNextSite())
                {
                    pt             = it.getCurrentSite();
                    i              = pt.y;
                    j              = pt.x;
                    shareCut_ACell = GetStockinginACell(i, j) / TmpStockingS * Stocking_toCut;
                    if (shareCut_ACell > 0.0)
                    {
                        //CutShareStockinginACell(i,j,shareCut_ACell);
                        //SitesCut++;
                        CutShareStockinginACell_LifeSpanPercent(i, j, shareCut_ACell);
                        BoundedPocketStandHarvester.pHarvestsites[i, j].harvestType = (short)GetUserInputId();
                        BoundedPocketStandHarvester.pHarvestsites[i, j].lastHarvest = (short)BoundedPocketStandHarvester.currentDecade;
                    }
                    else
                    {
                        //pHarvestsites->SetValueHarvestBA(i,j,shareCut_ACell);
                    }
                }
            }
            //return StandsCut;
            //printf("after harvest standID: %d, stocking: %lf\n",stand->getId(),computeStandStocking(stand));
            return(1);
        }
コード例 #3
0
        public override int harvestStand(Stand stand)
        {
            SitesCut += stand.numberOfActiveSites();
            //printf("sitesinstand:%d SitesCut:%d Target:%d\n",stand->numberOfActiveSites(),SitesCut,itsTargetCut);
            SiteHarvester theSiteHarvester = new SiteHarvester(GetUserInputId(), getRemovalMask(), getReport(), getDuration());
            MultiplePocketStandHarvester theStandHarvester = new MultiplePocketStandHarvester(stand, itsStandProportion, itsMeanGroupSize, itsStandardDeviation, theSiteHarvester);
            int standCut = theStandHarvester.Harvest();

            if (standCut > 0)
            {
                stand.reserve();
                itsStands.Add(stand.getId());
                itsTotalNumberOfStands++;
            }
            return(1);
        }