int field_config_parse_user_key(const field_config_type * config, const char * index_key , int *i , int *j , int *k) { int return_value = 0; if (field_config_parse_user_key__( index_key , i , j , k)) { if(field_config_ijk_valid(config, *i, *j, *k)) { int active_index = field_config_active_index(config , *i,*j,*k); if (active_index < 0) return_value = 3; /* ijk corresponds to an inactive cell. */ } else return_value = 2; /* ijk is outside the grid. */ } else return_value = 1; /* Could not be parsed to three integers. */ return return_value; }
void block_obs_user_get(const block_obs_type * block_obs , const char * index_key , double *value , double * std, bool * valid) { int i,j,k; *valid = false; if (field_config_parse_user_key__( index_key , &i , &j , &k)) { int active_index = ecl_grid_get_active_index3(block_obs->grid , i,j,k); int l = 0; /* iterating through all the cells the observation is observing. */ while (!(*valid) && l < block_obs->size) { const point_obs_type * point_obs = block_obs->point_list[l]; if (point_obs->active_index == active_index) { *value = point_obs->value; *std = point_obs->std; *valid = true; } l++; } } }