I have now updated the  code by adding a vector class. I’m also using a iget style accessor to copy out the data values.

From: Joakim Hove [mailto:notifications@github.com]
Sent: 5. februar 2014 15:33
To: Ensembles/ert
Cc: Per Røe
Subject: Re: [ert] Ert 494 enkf plot gen kw (#367)


In devel/libenkf/src/enkf_plot_gen_kw.c:

> +    int iens;

> +    enkf_node_type * data_node;

> +

> +    if (enkf_config_node_get_impl_type( plot_gen_kw->config_node ) == CONTAINER)

> +      data_node = enkf_node_alloc_private_container( plot_gen_kw->config_node );

> +    else

> +      data_node = enkf_node_alloc( plot_gen_kw->config_node );

> +

> +    for (iens = 0; iens < ens_size; ++iens) {

> +      if (bool_vector_iget( mask , iens)) {

> +        double value;

> +        node_id_type node_id = { .report_step = report_step ,

> +                                 .state       = state ,

> +                                 .iens        = iens };

> +

> +        if (enkf_node_user_get( data_node , fs , key , node_id , &value)) {

I noticed that for blockdata you have a two-dimensional structure where for each ensemble, iens, you have a vector of data.

That structur should be reproduced.

For GEN_KW i had the impression that there is only one value for a given key for each ensemble member?

For GEN_KW there are typically a handful of elements, i.e. a (small) vector should be created.

Is there an alternative to using enkf_node_user_get?

double_vector_type * data;

gen_kw_type * gen_kw = enkf_node_value_ptr( node );

gen_kw_memcpy_data( gen_kw , true , data);

NB: The function gen_kw_memcpy_data() does not exist yet... The boolean flag should indicate whether the internal N(0,1) value or the transformed value coming from: gen_kw_config_transform() should be used.

—
Reply to this email directly or view it on GitHub<https://github.com/Ensembles/ert/pull/367/files#r9462022>.