2013-04-04 08:24:40 +02:00
|
|
|
/*
|
2015-04-14 15:47:22 +02:00
|
|
|
Copyright (C) 2013 Statoil ASA, Norway.
|
|
|
|
|
|
|
|
|
|
The file 'well_ts.c' is part of ERT - Ensemble based Reservoir Tool.
|
|
|
|
|
|
|
|
|
|
ERT is free software: you can redistribute it and/or modify
|
|
|
|
|
it under the terms of the GNU General Public License as published by
|
|
|
|
|
the Free Software Foundation, either version 3 of the License, or
|
|
|
|
|
(at your option) any later version.
|
|
|
|
|
|
|
|
|
|
ERT is distributed in the hope that it will be useful, but WITHOUT ANY
|
|
|
|
|
WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
|
|
|
|
FITNESS FOR A PARTICULAR PURPOSE.
|
|
|
|
|
|
|
|
|
|
See the GNU General Public License at <http://www.gnu.org/licenses/gpl.html>
|
|
|
|
|
for more details.
|
2013-04-04 08:24:40 +02:00
|
|
|
*/
|
|
|
|
|
#include <stdlib.h>
|
|
|
|
|
#include <stdbool.h>
|
|
|
|
|
|
|
|
|
|
#include <ert/util/test_util.h>
|
|
|
|
|
#include <ert/util/stringlist.h>
|
|
|
|
|
#include <ert/util/util.h>
|
|
|
|
|
|
|
|
|
|
#include <ert/ecl/ecl_util.h>
|
2013-08-26 13:56:42 +02:00
|
|
|
#include <ert/ecl/ecl_grid.h>
|
2013-04-04 08:24:40 +02:00
|
|
|
|
|
|
|
|
#include <ert/ecl_well/well_info.h>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
int main(int argc , char ** argv) {
|
|
|
|
|
const char * case_path = argv[1];
|
2013-08-26 13:56:42 +02:00
|
|
|
char * grid_file = util_alloc_filename(NULL , case_path, "EGRID");
|
2013-04-04 08:24:40 +02:00
|
|
|
stringlist_type * file_list = stringlist_alloc_new( );
|
2013-08-26 13:56:42 +02:00
|
|
|
ecl_grid_type * grid = ecl_grid_alloc( grid_file );
|
2013-04-04 08:24:40 +02:00
|
|
|
ecl_util_select_filelist( NULL , case_path , ECL_RESTART_FILE , false , file_list);
|
2015-04-14 15:47:22 +02:00
|
|
|
|
2013-04-04 08:24:40 +02:00
|
|
|
printf("Searching in:%s \n",case_path);
|
|
|
|
|
test_assert_int_equal( 4 , stringlist_get_size( file_list ));
|
|
|
|
|
stringlist_sort( file_list , (string_cmp_ftype *) util_strcmp_int );
|
2015-04-14 15:47:22 +02:00
|
|
|
|
|
|
|
|
|
2013-04-04 08:24:40 +02:00
|
|
|
{
|
|
|
|
|
int i;
|
|
|
|
|
for (i=0; i < stringlist_get_size( file_list); i++) {
|
|
|
|
|
char * ext;
|
|
|
|
|
char * target_ext = util_alloc_sprintf("X%04d" , i);
|
|
|
|
|
util_alloc_file_components( stringlist_iget( file_list , i ) , NULL , NULL , &ext);
|
2015-04-14 15:47:22 +02:00
|
|
|
|
2013-04-04 08:24:40 +02:00
|
|
|
test_assert_string_equal( ext , target_ext);
|
|
|
|
|
free( ext );
|
|
|
|
|
free( target_ext );
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
{
|
2013-08-26 13:56:42 +02:00
|
|
|
well_info_type * well_info = well_info_alloc( grid );
|
2013-04-04 08:24:40 +02:00
|
|
|
int i;
|
2013-12-09 15:19:06 +01:00
|
|
|
for (i=0; i < stringlist_get_size( file_list ); i++) {
|
|
|
|
|
printf("Loading file:%s \n",stringlist_iget( file_list , i ));
|
2014-10-24 11:19:54 +02:00
|
|
|
well_info_load_rstfile( well_info , stringlist_iget(file_list , i) , true);
|
2013-12-09 15:19:06 +01:00
|
|
|
}
|
2013-04-04 08:24:40 +02:00
|
|
|
well_info_free( well_info );
|
|
|
|
|
}
|
2015-04-14 15:47:22 +02:00
|
|
|
|
2013-04-04 08:24:40 +02:00
|
|
|
{
|
2013-08-26 13:56:42 +02:00
|
|
|
well_info_type * well_info = well_info_alloc( grid );
|
2013-04-04 08:24:40 +02:00
|
|
|
int i;
|
|
|
|
|
stringlist_reverse( file_list );
|
2015-04-14 15:47:22 +02:00
|
|
|
for (i=0; i < stringlist_get_size( file_list ); i++)
|
2014-10-24 11:19:54 +02:00
|
|
|
well_info_load_rstfile( well_info , stringlist_iget(file_list , i), true);
|
2013-04-04 08:24:40 +02:00
|
|
|
well_info_free( well_info );
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
exit(0);
|
|
|
|
|
}
|