/** The input vectors i,j,k should contain offset zero values. */ block_obs_type * block_obs_alloc(const char * obs_key, block_obs_source_type source_type , const stringlist_type * summary_keys , const void * data_config , const ecl_grid_type * grid , int size, const int * i, const int * j, const int * k, const double * obs_value, const double * obs_std) { block_obs_validate_ijk( grid , size , i,j,k); { block_obs_type * block_obs = util_malloc(sizeof * block_obs); char * sum_kw = NULL; UTIL_TYPE_ID_INIT( block_obs , BLOCK_OBS_TYPE_ID ); block_obs->obs_key = util_alloc_string_copy(obs_key); block_obs->data_config = data_config; block_obs->source_type = source_type; block_obs->size = 0; block_obs->point_list = NULL; block_obs->grid = grid; block_obs_resize( block_obs , size ); { for (int l=0; l < size; l++) { int active_index = ecl_grid_get_active_index3( block_obs->grid , i[l],j[l],k[l]); char * sum_key = NULL; if (source_type == SOURCE_SUMMARY) sum_key = stringlist_iget( summary_keys , l ); block_obs->point_list[l] = point_obs_alloc(source_type , i[l] , j[l] , k[l] , active_index , sum_key , obs_value[l] , obs_std[l]); } } return block_obs; } }
void block_obs_append_summary_obs( block_obs_type * block_obs , int i , int j , int k , const char * sum_key , double value , double std) { int active_index = ecl_grid_get_active_index3( block_obs->grid , i , j , k ); point_obs_type * point_obs = point_obs_alloc( SOURCE_SUMMARY , i , j , k , active_index , sum_key , value , std); block_obs_append_point( block_obs , point_obs ); }
void block_obs_append_field_obs( block_obs_type * block_obs , int i , int j , int k , double value , double std) { int active_index = ecl_grid_get_active_index3( block_obs->grid , i , j , k ); point_obs_type * point_obs = point_obs_alloc( SOURCE_FIELD , i , j , k , active_index , NULL , value , std); block_obs_append_point( block_obs , point_obs ); }