void ecl_config_free(ecl_config_type * ecl_config) { ecl_io_config_free( ecl_config->io_config ); if (ecl_config->eclbase != NULL) path_fmt_free( ecl_config->eclbase ); set_free( ecl_config->static_kw_set ); stringlist_free( ecl_config->user_static_kw ); util_safe_free(ecl_config->data_file); if (ecl_config->sched_file != NULL) sched_file_free(ecl_config->sched_file); util_safe_free(ecl_config->schedule_target_file); hash_free( ecl_config->fixed_length_kw ); util_safe_free(ecl_config->input_init_section); util_safe_free(ecl_config->init_section); util_safe_free(ecl_config->schedule_prediction_file); if (ecl_config->grid != NULL) ecl_grid_free( ecl_config->grid ); ecl_refcase_list_free( ecl_config->refcase_list ); free(ecl_config); }
time_map_type * enkf_fs_alloc_readonly_time_map( const char * mount_point ) { path_fmt_type * path_fmt = path_fmt_alloc_directory_fmt( DEFAULT_CASE_PATH ); char * filename = path_fmt_alloc_file( path_fmt , false , mount_point , TIME_MAP_FILE); time_map_type * time_map = time_map_fread_alloc_readonly( filename ); path_fmt_free( path_fmt ); free( filename ); return time_map; }
void enkf_fs_close( enkf_fs_type * fs ) { enkf_fs_fsync( fs ); enkf_fs_fwrite_misfit( fs ); enkf_fs_free_driver( fs->dynamic_forecast ); enkf_fs_free_driver( fs->dynamic_analyzed ); enkf_fs_free_driver( fs->parameter ); enkf_fs_free_driver( fs->eclipse_static ); enkf_fs_free_driver( fs->index ); util_safe_free( fs->case_name ); util_safe_free( fs->root_path ); util_safe_free( fs->mount_point ); path_fmt_free( fs->case_fmt ); path_fmt_free( fs->case_member_fmt ); path_fmt_free( fs->case_tstep_fmt ); path_fmt_free( fs->case_tstep_member_fmt ); time_map_free( fs->time_map ); free( fs ); }
static void enkf_fs_umount( enkf_fs_type * fs ) { if (!fs->read_only) { enkf_fs_fsync( fs ); enkf_fs_fwrite_misfit( fs ); } if (fs->lock_fd > 0) { close( fs->lock_fd ); // Closing the lock_file file descriptor - and releasing the lock. util_unlink_existing( fs->lock_file ); } { int refcount = fs->refcount; if (refcount == 0) { enkf_fs_free_driver( fs->dynamic_forecast ); enkf_fs_free_driver( fs->dynamic_analyzed ); enkf_fs_free_driver( fs->parameter ); enkf_fs_free_driver( fs->eclipse_static ); enkf_fs_free_driver( fs->index ); util_safe_free( fs->case_name ); util_safe_free( fs->root_path ); util_safe_free(fs->lock_file); util_safe_free( fs->mount_point ); path_fmt_free( fs->case_fmt ); path_fmt_free( fs->case_member_fmt ); path_fmt_free( fs->case_tstep_fmt ); path_fmt_free( fs->case_tstep_member_fmt ); state_map_free( fs->state_map ); time_map_free( fs->time_map ); cases_config_free( fs->cases_config ); free( fs ); } else util_abort("%s: internal fuckup - tried to umount a filesystem with refcount:%d\n",__func__ , refcount); } }
void enkf_config_node_free(enkf_config_node_type * node) { /* Freeing the underlying node object. */ if (node->freef != NULL) node->freef(node->data); free(node->key); stringlist_free(node->obs_keys); if (node->enkf_infile_fmt != NULL) path_fmt_free( node->enkf_infile_fmt ); if (node->enkf_outfile_fmt != NULL) path_fmt_free( node->enkf_outfile_fmt ); if (node->init_file_fmt != NULL) path_fmt_free( node->init_file_fmt ); if (node->internalize != NULL) bool_vector_free( node->internalize ); if (node->min_std != NULL) enkf_node_free( node->min_std ); vector_free( node->container_nodes ); free(node); }
void model_config_free(model_config_type * model_config) { path_fmt_free( model_config->current_runpath ); if (model_config->enkf_sched != NULL) enkf_sched_free( model_config->enkf_sched ); free( model_config->enspath ); free( model_config->rftpath ); util_safe_free( model_config->jobname_fmt ); util_safe_free( model_config->enkf_sched_file ); util_safe_free( model_config->select_case ); util_safe_free( model_config->case_table_file ); util_safe_free( model_config->current_path_key); if (model_config->history != NULL) history_free(model_config->history); if (model_config->forward_model != NULL) forward_model_free(model_config->forward_model); bool_vector_free(model_config->internalize_state); bool_vector_free(model_config->__load_state); if (model_config->case_names != NULL) stringlist_free( model_config->case_names ); free(model_config); }
void ecl_config_set_eclbase( ecl_config_type * ecl_config , const char * eclbase_fmt ) { if (ecl_config->eclbase != NULL) path_fmt_free( ecl_config->eclbase ); ecl_config->eclbase = path_fmt_alloc_path_fmt( eclbase_fmt ); }