public override void Harvest()
        {
            List <int> rankedList = new List <int>();
            Stand      stand      = new Stand();
            int        standCut;

            itsRankAlgorithm.rankStands(ref rankedList);
            getReport().reset();
            // length of rankedList should be equal to length of  theLength;

            foreach (int it in rankedList)
            {
                if (isHarvestDone() == 0)
                {
                    stand.Copy(BoundedPocketStandHarvester.pstands[it]);
                    if (stand.canBeHarvested() && (BoundedPocketStandHarvester.iParamstandAdjacencyFlag == 0 || !stand.neighborsWereRecentlyHarvested()))
                    {
                        standCut = harvestStand(BoundedPocketStandHarvester.pstands[it]);
                    }
                }
                else
                {
                    break;
                }
            }

            writeReport(BoundedPocketStandHarvester.harvestOutputFile2);
        }
Exemple #2
0
        public void reharvest()
        {
            Stand stand = new Stand();

            //Console.WriteLine(itsStands.Count);
            //Console.ReadLine();
            for (int ii = 0; ii < itsStands.Count; ii++)
            {
                stand.Copy(BoundedPocketStandHarvester.pstands[itsStands[ii]]);
                SitesCut += stand.numberOfActiveSites();
                Ldpoint pt = new Ldpoint();
                int     m;
                int     k;
                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
                    StandsCut++;
                    BA_toCut = TmpBasalAreaS_avg - TargetVolume;
                    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;
                        // Console.WriteLine(shareCut_ACell);
                        if (shareCut_ACell > 0)
                        {
                            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);
                        }
                    }
                }
            }
        }
Exemple #3
0
        public void reharvest()
        {
            Stand stand = new Stand();

            for (int ii = 0; ii < itsStands.Count; ii++)
            {
                stand.Copy(BoundedPocketStandHarvester.pstands[itsStands[ii]]);
                SitesCut += stand.numberOfActiveSites();
                double  stocking_debug = computeStandStocking(stand);
                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();
                if (TmpStockingS <= Mininum_Stocking)
                {
                }
                else
                { //Cut trees here
                    StandsCut++;
                    Stocking_toCut = TmpStockingS - TargetStocking;
                    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_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);
                        }
                    }
                }
            }
        }
Exemple #4
0
 public StandIterator(Stand s)
 {
     stand.Copy(s);
     p.x = s.itsMinPoint.x;
     p.y = s.itsMinPoint.y;
     if (s.itsMinPoint.x <= 0 && s.itsMinPoint.y <= 0)
     {
         throw new Exception("Invaild stand point");
     }
     while (moreSites() && !stand.inStand(p.y, p.x))
     {
         advance();
     }
 }
        public void reharvest()
        {
            Stand stand = new Stand();
            MultiplePocketStandHarvester theStandHarvester;
            int           standCut;
            SiteHarvester theSiteHarvester = new SiteHarvester(GetUserInputId(), getRemovalMask(), getReport(), getDuration());

            getReport().reset();

            for (int i = 0; i < itsStands.Count; i++)
            {
                //        stand = stands(it.current());  Modified by Vera
                stand.Copy(BoundedPocketStandHarvester.pstands[itsStands[i]]);
                theStandHarvester = new MultiplePocketStandHarvester(stand, itsStandProportion, itsMeanGroupSize, itsStandardDeviation, theSiteHarvester);
                standCut          = theStandHarvester.Harvest();
                theStandHarvester = null;
            }
            writeReport(BoundedPocketStandHarvester.harvestOutputFile2);
        }
        public void filter(ref IntArray theStandArray, ref IntArray theAgeArray, ref int theLength)
        {
            Stand stand = new Stand();

            int theNewLength = 0;

            List <int> it = new List <int>();

            it = itsManagementArea.itsStandList;
            for (int i = 0; i < it.Count; i++)
            {
                int id = it[i];
                stand.Copy(BoundedPocketStandHarvester.pstands[id]);
                if (stand.canBeHarvested() && stand.getAge() >= itsRotationAge)
                {
                    theNewLength++;
                    theStandArray[theNewLength] = id;
                    theAgeArray[theNewLength]   = stand.getAge();
                }
            }
            theLength = theNewLength;
        }