Ejemplo n.º 1
0
/*///////////////////////////////////////////////////////////////*/
void        apply_adults_initial_n  (KConfig_n KN, KArray_n& a)
/*
** Initiate adult frequencies
*/
{
    const char* thisfunction = "apply_adults_initial_n";
    IF_DEBUG(DEBUG_TRACE1) fprintf(stderr, "%s\n", thisfunction);
    fill_KArray_n(KN, a, 0.0);
    a[0][0][0][0] = 1.0;
    check_normalization_n(KN, a, thisfunction, "a");
}
Ejemplo n.º 2
0
/*///////////////////////////////////////////////////////////////*/
void        compute_self_progeny_n  (KConfig_n KN)
/*
** Compute proportions of selfed genotypes produced by population.
*/
{
    const char* thisfunction = "compute_self_progeny_n";
    IF_DEBUG(DEBUG_TRACE1) fprintf(stderr, "%s\n", thisfunction);
    if (KN->current_x != KN_CURRENT_PROGENY_TO_X1 &&
        KN->current_x != KN_CURRENT_X2) {
        char buf[200];
        sprintf(buf, "%s: wrong current x array = %d",
                thisfunction, KN->current_x);
        fatal(buf);
    }
    if (KN->current_x == KN_CURRENT_X2) {
        /* we're the first reproduction function to get
        ** called, so we have to zero the destination array,
        ** which is KN->x1
        */
        fill_KArray_n(KN, KN->x1, 0.0);
    }
    apply_self_progeny_n(KN, KN->x1, KN->x2);
    KN->current_x = KN_CURRENT_PROGENY_TO_X1;
}
Ejemplo n.º 3
0
/*///////////////////////////////////////////////////////////////*/
void        compute_gametes_n   (KConfig_n KN)
/*
** Compute genotype proportions for male and female gametes.
*/
{
    const char* thisfunction = "compute_gametes_n";
    IF_DEBUG(DEBUG_TRACE1) fprintf(stderr, "%s\n", thisfunction);
    if (KN->current_x != KN_CURRENT_PROGENY_TO_X1 &&
        KN->current_x != KN_CURRENT_X2) {
        char buf[200];
        sprintf(buf, "%s: wrong current x array = %d",
                thisfunction, KN->current_x);
        fatal(buf);
    }
    if (KN->current_x == KN_CURRENT_X2) {
        /* we're the first reproduction function to get
        ** called, so we have to zero the destination array,
        ** which is KN->x1
        */
        fill_KArray_n(KN, KN->x1, 0.0);
    }
    apply_gametes_n(KN, KN->mgam, KN->fgam, KN->x2);
    KN->current_x = KN_CURRENT_GAMETES_X2_TO_X1;
}