Subversion Repositories public iLand

Rev

Rev 1180 | Rev 1182 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 1180 Rev 1181
Line 845... Line 845...
845
            if (!mLDDDensity.isEmpty()) {
845
            if (!mLDDDensity.isEmpty()) {
846
                QPoint pt=sourcemap.indexOf(src);
846
                QPoint pt=sourcemap.indexOf(src);
847
847
848
                for (int r=0;r<mLDDDensity.size(); ++r) {
848
                for (int r=0;r<mLDDDensity.size(); ++r) {
849
                    float ldd_val = mLDDSeedlings / fec; // pixels will have this probability [note: fecundity will be multiplied below]
849
                    float ldd_val = mLDDSeedlings / fec; // pixels will have this probability [note: fecundity will be multiplied below]
850
                    int n = round( mLDDDensity[r] ); // number of pixels to activate
-
 
-
 
850
                    int n;
-
 
851
                    if (mLDDDensity[r]<1)
-
 
852
                        n = drandom()<mLDDDensity[r] ? 1 : 0;
-
 
853
                    else
-
 
854
                        n = round( mLDDDensity[r] ); // number of pixels to activate
851
                    for (int i=0;i<n;++i) {
855
                    for (int i=0;i<n;++i) {
852
                        // distance and direction:
856
                        // distance and direction:
853
                        double radius = nrandom(mLDDDistance[r], mLDDDistance[r+1]) / mSeedMap.cellsize(); // choose a random distance (in pixels)
857
                        double radius = nrandom(mLDDDistance[r], mLDDDistance[r+1]) / mSeedMap.cellsize(); // choose a random distance (in pixels)
854
                        double phi = drandom()*2.*M_PI; // choose a random direction
858
                        double phi = drandom()*2.*M_PI; // choose a random direction
855
                        QPoint ldd(pt.x() + radius*cos(phi), pt.y() + radius*sin(phi));
859
                        QPoint ldd(pt.x() + radius*cos(phi), pt.y() + radius*sin(phi));
Line 869... Line 873...
869
873
870
    // now the seed sources (0..1) are spatially distributed by the kernel (and LDD) without altering the magnitude;
874
    // now the seed sources (0..1) are spatially distributed by the kernel (and LDD) without altering the magnitude;
871
    // now we include the fecundity (=seedling potential per m2 crown area), and convert to the establishment probability p_seed.
875
    // now we include the fecundity (=seedling potential per m2 crown area), and convert to the establishment probability p_seed.
872
    // The number of (potential) seedlings per m2 on each cell is: cell * fecundity[m2]
876
    // The number of (potential) seedlings per m2 on each cell is: cell * fecundity[m2]
873
    // We assume that the availability of 10 potential seedlings/m2 is enough for unconstrained establishment;
877
    // We assume that the availability of 10 potential seedlings/m2 is enough for unconstrained establishment;
874
    const float n_unlimited = 50.f;
-
 
-
 
878
    const float n_unlimited = 100.f;
875
    for (float *p=mSeedMap.begin(); p!=mSeedMap.end(); ++p){
879
    for (float *p=mSeedMap.begin(); p!=mSeedMap.end(); ++p){
876
        if (*p>0.f) {
880
        if (*p>0.f) {
877
            *p = std::min(*p*fec / n_unlimited, 1.f);
881
            *p = std::min(*p*fec / n_unlimited, 1.f);
878
        }
882
        }
879
    }
883
    }