Skip to content
This repository has been archived by the owner on Jul 19, 2021. It is now read-only.

Commit

Permalink
Log an error if GEN_DATA loader misses last_report
Browse files Browse the repository at this point in the history
  • Loading branch information
joakim-hove committed Sep 21, 2017
1 parent 835544f commit d00b8e4
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 7 deletions.
19 changes: 16 additions & 3 deletions libenkf/src/enkf_state.c
Original file line number Diff line number Diff line change
Expand Up @@ -645,12 +645,24 @@ static void enkf_state_internalize_GEN_DATA(enkf_state_type * enkf_state ,
const model_config_type * model_config ,
int last_report) {

member_config_type * my_config = enkf_state->my_config;
const int iens = member_config_get_iens( my_config );
stringlist_type * keylist_GEN_DATA = ensemble_config_alloc_keylist_from_impl_type(enkf_state->ensemble_config,
GEN_DATA);


if (stringlist_get_size( keylist_GEN_DATA) > 0) {
if (last_report <= 0) {
res_log_add_message( LOG_ERROR, stderr, "Trying to load GEN_DATA without properly set last_report - THIS WILL FAIL.", false);
stringlist_free( keylist_GEN_DATA );
return;
}
}


const run_arg_type * run_arg = forward_load_context_get_run_arg( load_context );
enkf_fs_type * result_fs = run_arg_get_result_fs( run_arg );
member_config_type * my_config = enkf_state->my_config;
const int iens = member_config_get_iens( my_config );


for (int ikey=0; ikey < stringlist_get_size( keylist_GEN_DATA ); ikey++) {
enkf_node_type * node = enkf_state_get_node( enkf_state , stringlist_iget( keylist_GEN_DATA , ikey));
Expand Down Expand Up @@ -744,7 +756,8 @@ static int enkf_state_internalize_results(enkf_state_type * enkf_state , run_arg
last_report = model_config_get_last_history_restart( enkf_state->shared_info->model_config);

/* Ensure that the last step is internalized? */
model_config_set_internalize_state( model_config , last_report);
if (last_report > 0)
model_config_set_internalize_state( model_config , last_report);

for (report_step = run_arg_get_load_start(run_arg); report_step <= last_report; report_step++) {
bool store_vectors = (report_step == last_report);
Expand Down
6 changes: 2 additions & 4 deletions libenkf/src/model_config.c
Original file line number Diff line number Diff line change
Expand Up @@ -659,10 +659,8 @@ int model_config_get_last_history_restart(const model_config_type * config) {
else {
if (config->external_time_map)
return time_map_get_last_step( config->external_time_map);
else {
fprintf(stderr,"** Warning: Trying to get the last restart number - no history/time_map object has been registered.\n");
return 0;
}
else
return -1;
}
}

Expand Down

0 comments on commit d00b8e4

Please sign in to comment.