//--------------------------------------------------------------------------------------------------
/// 
//--------------------------------------------------------------------------------------------------
std::vector<std::string> RifEclipseSummaryTools::findSummaryDataFiles(const std::string& caseFile)
{
    std::vector<std::string> fileNames;

    std::string path;
    std::string base;

    findSummaryHeaderFileInfo(caseFile, NULL, &path, &base, NULL);
    if (path.empty() || base.empty()) return fileNames;

    char* header_file = NULL;
    stringlist_type* summary_file_list = stringlist_alloc_new();

    ecl_util_alloc_summary_files(path.data(), base.data(), NULL, &header_file, summary_file_list);
    if (stringlist_get_size( summary_file_list ) > 0)
    {
        for (int i = 0; i < stringlist_get_size(summary_file_list); i++)
        {
            fileNames.push_back(stringlist_iget(summary_file_list, i));
        }
    }

    util_safe_free(header_file);
    stringlist_free(summary_file_list);

    return fileNames;
}
Example #2
0
//--------------------------------------------------------------------------------------------------
/// 
//--------------------------------------------------------------------------------------------------
QStringList RifEclipseSummaryTools::findSummaryDataFiles(const QString& caseFile)
{
    QStringList fileNames;

    QString path;
    QString base;

    findSummaryHeaderFileInfo(caseFile, nullptr, &path, &base, nullptr);
    if (path.isEmpty() || base.isEmpty()) return fileNames;

    char* header_file = nullptr;
    stringlist_type* summary_file_list = stringlist_alloc_new();

    ecl_util_alloc_summary_files(RiaStringEncodingTools::toNativeEncoded(path).data(), RiaStringEncodingTools::toNativeEncoded(base).data(), nullptr, &header_file, summary_file_list);
    if (stringlist_get_size( summary_file_list ) > 0)
    {
        for (int i = 0; i < stringlist_get_size(summary_file_list); i++)
        {
            fileNames.push_back(RiaStringEncodingTools::fromNativeEncoded(stringlist_iget(summary_file_list, i)));
        }
    }

    util_safe_free(header_file);
    stringlist_free(summary_file_list);

    return fileNames;
}
Example #3
0
File: ecl_sum.c Project: flikka/ert
static bool ecl_sum_fread_case( ecl_sum_type * ecl_sum , bool include_restart) {
  char * header_file;
  stringlist_type * summary_file_list = stringlist_alloc_new();

  bool caseOK = false;

  ecl_util_alloc_summary_files( ecl_sum->path , ecl_sum->base , ecl_sum->ext , &header_file , summary_file_list );
  if ((header_file != NULL) && (stringlist_get_size( summary_file_list ) > 0)) {
    caseOK = ecl_sum_fread( ecl_sum , header_file , summary_file_list , include_restart );
  }
  util_safe_free( header_file );
  stringlist_free( summary_file_list );

  return caseOK;
}
Example #4
0
File: ecl_sum.c Project: flikka/ert
bool ecl_sum_case_exists( const char * input_file ) {
  char * smspec_file = NULL;
  stringlist_type * data_files = stringlist_alloc_new();
  char * path;
  char * basename;
  char * extension;
  bool   case_exists;

  util_alloc_file_components( input_file , &path , &basename , &extension);
  case_exists = ecl_util_alloc_summary_files( path , basename , extension , &smspec_file , data_files );

  util_safe_free( path );
  util_safe_free( basename );
  util_safe_free( extension );
  util_safe_free( smspec_file );
  stringlist_free( data_files );

  return case_exists;
}
//--------------------------------------------------------------------------------------------------
/// 
//--------------------------------------------------------------------------------------------------
void RifEclipseSummaryTools::findSummaryFiles(const std::string& inputFile, 
                                                   std::string* headerFile, 
                                                   std::vector<std::string>* dataFiles)
{
    dataFiles->clear();
    headerFile->clear();

    char* myPath = NULL;
    char* myBase = NULL;
    char* myExtention = NULL;

    util_alloc_file_components(inputFile.data(), &myPath, &myBase, &myExtention);

    std::string path; if(myPath) path = myPath;
    std::string base; if(myBase) base = myBase;
    std::string extention; if(myExtention) extention = myExtention;

    if(path.empty() || base.empty()) return ;

    char* myHeaderFile = NULL;
    stringlist_type* summary_file_list = stringlist_alloc_new();

    ecl_util_alloc_summary_files(path.data(), base.data(), extention.data(), &myHeaderFile, summary_file_list);
    if(myHeaderFile)
    {
        (*headerFile) = myHeaderFile;
        util_safe_free(myHeaderFile);
    }

    if(stringlist_get_size(summary_file_list) > 0)
    {
        for(int i = 0; i < stringlist_get_size(summary_file_list); i++)
        {
            dataFiles->push_back(stringlist_iget(summary_file_list,i));
        }
    }
    stringlist_free(summary_file_list);

    return;
}
Example #6
0
//--------------------------------------------------------------------------------------------------
/// 
//--------------------------------------------------------------------------------------------------
void RifEclipseSummaryTools::findSummaryFiles(const QString& inputFile, 
                                                   QString* headerFile, 
                                                   QStringList* dataFiles)
{
    dataFiles->clear();
    headerFile->clear();

    char* myPath = nullptr;
    char* myBase = nullptr;
    char* myExtention = nullptr;

    util_alloc_file_components(RiaStringEncodingTools::toNativeEncoded(inputFile).data(), &myPath, &myBase, &myExtention);

    QString path; if(myPath) path = RiaStringEncodingTools::fromNativeEncoded(myPath);
    QString base; if(myBase) base = RiaStringEncodingTools::fromNativeEncoded(myBase);
    std::string extention; if(myExtention) extention = myExtention;

    if(path.isEmpty() || base.isEmpty()) return ;

    char* myHeaderFile = nullptr;
    stringlist_type* summary_file_list = stringlist_alloc_new();

    ecl_util_alloc_summary_files(RiaStringEncodingTools::toNativeEncoded(path).data(), RiaStringEncodingTools::toNativeEncoded(base).data(), extention.data(), &myHeaderFile, summary_file_list);
    if(myHeaderFile)
    {
        (*headerFile) = RiaStringEncodingTools::fromNativeEncoded(myHeaderFile);
        util_safe_free(myHeaderFile);
    }

    if(stringlist_get_size(summary_file_list) > 0)
    {
        for(int i = 0; i < stringlist_get_size(summary_file_list); i++)
        {
            dataFiles->push_back(RiaStringEncodingTools::fromNativeEncoded(stringlist_iget(summary_file_list,i)));
        }
    }
    stringlist_free(summary_file_list);

    return;
}