vic/drivers/classic/src/alloc_veg_hist.c
void
alloc_veg_hist(int                nrecs,
               int                nveg,
               veg_hist_struct ***veg_hist)
{
    int i, j;

    *veg_hist = calloc(nrecs, sizeof(*(*veg_hist)));
    check_alloc_status((*veg_hist), "Memory allocation error.");

    for (i = 0; i < nrecs; i++) {
        (*veg_hist)[i] = calloc(nveg + 1, sizeof(*((*veg_hist)[i])));
        check_alloc_status((*veg_hist)[i], "Memory allocation error.");

        for (j = 0; j < nveg + 1; j++) {
            (*veg_hist)[i][j].albedo =
                calloc(NR + 1, sizeof(*((*veg_hist)[i][j].albedo)));
            check_alloc_status((*veg_hist)[i][j].albedo,
                               "Memory allocation error.");
            (*veg_hist)[i][j].displacement = calloc(NR + 1,
                                                    sizeof(*((*veg_hist)[i][j].
                                                             displacement)));
            check_alloc_status((*veg_hist)[i][j].displacement,
                               "Memory allocation error.");
            (*veg_hist)[i][j].fcanopy = calloc(NR + 1,
                                               sizeof(*((*veg_hist)[i][j].
                                                        fcanopy)));
            check_alloc_status((*veg_hist)[i][j].fcanopy,
                               "Memory allocation error.");
            (*veg_hist)[i][j].LAI =
                calloc(NR + 1, sizeof(*((*veg_hist)[i][j].LAI)));
            check_alloc_status((*veg_hist)[i][j].LAI,
                               "Memory allocation error.");
            (*veg_hist)[i][j].roughness = calloc(NR + 1,
                                                 sizeof(*((*veg_hist)[i][j].
                                                          roughness)));
            check_alloc_status((*veg_hist)[i][j].roughness,
                               "Memory allocation error.");
        }
    }
}
/******************************************************************************
 * @brief    Allocate memory for veg his structure.
 *****************************************************************************/
@brief    Allocate memory for veg his structure.
@brief Allocate memory for veg his structure .
void
alloc_veg_hist(int                nrecs,
               int                nveg,
               veg_hist_struct ***veg_hist)
{
    int i, j;
    *veg_hist = calloc(nrecs, sizeof(*(*veg_hist)));
    check_alloc_status((*veg_hist), "Memory allocation error.");
    for (i = 0; i < nrecs; i++) {
        (*veg_hist)[i] = calloc(nveg + 1, sizeof(*((*veg_hist)[i])));
        check_alloc_status((*veg_hist)[i], "Memory allocation error.");
        for (j = 0; j < nveg + 1; j++) {
            (*veg_hist)[i][j].albedo =
                calloc(NR + 1, sizeof(*((*veg_hist)[i][j].albedo)));
            check_alloc_status((*veg_hist)[i][j].albedo,
                               "Memory allocation error.");
            (*veg_hist)[i][j].displacement = calloc(NR + 1,
                                                    sizeof(*((*veg_hist)[i][j].
                                                             displacement)));
            check_alloc_status((*veg_hist)[i][j].displacement,
                               "Memory allocation error.");
            (*veg_hist)[i][j].fcanopy = calloc(NR + 1,
                                               sizeof(*((*veg_hist)[i][j].
                                                        fcanopy)));
            check_alloc_status((*veg_hist)[i][j].fcanopy,
                               "Memory allocation error.");
            (*veg_hist)[i][j].LAI =
                calloc(NR + 1, sizeof(*((*veg_hist)[i][j].LAI)));
            check_alloc_status((*veg_hist)[i][j].LAI,
                               "Memory allocation error.");
            (*veg_hist)[i][j].roughness = calloc(NR + 1,
                                                 sizeof(*((*veg_hist)[i][j].
                                                          roughness)));
            check_alloc_status((*veg_hist)[i][j].roughness,
                               "Memory allocation error.");
        }
    }
}
void alloc_veg_hist ( int nrecs , int nveg , veg_hist_struct * * * veg_hist ) { int i , j ; * veg_hist = calloc ( nrecs , sizeof ( * ( * veg_hist ) ) ) ; check_alloc_status ( ( * veg_hist ) , " " ) ; for ( i = 0 ; i < nrecs ; i ++ ) { ( * veg_hist ) [ i ] = calloc ( nveg + 1 , sizeof ( * ( ( * veg_hist ) [ i ] ) ) ) ; check_alloc_status ( ( * veg_hist ) [ i ] , " " ) ; for ( j = 0 ; j < nveg + 1 ; j ++ ) { ( * veg_hist ) [ i ] [ j ] . albedo = calloc ( NR + 1 , sizeof ( * ( ( * veg_hist ) [ i ] [ j ] . albedo ) ) ) ; check_alloc_status ( ( * veg_hist ) [ i ] [ j ] . albedo , " " ) ; ( * veg_hist ) [ i ] [ j ] . displacement = calloc ( NR + 1 , sizeof ( * ( ( * veg_hist ) [ i ] [ j ] . displacement ) ) ) ; check_alloc_status ( ( * veg_hist ) [ i ] [ j ] . displacement , " " ) ; ( * veg_hist ) [ i ] [ j ] . fcanopy = calloc ( NR + 1 , sizeof ( * ( ( * veg_hist ) [ i ] [ j ] . fcanopy ) ) ) ; check_alloc_status ( ( * veg_hist ) [ i ] [ j ] . fcanopy , " " ) ; ( * veg_hist ) [ i ] [ j ] . LAI = calloc ( NR + 1 , sizeof ( * ( ( * veg_hist ) [ i ] [ j ] . LAI ) ) ) ; check_alloc_status ( ( * veg_hist ) [ i ] [ j ] . LAI , " " ) ; ( * veg_hist ) [ i ] [ j ] . roughness = calloc ( NR + 1 , sizeof ( * ( ( * veg_hist ) [ i ] [ j ] . roughness ) ) ) ; check_alloc_status ( ( * veg_hist ) [ i ] [ j ] . roughness , " " ) ; } } }
@brief    Allocate memory for veg his structure.
@brief Allocate memory for veg his structure .