Example #1
0
static int smspec_node_cmp_KEYWORD_WGNAME( const smspec_node_type * node1, const smspec_node_type * node2) {
  int keyword_cmp = strcmp( node1->keyword , node2->keyword);
  if (keyword_cmp != 0)
    return keyword_cmp;

  if (IS_DUMMY_WELL( node1->wgname )) {
    if (IS_DUMMY_WELL( node2->wgname ))
      return 0;
    else
      return 1;
  }

  if (IS_DUMMY_WELL( node2->wgname ))
    return -1;

  return strcmp( node1->wgname , node2->wgname);
}
Example #2
0
bool smspec_node_init_lgr( smspec_node_type * smspec_node ,
                           ecl_smspec_var_type var_type ,
                           const char * wgname  ,
                           const char * keyword ,
                           const char * unit    ,
                           const char * lgr ,
                           const char * key_join_string ,
                           int   lgr_i, int lgr_j , int lgr_k
                         ) {
    bool initOK = true;
    bool wgnameOK = true;
    if ((wgname != NULL) && (IS_DUMMY_WELL(wgname)))
        wgnameOK = false;

    smspec_node_common_init( smspec_node , var_type , keyword , unit );
    switch (var_type) {
    case(ECL_SMSPEC_LOCAL_WELL_VAR):
        if (wgnameOK) {
            smspec_node_set_wgname( smspec_node , wgname );
            smspec_node_set_lgr_name( smspec_node , lgr );
        } else
            initOK = false;
        break;
    case(ECL_SMSPEC_LOCAL_BLOCK_VAR):
        smspec_node_set_lgr_name( smspec_node , lgr );
        smspec_node_set_lgr_ijk( smspec_node , lgr_i, lgr_j , lgr_k );
        break;
    case(ECL_SMSPEC_LOCAL_COMPLETION_VAR):
        if (wgnameOK) {
            smspec_node_set_lgr_name( smspec_node , lgr );
            smspec_node_set_wgname( smspec_node , wgname );
            smspec_node_set_lgr_ijk( smspec_node , lgr_i, lgr_j , lgr_k );
        } else
            initOK = false;
        break;
    default:
        util_abort("%s: internal error:  in LGR function with  non-LGR keyword:%s \n",__func__ , keyword);
    }
    if (initOK)
        smspec_node_set_gen_keys( smspec_node , key_join_string );
    return initOK;
}
Example #3
0
/*
  This *should* become static.
*/
void smspec_node_init( smspec_node_type * smspec_node,
                       ecl_smspec_var_type var_type ,
                       const char * wgname  ,
                       const char * keyword ,
                       const char * unit    ,
                       const char * key_join_string ,
                       const int grid_dims[3] ,
                       int num) {

  bool initOK    = true;
  bool wgnameOK = true;
  if ((wgname != NULL) && (IS_DUMMY_WELL(wgname)))
    wgnameOK = false;

  smspec_node_common_init( smspec_node , var_type , keyword , unit );
  switch (var_type) {
  case(ECL_SMSPEC_COMPLETION_VAR):
    /* Completion variable : WGNAME & NUM */
    smspec_node_set_num( smspec_node , grid_dims , num );
    smspec_node_set_wgname( smspec_node , wgname );
    if (!wgnameOK || num < 0)
      initOK = false;
    break;
  case(ECL_SMSPEC_GROUP_VAR):
    /* Group variable : WGNAME */
    smspec_node_set_wgname( smspec_node , wgname );
    initOK = wgnameOK;
    break;
  case(ECL_SMSPEC_WELL_VAR):
    /* Well variable : WGNAME */
    smspec_node_set_wgname( smspec_node , wgname );
    initOK = wgnameOK;
    break;
  case(ECL_SMSPEC_SEGMENT_VAR):
    smspec_node_set_wgname( smspec_node , wgname );
    smspec_node_set_num( smspec_node , grid_dims , num );
    if (!wgnameOK || num < 0)
      initOK = false;
    break;
  case(ECL_SMSPEC_FIELD_VAR):
    /* Field variable : */
    /* Fully initialized with the smspec_common_init() function */
    break;
  case(ECL_SMSPEC_REGION_VAR):
    /* Region variable : NUM */
    smspec_node_set_num( smspec_node , grid_dims , num );
    break;
  case(ECL_SMSPEC_REGION_2_REGION_VAR):
    /* Region 2 region variable : NUM */
    smspec_node_set_num( smspec_node , grid_dims , num );
    break;
  case(ECL_SMSPEC_BLOCK_VAR):
    /* A block variable : NUM*/
    smspec_node_set_num( smspec_node , grid_dims , num );
    break;
  case(ECL_SMSPEC_MISC_VAR):
    /* Misc variable : */

    /*
       For some keywords the SMSPEC files generated by Eclipse have a
       non zero NUMS value although; it seems that value is required
       for the generatd summaryfiles to display nicely in
       e.g. S3GRAF.
    */

    if (util_string_equal( keyword ,SMSPEC_TIME_KEYWORD))
      smspec_node_set_num( smspec_node , grid_dims , SMSPEC_TIME_NUMS_VALUE );

    if (util_string_equal( keyword ,SMSPEC_YEARS_KEYWORD))
      smspec_node_set_num( smspec_node , grid_dims , SMSPEC_YEARS_NUMS_VALUE );

    break;
  case(ECL_SMSPEC_AQUIFER_VAR):
    smspec_node_set_num( smspec_node , grid_dims , num );
    break;
  default:
    /* Lots of legitimate alternatives which are not internalized. */
    initOK = false;
    break;
  }

  if (initOK)
    smspec_node_set_gen_keys( smspec_node , key_join_string );
}
Example #4
0
bool smspec_node_init( smspec_node_type * smspec_node,
                       ecl_smspec_var_type var_type ,
                       const char * wgname  ,
                       const char * keyword ,
                       const char * unit    ,
                       const char * key_join_string ,
                       const int grid_dims[3] ,
                       int num) {

    bool initOK    = true;
    bool wgnameOK = true;
    if ((wgname != NULL) && (IS_DUMMY_WELL(wgname)))
        wgnameOK = false;

    smspec_node_common_init( smspec_node , var_type , keyword , unit );
    switch (var_type) {
    case(ECL_SMSPEC_COMPLETION_VAR):
        /* Completion variable : WGNAME & NUM */
        if (wgnameOK) {
            smspec_node_set_num( smspec_node , grid_dims , num );
            smspec_node_set_wgname( smspec_node , wgname );
        } else
            initOK = false;
        break;
    case(ECL_SMSPEC_GROUP_VAR):
        /* Group variable : WGNAME */
        if (wgnameOK)
            smspec_node_set_wgname( smspec_node , wgname );
        else
            initOK = false;
        break;
    case(ECL_SMSPEC_WELL_VAR):
        /* Well variable : WGNAME */
        if (wgnameOK)
            smspec_node_set_wgname( smspec_node , wgname );
        else
            initOK = false;
        break;
    case(ECL_SMSPEC_SEGMENT_VAR):
        if (wgnameOK) {
            smspec_node_set_wgname( smspec_node , wgname );
            smspec_node_set_num( smspec_node , grid_dims , num );
        } else
            initOK = false;
        break;
    case(ECL_SMSPEC_FIELD_VAR):
        /* Field variable : */
        /* Fully initialized with the smspec_common_init() function */
        break;
    case(ECL_SMSPEC_REGION_VAR):
        /* Region variable : NUM */
        smspec_node_set_num( smspec_node , grid_dims , num );
        break;
    case(ECL_SMSPEC_BLOCK_VAR):
        /* A block variable : NUM*/
        smspec_node_set_num( smspec_node , grid_dims , num );
        break;
    case(ECL_SMSPEC_MISC_VAR):
        /* Misc variable : */
        /* Fully initialized with the smspec_common_init() function */
        break;
    default:
        /* Lots of legitimate alternatives which are not internalized. */
        initOK = false;
        break;
    }
    if (initOK)
        smspec_node_set_gen_keys( smspec_node , key_join_string );
    return initOK;
}