mirror of
https://github.com/OPM/ResInsight.git
synced 2025-02-25 18:55:39 -06:00
#10191 Read NNC data from INIT file for Intersect files
This commit is contained in:
parent
862e67755a
commit
448e3dfcbc
34
ThirdParty/Ert/lib/ecl/ecl_grid.cpp
vendored
34
ThirdParty/Ert/lib/ecl/ecl_grid.cpp
vendored
@ -3126,10 +3126,38 @@ static ecl_grid_type * ecl_grid_alloc_EGRID_all_grids(const char * grid_file, bo
|
||||
}
|
||||
}
|
||||
main_grid->name = util_alloc_string_copy( grid_file );
|
||||
ecl_grid_init_nnc(main_grid, ecl_file);
|
||||
ecl_grid_init_nnc_amalgamated(main_grid, ecl_file);
|
||||
|
||||
ecl_file_close( ecl_file );
|
||||
// If the INIT file type is INTERSECT, we read NNC data from the INIT file
|
||||
// instead of the EGRID file.
|
||||
ecl_file_type* ecl_file_for_nnc_import = ecl_file;
|
||||
|
||||
ecl_file_type* ecl_init_file = NULL;
|
||||
{
|
||||
char* path = NULL;
|
||||
char* basename = NULL;
|
||||
util_alloc_file_components(grid_file, &path, &basename, NULL);
|
||||
char* init_file_name = ecl_util_alloc_filename(path, basename, ECL_INIT_FILE, false, -1);
|
||||
if (util_file_exists(init_file_name)) {
|
||||
ecl_file_type* ecl_init_file = ecl_file_open(init_file_name, 0);
|
||||
if (ecl_init_file) {
|
||||
ecl_version_enum version = ecl_file_get_ecl_version(ecl_init_file);
|
||||
if (version == INTERSECT) {
|
||||
ecl_file_for_nnc_import = ecl_init_file;
|
||||
}
|
||||
}
|
||||
}
|
||||
free(path);
|
||||
free(basename);
|
||||
free(init_file_name);
|
||||
}
|
||||
|
||||
ecl_grid_init_nnc(main_grid, ecl_file_for_nnc_import);
|
||||
ecl_grid_init_nnc_amalgamated(main_grid, ecl_file_for_nnc_import);
|
||||
|
||||
ecl_file_close(ecl_file);
|
||||
|
||||
if (ecl_init_file) ecl_file_close(ecl_init_file);
|
||||
|
||||
return main_grid;
|
||||
} else
|
||||
return NULL;
|
||||
|
Loading…
Reference in New Issue
Block a user