Updated to ERT version 67a38b6899f6935cb13b092105c90274f2b632f5

p4#: 20199
This commit is contained in:
Magne Sjaastad 2013-01-18 15:27:32 +01:00
parent 825be4e8d0
commit 6f257f7dba
17 changed files with 227 additions and 290 deletions

View File

@ -0,0 +1,48 @@
import os
import os.path
import sys
sys.path += ["../../scons-config"]
import global_config
from global_config import LIBUTIL
from global_config import LIBANALYSIS
from global_config import add_static_library
from global_config import add_shared_library
from global_config import add_header
from global_config import get_target
from global_config import add_program
package = "analysis"
lib_path = "../lib"
slib_path = "../lib"
include_path = "../include"
module_path = "../modules"
conf = global_config.get_conf(os.getcwd() , 2)
env = Environment()
conf.update_env( env , [ LIBUTIL , LIBANALYSIS ] , link = False)
src_list = Split("analysis_module.c enkf_linalg.c")
src_list.append("std_enkf.c")
src_list.append("sqrt_enkf.c")
src_list.append("cv_enkf.c")
src_list.append("bootstrap_enkf.c")
src_list.append("null_enkf.c")
src_list.append("fwd_step_enkf.c")
header_list = Split("analysis_module.h analysis_table.h enkf_linalg.h")
add_shared_library( env , conf , slib_path , package , src_list)
add_header( env , conf , include_path , header_list )
env['SHLIBPREFIX'] = ""
add_shared_library( env , conf , module_path , "std_enkf.so" , ["std_enkf.c"] )
add_shared_library( env , conf , module_path , "sqrt_enkf.so" , ["sqrt_enkf.c"] )
add_shared_library( env , conf , module_path , "cv_enkf.so" , ["cv_enkf.c"] )
add_shared_library( env , conf , module_path , "bootstrap_enkf.so" , ["bootstrap_enkf.c"] )
add_shared_library( env , conf , module_path , "null_enkf.so" , ["null_enkf.c"] )
add_shared_library( env , conf , module_path , "fwd_step_enkf.so" , ["fwd_step_enkf.c"] )
Default( include_path , slib_path , module_path )

View File

@ -0,0 +1 @@
SConscript(["src/SConstruct"])

View File

@ -0,0 +1,38 @@
import os
import os.path
import sys
sys.path += ["../../../scons-config"]
import global_config
from global_config import LIBUTIL
from global_config import LIBECL
from global_config import LIBGEOMETRY
from global_config import add_static_library
from global_config import add_shared_library
from global_config import add_header
from global_config import get_target
package = "eclxx"
lib_path = "../lib"
slib_path = "../slib"
include_path = "../include"
bin_path = "../bin"
conf = global_config.get_conf(os.getcwd() , 3)
env = Environment()
conf.update_env( env , [ LIBGEOMETRY , LIBECL , LIBUTIL] , link = False)
src_list = Split("fortio.cxx ecl_kw.cxx")
# tetrahedron.h and point.h are not installed.
header_list = Split("fortio.hpp ecl_kw.hpp")
add_static_library( env , conf , lib_path , package , src_list)
add_shared_library( env , conf , slib_path , package , src_list)
add_header( env , conf , include_path , header_list )
Default( lib_path , include_path , slib_path )

View File

