예제 #1
0
파일: Well.cpp 프로젝트: alfbr/opm-common
 bool Well::wellNameInWellNamePattern(const std::string& wellName, const std::string& wellNamePattern) {
     bool wellNameInPattern = false;
     if (util_fnmatch( wellNamePattern.c_str() , wellName.c_str()) == 0) {
         wellNameInPattern = true;
     }
     return wellNameInPattern;
 }
예제 #2
0
 void ParseContext::patternUpdate( const std::string& pattern , InputError::Action action) {
     const char * c_pattern = pattern.c_str();
     for (const auto& pair : m_errorContexts) {
         const std::string& key = pair.first;
         if (util_fnmatch( c_pattern , key.c_str()) == 0)
             updateKey( key , action );
      }
 }
예제 #3
0
파일: stringlist.c 프로젝트: akva2/ert
int stringlist_append_matching_elements(stringlist_type * target , const stringlist_type * src , const char * pattern) {
      int ielm;
    int match_count = 0;
    for (ielm = 0; ielm < stringlist_get_size( src ); ielm++) {
      const char * item = stringlist_iget( src , ielm );
      if (util_fnmatch( pattern , item ) == 0) {
        stringlist_append_copy( target , item );
        match_count++;
      }
    }
    return match_count;
}
예제 #4
0
bool summary_key_matcher_match_summary_key(const summary_key_matcher_type * matcher, const char * summary_key) {
    stringlist_type * keys = hash_alloc_stringlist(matcher->key_set);
    bool has_key = false;

    for (int i = 0; i < stringlist_get_size(keys); i++) {
        const char * pattern = stringlist_iget(keys, i);
        if(util_fnmatch(pattern, summary_key) == 0) {
            has_key = true;
            break;
        }
    }

    stringlist_free(keys);

    return has_key;
}
예제 #5
0
int ecl_rft_file_get_size__( const ecl_rft_file_type * rft_file, const char * well_pattern , time_t recording_time) {
  if ((well_pattern == NULL) && (recording_time < 0))
    return vector_get_size( rft_file->data );
  else {
    int match_count = 0;
    int i;
    for ( i=0; i < vector_get_size( rft_file->data ); i++) {
      const ecl_rft_node_type * rft = vector_iget_const( rft_file->data , i);

      if (well_pattern) {
        if (util_fnmatch( well_pattern , ecl_rft_node_get_well_name( rft )) != 0)
          continue;
      }

      /*OK - we either do not care about the well, or alternatively the well matches. */
      if (recording_time >= 0) {
        if (recording_time != ecl_rft_node_get_date( rft ))
          continue;
      }
      match_count++;
    }
    return match_count;
  }
}