vic/drivers/image/src/vic_populate_model_state.c
void
vic_populate_model_state(dmy_struct *dmy_current)
{
    extern all_vars_struct *all_vars;
    extern lake_con_struct *lake_con;
    extern domain_struct    local_domain;
    extern option_struct    options;
    extern soil_con_struct *soil_con;
    extern veg_con_struct **veg_con;

    size_t                  i;

    // read the model state from the netcdf file if there is one
    if (options.INIT_STATE) {
        vic_restore();
    }
    else {
        // else generate a default state
        for (i = 0; i < local_domain.ncells_active; i++) {
            generate_default_state(&(all_vars[i]), &(soil_con[i]), veg_con[i],
                                   dmy_current);
            if (options.LAKES) {
                generate_default_lake_state(&(all_vars[i].lake_var),
                                            &(soil_con[i]), lake_con[i]);
            }
        }
    }

    // compute those state variables that are derived from the others
    for (i = 0; i < local_domain.ncells_active; i++) {
        compute_derived_state_vars(&(all_vars[i]), &(soil_con[i]), veg_con[i]);
        if (options.LAKES) {
            compute_derived_lake_dimensions(&(all_vars[i].lake_var),
                                            lake_con[i]);
        }
    }
}
/******************************************************************************
 * @brief    This function handles tasks related to populating model state.
 *****************************************************************************/
@brief    This function handles tasks related to populating model state.
@brief This function handles tasks related to populating model state .
void
vic_populate_model_state(dmy_struct *dmy_current)
{
    extern all_vars_struct *all_vars;
    extern lake_con_struct *lake_con;
    extern domain_struct    local_domain;
    extern option_struct    options;
    extern soil_con_struct *soil_con;
    extern veg_con_struct **veg_con;
    size_t                  i;
    if (options.INIT_STATE) {
        vic_restore();
    }
    else {
        for (i = 0; i < local_domain.ncells_active; i++) {
            generate_default_state(&(all_vars[i]), &(soil_con[i]), veg_con[i],
                                   dmy_current);
            if (options.LAKES) {
                generate_default_lake_state(&(all_vars[i].lake_var),
                                            &(soil_con[i]), lake_con[i]);
            }
        }
    }
    for (i = 0; i < local_domain.ncells_active; i++) {
        compute_derived_state_vars(&(all_vars[i]), &(soil_con[i]), veg_con[i]);
        if (options.LAKES) {
            compute_derived_lake_dimensions(&(all_vars[i].lake_var),
                                            lake_con[i]);
        }
    }
}
void vic_populate_model_state ( dmy_struct * dmy_current ) { extern all_vars_struct * all_vars ; extern lake_con_struct * lake_con ; extern domain_struct local_domain ; extern option_struct options ; extern soil_con_struct * soil_con ; extern veg_con_struct * * veg_con ; size_t i ; if ( options . INIT_STATE ) { vic_restore ( ) ; } else { for ( i = 0 ; i < local_domain . ncells_active ; i ++ ) { generate_default_state ( & ( all_vars [ i ] ) , & ( soil_con [ i ] ) , veg_con [ i ] , dmy_current ) ; if ( options . LAKES ) { generate_default_lake_state ( & ( all_vars [ i ] . lake_var ) , & ( soil_con [ i ] ) , lake_con [ i ] ) ; } } } for ( i = 0 ; i < local_domain . ncells_active ; i ++ ) { compute_derived_state_vars ( & ( all_vars [ i ] ) , & ( soil_con [ i ] ) , veg_con [ i ] ) ; if ( options . LAKES ) { compute_derived_lake_dimensions ( & ( all_vars [ i ] . lake_var ) , lake_con [ i ] ) ; } } }
@brief    This function handles tasks related to populating model state.
@brief This function handles tasks related to populating model state .
// read the model state from the netcdf file if there is one // else generate a default state // compute those state variables that are derived from the others