@ -1,88 +0,0 @@
/*
Copyright (C) 2011 Statoil ASA, Norway.
The file 'combine_grdecl.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.
*/
#include <stdlib.h>
#include <ecl_kw.h>
#include <ecl_util.h>
#include <stdio.h>
#include <stdbool.h>
#include <util.h>
#include <ecl_box.h>
int main(int argc, char ** argv) {
//int nx,ny,nz;
//char filename[128];
//ecl_type_enum ecl_type = ecl_float_type;
//bool endian_flip = true;
//
//ecl_kw_type * main_kw;
//ecl_box_type * ecl_box;
//
//printf("Main filename => ");
//scanf("%s" , filename);
//printf("Total size of grid (nx ny nz) => ");
//scanf("%d %d %d" , &nx , &ny , &nz);
//
//{
// FILE * stream = util_fopen(filename , "r");
// main_kw = ecl_kw_fscanf_alloc_grdecl_data(stream , nx*ny*nz , ecl_type , endian_flip);
// fclose(stream);
//}
//ecl_box = ecl_box_alloc(nx,ny,nz, 0, 0 , 0 , 0,0,0);
//
//{
// int scan_count;
// int x1,x2,y1,y2,z1,z2;
// do {
// printf("box: file x1 x2 y1 y2 z1 z2 (^d to exit): ");
// scan_count = scanf("%s %d %d %d %d %d %d" , filename , &x1 , &x2 , &y1 , &y2 , &z1 , &z2);
// if (scan_count == 7) {
// ecl_box_set_size(ecl_box, x1,x2 , y1 , y2 , z1 , z2);
// {
// FILE * stream = util_fopen(filename , "r");
// ecl_kw_type * sub_kw = ecl_kw_fscanf_alloc_grdecl_data(stream , ecl_box_get_box_size(ecl_box) , ecl_type , endian_flip);
// ecl_kw_merge(main_kw , sub_kw , ecl_box);
// ecl_kw_free(sub_kw);
// fclose(stream);
// }
// } else if (scan_count == 2) {
// int format = x1;
//
// if (format == 1) {
// FILE * stream = util_fopen(filename , "w");
// ecl_kw_fprintf_grdecl(main_kw , stream);
// printf("New kw saved to: %s \n",filename);
// fclose(stream);
// } else {
// fortio_type * fortio = fortio_open(filename , "w" , endian_flip);
// ecl_kw_set_fmt_file(main_kw , false);
// ecl_kw_fwrite(main_kw , fortio);
// printf("New kw saved to: %s \n",filename);
// fortio_close(fortio);
// }
//
// }
// } while (scan_count != EOF);
//}
//ecl_box_free(ecl_box);
//ecl_kw_free(main_kw);
exit(1);
}

View File

@ -1,16 +0,0 @@
ecl_util.o : ecl_util.c ecl_util.h
ecl_sum_data.o : ecl_sum_data.c ecl_sum_data.h ecl_util.o ecl_smspec.o ecl_kw.o ecl_file.o ecl_endian_flip.h
ecl_grid.o : ecl_grid.c ecl_grid.h ecl_kw.o ecl_util.o ecl_file.o point.o tetrahedron.o
ecl_region.o : ecl_region.c ecl_region.h ecl_kw.o ecl_grid.o ecl_box.o ecl_util.o
ecl_box.o : ecl_box.c ecl_box.h ecl_grid.o
ecl_well_vars.o : ecl_well_vars.c ecl_well_vars.h
ecl_rft_node.o : ecl_rft_node.c ecl_rft_node.h ecl_kw.o ecl_file.o
point.o : point.c point.h
ecl_rft_file.o : ecl_rft_file.c ecl_rft_file.h ecl_rft_node.o ecl_file.o ecl_endian_flip.h
ecl_file.o : ecl_file.c ecl_file.h fortio.o ecl_kw.o ecl_endian_flip.h
ecl_sum.o : ecl_sum.c ecl_sum.h ecl_util.o ecl_smspec.o ecl_sum_data.o
ecl_io_config.o : ecl_io_config.c ecl_io_config.h ecl_util.o
fortio.o : fortio.c fortio.h
ecl_smspec.o : ecl_smspec.c ecl_smspec.h ecl_kw.o ecl_util.o ecl_file.o
ecl_kw.o : ecl_kw.c ecl_kw.h ecl_util.o fortio.o ecl_endian_flip.h
tetrahedron.o : tetrahedron.c tetrahedron.h point.o

View File

