#4762 Fix ecl_grid_reset_actnum in the libecl-team suggested way

This commit is contained in:
Gaute Lindkvist
2019-10-22 10:40:04 +02:00
parent 1255c877d7
commit 7bbe505d39
3 changed files with 36 additions and 2 deletions

View File

@@ -287,6 +287,17 @@ const int * ecl_coarse_cell_get_box_ptr( const ecl_coarse_cell_type * coarse_cel
/*****************************************************************/ /*****************************************************************/
void ecl_coarse_cell_reset_active_index(ecl_coarse_cell_type * coarse_cell, int active_value) {
if (active_value & CELL_ACTIVE_MATRIX)
{
coarse_cell->active_index = -1;
}
if (active_value & CELL_ACTIVE_FRACTURE)
{
coarse_cell->active_fracture_index = -1;
}
}
void ecl_coarse_cell_update_index( ecl_coarse_cell_type * coarse_cell , int global_index , int * active_index , int * active_fracture_index , int active_value) { void ecl_coarse_cell_update_index( ecl_coarse_cell_type * coarse_cell , int global_index , int * active_index , int * active_fracture_index , int active_value) {
if (active_value & CELL_ACTIVE_MATRIX) { if (active_value & CELL_ACTIVE_MATRIX) {

View File

@@ -1875,7 +1875,29 @@ static void ecl_grid_set_active_index(ecl_grid_type * ecl_grid) {
} else { } else {
/* --- More involved path in the case of coarsening groups. --- */ /* --- More involved path in the case of coarsening groups. --- */
/* 1: Go through all the cells and set the active index. In the /* 1: Reset cell active_index across the entire grid.
In the involved path ecl_coarse_cell_update_index() only updates
the coarse cells' active_index if it is -1. */
for (global_index = 0; global_index < ecl_grid->size; global_index++) {
ecl_cell_type * cell = ecl_grid_get_cell(ecl_grid, global_index);
if (cell->coarse_group == COARSE_GROUP_NONE)
{
if (cell->active & CELL_ACTIVE_MATRIX)
{
cell->active_index[MATRIX_INDEX] = -1;
}
if (cell->active & CELL_ACTIVE_FRACTURE)
{
cell->active_index[FRACTURE_INDEX] = -1;
}
} else {
ecl_coarse_cell_type * coarse_cell = ecl_grid_iget_coarse_group(ecl_grid, cell->coarse_group);
ecl_coarse_cell_reset_active_index(coarse_cell, cell->active);
}
}
/* 2: Go through all the cells and set the active index. In the
case of coarse cells we only set the common active index of case of coarse cells we only set the common active index of
the entire coarse cell. the entire coarse cell.
*/ */
@@ -1907,7 +1929,7 @@ static void ecl_grid_set_active_index(ecl_grid_type * ecl_grid) {
/* /*
2: Go through all the coarse cells and set the active index and 3: Go through all the coarse cells and set the active index and
active value of all the cells in the coarse cell to the active value of all the cells in the coarse cell to the
common value for the coarse cell. common value for the coarse cell.
*/ */

View File

@@ -51,6 +51,7 @@ int ecl_coarse_cell_iget_cell_index(ecl_coarse_cell_type * coarse_cell,
const int * ecl_coarse_cell_get_index_ptr(ecl_coarse_cell_type * coarse_cell); const int * ecl_coarse_cell_get_index_ptr(ecl_coarse_cell_type * coarse_cell);
const int_vector_type * ecl_coarse_cell_get_index_vector(ecl_coarse_cell_type * coarse_cell); const int_vector_type * ecl_coarse_cell_get_index_vector(ecl_coarse_cell_type * coarse_cell);
void ecl_coarse_cell_reset_active_index(ecl_coarse_cell_type * coarse_cell, int active_value);
void ecl_coarse_cell_update_index(ecl_coarse_cell_type * coarse_cell, void ecl_coarse_cell_update_index(ecl_coarse_cell_type * coarse_cell,
int global_index, int global_index,
int * active_index, int * active_index,