예제 #1
0
void enkf_main_set_fs( enkf_main_type * enkf_main , enkf_fs_type * fs , const char * case_path /* Can be NULL */) {
  if (enkf_main->dbase != fs) {
    enkf_fs_incref( fs );

    if (enkf_main->dbase)
      enkf_fs_decref( enkf_main->dbase );

    enkf_main->dbase = fs;
    enkf_main_invalidate_cache(enkf_main);
    enkf_main_update_current_case(enkf_main, case_path);
  }
}
예제 #2
0
void enkf_main_set_fs( enkf_main_type * enkf_main , enkf_fs_type * fs , const char * case_path /* Can be NULL */) {
  if (enkf_main->dbase != fs) {
    enkf_fs_incref( fs );

    if (enkf_main->dbase)
      enkf_fs_decref(enkf_main->dbase);

    enkf_main->dbase = fs;
    enkf_main_update_current_case(enkf_main, case_path);

    enkf_main_update_summary_config_from_fs__(enkf_main, fs);
    enkf_main_update_custom_kw_config_from_fs__(enkf_main, fs);
  }
}
예제 #3
0
enkf_fs_type * enkf_main_mount_alt_fs(const enkf_main_type * enkf_main , const char * case_path , bool create) {
  if (enkf_main_case_is_current( enkf_main , case_path )) {
    // Fast path - we just return a reference to the currently selected case;
    // with increased refcount.
    enkf_fs_incref( enkf_main->dbase );
    return enkf_main->dbase;
  } else {
    // We have asked for an alterantive fs - must mount and possibly create that first.
    enkf_fs_type * new_fs = NULL;
    if (case_path != NULL) {
      char * new_mount_point    = enkf_main_alloc_mount_point( enkf_main , case_path );

      if (!enkf_fs_exists( new_mount_point )) {
        if (create)
          enkf_main_create_fs( enkf_main , case_path );
      }

      new_fs = enkf_fs_mount( new_mount_point );
      free( new_mount_point );
    }
    return new_fs;
  }
}
예제 #4
0
enkf_fs_type * enkf_main_mount_alt_fs(const enkf_main_type * enkf_main , const char * case_path , bool create) {
    if (enkf_main_case_is_current( enkf_main , case_path )) {
        // Fast path - we just return a reference to the currently selected case;
        // with increased refcount.
        enkf_fs_incref( enkf_main->dbase );
        return enkf_main->dbase;
    } else {
        // We have asked for an alterantive fs - must mount and possibly create that first.
        enkf_fs_type * new_fs = NULL;
        if (case_path != NULL) {
            char * new_mount_point    = enkf_main_alloc_mount_point( enkf_main , case_path );

            if (!enkf_fs_exists( new_mount_point )) {
                if (create)
                    enkf_main_create_fs( enkf_main , case_path );
            }

            new_fs = enkf_fs_mount( new_mount_point );
            if (new_fs) {
                const model_config_type * model_config = enkf_main_get_model_config( enkf_main );
                const ecl_sum_type * refcase = model_config_get_refcase( model_config );

                if (refcase) {
                    time_map_type * time_map = enkf_fs_get_time_map( new_fs );
                    if (time_map_attach_refcase( time_map , refcase))
                        time_map_set_strict( time_map , false );
                    else
                        ert_log_add_fmt_message(1 , stderr , "Warning mismatch between refcase:%s and existing case:%s" , ecl_sum_get_case( refcase ) , new_mount_point);
                }
            }

            free( new_mount_point );
        }
        return new_fs;
    }
}
예제 #5
0
파일: enkf_fs.c 프로젝트: shulNN/ert
enkf_fs_type * enkf_fs_get_ref( enkf_fs_type * fs ) {
  enkf_fs_incref( fs );
  return fs;
}