@ -1991,12 +1991,17 @@ static ecl_grid_type * ecl_grid_alloc_EGRID__( ecl_grid_type * main_grid , const
ecl_kw_type * gridhead_kw = ecl_file_iget_named_kw( ecl_file , GRIDHEAD_KW , grid_nr);
ecl_kw_type * zcorn_kw = ecl_file_iget_named_kw( ecl_file , ZCORN_KW , grid_nr);
ecl_kw_type * coord_kw = ecl_file_iget_named_kw( ecl_file , COORD_KW , grid_nr);
ecl_kw_type * filehead_kw = ecl_file_iget_named_kw( ecl_file , FILEHEAD_KW , grid_nr);
ecl_kw_type * corsnum_kw = NULL;
ecl_kw_type * actnum_kw = NULL;
ecl_kw_type * mapaxes_kw = NULL;
int dualp_flag = ecl_kw_iget_int( filehead_kw , FILEHEAD_DUALP_INDEX );
int dualp_flag;
if (grid_nr == 0) {
ecl_kw_type * filehead_kw = ecl_file_iget_named_kw( ecl_file , FILEHEAD_KW , grid_nr);
dualp_flag = ecl_kw_iget_int( filehead_kw , FILEHEAD_DUALP_INDEX );
} else
dualp_flag = main_grid->dualp_flag;
/** If ACTNUM is not present - that is is interpreted as - all active. */
if (ecl_file_get_num_named_kw(ecl_file , ACTNUM_KW) > grid_nr)
actnum_kw = ecl_file_iget_named_kw( ecl_file , ACTNUM_KW , grid_nr);
@ -2095,7 +2100,10 @@ static ecl_grid_type * ecl_grid_alloc_GRID_data__(ecl_grid_type * global_grid ,
*/
ecl_grid_type * ecl_grid_alloc_GRID_data(int num_coords , int nx , int ny , int nz , int coords_size , int ** coords , float ** corners , const float * mapaxes) {
return ecl_grid_alloc_GRID_data__( NULL , num_coords , FILEHEAD_SINGLE_POROSITY , nx , ny , nz , 0 , coords_size , coords , corners , mapaxes);
return ecl_grid_alloc_GRID_data__( NULL ,
num_coords ,
FILEHEAD_SINGLE_POROSITY , /* Does currently not support to determine dualp_flag from inspection. */
nx , ny , nz , 0 , coords_size , coords , corners , mapaxes);
}

View File

@ -1,62 +0,0 @@
/*
Copyright (C) 2011 Statoil ASA, Norway.
The file 'kw_cmp.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.
*/
#include <stdlib.h>
#include <stdio.h>
#include <stdbool.h>
#include <ecl_kw.h>
#include <fortio.h>
#include <string.h>
#include <ecl_fstate.h>
#include <restart_kw_list.h>
void kw_cmp(const char *file1 , const char * file2) {
bool at_eof;
fortio_type *fortio1 = fortio_open(file1 , "r" , true);
fortio_type *fortio2 = fortio_open(file2 , "r" , true);
ecl_block_type * block1 = ecl_block_fread_alloc(0 , false , true , fortio1 , &at_eof);
ecl_block_type * block2 = ecl_block_fread_alloc(0 , false , true , fortio2 , &at_eof);
fortio_close(fortio1);
fortio_close(fortio2);
{
ecl_kw_type *ecl_kw1 , *ecl_kw2;
int index;
ecl_kw1 = ecl_block_get_first_kw(block1);
ecl_kw2 = ecl_block_get_first_kw(block2);
while (ecl_kw1 != NULL && ecl_kw2 != NULL) {
if (ecl_kw_equal(ecl_kw1 , ecl_kw2))
printf("equal\n");
else
printf("different\n");
ecl_kw1 = ecl_block_get_next_kw(block1);
ecl_kw2 = ecl_block_get_next_kw(block2);
}
}
}
int main (int argc , char **argv) {
kw_cmp(argv[1] ,argv[2]);
return 0;
}

View File

@ -1,68 +0,0 @@
/*
Copyright (C) 2011 Statoil ASA, Norway.
The file 'summary_get_last.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.
*/
#include <ecl_fstate.h>
#include <ecl_kw.h>
#include <fortio.h>
#include <msg.h>
#include <stdbool.h>
void summary_file_get_last(const char * summary_file , msg_type * msg) {
const bool fmt_file = false;
ecl_kw_type * seqhdr_kw;
ecl_kw_type * ministep_kw;
ecl_kw_type * params_kw;
fortio_type * fortio = fortio_open(summary_file , "r" , true);
seqhdr_kw = ecl_kw_fread_alloc(fortio , fmt_file);
{
long int start_pos = 0;
while (ecl_kw_fseek_kw("MINISTEP" , fmt_file , false , false , fortio)) {
start_pos = ftell(fortio_get_FILE(fortio));
ecl_kw_fskip(fortio , fmt_file);
}
fseek(fortio_get_FILE(fortio) , start_pos , SEEK_SET);
}
ministep_kw = ecl_kw_fread_alloc(fortio , fmt_file);
params_kw = ecl_kw_fread_alloc(fortio , fmt_file);
fortio_close(fortio);
fortio = fortio_open(summary_file , "w" , true);
ecl_kw_fwrite(seqhdr_kw , fortio);
ecl_kw_fwrite(ministep_kw , fortio);
ecl_kw_fwrite(params_kw , fortio);
fortio_close(fortio);
msg_update(msg , summary_file);
}
int main(int argc , char **argv) {
msg_type * msg = msg_alloc("Ferdig med: " , false);
int i;
msg_show(msg);
for (i=1; i < argc; i++) {
summary_file_get_last(argv[i] , msg);
}
msg_free(msg , false);
return 0;
}

View File

@ -1,51 +0,0 @@
/*
Copyright (C) 2011 Statoil ASA, Norway.
The file 'test.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.
*/
#include <ecl_grav.h>
#include <ecl_file.h>
int main (int argc, char **argv) {
const char * path = "/d/proj/bg/restroll2/restek2/TEG/simu_HM2011";
const char * base = "BCUPD_HISTORYMATCH_JAN11_ECL20072";
{
char * grid_file = ecl_util_alloc_exfilename( path , base , ECL_EGRID_FILE , false , 0 );
char * init_file = ecl_util_alloc_exfilename( path , base , ECL_INIT_FILE , false , 0 );
char * restart_file = ecl_util_alloc_exfilename( path , base , ECL_UNIFIED_RESTART_FILE , false , 0 );
ecl_grav_type * ecl_grav = ecl_grav_alloc( grid_file , init_file );
{
ecl_file_type * base_survey = ecl_file_fread_alloc_unrst_section( restart_file , 23 );
ecl_file_type * monitor_survey = ecl_file_fread_alloc_unrst_section( restart_file , 206 );
ecl_grav_add_survey(ecl_grav , "BASE" , base_survey );
ecl_grav_add_survey( ecl_grav , "MONITOR" , monitor_survey );
printf("grav_eval: %g \n",ecl_grav_eval( ecl_grav , "BASE" , "MONITOR" , 541003 , 6709907 , 297.023);
ecl_file_free( base_survey );
ecl_file_free( monitor_survey );
}
free( grid_file );
free( init_file );
free( restart_file );
}
}

View File

@ -4,8 +4,15 @@ target_link_libraries( ecl_coarse_test ecl )
add_executable( ecl_restart_test ecl_restart_test.c )
target_link_libraries( ecl_restart_test ecl )
add_test( ecl_coarse_test ${EXECUTABLE_OUTPUT_PATH}/ecl_coarse_test ${PROJECT_SOURCE_DIR}/test-data/Statoil/ECLIPSE/LGCcase/LGC_TESTCASE2.EGRID )
add_executable( ecl_lgr_test ecl_lgr_test.c )
target_link_libraries( ecl_lgr_test ecl )
add_test( ecl_coarse_test ${EXECUTABLE_OUTPUT_PATH}/ecl_coarse_test ${PROJECT_SOURCE_DIR}/test-data/Statoil/ECLIPSE/LGCcase/LGC_TESTCASE2.EGRID )
add_test( ecl_restart_test ${EXECUTABLE_OUTPUT_PATH}/ecl_restart_test ${PROJECT_SOURCE_DIR}/test-data/Statoil/ECLIPSE/Gurbat/ECLIPSE.UNRST )
add_test( ecl_lgr_test1 ${EXECUTABLE_OUTPUT_PATH}/ecl_lgr_test ${PROJECT_SOURCE_DIR}/test-data/Statoil/ECLIPSE/10kcase/TEST10K_FLT_LGR_NNC.EGRID)
add_test( ecl_lgr_test2 ${EXECUTABLE_OUTPUT_PATH}/ecl_lgr_test ${PROJECT_SOURCE_DIR}/test-data/Statoil/ECLIPSE/10kcase/TEST10K_FLT_LGR_NNC.GRID)
set_property( TEST ecl_coarse_test PROPERTY LABELS Statoil )
set_property( TEST ecl_restart_test PROPERTY LABELS Statoil )
set_property( TEST ecl_lgr_test1 PROPERTY LABELS Statoil )
set_property( TEST ecl_lgr_test2 PROPERTY LABELS Statoil )

View File

@ -0,0 +1,31 @@
/*
Copyright (C) 2013 Statoil ASA, Norway.
The file 'ecl_lgr_test.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.
*/
#include <stdlib.h>
#include <stdbool.h>
#include <util.h>
#include <ecl_grid.h>
int main(int argc , char ** argv) {
const char * grid_file = argv[1];
ecl_grid_type * ecl_grid = ecl_grid_alloc( grid_file );
ecl_grid_free( ecl_grid );
exit(0);
}

View File

@ -0,0 +1 @@
SConscript(["../SConstruct"])

View File

@ -0,0 +1,29 @@
import os
import os.path
import sys
sys.path += ["../../scons-config"]
import global_config
from global_config import LIBUTIL
from global_config import LIBGEOMETRY
from global_config import add_program
lib_path = "../lib"
include_path = "../include"
bin_path = "../bin"
conf = global_config.get_conf(os.getcwd() , 2)
env = Environment()
lib_list = ["lapack" , "blas", "plplotd" , "m" , "z" , "pthread"]
if conf.g2c:
lib_list.append( "g2c" )
conf.update_env( env , [ LIBGEOMETRY , LIBUTIL ] , ext_liblist = lib_list , link = True)
env.Append( CPPPATH = conf.PLPLOT_INCLUDE_PATH )
env.Append( LIBPATH = conf.PLPLOT_LIB_PATH )
add_program(env , conf , bin_path , "irap_test.x" , "irap_test.c" )
add_program(env , conf , bin_path , "polygon_test.x" , "polygon_test.c" )
Default( bin_path )

View File

@ -0,0 +1,58 @@
# -*-python-*-
#
import os
import os.path
#
# Set umask and file rights so that things are built and installed readable by others
#
umask = os.umask(002)
os.system('chmod o+r *.h')
os.system('chmod ug+rw *.h')
os.system('chmod o+r *.hxx')
os.system('chmod ug+rw *.hxx')
#
# Create variables instdir, bindir, libdir, and incdir, and alias install:
#
basedir = os.environ['SDP_BINDIST_ROOT'] # directory for "binary" distribution
instdir = os.environ['SDP_BINDIST'] # install directory
bindir = instdir + '/bin'
libdir = instdir + '/lib'
incdir = instdir + '/inc'
ib = Alias('install-inc', incdir)
il = Alias('install-lib', libdir)
Alias('install', [ib, il])
# -----------------------------------------------
opt = Environment(CXXFLAGS = '-O3' ,
CFLAGS = '-O2 -std=gnu99 -g -Wall -fPIC -DWITH_TRUETYPE=1' ,
CPPPATH = ['.',incdir] ,
LIBPATH = ['.', libdir]
)
lib_list = ['ecl','plot','util','plplotd','m','z','pthread']
object_files = opt.Object('plot.c')
object_files += opt.Object('plot_dataset.c')
object_files += opt.Object('plot_range.c')
object_files += opt.Object('plot_const_cxx.cxx')
header_files = ['plot.h','plot_dataset.h','plot_range.h','plot_const.h']
header_files += ['plot.hxx','plot_range.hxx','plot_const_cxx.hxx']
newlibs = opt.Library('plot',object_files)
test_progs = opt.Program('testplot_cxx', 'testplot_cxx.cc' , LIBS=lib_list)
Install(libdir,newlibs)
Install(incdir,header_files)

View File

@ -71,6 +71,7 @@ if ert_lib_path:
else:
# Look in the default path "../../lib"
ert_lib_path = os.path.realpath( os.path.join(os.path.dirname( os.path.abspath( __file__)) , "../../lib") )
if not os.path.exists( ert_lib_path ):
ert_lib_path = None
cwrap.clib.ert_lib_path = ert_lib_path