From b63f51921d4901bf540b064ded990d652fb6ffaf Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jacob=20St=C3=B8ren?= Date: Mon, 26 Aug 2013 13:56:42 +0200 Subject: [PATCH] MswRollUp: Updated Ert to experimental MSW branch. Updated ResInsight code to handle API changes https://github.com/joakim-hove/ert/commit/067fa99faa300815950d7c0147649754a578b71a This is an intermediate commit and does not compile p4#: 22212 --- .../FileInterface/RifReaderEclipseOutput.cpp | 385 +++++-- .../FileInterface/RifReaderEclipseOutput.h | 2 +- .../RivWellPipesPartMgr.cpp | 208 +++- .../ProjectDataModel/RimReservoirView.cpp | 51 +- ApplicationCode/ProjectDataModel/RimWell.cpp | 29 +- .../RigSingleWellResultsData.cpp | 34 +- .../RigSingleWellResultsData.h | 76 +- ThirdParty/Ert/devel/cmake/cmake_pyc2 | 6 +- ThirdParty/Ert/devel/cmake/cmake_pyc_tree | 4 + .../devel/libecl/applications/CMakeLists.txt | 5 +- .../Ert/devel/libecl/applications/makefile | 163 --- .../devel/libecl/applications/summary2csv.c | 85 +- .../devel/libecl/applications/summary2csv2.c | 146 +++ .../devel/libecl/include/ert/ecl/ecl_grid.h | 5 + .../libecl/include/ert/ecl/ecl_kw_magic.h | 9 +- .../libecl/include/ert/ecl/ecl_rft_cell.h | 83 ++ .../libecl/include/ert/ecl/ecl_rft_file.h | 8 +- .../libecl/include/ert/ecl/ecl_rft_node.h | 17 +- .../libecl/include/ert/ecl/ecl_rsthead.h | 1 + .../devel/libecl/include/ert/ecl/ecl_sum.h | 1 + .../Ert/devel/libecl/src/CMakeLists.txt | 4 +- ThirdParty/Ert/devel/libecl/src/ecl_grid.c | 27 +- ThirdParty/Ert/devel/libecl/src/ecl_region.c | 5 +- .../Ert/devel/libecl/src/ecl_rft_cell.c | 357 +++++++ .../Ert/devel/libecl/src/ecl_rft_file.c | 64 +- .../Ert/devel/libecl/src/ecl_rft_node.c | 646 ++++-------- ThirdParty/Ert/devel/libecl/src/ecl_rsthead.c | 1 + ThirdParty/Ert/devel/libecl/src/ecl_sum.c | 32 +- .../Ert/devel/libecl/tests/CMakeLists.txt | 63 +- .../Ert/devel/libecl/tests/ecl_grid_case.c | 46 + .../devel/libecl/tests/ecl_grid_lgr_name.c | 38 + .../Ert/devel/libecl/tests/ecl_region.c | 70 ++ ThirdParty/Ert/devel/libecl/tests/ecl_rft.c | 131 +++ .../Ert/devel/libecl/tests/ecl_rft_cell.c | 147 +++ .../Ert/devel/libecl/tests/ecl_sum_test.c | 7 + .../Ert/devel/libecl_well/CMakeLists.txt | 2 +- .../libecl_well/applications/CMakeLists.txt | 3 +- .../libecl_well/applications/segment_info.c | 107 ++ .../include/ert/ecl_well/well_branch.h | 42 - .../ert/ecl_well/well_branch_collection.h | 50 + .../include/ert/ecl_well/well_conn.h | 18 +- .../ert/ecl_well/well_conn_collection.h | 51 + .../include/ert/ecl_well/well_const.h | 7 + .../include/ert/ecl_well/well_path.h | 48 - .../include/ert/ecl_well/well_segment.h | 79 ++ .../ert/ecl_well/well_segment_collection.h | 60 ++ .../include/ert/ecl_well/well_state.h | 45 +- .../Ert/devel/libecl_well/src/CMakeLists.txt | 9 +- .../Ert/devel/libecl_well/src/well_branch.c | 103 -- .../libecl_well/src/well_branch_collection.c | 117 +++ .../Ert/devel/libecl_well/src/well_conn.c | 234 +++-- .../libecl_well/src/well_conn_collection.c | 115 +++ .../Ert/devel/libecl_well/src/well_info.c | 29 +- .../Ert/devel/libecl_well/src/well_path.c | 185 ---- .../Ert/devel/libecl_well/src/well_segment.c | 249 +++++ .../libecl_well/src/well_segment_collection.c | 169 ++++ .../Ert/devel/libecl_well/src/well_state.c | 681 +++++++------ .../devel/libecl_well/tests/CMakeLists.txt | 123 ++- .../tests/well_branch_collection.c | 70 ++ .../Ert/devel/libecl_well/tests/well_conn.c | 123 +++ .../libecl_well/tests/well_conn_collection.c | 55 + .../devel/libecl_well/tests/well_conn_load.c | 104 ++ .../Ert/devel/libecl_well/tests/well_info.c | 44 + .../devel/libecl_well/tests/well_lgr_load.c | 10 +- .../devel/libecl_well/tests/well_segment.c | 115 +++ .../tests/well_segment_branch_conn_load.c | 106 ++ .../tests/well_segment_collection.c | 87 ++ .../libecl_well/tests/well_segment_conn.c | 59 ++ .../tests/well_segment_conn_load.c | 107 ++ .../libecl_well/tests/well_segment_load.c | 88 ++ .../Ert/devel/libecl_well/tests/well_state.c | 67 ++ .../devel/libecl_well/tests/well_state_load.c | 78 ++ .../Ert/devel/libecl_well/tests/well_ts.c | 7 +- .../lib/ert_gui/pages/config/analysis.py | 93 -- .../lib/ert_gui/pages/plot/rftfetcher.py | 192 ---- .../applications/ert_tui/enkf_tui_plot_rft.c | 46 +- .../libenkf/include/ert/enkf/config_keys.h | 1 - .../include/ert/enkf/enkf_config_node.h | 1 + .../libenkf/include/ert/enkf/enkf_main.h | 1 + .../libenkf/include/ert/enkf/enkf_node.h | 1 + .../libenkf/include/ert/enkf/model_config.h | 4 +- .../libenkf/include/ert/enkf/obs_vector.h | 102 -- .../libenkf/include/ert/enkf/site_config.h | 2 - .../Ert/devel/libenkf/src/enkf_config_node.c | 4 + ThirdParty/Ert/devel/libenkf/src/enkf_main.c | 1 - ThirdParty/Ert/devel/libenkf/src/enkf_node.c | 9 +- ThirdParty/Ert/devel/libenkf/src/field.c | 1 - .../Ert/devel/libenkf/src/field_config.c | 2 - .../Ert/devel/libenkf/src/model_config.c | 5 +- ThirdParty/Ert/devel/libenkf/src/obs_vector.c | 957 ------------------ .../Ert/devel/libenkf/src/site_config.c | 102 +- .../Ert/devel/libenkf/tests/CMakeLists.txt | 20 +- .../libert_util/include/ert/util/test_util.h | 2 + .../include/ert/util/type_macros.h | 35 + .../libert_util/include/ert/util/vector.h | 2 + .../include/ert/util/vector_template.h | 1 + .../Ert/devel/libert_util/src/test_util.c | 11 +- ThirdParty/Ert/devel/libert_util/src/vector.c | 56 +- .../devel/libert_util/src/vector_template.c | 9 + .../tests/ert_util_type_vector_test.c | 16 +- .../libert_util/tests/ert_util_vector_test.c | 42 + .../devel/libgeometry/tests/CMakeLists.txt | 2 +- .../include/ert/job_queue/job_queue.h | 4 +- .../include/ert/job_queue/queue_driver.h | 9 +- .../Ert/devel/libjob_queue/src/job_queue.c | 75 +- .../Ert/devel/libjob_queue/src/queue_driver.c | 87 +- .../devel/libjob_queue/tests/job_queue_test.c | 69 +- .../tests/job_torque_submit_test.c | 4 +- .../libjob_queue/tests/job_torque_test.c | 2 + ThirdParty/Ert/devel/librms/src/makefile | 74 -- .../Ert/devel/python/python/CMakeLists.txt | 2 + .../devel/python/python/ert/CMakeLists.txt | 2 +- .../devel/python/python/ert/cwrap/cwrap.py | 10 +- .../python/python/ert/ecl/CMakeLists.txt | 16 +- .../Ert/devel/python/python/ert/ecl/ecl.py | 3 +- .../devel/python/python/ert/ecl/ecl_grid.py | 2 +- .../devel/python/python/ert/ecl/ecl_local.py | 72 -- .../devel/python/python/ert/ecl/ecl_rft.py | 341 ++++--- .../python/python/ert/ecl/ecl_rft_cell.py | 217 ++++ .../devel/python/python/ert/ecl/ecl_sum.py | 30 +- .../python/python/ert/enkf/CMakeLists.txt | 2 +- .../python/python/ert/enkf/analysis_config.py | 55 +- .../devel/python/python/ert/enkf/block_obs.py | 58 ++ .../python/python/ert/enkf/ecl_config.py | 89 +- .../python/ert/enkf/enkf_config_node.py | 87 +- .../devel/python/python/ert/enkf/enkf_fs.py | 68 ++ .../devel/python/python/ert/enkf/enkf_main.py | 278 ++++- .../devel/python/python/ert/enkf/enkf_node.py | 66 ++ .../devel/python/python/ert/enkf/enkf_obs.py | 34 +- .../python/python/ert/enkf/enkf_state.py | 64 ++ .../python/python/ert/enkf/ens_config.py | 68 +- .../python/python/ert/enkf/ert_template.py | 45 +- .../python/python/ert/enkf/ert_templates.py | 62 ++ .../Ert/devel/python/python/ert/enkf/field.py | 48 + .../python/python/ert/enkf/field_config.py | 67 +- .../python/python/ert/enkf/gen_data_config.py | 37 +- .../python/python/ert/enkf/gen_kw_config.py | 39 +- .../python/python/ert/enkf/local_config.py | 33 +- .../python/python/ert/enkf/model_config.py | 89 +- .../python/python/ert/enkf/obs_vector.py | 60 ++ .../python/python/ert/enkf/plot_config.py | 76 +- .../python/python/ert/enkf/site_config.py | 163 ++- .../devel/python/python/ert/enkf/time_map.py | 53 + .../python/python/ert/ert/CMakeLists.txt | 1 + .../devel/python/python/ert/ert/c_enums.py | 79 ++ .../Ert/devel/python/python/ert/ert/enums.py | 28 +- .../devel/python/python/ert/ert/erttypes.py | 6 + .../devel/python/python/ert/ert/ertwrapper.py | 85 +- .../python/python/ert/job_queue/driver.py | 1 - .../python/python/ert/job_queue/ext_job.py | 110 +- .../python/ert/job_queue/ext_joblist.py | 43 +- .../python/ert/job_queue/forward_model.py | 42 +- .../python/python/ert/job_queue/queue.py | 95 +- .../python/python/ert/sched/CMakeLists.txt | 2 +- .../devel/python/python/ert/sched/history.py | 54 + .../python/python/ert/util/CMakeLists.txt | 2 +- .../devel/python/python/ert/util/buffer.py | 46 + .../Ert/devel/python/python/ert/util/ctime.py | 3 + .../Ert/devel/python/python/ert/util/log.py | 51 +- .../python/python/ert/util/stringlist.py | 13 +- .../devel/python/python/ert/util/tvector.py | 78 +- .../python/python/ert_gui/CMakeLists.txt | 3 + .../devel/python/python/ert_gui/README.txt | 43 + .../lib => python/python}/ert_gui/__init__.py | 0 .../python}/ert_gui/gert_main.py | 130 +-- .../python}/ert_gui/newconfig.py | 0 .../python/ert_gui/pages/CMakeLists.txt | 5 + .../python}/ert_gui/pages/__init__.py | 0 .../python}/ert_gui/pages/application.py | 0 .../ert_gui/pages/config/CMakeLists.txt | 4 + .../python}/ert_gui/pages/config/__init__.py | 0 .../python/ert_gui/pages/config/analysis.py | 85 ++ .../ert_gui/pages/config/configpages.py | 4 +- .../python}/ert_gui/pages/config/eclipse.py | 51 +- .../python}/ert_gui/pages/config/ensemble.py | 115 ++- .../ert_gui/pages/config/jobs/CMakeLists.txt | 1 + .../ert_gui/pages/config/jobs/__init__.py | 0 .../pages/config/jobs/forwardmodelpanel.py | 9 +- .../ert_gui/pages/config/jobs/jobsdialog.py | 117 ++- .../ert_gui/pages/config/jobs/jobspanel.py | 7 +- .../ert_gui/pages/config/observations.py | 28 +- .../pages/config/parameters/CMakeLists.txt | 1 + .../pages/config/parameters/__init__.py | 0 .../pages/config/parameters/datapanel.py | 0 .../pages/config/parameters/fieldpanel.py | 4 +- .../pages/config/parameters/keywordpanel.py | 0 .../config/parameters/parameterdialog.py | 0 .../config/parameters/parametermodels.py | 0 .../pages/config/parameters/parameterpanel.py | 52 +- .../python}/ert_gui/pages/config/plot.py | 35 +- .../ert_gui/pages/config/queuesystem.py | 42 +- .../ert_gui/pages/config/simulation.py | 97 +- .../pages/config/simulations/CMakeLists.txt | 1 + .../pages/config/simulations/__init__.py | 0 .../pages/config/simulations/runpathpanel.py | 0 .../config/simulations/runtemplatepanel.py | 4 +- .../python}/ert_gui/pages/config/systemenv.py | 91 +- .../python/ert_gui/pages/init/CMakeLists.txt | 1 + .../python}/ert_gui/pages/init/__init__.py | 0 .../python}/ert_gui/pages/init/initandcopy.py | 52 +- .../python}/ert_gui/pages/init/initpanel.py | 29 +- .../python/ert_gui/pages/plot/CMakeLists.txt | 1 + .../python}/ert_gui/pages/plot/__init__.py | 0 .../ert_gui/pages/plot/ensemblefetcher.py | 167 ++- .../python}/ert_gui/pages/plot/fetcher.py | 0 .../python}/ert_gui/pages/plot/plotconfig.py | 4 +- .../python}/ert_gui/pages/plot/plotdata.py | 81 +- .../python}/ert_gui/pages/plot/plotfigure.py | 0 .../ert_gui/pages/plot/plotgenerator.py | 0 .../python}/ert_gui/pages/plot/plotpanel.py | 6 +- .../ert_gui/pages/plot/plotrenderer.py | 0 .../ert_gui/pages/plot/plotsettings.py | 4 +- .../ert_gui/pages/plot/plotsettingsxml.py | 0 .../python}/ert_gui/pages/plot/plotview.py | 2 +- .../python/ert_gui/pages/plot/rftfetcher.py | 164 +++ .../python}/ert_gui/pages/plot/zoomslider.py | 2 - .../python/ert_gui/pages/run/CMakeLists.txt | 1 + .../python}/ert_gui/pages/run/__init__.py | 0 .../python}/ert_gui/pages/run/legend.py | 0 .../python}/ert_gui/pages/run/runpanel.py | 35 +- .../python}/ert_gui/pages/run/simulation.py | 33 +- .../ert_gui/pages/run/simulationsdialog.py | 27 +- .../python/ert_gui/widgets/CMakeLists.txt | 2 + .../python}/ert_gui/widgets/__init__.py | 0 .../python}/ert_gui/widgets/activelabel.py | 2 +- .../python}/ert_gui/widgets/checkbox.py | 0 .../python}/ert_gui/widgets/cogwheel.py | 0 .../python}/ert_gui/widgets/combochoice.py | 8 +- .../python}/ert_gui/widgets/configpanel.py | 0 .../python}/ert_gui/widgets/help.py | 0 .../python}/ert_gui/widgets/helpedwidget.py | 0 .../python}/ert_gui/widgets/pathchooser.py | 4 +- .../python}/ert_gui/widgets/reloadbutton.py | 0 .../python}/ert_gui/widgets/searchablelist.py | 0 .../python}/ert_gui/widgets/spinnerwidgets.py | 0 .../python}/ert_gui/widgets/stringbox.py | 2 +- .../python}/ert_gui/widgets/tablewidgets.py | 0 .../python}/ert_gui/widgets/util.py | 2 +- .../ert_gui/widgets/validateddialog.py | 0 .../Ert/devel/python/test/CMakeLists.txt | 74 +- ThirdParty/Ert/devel/python/test/ctest_run.py | 10 +- ThirdParty/Ert/devel/python/test/enkf_test.py | 57 +- .../Ert/devel/python/test/ens_config_test.py | 16 +- ThirdParty/Ert/devel/python/test/grid_test.py | 9 + .../Ert/devel/python/test/import_local.py | 33 + .../Ert/devel/python/test/import_test.py | 190 +++- .../Ert/devel/python/test/rft_cell_test.py | 122 +++ ThirdParty/Ert/devel/python/test/rft_test.py | 84 +- .../Ert/devel/python/test/tvector_test.py | 107 ++ .../Ert/devel/share/gui/img/newsplash.jpg | Bin 0 -> 78813 bytes 250 files changed, 9280 insertions(+), 4701 deletions(-) delete mode 100644 ThirdParty/Ert/devel/libecl/applications/makefile create mode 100644 ThirdParty/Ert/devel/libecl/applications/summary2csv2.c create mode 100644 ThirdParty/Ert/devel/libecl/include/ert/ecl/ecl_rft_cell.h create mode 100644 ThirdParty/Ert/devel/libecl/src/ecl_rft_cell.c create mode 100644 ThirdParty/Ert/devel/libecl/tests/ecl_grid_case.c create mode 100644 ThirdParty/Ert/devel/libecl/tests/ecl_grid_lgr_name.c create mode 100644 ThirdParty/Ert/devel/libecl/tests/ecl_region.c create mode 100644 ThirdParty/Ert/devel/libecl/tests/ecl_rft.c create mode 100644 ThirdParty/Ert/devel/libecl/tests/ecl_rft_cell.c create mode 100644 ThirdParty/Ert/devel/libecl_well/applications/segment_info.c delete mode 100644 ThirdParty/Ert/devel/libecl_well/include/ert/ecl_well/well_branch.h create mode 100644 ThirdParty/Ert/devel/libecl_well/include/ert/ecl_well/well_branch_collection.h create mode 100644 ThirdParty/Ert/devel/libecl_well/include/ert/ecl_well/well_conn_collection.h delete mode 100644 ThirdParty/Ert/devel/libecl_well/include/ert/ecl_well/well_path.h create mode 100644 ThirdParty/Ert/devel/libecl_well/include/ert/ecl_well/well_segment.h create mode 100644 ThirdParty/Ert/devel/libecl_well/include/ert/ecl_well/well_segment_collection.h delete mode 100644 ThirdParty/Ert/devel/libecl_well/src/well_branch.c create mode 100644 ThirdParty/Ert/devel/libecl_well/src/well_branch_collection.c create mode 100644 ThirdParty/Ert/devel/libecl_well/src/well_conn_collection.c delete mode 100644 ThirdParty/Ert/devel/libecl_well/src/well_path.c create mode 100644 ThirdParty/Ert/devel/libecl_well/src/well_segment.c create mode 100644 ThirdParty/Ert/devel/libecl_well/src/well_segment_collection.c create mode 100644 ThirdParty/Ert/devel/libecl_well/tests/well_branch_collection.c create mode 100644 ThirdParty/Ert/devel/libecl_well/tests/well_conn.c create mode 100644 ThirdParty/Ert/devel/libecl_well/tests/well_conn_collection.c create mode 100644 ThirdParty/Ert/devel/libecl_well/tests/well_conn_load.c create mode 100644 ThirdParty/Ert/devel/libecl_well/tests/well_info.c create mode 100644 ThirdParty/Ert/devel/libecl_well/tests/well_segment.c create mode 100644 ThirdParty/Ert/devel/libecl_well/tests/well_segment_branch_conn_load.c create mode 100644 ThirdParty/Ert/devel/libecl_well/tests/well_segment_collection.c create mode 100644 ThirdParty/Ert/devel/libecl_well/tests/well_segment_conn.c create mode 100644 ThirdParty/Ert/devel/libecl_well/tests/well_segment_conn_load.c create mode 100644 ThirdParty/Ert/devel/libecl_well/tests/well_segment_load.c create mode 100644 ThirdParty/Ert/devel/libecl_well/tests/well_state.c create mode 100644 ThirdParty/Ert/devel/libecl_well/tests/well_state_load.c delete mode 100644 ThirdParty/Ert/devel/libenkf/applications/ert_gui/lib/ert_gui/pages/config/analysis.py delete mode 100644 ThirdParty/Ert/devel/libenkf/applications/ert_gui/lib/ert_gui/pages/plot/rftfetcher.py delete mode 100644 ThirdParty/Ert/devel/libenkf/include/ert/enkf/obs_vector.h delete mode 100644 ThirdParty/Ert/devel/libenkf/src/obs_vector.c delete mode 100644 ThirdParty/Ert/devel/librms/src/makefile delete mode 100644 ThirdParty/Ert/devel/python/python/ert/ecl/ecl_local.py create mode 100644 ThirdParty/Ert/devel/python/python/ert/ecl/ecl_rft_cell.py create mode 100644 ThirdParty/Ert/devel/python/python/ert/enkf/block_obs.py create mode 100644 ThirdParty/Ert/devel/python/python/ert/enkf/enkf_fs.py create mode 100644 ThirdParty/Ert/devel/python/python/ert/enkf/enkf_node.py create mode 100644 ThirdParty/Ert/devel/python/python/ert/enkf/enkf_state.py create mode 100644 ThirdParty/Ert/devel/python/python/ert/enkf/ert_templates.py create mode 100644 ThirdParty/Ert/devel/python/python/ert/enkf/field.py create mode 100644 ThirdParty/Ert/devel/python/python/ert/enkf/obs_vector.py create mode 100644 ThirdParty/Ert/devel/python/python/ert/enkf/time_map.py create mode 100644 ThirdParty/Ert/devel/python/python/ert/ert/CMakeLists.txt create mode 100644 ThirdParty/Ert/devel/python/python/ert/ert/c_enums.py create mode 100644 ThirdParty/Ert/devel/python/python/ert/sched/history.py create mode 100644 ThirdParty/Ert/devel/python/python/ert/util/buffer.py create mode 100644 ThirdParty/Ert/devel/python/python/ert_gui/CMakeLists.txt create mode 100644 ThirdParty/Ert/devel/python/python/ert_gui/README.txt rename ThirdParty/Ert/devel/{libenkf/applications/ert_gui/lib => python/python}/ert_gui/__init__.py (100%) rename ThirdParty/Ert/devel/{libenkf/applications/ert_gui/lib => python/python}/ert_gui/gert_main.py (60%) rename ThirdParty/Ert/devel/{libenkf/applications/ert_gui/lib => python/python}/ert_gui/newconfig.py (100%) create mode 100644 ThirdParty/Ert/devel/python/python/ert_gui/pages/CMakeLists.txt rename ThirdParty/Ert/devel/{libenkf/applications/ert_gui/lib => python/python}/ert_gui/pages/__init__.py (100%) rename ThirdParty/Ert/devel/{libenkf/applications/ert_gui/lib => python/python}/ert_gui/pages/application.py (100%) create mode 100644 ThirdParty/Ert/devel/python/python/ert_gui/pages/config/CMakeLists.txt rename ThirdParty/Ert/devel/{libenkf/applications/ert_gui/lib => python/python}/ert_gui/pages/config/__init__.py (100%) create mode 100644 ThirdParty/Ert/devel/python/python/ert_gui/pages/config/analysis.py rename ThirdParty/Ert/devel/{libenkf/applications/ert_gui/lib => python/python}/ert_gui/pages/config/configpages.py (100%) rename ThirdParty/Ert/devel/{libenkf/applications/ert_gui/lib => python/python}/ert_gui/pages/config/eclipse.py (60%) rename ThirdParty/Ert/devel/{libenkf/applications/ert_gui/lib => python/python}/ert_gui/pages/config/ensemble.py (66%) create mode 100644 ThirdParty/Ert/devel/python/python/ert_gui/pages/config/jobs/CMakeLists.txt rename ThirdParty/Ert/devel/{libenkf/applications/ert_gui/lib => python/python}/ert_gui/pages/config/jobs/__init__.py (100%) rename ThirdParty/Ert/devel/{libenkf/applications/ert_gui/lib => python/python}/ert_gui/pages/config/jobs/forwardmodelpanel.py (97%) rename ThirdParty/Ert/devel/{libenkf/applications/ert_gui/lib => python/python}/ert_gui/pages/config/jobs/jobsdialog.py (67%) rename ThirdParty/Ert/devel/{libenkf/applications/ert_gui/lib => python/python}/ert_gui/pages/config/jobs/jobspanel.py (94%) rename ThirdParty/Ert/devel/{libenkf/applications/ert_gui/lib => python/python}/ert_gui/pages/config/observations.py (63%) create mode 100644 ThirdParty/Ert/devel/python/python/ert_gui/pages/config/parameters/CMakeLists.txt rename ThirdParty/Ert/devel/{libenkf/applications/ert_gui/lib => python/python}/ert_gui/pages/config/parameters/__init__.py (100%) rename ThirdParty/Ert/devel/{libenkf/applications/ert_gui/lib => python/python}/ert_gui/pages/config/parameters/datapanel.py (100%) rename ThirdParty/Ert/devel/{libenkf/applications/ert_gui/lib => python/python}/ert_gui/pages/config/parameters/fieldpanel.py (93%) rename ThirdParty/Ert/devel/{libenkf/applications/ert_gui/lib => python/python}/ert_gui/pages/config/parameters/keywordpanel.py (100%) rename ThirdParty/Ert/devel/{libenkf/applications/ert_gui/lib => python/python}/ert_gui/pages/config/parameters/parameterdialog.py (100%) rename ThirdParty/Ert/devel/{libenkf/applications/ert_gui/lib => python/python}/ert_gui/pages/config/parameters/parametermodels.py (100%) rename ThirdParty/Ert/devel/{libenkf/applications/ert_gui/lib => python/python}/ert_gui/pages/config/parameters/parameterpanel.py (89%) rename ThirdParty/Ert/devel/{libenkf/applications/ert_gui/lib => python/python}/ert_gui/pages/config/plot.py (56%) rename ThirdParty/Ert/devel/{libenkf/applications/ert_gui/lib => python/python}/ert_gui/pages/config/queuesystem.py (60%) rename ThirdParty/Ert/devel/{libenkf/applications/ert_gui/lib => python/python}/ert_gui/pages/config/simulation.py (57%) create mode 100644 ThirdParty/Ert/devel/python/python/ert_gui/pages/config/simulations/CMakeLists.txt rename ThirdParty/Ert/devel/{libenkf/applications/ert_gui/lib => python/python}/ert_gui/pages/config/simulations/__init__.py (100%) rename ThirdParty/Ert/devel/{libenkf/applications/ert_gui/lib => python/python}/ert_gui/pages/config/simulations/runpathpanel.py (100%) rename ThirdParty/Ert/devel/{libenkf/applications/ert_gui/lib => python/python}/ert_gui/pages/config/simulations/runtemplatepanel.py (99%) rename ThirdParty/Ert/devel/{libenkf/applications/ert_gui/lib => python/python}/ert_gui/pages/config/systemenv.py (60%) create mode 100644 ThirdParty/Ert/devel/python/python/ert_gui/pages/init/CMakeLists.txt rename ThirdParty/Ert/devel/{libenkf/applications/ert_gui/lib => python/python}/ert_gui/pages/init/__init__.py (100%) rename ThirdParty/Ert/devel/{libenkf/applications/ert_gui/lib => python/python}/ert_gui/pages/init/initandcopy.py (88%) rename ThirdParty/Ert/devel/{libenkf/applications/ert_gui/lib => python/python}/ert_gui/pages/init/initpanel.py (79%) create mode 100644 ThirdParty/Ert/devel/python/python/ert_gui/pages/plot/CMakeLists.txt rename ThirdParty/Ert/devel/{libenkf/applications/ert_gui/lib => python/python}/ert_gui/pages/plot/__init__.py (100%) rename ThirdParty/Ert/devel/{libenkf/applications/ert_gui/lib => python/python}/ert_gui/pages/plot/ensemblefetcher.py (70%) rename ThirdParty/Ert/devel/{libenkf/applications/ert_gui/lib => python/python}/ert_gui/pages/plot/fetcher.py (100%) rename ThirdParty/Ert/devel/{libenkf/applications/ert_gui/lib => python/python}/ert_gui/pages/plot/plotconfig.py (99%) rename ThirdParty/Ert/devel/{libenkf/applications/ert_gui/lib => python/python}/ert_gui/pages/plot/plotdata.py (73%) rename ThirdParty/Ert/devel/{libenkf/applications/ert_gui/lib => python/python}/ert_gui/pages/plot/plotfigure.py (100%) rename ThirdParty/Ert/devel/{libenkf/applications/ert_gui/lib => python/python}/ert_gui/pages/plot/plotgenerator.py (100%) rename ThirdParty/Ert/devel/{libenkf/applications/ert_gui/lib => python/python}/ert_gui/pages/plot/plotpanel.py (98%) rename ThirdParty/Ert/devel/{libenkf/applications/ert_gui/lib => python/python}/ert_gui/pages/plot/plotrenderer.py (100%) rename ThirdParty/Ert/devel/{libenkf/applications/ert_gui/lib => python/python}/ert_gui/pages/plot/plotsettings.py (98%) rename ThirdParty/Ert/devel/{libenkf/applications/ert_gui/lib => python/python}/ert_gui/pages/plot/plotsettingsxml.py (100%) rename ThirdParty/Ert/devel/{libenkf/applications/ert_gui/lib => python/python}/ert_gui/pages/plot/plotview.py (99%) create mode 100644 ThirdParty/Ert/devel/python/python/ert_gui/pages/plot/rftfetcher.py rename ThirdParty/Ert/devel/{libenkf/applications/ert_gui/lib => python/python}/ert_gui/pages/plot/zoomslider.py (98%) create mode 100644 ThirdParty/Ert/devel/python/python/ert_gui/pages/run/CMakeLists.txt rename ThirdParty/Ert/devel/{libenkf/applications/ert_gui/lib => python/python}/ert_gui/pages/run/__init__.py (100%) rename ThirdParty/Ert/devel/{libenkf/applications/ert_gui/lib => python/python}/ert_gui/pages/run/legend.py (100%) rename ThirdParty/Ert/devel/{libenkf/applications/ert_gui/lib => python/python}/ert_gui/pages/run/runpanel.py (90%) rename ThirdParty/Ert/devel/{libenkf/applications/ert_gui/lib => python/python}/ert_gui/pages/run/simulation.py (92%) rename ThirdParty/Ert/devel/{libenkf/applications/ert_gui/lib => python/python}/ert_gui/pages/run/simulationsdialog.py (90%) create mode 100644 ThirdParty/Ert/devel/python/python/ert_gui/widgets/CMakeLists.txt rename ThirdParty/Ert/devel/{libenkf/applications/ert_gui/lib => python/python}/ert_gui/widgets/__init__.py (100%) rename ThirdParty/Ert/devel/{libenkf/applications/ert_gui/lib => python/python}/ert_gui/widgets/activelabel.py (96%) rename ThirdParty/Ert/devel/{libenkf/applications/ert_gui/lib => python/python}/ert_gui/widgets/checkbox.py (100%) rename ThirdParty/Ert/devel/{libenkf/applications/ert_gui/lib => python/python}/ert_gui/widgets/cogwheel.py (100%) rename ThirdParty/Ert/devel/{libenkf/applications/ert_gui/lib => python/python}/ert_gui/widgets/combochoice.py (90%) rename ThirdParty/Ert/devel/{libenkf/applications/ert_gui/lib => python/python}/ert_gui/widgets/configpanel.py (100%) rename ThirdParty/Ert/devel/{libenkf/applications/ert_gui/lib => python/python}/ert_gui/widgets/help.py (100%) rename ThirdParty/Ert/devel/{libenkf/applications/ert_gui/lib => python/python}/ert_gui/widgets/helpedwidget.py (100%) rename ThirdParty/Ert/devel/{libenkf/applications/ert_gui/lib => python/python}/ert_gui/widgets/pathchooser.py (99%) rename ThirdParty/Ert/devel/{libenkf/applications/ert_gui/lib => python/python}/ert_gui/widgets/reloadbutton.py (100%) rename ThirdParty/Ert/devel/{libenkf/applications/ert_gui/lib => python/python}/ert_gui/widgets/searchablelist.py (100%) rename ThirdParty/Ert/devel/{libenkf/applications/ert_gui/lib => python/python}/ert_gui/widgets/spinnerwidgets.py (100%) rename ThirdParty/Ert/devel/{libenkf/applications/ert_gui/lib => python/python}/ert_gui/widgets/stringbox.py (98%) rename ThirdParty/Ert/devel/{libenkf/applications/ert_gui/lib => python/python}/ert_gui/widgets/tablewidgets.py (100%) rename ThirdParty/Ert/devel/{libenkf/applications/ert_gui/lib => python/python}/ert_gui/widgets/util.py (99%) rename ThirdParty/Ert/devel/{libenkf/applications/ert_gui/lib => python/python}/ert_gui/widgets/validateddialog.py (100%) create mode 100644 ThirdParty/Ert/devel/python/test/import_local.py create mode 100644 ThirdParty/Ert/devel/python/test/rft_cell_test.py create mode 100644 ThirdParty/Ert/devel/share/gui/img/newsplash.jpg diff --git a/ApplicationCode/FileInterface/RifReaderEclipseOutput.cpp b/ApplicationCode/FileInterface/RifReaderEclipseOutput.cpp index d1f952bb07..2c660a74bc 100644 --- a/ApplicationCode/FileInterface/RifReaderEclipseOutput.cpp +++ b/ApplicationCode/FileInterface/RifReaderEclipseOutput.cpp @@ -111,6 +111,8 @@ bool transferGridCellData(RigMainGrid* mainGrid, RigActiveCellInfo* activeCellIn { RigCell& cell = mainGrid->cells()[cellStartIndex + localCellIdx]; + bool invalid = ecl_grid_cell_invalid1(localEclGrid, localCellIdx); + cell.setInvalid(invalid); cell.setCellIndex(localCellIdx); // Active cell index @@ -161,7 +163,10 @@ bool transferGridCellData(RigMainGrid* mainGrid, RigActiveCellInfo* activeCellIn // Mark inactive long pyramid looking cells as invalid // Forslag //if (!invalid && (cell.isInCoarseCell() || (!cell.isActiveInMatrixModel() && !cell.isActiveInFractureModel()) ) ) - cell.setInvalid(cell.isLongPyramidCell()); + if (!invalid) + { + cell.setInvalid(cell.isLongPyramidCell()); + } #pragma omp atomic computedCellCount++; @@ -355,7 +360,6 @@ bool RifReaderEclipseOutput::open(const QString& fileName, RigCaseData* eclipseC m_filesWithSameBaseName = fileSet; // Read geometry - // Todo: Needs to check existence of file before calling ert, else it will abort ecl_grid_type * mainEclGrid = ecl_grid_alloc( fileName.toAscii().data() ); progInfo.incrementProgress(); @@ -366,14 +370,10 @@ bool RifReaderEclipseOutput::open(const QString& fileName, RigCaseData* eclipseC if (!transferGeometry(mainEclGrid, eclipseCase)) return false; progInfo.incrementProgress(); - progInfo.setProgressDescription("Releasing reader memory"); - ecl_grid_free( mainEclGrid ); - progInfo.incrementProgress(); + m_eclipseCase = eclipseCase; progInfo.setProgressDescription("Reading Result index"); progInfo.setNextProgressIncrement(60); - - m_eclipseCase = eclipseCase; // Build results meta data buildMetaData(); @@ -381,9 +381,11 @@ bool RifReaderEclipseOutput::open(const QString& fileName, RigCaseData* eclipseC progInfo.setNextProgressIncrement(8); progInfo.setProgressDescription("Reading Well information"); - - readWellCells(); + readWellCells(mainEclGrid); + progInfo.setProgressDescription("Releasing reader memory"); + ecl_grid_free( mainEclGrid ); + progInfo.incrementProgress(); return true; } @@ -597,9 +599,6 @@ void RifReaderEclipseOutput::buildMetaData() staticDate.push_back(m_timeSteps.front()); } - // Add ACTNUM - matrixResultNames += "ACTNUM"; - for (int i = 0; i < matrixResultNames.size(); ++i) { size_t resIndex = matrixModelResults->addEmptyScalarResult(RimDefines::STATIC_NATIVE, matrixResultNames[i], false); @@ -619,9 +618,6 @@ void RifReaderEclipseOutput::buildMetaData() staticDate.push_back(m_timeSteps.front()); } - // Add ACTNUM - fractureResultNames += "ACTNUM"; - for (int i = 0; i < fractureResultNames.size(); ++i) { size_t resIndex = fractureModelResults->addEmptyScalarResult(RimDefines::STATIC_NATIVE, fractureResultNames[i], false); @@ -666,14 +662,6 @@ bool RifReaderEclipseOutput::staticResult(const QString& result, PorosityModelRe { CVF_ASSERT(values); - if (result.compare("ACTNUM", Qt::CaseInsensitive) == 0) - { - RigActiveCellInfo* activeCellInfo = m_eclipseCase->activeCellInfo(matrixOrFracture); - values->resize(activeCellInfo->globalActiveCellCount(), 1.0); - - return true; - } - openInitFile(); if(m_ecl_init_file) @@ -719,16 +707,48 @@ bool RifReaderEclipseOutput::dynamicResult(const QString& result, PorosityModelR return true; } + + +// Helper structure to handle the metadata for connections in segments +struct SegmentData +{ + SegmentData(const well_conn_collection_type* connections) : + m_branchId(-1), + m_segmentId(-1), + m_gridIndex(cvf::UNDEFINED_SIZE_T), + m_connections(connections) + {} + + int m_branchId; + int m_segmentId; + size_t m_gridIndex; + const well_conn_collection_type* m_connections; +}; + +void getSegmentDataByBranchId(const std::list& segments, std::vector& branchSegments, int branchId) +{ + std::list::const_iterator it; + + for (it = segments.begin(); it != segments.end(); it++) + { + if (it->m_branchId == branchId) + { + branchSegments.push_back(*it); + } + } +} + + //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- -void RifReaderEclipseOutput::readWellCells() +void RifReaderEclipseOutput::readWellCells(const ecl_grid_type* mainEclGrid) { CVF_ASSERT(m_eclipseCase); if (m_dynamicResultsAccess.isNull()) return; - well_info_type* ert_well_info = well_info_alloc(NULL); + well_info_type* ert_well_info = well_info_alloc(mainEclGrid); if (!ert_well_info) return; m_dynamicResultsAccess->readWellData(ert_well_info); @@ -795,25 +815,29 @@ void RifReaderEclipseOutput::readWellCells() - // Loop over all the grids in the model. If we have connections in one, we will discard - // the maingrid connections as they are "duplicates" + // the main grid connections as the well connections are duplicated in the main grid and LGR grids bool hasWellConnectionsInLGR = false; + +#if 0 + // To be discussed with Statoil for (size_t gridNr = 1; gridNr < grids.size(); ++gridNr) { - int branchCount = well_state_iget_lgr_num_branches(ert_well_state, static_cast(gridNr)); - if (branchCount > 0) + RigGridBase* lgrGrid = m_eclipseCase->grid(gridNr); + if (well_state_has_grid_connections(ert_well_state, lgrGrid->gridName().data())) { hasWellConnectionsInLGR = true; break; } } +#endif + size_t gridNr = hasWellConnectionsInLGR ? 1 : 0; for (; gridNr < grids.size(); ++gridNr) { - // Wellhead. If several grids have a wellhead definition for this well, we use tha last one. (Possibly the innermost LGR) + // Wellhead. If several grids have a wellhead definition for this well, we use the last one. (Possibly the innermost LGR) const well_conn_type* ert_wellhead = well_state_iget_wellhead(ert_well_state, static_cast(gridNr)); if (ert_wellhead) { @@ -831,53 +855,275 @@ void RifReaderEclipseOutput::readWellCells() wellResFrame.m_wellHead.m_gridCellIndex = grids[gridNr]->cellIndexFromIJK(cellI, cellJ, cellK); wellResFrame.m_wellHead.m_gridIndex = gridNr; } - - - int branchCount = well_state_iget_lgr_num_branches(ert_well_state, static_cast(gridNr)); - if (branchCount > 0) + else { - if (static_cast(wellResFrame.m_wellResultBranches.size()) < branchCount) wellResFrame.m_wellResultBranches.resize(branchCount); + CVF_ASSERT(0); + } - for (int branchIdx = 0; branchIdx < branchCount; ++branchIdx ) + + std::string gridName; + if (gridNr == 0) + { + gridName = ECL_GRID_GLOBAL_GRID; + } + else + { + RigGridBase* rigGrid = m_eclipseCase->grid(gridNr); + gridName = rigGrid->gridName(); + } + + + + std::list segmentList; + std::vector outletBranchSegmentList; // Keep a list of branch outlet segments to avoid traversal twice + std::vector ertBranchIDs; + + int branchCount = 0; + if (well_state_is_MSW(ert_well_state)) + { + wellResults->setMultiSegmentWell(true); + + well_branch_collection_type* branches = well_state_get_branches(ert_well_state); + + branchCount = well_branch_collection_get_size(branches); + for (int branchIdx = 0; branchIdx < well_branch_collection_get_size(branches); branchIdx++) { - // Connections - int connectionCount = well_state_iget_num_lgr_connections(ert_well_state, static_cast(gridNr), branchIdx); - if (connectionCount > 0) + const well_segment_type* segment = well_branch_collection_iget_start_segment(branches, branchIdx); + int branchId = well_segment_get_branch_id(segment); + + ertBranchIDs.push_back(branchId); + + while (segment && branchId == well_segment_get_branch_id(segment)) { - - RigWellResultBranch& wellSegment = wellResFrame.m_wellResultBranches[branchIdx]; // Is this completely right? Is the branch index actually the same between lgrs ? - wellSegment.m_branchNumber = branchIdx; - size_t existingConnCount = wellSegment.m_wellCells.size(); - wellSegment.m_wellCells.resize(existingConnCount + connectionCount); - - int connIdx; - for (connIdx = 0; connIdx < connectionCount; connIdx++) + SegmentData segmentData(NULL); + segmentData.m_branchId = branchId; + segmentData.m_segmentId = well_segment_get_id(segment); + segmentData.m_gridIndex = gridNr; + + if (well_segment_has_grid_connections(segment, gridName.data())) { - const well_conn_type* ert_connection = well_state_iget_lgr_connections( ert_well_state, static_cast(gridNr), branchIdx)[connIdx]; + const well_conn_collection_type* connections = well_segment_get_connections(segment, gridName.data()); + segmentData.m_connections = connections; + } + + // Insert in front, as the segments are accessed starting from grid cell closes to well head + segmentList.push_front(segmentData); + + if (well_segment_get_outlet_id(segment) == -1) + { + break; + } + + segment = well_segment_get_outlet(segment); + } + + outletBranchSegmentList.push_back(segment); + } + } + else + { + branchCount = 1; + ertBranchIDs.push_back(0); + + const well_conn_collection_type* connections = well_state_get_grid_connections(ert_well_state, gridName.data()); + SegmentData segmentData(connections); + segmentData.m_gridIndex = gridNr; + segmentList.push_front(segmentData); + } + + size_t currentGridBranchStartIndex = wellResFrame.m_wellResultBranches.size(); + wellResFrame.m_wellResultBranches.resize(currentGridBranchStartIndex + branchCount); + + + // Import all well result cells for all connections + for (int branchIdx = 0; branchIdx < branchCount; branchIdx++) + { + RigWellResultBranch& wellResultBranch = wellResFrame.m_wellResultBranches[currentGridBranchStartIndex + branchIdx]; + wellResultBranch.m_branchIndex = branchIdx; + + int ertBranchId = ertBranchIDs[branchIdx]; + wellResultBranch.m_ertBranchId = ertBranchId; + + std::vector branchSegments; + getSegmentDataByBranchId(segmentList, branchSegments, ertBranchId); + + for (size_t segmentIdx = 0; segmentIdx < branchSegments.size(); segmentIdx++) + { + SegmentData& connData = branchSegments[segmentIdx]; + + if (!connData.m_connections) + { + size_t existingCellCount = wellResultBranch.m_wellCells.size(); + wellResultBranch.m_wellCells.resize(existingCellCount + 1); + + RigWellResultCell& data = wellResultBranch.m_wellCells[existingCellCount]; + + data.m_ertBranchId = connData.m_branchId; + data.m_ertSegmentId = connData.m_segmentId; + } + else + { + int connectionCount = well_conn_collection_get_size(connData.m_connections); + + size_t existingCellCount = wellResultBranch.m_wellCells.size(); + wellResultBranch.m_wellCells.resize(existingCellCount + connectionCount); + + for (int connIdx = 0; connIdx < connectionCount; connIdx++) + { + well_conn_type* ert_connection = well_conn_collection_iget(connData.m_connections, connIdx); CVF_ASSERT(ert_connection); - RigWellResultCell& data = wellSegment.m_wellCells[existingConnCount + connIdx]; - data.m_gridIndex = gridNr; - { - int cellI = well_conn_get_i( ert_connection ); - int cellJ = well_conn_get_j( ert_connection ); - int cellK = well_conn_get_k( ert_connection ); - bool open = well_conn_open( ert_connection ); - int branch = well_conn_get_branch( ert_connection ); - int segment = well_conn_get_segment( ert_connection ); - - // If a well is defined in fracture region, the K-value is from (cellCountK - 1) -> cellCountK*2 - 1 - // Adjust K so index is always in valid grid region - if (cellK >= static_cast(grids[gridNr]->cellCountK())) - { - cellK -= static_cast(grids[gridNr]->cellCountK()); - } + RigWellResultCell& data = wellResultBranch.m_wellCells[existingCellCount + connIdx]; + int cellI = well_conn_get_i( ert_connection ); + int cellJ = well_conn_get_j( ert_connection ); + int cellK = well_conn_get_k( ert_connection ); + bool isCellOpen = well_conn_open( ert_connection ); - data.m_gridCellIndex = grids[gridNr]->cellIndexFromIJK(cellI , cellJ , cellK); - - data.m_isOpen = open; - data.m_branchId = branch; - data.m_segmentId = segment; + // If a well is defined in fracture region, the K-value is from (cellCountK - 1) -> cellCountK*2 - 1 + // Adjust K so index is always in valid grid region + if (cellK >= static_cast(grids[gridNr]->cellCountK())) + { + cellK -= static_cast(grids[gridNr]->cellCountK()); + } + + data.m_gridIndex = gridNr; + data.m_gridCellIndex = grids[gridNr]->cellIndexFromIJK(cellI, cellJ, cellK); + + data.m_isOpen = isCellOpen; + + data.m_ertBranchId = connData.m_branchId; + data.m_ertSegmentId = connData.m_segmentId; + } + } + } + } + + + if (well_state_is_MSW(ert_well_state)) + { + + // Assign outlet well cells to leaf branch well heads + + for (int branchIdx = 0; branchIdx < branchCount; branchIdx++) + { + RigWellResultBranch& wellResultLeafBranch = wellResFrame.m_wellResultBranches[currentGridBranchStartIndex + branchIdx]; + + const well_segment_type* outletBranchSegment = outletBranchSegmentList[branchIdx]; + CVF_ASSERT(outletBranchSegment); + + int outletErtBranchId = well_segment_get_branch_id(outletBranchSegment); + + size_t outletErtBranchIndex = cvf::UNDEFINED_SIZE_T; + for (size_t i = 0; i < ertBranchIDs.size(); i++) + { + if (ertBranchIDs[i] == outletErtBranchId) + { + outletErtBranchIndex = i; + } + } + + RigWellResultBranch& outletResultBranch = wellResFrame.m_wellResultBranches[currentGridBranchStartIndex + outletErtBranchIndex]; + + int outletErtSegmentId = well_segment_get_branch_id(outletBranchSegment); + size_t lastCellIndexForSegmentIdInOutletBranch = cvf::UNDEFINED_SIZE_T; + for (size_t outletCellIdx = 0; outletCellIdx < outletResultBranch.m_wellCells.size(); outletCellIdx++) + { + if (outletResultBranch.m_wellCells[outletCellIdx].m_ertSegmentId == outletErtSegmentId) + { + lastCellIndexForSegmentIdInOutletBranch = outletCellIdx; + } + } + + if (lastCellIndexForSegmentIdInOutletBranch == cvf::UNDEFINED_SIZE_T) + { + // Did not find the cell in the outlet branch based on branch id and segment id from outlet cell in leaf branch + CVF_ASSERT(0); + } + else + { + RigWellResultCell& outletCell = outletResultBranch.m_wellCells[lastCellIndexForSegmentIdInOutletBranch]; + + wellResultLeafBranch.m_outletBranchIndex = currentGridBranchStartIndex + outletErtBranchIndex; + wellResultLeafBranch.m_outletBranchHeadCellIndex = lastCellIndexForSegmentIdInOutletBranch; + } + } + + + // Update outlet well cells with no grid cell connections + + for (int branchIdx = 0; branchIdx < branchCount; branchIdx++) + { + RigWellResultBranch& wellResultLeafBranch = wellResFrame.m_wellResultBranches[currentGridBranchStartIndex + branchIdx]; + + const RigWellResultCell* leafBranchHead = wellResFrame.findResultCellFromOutletSpecification(wellResultLeafBranch.m_outletBranchIndex, wellResultLeafBranch.m_outletBranchHeadCellIndex); + if (!leafBranchHead || leafBranchHead->hasGridConnections()) + { + continue; + } + + RigWellResultBranch& outletResultBranch = wellResFrame.m_wellResultBranches[wellResultLeafBranch.m_outletBranchIndex]; + + size_t firstCellIndexWithGridConnectionInLeafBranch = cvf::UNDEFINED_SIZE_T; + for (size_t j = 0; j < wellResultLeafBranch.m_wellCells.size(); j++) + { + if (wellResultLeafBranch.m_wellCells[j].hasGridConnections()) + { + firstCellIndexWithGridConnectionInLeafBranch = j; + break; + } + } + + if (firstCellIndexWithGridConnectionInLeafBranch != cvf::UNDEFINED_SIZE_T) + { + const RigCell& firstCellWithGridConnectionInLeafBranch = m_eclipseCase->cellFromWellResultCell(wellResultLeafBranch.m_wellCells[firstCellIndexWithGridConnectionInLeafBranch]); + cvf::Vec3d firstGridConnectionCenterInLeafBranch = firstCellWithGridConnectionInLeafBranch.center(); + + size_t cellIndexInOutletBranch = wellResultLeafBranch.m_outletBranchHeadCellIndex; + CVF_ASSERT(cellIndexInOutletBranch != cvf::UNDEFINED_SIZE_T); + + RigWellResultCell& currCell = outletResultBranch.m_wellCells[cellIndexInOutletBranch]; + + while (cellIndexInOutletBranch != cvf::UNDEFINED_SIZE_T && !currCell.hasGridConnections()) + { + size_t branchConnectionCount = currCell.m_branchConnectionCount; + if (branchConnectionCount == 0) + { + currCell.m_averageCenter = firstGridConnectionCenterInLeafBranch; + } + else + { + cvf::Vec3d currentWeightedCoord = currCell.m_averageCenter * branchConnectionCount / static_cast(branchConnectionCount + 1); + cvf::Vec3d additionalWeightedCoord = firstGridConnectionCenterInLeafBranch / static_cast(branchConnectionCount + 1); + + currCell.m_averageCenter = currentWeightedCoord + additionalWeightedCoord; + } + + currCell.m_branchConnectionCount++; + + if (cellIndexInOutletBranch == 0) + { + cellIndexInOutletBranch = cvf::UNDEFINED_SIZE_T; + + // Find the branch the outlet is connected to, and continue update of + // segments until a segment with a grid connection is found + const RigWellResultCell* leafBranchHead = wellResFrame.findResultCellFromOutletSpecification(outletResultBranch.m_outletBranchIndex, outletResultBranch.m_outletBranchHeadCellIndex); + + if (leafBranchHead && + !leafBranchHead->hasGridConnections() && + leafBranchHead->m_ertBranchId != outletResultBranch.m_ertBranchId) + { + outletResultBranch = wellResFrame.m_wellResultBranches[outletResultBranch.m_outletBranchIndex]; + cellIndexInOutletBranch = outletResultBranch.m_outletBranchHeadCellIndex; + } + } + else + { + cellIndexInOutletBranch--; + } + + if(cellIndexInOutletBranch >= 0 && cellIndexInOutletBranch < outletResultBranch.m_wellCells.size()) + { + currCell = outletResultBranch.m_wellCells[cellIndexInOutletBranch]; } } } @@ -886,6 +1132,7 @@ void RifReaderEclipseOutput::readWellCells() } } + wellResults->computeMappingFromResultTimeIndicesToWellTimeIndices(m_timeSteps); wells.push_back(wellResults.p()); diff --git a/ApplicationCode/FileInterface/RifReaderEclipseOutput.h b/ApplicationCode/FileInterface/RifReaderEclipseOutput.h index 5dc8794a3a..fe33a025ae 100644 --- a/ApplicationCode/FileInterface/RifReaderEclipseOutput.h +++ b/ApplicationCode/FileInterface/RifReaderEclipseOutput.h @@ -56,7 +56,7 @@ public: private: bool readActiveCellInfo(); void buildMetaData(); - void readWellCells(); + void readWellCells(const ecl_grid_type* mainEclGrid); void openInitFile(); bool openDynamicAccess(); diff --git a/ApplicationCode/ModelVisualization/RivWellPipesPartMgr.cpp b/ApplicationCode/ModelVisualization/RivWellPipesPartMgr.cpp index 8d1e738f1f..00702a2091 100644 --- a/ApplicationCode/ModelVisualization/RivWellPipesPartMgr.cpp +++ b/ApplicationCode/ModelVisualization/RivWellPipesPartMgr.cpp @@ -176,15 +176,15 @@ void RivWellPipesPartMgr::calculateWellPipeCenterline( std::vector< std::vector RigCaseData* rigReservoir = m_rimReservoirView->eclipseCase()->reservoirData(); RigSingleWellResultsData* wellResults = m_rimWell->wellResults(); - const RigWellResultFrame& staticWellFrame = m_rimWell->wellResults()->m_staticWellCells; - // Make sure we have computed the static representation of the well - if (staticWellFrame.m_wellResultBranches.size() == 0) + if (wellResults->m_staticWellCells.m_wellResultBranches.size() == 0) { wellResults->computeStaticWellCellPath(); } - if (staticWellFrame.m_wellResultBranches.size() == 0) return; + const RigWellResultFrame& staticWellFrame = wellResults->m_staticWellCells; + if (staticWellFrame.m_wellResultBranches.size() == 0) return; + // Initialize the return arrays pipeBranchesCLCoords.clear(); pipeBranchesCellIds.clear(); @@ -211,31 +211,93 @@ void RivWellPipesPartMgr::calculateWellPipeCenterline( std::vector< std::vector if (hasResultCells) { - // Create a new branch from wellhead - - pipeBranchesCLCoords.push_back(std::vector()); - pipeBranchesCellIds.push_back(std::vector ()); - - // We start by entering the first cell (the wellhead) - const RigWellResultCell* prevResCell = whResCell; - - pipeBranchesCLCoords.back().push_back(whStartPos); - pipeBranchesCellIds.back().push_back(*prevResCell ); // Add extra coordinate between cell face and cell center // to make sure the well pipe terminated in a segment parallel to z-axis cvf::Vec3d whIntermediate = whStartPos; whIntermediate.z() = (whStartPos.z() + whCell.center().z()) / 2.0; - pipeBranchesCLCoords.back().push_back(whIntermediate); - pipeBranchesCellIds.back().push_back(*prevResCell ); + const RigWellResultCell* prevResCell = NULL; + + // Use well head if branch head is not specified + if (!wellResults->isMultiSegmentWell()) + { + // Create a new branch from wellhead + + pipeBranchesCLCoords.push_back(std::vector()); + pipeBranchesCellIds.push_back(std::vector ()); + + prevResCell = whResCell; + + pipeBranchesCLCoords.back().push_back(whStartPos); + pipeBranchesCellIds.back().push_back(*prevResCell); + + pipeBranchesCLCoords.back().push_back(whIntermediate); + pipeBranchesCellIds.back().push_back(*prevResCell); + } for (size_t brIdx = 0; brIdx < resBranches.size(); brIdx++) { if (resBranches[brIdx].m_wellCells.size() == 0) continue; // Skip empty branches. Do not know why they exist, but they make problems. + prevResCell = NULL; + + + // Find the start the MSW well-branch centerline. Normal wells are started "once" at wellhead in the code above + + if (wellResults->isMultiSegmentWell()) + { + pipeBranchesCLCoords.push_back(std::vector()); + pipeBranchesCellIds.push_back(std::vector ()); + + if (brIdx == 0) + { + // The first branch contains segment number 1, and this is the only segment connected to well head + // See Eclipse documentation for the keyword WELSEGS + prevResCell = whResCell; + + pipeBranchesCLCoords.back().push_back(whStartPos); + pipeBranchesCellIds.back().push_back(*prevResCell); + + pipeBranchesCLCoords.back().push_back(whIntermediate); + pipeBranchesCellIds.back().push_back(*prevResCell); + } + else + { + const RigWellResultCell* leafBranchHead = staticWellFrame.findResultCellFromOutletSpecification(resBranches[brIdx].m_outletBranchIndex, resBranches[brIdx].m_outletBranchHeadCellIndex); + if (leafBranchHead && leafBranchHead->hasGridConnections()) + { + // Create a new branch and use branch head as previous result cell + + prevResCell = leafBranchHead; + + const RigCell& cell = rigReservoir->cellFromWellResultCell(*leafBranchHead); + cvf::Vec3d branchHeadStartPos = cell.faceCenter(cvf::StructGridInterface::NEG_K); + + pipeBranchesCLCoords.back().push_back(branchHeadStartPos); + pipeBranchesCellIds.back().push_back(*prevResCell); + } + else if (leafBranchHead) + { + cvf::Vec3d interpolatedCoord = leafBranchHead->m_averageCenter; + + CVF_ASSERT(interpolatedCoord != cvf::Vec3d::UNDEFINED); + if (interpolatedCoord != cvf::Vec3d::UNDEFINED) + { + pipeBranchesCLCoords.back().push_back(interpolatedCoord); + pipeBranchesCellIds.back().push_back(RigWellResultCell()); + } + } + else + { + // No branch head found: Possibly main branch + CVF_ASSERT(false); + } + } + } + // Loop over all the resultCells in the branch const std::vector& resBranchCells = resBranches[brIdx].m_wellCells; @@ -245,56 +307,101 @@ void RivWellPipesPartMgr::calculateWellPipeCenterline( std::vector< std::vector std::vector& branchCellIds = pipeBranchesCellIds.back(); const RigWellResultCell& resCell = resBranchCells[cIdx]; + + if (!resCell.hasConnections()) + { + continue; + } + + if (resCell.hasBranchConnections()) + { + // Use the interpolated value of branch head + cvf::Vec3d interpolatedCoord = resCell.m_averageCenter; + + CVF_ASSERT(interpolatedCoord != cvf::Vec3d::UNDEFINED); + if (interpolatedCoord != cvf::Vec3d::UNDEFINED) + { + pipeBranchesCLCoords.back().push_back(interpolatedCoord); + pipeBranchesCellIds.back().push_back(RigWellResultCell()); + } + + // Set previous result cell to NULL + prevResCell = NULL; + + continue; + } + const RigCell& cell = rigReservoir->cellFromWellResultCell(resCell); // Check if this and the previous cells has shared faces cvf::StructGridInterface::FaceType sharedFace; - if (rigReservoir->findSharedSourceFace(sharedFace, resCell, *prevResCell)) + if (prevResCell && rigReservoir->findSharedSourceFace(sharedFace, resCell, *prevResCell)) { branchCLCoords.push_back(cell.faceCenter(sharedFace)); branchCellIds.push_back(resCell); } else { - // This and the previous cell does not share a face. We need to go out of the previous cell, before entering this. - const RigCell& prevCell = rigReservoir->cellFromWellResultCell(*prevResCell); - cvf::Vec3d centerPrevCell = prevCell.center(); + cvf::Vec3d previousCoord; + + if (prevResCell) + { + // This and the previous cell does not share a face. We need to go out of the previous cell, before entering this. + const RigCell& prevCell = rigReservoir->cellFromWellResultCell(*prevResCell); + previousCoord = prevCell.center(); + } + else + { + previousCoord = pipeBranchesCLCoords.back().back(); + } + cvf::Vec3d centerThisCell = cell.center(); // First make sure this cell is not starting a new "display" branch - if ( !isAutoDetectBranches || (prevResCell == whResCell) - || (centerThisCell-centerPrevCell).lengthSquared() <= (centerThisCell - whStartPos).lengthSquared()) + if ( wellResults->isMultiSegmentWell() + || !isAutoDetectBranches + || (prevResCell == whResCell) + || (centerThisCell-previousCoord).lengthSquared() <= (centerThisCell - whStartPos).lengthSquared() + ) { // Not starting a "display" branch // Create ray and intersect with cells cvf::Ray rayToThisCell; - rayToThisCell.setOrigin(centerPrevCell); - rayToThisCell.setDirection((centerThisCell - centerPrevCell).getNormalized()); + rayToThisCell.setOrigin(previousCoord); + rayToThisCell.setDirection((centerThisCell - previousCoord).getNormalized()); - cvf::Vec3d outOfPrevCell(centerPrevCell); cvf::Vec3d intoThisCell(centerThisCell); + cell.firstIntersectionPoint(rayToThisCell, &intoThisCell); - bool intersectionOk = prevCell.firstIntersectionPoint(rayToThisCell, &outOfPrevCell); - //CVF_ASSERT(intersectionOk); - intersectionOk = cell.firstIntersectionPoint(rayToThisCell, &intoThisCell); - //CVF_ASSERT(intersectionOk); - if ((intoThisCell - outOfPrevCell).lengthSquared() > 1e-3) + if (prevResCell) { - branchCLCoords.push_back(outOfPrevCell); - branchCellIds.push_back(RigWellResultCell()); + cvf::Vec3d outOfPrevCell(previousCoord); + + const RigCell& prevCell = rigReservoir->cellFromWellResultCell(*prevResCell); + bool intersectionOk = prevCell.firstIntersectionPoint(rayToThisCell, &outOfPrevCell); + //CVF_ASSERT(intersectionOk); + //CVF_ASSERT(intersectionOk); + if ((intoThisCell - outOfPrevCell).lengthSquared() > 1e-3) + { + branchCLCoords.push_back(outOfPrevCell); + branchCellIds.push_back(*prevResCell); + } } + branchCLCoords.push_back(intoThisCell); branchCellIds.push_back(resCell); } else { + CVF_ASSERT(!wellResults->isMultiSegmentWell()); + // This cell is further from the previous cell than from the well head, // thus we interpret it as a new branch. // First finish the current branch - branchCLCoords.push_back(branchCLCoords.back() + 1.5*(centerPrevCell - branchCLCoords.back()) ); + branchCLCoords.push_back(branchCLCoords.back() + 1.5*(previousCoord - branchCLCoords.back()) ); // Create new display branch pipeBranchesCLCoords.push_back(std::vector()); @@ -316,14 +423,32 @@ void RivWellPipesPartMgr::calculateWellPipeCenterline( std::vector< std::vector } prevResCell = &resCell; - } + + if ( wellResults->isMultiSegmentWell()) + { + // All MSW branches are completed using the point 0.5 past the center of last cell + size_t clCoordCount = pipeBranchesCLCoords.back().size(); + CVF_ASSERT(clCoordCount >= 2); + cvf::Vec3d centerPrevCell = pipeBranchesCLCoords.back()[clCoordCount - 2]; + cvf::Vec3d centerThisCell = pipeBranchesCLCoords.back()[clCoordCount - 1]; + + pipeBranchesCLCoords.back().push_back(centerThisCell + 1.5*(centerPrevCell - centerThisCell) ); + } } - // For the last cell, add the point 0.5 past the center of that cell - const RigCell& prevCell = rigReservoir->cellFromWellResultCell(*prevResCell); - cvf::Vec3d centerPrevCell = prevCell.center(); - pipeBranchesCLCoords.back().push_back(pipeBranchesCLCoords.back().back() + 1.5*(centerPrevCell - pipeBranchesCLCoords.back().back()) ); + if (!wellResults->isMultiSegmentWell()) + { + // None MSW wells + // For the last cell, add the point 0.5 past the center of that cell + + size_t clCoordCount = pipeBranchesCLCoords.back().size(); + CVF_ASSERT(clCoordCount >= 2); + cvf::Vec3d centerPrevCell = pipeBranchesCLCoords.back()[clCoordCount - 2]; + cvf::Vec3d centerThisCell = pipeBranchesCLCoords.back()[clCoordCount - 1]; + + pipeBranchesCLCoords.back().push_back(centerThisCell + 1.5*(centerPrevCell - centerThisCell) ); + } } @@ -389,7 +514,12 @@ void RivWellPipesPartMgr::updatePipeResultColor(size_t frameIndex) for (size_t wcIdx = 0; wcIdx < cellIds.size(); ++wcIdx) { // we need a faster lookup, I guess - const RigWellResultCell* wResCell = wResFrame.findResultCell(cellIds[wcIdx].m_gridIndex, cellIds[wcIdx].m_gridCellIndex); + const RigWellResultCell* wResCell = NULL; + + if (cellIds[wcIdx].hasGridConnections()) + { + wResCell = wResFrame.findResultCell(cellIds[wcIdx].m_gridIndex, cellIds[wcIdx].m_gridCellIndex); + } if (wResCell == NULL) { diff --git a/ApplicationCode/ProjectDataModel/RimReservoirView.cpp b/ApplicationCode/ProjectDataModel/RimReservoirView.cpp index 266795d45a..2e1d37c6e0 100644 --- a/ApplicationCode/ProjectDataModel/RimReservoirView.cpp +++ b/ApplicationCode/ProjectDataModel/RimReservoirView.cpp @@ -435,9 +435,6 @@ void RimReservoirView::fieldChangedByUi(const caf::PdmFieldHandle* changedField, } else if ( changedField == &showInactiveCells ) { - m_reservoirGridPartManager->scheduleGeometryRegen(RivReservoirViewPartMgr::INACTIVE); - m_reservoirGridPartManager->scheduleGeometryRegen(RivReservoirViewPartMgr::RANGE_FILTERED_INACTIVE); - createDisplayModelAndRedraw(); } else if ( changedField == &showMainGrid ) @@ -560,7 +557,7 @@ void RimReservoirView::createDisplayModel() if (! this->propertyFilterCollection()->hasActiveFilters()) { std::vector geometryTypesToAdd; - + if (this->rangeFilterCollection()->hasActiveFilters() || this->wellCollection()->hasVisibleWellCells()) { geometryTypesToAdd.push_back(RivReservoirViewPartMgr::RANGE_FILTERED); @@ -582,7 +579,7 @@ void RimReservoirView::createDisplayModel() geometryTypesToAdd.push_back(RivReservoirViewPartMgr::INACTIVE); } } - + size_t frameIdx; for (frameIdx = 0; frameIdx < frameModels.size(); ++frameIdx) { @@ -678,22 +675,6 @@ void RimReservoirView::updateCurrentTimeStep() float opacity = static_cast< float> (1 - cvf::Math::clamp(this->wellCollection()->wellCellTransparencyLevel(), 0.0, 1.0)); m_reservoirGridPartManager->updateCellColor(RivReservoirViewPartMgr::PROPERTY_FILTERED_WELL_CELLS, m_currentTimeStep, cvf::Color4f(cvf::Color3f(cvf::Color3::WHITE), opacity)); - - if (this->showInactiveCells()) - { - std::vector gridIndices; - this->indicesToVisibleGrids(&gridIndices); - - if (this->rangeFilterCollection()->hasActiveFilters() || this->wellCollection()->hasVisibleWellCells()) - { - m_reservoirGridPartManager->appendStaticGeometryPartsToModel(frameParts.p(), RivReservoirViewPartMgr::RANGE_FILTERED_INACTIVE, gridIndices); - } - else - { - m_reservoirGridPartManager->appendStaticGeometryPartsToModel(frameParts.p(), RivReservoirViewPartMgr::INACTIVE, gridIndices); - } - } - if (m_viewer) { cvf::Scene* frameScene = m_viewer->frame(m_currentTimeStep); @@ -1044,6 +1025,29 @@ void RimReservoirView::appendCellResultInfo(size_t gridIndex, size_t cellIndex, } } } + + cvf::Collection wellResults = m_reservoir->reservoirData()->wellResults(); + for (size_t i = 0; i < wellResults.size(); i++) + { + RigSingleWellResultsData* singleWellResultData = wellResults.at(i); + + if (m_currentTimeStep < singleWellResultData->firstResultTimeStep()) + { + continue; + } + + const RigWellResultFrame& wellResultFrame = singleWellResultData->wellResultFrame(m_currentTimeStep); + const RigWellResultCell* wellResultCell = wellResultFrame.findResultCell(gridIndex, cellIndex); + if (wellResultCell) + { + resultInfoText->append(QString("(0-based) Branch Id : %1 Segment Id %2\n").arg(wellResultCell->m_ertBranchId).arg(wellResultCell->m_ertSegmentId)); + if (wellResultCell->hasBranchConnections()) + { + resultInfoText->append(QString("Branch Connection Count : %1\n").arg(wellResultCell->m_branchConnectionCount)); + resultInfoText->append(QString("Center coord : %1 %2 %3\n").arg(wellResultCell->m_averageCenter.x()).arg(wellResultCell->m_averageCenter.y()).arg(wellResultCell->m_averageCenter.z())); + } + } + } } } @@ -1400,6 +1404,11 @@ void RimReservoirView::calculateVisibleWellCellsIncFence(cvf::UByteArray* visibl { if (wsResCells[cIdx].m_gridIndex == grid->gridIndex()) { + if (!wsResCells[cIdx].hasGridConnections()) + { + continue; + } + size_t gridCellIndex = wsResCells[cIdx].m_gridCellIndex; (*visibleCells)[gridCellIndex] = true; diff --git a/ApplicationCode/ProjectDataModel/RimWell.cpp b/ApplicationCode/ProjectDataModel/RimWell.cpp index 4e07d4a449..ccbeaef416 100644 --- a/ApplicationCode/ProjectDataModel/RimWell.cpp +++ b/ApplicationCode/ProjectDataModel/RimWell.cpp @@ -148,18 +148,12 @@ bool RimWell::calculateWellPipeVisibility(size_t frameIndex) if (m_reservoirView == NULL) return false; if (this->wellResults() == NULL) return false; - if (frameIndex >= this->wellResults()->m_resultTimeStepIndexToWellTimeStepIndex.size()) - { + if ( this->wellResults()->firstResultTimeStep() == cvf::UNDEFINED_SIZE_T + || frameIndex < this->wellResults()->firstResultTimeStep() + || frameIndex >= this->wellResults()->m_wellCellsTimeSteps.size()) return false; - } - size_t wellTimeStepIndex = this->wellResults()->m_resultTimeStepIndexToWellTimeStepIndex[frameIndex]; - if (wellTimeStepIndex == cvf::UNDEFINED_SIZE_T) - { - return false; - } - - if (!m_reservoirView->wellCollection()->isActive()) + if (!m_reservoirView->wellCollection()->active()) return false; if (m_reservoirView->wellCollection()->wellPipeVisibility() == RimWellCollection::PIPES_FORCE_ALL_ON) @@ -202,13 +196,16 @@ bool RimWell::calculateWellPipeVisibility(size_t frameIndex) const std::vector& wsResCells = wellResSegments[wsIdx].m_wellCells; for (size_t cIdx = 0; cIdx < wsResCells.size(); ++ cIdx) { - gridIndex = wsResCells[cIdx].m_gridIndex; - gridCellIndex = wsResCells[cIdx].m_gridCellIndex; - - cvf::cref cellVisibility = rvMan->cellVisibility(visGridParts[gpIdx], gridIndex, frameIndex); - if ((*cellVisibility)[gridCellIndex]) + if (wsResCells[cIdx].hasGridConnections()) { - return true; + gridIndex = wsResCells[cIdx].m_gridIndex; + gridCellIndex = wsResCells[cIdx].m_gridCellIndex; + + cvf::cref cellVisibility = rvMan->cellVisibility(visGridParts[gpIdx], gridIndex, frameIndex); + if ((*cellVisibility)[gridCellIndex]) + { + return true; + } } } } diff --git a/ApplicationCode/ReservoirDataModel/RigSingleWellResultsData.cpp b/ApplicationCode/ReservoirDataModel/RigSingleWellResultsData.cpp index a36cf5752f..609e2766ed 100644 --- a/ApplicationCode/ReservoirDataModel/RigSingleWellResultsData.cpp +++ b/ApplicationCode/ReservoirDataModel/RigSingleWellResultsData.cpp @@ -118,7 +118,7 @@ void RigSingleWellResultsData::computeStaticWellCellPath() for (size_t bIdx = 0; bIdx < m_wellCellsTimeSteps[0].m_wellResultBranches.size(); ++bIdx) { - size_t branchNumber = m_wellCellsTimeSteps[0].m_wellResultBranches[bIdx].m_branchNumber; + size_t branchNumber = m_wellCellsTimeSteps[0].m_wellResultBranches[bIdx].m_branchIndex; std::vector& frameCells = m_wellCellsTimeSteps[0].m_wellResultBranches[bIdx].m_wellCells; std::list< RigWellResultCell >& branch = staticWellBranches[branchNumber]; @@ -137,7 +137,7 @@ void RigSingleWellResultsData::computeStaticWellCellPath() for (size_t bIdx = 0; bIdx < m_wellCellsTimeSteps[tIdx].m_wellResultBranches.size(); ++bIdx) { - size_t branchNumber = m_wellCellsTimeSteps[tIdx].m_wellResultBranches[bIdx].m_branchNumber; + size_t branchNumber = m_wellCellsTimeSteps[tIdx].m_wellResultBranches[bIdx].m_branchIndex; std::vector& resBranch = m_wellCellsTimeSteps[tIdx].m_wellResultBranches[bIdx].m_wellCells; std::list< RigWellResultCell >& stBranch = staticWellBranches[branchNumber]; @@ -252,12 +252,20 @@ void RigSingleWellResultsData::computeStaticWellCellPath() for (bIt = staticWellBranches.begin(); bIt != staticWellBranches.end(); ++bIt) { - RigWellResultBranch rigBranch; - rigBranch.m_branchNumber = bIt->first; + if (bIt->first >= m_wellCellsTimeSteps[0].m_wellResultBranches.size()) + { + continue; + } + + // Copy from first time step + RigWellResultBranch rigBranch = m_wellCellsTimeSteps[0].m_wellResultBranches[bIt->first]; + rigBranch.m_branchIndex = bIt->first; + + // Clear well cells, and insert the collection of well cells for the static situation + rigBranch.m_wellCells.clear(); std::list< RigWellResultCell >& branch = bIt->second; std::list< RigWellResultCell >::iterator cIt; - for (cIt = branch.begin(); cIt != branch.end(); ++cIt) { RigWellResultCell rwc = *cIt; @@ -269,3 +277,19 @@ void RigSingleWellResultsData::computeStaticWellCellPath() } } +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +void RigSingleWellResultsData::setMultiSegmentWell(bool isMultiSegmentWell) +{ + m_isMultiSegmentWell = isMultiSegmentWell; +} + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +bool RigSingleWellResultsData::isMultiSegmentWell() const +{ + return m_isMultiSegmentWell; +} + diff --git a/ApplicationCode/ReservoirDataModel/RigSingleWellResultsData.h b/ApplicationCode/ReservoirDataModel/RigSingleWellResultsData.h index 7e27f23073..3954c0d11b 100644 --- a/ApplicationCode/ReservoirDataModel/RigSingleWellResultsData.h +++ b/ApplicationCode/ReservoirDataModel/RigSingleWellResultsData.h @@ -25,33 +25,72 @@ #include "RimDefines.h" #include #include +#include "cvfVector3.h" struct RigWellResultCell { RigWellResultCell() : m_gridIndex(cvf::UNDEFINED_SIZE_T), m_gridCellIndex(cvf::UNDEFINED_SIZE_T), - m_branchId(-1), - m_segmentId(-1), - m_isOpen(false) + m_isOpen(false), + m_ertBranchId(-1), + m_ertSegmentId(-1), + m_averageCenter(cvf::Vec3d::UNDEFINED), + m_branchConnectionCount(0) { } + bool hasBranchConnections() const + { + return m_branchConnectionCount != 0; + } + + bool hasGridConnections() const + { + return m_gridCellIndex != cvf::UNDEFINED_SIZE_T; + } + + bool hasConnections() const + { + return hasGridConnections() || hasBranchConnections(); + } + + size_t m_gridIndex; size_t m_gridCellIndex; //< Index to cell which is included in the well - int m_branchId; - int m_segmentId; bool m_isOpen; //< Marks the well as open or closed as of Eclipse simulation + + int m_ertBranchId; + int m_ertSegmentId; + + cvf::Vec3d m_averageCenter; + size_t m_branchConnectionCount; }; struct RigWellResultBranch { RigWellResultBranch() : - m_branchNumber(cvf::UNDEFINED_SIZE_T) + m_branchIndex(cvf::UNDEFINED_SIZE_T), + m_ertBranchId(-1), + m_outletBranchIndex(cvf::UNDEFINED_SIZE_T), + m_outletBranchHeadCellIndex(cvf::UNDEFINED_SIZE_T) {} - size_t m_branchNumber; + + size_t m_branchIndex; + int m_ertBranchId; + std::vector m_wellCells; + + // Grid cell from last connection in outlet segment. For MSW wells, this is either well head or a well result cell in another branch + // For standard wells, this is always well head. + RigWellResultCell m_branchHead; + + // Grid cell from last connection in outlet segment. For MSW wells, this is either well head or a well result cell in another branch + // For standard wells, this is always well head. + size_t m_outletBranchIndex; + size_t m_outletBranchHeadCellIndex; + }; class RigWellResultFrame @@ -67,6 +106,8 @@ public: const RigWellResultCell* findResultCell(size_t gridIndex, size_t gridCellIndex) const { + CVF_ASSERT(gridIndex != cvf::UNDEFINED_SIZE_T && gridCellIndex != cvf::UNDEFINED_SIZE_T); + if (m_wellHead.m_gridCellIndex == gridCellIndex && m_wellHead.m_gridIndex == gridIndex ) { return &m_wellHead; @@ -87,6 +128,21 @@ public: return NULL; } + const RigWellResultCell* findResultCellFromOutletSpecification(size_t branchIndex, size_t wellResultCellIndex) const + { + if (branchIndex != cvf::UNDEFINED_SIZE_T && branchIndex < m_wellResultBranches.size()) + { + const RigWellResultBranch& resBranch = m_wellResultBranches[branchIndex]; + if (wellResultCellIndex != cvf::UNDEFINED_SIZE_T && wellResultCellIndex < resBranch.m_wellCells.size()) + { + return (&resBranch.m_wellCells[wellResultCellIndex]); + } + } + + return NULL; + } + + WellProductionType m_productionType; bool m_isOpen; RigWellResultCell m_wellHead; @@ -102,6 +158,11 @@ public: class RigSingleWellResultsData : public cvf::Object { public: + RigSingleWellResultsData() { m_isMultiSegmentWell = false; } + + void setMultiSegmentWell(bool isMultiSegmentWell); + bool isMultiSegmentWell() const; + bool hasWellResult(size_t resultTimeStepIndex) const; size_t firstResultTimeStep() const; @@ -113,6 +174,7 @@ public: public: QString m_wellName; + bool m_isMultiSegmentWell; std::vector m_resultTimeStepIndexToWellTimeStepIndex; // Well result timesteps may differ from result timesteps std::vector< RigWellResultFrame > m_wellCellsTimeSteps; diff --git a/ThirdParty/Ert/devel/cmake/cmake_pyc2 b/ThirdParty/Ert/devel/cmake/cmake_pyc2 index d1ecbf7279..b32fd967a7 100644 --- a/ThirdParty/Ert/devel/cmake/cmake_pyc2 +++ b/ThirdParty/Ert/devel/cmake/cmake_pyc2 @@ -11,7 +11,11 @@ target_file = sys.argv[2] (target_path , tail) = os.path.split( target_file ) if not os.path.exists( target_path ): - os.makedirs( target_path ) + try: + os.makedirs( target_path ) + except: + # When running with make -j 4 there might be a race to create this directory. + pass shutil.copyfile( src_file , target_file ) try: diff --git a/ThirdParty/Ert/devel/cmake/cmake_pyc_tree b/ThirdParty/Ert/devel/cmake/cmake_pyc_tree index 790ce984d9..eeeaa389b6 100644 --- a/ThirdParty/Ert/devel/cmake/cmake_pyc_tree +++ b/ThirdParty/Ert/devel/cmake/cmake_pyc_tree @@ -17,6 +17,10 @@ for (root , dir_list , file_list) in os.walk( root_path ): (tmp , ext) = os.path.splitext( full_path ) if ext == ".py": py_file = full_path + pyc_file = full_path + "c" + if os.path.exists( pyc_file ): + os.unlink( pyc_file ) + try: print "Compiling: %s" % py_file py_compile.compile( py_file , doraise = True ) diff --git a/ThirdParty/Ert/devel/libecl/applications/CMakeLists.txt b/ThirdParty/Ert/devel/libecl/applications/CMakeLists.txt index afc4dba904..864aeaf500 100644 --- a/ThirdParty/Ert/devel/libecl/applications/CMakeLists.txt +++ b/ThirdParty/Ert/devel/libecl/applications/CMakeLists.txt @@ -3,6 +3,7 @@ if (BUILD_APPLICATIONS) add_executable( make_grid make_grid.c ) add_executable( grdecl_grid grdecl_grid.c ) add_executable( summary2csv summary2csv.c ) + add_executable( summary2csv2 summary2csv2.c ) if (ERT_LINUX) add_executable( esummary.x esummary.c ) add_executable( convert.x convert.c ) @@ -15,7 +16,7 @@ if (BUILD_APPLICATIONS) add_executable( summary.x view_summary.c ) add_executable( select_test.x select_test.c ) add_executable( load_test.x load_test.c ) - set(program_list summary2csv esummary.x kw_extract.x grdecl_grid make_grid sum_write load_test.x grdecl_test.x grid_dump_ascii.x select_test.x grid_dump.x convert.x kw_list.x grid_info.x summary.x) + set(program_list summary2csv2 summary2csv esummary.x kw_extract.x grdecl_grid make_grid sum_write load_test.x grdecl_test.x grid_dump_ascii.x select_test.x grid_dump.x convert.x kw_list.x grid_info.x summary.x) else() # The stupid .x extension creates problems on windows add_executable( convert convert.c ) @@ -28,7 +29,7 @@ if (BUILD_APPLICATIONS) add_executable( summary view_summary.c ) add_executable( select_test select_test.c ) add_executable( load_test load_test.c ) - set(program_list summary2csv kw_extract grdecl_grid make_grid sum_write load_test grdecl_test grid_dump_ascii select_test grid_dump convert kw_list grid_info summary) + set(program_list summary2csv2 summary2csv kw_extract grdecl_grid make_grid sum_write load_test grdecl_test grid_dump_ascii select_test grid_dump convert kw_list grid_info summary) endif() diff --git a/ThirdParty/Ert/devel/libecl/applications/makefile b/ThirdParty/Ert/devel/libecl/applications/makefile deleted file mode 100644 index 7c3db2c7dd..0000000000 --- a/ThirdParty/Ert/devel/libecl/applications/makefile +++ /dev/null @@ -1,163 +0,0 @@ -# CMAKE generated file: DO NOT EDIT! -# Generated by "MinGW Makefiles" Generator, CMake Version 2.8 - -# Default target executed when no arguments are given to make. -default_target: all -.PHONY : default_target - -#============================================================================= -# Special targets provided by cmake. - -# Disable implicit rules so canoncical targets will work. -.SUFFIXES: - -# Remove some rules from gmake that .SUFFIXES does not remove. -SUFFIXES = - -.SUFFIXES: .hpux_make_needs_suffix_list - -# Suppress display of executed commands. -$(VERBOSE).SILENT: - -# A target that is always out of date. -cmake_force: -.PHONY : cmake_force - -#============================================================================= -# Set environment variables for the build. - -SHELL = cmd.exe - -# The CMake executable. -CMAKE_COMMAND = "C:\Program Files\CMake 2.8\bin\cmake.exe" - -# The command to remove a file. -RM = "C:\Program Files\CMake 2.8\bin\cmake.exe" -E remove -f - -# The program to use to edit the cache. -CMAKE_EDIT_COMMAND = "C:\Program Files\CMake 2.8\bin\cmake-gui.exe" - -# The top-level source directory on which CMake was run. -CMAKE_SOURCE_DIR = C:\code\ERT - -# The top-level build directory on which CMake was run. -CMAKE_BINARY_DIR = C:\code\ERT - -#============================================================================= -# Targets provided globally by CMake. - -# Special rule for the target edit_cache -edit_cache: - @$(CMAKE_COMMAND) -E cmake_echo_color --switch=$(COLOR) --cyan "Running CMake cache editor..." - "C:\Program Files\CMake 2.8\bin\cmake-gui.exe" -H$(CMAKE_SOURCE_DIR) -B$(CMAKE_BINARY_DIR) -.PHONY : edit_cache - -# Special rule for the target edit_cache -edit_cache/fast: edit_cache -.PHONY : edit_cache/fast - -# Special rule for the target rebuild_cache -rebuild_cache: - @$(CMAKE_COMMAND) -E cmake_echo_color --switch=$(COLOR) --cyan "Running CMake to regenerate build system..." - "C:\Program Files\CMake 2.8\bin\cmake.exe" -H$(CMAKE_SOURCE_DIR) -B$(CMAKE_BINARY_DIR) -.PHONY : rebuild_cache - -# Special rule for the target rebuild_cache -rebuild_cache/fast: rebuild_cache -.PHONY : rebuild_cache/fast - -# The main all target -all: cmake_check_build_system - cd /d C:\code\ERT && $(CMAKE_COMMAND) -E cmake_progress_start C:\code\ERT\CMakeFiles C:\code\ERT\libecl\applications\CMakeFiles\progress.marks - cd /d C:\code\ERT && $(MAKE) -f CMakeFiles\Makefile2 libecl/applications/all - $(CMAKE_COMMAND) -E cmake_progress_start C:\code\ERT\CMakeFiles 0 -.PHONY : all - -# The main clean target -clean: - cd /d C:\code\ERT && $(MAKE) -f CMakeFiles\Makefile2 libecl/applications/clean -.PHONY : clean - -# The main clean target -clean/fast: clean -.PHONY : clean/fast - -# Prepare targets for installation. -preinstall: all - cd /d C:\code\ERT && $(MAKE) -f CMakeFiles\Makefile2 libecl/applications/preinstall -.PHONY : preinstall - -# Prepare targets for installation. -preinstall/fast: - cd /d C:\code\ERT && $(MAKE) -f CMakeFiles\Makefile2 libecl/applications/preinstall -.PHONY : preinstall/fast - -# clear depends -depend: - cd /d C:\code\ERT && $(CMAKE_COMMAND) -H$(CMAKE_SOURCE_DIR) -B$(CMAKE_BINARY_DIR) --check-build-system CMakeFiles\Makefile.cmake 1 -.PHONY : depend - -# Convenience name for target. -libecl/applications/CMakeFiles/grid_info.x.dir/rule: - cd /d C:\code\ERT && $(MAKE) -f CMakeFiles\Makefile2 libecl/applications/CMakeFiles/grid_info.x.dir/rule -.PHONY : libecl/applications/CMakeFiles/grid_info.x.dir/rule - -# Convenience name for target. -grid_info.x: libecl/applications/CMakeFiles/grid_info.x.dir/rule -.PHONY : grid_info.x - -# fast build rule for target. -grid_info.x/fast: - cd /d C:\code\ERT && $(MAKE) -f libecl\applications\CMakeFiles\grid_info.x.dir\build.make libecl/applications/CMakeFiles/grid_info.x.dir/build -.PHONY : grid_info.x/fast - -grid_info.obj: grid_info.c.obj -.PHONY : grid_info.obj - -# target to build an object file -grid_info.c.obj: - cd /d C:\code\ERT && $(MAKE) -f libecl\applications\CMakeFiles\grid_info.x.dir\build.make libecl/applications/CMakeFiles/grid_info.x.dir/grid_info.c.obj -.PHONY : grid_info.c.obj - -grid_info.i: grid_info.c.i -.PHONY : grid_info.i - -# target to preprocess a source file -grid_info.c.i: - cd /d C:\code\ERT && $(MAKE) -f libecl\applications\CMakeFiles\grid_info.x.dir\build.make libecl/applications/CMakeFiles/grid_info.x.dir/grid_info.c.i -.PHONY : grid_info.c.i - -grid_info.s: grid_info.c.s -.PHONY : grid_info.s - -# target to generate assembly for a file -grid_info.c.s: - cd /d C:\code\ERT && $(MAKE) -f libecl\applications\CMakeFiles\grid_info.x.dir\build.make libecl/applications/CMakeFiles/grid_info.x.dir/grid_info.c.s -.PHONY : grid_info.c.s - -# Help Target -help: - @$(CMAKE_COMMAND) -E echo "The following are some of the valid targets for this Makefile:" - @$(CMAKE_COMMAND) -E echo "... all (the default if no target is provided)" - @$(CMAKE_COMMAND) -E echo "... clean" - @$(CMAKE_COMMAND) -E echo "... depend" - @$(CMAKE_COMMAND) -E echo "... edit_cache" - @$(CMAKE_COMMAND) -E echo "... grid_info.x" - @$(CMAKE_COMMAND) -E echo "... rebuild_cache" - @$(CMAKE_COMMAND) -E echo "... grid_info.obj" - @$(CMAKE_COMMAND) -E echo "... grid_info.i" - @$(CMAKE_COMMAND) -E echo "... grid_info.s" -.PHONY : help - - - -#============================================================================= -# Special targets to cleanup operation of make. - -# Special rule to run CMake to check the build system integrity. -# No rule that depends on this can have commands that come from listfiles -# because they might be regenerated. -cmake_check_build_system: - cd /d C:\code\ERT && $(CMAKE_COMMAND) -H$(CMAKE_SOURCE_DIR) -B$(CMAKE_BINARY_DIR) --check-build-system CMakeFiles\Makefile.cmake 0 -.PHONY : cmake_check_build_system - diff --git a/ThirdParty/Ert/devel/libecl/applications/summary2csv.c b/ThirdParty/Ert/devel/libecl/applications/summary2csv.c index 2a43ed4725..2b9fb94eb9 100644 --- a/ThirdParty/Ert/devel/libecl/applications/summary2csv.c +++ b/ThirdParty/Ert/devel/libecl/applications/summary2csv.c @@ -27,39 +27,32 @@ - -static void build_key_list( const ecl_sum_type * ecl_sum , stringlist_type * key_list ) { - int iw; +static bool extend_key_list( const ecl_sum_type * ecl_sum , const stringlist_type * var_list , const char * well , stringlist_type * key_list ) { + bool oil_producer = false; int last_step = ecl_sum_get_data_length( ecl_sum ) - 1; - stringlist_type * well_list = ecl_sum_alloc_well_list( ecl_sum , NULL ); - for (iw = 0; iw < stringlist_get_size( well_list ); iw++) { - const char * well = stringlist_iget( well_list , iw ); - char * wopt_key = ecl_sum_alloc_well_key( ecl_sum , "WOPR", well); - if (ecl_sum_has_key( ecl_sum , wopt_key) && (ecl_sum_get_well_var( ecl_sum , last_step , well , "WOPT") > 0 )) { - /* - We add all the keys unconditionally here; and then let the - ecl_sum_fprintf() function print a message on stderr if it is - missing. - */ - stringlist_append_owned_ref( key_list , ecl_sum_alloc_well_key( ecl_sum , "WOPR", well) ); - stringlist_append_owned_ref( key_list , ecl_sum_alloc_well_key( ecl_sum , "WOPT", well) ); - - stringlist_append_owned_ref( key_list , ecl_sum_alloc_well_key( ecl_sum , "WGPR", well) ); - stringlist_append_owned_ref( key_list , ecl_sum_alloc_well_key( ecl_sum , "WGPT", well) ); - - stringlist_append_owned_ref( key_list , ecl_sum_alloc_well_key( ecl_sum , "WWPR", well) ); - stringlist_append_owned_ref( key_list , ecl_sum_alloc_well_key( ecl_sum , "WWPT", well) ); - } else - printf("Ignoring well: %s \n",well); - free( wopt_key ); - } - stringlist_free( well_list ); + char * wopt_key = ecl_sum_alloc_well_key( ecl_sum , "WOPT", well); + if (ecl_sum_has_key( ecl_sum , wopt_key) && (ecl_sum_get_well_var( ecl_sum , last_step , well , "WOPT") > 0 )) { + /* + We add all the keys unconditionally here; and then let the + ecl_sum_fprintf() function print a message on stderr if it is + missing. + */ + int ivar; + for (ivar = 0; ivar < stringlist_get_size( var_list ); ivar++) { + const char * var = stringlist_iget( var_list , ivar ); + stringlist_append_owned_ref( key_list , ecl_sum_alloc_well_key( ecl_sum , var, well) ); + } + oil_producer = true; + } + free( wopt_key ); + return oil_producer; } int main(int argc , char ** argv) { { ecl_sum_fmt_type fmt; + bool well_rows = false; bool include_restart = true; int arg_offset = 1; @@ -71,23 +64,49 @@ int main(int argc , char ** argv) { { char * data_file = argv[arg_offset]; ecl_sum_type * ecl_sum; + stringlist_type * var_list = stringlist_alloc_new(); + + stringlist_append_ref( var_list , "WOPR" ); + stringlist_append_ref( var_list , "WOPT" ); + stringlist_append_ref( var_list , "WGPR" ); + stringlist_append_ref( var_list , "WGPT" ); + stringlist_append_ref( var_list , "WWPR" ); + stringlist_append_ref( var_list , "WWPT" ); ecl_sum_fmt_init_csv( &fmt ); ecl_sum = ecl_sum_fread_alloc_case__( data_file , ":" , include_restart); if (ecl_sum != NULL) { + char * csv_file = util_alloc_filename( NULL , ecl_sum_get_base(ecl_sum) , "txt"); // Will save to current path; can use ecl_sum_get_path() to save to target path instead. + FILE * stream = util_fopen( csv_file , "w"); + + stringlist_type * well_list = ecl_sum_alloc_well_list( ecl_sum , NULL ); stringlist_type * key_list = stringlist_alloc_new( ); - build_key_list( ecl_sum , key_list ); - { - char * csv_file = util_alloc_filename( NULL , ecl_sum_get_base(ecl_sum) , "txt"); // Weill save to current path; can use ecl_sum_get_path() to save to target path instead. - FILE * stream = util_fopen( csv_file , "w"); + int iw; + + for (iw = 0; iw < stringlist_get_size( well_list ); iw++) { + const char * well = stringlist_iget( well_list , iw ); + if (!extend_key_list( ecl_sum , var_list , well , key_list)) + fprintf(stderr , "Ignoring well: %s \n",well); + + if (well_rows) { + if (stringlist_get_size(key_list)) { + ecl_sum_fprintf(ecl_sum , stream , key_list , false , &fmt); + stringlist_clear( key_list ); + } + } + } + if (!well_rows) ecl_sum_fprintf(ecl_sum , stream , key_list , false , &fmt); - fclose( stream ); - free( csv_file ); - } + + stringlist_free( well_list ); stringlist_free( key_list ); ecl_sum_free(ecl_sum); + fclose( stream ); + free( csv_file ); } else fprintf(stderr,"summary2csv: No summary data found for case:%s\n", data_file ); + + stringlist_free( var_list ); } } } diff --git a/ThirdParty/Ert/devel/libecl/applications/summary2csv2.c b/ThirdParty/Ert/devel/libecl/applications/summary2csv2.c new file mode 100644 index 0000000000..7655f1f02b --- /dev/null +++ b/ThirdParty/Ert/devel/libecl/applications/summary2csv2.c @@ -0,0 +1,146 @@ +/* + Copyright (C) 2013 Statoil ASA, Norway. + The file 'summary2csv2.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 + for more details. +*/ + +#include +#include +#include +#include + +#include +#include + +#include + + + + + +static void fprintf_line( const ecl_sum_type * ecl_sum , const ecl_sum_fmt_type * fmt , const char * well , int time_index , const stringlist_type * var_list , FILE * stream) { + /* WELL */ + fprintf(stream , fmt->header_fmt , well); + fprintf(stream , fmt->sep ); + + /* DAYS */ + fprintf(stream , fmt->days_fmt , ecl_sum_iget_sim_days(ecl_sum , time_index)); + fprintf(stream , fmt->sep ); + + /* DATE */ + { + struct tm ts; + const int DATE_STRING_LENGTH = 128; + char * date_string = util_malloc( DATE_STRING_LENGTH * sizeof * date_string); + time_t sim_time = ecl_sum_iget_sim_time(ecl_sum , time_index ); + util_localtime( &sim_time , &ts); + strftime( date_string , DATE_STRING_LENGTH - 1 , fmt->date_fmt , &ts); + fprintf(stream , date_string ); + free( date_string ); + } + + { + int ivar; + for (ivar = 0; ivar < stringlist_get_size( var_list ); ivar++) { + const char * var = stringlist_iget( var_list , ivar ); + double value = 0; + if (ecl_sum_has_well_var( ecl_sum , well , var )) + value = ecl_sum_get_well_var( ecl_sum , time_index , well , var ); + else + fprintf(stderr,"Missing variable:%s for well:%s - substituting 0.0 \n",var , well); + + fprintf(stream , fmt->sep ); + fprintf(stream , fmt->value_fmt , value ); + } + fprintf( stream , fmt->newline ); + } +} + + + +int main(int argc , char ** argv) { + { + ecl_sum_fmt_type fmt; + bool include_restart = true; + int arg_offset = 1; + + if (argc != 2) { + printf("You must supply the name of a case as:\n\n summary2csv.exe ECLIPSE_CASE\n\nThe case can optionally contain a leading path component.\n"); + exit(1); + } + + { + char * data_file = argv[arg_offset]; + ecl_sum_type * ecl_sum; + stringlist_type * var_list = stringlist_alloc_new(); + + stringlist_append_ref( var_list , "WOPR" ); + stringlist_append_ref( var_list , "WOPT" ); + stringlist_append_ref( var_list , "WGPR" ); + stringlist_append_ref( var_list , "WGPT" ); + stringlist_append_ref( var_list , "WWPR" ); + stringlist_append_ref( var_list , "WWPT" ); + + + ecl_sum_fmt_init_csv( &fmt ); + ecl_sum = ecl_sum_fread_alloc_case__( data_file , ":" , include_restart); + if (ecl_sum != NULL) { + char * csv_file = util_alloc_filename( NULL , ecl_sum_get_base(ecl_sum) , "txt"); // Will save to current path; can use ecl_sum_get_path() to save to target path instead. + FILE * stream = util_fopen( csv_file , "w"); + + stringlist_type * well_list = ecl_sum_alloc_well_list( ecl_sum , NULL ); + stringlist_type * key_list = stringlist_alloc_new( ); + + fprintf(stream , fmt.header_fmt , "WELLNAME"); + + fprintf(stream , fmt.sep ); + fprintf(stream , fmt.header_fmt , "DAYS"); + + fprintf(stream , fmt.sep ); + fprintf(stream , fmt.header_fmt , "DATES"); + + { + int ivar; + for (ivar = 0; ivar < stringlist_get_size( var_list ); ivar++) { + const char * var = stringlist_iget( var_list , ivar ); + fprintf(stream , fmt.sep ); + fprintf(stream , fmt.header_fmt , var ); + } + fprintf(stream , "\n"); + } + + { + int iw; + for (iw = 0; iw < stringlist_get_size( well_list ); iw++) { + const char * well = stringlist_iget( well_list , iw ); + if (ecl_sum_is_oil_producer( ecl_sum , well )) { + int time_index; + for (time_index = 0; time_index < ecl_sum_get_data_length( ecl_sum ); time_index++) + fprintf_line( ecl_sum , &fmt , well , time_index , var_list , stream); + } + } + } + + stringlist_free( well_list ); + stringlist_free( key_list ); + ecl_sum_free(ecl_sum); + fclose( stream ); + free( csv_file ); + } else + fprintf(stderr,"summary2csv2: No summary data found for case:%s\n", data_file ); + + stringlist_free( var_list ); + } + } +} diff --git a/ThirdParty/Ert/devel/libecl/include/ert/ecl/ecl_grid.h b/ThirdParty/Ert/devel/libecl/include/ert/ecl/ecl_grid.h index 2ab1448567..ee007e3b08 100644 --- a/ThirdParty/Ert/devel/libecl/include/ert/ecl/ecl_grid.h +++ b/ThirdParty/Ert/devel/libecl/include/ert/ecl/ecl_grid.h @@ -31,6 +31,8 @@ extern "C" { #include #include +#define ECL_GRID_GLOBAL_GRID "Global" // used as key in hash tables over grids. + typedef double (block_function_ftype) ( const double_vector_type *); typedef struct ecl_grid_struct ecl_grid_type; @@ -140,6 +142,7 @@ extern "C" { ecl_grid_type * ecl_grid_iget_lgr(const ecl_grid_type * main_grid , int lgr_nr); ecl_grid_type * ecl_grid_get_lgr(const ecl_grid_type * main_grid, const char * __lgr_name); bool ecl_grid_has_lgr(const ecl_grid_type * main_grid, const char * __lgr_name); + const char * ecl_grid_iget_lgr_name( const ecl_grid_type * ecl_grid , int lgr_nr); stringlist_type * ecl_grid_alloc_lgr_name_list(const ecl_grid_type * ecl_grid); int ecl_grid_get_parent_cell1( const ecl_grid_type * grid , int global_index); int ecl_grid_get_parent_cell3( const ecl_grid_type * grid , int i , int j , int k); @@ -171,6 +174,8 @@ extern "C" { void ecl_grid_cell_ri_export( const ecl_grid_type * ecl_grid , int global_index , double * ri_points); bool ecl_grid_dual_grid( const ecl_grid_type * ecl_grid ); + + UTIL_IS_INSTANCE_HEADER( ecl_grid ); #ifdef __cplusplus } diff --git a/ThirdParty/Ert/devel/libecl/include/ert/ecl/ecl_kw_magic.h b/ThirdParty/Ert/devel/libecl/include/ert/ecl/ecl_kw_magic.h index 9bf019ffe2..ece8f6ecf8 100644 --- a/ThirdParty/Ert/devel/libecl/include/ert/ecl/ecl_kw_magic.h +++ b/ThirdParty/Ert/devel/libecl/include/ert/ecl/ecl_kw_magic.h @@ -104,6 +104,7 @@ extern "C" { #define ZWEL_KW "ZWEL" #define ICON_KW "ICON" #define ISEG_KW "ISEG" +#define RSEG_KW "RSEG" #define ECLIPSE100_OIL_DEN_KW "OIL_DEN" #define ECLIPSE100_GAS_DEN_KW "GAS_DEN" @@ -135,9 +136,9 @@ extern "C" { #define INTEHEAD_NSEGMX_INDEX 176 #define INTEHEAD_NLBRMX_INDEX 177 #define INTEHEAD_NISEGZ_INDEX 178 +#define INTEHEAD_NRSEGZ_INDEX 179 #define INTEHEAD_NILBRZ_INDEX 180 - #define DOUBHEAD_DAYS_INDEX 0 /*****************************************************************/ @@ -230,7 +231,11 @@ extern "C" { #define CONGRAT_KW "CONGRAT" /* Gas ... */ #define CONORAT_KW "CONORAT" /* Oil ... */ #define CONPRES_KW "CONPRES" /* Pressure ... */ - +#define CONLENST_KW "CONLENST" /* Length along MSW well */ +#define CONVTUB_KW "CONVTUB" /* Volumetric flow at tubing head conditions. */ +#define CONOTUB_KW "CONOTUB" /* Volumetric oil flow at tubing head conditions. */ +#define CONGTUB_KW "CONGTUB" /* Volumetric gas flow at tubing head conditions. */ +#define CONWTUB_KW "CONWTUB" /* Volumetric water flow at tubing head conditions. */ #define WELLETC_TYPE_INDEX 5 /* At this keyword the WELLETC keyword contains a string diff --git a/ThirdParty/Ert/devel/libecl/include/ert/ecl/ecl_rft_cell.h b/ThirdParty/Ert/devel/libecl/include/ert/ecl/ecl_rft_cell.h new file mode 100644 index 0000000000..4d8ad0754b --- /dev/null +++ b/ThirdParty/Ert/devel/libecl/include/ert/ecl/ecl_rft_cell.h @@ -0,0 +1,83 @@ +/* + Copyright (C) 2011 Statoil ASA, Norway. + + The file 'ecl_rft_cell.h' 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 + for more details. +*/ + +#ifndef __ECL_RFT_CELL_H__ +#define __ECL_RFT_CELL_H__ +#ifdef __cplusplus +extern "C" { +#endif + +#include + +#define ECL_RFT_CELL_INVALID_VALUE -1 + +typedef struct ecl_rft_cell_struct ecl_rft_cell_type; + + + + +UTIL_IS_INSTANCE_HEADER( ecl_rft_cell ); + + ecl_rft_cell_type * ecl_rft_cell_alloc_PLT( int i , + int j , + int k , + double depth , + double pressure , + double orat , + double grat , + double wrat , + double connection_start, + double flowrate, + double oil_flowrate, + double gas_flowrate, + double water_flowrate); + + ecl_rft_cell_type * ecl_rft_cell_alloc_RFT( int i , int j , int k , double depth , double pressure , double swat , double sgas); + void ecl_rft_cell_free( ecl_rft_cell_type * cell ); + void ecl_rft_cell_free__( void * arg); + + bool ecl_rft_cell_ijk_equal( const ecl_rft_cell_type * cell , int i , int j , int k); + void ecl_rft_cell_get_ijk( const ecl_rft_cell_type * cell , int * i , int * j , int * k); + int ecl_rft_cell_get_i( const ecl_rft_cell_type * cell ); + int ecl_rft_cell_get_j( const ecl_rft_cell_type * cell ); + int ecl_rft_cell_get_k( const ecl_rft_cell_type * cell ); + double ecl_rft_cell_get_depth( const ecl_rft_cell_type * cell ); + double ecl_rft_cell_get_pressure( const ecl_rft_cell_type * cell ); + + double ecl_rft_cell_get_swat( const ecl_rft_cell_type * cell ); + double ecl_rft_cell_get_sgas( const ecl_rft_cell_type * cell ); + double ecl_rft_cell_get_soil( const ecl_rft_cell_type * cell ); + + double ecl_rft_cell_get_wrat( const ecl_rft_cell_type * cell ); + double ecl_rft_cell_get_grat( const ecl_rft_cell_type * cell ); + double ecl_rft_cell_get_orat( const ecl_rft_cell_type * cell ); + double ecl_rft_cell_get_connection_start( const ecl_rft_cell_type * cell ); + double ecl_rft_cell_get_flowrate( const ecl_rft_cell_type * cell ); + double ecl_rft_cell_get_oil_flowrate( const ecl_rft_cell_type * cell ); + double ecl_rft_cell_get_gas_flowrate( const ecl_rft_cell_type * cell ); + double ecl_rft_cell_get_water_flowrate( const ecl_rft_cell_type * cell ); + + int ecl_rft_cell_cmp__( const void * arg1 , const void * arg2); + int ecl_rft_cell_cmp( const ecl_rft_cell_type * cell1 , const ecl_rft_cell_type * cell2); + +#ifdef __cplusplus +} +#endif + +#endif + diff --git a/ThirdParty/Ert/devel/libecl/include/ert/ecl/ecl_rft_file.h b/ThirdParty/Ert/devel/libecl/include/ert/ecl/ecl_rft_file.h index d6ff6ded25..1118fdd011 100644 --- a/ThirdParty/Ert/devel/libecl/include/ert/ecl/ecl_rft_file.h +++ b/ThirdParty/Ert/devel/libecl/include/ert/ecl/ecl_rft_file.h @@ -39,15 +39,13 @@ void ecl_rft_file_free(ecl_rft_file_type * ); void ecl_rft_file_block(const ecl_rft_file_type * , double , const char * , int , const double * , int * , int * , int *); void ecl_rft_file_fprintf_rft_obs(const ecl_rft_file_type * , double , const char * , const char *, const char * , double); ecl_rft_node_type * ecl_rft_file_get_node(const ecl_rft_file_type * , const char * ); -void ecl_rft_file_summarize(const ecl_rft_file_type * , bool ); -void ecl_rft_file_xml_summary( const ecl_rft_file_type * rft_file ); -const ecl_rft_node_type * ecl_rft_file_get_well_time_rft( const ecl_rft_file_type * rft_file , const char * well , time_t recording_time); int ecl_rft_file_get_size__( const ecl_rft_file_type * rft_file, const char * well_pattern , time_t recording_time); int ecl_rft_file_get_size( const ecl_rft_file_type * rft_file); -const ecl_rft_node_type * ecl_rft_file_iget_node( const ecl_rft_file_type * rft_file , int index); -const ecl_rft_node_type * ecl_rft_file_iget_well_rft( const ecl_rft_file_type * rft_file , const char * well, int index); +ecl_rft_node_type * ecl_rft_file_get_well_time_rft( const ecl_rft_file_type * rft_file , const char * well , time_t recording_time); +ecl_rft_node_type * ecl_rft_file_iget_node( const ecl_rft_file_type * rft_file , int index); +ecl_rft_node_type * ecl_rft_file_iget_well_rft( const ecl_rft_file_type * rft_file , const char * well, int index); bool ecl_rft_file_has_well( const ecl_rft_file_type * rft_file , const char * well); int ecl_rft_file_get_well_occurences( const ecl_rft_file_type * rft_file , const char * well); stringlist_type * ecl_rft_file_alloc_well_list(const ecl_rft_file_type * rft_file ); diff --git a/ThirdParty/Ert/devel/libecl/include/ert/ecl/ecl_rft_node.h b/ThirdParty/Ert/devel/libecl/include/ert/ecl/ecl_rft_node.h index f6fd0d7b7c..1a4f9fed27 100644 --- a/ThirdParty/Ert/devel/libecl/include/ert/ecl/ecl_rft_node.h +++ b/ThirdParty/Ert/devel/libecl/include/ert/ecl/ecl_rft_node.h @@ -24,6 +24,7 @@ extern "C" { #include #include +#include typedef enum { RFT = 1 , PLT = 2 , @@ -31,28 +32,34 @@ typedef enum { RFT = 1 , typedef struct ecl_rft_node_struct ecl_rft_node_type; -int ecl_rft_node_lookup_ijk( const ecl_rft_node_type * rft_node , int i, int j , int k); +void ecl_rft_node_inplace_sort_cells( ecl_rft_node_type * rft_node ); +const ecl_rft_cell_type * ecl_rft_node_iget_cell_sorted( ecl_rft_node_type * rft_node , int index); +const ecl_rft_cell_type * ecl_rft_node_iget_cell( const ecl_rft_node_type * rft_node , int index); +const ecl_rft_cell_type * ecl_rft_node_lookup_ijk( const ecl_rft_node_type * rft_node , int i, int j , int k); void ecl_rft_node_fprintf_rft_obs(const ecl_rft_node_type * , double , const char * , const char * , double ); ecl_rft_node_type * ecl_rft_node_alloc(const ecl_file_type * file_map ); const char * ecl_rft_node_get_well_name(const ecl_rft_node_type * ); void ecl_rft_node_free(ecl_rft_node_type * ); void ecl_rft_node_free__(void * ); -void ecl_rft_node_block2(const ecl_rft_node_type * , int , const double * , const double * , int * , int * , int *); -void ecl_rft_node_block(const ecl_rft_node_type * , double , int , const double * , int * , int * , int *); time_t ecl_rft_node_get_date(const ecl_rft_node_type * ); int ecl_rft_node_get_size(const ecl_rft_node_type * ); -void ecl_rft_node_summarize(const ecl_rft_node_type * , bool ); const char * ecl_rft_node_get_well_name( const ecl_rft_node_type * rft_node ); void ecl_rft_node_iget_ijk( const ecl_rft_node_type * rft_node , int index , int *i , int *j , int *k); -void ecl_rft_node_export_DEPTH(const ecl_rft_node_type * , const char * ); +bool ecl_rft_node_is_RFT( const ecl_rft_node_type * rft_node ); +bool ecl_rft_node_is_PLT( const ecl_rft_node_type * rft_node ); +bool ecl_rft_node_is_SEGMENT( const ecl_rft_node_type * rft_node ); +bool ecl_rft_node_is_MSW( const ecl_rft_node_type * rft_node ); + double ecl_rft_node_iget_pressure( const ecl_rft_node_type * rft_node , int index); double ecl_rft_node_iget_depth( const ecl_rft_node_type * rft_node , int index); double ecl_rft_node_iget_wrat( const ecl_rft_node_type * rft_node , int index); double ecl_rft_node_iget_grat( const ecl_rft_node_type * rft_node , int index); double ecl_rft_node_iget_orat( const ecl_rft_node_type * rft_node , int index); + double ecl_rft_node_iget_swat( const ecl_rft_node_type * rft_node , int index); double ecl_rft_node_iget_sgas( const ecl_rft_node_type * rft_node , int index); +double ecl_rft_node_iget_soil( const ecl_rft_node_type * rft_node , int index); #ifdef __cplusplus } diff --git a/ThirdParty/Ert/devel/libecl/include/ert/ecl/ecl_rsthead.h b/ThirdParty/Ert/devel/libecl/include/ert/ecl/ecl_rsthead.h index a128e2adf1..4068ed4528 100644 --- a/ThirdParty/Ert/devel/libecl/include/ert/ecl/ecl_rsthead.h +++ b/ThirdParty/Ert/devel/libecl/include/ert/ecl/ecl_rsthead.h @@ -63,6 +63,7 @@ extern "C" { int nswlmx; // The maximum number of segmented wells int nlbrmx; // The maximum number of lateral branches pr well int nilbrz; // The number of entries pr segment in ILBR array + int nrsegz; // The number of entries pr segment in RSEG array // Properteies from the LOGIHEAD keyword: bool dualp; diff --git a/ThirdParty/Ert/devel/libecl/include/ert/ecl/ecl_sum.h b/ThirdParty/Ert/devel/libecl/include/ert/ecl/ecl_sum.h index c62fc61f42..e31572f7ca 100644 --- a/ThirdParty/Ert/devel/libecl/include/ert/ecl/ecl_sum.h +++ b/ThirdParty/Ert/devel/libecl/include/ert/ecl/ecl_sum.h @@ -200,6 +200,7 @@ typedef struct ecl_sum_struct ecl_sum_type; ecl_sum_tstep_type * ecl_sum_add_tstep( ecl_sum_type * ecl_sum , int report_step , double sim_days); void ecl_sum_update_wgname( ecl_sum_type * ecl_sum , smspec_node_type * node , const char * wgname ); + bool ecl_sum_is_oil_producer( const ecl_sum_type * ecl_sum , const char * well); char * ecl_sum_alloc_well_key( const ecl_sum_type * ecl_sum , const char * keyword , const char * wgname); UTIL_IS_INSTANCE_HEADER( ecl_sum ); diff --git a/ThirdParty/Ert/devel/libecl/src/CMakeLists.txt b/ThirdParty/Ert/devel/libecl/src/CMakeLists.txt index 1ddeaf0066..92a66c89ac 100644 --- a/ThirdParty/Ert/devel/libecl/src/CMakeLists.txt +++ b/ThirdParty/Ert/devel/libecl/src/CMakeLists.txt @@ -2,9 +2,9 @@ include_directories( ext ) file(GLOB ext_source "ext/*.c" ) file(GLOB ext_header "ext/*.h" ) -set( source_files ecl_rsthead.c ecl_sum_tstep.c ecl_rst_file.c ecl_init_file.c ecl_grid_cache.c smspec_node.c ecl_kw_grdecl.c ecl_file_kw.c ecl_grav.c ecl_grav_calc.c ecl_smspec.c ecl_sum_data.c ecl_util.c ecl_kw.c ecl_sum.c fortio.c ecl_rft_file.c ecl_rft_node.c ecl_grid.c ecl_coarse_cell.c ecl_box.c ecl_io_config.c ecl_file.c ecl_region.c point.c tetrahedron.c ecl_subsidence.c ecl_grid_dims.c grid_dims.c ecl_grav_common.c ${ext_source}) +set( source_files ecl_rsthead.c ecl_sum_tstep.c ecl_rst_file.c ecl_init_file.c ecl_grid_cache.c smspec_node.c ecl_kw_grdecl.c ecl_file_kw.c ecl_grav.c ecl_grav_calc.c ecl_smspec.c ecl_sum_data.c ecl_util.c ecl_kw.c ecl_sum.c fortio.c ecl_rft_file.c ecl_rft_node.c ecl_rft_cell.c ecl_grid.c ecl_coarse_cell.c ecl_box.c ecl_io_config.c ecl_file.c ecl_region.c point.c tetrahedron.c ecl_subsidence.c ecl_grid_dims.c grid_dims.c ecl_grav_common.c ${ext_source}) -set( header_files ecl_rsthead.h ecl_sum_tstep.h ecl_rst_file.h ecl_init_file.h smspec_node.h ecl_grid_cache.h ecl_kw_grdecl.h ecl_file_kw.h ecl_grav.h ecl_grav_calc.h ecl_endian_flip.h ecl_smspec.h ecl_sum_data.h ecl_util.h ecl_kw.h ecl_sum.h fortio.h ecl_rft_file.h ecl_rft_node.h ecl_box.h ecl_coarse_cell.h ecl_grid.h ecl_io_config.h ecl_file.h ecl_region.h ecl_kw_magic.h ecl_subsidence.h ecl_grid_dims.h grid_dims.h ${ext_header} ecl_grav_common.h) +set( header_files ecl_rsthead.h ecl_sum_tstep.h ecl_rst_file.h ecl_init_file.h smspec_node.h ecl_grid_cache.h ecl_kw_grdecl.h ecl_file_kw.h ecl_grav.h ecl_grav_calc.h ecl_endian_flip.h ecl_smspec.h ecl_sum_data.h ecl_util.h ecl_kw.h ecl_sum.h fortio.h ecl_rft_file.h ecl_rft_node.h ecl_rft_cell.h ecl_box.h ecl_coarse_cell.h ecl_grid.h ecl_io_config.h ecl_file.h ecl_region.h ecl_kw_magic.h ecl_subsidence.h ecl_grid_dims.h grid_dims.h ${ext_header} ecl_grav_common.h) diff --git a/ThirdParty/Ert/devel/libecl/src/ecl_grid.c b/ThirdParty/Ert/devel/libecl/src/ecl_grid.c index f8bc1846d4..cde1086863 100644 --- a/ThirdParty/Ert/devel/libecl/src/ecl_grid.c +++ b/ThirdParty/Ert/devel/libecl/src/ecl_grid.c @@ -513,12 +513,12 @@ struct ecl_grid_struct { int parent_box[6]; /* integers i1,i2, j1,j2, k1,k2 of the parent grid region containing this lgr. the indices are inclusive - zero offset */ /* not used yet .. */ - int dualp_flag; - bool use_mapaxes; - double unit_x[2]; - double unit_y[2]; - double origo[2]; - float mapaxes[6]; + int dualp_flag; + bool use_mapaxes; + double unit_x[2]; + double unit_y[2]; + double origo[2]; + float mapaxes[6]; /*------------------------------: the fields below this line are used for blocking algorithms - and not allocated by default.*/ int block_dim; /* == 2 for maps and 3 for fields. 0 when not in use. */ int block_size; @@ -1089,6 +1089,7 @@ static void ecl_cell_init_regular( ecl_cell_type * cell , const double * offset /* starting on the ecl_grid proper implementation */ UTIL_SAFE_CAST_FUNCTION(ecl_grid , ECL_GRID_ID); +UTIL_IS_INSTANCE_FUNCTION( ecl_grid , ECL_GRID_ID); /** this function allocates the internal index_map and inv_index_map fields. @@ -2601,7 +2602,10 @@ ecl_grid_type * ecl_grid_load_case( const char * case_input ) { ecl_grid_type * ecl_grid = NULL; char * grid_file = ecl_grid_alloc_case_filename( case_input ); if (grid_file != NULL) { - ecl_grid = ecl_grid_alloc( grid_file ); + + if (util_file_exists( grid_file )) + ecl_grid = ecl_grid_alloc( grid_file ); + free( grid_file ); } return ecl_grid; @@ -3541,6 +3545,15 @@ stringlist_type * ecl_grid_alloc_lgr_name_list(const ecl_grid_type * ecl_grid) { } } +const char * ecl_grid_iget_lgr_name( const ecl_grid_type * ecl_grid , int lgr_nr) { + __assert_main_grid( ecl_grid ); + if (lgr_nr < (vector_get_size( ecl_grid->LGR_list ) - 1)) { + const ecl_grid_type * lgr = vector_iget( ecl_grid->LGR_list , lgr_nr + 1); + return lgr->name; + } else + return NULL; +} + /*****************************************************************/ diff --git a/ThirdParty/Ert/devel/libecl/src/ecl_region.c b/ThirdParty/Ert/devel/libecl/src/ecl_region.c index 2c872abaf1..cab67acd54 100644 --- a/ThirdParty/Ert/devel/libecl/src/ecl_region.c +++ b/ThirdParty/Ert/devel/libecl/src/ecl_region.c @@ -689,8 +689,9 @@ void ecl_region_deselect_i1i2( ecl_region_type * region , int i1 , int i2) { static void ecl_region_select_j1j2__( ecl_region_type * region , int j1 , int j2 , bool select) { if (j1 > j2) util_abort("%s: i1 > i2 - this is illogical ... \n",__func__); + j1 = util_int_max(0 , j1); - j2 = util_int_min(region->grid_nx - 1 , j2); + j2 = util_int_min(region->grid_ny - 1 , j2); { int i,j,k; for (k = 0; k < region->grid_nz; k++) @@ -729,7 +730,7 @@ static void ecl_region_select_k1k2__( ecl_region_type * region , int k1 , int k2 if (k1 > k2) util_abort("%s: i1 > i2 - this is illogical ... \n",__func__); k1 = util_int_max(0 , k1); - k2 = util_int_min(region->grid_nx - 1 , k2); + k2 = util_int_min(region->grid_nz - 1 , k2); { int i,j,k; for (k = k1; k <= k2; k++) diff --git a/ThirdParty/Ert/devel/libecl/src/ecl_rft_cell.c b/ThirdParty/Ert/devel/libecl/src/ecl_rft_cell.c new file mode 100644 index 0000000000..eab980b2f6 --- /dev/null +++ b/ThirdParty/Ert/devel/libecl/src/ecl_rft_cell.c @@ -0,0 +1,357 @@ +/* + Copyright (C) 2011 Statoil ASA, Norway. + + The file 'ecl_rft_cell.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 + for more details. +*/ + +#include +#include +#include +#include +#include +#include + +#include +#include + +#include +#include +#include +#include + + +#define ECL_RFT_CELL_TYPE_ID 99164012 +#define RFT_DATA_TYPE_ID 66787166 +#define PLT_DATA_TYPE_ID 87166667 + + +struct ecl_rft_cell_struct { + UTIL_TYPE_ID_DECLARATION; + int i,j,k; + double pressure; + double depth; + + void * data; +}; + + +typedef struct plt_data_struct plt_data_type; +typedef struct rft_data_struct rft_data_type; + + +struct rft_data_struct { + UTIL_TYPE_ID_DECLARATION; + double swat; + double sgas; +}; + + + + +struct plt_data_struct { + UTIL_TYPE_ID_DECLARATION; + double orat; + double wrat; + double grat; + double connection_start; + double flowrate; + double oil_flowrate; + double gas_flowrate; + double water_flowrate; +}; + + +/*****************************************************************/ + +static rft_data_type * rft_data_alloc( double swat , double sgas) { + rft_data_type * data = util_malloc( sizeof * data ); + UTIL_TYPE_ID_INIT( data , RFT_DATA_TYPE_ID ); + + data->swat = swat; + data->sgas = sgas; + + return data; +} + + +static void rft_data_free( rft_data_type * data ) { + free( data ); +} + +static UTIL_TRY_CAST_FUNCTION_CONST( rft_data , RFT_DATA_TYPE_ID) +static UTIL_IS_INSTANCE_FUNCTION( rft_data , RFT_DATA_TYPE_ID) + +/*****************************************************************/ + + static plt_data_type * plt_data_alloc( double orat , double grat , double wrat,double connection_start, double flowrate , double oil_flowrate , double gas_flowrate , double water_flowrate) { + plt_data_type * data = util_malloc( sizeof * data ); + UTIL_TYPE_ID_INIT( data , PLT_DATA_TYPE_ID ); + + data->orat = orat; + data->grat = grat; + data->wrat = wrat; + data->connection_start = connection_start; + data->flowrate = flowrate; + data->oil_flowrate = oil_flowrate; + data->gas_flowrate = gas_flowrate; + data->water_flowrate = water_flowrate; + + return data; +} + + +static void plt_data_free( plt_data_type * data ) { + free( data ); +} + +static UTIL_TRY_CAST_FUNCTION_CONST( plt_data , PLT_DATA_TYPE_ID) +static UTIL_IS_INSTANCE_FUNCTION( plt_data , PLT_DATA_TYPE_ID) + + + +/*****************************************************************/ + +static UTIL_SAFE_CAST_FUNCTION( ecl_rft_cell , ECL_RFT_CELL_TYPE_ID) +static UTIL_SAFE_CAST_FUNCTION_CONST( ecl_rft_cell , ECL_RFT_CELL_TYPE_ID) +UTIL_IS_INSTANCE_FUNCTION( ecl_rft_cell , ECL_RFT_CELL_TYPE_ID) + + + +static ecl_rft_cell_type * ecl_rft_cell_alloc_common(int i , int j , int k , double depth , double pressure) { + ecl_rft_cell_type * cell = util_malloc( sizeof * cell ); + UTIL_TYPE_ID_INIT( cell , ECL_RFT_CELL_TYPE_ID ); + + cell->i = i; + cell->j = j; + cell->k = k; + cell->depth = depth; + cell->pressure = pressure; + + return cell; +} + + + +ecl_rft_cell_type * ecl_rft_cell_alloc_RFT( int i , int j , int k , double depth , double pressure , double swat , double sgas) { + ecl_rft_cell_type * cell = ecl_rft_cell_alloc_common( i , j , k , depth , pressure ); + + cell->data = rft_data_alloc( swat , sgas ); + return cell; +} + + +ecl_rft_cell_type * ecl_rft_cell_alloc_PLT( int i , + int j , + int k , + double depth , + double pressure , + double orat , + double grat , + double wrat, + double connection_start, + double flowrate , + double oil_flowrate , + double gas_flowrate , + double water_flowrate) { + + ecl_rft_cell_type * cell = ecl_rft_cell_alloc_common( i , j , k , depth , pressure ); + + cell->data = plt_data_alloc( orat , grat , wrat , connection_start , flowrate , oil_flowrate , gas_flowrate , water_flowrate); + return cell; +} + + + +void ecl_rft_cell_free( ecl_rft_cell_type * cell ) { + if (rft_data_is_instance( cell->data )) + rft_data_free( cell->data ); + else if (plt_data_is_instance( cell->data )) + plt_data_free( cell->data ); + + free( cell ); +} + +void ecl_rft_cell_free__( void * arg) { + ecl_rft_cell_type * cell = ecl_rft_cell_safe_cast( arg ); + ecl_rft_cell_free( cell ); +} + + +/*****************************************************************/ + +int ecl_rft_cell_get_i( const ecl_rft_cell_type * cell ) { + return cell->i; +} + +int ecl_rft_cell_get_j( const ecl_rft_cell_type * cell ) { + return cell->j; +} + +int ecl_rft_cell_get_k( const ecl_rft_cell_type * cell ) { + return cell->k; +} + +void ecl_rft_cell_get_ijk( const ecl_rft_cell_type * cell , int * i , int * j , int * k) { + *i = cell->i; + *j = cell->j; + *k = cell->k; +} + +double ecl_rft_cell_get_depth( const ecl_rft_cell_type * cell ) { + return cell->depth; +} + +double ecl_rft_cell_get_pressure( const ecl_rft_cell_type * cell ) { + return cell->pressure; +} + + +/*****************************************************************/ + +double ecl_rft_cell_get_swat( const ecl_rft_cell_type * cell ) { + const rft_data_type * data = rft_data_try_cast_const( cell->data ); + if (data) + return data->swat; + else + return ECL_RFT_CELL_INVALID_VALUE; +} + + +double ecl_rft_cell_get_sgas( const ecl_rft_cell_type * cell ) { + const rft_data_type * data = rft_data_try_cast_const( cell->data ); + if (data) + return data->sgas; + else + return ECL_RFT_CELL_INVALID_VALUE; +} + + +double ecl_rft_cell_get_soil( const ecl_rft_cell_type * cell ) { + const rft_data_type * data = rft_data_try_cast_const( cell->data ); + if (data) + return 1 - (data->swat + data->sgas); + else + return ECL_RFT_CELL_INVALID_VALUE; +} + +/*****************************************************************/ + +double ecl_rft_cell_get_orat( const ecl_rft_cell_type * cell ) { + const plt_data_type * data = plt_data_try_cast_const( cell->data ); + if (data) + return data->orat; + else + return ECL_RFT_CELL_INVALID_VALUE; +} + + +double ecl_rft_cell_get_grat( const ecl_rft_cell_type * cell ) { + const plt_data_type * data = plt_data_try_cast_const( cell->data ); + if (data) + return data->grat; + else + return ECL_RFT_CELL_INVALID_VALUE; +} + + +double ecl_rft_cell_get_wrat( const ecl_rft_cell_type * cell ) { + const plt_data_type * data = plt_data_try_cast_const( cell->data ); + if (data) + return data->wrat; + else + return ECL_RFT_CELL_INVALID_VALUE; +} + +double ecl_rft_cell_get_connection_start( const ecl_rft_cell_type * cell ) { + const plt_data_type * data = plt_data_try_cast_const( cell->data ); + if (data) + return data->connection_start; + else + return ECL_RFT_CELL_INVALID_VALUE; +} + + +double ecl_rft_cell_get_flowrate( const ecl_rft_cell_type * cell ) { + const plt_data_type * data = plt_data_try_cast_const( cell->data ); + if (data) + return data->flowrate; + else + return ECL_RFT_CELL_INVALID_VALUE; +} + + +double ecl_rft_cell_get_oil_flowrate( const ecl_rft_cell_type * cell ) { + const plt_data_type * data = plt_data_try_cast_const( cell->data ); + if (data) + return data->oil_flowrate; + else + return ECL_RFT_CELL_INVALID_VALUE; +} + + +double ecl_rft_cell_get_gas_flowrate( const ecl_rft_cell_type * cell ) { + const plt_data_type * data = plt_data_try_cast_const( cell->data ); + if (data) + return data->gas_flowrate; + else + return ECL_RFT_CELL_INVALID_VALUE; +} + + +double ecl_rft_cell_get_water_flowrate( const ecl_rft_cell_type * cell ) { + const plt_data_type * data = plt_data_try_cast_const( cell->data ); + if (data) + return data->water_flowrate; + else + return ECL_RFT_CELL_INVALID_VALUE; +} + + + + + +/*****************************************************************/ + + + +bool ecl_rft_cell_ijk_equal( const ecl_rft_cell_type * cell , int i , int j , int k) { + return ( (i == cell->i) && + (j == cell->j) && + (k == cell->k) ); +} + + +/* + Currently only comparison based on connection length along PLT is supported. +*/ +int ecl_rft_cell_cmp( const ecl_rft_cell_type * cell1 , const ecl_rft_cell_type * cell2) { + double val1 = ecl_rft_cell_get_connection_start( cell1 ); + double val2 = ecl_rft_cell_get_connection_start( cell2 ); + + if (val1 < val2) + return -1; + else if (val1 == val2) + return 0; + else + return 0; + +} + + +int ecl_rft_cell_cmp__( const void * arg1 , const void * arg2) { + const ecl_rft_cell_type * cell1 = ecl_rft_cell_safe_cast_const( arg1 ); + const ecl_rft_cell_type * cell2 = ecl_rft_cell_safe_cast_const( arg2 ); + return ecl_rft_cell_cmp( cell1 , cell2 ); +} diff --git a/ThirdParty/Ert/devel/libecl/src/ecl_rft_file.c b/ThirdParty/Ert/devel/libecl/src/ecl_rft_file.c index f65f0e6937..f06f9d00c2 100644 --- a/ThirdParty/Ert/devel/libecl/src/ecl_rft_file.c +++ b/ThirdParty/Ert/devel/libecl/src/ecl_rft_file.c @@ -226,8 +226,8 @@ int ecl_rft_file_get_size__( const ecl_rft_file_type * rft_file, const char * we 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 != NULL) { - if (!util_fnmatch( well_pattern , ecl_rft_node_get_well_name( rft ))) + if (well_pattern) { + if (util_fnmatch( well_pattern , ecl_rft_node_get_well_name( rft )) != 0) continue; } @@ -269,8 +269,8 @@ const char * ecl_rft_file_get_filename( const ecl_rft_file_type * rft_file ) { handle that. */ -const ecl_rft_node_type * ecl_rft_file_iget_node( const ecl_rft_file_type * rft_file , int index) { - return vector_iget_const( rft_file->data , index ); +ecl_rft_node_type * ecl_rft_file_iget_node( const ecl_rft_file_type * rft_file , int index) { + return vector_iget( rft_file->data , index ); } @@ -301,7 +301,7 @@ const ecl_rft_node_type * ecl_rft_file_iget_node( const ecl_rft_file_type * rft_ -const ecl_rft_node_type * ecl_rft_file_iget_well_rft( const ecl_rft_file_type * rft_file , const char * well, int index) { +ecl_rft_node_type * ecl_rft_file_iget_well_rft( const ecl_rft_file_type * rft_file , const char * well, int index) { const int_vector_type * index_vector = hash_get(rft_file->well_index , well); return ecl_rft_file_iget_node( rft_file , int_vector_iget(index_vector , index)); } @@ -315,8 +315,8 @@ const ecl_rft_node_type * ecl_rft_file_iget_well_rft( const ecl_rft_file_type * */ -const ecl_rft_node_type * ecl_rft_file_get_well_time_rft( const ecl_rft_file_type * rft_file , const char * well , time_t recording_time) { - const ecl_rft_node_type * node = NULL; +ecl_rft_node_type * ecl_rft_file_get_well_time_rft( const ecl_rft_file_type * rft_file , const char * well , time_t recording_time) { + ecl_rft_node_type * node = NULL; if (hash_has_key( rft_file->well_index , well)) { const int_vector_type * index_vector = hash_get(rft_file->well_index , well); int index = 0; @@ -367,56 +367,6 @@ stringlist_type * ecl_rft_file_alloc_well_list(const ecl_rft_file_type * rft_fil } -/*****************************************************************/ -void ecl_rft_file_summarize(const ecl_rft_file_type * rft_vector , bool show_completions) { - int iw; - for (iw = 0; iw < vector_get_size( rft_vector->data ); iw++) { - ecl_rft_node_summarize(vector_iget( rft_vector->data , iw) , show_completions); - printf("\n"); - } -} - -void ecl_rft_file_xml_summary( const ecl_rft_file_type * rft_file ) { - stringlist_type * wells = ecl_rft_file_alloc_well_list( rft_file ); - printf("\n"); - { - int iw; - for (iw = 0; iw < stringlist_get_size( wells ); iw++) { - const char * well = stringlist_iget(wells , iw); - printf(" \n"); - { - int it; - for (it = 0; it < ecl_rft_file_get_well_occurences( rft_file , well ); it++) { - const ecl_rft_node_type * node = ecl_rft_file_iget_well_rft( rft_file , well , it); - time_t date = ecl_rft_node_get_date( node ); - { - int mday, year,month; - util_set_date_values( date , &mday , &month , &year); - printf(" \n"); - printf(" %02d/%02d/%4d \n",mday,month,year); - { - int num_cells = ecl_rft_node_get_size( node ); - int icell; - for (icell = 0; icell < num_cells; icell++) { - int i,j,k; - ecl_rft_node_iget_ijk( node , icell , &i , &j , &k); - printf(" \n"); - printf(" %g \n", ecl_rft_node_iget_pressure( node, icell)); - printf(" %g \n" , ecl_rft_node_iget_depth( node , icell)); - printf(" %3d,%3d,%3d \n",i,j,k); - printf(" \n"); - } - } - printf(" \n"); - } - } - } - printf(" \n"); - } - } - printf("\n"); - stringlist_free( wells ); -} diff --git a/ThirdParty/Ert/devel/libecl/src/ecl_rft_node.c b/ThirdParty/Ert/devel/libecl/src/ecl_rft_node.c index 6c37f90306..07f60948b3 100644 --- a/ThirdParty/Ert/devel/libecl/src/ecl_rft_node.c +++ b/ThirdParty/Ert/devel/libecl/src/ecl_rft_node.c @@ -25,12 +25,14 @@ #include #include +#include +#include #include #include #include #include - +#include /** The RFT's from several wells, and possibly also several timesteps @@ -48,80 +50,20 @@ */ -/** - Here comes some small structs containing various pieces of - information. Observe the following which is common to all these - structs: - - * In the implementation only 'full instance' are employed, and - not pointers. This implies that the code does not provide - xxx_alloc() and xx_free() functions. - - * They should NOT be exported out of this file. -*/ - - -/** - This type is used to hold the coordinates of a perforated - cell. This type is used irrespective of whether this is a simple - RFT or a PLT. -*/ - -typedef struct { - int i; - int j; - int k; - double depth; - double pressure; /* both CONPRES from PLT and PRESSURE from RFT are internalized as pressure in the cell_type. */ -} cell_type; - -/*-----------------------------------------------------------------*/ -/** - Type which contains the information for one cell in an RFT. -*/ -typedef struct { - double swat; - double sgas; -} rft_data_type; - - -/*-----------------------------------------------------------------*/ -/** - Type which contains the information for one cell in an PLT. -*/ -typedef struct { - double orat; - double grat; - double wrat; - /* There is quite a lot of more information in the PLT - not yet internalized. */ -} plt_data_type; - - - - -/* This is not implemented at all ..... */ -typedef struct { - double data; -} segment_data_type; - #define ECL_RFT_NODE_ID 887195 struct ecl_rft_node_struct { UTIL_TYPE_ID_DECLARATION; char * well_name; /* Name of the well. */ - int size; /* The number of entries in this RFT vector (i.e. the number of cells) .*/ ecl_rft_enum data_type; /* What type of data: RFT|PLT|SEGMENT */ time_t recording_date; /* When was the RFT recorded - date.*/ double days; /* When was the RFT recorded - days after simulaton start. */ - cell_type *cells; /* Coordinates and depth of the well cells. */ - - /* Only one of segment_data, rft_data or plt_data can be != NULL */ - segment_data_type * segment_data; - rft_data_type * rft_data; - plt_data_type * plt_data; - - bool __vertical_well; /* Internal variable - when this is true we can try to block - otherwise it is NO FUXXXX WAY. */ + bool MSW; + + bool sort_perm_in_sync ; + int_vector_type * sort_perm; + vector_type *cells; }; @@ -131,7 +73,7 @@ struct ecl_rft_node_struct { that is not (yet) supported. */ -static ecl_rft_node_type * ecl_rft_node_alloc_empty(int size , const char * data_type_string) { +static ecl_rft_node_type * ecl_rft_node_alloc_empty(const char * data_type_string) { ecl_rft_enum data_type = SEGMENT; /* According to the ECLIPSE documentaton. */ @@ -140,7 +82,7 @@ static ecl_rft_node_type * ecl_rft_node_alloc_empty(int size , const char * data else if (strchr(data_type_string, 'R') != NULL) data_type = RFT; else if (strchr(data_type_string , 'S') != NULL) - data_type = SEGMENT; + data_type = SEGMENT; else util_abort("%s: Could not determine type of RFT/PLT/SEGMENT data - aborting\n",__func__); @@ -153,24 +95,13 @@ static ecl_rft_node_type * ecl_rft_node_alloc_empty(int size , const char * data { ecl_rft_node_type * rft_node = util_malloc(sizeof * rft_node ); - rft_node->plt_data = NULL; - rft_node->rft_data = NULL; - rft_node->segment_data = NULL; - UTIL_TYPE_ID_INIT( rft_node , ECL_RFT_NODE_ID ); - rft_node->cells = util_calloc( size , sizeof * rft_node->cells ); - if (data_type == RFT) - rft_node->rft_data = util_calloc( size , sizeof * rft_node->rft_data ); - else if (data_type == PLT) - rft_node->plt_data = util_calloc( size , sizeof * rft_node->plt_data); - else if (data_type == SEGMENT) - rft_node->segment_data = util_calloc( size , sizeof * rft_node->segment_data ); - - rft_node->__vertical_well = false; - rft_node->size = size; + rft_node->cells = vector_alloc_new(); rft_node->data_type = data_type; - + rft_node->sort_perm = NULL; + rft_node->sort_perm_in_sync = false; + return rft_node; } } @@ -180,112 +111,137 @@ UTIL_SAFE_CAST_FUNCTION( ecl_rft_node , ECL_RFT_NODE_ID ); UTIL_IS_INSTANCE_FUNCTION( ecl_rft_node , ECL_RFT_NODE_ID ); +static void ecl_rft_node_append_cell( ecl_rft_node_type * rft_node , ecl_rft_cell_type * cell) { + vector_append_owned_ref( rft_node->cells , cell , ecl_rft_cell_free__ ); + rft_node->sort_perm_in_sync = false; +} + + + +static void ecl_rft_node_init_RFT_cells( ecl_rft_node_type * rft_node , const ecl_file_type * rft) { + const ecl_kw_type * conipos = ecl_file_iget_named_kw( rft , CONIPOS_KW , 0); + const ecl_kw_type * conjpos = ecl_file_iget_named_kw( rft , CONJPOS_KW , 0); + const ecl_kw_type * conkpos = ecl_file_iget_named_kw( rft , CONKPOS_KW , 0); + const ecl_kw_type * depth_kw = ecl_file_iget_named_kw( rft , DEPTH_KW , 0); + const ecl_kw_type * swat_kw = ecl_file_iget_named_kw( rft , SWAT_KW , 0); + const ecl_kw_type * sgas_kw = ecl_file_iget_named_kw( rft , SGAS_KW , 0); + const ecl_kw_type * pressure_kw = ecl_file_iget_named_kw( rft , PRESSURE_KW , 0); + + const float * SW = ecl_kw_get_float_ptr( swat_kw ); + const float * SG = ecl_kw_get_float_ptr( sgas_kw ); + const float * P = ecl_kw_get_float_ptr( pressure_kw ); + const float * depth = ecl_kw_get_float_ptr( depth_kw ); + const int * i = ecl_kw_get_int_ptr( conipos ); + const int * j = ecl_kw_get_int_ptr( conjpos ); + const int * k = ecl_kw_get_int_ptr( conkpos ); + + { + int c; + for (c = 0; c < ecl_kw_get_size( conipos ); c++) { + /* The connection coordinates are shifted -= 1; i.e. all internal usage is offset 0. */ + ecl_rft_cell_type * cell = ecl_rft_cell_alloc_RFT( i[c] - 1 , j[c] - 1 , k[c] - 1 , + depth[c] , P[c] , SW[c] , SG[c]); + ecl_rft_node_append_cell( rft_node , cell ); + } + } +} + + + + + +static void ecl_rft_node_init_PLT_cells( ecl_rft_node_type * rft_node , const ecl_file_type * rft) { + /* For PLT there is quite a lot of extra information which is not yet internalized. */ + const ecl_kw_type * conipos = ecl_file_iget_named_kw( rft , CONIPOS_KW , 0); + const ecl_kw_type * conjpos = ecl_file_iget_named_kw( rft , CONJPOS_KW , 0); + const ecl_kw_type * conkpos = ecl_file_iget_named_kw( rft , CONKPOS_KW , 0); + + const int * i = ecl_kw_get_int_ptr( conipos ); + const int * j = ecl_kw_get_int_ptr( conjpos ); + const int * k = ecl_kw_get_int_ptr( conkpos ); + + const float * WR = ecl_kw_get_float_ptr( ecl_file_iget_named_kw( rft , CONWRAT_KW , 0)); + const float * GR = ecl_kw_get_float_ptr( ecl_file_iget_named_kw( rft , CONGRAT_KW , 0)); + const float * OR = ecl_kw_get_float_ptr( ecl_file_iget_named_kw( rft , CONORAT_KW , 0)); + const float * P = ecl_kw_get_float_ptr( ecl_file_iget_named_kw( rft , CONPRES_KW , 0)); + const float * depth = ecl_kw_get_float_ptr( ecl_file_iget_named_kw( rft , CONDEPTH_KW , 0)); + const float * flowrate = ecl_kw_get_float_ptr( ecl_file_iget_named_kw( rft , CONVTUB_KW , 0)); + const float * oil_flowrate = ecl_kw_get_float_ptr( ecl_file_iget_named_kw( rft , CONOTUB_KW , 0)); + const float * gas_flowrate = ecl_kw_get_float_ptr( ecl_file_iget_named_kw( rft , CONGTUB_KW , 0)); + const float * water_flowrate = ecl_kw_get_float_ptr( ecl_file_iget_named_kw( rft , CONWTUB_KW , 0)); + const float * connection_start = NULL; + + /* This keyword is ONLY present if we are dealing with a MSW well. */ + if (ecl_file_has_kw( rft , CONLENST_KW)) + connection_start = ecl_kw_get_float_ptr( ecl_file_iget_named_kw( rft , CONLENST_KW , 0)); + + { + int c; + for ( c = 0; c < ecl_kw_get_size( conipos ); c++) { + ecl_rft_cell_type * cell; + double cs = 0; + if (connection_start) + cs = connection_start[c]; + + /* The connection coordinates are shifted -= 1; i.e. all internal usage is offset 0. */ + cell = ecl_rft_cell_alloc_PLT( i[c] -1 , j[c] -1 , k[c] -1 , + depth[c] , P[c] , OR[c] , GR[c] , WR[c] , cs , flowrate[c] , oil_flowrate[c] , gas_flowrate[c] , water_flowrate[c]); + ecl_rft_node_append_cell( rft_node , cell ); + } + } +} + + + + + +static void ecl_rft_node_init_cells( ecl_rft_node_type * rft_node , const ecl_file_type * rft ) { + + if (rft_node->data_type == RFT) + ecl_rft_node_init_RFT_cells( rft_node , rft ); + else if (rft_node->data_type == PLT) + ecl_rft_node_init_PLT_cells( rft_node , rft ); + +} + + ecl_rft_node_type * ecl_rft_node_alloc(const ecl_file_type * rft) { - ecl_kw_type * conipos = ecl_file_iget_named_kw(rft , CONIPOS_KW , 0); ecl_kw_type * welletc = ecl_file_iget_named_kw(rft , WELLETC_KW , 0); - ecl_rft_node_type * rft_node = ecl_rft_node_alloc_empty(ecl_kw_get_size(conipos) , - ecl_kw_iget_ptr(welletc , WELLETC_TYPE_INDEX)); + ecl_rft_node_type * rft_node = ecl_rft_node_alloc_empty(ecl_kw_iget_ptr(welletc , WELLETC_TYPE_INDEX)); if (rft_node != NULL) { ecl_kw_type * date_kw = ecl_file_iget_named_kw( rft , DATE_KW , 0); - ecl_kw_type * conjpos = ecl_file_iget_named_kw( rft , CONJPOS_KW , 0); - ecl_kw_type * conkpos = ecl_file_iget_named_kw( rft , CONKPOS_KW , 0); - ecl_kw_type * depth_kw; - if (rft_node->data_type == RFT) - depth_kw = ecl_file_iget_named_kw( rft , DEPTH_KW , 0); - else - depth_kw = ecl_file_iget_named_kw( rft , CONDEPTH_KW , 0); rft_node->well_name = util_alloc_strip_copy( ecl_kw_iget_ptr(welletc , WELLETC_NAME_INDEX)); - + /* Time information. */ { int * time = ecl_kw_get_int_ptr( date_kw ); rft_node->recording_date = util_make_date( time[DATE_DAY_INDEX] , time[DATE_MONTH_INDEX] , time[DATE_YEAR_INDEX] ); } rft_node->days = ecl_kw_iget_float( ecl_file_iget_named_kw( rft , TIME_KW , 0 ) , 0); - - - /* Cell information */ - { - const int * i = ecl_kw_get_int_ptr( conipos ); - const int * j = ecl_kw_get_int_ptr( conjpos ); - const int * k = ecl_kw_get_int_ptr( conkpos ); - const float * depth = ecl_kw_get_float_ptr( depth_kw ); + if (ecl_file_has_kw( rft , CONLENST_KW)) + rft_node->MSW = true; + else + rft_node->MSW = false; - - /* The ECLIPSE file has offset-1 coordinates, and that is - currently what we store; What a fxxxing mess. */ - int c; - for (c = 0; c < rft_node->size; c++) { - rft_node->cells[c].i = i[c]; - rft_node->cells[c].j = j[c]; - rft_node->cells[c].k = k[c]; - rft_node->cells[c].depth = depth[c]; - } - - } - - - /* Now we are done with the information which is common to both RFT and PLT. */ - if (rft_node->data_type == RFT) { - const float * SW = ecl_kw_get_float_ptr( ecl_file_iget_named_kw( rft , SWAT_KW , 0)); - const float * SG = ecl_kw_get_float_ptr( ecl_file_iget_named_kw( rft , SGAS_KW , 0)); - const float * P = ecl_kw_get_float_ptr( ecl_file_iget_named_kw( rft , PRESSURE_KW , 0)); - int c; - for (c = 0; c < rft_node->size; c++) { - rft_node->rft_data[c].swat = SW[c]; - rft_node->rft_data[c].sgas = SG[c]; - rft_node->cells[c].pressure = P[c]; - } - } else if (rft_node->data_type == PLT) { - /* For PLT there is quite a lot of extra information which is not yet internalized. */ - const float * WR = ecl_kw_get_float_ptr( ecl_file_iget_named_kw( rft , CONWRAT_KW , 0)); - const float * GR = ecl_kw_get_float_ptr( ecl_file_iget_named_kw( rft , CONGRAT_KW , 0)); - const float * OR = ecl_kw_get_float_ptr( ecl_file_iget_named_kw( rft , CONORAT_KW , 0)); - const float * P = ecl_kw_get_float_ptr( ecl_file_iget_named_kw( rft , CONPRES_KW , 0)); - int c; - for ( c = 0; c < rft_node->size; c++) { - rft_node->plt_data[c].orat = OR[c]; - rft_node->plt_data[c].grat = GR[c]; - rft_node->plt_data[c].wrat = WR[c]; - rft_node->cells[c].pressure = P[c]; - } - } else { - /* Segmnet code - not implemented. */ - } - - /* - Checking if the well is monotone in the z-direction; if it is we can - reasonably safely try some blocking. - */ - { - int i; - double first_delta = rft_node->cells[1].depth - rft_node->cells[0].depth; - rft_node->__vertical_well = true; - for (i = 1; i < (rft_node->size - 1); i++) { - double delta = rft_node->cells[i+1].depth - rft_node->cells[i].depth; - if (fabs(delta) > 0) { - if (first_delta * delta < 0) - rft_node->__vertical_well = false; - } - } - } + ecl_rft_node_init_cells( rft_node , rft ); } return rft_node; } - + const char * ecl_rft_node_get_well_name(const ecl_rft_node_type * rft_node) { return rft_node->well_name; } void ecl_rft_node_free(ecl_rft_node_type * rft_node) { + free(rft_node->well_name); - free(rft_node->cells); - util_safe_free(rft_node->segment_data); - util_safe_free(rft_node->rft_data); - util_safe_free(rft_node->plt_data); + vector_free( rft_node->cells ); + if (rft_node->sort_perm) + int_vector_free( rft_node->sort_perm ); + free(rft_node); } @@ -295,247 +251,10 @@ void ecl_rft_node_free__(void * void_node) { -void ecl_rft_node_summarize(const ecl_rft_node_type * rft_node , bool print_cells) { - int i; - printf("--------------------------------------------------------------\n"); - printf("Well.............: %s \n",rft_node->well_name); - printf("Completed cells..: %d \n",rft_node->size); - printf("Vertical well....: %d \n",rft_node->__vertical_well); - { - int day , month , year; - util_set_date_values(rft_node->recording_date , &day , &month , &year); - printf("Recording date...: %02d/%02d/%4d / %g days after simulation start.\n" , day , month , year , rft_node->days); - } - printf("-----------------------------------------\n"); - if (print_cells) { - printf(" i j k Depth Pressure\n"); - printf("-----------------------------------------\n"); - for (i=0; i < rft_node->size; i++) - printf("%2d: %3d %3d %3d | %10.2f %10.2f \n",i, - rft_node->cells[i].i , - rft_node->cells[i].j , - rft_node->cells[i].k , - rft_node->cells[i].depth, - rft_node->cells[i].pressure); - printf("-----------------------------------------\n"); - } -} -/* - For this function to work the ECLIPSE keyword COMPORD must be used. -*/ -void ecl_rft_node_block(const ecl_rft_node_type * rft_node , double epsilon , int size , const double * tvd , int * i, int * j , int *k) { - int rft_index , tvd_index; - int last_rft_index = 0; - bool * blocked = util_calloc(rft_node->size , sizeof * blocked); - - if (!rft_node->__vertical_well) { - fprintf(stderr,"**************************************************************************\n"); - fprintf(stderr,"** WARNING: Trying to block horizontal well: %s from only tvd, this **\n", ecl_rft_node_get_well_name(rft_node)); - fprintf(stderr,"** is extremely error prone - blocking should be carefully checked. **\n"); - fprintf(stderr,"**************************************************************************\n"); - } - ecl_rft_node_summarize(rft_node , true); - for (tvd_index = 0; tvd_index < size; tvd_index++) { - double min_diff = 100000; - int min_diff_index = 0; - if (rft_node->__vertical_well) { - for (rft_index = last_rft_index; rft_index < rft_node->size; rft_index++) { - double diff = fabs(tvd[tvd_index] - rft_node->cells[rft_index].depth); - if (diff < min_diff) { - min_diff = diff; - min_diff_index = rft_index; - } - } - } else { - for (rft_index = last_rft_index; rft_index < (rft_node->size - 1); rft_index++) { - int next_rft_index = rft_index + 1; - if ((rft_node->cells[next_rft_index].depth - tvd[tvd_index]) * (tvd[tvd_index] - rft_node->cells[rft_index].depth) > 0) { - /* - We have bracketing ... !! - */ - min_diff_index = rft_index; - min_diff = 0; - printf("Bracketing: %g | %g | %g \n",rft_node->cells[next_rft_index].depth , - tvd[tvd_index] , rft_node->cells[rft_index].depth); - break; - } - } - } - - if (min_diff < epsilon) { - i[tvd_index] = rft_node->cells[min_diff_index].i; - j[tvd_index] = rft_node->cells[min_diff_index].j; - k[tvd_index] = rft_node->cells[min_diff_index].k; - - blocked[min_diff_index] = true; - last_rft_index = min_diff_index; - } else { - i[tvd_index] = -1; - j[tvd_index] = -1; - k[tvd_index] = -1; - fprintf(stderr,"%s: Warning: True Vertical Depth:%g (Point:%d/%d) could not be mapped to well_path for well:%s \n",__func__ , tvd[tvd_index] , tvd_index+1 , size , rft_node->well_name); - } - } - free(blocked); -} - - - -/* - Faen - dette er jeg egentlig *ikke* interessert i .... -*/ -static double * ecl_rft_node_alloc_well_md(const ecl_rft_node_type * rft_node , int fixed_index , double md_offset) { - double * md = util_calloc(rft_node->size , sizeof * md ); - - - - return md; -} - - -void ecl_rft_node_block_static(const ecl_rft_node_type * rft_node , int rft_index_offset , int md_size , int md_index_offset , const double * md , int * i , int * j , int * k) { - const double md_offset = md[md_index_offset]; - double *well_md = ecl_rft_node_alloc_well_md(rft_node , rft_index_offset , md_offset); - int index; - for (index = 0; index < md_size; index++) { - i[index] = -1; - j[index] = -1; - k[index] = -1; - } - i[md_index_offset] = rft_node->cells[rft_index_offset].i; - j[md_index_offset] = rft_node->cells[rft_index_offset].j; - k[md_index_offset] = rft_node->cells[rft_index_offset].k; - - - free(well_md); -} - - - - -void ecl_rft_node_block2(const ecl_rft_node_type * rft_node , int tvd_size , const double * md , const double * tvd , int * i, int * j , int *k) { - const double epsilon = 1.0; - int rft_index ; - - ecl_rft_node_summarize(rft_node , true); - { - double min_diff = 100000; - int min_diff_index = 0; - int tvd_index = 0; - double local_tvd_peak = 99999999; - { - int index; - for (index = 1; index < (tvd_size - 1); index++) - if (tvd[index] < tvd[index+1] && tvd[index] < tvd[index-1]) - local_tvd_peak = util_double_min(tvd[index] , local_tvd_peak); - } - - - while (min_diff > epsilon) { - for (rft_index = 0; rft_index < rft_node->size; rft_index++) { - double diff = fabs(tvd[tvd_index] - rft_node->cells[rft_index].depth); - if (diff < min_diff) { - min_diff = diff; - min_diff_index = rft_index; - } - } - if (min_diff > epsilon) { - tvd_index++; - if (tvd_index == tvd_size) { - fprintf(stderr,"%s: could not map tvd:%g to well-path depth - aborting \n",__func__ , tvd[tvd_index]); - abort(); - } - - if (tvd[tvd_index] > local_tvd_peak) { - fprintf(stderr,"%s: could not determine offset before well path becomes multivalued - aborting\n",__func__); - abort(); - } - } - } - ecl_rft_node_block_static(rft_node , min_diff_index , tvd_size , tvd_index , md , i , j , k); - } -} - - - - - -void ecl_rft_node_fprintf_rft_obs(const ecl_rft_node_type * rft_node , double epsilon , const char * tvd_file , const char * target_file , double p_std) { - FILE * input_stream = util_fopen(tvd_file , "r" ); - int size = util_count_file_lines(input_stream); - double *p = util_calloc(size , sizeof * p ); - double *tvd = util_calloc(size , sizeof * tvd ); - double *md = util_calloc(size , sizeof * md ); - int *i = util_calloc(size , sizeof * i); - int *j = util_calloc(size , sizeof * j); - int *k = util_calloc(size , sizeof * k); - - { - double *arg1 , *arg2; - int line; - arg1 = p; - arg2 = tvd; - for (line = 0; line < size; line++) - if (fscanf(input_stream , "%lg %lg", &arg1[line] , &arg2[line]) != 2) { - fprintf(stderr,"%s: something wrong when reading: %s - aborting \n",__func__ , tvd_file); - abort(); - } - } - fclose(input_stream); - ecl_rft_node_block(rft_node , epsilon , size , tvd , i , j , k); - - { - int active_lines = 0; - int line; - for (line = 0; line < size; line++) - if (i[line] != -1) - active_lines++; - - if (active_lines > 0) { - FILE * output_stream = util_fopen(target_file , "w" ); - fprintf(output_stream,"%d\n" , active_lines); - for (line = 0; line < size; line++) - if (i[line] != -1) - fprintf(output_stream , "%3d %3d %3d %g %g\n",i[line] , j[line] , k[line] , p[line] , p_std); - fclose(output_stream); - } else - fprintf(stderr,"%s: Warning found no active cells when blocking well:%s to data_file:%s \n",__func__ , rft_node->well_name , tvd_file); - } - - free(md); - free(p); - free(tvd); - free(i); - free(j); - free(k); -} - - -void ecl_rft_node_export_DEPTH(const ecl_rft_node_type * rft_node , const char * path) { - FILE * stream; - char * full; - char * filename = util_alloc_string_copy(ecl_rft_node_get_well_name(rft_node)); - int i; - - filename = util_strcat_realloc(filename , ".DEPTH"); - full = util_alloc_filename(path , filename , NULL); - - stream = fopen(full , "w"); - for (i=0; i < rft_node->size; i++) - fprintf(stream , "%d %g \n",i , rft_node->cells[i].depth); - fclose(stream); - - /* - free(full); - free(filename); - */ -} - - -int ecl_rft_node_get_size(const ecl_rft_node_type * rft_node) { return rft_node->size; } +int ecl_rft_node_get_size(const ecl_rft_node_type * rft_node) { return vector_get_size( rft_node->cells ); } time_t ecl_rft_node_get_date(const ecl_rft_node_type * rft_node) { return rft_node->recording_date; } ecl_rft_enum ecl_rft_node_get_type(const ecl_rft_node_type * rft_node) { return rft_node->data_type; } @@ -543,65 +262,87 @@ ecl_rft_enum ecl_rft_node_get_type(const ecl_rft_node_type * rft_node) { return /*****************************************************************/ /* various functions to access properties at the cell level */ -static cell_type * ecl_rft_node_iget_cell( const ecl_rft_node_type * rft_node , int index) { - if (index < rft_node->size) - return &rft_node->cells[index]; +const ecl_rft_cell_type * ecl_rft_node_iget_cell( const ecl_rft_node_type * rft_node , int index) { + return vector_iget_const( rft_node->cells , index ); +} + + +static void ecl_rft_node_create_sort_perm( ecl_rft_node_type * rft_node ) { + if (rft_node->sort_perm) + int_vector_free( rft_node->sort_perm ); + + rft_node->sort_perm = vector_alloc_sort_perm( rft_node->cells , ecl_rft_cell_cmp__ ); + rft_node->sort_perm_in_sync = true; +} + +void ecl_rft_node_inplace_sort_cells( ecl_rft_node_type * rft_node ) { + vector_sort( rft_node->cells , ecl_rft_cell_cmp__ ); + rft_node->sort_perm_in_sync = false; // The permutation is no longer sorted; however the vector itself is sorted .... +} + +const ecl_rft_cell_type * ecl_rft_node_iget_cell_sorted( ecl_rft_node_type * rft_node , int index) { + if (ecl_rft_node_is_RFT( rft_node )) + return ecl_rft_node_iget_cell( rft_node , index ); else { - util_abort("%s: asked for cell:%d max:%d \n",__func__ , index , rft_node->size - 1); - return NULL; + if (!rft_node->sort_perm_in_sync) + ecl_rft_node_create_sort_perm( rft_node ); + + return vector_iget_const( rft_node->cells , int_vector_iget( rft_node->sort_perm , index )); } } double ecl_rft_node_iget_depth( const ecl_rft_node_type * rft_node , int index) { - const cell_type * cell = ecl_rft_node_iget_cell( rft_node , index ); - return cell->depth; + const ecl_rft_cell_type * cell = ecl_rft_node_iget_cell( rft_node , index ); + return ecl_rft_cell_get_depth( cell ); } double ecl_rft_node_iget_pressure( const ecl_rft_node_type * rft_node , int index) { - const cell_type * cell = ecl_rft_node_iget_cell( rft_node , index ); - return cell->pressure; + const ecl_rft_cell_type * cell = ecl_rft_node_iget_cell( rft_node , index ); + return ecl_rft_cell_get_pressure( cell ); } void ecl_rft_node_iget_ijk( const ecl_rft_node_type * rft_node , int index , int *i , int *j , int *k) { - const cell_type * cell = ecl_rft_node_iget_cell( rft_node , index ); - *i = cell->i; - *j = cell->j; - *k = cell->k; + const ecl_rft_cell_type * cell = ecl_rft_node_iget_cell( rft_node , index ); + + ecl_rft_cell_get_ijk( cell , i,j,k); } -int ecl_rft_node_lookup_ijk( const ecl_rft_node_type * rft_node , int i, int j , int k) { +const ecl_rft_cell_type * ecl_rft_node_lookup_ijk( const ecl_rft_node_type * rft_node , int i, int j , int k) { int index = 0; + int size = ecl_rft_node_get_size( rft_node ); while (true) { - const cell_type * cell = ecl_rft_node_iget_cell( rft_node , index ); - if ((cell->i == (i+1)) && (cell->j == (j+1)) && (cell->k == (k+1))) /* OK - found it. */ - return index; + const ecl_rft_cell_type * cell = ecl_rft_node_iget_cell( rft_node , index ); + + if (ecl_rft_cell_ijk_equal( cell , i , j , k )) + return cell; index++; - if (index == rft_node->size) /* Could not find it. */ - return -1; + if (index == size) /* Could not find it. */ + return NULL; } } + static void assert_type_and_index( const ecl_rft_node_type * rft_node , ecl_rft_enum target_type , int index) { if (rft_node->data_type != target_type) util_abort("%s: wrong type \n",__func__); - if ((index < 0) || (index >= rft_node->size)) + if ((index < 0) || (index >= vector_get_size( rft_node->cells ))) util_abort("%s: invalid index:%d \n",__func__ , index); } double ecl_rft_node_iget_sgas( const ecl_rft_node_type * rft_node , int index) { assert_type_and_index( rft_node , RFT , index ); { - const rft_data_type rft_data = rft_node->rft_data[ index ]; - return rft_data.sgas; + const ecl_rft_cell_type * cell = vector_iget_const( rft_node->cells , index ); + return ecl_rft_cell_get_sgas( cell ); } } @@ -609,17 +350,28 @@ double ecl_rft_node_iget_sgas( const ecl_rft_node_type * rft_node , int index) { double ecl_rft_node_iget_swat( const ecl_rft_node_type * rft_node , int index) { assert_type_and_index( rft_node , RFT , index ); { - const rft_data_type rft_data = rft_node->rft_data[ index ]; - return rft_data.swat; + const ecl_rft_cell_type * cell = vector_iget_const( rft_node->cells , index ); + return ecl_rft_cell_get_swat( cell ); } } +double ecl_rft_node_iget_soil( const ecl_rft_node_type * rft_node , int index) { + assert_type_and_index( rft_node , RFT , index ); + { + const ecl_rft_cell_type * cell = vector_iget_const( rft_node->cells , index ); + return ecl_rft_cell_get_soil( cell ); + } +} + +/*****************************************************************/ + + double ecl_rft_node_iget_orat( const ecl_rft_node_type * rft_node , int index) { assert_type_and_index( rft_node , PLT , index ); { - const plt_data_type plt_data = rft_node->plt_data[ index ]; - return plt_data.orat; + const ecl_rft_cell_type * cell = vector_iget_const( rft_node->cells , index ); + return ecl_rft_cell_get_orat( cell ); } } @@ -627,8 +379,8 @@ double ecl_rft_node_iget_orat( const ecl_rft_node_type * rft_node , int index) { double ecl_rft_node_iget_wrat( const ecl_rft_node_type * rft_node , int index) { assert_type_and_index( rft_node , PLT , index ); { - const plt_data_type plt_data = rft_node->plt_data[ index ]; - return plt_data.wrat; + const ecl_rft_cell_type * cell = vector_iget_const( rft_node->cells , index); + return ecl_rft_cell_get_wrat( cell ); } } @@ -636,8 +388,36 @@ double ecl_rft_node_iget_wrat( const ecl_rft_node_type * rft_node , int index) { double ecl_rft_node_iget_grat( const ecl_rft_node_type * rft_node , int index) { assert_type_and_index( rft_node , PLT , index ); { - const plt_data_type plt_data = rft_node->plt_data[ index ]; - return plt_data.grat; + const ecl_rft_cell_type * cell = vector_iget_const( rft_node->cells , index); + return ecl_rft_cell_get_grat( cell ); } } + +bool ecl_rft_node_is_MSW( const ecl_rft_node_type * rft_node ) { + return rft_node->MSW; +} + + +bool ecl_rft_node_is_PLT( const ecl_rft_node_type * rft_node ) { + if (rft_node->data_type == PLT) + return true; + else + return false; +} + +bool ecl_rft_node_is_SEGMENT( const ecl_rft_node_type * rft_node ) { + if (rft_node->data_type == SEGMENT) + return true; + else + return false; +} + +bool ecl_rft_node_is_RFT( const ecl_rft_node_type * rft_node ) { + if (rft_node->data_type == RFT) + return true; + else + return false; +} + + diff --git a/ThirdParty/Ert/devel/libecl/src/ecl_rsthead.c b/ThirdParty/Ert/devel/libecl/src/ecl_rsthead.c index 05995747cc..b0baf402ed 100644 --- a/ThirdParty/Ert/devel/libecl/src/ecl_rsthead.c +++ b/ThirdParty/Ert/devel/libecl/src/ecl_rsthead.c @@ -71,6 +71,7 @@ ecl_rsthead_type * ecl_rsthead_ialloc( const ecl_file_type * rst_file , int occu rsthead->nisegz = data[INTEHEAD_NISEGZ_INDEX]; rsthead->nsegmx = data[INTEHEAD_NSEGMX_INDEX]; rsthead->nswlmx = data[INTEHEAD_NSWLMX_INDEX]; + rsthead->nrsegz = data[INTEHEAD_NRSEGZ_INDEX]; // The only derived quantity rsthead->sim_time = rsthead_date( rsthead->day , rsthead->month , rsthead->year ); diff --git a/ThirdParty/Ert/devel/libecl/src/ecl_sum.c b/ThirdParty/Ert/devel/libecl/src/ecl_sum.c index f07e1de355..d9282726f7 100644 --- a/ThirdParty/Ert/devel/libecl/src/ecl_sum.c +++ b/ThirdParty/Ert/devel/libecl/src/ecl_sum.c @@ -333,6 +333,7 @@ void ecl_sum_free( ecl_sum_type * ecl_sum ) { util_safe_free( ecl_sum->path ); util_safe_free( ecl_sum->ext ); + util_safe_free( ecl_sum->abs_path ); free( ecl_sum->base ); free( ecl_sum->ecl_case ); @@ -882,8 +883,6 @@ void ecl_sum_fmt_init_summary_x( ecl_sum_fmt_type * fmt ) { #define DATE_STRING_LENGTH 128 static void __ecl_sum_fprintf_line( const ecl_sum_type * ecl_sum , FILE * stream , int internal_index , const bool_vector_type * has_var , const int_vector_type * var_index , char * date_string , const ecl_sum_fmt_type * fmt) { - int ivar , day,month,year; - util_set_date_values(ecl_sum_iget_sim_time(ecl_sum , internal_index ) , &day , &month, &year); fprintf(stream , fmt->days_fmt , ecl_sum_iget_sim_days(ecl_sum , internal_index)); fprintf(stream , fmt->sep ); @@ -895,12 +894,15 @@ static void __ecl_sum_fprintf_line( const ecl_sum_type * ecl_sum , FILE * stream fprintf(stream , date_string ); } - for (ivar = 0; ivar < int_vector_size( var_index ); ivar++) { - if (bool_vector_iget( has_var , ivar )) { - fprintf(stream , fmt->sep); - fprintf(stream , fmt->value_fmt , ecl_sum_iget(ecl_sum , internal_index, int_vector_iget( var_index , ivar ))); + { + int ivar; + for (ivar = 0; ivar < int_vector_size( var_index ); ivar++) { + if (bool_vector_iget( has_var , ivar )) { + fprintf(stream , fmt->sep); + fprintf(stream , fmt->value_fmt , ecl_sum_iget(ecl_sum , internal_index, int_vector_iget( var_index , ivar ))); + } } - } + } fprintf(stream , fmt->newline); } @@ -980,6 +982,7 @@ void ecl_sum_fprintf(const ecl_sum_type * ecl_sum , FILE * stream , const string bool_vector_free( has_var ); if (current_locale != NULL) setlocale( LC_NUMERIC , current_locale); + free( date_string ); } #undef DATE_STRING_LENGTH @@ -1163,6 +1166,21 @@ char * ecl_sum_alloc_well_key( const ecl_sum_type * ecl_sum , const char * keywo +bool ecl_sum_is_oil_producer( const ecl_sum_type * ecl_sum , const char * well) { + const char * WOPT_KEY = "WOPT"; + bool oil_producer = false; + + if (ecl_sum_has_well_var( ecl_sum , well , WOPT_KEY)) { + int last_step = ecl_sum_get_data_length( ecl_sum ) - 1; + double wopt = ecl_sum_get_well_var( ecl_sum , last_step , well , WOPT_KEY); + + if (wopt > 0) + oil_producer = true; + } + + return oil_producer; +} + diff --git a/ThirdParty/Ert/devel/libecl/tests/CMakeLists.txt b/ThirdParty/Ert/devel/libecl/tests/CMakeLists.txt index 2236c08c93..42c8765bf9 100644 --- a/ThirdParty/Ert/devel/libecl/tests/CMakeLists.txt +++ b/ThirdParty/Ert/devel/libecl/tests/CMakeLists.txt @@ -8,6 +8,20 @@ target_link_libraries( ecl_restart_test ecl ) add_test( ecl_restart_test ${EXECUTABLE_OUTPUT_PATH}/ecl_restart_test ${PROJECT_SOURCE_DIR}/test-data/Statoil/ECLIPSE/Gurbat/ECLIPSE.UNRST ) +add_executable( ecl_grid_lgr_name ecl_grid_lgr_name.c ) +target_link_libraries( ecl_grid_lgr_name ecl ) +set_target_properties( ecl_grid_lgr_name PROPERTIES COMPILE_FLAGS "-Werror") +add_test( ecl_grid_lgr_name ${EXECUTABLE_OUTPUT_PATH}/ecl_grid_lgr_name ${PROJECT_SOURCE_DIR}/test-data/Statoil/ECLIPSE/10kcase/TEST10K_FLT_LGR_NNC.EGRID) + +add_executable( ecl_region ecl_region.c ) +target_link_libraries( ecl_region ecl ) +add_test( ecl_region ${EXECUTABLE_OUTPUT_PATH}/ecl_region ${PROJECT_SOURCE_DIR}/test-data/Statoil/ECLIPSE/Gurbat/ECLIPSE.EGRID ) + + +add_executable( ecl_grid_case ecl_grid_case.c ) +target_link_libraries( ecl_grid_case ecl ) +add_test( ecl_grid_case ${EXECUTABLE_OUTPUT_PATH}/ecl_grid_case ${PROJECT_SOURCE_DIR}/test-data/Statoil/ECLIPSE/Gurbat/ECLIPSE.EGRID ${PROJECT_SOURCE_DIR}/test-data/Statoil/ECLIPSE/Gurbat/ECLIPSE ) + add_executable( ecl_lgr_test ecl_lgr_test.c ) target_link_libraries( ecl_lgr_test ecl ) @@ -75,20 +89,35 @@ target_link_libraries( ecl_rsthead ecl ) add_test( ecl_rsthead ${EXECUTABLE_OUTPUT_PATH}/ecl_rsthead ${PROJECT_SOURCE_DIR}/test-data/Statoil/ECLIPSE/Gurbat/ECLIPSE.UNRST ${PROJECT_SOURCE_DIR}/test-data/Statoil/ECLIPSE/DualPoro/DUALPORO.X0005 ) -set_property( TEST ecl_fmt PROPERTY LABELS Statoil ) -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 ) -set_property( TEST ecl_lgr_test3 PROPERTY LABELS Statoil ) -set_property( TEST ecl_grid_simple PROPERTY LABELS Statoil ) -set_property( TEST ecl_dualp PROPERTY LABELS Statoil ) -set_property( TEST ecl_sum_test PROPERTY LABELS Statoil ) -set_property( TEST ecl_fortio PROPERTY LABELS Statoil) -set_property( TEST ecl_grid_dims1 PROPERTY LABELS Statoil ) -set_property( TEST ecl_grid_dims2 PROPERTY LABELS Statoil ) -set_property( TEST ecl_grid_dims3 PROPERTY LABELS Statoil ) -set_property( TEST ecl_grid_dims4 PROPERTY LABELS Statoil ) -set_property( TEST ecl_grid_dims5 PROPERTY LABELS Statoil ) -set_property( TEST ecl_file PROPERTY LABELS Statoil) -set_property( TEST ecl_rsthead PROPERTY LABELS Statoil) +add_executable( ecl_rft ecl_rft.c ) +target_link_libraries( ecl_rft ecl ) +add_test( ecl_rft_rft ${EXECUTABLE_OUTPUT_PATH}/ecl_rft ${PROJECT_SOURCE_DIR}/test-data/Statoil/ECLIPSE/Gurbat/ECLIPSE.RFT RFT) +add_test( ecl_rft_plt ${EXECUTABLE_OUTPUT_PATH}/ecl_rft ${PROJECT_SOURCE_DIR}/test-data/Statoil/ECLIPSE/RFT/TEST1_1A.RFT PLT) + +add_executable( ecl_rft_cell ecl_rft_cell.c ) +target_link_libraries( ecl_rft_cell ecl ) +add_test( ecl_rft_cell ${EXECUTABLE_OUTPUT_PATH}/ecl_rft_cell ) + + +set_property( TEST ecl_fmt PROPERTY LABELS StatoilData ) +set_property( TEST ecl_coarse_test PROPERTY LABELS StatoilData ) +set_property( TEST ecl_restart_test PROPERTY LABELS StatoilData ) +set_property( TEST ecl_lgr_test1 PROPERTY LABELS StatoilData ) +set_property( TEST ecl_lgr_test2 PROPERTY LABELS StatoilData ) +set_property( TEST ecl_lgr_test3 PROPERTY LABELS StatoilData ) +set_property( TEST ecl_grid_lgr_name PROPERTY LABELS StatoilData ) +set_property( TEST ecl_grid_simple PROPERTY LABELS StatoilData ) +set_property( TEST ecl_dualp PROPERTY LABELS StatoilData ) +set_property( TEST ecl_sum_test PROPERTY LABELS StatoilData ) +set_property( TEST ecl_fortio PROPERTY LABELS StatoilData) +set_property( TEST ecl_grid_dims1 PROPERTY LABELS StatoilData ) +set_property( TEST ecl_grid_dims2 PROPERTY LABELS StatoilData ) +set_property( TEST ecl_grid_dims3 PROPERTY LABELS StatoilData ) +set_property( TEST ecl_grid_dims4 PROPERTY LABELS StatoilData ) +set_property( TEST ecl_grid_dims5 PROPERTY LABELS StatoilData ) +set_property( TEST ecl_file PROPERTY LABELS StatoilData) +set_property( TEST ecl_rsthead PROPERTY LABELS StatoilData) +set_property( TEST ecl_region PROPERTY LABELS StatoilData) +set_property( TEST ecl_grid_case PROPERTY LABELS StatoilData) +set_property( TEST ecl_rft_rft PROPERTY LABELS StatoilData) +set_property( TEST ecl_rft_plt PROPERTY LABELS StatoilData) diff --git a/ThirdParty/Ert/devel/libecl/tests/ecl_grid_case.c b/ThirdParty/Ert/devel/libecl/tests/ecl_grid_case.c new file mode 100644 index 0000000000..cbf40c6a83 --- /dev/null +++ b/ThirdParty/Ert/devel/libecl/tests/ecl_grid_case.c @@ -0,0 +1,46 @@ +/* + Copyright (C) 2013 Statoil ASA, Norway. + + The file 'ecl_grid_case.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 + for more details. +*/ +#include +#include + +#include + +#include + + +void test_grid( const char * input , bool expected) { + ecl_grid_type * grid = ecl_grid_load_case( input ); + if (expected) { + test_assert_true( ecl_grid_is_instance( grid )); + ecl_grid_free( grid ); + } else + test_assert_NULL( grid ); +} + + +int main(int argc , char ** argv) { + const char * grid_file = argv[1]; + const char * case_path = argv[2]; + + test_grid( grid_file , true ); + test_grid( case_path , true ); + test_grid( "/tmp/does/not/exists/file.EGRID" , false ); + test_grid( "/tmp/does/not/exists/CASE" , false ); + + exit(0); +} diff --git a/ThirdParty/Ert/devel/libecl/tests/ecl_grid_lgr_name.c b/ThirdParty/Ert/devel/libecl/tests/ecl_grid_lgr_name.c new file mode 100644 index 0000000000..a9d54a951f --- /dev/null +++ b/ThirdParty/Ert/devel/libecl/tests/ecl_grid_lgr_name.c @@ -0,0 +1,38 @@ +/* + Copyright (C) 2013 Statoil ASA, Norway. + + The file 'ecl_grid_lgr_name.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 + for more details. +*/ +#include +#include + +#include +#include + +#include + + + +int main(int argc , char ** argv) { + const char * grid_file = argv[1]; + ecl_grid_type * ecl_grid = ecl_grid_alloc( grid_file ); + + test_assert_int_equal( 1 , ecl_grid_get_num_lgr( ecl_grid )); + test_assert_string_equal( "LGR1" , ecl_grid_iget_lgr_name( ecl_grid , 0 )); + test_assert_string_equal( NULL , ecl_grid_iget_lgr_name( ecl_grid , 1 )); + + ecl_grid_free( ecl_grid ); + exit(0); +} diff --git a/ThirdParty/Ert/devel/libecl/tests/ecl_region.c b/ThirdParty/Ert/devel/libecl/tests/ecl_region.c new file mode 100644 index 0000000000..2c0b339814 --- /dev/null +++ b/ThirdParty/Ert/devel/libecl/tests/ecl_region.c @@ -0,0 +1,70 @@ +/* + Copyright (C) 2012 Statoil ASA, Norway. + + The file 'ecl_region.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 + for more details. +*/ +#include +#include + +#include + +#include +#include + +void test_list( int volume , int nactive , ecl_region_type * region ) { + const int_vector_type * active_list; + const int_vector_type * global_list; + active_list = ecl_region_get_active_list( region ); + global_list = ecl_region_get_global_list( region ); + test_assert_int_equal( nactive , int_vector_size( active_list )); + test_assert_int_equal( volume , int_vector_size( global_list )); + + + ecl_region_deselect_all( region ); + active_list = ecl_region_get_active_list( region ); + global_list = ecl_region_get_global_list( region ); + test_assert_int_equal( 0 , int_vector_size( active_list )); + test_assert_int_equal( 0 , int_vector_size( global_list )); +} + + + +void test_slice( const ecl_grid_type * grid ) { + int nx = ecl_grid_get_nx( grid ); + int ny = ecl_grid_get_ny( grid ); + int nz = ecl_grid_get_nz( grid ); + int nactive = ecl_grid_get_nactive( grid ); + ecl_region_type * region = ecl_region_alloc( grid , false ); + + ecl_region_select_i1i2( region , 0 , nx - 1); + test_list( nx*ny*nz , nactive , region ); + ecl_region_select_j1j2( region , 0 , ny - 1); + test_list( nx*ny*nz , nactive , region ); + ecl_region_select_k1k2( region , 0 , nz - 1); + test_list( nx*ny*nz , nactive , region ); + + ecl_region_free( region ); +} + + +int main(int argc , char ** argv) { + const char * grid_file = argv[1]; + ecl_grid_type * grid = ecl_grid_alloc( grid_file ); + + test_slice( grid ); + + ecl_grid_free( grid ); + exit(0); +} diff --git a/ThirdParty/Ert/devel/libecl/tests/ecl_rft.c b/ThirdParty/Ert/devel/libecl/tests/ecl_rft.c new file mode 100644 index 0000000000..88c0bad336 --- /dev/null +++ b/ThirdParty/Ert/devel/libecl/tests/ecl_rft.c @@ -0,0 +1,131 @@ +/* + Copyright (C) 2013 Statoil ASA, Norway. + + The file 'ecl_rft.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 + for more details. +*/ +#include +#include + +#include +#include +#include + +#include + + + + +// Hardcoded GURBAT values +void test_rft( const char * rft_file ) { + ecl_rft_file_type * rft = ecl_rft_file_alloc( rft_file ); + ecl_rft_node_type * rft_node = ecl_rft_file_iget_node( rft , 0 ); + + test_assert_true( ecl_rft_node_is_RFT( rft_node )); + test_assert_int_equal( 14 , ecl_rft_node_get_size( rft_node )); + test_assert_false( ecl_rft_node_is_MSW( rft_node )); + + test_assert_double_equal( 259.146 , ecl_rft_node_iget_pressure( rft_node , 0 )); + test_assert_double_equal( 0.0580598 , ecl_rft_node_iget_soil( rft_node , 0 )); + test_assert_double_equal( 0.940477 , ecl_rft_node_iget_swat( rft_node , 0 )); + test_assert_double_equal( 0.00146271 , ecl_rft_node_iget_sgas( rft_node , 0 )); + + { + int i,j,k; + + ecl_rft_node_iget_ijk( rft_node , 0 , &i , &j , &k ); + test_assert_int_equal( 32 , i ); + test_assert_int_equal( 53 , j ); + test_assert_int_equal( 0 , k ); + + ecl_rft_node_iget_ijk( rft_node , 13 , &i , &j , &k ); + test_assert_int_equal( 32 , i ); + test_assert_int_equal( 54 , j ); + test_assert_int_equal( 12 , k ); + + for (i=0; i < ecl_rft_node_get_size( rft_node ); i++) { + const ecl_rft_cell_type * cell1 = ecl_rft_node_iget_cell( rft_node , i ); + const ecl_rft_cell_type * cell2 = ecl_rft_node_iget_cell_sorted( rft_node , i ); + + test_assert_ptr_equal( cell1 , cell2 ); + } + } + ecl_rft_node_inplace_sort_cells( rft_node ); + + ecl_rft_file_free( rft ); +} + + +// Have no such case yet ... +void test_plt_msw( const char * plt_file ) { + +} + + +// Hardcoded values from a test case with a PLT. +void test_plt( const char * plt_file ) { + ecl_rft_file_type * plt = ecl_rft_file_alloc( plt_file ); + ecl_rft_node_type * plt_node = ecl_rft_file_iget_node( plt , 11 ); + + test_assert_true( ecl_rft_node_is_PLT( plt_node )); + test_assert_false( ecl_rft_node_is_MSW( plt_node )); + test_assert_int_equal( 22 , ecl_rft_node_get_size( plt_node )); + + test_assert_double_equal( 244.284 , ecl_rft_node_iget_pressure( plt_node , 0 )); + test_assert_double_equal( 167.473 , ecl_rft_node_iget_orat( plt_node , 0 )); + test_assert_double_equal( 41682.2 , ecl_rft_node_iget_grat( plt_node , 0 )); + test_assert_double_equal( 0.958927 , ecl_rft_node_iget_wrat( plt_node , 0 )); + + { + int i,j,k; + + ecl_rft_node_iget_ijk( plt_node , 0 , &i , &j , &k ); + test_assert_int_equal( 39 , i ); + test_assert_int_equal( 33 , j ); + test_assert_int_equal( 16 , k ); + + ecl_rft_node_iget_ijk( plt_node , 21 , &i , &j , &k ); + test_assert_int_equal( 44 , i ); + test_assert_int_equal( 34 , j ); + test_assert_int_equal( 7 , k ); + + for (i=0; i < ecl_rft_node_get_size( plt_node ); i++) { + const ecl_rft_cell_type * cell1 = ecl_rft_node_iget_cell( plt_node , i ); + const ecl_rft_cell_type * cell2 = ecl_rft_node_iget_cell_sorted( plt_node , i ); + + test_assert_ptr_equal( cell1 , cell2 ); + } + ecl_rft_node_inplace_sort_cells( plt_node ); + } + + ecl_rft_file_free( plt ); +} + + + +int main( int argc , char ** argv) { + const char * rft_file = argv[1]; + const char * mode_string = argv[2]; + + if (strcmp( mode_string , "RFT") == 0) + test_rft( rft_file ); + else if (strcmp( mode_string , "PLT") == 0) + test_plt( rft_file ); + else if (strcmp( mode_string , "MSW-PLT") == 0) + test_plt_msw( rft_file ); + else + test_error_exit("Second argument:%s not recognized. Valid values are: RFT and PLT" , mode_string); + + exit(0); +} diff --git a/ThirdParty/Ert/devel/libecl/tests/ecl_rft_cell.c b/ThirdParty/Ert/devel/libecl/tests/ecl_rft_cell.c new file mode 100644 index 0000000000..0c37cf48d0 --- /dev/null +++ b/ThirdParty/Ert/devel/libecl/tests/ecl_rft_cell.c @@ -0,0 +1,147 @@ +/* + Copyright (C) 2013 Statoil ASA, Norway. + + The file 'ecl_rft_cell.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 + for more details. +*/ + + + + + + +#include +#include + +#include +#include +#include + +#include +#include + + + +void test_rft_cell() { + const int i = 10; + const int j = 11; + const int k = 12; + + const double depth = 100; + const double pressure = 200; + const double swat = 0.25; + const double sgas = 0.35; + + ecl_rft_cell_type * cell = ecl_rft_cell_alloc_RFT(i,j,k,depth,pressure,swat,sgas); + + test_assert_int_equal( i , ecl_rft_cell_get_i( cell )); + test_assert_int_equal( j , ecl_rft_cell_get_j( cell )); + test_assert_int_equal( k , ecl_rft_cell_get_k( cell )); + + { + int ii,jj,kk; + ecl_rft_cell_get_ijk( cell , &ii , &jj , &kk); + test_assert_int_equal( i , ii); + test_assert_int_equal( j , jj); + test_assert_int_equal( k , kk); + } + + test_assert_double_equal( depth , ecl_rft_cell_get_depth( cell )); + test_assert_double_equal( pressure , ecl_rft_cell_get_pressure( cell )); + test_assert_double_equal( swat , ecl_rft_cell_get_swat( cell )); + test_assert_double_equal( sgas , ecl_rft_cell_get_sgas( cell )); + test_assert_double_equal( 1 - (swat + sgas) , ecl_rft_cell_get_soil( cell )); + + test_assert_double_equal( ECL_RFT_CELL_INVALID_VALUE , ecl_rft_cell_get_orat( cell )); + test_assert_double_equal( ECL_RFT_CELL_INVALID_VALUE , ecl_rft_cell_get_grat( cell )); + test_assert_double_equal( ECL_RFT_CELL_INVALID_VALUE , ecl_rft_cell_get_wrat( cell )); + test_assert_double_equal( ECL_RFT_CELL_INVALID_VALUE , ecl_rft_cell_get_flowrate( cell )); + test_assert_double_equal( ECL_RFT_CELL_INVALID_VALUE , ecl_rft_cell_get_connection_start( cell )); + test_assert_double_equal( ECL_RFT_CELL_INVALID_VALUE , ecl_rft_cell_get_oil_flowrate( cell )); + test_assert_double_equal( ECL_RFT_CELL_INVALID_VALUE , ecl_rft_cell_get_gas_flowrate( cell )); + test_assert_double_equal( ECL_RFT_CELL_INVALID_VALUE , ecl_rft_cell_get_water_flowrate( cell )); + + ecl_rft_cell_free( cell ); + { + ecl_rft_cell_type * cell = ecl_rft_cell_alloc_RFT(i,j,k,depth,pressure,swat,sgas); + + test_assert_true( ecl_rft_cell_ijk_equal( cell , i , j , k )); + test_assert_false( ecl_rft_cell_ijk_equal( cell , i , j , k + 1 )); + + ecl_rft_cell_free__( cell ); + } +} + + + +void test_plt_cell() { + const int i = 10; + const int j = 11; + const int k = 12; + + const double depth = 100; + const double pressure = 200; + const double orat = 0.25; + const double grat = 0.35; + const double wrat = 0.45; + const double flowrate = 100.0; + const double connection_start = 891; + const double oil_flowrate = 0.891; + const double gas_flowrate = 7771; + const double water_flowrate = 77614; + + ecl_rft_cell_type * cell = ecl_rft_cell_alloc_PLT(i,j,k,depth,pressure,orat,grat,wrat,connection_start,flowrate,oil_flowrate , gas_flowrate , water_flowrate); + + test_assert_int_equal( i , ecl_rft_cell_get_i( cell )); + test_assert_int_equal( j , ecl_rft_cell_get_j( cell )); + test_assert_int_equal( k , ecl_rft_cell_get_k( cell )); + + { + int ii,jj,kk; + ecl_rft_cell_get_ijk( cell , &ii , &jj , &kk); + test_assert_int_equal( i , ii); + test_assert_int_equal( j , jj); + test_assert_int_equal( k , kk); + } + + test_assert_double_equal( depth , ecl_rft_cell_get_depth( cell )); + test_assert_double_equal( pressure , ecl_rft_cell_get_pressure( cell )); + + test_assert_double_equal( orat , ecl_rft_cell_get_orat( cell )); + test_assert_double_equal( grat , ecl_rft_cell_get_grat( cell )); + test_assert_double_equal( wrat , ecl_rft_cell_get_wrat( cell )); + test_assert_double_equal( connection_start, ecl_rft_cell_get_connection_start( cell )); + test_assert_double_equal(flowrate , ecl_rft_cell_get_flowrate( cell )); + + test_assert_double_equal(oil_flowrate , ecl_rft_cell_get_oil_flowrate( cell )); + test_assert_double_equal(gas_flowrate , ecl_rft_cell_get_gas_flowrate( cell )); + test_assert_double_equal(water_flowrate , ecl_rft_cell_get_water_flowrate( cell )); + + test_assert_double_equal( ECL_RFT_CELL_INVALID_VALUE , ecl_rft_cell_get_swat( cell )); + test_assert_double_equal( ECL_RFT_CELL_INVALID_VALUE , ecl_rft_cell_get_sgas( cell )); + test_assert_double_equal( ECL_RFT_CELL_INVALID_VALUE , ecl_rft_cell_get_soil( cell )); + + ecl_rft_cell_free( cell ); +} + + + + + +int main( int argc , char ** argv) { + + test_rft_cell(); + test_plt_cell(); + exit(0); +} diff --git a/ThirdParty/Ert/devel/libecl/tests/ecl_sum_test.c b/ThirdParty/Ert/devel/libecl/tests/ecl_sum_test.c index beb85d875d..a383cfa2ec 100644 --- a/ThirdParty/Ert/devel/libecl/tests/ecl_sum_test.c +++ b/ThirdParty/Ert/devel/libecl/tests/ecl_sum_test.c @@ -51,6 +51,12 @@ void test_days( const ecl_sum_type * ecl_sum ) { } +void test_is_oil_producer( const ecl_sum_type * ecl_sum) { + test_assert_true( ecl_sum_is_oil_producer( ecl_sum , "OP_1")); + test_assert_false( ecl_sum_is_oil_producer( ecl_sum , "WI_1")); + test_assert_false( ecl_sum_is_oil_producer( ecl_sum , "DoesNotExist")); +} + @@ -61,6 +67,7 @@ int main( int argc , char ** argv) { test_time_range( ecl_sum ); test_days( ecl_sum ); + test_is_oil_producer(ecl_sum); exit(0); } diff --git a/ThirdParty/Ert/devel/libecl_well/CMakeLists.txt b/ThirdParty/Ert/devel/libecl_well/CMakeLists.txt index 3edab07684..c59e944fce 100644 --- a/ThirdParty/Ert/devel/libecl_well/CMakeLists.txt +++ b/ThirdParty/Ert/devel/libecl_well/CMakeLists.txt @@ -1,5 +1,5 @@ add_subdirectory( src ) -if (BUILD_APPLICATONS) +if (BUILD_APPLICATIONS) add_subdirectory( applications ) endif() diff --git a/ThirdParty/Ert/devel/libecl_well/applications/CMakeLists.txt b/ThirdParty/Ert/devel/libecl_well/applications/CMakeLists.txt index 4e4b78d7d6..578a9d2901 100644 --- a/ThirdParty/Ert/devel/libecl_well/applications/CMakeLists.txt +++ b/ThirdParty/Ert/devel/libecl_well/applications/CMakeLists.txt @@ -1,6 +1,7 @@ add_executable( well_info_test well_info_test.c ) +add_executable( segment_info segment_info.c ) -set(program_list well_info_test ) +set(program_list well_info_test segment_info ) foreach(prog ${program_list}) target_link_libraries( ${prog} ecl_well ecl) diff --git a/ThirdParty/Ert/devel/libecl_well/applications/segment_info.c b/ThirdParty/Ert/devel/libecl_well/applications/segment_info.c new file mode 100644 index 0000000000..712802ece0 --- /dev/null +++ b/ThirdParty/Ert/devel/libecl_well/applications/segment_info.c @@ -0,0 +1,107 @@ +/* + Copyright (C) 2013 Statoil ASA, Norway. + + The file 'segment_info.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 + for more details. +*/ +#include +#include +#include +#include + +#include +#include +#include + +#include +#include +#include +#include +#include + +#include +#include +#include +#include + + +int main(int argc , char ** argv) { + const char * Xfile = argv[1]; + ecl_file_type * rst_file = ecl_file_open( Xfile , 0 ); + ecl_rsthead_type * rst_head = ecl_rsthead_alloc( rst_file ); + const ecl_kw_type * iwel_kw = ecl_file_iget_named_kw( rst_file , IWEL_KW , 0 ); + const ecl_kw_type * iseg_kw = ecl_file_iget_named_kw( rst_file , ISEG_KW , 0 ); + const ecl_kw_type * rseg_kw = ecl_file_iget_named_kw( rst_file , RSEG_KW , 0 ); + const ecl_kw_type * icon_kw = ecl_file_iget_named_kw( rst_file , ICON_KW , 0 ); + const ecl_kw_type * zwel_kw = ecl_file_iget_named_kw( rst_file , ZWEL_KW , 0 ); + + test_install_SIGNALS(); + { + int well_nr; + for (well_nr = 0; well_nr < rst_head->nwells; well_nr++) { + const int zwel_offset = rst_head->nzwelz * well_nr; + char * well_name = util_alloc_strip_copy(ecl_kw_iget_ptr( zwel_kw , zwel_offset )); + + printf("=================================================================\n"); + printf("Well: %s ",well_name); + { + well_conn_collection_type * connections = well_conn_collection_alloc(); + well_segment_collection_type * segments = well_segment_collection_alloc(); + + if (well_segment_collection_load_from_kw( segments , well_nr , iwel_kw , iseg_kw , rseg_kw , rst_head )) { + well_branch_collection_type * branches = well_branch_collection_alloc(); + + well_conn_collection_load_from_kw( connections , iwel_kw , icon_kw , well_nr , rst_head); + well_segment_collection_link( segments ); + well_segment_collection_add_branches( segments , branches ); + well_segment_collection_add_connections( segments , ECL_GRID_GLOBAL_GRID , connections ); + + printf("\n"); + printf("Segments:\n"); + { + int is; + for (is=0; is < well_segment_collection_get_size( segments ); is++) { + well_segment_type * segment = well_segment_collection_iget( segments , is ); + printf("-----------------------------------------------------------------\n"); + printf("ID : %d \n",well_segment_get_id( segment )); + printf("Outlet : %d \n",well_segment_get_outlet_id( segment )); + printf("Branch : %d \n",well_segment_get_branch_id( segment )); + printf("Connections : ["); + { + well_conn_collection_type * connections = well_segment_get_global_connections( segment ); + if (connections) { + int ic; + for (ic = 0; ic < well_conn_collection_get_size( connections ); ic++) { + const well_conn_type * conn = well_conn_collection_iget( connections , ic ); + printf("(%d , %d , %d) ",well_conn_get_i( conn ), well_conn_get_j( conn ), well_conn_get_k( conn )); + } + } + } + + printf("]\n"); + } + } + well_branch_collection_free( branches ); + } else + printf("not MSW well\n\n"); + + well_conn_collection_free( connections ); + well_segment_collection_free( segments ); + } + } + } + + ecl_file_close( rst_file ); + ecl_rsthead_free( rst_head ); +} diff --git a/ThirdParty/Ert/devel/libecl_well/include/ert/ecl_well/well_branch.h b/ThirdParty/Ert/devel/libecl_well/include/ert/ecl_well/well_branch.h deleted file mode 100644 index f876ba370f..0000000000 --- a/ThirdParty/Ert/devel/libecl_well/include/ert/ecl_well/well_branch.h +++ /dev/null @@ -1,42 +0,0 @@ -/* - Copyright (C) 2012 Statoil ASA, Norway. - - The file 'well_branch.h' 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 - for more details. -*/ - -#ifndef __WELL_BRANCH_H__ -#define __WELL_BRANCH_H__ - - -#ifdef __cplusplus -extern "C" { -#endif - -#include - - typedef struct well_branch_struct well_branch_type; - - well_branch_type * well_branch_alloc(int branch_nr); - void well_branch_free( well_branch_type * branch ); - void well_branch_add_conn( well_branch_type * branch , well_conn_type * connection ); - int well_branch_get_length( const well_branch_type * branch ); - const well_conn_type ** well_branch_get_connections( const well_branch_type * branch ); - int well_branch_get_nr( const well_branch_type * branch ); - -#ifdef __cplusplus -} -#endif -#endif - diff --git a/ThirdParty/Ert/devel/libecl_well/include/ert/ecl_well/well_branch_collection.h b/ThirdParty/Ert/devel/libecl_well/include/ert/ecl_well/well_branch_collection.h new file mode 100644 index 0000000000..de472c3dbd --- /dev/null +++ b/ThirdParty/Ert/devel/libecl_well/include/ert/ecl_well/well_branch_collection.h @@ -0,0 +1,50 @@ +/* + Copyright (C) 2013 Statoil ASA, Norway. + + The file 'well_branch_collection.h' 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 + for more details. +*/ + + +#ifndef __WELL_BRANCH_COLLECTION_H__ +#define __WELL_BRANCH_COLLECTION_H__ + + +#ifdef __cplusplus +extern "C" { +#endif + +#include + +#include + +#include + + typedef struct well_branch_collection_struct well_branch_collection_type; + + well_branch_collection_type * well_branch_collection_alloc(); + void well_branch_collection_free( well_branch_collection_type * branches ); + void well_branch_collection_free__( void * arg ); + bool well_branch_collection_has_branch( const well_branch_collection_type * branches , int branch_id); + int well_branch_collection_get_size( const well_branch_collection_type * branches ); + const well_segment_type * well_branch_collection_iget_start_segment( const well_branch_collection_type * branches , int index ); + const well_segment_type * well_branch_collection_get_start_segment( const well_branch_collection_type * branches , int branch_id); + bool well_branch_collection_add_start_segment( well_branch_collection_type * branches , const well_segment_type * start_segment); + + UTIL_IS_INSTANCE_HEADER( well_branch_collection ); + +#ifdef __cplusplus +} +#endif +#endif diff --git a/ThirdParty/Ert/devel/libecl_well/include/ert/ecl_well/well_conn.h b/ThirdParty/Ert/devel/libecl_well/include/ert/ecl_well/well_conn.h index f6b1194cca..d2c2fd2a17 100644 --- a/ThirdParty/Ert/devel/libecl_well/include/ert/ecl_well/well_conn.h +++ b/ThirdParty/Ert/devel/libecl_well/include/ert/ecl_well/well_conn.h @@ -27,6 +27,8 @@ extern "C" { #include +#include + #include typedef enum { @@ -43,10 +45,17 @@ extern "C" { void well_conn_free( well_conn_type * conn); void well_conn_free__( void * arg ); - well_conn_type * well_conn_alloc( const ecl_kw_type * icon_kw , const ecl_kw_type * iseg_kw , const ecl_rsthead_type * header , int well_nr , int seg_well_nr , int conn_nr); + + well_conn_type * well_conn_alloc( int i , int j , int k , well_conn_dir_enum dir, bool open); + well_conn_type * well_conn_alloc_MSW( int i , int j , int k , well_conn_dir_enum dir, bool open, int segment); + well_conn_type * well_conn_alloc_fracture( int i , int j , int k , well_conn_dir_enum dir, bool open); + well_conn_type * well_conn_alloc_fracture_MSW( int i , int j , int k , well_conn_dir_enum dir, bool open, int segment); + + bool well_conn_MSW(const well_conn_type * conn); + + well_conn_type * well_conn_alloc_from_kw( const ecl_kw_type * icon_kw , const ecl_rsthead_type * header , int well_nr , int conn_nr); well_conn_type * well_conn_alloc_wellhead( const ecl_kw_type * iwel_kw , const ecl_rsthead_type * header , int well_nr); - int well_conn_get_branch(const well_conn_type * conn); int well_conn_get_i(const well_conn_type * conn); int well_conn_get_j(const well_conn_type * conn); int well_conn_get_k(const well_conn_type * conn); @@ -55,6 +64,11 @@ extern "C" { int well_conn_get_segment( const well_conn_type * conn ); bool well_conn_fracture_connection( const well_conn_type * conn); bool well_conn_matrix_connection( const well_conn_type * conn); + bool well_conn_equal( const well_conn_type *conn1 , const well_conn_type * conn2); + + UTIL_IS_INSTANCE_HEADER( well_conn ); + UTIL_SAFE_CAST_HEADER( well_conn ); + #ifdef __cplusplus } diff --git a/ThirdParty/Ert/devel/libecl_well/include/ert/ecl_well/well_conn_collection.h b/ThirdParty/Ert/devel/libecl_well/include/ert/ecl_well/well_conn_collection.h new file mode 100644 index 0000000000..3357c61a8d --- /dev/null +++ b/ThirdParty/Ert/devel/libecl_well/include/ert/ecl_well/well_conn_collection.h @@ -0,0 +1,51 @@ +/* + Copyright (C) 2013 Statoil ASA, Norway. + + The file 'well_conn_collection.h' 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 + for more details. +*/ + + +#ifndef __WELL_CONN_COLLECTION_H__ +#define __WELL_CONN_COLLECTION_H__ + + +#ifdef __cplusplus +extern "C" { +#endif + +#include + +#include + +#include + + typedef struct well_conn_collection_struct well_conn_collection_type; + + well_conn_collection_type * well_conn_collection_alloc(); + void well_conn_collection_free( well_conn_collection_type * wellcc ); + void well_conn_collection_free__( void * arg ); + int well_conn_collection_get_size( const well_conn_collection_type * wellcc ); + const well_conn_type * well_conn_collection_iget_const( const well_conn_collection_type * wellcc , int index); + well_conn_type * well_conn_collection_iget(const well_conn_collection_type * wellcc , int index); + void well_conn_collection_add( well_conn_collection_type * wellcc , well_conn_type * conn); + void well_conn_collection_add_ref( well_conn_collection_type * wellcc , well_conn_type * conn); + int well_conn_collection_load_from_kw( well_conn_collection_type * wellcc , const ecl_kw_type * iwel_kw , const ecl_kw_type * icon_kw , int iwell , const ecl_rsthead_type * rst_head); + + UTIL_IS_INSTANCE_HEADER( well_conn_collection ); + +#ifdef __cplusplus +} +#endif +#endif diff --git a/ThirdParty/Ert/devel/libecl_well/include/ert/ecl_well/well_const.h b/ThirdParty/Ert/devel/libecl_well/include/ert/ecl_well/well_const.h index e7319067a5..3fca6fa5c6 100644 --- a/ThirdParty/Ert/devel/libecl_well/include/ert/ecl_well/well_const.h +++ b/ThirdParty/Ert/devel/libecl_well/include/ert/ecl_well/well_const.h @@ -39,6 +39,8 @@ extern "C" { #define IWEL_LGR_ITEM 42 #define IWEL_SEGMENTED_WELL_NR_ITEM 70 +#define IWEL_SEGMENTED_WELL_NR_NORMAL_VALUE -1 + #define ISEG_OUTLET_ITEM 1 #define ISEG_BRANCH_ITEM 3 @@ -59,6 +61,11 @@ extern "C" { #define ICON_DEFAULT_DIR_TARGET ICON_DIRZ +#define RSEG_LENGTH_INDEX 0 +#define RSEG_DIAMETER_INDEX 2 +#define RSEG_TOTAL_LENGTH_INDEX 6 +#define RSEG_DEPTH_INDEX 7 + /* The ECLIPSE documentation says that a certain item in the IWEL array should indicate the type of the well, the available types are the diff --git a/ThirdParty/Ert/devel/libecl_well/include/ert/ecl_well/well_path.h b/ThirdParty/Ert/devel/libecl_well/include/ert/ecl_well/well_path.h deleted file mode 100644 index 69a4607112..0000000000 --- a/ThirdParty/Ert/devel/libecl_well/include/ert/ecl_well/well_path.h +++ /dev/null @@ -1,48 +0,0 @@ -/* - Copyright (C) 2012 Statoil ASA, Norway. - - The file 'well_path.h' 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 - for more details. -*/ - -#ifndef __WELL_PATH_H__ -#define __WELL_PATH_H__ - - -#ifdef __cplusplus -extern "C" { -#endif - -#include - -#include -#include - - - typedef struct well_path_struct well_path_type; - - well_path_type * well_path_alloc(const char * grid_name ); - void well_path_free( well_path_type * path ); - void well_path_add_conn( well_path_type * well_path , well_conn_type * conn); - well_branch_type * well_path_iget_branch( const well_path_type * well_path , int branch_nr); - void well_path_free__(void * arg); - int well_path_get_max_branches( const well_path_type * well_path ); - int well_path_get_num_active_branches( const well_path_type * well_path ); - const char * well_path_get_grid_name( const well_path_type * well_path ); - -#ifdef __cplusplus -} -#endif -#endif - diff --git a/ThirdParty/Ert/devel/libecl_well/include/ert/ecl_well/well_segment.h b/ThirdParty/Ert/devel/libecl_well/include/ert/ecl_well/well_segment.h new file mode 100644 index 0000000000..689af32cf2 --- /dev/null +++ b/ThirdParty/Ert/devel/libecl_well/include/ert/ecl_well/well_segment.h @@ -0,0 +1,79 @@ +/* + Copyright (C) 2013 Statoil ASA, Norway. + + The file 'well_segment.h' 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 + for more details. +*/ + + +#ifndef __WELL_SEGMENT_H__ +#define __WELL_SEGMENT_H__ + + +#ifdef __cplusplus +extern "C" { +#endif + +#include + +#include +#include + +#include +#include + + /* The values are shifted one down compared to ISEG description in table 6.1 in ECLIPSE file formats reference. */ + +#define ECLIPSE_WELL_SEGMENT_OUTLET_END_VALUE -1 +#define ECLIPSE_WELL_SEGMENT_BRANCH_MAIN_STEM_VALUE 0 +#define ECLIPSE_WELL_SEGMENT_BRANCH_INACTIVE_VALUE -1 + + + + typedef struct well_segment_struct well_segment_type; + + well_segment_type * well_segment_alloc_from_kw( const ecl_kw_type * iseg_kw , const ecl_kw_type * rseg_kw , const ecl_rsthead_type * header , int well_nr, int segment_id); + well_segment_type * well_segment_alloc(int segment_id , int outlet_segment_id , int branch_id , const double * rseg_data); + void well_segment_free(well_segment_type * segment ); + void well_segment_free__(void * arg); + + bool well_segment_active( const well_segment_type * segment ); + bool well_segment_main_stem( const well_segment_type * segment ); + bool well_segment_nearest_wellhead( const well_segment_type * segment ); + + int well_segment_get_link_count( const well_segment_type * segment ); + int well_segment_get_branch_id( const well_segment_type * segment ); + int well_segment_get_outlet_id( const well_segment_type * segment ); + int well_segment_get_id( const well_segment_type * segment ); + well_segment_type * well_segment_get_outlet( const well_segment_type * segment ); + bool well_segment_link( well_segment_type * segment , well_segment_type * outlet_segment ); + void well_segment_link_strict( well_segment_type * segment , well_segment_type * outlet_segment ); + bool well_segment_has_grid_connections( const well_segment_type * segment , const char * grid_name); + bool well_segment_has_global_grid_connections( const well_segment_type * segment); + bool well_segment_add_connection( well_segment_type * segment , const char * grid_name , well_conn_type * conn); + const well_conn_collection_type * well_segment_get_connections(const well_segment_type * segment , const char * grid_name ); + const well_conn_collection_type * well_segment_get_global_connections(const well_segment_type * segment ); + bool well_segment_well_is_MSW(int well_nr , const ecl_kw_type * iwel_kw , const ecl_rsthead_type * rst_head); + + double well_segment_get_depth( const well_segment_type * segment ); + double well_segment_get_length( const well_segment_type * segment ); + double well_segment_get_total_length( const well_segment_type * segment ); + double well_segment_get_diameter( const well_segment_type * segment ); + + UTIL_IS_INSTANCE_HEADER( well_segment ); + +#ifdef __cplusplus +} +#endif +#endif diff --git a/ThirdParty/Ert/devel/libecl_well/include/ert/ecl_well/well_segment_collection.h b/ThirdParty/Ert/devel/libecl_well/include/ert/ecl_well/well_segment_collection.h new file mode 100644 index 0000000000..3a2e1b8deb --- /dev/null +++ b/ThirdParty/Ert/devel/libecl_well/include/ert/ecl_well/well_segment_collection.h @@ -0,0 +1,60 @@ +/* + Copyright (C) 2013 Statoil ASA, Norway. + + The file 'well_segment_collection.h' 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 + for more details. +*/ + + +#ifndef __WELL_SEGMENT_COLLECTION_H__ +#define __WELL_SEGMENT_COLLECTION_H__ + + +#ifdef __cplusplus +extern "C" { +#endif + +#include + +#include + +#include +#include +#include + + typedef struct well_segment_collection_struct well_segment_collection_type; + + well_segment_collection_type * well_segment_collection_alloc(); + void well_segment_collection_free(well_segment_collection_type * segment_collection ); + int well_segment_collection_get_size( const well_segment_collection_type * segment_collection ); + void well_segment_collection_add( well_segment_collection_type * segment_collection , well_segment_type * segment); + bool well_segment_collection_has_segment( const well_segment_collection_type * segment_collection , int segment_id); + well_segment_type * well_segment_collection_get( const well_segment_collection_type * segment_collection , int segment_id); + well_segment_type * well_segment_collection_iget( const well_segment_collection_type * segment_collection , int index); + int well_segment_collection_load_from_kw( well_segment_collection_type * segment_collection , int well_nr , + const ecl_kw_type * iwel_kw , + const ecl_kw_type * iseg_kw , + const ecl_kw_type * rseg_kw , + const ecl_rsthead_type * rst_head); + void well_segment_collection_link(const well_segment_collection_type * segment_collection); + void well_segment_collection_add_connections(well_segment_collection_type * segment_collection , + const char * grid_name , + const well_conn_collection_type * connections); + void well_segment_collection_add_branches( const well_segment_collection_type * segment_collection , + well_branch_collection_type * branches ); + +#ifdef __cplusplus +} +#endif +#endif diff --git a/ThirdParty/Ert/devel/libecl_well/include/ert/ecl_well/well_state.h b/ThirdParty/Ert/devel/libecl_well/include/ert/ecl_well/well_state.h index 0db96bc313..8481573e8c 100644 --- a/ThirdParty/Ert/devel/libecl_well/include/ert/ecl_well/well_state.h +++ b/ThirdParty/Ert/devel/libecl_well/include/ert/ecl_well/well_state.h @@ -27,16 +27,37 @@ extern "C" { #include #include +#include #include #include +#include +#include +#include #define GLOBAL_GRID_NAME "GLOBAL" // The name assigned to the global grid for name based lookup. typedef struct well_state_struct well_state_type; - well_state_type * well_state_alloc( ecl_file_type * ecl_file , int report_step , int well_nr); + well_state_type * well_state_alloc(const char * well_name , int global_well_nr , bool open, well_type_enum type , int report_nr, time_t valid_from); + well_state_type * well_state_alloc_from_file( ecl_file_type * ecl_file , const ecl_grid_type * grid , int report_step , int well_nr); + + void well_state_add_connections( well_state_type * well_state , + const ecl_grid_type * grid , + ecl_file_type * rst_file , + int well_nr); + + bool well_state_add_MSW( well_state_type * well_state , + const ecl_file_type * rst_file , + int well_nr); + + bool well_state_is_MSW( const well_state_type * well_state); + + well_segment_collection_type * well_state_get_segments( const well_state_type * well_state ); + well_branch_collection_type * well_state_get_branches( const well_state_type * well_state ); + + void well_state_free( well_state_type * well ); const char * well_state_get_name( const well_state_type * well ); int well_state_get_report_nr( const well_state_type * well_state ); @@ -44,24 +65,18 @@ extern "C" { well_conn_type * well_state_iget_connection( const well_state_type * well_state , int index); well_type_enum well_state_get_type( const well_state_type * well_state); bool well_state_is_open( const well_state_type * well_state ); - + int well_state_get_well_nr( const well_state_type * well_state ); + const well_conn_type * well_state_iget_wellhead( const well_state_type * well_state , int grid_nr); const well_conn_type * well_state_get_wellhead( const well_state_type * well_state , const char * grid_name); - - const well_conn_type ** well_state_iget_lgr_connections(const well_state_type * well_state , int grid_nr , int branch_nr ); - const well_conn_type ** well_state_get_lgr_connections(const well_state_type * well_state , const char * lgr_name , int branch_nr); - const well_conn_type ** well_state_get_connections(const well_state_type * well_state , int branch_nr ); - - int well_state_iget_num_lgr_connections(const well_state_type * well_state , int grid_nr , int branch_nr ); - int well_state_get_num_lgr_connections(const well_state_type * well_state , const char * lgr_name , int branch_nr); - int well_state_get_num_connections(const well_state_type * well_state , int branch_nr ); - - int well_state_iget_lgr_num_branches( const well_state_type * well_state , int grid_nr); - int well_state_get_lgr_num_branches( const well_state_type * well_state , const char * lgr_name); - int well_state_get_num_branches(const well_state_type * well_state ); - void well_state_summarize( const well_state_type * well_state , FILE * stream ); + well_type_enum well_state_translate_ecl_type_int(int int_type); + + const well_conn_collection_type * well_state_get_grid_connections( const well_state_type * well_state , const char * grid_name); + const well_conn_collection_type * well_state_get_global_connections( const well_state_type * well_state ); + bool well_state_has_grid_connections( const well_state_type * well_state , const char * grid_name); + bool well_state_has_global_connections( const well_state_type * well_state ); UTIL_IS_INSTANCE_HEADER( well_state ); diff --git a/ThirdParty/Ert/devel/libecl_well/src/CMakeLists.txt b/ThirdParty/Ert/devel/libecl_well/src/CMakeLists.txt index 59182ea3c8..19b908b75c 100644 --- a/ThirdParty/Ert/devel/libecl_well/src/CMakeLists.txt +++ b/ThirdParty/Ert/devel/libecl_well/src/CMakeLists.txt @@ -1,5 +1,10 @@ -set( source_files well_state.c well_conn.c well_info.c well_ts.c well_branch.c well_path.c ) -set( header_files well_state.h well_const.h well_conn.h well_info.h well_ts.h well_branch.h well_path.h ) +set( source_files well_state.c well_conn.c well_info.c well_ts.c well_conn_collection.c well_segment.c well_segment_collection.c well_branch_collection.c) +set( header_files well_state.h well_const.h well_conn.h well_info.h well_ts.h well_conn_collection.h well_segment.h well_segment_collection.h well_branch_collection.h) + +if (NOT ERT_WINDOWS) + set_property( SOURCE well_branch_collection.c well_segment.c well_segment_collection.c well_conn_collection.c well_conn.c PROPERTY COMPILE_FLAGS "-Werror") +endif() + include_directories( ${CMAKE_CURRENT_SOURCE_DIR} ) include_directories( ${libgeometry_src_path} ) diff --git a/ThirdParty/Ert/devel/libecl_well/src/well_branch.c b/ThirdParty/Ert/devel/libecl_well/src/well_branch.c deleted file mode 100644 index dd2ccd8416..0000000000 --- a/ThirdParty/Ert/devel/libecl_well/src/well_branch.c +++ /dev/null @@ -1,103 +0,0 @@ -/* - Copyright (C) 2012 Statoil ASA, Norway. - - The file 'well_branch.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 - for more details. -*/ - -#include - -#include - -#include -#include -#include - -/* - - See also documentation on the top of well_path.c for how a path and - a branch are related. -*/ - -struct well_branch_struct { - int branch_nr; - well_conn_type ** connections; - int size; - int alloc_size; -}; - - -static void well_branch_resize( well_branch_type * branch , int new_size) { - if (new_size < branch->alloc_size) - util_abort("%s: sorry - can only grow \n",__func__); - - branch->connections = util_realloc( branch->connections , new_size * sizeof * branch->connections ); - { - int i; - for (i=branch->alloc_size; i < new_size; i++) - branch->connections[i] = NULL; - } - branch->alloc_size = new_size; -} - - -well_branch_type * well_branch_alloc(int branch_nr) { - well_branch_type * branch = util_malloc( sizeof * branch ); - branch->branch_nr = branch_nr; - branch->connections = NULL; - branch->alloc_size = 0; - branch->size = 0; - - well_branch_resize( branch , 10 ); - return branch; -} - - -void well_branch_free( well_branch_type * branch ) { - int i; - for ( i=0; i < branch->alloc_size; i++) { - well_conn_type * conn = branch->connections[i]; - if (conn != NULL) - well_conn_free( conn ); - } - free( branch->connections ); - free( branch ); -} - - -int well_branch_get_length( const well_branch_type * branch) { - return branch->size; -} - - -const well_conn_type ** well_branch_get_connections( const well_branch_type * branch ) { - if (branch->size == 0) - return NULL; - else - return (const well_conn_type **) branch->connections; -} - - -void well_branch_add_conn( well_branch_type * branch, well_conn_type * connection ) { - if (branch->size == branch->alloc_size) - well_branch_resize(branch , 2*( 1 + branch->alloc_size )); - branch->connections[ branch->size ] = connection; - branch->size++; -} - - -int well_branch_get_nr( const well_branch_type * branch ) { - return branch->branch_nr; -} - diff --git a/ThirdParty/Ert/devel/libecl_well/src/well_branch_collection.c b/ThirdParty/Ert/devel/libecl_well/src/well_branch_collection.c new file mode 100644 index 0000000000..0e514cb6fb --- /dev/null +++ b/ThirdParty/Ert/devel/libecl_well/src/well_branch_collection.c @@ -0,0 +1,117 @@ +/* + Copyright (C) 2013 Statoil ASA, Norway. + + The file 'well_branch_collection.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 + for more details. +*/ + +#include + +#include +#include +#include +#include + +#include +#include +#include + + +#define WELL_BRANCH_COLLECTION_TYPE_ID 67177087 + +struct well_branch_collection_struct { + UTIL_TYPE_ID_DECLARATION; + + vector_type * __start_segments; + int_vector_type * index_map; +}; + + +UTIL_IS_INSTANCE_FUNCTION( well_branch_collection , WELL_BRANCH_COLLECTION_TYPE_ID ) +static UTIL_SAFE_CAST_FUNCTION( well_branch_collection , WELL_BRANCH_COLLECTION_TYPE_ID ) + + +well_branch_collection_type * well_branch_collection_alloc() { + well_branch_collection_type * branch_collection = util_malloc( sizeof * branch_collection ); + UTIL_TYPE_ID_INIT( branch_collection , WELL_BRANCH_COLLECTION_TYPE_ID ); + branch_collection->__start_segments = vector_alloc_new(); + branch_collection->index_map = int_vector_alloc(0 , -1 ); + return branch_collection; +} + + + +void well_branch_collection_free( well_branch_collection_type * branches ) { + vector_free( branches->__start_segments ); + int_vector_free( branches->index_map ); + free( branches ); +} + + + +void well_branch_collection_free__( void * arg ) { + well_branch_collection_type * branches = well_branch_collection_safe_cast( arg ); + well_branch_collection_free( branches ); +} + + +int well_branch_collection_get_size( const well_branch_collection_type * branches ) { + return vector_get_size( branches->__start_segments ); +} + + +bool well_branch_collection_has_branch( const well_branch_collection_type * branches , int branch_id) { + if (int_vector_safe_iget( branches->index_map , branch_id) >= 0) + return true; + else + return false; +} + + + +const well_segment_type * well_branch_collection_iget_start_segment( const well_branch_collection_type * branches , int index ) { + if (index < vector_get_size( branches->__start_segments)) + return vector_iget_const( branches->__start_segments , index); + else + return NULL; +} + + + +const well_segment_type * well_branch_collection_get_start_segment( const well_branch_collection_type * branches , int branch_id) { + int internal_index = int_vector_safe_iget( branches->index_map , branch_id); + if (internal_index >= 0) + return well_branch_collection_iget_start_segment( branches , internal_index ); + else + return NULL; +} + + +bool well_branch_collection_add_start_segment( well_branch_collection_type * branches , const well_segment_type * start_segment) { + if ((well_segment_get_link_count( start_segment ) == 0) && (well_segment_get_outlet(start_segment))) { + int branch_id = well_segment_get_branch_id( start_segment ); + int current_index = int_vector_safe_iget( branches->index_map , branch_id); + if (current_index >= 0) + vector_iset_ref( branches->__start_segments , current_index , start_segment); + else { + int new_index = vector_get_size( branches->__start_segments ); + vector_append_ref( branches->__start_segments , start_segment); + int_vector_iset( branches->index_map , branch_id , new_index); + } + + return true; + } else + return false; +} + diff --git a/ThirdParty/Ert/devel/libecl_well/src/well_conn.c b/ThirdParty/Ert/devel/libecl_well/src/well_conn.c index 0d10cd786d..bc2e536948 100644 --- a/ThirdParty/Ert/devel/libecl_well/src/well_conn.c +++ b/ThirdParty/Ert/devel/libecl_well/src/well_conn.c @@ -17,8 +17,10 @@ */ #include +#include #include +#include #include #include @@ -26,110 +28,151 @@ #include #include + +#define WELL_CONN_NORMAL_WELL_SEGMENT_ID -999 +#define ECLIPSE_NORMAL_WELL_SEGMENT_ID -1 + /* Observe that when the (ijk) values are initialized they are shifted to zero offset values, to be aligned with the rest of the ert libraries. */ +#define WELL_CONN_TYPE_ID 702052013 + struct well_conn_struct { - int i; - int j; - int k; - well_conn_dir_enum dir; - bool open; - int segment; // -1: Ordinary well - bool matrix_connection; // k >= nz => fracture (and k -= nz ) - /*-----------------------------------------------------------------*/ - /* If the segment field == -1 - i.e. an ordinary well, the - outlet_segment is rubbish and should not be consulted. - */ - int branch; - int outlet_segment; // -1: This segment flows to the wellhead. + UTIL_TYPE_ID_DECLARATION; + int i; + int j; + int k; + well_conn_dir_enum dir; + bool open; + int segment; // -1: Ordinary well + bool matrix_connection; // k >= nz => fracture (and k -= nz ) }; -static void well_conn_set_k( well_conn_type * conn , const ecl_rsthead_type * header , int icon_k) { - conn->k = icon_k; - conn->matrix_connection = true; - if (header->dualp) { - int geometric_nz = header->nz / 2; - if (icon_k >= geometric_nz) { - conn->k -= geometric_nz; - conn->matrix_connection = false; - } - } +bool well_conn_equal( const well_conn_type *conn1 , const well_conn_type * conn2) { + if (memcmp(conn1 , conn2 , sizeof * conn1) == 0) + return true; + else + return false; } +bool well_conn_MSW( const well_conn_type * conn ) { + if (conn->segment == WELL_CONN_NORMAL_WELL_SEGMENT_ID) + return false; + else + return true; +} + +static bool well_conn_assert_direction( well_conn_dir_enum dir, bool matrix_connection) { + if ((dir == well_conn_fracX || dir == well_conn_fracY) && matrix_connection) + return false; + else + return true; +} -well_conn_type * well_conn_alloc_wellhead( const ecl_kw_type * iwel_kw , const ecl_rsthead_type * header , int well_nr) { - const int iwel_offset = header->niwelz * well_nr; - int conn_i = ecl_kw_iget_int( iwel_kw , iwel_offset + IWEL_HEADI_ITEM ); - - if (conn_i > 0) { +UTIL_IS_INSTANCE_FUNCTION( well_conn , WELL_CONN_TYPE_ID) +UTIL_SAFE_CAST_FUNCTION( well_conn , WELL_CONN_TYPE_ID) + + +static well_conn_type * well_conn_alloc__( int i , int j , int k , well_conn_dir_enum dir , bool open, int segment_id, bool matrix_connection) { + if (well_conn_assert_direction( dir , matrix_connection)) { well_conn_type * conn = util_malloc( sizeof * conn ); + UTIL_TYPE_ID_INIT( conn , WELL_CONN_TYPE_ID ); + conn->i = i; + conn->j = j; + conn->k = k; + conn->open = open; + conn->dir = dir; - conn->i = ecl_kw_iget_int( iwel_kw , iwel_offset + IWEL_HEADI_ITEM ) - 1; - conn->j = ecl_kw_iget_int( iwel_kw , iwel_offset + IWEL_HEADJ_ITEM ) - 1; - { - int icon_k = ecl_kw_iget_int( iwel_kw , iwel_offset + IWEL_HEADK_ITEM ) - 1; - well_conn_set_k( conn , header , icon_k); - } - - conn->open = true; // This is not really specified anywhere. - conn->branch = 0; - conn->segment = 0; - conn->outlet_segment = 0; + conn->matrix_connection = matrix_connection; + if (segment_id == ECLIPSE_NORMAL_WELL_SEGMENT_ID) + conn->segment = WELL_CONN_NORMAL_WELL_SEGMENT_ID; + else + conn->segment = segment_id; + return conn; - } else - // The well is completed in this LGR - however the wellhead is in another LGR. + } else { + printf("assert-direction failed. dir:%d matrix_connection:%d \n",dir , matrix_connection); return NULL; -} - - -static well_conn_type * well_conn_alloc__( const ecl_kw_type * icon_kw , const ecl_rsthead_type * header , int icon_offset) { - well_conn_type * conn = util_malloc( sizeof * conn ); - - conn->i = ecl_kw_iget_int( icon_kw , icon_offset + ICON_I_ITEM ) - 1; - conn->j = ecl_kw_iget_int( icon_kw , icon_offset + ICON_J_ITEM ) - 1; - { - int icon_k = ecl_kw_iget_int( icon_kw , icon_offset + ICON_K_ITEM ) - 1; - well_conn_set_k( conn , header , icon_k); } - - conn->segment = ecl_kw_iget_int( icon_kw , icon_offset + ICON_SEGMENT_ITEM ) - 1; - - conn->outlet_segment = -999; - conn->branch = -999; - return conn; } + +well_conn_type * well_conn_alloc( int i , int j , int k , well_conn_dir_enum dir , bool open) { + return well_conn_alloc__(i , j , k , dir , open , WELL_CONN_NORMAL_WELL_SEGMENT_ID , true ); +} + + + +well_conn_type * well_conn_alloc_MSW( int i , int j , int k , well_conn_dir_enum dir , bool open, int segment) { + return well_conn_alloc__(i , j , k , dir , open , segment , true ); +} + + + +well_conn_type * well_conn_alloc_fracture( int i , int j , int k , well_conn_dir_enum dir , bool open) { + return well_conn_alloc__(i , j , k , dir , open , WELL_CONN_NORMAL_WELL_SEGMENT_ID , false); +} + + + +well_conn_type * well_conn_alloc_fracture_MSW( int i , int j , int k , well_conn_dir_enum dir , bool open, int segment) { + return well_conn_alloc__(i , j , k , dir , open , segment , false); +} + + + + /* Observe that the (ijk) and branch values are shifted to zero offset to be aligned with the rest of the ert libraries. */ -well_conn_type * well_conn_alloc( const ecl_kw_type * icon_kw , - const ecl_kw_type * iseg_kw , - const ecl_rsthead_type * header , - int well_nr , - int seg_well_nr , - int conn_nr ) { +well_conn_type * well_conn_alloc_from_kw( const ecl_kw_type * icon_kw , + const ecl_rsthead_type * header , + int well_nr , + int conn_nr ) { const int icon_offset = header->niconz * ( header->ncwmax * well_nr + conn_nr ); int IC = ecl_kw_iget_int( icon_kw , icon_offset + ICON_IC_ITEM ); if (IC > 0) { - well_conn_type * conn = well_conn_alloc__( icon_kw , header , icon_offset ); + well_conn_type * conn; + int i = ecl_kw_iget_int( icon_kw , icon_offset + ICON_I_ITEM ) - 1; + int j = ecl_kw_iget_int( icon_kw , icon_offset + ICON_J_ITEM ) - 1; + int k = ecl_kw_iget_int( icon_kw , icon_offset + ICON_K_ITEM ) - 1; + int segment = ecl_kw_iget_int( icon_kw , icon_offset + ICON_SEGMENT_ITEM ) - 1; + bool matrix_connection = true; + bool open; + well_conn_dir_enum dir = well_conn_fracX; + + /* Set the status */ { int int_status = ecl_kw_iget_int( icon_kw , icon_offset + ICON_STATUS_ITEM ); if (int_status > 0) - conn->open = true; + open = true; else - conn->open = false; + open = false; } + + /* Set the K value and fracture flag. */ + { + if (header->dualp) { + int geometric_nz = header->nz / 2; + if (k >= geometric_nz) { + k -= geometric_nz; + matrix_connection = false; + } + } + } + + + /* Set the direction flag */ { int int_direction = ecl_kw_iget_int( icon_kw , icon_offset + ICON_DIRECTION_ITEM ); if (int_direction == ICON_DEFAULT_DIR_VALUE) @@ -137,25 +180,27 @@ well_conn_type * well_conn_alloc( const ecl_kw_type * icon_kw , switch (int_direction) { case(ICON_DIRX): - conn->dir = well_conn_dirX; + dir = well_conn_dirX; break; case(ICON_DIRY): - conn->dir = well_conn_dirY; + dir = well_conn_dirY; break; case(ICON_DIRZ): - conn->dir = well_conn_dirZ; + dir = well_conn_dirZ; break; case(ICON_FRACX): - conn->dir = well_conn_fracX; + dir = well_conn_fracX; break; case(ICON_FRACY): - conn->dir = well_conn_fracY; + dir = well_conn_fracY; break; default: util_abort("%s: icon direction value:%d not recognized\n",__func__ , int_direction); } } - + + conn = well_conn_alloc__(i,j,k,dir,open,segment,matrix_connection); + /** For multisegmented wells ONLY the global part of the restart file has segment information, i.e. the ?SEG @@ -163,8 +208,9 @@ well_conn_type * well_conn_alloc( const ecl_kw_type * icon_kw , MSW + LGR well. */ + /* if (iseg_kw != NULL) { - if (conn->segment >= 0) { + if (conn->segment != WELL_CONN_NORMAL_WELL_SEGMENT_ID) { const int iseg_offset = header->nisegz * ( header->nsegmx * seg_well_nr + conn->segment ); conn->outlet_segment = ecl_kw_iget_int( iseg_kw , iseg_offset + ISEG_OUTLET_ITEM ); conn->branch = ecl_kw_iget_int( iseg_kw , iseg_offset + ISEG_BRANCH_ITEM ); @@ -176,7 +222,8 @@ well_conn_type * well_conn_alloc( const ecl_kw_type * icon_kw , conn->branch = 0; conn->outlet_segment = 0; } - + */ + return conn; } else return NULL; /* IC < 0: Connection not in current LGR. */ @@ -189,11 +236,42 @@ void well_conn_free( well_conn_type * conn) { void well_conn_free__( void * arg ) { - well_conn_type * conn = (well_conn_type *) arg; + well_conn_type * conn = well_conn_safe_cast( arg ); well_conn_free( conn ); } +well_conn_type * well_conn_alloc_wellhead( const ecl_kw_type * iwel_kw , const ecl_rsthead_type * header , int well_nr) { + const int iwel_offset = header->niwelz * well_nr; + int conn_i = ecl_kw_iget_int( iwel_kw , iwel_offset + IWEL_HEADI_ITEM ) - 1; + + if (conn_i >= 0) { + //well_conn_type * conn = util_malloc( sizeof * conn ); + int conn_j = ecl_kw_iget_int( iwel_kw , iwel_offset + IWEL_HEADJ_ITEM ) - 1; + int conn_k = ecl_kw_iget_int( iwel_kw , iwel_offset + IWEL_HEADK_ITEM ) - 1; + bool matrix_connection = true; + bool open = true; + + if (header->dualp) { + int geometric_nz = header->nz / 2; + if (conn_k >= geometric_nz) { + conn_k -= geometric_nz; + matrix_connection = false; + } + } + + if (matrix_connection) + return well_conn_alloc( conn_i , conn_j , conn_k , open , well_conn_dirZ ); + else + return well_conn_alloc_fracture( conn_i , conn_j , conn_k , open , well_conn_dirZ ); + } else + // The well is completed in this LGR - however the wellhead is in another LGR. + return NULL; +} + + + + /*****************************************************************/ @@ -210,9 +288,6 @@ int well_conn_get_k(const well_conn_type * conn) { } -int well_conn_get_branch(const well_conn_type * conn) { - return conn->branch; -} well_conn_dir_enum well_conn_get_dir(const well_conn_type * conn) { return conn->dir; @@ -222,6 +297,7 @@ bool well_conn_open( const well_conn_type * conn ) { return conn->open; } + int well_conn_get_segment( const well_conn_type * conn ) { return conn->segment; } diff --git a/ThirdParty/Ert/devel/libecl_well/src/well_conn_collection.c b/ThirdParty/Ert/devel/libecl_well/src/well_conn_collection.c new file mode 100644 index 0000000000..f409566517 --- /dev/null +++ b/ThirdParty/Ert/devel/libecl_well/src/well_conn_collection.c @@ -0,0 +1,115 @@ +/* + Copyright (C) 2013 Statoil ASA, Norway. + + The file 'well_conn_collection.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 + for more details. +*/ + +#include + +#include +#include +#include + +#include +#include + +#include +#include +#include + + +#define WELL_CONN_COLLECTION_TYPE_ID 67150087 + +struct well_conn_collection_struct { + UTIL_TYPE_ID_DECLARATION; + vector_type * connection_list; +}; + + +UTIL_IS_INSTANCE_FUNCTION( well_conn_collection , WELL_CONN_COLLECTION_TYPE_ID ) +static UTIL_SAFE_CAST_FUNCTION( well_conn_collection , WELL_CONN_COLLECTION_TYPE_ID ) + + +well_conn_collection_type * well_conn_collection_alloc() { + well_conn_collection_type * wellcc = util_malloc( sizeof * wellcc ); + UTIL_TYPE_ID_INIT( wellcc , WELL_CONN_COLLECTION_TYPE_ID ); + wellcc->connection_list = vector_alloc_new(); + return wellcc; +} + +/* + The collection takes ownership of the connection object and frees it + when the collection is discarded. +*/ + +void well_conn_collection_add( well_conn_collection_type * wellcc , well_conn_type * conn) { + vector_append_owned_ref( wellcc->connection_list , conn , well_conn_free__); +} + +/* + The collection only stores a refernce to the object, which will be destroyed by 'someone else'. +*/ + +void well_conn_collection_add_ref( well_conn_collection_type * wellcc , well_conn_type * conn) { + vector_append_ref( wellcc->connection_list , conn ); +} + + +void well_conn_collection_free( well_conn_collection_type * wellcc ) { + vector_free( wellcc->connection_list ); + free( wellcc ); +} + +void well_conn_collection_free__( void * arg ) { + well_conn_collection_type * wellcc = well_conn_collection_safe_cast( arg ); + well_conn_collection_free( wellcc ); +} + + +int well_conn_collection_get_size( const well_conn_collection_type * wellcc ) { + return vector_get_size( wellcc->connection_list ); +} + + +const well_conn_type * well_conn_collection_iget_const(const well_conn_collection_type * wellcc , int index) { + int size = well_conn_collection_get_size( wellcc ); + if (index < size) + return vector_iget_const( wellcc->connection_list , index ); + else + return NULL; +} + +well_conn_type * well_conn_collection_iget(const well_conn_collection_type * wellcc , int index) { + int size = well_conn_collection_get_size( wellcc ); + if (index < size) + return vector_iget( wellcc->connection_list , index ); + else + return NULL; +} + + +int well_conn_collection_load_from_kw( well_conn_collection_type * wellcc , const ecl_kw_type * iwel_kw , const ecl_kw_type * icon_kw , int iwell , const ecl_rsthead_type * rst_head) { + const int iwel_offset = rst_head->niwelz * iwell; + int num_connections = ecl_kw_iget_int( iwel_kw , iwel_offset + IWEL_CONNECTIONS_ITEM ); + int iconn; + + for (iconn = 0; iconn < num_connections; iconn++) { + well_conn_type * conn = well_conn_alloc_from_kw( icon_kw , rst_head , iwell , iconn ); + if (conn) + well_conn_collection_add( wellcc , conn ); + } + return num_connections; +} + diff --git a/ThirdParty/Ert/devel/libecl_well/src/well_info.c b/ThirdParty/Ert/devel/libecl_well/src/well_info.c index 4c2c13abed..4980c22ded 100644 --- a/ThirdParty/Ert/devel/libecl_well/src/well_info.c +++ b/ThirdParty/Ert/devel/libecl_well/src/well_info.c @@ -52,22 +52,9 @@ contains a time series for one well. well_state_type: The well_state_type datatype contains the - state/properties of one well at one particular instant of time. - - well_path_type: The well_path_type datatype hold information about - the path of the well, i.e. which cells it goes through. The - well_path_type instance is for one grid only; and if the well - goes through LGRs the well_state instance contains one - well_path instance for the global grid and additional well_path - instances for each LGR. - - well_branch_type: The wells can be split into several - branches. The well_branch_type datatype contain a collection of - well connections which form a 1-dimensional segment. - - well_conn_type: This is the connection of a well to one cell. This - datatype is exported, i.e. calling scope can inspect - (read-only!) the members of a well_conn_type instance. + state/properties of one well at one particular instant of + time. The well_state.c file contains further documentation of + the concepts connections, branches and segments. WELL1 @@ -279,18 +266,18 @@ static void well_info_add_state( well_info_type * well_info , well_state_type * by calling this function repeatedly. This function will go through all the wells by number and call the - well_state_alloc() function to create a well state object for each - well. The well_state_alloc() function will iterate through all the + well_state_alloc_from_file() function to create a well state object for each + well. The well_state_alloc_from_file() function will iterate through all the grids and assign well properties corresponding to each of the grids, the global grid special-cased to determine is consulted to determine the number of wells. */ void well_info_add_wells( well_info_type * well_info , ecl_file_type * rst_file , int report_nr) { - ecl_rsthead_type * global_header = ecl_rsthead_alloc( rst_file ); int well_nr; + ecl_rsthead_type * global_header = ecl_rsthead_alloc( rst_file ); for (well_nr = 0; well_nr < global_header->nwells; well_nr++) { - well_state_type * well_state = well_state_alloc( rst_file , report_nr , well_nr ); + well_state_type * well_state = well_state_alloc_from_file( rst_file , well_info->grid , report_nr , well_nr ); if (well_state != NULL) well_info_add_state( well_info , well_state ); } @@ -340,7 +327,7 @@ void well_info_load_rstfile( well_info_type * well_info , const char * filename) well_info_add_wells( well_info , ecl_file , report_nr ); else well_info_add_UNRST_wells( well_info , ecl_file ); - + ecl_file_close( ecl_file ); } else util_abort("%s: invalid file type:%s - must be a restart file\n",__func__ , filename); diff --git a/ThirdParty/Ert/devel/libecl_well/src/well_path.c b/ThirdParty/Ert/devel/libecl_well/src/well_path.c deleted file mode 100644 index 72208435fb..0000000000 --- a/ThirdParty/Ert/devel/libecl_well/src/well_path.c +++ /dev/null @@ -1,185 +0,0 @@ -/* - Copyright (C) 2012 Statoil ASA, Norway. - - The file 'well_path.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 - for more details. -*/ - -#include - -#include - -#include -#include -#include -#include - -/* - This file implements the well_path structure which is container for - the grid connections for one grid realisation; i.e. if the well is - perforated in LGRs in addition to the global grid the parent - well_state structure will have several well_path instances - one for - the global grid and one for each LGR. - - The well_path structure consist of one or several well_branch_type - instances; the well_branch is a collection of cells which are - connected on a 1D line. - - --------------D - / - / - A---------------B----------C - - - All of this figure is one well; how this structure is connected to - one particular grid is described by the well_path structure in this - file. The current well consist of two branches: A-B-C and B-D; these - are two well_branch instance in the well_path structure. -*/ - - -#define WELL_PATH_TYPE_ID 91916433 - -struct well_path_struct { - UTIL_TYPE_ID_DECLARATION; - char * grid_name; // Will be NULL for 'null_path' construction in the well_state object. - well_branch_type ** branches; - int max_branches; // This might be misleading due to NULL pointers 'inside' the branches array. - int alloc_size; -}; - - - -static void well_path_resize( well_path_type * well_path , int new_size) { - well_path->branches = util_realloc( well_path->branches , new_size * sizeof * well_path->branches ); - { - int i; - for (i=well_path->alloc_size; i < new_size; i++) - well_path->branches[i] = NULL; - } - - well_path->alloc_size = new_size; -} - -static UTIL_SAFE_CAST_FUNCTION( well_path , WELL_PATH_TYPE_ID ) - -well_path_type * well_path_alloc(const char * grid_name) { - well_path_type * well_path = util_malloc( sizeof * well_path ); - UTIL_TYPE_ID_INIT( well_path , WELL_PATH_TYPE_ID ); - well_path->grid_name = util_alloc_string_copy( grid_name ); - well_path->branches = NULL; - well_path->max_branches = 0; - well_path->alloc_size = 0; - well_path_resize( well_path , 4 ); - return well_path; -} - - - -well_branch_type * well_path_add_branch( well_path_type * well_path , int branch_nr) { - - well_branch_type * new_branch = well_branch_alloc( branch_nr ); - if (branch_nr >= well_path->alloc_size) - well_path_resize( well_path , 2 * branch_nr ); - - well_path->branches[ branch_nr ] = new_branch; - if (branch_nr >= well_path->max_branches) - well_path->max_branches = branch_nr + 1; - - return new_branch; -} - - -bool well_path_has_branch( const well_path_type * well_path , int branch_nr ) { - if (branch_nr >= 0 && branch_nr < well_path->max_branches) { - well_branch_type * branch = well_path->branches[ branch_nr ]; - if (branch != NULL) - return true; - else - return false; - } else - return false; -} - -/** - This will return the maximum branch number; there can be holes in - the branches array: - - branches = [ branch0, NULL , branch1 , NULL , branch3] - - In this case the the well_path_get_max_branches() will return five; - however there are only three active branches in this case. The - alternative function well_path_get_num_active_branches() will count - the number of active (i.e. != NULL) branches. -*/ -int well_path_get_max_branches( const well_path_type * well_path ) { - return well_path->max_branches; -} - - -int well_path_get_num_active_branches( const well_path_type * well_path) { - int branch_nr; - int num_active = 0; - for (branch_nr = 0; branch_nr < well_path->max_branches; branch_nr++) - if (well_path->branches[ branch_nr ] != NULL) - num_active++; - return num_active; -} - - - -/** - Will return NULL if the branch does not exist. -*/ - -well_branch_type * well_path_iget_branch( const well_path_type * well_path , int branch_nr) { - if (well_path_has_branch( well_path , branch_nr )) - return well_path->branches[ branch_nr ]; - else - return NULL; -} - - -void well_path_add_conn( well_path_type * well_path , well_conn_type * conn) { - int branch_nr = well_conn_get_branch( conn ); - if (!well_path_has_branch( well_path , branch_nr)) - well_path_add_branch( well_path , branch_nr ); - { - well_branch_type * branch = well_path_iget_branch( well_path , branch_nr ); - well_branch_add_conn( branch , conn ); - } -} - - -void well_path_free( well_path_type * well_path ) { - int i; - for (i=0; i < well_path->alloc_size; i++) { - if (well_path->branches[i] != NULL) - well_branch_free( well_path->branches[i] ); - } - util_safe_free( well_path->grid_name ); - free( well_path->branches ); - free( well_path ); -} - -void well_path_free__(void * arg) { - well_path_type * well_path = well_path_safe_cast( arg ); - well_path_free( well_path ); -} - - - -const char * well_path_get_grid_name( const well_path_type * well_path ) { - return well_path->grid_name; -} diff --git a/ThirdParty/Ert/devel/libecl_well/src/well_segment.c b/ThirdParty/Ert/devel/libecl_well/src/well_segment.c new file mode 100644 index 0000000000..90bf94a281 --- /dev/null +++ b/ThirdParty/Ert/devel/libecl_well/src/well_segment.c @@ -0,0 +1,249 @@ +/* + Copyright (C) 2013 Statoil ASA, Norway. + + The file 'well_segment.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 + for more details. +*/ + +#include + +#include +#include + +#include +#include +#include + +#include +#include +#include +#include + +#define WELL_SEGMENT_TYPE_ID 2209166 + +struct well_segment_struct { + UTIL_TYPE_ID_DECLARATION; + int link_count; + int segment_id; + int branch_id; + int outlet_segment_id; // This is in the global index space given by the ISEG keyword. + well_segment_type * outlet_segment; + hash_type * connections; // hash_type; + + double depth; // The depth of the segment node; furthest away from the wellhead. + double length; + double total_length; // Total length from wellhead. + double diameter; // The tube diametere available for flow. +}; + + +UTIL_IS_INSTANCE_FUNCTION( well_segment , WELL_SEGMENT_TYPE_ID ) +static UTIL_SAFE_CAST_FUNCTION( well_segment , WELL_SEGMENT_TYPE_ID ) + + +well_segment_type * well_segment_alloc(int segment_id , int outlet_segment_id , int branch_id , const double * rseg_data) { + well_segment_type * segment = util_malloc( sizeof * segment ); + UTIL_TYPE_ID_INIT( segment , WELL_SEGMENT_TYPE_ID ); + + segment->link_count = 0; + segment->segment_id = segment_id; + segment->outlet_segment_id = outlet_segment_id; + segment->branch_id = branch_id; + segment->outlet_segment = NULL; + segment->connections = hash_alloc(); + + segment->depth = rseg_data[ RSEG_DEPTH_INDEX ]; + segment->length = rseg_data[ RSEG_LENGTH_INDEX ]; + segment->total_length = rseg_data[ RSEG_TOTAL_LENGTH_INDEX ]; + segment->diameter = rseg_data[ RSEG_DIAMETER_INDEX ]; + + return segment; +} + + +well_segment_type * well_segment_alloc_from_kw( const ecl_kw_type * iseg_kw , const ecl_kw_type * rseg_kw , const ecl_rsthead_type * header , int well_nr, int segment_id) { + if (rseg_kw == NULL) { + util_abort("%s: fatal internal error - tried to create well_segment instance without RSEG keyword.\n",__func__); + return NULL; + } else { + const int iseg_offset = header->nisegz * ( header->nsegmx * well_nr + segment_id); + const int rseg_offset = header->nrsegz * ( header->nsegmx * well_nr + segment_id); + int outlet_segment_id = ecl_kw_iget_int( iseg_kw , iseg_offset + ISEG_OUTLET_ITEM ) - 1; + int branch_id = ecl_kw_iget_int( iseg_kw , iseg_offset + ISEG_BRANCH_ITEM ) - 1; + const double * rseg_data = ecl_kw_iget_ptr( rseg_kw , rseg_offset ); + + well_segment_type * segment = well_segment_alloc( segment_id , outlet_segment_id , branch_id , rseg_data); + return segment; + } +} + + +/* + if (iseg_kw != NULL) { + if (conn->segment != WELL_CONN_NORMAL_WELL_SEGMENT_ID) { + + } else { + conn->branch = 0; + conn->outlet_segment = 0; + } + } else { + conn->branch = 0; + conn->outlet_segment = 0; + } + */ + + +void well_segment_free(well_segment_type * segment ) { + hash_free( segment->connections ); + free( segment ); +} + +void well_segment_free__(void * arg) { + well_segment_type * segment = well_segment_safe_cast( arg ); + well_segment_free( segment ); +} + + +bool well_segment_active( const well_segment_type * segment ) { + if (segment->branch_id == ECLIPSE_WELL_SEGMENT_BRANCH_INACTIVE_VALUE) + return false; + else + return true; +} + + +bool well_segment_main_stem( const well_segment_type * segment ) { + if (segment->branch_id == ECLIPSE_WELL_SEGMENT_BRANCH_MAIN_STEM_VALUE) + return true; + else + return false; +} + + +bool well_segment_nearest_wellhead( const well_segment_type * segment ) { + if (segment->outlet_segment_id == ECLIPSE_WELL_SEGMENT_OUTLET_END_VALUE) + return true; + else + return false; +} + + +int well_segment_get_link_count( const well_segment_type * segment ) { + return segment->link_count; +} + +int well_segment_get_branch_id( const well_segment_type * segment ) { + return segment->branch_id; +} + +int well_segment_get_outlet_id( const well_segment_type * segment ) { + return segment->outlet_segment_id; +} + +int well_segment_get_id( const well_segment_type * segment ) { + return segment->segment_id; +} + + +well_segment_type * well_segment_get_outlet( const well_segment_type * segment ) { + return segment->outlet_segment; +} + + +bool well_segment_link( well_segment_type * segment , well_segment_type * outlet_segment ) { + if (segment->outlet_segment_id == outlet_segment->segment_id) { + segment->outlet_segment = outlet_segment; + outlet_segment->link_count++; + return true; + } else + /* + This is a quite fatal topological error - and aborting is probaly the wisest + thing to do. I.e. the function well_segment_link_strict() is recommended. + */ + return false; +} + + +void well_segment_link_strict( well_segment_type * segment , well_segment_type * outlet_segment ) { + if (!well_segment_link( segment , outlet_segment)) + util_abort("%s: tried to create invalid link between segments %d and %d \n",segment->segment_id , outlet_segment->segment_id); +} + + + +bool well_segment_has_grid_connections( const well_segment_type * segment , const char * grid_name) { + return hash_has_key( segment->connections , grid_name ); +} + + +bool well_segment_has_global_grid_connections( const well_segment_type * segment) { + return well_segment_has_grid_connections( segment , ECL_GRID_GLOBAL_GRID ); +} + + +bool well_segment_add_connection( well_segment_type * segment , const char * grid_name , well_conn_type * conn) { + int conn_segment_id = well_conn_get_segment( conn ); + if (conn_segment_id == segment->segment_id) { + if (!well_segment_has_grid_connections( segment , grid_name )) + hash_insert_hash_owned_ref( segment->connections , grid_name , well_conn_collection_alloc() , well_conn_collection_free__ ); + + { + well_conn_collection_type * connections = hash_get( segment->connections , grid_name ); + well_conn_collection_add_ref( connections , conn ); + } + return true; + } else + return false; +} + + +const well_conn_collection_type * well_segment_get_connections(const well_segment_type * segment , const char * grid_name ) { + if (well_segment_has_grid_connections( segment , grid_name)) + return hash_get( segment->connections , grid_name); + else + return NULL; +} + + +const well_conn_collection_type * well_segment_get_global_connections(const well_segment_type * segment ) { + return well_segment_get_connections( segment , ECL_GRID_GLOBAL_GRID ); +} + + +bool well_segment_well_is_MSW(int well_nr , const ecl_kw_type * iwel_kw , const ecl_rsthead_type * rst_head) { + int iwel_offset = rst_head->niwelz * well_nr; + int segment_well_nr = ecl_kw_iget_int( iwel_kw , iwel_offset + IWEL_SEGMENTED_WELL_NR_ITEM) - 1; + + if (segment_well_nr == IWEL_SEGMENTED_WELL_NR_NORMAL_VALUE) + return false; + else + return true; +} + + +double well_segment_get_depth( const well_segment_type * segment ) { + return segment->depth; +} + +double well_segment_get_length( const well_segment_type * segment ) { + return segment->length; +} + +double well_segment_get_total_length( const well_segment_type * segment ) { + return segment->total_length; +} + +double well_segment_get_diameter( const well_segment_type * segment ) { + return segment->diameter; +} diff --git a/ThirdParty/Ert/devel/libecl_well/src/well_segment_collection.c b/ThirdParty/Ert/devel/libecl_well/src/well_segment_collection.c new file mode 100644 index 0000000000..403c373de7 --- /dev/null +++ b/ThirdParty/Ert/devel/libecl_well/src/well_segment_collection.c @@ -0,0 +1,169 @@ +/* + Copyright (C) 2013 Statoil ASA, Norway. + + The file 'well_segment_collection.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 + for more details. +*/ + +#include + +#include +#include + +#include +#include + +#include +#include +#include +#include +#include +#include + + +struct well_segment_collection_struct { + int_vector_type * segment_index_map; + vector_type * __segment_storage; +}; + + + +well_segment_collection_type * well_segment_collection_alloc() { + well_segment_collection_type * segment_collection = util_malloc( sizeof * segment_collection ); + + segment_collection->__segment_storage = vector_alloc_new(); + segment_collection->segment_index_map = int_vector_alloc( 0 , -1 ); + return segment_collection; +} + + + +void well_segment_collection_free(well_segment_collection_type * segment_collection ) { + vector_free( segment_collection->__segment_storage ); + int_vector_free( segment_collection->segment_index_map ); + free( segment_collection ); +} + + + +int well_segment_collection_get_size( const well_segment_collection_type * segment_collection ) { + return vector_get_size( segment_collection->__segment_storage ); +} + + +void well_segment_collection_add( well_segment_collection_type * segment_collection , well_segment_type * segment) { + int segment_id = well_segment_get_id( segment ); + int current_index = int_vector_safe_iget( segment_collection->segment_index_map , segment_id ); + if (current_index >= 0) + vector_iset_owned_ref( segment_collection->__segment_storage , current_index , segment , well_segment_free__); + else { + int new_index = vector_get_size(segment_collection->__segment_storage); + vector_append_owned_ref( segment_collection->__segment_storage , segment , well_segment_free__); + int_vector_iset( segment_collection->segment_index_map , segment_id , new_index); + } +} + + + +well_segment_type * well_segment_collection_iget( const well_segment_collection_type * segment_collection , int index) { + return vector_iget( segment_collection->__segment_storage , index ); +} + + +well_segment_type * well_segment_collection_get( const well_segment_collection_type * segment_collection , int segment_id) { + int internal_index = int_vector_safe_iget( segment_collection->segment_index_map , segment_id ); + if (internal_index >= 0) + return well_segment_collection_iget( segment_collection , internal_index ); + else + return NULL; +} + + +bool well_segment_collection_has_segment( const well_segment_collection_type * segment_collection , int segment_id) { + int internal_index = int_vector_safe_iget( segment_collection->segment_index_map , segment_id ); + if (internal_index >= 0) + return true; + else + return false; +} + + + +int well_segment_collection_load_from_kw( well_segment_collection_type * segment_collection , int well_nr , + const ecl_kw_type * iwel_kw , + const ecl_kw_type * iseg_kw , + const ecl_kw_type * rseg_kw , + const ecl_rsthead_type * rst_head) { + + int iwel_offset = rst_head->niwelz * well_nr; + int segment_well_nr = ecl_kw_iget_int( iwel_kw , iwel_offset + IWEL_SEGMENTED_WELL_NR_ITEM) - 1; + int segments_added = 0; + + if (segment_well_nr != IWEL_SEGMENTED_WELL_NR_NORMAL_VALUE) { + int segment_id; + for (segment_id = 0; segment_id < rst_head->nsegmx; segment_id++) { + well_segment_type * segment = well_segment_alloc_from_kw( iseg_kw , rseg_kw , rst_head , segment_well_nr , segment_id ); + + if (well_segment_active( segment )) { + well_segment_collection_add( segment_collection , segment ); + segments_added++; + } else + well_segment_free( segment ); + } + } + + return segments_added; +} + + +void well_segment_collection_link(const well_segment_collection_type * segment_collection) { + int index; + for (index = 0; index < vector_get_size( segment_collection->__segment_storage); index++) { + well_segment_type * segment = well_segment_collection_iget( segment_collection , index ); + int outlet_segment_id = well_segment_get_outlet_id( segment ); + if (!well_segment_nearest_wellhead(segment)) { + well_segment_type * target_segment = well_segment_collection_get( segment_collection , outlet_segment_id ); + well_segment_link( segment , target_segment ); + } + } +} + + + +void well_segment_collection_add_connections(well_segment_collection_type * segment_collection , + const char * grid_name , + const well_conn_collection_type * connections) { + int iconn; + for (iconn = 0; iconn < well_conn_collection_get_size( connections ); iconn++) { + well_conn_type * conn = well_conn_collection_iget( connections , iconn ); + if (well_conn_MSW( conn )) { + int segment_id = well_conn_get_segment( conn ); + well_segment_type * segment = well_segment_collection_get( segment_collection , segment_id ); + well_segment_add_connection( segment , grid_name , conn ); + } + } +} + + + +void well_segment_collection_add_branches( const well_segment_collection_type * segment_collection , + well_branch_collection_type * branches ) { + int iseg; + for (iseg =0; iseg < well_segment_collection_get_size( segment_collection ); iseg++) { + const well_segment_type * segment = well_segment_collection_iget( segment_collection , iseg ); + if (well_segment_get_link_count( segment ) == 0) + well_branch_collection_add_start_segment( branches , segment ); + } +} + diff --git a/ThirdParty/Ert/devel/libecl_well/src/well_state.c b/ThirdParty/Ert/devel/libecl_well/src/well_state.c index 2212050578..0f792c7b10 100644 --- a/ThirdParty/Ert/devel/libecl_well/src/well_state.c +++ b/ThirdParty/Ert/devel/libecl_well/src/well_state.c @@ -1,19 +1,19 @@ /* - Copyright (C) 2011 Statoil ASA, Norway. - - The file 'well_state.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 - for more details. + Copyright (C) 2011 Statoil ASA, Norway. + + The file 'well_state.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 + for more details. */ /** @@ -36,11 +36,126 @@ #include #include #include +#include #include #include #include -#include +#include +#include + +/* + +Connections, segments and branches +---------------------------------- + + + +-----+ + | | <- Wellhead + | | + +-----+ _________ Segment 2 + |\ / + | \/ Segment 1 Segment 0 + | \-----0---------------0--<----------------------O <-- Branch: 0 + \ | | | | + \ +-----+ +-----++-----+ +-----+ + \ | C3 | | C2 || C1 | | C0 | + \ | | | || | | | + \ +-----+ +-----++-----+ +-----+ + \ +Segment 5 \ + \ + \ Segment 4 Segment 3 + \-<--O-------<-------O----------------<------------O <-- Branch: 1 + | | | | + +-----+ +-----+ +-----+ +-----+ + | C7 | | C6 | | C5 | | C4 | + | | | | | | | | + +-----+ +-----+ +-----+ +-----+ + + + + +The boxes show connections C0 - C7; the connections serve as sinks (or +sources in the case of injectors) removing fluids from the +reservoir. As ind icated by the use of isolated boxes the ECLIPSE model +contains no geomtric concept linking the different connections into a +connected 'well-like' object. + +Ordinary wells in the ECLIPSE model are just a collection of +connections like these illustrated boxes, and to draw a connected 1D +object heuristics of some kind must be used to determine how the +various connections should be connected. In particular for wells which +consist of multiple branches this heuristic is non obvious. + +More advanced (i.e. newer) wells are modelles as multisegment wells; +the important thing about multisegment wells is that the 1D segments +constituting the flowpipe are modelled explicitly as 'segments', and +the equations of fluid flow are solved by ECLIPSE in these 1D +domains. The figure above shows a multisegment well with six segments +marked as Segment0 ... Segment5. The segments themselves are quite +abstract objects not directly linked to the grid, but indriectly +through the connections. In the figure the segment <-> connection +links are as follows: + + Segment0: C0, C1 + Segment1: C2 + Segment2: C3 + Segment3: C4, C5 + Segment4: C6 + Segment5: C7 + +Each segment has an outlet segment, which will link the segments +together into a geometry. + +The connection can in general be both to the main global grid, and to +an LGR. Hence all questions about connections must be LGR aware. This +is in contrast to the segments and branches which are geometric +objects, not directly coupled to a specific grid; however the segments +have a collection of connections - and these connections are of course +coupledte implementation these objects are modelled as such: + + 1. The well_state has hash table which is indexed by LGR name, and + the values are well_conn_collection instances. The + well_conn_collection type is a quite simple collection which can + tell how may connections there are, and index based lookup: + + + well_conn_collection_type * connections = well_state_get_grid_connections( well_state , LGR_NAME); + if (connections) { + well_conn_type * conn = well_conn_collection_iget( connections , 0 ); + printf("Have %d connections \n",well_conn_collection_get_size( connections ); + } + + The connections to the global grid are stored with the 'LGR' name + given by the symbole ECL_GRID_GLOBAL_GRID, or alternatively the + function well_state_get_global_connections( well_state ) can be + used. + + + + 2. If - AND ONLY IF - the well is a multisegment well, you can query + the well_state object for information about segments and branches: + + if (well_state_is_MSW( well_state )) { + well_segment_collection_type * segments = well_state_get_segments( well_state ); + well_branch_collection_type * branches = well_state_get_branches( well_state ); + int branch_nr; + + for (branch_nr = 0; branch_nr < well_branch_collection_get_size( branches ); branch_nr++) { + well_segment_type * segment = well_branch_collection_iget_start_segment( branches , branhc_nr ); + while (segment) { + // Inspect the current segment. + segment = well_segment_get_outlet( segment ); + } + } + } + + + + +*/ + #define WELL_STATE_TYPE_ID 613307832 @@ -49,16 +164,18 @@ struct well_state_struct { char * name; time_t valid_from_time; int valid_from_report; + int global_well_nr; bool open; well_type_enum type; - - well_path_type * null_path; // This is a valid - empty path instance returned when the well does not have any cells in a particular LGR. + + hash_type * connections; // hash + well_segment_collection_type * segments; + well_branch_collection_type * branches; + + /*****************************************************************/ vector_type * index_wellhead; // An well_conn_type instance representing the wellhead - indexed by grid_nr. hash_type * name_wellhead; // An well_conn_type instance representing the wellhead - indexed by lgr_name. - - vector_type * index_lgr_path; // Contains the various well_path instances indexed by grid_nr - global has grid_nr == 0. - hash_type * name_lgr_path; // Contains the different well_path instances indexed by lgr_name }; @@ -66,34 +183,30 @@ struct well_state_struct { UTIL_IS_INSTANCE_FUNCTION( well_state , WELL_STATE_TYPE_ID) -static well_state_type * well_state_alloc_empty() { +well_state_type * well_state_alloc(const char * well_name , int global_well_nr , bool open, well_type_enum type , int report_nr, time_t valid_from) { well_state_type * well_state = util_malloc( sizeof * well_state ); UTIL_TYPE_ID_INIT( well_state , WELL_STATE_TYPE_ID ); - well_state->index_lgr_path = vector_alloc_new(); - well_state->name_lgr_path = hash_alloc(); - well_state->index_wellhead = vector_alloc_new(); well_state->name_wellhead = hash_alloc(); - well_state->null_path = well_path_alloc( NULL ); + well_state->name = util_alloc_string_copy( well_name ); + well_state->valid_from_time = valid_from; + well_state->valid_from_report = report_nr; + well_state->open = open; + well_state->type = type; + well_state->global_well_nr = global_well_nr; + well_state->connections = hash_alloc(); + well_state->segments = well_segment_collection_alloc(); + well_state->branches = well_branch_collection_alloc(); + + /* See documentation of the 'IWEL_UNDOCUMENTED_ZERO' in well_const.h */ + if ((type == UNDOCUMENTED_ZERO) && open) + util_abort("%s: Invalid type value for open wells.\n",__func__ ); return well_state; } -/* - This function assumes that the ecl_file state has been restricted - to one LGR block with the ecl_file_subselect_block() function. -*/ -well_path_type * well_state_add_path( well_state_type * well_state , const ecl_file_type * rst_file , const char * grid_name , int grid_nr) { - well_path_type * well_path; - well_path = well_path_alloc( grid_name ); - - vector_safe_iset_owned_ref( well_state->index_lgr_path , grid_nr , well_path , well_path_free__); - hash_insert_ref( well_state->name_lgr_path , grid_name , well_path ); - - return well_path; -} void well_state_add_wellhead( well_state_type * well_state , const ecl_rsthead_type * header , const ecl_kw_type * iwel_kw , int well_nr , const char * grid_name , int grid_nr) { @@ -103,72 +216,26 @@ void well_state_add_wellhead( well_state_type * well_state , const ecl_rsthead_t vector_safe_iset_owned_ref( well_state->index_wellhead , grid_nr , wellhead , well_conn_free__ ); hash_insert_ref( well_state->name_wellhead , grid_name , wellhead ); } - + } -/* - This function assumes that the ecl_file state has been restricted - to one LGR block with the ecl_file_subselect_block() function. -*/ -static void well_state_add_connections( well_state_type * well_state , const ecl_file_type * rst_file , int grid_nr, int well_nr ) { - ecl_rsthead_type * header = ecl_rsthead_alloc( rst_file ); - const ecl_kw_type * icon_kw = ecl_file_iget_named_kw( rst_file , ICON_KW , 0); - const ecl_kw_type * iwel_kw = ecl_file_iget_named_kw( rst_file , IWEL_KW , 0); - const int iwel_offset = header->niwelz * well_nr; - int num_connections = ecl_kw_iget_int( iwel_kw , iwel_offset + IWEL_CONNECTIONS_ITEM ); - ecl_kw_type * iseg_kw = NULL; - bool MSW = false; // MultiSegmentWell - int seg_well_nr = ecl_kw_iget_int( iwel_kw , iwel_offset + IWEL_SEGMENTED_WELL_NR_ITEM) - 1; // -1: Ordinary well. - well_path_type * path; - - { - char * grid_name; - - if (grid_nr > 0) { - const ecl_kw_type * lgr_kw = ecl_file_iget_named_kw( rst_file , LGR_KW , 0 ); - grid_name = util_alloc_strip_copy(ecl_kw_iget_ptr( lgr_kw , 0)); - } else - grid_name = util_alloc_string_copy( GLOBAL_GRID_NAME ); - - path = well_state_add_path( well_state , rst_file , grid_name , grid_nr ); - well_state_add_wellhead( well_state , header , iwel_kw , well_nr , grid_name , grid_nr ); - free( grid_name ); - } - - /* The MSW information is only attached to the global grid. */ - if (seg_well_nr >= 0 && grid_nr == 0) - MSW = true; - - if (MSW) - iseg_kw = ecl_file_iget_named_kw( rst_file , ISEG_KW , 0 ); - - { - int conn_nr; - for (conn_nr = 0; conn_nr < num_connections; conn_nr++) { - well_conn_type * conn = well_conn_alloc( icon_kw , iseg_kw , header , well_nr , seg_well_nr , conn_nr ); - if (conn != NULL) - well_path_add_conn( path , conn ); - } - } - ecl_rsthead_free( header ); -} /* This function assumes that the ecl_file state has been restricted to one LGR block with the ecl_file_subselect_block() function. Return value: -1 means that the well is not found in this LGR at - all. + all. */ static int well_state_get_lgr_well_nr( const well_state_type * well_state , const ecl_file_type * ecl_file) { int well_nr = -1; - + if (ecl_file_has_kw( ecl_file , ZWEL_KW)) { - ecl_rsthead_type * header = ecl_rsthead_alloc( ecl_file ); // - const ecl_kw_type * zwel_kw = ecl_file_iget_named_kw( ecl_file , ZWEL_KW , 0); + ecl_rsthead_type * header = ecl_rsthead_alloc( ecl_file ); + const ecl_kw_type * zwel_kw = ecl_file_iget_named_kw( ecl_file , ZWEL_KW , 0 ); int num_wells = header->nwells; well_nr = 0; while (true) { @@ -180,10 +247,10 @@ static int well_state_get_lgr_well_nr( const well_state_type * well_state , cons found = true; else well_nr++; - + free( lgr_well_name ); } - + if (found) break; else if (well_nr == num_wells) { @@ -191,7 +258,7 @@ static int well_state_get_lgr_well_nr( const well_state_type * well_state , cons well_nr = -1; break; } - + } ecl_rsthead_free( header ); } @@ -199,97 +266,217 @@ static int well_state_get_lgr_well_nr( const well_state_type * well_state , cons } -well_state_type * well_state_alloc( ecl_file_type * ecl_file , int report_nr , int global_well_nr) { + +well_type_enum well_state_translate_ecl_type_int(int int_type) { + well_type_enum type = UNDOCUMENTED_ZERO; + + switch (int_type) { + /* See documentation of the 'IWEL_UNDOCUMENTED_ZERO' in well_const.h */ + case(IWEL_UNDOCUMENTED_ZERO): + type = UNDOCUMENTED_ZERO; + break; + case(IWEL_PRODUCER): + type = PRODUCER; + break; + case(IWEL_OIL_INJECTOR): + type = OIL_INJECTOR; + break; + case(IWEL_GAS_INJECTOR): + type = GAS_INJECTOR; + break; + case(IWEL_WATER_INJECTOR): + type = WATER_INJECTOR; + break; + default: + util_abort("%s: Invalid type value %d\n",__func__ , int_type); + } + return type; +} + + + +/* + This function assumes that the ecl_file state has been restricted + to one LGR block with the ecl_file_subselect_block() function. +*/ + +static void well_state_add_connections__( well_state_type * well_state , + const ecl_file_type * rst_file , + const char * grid_name , + int grid_nr, + int well_nr ) { + + ecl_rsthead_type * header = ecl_rsthead_alloc( rst_file ); + const ecl_kw_type * icon_kw = ecl_file_iget_named_kw( rst_file , ICON_KW , 0); + const ecl_kw_type * iwel_kw = ecl_file_iget_named_kw( rst_file , IWEL_KW , 0); + + //const int iwel_offset = header->niwelz * well_nr; + //int seg_well_nr = ecl_kw_iget_int( iwel_kw , iwel_offset + IWEL_SEGMENTED_WELL_NR_ITEM) - 1; // -1: Ordinary well. + + well_state_add_wellhead( well_state , header , iwel_kw , well_nr , grid_name , grid_nr ); + + if (!well_state_has_grid_connections( well_state , grid_name )) + hash_insert_hash_owned_ref( well_state->connections , grid_name, well_conn_collection_alloc( ) , well_conn_collection_free__ ); + + { + well_conn_collection_type * wellcc = hash_get( well_state->connections , grid_name ); + well_conn_collection_load_from_kw( wellcc , iwel_kw , icon_kw , well_nr , header ); + } + ecl_rsthead_free( header ); +} + + +static void well_state_add_global_connections( well_state_type * well_state , + const ecl_file_type * rst_file , + int well_nr ) { + well_state_add_connections__( well_state , rst_file , ECL_GRID_GLOBAL_GRID , 0 , well_nr ); +} + +static void well_state_add_LGR_connections( well_state_type * well_state , const ecl_grid_type * grid , ecl_file_type * ecl_file, int global_well_nr ) { + // Go through all the LGRs and add connections; both in the bulk + // grid and as wellhead. + int num_lgr = ecl_grid_get_num_lgr( grid ); + int lgr_nr; + for (lgr_nr = 0; lgr_nr < num_lgr; lgr_nr++) { + ecl_file_push_block( ecl_file ); // <-------------------------// + { // + ecl_file_subselect_block( ecl_file , LGR_KW , lgr_nr ); // + { // Restrict the file view + const char * grid_name = ecl_grid_iget_lgr_name( grid , lgr_nr ); // + int well_nr = well_state_get_lgr_well_nr( well_state , ecl_file ); // to one LGR block. + if (well_nr >= 0) // + well_state_add_connections__( well_state , ecl_file , grid_name , lgr_nr + 1, well_nr ); // + } // + } // + ecl_file_pop_block( ecl_file ); // <-------------------------// + } +} + + + +void well_state_add_connections( well_state_type * well_state , + const ecl_grid_type * grid , + ecl_file_type * rst_file , // Either an open .Xnnnn file or UNRST file restricted to one report step + int well_nr) { + + well_state_add_global_connections( well_state , rst_file , well_nr ); + well_state_add_LGR_connections( well_state , grid , rst_file , well_nr ); + +} + + +bool well_state_add_MSW( well_state_type * well_state , + const ecl_file_type * rst_file , + int well_nr) { + + if (ecl_file_has_kw( rst_file , ISEG_KW)) { + ecl_rsthead_type * rst_head = ecl_rsthead_alloc( rst_file ); + const ecl_kw_type * iwel_kw = ecl_file_iget_named_kw( rst_file , IWEL_KW , 0); + const ecl_kw_type * iseg_kw = ecl_file_iget_named_kw( rst_file , ISEG_KW , 0); + ecl_kw_type * rseg_kw = NULL; + + int segments; + + if (ecl_file_has_kw( rst_file , RSEG_KW )) + /* + Here we check that the file has the RSEG_KW keyword, and pass + NULL if not. The rseg_kw pointer will later be used in + well_segment_collection_load_from_kw() where we test if this + is a MSW well. If this indeed is a MSW well the rseg_kw + pointer will be used unchecked, if it is then NULL => Crash + and burn. + */ + rseg_kw = ecl_file_iget_named_kw( rst_file , RSEG_KW , 0); + + segments = well_segment_collection_load_from_kw( well_state->segments , + well_nr , + iwel_kw , + iseg_kw , + rseg_kw , + rst_head); + + if (segments) { + hash_iter_type * grid_iter = hash_iter_alloc( well_state->connections ); + while (!hash_iter_is_complete( grid_iter )) { + const char * grid_name = hash_iter_get_next_key( grid_iter ); + const well_conn_collection_type * connections = hash_get( well_state->connections , grid_name ); + well_segment_collection_add_connections( well_state->segments , grid_name , connections ); + } + hash_iter_free( grid_iter ); + well_segment_collection_link( well_state->segments ); + well_segment_collection_add_branches( well_state->segments , well_state->branches ); + } + ecl_rsthead_free( rst_head ); + return true; + } else + return false; +} + + +bool well_state_is_MSW( const well_state_type * well_state) { + if (well_segment_collection_get_size( well_state->segments ) > 0) + return true; + else + return false; +} + + +well_state_type * well_state_alloc_from_file( ecl_file_type * ecl_file , const ecl_grid_type * grid , int report_nr , int global_well_nr) { if (ecl_file_has_kw( ecl_file , IWEL_KW)) { well_state_type * well_state = NULL; ecl_rsthead_type * global_header = ecl_rsthead_alloc( ecl_file ); const ecl_kw_type * global_iwel_kw = ecl_file_iget_named_kw( ecl_file , IWEL_KW , 0); const ecl_kw_type * global_zwel_kw = ecl_file_iget_named_kw( ecl_file , ZWEL_KW , 0); - + const int iwel_offset = global_header->niwelz * global_well_nr; { - const int zwel_offset = global_header->nzwelz * global_well_nr; - well_state = well_state_alloc_empty(); - - well_state->valid_from_time = global_header->sim_time; - well_state->valid_from_report = report_nr; - well_state->name = util_alloc_strip_copy(ecl_kw_iget_ptr( global_zwel_kw , zwel_offset )); // Hardwired max 8 characters in Well Name - + char * name; + bool open; + well_type_enum type = UNDOCUMENTED_ZERO; { int int_state = ecl_kw_iget_int( global_iwel_kw , iwel_offset + IWEL_STATUS_ITEM ); if (int_state > 0) - well_state->open = true; + open = true; else - well_state->open = false; + open = false; } - + { int int_type = ecl_kw_iget_int( global_iwel_kw , iwel_offset + IWEL_TYPE_ITEM); - switch (int_type) { - /* See documentation of the 'IWEL_UNDOCUMENTED_ZERO' in well_const.h */ - case(IWEL_UNDOCUMENTED_ZERO): - well_state->type = UNDOCUMENTED_ZERO; - if (well_state->open) - util_abort("%s: Invalid type value %d\n",__func__ , int_type); - break; - case(IWEL_PRODUCER): - well_state->type = PRODUCER; - break; - case(IWEL_OIL_INJECTOR): - well_state->type = OIL_INJECTOR; - break; - case(IWEL_GAS_INJECTOR): - well_state->type = GAS_INJECTOR; - break; - case(IWEL_WATER_INJECTOR): - well_state->type = WATER_INJECTOR; - break; - default: - util_abort("%s: Invalid type value %d\n",__func__ , int_type); - } + type = well_state_translate_ecl_type_int( int_type ); } - - - // Add global connections: - well_state_add_connections( well_state , ecl_file , 0 , global_well_nr ); - - - - // Go through all the LGRs and add connections; both in the bulk - // grid and as wellhead. - + { - int num_lgr = ecl_file_get_num_named_kw( ecl_file , LGR_KW ); - int lgr_nr; - for (lgr_nr = 0; lgr_nr < num_lgr; lgr_nr++) { - ecl_file_push_block( ecl_file ); // <-------------------- - { // - ecl_file_subselect_block( ecl_file , LGR_KW , lgr_nr ); // - { // Restrict the file view - int well_nr = well_state_get_lgr_well_nr( well_state , ecl_file); // to one LGR block. - if (well_nr >= 0) // - well_state_add_connections( well_state , ecl_file , lgr_nr + 1, well_nr ); // - } // - } // - ecl_file_pop_block( ecl_file ); // <-------------------- - } + const int zwel_offset = global_header->nzwelz * global_well_nr; + name = util_alloc_strip_copy(ecl_kw_iget_ptr( global_zwel_kw , zwel_offset )); // Hardwired max 8 characters in Well Name } - } + + well_state = well_state_alloc(name , global_well_nr , open , type , report_nr , global_header->sim_time); + free( name ); + + well_state_add_connections( well_state , grid , ecl_file , global_well_nr); + if (ecl_file_has_kw( ecl_file , ISEG_KW)) + well_state_add_MSW( well_state , ecl_file , global_well_nr ); + } ecl_rsthead_free( global_header ); return well_state; - } else + } else /* This seems a bit weird - have come over E300 restart files without the IWEL keyword. */ return NULL; } -void well_state_free( well_state_type * well ) { - hash_free( well->name_lgr_path ); - vector_free( well->index_lgr_path ); + + + + + +void well_state_free( well_state_type * well ) { hash_free( well->name_wellhead ); vector_free( well->index_wellhead ); - - well_path_free( well->null_path ); + hash_free( well->connections ); + well_segment_collection_free( well->segments ); + well_branch_collection_free( well->branches ); free( well->name ); free( well ); @@ -321,7 +508,7 @@ const well_conn_type * well_state_get_wellhead( const well_state_type * well_sta } -well_type_enum well_state_get_type( const well_state_type * well_state){ +well_type_enum well_state_get_type( const well_state_type * well_state){ return well_state->type; } @@ -329,146 +516,54 @@ bool well_state_is_open( const well_state_type * well_state ) { return well_state->open; } +int well_state_get_well_nr( const well_state_type * well_state ) { + return well_state->global_well_nr; +} + + const char * well_state_get_name( const well_state_type * well_state ) { return well_state->name; } -/*****************************************************************/ - -well_path_type * well_state_get_path( const well_state_type * well_state , const char * lgr_name) { - if (hash_has_key( well_state->name_lgr_path , lgr_name)) - return hash_get( well_state->name_lgr_path , lgr_name ); - else - return well_state->null_path; -} - -well_path_type * well_state_iget_path( const well_state_type * well_state , int grid_nr) { - well_path_type * path = vector_safe_iget( well_state->index_lgr_path , grid_nr ); - if (path != NULL) - return path; - else - return well_state->null_path; -} - - -const well_conn_type ** well_state_iget_lgr_connections(const well_state_type * well_state , int grid_nr , int branch_nr ) { - well_path_type * well_path = well_state_iget_path( well_state , grid_nr ); - well_branch_type * branch = well_path_iget_branch( well_path , branch_nr ); - - if (branch != NULL) - return well_branch_get_connections( branch ); - else - return NULL; // Branch does not exist - or has 0 connections. -} - - -const well_conn_type ** well_state_get_lgr_connections(const well_state_type * well_state , const char * lgr_name , int branch_nr) { - well_path_type * well_path = well_state_get_path( well_state , lgr_name ); - well_branch_type * branch = well_path_iget_branch( well_path , branch_nr ); - if (branch != NULL) - return well_branch_get_connections( branch ); - else - return NULL; // Branch does not exist - or has 0 connections. -} - - -const well_conn_type ** well_state_get_connections(const well_state_type * well_state , int branch_nr ) { - return well_state_iget_lgr_connections(well_state , 0 , branch_nr ); -} - -/*****************************************************************/ - -int well_state_iget_num_lgr_connections(const well_state_type * well_state , int grid_nr , int branch_nr ) { - well_path_type * well_path = well_state_iget_path( well_state , grid_nr ); - well_branch_type * branch = well_path_iget_branch( well_path , branch_nr ); - if (branch != NULL) - return well_branch_get_length( branch ); - else - return 0; -} - -int well_state_get_num_lgr_connections(const well_state_type * well_state , const char * lgr_name , int branch_nr) { - well_path_type * well_path = well_state_get_path( well_state , lgr_name ); - well_branch_type * branch = well_path_iget_branch( well_path , branch_nr ); - if (branch != NULL) - return well_branch_get_length( branch ); - else - return 0; -} - - -int well_state_get_num_connections(const well_state_type * well_state , int branch_nr ) { - return well_state_iget_num_lgr_connections(well_state , 0 , branch_nr ); -} - -/*****************************************************************/ - -int well_state_iget_lgr_num_branches( const well_state_type * well_state , int grid_nr) { - well_path_type * well_path = well_state_iget_path( well_state , grid_nr ); - return well_path_get_max_branches( well_path ); -} - -int well_state_get_lgr_num_branches( const well_state_type * well_state , const char * lgr_name) { - well_path_type * well_path = well_state_get_path( well_state , lgr_name ); - return well_path_get_max_branches( well_path ); -} - - -int well_state_get_num_branches(const well_state_type * well_state ) { - return well_state_iget_lgr_num_branches( well_state , 0 ); -} - -/*****************************************************************/ - -int well_state_get_num_paths( const well_state_type * well_state ) { - return vector_get_size( well_state->index_lgr_path ); -} /*****************************************************************/ void well_state_summarize( const well_state_type * well_state , FILE * stream ) { - fprintf(stream , "Well: %s \n" , well_state->name ); - { - int grid_nr; - for (grid_nr=0; grid_nr < well_state_get_num_paths( well_state ); grid_nr++) { - well_path_type * well_path = well_state_iget_path(well_state , grid_nr ); - if (well_path_get_grid_name( well_path ) != NULL) { - fprintf(stream , " Grid: %-8s\n",well_path_get_grid_name( well_path )); - - { - const well_conn_type * global_head = well_state_iget_wellhead( well_state , grid_nr ); - if (global_head != NULL) - fprintf(stream , " Wellhead: (%3d,%3d,%3d)\n" , well_conn_get_i( global_head ) , well_conn_get_j(global_head) , well_conn_get_k( global_head) ); - else - fprintf(stream , " Wellhead: ------------\n" ); - } - - { - int num_branches = well_path_get_max_branches(well_path); - int branch_nr; - for (branch_nr = 0; branch_nr < num_branches; branch_nr++) { - well_branch_type * branch = well_path_iget_branch( well_path , branch_nr ); - if (branch != NULL) { - const well_conn_type ** connections = well_branch_get_connections( branch ); - int num_connections = well_branch_get_length( branch ); - int iconn; - - fprintf(stream , " Branch %2d: [" , branch_nr ); - for (iconn=0; iconn < num_connections; iconn++) { - const well_conn_type * conn = connections[ iconn ]; - fprintf(stream, "(%3d,%3d,%3d)",well_conn_get_i( conn ) , well_conn_get_j( conn ), well_conn_get_k( conn )); - if (iconn == (num_connections - 1)) - fprintf(stream , "]\n"); - else { - fprintf(stream , ", "); - if ((iconn + 1) % 10 == 0) - fprintf(stream , "\n "); - } - } - } - } - } - } - } - } } + + +const well_conn_collection_type * well_state_get_grid_connections( const well_state_type * well_state , const char * grid_name) { + if (hash_has_key( well_state->connections , grid_name)) + return hash_get( well_state->connections , grid_name); + else + return NULL; +} + + +const well_conn_collection_type * well_state_get_global_connections( const well_state_type * well_state ) { + return well_state_get_grid_connections( well_state , ECL_GRID_GLOBAL_GRID ); +} + + +bool well_state_has_grid_connections( const well_state_type * well_state , const char * grid_name) { + if (hash_has_key( well_state->connections , grid_name)) + return true; + else + return false; +} + + +bool well_state_has_global_connections( const well_state_type * well_state ) { + return well_state_has_grid_connections( well_state , ECL_GRID_GLOBAL_GRID ); +} + + +well_segment_collection_type * well_state_get_segments( const well_state_type * well_state ) { + return well_state->segments; +} + + +well_branch_collection_type * well_state_get_branches( const well_state_type * well_state ) { + return well_state->branches; +} + diff --git a/ThirdParty/Ert/devel/libecl_well/tests/CMakeLists.txt b/ThirdParty/Ert/devel/libecl_well/tests/CMakeLists.txt index d17c7ee460..7c47c45ef9 100644 --- a/ThirdParty/Ert/devel/libecl_well/tests/CMakeLists.txt +++ b/ThirdParty/Ert/devel/libecl_well/tests/CMakeLists.txt @@ -1,3 +1,97 @@ +add_executable( well_conn_collection well_conn_collection.c ) +target_link_libraries( well_conn_collection ecl_well ) +set_target_properties( well_conn_collection PROPERTIES COMPILE_FLAGS "-Werror") +add_test( well_conn_collection ${EXECUTABLE_OUTPUT_PATH}/well_conn_collection ) + +add_executable( well_branch_collection well_branch_collection.c ) +target_link_libraries( well_branch_collection ecl_well ) +set_target_properties( well_branch_collection PROPERTIES COMPILE_FLAGS "-Werror") +add_test( well_branch_collection ${EXECUTABLE_OUTPUT_PATH}/well_branch_collection ) + +add_executable( well_conn well_conn.c ) +target_link_libraries( well_conn ecl_well ) +set_target_properties( well_conn PROPERTIES COMPILE_FLAGS "-Werror") +add_test( well_conn ${EXECUTABLE_OUTPUT_PATH}/well_conn ) + +add_executable( well_state well_state.c ) +target_link_libraries( well_state ecl_well ) +set_target_properties( well_state PROPERTIES COMPILE_FLAGS "-Werror") +add_test( well_state ${EXECUTABLE_OUTPUT_PATH}/well_state ) + +add_executable( well_state_load well_state_load.c ) +target_link_libraries( well_state_load ecl_well ) +set_target_properties( well_state_load PROPERTIES COMPILE_FLAGS "-Werror") + +add_executable( well_state_load_missing_RSEG well_state_load_missing_RSEG.c ) +target_link_libraries( well_state_load_missing_RSEG ecl_well ) +set_target_properties( well_state_load_missing_RSEG PROPERTIES COMPILE_FLAGS "-Werror") + + +add_test( well_state_load1 ${EXECUTABLE_OUTPUT_PATH}/well_state_load ${PROJECT_SOURCE_DIR}/test-data/Statoil/ECLIPSE/Gurbat/ECLIPSE.EGRID + ${PROJECT_SOURCE_DIR}/test-data/Statoil/ECLIPSE/Gurbat/ECLIPSE.X0030) + +add_test( well_state_load2 ${EXECUTABLE_OUTPUT_PATH}/well_state_load ${PROJECT_SOURCE_DIR}/test-data/Statoil/ECLIPSE/MSWcase/MSW_CASE.EGRID + ${PROJECT_SOURCE_DIR}/test-data/Statoil/ECLIPSE/MSWcase/MSW_CASE.X0021) + +add_test( well_state_load3 ${EXECUTABLE_OUTPUT_PATH}/well_state_load ${PROJECT_SOURCE_DIR}/test-data/Statoil/ECLIPSE/Troll/MSW/MSW.EGRID + ${PROJECT_SOURCE_DIR}/test-data/Statoil/ECLIPSE/Troll/MSW/MSW.X0123) + +add_test( well_state_load4 ${EXECUTABLE_OUTPUT_PATH}/well_state_load ${PROJECT_SOURCE_DIR}/test-data/Statoil/ECLIPSE/Troll/MSW_LGR/LGR.EGRID + ${PROJECT_SOURCE_DIR}/test-data/Statoil/ECLIPSE/Troll/MSW_LGR/LGR.X0095) + +add_test( well_state_load5 ${EXECUTABLE_OUTPUT_PATH}/well_state_load ${PROJECT_SOURCE_DIR}/test-data/Statoil/ECLIPSE/10kcase/TEST10K_FLT_LGR_NNC.EGRID + ${PROJECT_SOURCE_DIR}/test-data/Statoil/ECLIPSE/10kcase/TEST10K_FLT_LGR_NNC.X0061) + +add_test( well_state_load_missing_RSEG1 ${EXECUTABLE_OUTPUT_PATH}/well_state_load_missing_RSEG ${PROJECT_SOURCE_DIR}/test-data/Statoil/ECLIPSE/10kcase/TEST10K_FLT_LGR_NNC.EGRID + ${PROJECT_SOURCE_DIR}/test-data/Statoil/ECLIPSE/10kcase/TEST10K_FLT_LGR_NNC.X0061) + +add_test( well_state_load_missing_RSEG2 ${EXECUTABLE_OUTPUT_PATH}/well_state_load_missing_RSEG ${PROJECT_SOURCE_DIR}/test-data/Statoil/ECLIPSE/Troll/MSW/MSW.EGRID + ${PROJECT_SOURCE_DIR}/test-data/Statoil/ECLIPSE/Troll/MSW/MSW.X0123) + + +add_executable( well_segment well_segment.c ) +target_link_libraries( well_segment ecl_well ) +set_target_properties( well_segment PROPERTIES COMPILE_FLAGS "-Werror") +add_test( well_segment ${EXECUTABLE_OUTPUT_PATH}/well_segment ) + +add_executable( well_segment_conn well_segment_conn.c ) +target_link_libraries( well_segment_conn ecl_well ) +set_target_properties( well_segment_conn PROPERTIES COMPILE_FLAGS "-Werror") +add_test( well_segment_conn ${EXECUTABLE_OUTPUT_PATH}/well_segment_conn ) + +add_executable( well_segment_load well_segment_load.c ) +target_link_libraries( well_segment_load ecl_well ) +set_target_properties( well_segment_load PROPERTIES COMPILE_FLAGS "-Werror") +add_test( well_segment_load ${EXECUTABLE_OUTPUT_PATH}/well_segment_load ${PROJECT_SOURCE_DIR}/test-data/Statoil/ECLIPSE/MSWcase/MSW_CASE.X0021) + + +add_executable( well_segment_branch_conn_load well_segment_branch_conn_load.c ) +target_link_libraries( well_segment_branch_conn_load ecl_well ) +set_target_properties( well_segment_branch_conn_load PROPERTIES COMPILE_FLAGS "-Werror") +add_test( well_segment_branch_conn_load ${EXECUTABLE_OUTPUT_PATH}/well_segment_branch_conn_load ${PROJECT_SOURCE_DIR}/test-data/Statoil/ECLIPSE/MSWcase/MSW_CASE.X0021) + +add_executable( well_info well_info.c ) +target_link_libraries( well_info ecl_well ) +set_target_properties( well_info PROPERTIES COMPILE_FLAGS "-Werror") +add_test( well_info ${EXECUTABLE_OUTPUT_PATH}/well_info ${PROJECT_SOURCE_DIR}/test-data/Statoil/ECLIPSE/Gurbat/ECLIPSE.EGRID ) + + +add_executable( well_segment_collection well_segment_collection.c ) +target_link_libraries( well_segment_collection ecl_well ) +set_target_properties( well_segment_collection PROPERTIES COMPILE_FLAGS "-Werror") +add_test( well_segment_collection ${EXECUTABLE_OUTPUT_PATH}/well_segment_collection ) + + +add_executable( well_conn_load well_conn_load.c ) +target_link_libraries( well_conn_load ecl_well ) +set_target_properties( well_conn_load PROPERTIES COMPILE_FLAGS "-Werror") +add_test( well_conn_load1 ${EXECUTABLE_OUTPUT_PATH}/well_conn_load ${PROJECT_SOURCE_DIR}/test-data/Statoil/ECLIPSE/Gurbat/ECLIPSE.X0030 F) +add_test( well_conn_load2 ${EXECUTABLE_OUTPUT_PATH}/well_conn_load ${PROJECT_SOURCE_DIR}/test-data/Statoil/ECLIPSE/10kcase/TEST10K_FLT_LGR_NNC.X0021 F) +add_test( well_conn_load3 ${EXECUTABLE_OUTPUT_PATH}/well_conn_load ${PROJECT_SOURCE_DIR}/test-data/Statoil/ECLIPSE/MSWcase/MSW_CASE.X0021 T) +add_test( well_conn_load4 ${EXECUTABLE_OUTPUT_PATH}/well_conn_load ${PROJECT_SOURCE_DIR}/test-data/Statoil/ECLIPSE/AmalgLGRcase/TESTCASE_AMALG_LGR.X0021 F) +add_test( well_conn_load5 ${EXECUTABLE_OUTPUT_PATH}/well_conn_load ${PROJECT_SOURCE_DIR}/test-data/Statoil/ECLIPSE/DualPoro/DUALPORO.X0009 F) +add_test( well_conn_load6 ${EXECUTABLE_OUTPUT_PATH}/well_conn_load ${PROJECT_SOURCE_DIR}/test-data/Statoil/ECLIPSE/0.9.2_LGR/BASE_REF_XY3Z1_T30_WI.X0003 F) + add_executable( well_ts well_ts.c ) target_link_libraries( well_ts ecl_well ) add_test( well_ts ${EXECUTABLE_OUTPUT_PATH}/well_ts ${PROJECT_SOURCE_DIR}/test-data/Statoil/ECLIPSE/CO2case/BASE_CASE ) @@ -12,10 +106,27 @@ add_test( well_dualp ${EXECUTABLE_OUTPUT_PATH}/well_dualp ${PROJECT_SOURCE_DIR} add_executable( well_lgr_load well_lgr_load.c ) target_link_libraries( well_lgr_load ecl_well ) -add_test( well_lgr_load1 ${EXECUTABLE_OUTPUT_PATH}/well_lgr_load ${PROJECT_SOURCE_DIR}/test-data/Statoil/ECLIPSE/0.9.2_LGR/BASE_REF_XY3Z1_T30_WI.X0003) -add_test( well_lgr_load2 ${EXECUTABLE_OUTPUT_PATH}/well_lgr_load ${PROJECT_SOURCE_DIR}/test-data/Statoil/ECLIPSE/AmalgLGRcase/TESTCASE_AMALG_LGR.X0016) +add_test( well_lgr_load1 ${EXECUTABLE_OUTPUT_PATH}/well_lgr_load ${PROJECT_SOURCE_DIR}/test-data/Statoil/ECLIPSE/0.9.2_LGR/BASE_REF_XY3Z1_T30_WI.EGRID ${PROJECT_SOURCE_DIR}/test-data/Statoil/ECLIPSE/0.9.2_LGR/BASE_REF_XY3Z1_T30_WI.X0003) +add_test( well_lgr_load2 ${EXECUTABLE_OUTPUT_PATH}/well_lgr_load ${PROJECT_SOURCE_DIR}/test-data/Statoil/ECLIPSE/AmalgLGRcase/TESTCASE_AMALG_LGR.EGRID ${PROJECT_SOURCE_DIR}/test-data/Statoil/ECLIPSE/AmalgLGRcase/TESTCASE_AMALG_LGR.X0016) -set_property( TEST well_lgr_load1 PROPERTY LABELS Statoil ) -set_property( TEST well_lgr_load2 PROPERTY LABELS Statoil ) -set_property( TEST well_dualp PROPERTY LABELS Statoil ) -set_property( TEST well_ts PROPERTY LABELS Statoil ) +set_property( TEST well_lgr_load1 PROPERTY LABELS StatoilData ) +set_property( TEST well_lgr_load2 PROPERTY LABELS StatoilData ) +set_property( TEST well_dualp PROPERTY LABELS StatoilData ) +set_property( TEST well_state_load1 PROPERTY LABELS StatoilData ) +set_property( TEST well_state_load2 PROPERTY LABELS StatoilData ) +set_property( TEST well_state_load3 PROPERTY LABELS StatoilData ) +set_property( TEST well_state_load4 PROPERTY LABELS StatoilData ) +set_property( TEST well_state_load5 PROPERTY LABELS StatoilData ) +set_property( TEST well_state_load_missing_RSEG1 PROPERTY LABELS StatoilData ) +set_property( TEST well_state_load_missing_RSEG2 PROPERTY LABELS StatoilData ) +set_property( TEST well_dualp PROPERTY LABELS StatoilData ) +set_property( TEST well_conn_load1 PROPERTY LABELS StatoilData ) +set_property( TEST well_conn_load2 PROPERTY LABELS StatoilData ) +set_property( TEST well_conn_load3 PROPERTY LABELS StatoilData ) +set_property( TEST well_conn_load4 PROPERTY LABELS StatoilData ) +set_property( TEST well_conn_load5 PROPERTY LABELS StatoilData ) +set_property( TEST well_conn_load6 PROPERTY LABELS StatoilData ) +set_property( TEST well_info PROPERTY LABELS StatoilData ) +set_property( TEST well_segment_load PROPERTY LABELS StatoilData ) +set_property( TEST well_segment_branch_conn_load PROPERTY LABELS StatoilData ) +set_property( TEST well_ts PROPERTY LABELS StatoilData ) diff --git a/ThirdParty/Ert/devel/libecl_well/tests/well_branch_collection.c b/ThirdParty/Ert/devel/libecl_well/tests/well_branch_collection.c new file mode 100644 index 0000000000..bd6d410d3a --- /dev/null +++ b/ThirdParty/Ert/devel/libecl_well/tests/well_branch_collection.c @@ -0,0 +1,70 @@ +/* + Copyright (C) 2013 Statoil ASA, Norway. + + The file 'well_branch_collection.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 + for more details. +*/ +#include +#include + +#include +#include +#include + +#include + + +#include +#include +#include + +int main(int argc , char ** argv) { + test_install_SIGNALS(); + + well_branch_collection_type * branches = well_branch_collection_alloc(); + double * rseg_data = util_calloc( 100 , sizeof * rseg_data ); + const double depth = 100; + const double length = 20; + const double total_length = 200; + const double diameter = 10; + + rseg_data[ RSEG_DEPTH_INDEX ] = depth; + rseg_data[ RSEG_LENGTH_INDEX ] = length; + rseg_data[ RSEG_TOTAL_LENGTH_INDEX ] = total_length; + rseg_data[ RSEG_DIAMETER_INDEX ] = diameter; + + test_assert_true( well_branch_collection_is_instance( branches )); + test_assert_int_equal( well_branch_collection_get_size( branches ) , 0 ); + test_assert_NULL( well_branch_collection_iget_start_segment( branches , 0 )); + test_assert_NULL( well_branch_collection_get_start_segment( branches , 0 )); + test_assert_false( well_branch_collection_has_branch( branches , 0 )); + { + well_segment_type * segment1 = well_segment_alloc(189 , 99 , 78 , rseg_data); + well_segment_type * segment2 = well_segment_alloc(200 , 189 , 78 , rseg_data); + + test_assert_false( well_branch_collection_add_start_segment( branches , segment1 )); + + test_assert_true( well_segment_link( segment2 , segment1 )); + test_assert_true( well_branch_collection_add_start_segment( branches , segment2 )); + + test_assert_int_equal( well_branch_collection_get_size( branches ) , 1 ); + test_assert_true( well_segment_is_instance( well_branch_collection_iget_start_segment( branches , 0 ))); + test_assert_true( well_segment_is_instance( well_branch_collection_get_start_segment( branches , 78 ))); + test_assert_true( well_branch_collection_has_branch( branches , 78 )); + + } + well_branch_collection_free( branches ); + + exit(0); +} diff --git a/ThirdParty/Ert/devel/libecl_well/tests/well_conn.c b/ThirdParty/Ert/devel/libecl_well/tests/well_conn.c new file mode 100644 index 0000000000..255aac1d8a --- /dev/null +++ b/ThirdParty/Ert/devel/libecl_well/tests/well_conn.c @@ -0,0 +1,123 @@ +/* + Copyright (C) 2013 Statoil ASA, Norway. + + The file 'well_conn.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 + for more details. +*/ +#include +#include + +#include +#include +#include + +#include + + +#include +#include + + +int main(int argc , char ** argv) { + int i = 10; + int j = 5; + int k = 16; + bool open = true; + test_install_SIGNALS(); + + { + well_conn_dir_enum dir = well_conn_dirX; + well_conn_type * conn = well_conn_alloc(i,j,k,dir,open); + well_conn_type * conn2 = well_conn_alloc(i,j,k,dir,open); + well_conn_type * conn3 = well_conn_alloc(i,j,k+1,dir,open); + test_assert_not_NULL( conn ); + test_assert_true( well_conn_is_instance( conn )); + test_assert_int_equal( i , well_conn_get_i( conn )); + test_assert_int_equal( j , well_conn_get_j( conn )); + test_assert_int_equal( k , well_conn_get_k( conn )); + test_assert_int_equal( dir , well_conn_get_dir( conn )); + test_assert_bool_equal( open , well_conn_open( conn )); + test_assert_false( well_conn_MSW( conn )); + test_assert_true( well_conn_matrix_connection( conn )); + test_assert_true( well_conn_equal( conn , conn2 )); + test_assert_false( well_conn_equal( conn , conn3 )); + well_conn_free( conn ); + } + + { + well_conn_dir_enum dir = well_conn_fracX; + well_conn_type * conn = well_conn_alloc(i,j,k,dir,open); + test_assert_NULL( conn ); + } + + + { + well_conn_dir_enum dir = well_conn_fracX; + well_conn_type * conn = well_conn_alloc_fracture(i,j,k,dir,open); + test_assert_not_NULL( conn ); + test_assert_int_equal( i , well_conn_get_i( conn )); + test_assert_int_equal( j , well_conn_get_j( conn )); + test_assert_int_equal( k , well_conn_get_k( conn )); + test_assert_bool_equal( open , well_conn_open( conn )); + test_assert_int_equal( dir , well_conn_get_dir( conn )); + test_assert_false( well_conn_MSW( conn )); + test_assert_false( well_conn_matrix_connection( conn )); + test_assert_true( well_conn_fracture_connection( conn )); + well_conn_free( conn ); + } + + + { + well_conn_dir_enum dir = well_conn_dirX; + well_conn_type * conn = well_conn_alloc_fracture(i,j,k,dir,open); + test_assert_not_NULL( conn ); + } + + { + int segment = 16; + well_conn_dir_enum dir = well_conn_dirX; + well_conn_type * conn = well_conn_alloc_MSW(i,j,k,dir,open,segment); + test_assert_not_NULL( conn ); + test_assert_int_equal( i , well_conn_get_i( conn )); + test_assert_int_equal( j , well_conn_get_j( conn )); + test_assert_int_equal( k , well_conn_get_k( conn )); + test_assert_int_equal( segment , well_conn_get_segment( conn )); + test_assert_bool_equal( open , well_conn_open( conn )); + test_assert_int_equal( dir , well_conn_get_dir( conn )); + test_assert_true( well_conn_MSW( conn )); + test_assert_true( well_conn_matrix_connection( conn )); + well_conn_free( conn ); + } + + + { + int segment = 16; + well_conn_dir_enum dir = well_conn_fracX; + well_conn_type * conn = well_conn_alloc_fracture_MSW(i,j,k,dir,open,segment); + test_assert_not_NULL( conn ); + test_assert_int_equal( i , well_conn_get_i( conn )); + test_assert_int_equal( j , well_conn_get_j( conn )); + test_assert_int_equal( k , well_conn_get_k( conn )); + test_assert_int_equal( segment , well_conn_get_segment( conn )); + test_assert_bool_equal( open , well_conn_open( conn )); + test_assert_int_equal( dir , well_conn_get_dir( conn )); + test_assert_true( well_conn_MSW( conn )); + test_assert_false( well_conn_matrix_connection( conn )); + well_conn_free( conn ); + } + + + + +} diff --git a/ThirdParty/Ert/devel/libecl_well/tests/well_conn_collection.c b/ThirdParty/Ert/devel/libecl_well/tests/well_conn_collection.c new file mode 100644 index 0000000000..41b4fa4cfe --- /dev/null +++ b/ThirdParty/Ert/devel/libecl_well/tests/well_conn_collection.c @@ -0,0 +1,55 @@ +/* + Copyright (C) 2013 Statoil ASA, Norway. + + The file 'well_conn_collection.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 + for more details. +*/ +#include +#include + +#include +#include +#include + +#include + + +#include +#include + + +void test_empty() { + well_conn_collection_type * wellcc = well_conn_collection_alloc( ); + test_assert_not_NULL( wellcc ); + test_assert_true( well_conn_collection_is_instance( wellcc )); + + test_assert_int_equal( 0 , well_conn_collection_get_size( wellcc )); + { + well_conn_type * conn = well_conn_collection_iget( wellcc , 0 ); + test_assert_NULL( conn ); + } + { + const well_conn_type * conn = well_conn_collection_iget_const( wellcc , 10 ); + test_assert_NULL( conn ); + } + + well_conn_collection_free( wellcc ); +} + + + +int main(int argc , char ** argv) { + test_empty(); + exit(0); +} diff --git a/ThirdParty/Ert/devel/libecl_well/tests/well_conn_load.c b/ThirdParty/Ert/devel/libecl_well/tests/well_conn_load.c new file mode 100644 index 0000000000..928744ec5b --- /dev/null +++ b/ThirdParty/Ert/devel/libecl_well/tests/well_conn_load.c @@ -0,0 +1,104 @@ +/* + Copyright (C) 2013 Statoil ASA, Norway. + + The file 'well_conn_load.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 + for more details. +*/ +#include +#include + +#include +#include +#include + +#include +#include +#include +#include + +#include +#include +#include + + + +int main(int argc , char ** argv) { + const char * Xfile = argv[1]; + bool MSW; + ecl_file_type * rst_file = ecl_file_open( Xfile , 0 ); + ecl_rsthead_type * rst_head = ecl_rsthead_alloc( rst_file ); + + test_install_SIGNALS(); + test_assert_true( util_sscanf_bool( argv[2] , &MSW )); + test_assert_not_NULL( rst_file ); + test_assert_not_NULL( rst_head ); + + { + int iwell; + const ecl_kw_type * iwel_kw = ecl_file_iget_named_kw( rst_file , IWEL_KW , 0 ); + const ecl_kw_type * icon_kw = ecl_file_iget_named_kw( rst_file , ICON_KW , 0 ); + bool caseMSW = false; + + for (iwell = 0; iwell < rst_head->nwells; iwell++) { + const int iwel_offset = rst_head->niwelz * iwell; + int num_connections = ecl_kw_iget_int( iwel_kw , iwel_offset + IWEL_CONNECTIONS_ITEM ); + int iconn; + well_conn_collection_type * wellcc = well_conn_collection_alloc( ); + well_conn_collection_type * wellcc_ref = well_conn_collection_alloc(); + + for (iconn = 0; iconn < num_connections; iconn++) { + well_conn_type * conn = well_conn_alloc_from_kw( icon_kw , rst_head , iwell , iconn ); + + test_assert_true( well_conn_is_instance( conn )); + test_assert_not_NULL( conn ); + if (!MSW) + test_assert_bool_equal( well_conn_MSW( conn ) , MSW); + else + caseMSW |= well_conn_MSW( conn ); + + well_conn_collection_add( wellcc , conn ); + well_conn_collection_add_ref( wellcc_ref , conn ); + test_assert_int_equal( iconn + 1 , well_conn_collection_get_size( wellcc )); + test_assert_ptr_equal( well_conn_collection_iget_const( wellcc , iconn) , conn); + test_assert_ptr_equal( well_conn_collection_iget_const( wellcc_ref , iconn) , conn); + } + well_conn_collection_free( wellcc_ref ); + { + + int i; + for (i=0; i < well_conn_collection_get_size( wellcc ); i++) + test_assert_true( well_conn_is_instance( well_conn_collection_iget_const( wellcc , i ))); + + } + { + well_conn_collection_type * wellcc2 = well_conn_collection_alloc(); + int i; + + test_assert_int_equal( well_conn_collection_get_size( wellcc ) , + well_conn_collection_load_from_kw( wellcc2 , iwel_kw , icon_kw , iwell , rst_head)); + + for (i=0; i < well_conn_collection_get_size( wellcc2 ); i++) { + test_assert_true( well_conn_is_instance( well_conn_collection_iget_const( wellcc2 , i ))); + test_assert_true( well_conn_equal( well_conn_collection_iget_const( wellcc2 , i ) , well_conn_collection_iget_const( wellcc , i ))); + } + well_conn_collection_free( wellcc2 ); + } + well_conn_collection_free( wellcc ); + } + test_assert_bool_equal( caseMSW , MSW); + } + + + exit( 0 ); +} diff --git a/ThirdParty/Ert/devel/libecl_well/tests/well_info.c b/ThirdParty/Ert/devel/libecl_well/tests/well_info.c new file mode 100644 index 0000000000..8a8dcb5424 --- /dev/null +++ b/ThirdParty/Ert/devel/libecl_well/tests/well_info.c @@ -0,0 +1,44 @@ +/* + Copyright (C) 2013 Statoil ASA, Norway. + + The file 'well_conn.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 + for more details. +*/ +#include +#include + +#include +#include +#include + +#include +#include + + +#include + + +int main(int argc , char ** argv) { + const char * grid_file = argv[1]; + + ecl_grid_type * grid = ecl_grid_alloc( grid_file ); + test_assert_not_NULL( grid ); + { + well_info_type * well_info = well_info_alloc( grid ); + test_assert_not_NULL( well_info ); + well_info_free( well_info ); + } + ecl_grid_free( grid ); + exit(0); +} diff --git a/ThirdParty/Ert/devel/libecl_well/tests/well_lgr_load.c b/ThirdParty/Ert/devel/libecl_well/tests/well_lgr_load.c index d3a3b477c6..ea656e1164 100644 --- a/ThirdParty/Ert/devel/libecl_well/tests/well_lgr_load.c +++ b/ThirdParty/Ert/devel/libecl_well/tests/well_lgr_load.c @@ -41,12 +41,10 @@ int main( int argc , char ** argv) { Killing with SIGKILL (-9) will not give a backtrace.*/ signal(SIGABRT , util_abort_signal); /* Signal abort. */ { - well_info_type * well_info = well_info_alloc( NULL ); - int i; - for (i=1; i < argc; i++) { - printf("Loading file: %s \n",argv[i]); - well_info_load_rstfile( well_info , argv[i]); - } + ecl_grid_type * grid = ecl_grid_alloc( argv[1] ); + well_info_type * well_info = well_info_alloc( grid ); + + well_info_load_rstfile( well_info , argv[2]); // List all wells: { diff --git a/ThirdParty/Ert/devel/libecl_well/tests/well_segment.c b/ThirdParty/Ert/devel/libecl_well/tests/well_segment.c new file mode 100644 index 0000000000..fcc34ad73d --- /dev/null +++ b/ThirdParty/Ert/devel/libecl_well/tests/well_segment.c @@ -0,0 +1,115 @@ +/* + Copyright (C) 2013 Statoil ASA, Norway. + + The file 'well_segment.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 + for more details. +*/ +#include +#include + +#include +#include +#include + +#include + + +#include +#include + +int main(int argc , char ** argv) { + test_install_SIGNALS(); + double * rseg_data = util_calloc( 100 , sizeof * rseg_data ); + const double depth = 100; + const double length = 20; + const double total_length = 200; + const double diameter = 10; + + rseg_data[ RSEG_DEPTH_INDEX ] = depth; + rseg_data[ RSEG_LENGTH_INDEX ] = length; + rseg_data[ RSEG_TOTAL_LENGTH_INDEX ] = total_length; + rseg_data[ RSEG_DIAMETER_INDEX ] = diameter; + { + int segment_id = 78; + int outlet_segment_id = 100; + int branch_nr = ECLIPSE_WELL_SEGMENT_BRANCH_MAIN_STEM_VALUE; + well_segment_type * ws = well_segment_alloc(segment_id , outlet_segment_id , branch_nr, rseg_data); + + test_assert_true( well_segment_is_instance( ws )); + test_assert_int_equal( 0 , well_segment_get_link_count( ws )); + test_assert_NULL( well_segment_get_outlet( ws )); + test_assert_int_equal( well_segment_get_outlet_id( ws ) , outlet_segment_id ); + test_assert_int_equal( well_segment_get_branch_id( ws ) , branch_nr ); + test_assert_int_equal( well_segment_get_id( ws ) , segment_id ); + + test_assert_false( well_segment_nearest_wellhead( ws )); + test_assert_true( well_segment_active( ws )); + test_assert_true( well_segment_main_stem( ws )); + + test_assert_double_equal( depth , well_segment_get_depth( ws )); + test_assert_double_equal( length , well_segment_get_length( ws )); + test_assert_double_equal( total_length , well_segment_get_total_length( ws )); + test_assert_double_equal( diameter , well_segment_get_diameter( ws )); + + well_segment_free( ws ); + } + + { + int outlet_segment_id = ECLIPSE_WELL_SEGMENT_OUTLET_END_VALUE; + int branch_nr = 100; + well_segment_type * ws = well_segment_alloc(12 , outlet_segment_id , branch_nr, rseg_data); + + test_assert_true( well_segment_nearest_wellhead( ws )); + test_assert_false( well_segment_main_stem( ws )); + } + + + { + int outlet_segment_id = ECLIPSE_WELL_SEGMENT_OUTLET_END_VALUE; + int branch_nr = ECLIPSE_WELL_SEGMENT_BRANCH_INACTIVE_VALUE; + well_segment_type * ws = well_segment_alloc(89 , outlet_segment_id , branch_nr, rseg_data); + + test_assert_false( well_segment_active( ws )); + } + + { + int branch_nr = ECLIPSE_WELL_SEGMENT_BRANCH_MAIN_STEM_VALUE; + int outlet_id = 0; + well_segment_type * outlet = well_segment_alloc(outlet_id , ECLIPSE_WELL_SEGMENT_OUTLET_END_VALUE , branch_nr, rseg_data); + well_segment_type * ws = well_segment_alloc(100 , outlet_id , branch_nr, rseg_data); + + test_assert_true( well_segment_link( ws , outlet )); + test_assert_ptr_equal( well_segment_get_outlet( ws ) , outlet ); + test_assert_int_equal( well_segment_get_link_count( outlet ) , 1 ); + test_assert_ptr_not_equal( ws , well_segment_get_outlet( ws )); + + well_segment_link_strict( ws , outlet ); // This relinks - not very logical; refcount gets wrong. + well_segment_free( ws ); + } + + { + int branch_nr = ECLIPSE_WELL_SEGMENT_BRANCH_MAIN_STEM_VALUE; + int outlet_id = 0; + well_segment_type * outlet = well_segment_alloc(outlet_id , ECLIPSE_WELL_SEGMENT_OUTLET_END_VALUE , branch_nr , rseg_data); + well_segment_type * ws = well_segment_alloc(100 , outlet_id + 1, branch_nr, rseg_data); + + test_assert_false( well_segment_link( ws , outlet )); + test_assert_NULL( well_segment_get_outlet( ws ) ); + test_assert_int_equal( well_segment_get_link_count( outlet ) , 0 ); + + well_segment_free( ws ); + } + free( rseg_data ); + exit(0); +} diff --git a/ThirdParty/Ert/devel/libecl_well/tests/well_segment_branch_conn_load.c b/ThirdParty/Ert/devel/libecl_well/tests/well_segment_branch_conn_load.c new file mode 100644 index 0000000000..36349ba508 --- /dev/null +++ b/ThirdParty/Ert/devel/libecl_well/tests/well_segment_branch_conn_load.c @@ -0,0 +1,106 @@ +/* + Copyright (C) 2013 Statoil ASA, Norway. + + The file 'well_segment_conn_load.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 + for more details. +*/ +#include +#include +#include + +#include +#include +#include + +#include +#include +#include +#include +#include + +#include +#include +#include +#include + + +int main(int argc , char ** argv) { + const char * Xfile = argv[1]; + ecl_file_type * rst_file = ecl_file_open( Xfile , 0 ); + ecl_rsthead_type * rst_head = ecl_rsthead_alloc( rst_file ); + const ecl_kw_type * iwel_kw = ecl_file_iget_named_kw( rst_file , IWEL_KW , 0 ); + const ecl_kw_type * iseg_kw = ecl_file_iget_named_kw( rst_file , ISEG_KW , 0 ); + const ecl_kw_type * rseg_kw = ecl_file_iget_named_kw( rst_file , RSEG_KW , 0 ); + const ecl_kw_type * icon_kw = ecl_file_iget_named_kw( rst_file , ICON_KW , 0 ); + + test_install_SIGNALS(); + test_assert_not_NULL( rst_file ); + test_assert_not_NULL( rst_head ); + { + int well_nr; + for (well_nr = 0; well_nr < rst_head->nwells; well_nr++) { + well_conn_collection_type * connections = well_conn_collection_alloc(); + well_conn_collection_load_from_kw( connections , iwel_kw , icon_kw , well_nr , rst_head); + { + well_segment_collection_type * segments = well_segment_collection_alloc(); + + if (well_segment_collection_load_from_kw( segments , well_nr , iwel_kw , iseg_kw , rseg_kw , rst_head )) { + well_branch_collection_type * branches = well_branch_collection_alloc(); + + test_assert_true( well_segment_well_is_MSW( well_nr , iwel_kw , rst_head)); + well_segment_collection_link( segments ); + { + int is; + for (is=0; is < well_segment_collection_get_size( segments ); is++) { + well_segment_type * segment = well_segment_collection_iget( segments , is ); + + if (well_segment_nearest_wellhead( segment )) + test_assert_NULL( well_segment_get_outlet( segment )); + else + test_assert_not_NULL( well_segment_get_outlet( segment )); + + test_assert_int_not_equal( well_segment_get_id( segment ) , well_segment_get_outlet_id( segment )); + test_assert_ptr_not_equal( segment , well_segment_get_outlet( segment )); + } + } + well_segment_collection_add_branches( segments , branches ); + { + int ib; + for (ib = 0; ib < well_branch_collection_get_size( branches ); ib++) { + const well_segment_type * start_segment = well_branch_collection_iget_start_segment( branches , ib ); + const well_segment_type * segment = start_segment; + + printf("Branch %d " , ib ); + while (segment) { + printf("%d -> ",well_segment_get_id( segment )); + segment = well_segment_get_outlet( segment ); + } + printf(" X \n"); + } + } + well_segment_collection_add_connections( segments , ECL_GRID_GLOBAL_GRID , connections ); + well_branch_collection_free( branches ); + } else + test_assert_false( well_segment_well_is_MSW( well_nr , iwel_kw , rst_head )); + + well_segment_collection_free( segments ); + } + well_conn_collection_free( connections ); + } + } + + ecl_file_close( rst_file ); + ecl_rsthead_free( rst_head ); + exit(0); +} diff --git a/ThirdParty/Ert/devel/libecl_well/tests/well_segment_collection.c b/ThirdParty/Ert/devel/libecl_well/tests/well_segment_collection.c new file mode 100644 index 0000000000..98c3772b68 --- /dev/null +++ b/ThirdParty/Ert/devel/libecl_well/tests/well_segment_collection.c @@ -0,0 +1,87 @@ +/* + Copyright (C) 2013 Statoil ASA, Norway. + + The file 'well_segment_collection.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 + for more details. +*/ +#include +#include + +#include +#include +#include + +#include + + +#include + + +int main(int argc , char ** argv) { + test_install_SIGNALS(); + + double * rseg_data = util_calloc( 100 , sizeof * rseg_data ); + well_segment_collection_type * sc = well_segment_collection_alloc(); + test_assert_not_NULL( sc ); + test_assert_int_equal( well_segment_collection_get_size( sc ) , 0 ); + + { + int outlet_segment_id = ECLIPSE_WELL_SEGMENT_OUTLET_END_VALUE; + int branch_nr = ECLIPSE_WELL_SEGMENT_BRANCH_INACTIVE_VALUE; + well_segment_type * ws = well_segment_alloc(89 , outlet_segment_id , branch_nr, rseg_data); + + well_segment_collection_add( sc , ws ); + test_assert_int_equal( well_segment_collection_get_size( sc ) , 1); + test_assert_ptr_equal( well_segment_collection_iget( sc , 0 ) , ws ); + + test_assert_false( well_segment_collection_has_segment( sc , 451 )); + test_assert_true( well_segment_collection_has_segment( sc , 89 )); + test_assert_ptr_equal( well_segment_collection_get( sc , 89 ) , ws ); + } + + { + int outlet_segment_id = ECLIPSE_WELL_SEGMENT_OUTLET_END_VALUE; + int branch_nr = ECLIPSE_WELL_SEGMENT_BRANCH_INACTIVE_VALUE; + well_segment_type * ws = well_segment_alloc(90 , outlet_segment_id , branch_nr , rseg_data); + + well_segment_collection_add( sc , ws ); + test_assert_int_equal( well_segment_collection_get_size( sc ) , 2); + test_assert_ptr_equal( well_segment_collection_iget( sc , 1 ) , ws ); + + test_assert_false( well_segment_collection_has_segment( sc , 451 )); + test_assert_true( well_segment_collection_has_segment( sc , 89 )); + test_assert_true( well_segment_collection_has_segment( sc , 90 )); + test_assert_ptr_equal( well_segment_collection_get( sc , 90 ) , ws ); + test_assert_NULL( well_segment_collection_get( sc , 76 )); + } + + { + int outlet_segment_id = ECLIPSE_WELL_SEGMENT_OUTLET_END_VALUE; + int branch_nr = ECLIPSE_WELL_SEGMENT_BRANCH_INACTIVE_VALUE; + well_segment_type * ws = well_segment_alloc(89 , outlet_segment_id , branch_nr, rseg_data); + + well_segment_collection_add( sc , ws ); + test_assert_int_equal( well_segment_collection_get_size( sc ) , 2); + test_assert_ptr_equal( well_segment_collection_iget( sc , 0 ) , ws ); + + test_assert_false( well_segment_collection_has_segment( sc , 451 )); + test_assert_true( well_segment_collection_has_segment( sc , 89 )); + test_assert_ptr_equal( well_segment_collection_get( sc , 89 ) , ws ); + } + + free( rseg_data ); + well_segment_collection_free( sc ); + + exit(0); +} diff --git a/ThirdParty/Ert/devel/libecl_well/tests/well_segment_conn.c b/ThirdParty/Ert/devel/libecl_well/tests/well_segment_conn.c new file mode 100644 index 0000000000..1779f6734d --- /dev/null +++ b/ThirdParty/Ert/devel/libecl_well/tests/well_segment_conn.c @@ -0,0 +1,59 @@ +/* + Copyright (C) 2013 Statoil ASA, Norway. + + The file 'well_segment_conn.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 + for more details. +*/ +#include +#include + +#include +#include +#include + +#include +#include + +#include +#include +#include + + +int main(int argc , char ** argv) { + test_install_SIGNALS(); + double * rseg_data = util_calloc( 100 , sizeof * rseg_data ); + { + int segment_id = 78; + int outlet_segment_id = 100; + int branch_nr = ECLIPSE_WELL_SEGMENT_BRANCH_MAIN_STEM_VALUE; + well_segment_type * ws = well_segment_alloc(segment_id , outlet_segment_id , branch_nr, rseg_data); + well_conn_type * conn1 = well_conn_alloc_MSW(1,1,1,true,well_conn_dirX,segment_id); + well_conn_type * conn2 = well_conn_alloc_MSW(1,1,1,true,well_conn_dirX,segment_id + 1); + + test_assert_false( well_segment_has_global_grid_connections( ws )); + + test_assert_true( well_segment_add_connection( ws , ECL_GRID_GLOBAL_GRID , conn1 )); + test_assert_false( well_segment_add_connection( ws , ECL_GRID_GLOBAL_GRID , conn2 )); + + test_assert_true( well_segment_has_grid_connections( ws , ECL_GRID_GLOBAL_GRID )); + test_assert_true( well_segment_has_global_grid_connections( ws )); + test_assert_false( well_segment_has_grid_connections( ws , "DoesNotExist")); + + test_assert_true( well_conn_collection_is_instance( well_segment_get_connections( ws , ECL_GRID_GLOBAL_GRID))); + test_assert_true( well_conn_collection_is_instance( well_segment_get_global_connections( ws))); + test_assert_NULL( well_segment_get_connections( ws , "doesNotExist")); + } + free( rseg_data ); + exit(0); +} diff --git a/ThirdParty/Ert/devel/libecl_well/tests/well_segment_conn_load.c b/ThirdParty/Ert/devel/libecl_well/tests/well_segment_conn_load.c new file mode 100644 index 0000000000..6fbdb46eb6 --- /dev/null +++ b/ThirdParty/Ert/devel/libecl_well/tests/well_segment_conn_load.c @@ -0,0 +1,107 @@ +/* + Copyright (C) 2013 Statoil ASA, Norway. + + The file 'well_segment_conn_load.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 + for more details. +*/ +#include +#include +#include + +#include +#include +#include + +#include +#include +#include +#include +#include + +#include +#include +#include +#include + + +int main(int argc , char ** argv) { + const char * Xfile = argv[1]; + ecl_file_type * rst_file = ecl_file_open( Xfile , 0 ); + ecl_rsthead_type * rst_head = ecl_rsthead_alloc( rst_file ); + const ecl_kw_type * iwel_kw = ecl_file_iget_named_kw( rst_file , IWEL_KW , 0 ); + const ecl_kw_type * iseg_kw = ecl_file_iget_named_kw( rst_file , ISEG_KW , 0 ); + const ecl_kw_type * rseg_kw = ecl_file_iget_named_kw( rst_file , RSEG_KW , 0 ); + const ecl_kw_type * icon_kw = ecl_file_iget_named_kw( rst_file , ICON_KW , 0 ); + + test_install_SIGNALS(); + test_assert_not_NULL( rst_file ); + test_assert_not_NULL( rst_head ); + { + int well_nr; + for (well_nr = 0; well_nr < rst_head->nwells; well_nr++) { + well_conn_collection_type * connections = well_conn_collection_alloc(); + well_conn_collection_load_from_kw( connections , iwel_kw , icon_kw , well_nr , rst_head); + { + well_segment_collection_type * segments = well_segment_collection_alloc(); + + if (well_segment_collection_load_from_kw( segments , well_nr , iwel_kw , iseg_kw , rseg_kw , rst_head )) { + well_branch_collection_type * branches = well_branch_collection_alloc(); + + test_assert_true( well_segment_well_is_MSW( well_nr , iwel_kw , rst_head)); + well_segment_collection_link( segments ); + { + int is; + for (is=0; is < well_segment_collection_get_size( segments ); is++) { + well_segment_type * segment = well_segment_collection_iget( segments , is ); + + if (well_segment_nearest_wellhead( segment )) + test_assert_NULL( well_segment_get_outlet( segment )); + else + test_assert_not_NULL( well_segment_get_outlet( segment )); + + test_assert_ptr_not_equal( segment , well_segment_get_outlet( segment )); + } + } + + well_segment_collection_add_branches( segments , branches ); + { + int ib; + for (ib = 0; ib < well_branch_collection_get_size( branches ); ib++) { + const well_segment_type * start_segment = well_branch_collection_iget_start_segment( branches , ib ); + const well_segment_type * segment = start_segment; + + printf("Branch %d/%d " , ib , well_branch_collection_get_size( branches ) ); + while (segment) { + printf("[%p]%d -> \n",segment , well_segment_get_id( segment )); + segment = well_segment_get_outlet( segment ); + } + printf("\n"); + sleep(1); + } + } + well_segment_collection_add_connections( segments , ECL_GRID_GLOBAL_GRID , connections ); + well_branch_collection_free( branches ); + } else + test_assert_false( well_segment_well_is_MSW( well_nr , iwel_kw , rst_head )); + + well_segment_collection_free( segments ); + } + well_conn_collection_free( connections ); + } + } + + ecl_file_close( rst_file ); + ecl_rsthead_free( rst_head ); + exit(0); +} diff --git a/ThirdParty/Ert/devel/libecl_well/tests/well_segment_load.c b/ThirdParty/Ert/devel/libecl_well/tests/well_segment_load.c new file mode 100644 index 0000000000..032632b186 --- /dev/null +++ b/ThirdParty/Ert/devel/libecl_well/tests/well_segment_load.c @@ -0,0 +1,88 @@ +/* + Copyright (C) 2013 Statoil ASA, Norway. + + The file 'well_segment_load.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 + for more details. +*/ +#include +#include + +#include +#include +#include + +#include +#include +#include +#include + +#include +#include +#include + + +int main(int argc , char ** argv) { + const char * Xfile = argv[1]; + ecl_file_type * rst_file = ecl_file_open( Xfile , 0 ); + ecl_rsthead_type * rst_head = ecl_rsthead_alloc( rst_file ); + const ecl_kw_type * iwel_kw = ecl_file_iget_named_kw( rst_file , IWEL_KW , 0 ); + const ecl_kw_type * iseg_kw = ecl_file_iget_named_kw( rst_file , ISEG_KW , 0 ); + const ecl_kw_type * rseg_kw = ecl_file_iget_named_kw( rst_file , RSEG_KW , 0 ); + + test_install_SIGNALS(); + test_assert_not_NULL( rst_file ); + test_assert_not_NULL( rst_head ); + + { + int well_nr; + + for (well_nr = 0; well_nr < rst_head->nwells; well_nr++) { + int iwel_offset = rst_head->niwelz * well_nr; + well_segment_collection_type * segments = well_segment_collection_alloc(); + int seg_well_nr = ecl_kw_iget_int( iwel_kw , iwel_offset + IWEL_SEGMENTED_WELL_NR_ITEM) - 1; // -1: Ordinary well. + if (seg_well_nr >= 0) { + int segment_id; + int segment_count = 0; + + for (segment_id = 0; segment_id < rst_head->nsegmx; segment_id++) { + well_segment_type * segment = well_segment_alloc_from_kw( iseg_kw , rseg_kw , rst_head , seg_well_nr , segment_id ); + + test_assert_true( well_segment_is_instance( segment )); + + if (well_segment_active( segment )) { + well_segment_collection_add( segments , segment ); + test_assert_int_equal( well_segment_collection_get_size( segments ) , segment_count + 1); + test_assert_ptr_equal( well_segment_collection_iget( segments , segment_count) , segment ); + segment_count++; + } else + well_segment_free( segment ); + } + } + + { + well_segment_collection_type * segments2 = well_segment_collection_alloc(); + test_assert_int_equal( well_segment_collection_load_from_kw( segments2 , well_nr , iwel_kw , iseg_kw , rseg_kw , rst_head ) , + well_segment_collection_get_size( segments)); + + well_segment_collection_link( segments ); + well_segment_collection_link( segments2 ); + well_segment_collection_free( segments ); + well_segment_collection_free( segments2 ); + } + } + } + ecl_file_close( rst_file ); + ecl_rsthead_free( rst_head ); + exit(0); +} diff --git a/ThirdParty/Ert/devel/libecl_well/tests/well_state.c b/ThirdParty/Ert/devel/libecl_well/tests/well_state.c new file mode 100644 index 0000000000..9131c3ebe7 --- /dev/null +++ b/ThirdParty/Ert/devel/libecl_well/tests/well_state.c @@ -0,0 +1,67 @@ +/* + Copyright (C) 2013 Statoil ASA, Norway. + + The file 'well_state.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 + for more details. +*/ +#include +#include + +#include +#include +#include + +#include + +#include + + +int main(int argc , char ** argv) { + test_install_SIGNALS(); + + test_assert_int_equal( well_state_translate_ecl_type_int( IWEL_UNDOCUMENTED_ZERO) , UNDOCUMENTED_ZERO); + test_assert_int_equal( well_state_translate_ecl_type_int( IWEL_PRODUCER) , PRODUCER); + test_assert_int_equal( well_state_translate_ecl_type_int( IWEL_WATER_INJECTOR) , WATER_INJECTOR); + test_assert_int_equal( well_state_translate_ecl_type_int( IWEL_GAS_INJECTOR) , GAS_INJECTOR); + test_assert_int_equal( well_state_translate_ecl_type_int( IWEL_OIL_INJECTOR) , OIL_INJECTOR); + + { + const char * well_name = "WELL"; + int report_nr = 100; + int global_well_nr = 67; + time_t valid_from = -1; + bool open = false; + well_type_enum type = GAS_INJECTOR; + + well_state_type * well_state = well_state_alloc(well_name , global_well_nr , open , type , report_nr , valid_from); + test_assert_true( well_state_is_instance( well_state) ); + + test_assert_false( well_state_is_MSW( well_state )); + test_assert_string_equal( well_name , well_state_get_name( well_state )); + test_assert_int_equal( global_well_nr , well_state_get_well_nr( well_state )); + test_assert_bool_equal( open , well_state_is_open( well_state )); + test_assert_int_equal( type , well_state_get_type( well_state )); + test_assert_int_equal( report_nr , well_state_get_report_nr( well_state )); + test_assert_time_t_equal( valid_from , well_state_get_sim_time( well_state )); + + test_assert_NULL( well_state_get_global_connections( well_state )); + test_assert_false( well_state_has_global_connections( well_state )); + test_assert_NULL( well_state_get_grid_connections( well_state , "GRID")); + test_assert_false( well_state_has_grid_connections( well_state , "GRID")); + + well_state_free( well_state ); + } + + exit(0); +} diff --git a/ThirdParty/Ert/devel/libecl_well/tests/well_state_load.c b/ThirdParty/Ert/devel/libecl_well/tests/well_state_load.c new file mode 100644 index 0000000000..d9375259d4 --- /dev/null +++ b/ThirdParty/Ert/devel/libecl_well/tests/well_state_load.c @@ -0,0 +1,78 @@ +/* + Copyright (C) 2013 Statoil ASA, Norway. + + The file 'well_state_load.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 + for more details. +*/ +#include +#include + +#include +#include +#include + +#include +#include +#include +#include + +#include + + +int main(int argc , char ** argv) { + test_install_SIGNALS(); + { + const char * grid_file = argv[1]; + const char * rst_file_name = argv[2]; + + ecl_grid_type * grid = ecl_grid_alloc( grid_file ); + ecl_file_type * rst_file = ecl_file_open( rst_file_name , 0); + ecl_rsthead_type * header = ecl_rsthead_alloc( rst_file ); + const char * well_name = "WELL"; + int report_nr = 100; + time_t valid_from = -1; + bool open = false; + well_type_enum type = GAS_INJECTOR; + int global_well_nr = 0; + + for (global_well_nr = 0; global_well_nr < header->nwells; global_well_nr++) { + well_state_type * well_state = well_state_alloc(well_name , global_well_nr , open , type , report_nr , valid_from); + test_assert_true( well_state_is_instance( well_state) ); + well_state_add_connections( well_state , grid , rst_file , 0 ); + + test_assert_true( well_state_has_grid_connections( well_state , ECL_GRID_GLOBAL_GRID )); + test_assert_false( well_state_has_grid_connections( well_state , "???" )); + test_assert_true( well_state_has_global_connections( well_state )); + + well_state_add_MSW( well_state , rst_file , global_well_nr ); + { + const well_segment_collection_type * segments = well_state_get_segments( well_state ); + const well_branch_collection_type * branches = well_state_get_branches( well_state ); + + if (well_state_is_MSW( well_state )) { + test_assert_true( ecl_file_has_kw( rst_file , ISEG_KW )); + test_assert_int_not_equal( well_segment_collection_get_size( segments ) , 0); + test_assert_int_not_equal( well_branch_collection_get_size( branches ) , 0); + } else { + test_assert_int_equal( well_segment_collection_get_size( segments ) , 0); + test_assert_int_equal( well_branch_collection_get_size( branches ) , 0); + test_assert_false( well_state_is_MSW( well_state )); + } + } + well_state_free( well_state ); + } + } + + exit(0); +} diff --git a/ThirdParty/Ert/devel/libecl_well/tests/well_ts.c b/ThirdParty/Ert/devel/libecl_well/tests/well_ts.c index 33b1d4c0fb..25d221f0c0 100644 --- a/ThirdParty/Ert/devel/libecl_well/tests/well_ts.c +++ b/ThirdParty/Ert/devel/libecl_well/tests/well_ts.c @@ -23,13 +23,16 @@ #include #include +#include #include int main(int argc , char ** argv) { const char * case_path = argv[1]; + char * grid_file = util_alloc_filename(NULL , case_path, "EGRID"); stringlist_type * file_list = stringlist_alloc_new( ); + ecl_grid_type * grid = ecl_grid_alloc( grid_file ); ecl_util_select_filelist( NULL , case_path , ECL_RESTART_FILE , false , file_list); printf("Searching in:%s \n",case_path); @@ -50,7 +53,7 @@ int main(int argc , char ** argv) { } } { - well_info_type * well_info = well_info_alloc( NULL ); + well_info_type * well_info = well_info_alloc( grid ); int i; for (i=0; i < stringlist_get_size( file_list ); i++) well_info_load_rstfile( well_info , stringlist_iget(file_list , i)); @@ -58,7 +61,7 @@ int main(int argc , char ** argv) { } { - well_info_type * well_info = well_info_alloc( NULL ); + well_info_type * well_info = well_info_alloc( grid ); int i; stringlist_reverse( file_list ); for (i=0; i < stringlist_get_size( file_list ); i++) diff --git a/ThirdParty/Ert/devel/libenkf/applications/ert_gui/lib/ert_gui/pages/config/analysis.py b/ThirdParty/Ert/devel/libenkf/applications/ert_gui/lib/ert_gui/pages/config/analysis.py deleted file mode 100644 index 1a6d312eb4..0000000000 --- a/ThirdParty/Ert/devel/libenkf/applications/ert_gui/lib/ert_gui/pages/config/analysis.py +++ /dev/null @@ -1,93 +0,0 @@ -# Copyright (C) 2011 Statoil ASA, Norway. -# -# The file 'analysis.py' 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 -# for more details. - - -# ---------------------------------------------------------------------------------------------- -# Analysis tab -# ---------------------------------------------------------------------------------------------- -from ert_gui.widgets.checkbox import CheckBox -from ert_gui.widgets.spinnerwidgets import IntegerSpinner, DoubleSpinner, DoubleSpinner -import ert_gui.widgets.tablewidgets -from ert_gui.widgets.pathchooser import PathChooser -from ert_gui.widgets.combochoice import ComboChoice -from PyQt4 import QtGui -import ert.enkf - -def createAnalysisPage(configPanel, parent): - configPanel.startPage("Analysis") - - r = configPanel.addRow(CheckBox(parent, "ENKF rerun", "config/analysis/enkf_rerun", "Perform rerun")) - r.getter = lambda ert : ert.enkf.analysis_config_get_rerun(ert.analysis_config) - r.setter = lambda ert, value : ert.enkf.analysis_config_set_rerun(ert.analysis_config, value) - - r = configPanel.addRow(IntegerSpinner(parent, "Rerun start", "config/analysis/rerun_start", 0, 100000)) - r.getter = lambda ert : ert.enkf.analysis_config_get_rerun_start(ert.analysis_config) - r.setter = lambda ert, value : ert.enkf.analysis_config_set_rerun_start(ert.analysis_config, value) - - r = configPanel.addRow(PathChooser(parent, "ENKF schedule file", "config/analysis/enkf_sched_file")) - r.getter = lambda ert : ert.enkf.model_config_get_enkf_sched_file(ert.enkf.enkf_main_get_model_config(ert.main)) - r.setter = lambda ert, value : ert.enkf.model_config_set_enkf_sched_file(ert.enkf.enkf_main_get_model_config(ert.main), str(value)) - - r = configPanel.addRow(ert_gui.widgets.tablewidgets.KeywordList(parent, "Local config", "config/analysis/local_config")) - r.newKeywordPopup = lambda list : QtGui.QFileDialog.getOpenFileName(r, "Select a path", "") - - def get_local_config_files(ert): - local_config = ert.enkf.enkf_main_get_local_config(ert.main) - config_files_pointer = ert.enkf.local_config_get_config_files(local_config) - return ert.getStringList(config_files_pointer) - - r.getter = get_local_config_files - - def add_config_file(ert, value): - local_config = ert.enkf.enkf_main_get_local_config(ert.main) - ert.enkf.local_config_clear_config_files(local_config) - - for file in value: - ert.enkf.local_config_add_config_file(local_config, file) - - r.setter = add_config_file - - r = configPanel.addRow(PathChooser(parent, "Update log", "config/analysis/update_log")) - r.getter = lambda ert : ert.enkf.analysis_config_get_log_path(ert.analysis_config) - r.setter = lambda ert, value : ert.enkf.analysis_config_set_log_path(ert.analysis_config, str(value)) - - - configPanel.startGroup("EnKF") - - r = configPanel.addRow(DoubleSpinner(parent, "Alpha", "config/analysis/enkf_alpha", 0, 100000, 2)) - r.getter = lambda ert : ert.enkf.analysis_config_get_alpha(ert.analysis_config) - r.setter = lambda ert, value : ert.enkf.analysis_config_set_alpha(ert.analysis_config, value) - - r = configPanel.addRow(CheckBox(parent, "Merge Observations", "config/analysis/enkf_merge_observations", "Perform merge")) - r.getter = lambda ert : ert.enkf.analysis_config_get_merge_observations(ert.analysis_config) - r.setter = lambda ert, value : ert.enkf.analysis_config_set_merge_observations(ert.analysis_config, value) - - - enkf_mode_type = {"ENKF_STANDARD" : 10, "ENKF_SQRT" : 20} - enkf_mode_type_inverted = {10 : "ENKF_STANDARD" , 20 : "ENKF_SQRT"} - r = configPanel.addRow(ComboChoice(parent, enkf_mode_type.keys(), "Mode", "config/analysis/enkf_mode")) - r.getter = lambda ert : enkf_mode_type_inverted[ert.enkf.analysis_config_get_enkf_mode(ert.analysis_config)] - r.setter = lambda ert, value : ert.enkf.analysis_config_set_enkf_mode(ert.analysis_config, enkf_mode_type[str(value)]) - - - r = configPanel.addRow(DoubleSpinner(parent, "Truncation", "config/analysis/enkf_truncation", 0, 1, 2)) - r.getter = lambda ert : ert.enkf.analysis_config_get_truncation(ert.analysis_config) - r.setter = lambda ert, value : ert.enkf.analysis_config_set_truncation(ert.analysis_config, value) - - - - configPanel.endGroup() - configPanel.endPage() diff --git a/ThirdParty/Ert/devel/libenkf/applications/ert_gui/lib/ert_gui/pages/plot/rftfetcher.py b/ThirdParty/Ert/devel/libenkf/applications/ert_gui/lib/ert_gui/pages/plot/rftfetcher.py deleted file mode 100644 index 08d1da4521..0000000000 --- a/ThirdParty/Ert/devel/libenkf/applications/ert_gui/lib/ert_gui/pages/plot/rftfetcher.py +++ /dev/null @@ -1,192 +0,0 @@ -# Copyright (C) 2011 Statoil ASA, Norway. -# -# The file 'rftfetcher.py' 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 -# for more details. - - -from fetcher import PlotDataFetcherHandler -import ert.ert.ertwrapper as ertwrapper -import ert.ert.enums as enums -import plotdata -from ert.ert.enums import ert_state_enum, obs_impl_type -import numpy - -class RFTFetcher(PlotDataFetcherHandler): - - def __init__(self): - PlotDataFetcherHandler.__init__(self) - - def initialize(self, ert): - ert.prototype("long enkf_main_get_obs(long)") - ert.prototype("long enkf_main_get_fs(long)") - ert.prototype("int enkf_main_get_ensemble_size(long)") - ert.prototype("int enkf_main_get_history_length(long)") - - ert.prototype("bool enkf_fs_has_node(long, long, int, int, int)") - ert.prototype("void enkf_fs_fread_node(long, long, int, int, int)") - - ert.prototype("bool enkf_obs_has_key(long, char*)") - ert.prototype("long enkf_obs_get_vector(long, char*)") - ert.prototype("long enkf_obs_alloc_typed_keylist(long, int)") - - ert.prototype("char* obs_vector_get_state_kw(long)") - ert.prototype("long obs_vector_iget_node(long, int)") - ert.prototype("int obs_vector_get_num_active(long)") - ert.prototype("bool obs_vector_iget_active(long, int)") - - ert.prototype("long enkf_config_node_get_ref(long)") - - ert.prototype("int* field_obs_get_i(long)") - ert.prototype("int* field_obs_get_j(long)") - ert.prototype("int* field_obs_get_k(long)") - ert.prototype("int field_obs_get_size(long)") - ert.prototype("void field_obs_iget(long, int, double*, double*)") - - ert.prototype("double field_ijk_get_double(long, int, int, int)") - - ert.prototype("long field_config_get_grid(long)") - - ert.prototype("long enkf_node_alloc(long)") - ert.prototype("void enkf_node_free(long)") - ert.prototype("long enkf_node_value_ptr(long)") - - ert.prototype("void ecl_grid_get_xyz3(long, int, int, int, double*, double*, double*)", lib=ert.ecl) - - def isHandlerFor(self, ert, key): - enkf_obs = ert.enkf.enkf_main_get_obs(ert.main) - key_list = ert.enkf.enkf_obs_alloc_typed_keylist(enkf_obs, obs_impl_type.FIELD_OBS.value()) - field_obs = ert.getStringList(key_list, free_after_use=True) - return key in field_obs - - def fetch(self, ert, key, parameter, data, comparison_fs): - enkf_obs = ert.enkf.enkf_main_get_obs(ert.main) - obs_vector = ert.enkf.enkf_obs_get_vector(enkf_obs, key) - - num_active = ert.enkf.obs_vector_get_num_active(obs_vector) - if num_active == 1: - report_step = ert.enkf.obs_vector_get_active_report_step(obs_vector) - elif num_active > 1: - history_length = ert.enkf.enkf_main_get_history_length(ert.main) - active = [] - for index in range(history_length): - if ert.enkf.obs_vector_iget_active(obs_vector , index): - active.append(index) - print "Active:", active - report_step = active[0] #todo: enable selection from GUI - else: - return - - fs = ert.enkf.enkf_main_get_fs(ert.main) - state_kw = ert.enkf.obs_vector_get_state_kw(obs_vector) - - ens_size = ert.enkf.enkf_main_get_ensemble_size(ert.main) - config_node = ert.enkf.ensemble_config_get_node(ert.ensemble_config, state_kw) - field_config = ert.enkf.enkf_config_node_get_ref(config_node) - field_obs = ert.enkf.obs_vector_iget_node(obs_vector, report_step) - - i = ert.enkf.field_obs_get_i(field_obs) - j = ert.enkf.field_obs_get_j(field_obs) - k = ert.enkf.field_obs_get_k(field_obs) - obs_size = ert.enkf.field_obs_get_size(field_obs) - grid = ert.enkf.field_config_get_grid(field_config) - - node = ert.enkf.enkf_node_alloc(config_node) - - y_obs = [] - x_obs = [] - x_std = [] - xpos = (ertwrapper.c_double)() - ypos = (ertwrapper.c_double)() - zpos = (ertwrapper.c_double)() - value = (ertwrapper.c_double)() - std = (ertwrapper.c_double)() - for index in range(obs_size): - ert.ecl.ecl_grid_get_xyz3(grid, i[index], j[index], k[index], xpos, ypos , zpos) - y_obs.append(zpos.value) - ert.enkf.field_obs_iget(field_obs, index, value, std) - x_obs.append(value.value) - x_std.append(std.value) - data.checkMaxMin(value.value + std.value) - data.checkMaxMin(value.value - std.value) - data.obs_y = numpy.array(y_obs) - data.obs_x = numpy.array(x_obs) - data.obs_std_x = numpy.array(x_std) - data.obs_std_y = None - - - for member in range(ens_size): - if ert.enkf.enkf_fs_has_node(fs, config_node, report_step, member, ert_state_enum.ANALYZED.value()): - ert.enkf.enkf_fs_fread_node(fs, node, report_step, member, ert_state_enum.ANALYZED.value()) - elif ert.enkf.enkf_fs_has_node(fs, config_node, report_step, member, ert_state_enum.FORECAST.value()): - ert.enkf.enkf_fs_fread_node(fs, node, report_step, member, ert_state_enum.FORECAST.value()) - else: - print "No data found for member %d/%d." % (member, report_step) - continue - - data.x_data[member] = [] - data.y_data[member] = [] - x_data = data.x_data[member] - y_data = data.y_data[member] - - field = ert.enkf.enkf_node_value_ptr(node) - for index in range(obs_size): - value = ert.enkf.field_ijk_get_double(field, i[index] , j[index] , k[index]) - x_data.append(value) - y_data.append(y_obs[index]) - data.checkMaxMin(value) - - data.x_data[member] = numpy.array(x_data) - data.y_data[member] = numpy.array(y_data) - - if not comparison_fs is None: - comp_node = ert.enkf.enkf_node_alloc(config_node) - for member in range(ens_size): - if ert.enkf.enkf_fs_has_node(comparison_fs, config_node, report_step, member, ert_state_enum.ANALYZED.value()): - ert.enkf.enkf_fs_fread_node(comparison_fs, comp_node, report_step, member, ert_state_enum.ANALYZED.value()) - elif ert.enkf.enkf_fs_has_node(comparison_fs, config_node, report_step, member, ert_state_enum.FORECAST.value()): - ert.enkf.enkf_fs_fread_node(comparison_fs, comp_node, report_step, member, ert_state_enum.FORECAST.value()) - else: - print "No data found for member %d/%d." % (member, report_step) - continue - - data.x_comp_data[member] = [] - data.y_comp_data[member] = [] - x_data = data.x_comp_data[member] - y_data = data.y_comp_data[member] - - field = ert.enkf.enkf_node_value_ptr(comp_node) - for index in range(obs_size): - value = ert.enkf.field_ijk_get_double(field, i[index] , j[index] , k[index]) - x_data.append(value) - y_data.append(y_obs[index]) - data.checkMaxMin(value) - - data.x_comp_data[member] = numpy.array(x_data) - data.y_comp_data[member] = numpy.array(y_data) - - ert.enkf.enkf_node_free(comp_node) - - ert.enkf.enkf_node_free(node) - - data.x_data_type = "number" - data.inverted_y_axis = True - - def getConfigurationWidget(self, context_data): - return None - - def configure(self, parameter, context_data): - pass #nothing to configure, yet - - - diff --git a/ThirdParty/Ert/devel/libenkf/applications/ert_tui/enkf_tui_plot_rft.c b/ThirdParty/Ert/devel/libenkf/applications/ert_tui/enkf_tui_plot_rft.c index b5c036cdbf..87eada994b 100644 --- a/ThirdParty/Ert/devel/libenkf/applications/ert_tui/enkf_tui_plot_rft.c +++ b/ThirdParty/Ert/devel/libenkf/applications/ert_tui/enkf_tui_plot_rft.c @@ -37,6 +37,8 @@ #include #include +#include +#include #include #include @@ -245,7 +247,12 @@ void enkf_tui_plot_RFT_simIn(enkf_main_type * enkf_main, path_fmt_type * runpath for (int nobs =0; nobs -1){ - int cell_index = ecl_rft_node_lookup_ijk( rft_refcase_node , - int_vector_iget(i_values,nobs) , - int_vector_iget(j_values,nobs) , - int_vector_iget(k_values,nobs) ); //lookup cell - - if(cell_index > -1){ - double pressure_value = ecl_rft_node_iget_pressure( rft_refcase_node , cell_index); // Pressure + const ecl_rft_cell_type * cell = ecl_rft_node_lookup_ijk( rft_refcase_node , + int_vector_iget(i_values,nobs) , + int_vector_iget(j_values,nobs) , + int_vector_iget(k_values,nobs) ); + + if (cell) { + double pressure_value = ecl_rft_cell_get_pressure( cell ); double_vector_append(RFT_refcase, pressure_value); bool_vector_append(refcase_has_data, true); - } - else{ + } else { double_vector_append(RFT_refcase, 0.0); bool_vector_append(refcase_has_data, false); } @@ -337,17 +343,19 @@ void enkf_tui_plot_RFT_simIn(enkf_main_type * enkf_main, path_fmt_type * runpath else{ for( int nobs = 0; nobs < lines; nobs++){ if( int_vector_iget(active,nobs) > -1){ - int cell_index = ecl_rft_node_lookup_ijk( rftnode , int_vector_iget(i_values,nobs), int_vector_iget(j_values,nobs),int_vector_iget(k_values,nobs) ); //lookup cell - double pressure_value = ecl_rft_node_iget_pressure( rftnode , cell_index); // Pressure - double_vector_iset(simulated_pressures,nobs , pressure_value); - if(cell_index > -1) + const ecl_rft_cell_type * cell = ecl_rft_node_lookup_ijk( rftnode , + int_vector_iget(i_values,nobs), + int_vector_iget(j_values,nobs), + int_vector_iget(k_values,nobs) ); //lookup cell + if (cell) { + double pressure_value = ecl_rft_cell_get_pressure( cell ); + double_vector_iset(simulated_pressures, nobs , pressure_value); bool_vector_iset(has_data, nobs, true); - else + } else { + double_vector_iset(simulated_pressures,nobs ,0.0); bool_vector_iset(has_data, nobs, false); - } - else { - double_vector_iset(simulated_pressures,nobs ,0.0); - bool_vector_iset(has_data, nobs, false); + } + } } } diff --git a/ThirdParty/Ert/devel/libenkf/include/ert/enkf/config_keys.h b/ThirdParty/Ert/devel/libenkf/include/ert/enkf/config_keys.h index d8a40f9eb1..e8f9c452d9 100644 --- a/ThirdParty/Ert/devel/libenkf/include/ert/enkf/config_keys.h +++ b/ThirdParty/Ert/devel/libenkf/include/ert/enkf/config_keys.h @@ -110,7 +110,6 @@ extern "C" { #define MAX_RUNNING_LOCAL_KEY "MAX_RUNNING_LOCAL" #define MAX_RUNNING_LSF_KEY "MAX_RUNNING_LSF" #define MAX_RUNNING_RSH_KEY "MAX_RUNNING_RSH" -#define MAX_RUNNING_TORQUE_KEY "MAX_RUNNING_TORQUE" #define MAX_SUBMIT_KEY "MAX_SUBMIT" #define NUM_REALIZATIONS_KEY "NUM_REALIZATIONS" #define OBS_CONFIG_KEY "OBS_CONFIG" diff --git a/ThirdParty/Ert/devel/libenkf/include/ert/enkf/enkf_config_node.h b/ThirdParty/Ert/devel/libenkf/include/ert/enkf/enkf_config_node.h index 112f53d9d2..15568a322b 100644 --- a/ThirdParty/Ert/devel/libenkf/include/ert/enkf/enkf_config_node.h +++ b/ThirdParty/Ert/devel/libenkf/include/ert/enkf/enkf_config_node.h @@ -139,6 +139,7 @@ extern "C" { const char * enkf_config_node_get_min_std_file( const enkf_config_node_type * config_node ); const char * enkf_config_node_get_enkf_outfile( const enkf_config_node_type * conifg_node ); const char * enkf_config_node_get_enkf_infile( const enkf_config_node_type * config_node ); + const char * enkf_config_node_get_init_file_fmt( const enkf_config_node_type * config_node ); char * enkf_config_node_alloc_initfile( const enkf_config_node_type * node , const char * path , int iens); void enkf_config_node_set_internalize(enkf_config_node_type * node, int report_step); diff --git a/ThirdParty/Ert/devel/libenkf/include/ert/enkf/enkf_main.h b/ThirdParty/Ert/devel/libenkf/include/ert/enkf/enkf_main.h index 5a92a734fa..7e1c04305b 100644 --- a/ThirdParty/Ert/devel/libenkf/include/ert/enkf/enkf_main.h +++ b/ThirdParty/Ert/devel/libenkf/include/ert/enkf/enkf_main.h @@ -91,6 +91,7 @@ extern "C" { const char * enkf_main_get_data_file(const enkf_main_type * ); const char ** enkf_main_get_well_list_ref(const enkf_main_type * , int *); + bool enkf_main_get_endian_swap(const enkf_main_type * ); bool enkf_main_get_fmt_file(const enkf_main_type * ); bool enkf_main_has_key(const enkf_main_type * , const char *); diff --git a/ThirdParty/Ert/devel/libenkf/include/ert/enkf/enkf_node.h b/ThirdParty/Ert/devel/libenkf/include/ert/enkf/enkf_node.h index 6875728790..630bd43a5b 100644 --- a/ThirdParty/Ert/devel/libenkf/include/ert/enkf/enkf_node.h +++ b/ThirdParty/Ert/devel/libenkf/include/ert/enkf/enkf_node.h @@ -108,6 +108,7 @@ extern "C" { bool enkf_node_user_get_vector( enkf_node_type * enkf_node , enkf_fs_type * fs , const char * key , int iens , state_enum state , double_vector_type * values); + bool enkf_node_user_get_no_id(enkf_node_type * enkf_node , enkf_fs_type * fs , const char * key , int report_step, int iens, state_enum state , double * value); bool enkf_node_user_get(enkf_node_type * , enkf_fs_type * , const char * , node_id_type , double * ); enkf_node_type * enkf_node_alloc(const enkf_config_node_type *); enkf_node_type * enkf_node_copyc(const enkf_node_type * ); diff --git a/ThirdParty/Ert/devel/libenkf/include/ert/enkf/model_config.h b/ThirdParty/Ert/devel/libenkf/include/ert/enkf/model_config.h index ffa0e2cd47..2f57e3fde6 100644 --- a/ThirdParty/Ert/devel/libenkf/include/ert/enkf/model_config.h +++ b/ThirdParty/Ert/devel/libenkf/include/ert/enkf/model_config.h @@ -74,6 +74,7 @@ extern "C" { const char * model_config_iget_casename( const model_config_type * model_config , int index); //void model_config_set_max_resample( model_config_type * model_config , int max_resample ); //int model_config_get_max_resample(const model_config_type * model_config ); + void model_config_set_max_internal_submit(model_config_type * config, int max_resample); int model_config_get_max_internal_submit( const model_config_type * config ); bool model_config_select_runpath( model_config_type * model_config , const char * path_key); void model_config_add_runpath( model_config_type * model_config , const char * path_key , const char * fmt ); @@ -82,7 +83,8 @@ extern "C" { void model_config_set_refcase( model_config_type * model_config , const ecl_sum_type * refcase ); void model_config_fprintf_config( const model_config_type * model_config , int ens_size ,FILE * stream ); model_config_type * model_config_alloc_empty(); - + bool model_config_select_history( model_config_type * model_config , history_source_type source_type, const sched_file_type * sched_file , const ecl_sum_type * refcase); + #ifdef __cplusplus } #endif diff --git a/ThirdParty/Ert/devel/libenkf/include/ert/enkf/obs_vector.h b/ThirdParty/Ert/devel/libenkf/include/ert/enkf/obs_vector.h deleted file mode 100644 index 934272b3e2..0000000000 --- a/ThirdParty/Ert/devel/libenkf/include/ert/enkf/obs_vector.h +++ /dev/null @@ -1,102 +0,0 @@ -/* - Copyright (C) 2011 Statoil ASA, Norway. - - The file 'obs_vector.h' 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 - for more details. -*/ - -#ifndef __OBS_VECTOR_H__ -#define __OBS_VECTOR_H__ - -#ifdef __cplusplus -extern "C" { -#endif - -#include - -#include - -#include - -#include - -#include - -#include -#include -#include -#include -#include -#include -#include -#include - - - typedef void (obs_free_ftype) (void *); - typedef void (obs_get_ftype) (const void * , obs_data_type * , int , const active_list_type * ); - typedef void (obs_meas_ftype) (const void * , const void *, node_id_type , meas_data_type * , const active_list_type * ); - typedef void (obs_user_get_ftype) (void * , const char * , double * , double * , bool *); - typedef double (obs_chi2_ftype) (const void * , const void *, node_id_type ); - - typedef enum { GEN_OBS = 1, - SUMMARY_OBS = 2, - BLOCK_OBS = 3} obs_impl_type; - - typedef struct obs_vector_struct obs_vector_type; - - - void obs_vector_clear_nodes( obs_vector_type * obs_vector ); - void obs_vector_del_node(obs_vector_type * obs_vector , int index); - void obs_vector_free(obs_vector_type * ); - int obs_vector_get_num_active(const obs_vector_type * ); - time_t obs_vector_iget_obs_time( const obs_vector_type * vector , int index); - bool obs_vector_iget_active(const obs_vector_type * , int ); - void obs_vector_iget_observations(const obs_vector_type * , int , obs_data_type * , const active_list_type * active_list); - void obs_vector_measure(const obs_vector_type * , enkf_fs_type * fs, state_enum state , int report_step , const enkf_state_type * , meas_data_type * , const active_list_type * active_list); - const char * obs_vector_get_state_kw(const obs_vector_type * ); - obs_impl_type obs_vector_get_impl_type(const obs_vector_type * ); - int obs_vector_get_active_report_step(const obs_vector_type * ); - void obs_vector_user_get(const obs_vector_type * obs_vector , const char * index_key , int report_step , double * value , double * std , bool * valid); - int obs_vector_get_next_active_step(const obs_vector_type * , int ); - void * obs_vector_iget_node(const obs_vector_type * , int ); - obs_vector_type * obs_vector_alloc_from_GENERAL_OBSERVATION(const conf_instance_type * , const history_type * , const ensemble_config_type * , const time_t_vector_type * obs_time); - void obs_vector_load_from_SUMMARY_OBSERVATION(obs_vector_type * obs_vector , const conf_instance_type * , const history_type * , ensemble_config_type * ); - bool obs_vector_load_from_HISTORY_OBSERVATION(obs_vector_type * obs_vector , const conf_instance_type * , const history_type * , ensemble_config_type * , double std_cutoff ); - obs_vector_type * obs_vector_alloc_from_BLOCK_OBSERVATION(const conf_instance_type * , const ecl_grid_type * grid , const ecl_sum_type * refcase , const history_type * , ensemble_config_type * , const time_t_vector_type * obs_time); - void obs_vector_set_config_node(obs_vector_type * , const enkf_config_node_type * ); - obs_vector_type * obs_vector_alloc(obs_impl_type obs_type , const char * obs_key , enkf_config_node_type * config_node , const time_t_vector_type * obs_time , int num_reports); - - double obs_vector_chi2(const obs_vector_type * , enkf_fs_type * , node_id_type node_id); - - void obs_vector_ensemble_chi2(const obs_vector_type * obs_vector , - enkf_fs_type * fs, - bool_vector_type * valid , - int step1 , int step2 , - int iens1 , int iens2 , - state_enum load_state , - double ** chi2); - - double obs_vector_total_chi2(const obs_vector_type * , enkf_fs_type * , int , state_enum ); - void obs_vector_ensemble_total_chi2(const obs_vector_type * , enkf_fs_type * , int , state_enum , double * ); - enkf_config_node_type * obs_vector_get_config_node(obs_vector_type * ); - const char * obs_vector_get_obs_key( const obs_vector_type * obs_vector); - - UTIL_SAFE_CAST_HEADER(obs_vector); - VOID_FREE_HEADER(obs_vector); - - -#ifdef __cplusplus -} -#endif -#endif diff --git a/ThirdParty/Ert/devel/libenkf/include/ert/enkf/site_config.h b/ThirdParty/Ert/devel/libenkf/include/ert/enkf/site_config.h index f3b627f844..16714d1535 100644 --- a/ThirdParty/Ert/devel/libenkf/include/ert/enkf/site_config.h +++ b/ThirdParty/Ert/devel/libenkf/include/ert/enkf/site_config.h @@ -58,8 +58,6 @@ typedef struct site_config_struct site_config_type; int site_config_get_max_running_rsh( const site_config_type * site_config); void site_config_set_max_running_local( site_config_type * site_config , int max_running_local); int site_config_get_max_running_local( const site_config_type * site_config ); - void site_config_set_max_running_torque( site_config_type * site_config , int max_running_torque); - int site_config_get_max_running_torque( const site_config_type * site_config ); void site_config_setenv( site_config_type * site_config , const char * variable, const char * value); hash_type * site_config_get_env_hash( const site_config_type * site_config ); void site_config_clear_env( site_config_type * site_config ); diff --git a/ThirdParty/Ert/devel/libenkf/src/enkf_config_node.c b/ThirdParty/Ert/devel/libenkf/src/enkf_config_node.c index ce73d26b75..c274875712 100644 --- a/ThirdParty/Ert/devel/libenkf/src/enkf_config_node.c +++ b/ThirdParty/Ert/devel/libenkf/src/enkf_config_node.c @@ -576,6 +576,10 @@ const char * enkf_config_node_get_enkf_infile( const enkf_config_node_type * con return path_fmt_get_fmt( config_node->enkf_infile_fmt ); } +const char * enkf_config_node_get_init_file_fmt( const enkf_config_node_type * config_node) +{ + return path_fmt_get_fmt( config_node->init_file_fmt ); +} void enkf_config_node_set_min_std( enkf_config_node_type * config_node , enkf_node_type * min_std ) { if (config_node->min_std != NULL) diff --git a/ThirdParty/Ert/devel/libenkf/src/enkf_main.c b/ThirdParty/Ert/devel/libenkf/src/enkf_main.c index 8e0f04b9ec..2fc1be833d 100644 --- a/ThirdParty/Ert/devel/libenkf/src/enkf_main.c +++ b/ThirdParty/Ert/devel/libenkf/src/enkf_main.c @@ -2144,7 +2144,6 @@ enkf_main_type * enkf_main_alloc_empty( ) { enkf_main_init_subst_list( enkf_main ); enkf_main_set_verbose( enkf_main , true ); - printf("enkf_main->subst_list :%p \n",enkf_main->subst_list); return enkf_main; } diff --git a/ThirdParty/Ert/devel/libenkf/src/enkf_node.c b/ThirdParty/Ert/devel/libenkf/src/enkf_node.c index 15ec40cfbc..dc0e742490 100644 --- a/ThirdParty/Ert/devel/libenkf/src/enkf_node.c +++ b/ThirdParty/Ert/devel/libenkf/src/enkf_node.c @@ -341,22 +341,25 @@ void enkf_node_ecl_write(const enkf_node_type *enkf_node , const char *path , fo bool enkf_node_user_get(enkf_node_type * enkf_node , enkf_fs_type * fs , const char * key , node_id_type node_id , double * value) { + return enkf_node_user_get_no_id( enkf_node , fs , key , node_id.report_step , node_id.iens , node_id.state , value ); +} + +bool enkf_node_user_get_no_id(enkf_node_type * enkf_node , enkf_fs_type * fs , const char * key , int report_step, int iens, state_enum state , double * value) { + node_id_type node_id = {.report_step = report_step , .iens = iens, .state = state }; bool loadOK; FUNC_ASSERT( enkf_node->user_get ); { loadOK = enkf_node_try_load( enkf_node , fs , node_id); if (loadOK) - return enkf_node->user_get(enkf_node->data , key , node_id.report_step, node_id.state , value); + return enkf_node->user_get(enkf_node->data , key , report_step, state , value); else { *value = 0; return false; } - } } - bool enkf_node_user_get_vector( enkf_node_type * enkf_node , enkf_fs_type * fs , const char * key , int iens , state_enum state , double_vector_type * values) { if (enkf_node->vector_storage) { if (enkf_node_try_load_vector( enkf_node , fs , iens , state)) { diff --git a/ThirdParty/Ert/devel/libenkf/src/field.c b/ThirdParty/Ert/devel/libenkf/src/field.c index 8e79942027..a70d77e2f7 100644 --- a/ThirdParty/Ert/devel/libenkf/src/field.c +++ b/ThirdParty/Ert/devel/libenkf/src/field.c @@ -1383,7 +1383,6 @@ void field_update_sum(field_type * sum , field_type * field , double lower_limit */ bool field_user_get(const field_type * field, const char * index_key, int report_step , state_enum state, double * value) { - printf("index_key : %s \n",index_key); const bool internal_value = false; bool valid; int i,j,k; diff --git a/ThirdParty/Ert/devel/libenkf/src/field_config.c b/ThirdParty/Ert/devel/libenkf/src/field_config.c index c409719aa9..70d49c7ea0 100644 --- a/ThirdParty/Ert/devel/libenkf/src/field_config.c +++ b/ThirdParty/Ert/devel/libenkf/src/field_config.c @@ -954,8 +954,6 @@ bool field_config_parse_user_key__( const char * index_key , int *i , int *j , i *k = int_vector_iget( indices , 2) - 1; } - int_vector_fprintf( indices , stdout , "INDEXLIST" , " %4d"); - int_vector_free( indices ); } if (length == 3) diff --git a/ThirdParty/Ert/devel/libenkf/src/model_config.c b/ThirdParty/Ert/devel/libenkf/src/model_config.c index 95867b8d4a..a8f1faa12f 100644 --- a/ThirdParty/Ert/devel/libenkf/src/model_config.c +++ b/ThirdParty/Ert/devel/libenkf/src/model_config.c @@ -286,7 +286,7 @@ int model_config_get_max_internal_submit( const model_config_type * config ) { return config->max_internal_submit; } -static void model_config_set_max_internal_submit( model_config_type * model_config , int max_resample ) { +void model_config_set_max_internal_submit( model_config_type * model_config , int max_resample ) { model_config->max_internal_submit = max_resample; } @@ -330,7 +330,7 @@ model_config_type * model_config_alloc_empty() { } -static bool model_config_select_history( model_config_type * model_config , history_source_type source_type, const sched_file_type * sched_file , const ecl_sum_type * refcase) { +bool model_config_select_history( model_config_type * model_config , history_source_type source_type, const sched_file_type * sched_file , const ecl_sum_type * refcase) { bool selectOK = false; if (source_type == SCHEDULE && sched_file != NULL) { @@ -512,7 +512,6 @@ history_type * model_config_get_history(const model_config_type * config) { } int model_config_get_last_history_restart(const model_config_type * config) { - printf("config->history:%p \n",config->history); return history_get_last_restart( config->history ); } diff --git a/ThirdParty/Ert/devel/libenkf/src/obs_vector.c b/ThirdParty/Ert/devel/libenkf/src/obs_vector.c deleted file mode 100644 index 51e3790425..0000000000 --- a/ThirdParty/Ert/devel/libenkf/src/obs_vector.c +++ /dev/null @@ -1,957 +0,0 @@ -/* - Copyright (C) 2011 Statoil ASA, Norway. - - The file 'obs_vector.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 - for more details. -*/ - -/** - See the overview documentation of the observation system in enkf_obs.c -*/ - -#include -#include -#include -#include - -#include -#include -#include -#include -#include - -#include - -#include - -#include -#include -#include - -#include -#include -#include -#include -#include -#include -#include -#include -#include - -#define OBS_VECTOR_TYPE_ID 120086 - -struct obs_vector_struct { - UTIL_TYPE_ID_DECLARATION; - obs_free_ftype *freef; /* Function used to free an observation node. */ - obs_get_ftype *get_obs; /* Function used to build the 'd' vector. */ - obs_meas_ftype *measure; /* Function used to measure on the state, and add to to the S matrix. */ - obs_user_get_ftype *user_get; /* Function to get an observation based on KEY:INDEX input from user.*/ - obs_chi2_ftype *chi2; /* Function to evaluate chi-squared for an observation. */ - - const time_t_vector_type * obs_time; /* Global vector owned by the enkf_obs structure. */ - vector_type * nodes; - char * obs_key; /* The key this observation vector has in the enkf_obs layer. */ - enkf_config_node_type * config_node; /* The config_node of the node type we are observing - shared reference */ - obs_impl_type obs_type; - int num_active; /* The total number of timesteps where this observation is active (i.e. nodes[ ] != NULL) */ -}; - - -UTIL_IS_INSTANCE_FUNCTION(obs_vector , OBS_VECTOR_TYPE_ID) -UTIL_SAFE_CAST_FUNCTION(obs_vector , OBS_VECTOR_TYPE_ID) - -/*****************************************************************/ - - -static int __conf_instance_get_restart_nr(const conf_instance_type * conf_instance, const char * obs_key , const history_type * history , int size) { - int obs_restart_nr = -1; /* To shut up compiler warning. */ - - if(conf_instance_has_item(conf_instance, "RESTART")) { - obs_restart_nr = conf_instance_get_item_value_int(conf_instance, "RESTART"); - if(obs_restart_nr > size) - util_abort("%s: Observation %s occurs at restart %i, but history file has only %i restarts.\n", __func__, obs_key, obs_restart_nr, size); - } else if(conf_instance_has_item(conf_instance, "DATE")) { - time_t obs_date = conf_instance_get_item_value_time_t(conf_instance, "DATE" ); - obs_restart_nr = history_get_restart_nr_from_time_t( history , obs_date ); - } else if (conf_instance_has_item(conf_instance, "DAYS")) { - double days = conf_instance_get_item_value_double(conf_instance, "DAYS"); - obs_restart_nr = history_get_restart_nr_from_days( history , days ); - } else - util_abort("%s: Internal error. Invalid conf_instance?\n", __func__); - - return obs_restart_nr; -} - - - -/*****************************************************************/ - - -static void obs_vector_resize(obs_vector_type * vector , int new_size) { - int current_size = vector_get_size( vector->nodes ); - int i; - - for (i=current_size; i < new_size; i++) - vector_append_ref( vector->nodes , NULL); - -} - - - -obs_vector_type * obs_vector_alloc(obs_impl_type obs_type , const char * obs_key , enkf_config_node_type * config_node , const time_t_vector_type * obs_time , int num_reports) { - obs_vector_type * vector = util_malloc(sizeof * vector ); - - UTIL_TYPE_ID_INIT( vector , OBS_VECTOR_TYPE_ID); - vector->freef = NULL; - vector->measure = NULL; - vector->get_obs = NULL; - vector->user_get = NULL; - vector->chi2 = NULL; - - switch (obs_type) { - case(SUMMARY_OBS): - vector->freef = summary_obs_free__; - vector->measure = summary_obs_measure__; - vector->get_obs = summary_obs_get_observations__; - vector->user_get = summary_obs_user_get__; - vector->chi2 = summary_obs_chi2__; - break; - case(BLOCK_OBS): - vector->freef = block_obs_free__; - vector->measure = block_obs_measure__; - vector->get_obs = block_obs_get_observations__; - vector->user_get = block_obs_user_get__; - vector->chi2 = block_obs_chi2__; - break; - case(GEN_OBS): - vector->freef = gen_obs_free__; - vector->measure = gen_obs_measure__; - vector->get_obs = gen_obs_get_observations__; - vector->user_get = gen_obs_user_get__; - vector->chi2 = gen_obs_chi2__; - break; - default: - util_abort("%s: internal error - obs_type:%d not recognized \n",__func__ , obs_type); - } - - vector->obs_type = obs_type; - vector->config_node = config_node; - vector->obs_key = util_alloc_string_copy( obs_key ); - vector->num_active = 0; - vector->nodes = vector_alloc_new(); - vector->obs_time = obs_time; - obs_vector_resize(vector , num_reports + 1); /* +1 here ?? Ohh - these fucking +/- problems. */ - - return vector; -} - -obs_impl_type obs_vector_get_impl_type(const obs_vector_type * obs_vector) { - return obs_vector->obs_type; -} - - -/** - This is the key for the enkf_node which this observation is - 'looking at'. I.e. if this observation is an RFT pressure - measurement, this function will return "PRESSURE". -*/ - -const char * obs_vector_get_state_kw(const obs_vector_type * obs_vector) { - return enkf_config_node_get_key( obs_vector->config_node ); -} - - -enkf_config_node_type * obs_vector_get_config_node(obs_vector_type * obs_vector) { - return obs_vector->config_node; -} - - - -void obs_vector_free(obs_vector_type * obs_vector) { - vector_free( obs_vector->nodes ); - free(obs_vector->obs_key); - free(obs_vector); -} - - -static void obs_vector_assert_node_type( const obs_vector_type * obs_vector , const void * node ) { - bool type_OK; - switch (obs_vector->obs_type) { - case(SUMMARY_OBS): - type_OK = summary_obs_is_instance( node ); - break; - case(BLOCK_OBS): - type_OK = block_obs_is_instance( node ); - break; - case(GEN_OBS): - type_OK = gen_obs_is_instance( node ); - break; - default: - util_abort("%s: What the fuck? \n",__func__); - type_OK = false; - } - if (!type_OK) - util_abort("%s: Type mismatch when trying to add observation node to observation vector \n",__func__); -} - - - - -void obs_vector_del_node(obs_vector_type * obs_vector , int index) { - if (vector_iget_const( obs_vector->nodes , index ) != NULL) { - vector_iset_ref( obs_vector->nodes , index , NULL); /* Clear current content. */ - obs_vector->num_active--; - } -} - -/** - This function will clear (and free) all the summary_obs / gen_obs / - field_obs instances which have been installed in the vector; - however the vector itself is retained with keys, function pointers - and so on. -*/ - -void obs_vector_clear_nodes( obs_vector_type * obs_vector ) { - vector_clear( obs_vector->nodes ); - obs_vector->num_active = 0; -} - - - -static void obs_vector_install_node(obs_vector_type * obs_vector , int index , void * node) { - obs_vector_assert_node_type( obs_vector , node ); - { - if (vector_iget_const( obs_vector->nodes , index ) == NULL) - obs_vector->num_active++; - - vector_iset_owned_ref( obs_vector->nodes , index , node , obs_vector->freef ); - } -} - - - -/** - Observe that @summary_key is the key used to look up the - corresponding simulated value in the ensemble, and not the - observation key - the two can be different. -*/ - -static void obs_vector_add_summary_obs( obs_vector_type * obs_vector , int obs_index , const char * summary_key , const char * obs_key , double value , double std , const char * auto_corrf_name , double auto_corrf_param) { - summary_obs_type * summary_obs = summary_obs_alloc( summary_key , obs_key , value , std , auto_corrf_name , auto_corrf_param); - obs_vector_install_node( obs_vector , obs_index , summary_obs ); -} - - -time_t obs_vector_iget_obs_time( const obs_vector_type * obs_vector , int report_step) { - return time_t_vector_safe_iget( obs_vector->obs_time , report_step ); -} - - - - - -/*****************************************************************/ - -int obs_vector_get_num_active(const obs_vector_type * vector) { - return vector->num_active; -} - - -/** - IFF - only one - report step is active this function will return - that report step. If more than report step is active, the function - is ambigous, and will fail HARD. Check with get_num_active first! -*/ - -int obs_vector_get_active_report_step(const obs_vector_type * vector) { - if (vector->num_active == 1) { - int active_step = -1; - int i; - for (i=0; i < vector_get_size(vector->nodes); i++) { - void * obs_node = vector_iget( vector->nodes , i); - if (obs_node != NULL) { - if (active_step >= 0) - util_abort("%s: internal error - mismatch in obs_vector->nodes and obs_vector->num_active \n",__func__); - active_step = i; - } - } - if (active_step < 0) - util_abort("%s: internal error - mismatch in obs_vector->nodes and obs_vector->num_active \n",__func__); - - return active_step; - } else { - util_abort("%s: when calling this function the number of active report steps MUST BE 1 - you had: %d \n",__func__ , vector->num_active); - return 0; /* Comiler shut up. */ - } -} - - - -bool obs_vector_iget_active(const obs_vector_type * vector, int index) { - /* We accept this ... */ - if (index >= vector_get_size( vector->nodes )) - return false; - - { - void * obs_data = vector_iget( vector->nodes , index ); - if (obs_data != NULL) - return true; - else - return false; - } -} - - -/* - Will happily return NULL if index is not active. -*/ -void * obs_vector_iget_node(const obs_vector_type * vector, int index) { - return vector_iget( vector->nodes , index ); -} - - -void obs_vector_user_get(const obs_vector_type * obs_vector , const char * index_key , int report_step , double * value , double * std , bool * valid) { - void * obs_node = obs_vector_iget_node( obs_vector , report_step ); - obs_vector->user_get(obs_node , index_key , value , std , valid); -} - -/* - This function returns the next active (i.e. node != NULL) report - step, starting with 'prev_step + 1'. If no more active steps are - found, it will return -1. -*/ - -int obs_vector_get_next_active_step(const obs_vector_type * obs_vector , int prev_step) { - if (prev_step >= (vector_get_size(obs_vector->nodes) - 1)) - return -1; - else { - int size = vector_get_size( obs_vector->nodes ); - int next_step = prev_step + 1; - while (( next_step < size) && (obs_vector_iget_node(obs_vector , next_step) == NULL)) - next_step++; - - if (next_step == size) - return -1; /* No more active steps. */ - else - return next_step; - } -} - - -/*****************************************************************/ -/** - All the obs_vector_load_from_XXXX() functions can safely return - NULL, in which case no observation is added to enkf_obs observation - hash table. -*/ - - -void obs_vector_load_from_SUMMARY_OBSERVATION(obs_vector_type * obs_vector , const conf_instance_type * conf_instance , const history_type * history, ensemble_config_type * ensemble_config) { - if(!conf_instance_is_of_class(conf_instance, "SUMMARY_OBSERVATION")) - util_abort("%s: internal error. expected \"SUMMARY_OBSERVATION\" instance, got \"%s\".\n", - __func__, conf_instance_get_class_name_ref(conf_instance) ); - - { - double obs_value = conf_instance_get_item_value_double(conf_instance, "VALUE" ); - double obs_error = conf_instance_get_item_value_double(conf_instance, "ERROR" ); - double min_error = conf_instance_get_item_value_double(conf_instance, "ERROR_MIN"); - const char * error_mode = conf_instance_get_item_value_ref( conf_instance, "ERROR_MODE"); - const char * sum_key = conf_instance_get_item_value_ref( conf_instance, "KEY" ); - const char * obs_key = conf_instance_get_name_ref(conf_instance); - int size = history_get_last_restart( history ); - int obs_restart_nr = __conf_instance_get_restart_nr(conf_instance , obs_key , history , size); - - if (obs_restart_nr == 0) { - int day,month,year; - time_t start_time = history_get_time_t_from_restart_nr( history , 0 ); - util_set_date_values( start_time , &day , &month , &year); - - fprintf(stderr,"** ERROR: It is unfortunately not possible to use summary observations from the\n"); - fprintf(stderr," start of the simulation. Problem with observation:%s at %02d/%02d/%4d\n",obs_key , day,month,year); - exit(1); - } - { - if (strcmp( error_mode , "REL") == 0) - obs_error *= obs_value; - else if (strcmp( error_mode , "RELMIN") == 0) - obs_error = util_double_max( min_error , obs_error * obs_value ); - - obs_vector_add_summary_obs( obs_vector , obs_restart_nr , sum_key , obs_key , obs_value , obs_error , NULL , 0); - } - } -} - - - - -obs_vector_type * obs_vector_alloc_from_GENERAL_OBSERVATION(const conf_instance_type * conf_instance , const history_type * history, const ensemble_config_type * ensemble_config , const time_t_vector_type * obs_time) { - if(!conf_instance_is_of_class(conf_instance, "GENERAL_OBSERVATION")) - util_abort("%s: internal error. expected \"GENERAL_OBSERVATION\" instance, got \"%s\".\n", - __func__, conf_instance_get_class_name_ref(conf_instance) ); - const char * obs_key = conf_instance_get_name_ref(conf_instance); - const char * state_kw = conf_instance_get_item_value_ref( conf_instance, "DATA" ); - if (ensemble_config_has_key( ensemble_config , state_kw )) { - const char * obs_key = conf_instance_get_name_ref(conf_instance); - int size = history_get_last_restart( history ); - obs_vector_type * obs_vector = obs_vector_alloc( GEN_OBS , obs_key , ensemble_config_get_node(ensemble_config , state_kw ) , obs_time , size); - int obs_restart_nr = __conf_instance_get_restart_nr(conf_instance , obs_key , history , size); - const char * index_file = NULL; - const char * index_list = NULL; - const char * obs_file = NULL; - const char * error_covar_file = NULL; - - if (conf_instance_has_item(conf_instance , "INDEX_FILE")) - index_file = conf_instance_get_item_value_ref( conf_instance, "INDEX_FILE" ); - - if (conf_instance_has_item(conf_instance , "INDEX_LIST")) - index_list = conf_instance_get_item_value_ref( conf_instance, "INDEX_LIST" ); - - if (conf_instance_has_item(conf_instance , "OBS_FILE")) - obs_file = conf_instance_get_item_value_ref( conf_instance, "OBS_FILE" ); - - if (conf_instance_has_item(conf_instance , "ERROR_COVAR")) - error_covar_file = conf_instance_get_item_value_ref( conf_instance, "ERROR_COVAR" ); - - { - const enkf_config_node_type * config_node = ensemble_config_get_node( ensemble_config , state_kw); - if (enkf_config_node_get_impl_type(config_node) == GEN_DATA) { - double scalar_error = -1; - double scalar_value = -1; - gen_obs_type * gen_obs ; - - if (conf_instance_has_item(conf_instance , "VALUE")) { - scalar_value = conf_instance_get_item_value_double(conf_instance , "VALUE"); - scalar_error = conf_instance_get_item_value_double(conf_instance , "ERROR"); - } - - /** The config system has ensured that we have either OBS_FILE or (VALUE and ERROR). */ - gen_obs = gen_obs_alloc( enkf_config_node_get_ref( config_node ) , obs_key , obs_file , scalar_value , scalar_error , index_file , index_list , error_covar_file); - obs_vector_install_node( obs_vector , obs_restart_nr , gen_obs ); - } else { - ert_impl_type impl_type = enkf_config_node_get_impl_type(config_node); - util_abort("%s: %s has implementation type:\'%s\' - expected:\'%s\'.\n",__func__ , state_kw , enkf_types_get_impl_name(impl_type) , enkf_types_get_impl_name(GEN_DATA)); - } - } - return obs_vector; - } else { - fprintf(stderr,"** Warning the ensemble key:%s does not exist - observation:%s not added \n", state_kw , obs_key); - return NULL; - } -} - - - -// Should check the refcase for key - if it is != NULL. - -bool obs_vector_load_from_HISTORY_OBSERVATION(obs_vector_type * obs_vector , - const conf_instance_type * conf_instance , - const history_type * history , - ensemble_config_type * ensemble_config, - double std_cutoff ) { - - if(!conf_instance_is_of_class(conf_instance, "HISTORY_OBSERVATION")) - util_abort("%s: internal error. expected \"HISTORY_OBSERVATION\" instance, got \"%s\".\n",__func__, conf_instance_get_class_name_ref(conf_instance) ); - - { - bool initOK = false; - int size , restart_nr; - double_vector_type * value = double_vector_alloc(0,0); - double_vector_type * std = double_vector_alloc(0,0); - bool_vector_type * valid = bool_vector_alloc(0 , false); - - /* The auto_corrf parameters can not be "segmentized" */ - double auto_corrf_param = -1; - const char * auto_corrf_name = NULL; - - - double error = conf_instance_get_item_value_double(conf_instance, "ERROR" ); - double error_min = conf_instance_get_item_value_double(conf_instance, "ERROR_MIN" ); - const char * error_mode = conf_instance_get_item_value_ref( conf_instance, "ERROR_MODE"); - const char * sum_key = conf_instance_get_name_ref( conf_instance ); - - if(conf_instance_has_item(conf_instance, "AUTO_CORRF")) { - auto_corrf_name = conf_instance_get_item_value_ref( conf_instance , "AUTO_CORRF"); - auto_corrf_param = conf_instance_get_item_value_double(conf_instance, "AUTO_CORRF_PARAM"); - if(conf_instance_has_item(conf_instance, "AUTO_CORRF_PARAM")) - auto_corrf_param = conf_instance_get_item_value_double(conf_instance, "AUTO_CORRF_PARAM"); - else - util_abort("%s: When specifying AUTO_CORRF you must also give a vlaue for AUTO_CORRF_PARAM",__func__); - } - - - // Get time series data from history object and allocate - size = history_get_last_restart(history); - if (history_init_ts( history , sum_key , value , valid )) { - - // Create the standard deviation vector - if(strcmp(error_mode, "ABS") == 0) { - for( restart_nr = 0; restart_nr < size; restart_nr++) - double_vector_iset( std , restart_nr , error ); - } else if(strcmp(error_mode, "REL") == 0) { - for( restart_nr = 0; restart_nr < size; restart_nr++) - double_vector_iset( std , restart_nr , error * abs( double_vector_iget( value , restart_nr ))); - } else if(strcmp(error_mode, "RELMIN") == 0) { - for(restart_nr = 0; restart_nr < size; restart_nr++) { - double tmp_std = util_double_max( error_min , error * abs( double_vector_iget( value , restart_nr ))); - double_vector_iset( std , restart_nr , tmp_std); - } - } else - util_abort("%s: Internal error. Unknown error mode \"%s\"\n", __func__, error_mode); - - - // Handle SEGMENTs which can be used to customize the observation error. */ - { - stringlist_type * segment_keys = conf_instance_alloc_list_of_sub_instances_of_class_by_name(conf_instance, "SEGMENT"); - stringlist_sort( segment_keys , NULL ); - - int num_segments = stringlist_get_size(segment_keys); - - for(int segment_nr = 0; segment_nr < num_segments; segment_nr++) - { - const char * segment_name = stringlist_iget(segment_keys, segment_nr); - const conf_instance_type * segment_conf = conf_instance_get_sub_instance_ref(conf_instance, segment_name); - - int start = conf_instance_get_item_value_int( segment_conf, "START" ); - int stop = conf_instance_get_item_value_int( segment_conf, "STOP" ); - double error_segment = conf_instance_get_item_value_double(segment_conf, "ERROR" ); - double error_min_segment = conf_instance_get_item_value_double(segment_conf, "ERROR_MIN" ); - const char * error_mode_segment = conf_instance_get_item_value_ref( segment_conf, "ERROR_MODE"); - - if(start < 0) - { - printf("%s: WARNING - Segment out of bounds. Truncating start of segment to 0.\n", __func__); - start = 0; - } - - if(stop >= size) - { - printf("%s: WARNING - Segment out of bounds. Truncating end of segment to %d.\n", __func__, size - 1); - stop = size -1; - } - - if(start > stop) - { - printf("%s: WARNING - Segment start after stop. Truncating end of segment to %d.\n", __func__, start ); - stop = start; - } - - // Create the standard deviation vector - if(strcmp(error_mode_segment, "ABS") == 0) { - for( restart_nr = start; restart_nr <= stop; restart_nr++) - double_vector_iset( std , restart_nr , error_segment) ; - } else if(strcmp(error_mode_segment, "REL") == 0) { - for( restart_nr = start; restart_nr <= stop; restart_nr++) - double_vector_iset( std , restart_nr , error_segment * abs(double_vector_iget( value , restart_nr))); - } else if(strcmp(error_mode_segment, "RELMIN") == 0) { - for(restart_nr = start; restart_nr <= stop ; restart_nr++) { - double tmp_std = util_double_max( error_min_segment , error_segment * abs( double_vector_iget( value , restart_nr ))); - double_vector_iset( std , restart_nr , tmp_std); - } - } else - util_abort("%s: Internal error. Unknown error mode \"%s\"\n", __func__, error_mode); - } - stringlist_free(segment_keys); - } - - - /* - This is where the summary observations are finally added. - */ - for (restart_nr = 0; restart_nr < size; restart_nr++) { - if (bool_vector_safe_iget( valid , restart_nr)) { - if (double_vector_iget( std , restart_nr) > std_cutoff) { - obs_vector_add_summary_obs( obs_vector , restart_nr , sum_key , sum_key , - double_vector_iget( value ,restart_nr) , double_vector_iget( std , restart_nr ) , - auto_corrf_name , auto_corrf_param); - } else - fprintf(stderr,"** Warning: to small observation error in observation %s:%d - ignored. \n", sum_key , restart_nr); - } - } - initOK = true; - } - double_vector_free(std); - double_vector_free(value); - bool_vector_free(valid); - return initOK; - } -} - - - -static const char * __summary_kw( const char * field_name ) { - if (strcmp( field_name , "PRESSURE") == 0) - return "BPR"; - else if (strcmp( field_name , "SWAT") == 0) - return "BSWAT"; - else if (strcmp( field_name , "SGAS") == 0) - return "BSGAS"; - else { - util_abort("%s: sorry - could not \'translate\' field:%s to block summayr variable\n",__func__ , field_name); - return NULL; - } -} - - -obs_vector_type * obs_vector_alloc_from_BLOCK_OBSERVATION(const conf_instance_type * conf_instance , - const ecl_grid_type * grid , - const ecl_sum_type * refcase , - const history_type * history, - ensemble_config_type * ensemble_config, - const time_t_vector_type * obs_time) { - - if(!conf_instance_is_of_class(conf_instance, "BLOCK_OBSERVATION")) - util_abort("%s: internal error. expected \"BLOCK_OBSERVATION\" instance, got \"%s\".\n", - __func__, conf_instance_get_class_name_ref(conf_instance) ); - - block_obs_source_type source_type = SOURCE_SUMMARY; - const char * obs_label = conf_instance_get_name_ref(conf_instance); - const char * source_string = conf_instance_get_item_value_ref(conf_instance , "SOURCE"); - const char * field_name = conf_instance_get_item_value_ref(conf_instance , "FIELD"); - const char * sum_kw = NULL; - bool OK = true; - - if (strcmp(source_string , "FIELD") == 0) { - source_type = SOURCE_FIELD; - if (!ensemble_config_has_key( ensemble_config , field_name)) { - OK = false; - fprintf(stderr,"** Warning the ensemble key:%s does not exist - observation:%s not added \n", field_name , obs_label); - } - } else if (strcmp( source_string , "SUMMARY") == 0) { - source_type = SOURCE_SUMMARY; - sum_kw = __summary_kw( field_name ); - } else - util_abort("%s: internal error \n",__func__); - - if (OK) { - obs_vector_type * obs_vector = NULL; - int size = history_get_last_restart( history ); - int obs_restart_nr ; - - stringlist_type * summary_keys = stringlist_alloc_new(); - stringlist_type * obs_pt_keys = conf_instance_alloc_list_of_sub_instances_of_class_by_name(conf_instance, "OBS"); - int num_obs_pts = stringlist_get_size(obs_pt_keys); - - double * obs_value = util_calloc(num_obs_pts , sizeof * obs_value); - double * obs_std = util_calloc(num_obs_pts , sizeof * obs_std ); - int * obs_i = util_calloc(num_obs_pts , sizeof * obs_i ); - int * obs_j = util_calloc(num_obs_pts , sizeof * obs_j ); - int * obs_k = util_calloc(num_obs_pts , sizeof * obs_k ); - - obs_restart_nr = __conf_instance_get_restart_nr(conf_instance , obs_label , history , size); - - /** Build the observation. */ - for(int obs_pt_nr = 0; obs_pt_nr < num_obs_pts; obs_pt_nr++) { - const char * obs_key = stringlist_iget(obs_pt_keys, obs_pt_nr); - const conf_instance_type * obs_instance = conf_instance_get_sub_instance_ref(conf_instance, obs_key); - const char * error_mode = conf_instance_get_item_value_ref(obs_instance, "ERROR_MODE"); - double error = conf_instance_get_item_value_double(obs_instance, "ERROR"); - double value = conf_instance_get_item_value_double(obs_instance, "VALUE"); - double min_error = conf_instance_get_item_value_double(obs_instance, "ERROR_MIN"); - - if (strcmp( error_mode , "REL") == 0) - error *= value; - else if (strcmp( error_mode , "RELMIN") == 0) - error = util_double_max( error * value , min_error ); - - obs_value[obs_pt_nr] = value; - obs_std [obs_pt_nr] = error; - - /** - The input values i,j,k come from the user, and are offset 1. They - are immediately shifted with -1 to become C-based offset zero. - */ - obs_i[obs_pt_nr] = conf_instance_get_item_value_int( obs_instance, "I") - 1; - obs_j[obs_pt_nr] = conf_instance_get_item_value_int( obs_instance, "J") - 1; - obs_k[obs_pt_nr] = conf_instance_get_item_value_int( obs_instance, "K") - 1; - - if (source_type == SOURCE_SUMMARY) { - char * summary_key = smspec_alloc_block_ijk_key( SUMMARY_KEY_JOIN_STRING , sum_kw , - obs_i[obs_pt_nr] + 1 , - obs_j[obs_pt_nr] + 1 , - obs_k[obs_pt_nr] + 1 ); - - stringlist_append_owned_ref( summary_keys , summary_key ); - } - } - - - if (source_type == SOURCE_FIELD) { - const enkf_config_node_type * config_node = ensemble_config_get_node( ensemble_config , field_name); - const field_config_type * field_config = enkf_config_node_get_ref( config_node ); - block_obs_type * block_obs = block_obs_alloc(obs_label, source_type , NULL , field_config , grid , num_obs_pts, obs_i, obs_j, obs_k, obs_value, obs_std); - - if (block_obs != NULL) { - obs_vector = obs_vector_alloc( BLOCK_OBS , obs_label , ensemble_config_get_node(ensemble_config , field_name) , obs_time , size ); - obs_vector_install_node( obs_vector , obs_restart_nr , block_obs); - } - } else if (source_type == SOURCE_SUMMARY) { - OK = true; - if (refcase != NULL) { - for (int i=0; i < stringlist_get_size( summary_keys ); i++) { - const char * sum_key = stringlist_iget( summary_keys , i ); - if (!ecl_sum_has_key(refcase , sum_key)) { - /* - If the - */ - fprintf(stderr,"** Warning missing summary %s for cell: (%d,%d,%d) in refcase - make sure that \"BPR %d %d %d\" is included in ECLIPSE summary specification \n" , - sum_key , obs_i[i]+1 , obs_j[i]+1 , obs_k[i]+1 , obs_i[i]+1 , obs_j[i]+1 , obs_k[i]+1 ); - //OK = false; - } - } - } - if (OK) { - // We can create the container node and add the summary nodes. - enkf_config_node_type * container_config = ensemble_config_add_container( ensemble_config , NULL ); - - for (int i=0; i < stringlist_get_size( summary_keys ); i++) { - const char * sum_key = stringlist_iget( summary_keys , i ); - enkf_config_node_type * child_node = ensemble_config_add_summary( ensemble_config , sum_key , LOAD_FAIL_WARN ); - enkf_config_node_update_container( container_config , child_node ); - } - - { - block_obs_type * block_obs = block_obs_alloc(obs_label, source_type , summary_keys , container_config , grid , num_obs_pts, obs_i, obs_j, obs_k, obs_value, obs_std); - if (block_obs != NULL) { - obs_vector = obs_vector_alloc( BLOCK_OBS , obs_label , container_config , obs_time , size ); - obs_vector_install_node( obs_vector , obs_restart_nr , block_obs); - } - } - } - } else - util_abort("%s: invalid source value \n",__func__); - - free(obs_value); - free(obs_std); - free(obs_i); - free(obs_j); - free(obs_k); - stringlist_free(obs_pt_keys); - stringlist_free(summary_keys); - - return obs_vector; - } else { - fprintf(stderr,"** Warning the ensemble key:%s does not exist - observation:%s not added \n", field_name , obs_label); - return NULL; - } -} -/*****************************************************************/ - -void obs_vector_iget_observations(const obs_vector_type * obs_vector , int report_step , obs_data_type * obs_data, const active_list_type * active_list) { - void * obs_node = vector_iget( obs_vector->nodes , report_step ); - if ( obs_node != NULL) - obs_vector->get_obs(obs_node , obs_data , report_step , active_list); -} - - -void obs_vector_measure(const obs_vector_type * obs_vector , enkf_fs_type * fs , state_enum state , int report_step , const enkf_state_type * enkf_state , meas_data_type * meas_data , const active_list_type * active_list) { - - void * obs_node = vector_iget( obs_vector->nodes , report_step ); - if ( obs_node != NULL ) { - enkf_node_type * enkf_node = enkf_state_get_node( enkf_state , obs_vector_get_state_kw( obs_vector )); - node_id_type node_id = { .report_step = report_step , - .state = state , - .iens = enkf_state_get_iens( enkf_state ) }; - - enkf_node_load(enkf_node , fs , node_id); - obs_vector->measure(obs_node , enkf_node_value_ptr(enkf_node) , node_id , meas_data , active_list); - } -} - - - -/*****************************************************************/ -/** Here comes many different functions for misfit calculations. */ - -/** - This is the lowest level function: - - * It is checked that the obs_vector is active for the actual report - step; if it is not active 0.0 is returned without any further - ado. - - * It is assumed the enkf_node_instance contains valid data for this - report_step. This is not checked in this function, and is the - responsability of the calling scope. - - * The underlying chi2 function will do a type-check of node - and - fail hard if it is not correct. - -*/ - - -static double obs_vector_chi2__(const obs_vector_type * obs_vector , int report_step , const enkf_node_type * node, node_id_type node_id) { - void * obs_node = vector_iget( obs_vector->nodes , report_step ); - - if ( obs_node != NULL) - return obs_vector->chi2( obs_node , enkf_node_value_ptr( node ), node_id); - else - return 0.0; /* Observation not active for this report step. */ - -} - - - - - -double obs_vector_chi2(const obs_vector_type * obs_vector , enkf_fs_type * fs , node_id_type node_id) { - enkf_node_type * enkf_node = enkf_node_alloc( obs_vector->config_node ); - double chi2 = 0; - - if (enkf_node_try_load( enkf_node , fs , node_id)) - chi2 = obs_vector_chi2__(obs_vector , node_id.report_step , enkf_node , node_id); - - enkf_node_free( enkf_node ); - return chi2; -} - - - - -/** - This function will evaluate the chi2 for the ensemble members - [iens1,iens2) and report steps [step1,step2). - - Observe that the chi2 pointer is assumed to be allocated for the - complete ensemble, altough this function only operates on part of - it. -*/ - - -//This will not work for container observations ..... - -void obs_vector_ensemble_chi2(const obs_vector_type * obs_vector , - enkf_fs_type * fs, - bool_vector_type * valid , - int step1 , - int step2 , - int iens1 , - int iens2 , - state_enum load_state , - double ** chi2) { - - int step; - enkf_node_type * enkf_node = enkf_node_alloc( obs_vector->config_node ); - node_id_type node_id; - node_id.state = load_state; - for (step = step1; step <= step2; step++) { - int iens; - node_id.report_step = step; - { - void * obs_node = vector_iget( obs_vector->nodes , step); - - if (obs_node == NULL) { - for (iens = iens1; iens < iens2; iens++) - chi2[step][iens] = 0; - } else { - for (iens = iens1; iens < iens2; iens++) { - node_id.iens = iens; - if (enkf_node_try_load( enkf_node , fs , node_id)) - chi2[step][iens] = obs_vector_chi2__(obs_vector , step , enkf_node , node_id); - else { - chi2[step][iens] = 0; - // Missing data - this member will be marked as invalid in the misfit calculations. - bool_vector_iset( valid , iens , false ); - } - } - } - } - } - enkf_node_free( enkf_node ); -} - - - -/** - This function will evaluate the total chi2 for one ensemble member - (i.e. sum over report steps). -*/ - - -double obs_vector_total_chi2(const obs_vector_type * obs_vector , enkf_fs_type * fs , int iens, state_enum load_state) { - int report_step; - double sum_chi2 = 0; - enkf_node_type * enkf_node = enkf_node_alloc( obs_vector->config_node ); - node_id_type node_id = {.report_step = 0, .iens = iens , .state = load_state }; - - for (report_step = 0; report_step < vector_get_size( obs_vector->nodes ); report_step++) { - if (vector_iget(obs_vector->nodes , report_step) != NULL) { - node_id.report_step = report_step; - - if (enkf_node_try_load( enkf_node , fs , node_id)) - sum_chi2 += obs_vector_chi2__(obs_vector , report_step , enkf_node, node_id); - - } - } - enkf_node_free( enkf_node ); - return sum_chi2; -} - - -/** - This function will sum up all timesteps of the obs_vector, for all ensemble members. -*/ - -void obs_vector_ensemble_total_chi2(const obs_vector_type * obs_vector , enkf_fs_type * fs , int ens_size , state_enum load_state , double * sum_chi2) { - const bool verbose = true; - msg_type * msg; - int report_step; - int iens; - char * msg_text = NULL; - - for (iens = 0; iens < ens_size; iens++) - sum_chi2[iens] = 0; - - if (verbose) { - msg = msg_alloc("Observation: " , false); - msg_show(msg); - } - - { - node_id_type node_id = {.report_step = 0, .iens = iens , .state = load_state }; - enkf_node_type * enkf_node = enkf_node_alloc( obs_vector->config_node ); - for (report_step = 0; report_step < vector_get_size( obs_vector->nodes); report_step++) { - if (verbose) { - msg_text = util_realloc_sprintf( msg_text , "%s[%03d]" , obs_vector->obs_key , report_step); - msg_update(msg , msg_text); - } - if (vector_iget(obs_vector->nodes , report_step) != NULL) { - node_id.report_step = report_step; - for (iens = 0; iens < ens_size; iens++) { - node_id.iens = iens; - - if (enkf_node_try_load( enkf_node , fs , node_id)) - sum_chi2[iens] += obs_vector_chi2__(obs_vector , report_step , enkf_node, node_id); - - } - } - } - enkf_node_free( enkf_node ); - } - - if (verbose) { - msg_free(msg , true); - util_safe_free( msg_text ); - } -} - -const char * obs_vector_get_obs_key( const obs_vector_type * obs_vector) { - return obs_vector->obs_key; -} - - -/*****************************************************************/ - - -VOID_FREE(obs_vector) - diff --git a/ThirdParty/Ert/devel/libenkf/src/site_config.c b/ThirdParty/Ert/devel/libenkf/src/site_config.c index 206b19ca2d..b112d6d87a 100644 --- a/ThirdParty/Ert/devel/libenkf/src/site_config.c +++ b/ThirdParty/Ert/devel/libenkf/src/site_config.c @@ -113,10 +113,6 @@ struct site_config_struct { int max_running_local_site; - int max_running_torque_site; - - - job_driver_type driver_type; job_driver_type driver_type_site; int max_submit; @@ -421,45 +417,36 @@ static void site_config_select_TORQUE_job_queue(site_config_type * site_config) /*****************************************************************/ -/** - This is quite awkward because the max_running variable is located - both in the job_queue instance, and in each separate driver - individually: - - o If you call set_max_running - i.e. without specifiying a - particular driver, it will tell the queue system to use this - many jobs, and also look up the currently active driver and - update the internal info on that. - - o If you tell a specific driver a value for max_running, it will - update the internal field for that driver, AND the queue IFF the - queue is currently running this driver; otherwise the queue will - be left untouched. - - What a mess. - */ +/*****************************************************************/ +static int site_config_get_queue_max_running_option(queue_driver_type * driver) { + const char * max_running_string = queue_driver_get_option(driver, MAX_RUNNING); + int max_running = 0; + if(!util_sscanf_int(max_running_string, &max_running)) { + fprintf(stderr, "** Warning: String:%s for max_running is not parsable as int, using 0\n", max_running_string); + } + return max_running; +} -void site_config_set_max_running(site_config_type * site_config, int max_running) { - queue_driver_set_max_running(site_config->current_driver, max_running); /* We set the max running of the current driver */ +static void site_config_set_queue_max_running_option(site_config_type * site_config, const char* driver_name, int max_running) { + char* max_running_string = util_alloc_sprintf("%d", max_running); + site_config_set_queue_option(site_config, driver_name, MAX_RUNNING, max_running_string); + free(max_running_string); } void site_config_set_max_running_lsf(site_config_type * site_config, int max_running_lsf) { - queue_driver_type * lsf_driver = site_config_get_queue_driver(site_config, LSF_DRIVER_NAME); - queue_driver_set_max_running(lsf_driver, max_running_lsf); - + site_config_set_queue_max_running_option(site_config, LSF_DRIVER_NAME, max_running_lsf); if (!site_config->user_mode) site_config->max_running_lsf_site = max_running_lsf; } int site_config_get_max_running_lsf(const site_config_type * site_config) { queue_driver_type * lsf_driver = site_config_get_queue_driver(site_config, LSF_DRIVER_NAME); - return queue_driver_get_max_running(lsf_driver); + return site_config_get_queue_max_running_option(lsf_driver); } void site_config_set_max_running_rsh(site_config_type * site_config, int max_running_rsh) { - queue_driver_type * rsh_driver = site_config_get_queue_driver(site_config, RSH_DRIVER_NAME); - queue_driver_set_max_running(rsh_driver, max_running_rsh); + site_config_set_queue_max_running_option(site_config, RSH_DRIVER_NAME, max_running_rsh); if (!site_config->user_mode) site_config->max_running_rsh_site = max_running_rsh; @@ -467,12 +454,11 @@ void site_config_set_max_running_rsh(site_config_type * site_config, int max_run int site_config_get_max_running_rsh(const site_config_type * site_config) { queue_driver_type * rsh_driver = site_config_get_queue_driver(site_config, RSH_DRIVER_NAME); - return queue_driver_get_max_running(rsh_driver); + return site_config_get_queue_max_running_option(rsh_driver); } void site_config_set_max_running_local(site_config_type * site_config, int max_running_local) { - queue_driver_type * local_driver = site_config_get_queue_driver(site_config, LOCAL_DRIVER_NAME); - queue_driver_set_max_running(local_driver, max_running_local); + site_config_set_queue_max_running_option(site_config, LOCAL_DRIVER_NAME, max_running_local); if (!site_config->user_mode) site_config->max_running_local_site = max_running_local; @@ -480,20 +466,7 @@ void site_config_set_max_running_local(site_config_type * site_config, int max_r int site_config_get_max_running_local(const site_config_type * site_config) { queue_driver_type * local_driver = site_config_get_queue_driver(site_config, LOCAL_DRIVER_NAME); - return queue_driver_get_max_running(local_driver); -} - -void site_config_set_max_running_torque(site_config_type * site_config, int max_running_torque) { - queue_driver_type * torque_driver = site_config_get_queue_driver(site_config, TORQUE_DRIVER_NAME); - queue_driver_set_max_running(torque_driver, max_running_torque); - - if (!site_config->user_mode) - site_config->max_running_torque_site = max_running_torque; -} - -int site_config_get_max_running_torque(const site_config_type * site_config) { - queue_driver_type * torque_driver = site_config_get_queue_driver(site_config, TORQUE_DRIVER_NAME); - return queue_driver_get_max_running(torque_driver); + return site_config_get_queue_max_running_option(local_driver); } /*****************************************************************/ @@ -775,10 +748,6 @@ bool site_config_init(site_config_type * site_config, const config_type * config } } - /* Torque options */ - if (config_item_set(config, MAX_RUNNING_TORQUE_KEY)) - site_config_set_max_running_torque(site_config, config_get_value_as_int(config, MAX_RUNNING_TORQUE_KEY)); - if (config_item_set(config, QUEUE_SYSTEM_KEY)) { job_driver_type driver_type; @@ -982,25 +951,18 @@ void site_config_fprintf_config(const site_config_type * site_config, FILE * str } { - queue_driver_type * rsh_driver = site_config_get_queue_driver( site_config , RSH_DRIVER_NAME ); - hash_type * host_list = hash_safe_cast( (void *) queue_driver_get_option( rsh_driver , RSH_HOSTLIST ) ); - hash_iter_type * iter = hash_iter_alloc( host_list ); - while (!hash_iter_is_complete( iter )) { - const char * host_name = hash_iter_get_next_key( iter ); - fprintf(stream , CONFIG_KEY_FORMAT , RSH_HOST_KEY ); - fprintf(stream , "%s:%d\n" , host_name , hash_get_int( host_list , host_name)); + queue_driver_type * rsh_driver = site_config_get_queue_driver(site_config, RSH_DRIVER_NAME); + hash_type * host_list = hash_safe_cast((void *) queue_driver_get_option(rsh_driver, RSH_HOSTLIST)); + hash_iter_type * iter = hash_iter_alloc(host_list); + while (!hash_iter_is_complete(iter)) { + const char * host_name = hash_iter_get_next_key(iter); + fprintf(stream, CONFIG_KEY_FORMAT, RSH_HOST_KEY); + fprintf(stream, "%s:%d\n", host_name, hash_get_int(host_list, host_name)); } hash_iter_free(iter); } } - /* Storing TORQUE settings. */ - { - if (site_config_get_max_running_torque(site_config) != site_config->max_running_torque_site) { - fprintf(stream, CONFIG_KEY_FORMAT, MAX_RUNNING_TORQUE_KEY); - fprintf(stream, CONFIG_INT_FORMAT, site_config_get_max_running_torque(site_config)); - fprintf(stream, "\n"); - } - } + fprintf(stream, "\n\n"); } @@ -1025,11 +987,6 @@ void site_config_add_queue_config_items(config_type * config, bool site_mode) { "MAX_RUNNING_LOCAL" }, 1); - // TODO: Hva er dette for noe greier - // stringlist_type * torque_dep = stringlist_alloc_argv_ref((const char *[1]) { - // "MAX_RUNNING_TORQUE"}, 1); - // - if (site_mode) { config_schema_item_set_common_selection_set(item, 3, (const char *[3]) { @@ -1114,10 +1071,7 @@ void site_config_add_config_items(config_type * config, bool site_mode) { item = config_add_schema_item(config, MAX_RUNNING_LOCAL_KEY, false); config_schema_item_set_argc_minmax(item, 1, 1); config_schema_item_iset_type(item, 0, CONFIG_INT); - - item = config_add_schema_item(config, MAX_RUNNING_TORQUE_KEY, false); - config_schema_item_set_argc_minmax(item, 1, 1); - config_schema_item_iset_type(item, 0, CONFIG_INT); + /*****************************************************************/ item = config_add_schema_item(config, QUEUE_OPTION_KEY, false); diff --git a/ThirdParty/Ert/devel/libenkf/tests/CMakeLists.txt b/ThirdParty/Ert/devel/libenkf/tests/CMakeLists.txt index 7f959cf417..fbfba306bd 100644 --- a/ThirdParty/Ert/devel/libenkf/tests/CMakeLists.txt +++ b/ThirdParty/Ert/devel/libenkf/tests/CMakeLists.txt @@ -88,20 +88,20 @@ add_executable( enkf_refcase_list enkf_refcase_list.c ) target_link_libraries( enkf_refcase_list enkf ) add_test( enkf_refcase_list ${EXECUTABLE_OUTPUT_PATH}/enkf_refcase_list ${PROJECT_SOURCE_DIR}/test-data/Statoil/ECLIPSE/Gurbat/ECLIPSE ${PROJECT_SOURCE_DIR}/test-data/Statoil/ECLIPSE/Gurbat*/ECLIPSE) add_test( enkf_refcase_list2 ${EXECUTABLE_OUTPUT_PATH}/enkf_refcase_list ${PROJECT_SOURCE_DIR}/test-data/Statoil/ECLIPSE/Gurbat/ECLIPSE ${PROJECT_SOURCE_DIR}/test-data/Statoil/ECLIPSE/Gurbat*/ECLIPSE.*) -set_property( TEST enkf_refcase_list PROPERTY LABELS Statoil ) -set_property( TEST enkf_refcase_list2 PROPERTY LABELS Statoil ) +set_property( TEST enkf_refcase_list PROPERTY LABELS StatoilData ) +set_property( TEST enkf_refcase_list2 PROPERTY LABELS StatoilData ) add_executable( enkf_ecl_config enkf_ecl_config.c ) target_link_libraries( enkf_ecl_config enkf ) add_test( enkf_ecl_config1 ${EXECUTABLE_OUTPUT_PATH}/enkf_ecl_config ) add_test( enkf_ecl_config2 ${EXECUTABLE_OUTPUT_PATH}/enkf_ecl_config ${PROJECT_SOURCE_DIR}/test-data/Statoil/ECLIPSE/Gurbat/ECLIPSE) -set_property( TEST enkf_ecl_config2 PROPERTY LABELS Statoil ) +set_property( TEST enkf_ecl_config2 PROPERTY LABELS StatoilData ) add_executable( enkf_ecl_config_config enkf_ecl_config_config.c ) target_link_libraries( enkf_ecl_config_config enkf ) add_test( enkf_ecl_config_config ${EXECUTABLE_OUTPUT_PATH}/enkf_ecl_config_config ${PROJECT_SOURCE_DIR}/test-data/Statoil/config/ecl_config ) -set_property( TEST enkf_ecl_config_config PROPERTY LABELS Statoil ) +set_property( TEST enkf_ecl_config_config PROPERTY LABELS StatoilData ) add_test( enkf_runpath_list ${EXECUTABLE_OUTPUT_PATH}/enkf_runpath_list ) add_test( enkf_site_config ${EXECUTABLE_OUTPUT_PATH}/enkf_site_config /project/res/etc/ERT/site-config) @@ -111,10 +111,10 @@ add_test( enkf_ensemble_GEN_PARAM ${EXECUTABLE_OUTPUT_PATH}/enkf_ensemble_GEN_P add_test( enkf_ensemble ${EXECUTABLE_OUTPUT_PATH}/enkf_ensemble ) -set_property( TEST enkf_time_map2 PROPERTY LABELS Statoil ) -set_property( TEST enkf_site_config PROPERTY LABELS Statoil ) -set_property( TEST enkf_forward_init_SURFACE_FALSE PROPERTY LABELS Statoil ) -set_property( TEST enkf_forward_init_SURFACE_TRUE PROPERTY LABELS Statoil ) -set_property( TEST enkf_forward_init_FIELD_FALSE PROPERTY LABELS Statoil ) -set_property( TEST enkf_forward_init_FIELD_TRUE PROPERTY LABELS Statoil ) +set_property( TEST enkf_time_map2 PROPERTY LABELS StatoilData ) +set_property( TEST enkf_site_config PROPERTY LABELS StatoilData ) +set_property( TEST enkf_forward_init_SURFACE_FALSE PROPERTY LABELS StatoilData ) +set_property( TEST enkf_forward_init_SURFACE_TRUE PROPERTY LABELS StatoilData ) +set_property( TEST enkf_forward_init_FIELD_FALSE PROPERTY LABELS StatoilData ) +set_property( TEST enkf_forward_init_FIELD_TRUE PROPERTY LABELS StatoilData ) diff --git a/ThirdParty/Ert/devel/libert_util/include/ert/util/test_util.h b/ThirdParty/Ert/devel/libert_util/include/ert/util/test_util.h index 27bc4a7a6e..1083b21b08 100644 --- a/ThirdParty/Ert/devel/libert_util/include/ert/util/test_util.h +++ b/ThirdParty/Ert/devel/libert_util/include/ert/util/test_util.h @@ -98,6 +98,8 @@ extern "C" { void test_util_addr2line(); #endif + void test_install_SIGNALS(void); + #ifdef __cplusplus } #endif diff --git a/ThirdParty/Ert/devel/libert_util/include/ert/util/type_macros.h b/ThirdParty/Ert/devel/libert_util/include/ert/util/type_macros.h index c4e1156f01..aeefb0d4e9 100644 --- a/ThirdParty/Ert/devel/libert_util/include/ert/util/type_macros.h +++ b/ThirdParty/Ert/devel/libert_util/include/ert/util/type_macros.h @@ -95,6 +95,41 @@ const type ## _type * type ## _safe_cast_const( const void * __arg ) { } #define UTIL_SAFE_CAST_HEADER_CONST( type ) const type ## _type * type ## _safe_cast_const( const void * __arg ) + + + +#define UTIL_TRY_CAST_FUNCTION(type , TYPE_ID) \ +type ## _type * type ## _try_cast( void * __arg ) { \ + if (__arg == NULL) \ + return NULL; \ + { \ + type ## _type * arg = (type ## _type *) __arg; \ + if ( arg->__type_id == TYPE_ID) \ + return arg; \ + else \ + return NULL; \ + } \ +} +#define UTIL_TRY_CAST_HEADER( type ) type ## _type * type ## _try_cast( void * __arg ) + + +#define UTIL_TRY_CAST_FUNCTION_CONST(type , TYPE_ID) \ +const type ## _type * type ## _try_cast_const( const void * __arg ) { \ + if (__arg == NULL) \ + return NULL; \ + { \ + const type ## _type * arg = (type ## _type *) __arg; \ + if ( arg->__type_id == TYPE_ID) \ + return arg; \ + else \ + return NULL; \ + } \ +} +#define UTIL_TRY_CAST_HEADER_CONST( type ) const type ## _type * type ## _try_cast_const( const void * __arg ) + + + + #define UTIL_TYPE_ID_DECLARATION int __type_id #define UTIL_TYPE_ID_INIT(var , TYPE_ID) var->__type_id = TYPE_ID; diff --git a/ThirdParty/Ert/devel/libert_util/include/ert/util/vector.h b/ThirdParty/Ert/devel/libert_util/include/ert/util/vector.h index 2f8e44ef89..b6f0cee0d9 100644 --- a/ThirdParty/Ert/devel/libert_util/include/ert/util/vector.h +++ b/ThirdParty/Ert/devel/libert_util/include/ert/util/vector.h @@ -24,6 +24,7 @@ extern "C" { #endif #include #include +#include typedef void ( vector_func_type ) (void * , void *); typedef int ( vector_cmp_ftype) (const void * , const void *); @@ -75,6 +76,7 @@ extern "C" { void * vector_pop_back(vector_type * ); void * vector_pop_front(vector_type * ); void vector_sort(vector_type * vector , vector_cmp_ftype * cmp); + int_vector_type * vector_alloc_sort_perm(const vector_type * vector , vector_cmp_ftype * cmp); void vector_inplace_reverse(vector_type * vector); vector_type * vector_alloc_copy(const vector_type * src , bool deep_copy); diff --git a/ThirdParty/Ert/devel/libert_util/include/ert/util/vector_template.h b/ThirdParty/Ert/devel/libert_util/include/ert/util/vector_template.h index 5e94d3461a..2ae2b65317 100644 --- a/ThirdParty/Ert/devel/libert_util/include/ert/util/vector_template.h +++ b/ThirdParty/Ert/devel/libert_util/include/ert/util/vector_template.h @@ -51,6 +51,7 @@ typedef @TYPE@ (@TYPE@_ftype) (@TYPE@); @TYPE@_vector_type * @TYPE@_vector_alloc_copy( const @TYPE@_vector_type * src); void @TYPE@_vector_imul(@TYPE@_vector_type * vector, int index, @TYPE@ factor); void @TYPE@_vector_scale(@TYPE@_vector_type * vector, @TYPE@ factor); + void @TYPE@_vector_div(@TYPE@_vector_type * vector, @TYPE@ divisor); @TYPE@ @TYPE@_vector_reverse_iget(const @TYPE@_vector_type * vector , int index); @TYPE@ @TYPE@_vector_iget(const @TYPE@_vector_type * , int); @TYPE@ @TYPE@_vector_safe_iget(const @TYPE@_vector_type * , int); diff --git a/ThirdParty/Ert/devel/libert_util/src/test_util.c b/ThirdParty/Ert/devel/libert_util/src/test_util.c index d2c95ea53e..13e60e147b 100644 --- a/ThirdParty/Ert/devel/libert_util/src/test_util.c +++ b/ThirdParty/Ert/devel/libert_util/src/test_util.c @@ -22,6 +22,7 @@ #include #include #include +#include #include #include @@ -156,7 +157,7 @@ void test_assert_ptr_equal__( const void * p1 , const void * p2 , const char * f void test_assert_ptr_not_equal__( const void * p1 , const void * p2 , const char * file , int line) { bool equal = (p1 == p2); if (equal) - test_error_exit( "%s:%d => Pointers are different p1:[%p] p2:[%p]\n" , file , line , p1 , p2 ); + test_error_exit( "%s:%d => Pointers are equal p1:[%p] p2:[%p]\n" , file , line , p1 , p2 ); } @@ -204,6 +205,14 @@ void test_assert_double_not_equal__( double d1 , double d2, const char * file , test_error_exit( "%s:%d => double values:%15.12g %15.12g are equal.\n" , file , line , d1 , d2); } +/*****************************************************************/ + +void test_install_SIGNALS(void) { + signal(SIGSEGV , util_abort_signal); /* Segmentation violation, i.e. overwriting memory ... */ + signal(SIGINT , util_abort_signal); /* Control C */ + signal(SIGTERM , util_abort_signal); /* If killing the program with SIGTERM (the default kill signal) you will get a backtrace. + Killing with SIGKILL (-9) will not give a backtrace.*/ +} /*****************************************************************/ diff --git a/ThirdParty/Ert/devel/libert_util/src/vector.c b/ThirdParty/Ert/devel/libert_util/src/vector.c index 99fa0c445e..63ae3a0c4c 100644 --- a/ThirdParty/Ert/devel/libert_util/src/vector.c +++ b/ThirdParty/Ert/devel/libert_util/src/vector.c @@ -43,6 +43,7 @@ struct vector_struct { typedef struct { vector_cmp_ftype * user_cmp; node_data_type * data; + int index; } vector_sort_node_type; @@ -555,29 +556,50 @@ static int vector_cmp(const void * s1 , const void * s2) { */ +static vector_sort_node_type * vector_alloc_sort_data( const vector_type * vector , vector_cmp_ftype * cmp) { + vector_sort_node_type * sort_data = util_calloc( vector->size , sizeof * sort_data ); + int i; + + /* Fill up the temporary storage used for sorting */ + for (i = 0; i < vector->size; i++) { + sort_data[i].data = vector->data[i]; + sort_data[i].user_cmp = cmp; + sort_data[i].index = i; + } + + /* Sort the temporary vector */ + qsort(sort_data , vector->size , sizeof * sort_data , vector_cmp); + + return sort_data; +} + void vector_sort(vector_type * vector , vector_cmp_ftype * cmp) { - vector_sort_node_type * sort_data = util_calloc( vector->size , sizeof * sort_data ); - { - int i; - - /* Fill up the temporary storage used for sorting */ - for (i = 0; i < vector->size; i++) { - sort_data[i].data = vector->data[i]; - sort_data[i].user_cmp = cmp; - } - - /* Sort the temporary vector */ - qsort(sort_data , vector->size , sizeof * sort_data , vector_cmp); - - /* Recover the sorted vector */ - for (i = 0; i < vector->size; i++) - vector->data[i] = sort_data[i].data; - } + vector_sort_node_type * sort_data = vector_alloc_sort_data( vector , cmp ); + int i; + /* Recover the sorted vector */ + for (i = 0; i < vector->size; i++) + vector->data[i] = sort_data[i].data; + free( sort_data ); } +int_vector_type * vector_alloc_sort_perm(const vector_type * vector , vector_cmp_ftype * cmp) { + vector_sort_node_type * sort_data = vector_alloc_sort_data( vector , cmp ); + int_vector_type * sort_perm = int_vector_alloc(0,0); + int i; + for (i = 0; i < vector->size; i++) + int_vector_iset( sort_perm , i , sort_data[i].index); + + free( sort_data ); + return sort_perm; +} + + + + + void vector_inplace_reverse(vector_type * vector) { if (vector->size > 0) { node_data_type ** new_data = util_calloc( vector->size , sizeof * new_data ); diff --git a/ThirdParty/Ert/devel/libert_util/src/vector_template.c b/ThirdParty/Ert/devel/libert_util/src/vector_template.c index c032a184c6..5ae8e9bb4b 100644 --- a/ThirdParty/Ert/devel/libert_util/src/vector_template.c +++ b/ThirdParty/Ert/devel/libert_util/src/vector_template.c @@ -500,6 +500,15 @@ void @TYPE@_vector_scale(@TYPE@_vector_type * vector, @TYPE@ factor) { vector->data[i] *= factor; } + +/* Vector / scalar; seperate _div function to ensure correct integer division. */ +void @TYPE@_vector_div(@TYPE@_vector_type * vector, @TYPE@ divisor) { + int i; + for (i=0; i < vector->size; i++) + vector->data[i] /= divisor; +} + + /* vector + scalar */ void @TYPE@_vector_shift(@TYPE@_vector_type * vector, @TYPE@ delta) { int i; diff --git a/ThirdParty/Ert/devel/libert_util/tests/ert_util_type_vector_test.c b/ThirdParty/Ert/devel/libert_util/tests/ert_util_type_vector_test.c index 78649421f2..a3d44d5c3e 100644 --- a/ThirdParty/Ert/devel/libert_util/tests/ert_util_type_vector_test.c +++ b/ThirdParty/Ert/devel/libert_util/tests/ert_util_type_vector_test.c @@ -27,6 +27,19 @@ void assert_equal( bool equal ) { } +void test_div() { + int_vector_type * int_vector = int_vector_alloc( 0 , 100); + int_vector_iset( int_vector , 10 , 100 ); + int_vector_div( int_vector , 10 ); + { + int i; + for (i=0; i < int_vector_size( int_vector ); i++) + test_assert_int_equal( 10 , int_vector_iget( int_vector , i )); + } +} + + + int main(int argc , char ** argv) { int_vector_type * int_vector = int_vector_alloc( 0 , 99); @@ -99,6 +112,7 @@ int main(int argc , char ** argv) { int_vector_free( v1 ); int_vector_free( v2 ); } - + + test_div(); exit(0); } diff --git a/ThirdParty/Ert/devel/libert_util/tests/ert_util_vector_test.c b/ThirdParty/Ert/devel/libert_util/tests/ert_util_vector_test.c index 29a22eeffb..3ee8d0146a 100644 --- a/ThirdParty/Ert/devel/libert_util/tests/ert_util_vector_test.c +++ b/ThirdParty/Ert/devel/libert_util/tests/ert_util_vector_test.c @@ -18,6 +18,7 @@ #include #include +#include #include #include @@ -70,10 +71,51 @@ void test_reverse() { +void test_sort() { + vector_type * v1 = vector_alloc_new(); + vector_type * v2 = vector_alloc_new(); + + vector_append_ref(v1 , "2"); + vector_append_ref(v2 , "2"); + + vector_append_ref(v1 , "0"); + vector_append_ref(v2 , "0"); + + vector_append_ref(v1 , "1"); + vector_append_ref(v2 , "1"); + + vector_append_ref(v1 , "4"); + vector_append_ref(v2 , "4"); + + vector_append_ref(v1 , "3"); + vector_append_ref(v2 , "3"); + + + { + int_vector_type * sort_map = vector_alloc_sort_perm( v1 , (vector_cmp_ftype *) util_strcmp_int ); + vector_sort( v2 , (vector_cmp_ftype *) util_strcmp_int); + + test_assert_int_equal( 1 , int_vector_iget( sort_map , 0 )); + test_assert_int_equal( 2 , int_vector_iget( sort_map , 1 )); + test_assert_int_equal( 0 , int_vector_iget( sort_map , 2 )); + test_assert_int_equal( 4 , int_vector_iget( sort_map , 3 )); + test_assert_int_equal( 3 , int_vector_iget( sort_map , 4 )); + + test_assert_string_equal( "0" , vector_iget(v2 , 0 )); + test_assert_string_equal( "1" , vector_iget(v2 , 1 )); + test_assert_string_equal( "2" , vector_iget(v2 , 2 )); + test_assert_string_equal( "3" , vector_iget(v2 , 3 )); + test_assert_string_equal( "4" , vector_iget(v2 , 4 )); + + int_vector_free( sort_map ); + } +} + int main(int argc , char ** argv) { test_iset( ); test_reverse( ); + test_sort( ); exit(0); } diff --git a/ThirdParty/Ert/devel/libgeometry/tests/CMakeLists.txt b/ThirdParty/Ert/devel/libgeometry/tests/CMakeLists.txt index d263b1d252..fcedece5f1 100644 --- a/ThirdParty/Ert/devel/libgeometry/tests/CMakeLists.txt +++ b/ThirdParty/Ert/devel/libgeometry/tests/CMakeLists.txt @@ -5,5 +5,5 @@ add_test( geo_surface ${EXECUTABLE_OUTPUT_PATH}/geo_surface ${PROJECT_SOURCE_DIR}/test-data/Statoil/Geometry/Surface.irap ${PROJECT_SOURCE_DIR}/test-data/Statoil/Geometry/Surface_incompatible.irap ) -set_property( TEST geo_surface PROPERTY LABELS Statoil ) +set_property( TEST geo_surface PROPERTY LABELS StatoilData ) diff --git a/ThirdParty/Ert/devel/libjob_queue/include/ert/job_queue/job_queue.h b/ThirdParty/Ert/devel/libjob_queue/include/ert/job_queue/job_queue.h index 4694c30649..6c670ef579 100644 --- a/ThirdParty/Ert/devel/libjob_queue/include/ert/job_queue/job_queue.h +++ b/ThirdParty/Ert/devel/libjob_queue/include/ert/job_queue/job_queue.h @@ -69,9 +69,7 @@ extern "C" { void * job_queue_run_jobs__(void * ); job_status_type job_queue_iget_job_status(const job_queue_type * , int ); const char * job_queue_status_name( job_status_type status ); - void job_queue_set_max_running( job_queue_type * queue , int max_running ); - int job_queue_inc_max_runnning( job_queue_type * queue, int delta ); - int job_queue_get_max_running( const job_queue_type * queue ); + int job_queue_iget_status_summary( const job_queue_type * queue , job_status_type status); time_t job_queue_iget_sim_start( job_queue_type * queue, int job_index); time_t job_queue_iget_submit_time( job_queue_type * queue, int job_index); diff --git a/ThirdParty/Ert/devel/libjob_queue/include/ert/job_queue/queue_driver.h b/ThirdParty/Ert/devel/libjob_queue/include/ert/job_queue/queue_driver.h index e842668c9c..06940673da 100644 --- a/ThirdParty/Ert/devel/libjob_queue/include/ert/job_queue/queue_driver.h +++ b/ThirdParty/Ert/devel/libjob_queue/include/ert/job_queue/queue_driver.h @@ -40,7 +40,12 @@ extern "C" { {.value = 4 , .name = "TORQUE_DRIVER"} #define JOB_DRIVER_ENUM_SIZE 5 - + + /* + The options supported by the base queue_driver. + */ +#define MAX_RUNNING "MAX_RUNNING" + typedef enum { JOB_QUEUE_NOT_ACTIVE = 1, /* This value is used in external query routines - for jobs which are (currently) not active. */ //JOB_QUEUE_LOADING = 2 , /* This value is used by external routines. Not used in the libjob_queue implementation. */ @@ -129,8 +134,6 @@ extern "C" { void queue_driver_kill_job(queue_driver_type * driver, void * job_data); job_status_type queue_driver_get_status(queue_driver_type * driver, void * job_data); - void queue_driver_set_max_running(queue_driver_type * driver, int max_running); - int queue_driver_get_max_running(const queue_driver_type * driver); const char * queue_driver_get_name(const queue_driver_type * driver); bool queue_driver_set_option(queue_driver_type * driver, const char * option_key, const void * value); diff --git a/ThirdParty/Ert/devel/libjob_queue/src/job_queue.c b/ThirdParty/Ert/devel/libjob_queue/src/job_queue.c index e9f4052104..a2bce78ed5 100644 --- a/ThirdParty/Ert/devel/libjob_queue/src/job_queue.c +++ b/ThirdParty/Ert/devel/libjob_queue/src/job_queue.c @@ -1139,8 +1139,55 @@ static void job_queue_handle_EXIT( job_queue_type * queue , job_queue_node_type } +/*****************************************************************/ +int job_queue_get_max_running_option(queue_driver_type * driver) { + char * max_running_string = (char*)queue_driver_get_option(driver, MAX_RUNNING); + int max_running; + if (!util_sscanf_int(max_running_string, &max_running)) { + fprintf(stderr, "%s: Unable to parse option MAX_RUNNING with value %s to an int", __func__, max_running_string); + } + return max_running; +} + +void job_queue_set_max_running_option(queue_driver_type * driver, int max_running) { + char * max_running_string = util_alloc_sprintf("%d", max_running); + queue_driver_set_option(driver, MAX_RUNNING, max_running_string); + free(max_running_string); +} + + +/** + Observe that if the max number of running jobs is decreased, + nothing will be done to reduce the number of jobs currently + running; but no more jobs will be submitted until the number of + running has fallen below the new limit. + + The updated value will also be pushed down to the current driver. + NOTE: These next three *max_running functions should not be used, rather + use the set_option feature, with MAX_RUNNING. They are (maybe) used by python + therefore not removed. +*/ +int job_queue_get_max_running( const job_queue_type * queue ) { + return job_queue_get_max_running_option(queue->driver); +} + +void job_queue_set_max_running( job_queue_type * queue , int max_running ) { + job_queue_set_max_running_option(queue->driver, max_running); +} + +/* + The return value is the new value for max_running. +*/ +int job_queue_inc_max_runnning( job_queue_type * queue, int delta ) { + job_queue_set_max_running( queue , job_queue_get_max_running( queue ) + delta ); + return job_queue_get_max_running( queue ); +} + +/*****************************************************************/ + + /** If the total number of jobs is not known in advance the job_queue_run_jobs function can be called with @num_total_run == 0. In that case it is paramount @@ -1519,34 +1566,6 @@ bool job_queue_has_driver(const job_queue_type * queue ) { } -/** - Observe that if the max number of running jobs is decreased, - nothing will be done to reduce the number of jobs currently - running; but no more jobs will be submitted until the number of - running has fallen below the new limit. - - The updated value will also be pushed down to the current driver. -*/ - -void job_queue_set_max_running( job_queue_type * queue , int max_running ) { - queue_driver_set_max_running( queue->driver , max_running ); -} - -/* - The return value is the new value for max_running. -*/ -int job_queue_inc_max_runnning( job_queue_type * queue, int delta ) { - job_queue_set_max_running( queue , job_queue_get_max_running( queue ) + delta ); - return job_queue_get_max_running( queue ); -} - -int job_queue_get_max_running( const job_queue_type * queue ) { - return queue_driver_get_max_running( queue->driver ); -} - - -/*****************************************************************/ - job_driver_type job_queue_lookup_driver_name( const char * driver_name ) { if (strcmp( driver_name , "LOCAL") == 0) diff --git a/ThirdParty/Ert/devel/libjob_queue/src/queue_driver.c b/ThirdParty/Ert/devel/libjob_queue/src/queue_driver.c index 507130e6eb..48f6781ce4 100644 --- a/ThirdParty/Ert/devel/libjob_queue/src/queue_driver.c +++ b/ThirdParty/Ert/devel/libjob_queue/src/queue_driver.c @@ -77,6 +77,7 @@ struct queue_driver_struct { */ char * name; /* String name of driver. */ job_driver_type driver_type; /* Enum value for driver. */ + char * max_running_string; int max_running; /* Possible to maintain different max_running values for different drivers; the value 0 is interpreted as no limit - i.e. the queue layer will (try) to send an unlimited number of jobs to the driver. */ @@ -108,6 +109,7 @@ static queue_driver_type * queue_driver_alloc_empty() { driver->has_option = NULL; driver->name = NULL; driver->data = NULL; + driver->max_running_string = NULL; return driver; } @@ -178,22 +180,74 @@ queue_driver_type * queue_driver_alloc(job_driver_type type) { /*****************************************************************/ + +/*****************************************************************/ + +void queue_driver_set_max_running(queue_driver_type * driver, int max_running) { + driver->max_running_string = util_realloc_sprintf(driver->max_running_string,"%d", max_running); + driver->max_running = max_running; +} + +int queue_driver_get_max_running(const queue_driver_type * driver) { + return driver->max_running; +} + +const char * queue_driver_get_name(const queue_driver_type * driver) { + return driver->name; +} + + +/*****************************************************************/ + + +static bool queue_driver_set_generic_option__(queue_driver_type * driver, const char * option_key, const void * value) { + bool option_set = true; + { + if (strcmp(MAX_RUNNING, option_key) == 0) { + int max_running_int = 0; + if (util_sscanf_int(value, &max_running_int)) { + queue_driver_set_max_running(driver, max_running_int); + option_set = true; + } + else + option_set = false; + } else + option_set = false; + } + return option_set; +} + +static void * queue_driver_get_generic_option__(queue_driver_type * driver, const char * option_key) { + if (strcmp(MAX_RUNNING, option_key) == 0) { + return driver->max_running_string; + } else { + util_abort("%s: driver:%s does not support generic option %s\n", __func__, driver->name, option_key); + return NULL; + } +} + +static bool queue_driver_has_generic_option__(queue_driver_type * driver, const char * option_key) { + if (strcmp(MAX_RUNNING, option_key) == 0) + return true; + else + return false; +} + /** Set option - can also be used to perform actions - not only setting of parameters. There is no limit :-) */ bool queue_driver_set_option(queue_driver_type * driver, const char * option_key, const void * value) { - if (driver->set_option != NULL) + if (queue_driver_set_generic_option__(driver, option_key, value)) { + return true; + } else if (driver->set_option != NULL) /* The actual low level set functions can not fail! */ return driver->set_option(driver->data, option_key, value); else { util_abort("%s: driver:%s does not support run time setting of options\n", __func__, driver->name); return false; } -} - -bool queue_driver_set_string_option(queue_driver_type * driver, const char * option_key, const char * value) { - return queue_driver_set_option(driver, option_key, value); + return false; } /*****************************************************************/ @@ -208,13 +262,16 @@ bool queue_driver_has_option(queue_driver_type * driver, const char * option_key /*****************************************************************/ const void * queue_driver_get_option(queue_driver_type * driver, const char * option_key) { - if (driver->get_option != NULL) + if (queue_driver_has_generic_option__(driver, option_key)) { + return queue_driver_get_generic_option__(driver, option_key); + } else if (driver->get_option != NULL) /* The actual low level set functions can not fail! */ return driver->get_option(driver->data, option_key); else { util_abort("%s: driver:%s does not support run time reading of options\n", __func__, driver->name); return NULL; } + return NULL; } /*****************************************************************/ @@ -252,23 +309,6 @@ queue_driver_type * queue_driver_alloc_local() { return driver; } -/*****************************************************************/ - -void queue_driver_set_max_running(queue_driver_type * driver, int max_running) { - driver->max_running = max_running; -} - -int queue_driver_get_max_running(const queue_driver_type * driver) { - return driver->max_running; -} - -const char * queue_driver_get_name(const queue_driver_type * driver) { - return driver->name; -} - - -/*****************************************************************/ - /* These are the functions used by the job_queue layer. */ void * queue_driver_submit_job(queue_driver_type * driver, const char * run_cmd, int num_cpu, const char * run_path, const char * job_name, int argc, const char ** argv) { @@ -297,6 +337,7 @@ void queue_driver_free_driver(queue_driver_type * driver) { void queue_driver_free(queue_driver_type * driver) { queue_driver_free_driver(driver); util_safe_free(driver->name); + util_safe_free(driver->max_running_string); free(driver); } diff --git a/ThirdParty/Ert/devel/libjob_queue/tests/job_queue_test.c b/ThirdParty/Ert/devel/libjob_queue/tests/job_queue_test.c index 1a7361eb68..41a2990987 100644 --- a/ThirdParty/Ert/devel/libjob_queue/tests/job_queue_test.c +++ b/ThirdParty/Ert/devel/libjob_queue/tests/job_queue_test.c @@ -14,7 +14,7 @@ See the GNU General Public License at for more details. -*/ + */ #include #include @@ -27,18 +27,71 @@ #include #include +#include "ert/job_queue/torque_driver.h" void job_queue_set_driver_(job_driver_type driver_type) { - job_queue_type * queue = job_queue_alloc( 10 , "OK" , "ERROR"); - queue_driver_type * driver = queue_driver_alloc( driver_type ); - test_assert_false( job_queue_has_driver( queue )); - - job_queue_set_driver( queue , driver ); - test_assert_true( job_queue_has_driver( queue )); + job_queue_type * queue = job_queue_alloc(10, "OK", "ERROR"); + queue_driver_type * driver = queue_driver_alloc(driver_type); + test_assert_false(job_queue_has_driver(queue)); + + job_queue_set_driver(queue, driver); + test_assert_true(job_queue_has_driver(queue)); + + job_queue_free(queue); + queue_driver_free(driver); + } -int main( int argc , char ** argv) { +void set_option_max_running_max_running_value_set() { + queue_driver_type * driver_torque = queue_driver_alloc(TORQUE_DRIVER); + test_assert_true(queue_driver_set_option(driver_torque, MAX_RUNNING, "42")); + test_assert_string_equal("42", queue_driver_get_option(driver_torque, MAX_RUNNING)); + queue_driver_free(driver_torque); + + + queue_driver_type * driver_lsf = queue_driver_alloc(LSF_DRIVER); + test_assert_true(queue_driver_set_option(driver_lsf, MAX_RUNNING, "72")); + test_assert_string_equal("72", queue_driver_get_option(driver_lsf, MAX_RUNNING)); + queue_driver_free(driver_lsf); +} + +void set_option_max_running_max_running_option_set() { + queue_driver_type * driver_torque = queue_driver_alloc(TORQUE_DRIVER); + test_assert_true(queue_driver_set_option(driver_torque, MAX_RUNNING, "42")); + test_assert_string_equal("42", queue_driver_get_option(driver_torque, MAX_RUNNING)); + queue_driver_free(driver_torque); + +} + +void set_option_invalid_option_returns_false() { + queue_driver_type * driver_torque = queue_driver_alloc(TORQUE_DRIVER); + test_assert_false(queue_driver_set_option(driver_torque, "MAKS_RUNNING", "42")); + queue_driver_free(driver_torque); +} + +void set_option_invalid_value_returns_false() { + queue_driver_type * driver_torque = queue_driver_alloc(TORQUE_DRIVER); + test_assert_false(queue_driver_set_option(driver_torque, "MAX_RUNNING", "2a")); + queue_driver_free(driver_torque); +} + +void set_option_valid_on_specific_driver_returns_true() { + queue_driver_type * driver_torque = queue_driver_alloc(TORQUE_DRIVER); + test_assert_true(queue_driver_set_option(driver_torque, TORQUE_NUM_CPUS_PER_NODE, "33")); + test_assert_string_equal("33", queue_driver_get_option(driver_torque, TORQUE_NUM_CPUS_PER_NODE)); + queue_driver_free(driver_torque); +} + +int main(int argc, char ** argv) { job_queue_set_driver_(LSF_DRIVER); job_queue_set_driver_(TORQUE_DRIVER); + + set_option_max_running_max_running_value_set(); + set_option_max_running_max_running_option_set(); + set_option_invalid_option_returns_false(); + set_option_invalid_value_returns_false(); + + set_option_valid_on_specific_driver_returns_true(); + exit(0); } diff --git a/ThirdParty/Ert/devel/libjob_queue/tests/job_torque_submit_test.c b/ThirdParty/Ert/devel/libjob_queue/tests/job_torque_submit_test.c index 7c06fada7b..7007b8c2b6 100644 --- a/ThirdParty/Ert/devel/libjob_queue/tests/job_torque_submit_test.c +++ b/ThirdParty/Ert/devel/libjob_queue/tests/job_torque_submit_test.c @@ -35,8 +35,8 @@ void test_submit(torque_driver_type * driver, const char * cmd) { } torque_driver_kill_job(driver, job); - printf("Waiting 5 seconds"); - for (int i = 0; i < 5; i++) { + printf("Waiting 2 seconds"); + for (int i = 0; i < 2; i++) { printf("."); fflush(stdout); sleep(1); diff --git a/ThirdParty/Ert/devel/libjob_queue/tests/job_torque_test.c b/ThirdParty/Ert/devel/libjob_queue/tests/job_torque_test.c index 15340b4e65..6bffdd3ca0 100644 --- a/ThirdParty/Ert/devel/libjob_queue/tests/job_torque_test.c +++ b/ThirdParty/Ert/devel/libjob_queue/tests/job_torque_test.c @@ -96,9 +96,11 @@ void create_submit_script_script_according_to_input() { fclose(file_stream); } + int main(int argc, char ** argv) { getoption_nooptionsset_defaultoptionsreturned(); setoption_setalloptions_optionsset(); + setoption_set_typed_options_wrong_format_returns_false(); create_submit_script_script_according_to_input(); exit(0); diff --git a/ThirdParty/Ert/devel/librms/src/makefile b/ThirdParty/Ert/devel/librms/src/makefile deleted file mode 100644 index 79b8e2f27f..0000000000 --- a/ThirdParty/Ert/devel/librms/src/makefile +++ /dev/null @@ -1,74 +0,0 @@ -include global_config -SDP_ROOT = $(shell get_sdp_root.py) -################################################################# -COMPILE_INCLUDE = -I$(LIBRMS_HOME)/src -I$(LIBECL_HOME)/include -I$(LIBUTIL_HOME)/include -INSTALL_INC_PATH = $(LIBRMS_HOME)/include -INSTALL_LIB_PATH = $(LIBRMS_HOME)/lib -################################################################# -OBJECTS = rms_file.o rms_util.o rms_tag.o rms_type.o rms_tagkey.o rms_stats.o rms_export.o -INC_FILES = rms_file.h rms_util.h rms_tag.h rms_type.h rms_tagkey.h rms_stats.h rms_export.h -LIB = librms.a - - -LOCAL: LIB - install -d $(INSTALL_INC_PATH) - install -d $(INSTALL_LIB_PATH) - install $(INC_FILES) $(INSTALL_INC_PATH) - install $(LIB) $(INSTALL_LIB_PATH) - -SDP_INSTALL: LIB BIN - install $(LIB) $(SDP_ROOT)/lib/lib$(LIB_ROOT).a - install $(INC_FILES) $(SDP_ROOT)/include - -LIB: $(LIB) - -clean: - rm -f *.o *~ - rm -f $(LIB) - rm -f $(INSTALL_LIB_PATH)/$(LIB) - rm -f $(INSTALL_INC_PATH)/*.h - -rebuild: clean LOCAL - -$(LIB): $(OBJECTS) - $(AR) $(ARFLAGS) $(LIB) $(OBJECTS) - - -%.o : %.c - $(CC) -c $(CFLAGS) $(COMPILE_INCLUDE) $(CPPFLAGS) $< -o $@ - - -new: - ../../Scripts/cdep.py all_include.h 0 - -include dependencies - -################################################################## -## Binaries -# -#BIN_FILES = rms.x rms_stat.x roff_tags.x rms_extract.x rms_setname.x -#BIN: $(BIN_FILES) -#BIN_FILES_SDP_INSTALL = roff_tags.x -# -#rms_test.o : rms_test.c -#rms_stat.o : rms_stat.c -#tag_list.o : tag_list.c -#rms_extract.o : rms_extract.c -#rms_setname.o : rms_setname.c -# -#roff_tags.x: tag_list.o $(LIB) -# $(CC) -$(MFLAG) $(LDFLAGS) tag_list.o -o roff_tags.x $(LIB_PATH) $(LIB_LINK) -# -#rms.x: rms_test.o $(LIB) -# $(CC) -$(MFLAG) $(LDFLAGS) rms_test.o -o rms.x $(LIB_PATH) $(LIB_LINK) -# -#rms_stat.x: rms_stat.o $(LIB) -# $(CC) -$(MFLAG) $(LDFLAGS) rms_stat.o -o rms_stat.x $(LIB_PATH) $(LIB_LINK) -# -#rms_extract.x: rms_extract.o $(LIB) -# $(CC) -$(MFLAG) $(LDFLAGS) rms_extract.o -o rms_extract.x $(LIB_PATH) $(LIB_LINK) -# -#rms_setname.x: rms_setname.o $(LIB) -# $(CC) -$(MFLAG) $(LDFLAGS) rms_setname.o -o rms_setname.x $(LIB_PATH) $(LIB_LINK) - - diff --git a/ThirdParty/Ert/devel/python/python/CMakeLists.txt b/ThirdParty/Ert/devel/python/python/CMakeLists.txt index 970c600891..4e27dd7af2 100644 --- a/ThirdParty/Ert/devel/python/python/CMakeLists.txt +++ b/ThirdParty/Ert/devel/python/python/CMakeLists.txt @@ -1 +1,3 @@ add_subdirectory( ert ) +add_subdirectory( ert_gui ) + diff --git a/ThirdParty/Ert/devel/python/python/ert/CMakeLists.txt b/ThirdParty/Ert/devel/python/python/ert/CMakeLists.txt index 08727c8c72..48c01a8417 100644 --- a/ThirdParty/Ert/devel/python/python/ert/CMakeLists.txt +++ b/ThirdParty/Ert/devel/python/python/ert/CMakeLists.txt @@ -10,4 +10,4 @@ add_subdirectory( rms ) add_subdirectory( sched ) add_subdirectory( util ) add_subdirectory( well ) - +add_subdirectory( ert ) diff --git a/ThirdParty/Ert/devel/python/python/ert/cwrap/cwrap.py b/ThirdParty/Ert/devel/python/python/ert/cwrap/cwrap.py index e1b7243c2d..a94bf5ddb3 100644 --- a/ThirdParty/Ert/devel/python/python/ert/cwrap/cwrap.py +++ b/ThirdParty/Ert/devel/python/python/ert/cwrap/cwrap.py @@ -123,7 +123,15 @@ class CWrapper: return func - + def safe_prototype(self,pattern , lib = None): + try: + func = self.prototype(pattern, lib) + except AttributeError: + func = None + sys.stderr.write("****Defunct function call: %s\n" % pattern) + return func + + def print_types(self): for ctype in self.registered_types.keys(): print "%16s -> %s" % (ctype , self.registered_types[ ctype ]) diff --git a/ThirdParty/Ert/devel/python/python/ert/ecl/CMakeLists.txt b/ThirdParty/Ert/devel/python/python/ert/ecl/CMakeLists.txt index b61bbe51de..ebf1fd1faf 100644 --- a/ThirdParty/Ert/devel/python/python/ert/ecl/CMakeLists.txt +++ b/ThirdParty/Ert/devel/python/python/ert/ecl/CMakeLists.txt @@ -1,5 +1,15 @@ -add_python_package("Python ert.ecl" ${PYTHON_INSTALL_PREFIX}/ert/ecl "ecl_case.py;ecl_default.py;ecl_file.py;ecl_grav_calc.py;ecl_grav.py;ecl_grid.py;ecl_kw.py;ecl.py;ecl_queue.py;ecl_region.py;ecl_rft.py;ecl_subsidence.py;ecl_sum.py;ecl_util.py;fortio.py;__init__.py;libecl.py" True) +add_python_package("Python ert.ecl" ${PYTHON_INSTALL_PREFIX}/ert/ecl "ecl_case.py;ecl_rft_cell.py;ecl_default.py;ecl_file.py;ecl_grav_calc.py;ecl_grav.py;ecl_grid.py;ecl_kw.py;ecl.py;ecl_queue.py;ecl_region.py;ecl_rft.py;ecl_subsidence.py;ecl_sum.py;ecl_util.py;fortio.py;__init__.py;libecl.py" True) -if (EXISTS "ecl_local.py") - add_python_file( "Python ert.ecl.ecl_local" ${PYTHON_INSTALL_PREFIX}/ert/ecl "ecl_local.py" True) + +set( ECL_LOCAL_TARGET "" CACHE FILE "Name of optional external ecl_local module") + +if (EXISTS ${ECL_LOCAL_TARGET}) + if (NOT EXISTS "${CMAKE_CURRENT_SOURCE_DIR}/ecl_local.py") + EXECUTE_PROCESS( COMMAND ${CMAKE_COMMAND} -E create_symlink "${ECL_LOCAL_TARGET}" "${CMAKE_CURRENT_SOURCE_DIR}/ecl_local.py") + message("-- Adding symlink ${CMAKE_CURRENT_SOURCE_DIR}/ecl_local.py -> ${ECL_LOCAL_TARGET}") + endif() +endif() + +if (EXISTS "${CMAKE_CURRENT_SOURCE_DIR}/ecl_local.py") + add_python_package( "Python ert.ecl.ecl_local" ${PYTHON_INSTALL_PREFIX}/ert/ecl "ecl_local.py" True) endif() diff --git a/ThirdParty/Ert/devel/python/python/ert/ecl/ecl.py b/ThirdParty/Ert/devel/python/python/ert/ecl/ecl.py index 8d4847e8c6..7489956b6b 100644 --- a/ThirdParty/Ert/devel/python/python/ert/ecl/ecl.py +++ b/ThirdParty/Ert/devel/python/python/ert/ecl/ecl.py @@ -37,7 +37,8 @@ from ecl_kw import EclKW from ecl_case import EclCase from ecl_file import EclFile from ecl_sum import EclSum -from ecl_rft import EclRFTFile , EclRFT , EclRFTCell +from ecl_rft import EclRFTFile , EclRFT +from ecl_rft_cell import EclRFTCell, EclPLTCell from ecl_grid import EclGrid from ecl_grav import EclGrav from ecl_subsidence import EclSubsidence diff --git a/ThirdParty/Ert/devel/python/python/ert/ecl/ecl_grid.py b/ThirdParty/Ert/devel/python/python/ert/ecl/ecl_grid.py index fa65609ae1..b7644f26ed 100644 --- a/ThirdParty/Ert/devel/python/python/ert/ecl/ecl_grid.py +++ b/ThirdParty/Ert/devel/python/python/ert/ecl/ecl_grid.py @@ -93,7 +93,7 @@ class EclGrid(CClass): obj.init_cobj( c_ptr , cfunc.free ) return obj else: - return None + raise IOError("Loading grid from:%s failed" % filename) def equal(self , other , include_lgr = True , verbose = False): diff --git a/ThirdParty/Ert/devel/python/python/ert/ecl/ecl_local.py b/ThirdParty/Ert/devel/python/python/ert/ecl/ecl_local.py deleted file mode 100644 index a2c6642432..0000000000 --- a/ThirdParty/Ert/devel/python/python/ert/ecl/ecl_local.py +++ /dev/null @@ -1,72 +0,0 @@ -import os -import socket -import sys -import ert.job_queue.driver as driver - -################################################################# -# Only a quite few of the Linux computers in Statoil are proper LSF -# nodes, in the sense that they can talk directly to the LSF -# demons. When using LSF from a computer which is not properly part of -# the LSF cluster you must first ssh to a node which can serve as LSF -# server, and then issue the LSF commands there. This is controlled by -# the LSF_SERVER option in the LSF driver. -# -# In this configuration file the LSF server to use is determined by -# using the two first characters from the name of the submitting host -# as a lookup key in the server_list dictionary. -# -# If your workstation has proper access to LSF you can set the -# environment variable LOCAL_LSF; in that case the lsf_server variable -# will be left at None and the LSF driver instance will issue the LSF -# commands directly at the calling host without going through ssh. -# -# Observe that the ssh-based scheme requires that you have -# passwordless login to the server used as lsf server. -################################################################# - -server_list = { "be" : "be-grid01.be.statoil.no", - "st" : "st-grid01.st.statoil.no", - "tr" : "tr-grid01.tr.statoil.no", - "stj" : "tr-grid01.tr.statoil.no", - "rio" : "rio-grid01.rio.statoil.no" } - - -def get_lsf_server(): - if os.getenv("LOCAL_LSF"): - # The user has set the LOCAL_LSF environment variable - - # signalling that she has access to a proper LSF node. - return None - else: - host = socket.gethostname() - host_prefix = host.split("-")[0] - lsf_server = server_list.get( host_prefix , None) - # This will silently return None if no appropriate LSF server - # is found. In that case things will blow up at a later stage - # if/when someone tries to use the invalid lsf server. - return lsf_server - - -# The command used to run ECLIPSE. The executable will be called with -# commandline arguments: version data_file num_cpu -ecl_cmd = "/project/res/etc/ERT/Scripts/run_eclipse.py" - -# The ECLIPSE version which will be used, by default. -ecl_version = "2010.2" - -# The resource request passed to the LSF server. In practice every god-damn compute node -# in Statoil will satisfy these needs, so it could just be left as None. -lsf_resource_request = "select[cs && x86_64Linux] rusage[ecl100v2000=1:duration=5]" - -lsf_queue = "normal" -rsh_command = "/usr/bin/ssh" - -driver_options = { driver.LSF_DRIVER : [("LSF_QUEUE" , lsf_queue), - ("LSF_RESOURCE" , lsf_resource_request), - ("LSF_SERVER" , get_lsf_server())], - driver.RSH_DRIVER : [("RSH_COMMAND" , rsh_command)], - driver.LOCAL_DRIVER : []} - -driver_type = driver.LSF_DRIVER - - - diff --git a/ThirdParty/Ert/devel/python/python/ert/ecl/ecl_rft.py b/ThirdParty/Ert/devel/python/python/ert/ecl/ecl_rft.py index d567759a1f..8689e5ecda 100644 --- a/ThirdParty/Ert/devel/python/python/ert/ecl/ecl_rft.py +++ b/ThirdParty/Ert/devel/python/python/ert/ecl/ecl_rft.py @@ -17,18 +17,33 @@ Module for loading ECLIPSE RFT files. """ -import libecl import ctypes import types +import warnings + +import libecl from ert.cwrap.cwrap import * from ert.cwrap.cclass import CClass from ert.util.ctime import ctime +from ecl_rft_cell import EclRFTCell, EclPLTCell -RFT = 1 -PLT = 2 class EclRFTFile(CClass): + """ + The EclRFTFile class is used to load an ECLIPSE RFT file. + + The EclRFTFile serves as a container which can load and hold the + content of an ECLIPSE RFT file. The RFT files will in general + contain data for several wells and several times in one large + container. The EclRFTClass class contains methods get the the RFT + results for a specific time and/or well. + + The EclRFTFile class can in general contain a mix of RFT and PLT + measurements. The class does not really differentiate between + these. + """ + def __new__( cls , case ): c_ptr = cfunc_file.load( case ) if c_ptr: @@ -53,29 +68,63 @@ class EclRFTFile(CClass): else: raise TypeError("Index should be integer type") - - @property def size( self , well = None , date = None): - return cfunc_file.get_size( self , well , -1) + """ + The number of elements in EclRFTFile container. + + By default the size() method will return the total number of + RFTs/PLTs in the container, but by specifying the optional + arguments date and/or well the function will only count the + number of well measurements matching that time or well + name. The well argument can contain wildcards. + + rftFile = ecl.EclRFTFile( "ECLIPSE.RFT" ) + print "Total number of RFTs : %d" % rftFile.size( ) + print "RFTs matching OP* : %d" % rftFile.size( well = "OP*" ) + print "RFTs at 01/01/2010 : %d" % rftFile.size( date = datetime.date( 2010 , 1 , 1 )) + + """ + if date: + cdate = ctime( date ) + else: + cdate = -1 + + return cfunc_file.get_size( self , well , cdate) + @property def num_wells( self ): + """ + Returns the total number of distinct wells in the RFT file. + """ return cfunc_file.get_num_wells( self ) @property def headers(self): + """ + Returns a list of two tuples (well_name , date) for the whole file. + """ header_list = [] for i in (range(cfunc_file.get_size( self , None , -1))): rft = self.iget( i ) - print rft header_list.append( (rft.well , rft.date) ) return header_list + def iget(self , index): + """ + Will lookup RFT @index - equivalent to [@index]. + """ return self.__getitem__( index ) + def get(self , well_name , date ): + """ + Will look up the RFT object corresponding to @well and @date. + + Returns None if no matching RFT can be found. + """ c_ptr = cfunc_file.get_rft( self , well_name , ctime( date )) if c_ptr: return EclRFT( c_ptr , self) @@ -87,13 +136,56 @@ class EclRFTFile(CClass): class EclRFT(CClass): + """The EclRFT class contains the information for *one* RFT. + + The ECLIPSE RFT file can contain three different types of RFT like + objects which are lumped together; the EclRFTClass is a container + for such objects. The three different object types which can be + found in an RFT file are: + + RFT: This is old-fashioned RFT which contains measurements of + saturations for each of the completed cells. + + PLT: This contains production and flow rates for each phase in + each cell. + + SEGMENT: Not implemented. + + In addition to the measurements specific for RFT and PLT each cell + has coordinates, pressure and depth. + """ def __init__(self , c_ptr , parent): self.init_cref( c_ptr , parent ) - def __len__(self): + """ + The number of completed cells in this RFT. + """ return cfunc_rft.get_size( self ) + def is_RFT(self): + """ + Is instance an RFT; in that case all the cells will be EclRFTCell instances. + """ + return cfunc_rft.is_RFT( self ) + + def is_PLT(self): + """ + Is instance a PLT; in that case all the cells will be EclPLTCell instances. + """ + return cfunc_rft.is_PLT( self ) + + def is_SEGMENT(self): + """ + Is this a SEGMENT - not implemented. + """ + return cfunc_rft.is_SEGMENT( self ) + + def is_MSW(self): + """ + Is this well a MSW well. Observe that the test ONLY applies to PLTs. + """ + return cfunc_rft.is_MSW( self ) @property @@ -102,146 +194,129 @@ class EclRFT(CClass): # RFT = 1 # PLT = 2 # Segment = 3 -- Not properly implemented + """ + Deprecated - use query methods: is_RFT(), is_PLT() and is_SEGMENT() instead. + """ + warnings.warn("The property type is deprecated, use the query methods is_RFT(), is_PLT() and is_SEGMENT() instead.") return cfunc_rft.get_type( self ) @property def well(self): + """ + The name of the well we are considering. + """ return cfunc_rft.get_well( self ) @property def date(self): + """ + The date when this RFT/PLT/... was recorded. + """ return cfunc_rft.get_date( self ) @property def size(self): + """ + The number of completed cells. + """ return self.__len__() - def __make_node( self , index ): - i = ctypes.c_int() - j = ctypes.c_int() - k = ctypes.c_int() - pressure = cfunc_rft.iget_pressure( self, index ) - depth = cfunc_rft.iget_depth( self, index ) - cfunc_rft.iget_ijk( self, index , ctypes.byref(i), ctypes.byref(j) , ctypes.byref(k)) - - - if self.type == RFT: - swat = cfunc_rft.iget_swat( self, index ) - sgas = cfunc_rft.iget_sgas( self, index ) - return EclRFTCell.RFTCell( i,j,k,depth , pressure,swat,sgas) + def __cell_ref( self , cell_ptr ): + if self.is_RFT(): + return EclRFTCell.ref( cell_ptr , self ) + elif self.is_PLT(): + return EclPLTCell.ref( cell_ptr , self ) else: - orat = cfunc_rft.iget_orat( self, index ) - wrat = cfunc_rft.iget_wrat( self, index ) - grat = cfunc_rft.iget_grat( self, index ) - return EclRFTCell.PLTCell( i,j,k,depth , pressure,orat,grat,wrat) + raise NotImplementedError("Only RFT and PLT cells are implemented") - def __getitem__(self , index): + + def assert_cell_index( self , index ): if isinstance( index , types.IntType): length = self.__len__() if index < 0 or index >= length: raise IndexError - else: - return self.__make_node( index ) else: raise TypeError("Index should be integer type") + + def __getitem__(self , index): + """Implements the [] operator to return the cells. + + To get the object related to cell nr 5: + + cell = rft[4] + + The return value from the __getitem__() method is either an + EclRFTCell instance or a EclPLTCell instance, depending on the + type of this particular RFT object. + """ + self.assert_cell_index( index ) + cell_ptr = cfunc_rft.iget_cell( self , index ) + return self.__cell_ref( cell_ptr ) + + def iget( self , index ): return self.__getitem__( index ) + + def iget_sorted( self , index ): + """ + Will return the cell nr @index in the list of sorted cells. + + See method sort() for further documentation. + """ + self.assert_cell_index( index ) + cell_ptr = cfunc_rft.iget_cell_sorted( self , index ) + return self.__cell_ref( cell_ptr ) + + + def sort(self): + """ + Will sort cells in RFT; currently only applies to MSW wells. + + By default the cells in the RFT come in the order they are + specified in the ECLIPSE input file; that is not necessarily + in a suitable order. In the case of MSW wells it is possible + to sort the connections after distance along the wellpath. To + access the cells in sort order you have two options: + + 1. Sort the cells using the sort() method, and then + subsequently access them sequentially: + + rft.sort() + for cell in rft: + print cell + + 2. Let the rft object stay unsorted, but access the cells + using the iget_sorted() method: + + for i in range(len(rft)): + cell = rft.iget_sorted( i ) + + Currently only MSW/PLTs are sorted, based on the CONLENST + keyword; for other wells the sort() method does nothing. + """ + cfunc_rft.sort_cells( self ) + # ijk are zero offset def ijkget( self , ijk ): - index = cfunc_rft.lookup_ijk( self , ijk[0] , ijk[1] , ijk[2]) - if index >= 0: - return self.iget( index ) + """ + Will look up the cell based on (i,j,k). + + If the cell (i,j,k) is not part of this RFT/PLT None will be + returned. The (i,j,k) input values should be zero offset, + i.e. you must subtract 1 from the (i,j,k) values given in the ECLIPSE input. + """ + cell_ptr = cfunc_rft.lookup_ijk( self , ijk[0] , ijk[1] , ijk[2]) + if cell_ptr: + return self.__cell_ref( cell_ptr ) else: return None -class EclRFTCell: - def __init__(self , type , i , j , k , depth , pressure): - self.type = type - self.__i = i - self.__j = j - self.__k = k - self.__depth = depth - self.__pressure = pressure - - self.__sgas = None - self.__swat = None - self.__orat = None - self.__wrat = None - self.__grat = None - - @classmethod - def RFTCell( cls , i,j,k,depth,pressure,swat,sgas): - cell = cls(RFT , i,j,k,depth,pressure) - cell.__swat = swat - cell.__sgas = sgas - return cell - - @classmethod - def PLTCell(cls , i,j,k,depth,pressure,orat,grat,wrat): - cell = cls(PLT , i,j,k,depth,pressure) - cell.__orat = orat - cell.__wrat = wrat - cell.__grat = grat - return cell - - @property - def i(self): - return self.__i.value - - @property - def j(self): - return self.__j.value - - @property - def k(self): - return self.__k.value - - @property - def ijk(self): - return (self.__i.value , self.__j.value , self.__k.value) - - @property - def pressure(self): - return self.__pressure - - @property - def depth(self): - return self.__depth - - @property - def PLT(self): - if self.type == PLT: - return True - else: - return False - - @property - def sgas(self): - return self.__sgas - - @property - def swat(self): - return self.__swat - - @property - def orat(self): - return self.__orat - - @property - def grat(self): - return self.__grat - - @property - def wrat(self): - return self.__wrat - - # 2. Creating a wrapper object around the libecl library, @@ -253,25 +328,31 @@ cwrapper.registerType( "ecl_rft" , EclRFT ) cfunc_file = CWrapperNameSpace("ecl_rft_file") cfunc_rft = CWrapperNameSpace("ecl_rft") -cfunc_file.load = cwrapper.prototype("long ecl_rft_file_alloc_case( char* )") +cfunc_file.load = cwrapper.prototype("c_void_p ecl_rft_file_alloc_case( char* )") cfunc_file.has_rft = cwrapper.prototype("bool ecl_rft_file_case_has_rft( char* )") cfunc_file.free = cwrapper.prototype("void ecl_rft_file_free( ecl_rft_file )") cfunc_file.get_size = cwrapper.prototype("int ecl_rft_file_get_size__( ecl_rft_file , char* , time_t)") -cfunc_file.iget = cwrapper.prototype("long ecl_rft_file_iget_node( ecl_rft_file , int )") +cfunc_file.iget = cwrapper.prototype("c_void_p ecl_rft_file_iget_node( ecl_rft_file , int )") cfunc_file.get_num_wells = cwrapper.prototype("int ecl_rft_file_get_num_wells( ecl_rft_file )") -cfunc_file.get_rft = cwrapper.prototype("long ecl_rft_file_get_well_time_rft( ecl_rft_file , char* , time_t)") - -cfunc_rft.get_type = cwrapper.prototype("int ecl_rft_node_get_type( ecl_rft )") -cfunc_rft.get_well = cwrapper.prototype("char* ecl_rft_node_get_well_name( ecl_rft )") -cfunc_rft.get_date = cwrapper.prototype("time_t ecl_rft_node_get_date( ecl_rft )") -cfunc_rft.get_size = cwrapper.prototype("int ecl_rft_node_get_size( ecl_rft )") -cfunc_rft.iget_depth = cwrapper.prototype("double ecl_rft_node_iget_depth( ecl_rft )") -cfunc_rft.iget_pressure = cwrapper.prototype("double ecl_rft_node_iget_pressure(ecl_rft)") -cfunc_rft.iget_ijk = cwrapper.prototype("void ecl_rft_node_iget_ijk( ecl_rft , int , int*, int*, int*)") -cfunc_rft.iget_swat = cwrapper.prototype("double ecl_rft_node_iget_swat(ecl_rft)") -cfunc_rft.iget_sgas = cwrapper.prototype("double ecl_rft_node_iget_sgas(ecl_rft)") -cfunc_rft.iget_orat = cwrapper.prototype("double ecl_rft_node_iget_orat(ecl_rft)") -cfunc_rft.iget_wrat = cwrapper.prototype("double ecl_rft_node_iget_wrat(ecl_rft)") -cfunc_rft.iget_grat = cwrapper.prototype("double ecl_rft_node_iget_grat(ecl_rft)") -cfunc_rft.lookup_ijk = cwrapper.prototype("int ecl_rft_node_lookup_ijk( ecl_rft , int , int , int)") +cfunc_file.get_rft = cwrapper.prototype("c_void_p ecl_rft_file_get_well_time_rft( ecl_rft_file , char* , time_t)") +cfunc_rft.get_type = cwrapper.prototype("int ecl_rft_node_get_type( ecl_rft )") +cfunc_rft.get_well = cwrapper.prototype("char* ecl_rft_node_get_well_name( ecl_rft )") +cfunc_rft.get_date = cwrapper.prototype("time_t ecl_rft_node_get_date( ecl_rft )") +cfunc_rft.get_size = cwrapper.prototype("int ecl_rft_node_get_size( ecl_rft )") +cfunc_rft.iget_cell = cwrapper.prototype("c_void_p ecl_rft_node_iget_cell( ecl_rft )") +cfunc_rft.iget_cell_sorted = cwrapper.prototype("c_void_p ecl_rft_node_iget_cell_sorted( ecl_rft )") +cfunc_rft.sort_cells = cwrapper.prototype("c_void_p ecl_rft_node_inplace_sort_cells( ecl_rft )") +cfunc_rft.iget_depth = cwrapper.prototype("double ecl_rft_node_iget_depth( ecl_rft )") +cfunc_rft.iget_pressure = cwrapper.prototype("double ecl_rft_node_iget_pressure(ecl_rft)") +cfunc_rft.iget_ijk = cwrapper.prototype("void ecl_rft_node_iget_ijk( ecl_rft , int , int*, int*, int*)") +cfunc_rft.iget_swat = cwrapper.prototype("double ecl_rft_node_iget_swat(ecl_rft)") +cfunc_rft.iget_sgas = cwrapper.prototype("double ecl_rft_node_iget_sgas(ecl_rft)") +cfunc_rft.iget_orat = cwrapper.prototype("double ecl_rft_node_iget_orat(ecl_rft)") +cfunc_rft.iget_wrat = cwrapper.prototype("double ecl_rft_node_iget_wrat(ecl_rft)") +cfunc_rft.iget_grat = cwrapper.prototype("double ecl_rft_node_iget_grat(ecl_rft)") +cfunc_rft.lookup_ijk = cwrapper.prototype("c_void_p ecl_rft_node_lookup_ijk( ecl_rft , int , int , int)") +cfunc_rft.is_RFT = cwrapper.prototype("bool ecl_rft_node_is_RFT( ecl_rft )") +cfunc_rft.is_PLT = cwrapper.prototype("bool ecl_rft_node_is_PLT( ecl_rft )") +cfunc_rft.is_SEGMENT = cwrapper.prototype("bool ecl_rft_node_is_SEGMENT( ecl_rft )") +cfunc_rft.is_MSW = cwrapper.prototype("bool ecl_rft_node_is_MSW( ecl_rft )") diff --git a/ThirdParty/Ert/devel/python/python/ert/ecl/ecl_rft_cell.py b/ThirdParty/Ert/devel/python/python/ert/ecl/ecl_rft_cell.py new file mode 100644 index 0000000000..4cd4727ddd --- /dev/null +++ b/ThirdParty/Ert/devel/python/python/ert/ecl/ecl_rft_cell.py @@ -0,0 +1,217 @@ +# Copyright (C) 2011 Statoil ASA, Norway. +# +# The file 'ecl_rft_cell.py' 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 +# for more details. + +import warnings +import ctypes +import types + +import libecl +from ert.cwrap.cwrap import * +from ert.cwrap.cclass import CClass + +class RFTCell(CClass): + """The RFTCell is a base class for the cells which are part of an RFT/PLT. + + The RFTCell class contains the elements which are common to both + RFT and PLT. The list of common elements include the corrdinates + (i,j,k) the pressure and the depth of the cell. Actual user access + should be based on the derived classes EclRFTCell and EclPLTCell. + + Observe that from june 2013 the properties i,j and k which return + offset 1 coordinate values are deprecated, and you should rather + use the methods get_i(), get_j() and get_k() which return offset 0 + coordinate values. + """ + + + def warn(self , old , new): + msg = """ + +The cell property:%s has been deprecated, and the method:%s() should +be used instead. Observe that the new method %s() returns coordinate +values starting at 0, whereas the old property %s returned values +starting at 1; hence you must adapt the calling code when you change +from %s -> %s() +""" % (old , new , new , old , old , new) + warnings.warn( msg , DeprecationWarning ) + + @property + def i(self): + self.warn("i" , "get_i") + return self.get_i() + 1 + + @property + def j(self): + self.warn("j" , "get_j") + return self.get_j() + 1 + + @property + def k(self): + self.warn("k" , "get_k") + return self.get_k() + 1 + + @property + def ijk(self): + self.warn("ijk" , "get_ijk") + return (self.get_i() + 1 , self.get_j() + 1 , self.get_k() + 1) + + def get_i(self): + return cfunc.get_i( self ) + + def get_j(self): + return cfunc.get_j( self ) + + def get_k(self): + return cfunc.get_k( self ) + + def get_ijk(self): + return (cfunc.get_i( self ) , cfunc.get_j( self ) , cfunc.get_k( self )) + + @property + def pressure(self): + return cfunc.get_pressure( self ) + + @property + def depth(self): + return cfunc.get_depth( self ) + + +################################################################# + + +class EclRFTCell(RFTCell): + + @classmethod + def new(cls , i , j , k , depth , pressure , swat , sgas ): + cell = EclRFTCell() + c_ptr = cfunc.alloc_RFT( i,j,k,depth,pressure,swat,sgas) + cell.init_cobj( c_ptr , cfunc.free ) + return cell + + @classmethod + def ref(cls, c_ptr , parent): + cell = EclRFTCell() + cell.init_cref( c_ptr , parent ) + return cell + + @property + def swat(self): + return cfunc.get_swat( self ) + + @property + def sgas(self): + return cfunc.get_sgas( self ) + + @property + def soil(self): + return 1 - (cfunc.get_sgas( self ) + cfunc.get_swat( self )) + + +################################################################# + + +class EclPLTCell(RFTCell): + + @classmethod + def new(self , i , j , k , depth , pressure , orat , grat , wrat , conn_start , flowrate , oil_flowrate , gas_flowrate , water_flowrate ): + cell = EclPLTCell() + c_ptr = cfunc.alloc_PLT( i,j,k,depth,pressure,orat , grat , wrat , conn_start , flowrate , oil_flowrate , gas_flowrate , water_flowrate) + cell.init_cobj( c_ptr , cfunc.free ) + return cell + + @classmethod + def ref(cls, c_ptr , parent): + cell = EclPLTCell() + cell.init_cref( c_ptr , parent ) + return cell + + @property + def orat(self): + return cfunc.get_orat( self ) + + @property + def grat(self): + return cfunc.get_grat( self ) + + @property + def wrat(self): + return cfunc.get_wrat( self ) + + @property + def conn_start(self): + """Will return the length from wellhead(?) to connection. + + For MSW wells this property will return the distance from a + fixed point (wellhead) to the current connection. This value + will be used to sort the completed cells along the well + path. In the case of non MSW wells this will just return a + fixed default value. + """ + return cfunc.get_conn_start( self ) + + @property + def flowrate(self): + return cfunc.get_flowrate( self ) + + @property + def oil_flowrate(self): + return cfunc.get_oil_flowrate( self ) + + @property + def gas_flowrate(self): + return cfunc.get_gas_flowrate( self ) + + @property + def water_flowrate(self): + return cfunc.get_water_flowrate( self ) + + +################################################################# + + +cwrapper = CWrapper( libecl.lib ) +cwrapper.registerType( "rft_cell" , RFTCell) +cwrapper.registerType( "ecl_rft_cell" , EclRFTCell ) +cwrapper.registerType( "ecl_plt_cell" , EclPLTCell ) + +cfunc = CWrapperNameSpace("ecl_rft_cell") + +cfunc.alloc_RFT = cwrapper.prototype("c_void_p ecl_rft_cell_alloc_RFT( int, int , int , double , double , double , double)") +cfunc.alloc_PLT = cwrapper.prototype("c_void_p ecl_rft_cell_alloc_PLT( int, int , int , double , double , double , double, double , double , double , double , double , double )") +cfunc.free = cwrapper.prototype("void ecl_rft_cell_free( rft_cell )") + +cfunc.get_pressure = cwrapper.prototype("double ecl_rft_cell_get_pressure( rft_cell )") +cfunc.get_depth = cwrapper.prototype("double ecl_rft_cell_get_depth( rft_cell )") +cfunc.get_i = cwrapper.prototype("int ecl_rft_cell_get_i( rft_cell )") +cfunc.get_j = cwrapper.prototype("int ecl_rft_cell_get_j( rft_cell )") +cfunc.get_k = cwrapper.prototype("int ecl_rft_cell_get_k( rft_cell )") + +cfunc.get_swat = cwrapper.prototype("double ecl_rft_cell_get_swat( ecl_rft_cell )") +cfunc.get_soil = cwrapper.prototype("double ecl_rft_cell_get_soil( ecl_rft_cell )") +cfunc.get_sgas = cwrapper.prototype("double ecl_rft_cell_get_sgas( ecl_rft_cell )") + +cfunc.get_orat = cwrapper.prototype("double ecl_rft_cell_get_orat( ecl_plt_cell )") +cfunc.get_grat = cwrapper.prototype("double ecl_rft_cell_get_grat( ecl_plt_cell )") +cfunc.get_wrat = cwrapper.prototype("double ecl_rft_cell_get_wrat( ecl_plt_cell )") + +cfunc.get_conn_start = cwrapper.prototype("double ecl_rft_cell_get_connection_start( ecl_plt_cell )") + +cfunc.get_flowrate = cwrapper.prototype("double ecl_rft_cell_get_flowrate( ecl_plt_cell )") +cfunc.get_oil_flowrate = cwrapper.prototype("double ecl_rft_cell_get_oil_flowrate( ecl_plt_cell )") +cfunc.get_gas_flowrate = cwrapper.prototype("double ecl_rft_cell_get_gas_flowrate( ecl_plt_cell )") +cfunc.get_water_flowrate = cwrapper.prototype("double ecl_rft_cell_get_water_flowrate( ecl_plt_cell )") + + diff --git a/ThirdParty/Ert/devel/python/python/ert/ecl/ecl_sum.py b/ThirdParty/Ert/devel/python/python/ert/ecl/ecl_sum.py index d687e329e2..308ef6ebc2 100644 --- a/ThirdParty/Ert/devel/python/python/ert/ecl/ecl_sum.py +++ b/ThirdParty/Ert/devel/python/python/ert/ecl/ecl_sum.py @@ -33,6 +33,7 @@ from ert.cwrap.cwrap import * from ert.cwrap.cclass import CClass from ert.util.stringlist import StringList from ert.util.ctime import ctime +from ert.ert.erttypes import time_vector, double_vector import numpy @@ -507,7 +508,7 @@ class EclSMSPECNode( CClass ): class EclSum( CClass ): - def __new__( cls , load_case , join_string = ":" , include_restart = True): + def __new__( cls , load_case , join_string = ":" , include_restart = True, c_ptr = None, parent = None): """ Loads a new EclSum instance with summary data. @@ -525,16 +526,24 @@ class EclSum( CClass ): loader will, in the case of a restarted ECLIPSE simulation, try to load summary results also from the restarted case. """ - c_ptr = cfunc.fread_alloc( load_case , join_string , include_restart) if c_ptr: obj = object.__new__( cls ) - obj.init_cobj( c_ptr , cfunc.free ) + if parent: + obj.init_cref( c_ptr , parent) + else: + obj.init_cobj( c_ptr , cfunc.free ) return obj else: - return None + c_ptr = cfunc.fread_alloc( load_case , join_string , include_restart) + if c_ptr: + obj = object.__new__( cls ) + obj.init_cobj( c_ptr , cfunc.free ) + return obj + else: + return None - def __init__(self , load_case , join_string = ":" ,include_restart = True , c_ptr = None): + def __init__(self , load_case , join_string = ":" ,include_restart = True , c_ptr = None, parent = None): """ Initialize a new EclSum instance. @@ -1221,9 +1230,15 @@ class EclSum( CClass ): cfunc.fwrite_sum( self ) - + def alloc_time_vector(self, report_only): + return time_vector(cfunc.alloc_time_vector(self, report_only)) + + def alloc_data_vector(self, data_index, report_only): + return double_vector(cfunc.alloc_data_vector(self, data_index, report_only)) + def get_general_var_index(self, key): + return cfunc.get_general_var_index( self , key ) ################################################################# @@ -1280,7 +1295,8 @@ cfunc.get_report_time = cwrapper.prototype("time_t ecl_sum_get_r cfunc.fwrite_sum = cwrapper.prototype("void ecl_sum_fwrite(ecl_sum)") cfunc.set_case = cwrapper.prototype("void ecl_sum_set_case(ecl_sum, char*)") - +cfunc.alloc_time_vector = cwrapper.prototype("c_void_p ecl_sum_alloc_time_vector(ecl_sum, bool)") +cfunc.alloc_data_vector = cwrapper.prototype("c_void_p ecl_sum_alloc_data_vector(ecl_sum, int, bool)") #----------------------------------------------------------------- # smspec node related stuff diff --git a/ThirdParty/Ert/devel/python/python/ert/enkf/CMakeLists.txt b/ThirdParty/Ert/devel/python/python/ert/enkf/CMakeLists.txt index cd664575a1..0ea246117a 100644 --- a/ThirdParty/Ert/devel/python/python/ert/enkf/CMakeLists.txt +++ b/ThirdParty/Ert/devel/python/python/ert/enkf/CMakeLists.txt @@ -1 +1 @@ -add_python_package("Python ert.enkf" ${PYTHON_INSTALL_PREFIX}/ert/enkf "enkf_enum.py;enkf_main.py;enkf.py;ens_config.py;__init__.py;analysis_config.py;libenkf.py" True) +add_python_package("Python ert.enkf" ${PYTHON_INSTALL_PREFIX}/ert/enkf "analysis_config.py;enkf_main.py;ert_templates.py;gen_kw_config.py;model_config.py;ecl_config.py;enkf_node.py;field_config.py;__init__.py;obs_vector.py;enkf_config_node.py;enkf_obs.py;block_obs.py;libenkf.py;plot_config.py;enkf_enum.py;enkf.py;field.py;local_config.py;site_config.py;enkf_fs.py;ens_config.py;gen_data_config.py;time_map.py;ert_template.py;enkf_state.py" True) diff --git a/ThirdParty/Ert/devel/python/python/ert/enkf/analysis_config.py b/ThirdParty/Ert/devel/python/python/ert/enkf/analysis_config.py index 567c632451..6325c4c21d 100644 --- a/ThirdParty/Ert/devel/python/python/ert/enkf/analysis_config.py +++ b/ThirdParty/Ert/devel/python/python/ert/enkf/analysis_config.py @@ -23,35 +23,57 @@ import libenkf class AnalysisConfig(CClass): - def __init__(self , c_ptr = None): - self.owner = False - self.c_ptr = c_ptr + def __init__(self , c_ptr , parent = None): + if parent: + self.init_cref( c_ptr , parent) + else: + self.init_cobj( c_ptr , cfunc.free ) + + @property + def get_rerun(self): + return cfunc.get_rerun( self ) + + def set_rerun(self, rerun): + cfunc.set_rerun(self, rerun) - - def __del__(self): - if self.owner: - cfunc.free( self ) + @property + def get_rerun_start(self): + return cfunc.get_rerun_start( self ) + def set_rerun_start(self, int): + cfunc.set_rerun_start( self , int) - def has_key(self , key): - return cfunc.has_key( self ,key ) + @property + def get_log_path(self): + return cfunc.get_log_path( self ) + def set_log_path(self, path): + cfunc.set_log_path( self, path) + @property + def get_alpha(self): + return cfunc.get_alpha( self ) + def set_alpha(self, alpha): + cfunc.set_alpha( self , alpha) + + @property + def get_merge_observations(self): + return cfunc.get_merge_observations( self ) + + def set_merge_observations(self, merge_observations): + return cfunc.set_merge_observations( self , merge_observations) ################################################################## cwrapper = CWrapper( libenkf.lib ) cwrapper.registerType( "analysis_config" , AnalysisConfig ) -# 3. Installing the c-functions used to manipulate ecl_kw instances. -# These functions are used when implementing the EclKW class, not -# used outside this scope. cfunc = CWrapperNameSpace("analysis_config") cfunc.free = cwrapper.prototype("void analysis_config_free( analysis_config )") cfunc.get_rerun = cwrapper.prototype("int analysis_config_get_rerun( analysis_config )") -cfunc.set_rerun = cwrapper.prototype("void analysis_config_set_rerun analysis_config, bool)") +cfunc.set_rerun = cwrapper.prototype("void analysis_config_set_rerun( analysis_config, bool)") cfunc.get_rerun_start = cwrapper.prototype("int analysis_config_get_rerun_start( analysis_config )") cfunc.set_rerun_start = cwrapper.prototype("void analysis_config_set_rerun_start( analysis_config, int)") cfunc.get_log_path = cwrapper.prototype("char* analysis_config_get_log_path( analysis_config)") @@ -59,8 +81,5 @@ cfunc.set_log_path = cwrapper.prototype("void analysis_config_set_log_ cfunc.get_alpha = cwrapper.prototype("double analysis_config_get_alpha(analysis_config)") cfunc.set_alpha = cwrapper.prototype("void analysis_config_set_alpha(analysis_config, double)") cfunc.get_merge_observations = cwrapper.prototype("bool analysis_config_get_merge_observations(analysis_config)") -cfunc.set_merge_observations = cwrapper.prototype("void analysis_config_set_merge_observations(analysis_config, int)") -cfunc.get_enkf_mode = cwrapper.prototype("int analysis_config_get_enkf_mode(analysis_config)") -cfunc.set_enkf_mode = cwrapper.prototype("void analysis_config_set_enkf_mode(analysis_config, int)") -cfunc.get_truncation = cwrapper.prototype("double analysis_config_get_truncation(analysis_config)") -cfunc.get_truncation = cwrapper.prototype("void analysis_config_set_truncation(analysis_config, double)") +cfunc.set_merge_observations = cwrapper.prototype("void analysis_config_set_merge_observations(analysis_config, bool)") + diff --git a/ThirdParty/Ert/devel/python/python/ert/enkf/block_obs.py b/ThirdParty/Ert/devel/python/python/ert/enkf/block_obs.py new file mode 100644 index 0000000000..af15b20f8c --- /dev/null +++ b/ThirdParty/Ert/devel/python/python/ert/enkf/block_obs.py @@ -0,0 +1,58 @@ +# Copyright (C) 2012 Statoil ASA, Norway. +# +# The file 'block_obs.py' 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 +# for more details. + +import ctypes +from ert.cwrap.cwrap import * +from ert.cwrap.cclass import CClass +from ert.util.tvector import * +from enkf_enum import * +import libenkf +class BlockObs(CClass): + + def __init__(self , c_ptr , parent = None): + if parent: + self.init_cref( c_ptr , parent) + else: + self.init_cobj( c_ptr , cfunc.free ) + + def iget_i(self , index): + return cfunc.iget_i( self ,index ) + + def iget_j(self , index): + return cfunc.iget_j( self ,index ) + + def iget_k(self , index): + return cfunc.iget_k( self ,index ) + + def get_size(self): + return cfunc.get_size(self) + + def iget(self, index, value, std): + return cfunc.iget(self, index, value, std) + +################################################################## + +cwrapper = CWrapper( libenkf.lib ) +cwrapper.registerType( "block_obs" , BlockObs ) +cfunc = CWrapperNameSpace("block_obs") + + +cfunc.free = cwrapper.prototype("void block_obs_free( block_obs )") +cfunc.iget_i = cwrapper.prototype("int block_obs_iget_i(block_obs, int)") +cfunc.iget_j = cwrapper.prototype("int block_obs_iget_j( block_obs, int)") +cfunc.iget_k = cwrapper.prototype("int block_obs_iget_k( block_obs , int)") +cfunc.get_size = cwrapper.prototype("int block_obs_get_size( block_obs )") +cfunc.iget = cwrapper.prototype("void block_obs_iget( block_obs, int, double*, double*)") diff --git a/ThirdParty/Ert/devel/python/python/ert/enkf/ecl_config.py b/ThirdParty/Ert/devel/python/python/ert/enkf/ecl_config.py index fffec1a3aa..c3e67a3cc9 100644 --- a/ThirdParty/Ert/devel/python/python/ert/enkf/ecl_config.py +++ b/ThirdParty/Ert/devel/python/python/ert/enkf/ecl_config.py @@ -20,31 +20,86 @@ from ert.cwrap.cclass import CClass from ert.util.tvector import * from enkf_enum import * import libenkf +import ert.util.libutil +from ert.ecl.ecl_sum import EclSum +from ert.util.stringlist import StringList class EclConfig(CClass): - def __init__(self , c_ptr = None): - self.owner = False - self.c_ptr = c_ptr + def __init__(self , c_ptr , parent = None): + if parent: + self.init_cref( c_ptr , parent) + else: + self.init_cobj( c_ptr , cfunc.free ) + + @property + def get_eclbase(self): + eclbase = cfunc.get_eclbase(self) + return eclbase + + @property + def get_data_file(self): + datafile = cfunc.get_data_file(self) + return datafile + + @property + def get_gridfile(self): + gridfile = cfunc.get_gridfile(self) + return gridfile + + def set_gridfile(self, gridfile): + cfunc.set_gridfile(self, gridfile) + + @property + def get_schedule_file(self): + schedule_file = cfunc.get_schedule_file(self) + return schedule_file + + def set_schedule_file(self, schedule_file): + schedule_file = cfunc.set_schedule_file(self, schedule_file) + + @property + def get_init_section(self): + init_section = cfunc.get_init_section(self) + return init_section + + def set_init_section(self, init_section): + cfunc.set_init_section(self, init_section) + + @property + def get_refcase_name(self): + refcase_name = cfunc.get_refcase_name(self) + return refcase_name + + def load_refcase(self, refcase): + cfunc.load_refcase(self, refcase) - - def __del__(self): - if self.owner: - cfunc.free( self ) + @property + def get_static_kw_list(self): + return StringList(c_ptr = cfunc.get_static_kw_list( self ) , parent = self) + @property + def get_refcase(self): + refcase = EclSum(self.get_refcase_name, join_string = ":" , include_restart = True, c_ptr = cfunc.get_refcase( self ), parent = self) + return refcase + + def clear_static_kw(self): + cfunc.clear_static_kw(self) - def has_key(self , key): - return cfunc.has_key( self ,key ) - + def add_static_kw(self,kw): + cfunc.add_static_kw(self,kw) + @property + def get_grid(self): + return cfunc.get_grid(self) + @property + def get_sched_file(self): + return cfunc.get_sched_file(self) ################################################################## cwrapper = CWrapper( libenkf.lib ) cwrapper.registerType( "ecl_config" , EclConfig ) -# 3. Installing the c-functions used to manipulate ecl_kw instances. -# These functions are used when implementing the EclKW class, not -# used outside this scope. cfunc = CWrapperNameSpace("ecl_config") @@ -53,13 +108,15 @@ cfunc.get_eclbase = cwrapper.prototype("char* ecl_config_get_eclbase( ecl cfunc.get_data_file = cwrapper.prototype("char* ecl_config_get_data_file(ecl_config)") cfunc.get_gridfile = cwrapper.prototype("char* ecl_config_get_gridfile(ecl_config)") cfunc.set_gridfile = cwrapper.prototype("void ecl_config_set_grid(ecl_config, char*)") -cfunc.get_schedule = cwrapper.prototype("char* ecl_config_get_schedule_file(ecl_config)") -cfunc.set_schedule = cwrapper.prototype("void ecl_config_set_schedule_file(ecl_config, char*)") +cfunc.get_schedule_file = cwrapper.prototype("char* ecl_config_get_schedule_file(ecl_config)") +cfunc.set_schedule_file = cwrapper.prototype("void ecl_config_set_schedule_file(ecl_config, char*)") cfunc.get_init_section = cwrapper.prototype("char* ecl_config_get_init_section(ecl_config)") cfunc.set_init_section = cwrapper.prototype("void ecl_config_set_init_section(ecl_config, char*)") cfunc.get_refcase_name = cwrapper.prototype("char* ecl_config_get_refcase_name(ecl_config)") -cfunc.set_refcase_name = cwrapper.prototype("void ecl_config_load_refcase(ecl_config, char*)") +cfunc.load_refcase = cwrapper.prototype("void ecl_config_load_refcase(ecl_config, char*)") cfunc.get_static_kw_list = cwrapper.prototype("c_void_p ecl_config_get_static_kw_list(ecl_config)") cfunc.clear_static_kw = cwrapper.prototype("void ecl_config_clear_static_kw(ecl_config)") cfunc.add_static_kw = cwrapper.prototype("void ecl_config_add_static_kw(ecl_config, char*)") cfunc.get_grid = cwrapper.prototype("c_void_p ecl_config_get_grid(ecl_config)") +cfunc.get_refcase = cwrapper.prototype("c_void_p ecl_config_get_refcase(ecl_config)") +cfunc.get_sched_file = cwrapper.prototype("c_void_p ecl_config_get_sched_file(ecl_config)") diff --git a/ThirdParty/Ert/devel/python/python/ert/enkf/enkf_config_node.py b/ThirdParty/Ert/devel/python/python/ert/enkf/enkf_config_node.py index 0bca2c408b..a0d07f96b3 100644 --- a/ThirdParty/Ert/devel/python/python/ert/enkf/enkf_config_node.py +++ b/ThirdParty/Ert/devel/python/python/ert/enkf/enkf_config_node.py @@ -20,43 +20,76 @@ from ert.cwrap.cclass import CClass from ert.util.tvector import * from enkf_enum import * import libenkf +from ert.enkf.gen_data_config import GenDataConfig +from ert.enkf.gen_kw_config import GenKwConfig +from ert.enkf.field_config import FieldConfig +from ert.enkf.enkf_node import EnkfNode + class EnkfConfigNode(CClass): - def __init__(self , c_ptr = None): - self.owner = False - self.c_ptr = c_ptr - - - def __del__(self): - if self.owner: - cfunc.free( self ) + def __init__(self , c_ptr , parent = None): + if parent: + self.init_cref( c_ptr , parent) + else: + self.init_cobj( c_ptr , cfunc.free ) + @property + def get_impl_type( self ): + return cfunc.get_impl_type( self ) - def has_key(self , key): - return cfunc.has_key( self ,key ) + @property + def get_var_type( self ): + return cfunc.get_var_type( self ) + @property + def get_ref(self): + return cfunc.get_ref( self) + @property + def get_min_std_file(self): + return cfunc.get_min_std_file( self) + @property + def get_enkf_outfile(self): + return cfunc.get_enkf_outfile( self) + + @property + def field_model(self): + return FieldConfig(c_ptr = cfunc.get_ref( self), parent = self) + + @property + def data_model(self): + return GenDataConfig(c_ptr = cfunc.get_ref( self), parent = self) + + @property + def keyword_model(self): + return GenKwConfig(c_ptr = cfunc.get_ref( self), parent = self) + + @property + def get_enkf_infile(self): + return cfunc.get_enkf_infile( self) + + @property + def alloc_node(self): + node = EnkfNode.alloc(self) + return node + + @property + def get_init_file_fmt(self): + return cfunc.get_init_file_fmt(self) ################################################################## cwrapper = CWrapper( libenkf.lib ) cwrapper.registerType( "enkf_config_node" , EnkfConfigNode ) -# 3. Installing the c-functions used to manipulate ecl_kw instances. -# These functions are used when implementing the EclKW class, not -# used outside this scope. cfunc = CWrapperNameSpace("enkf_config_node") - - -cfunc.free = cwrapper.prototype("void enkf_config_node_free( enkf_config_node )") -cfunc.get_impl_type = cwrapper.prototype("c_void_p enkf_config_node_get_impl_type(enkf_config_node)") -cfunc.get_ref = cwrapper.prototype("c_void_p enkf_config_node_get_ref(enkf_config_node)") -cfunc.is_valid = cwrapper.prototype("bool enkf_config_node_is_valid(enkf_config_node)") -cfunc.get_min_std_file = cwrapper.prototype("char* enkf_config_node_get_min_std_file(enkf_config_node)") -cfunc.get_enkf_outfile = cwrapper.prototype("char* enkf_config_node_get_enkf_outfile(enkf_config_node)") -cfunc.get_enkf_infile = cwrapper.prototype("char* enkf_config_node_get_enkf_infile(enkf_config_node)") -cfunc.update_gen_kw = cwrapper.prototype("void enkf_config_node_update_gen_kw(enkf_config_node, char*, char*, char*, char*, char*)") -cfunc.update_state_field = cwrapper.prototype("void enkf_config_node_update_state_field(enkf_config_node, int, double, double)") -cfunc.update_parameter_field = cwrapper.prototype("void enkf_config_node_update_parameter_field(enkf_config_node, char*, char*, char*, int, double, double, char*, char*)") -cfunc.update_general_field = cwrapper.prototype("void enkf_config_node_update_general_field(enkf_config_node, char*, char*, char*, char*, int, double, double, char*, char*, char*)") -cfunc.update_gen_data = cwrapper.prototype("void enkf_config_node_update_gen_data(enkf_config_node, int, int, char*, char*, char*, char*, char*, char*)") +################################################################## +################################################################## +cfunc.free = cwrapper.prototype("void enkf_config_node_free( enkf_config_node )") +cfunc.get_ref = cwrapper.prototype("c_void_p enkf_config_node_get_ref(enkf_config_node)") +cfunc.get_impl_type = cwrapper.prototype("c_void_p enkf_config_node_get_impl_type(enkf_config_node)") +cfunc.get_enkf_outfile = cwrapper.prototype("char* enkf_config_node_get_enkf_outfile(enkf_config_node)") +cfunc.get_min_std_file = cwrapper.prototype("char* enkf_config_node_get_min_std_file(enkf_config_node)") +cfunc.get_enkf_infile = cwrapper.prototype("char* enkf_config_node_get_enkf_infile(enkf_config_node)") +cfunc.get_init_file_fmt = cwrapper.prototype("char* enkf_config_node_get_init_file_fmt(enkf_config_node)") +cfunc.get_var_type = cwrapper.prototype("c_void_p enkf_config_node_get_var_type(enkf_config_node)") diff --git a/ThirdParty/Ert/devel/python/python/ert/enkf/enkf_fs.py b/ThirdParty/Ert/devel/python/python/ert/enkf/enkf_fs.py new file mode 100644 index 0000000000..96e7cc3d8e --- /dev/null +++ b/ThirdParty/Ert/devel/python/python/ert/enkf/enkf_fs.py @@ -0,0 +1,68 @@ +# Copyright (C) 2012 Statoil ASA, Norway. +# +# The file 'enkf_fs.py' 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 +# for more details. + +import ctypes +from ctypes import c_buffer +from ert.cwrap.cwrap import * +from ert.cwrap.cclass import CClass +from ert.util.tvector import * +from enkf_enum import * +from ert.ert.enums import enkf_var_type, ert_state_enum +from ert.enkf.time_map import TimeMap +from ert.util.buffer import Buffer +import libenkf +from ert.ert.c_enums import state_enum +from ert.ert.c_enums import var_type +class EnkfFs(CClass): + + def __init__(self , c_ptr , parent = None): + if parent: + self.init_cref( c_ptr , parent) + else: + self.init_cobj( c_ptr , cfunc.close ) + + def has_node(self, node_key, var_type, report_step, iens, state): + return cfunc.has_node(self, node_key, var_type, report_step, iens, state) + + def has_vector(self, node_key, var_type, iens, state): + return cfunc.has_vector(self, node_key, var_type, iens, state) + + + def fread_node(self, key, type, step, member, value): + buffer = Buffer(100) + cfunc.fread_node(self, buffer, key, type, step, member, value) + + def fread_vector(self, key, type, member, value): + buffer = Buffer(100) + cfunc.fread_vector(self, buffer, key, type, member, value) + + @property + def get_time_map(self): + return TimeMap(cfunc.get_time_map(self), parent = self) + +################################################################## + +cwrapper = CWrapper( libenkf.lib ) +cwrapper.registerType( "enkf_fs" , EnkfFs ) + +cfunc = CWrapperNameSpace("enkf_fs") + +cfunc.close = cwrapper.prototype("void enkf_fs_close(enkf_fs)") +cfunc.has_node = cwrapper.prototype("bool enkf_fs_has_node(enkf_fs, char*, c_uint, int, int, c_uint)") +cfunc.has_vector = cwrapper.prototype("bool enkf_fs_has_vector(enkf_fs, char*, c_uint, int, c_uint)") +cfunc.fread_node = cwrapper.prototype("void enkf_fs_fread_node(enkf_fs, buffer, char*, c_uint, int, int, c_uint)") +cfunc.fread_vector = cwrapper.prototype("void enkf_fs_fread_vector(enkf_fs, buffer, char*, c_uint, int, c_uint)") +cfunc.get_time_map = cwrapper.prototype("c_void_p enkf_fs_get_time_map(enkf_fs)") diff --git a/ThirdParty/Ert/devel/python/python/ert/enkf/enkf_main.py b/ThirdParty/Ert/devel/python/python/ert/enkf/enkf_main.py index 57b4a319e5..5ded9202e4 100644 --- a/ThirdParty/Ert/devel/python/python/ert/enkf/enkf_main.py +++ b/ThirdParty/Ert/devel/python/python/ert/enkf/enkf_main.py @@ -15,25 +15,29 @@ # for more details. import ctypes -from ert.cwrap.cwrap import * -from ert.cwrap.cclass import CClass -from ert.util.tvector import * -from ert.job_queue.job_queue import JobQueue -from enkf_enum import * -import ens_config -import ecl_config -import analysis_config -import local_config -import model_config -import enkf_config_node -import gen_kw_config -import gen_data_config -import field_config -import enkf_obs -import plot_config -import site_config -import libenkf -import ert_local +from ert.cwrap.cwrap import * +from ert.cwrap.cclass import CClass +from ert.util.tvector import * +from ert.job_queue.job_queue import JobQueue +from ert.enkf.enkf_enum import * +from ert.ert.enums import * +from ert.enkf.ens_config import * +from ert.enkf.ecl_config import * +from ert.enkf.analysis_config import * +from ert.enkf.local_config import * +from ert.enkf.model_config import * +from ert.enkf.enkf_config_node import * +from ert.enkf.gen_kw_config import * +from ert.enkf.gen_data_config import * +from ert.enkf.field_config import * +from ert.enkf.enkf_obs import * +from ert.enkf.plot_config import * +from ert.enkf.site_config import * +from ert.enkf.libenkf import * +from ert.enkf.enkf_fs import * +from ert.enkf.ert_templates import * +from ert.enkf.enkf_state import * +from ert.util.log import * class EnKFMain(CClass): @@ -43,11 +47,13 @@ class EnKFMain(CClass): @classmethod - def bootstrap(cls , model_config , site_config = ert_local.site_config): + def bootstrap(cls , model_config , site_config , strict = True): obj = EnKFMain() - obj.c_ptr = cfunc.bootstrap( site_config , model_config , True , False ) + obj.c_ptr = cfunc.bootstrap( site_config , model_config , strict , False ) return obj - + + def set_eclbase(self, eclbase): + cfunc.set_eclbase(self, eclbase) def __del__(self): if self.c_ptr: @@ -58,48 +64,203 @@ class EnKFMain(CClass): @property def ens_size( self ): return cfunc.ens_size( self ) - + + @property + def ensemble_config(self): + config = EnsConfig( c_ptr = cfunc.get_ens_config( self ) , parent = self) + return config + + @property + def analysis_config(self): + anal_config = AnalysisConfig( c_ptr = cfunc.get_analysis_config( self ), parent = self) + return anal_config + + @property + def model_config(self): + mod_config = ModelConfig( c_ptr = cfunc.get_model_config( self ) , parent = self) + return mod_config - def sim( self ): - iactive = BoolVector( True ) - iactive[ self.ens_size -1 ] = True - - start_state = enkf_state_enum.ANALYZED - run_mode = enkf_run_enum.ENSEMBLE_EXPERIMENT - start_report = 0 - init_step_parameters = 0 - cfunc.run( self , run_mode , iactive , init_step_parameters , start_report , start_state ) + @property + def logh(self): + mog = Log( c_ptr = cfunc.get_logh( self ), parent = self) + return mog + + @property + def local_config(self): + loc_config = LocalConfig( c_ptr = cfunc.get_local_config( self ), parent = self) + return loc_config + + @property + def site_config(self): + site_conf = SiteConfig( c_ptr = cfunc.get_site_config( self ) , parent = self) + return site_conf + + @property + def ecl_config(self): + ecl_conf = EclConfig( c_ptr = cfunc.get_ecl_config( self ) , parent = self) + return ecl_conf + + @property + def plot_config(self): + plot_conf = PlotConfig( c_ptr = cfunc.get_plot_config( self ), parent = self) + return plot_conf + + def set_eclbase(self, eclbase): + cfunc.set_eclbase(self, eclbase) - def update(self , step_list): - cfunc.update( self , step_list ) - + def set_datafile(self, datafile): + cfunc.set_eclbase(self, datafile) + + @property + def get_schedule_prediction_file(self): + schedule_prediction_file = cfunc.get_schedule_prediction_file(self) + return schedule_prediction_file + + def set_schedule_prediction_file(self,file): + cfunc.set_schedule_prediction_file(self,file) + + @property + def get_data_kw(self): + data_kw = cfunc.get_data_kw(self) + return data_kw + + def clear_data_kw(self): + cfunc.set_data_kw(self) + + def add_data_kw(self, key, value): + cfunc.add_data_kw(self, key, value) + + def resize_ensemble(self, value): + cfunc.resize_ensemble(self, value) + + def del_node(self, key): + cfunc.del_node(self, key) @property - def config(self): - config = ens_config.EnsConfig( cfunc.get_ens_config( self )) - return config + def get_obs(self): + ob = EnkfObs( c_ptr = cfunc.get_obs( self ), parent = self) + return ob + + def load_obs(self, obs_config_file): + cfunc.load_obs(self, obs_config_file) + + def reload_obs(self): + cfunc.reload_obs(self) + + def set_case_table(self, case_table_file): + cfunc.set_case_table(self, case_table_file) + + @property + def get_pre_clear_runpath(self): + pre_clear = cfunc.get_pre_clear_runpath(self) + return pre_clear + + def set_pre_clear_runpath(self, value): + cfunc.set_pre_clear_runpath(self, value) + + def iget_keep_runpath(self, iens): + ikeep = cfunc.iget_keep_runpath(self, iens) + return ikeep + + def iset_keep_runpath(self, iens, keep_runpath): + cfunc.iset_keep_runpath(self, iens, keep_runpath) + + @property + def get_templates(self): + temp = ErtTemplates( c_ptr = cfunc.get_templates( self ), parent = self) + return temp + + @property + def get_site_config_file(self): + site_conf_file = cfunc.get_site_config_file(self) + return site_conf_file + + def initialize_from_scratch(self, parameter_list, iens1, iens2, force_init = True): + cfunc.initialize_from_scratch(self, parameter_list, iens1, iens2, force_init) + + @property + def get_fs(self): + return EnkfFs(c_ptr = cfunc.get_fs(self), parent = self) + + @property + def get_history_length(self): + return cfunc.get_history_length(self) + + def initialize_from_existing__(self, source_case,source_report_step, source_state, member_mask, ranking_key, node_list): + cfunc.initialize_from_existing__(self, source_case, source_report_step, source_state, member_mask, ranking_key, node_list) + + + def copy_ensemble(self, source_case, source_report_step, source_state, target_case, target_report_step, target_state, member_mask, ranking_key, node_list): + cfunc.copy_ensemble(self, source_case, source_report_step, source_state, target_case, target_report_step, target_state, member_mask, ranking_key, node_list) + def iget_state(self, ens_memb): + i_enkf_state = EnKFState( c_ptr = cfunc.iget_state( self ,ens_memb), parent = self) + return i_enkf_state + + def get_observations(self, user_key, obs_count, obs_x, obs_y, obs_std): + cfunc.get_observations(self, user_key, obs_count, obs_x, obs_y, obs_std) + + def get_observation_count(self, user_key): + return cfunc.get_observation_count(self, user_key) + + @property + def is_initialized(self): + return cfunc.is_initialized(self) + + def run(self, boolPtr, init_step_parameter, simFrom, state, mode): + #{"ENKF_ASSIMILATION" : 1, "ENSEMBLE_EXPERIMENT" : 2, "ENSEMBLE_PREDICTION" : 3, "INIT_ONLY" : 4, "SMOOTHER" : 5} + if mode == 1: + cfunc.run_assimilation(self, boolPtr, init_step_parameter, simFrom, state) + if mode == 2: + cfunc.run_exp(self, boolPtr, True, init_step_parameter, simFrom, state) + if mode == 4: + cfunc.run_exp(self, boolPtr, False, init_step_parameter, simFrom, state) + if mode == 5: + cfunc.run_smoother(self, "AUTOSMOOTHER", True) + + @property + def alloc_caselist(self): + return StringList(c_ptr = cfunc.alloc_caselist(self), parent = self) + + @property + def get_current_fs(self): + return cfunc.get_current_fs(self) + + def user_select_fs(self, input_case): + cfunc.user_select_fs(self, input_case) + + @property + def get_alt_fs(self, fs, read_only, create): + return EnkfFS(cfunc.get_alt_fs(self, fs, read_only, create), parent = self) + + @staticmethod + def create_new_config(config_file, storage_path, case_name, dbase_type, num_realizations): + cfunc.create_new_config(config_file, storage_path, case_name, dbase_type, num_realizations) + + def fprintf_config(self): + cfunc.fprintf_config(self) + ################################################################## cwrapper = CWrapper( libenkf.lib ) cwrapper.registerType( "enkf_main" , EnKFMain ) -# 3. Installing the c-functions used to manipulate ecl_kw instances. -# These functions are used when implementing the EclKW class, not -# used outside this scope. cfunc = CWrapperNameSpace("enkf_main") +################################################################## +################################################################## -cfunc.bootstrap = cwrapper.prototype("c_void_p enkf_main_bootstrap(char*, char*, bool)") +cfunc.bootstrap = cwrapper.prototype("c_void_p enkf_main_bootstrap(char*, char*, bool , bool)") cfunc.free = cwrapper.prototype("void enkf_main_free( enkf_main )") -cfunc.run = cwrapper.prototype("void enkf_main_run( enkf_main , int , bool_vector , int , int , int)") cfunc.ens_size = cwrapper.prototype("int enkf_main_get_ensemble_size( enkf_main )") cfunc.get_ens_config = cwrapper.prototype("c_void_p enkf_main_get_ensemble_config( enkf_main )") -cfunc.set_verbose = cwrapper.prototype("void enkf_main_set_verbose( enkf_main , bool )") -cfunc.update = cwrapper.prototype("void enkf_main_UPDATE(enkf_main , int_vector)") cfunc.get_model_config = cwrapper.prototype("c_void_p enkf_main_get_model_config( enkf_main )") cfunc.get_local_config = cwrapper.prototype("c_void_p enkf_main_get_local_config( enkf_main )") +cfunc.get_analysis_config = cwrapper.prototype("c_void_p enkf_main_get_analysis_config( enkf_main)") +cfunc.get_site_config = cwrapper.prototype("c_void_p enkf_main_get_site_config( enkf_main)") +cfunc.get_ecl_config = cwrapper.prototype("c_void_p enkf_main_get_ecl_config( enkf_main)") +cfunc.get_plot_config = cwrapper.prototype("c_void_p enkf_main_get_plot_config( enkf_main)") cfunc.set_eclbase = cwrapper.prototype("void enkf_main_set_eclbase( enkf_main, char*)") cfunc.set_datafile = cwrapper.prototype("void enkf_main_set_data_file( enkf_main, char*)") cfunc.get_schedule_prediction_file = cwrapper.prototype("char* enkf_main_get_schedule_prediction_file( enkf_main )") @@ -107,23 +268,34 @@ cfunc.set_schedule_prediction_file = cwrapper.prototype("void enkf_main_set_sche cfunc.get_data_kw = cwrapper.prototype("c_void_p enkf_main_get_data_kw(enkf_main)") cfunc.clear_data_kw = cwrapper.prototype("void enkf_main_clear_data_kw(enkf_main)") cfunc.add_data_kw = cwrapper.prototype("void enkf_main_add_data_kw(enkf_main, char*, char*)") -cfunc.get_ensemble_size = cwrapper.prototype("int enkf_main_get_ensemble_size(enkf_main)") -cfunc.resize_ensemble = cwrapper.prototype("void enkf_main_resize_ensemble(int)") +cfunc.resize_ensemble = cwrapper.prototype("void enkf_main_resize_ensemble(enkf_main, int)") cfunc.del_node = cwrapper.prototype("void enkf_main_del_node(enkf_main, char*)") cfunc.get_obs = cwrapper.prototype("c_void_p enkf_main_get_obs(enkf_main)") cfunc.load_obs = cwrapper.prototype("void enkf_main_load_obs(enkf_main, char*)") cfunc.reload_obs = cwrapper.prototype("void enkf_main_reload_obs(enkf_main)") cfunc.set_case_table = cwrapper.prototype("void enkf_main_set_case_table(enkf_main, char*)") -cfunc.get_pre_clear_runpath = cwrapper.prototype("bool enkf_main_get_pre_clear_runpath(enkf_main)"), +cfunc.get_pre_clear_runpath = cwrapper.prototype("bool enkf_main_get_pre_clear_runpath(enkf_main)") cfunc.set_pre_clear_runpath = cwrapper.prototype("void enkf_main_set_pre_clear_runpath(enkf_main, bool)") -cfunc.get_ensemble_size = cwrapper.prototype("int enkf_main_get_ensemble_size(enkf_main)"), -cfunc.iget_keep_runpath = cwrapper.prototype("int enkf_main_iget_keep_runpath(enkf_main, int)"), -cfunc.iset_keep_runpath = cwrapper.prototype("void enkf_main_iset_keep_runpath(enkf_main, int, keep_runpath)") +cfunc.iget_keep_runpath = cwrapper.prototype("int enkf_main_iget_keep_runpath(enkf_main, int)") +cfunc.iset_keep_runpath = cwrapper.prototype("void enkf_main_iset_keep_runpath(enkf_main, int, int_vector)") cfunc.get_templates = cwrapper.prototype("c_void_p enkf_main_get_templates(enkf_main)") cfunc.get_site_config_file = cwrapper.prototype("char* enkf_main_get_site_config_file(enkf_main)") -cfunc.initialize_from_scratch = cwrapper.prototype("int enkf_main_initialize_from_scratch(enkf_main, stringlist, int, int)") -cfunc.get_ensemble_size = cwrapper.prototype("int enkf_main_get_ensemble_size(enkf_main)") +cfunc.initialize_from_scratch = cwrapper.prototype("void enkf_main_initialize_from_scratch(enkf_main, stringlist, int, int, bool)") cfunc.get_fs = cwrapper.prototype("c_void_p enkf_main_get_fs(enkf_main)") cfunc.get_history_length = cwrapper.prototype("int enkf_main_get_history_length(enkf_main)") cfunc.initialize_from_existing__ = cwrapper.prototype("void enkf_main_initialize_from_existing__(enkf_main, char*, int, int, bool_vector, char*, stringlist)") cfunc.copy_ensemble = cwrapper.prototype("void enkf_main_copy_ensemble(enkf_main, char*, int, int, char*, int, int, bool_vector, char*, stringlist)") +cfunc.get_observations = cwrapper.prototype("void enkf_main_get_observations(enkf_main, char*, int, long*, double*, double*)") +cfunc.get_observation_count = cwrapper.prototype("int enkf_main_get_observation_count(enkf_main, char*)") +cfunc.get_alt_fs = cwrapper.prototype("c_void_p enkf_main_get_alt_fs(enkf_main , char* , bool , bool)") +cfunc.is_initialized = cwrapper.prototype("bool enkf_main_is_initialized(enkf_main)") +cfunc.iget_state = cwrapper.prototype("c_void_p enkf_main_iget_state(enkf_main, int)") +cfunc.user_select_fs = cwrapper.prototype("void enkf_main_user_select_fs(enkf_main , char*)") +cfunc.get_logh = cwrapper.prototype("void enkf_main_get_logh( enkf_main )") +cfunc.run_exp = cwrapper.prototype("void enkf_main_run_exp( enkf_main, bool_vector, bool, int, int, int)") +cfunc.run_assimilation = cwrapper.prototype("void enkf_main_run_assimilation( enkf_main, bool_vector, int, int, int)") +cfunc.run_smoother = cwrapper.prototype("void enkf_main_run_smoother(enkf_main, char*, bool)") +cfunc.get_current_fs = cwrapper.prototype("char* enkf_main_get_current_fs(enkf_main)") +cfunc.alloc_caselist = cwrapper.prototype("c_void_p enkf_main_alloc_caselist(enkf_main)") +cfunc.fprintf_config = cwrapper.prototype("void enkf_main_fprintf_config(enkf_main)") +cfunc.create_new_config = cwrapper.prototype("void enkf_main_create_new_config(char* , char*, char* , char* , int)") diff --git a/ThirdParty/Ert/devel/python/python/ert/enkf/enkf_node.py b/ThirdParty/Ert/devel/python/python/ert/enkf/enkf_node.py new file mode 100644 index 0000000000..0b51273fa6 --- /dev/null +++ b/ThirdParty/Ert/devel/python/python/ert/enkf/enkf_node.py @@ -0,0 +1,66 @@ +# Copyright (C) 2012 Statoil ASA, Norway. +# +# The file 'enkf_node.py' 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 +# for more details. + +import ctypes +from ert.cwrap.cwrap import * +from ert.cwrap.cclass import CClass +from ert.util.tvector import * +from enkf_enum import * +from ert.enkf.enkf_fs import EnkfFs +from ert.util.tvector import DoubleVector +import libenkf +class EnkfNode(CClass): + + def __init__(self , c_ptr , parent = None): + if parent: + self.init_cref( c_ptr , parent) + else: + self.init_cobj( c_ptr , cfunc.free ) + + @staticmethod + def alloc(config_node): + node = EnkfNode(c_ptr = cfunc.alloc( config_node ) , parent = config_node) + return node + + def user_get(self, fs, key, report_step, iens, state, value): + return cfunc.user_get(self, fs, key, report_step, iens, state, value) + + def user_get_vector( self , fs , key , iens , state , vector): + return cfunc.user_get_vector( self , fs , key , iens , state, vector) + + def value_ptr(self): + cfunc.value_ptr(self) + + @property + def vector_storage(self): + return cfunc.vector_storage(self) +################################################################## + +cwrapper = CWrapper( libenkf.lib ) +cwrapper.registerType( "enkf_node" , EnkfNode ) + +# 3. Installing the c-functions used to manipulate ecl_kw instances. +# These functions are used when implementing the EclKW class, not +# used outside this scope. +cfunc = CWrapperNameSpace("enkf_node") + + +cfunc.free = cwrapper.prototype("void enkf_node_free( enkf_node )") +cfunc.alloc = cwrapper.prototype("c_void_p enkf_node_alloc( enkf_node)") +cfunc.user_get = cwrapper.prototype("bool enkf_node_user_get_no_id(enkf_node , enkf_fs , char* , int, int , c_uint, double*)") +cfunc.user_get_vector = cwrapper.prototype("bool enkf_node_user_get_vector( enkf_node , enkf_fs , char*, int, c_uint, double_vector)") +cfunc.value_ptr = cwrapper.prototype("void enkf_node_value_ptr(enkf_node)") +cfunc.vector_storage = cwrapper.prototype("bool enkf_node_vector_storage(enkf_node)") diff --git a/ThirdParty/Ert/devel/python/python/ert/enkf/enkf_obs.py b/ThirdParty/Ert/devel/python/python/ert/enkf/enkf_obs.py index 2706af6419..0ebf92ff64 100644 --- a/ThirdParty/Ert/devel/python/python/ert/enkf/enkf_obs.py +++ b/ThirdParty/Ert/devel/python/python/ert/enkf/enkf_obs.py @@ -20,22 +20,31 @@ from ert.cwrap.cclass import CClass from ert.util.tvector import * from enkf_enum import * import libenkf +from ert.util.stringlist import StringList +from ert.enkf.obs_vector import ObsVector + class EnkfObs(CClass): - def __init__(self , c_ptr = None): - self.owner = False - self.c_ptr = c_ptr - - - def __del__(self): - if self.owner: - cfunc.free( self ) + def __init__(self , c_ptr , parent = None): + if parent: + self.init_cref( c_ptr , parent) + else: + self.init_cobj( c_ptr , cfunc.free ) + + @property + def get_config_file(self): + return cfunc.get_config_file(self) + def alloc_typed_keylist(self, type): + return StringList(c_ptr = cfunc.alloc_typed_keylist(self, type), parent = self) - def has_key(self , key): - return cfunc.has_key( self ,key ) - + @property + def has_key(self, key): + return cfunc.has_key(self, key) + @property + def get_vector(self, key): + return ObsVector(cfunc.get_vector(self,key), parent = self) ################################################################## @@ -50,3 +59,6 @@ cfunc = CWrapperNameSpace("enkf_obs") cfunc.free = cwrapper.prototype("void enkf_obs_free( enkf_obs )") cfunc.get_config_file = cwrapper.prototype("char* enkf_obs_get_config_file( enkf_obs )") +cfunc.alloc_typed_keylist = cwrapper.prototype("c_void_p enkf_obs_alloc_typed_keylist(enkf_obs, int)") +cfunc.has_key = cwrapper.prototype("bool enkf_obs_has_key(enkf_obs, char*)") +cfunc.get_vector = cwrapper.prototype("c_void_p enkf_obs_get_vector(enkf_obs, char*)") diff --git a/ThirdParty/Ert/devel/python/python/ert/enkf/enkf_state.py b/ThirdParty/Ert/devel/python/python/ert/enkf/enkf_state.py new file mode 100644 index 0000000000..0522ca7cf7 --- /dev/null +++ b/ThirdParty/Ert/devel/python/python/ert/enkf/enkf_state.py @@ -0,0 +1,64 @@ +# Copyright (C) 2012 Statoil ASA, Norway. +# +# The file 'enkf_state.py' 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 +# for more details. + +import ctypes +from ert.cwrap.cwrap import * +from ert.cwrap.cclass import CClass +from ert.util.tvector import * +from enkf_enum import * +import libenkf +from ert.util.ctime import ctime +#from ert.util.ctime import time_t +class EnKFState(CClass): + + def __init__(self , c_ptr , parent = None): + if parent: + self.init_cref( c_ptr , parent) + else: + self.init_cobj( c_ptr , cfunc.free ) + + def kill_simulation(self): + cfunc.kill_simulation(self) + + def resubmit_simulation(self, sim_number): + cfunc.resubmit_simulation(self, sim_number) + + @property + def get_run_status(self): + return cfunc.get_run_status(self) + + @property + def get_start_time(self): + return cfunc.get_start_time(self) + + @property + def get_submit_time(self): + return cfunc.get_submit_time(self) +################################################################## + +cwrapper = CWrapper( libenkf.lib ) +cwrapper.registerType( "enkf_state" , EnKFState ) + +cfunc = CWrapperNameSpace("enkf_state") + +################################################################## +################################################################## +cfunc.free = cwrapper.prototype("void enkf_state_free( enkf_state )") +cfunc.kill_simulation = cwrapper.prototype("void enkf_state_kill_simulation(enkf_state)") +cfunc.resubmit_simulation = cwrapper.prototype("void enkf_state_resubmit_simulation(enkf_state, int)") +cfunc.get_run_status = cwrapper.prototype("int enkf_state_get_run_status(enkf_state)") +cfunc.get_start_time = cwrapper.prototype("int enkf_state_get_start_time(enkf_state)") +cfunc.get_submit_time = cwrapper.prototype("int enkf_state_get_submit_time(enkf_state)") diff --git a/ThirdParty/Ert/devel/python/python/ert/enkf/ens_config.py b/ThirdParty/Ert/devel/python/python/ert/enkf/ens_config.py index 49860688ba..b5a689a9cc 100644 --- a/ThirdParty/Ert/devel/python/python/ert/enkf/ens_config.py +++ b/ThirdParty/Ert/devel/python/python/ert/enkf/ens_config.py @@ -18,42 +18,64 @@ import ctypes from ert.cwrap.cwrap import * from ert.cwrap.cclass import CClass from ert.util.tvector import * -from enkf_enum import * -import libenkf +from ert.enkf.enkf_enum import * +import ert.enkf.libenkf +from ert.ecl.ecl_grid import EclGrid +from ert.enkf.enkf_config_node import EnkfConfigNode +from ert.util.stringlist import StringList + class EnsConfig(CClass): - def __init__(self , c_ptr = None): - self.owner = False - self.c_ptr = c_ptr + def __init__(self , c_ptr , parent = None): + if parent: + self.init_cref( c_ptr , parent) + else: + self.init_cobj( c_ptr , cfunc.free ) - - def __del__(self): - if self.owner: - cfunc.free( self ) - - def has_key(self , key): return cfunc.has_key( self ,key ) + def get_node(self, key): + node = EnkfConfigNode( cfunc.get_node(self, key), parent = self) + return node + + @property + def alloc_keylist(self): + key_list = StringList( c_ptr = cfunc.alloc_keylist(self), parent = self) + return key_list + + def add_summary(self, key): + node = EnkfConfigNode( cfunc.add_summary(self, key, 2), parent = self) + return node + def add_gen_kw(self, key): + node = EnkfConfigNode( cfunc.add_gen_kw(self, key), parent = self) + return node + + def add_gen_data(self, key): + node = EnkfConfigNode( cfunc.add_gen_data(self, key), parent = self) + return node + + def add_field(self, key, eclipse_grid): + node = EnkfConfigNode( cfunc.add_field(self, key, eclipse_grid), parent = self) + return node + + def alloc_keylist_from_var_type(self, var_mask): + return StringList(c_ptr = cfunc.alloc_keylist_from_var_type(self,var_mask), parent = self) ################################################################## cwrapper = CWrapper( libenkf.lib ) cwrapper.registerType( "ens_config" , EnsConfig ) -# 3. Installing the c-functions used to manipulate ecl_kw instances. -# These functions are used when implementing the EclKW class, not -# used outside this scope. cfunc = CWrapperNameSpace("ens_config") - -cfunc.free = cwrapper.prototype("void ensemble_config_free( ens_config )") -cfunc.has_key = cwrapper.prototype("bool ensemble_config_has_key( ens_config , char* )") -cfunc.get_node = cwrapper.prototype("c_void_p ensemble_config_get_node( ens_config , char*)") -cfunc.alloc_keylist = cwrapper.prototype("c_void_p ensemble_config_alloc_keylist( ens_config )") -cfunc.add_summary = cwrapper.prototype("c_void_p ensemble_config_add_summary( ens_config, char*)") -cfunc.add_gen_kw = cwrapper.prototype("c_void_p ensemble_config_add_gen_kw( ens_config, char*)") -cfunc.add_gen_data = cwrapper.prototype("c_void_p ensemble_config_add_gen_data( ens_config, char*)") -cfunc.add_field = cwrapper.prototype("c_void_p ensemble_config_add_field( ens_config, char*, ecl_grid)") +cfunc.free = cwrapper.prototype("void ensemble_config_free( ens_config )") +cfunc.has_key = cwrapper.prototype("bool ensemble_config_has_key( ens_config , char* )") +cfunc.get_node = cwrapper.prototype("c_void_p ensemble_config_get_node( ens_config , char*)") +cfunc.alloc_keylist = cwrapper.prototype("c_void_p ensemble_config_alloc_keylist( ens_config )") +cfunc.add_summary = cwrapper.prototype("c_void_p ensemble_config_add_summary( ens_config, char*, int)") +cfunc.add_gen_kw = cwrapper.prototype("c_void_p ensemble_config_add_gen_kw( ens_config, char*)") +cfunc.add_gen_data = cwrapper.prototype("c_void_p ensemble_config_add_gen_data( ens_config, char*)") +cfunc.add_field = cwrapper.prototype("c_void_p ensemble_config_add_field( ens_config, char*, ecl_grid)") cfunc.alloc_keylist_from_var_type = cwrapper.prototype("c_void_p ensemble_config_alloc_keylist_from_var_type(ens_config, int)") diff --git a/ThirdParty/Ert/devel/python/python/ert/enkf/ert_template.py b/ThirdParty/Ert/devel/python/python/ert/enkf/ert_template.py index dbb1ee5bd9..59d763a6ad 100644 --- a/ThirdParty/Ert/devel/python/python/ert/enkf/ert_template.py +++ b/ThirdParty/Ert/devel/python/python/ert/enkf/ert_template.py @@ -22,37 +22,32 @@ from enkf_enum import * import libenkf class ErtTemplate(CClass): - def __init__(self , c_ptr = None): - self.owner = False - self.c_ptr = c_ptr - - - def __del__(self): - if self.owner: - cfunc.free( self ) - - - def has_key(self , key): - return cfunc.has_key( self ,key ) + def __init__(self , c_ptr , parent = None): + if parent: + self.init_cref( c_ptr , parent) + else: + self.init_cobj( c_ptr , cfunc.free ) + @property + def get_template_file(self): + return cfunc.get_template_file(self) + @property + def get_target_file(self): + return cfunc.get_target_file(self) + @property + def get_args_as_string(self): + return cfunc.get_args_as_string(self) ################################################################## cwrapper = CWrapper( libenkf.lib ) -cwrapper.registerType( "ert_template" , AnalysisConfig ) +cwrapper.registerType( "ert_template" , ErtTemplate ) -# 3. Installing the c-functions used to manipulate ecl_kw instances. -# These functions are used when implementing the EclKW class, not -# used outside this scope. cfunc = CWrapperNameSpace("ert_template") - - +################################################################## +################################################################## cfunc.free = cwrapper.prototype("void ert_template_free( ert_template )") -cfunc.alloc_list = cwrapper.prototype("c_void_p ert_templates_alloc_list(long)"), -cfunc.get_template = cwrapper.prototype("c_void_p ert_templates_get_template(long, char*)"), -cfunc.get_template_file = cwrapper.prototype("char* ert_template_get_template_file(long)"), -cfunc.get_target_file = cwrapper.prototype("char* ert_template_get_target_file(long)"), -cfunc.get_args_as_string = cwrapper.prototype("char* ert_template_get_args_as_string(long)"), -cfunc.clear = cwrapper.prototype("void ert_templates_clear(long)"), -cfunc.add_template = cwrapper.prototype("void ert_templates_add_template(long, char*, char*, char*, char*)"),] +cfunc.get_template_file = cwrapper.prototype("char* ert_template_get_template_file(ert_template)") +cfunc.get_target_file = cwrapper.prototype("char* ert_template_get_target_file(ert_template)") +cfunc.get_args_as_string = cwrapper.prototype("char* ert_template_get_args_as_string(ert_template)") diff --git a/ThirdParty/Ert/devel/python/python/ert/enkf/ert_templates.py b/ThirdParty/Ert/devel/python/python/ert/enkf/ert_templates.py new file mode 100644 index 0000000000..fe7170c6f6 --- /dev/null +++ b/ThirdParty/Ert/devel/python/python/ert/enkf/ert_templates.py @@ -0,0 +1,62 @@ +# Copyright (C) 2012 Statoil ASA, Norway. +# +# The file 'ert_templates.py' 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 +# for more details. + +import ctypes +from ert.cwrap.cwrap import * +from ert.cwrap.cclass import CClass +from ert.util.tvector import * +from enkf_enum import * +import libenkf +from ert.util.stringlist import StringList +from ert.enkf.ert_template import ErtTemplate +class ErtTemplates(CClass): + + def __init__(self , c_ptr , parent = None): + if parent: + self.init_cref( c_ptr , parent) + else: + self.init_cobj( c_ptr , cfunc.free ) + + @property + def alloc_list(self): + return StringList(c_ptr = cfunc.alloc_list(self), parent = self) + + def clear(self): + cfunc.clear(self) + + def get_template(self,key): + template = ErtTemplate( cfunc.get_template( self, key ), parent = self) + return template + + @property + def add_template(self, key, template_file, target_file, arg_string): + return ErtTemplate(cfunc.add_template(self, key, template_file, target_file, arg_string), parent = self) + + + +################################################################## + +cwrapper = CWrapper( libenkf.lib ) +cwrapper.registerType( "ert_templates" , ErtTemplates ) + +cfunc = CWrapperNameSpace("ert_templates") +################################################################## +################################################################## +cfunc.free = cwrapper.prototype("void ert_templates_free( ert_templates )") +cfunc.alloc_list = cwrapper.prototype("c_void_p ert_templates_alloc_list(ert_templates)") +cfunc.get_template = cwrapper.prototype("c_void_p ert_templates_get_template(ert_templates, char*)") +cfunc.clear = cwrapper.prototype("void ert_templates_clear(ert_templates)") +cfunc.add_template = cwrapper.prototype("void ert_templates_add_template(ert_templates, char*, char*, char*, char*)") diff --git a/ThirdParty/Ert/devel/python/python/ert/enkf/field.py b/ThirdParty/Ert/devel/python/python/ert/enkf/field.py new file mode 100644 index 0000000000..679f114ebf --- /dev/null +++ b/ThirdParty/Ert/devel/python/python/ert/enkf/field.py @@ -0,0 +1,48 @@ +# Copyright (C) 2012 Statoil ASA, Norway. +# +# The file 'field.py' 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 +# for more details. + +import ctypes +from ert.cwrap.cwrap import * +from ert.cwrap.cclass import CClass +from ert.util.tvector import * +from enkf_enum import * +import libenkf +class FieldObs(CClass): + + def __init__(self , c_ptr , parent = None): + if parent: + self.init_cref( c_ptr , parent) + else: + self.init_cobj( c_ptr , cfunc.free ) + + def ijk_get_double(self , i,j,k): + return cfunc.ijk_get_double( self ,i,j,k ) + + + +################################################################## + +cwrapper = CWrapper( libenkf.lib ) +cwrapper.registerType( "field" , FieldObs ) + +# 3. Installing the c-functions used to manipulate ecl_kw instances. +# These functions are used when implementing the EclKW class, not +# used outside this scope. +cfunc = CWrapperNameSpace("field") + + +cfunc.free = cwrapper.prototype("void field_free( field )") +cfunc.ijk_get_double = cwrapper.prototype("double field_ijk_get_double(field, int, int, int)") diff --git a/ThirdParty/Ert/devel/python/python/ert/enkf/field_config.py b/ThirdParty/Ert/devel/python/python/ert/enkf/field_config.py index 3ff7b3a1f5..6f333cc876 100644 --- a/ThirdParty/Ert/devel/python/python/ert/enkf/field_config.py +++ b/ThirdParty/Ert/devel/python/python/ert/enkf/field_config.py @@ -20,34 +20,59 @@ from ert.cwrap.cclass import CClass from ert.util.tvector import * from enkf_enum import * import libenkf -class GenDataConfig(CClass): +class FieldConfig(CClass): - def __init__(self , c_ptr = None): - self.owner = False - self.c_ptr = c_ptr - - - def __del__(self): - if self.owner: - cfunc.free( self ) + def __init__(self , c_ptr , parent = None): + if parent: + self.init_cref( c_ptr , parent) + else: + self.init_cobj( c_ptr , cfunc.free ) + + @property + def get_type(self): + return cfunc.get_type(self) + @property + def get_truncation_mode(self): + return cfunc.get_truncation_mode(self) - def has_key(self , key): - return cfunc.has_key( self ,key ) + @property + def get_truncation_min(self): + return cfunc.get_truncation_min(self) + @property + def get_init_transform_name(self): + return cfunc.get_init_transform_name(self) + @property + def get_output_transform_name(self): + return cfunc.get_output_transform_name(self) + @property + def get_truncation_max(self): + return cfunc.get_truncation_max(self) + + @property + def get_nx(self): + return cfunc.get_nx(self) + + @property + def get_ny(self): + return cfunc.get_ny(self) + + @property + def get_nz(self): + return cfunc.get_ny(self) + + def ijk_active(self, i,j,k): + return cfunc.ijk_active(self,i,j,k) ################################################################## - cwrapper = CWrapper( libenkf.lib ) -cwrapper.registerType( "field_config" , GenDataConfig ) +cwrapper.registerType( "field_config" , FieldConfig ) -# 3. Installing the c-functions used to manipulate ecl_kw instances. -# These functions are used when implementing the EclKW class, not -# used outside this scope. cfunc = CWrapperNameSpace("field_config") - - +################################################################## +################################################################## cfunc.free = cwrapper.prototype("void field_config_free( field_config )") cfunc.get_type = cwrapper.prototype("int field_config_get_type(field_config)") cfunc.get_truncation_mode = cwrapper.prototype("int field_config_get_truncation_mode(field_config)") @@ -55,4 +80,8 @@ cfunc.get_truncation_min = cwrapper.prototype("double field_config_get_tr cfunc.get_truncation_max = cwrapper.prototype("double field_config_get_truncation_max(field_config)") cfunc.get_init_transform_name = cwrapper.prototype("char* field_config_get_init_transform_name(field_config)") cfunc.get_output_transform_name = cwrapper.prototype("char* field_config_get_output_transform_name(field_config)") -cfunc.get_init_file_fmt = cwrapper.prototype("char* field_config_get_init_file_fmt(field_config)") +cfunc.ijk_active = cwrapper.prototype("bool field_config_ijk_active(field_config, int, int, int)") +cfunc.get_nx = cwrapper.prototype("int field_config_get_nx(field_config)") +cfunc.get_ny = cwrapper.prototype("int field_config_get_ny(field_config)") +cfunc.get_nz = cwrapper.prototype("int field_config_get_nz(field_config)") +cfunc.get_grid = cwrapper.prototype("c_void_p field_config_get_grid(field_config)") diff --git a/ThirdParty/Ert/devel/python/python/ert/enkf/gen_data_config.py b/ThirdParty/Ert/devel/python/python/ert/enkf/gen_data_config.py index b5f9f4dd07..39144f0580 100644 --- a/ThirdParty/Ert/devel/python/python/ert/enkf/gen_data_config.py +++ b/ThirdParty/Ert/devel/python/python/ert/enkf/gen_data_config.py @@ -20,20 +20,34 @@ from ert.cwrap.cclass import CClass from ert.util.tvector import * from enkf_enum import * import libenkf + class GenDataConfig(CClass): - def __init__(self , c_ptr = None): - self.owner = False - self.c_ptr = c_ptr - - - def __del__(self): - if self.owner: - cfunc.free( self ) + def __init__(self , c_ptr , parent = None): + if parent: + self.init_cref( c_ptr , parent) + else: + self.init_cobj( c_ptr , cfunc.free ) + + @property + def get_template_file(self): + return cfunc.get_template_file(self) + @property + def get_template_key(self): + return cfunc.get_template_key(self) - def has_key(self , key): - return cfunc.has_key( self ,key ) + @property + def get_initial_size(self): + return cfunc.get_initial_size(self) + + @property + def get_output_format(self): + return cfunc.get_output_format(self) + + @property + def get_input_format(self): + return cfunc.get_input_format(self) @@ -53,4 +67,5 @@ cfunc.get_output_format = cwrapper.prototype("c_void_p gen_data_config_get_ cfunc.get_input_format = cwrapper.prototype("c_void_p gen_data_config_get_input_format(gen_data_config)") cfunc.get_template_file = cwrapper.prototype("char* gen_data_config_get_template_file(gen_data_config)") cfunc.get_template_key = cwrapper.prototype("char* gen_data_config_get_template_key(gen_data_config)") -cfunc.get_init_file_fmt = cwrapper.prototype("char* gen_data_config_get_init_file_fmt(gen_data_config)") +cfunc.get_initial_size = cwrapper.prototype("int gen_data_config_get_initial_size(gen_data_config)") + diff --git a/ThirdParty/Ert/devel/python/python/ert/enkf/gen_kw_config.py b/ThirdParty/Ert/devel/python/python/ert/enkf/gen_kw_config.py index 66cdf2795b..afe9def000 100644 --- a/ThirdParty/Ert/devel/python/python/ert/enkf/gen_kw_config.py +++ b/ThirdParty/Ert/devel/python/python/ert/enkf/gen_kw_config.py @@ -18,37 +18,38 @@ import ctypes from ert.cwrap.cwrap import * from ert.cwrap.cclass import CClass from ert.util.tvector import * -from enkf_enum import * -import libenkf +from ert.enkf.enkf_enum import * +import ert.enkf.libenkf +from ert.util.stringlist import StringList class GenKwConfig(CClass): - def __init__(self , c_ptr = None): - self.owner = False - self.c_ptr = c_ptr - - - def __del__(self): - if self.owner: - cfunc.free( self ) + def __init__(self , c_ptr , parent = None): + if parent: + self.init_cref( c_ptr , parent) + else: + self.init_cobj( c_ptr , cfunc.free ) + @property + def get_template_file(self): + return cfunc.get_template_file(self) - def has_key(self , key): - return cfunc.has_key( self ,key ) - + @property + def get_parameter_file(self): + return cfunc.get_parameter_file(self) + @property + def alloc_name_list(self): + return StringList(c_ptr = cfunc.alloc_name_list(self), parent = self) ################################################################## cwrapper = CWrapper( libenkf.lib ) cwrapper.registerType( "gen_kw_config" , GenKwConfig ) -# 3. Installing the c-functions used to manipulate ecl_kw instances. -# These functions are used when implementing the EclKW class, not -# used outside this scope. cfunc = CWrapperNameSpace("gen_kw_config") - - +################################################################## +################################################################## cfunc.free = cwrapper.prototype("void gen_kw_config_free( gen_kw_config )") cfunc.get_template_file = cwrapper.prototype("char* gen_kw_config_get_template_file(gen_kw_config)") -cfunc.get_init_file_fmt = cwrapper.prototype("char* gen_kw_config_get_init_file_fmt(gen_kw_config)") cfunc.get_parameter_file = cwrapper.prototype("char* gen_kw_config_get_parameter_file(gen_kw_config)") +cfunc.alloc_name_list = cwrapper.prototype("c_void_p gen_kw_config_alloc_name_list(gen_kw_config)") diff --git a/ThirdParty/Ert/devel/python/python/ert/enkf/local_config.py b/ThirdParty/Ert/devel/python/python/ert/enkf/local_config.py index 3b28a60050..682c03823c 100644 --- a/ThirdParty/Ert/devel/python/python/ert/enkf/local_config.py +++ b/ThirdParty/Ert/devel/python/python/ert/enkf/local_config.py @@ -20,33 +20,34 @@ from ert.cwrap.cclass import CClass from ert.util.tvector import * from enkf_enum import * import libenkf +from ert.util.stringlist import StringList class LocalConfig(CClass): - def __init__(self , c_ptr = None): - self.owner = False - self.c_ptr = c_ptr - - - def __del__(self): - if self.owner: - cfunc.free( self ) - - - def has_key(self , key): - return cfunc.has_key( self ,key ) - + def __init__(self , c_ptr , parent = None): + if parent: + self.init_cref( c_ptr , parent) + else: + self.init_cobj( c_ptr , cfunc.free ) + + @property + def get_config_files(self): + config_files = StringList(c_ptr = cfunc.get_config_files(self), parent = self) + return config_files + def clear_config_files(self): + cfunc.clear_config_files(self) + def add_config_file(self, file): + cfunc.add_config_file(self, file) ################################################################## cwrapper = CWrapper( libenkf.lib ) cwrapper.registerType( "local_config" , LocalConfig ) -# 3. Installing the c-functions used to manipulate ecl_kw instances. -# These functions are used when implementing the EclKW class, not -# used outside this scope. cfunc = CWrapperNameSpace("local_config") +################################################################## +################################################################## cfunc.free = cwrapper.prototype("void local_config_free( local_config )") cfunc.get_config_files = cwrapper.prototype("c_void_p local_config_get_config_files( local_config )") diff --git a/ThirdParty/Ert/devel/python/python/ert/enkf/model_config.py b/ThirdParty/Ert/devel/python/python/ert/enkf/model_config.py index ffb6fd8a11..1f5aea0808 100644 --- a/ThirdParty/Ert/devel/python/python/ert/enkf/model_config.py +++ b/ThirdParty/Ert/devel/python/python/ert/enkf/model_config.py @@ -15,48 +15,81 @@ # for more details. import ctypes -from ert.cwrap.cwrap import * -from ert.cwrap.cclass import CClass -from ert.util.tvector import * -from enkf_enum import * -import libenkf +from ert.cwrap.cwrap import * +from ert.cwrap.cclass import CClass +from ert.util.tvector import * +from enkf_enum import * +from ert.job_queue.forward_model import ForwardModel +from libenkf import * +from ert.sched.libsched import * +from ert.sched.history import HistoryType +from ert.sched.sched_file import * +from ert.ecl.ecl_sum import * +from ert.sched.history import * class ModelConfig(CClass): - def __init__(self , c_ptr = None): - self.owner = False - self.c_ptr = c_ptr + def __init__(self , c_ptr , parent = None): + if parent: + self.init_cref( c_ptr , parent) + else: + self.init_cobj( c_ptr , cfunc.free ) + + @property + def get_enkf_sched_file(self): + return cfunc.get_enkf_sched_file( self ) + + def set_enkf_sched_file(self, file): + cfunc.get_enkf_sched_file( self , file) + + @property + def get_history_source(self): + return HistoryType(c_ptr = cfunc.get_history_source( self ) , parent = self) + + def set_history_source(self, history_source, sched_file, refcase): + return cfunc.select_history(self, history_source, sched_file, refcase) - - def __del__(self): - if self.owner: - cfunc.free( self ) + @property + def get_max_internal_submit(self): + return cfunc.get_max_internal_submit( self ) - def has_key(self , key): - return cfunc.has_key( self ,key ) + def set_max_internal_submit(self, max): + cfunc.get_max_internal_submit( self , max) + @property + def get_forward_model(self): + ford_model = ForwardModel( c_ptr = cfunc.get_forward_model( self ), parent = self) + return ford_model + @property + def get_case_table_file(self): + return cfunc.get_case_table_file(self) + @property + def get_runpath_as_char(self): + return cfunc.get_runpath_as_char(self) + + def select_runpath(self, path_key): + return cfunc.select_runpath(self, path_key) ################################################################## cwrapper = CWrapper( libenkf.lib ) cwrapper.registerType( "model_config" , ModelConfig ) -# 3. Installing the c-functions used to manipulate ecl_kw instances. -# These functions are used when implementing the EclKW class, not -# used outside this scope. cfunc = CWrapperNameSpace("model_config") +################################################################## +################################################################## -cfunc.free = cwrapper.prototype("void model_config_free( model_config )") -cfunc.get_enkf_sched_file = cwrapper.prototype("char* model_config_get_enkf_sched_file( model_config )") -cfunc.set_enkf_sched_file = cwrapper.prototype("void model_config_set_enkf_sched_file( model_config, char*)") -cfunc.get_history_source = cwrapper.prototype("int model_config_get_history_source(model_config)") -cfunc.set_history_source = cwrapper.prototype("void model_config_set_history_source(model_config, int)") -cfunc.get_forward_model = cwrapper.prototype("c_void_p model_config_get_forward_model(model_config)") -cfunc.get_max_resample = cwrapper.prototype("int model_config_get_max_resample(model_config)") -cfunc.set_max_resample = cwrapper.prototype("void model_config_set_max_resample(model_config, int)") -cfunc.get_case_table_file = cwrapper.prototype("char* model_config_get_case_table_file(model_config)") -cfunc.get_runpath_as_char = cwrapper.prototype("char* model_config_get_runpath_as_char(model_config)") -cfunc.set_runpath_fmt = cwrapper.prototype("void model_config_set_runpath_fmt(model_config, char*)") +cfunc.free = cwrapper.prototype("void model_config_free( model_config )") +cfunc.get_enkf_sched_file = cwrapper.prototype("char* model_config_get_enkf_sched_file( model_config )") +cfunc.set_enkf_sched_file = cwrapper.prototype("void model_config_set_enkf_sched_file( model_config, char*)") +cfunc.get_history_source = cwrapper.prototype("c_void_p model_config_get_history_source(model_config)") +cfunc.select_history = cwrapper.prototype("bool model_config_select_history(model_config, history_type, c_void_p, ecl_sum)") +cfunc.get_forward_model = cwrapper.prototype("c_void_p model_config_get_forward_model(model_config)") +cfunc.get_max_internal_submit = cwrapper.prototype("int model_config_get_max_internal_submit(model_config)") +cfunc.set_max_internal_submit = cwrapper.prototype("void model_config_set_max_internal_submit(model_config, int)") +cfunc.get_case_table_file = cwrapper.prototype("char* model_config_get_case_table_file(model_config)") +cfunc.get_runpath_as_char = cwrapper.prototype("char* model_config_get_runpath_as_char(model_config)") +cfunc.select_runpath = cwrapper.prototype("void model_config_select_runpath(model_config, char*)") diff --git a/ThirdParty/Ert/devel/python/python/ert/enkf/obs_vector.py b/ThirdParty/Ert/devel/python/python/ert/enkf/obs_vector.py new file mode 100644 index 0000000000..4bed9d61ac --- /dev/null +++ b/ThirdParty/Ert/devel/python/python/ert/enkf/obs_vector.py @@ -0,0 +1,60 @@ +# Copyright (C) 2012 Statoil ASA, Norway. +# +# The file 'obs_vector.py' 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 +# for more details. + +import ctypes +from ert.cwrap.cwrap import * +from ert.cwrap.cclass import CClass +from ert.util.tvector import * +from enkf_enum import * +import libenkf +class ObsVector(CClass): + + def __init__(self , c_ptr , parent = None): + if parent: + self.init_cref( c_ptr , parent) + else: + self.init_cobj( c_ptr , cfunc.free ) + + @property + def get_state_kw(self): + return cfunc.get_state_kw(self) + + def iget_node(self, index): + cfunc.iget_node(self,index) + + @property + def get_num_active(self): + return cfunc.get_num_active(self) + + @property + def iget_active(self, index): + return cfunc.iget_active(self, index) +################################################################## + +cwrapper = CWrapper( libenkf.lib ) +cwrapper.registerType( "obs_vector" , ObsVector ) + +# 3. Installing the c-functions used to manipulate ecl_kw instances. +# These functions are used when implementing the EclKW class, not +# used outside this scope. +cfunc = CWrapperNameSpace("obs_vector") + + +cfunc.free = cwrapper.prototype("void obs_vector_free( obs_vector )") +cfunc.get_state_kw = cwrapper.prototype("char* obs_vector_get_state_kw( obs_vector )") +cfunc.iget_node = cwrapper.prototype("void obs_vector_iget_node( obs_vector, int)") +cfunc.get_num_active = cwrapper.prototype("int obs_vector_get_num_active( obs_vector )") +cfunc.iget_active = cwrapper.prototype("bool obs_vector_iget_active( obs_vector, int)") diff --git a/ThirdParty/Ert/devel/python/python/ert/enkf/plot_config.py b/ThirdParty/Ert/devel/python/python/ert/enkf/plot_config.py index 33ea1c309e..db97918529 100644 --- a/ThirdParty/Ert/devel/python/python/ert/enkf/plot_config.py +++ b/ThirdParty/Ert/devel/python/python/ert/enkf/plot_config.py @@ -19,35 +19,72 @@ from ert.cwrap.cwrap import * from ert.cwrap.cclass import CClass from ert.util.tvector import * from enkf_enum import * -import libenkf +import ert.enkf.libenkf + class PlotConfig(CClass): - def __init__(self , c_ptr = None): - self.owner = False - self.c_ptr = c_ptr + def __init__(self , c_ptr , parent = None): + if parent: + self.init_cref( c_ptr , parent) + else: + self.init_cobj( c_ptr , cfunc.free ) + + @property + def get_path(self): + return cfunc.get_path(self) + + def set_path(self, path): + cfunc.set_path(self, path) + @property + def get_driver(self): + return cfunc.get_driver(self) + + def set_driver(self, driver): + cfunc.set_driver(self, driver) - def __del__(self): - if self.owner: - cfunc.free( self ) - - - def has_key(self , key): - return cfunc.has_key( self ,key ) - - - + @property + def get_errorbar_max(self): + return cfunc.get_errorbar_max(self) + + def set_errorbar_max(self, max): + cfunc.set_errorbar_max(self, max) + + @property + def get_width(self): + return cfunc.get_width(self) + + def set_width(self, value): + cfunc.set_width(self, value) + + @property + def get_height(self): + return cfunc.get_height(self) + + def set_height(self, value): + cfunc.set_height(self, value) + + @property + def get_viewer(self): + return cfunc.get_viewer(self) + + def set_viewer(self, value): + cfunc.set_viewer(self, value) + + @property + def get_image_type(self): + return cfunc.get_image_type(self) + + def set_image_type(self, value): + cfunc.set_image_type(self, value) ################################################################## cwrapper = CWrapper( libenkf.lib ) cwrapper.registerType( "plot_config" , PlotConfig ) -# 3. Installing the c-functions used to manipulate ecl_kw instances. -# These functions are used when implementing the EclKW class, not -# used outside this scope. cfunc = CWrapperNameSpace("plot_config") - - +################################################################## +################################################################## cfunc.free = cwrapper.prototype("void plot_config_free( plot_config )") cfunc.get_path = cwrapper.prototype("char* plot_config_get_path(plot_config)") cfunc.set_path = cwrapper.prototype("void plot_config_set_path(plot_config, char*)") @@ -63,3 +100,4 @@ cfunc.get_viewer = cwrapper.prototype("char* plot_config_get_viewer(plo cfunc.set_viewer = cwrapper.prototype("void plot_config_set_viewer(plot_config, char*)") cfunc.get_image_type = cwrapper.prototype("char* plot_config_get_image_type(plot_config)") cfunc.set_image_type = cwrapper.prototype("void plot_config_set_image_type(plot_config, char*)") + diff --git a/ThirdParty/Ert/devel/python/python/ert/enkf/site_config.py b/ThirdParty/Ert/devel/python/python/ert/enkf/site_config.py index a91da3a5b9..6fd69b037c 100644 --- a/ThirdParty/Ert/devel/python/python/ert/enkf/site_config.py +++ b/ThirdParty/Ert/devel/python/python/ert/enkf/site_config.py @@ -15,38 +15,153 @@ # for more details. import ctypes -from ert.cwrap.cwrap import * -from ert.cwrap.cclass import CClass -from ert.util.tvector import * -from enkf_enum import * +from ert.cwrap.cwrap import * +from ert.cwrap.cclass import CClass +from ert.util.tvector import * +from enkf_enum import * import libenkf +from ert.enkf.libenkf import * +from ert.job_queue.ext_joblist import ExtJoblist +from ert.job_queue.job_queue import JobQueue +from ert.util.stringlist import StringList + + + + class SiteConfig(CClass): - def __init__(self , c_ptr = None): - self.owner = False - self.c_ptr = c_ptr + def __init__(self , c_ptr , parent = None): + if parent: + self.init_cref( c_ptr , parent) + else: + self.init_cobj( c_ptr , cfunc.free ) - - def __del__(self): - if self.owner: - cfunc.free( self ) + @property + def get_queue_name(self): + return cfunc.get_queue_name( self ) - def has_key(self , key): - return cfunc.has_key( self ,key ) + def set_job_queue(self, queue): + cfunc.set_job_queue( self , queue) + @property + def get_lsf_queue(self): + return cfunc.get_lsf_queue( self ) + def set_lsf_queue(self, queue): + cfunc.set_lsf_queue( self , queue) + @property + def get_max_running_lsf(self): + return cfunc.get_max_running_lsf( self ) + + def set_max_running_lsf(self, max_running): + cfunc.set_max_running_lsf( self , max_running) + + @property + def get_lsf_request(self): + return cfunc.get_lsf_request( self ) + + def set_lsf_request(self, lsf_request): + cfunc.set_lsf_request( self , lsf_request) + + def clear_rsh_host_list(self): + cfunc.set_rsh_host_list( self ) + + @property + def get_rsh_command(self): + return cfunc.get_rsh_command( self ) + + def set_rsh_command(self, rsh_command): + cfunc.set_rsh_command( self , rsh_command) + + @property + def get_max_running_rsh(self): + return cfunc.get_max_running_rsh( self ) + + def set_max_running_rsh(self, max_running): + cfunc.set_max_running_rsh( self , max_running) + + @property + def get_max_running_local(self): + return cfunc.get_max_running_local( self ) + + def set_max_running_local(self, max_running): + cfunc.set_max_running_local( self , max_running) + + @property + def get_job_script(self): + return cfunc.get_job_script( self ) + + def set_job_script(self, job_script): + cfunc.set_job_script( self , job_script) + + @property + def get_env_hash(self): + return cfunc.get_env_hash( self ) + + def setenv(self, var, value): + cfunc.setenv( self , var, value) + + def clear_env(self): + cfunc.clear_env( self ) + + @property + def get_path_variables(self): + return StringList(c_ptr = cfunc.get_path_variables( self ), parent = self) + + @property + def get_path_values(self): + return StringList(c_ptr = cfunc.get_path_values( self ), parent = self) + + def clear_pathvar(self): + cfunc.clear_pathvar( self ) + + def update_pathvar(self, pathvar, value): + cfunc.update_pathvar( self ) + + @property + def get_installed_jobs(self): + installed_jobs = ExtJoblist( cfunc.get_installed_jobs( self ), parent = self) + return installed_jobs + + @property + def get_max_submit(self): + return cfunc.get_max_submit( self ) + + def set_max_submit(self, max): + cfunc.set_max_submit( self , max) + + @property + def get_license_root_path(self): + return cfunc.get_license_root_path( self ) + + def set_license_root_pathmax_submit(self, path): + cfunc.set_license_root_path( self , path) + + @property + def queue_is_running(self): + return cfunc.queue_is_running( self ) + + @property + def get_job_queue(self): + return JobQueue( c_ptr = cfunc.get_job_queue(self), parent = self) + + @property + def get_rsh_host_list(self): + return cfunc.get_rsh_host_list(self) + + def add_rsh_host(self, host, max_running): + cfunc.add_rsh_host(self, host, max_running) ################################################################## cwrapper = CWrapper( libenkf.lib ) cwrapper.registerType( "site_config" , SiteConfig ) -# 3. Installing the c-functions used to manipulate ecl_kw instances. -# These functions are used when implementing the EclKW class, not -# used outside this scope. cfunc = CWrapperNameSpace("site_config") +################################################################## +################################################################## cfunc.free = cwrapper.prototype("void site_config_free( site_config )") cfunc.get_queue_name = cwrapper.prototype("char* site_config_get_queue_name(site_config)") @@ -71,14 +186,14 @@ cfunc.get_max_submit = cwrapper.prototype("int site_config_get_max_submit cfunc.set_max_submit = cwrapper.prototype("void site_config_set_max_submit(site_config, int)") cfunc.get_license_root_path = cwrapper.prototype("char* site_config_get_license_root_path(site_config)") cfunc.set_license_root_path = cwrapper.prototype("void site_config_set_license_root_path(site_config, char*)") -cfunc.get_job_script = cwrapper.prototype("char* site_config_get_job_script(site_config)"), +cfunc.get_job_script = cwrapper.prototype("char* site_config_get_job_script(site_config)") cfunc.set_job_script = cwrapper.prototype("void site_config_set_job_script(site_config, char*)") -cfunc.get_env_hash = cwrapper.prototype("c_void_p site_config_get_env_hash(site_config)"), -cfunc.clear_env = cwrapper.prototype("void site_config_clear_env(site_config)"), +cfunc.get_env_hash = cwrapper.prototype("c_void_p site_config_get_env_hash(site_config)") +cfunc.clear_env = cwrapper.prototype("void site_config_clear_env(site_config)") cfunc.setenv = cwrapper.prototype("void site_config_setenv(site_config, char*, char*)") -cfunc.get_path_variables = cwrapper.prototype("c_void_p site_config_get_path_variables(site_config)"), -cfunc.get_path_values = cwrapper.prototype("c_void_p site_config_get_path_values(site_config)"), -cfunc.clear_pathvar = cwrapper.prototype("void site_config_clear_pathvar(site_config)"), +cfunc.get_path_variables = cwrapper.prototype("c_void_p site_config_get_path_variables(site_config)") +cfunc.get_path_values = cwrapper.prototype("c_void_p site_config_get_path_values(site_config)") +cfunc.clear_pathvar = cwrapper.prototype("void site_config_clear_pathvar(site_config)") cfunc.update_pathvar = cwrapper.prototype("void site_config_update_pathvar(site_config, char*, char*)") -cfunc.get_installed_jobs = cwrapper.prototype("c_void_p site_config_get_installed_jobs(site_config)"), -cfunc.get_license_root_path = cwrapper.prototype("char* site_config_get_license_root_path(site_config)") +cfunc.get_job_queue = cwrapper.prototype("c_void_p site_config_get_job_queue(site_config)") +cfunc.queue_is_running = cwrapper.prototype("bool site_config_queue_is_running(site_config)") diff --git a/ThirdParty/Ert/devel/python/python/ert/enkf/time_map.py b/ThirdParty/Ert/devel/python/python/ert/enkf/time_map.py new file mode 100644 index 0000000000..086ca8e6b9 --- /dev/null +++ b/ThirdParty/Ert/devel/python/python/ert/enkf/time_map.py @@ -0,0 +1,53 @@ +# Copyright (C) 2013 Statoil ASA, Norway. +# +# The file 'time_map.py' 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 +# for more details. + +import ctypes +from ert.cwrap.cwrap import * +from ert.cwrap.cclass import CClass +from ert.util.ctime import ctime +from ert.util.tvector import * +from enkf_enum import * +import libenkf +from ert.enkf.libenkf import * +from ert.ert.erttypes import time_t + +class TimeMap(CClass): + + def __init__(self , c_ptr , parent = None): + if parent: + self.init_cref( c_ptr , parent) + else: + self.init_cobj( c_ptr , cfunc.free ) + + @property + def iget_sim_days(self, step): + return cfunc.iget_sim_days(self,step) + + def iget(self,step): + return cfunc.iget(self,step) + +################################################################## +cwrapper = CWrapper( libenkf.lib ) +cwrapper.registerType( "time_map" , TimeMap ) + +cfunc = CWrapperNameSpace("time_map") + +################################################################## +################################################################## + +cfunc.free = cwrapper.prototype("void time_map_free( time_map )") +cfunc.iget_sim_days = cwrapper.prototype("double time_map_iget_sim_days(time_map, int)") +cfunc.iget = cwrapper.prototype("int time_map_iget(time_map, int)") diff --git a/ThirdParty/Ert/devel/python/python/ert/ert/CMakeLists.txt b/ThirdParty/Ert/devel/python/python/ert/ert/CMakeLists.txt new file mode 100644 index 0000000000..290956e8d9 --- /dev/null +++ b/ThirdParty/Ert/devel/python/python/ert/ert/CMakeLists.txt @@ -0,0 +1 @@ +add_python_package( "Python ert.ert" ${PYTHON_INSTALL_PREFIX}/ert/ert "__init__.py;enums.py;erttypes.py;ertwrapper.py;c_enums.py" True) diff --git a/ThirdParty/Ert/devel/python/python/ert/ert/c_enums.py b/ThirdParty/Ert/devel/python/python/ert/ert/c_enums.py new file mode 100644 index 0000000000..1b760d2306 --- /dev/null +++ b/ThirdParty/Ert/devel/python/python/ert/ert/c_enums.py @@ -0,0 +1,79 @@ +# Copyright (C) 2013 Statoil ASA, Norway. +# +# The file 'c_enums.py' 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 +# for more details. +from ctypes import * + +class EnumerationType(type(c_uint)): + def __new__(metacls, name, bases, dict): + if not "_members_" in dict: + _members_ = {} + for key,value in dict.items(): + if not key.startswith("_"): + _members_[key] = value + dict["_members_"] = _members_ + cls = type(c_uint).__new__(metacls, name, bases, dict) + for key,value in cls._members_.items(): + globals()[key] = value + return cls + + def __contains__(self, value): + return value in self._members_.values() + + def __repr__(self): + return "" % self.__name__ + +class Enumeration(c_uint): + __metaclass__ = EnumerationType + _members_ = {} + def __init__(self, value): + for k,v in self._members_.items(): + if v == value: + self.name = k + break + else: + raise ValueError("No enumeration member with value %r" % value) + c_uint.__init__(self, value) + + + @classmethod + def from_param(cls, param): + if isinstance(param, Enumeration): + if param.__class__ != cls: + raise ValueError("Cannot mix enumeration members") + else: + return param + else: + return cls(param) + + def __repr__(self): + return "" % (self.name, self.value, self.__class__) +#------------------------------------------------------------------- +# enum implementations +#------------------------------------------------------------------- + +class state_enum(Enumeration): + UNDEFINED = 0 + SERIALIZED = 1 + FORECAST = 2 + ANALYZED = 4 + BOTH = 6 + +class var_type(Enumeration): + INVALID_VAR = 0 + PARAMETER = 1 + DYNAMIC_STATE = 2 + DYNAMIC_RESULT = 4 + STATIC_STATE = 8 + INDEX_STATE = 16 diff --git a/ThirdParty/Ert/devel/python/python/ert/ert/enums.py b/ThirdParty/Ert/devel/python/python/ert/ert/enums.py index 93af61dcee..0825ada781 100644 --- a/ThirdParty/Ert/devel/python/python/ert/ert/enums.py +++ b/ThirdParty/Ert/devel/python/python/ert/ert/enums.py @@ -161,6 +161,21 @@ enkf_impl_type.GEN_KW = enkf_impl_type("Keyword", 107) enkf_impl_type.SUMMARY = enkf_impl_type("Summary", 110) enkf_impl_type.GEN_DATA = enkf_impl_type("Data", 113) +class enkf_var_type(enum): + #INVALID_VAR = None #, /* */ + PARAMETER = None #, /* A parameter which is updated with enkf: PORO , MULTFLT , ..*/ + DYNAMIC_STATE = None #, /* Dynamic data which are needed for a restart - i.e. pressure and saturations. */ + DYNAMIC_RESULT = None #, /* Dynamic results which are NOT needed for a restart - i.e. well rates. */ + #STATIC_STATE = None #, /* Keywords like XCON++ from eclipse restart files - which are just dragged along */ + #INDEX_STATE = None + +#enkf_var_type.INVALID_VAR +enkf_var_type.PARAMETER = enkf_var_type("Parameter", 1) +enkf_var_type.DYNAMIC_STATE = enkf_var_type("DynamicState", 2) +enkf_var_type.DYNAMIC_RESULT = enkf_var_type("DynamicResult", 4) +#enkf_var_type.STATIC_STATE +#enkf_var_type.INDEX_STATE + class ert_job_status_type(enum): """These "enum" values are all copies from the header file "basic_queue_driver.h".""" @@ -269,6 +284,17 @@ keep_runpath_type.DEFAULT_KEEP = keep_runpath_type("DEFAULT_KEEP", 0) keep_runpath_type.EXPLICIT_DELETE = keep_runpath_type("EXPLICIT_DELETE", 1) keep_runpath_type.EXPLICIT_KEEP = keep_runpath_type("EXPLICIT_KEEP", 2) +class run_mode_type(enum): + ENKF_ASSIMILATION = None + ENSEMBLE_EXPERIMENT = None + SMOOTHER_UPDATE = None + INIT_ONLY = None + +run_mode_type.ENKF_ASSIMILATION = run_mode_type( "ENKF_ASSIMILATION", 1) +run_mode_type.ENKF_EXPERIMENT = run_mode_type( "ENKF_EXPERIMENT", 2) +run_mode_type.SMOOTHER_UPDATE = run_mode_type( "SMOOTHER_UPDATE", 4) +run_mode_type.INIT_ONLY = run_mode_type( "INIT_ONLY", 8) + class history_source_type(enum): SCHEDULE = None REFCASE_SIMULATED = None @@ -286,4 +312,4 @@ class obs_impl_type(enum): obs_impl_type.GEN_OBS = obs_impl_type("GEN_OBS", 1) obs_impl_type.SUMMARY_OBS = obs_impl_type("SUMMARY_OBS", 2) -obs_impl_type.FIELD_OBS = obs_impl_type("FIELD_OBS", 3) \ No newline at end of file +obs_impl_type.FIELD_OBS = obs_impl_type("FIELD_OBS", 3) diff --git a/ThirdParty/Ert/devel/python/python/ert/ert/erttypes.py b/ThirdParty/Ert/devel/python/python/ert/ert/erttypes.py index 777d6be4de..456f5a291e 100644 --- a/ThirdParty/Ert/devel/python/python/ert/ert/erttypes.py +++ b/ThirdParty/Ert/devel/python/python/ert/ert/erttypes.py @@ -23,6 +23,12 @@ import ctypes class time_t(ctypes.c_long): """A convenience class for working with time_t objects.""" +# def __init__(self , c_ptr , parent = None): +# if parent: +# self.init_cref( c_ptr , parent) +# else: +# self.init_cobj( c_ptr , cfunc.free ) + def time(self): """Return this time_t as a time.localtime() object""" diff --git a/ThirdParty/Ert/devel/python/python/ert/ert/ertwrapper.py b/ThirdParty/Ert/devel/python/python/ert/ert/ertwrapper.py index b6528e8349..2d4a823efb 100644 --- a/ThirdParty/Ert/devel/python/python/ert/ert/ertwrapper.py +++ b/ThirdParty/Ert/devel/python/python/ert/ert/ertwrapper.py @@ -23,7 +23,9 @@ import re import sys import os import erttypes - +import ert +#import ert.enkf.enkf as enkf +import ert.enkf.enkf_main as enkf def RH_version(): RH = open('/etc/redhat-release' , 'r').read().split()[6] @@ -42,19 +44,9 @@ class ErtWrapper: def bootstrap(self, enkf_config , site_config , strict = True): - self.prototype("long enkf_main_bootstrap(char*, char*, bool)") - self.main = self.enkf.enkf_main_bootstrap(site_config, enkf_config, strict) + self.main = enkf.EnKFMain.bootstrap( enkf_config, site_config, strict ) print "\nBootstrap complete!" - - self.plot_config = self.__getErtPointer("enkf_main_get_plot_config") - self.analysis_config = self.__getErtPointer("enkf_main_get_analysis_config") - self.ecl_config = self.__getErtPointer("enkf_main_get_ecl_config") - self.site_config = self.__getErtPointer("enkf_main_get_site_config") - self.ensemble_config = self.__getErtPointer("enkf_main_get_ensemble_config") - self.model_config = self.__getErtPointer("enkf_main_get_model_config") - self.logh = self.__getErtPointer("enkf_main_get_logh") - self.initializeTypes() atexit.register(self.cleanup) @@ -85,7 +77,7 @@ class ErtWrapper: sys.exit("Need a value for environment variable LSF_HOME") self.util = self.__loadLibrary( "libert_util" ) - self.__loadLibrary( "libgeometry" ) + self.__loadLibrary( "libert_geometry" ) self.ecl = self.__loadLibrary( "libecl" ) self.__loadLibrary( "libsched" ) self.__loadLibrary( "librms" ) @@ -133,7 +125,7 @@ class ErtWrapper: prototype expects a string formatted like this: - "type functionName(type, ... ,type)" + #type functionName(type, ... ,type)# where type is a type available to ctypes Some type are automatically converted: @@ -181,12 +173,6 @@ class ErtWrapper: return func def initializeTypes(self): - self.prototype("char* stringlist_iget(long, int)", lib=self.util) - self.prototype("long stringlist_alloc_new()", lib=self.util) - self.prototype("void stringlist_append_copy(long, char*)", lib=self.util) - self.prototype("int stringlist_get_size(long)", lib=self.util) - self.prototype("void stringlist_free(long)", lib=self.util) - self.prototype("long hash_iter_alloc(long)", lib=self.util) self.prototype("char* hash_iter_get_next_key(long)", lib=self.util) self.prototype("char* hash_get(long, char*)", lib=self.util) @@ -198,12 +184,6 @@ class ErtWrapper: self.prototype("char* subst_list_iget_key(long, int)", lib=self.util) self.prototype("char* subst_list_iget_value(long, int)", lib=self.util) - self.prototype("long bool_vector_alloc(int, bool)", lib=self.util) - self.prototype("void bool_vector_iset(long, int, bool)", lib=self.util) - self.prototype("long bool_vector_get_ptr(long)", lib=self.util) - self.prototype("void bool_vector_free(long)", lib=self.util) - - self.prototype("void enkf_main_free(long)") self.prototype("void enkf_main_fprintf_config(long)") self.prototype("void enkf_main_create_new_config(long , char*, char* , char* , int)") @@ -213,38 +193,6 @@ class ErtWrapper: erttypes.double_vector.initialize(self) - def getStringList(self, stringlist_pointer, free_after_use=False): - """Retrieve a list of strings""" - result = [] - - if stringlist_pointer == 0: - return result - - number_of_strings = self.util.stringlist_get_size(stringlist_pointer) - - for index in range(number_of_strings): - result.append(self.util.stringlist_iget(stringlist_pointer, index)) - - if free_after_use: - self.freeStringList(stringlist_pointer) - - return result - - def createStringList(self, list): - """Creates a new string list from the specified list. Remember to free the list after use.""" - sl = self.util.stringlist_alloc_new() - - for item in list: - self.util.stringlist_append_copy(sl , item) - - return sl - - - def freeStringList(self, stringlistpointer): - """Must be used if the stringlist was allocated on the python side""" - self.util.stringlist_free(stringlistpointer) - - def getHash(self, hashpointer, intValue = False, return_type="char*"): """Retrieves a hash as a list of 2 element lists""" if hashpointer == 0: @@ -288,27 +236,10 @@ class ErtWrapper: return func( self.main ) - def createBoolVector(self, size, list): - """Allocates a bool vector""" - mask = self.util.bool_vector_alloc(size , False) - - for index in list: - self.util.bool_vector_iset(mask, index, True) - - return mask - - def getBoolVectorPtr(self, mask): - """Returns the pointer to a bool vector""" - return self.util.bool_vector_get_ptr(mask) - - def freeBoolVector(self, mask): - """Frees an allocated bool vector""" - self.util.bool_vector_free(mask) - def cleanup(self): """Called at atexit to clean up before shutdown""" print "Calling enkf_main_free()" - self.enkf.enkf_main_free(self.main) + self.main.__del__ def nonify(self, s): """Convert an empty string to None.""" @@ -316,7 +247,7 @@ class ErtWrapper: def save(self): """Save the state of ert to a configuration file.""" - self.enkf.enkf_main_fprintf_config(self.main) + self.main.fprintf_config diff --git a/ThirdParty/Ert/devel/python/python/ert/job_queue/driver.py b/ThirdParty/Ert/devel/python/python/ert/job_queue/driver.py index e0866bfd94..27b84d9fcb 100644 --- a/ThirdParty/Ert/devel/python/python/ert/job_queue/driver.py +++ b/ThirdParty/Ert/devel/python/python/ert/job_queue/driver.py @@ -146,7 +146,6 @@ cfunc.submit = cwrapper.prototype("c_void_p queue_driver_submit_job( cfunc.free_job = cwrapper.prototype("void queue_driver_free_job( driver , job )") cfunc.cget_status = cwrapper.prototype("int job_queue_get_status( driver , job)") cfunc.kill_job = cwrapper.prototype("void queue_driver_kill_job( driver , job )") -cfunc.set_str_option = cwrapper.prototype("void queue_driver_set_string_option( driver , char* , char*)") cfunc.set_max_running = cwrapper.prototype("void queue_driver_set_max_running( driver , int )") cfunc.get_max_running = cwrapper.prototype("int queue_driver_get_max_running( driver )") diff --git a/ThirdParty/Ert/devel/python/python/ert/job_queue/ext_job.py b/ThirdParty/Ert/devel/python/python/ert/job_queue/ext_job.py index 5cb9458e88..3031e62c35 100644 --- a/ThirdParty/Ert/devel/python/python/ert/job_queue/ext_job.py +++ b/ThirdParty/Ert/devel/python/python/ert/job_queue/ext_job.py @@ -18,38 +18,118 @@ import ctypes from ert.cwrap.cwrap import * from ert.cwrap.cclass import CClass from ert.util.tvector import * -from ert.enkf.enkf_enum import * import libjob_queue - class ExtJob(CClass): - def __init__(self , c_ptr = None): - self.owner = False - self.c_ptr = c_ptr + def __init__(self , c_ptr , parent = None): + if parent: + self.init_cref( c_ptr , parent) + else: + self.init_cobj( c_ptr , cfunc.free ) + + @property + def get_private_args_as_string(self): + return cfunc.get_private_args_as_string(self) + + def set_private_args_as_string(self, args): + cfunc.set_private_args_as_string(self, args) + + @property + def get_help_text(self): + return cfunc.get_help_text(self) + + @property + def is_private(self): + return cfunc.is_private(self) + @property + def get_config_file(self): + return cfunc.get_config_file(self) + + def set_config_file(self, config_file): + cfunc.set_config_file - def __del__(self): - if self.owner: - cfunc.free( self ) + @property + def get_stdin_file(self): + return cfunc.get_stdin_file(self) + + def set_stdin_file(self, file): + cfunc.set_stdin_file(self, file) + + @property + def get_stdout_file(self): + return cfunc.get_stdout_file(self) + def set_stdout_file(self, file): + cfunc.set_stdout_file(self, file) + + @property + def get_stderr_file(self): + return cfunc.get_stderr_file(self) - def has_key(self , key): - return cfunc.has_key( self ,key ) + def set_stderr_file(self, file): + cfunc.set_stderr_file(self, file) + @property + def get_target_file(self): + return cfunc.get_target_file(self) + def set_target_file(self, file): + cfunc.set_target_file(self, file) + + @property + def get_executable(self): + return cfunc.get_executable(self) + + def set_executable(self, executable): + cfunc.set_executable(self, executable) + + @property + def get_max_running(self): + return cfunc.get_max_running(self) + + def set_max_running(self, max_running): + cfunc.set_max_running(self, max_running) + + @property + def get_max_running_minutes(self): + return cfunc.get_max_running_minutes(self) + + def set_max_running_minutes(self, min): + cfunc.set_max_running_minutes(self, min) + + @property + def get_environment(self): + return cfunc.get_environment(self) + + def set_environment(self, key, value): + cfunc.set_environment(self, key, value) + + def clear_environment(self): + cfunc. clear_environment(self) + + def save(self): + cfunc.save(self) + + @staticmethod + def alloc(name, root_path, private): + job = ExtJob(c_ptr = cfunc.alloc(name, root_path, private)) + return job + + @staticmethod + def fscanf_alloc(name, root_path, private, config_file): + job = ExtJob(c_ptr = cfunc.fscanf_alloc(name, root_path, private, config_file)) + return job ################################################################## cwrapper = CWrapper( libjob_queue.lib ) cwrapper.registerType( "ext_job" , ExtJob ) -# 3. Installing the c-functions used to manipulate ecl_kw instances. -# These functions are used when implementing the EclKW class, not -# used outside this scope. cfunc = CWrapperNameSpace("ext_job") - - +################################################################## +################################################################## cfunc.free = cwrapper.prototype("void ext_job_free( ext_job )") cfunc.get_help_text = cwrapper.prototype("char* ext_job_get_help_text(ext_job)") cfunc.get_private_args_as_string = cwrapper.prototype("char* ext_job_get_private_args_as_string(ext_job)") diff --git a/ThirdParty/Ert/devel/python/python/ert/job_queue/ext_joblist.py b/ThirdParty/Ert/devel/python/python/ert/job_queue/ext_joblist.py index 9199cca390..855312173b 100644 --- a/ThirdParty/Ert/devel/python/python/ert/job_queue/ext_joblist.py +++ b/ThirdParty/Ert/devel/python/python/ert/job_queue/ext_joblist.py @@ -18,36 +18,45 @@ import ctypes from ert.cwrap.cwrap import * from ert.cwrap.cclass import CClass from ert.util.tvector import * -#from enkf_enum import * +from ert.enkf.enkf_enum import * +import ert.enkf.libenkf +from ert.util.stringlist import StringList +from ert.job_queue.ext_job import ExtJob import libjob_queue class ExtJoblist(CClass): - def __init__(self , c_ptr = None): - self.owner = False - self.c_ptr = c_ptr - - - def __del__(self): - if self.owner: - cfunc.free( self ) + def __init__(self , c_ptr , parent = None): + if parent: + self.init_cref( c_ptr , parent) + else: + self.init_cobj( c_ptr , cfunc.free ) + + @property + def get_jobs(self): + return cfunc.get_jobs( self ) + @property + def alloc_list(self): + return StringList(c_ptr = cfunc.alloc_list( self ), parent = self) - def has_key(self , key): - return cfunc.has_key( self ,key ) + def del_job(self, job): + return cfunc.del_job(self, job) + def has_job(self, job): + return cfunc.has_job(self, job) + def get_job(self, job): + return ExtJob( c_ptr = cfunc.get_job( self , job), parent = self) + def add_job(self, job_name, new_job): + cfunc.add_job(self, job_name, new_job) ################################################################## cwrapper = CWrapper( libjob_queue.lib ) cwrapper.registerType( "ext_joblist" , ExtJoblist ) - -# 3. Installing the c-functions used to manipulate ecl_kw instances. -# These functions are used when implementing the EclKW class, not -# used outside this scope. cfunc = CWrapperNameSpace("ext_joblist") - - +################################################################## +################################################################## cfunc.free = cwrapper.prototype("void ext_joblist_free( ext_joblist )") cfunc.alloc_list = cwrapper.prototype("c_void_p ext_joblist_alloc_list(ext_joblist)") cfunc.get_job = cwrapper.prototype("c_void_p ext_joblist_get_job(ext_joblist, char*)") diff --git a/ThirdParty/Ert/devel/python/python/ert/job_queue/forward_model.py b/ThirdParty/Ert/devel/python/python/ert/job_queue/forward_model.py index cf3885d1f1..2dd6db1d17 100644 --- a/ThirdParty/Ert/devel/python/python/ert/job_queue/forward_model.py +++ b/ThirdParty/Ert/devel/python/python/ert/job_queue/forward_model.py @@ -18,36 +18,44 @@ import ctypes from ert.cwrap.cwrap import * from ert.cwrap.cclass import CClass from ert.util.tvector import * +from ert.enkf.enkf_enum import * +from ert.enkf.libenkf import * import libjob_queue +from ert.util.stringlist import StringList +from ert.job_queue.ext_job import ExtJob class ForwardModel(CClass): - def __init__(self , c_ptr = None): - self.owner = False - self.c_ptr = c_ptr - - - def __del__(self): - if self.owner: - cfunc.free( self ) - - - def has_key(self , key): - return cfunc.has_key( self ,key ) + def __init__(self , c_ptr , parent = None): + if parent: + self.init_cref( c_ptr , parent) + else: + self.init_cobj( c_ptr , cfunc.free ) + + @property + def alloc_joblist(self): + s = StringList(initial = None, c_ptr = cfunc.alloc_joblist(self)) + return s + def iget_job(self, index): + job = ExtJob( cfunc.iget_job( self, index ), parent = self) + return job + def add_job(self, name): + job = ExtJob( cfunc.add_job( self, name ), parent = self) + return job + def clear(self): + cfunc.clear(self) ################################################################## cwrapper = CWrapper( libjob_queue.lib ) cwrapper.registerType( "forward_model" , ForwardModel ) -# 3. Installing the c-functions used to manipulate ecl_kw instances. -# These functions are used when implementing the EclKW class, not -# used outside this scope. cfunc = CWrapperNameSpace("forward_model") - - +################################################################## +################################################################## cfunc.free = cwrapper.prototype("void forward_model_free( forward_model )") cfunc.clear = cwrapper.prototype("void forward_model_clear(forward_model)") cfunc.add_job = cwrapper.prototype("c_void_p forward_model_add_job(forward_model, char*)") cfunc.alloc_joblist = cwrapper.prototype("c_void_p forward_model_alloc_joblist(forward_model)") +cfunc.iget_job = cwrapper.prototype("c_void_p forward_model_iget_job( forward_model, int)") diff --git a/ThirdParty/Ert/devel/python/python/ert/job_queue/queue.py b/ThirdParty/Ert/devel/python/python/ert/job_queue/queue.py index 4f99352b50..517e47e38a 100644 --- a/ThirdParty/Ert/devel/python/python/ert/job_queue/queue.py +++ b/ThirdParty/Ert/devel/python/python/ert/job_queue/queue.py @@ -29,7 +29,7 @@ from ert.cwrap.cclass import CClass # Need to import this to ensure that the ctime type is registered import ert.util.ctime - +from ert.util.ctime import ctime import libjob_queue @@ -122,40 +122,53 @@ class JobQueue(CClass): # necessary to explitly inform the queue layer when all jobs have # been submitted. - def __init__(self , driver , max_submit = 1 , size = 0): - """ - SHort doc... - - - - The @size argument is used to say how many jobs the queue will - run, in total. + #def __init__(self , driver = None, max_submit = 1 , size = 0, c_ptr = None): + # """ + # SHort doc... + # + # + # + # The @size argument is used to say how many jobs the queue will + # run, in total. +# +# size = 0: That means that you do not tell the queue in +# advance how many jobs you have. The queue will just run +# all the jobs you add, but you have to inform the queue in +# some way that all jobs have been submitted. To achieve +# this you should call the submit_complete() method when all +# jobs have been submitted.# +# +# size > 0: The queue will now exactly how many jobs to run, +# and will continue until this number of jobs have completed +# - it is not necessary to call the submit_complete() method +# in this case. +# """ +# +# OK_file = None +# exit_file = None +# if c_ptr: +# self.init_cobj( c_ptr , cfunc.free_queue ) +# else: +# c_ptr = cfunc.stringlist_alloc( ) +# self.init_cobj( c_ptr , cfunc.free_queue ) +# +# self.jobs = JobList() +# self.size = size +# +# self.exists = exList( self.jobs ) +# self.status = statusList( self.jobs ) +# self.run_time = runtimeList( self.jobs , self ) +# +# self.start( blocking = False ) +# if driver: +# self.driver = driver +# cfunc.set_driver( self , driver.c_ptr ) + def __init__(self , c_ptr , parent = None): + if parent: + self.init_cref( c_ptr , parent) + else: + self.init_cobj( c_ptr , cfunc.free ) - size = 0: That means that you do not tell the queue in - advance how many jobs you have. The queue will just run - all the jobs you add, but you have to inform the queue in - some way that all jobs have been submitted. To achieve - this you should call the submit_complete() method when all - jobs have been submitted. - - size > 0: The queue will now exactly how many jobs to run, - and will continue until this number of jobs have completed - - it is not necessary to call the submit_complete() method - in this case. - """ - - OK_file = None - exit_file = None - self.init_cobj( c_ptr , cfunc.free_queue ) - self.driver = driver - self.jobs = JobList() - self.size = size - - self.exists = exList( self.jobs ) - self.status = statusList( self.jobs ) - self.run_time = runtimeList( self.jobs , self ) - cfunc.set_driver( self , driver.c_ptr ) - self.start( blocking = False ) def kill_job(self , index): @@ -255,8 +268,14 @@ class JobQueue(CClass): def set_max_running( self , max_running ): self.driver.set_max_running( max_running ) - #max_running = property( fget = get_max_running , fset = set_max_running ) + def user_exit(self): + cfunc.user_exit(self) + def set_pause_on(self): + cfunc.set_pause_on + + def set_pause_off(self): + cfunc.set_pause_off ################################################################# @@ -265,7 +284,6 @@ cwrapper.registerType( "job_queue" , JobQueue ) cfunc = CWrapperNameSpace( "JobQueue" ) cfunc.user_exit = cwrapper.prototype("void job_queue_user_exit( job_queue )") -cfunc.alloc_queue = cwrapper.prototype("c_void_p job_queue_alloc( int , char* , char* )") cfunc.free_queue = cwrapper.prototype("void job_queue_free( job_queue )") cfunc.set_max_running = cwrapper.prototype("void job_queue_set_max_running( job_queue , int)") cfunc.get_max_running = cwrapper.prototype("int job_queue_get_max_running( job_queue )") @@ -281,5 +299,8 @@ cfunc.num_pending = cwrapper.prototype("int job_queue_get_num_pending( job_ cfunc.is_running = cwrapper.prototype("int job_queue_is_running( job_queue )") cfunc.submit_complete = cwrapper.prototype("void job_queue_submit_complete( job_queue )") cfunc.get_job_ptr = cwrapper.prototype("c_void_p job_queue_iget_job( job_queue , int)") -cfunc.iget_sim_start = cwrapper.prototype("time_t job_queue_iget_sim_start( job_queue , int)") +cfunc.iget_sim_start = cwrapper.prototype("int job_queue_iget_sim_start( job_queue , int)") cfunc.get_active_size = cwrapper.prototype("int job_queue_get_active_size( job_queue )") +cfunc.get_pause = cwrapper.prototype("bool job_queue_get_pause(job_queue)") +cfunc.set_pause_on = cwrapper.prototype("void job_queue_set_pause_on(job_queue)") +cfunc.set_pause_off = cwrapper.prototype("void job_queue_set_pause_off(job_queue)") diff --git a/ThirdParty/Ert/devel/python/python/ert/sched/CMakeLists.txt b/ThirdParty/Ert/devel/python/python/ert/sched/CMakeLists.txt index 16885d61a5..ac122f161d 100644 --- a/ThirdParty/Ert/devel/python/python/ert/sched/CMakeLists.txt +++ b/ThirdParty/Ert/devel/python/python/ert/sched/CMakeLists.txt @@ -1 +1 @@ -add_python_package("Python ert.sched" ${PYTHON_INSTALL_PREFIX}/ert/sched "__init__.py;libsched.py;sched_file.py;sched.py" True) +add_python_package("Python ert.sched" ${PYTHON_INSTALL_PREFIX}/ert/sched "__init__.py;libsched.py;sched_file.py;sched.py;history.py" True) diff --git a/ThirdParty/Ert/devel/python/python/ert/sched/history.py b/ThirdParty/Ert/devel/python/python/ert/sched/history.py new file mode 100644 index 0000000000..b694f6f04d --- /dev/null +++ b/ThirdParty/Ert/devel/python/python/ert/sched/history.py @@ -0,0 +1,54 @@ +# Copyright (C) 2013 Statoil ASA, Norway. +# +# The file 'history.py' 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 +# for more details. + +import ctypes +from ert.cwrap.cwrap import * +from ert.cwrap.cclass import CClass +from ert.util.tvector import * +from ert.ecl.ecl_sum import * +import libsched +class HistoryType(CClass): + + def __init__(self , c_ptr , parent = None): + if parent: + self.init_cref( c_ptr , parent) + else: + self.init_cobj( c_ptr , cfunc.free ) + + def get_source_string(self): + return cfunc.get_source_string(self) + + @staticmethod + def alloc_from_refcase(refcase, use_history): + return HistoryType(cfunc.alloc_from_refcase(refcase, use_history)) + + @staticmethod + def alloc_from_sched_file(sched_file): + return HistoryType(cfunc.alloc_from_sched_file(":", sched_file)) +################################################################## + +cwrapper = CWrapper( libsched.lib ) +cwrapper.registerType( "history_type" , HistoryType ) + +cfunc = CWrapperNameSpace("history_type") + +################################################################## +################################################################## + +cfunc.free = cwrapper.prototype("void history_free( history_type )") +cfunc.get_source_string = cwrapper.prototype("char* history_get_source_string(history_type)") +cfunc.alloc_from_refcase = cwrapper.prototype("c_void_p history_alloc_from_refcase(ecl_sum, bool)") +cfunc.alloc_from_sched_file = cwrapper.prototype("c_void_p history_alloc_from_sched_file(char*, c_void_p)") diff --git a/ThirdParty/Ert/devel/python/python/ert/util/CMakeLists.txt b/ThirdParty/Ert/devel/python/python/ert/util/CMakeLists.txt index 92e1128323..51ef2295a3 100644 --- a/ThirdParty/Ert/devel/python/python/ert/util/CMakeLists.txt +++ b/ThirdParty/Ert/devel/python/python/ert/util/CMakeLists.txt @@ -1,2 +1,2 @@ add_python_package("Python ert.util" ${PYTHON_INSTALL_PREFIX}/ert/util - "ctime.py;hash.py;__init__.py;latex.py;libutil.py;lookup_table.py;matrix.py;stat.py;stringlist.py;tvector.py;util_func.py" T) + "ctime.py;hash.py;__init__.py;latex.py;libutil.py;buffer.py;lookup_table.py;matrix.py;stat.py;stringlist.py;tvector.py;util_func.py;log.py" T) diff --git a/ThirdParty/Ert/devel/python/python/ert/util/buffer.py b/ThirdParty/Ert/devel/python/python/ert/util/buffer.py new file mode 100644 index 0000000000..b2111e1223 --- /dev/null +++ b/ThirdParty/Ert/devel/python/python/ert/util/buffer.py @@ -0,0 +1,46 @@ +# Copyright (C) 2013 Statoil ASA, Norway. +# +# The file 'buffer.py' 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 +# for more details. + +import ctypes +from ert.cwrap.cwrap import * +from ert.cwrap.cclass import CClass +from ert.util.ctime import ctime +from ert.util.tvector import * +import libutil +from ert.enkf.libenkf import * +#from ert.job_queue.ext_joblist import ExtJoblist + +class Buffer(CClass): + + def __init__(self , size , parent = None): + c_ptr = cfunc.alloc(size) + if parent: + self.init_cref( c_ptr , parent) + else: + self.init_cobj( c_ptr , cfunc.free ) + + +################################################################## +cwrapper = CWrapper( libutil.lib ) +cwrapper.registerType( "buffer" , Buffer ) + +cfunc = CWrapperNameSpace("buffer") + +################################################################## +################################################################## + +cfunc.free = cwrapper.prototype("void buffer_free( buffer )") +cfunc.alloc = cwrapper.prototype("c_void_p buffer_alloc(int)") diff --git a/ThirdParty/Ert/devel/python/python/ert/util/ctime.py b/ThirdParty/Ert/devel/python/python/ert/util/ctime.py index 5991d37514..576c65016e 100644 --- a/ThirdParty/Ert/devel/python/python/ert/util/ctime.py +++ b/ThirdParty/Ert/devel/python/python/ert/util/ctime.py @@ -59,6 +59,9 @@ class ctime(ctypes.c_long): def __lt__(self, other): return not self >= other + @property + def stripped(self): + return time.strptime(self, "%Y-%m-%d %H:%M:S%") cwrapper = CWrapper( None ) diff --git a/ThirdParty/Ert/devel/python/python/ert/util/log.py b/ThirdParty/Ert/devel/python/python/ert/util/log.py index 29a597e95d..9a1fab28ba 100644 --- a/ThirdParty/Ert/devel/python/python/ert/util/log.py +++ b/ThirdParty/Ert/devel/python/python/ert/util/log.py @@ -18,36 +18,41 @@ import ctypes from ert.cwrap.cwrap import * from ert.cwrap.cclass import CClass from ert.util.tvector import * -from enkf_enum import * -import libenkf +import libutil class Log(CClass): - def __init__(self , c_ptr = None): - self.owner = False - self.c_ptr = c_ptr + def __init__(self , c_ptr , parent = None): + if parent: + self.init_cref( c_ptr , parent) + else: + self.init_cobj( c_ptr , cfunc.free ) + + @property + def get_filename(self): + #return cfunc.get_filename( self ) + return "ert_config.log" + + def reopen(self, filename): + print "Logfile cannot be reopened" + #cfunc.reopen( self , filename) - - def __del__(self): - if self.owner: - cfunc.free( self ) - - - def has_key(self , key): - return cfunc.has_key( self ,key ) - - + @property + def get_level(self): + #return cfunc.get_level( self ) + return 0 + def set_level(self, level): + cfunc.set_level( self , level) ################################################################## -cwrapper = CWrapper( libenkf.lib ) +cwrapper = CWrapper( libutil.lib ) cwrapper.registerType( "log" , Log ) -# 3. Installing the c-functions used to manipulate ecl_kw instances. -# These functions are used when implementing the EclKW class, not -# used outside this scope. cfunc = CWrapperNameSpace("log") +################################################################## +################################################################## cfunc.free = cwrapper.prototype("void log( log )") -cfunc.get_filename = cwrapper.prototype("char* log_get_filename(long)") -cfunc.reset_filename = cwrapper.prototype("void log_reset_filename(long, char*)") -cfunc.get_level = cwrapper.prototype("int log_get_level(long)") -cfunc.set_level = cwrapper.prototype("void log_set_level(long, int)") +cfunc.get_filename = cwrapper.prototype("char* log_get_filename(log)") +cfunc.reopen = cwrapper.prototype("void log_reopen(log, char*)") +cfunc.get_level = cwrapper.prototype("int log_get_level(log)") +cfunc.set_level = cwrapper.prototype("void log_set_level(log, int)") diff --git a/ThirdParty/Ert/devel/python/python/ert/util/stringlist.py b/ThirdParty/Ert/devel/python/python/ert/util/stringlist.py index 833e733249..d90ee9d975 100644 --- a/ThirdParty/Ert/devel/python/python/ert/util/stringlist.py +++ b/ThirdParty/Ert/devel/python/python/ert/util/stringlist.py @@ -54,7 +54,7 @@ class StringList(CClass): # return obj - def __init__( self , initial = None , c_ptr = None): + def __init__( self , initial = None , c_ptr = None, parent = None): """ Creates a new stringlist instance. @@ -73,7 +73,10 @@ class StringList(CClass): ownership of the underlying object. """ if c_ptr: - self.init_cobj( c_ptr , cfunc.free ) + if parent: + self.init_cref( c_ptr , parent) + else: + self.init_cobj( c_ptr , cfunc.free ) else: c_ptr = cfunc.stringlist_alloc( ) self.init_cobj( c_ptr , cfunc.free ) @@ -193,7 +196,7 @@ class StringList(CClass): for s in self: slist.append( s ) return slist - + @property def last(self): """ @@ -234,5 +237,5 @@ cfunc.stringlist_iset = cwrapper.prototype("void stringlist_iset_copy( st cfunc.stringlist_get_size = cwrapper.prototype("int stringlist_get_size( stringlist )") cfunc.contains = cwrapper.prototype("bool stringlist_contains(stringlist , char*)") cfunc.sort = cwrapper.prototype("void stringlist_python_sort( stringlist , int)") -cfunc.pop = cwrapper.prototype("char* stringlist_pop( stringlist )") -cfunc.last = cwrapper.prototype("char* stringlist_get_last( stringlist )") +cfunc.pop = cwrapper.safe_prototype("char* stringlist_pop( stringlist )") +cfunc.last = cwrapper.safe_prototype("char* stringlist_get_last( stringlist )") diff --git a/ThirdParty/Ert/devel/python/python/ert/util/tvector.py b/ThirdParty/Ert/devel/python/python/ert/util/tvector.py index 4b30ebe5ab..d8d7c874db 100644 --- a/ThirdParty/Ert/devel/python/python/ert/util/tvector.py +++ b/ThirdParty/Ert/devel/python/python/ert/util/tvector.py @@ -50,6 +50,10 @@ from ert.cwrap.cclass import CClass import numpy + + + + class TVector(CClass): @classmethod @@ -86,8 +90,8 @@ class TVector(CClass): new_obj.init_cobj( c_ptr , new_obj.free ) return new_obj - - def __new__( cls ): + + def __new__( cls , **kwargs): obj = object.__new__( cls ) return obj @@ -229,10 +233,13 @@ class TVector(CClass): subtraction operations: __isub__, __sub__ and __rsub__. """ if type(self) == type(delta): - # This is vector + vector operation. - if not add: - self.scale( delta , -1 ) - self.inplace_add( self , delta ) + if self.size == delta.size: + # This is vector + vector operation. + if not add: + self.scale( delta , -1 ) + self.inplace_add( self , delta ) + else: + raise ValueError("Incompatible sizes for add self:%d other:%d" % (self.size , delta.size)) else: if isinstance( delta , int ) or isinstance( delta, float): if not add: @@ -260,7 +267,10 @@ class TVector(CClass): if type(self) == type(factor): # This is vector * vector operation. - self.inplace_mul( self , factor ) + if self.size == factor.size: + self.inplace_mul( self , factor ) + else: + raise ValueError("Incompatible sizes for mul self:%d other:%d" % (self.size , factor.size)) else: if isinstance( factor , int ) or isinstance( factor, float): self.scale( self , factor ) @@ -320,10 +330,14 @@ class TVector(CClass): def __rmul__(self , factor): return self.__mul__( factor ) - def __div__(self , factor): - copy = self.deep_copy() - copy /= factor - return copy + + def __div__(self , divisor): + if isinstance( divisor , int ) or isinstance( divisor , float): + copy = self.__copy__( self ) + copy.div( copy , divisor ) + return copy + else: + raise TypeError("Divisor has wrong type:%s" % type( divisor )) # No __rdiv__() @@ -361,7 +375,7 @@ class TVector(CClass): def __len__(self): """ - The number of elements in the vector." + The number of elements in the vector. """ return self.get_size( self ) @@ -397,6 +411,7 @@ class TVector(CClass): else: raise IndexError + def min_index( self , reverse = False ): if self.get_size( self ) > 0: return self.get_min_index( self , reverse ) @@ -488,11 +503,15 @@ class TVector(CClass): ################################################################# +# The ctypes type system with CWrapper.registerType() needs access to +# the wrapper object class definitions, and the warpper objects need +# access to the cfunc.xxxx function objects; that is the reason we +# invoke the ugly cls.initialized flag. class DoubleVector(TVector): initialized = False - def __new__( cls , *arglist ): + def __new__( cls , **kwargs ): if not cls.initialized: cls.csort = cfunc.double_vector_sort cls.crsort = cfunc.double_vector_rsort @@ -516,6 +535,7 @@ class DoubleVector(TVector): cls.get_min_index = cfunc.double_vector_get_min_index cls.shift = cfunc.double_vector_shift cls.scale = cfunc.double_vector_scale + cls.div = cfunc.double_vector_div cls.inplace_add = cfunc.double_vector_inplace_add cls.inplace_mul = cfunc.double_vector_inplace_mul cls.cassign = cfunc.double_vector_assign @@ -529,7 +549,7 @@ class DoubleVector(TVector): cls.def_fmt = "%8.4f" cls.initialized = True - obj = TVector.__new__( cls ) + obj = TVector.__new__( cls , kwargs ) return obj @@ -537,7 +557,7 @@ class DoubleVector(TVector): class BoolVector(TVector): initialized = False - def __new__( cls , *arglist ): + def __new__( cls , **kwargs ): if not cls.initialized: cls.csort = cfunc.bool_vector_sort cls.crsort = cfunc.bool_vector_rsort @@ -561,6 +581,7 @@ class BoolVector(TVector): cls.get_min_index = cfunc.bool_vector_get_min_index cls.shift = cfunc.bool_vector_shift cls.scale = cfunc.bool_vector_scale + cls.div = cfunc.bool_vector_div cls.inplace_add = cfunc.bool_vector_inplace_add cls.inplace_mul = cfunc.bool_vector_inplace_mul cls.cassign = cfunc.bool_vector_assign @@ -574,7 +595,7 @@ class BoolVector(TVector): cls.def_fmt = "%8d" cls.initialized = True - obj = TVector.__new__( cls ) + obj = TVector.__new__( cls , **kwargs) return obj @@ -598,6 +619,17 @@ class BoolVector(TVector): new_obj.init_cobj( c_ptr , new_obj.free ) return new_obj + @classmethod + def create_from_list(cls, size, list): + """Allocates a bool vector from a Python list""" + new_obj = BoolVector.__new__(cls) + c_ptr = cfunc.bool_vector_alloc(size , False) + for index in list: + cfunc.bool_vector_iset(c_ptr, index, True) + + #c_ptr = cfunc.bool_vector_data_ptr(mask) + new_obj.init_cobj( c_ptr , new_obj.free ) + return new_obj @@ -607,10 +639,10 @@ class BoolVector(TVector): class IntVector(TVector): initialized = False - def __new__( cls , *arglist ): + def __new__( cls , **kwargs ): if not cls.initialized: cls.csort = cfunc.int_vector_sort - cls.crsort = cfunc.int_vector_rsort + cls.crsort = cfunc.int_vector_rsort cls.alloc = cfunc.int_vector_alloc cls.alloc_copy = cfunc.int_vector_alloc_copy cls.free = cfunc.int_vector_free @@ -631,6 +663,7 @@ class IntVector(TVector): cls.get_min_index = cfunc.int_vector_get_min_index cls.shift = cfunc.int_vector_shift cls.scale = cfunc.int_vector_scale + cls.div = cfunc.int_vector_div cls.inplace_add = cfunc.int_vector_inplace_add cls.inplace_mul = cfunc.int_vector_inplace_mul cls.cassign = cfunc.int_vector_assign @@ -644,7 +677,7 @@ class IntVector(TVector): cls.def_fmt = "%d" cls.initialized = True - obj = TVector.__new__( cls ) + obj = TVector.__new__( cls , **kwargs) return obj @classmethod @@ -668,7 +701,6 @@ class IntVector(TVector): return new_obj - ################################################################# buffer_from_ptr = ctypes.pythonapi.PyBuffer_FromMemory @@ -706,6 +738,7 @@ cfunc.double_vector_get_max_index = cwrapper.prototype("int double_vector_ cfunc.double_vector_get_min_index = cwrapper.prototype("int double_vector_get_min_index( double_vector , bool)") cfunc.double_vector_shift = cwrapper.prototype("void double_vector_shift( double_vector , double )") cfunc.double_vector_scale = cwrapper.prototype("void double_vector_scale( double_vector , double )") +cfunc.double_vector_div = cwrapper.prototype("void double_vector_div( double_vector , double )") cfunc.double_vector_inplace_add = cwrapper.prototype("void double_vector_inplace_add( double_vector , double_vector )") cfunc.double_vector_inplace_mul = cwrapper.prototype("void double_vector_inplace_mul( double_vector , double_vector )") cfunc.double_vector_assign = cwrapper.prototype("void double_vector_set_all( double_vector , double)") @@ -739,6 +772,7 @@ cfunc.int_vector_get_max_index = cwrapper.prototype("int int_vector_get cfunc.int_vector_get_min_index = cwrapper.prototype("int int_vector_get_min_index( int_vector , bool)") cfunc.int_vector_shift = cwrapper.prototype("void int_vector_shift( int_vector , int )") cfunc.int_vector_scale = cwrapper.prototype("void int_vector_scale( int_vector , int )") +cfunc.int_vector_div = cwrapper.prototype("void int_vector_div( int_vector , int )") cfunc.int_vector_inplace_add = cwrapper.prototype("void int_vector_inplace_add( int_vector , int_vector )") cfunc.int_vector_inplace_mul = cwrapper.prototype("void int_vector_inplace_mul( int_vector , int_vector )") cfunc.int_vector_assign = cwrapper.prototype("void int_vector_set_all( int_vector , int)") @@ -751,7 +785,7 @@ cfunc.int_vector_element_size = cwrapper.prototype("int int_vector_ele cfunc.bool_vector_alloc_copy = cwrapper.prototype("c_void_p bool_vector_alloc_copy( bool_vector )") -cfunc.bool_vector_alloc = cwrapper.prototype("c_void_p bool_vector_alloc( bool , bool )") +cfunc.bool_vector_alloc = cwrapper.prototype("c_void_p bool_vector_alloc( int , bool )") cfunc.bool_vector_strided_copy = cwrapper.prototype("c_void_p bool_vector_alloc_strided_copy( bool_vector , bool , bool , bool)") cfunc.bool_vector_free = cwrapper.prototype("void bool_vector_free( bool_vector )") cfunc.bool_vector_iget = cwrapper.prototype("bool bool_vector_iget( bool_vector , bool )") @@ -772,6 +806,7 @@ cfunc.bool_vector_get_max_index = cwrapper.prototype("bool bool_vector_ cfunc.bool_vector_get_min_index = cwrapper.prototype("bool bool_vector_get_min_index( bool_vector , bool)") cfunc.bool_vector_shift = cwrapper.prototype("void bool_vector_shift( bool_vector , bool )") cfunc.bool_vector_scale = cwrapper.prototype("void bool_vector_scale( bool_vector , bool )") +cfunc.bool_vector_div = cwrapper.prototype("void bool_vector_div( bool_vector , bool )") cfunc.bool_vector_inplace_add = cwrapper.prototype("void bool_vector_inplace_add( bool_vector , bool_vector )") cfunc.bool_vector_inplace_mul = cwrapper.prototype("void bool_vector_inplace_mul( bool_vector , bool_vector )") cfunc.bool_vector_assign = cwrapper.prototype("void bool_vector_set_all( bool_vector , bool)") @@ -786,3 +821,4 @@ cfunc.bool_vector_element_size = cwrapper.prototype("int bool_vector_e cfunc.create_active_list = cwrapper.prototype("c_void_p string_util_alloc_active_list( char* )") cfunc.create_active_mask = cwrapper.prototype("c_void_p string_util_alloc_active_mask( char* )") + diff --git a/ThirdParty/Ert/devel/python/python/ert_gui/CMakeLists.txt b/ThirdParty/Ert/devel/python/python/ert_gui/CMakeLists.txt new file mode 100644 index 0000000000..9df22897b1 --- /dev/null +++ b/ThirdParty/Ert/devel/python/python/ert_gui/CMakeLists.txt @@ -0,0 +1,3 @@ +add_python_package( "Python ert_gui" ${PYTHON_INSTALL_PREFIX}/ert_gui "__init__.py;gert_main.py;newconfig.py" True) +add_subdirectory( pages ) +add_subdirectory( widgets ) diff --git a/ThirdParty/Ert/devel/python/python/ert_gui/README.txt b/ThirdParty/Ert/devel/python/python/ert_gui/README.txt new file mode 100644 index 0000000000..203cbbf45b --- /dev/null +++ b/ThirdParty/Ert/devel/python/python/ert_gui/README.txt @@ -0,0 +1,43 @@ +How to develop/run the GUI: + +You can run the gui in two ways: + +1a There are CMakeLists.txt files all the ways through the gui filesystem, + and if you build the ert distribution you will get file hierarchy + xxxx/build/python/ert_gui beside the xxxx/build/python/ert hierarchy. + + This is the way the gui should be organized when installed, to invoke the + gui this way: + + gert -v xxxx/build + + Observe that the 'xxxx' part must be an ABSOLUTE path, otherwise the + frontend script will search in the default installation directory. + + +1b Alternatively you can use the gert command to invoke the gui in the source + directory: + + gert -v xxxx/devel/python + + Observe only one 'python' above. + + + +2. You can invoke gui as a python module directly from the source, without + going through the gert frontend script. This requires that set several + environment variables: + + ERT_SITE_CONFIG -> /project/res/etc/ERT/site-config + ERT_SHARE_PATH -> xxxx/devel/libenkf/applications/ert_gui/share + LD_LIBRARY_PATH -> xxxx/build/lib64 + + And in addition you must source the local_csh file in + xxxx/devel/python/test to set the PYTHONPATH correctly. + + +About the ERT_SHARE_PATH variable: the correct value for the ERT_SHARE_PATH +variable is currently xxxx/devel/libenkf/applications/ert_gui/share, so if +you are using alternative 2 you get this one correctly, whereas if you use +alternative 1 it will be set to a generally incorrect value by the gert +frontend script. diff --git a/ThirdParty/Ert/devel/libenkf/applications/ert_gui/lib/ert_gui/__init__.py b/ThirdParty/Ert/devel/python/python/ert_gui/__init__.py similarity index 100% rename from ThirdParty/Ert/devel/libenkf/applications/ert_gui/lib/ert_gui/__init__.py rename to ThirdParty/Ert/devel/python/python/ert_gui/__init__.py diff --git a/ThirdParty/Ert/devel/libenkf/applications/ert_gui/lib/ert_gui/gert_main.py b/ThirdParty/Ert/devel/python/python/ert_gui/gert_main.py similarity index 60% rename from ThirdParty/Ert/devel/libenkf/applications/ert_gui/lib/ert_gui/gert_main.py rename to ThirdParty/Ert/devel/python/python/ert_gui/gert_main.py index 828d8f4483..c3ace25019 100644 --- a/ThirdParty/Ert/devel/libenkf/applications/ert_gui/lib/ert_gui/gert_main.py +++ b/ThirdParty/Ert/devel/python/python/ert_gui/gert_main.py @@ -114,94 +114,102 @@ from PyQt4 import QtGui, QtCore import sys import os + from ert.ert.ertwrapper import ErtWrapper import ert_gui.widgets.util import ert_gui.widgets.help -ert_gui.widgets.help.help_prefix = os.getenv("GERT_SHARE_PATH")+ "/help/" -ert_gui.widgets.util.img_prefix = os.getenv("GERT_SHARE_PATH")+ "/img/" - +ert_gui.widgets.help.help_prefix = os.getenv("ERT_SHARE_PATH")+ "/gui/help/" +ert_gui.widgets.util.img_prefix = os.getenv("ERT_SHARE_PATH")+ "/gui/img/" +from ert.enkf.enkf_main import EnKFMain from ert_gui.newconfig import NewConfigurationDialog - -app = QtGui.QApplication(sys.argv) #Early so that QT is initialized before other imports - from ert_gui.pages.application import Application from ert_gui.pages.init.initpanel import InitPanel from ert_gui.pages.run.runpanel import RunPanel -from ert_gui.pages.config.configpages import ConfigPages -from ert_gui.pages.plot.plotpanel import PlotPanel from ert_gui.widgets.helpedwidget import ContentModel from ert_gui.widgets.util import resourceImage, resourceIcon + + import matplotlib -print "PyQt4 version: ", QtCore.qVersion() -print "matplotlib version: ", matplotlib.__version__ -splash = QtGui.QSplashScreen(resourceImage("splash") , QtCore.Qt.WindowStaysOnTopHint) -splash.show() -splash.showMessage("Starting up...", color=QtCore.Qt.white) -app.processEvents() +def main(): + app = QtGui.QApplication(sys.argv) #Early so that QT is initialized before other imports + from ert_gui.pages.config.configpages import ConfigPages + from ert_gui.pages.plot.plotpanel import PlotPanel -window = Application() + splash = QtGui.QSplashScreen(resourceImage("newsplash") , QtCore.Qt.WindowStaysOnTopHint) + splash.show() + splash.showMessage("Starting up...", color=QtCore.Qt.white) + app.processEvents() -splash.showMessage("Bootstrapping...", color=QtCore.Qt.white) -app.processEvents() + window = Application() -ert = ErtWrapper( ) -strict = True -site_config = os.getenv("ERT_SITE_CONFIG") -if len(sys.argv) == 1: - print "-----------------------------------------------------------------" - print "-- You must supply the name of configuration file as the first --" - print "-- commandline argument: --" - print "-- --" - print "-- bash% gert --" - print "-- --" - print "-- If the configuration file does not exist, gert will create --" - print "-- create a new configuration file. --" - print "-----------------------------------------------------------------" - sys.exit( ) + splash.showMessage("Bootstrapping...", color=QtCore.Qt.white) + app.processEvents() -enkf_config = sys.argv[1] -if not os.path.exists(enkf_config): - print "Trying to start new config" - new_configuration_dialog = NewConfigurationDialog(enkf_config) - success = new_configuration_dialog.exec_() - if not success: - print "Can not run without a configuration file." - sys.exit(1) + ert = ErtWrapper( ) + strict = True + site_config = os.getenv("ERT_SITE_CONFIG") + if len(sys.argv) == 1: + print "-----------------------------------------------------------------" + print "-- You must supply the name of configuration file as the first --" + print "-- commandline argument: --" + print "-- --" + print "-- bash% gert --" + print "-- --" + print "-- If the configuration file does not exist, gert will create --" + print "-- create a new configuration file. --" + print "-----------------------------------------------------------------" + #sys.exit(0) else: - enkf_config = new_configuration_dialog.getConfigurationPath() - firste_case_name = new_configuration_dialog.getCaseName() - dbase_type = new_configuration_dialog.getDBaseType() - num_realizations = new_configuration_dialog.getNumberOfRealizations() - storage_path = new_configuration_dialog.getStoragePath() - ert.enkf.enkf_main_create_new_config(enkf_config, storage_path , firste_case_name, dbase_type, num_realizations) - strict = False + enkf_config = sys.argv[1] + if not os.path.exists(enkf_config): + print "Trying to start new config" + new_configuration_dialog = NewConfigurationDialog(enkf_config) + success = new_configuration_dialog.exec_() + if not success: + print "Can not run without a configuration file." + sys.exit(1) + else: + enkf_config = new_configuration_dialog.getConfigurationPath() + firste_case_name = new_configuration_dialog.getCaseName() + dbase_type = new_configuration_dialog.getDBaseType() + num_realizations = new_configuration_dialog.getNumberOfRealizations() + storage_path = new_configuration_dialog.getStoragePath() -ert.bootstrap(enkf_config, site_config = site_config, strict = strict) -window.setSaveFunction(ert.save) + EnKFMain.create_new_config(enkf_config, storage_path , firste_case_name, dbase_type, num_realizations) + strict = False -splash.showMessage("Creating GUI...", color=QtCore.Qt.white) -app.processEvents() + ert.bootstrap(enkf_config, site_config = site_config, strict = strict) + window.setSaveFunction(ert.save) -#window.addPage("Configuration", resourceIcon("config"), ConfigPages(window)) -window.addPage("Init", resourceIcon("db"), InitPanel(window)) -window.addPage("Run", resourceIcon("run"), RunPanel(window)) -window.addPage("Plots", resourceIcon("plot"), PlotPanel()) + splash.showMessage("Creating GUI...", color=QtCore.Qt.white) + app.processEvents() -splash.showMessage("Communicating with ERT...", color=QtCore.Qt.white) -app.processEvents() + window.addPage("Configuration", resourceIcon("config"), ConfigPages(window)) + window.addPage("Init" , resourceIcon("db"), InitPanel(window)) + window.addPage("Run" , resourceIcon("run"), RunPanel(window)) + window.addPage("Plots", resourceIcon("plot"), PlotPanel()) + + splash.showMessage("Communicating with ERT...", color=QtCore.Qt.white) + app.processEvents() + + ContentModel.contentModel = ert + ContentModel.updateObservers() + + window.show() + splash.finish(window) + + sys.exit(app.exec_()) + +if __name__ =="__main__": + main() -ContentModel.contentModel = ert -ContentModel.updateObservers() -window.show() -splash.finish(window) -sys.exit(app.exec_()) diff --git a/ThirdParty/Ert/devel/libenkf/applications/ert_gui/lib/ert_gui/newconfig.py b/ThirdParty/Ert/devel/python/python/ert_gui/newconfig.py similarity index 100% rename from ThirdParty/Ert/devel/libenkf/applications/ert_gui/lib/ert_gui/newconfig.py rename to ThirdParty/Ert/devel/python/python/ert_gui/newconfig.py diff --git a/ThirdParty/Ert/devel/python/python/ert_gui/pages/CMakeLists.txt b/ThirdParty/Ert/devel/python/python/ert_gui/pages/CMakeLists.txt new file mode 100644 index 0000000000..73e3edd049 --- /dev/null +++ b/ThirdParty/Ert/devel/python/python/ert_gui/pages/CMakeLists.txt @@ -0,0 +1,5 @@ +add_python_package( "Python gui.pages" ${PYTHON_INSTALL_PREFIX}/ert_gui/pages "application.py;__init__.py" True) +add_subdirectory( config ) +add_subdirectory( init ) +add_subdirectory( plot ) +add_subdirectory( run ) diff --git a/ThirdParty/Ert/devel/libenkf/applications/ert_gui/lib/ert_gui/pages/__init__.py b/ThirdParty/Ert/devel/python/python/ert_gui/pages/__init__.py similarity index 100% rename from ThirdParty/Ert/devel/libenkf/applications/ert_gui/lib/ert_gui/pages/__init__.py rename to ThirdParty/Ert/devel/python/python/ert_gui/pages/__init__.py diff --git a/ThirdParty/Ert/devel/libenkf/applications/ert_gui/lib/ert_gui/pages/application.py b/ThirdParty/Ert/devel/python/python/ert_gui/pages/application.py similarity index 100% rename from ThirdParty/Ert/devel/libenkf/applications/ert_gui/lib/ert_gui/pages/application.py rename to ThirdParty/Ert/devel/python/python/ert_gui/pages/application.py diff --git a/ThirdParty/Ert/devel/python/python/ert_gui/pages/config/CMakeLists.txt b/ThirdParty/Ert/devel/python/python/ert_gui/pages/config/CMakeLists.txt new file mode 100644 index 0000000000..ffe74a9b66 --- /dev/null +++ b/ThirdParty/Ert/devel/python/python/ert_gui/pages/config/CMakeLists.txt @@ -0,0 +1,4 @@ +add_python_package( "Python ert_gui.pages.config" ${PYTHON_INSTALL_PREFIX}/ert_gui/pages/config "__init__.py;analysis.py;configpages.py;eclipse.py;ensemble.py;observations.py;plot.py;queuesystem.py;simulation.py;systemenv.py" True) +add_subdirectory( jobs ) +add_subdirectory( parameters ) +add_subdirectory( simulations ) diff --git a/ThirdParty/Ert/devel/libenkf/applications/ert_gui/lib/ert_gui/pages/config/__init__.py b/ThirdParty/Ert/devel/python/python/ert_gui/pages/config/__init__.py similarity index 100% rename from ThirdParty/Ert/devel/libenkf/applications/ert_gui/lib/ert_gui/pages/config/__init__.py rename to ThirdParty/Ert/devel/python/python/ert_gui/pages/config/__init__.py diff --git a/ThirdParty/Ert/devel/python/python/ert_gui/pages/config/analysis.py b/ThirdParty/Ert/devel/python/python/ert_gui/pages/config/analysis.py new file mode 100644 index 0000000000..ffd0839516 --- /dev/null +++ b/ThirdParty/Ert/devel/python/python/ert_gui/pages/config/analysis.py @@ -0,0 +1,85 @@ +# Copyright (C) 2011 Statoil ASA, Norway. +# +# The file 'analysis.py' 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 +# for more details. + + +# ---------------------------------------------------------------------------------------------- +# Analysis tab +# ---------------------------------------------------------------------------------------------- +from ert_gui.widgets.checkbox import CheckBox +from ert_gui.widgets.spinnerwidgets import IntegerSpinner, DoubleSpinner, DoubleSpinner +import ert_gui.widgets.tablewidgets +from ert_gui.widgets.pathchooser import PathChooser +from PyQt4 import QtGui +import ert.enkf + +def createAnalysisPage(configPanel, parent): + configPanel.startPage("Analysis") + + r = configPanel.addRow(CheckBox(parent, "ENKF rerun", "config/analysis/enkf_rerun", "Perform rerun")) + r.initialize = lambda ert : ert.main.analysis_config.get_rerun + r.getter = lambda ert : ert.main.analysis_config.get_rerun + r.setter = lambda ert, value : ert.main.analysis_config.set_rerun( value) + + r = configPanel.addRow(IntegerSpinner(parent, "Rerun start", "config/analysis/rerun_start", 0, 100000)) + r.initialize = lambda ert : ert.main.analysis_config.get_rerun_start + r.getter = lambda ert : ert.main.analysis_config.get_rerun_start + r.setter = lambda ert, value : ert.main.analysis_config.set_rerun_start( value) + + r = configPanel.addRow(PathChooser(parent, "ENKF schedule file", "config/analysis/enkf_sched_file")) + r.initialize = lambda ert : ert.main.model_config.get_enkf_sched_file + r.getter = lambda ert : ert.main.model_config.get_enkf_sched_file + r.setter = lambda ert, value : ert.main.model_config.set_enkf_sched_file(str(value)) + + r = configPanel.addRow(ert_gui.widgets.tablewidgets.KeywordList(parent, "Local config", "config/analysis/local_config")) + r.newKeywordPopup = lambda list : QtGui.QFileDialog.getOpenFileName(r, "Select a path", "") + + def get_local_config_files(ert): + local_config = ert.main.local_config + config_files_pointer = ert.main.local_config.get_config_files + return config_files_pointer + + r.initialize = get_local_config_files + r.getter = get_local_config_files + + def add_config_file(ert, value): + local_config = ert.main.local_config + ert.main.local_config.clear_config_files + + for file in value: + ert.main.local_config.add_config_file( file) + + r.setter = add_config_file + + r = configPanel.addRow(PathChooser(parent, "Update log", "config/analysis/update_log")) + r.initialize = lambda ert : ert.main.analysis_config.get_log_path + r.getter = lambda ert : ert.main.analysis_config.get_log_path + r.setter = lambda ert, value : ert.main.analysis_config.set_log_path( str(value)) + + + configPanel.startGroup("EnKF") + + r = configPanel.addRow(DoubleSpinner(parent, "Alpha", "config/analysis/enkf_alpha", 0, 100000, 2)) + r.initialize = lambda ert : ert.main.analysis_config.get_alpha + r.getter = lambda ert : ert.main.analysis_config.get_alpha + r.setter = lambda ert, value : ert.main.analysis_config.set_alpha( value) + + r = configPanel.addRow(CheckBox(parent, "Merge Observations", "config/analysis/enkf_merge_observations", "Perform merge")) + r.initialize = lambda ert : ert.main.analysis_config.get_merge_observations + r.getter = lambda ert : ert.main.analysis_config.get_merge_observations + r.setter = lambda ert, value : ert.main.analysis_config.set_merge_observations( value) + + configPanel.endGroup() + configPanel.endPage() diff --git a/ThirdParty/Ert/devel/libenkf/applications/ert_gui/lib/ert_gui/pages/config/configpages.py b/ThirdParty/Ert/devel/python/python/ert_gui/pages/config/configpages.py similarity index 100% rename from ThirdParty/Ert/devel/libenkf/applications/ert_gui/lib/ert_gui/pages/config/configpages.py rename to ThirdParty/Ert/devel/python/python/ert_gui/pages/config/configpages.py index 0bfed3f9da..e9be36339f 100644 --- a/ThirdParty/Ert/devel/libenkf/applications/ert_gui/lib/ert_gui/pages/config/configpages.py +++ b/ThirdParty/Ert/devel/python/python/ert_gui/pages/config/configpages.py @@ -14,16 +14,16 @@ # See the GNU General Public License at # for more details. - from ert_gui.widgets.configpanel import ConfigPanel import eclipse import analysis import queuesystem import systemenv import plot -import ensemble import observations import simulation +import ensemble + class ConfigPages(ConfigPanel): diff --git a/ThirdParty/Ert/devel/libenkf/applications/ert_gui/lib/ert_gui/pages/config/eclipse.py b/ThirdParty/Ert/devel/python/python/ert_gui/pages/config/eclipse.py similarity index 60% rename from ThirdParty/Ert/devel/libenkf/applications/ert_gui/lib/ert_gui/pages/config/eclipse.py rename to ThirdParty/Ert/devel/python/python/ert_gui/pages/config/eclipse.py index 4a5504dc27..0d6c7415ea 100644 --- a/ThirdParty/Ert/devel/libenkf/applications/ert_gui/lib/ert_gui/pages/config/eclipse.py +++ b/ThirdParty/Ert/devel/python/python/ert_gui/pages/config/eclipse.py @@ -27,47 +27,54 @@ def createEclipsePage(configPanel, parent): configPanel.startPage("Eclipse") r = configPanel.addRow(PathChooser(parent, "Eclipse Base", "config/eclipse/eclbase", path_format=True)) - r.getter = lambda ert : ert.enkf.ecl_config_get_eclbase(ert.ecl_config) - r.setter = lambda ert, value : ert.enkf.enkf_main_set_eclbase(ert.main , str(value)) + r.initialize = lambda ert : ert.main.ecl_config.get_eclbase + r.getter = lambda ert : ert.main.ecl_config.get_eclbase + r.setter = lambda ert, value : ert.main.set_eclbase(str(value)) r = configPanel.addRow(PathChooser(parent, "Data file", "config/eclipse/data_file", show_files=True)) - r.getter = lambda ert : ert.enkf.ecl_config_get_data_file(ert.ecl_config) - r.setter = lambda ert, value : ert.enkf.enkf_main_set_data_file(ert.main , str(value)) + r.initialize = lambda ert : ert.main.ecl_config.get_data_file + r.getter = lambda ert : ert.main.ecl_config.get_data_file + r.setter = lambda ert, value : ert.main.set_datafile(str(value)) r = configPanel.addRow(PathChooser(parent, "Grid", "config/eclipse/grid", show_files=True)) - r.getter = lambda ert : ert.enkf.ecl_config_get_gridfile(ert.ecl_config) - r.setter = lambda ert, value : ert.enkf.ecl_config_set_grid(ert.ecl_config, str(value)) + r.initialize = lambda ert : ert.main.ecl_config.get_gridfile + r.getter = lambda ert : ert.main.ecl_config.get_gridfile + r.setter = lambda ert, value : ert.main.ecl_config.set_gridfile(str(value)) r = configPanel.addRow(PathChooser(parent, "Schedule file" , "config/eclipse/schedule_file" , show_files = True)) - r.getter = lambda ert : ert.enkf.ecl_config_get_schedule_file(ert.ecl_config) - r.setter = lambda ert, value : ert.enkf.ecl_config_set_schedule_file(ert.ecl_config, str(value)) + r.initialize = lambda ert : ert.main.ecl_config.get_schedule_file + r.getter = lambda ert : ert.main.ecl_config.get_schedule_file + r.setter = lambda ert, value : ert.main.ecl_config.set_schedule_file( str(value)) r = configPanel.addRow(PathChooser(parent, "Init section", "config/eclipse/init_section", show_files=True)) - r.getter = lambda ert : ert.enkf.ecl_config_get_init_section(ert.ecl_config) - r.setter = lambda ert, value : ert.enkf.ecl_config_set_init_section(ert.ecl_config, str(value)) + r.initialize = lambda ert : ert.main.ecl_config.get_init_section + r.getter = lambda ert : ert.main.ecl_config.get_init_section + r.setter = lambda ert, value : ert.main.ecl_config.set_init_section( str(value)) r = configPanel.addRow(PathChooser(parent, "Refcase", "config/eclipse/refcase", show_files=True)) - r.getter = lambda ert : ert.enkf.ecl_config_get_refcase_name(ert.ecl_config) - r.setter = lambda ert, value : ert.enkf.ecl_config_load_refcase(ert.ecl_config, str(value)) + r.initialize = lambda ert : ert.main.ecl_config.get_refcase_name + r.getter = lambda ert : ert.main.ecl_config.get_refcase_name + r.setter = lambda ert, value : ert.main.ecl_config.load_refcase( str(value)) r = configPanel.addRow(PathChooser(parent, "Schedule prediction file", "config/eclipse/schedule_prediction_file", show_files=True)) - r.getter = lambda ert : ert.enkf.enkf_main_get_schedule_prediction_file(ert.main) - r.setter = lambda ert, value : ert.enkf.enkf_main_set_schedule_prediction_file(ert.main, ert.nonify( value )) + r.initialize = lambda ert : ert.main.get_schedule_prediction_file + r.getter = lambda ert : ert.main.get_schedule_prediction_file + r.setter = lambda ert, value : ert.main.set_schedule_prediction_file( ert.nonify( value )) r = configPanel.addRow(KeywordTable(parent, "Data keywords", "config/eclipse/data_kw")) - r.getter = lambda ert : ert.getSubstitutionList(ert.enkf.enkf_main_get_data_kw(ert.main)) + r.getter = lambda ert : ert.getSubstitutionList(ert.main.get_data_kw) def add_data_kw(ert, listOfKeywords): - ert.enkf.enkf_main_clear_data_kw(ert.main) + ert.main.clear_data_kw for keyword in listOfKeywords: - ert.enkf.enkf_main_add_data_kw(ert.main, keyword[0], keyword[1]) + ert.main.add_data_kw( keyword[0], keyword[1]) r.setter = add_data_kw - + r.initialize = lambda ert : ert.getSubstitutionList(ert.main.get_data_kw) configPanel.addSeparator() @@ -76,16 +83,16 @@ def createEclipsePage(configPanel, parent): internalPanel.startPage("Static keywords") r = internalPanel.addRow(KeywordList(parent, "", "config/eclipse/add_static_kw")) - r.getter = lambda ert : ert.getStringList(ert.enkf.ecl_config_get_static_kw_list(ert.ecl_config)) + r.getter = lambda ert : ert.main.ecl_config.get_static_kw_list def add_static_kw(ert, listOfKeywords): - ert.enkf.ecl_config_clear_static_kw(ert.ecl_config) + ert.main.ecl_config.clear_static_kw for keyword in listOfKeywords: - ert.enkf.ecl_config_add_static_kw(ert.ecl_config, keyword) + ert.main.ecl_config.add_static_kw(keyword) r.setter = add_static_kw - + r.initialize = lambda ert : ert.main.ecl_config.get_static_kw_list internalPanel.endPage() # todo: add support for fixed length schedule keywords diff --git a/ThirdParty/Ert/devel/libenkf/applications/ert_gui/lib/ert_gui/pages/config/ensemble.py b/ThirdParty/Ert/devel/python/python/ert_gui/pages/config/ensemble.py similarity index 66% rename from ThirdParty/Ert/devel/libenkf/applications/ert_gui/lib/ert_gui/pages/config/ensemble.py rename to ThirdParty/Ert/devel/python/python/ert_gui/pages/config/ensemble.py index ba40fec8f1..07cdf0a760 100644 --- a/ThirdParty/Ert/devel/libenkf/applications/ert_gui/lib/ert_gui/pages/config/ensemble.py +++ b/ThirdParty/Ert/devel/python/python/ert_gui/pages/config/ensemble.py @@ -18,21 +18,23 @@ # ---------------------------------------------------------------------------------------------- # Ensemble tab # ---------------------------------------------------------------------------------------------- -from PyQt4 import QtGui, QtCore +from PyQt4 import QtCore from ert_gui.widgets.spinnerwidgets import IntegerSpinner -from parameters.parameterpanel import ParameterPanel, enums +from parameters.parameterpanel import ParameterPanel from parameters.parametermodels import SummaryModel, DataModel, FieldModel, KeywordModel -from ert.ert.enums import field_type -from ert.ert.enums import truncation_type -from ert.ert.enums import gen_data_file_format +import ert.ert.enums as enums +import ert.enkf.enkf_config_node +import ert.enkf.gen_kw_config +import ert.enkf.gen_data_config def createEnsemblePage(configPanel, parent): configPanel.startPage("Ensemble") r = configPanel.addRow(IntegerSpinner(parent, "Number of realizations", "config/ensemble/num_realizations", 1, 10000)) - r.getter = lambda ert : ert.enkf.enkf_main_get_ensemble_size(ert.main) - r.setter = lambda ert, value : ert.enkf.enkf_main_resize_ensemble(ert.main, value) + r.initialize = lambda ert : ert.main.ens_size + r.getter = lambda ert : ert.main.ens_size + r.setter = lambda ert, value : ert.main.resize_ensemble( value) parent.connect(r, QtCore.SIGNAL("contentsChanged()"), lambda : r.modelEmit("ensembleResized()")) @@ -41,52 +43,52 @@ def createEnsemblePage(configPanel, parent): r = configPanel.addRow(ParameterPanel(parent, "", "")) # no help file necessary parent.connect(r, QtCore.SIGNAL("contentsChanged()"), lambda : r.modelEmit("ensembleUpdated()")) + def getEnsembleParameters(ert): - keys = ert.getStringList(ert.enkf.ensemble_config_alloc_keylist(ert.ensemble_config), free_after_use=True) + keys = ert.main.ensemble_config.alloc_keylist parameters = [] for key in keys: - node = ert.enkf.ensemble_config_get_node(ert.ensemble_config, key) - type = ert.enkf.enkf_config_node_get_impl_type(node) - data = ert.enkf.enkf_config_node_get_ref(node) - #print key, type + node = ert.main.ensemble_config.get_node( key) + type = node.get_impl_type + data = node.get_ref model = None if type == FieldModel.TYPE: model = FieldModel(key) - field_type = ert.enkf.field_config_get_type(data) + field_type = node.field_model.get_type field_type = enums.field_type[field_type] model["type"] = field_type - truncation = ert.enkf.field_config_get_truncation_mode(data) + truncation = node.field_model.get_truncation_mode if truncation & enums.truncation_type.TRUNCATE_MAX: - model["max"] = ert.enkf.field_config_get_truncation_max(data) + model["max"] = node.field_model.get_truncation_max if truncation & enums.truncation_type.TRUNCATE_MIN: - model["min"] = ert.enkf.field_config_get_truncation_min(data) + model["min"] = node.field_model.get_truncation_min - model["init"] = ert.enkf.field_config_get_init_transform_name(data) - model["output"] = ert.enkf.field_config_get_output_transform_name(data) + model["init"] = node.field_model.get_init_transform_name + model["output"] = node.field_model.get_output_transform_name - model["init_files"] = ert.enkf.field_config_get_init_file_fmt(data) - model["min_std"] = ert.enkf.enkf_config_node_get_min_std_file(node) - model["enkf_outfile"] = ert.enkf.enkf_config_node_get_enkf_outfile(node) - model["enkf_infile"] = ert.enkf.enkf_config_node_get_enkf_infile(node) + model["init_files"] = node.get_init_file_fmt + model["min_std"] = node.get_min_std_file + model["enkf_outfile"] = node.get_enkf_outfile + model["enkf_infile"] = node.get_enkf_infile elif type == DataModel.TYPE: model = DataModel(key) - output_format_value = ert.enkf.gen_data_config_get_output_format(data) + output_format_value = node.data_model.get_output_format output_format = gen_data_file_format.resolveValue(output_format_value) - input_format_value = ert.enkf.gen_data_config_get_input_format(data) + input_format_value = node.data_model.get_input_format input_format = gen_data_file_format.resolveValue(input_format_value) - template_file = ert.enkf.gen_data_config_get_template_file(data) - template_key = ert.enkf.gen_data_config_get_template_key(data) - init_file_fmt = ert.enkf.gen_data_config_get_init_file_fmt(data) + template_file = node.data_model.get_template_file + template_key = node.data_model.get_template_key + init_file_fmt = node.get_init_file_fmt model["output_format"] = output_format model["input_format"] = input_format @@ -94,9 +96,9 @@ def createEnsemblePage(configPanel, parent): model["template_key"] = template_key model["init_file_fmt"] = init_file_fmt - min_std = ert.enkf.enkf_config_node_get_min_std_file(node) - enkf_outfile = ert.enkf.enkf_config_node_get_enkf_outfile(node) - enkf_infile = ert.enkf.enkf_config_node_get_enkf_infile(node) + min_std = node.get_min_std_file + enkf_outfile = node.get_enkf_outfile + enkf_infile = node.get_enkf_infile @@ -106,40 +108,40 @@ def createEnsemblePage(configPanel, parent): elif type == KeywordModel.TYPE: model = KeywordModel(key) - model["min_std"] = ert.enkf.enkf_config_node_get_min_std_file(node) - model["enkf_outfile"] = ert.enkf.enkf_config_node_get_enkf_outfile(node) - model["template"] = ert.enkf.gen_kw_config_get_template_file(data) - model["init_file"] = ert.enkf.gen_kw_config_get_init_file_fmt(data) - model["parameter_file"] = ert.enkf.gen_kw_config_get_parameter_file(data) + model["min_std"] = node.get_min_std_file + model["enkf_outfile"] = node.get_enkf_outfile + model["template"] = node.keyword_model.get_template_file + model["init_file"] = node.get_init_file_fmt + model["parameter_file"] = node.keyword_model.get_parameter_file elif type == SummaryModel.TYPE: model = SummaryModel(key) else: pass #Unknown type - model.setValid(ert.enkf.enkf_config_node_is_valid(node)) + #model.setValid(ert.main.enkf_config_node.is_valid) parameters.append(model) return parameters def removeParameter(ert, parameter_key): - ert.enkf.enkf_main_del_node(ert.main, parameter_key) + ert.main.del_node(ert.main, parameter_key) def insertParameter(ert, parameter): key = parameter.getName() if parameter.getType() == FieldModel.TYPE: - grid = ert.enkf.ecl_config_get_grid(ert.ecl_config) - node = ert.enkf.ensemble_config_add_field(ert.ensemble_config, key, grid) - parameter.setValid(ert.enkf.enkf_config_node_is_valid(node)) + grid = ert.main.ecl_config.get_grid + node = ert.main.ensemble_config.add_field( key, grid) + parameter.setValid(ert.main.enkf_config_node.is_valid) elif parameter.getType() == DataModel.TYPE: - node = ert.enkf.ensemble_config_add_gen_data(ert.ensemble_config, key) - parameter.setValid(ert.enkf.enkf_config_node_is_valid(node)) + node = ert.main.ensemble_config.add_gen_data( key) + parameter.setValid(ert.main.enkf_config_node.is_valid) elif parameter.getType() == KeywordModel.TYPE: - node = ert.enkf.ensemble_config_add_gen_kw(ert.ensemble_config, key) - parameter.setValid(ert.enkf.enkf_config_node_is_valid(node)) + node = ert.main.ensemble_config.add_gen_kw( key) + parameter.setValid(ert.main.enkf_config_node.is_valid) elif parameter.getType() == SummaryModel.TYPE: parameter.setValid(True) - b = ert.enkf.ensemble_config_add_summary(ert.ensemble_config, key) + b = ert.main.ensemble_config.add_summary( key) return b > 0 #0 == NULL else: print "Unknown type: ", parameter @@ -149,7 +151,7 @@ def createEnsemblePage(configPanel, parent): def updateParameter(ert, parameter_model): key = parameter_model.getName() - node = ert.enkf.ensemble_config_get_node(ert.ensemble_config, key) + node = ert.main.ensemble_config.get_node( key) if isinstance(parameter_model, FieldModel): type = parameter_model["type"] @@ -165,12 +167,12 @@ def createEnsemblePage(configPanel, parent): maximum = 0.0 if type == field_type.ECLIPSE_RESTART: #dynamic - ert.enkf.enkf_config_node_update_state_field(node, + ert.main.enkf_config_node.update_state_field(node, truncate.value(), float(minimum), float(maximum)) elif type == field_type.ECLIPSE_PARAMETER: #parameter - ert.enkf.enkf_config_node_update_parameter_field(node, + ert.main.enkf_config_node.update_parameter_field(node, ert.nonify(parameter_model["enkf_outfile"]), ert.nonify(parameter_model["init_files"]), ert.nonify(parameter_model["min_std"]), @@ -180,7 +182,7 @@ def createEnsemblePage(configPanel, parent): parameter_model["init"], parameter_model["output"]) elif type == field_type.GENERAL: #general - ert.enkf.enkf_config_node_update_general_field(node, + ert.main.enkf_config_node.update_general_field(node, ert.nonify(parameter_model["enkf_outfile"]), ert.nonify(parameter_model["enkf_infile"]), ert.nonify(parameter_model["init_files"]), @@ -192,7 +194,7 @@ def createEnsemblePage(configPanel, parent): None, parameter_model["output"]) - parameter_model.setValid(ert.enkf.enkf_config_node_is_valid(node)) + parameter_model.setValid(ert.main.enkf_config_node.is_valid) elif isinstance(parameter_model, KeywordModel): enkf_outfile_fmt = parameter_model["enkf_outfile"] @@ -200,20 +202,20 @@ def createEnsemblePage(configPanel, parent): parameter_file = parameter_model["parameter_file"] min_std_file = parameter_model["min_std"] init_file_fmt = parameter_model["init_files"] - ert.enkf.enkf_config_node_update_gen_kw(node, + ert.main.enkf_config_node.update_gen_kw(node, ert.nonify(enkf_outfile_fmt), ert.nonify(template_file), ert.nonify(parameter_file), ert.nonify(min_std_file), ert.nonify(init_file_fmt)) - parameter_model.setValid(ert.enkf.enkf_config_node_is_valid(node)) + parameter_model.setValid(ert.main.enkf_config_node.is_valid) elif isinstance(parameter_model, SummaryModel): #should never be called from SummaryModel... raise AssertionError("Summary keys can not be updated!") elif isinstance(parameter_model, DataModel): input_format = gen_data_file_format.resolveName(str(parameter_model["input_format"])) output_format = gen_data_file_format.resolveName(str(parameter_model["output_format"])) - ert.enkf.enkf_config_node_update_gen_data(node, + ert.main.enkf_config_node.update_gen_data(node, input_format.value(), output_format.value(), ert.nonify(parameter_model["init_file_fmt"]), @@ -222,17 +224,18 @@ def createEnsemblePage(configPanel, parent): ert.nonify(parameter_model["enkf_outfile"]), ert.nonify(parameter_model["enkf_infile"]), ert.nonify(parameter_model["min_std"])) - parameter_model.setValid(ert.enkf.enkf_config_node_is_valid(node)) + parameter_model.setValid(ert.main.enkf_config_node.is_valid) else: raise AssertionError("Type is not supported: %s" % (parameter_model.__class__)) - if ert.enkf.enkf_config_node_is_valid(node): - ert.enkf.enkf_main_update_node( ert.main , key ) + if ert.main.enkf_config_node.is_valid: + ert.main.update_node( ert.main , key ) r.getter = getEnsembleParameters + r.initialize = getEnsembleParameters r.remove = removeParameter r.insert = insertParameter r.setter = updateParameter diff --git a/ThirdParty/Ert/devel/python/python/ert_gui/pages/config/jobs/CMakeLists.txt b/ThirdParty/Ert/devel/python/python/ert_gui/pages/config/jobs/CMakeLists.txt new file mode 100644 index 0000000000..6eda67f87d --- /dev/null +++ b/ThirdParty/Ert/devel/python/python/ert_gui/pages/config/jobs/CMakeLists.txt @@ -0,0 +1 @@ +add_python_package( "Python ert_gui.pages.config.jobs" ${PYTHON_INSTALL_PREFIX}/ert_gui/pages/config/jobs "__init__.py;forwardmodelpanel.py;jobsdialog.py;jobspanel.py" True) diff --git a/ThirdParty/Ert/devel/libenkf/applications/ert_gui/lib/ert_gui/pages/config/jobs/__init__.py b/ThirdParty/Ert/devel/python/python/ert_gui/pages/config/jobs/__init__.py similarity index 100% rename from ThirdParty/Ert/devel/libenkf/applications/ert_gui/lib/ert_gui/pages/config/jobs/__init__.py rename to ThirdParty/Ert/devel/python/python/ert_gui/pages/config/jobs/__init__.py diff --git a/ThirdParty/Ert/devel/libenkf/applications/ert_gui/lib/ert_gui/pages/config/jobs/forwardmodelpanel.py b/ThirdParty/Ert/devel/python/python/ert_gui/pages/config/jobs/forwardmodelpanel.py similarity index 97% rename from ThirdParty/Ert/devel/libenkf/applications/ert_gui/lib/ert_gui/pages/config/jobs/forwardmodelpanel.py rename to ThirdParty/Ert/devel/python/python/ert_gui/pages/config/jobs/forwardmodelpanel.py index ffb35bfd55..bdab0fa371 100644 --- a/ThirdParty/Ert/devel/libenkf/applications/ert_gui/lib/ert_gui/pages/config/jobs/forwardmodelpanel.py +++ b/ThirdParty/Ert/devel/python/python/ert_gui/pages/config/jobs/forwardmodelpanel.py @@ -52,11 +52,10 @@ class ForwardModelPanel(HelpedWidget): def createWidgets(self, parent): self.searchableList = SearchableList(parent, list_height=150, list_width=150, ignore_case=True, order_editable=True) self.addWidget(self.searchableList) - self.connect(self.searchableList, QtCore.SIGNAL('currentItemChanged(QListWidgetItem, QListWidgetItem)'), - self.changeParameter) - self.connect(self.searchableList, QtCore.SIGNAL('addItem(list)'), self.addItem) - self.connect(self.searchableList, QtCore.SIGNAL('removeItem(list)'), self.removeItem) - self.connect(self.searchableList, QtCore.SIGNAL('orderChanged(list)'), self.forwardModelChanged) + self.connect(self.searchableList, QtCore.SIGNAL('currentItemChanged(QListWidgetItem, QListWidgetItem)'),self.changeParameter) + self.connect(self.searchableList, QtCore.SIGNAL('addItem(QListWidgetItem)'), self.addItem) + self.connect(self.searchableList, QtCore.SIGNAL('removeItem(QListWidgetItem)'), self.removeItem) + self.connect(self.searchableList, QtCore.SIGNAL('orderChanged(QListWidgetItem)'), self.forwardModelChanged) self.forward_model_panel = ert_gui.widgets.util.createEmptyPanel() diff --git a/ThirdParty/Ert/devel/libenkf/applications/ert_gui/lib/ert_gui/pages/config/jobs/jobsdialog.py b/ThirdParty/Ert/devel/python/python/ert_gui/pages/config/jobs/jobsdialog.py similarity index 67% rename from ThirdParty/Ert/devel/libenkf/applications/ert_gui/lib/ert_gui/pages/config/jobs/jobsdialog.py rename to ThirdParty/Ert/devel/python/python/ert_gui/pages/config/jobs/jobsdialog.py index 468009b714..df006158d6 100644 --- a/ThirdParty/Ert/devel/libenkf/applications/ert_gui/lib/ert_gui/pages/config/jobs/jobsdialog.py +++ b/ThirdParty/Ert/devel/python/python/ert_gui/pages/config/jobs/jobsdialog.py @@ -87,53 +87,124 @@ class JobConfigPanel(ConfigPanel): def jid(ert): """Returns the pointer to the current job (self.job)""" - jl = ert.enkf.site_config_get_installed_jobs(ert.site_config) - return ert.job_queue.ext_joblist_get_job(jl, self.job.name) + jl = ert.main.site_config.get_installed_jobs + return jl.get_job(self.job.name) + def set_stdin(ert,value): + job = jid(ert) + job.set_stdin_file(value) + + def get_stdin(ert): + job = jid(ert) + return job.get_stdin_file + self.stdin = PathChooser(self, "", "config/systemenv/install_job_stdin", show_files=True, must_be_set=False, must_exist=True) - self.stdin.setter = lambda ert, value : ert.job_queue.ext_job_set_stdin_file(jid(ert), value) - self.stdin.getter = lambda ert : ert.job_queue.ext_job_get_stdin_file(jid(ert)) + self.stdin.setter = set_stdin + self.stdin.getter = get_stdin + self.stdin.initialize =get_stdin + def set_stdout(ert,value): + job = jid(ert) + job.set_stdout_file(value) + + def get_stdout(ert): + job = jid(ert) + return job.get_stdout_file + self.stdout = PathChooser(self, "", "config/systemenv/install_job_stdout", show_files=True, must_be_set=True, must_exist=False) - self.stdout.setter = lambda ert, value : ert.job_queue.ext_job_set_stdout_file(jid(ert), value) - self.stdout.getter = lambda ert : ert.job_queue.ext_job_get_stdout_file(jid(ert)) + self.stdout.setter = set_stdout + self.stdout.getter = get_stdout + self.stdout.initialize = get_stdout + def set_stderr(ert,value): + job = jid(ert) + job.set_stderr_file(value) + + def get_stderr(ert): + job = jid(ert) + return job.get_stderr_file + self.stderr = PathChooser(self, "", "config/systemenv/install_job_stderr", show_files=True, must_be_set=True, must_exist=False) - self.stderr.setter = lambda ert, value : ert.job_queue.ext_job_set_stderr_file(jid(ert), value) - self.stderr.getter = lambda ert : ert.job_queue.ext_job_get_stderr_file(jid(ert)) + self.stderr.setter = set_stderr + self.stderr.getter = get_stderr + self.stderr.initialize = get_stderr - self.target_file = PathChooser(self, "", "config/systemenv/install_job_target_file", show_files=True, must_be_set=False, - must_exist=False) - self.target_file.setter = lambda ert, value : ert.job_queue.ext_job_set_target_file(jid(ert), value) - self.target_file.getter = lambda ert : ert.job_queue.ext_job_get_target_file(jid(ert)) + def set_target_file(ert,value): + job = jid(ert) + job.set_target_file(value) + def get_target_file(ert): + job = jid(ert) + return job.get_target_file + + self.target_file = PathChooser(self, "", "config/systemenv/install_job_target_file", show_files=True, must_be_set=False, must_exist=False) + self.target_file.setter = set_target_file + self.target_file.getter = get_target_file + self.target_file.initialize = get_target_file + + def set_executable(ert,value): + job = jid(ert) + job.set_executable(value) + + def get_executable(ert): + job = jid(ert) + return job.get_executable + self.executable = PathChooser(self, "", "config/systemenv/install_job_executable", show_files=True, must_be_set=True, must_exist=True, is_executable_file=True) - self.executable.setter = lambda ert, value : ert.job_queue.ext_job_set_executable(jid(ert), value) - self.executable.getter = lambda ert : ert.job_queue.ext_job_get_executable(jid(ert)) + self.executable.setter = set_executable + self.executable.getter = get_executable def setEnv(ert, value): job = jid(ert) - ert.job_queue.ext_job_clear_environment(job) + job.clear_environment for env in value: - ert.job_queue.ext_job_add_environment(job, env[0], env[1]) + job.set_environment(env[0], env[1]) + + def getEnv(ert): + job = jid(ert) + return ert.getHash(job.get_environment) self.env = KeywordTable(self, "", "config/systemenv/install_job_env", colHead1="Variable", colHead2="Value") self.env.setter = setEnv - self.env.getter = lambda ert : ert.getHash(ert.job_queue.ext_job_get_environment(jid(ert))) + self.env.getter = getEnv + + def set_arglist(ert,value): + job = jid(ert) + job.set_private_args_from_string(value) + + def get_arglist(ert): + job = jid(ert) + return job.get_private_args_as_string self.arglist = StringBox(self, "", "config/systemenv/install_job_arglist") - self.arglist.setter = lambda ert, value : ert.job_queue.ext_job_set_private_args_from_string(jid(ert), value) - self.arglist.getter = lambda ert : ert.job_queue.ext_job_get_private_args_as_string(jid(ert)) + self.arglist.setter = set_arglist + self.arglist.getter = get_arglist + def set_max_running(ert,value): + job = jid(ert) + job.set_max_running(value) + + def get_max_running(ert): + job = jid(ert) + return job.get_max_running + self.max_running = IntegerSpinner(self, "", "config/systemenv/install_job_max_running", 0, 10000) - self.max_running.setter = lambda ert, value : ert.job_queue.ext_job_set_max_running(jid(ert), value) - self.max_running.getter = lambda ert : ert.job_queue.ext_job_get_max_running(jid(ert)) + self.max_running.setter = set_max_running + self.max_running.getter = get_max_running + def set_max_running_minutes(ert,value): + job = jid(ert) + job.set_max_running_minutes(value) + + def get_max_running(ert): + job = jid(ert) + return job.get_max_running_minutes + self.max_running_minutes = IntegerSpinner(self, "", "config/systemenv/install_job_max_running_minutes", 0, 10000) - self.max_running_minutes.setter = lambda ert, value : ert.job_queue.ext_job_set_max_running_minutes(jid(ert), value) - self.max_running_minutes.getter = lambda ert : ert.job_queue.ext_job_get_max_running_minutes(jid(ert)) + self.max_running_minutes.setter = set_max_running_minutes + self.max_running_minutes.getter = get_max_running_minutes self.startPage("Standard") diff --git a/ThirdParty/Ert/devel/libenkf/applications/ert_gui/lib/ert_gui/pages/config/jobs/jobspanel.py b/ThirdParty/Ert/devel/python/python/ert_gui/pages/config/jobs/jobspanel.py similarity index 94% rename from ThirdParty/Ert/devel/libenkf/applications/ert_gui/lib/ert_gui/pages/config/jobs/jobspanel.py rename to ThirdParty/Ert/devel/python/python/ert_gui/pages/config/jobs/jobspanel.py index 1fd7421fb7..18f4681a10 100644 --- a/ThirdParty/Ert/devel/libenkf/applications/ert_gui/lib/ert_gui/pages/config/jobs/jobspanel.py +++ b/ThirdParty/Ert/devel/python/python/ert_gui/pages/config/jobs/jobspanel.py @@ -49,10 +49,9 @@ class JobsPanel(HelpedWidget): def createWidgets(self, parent): self.searchableList = SearchableList(parent, list_height=200, list_width=150, ignore_case=True) self.addWidget(self.searchableList) - self.connect(self.searchableList, QtCore.SIGNAL('currentItemChanged(QListWidgetItem, QListWidgetItem)'), - self.changeParameter) - self.connect(self.searchableList, QtCore.SIGNAL('addItem(list)'), self.addItem) - self.connect(self.searchableList, QtCore.SIGNAL('removeItem(list)'), self.removeItem) + self.connect(self.searchableList , QtCore.SIGNAL('currentItemChanged(QListWidgetItem, QListWidgetItem)'),self.changeParameter) + self.connect(self.searchableList , QtCore.SIGNAL('addItem(QListWidgetItem)'), self.addItem) + self.connect(self.searchableList , QtCore.SIGNAL('removeItem(QListWidgetItem)'), self.removeItem) self.jobPanel = ert_gui.widgets.util.createEmptyPanel() diff --git a/ThirdParty/Ert/devel/libenkf/applications/ert_gui/lib/ert_gui/pages/config/observations.py b/ThirdParty/Ert/devel/python/python/ert_gui/pages/config/observations.py similarity index 63% rename from ThirdParty/Ert/devel/libenkf/applications/ert_gui/lib/ert_gui/pages/config/observations.py rename to ThirdParty/Ert/devel/python/python/ert_gui/pages/config/observations.py index e7f0609726..b32de5adc4 100644 --- a/ThirdParty/Ert/devel/libenkf/applications/ert_gui/lib/ert_gui/pages/config/observations.py +++ b/ThirdParty/Ert/devel/python/python/ert_gui/pages/config/observations.py @@ -22,6 +22,7 @@ from ert_gui.widgets.combochoice import ComboChoice from ert_gui.widgets.pathchooser import PathChooser from ert.ert.enums import history_source_type from ert_gui.widgets.reloadbutton import ReloadButton +from ert.sched.history import HistoryType def createObservationsPage(configPanel, parent): configPanel.startPage("Observations") @@ -29,14 +30,23 @@ def createObservationsPage(configPanel, parent): r = configPanel.addRow(ComboChoice(parent, history_source_type.values(), "History source", "config/observations/history_source")) def get_history_source(ert): - history_source = ert.enkf.model_config_get_history_source(ert.model_config) - return history_source_type.resolveValue(history_source) + history_source = ert.main.model_config.get_history_source + return history_source_type.resolveValue(history_source.get_source_string) + r.initialize = get_history_source r.getter = get_history_source def set_history_source(ert, value): - history_source = history_source_type.resolveName(str(value)) - ert.enkf.model_config_get_history_source(ert.model_config, history_source.value()) + history_source_enum = history_source_type.resolveName(str(value)) + sched_file = ert.main.ecl_config.get_sched_file + refcase = ert.main.ecl_config.get_refcase + if history_source_enum.value() == 0: + history = HistoryType.alloc_from_sched_file(sched_file) + if history_source_enum.value() == 1: + history = HistoryType.alloc_from_refcase(refcase, True) + if history_source_enum.value() == 2: + history = HistoryType.alloc_from_refcase(refcase, False) + ert.main.model_config.set_history_source(history, sched_file, refcase) r.setter = set_history_source @@ -44,19 +54,21 @@ def createObservationsPage(configPanel, parent): r = configPanel.addRow(PathChooser(parent, "Observations config", "config/observations/obs_config", True)) def get_obs(ert): - obs = ert.enkf.enkf_main_get_obs(ert.main) - return ert.enkf.enkf_obs_get_config_file(obs) + obs = ert.main.get_obs + return obs.get_config_file + r.initialize = get_obs r.getter = get_obs def set_obs(ert, value): - ert.enkf.enkf_main_load_obs(ert.main, str(value)) + ert.main.load_obs( str(value)) r.setter = set_obs r = configPanel.addRow(ReloadButton(parent, "Reload Observations", "config/observations/reload_observation", "Reload")) - r.getter = lambda ert : ert.enkf.enkf_main_reload_obs(ert.main) + r.initialize = lambda ert : ert.main.reload_obs + r.getter = lambda ert : ert.main.reload_obs configPanel.endPage() diff --git a/ThirdParty/Ert/devel/python/python/ert_gui/pages/config/parameters/CMakeLists.txt b/ThirdParty/Ert/devel/python/python/ert_gui/pages/config/parameters/CMakeLists.txt new file mode 100644 index 0000000000..0d5db1aa04 --- /dev/null +++ b/ThirdParty/Ert/devel/python/python/ert_gui/pages/config/parameters/CMakeLists.txt @@ -0,0 +1 @@ +add_python_package( "Python ert_gui.pages.config.parameters" ${PYTHON_INSTALL_PREFIX}/ert_gui/pages/config/parameters "__init__.py;datapanel.py;fieldpanel.py;keywordpanel.py;parameterdialog.py;parametermodels.py;parameterpanel.py" True) diff --git a/ThirdParty/Ert/devel/libenkf/applications/ert_gui/lib/ert_gui/pages/config/parameters/__init__.py b/ThirdParty/Ert/devel/python/python/ert_gui/pages/config/parameters/__init__.py similarity index 100% rename from ThirdParty/Ert/devel/libenkf/applications/ert_gui/lib/ert_gui/pages/config/parameters/__init__.py rename to ThirdParty/Ert/devel/python/python/ert_gui/pages/config/parameters/__init__.py diff --git a/ThirdParty/Ert/devel/libenkf/applications/ert_gui/lib/ert_gui/pages/config/parameters/datapanel.py b/ThirdParty/Ert/devel/python/python/ert_gui/pages/config/parameters/datapanel.py similarity index 100% rename from ThirdParty/Ert/devel/libenkf/applications/ert_gui/lib/ert_gui/pages/config/parameters/datapanel.py rename to ThirdParty/Ert/devel/python/python/ert_gui/pages/config/parameters/datapanel.py diff --git a/ThirdParty/Ert/devel/libenkf/applications/ert_gui/lib/ert_gui/pages/config/parameters/fieldpanel.py b/ThirdParty/Ert/devel/python/python/ert_gui/pages/config/parameters/fieldpanel.py similarity index 93% rename from ThirdParty/Ert/devel/libenkf/applications/ert_gui/lib/ert_gui/pages/config/parameters/fieldpanel.py rename to ThirdParty/Ert/devel/python/python/ert_gui/pages/config/parameters/fieldpanel.py index 6120bc5575..978245006a 100644 --- a/ThirdParty/Ert/devel/libenkf/applications/ert_gui/lib/ert_gui/pages/config/parameters/fieldpanel.py +++ b/ThirdParty/Ert/devel/python/python/ert_gui/pages/config/parameters/fieldpanel.py @@ -48,10 +48,10 @@ class FieldPanel(QtGui.QFrame): self.max = DoubleBox(self, "", "config/ensemble/field_max") self.modelWrap(self.max, "max") - self.init = ComboChoice(self, ["None", "EXP", "LOG", "POW10", "ADD", "MUL", "RANDINT", "RANDFLOAT"], "", "config/ensemble/field_init") + self.init = ComboChoice(self, ["None", "EXP", "EXP0", "LOG", "LN","LN0", "POW10", "ADD", "MUL", "RANDINT", "RANDFLOAT"], "", "config/ensemble/field_init") self.modelWrap(self.init, "init") - self.output = ComboChoice(self, ["None", "EXP", "LOG", "POW10", "ADD", "MUL", "RANDINT", "RANDFLOAT"], "", "config/ensemble/field_output") + self.output = ComboChoice(self, ["None", "EXP", "EXP0", "LOG", "LN","LN0", "POW10", "ADD", "MUL", "RANDINT", "RANDFLOAT"], "", "config/ensemble/field_output") self.modelWrap(self.output, "output") self.init_files = PathChooser(self, "", "config/ensemble/field_init_files", True) diff --git a/ThirdParty/Ert/devel/libenkf/applications/ert_gui/lib/ert_gui/pages/config/parameters/keywordpanel.py b/ThirdParty/Ert/devel/python/python/ert_gui/pages/config/parameters/keywordpanel.py similarity index 100% rename from ThirdParty/Ert/devel/libenkf/applications/ert_gui/lib/ert_gui/pages/config/parameters/keywordpanel.py rename to ThirdParty/Ert/devel/python/python/ert_gui/pages/config/parameters/keywordpanel.py diff --git a/ThirdParty/Ert/devel/libenkf/applications/ert_gui/lib/ert_gui/pages/config/parameters/parameterdialog.py b/ThirdParty/Ert/devel/python/python/ert_gui/pages/config/parameters/parameterdialog.py similarity index 100% rename from ThirdParty/Ert/devel/libenkf/applications/ert_gui/lib/ert_gui/pages/config/parameters/parameterdialog.py rename to ThirdParty/Ert/devel/python/python/ert_gui/pages/config/parameters/parameterdialog.py diff --git a/ThirdParty/Ert/devel/libenkf/applications/ert_gui/lib/ert_gui/pages/config/parameters/parametermodels.py b/ThirdParty/Ert/devel/python/python/ert_gui/pages/config/parameters/parametermodels.py similarity index 100% rename from ThirdParty/Ert/devel/libenkf/applications/ert_gui/lib/ert_gui/pages/config/parameters/parametermodels.py rename to ThirdParty/Ert/devel/python/python/ert_gui/pages/config/parameters/parametermodels.py diff --git a/ThirdParty/Ert/devel/libenkf/applications/ert_gui/lib/ert_gui/pages/config/parameters/parameterpanel.py b/ThirdParty/Ert/devel/python/python/ert_gui/pages/config/parameters/parameterpanel.py similarity index 89% rename from ThirdParty/Ert/devel/libenkf/applications/ert_gui/lib/ert_gui/pages/config/parameters/parameterpanel.py rename to ThirdParty/Ert/devel/python/python/ert_gui/pages/config/parameters/parameterpanel.py index 9fb8dd15eb..46a27fc694 100644 --- a/ThirdParty/Ert/devel/libenkf/applications/ert_gui/lib/ert_gui/pages/config/parameters/parameterpanel.py +++ b/ThirdParty/Ert/devel/python/python/ert_gui/pages/config/parameters/parameterpanel.py @@ -32,6 +32,7 @@ import ert_gui.widgets.util from parametermodels import SummaryModel, FieldModel, DataModel, KeywordModel from PyQt4.QtCore import SIGNAL + class ParameterPanel(HelpedWidget): """Shows a widget for parameters. The data structure expected and sent to the getter and setter is an array of Parameters.""" @@ -59,8 +60,8 @@ class ParameterPanel(HelpedWidget): self.addWidget(self.pagesWidget) self.connect(self.searchableList, QtCore.SIGNAL('currentItemChanged(QListWidgetItem, QListWidgetItem)'), self.changeParameter) - self.connect(self.searchableList, QtCore.SIGNAL('addItem(list)'), self.addItem) - self.connect(self.searchableList, QtCore.SIGNAL('removeItem(list)'), self.removeItem) + self.connect(self.searchableList, QtCore.SIGNAL('addItem(QListWidgetItem)'), self.addItem) + self.connect(self.searchableList, QtCore.SIGNAL('removeItem(QListWidgetItem)'), self.removeItem) #self.addHelpButton() @@ -110,7 +111,7 @@ class ParameterPanel(HelpedWidget): list.setCurrentItem(parameter) user_data = parameter.getUserData() - self.connect(user_data, SIGNAL('modelChanged(Model)'), self.modelChanged) + ##self.connect(user_data, SIGNAL('modelChanged(Model)'), self.modelChanged) def modelChanged(self, parameter_model): """Called whenever the content of a model changes""" @@ -123,7 +124,7 @@ class ParameterPanel(HelpedWidget): for index in range(list.count()): uniqueNames.append(str(list.item(index).text())) - pd = ParameterDialog(self, Parameter.typeIcons, uniqueNames) + pd = ParameterDialog(self, Parameter.get_typeIcons() , uniqueNames) if pd.exec_(): parameter = self.createParameter(pd.getTypeName(), pd.getName()) ok = self.updateContent(parameter, operation=ContentModel.INSERT) @@ -154,7 +155,9 @@ class ParameterPanel(HelpedWidget): for parameter in parameters: if parameter is None: - raise AssertionError("Unknown type name!") + sys.stderr.write("Unknown type name!\n") + break + #raise AssertionError("Unknown type name!") param = Parameter(parameter.name, parameter.TYPE) param.setUserData(parameter) @@ -166,54 +169,65 @@ class ParameterPanel(HelpedWidget): self.searchableList.getList().setCurrentRow(0) + class Parameter(QtGui.QListWidgetItem): """ListWidgetItem class that represents a Parameter with an associated icon.""" - typeIcons = {FieldModel.TYPE: util.resourceIcon("grid_16"), - DataModel.TYPE: util.resourceIcon("data"), - SummaryModel.TYPE: util.resourceIcon("summary"), - KeywordModel.TYPE: util.resourceIcon("key")} + + typeIcons__ = None + + @classmethod + def get_typeIcons(cls): + if cls.typeIcons__ is None: + typeIcons__ = {FieldModel.TYPE: util.resourceIcon("grid_16"), + DataModel.TYPE: util.resourceIcon("data"), + SummaryModel.TYPE: util.resourceIcon("summary"), + KeywordModel.TYPE: util.resourceIcon("key")} + return typeIcons__ + def __init__(self, name, type, icon=None): if icon is None: - icon = Parameter.typeIcons[type] - + icon = Parameter.get_typeIcons()[type] + QtGui.QListWidgetItem.__init__(self, icon, name) self.type = type self.name = name self.user_data = None self.setValid(True) - + def getType(self): """Retruns the type of this parameter""" return self.type - + def getName(self): """Returns the name of this parameter (keyword)""" return self.name - + def __ge__(self, other): if self.type.name == other.type.name: return self.name.lower() >= other.name.lower() else: return self.type.name >= other.type.name - + def __lt__(self, other): return not self >= other - + def setUserData(self, data): """Set user data for this parameter.""" self.user_data = data - + def getUserData(self): """Retrieve the user data.""" return self.user_data - + def setValid(self, valid): """Set the validity of this item. An invalid item is colored red""" self.valid = valid - + if valid: self.setBackgroundColor(QtCore.Qt.white) else: self.setBackgroundColor(HelpedWidget.STRONG_ERROR_COLOR) + + diff --git a/ThirdParty/Ert/devel/libenkf/applications/ert_gui/lib/ert_gui/pages/config/plot.py b/ThirdParty/Ert/devel/python/python/ert_gui/pages/config/plot.py similarity index 56% rename from ThirdParty/Ert/devel/libenkf/applications/ert_gui/lib/ert_gui/pages/config/plot.py rename to ThirdParty/Ert/devel/python/python/ert_gui/pages/config/plot.py index 268e8d4391..aa670fd133 100644 --- a/ThirdParty/Ert/devel/libenkf/applications/ert_gui/lib/ert_gui/pages/config/plot.py +++ b/ThirdParty/Ert/devel/python/python/ert_gui/pages/config/plot.py @@ -27,32 +27,39 @@ def createPlotPage(configPanel, parent): configPanel.startPage("Plot") r = configPanel.addRow(PathChooser(parent, "Output path", "config/plot/path")) - r.getter = lambda ert : ert.enkf.plot_config_get_path(ert.plot_config) - r.setter = lambda ert, value : ert.enkf.plot_config_set_path(ert.plot_config, str(value)) + r.initialize = lambda ert : ert.main.plot_config.get_path + r.getter = lambda ert : ert.main.plot_config.get_path + r.setter = lambda ert, value : ert.main.plot_config.set_path( str(value)) r = configPanel.addRow(ComboChoice(parent, ["PLPLOT", "TEXT"], "Driver", "config/plot/plot_driver")) - r.getter = lambda ert : ert.enkf.plot_config_get_driver(ert.plot_config) - r.setter = lambda ert, value : ert.enkf.plot_config_set_driver(ert.plot_config, str(value)) + r.initialize = lambda ert : ert.main.plot_config.get_driver + r.getter = lambda ert : ert.main.plot_config.get_driver + r.setter = lambda ert, value : ert.main.plot_config.set_driver( str(value)) r = configPanel.addRow(IntegerSpinner(parent, "Errorbar max", "config/plot/plot_errorbar_max", 1, 10000000)) - r.getter = lambda ert : ert.enkf.plot_config_get_errorbar_max(ert.plot_config) - r.setter = lambda ert, value : ert.enkf.plot_config_set_errorbar_max(ert.plot_config, value) + r.initialize = lambda ert : ert.main.plot_config.get_errorbar_max + r.getter = lambda ert : ert.main.plot_config.get_errorbar_max + r.setter = lambda ert, value : ert.main.plot_config.set_errorbar_max( value) r = configPanel.addRow(IntegerSpinner(parent, "Width", "config/plot/width", 1, 10000)) - r.getter = lambda ert : ert.enkf.plot_config_get_width(ert.plot_config) - r.setter = lambda ert, value : ert.enkf.plot_config_set_width(ert.plot_config, value) + r.initialize = lambda ert : ert.main.plot_config.get_width + r.getter = lambda ert : ert.main.plot_config.get_width + r.setter = lambda ert, value : ert.main.plot_config.set_width( value) r = configPanel.addRow(IntegerSpinner(parent, "Height", "config/plot/plot_height", 1, 10000)) - r.getter = lambda ert : ert.enkf.plot_config_get_height(ert.plot_config) - r.setter = lambda ert, value : ert.enkf.plot_config_set_height(ert.plot_config, value) + r.initialize = lambda ert : ert.main.plot_config.get_height + r.getter = lambda ert : ert.main.plot_config.get_height + r.setter = lambda ert, value : ert.main.plot_config.set_height( value) r = configPanel.addRow(PathChooser(parent, "Image Viewer", "config/plot/image_viewer", True)) - r.getter = lambda ert : ert.enkf.plot_config_get_viewer(ert.plot_config) - r.setter = lambda ert, value : ert.enkf.plot_config_set_viewer(ert.plot_config, str(value)) + r.initialize = lambda ert : ert.main.plot_config.get_viewer + r.getter = lambda ert : ert.main.plot_config.get_viewer + r.setter = lambda ert, value : ert.main.plot_config.set_viewer( str(value)) r = configPanel.addRow(ComboChoice(parent, ["bmp", "jpg", "png", "tif"], "Image type", "config/plot/image_type")) - r.getter = lambda ert : ert.enkf.plot_config_get_image_type(ert.plot_config) - r.setter = lambda ert, value : ert.enkf.plot_config_set_image_type(ert.plot_config, str(value)) + r.initialize = lambda ert : ert.main.plot_config.get_image_type + r.getter = lambda ert : ert.main.plot_config.get_image_type + r.setter = lambda ert, value : ert.main.plot_config.set_image_type( str(value)) configPanel.endPage() diff --git a/ThirdParty/Ert/devel/libenkf/applications/ert_gui/lib/ert_gui/pages/config/queuesystem.py b/ThirdParty/Ert/devel/python/python/ert_gui/pages/config/queuesystem.py similarity index 60% rename from ThirdParty/Ert/devel/libenkf/applications/ert_gui/lib/ert_gui/pages/config/queuesystem.py rename to ThirdParty/Ert/devel/python/python/ert_gui/pages/config/queuesystem.py index 9f82da1f5e..f890b6a1db 100644 --- a/ThirdParty/Ert/devel/libenkf/applications/ert_gui/lib/ert_gui/pages/config/queuesystem.py +++ b/ThirdParty/Ert/devel/python/python/ert_gui/pages/config/queuesystem.py @@ -29,24 +29,28 @@ def createQueueSystemPage(configPanel, parent): configPanel.startPage("Queue System") r = configPanel.addRow(ComboChoice(parent, ["LSF", "RSH", "LOCAL"], "Queue system", "config/queue_system/queue_system")) - r.getter = lambda ert : ert.enkf.site_config_get_queue_name(ert.site_config) - r.setter = lambda ert, value : ert.enkf.site_config_set_job_queue(ert.site_config, str(value)) + r.initialize = lambda ert : ert.main.site_config.get_queue_name + r.getter = lambda ert : ert.main.site_config.get_queue_name + r.setter = lambda ert, value : ert.main.site_config.set_job_queue(str(value)) internalPanel = ConfigPanel(parent) internalPanel.startPage("LSF") r = internalPanel.addRow(StringBox(parent, "LSF Queue", "config/queue_system/lsf_queue")) - r.getter = lambda ert : ert.enkf.site_config_get_lsf_queue(ert.site_config) - r.setter = lambda ert, value : ert.enkf.site_config_set_lsf_queue(ert.site_config, str(value)) + r.initialize = lambda ert : ert.main.site_config.get_lsf_queue + r.getter = lambda ert : ert.main.site_config.get_lsf_queue + r.setter = lambda ert, value : ert.main.site_config.set_lsf_queue( str(value)) r = internalPanel.addRow(IntegerSpinner(parent, "Max running", "config/queue_system/max_running_lsf", 1, 1000)) - r.getter = lambda ert : ert.enkf.site_config_get_max_running_lsf(ert.site_config) - r.setter = lambda ert, value : ert.enkf.site_config_set_max_running_lsf(ert.site_config, value) + r.initialize = lambda ert : ert.main.site_config.get_max_running_lsf + r.getter = lambda ert : ert.main.site_config.get_max_running_lsf + r.setter = lambda ert, value : ert.main.site_config.set_max_running_lsf( value) r = internalPanel.addRow(StringBox(parent, "Resources", "config/queue_system/lsf_resources")) - r.getter = lambda ert : ert.enkf.site_config_get_lsf_request(ert.site_config) - r.setter = lambda ert, value : ert.enkf.site_config_set_lsf_request(ert.site_config, str(value)) + r.initialize = lambda ert : ert.main.site_config.get_lsf_request + r.getter = lambda ert : ert.main.site_config.get_lsf_request + r.setter = lambda ert, value : ert.main.site_config.set_lsf_request(str(value)) internalPanel.endPage() @@ -54,19 +58,22 @@ def createQueueSystemPage(configPanel, parent): internalPanel.startPage("RSH") r = internalPanel.addRow(PathChooser(parent, "Command", "config/queue_system/rsh_command", show_files=True, must_exist=True, is_executable_file=True)) - r.getter = lambda ert : ert.enkf.site_config_get_rsh_command(ert.site_config) - r.setter = lambda ert, value : ert.enkf.site_config_set_rsh_command(ert.site_config, str(value)) + r.initialize = lambda ert : ert.main.site_config.get_rsh_command + r.getter = lambda ert : ert.main.site_config.get_rsh_command + r.setter = lambda ert, value : ert.main.site_config.set_rsh_command(str(value)) r = internalPanel.addRow(IntegerSpinner(parent, "Max running", "config/queue_system/max_running_rsh", 1, 1000)) - r.getter = lambda ert : ert.enkf.site_config_get_max_running_rsh(ert.site_config) - r.setter = lambda ert, value : ert.enkf.site_config_set_max_running_rsh(ert.site_config, value) + r.initialize = lambda ert : ert.main.site_config.get_max_running_rsh + r.getter = lambda ert : ert.main.site_config.get_max_running_rsh + r.setter = lambda ert, value : ert.main.site_config.set_max_running_rsh( value) r = internalPanel.addRow(KeywordTable(parent, "Host List", "config/queue_system/rsh_host_list", "Host", "Number of jobs")) - r.getter = lambda ert : ert.getHash(ert.enkf.site_config_get_rsh_host_list(ert.site_config), True) + r.initialize = lambda ert : ert.getHash(ert.main.site_config.get_rsh_host_list, True) + r.getter = lambda ert : ert.getHash(ert.main.site_config.get_rsh_host_list, True) def add_rsh_host(ert, listOfKeywords): - ert.enkf.site_config_clear_rsh_host_list(ert.site_config) + ert.main.site_config.clear_rsh_host_list for keyword in listOfKeywords: if keyword[1].strip() == "": @@ -74,7 +81,7 @@ def createQueueSystemPage(configPanel, parent): else: max_running = int(keyword[1]) - ert.enkf.site_config_add_rsh_host(ert.site_config, keyword[0], max_running) + ert.main.site_config.add_rsh_host( keyword[0], max_running) r.setter = add_rsh_host @@ -84,8 +91,9 @@ def createQueueSystemPage(configPanel, parent): internalPanel.startPage("LOCAL") r = internalPanel.addRow(IntegerSpinner(parent, "Max running", "config/queue_system/max_running_local", 1, 1000)) - r.getter = lambda ert : ert.enkf.site_config_get_max_running_local(ert.site_config) - r.setter = lambda ert, value : ert.enkf.site_config_set_max_running_local(ert.site_config, value) + r.initialize = lambda ert : ert.main.site_config.get_max_running_local + r.getter = lambda ert : ert.main.site_config.get_max_running_local + r.setter = lambda ert, value : ert.main.site_config.set_max_running_local(value) internalPanel.endPage() configPanel.addRow(internalPanel) diff --git a/ThirdParty/Ert/devel/libenkf/applications/ert_gui/lib/ert_gui/pages/config/simulation.py b/ThirdParty/Ert/devel/python/python/ert_gui/pages/config/simulation.py similarity index 57% rename from ThirdParty/Ert/devel/libenkf/applications/ert_gui/lib/ert_gui/pages/config/simulation.py rename to ThirdParty/Ert/devel/python/python/ert_gui/pages/config/simulation.py index db12479cca..d833e20cb1 100644 --- a/ThirdParty/Ert/devel/libenkf/applications/ert_gui/lib/ert_gui/pages/config/simulation.py +++ b/ThirdParty/Ert/devel/python/python/ert_gui/pages/config/simulation.py @@ -31,18 +31,21 @@ from ert.ert.enums import keep_runpath_type from simulations.runtemplatepanel import RunTemplatePanel import ert_gui.widgets.helpedwidget import os +from ert.util.stringlist import StringList def createSimulationsPage(configPanel, parent): configPanel.startPage("Simulations") r = configPanel.addRow(IntegerSpinner(parent, "Max submit", "config/simulation/max_submit", 1, 10000)) - r.getter = lambda ert : ert.enkf.site_config_get_max_submit(ert.site_config) - r.setter = lambda ert, value : ert.enkf.site_config_set_max_submit(ert.site_config, value) + r.initialize = lambda ert : ert.main.site_config.get_max_submit + r.getter = lambda ert : ert.main.site_config.get_max_submit + r.setter = lambda ert, value : ert.main.site_config.set_max_submit( value) - r = configPanel.addRow(IntegerSpinner(parent, "Max resample", "config/simulation/max_resample", 1, 10000)) - r.getter = lambda ert : ert.enkf.model_config_get_max_resample(ert.model_config) - r.setter = lambda ert, value : ert.enkf.model_config_set_max_resample(ert.model_config, value) + r = configPanel.addRow(IntegerSpinner(parent, "Max internal submit", "config/simulation/max_resample", 1, 10000)) + r.initialize = lambda ert : ert.main.model_config.get_max_internal_submit + r.getter = lambda ert : ert.main.model_config.get_max_internal_submit + r.setter = lambda ert, value : ert.main.model_config.set_max_internal_submit( value) @@ -50,25 +53,23 @@ def createSimulationsPage(configPanel, parent): def get_forward_model(ert): - site_config = ert.site_config - installed_jobs_pointer = ert.enkf.site_config_get_installed_jobs(site_config) - installed_jobs_stringlist_pointer = ert.job_queue.ext_joblist_alloc_list(installed_jobs_pointer) - available_jobs = ert.getStringList(installed_jobs_stringlist_pointer , free_after_use=True) + site_config = ert.main.site_config + installed_jobs = ert.main.site_config.get_installed_jobs + available_jobs = installed_jobs.alloc_list result = {'available_jobs': available_jobs} - model_config = ert.model_config - forward_model = ert.enkf.model_config_get_forward_model(model_config) - name_string_list = ert.job_queue.forward_model_alloc_joblist(forward_model) - job_names = ert.getStringList(name_string_list, free_after_use=True) - + model_config = ert.main.model_config + forward_model = model_config.get_forward_model + job_names = forward_model.alloc_joblist + forward_model_jobs = [] count = 0 for name in job_names: - ext_job = ert.job_queue.forward_model_iget_job(forward_model, count) - arg_string = ert.job_queue.ext_job_get_private_args_as_string(ext_job) - help_text = ert.job_queue.ext_job_get_help_text(ext_job) + ext_job = forward_model.iget_job( count) + arg_string = ext_job.get_private_args_as_string + help_text = ext_job.get_help_text forward_model_jobs.append((name, arg_string, help_text)) count+=1 @@ -77,16 +78,17 @@ def createSimulationsPage(configPanel, parent): return result r.getter = get_forward_model + r.initialize = get_forward_model def update_forward_model(ert, forward_model): - forward_model_pointer = ert.enkf.model_config_get_forward_model(ert.model_config) - ert.job_queue.forward_model_clear(forward_model_pointer) + forward_model_object = ert.main.model_config.get_forward_model + forward_model_object.clear for job in forward_model: name = job[0] args = job[1] - ext_job = ert.job_queue.forward_model_add_job(forward_model_pointer, name) - ert.job_queue.ext_job_set_private_args_from_string(ext_job, args) + ext_job = forward_model.add_job( name) + ext_job.set_private_args_from_string( args) r.setter = update_forward_model @@ -96,17 +98,19 @@ def createSimulationsPage(configPanel, parent): def get_case_table(ert): - return ert.enkf.model_config_get_case_table_file(ert.model_config) + return ert.main.model_config.get_case_table_file r.getter = get_case_table - + r.initialize = get_case_table + def set_case_table(ert, value): if os.path.exists(value): - ert.enkf.enkf_main_set_case_table(ert.model_config, ert.nonify(value)) + ert.main.set_case_table( ert.nonify(value)) r.setter = set_case_table r = configPanel.addRow(PathChooser(parent, "License path", "config/simulation/license_path")) - r.getter = lambda ert : ert.enkf.site_config_get_license_root_path(ert.site_config) + r.getter = lambda ert : ert.main.site_config.get_license_root_path + r.initialize = lambda ert : ert.main.site_config.get_license_root_path def ls(string): if string is None: @@ -114,7 +118,7 @@ def createSimulationsPage(configPanel, parent): else: return string - r.setter = lambda ert, value : ert.enkf.site_config_set_license_root_path(ert.site_config, ls(value)) + r.setter = lambda ert, value : ert.main.site_config.set_license_root_path( ls(value)) @@ -124,33 +128,36 @@ def createSimulationsPage(configPanel, parent): r = internalPanel.addRow(PathChooser(parent, "Runpath", "config/simulation/runpath", path_format=True)) - r.getter = lambda ert : ert.enkf.model_config_get_runpath_as_char(ert.model_config) - r.setter = lambda ert, value : ert.enkf.model_config_set_runpath_fmt(ert.model_config, str(value)) + r.getter = lambda ert : ert.main.model_config.get_runpath_as_char + r.initialize = lambda ert : ert.main.model_config.get_runpath_as_char + r.setter = lambda ert, value : ert.main.model_config.select_runpath( str(value)) parent.connect(r, QtCore.SIGNAL("contentsChanged()"), lambda : r.modelEmit("runpathChanged()")) r = internalPanel.addRow(CheckBox(parent, "Pre clear", "config/simulation/pre_clear_runpath", "Perform pre clear")) - r.getter = lambda ert : ert.enkf.enkf_main_get_pre_clear_runpath(ert.main) - r.setter = lambda ert, value : ert.enkf.enkf_main_set_pre_clear_runpath(ert.main, value) + r.getter = lambda ert : ert.main.get_pre_clear_runpath + r.initialize = lambda ert : ert.main.get_pre_clear_runpath + r.setter = lambda ert, value : ert.main.set_pre_clear_runpath( value) r = internalPanel.addRow(RunpathMemberPanel(widgetLabel="Retain runpath", helpLabel="config/simulation/runpath_retain")) def get_runpath_retain_state(ert): - ensemble_size = ert.enkf.enkf_main_get_ensemble_size(ert.main) + ensemble_size = ert.main.ens_size result = [] for index in range(ensemble_size): - state = ert.enkf.enkf_main_iget_keep_runpath(ert.main, index) + state = ert.main.iget_keep_runpath( index) result.append((index, keep_runpath_type.resolveValue(state))) return result r.getter = get_runpath_retain_state - + r.initialize = get_runpath_retain_state + def set_runpath_retain_state(ert, items): for item in items: - ert.enkf.enkf_main_iset_keep_runpath(ert.main, item.member, item.runpath_state.value()) + ert.main.iset_keep_runpath(item.member, item.runpath_state.value()) r.setter = set_runpath_retain_state @@ -162,27 +169,27 @@ def createSimulationsPage(configPanel, parent): r = internalPanel.addRow(RunTemplatePanel(parent)) def get_run_templates(ert): - templates = ert.enkf.enkf_main_get_templates(ert.main) - template_list = ert.enkf.ert_template_alloc_list(templates) - - template_names = ert.getStringList(template_list, free_after_use=True) + templates = ert.main.get_templates + template_names = templates.alloc_list + result = [] for name in template_names: - template = ert.enkf.ert_template_get_template(templates, name) - template_file = ert.enkf.ert_template_get_template_file(template) - target_file = ert.enkf.ert_template_get_target_file(template) - arguments = ert.enkf.ert_template_get_args_as_string(template) + template = templates.get_template(name) + template_file = template.get_template_file + target_file = template.get_target_file + arguments = template.get_args_as_string result.append((name, template_file, target_file, arguments)) return result r.getter = get_run_templates + r.initialize = get_run_templates def set_run_templates(ert, template_list): - templates_pointer = ert.enkf.enkf_main_get_templates(ert.main) - ert.enkf.ert_template_clear(templates_pointer) + templates_object = ert.main.get_templates + templates_object.clear for template in template_list: - ert.enkf.ert_template_add_template(templates_pointer, template[0], template[1], template[2], template[3]) + templates_object.add_template( template[0], template[1], template[2], template[3]) r.setter = set_run_templates diff --git a/ThirdParty/Ert/devel/python/python/ert_gui/pages/config/simulations/CMakeLists.txt b/ThirdParty/Ert/devel/python/python/ert_gui/pages/config/simulations/CMakeLists.txt new file mode 100644 index 0000000000..56a1241e5e --- /dev/null +++ b/ThirdParty/Ert/devel/python/python/ert_gui/pages/config/simulations/CMakeLists.txt @@ -0,0 +1 @@ +add_python_package( "Python ert_gui.pages.config.simulations" ${PYTHON_INSTALL_PREFIX}/ert_gui/pages/config/simulations "__init__.py;runpathpanel.py;runtemplatepanel.py" True) diff --git a/ThirdParty/Ert/devel/libenkf/applications/ert_gui/lib/ert_gui/pages/config/simulations/__init__.py b/ThirdParty/Ert/devel/python/python/ert_gui/pages/config/simulations/__init__.py similarity index 100% rename from ThirdParty/Ert/devel/libenkf/applications/ert_gui/lib/ert_gui/pages/config/simulations/__init__.py rename to ThirdParty/Ert/devel/python/python/ert_gui/pages/config/simulations/__init__.py diff --git a/ThirdParty/Ert/devel/libenkf/applications/ert_gui/lib/ert_gui/pages/config/simulations/runpathpanel.py b/ThirdParty/Ert/devel/python/python/ert_gui/pages/config/simulations/runpathpanel.py similarity index 100% rename from ThirdParty/Ert/devel/libenkf/applications/ert_gui/lib/ert_gui/pages/config/simulations/runpathpanel.py rename to ThirdParty/Ert/devel/python/python/ert_gui/pages/config/simulations/runpathpanel.py diff --git a/ThirdParty/Ert/devel/libenkf/applications/ert_gui/lib/ert_gui/pages/config/simulations/runtemplatepanel.py b/ThirdParty/Ert/devel/python/python/ert_gui/pages/config/simulations/runtemplatepanel.py similarity index 99% rename from ThirdParty/Ert/devel/libenkf/applications/ert_gui/lib/ert_gui/pages/config/simulations/runtemplatepanel.py rename to ThirdParty/Ert/devel/python/python/ert_gui/pages/config/simulations/runtemplatepanel.py index a661172500..98b263b37d 100644 --- a/ThirdParty/Ert/devel/libenkf/applications/ert_gui/lib/ert_gui/pages/config/simulations/runtemplatepanel.py +++ b/ThirdParty/Ert/devel/python/python/ert_gui/pages/config/simulations/runtemplatepanel.py @@ -53,8 +53,8 @@ class RunTemplatePanel(HelpedWidget): self.addWidget(self.searchableList) self.connect(self.searchableList, QtCore.SIGNAL('currentItemChanged(QListWidgetItem, QListWidgetItem)'), self.changeParameter) - self.connect(self.searchableList, QtCore.SIGNAL('addItem(list)'), self.addItem) - self.connect(self.searchableList, QtCore.SIGNAL('removeItem(list)'), self.removeItem) + self.connect(self.searchableList, QtCore.SIGNAL('addItem(QListWidgetItem)'), self.addItem) + self.connect(self.searchableList, QtCore.SIGNAL('removeItem(QListWidgetItem)'), self.removeItem) self.run_template_panel = ert_gui.widgets.util.createEmptyPanel() diff --git a/ThirdParty/Ert/devel/libenkf/applications/ert_gui/lib/ert_gui/pages/config/systemenv.py b/ThirdParty/Ert/devel/python/python/ert_gui/pages/config/systemenv.py similarity index 60% rename from ThirdParty/Ert/devel/libenkf/applications/ert_gui/lib/ert_gui/pages/config/systemenv.py rename to ThirdParty/Ert/devel/python/python/ert_gui/pages/config/systemenv.py index e9c4f663d6..e4ee7873f5 100644 --- a/ThirdParty/Ert/devel/libenkf/applications/ert_gui/lib/ert_gui/pages/config/systemenv.py +++ b/ThirdParty/Ert/devel/python/python/ert_gui/pages/config/systemenv.py @@ -26,6 +26,7 @@ from jobs.jobspanel import JobsPanel, Job import os import ert_gui.widgets.spinnerwidgets from ert_gui.widgets.activelabel import ActiveLabel +from ert.job_queue.ext_job import ExtJob def createSystemPage(configPanel, parent): configPanel.startPage("System") @@ -34,25 +35,28 @@ def createSystemPage(configPanel, parent): # the site configuration file; this should only be a label - not # user editable. r = configPanel.addRow(ActiveLabel(None, "Site Config", "", "Not specified.")) - r.getter = lambda ert : ert.enkf.enkf_main_get_site_config_file(ert.main) + r.initialize = lambda ert : ert.main.get_site_config_file + r.getter = lambda ert : ert.main.get_site_config_file r.modelConnect("casesUpdated()", r.fetchContent) r = configPanel.addRow(PathChooser(parent, "Job script", "config/systemenv/job_script", True)) - r.getter = lambda ert : ert.enkf.site_config_get_job_script(ert.site_config) - r.setter = lambda ert, value : ert.enkf.site_config_set_job_script(ert.site_config, str(value)) + r.initialize = lambda ert : ert.main.site_config.get_job_script + r.getter = lambda ert : ert.main.site_config.get_job_script + r.setter = lambda ert, value : ert.main.site_config.set_job_script( str(value)) internalPanel = ConfigPanel(parent) internalPanel.startPage("setenv") r = internalPanel.addRow(KeywordTable(parent, "", "config/systemenv/setenv")) - r.getter = lambda ert : ert.getHash(ert.enkf.site_config_get_env_hash(ert.site_config)) + r.initialize = lambda ert : ert.getHash(ert.main.site_config.get_env_hash) + r.getter = lambda ert : ert.getHash(ert.main.site_config.get_env_hash) def setenv(ert, value): - ert.enkf.site_config_clear_env(ert.site_config) + ert.main.site_config.clear_env for env in value: - ert.enkf.site_config_setenv(ert.site_config, env[0], env[1]) + ert.main.site_config.setenv( env[0], env[1]) r.setter = setenv @@ -61,19 +65,21 @@ def createSystemPage(configPanel, parent): internalPanel.startPage("Update path") r = internalPanel.addRow(KeywordTable(parent, "", "config/systemenv/update_path")) + def get_update_path(ert): - paths = ert.getStringList(ert.enkf.site_config_get_path_variables(ert.site_config)) - values = ert.getStringList(ert.enkf.site_config_get_path_values(ert.site_config)) + paths = ert.main.site_config.get_path_variables + values = ert.main.site_config.get_path_values return [[p, v] for p, v in zip(paths, values)] r.getter = get_update_path - + r.initialize = get_update_path + def update_pathvar(ert, value): - ert.enkf.site_config_clear_pathvar(ert.site_config) + ert.main.site_config.clear_pathvar for pathvar in value: - ert.enkf.site_config_update_pathvar(ert.site_config, pathvar[0], pathvar[1]) + ert.main.site_config.update_pathvar( pathvar[0], pathvar[1]) r.setter = update_pathvar @@ -83,59 +89,66 @@ def createSystemPage(configPanel, parent): internalPanel.startPage("Jobs") r = internalPanel.addRow(JobsPanel(parent)) - def get_jobs(ert): - jl = ert.enkf.site_config_get_installed_jobs(ert.site_config) - h = ert.job_queue.ext_joblist_get_jobs(jl) - jobs = ert.getHash(h, return_type="long") + def get_jobs(ert): + jl = ert.main.site_config.get_installed_jobs + h = jl.get_jobs + stringlist = jl.alloc_list + jobs = ert.getHash(h, return_type="c_void_p") private_jobs = [] - for k, v in jobs: - v = int(v) - path = ert.job_queue.ext_job_get_config_file(v) - if ert.job_queue.ext_job_is_private(v): - private_jobs.append(Job(k, path)) + for v in stringlist: + job = jl.get_job(v) + path = job.get_config_file + if job.is_private: + private_jobs.append(Job(v, path)) + #for k, v in jobs: + # job = jl.get_job(v) + # path = job.get_config_file + # if v.is_private: + # private_jobs.append(Job(k, path)) return private_jobs def update_job(ert, value): - jl = ert.enkf.site_config_get_installed_jobs(ert.site_config) + jl = ert.main.site_config.get_installed_jobs if os.path.exists(value.path): - license = ert.enkf.site_config_get_license_root_path(ert.site_config) + license = ert.main.site_config.get_license_root_path job = ert.job_queue.ext_job_fscanf_alloc(value.name, license, True, value.path) - ert.job_queue.ext_joblist_add_job(jl, value.name, job) + jl.add_job(value.name, job) else: - job = ert.job_queue.ext_joblist_get_job(jl, value.name) - ert.job_queue.ext_job_set_config_file(job, value.path) + job = jl.get_job(value.name) + job.set_config_file(value.path) def add_job(ert, value): - jl = ert.enkf.site_config_get_installed_jobs(ert.site_config) - if not ert.job_queue.ext_joblist_has_job(jl, value.name): - license = ert.enkf.site_config_get_license_root_path(ert.site_config) + jl = ert.main.site_config.get_installed_jobs + if not jl.has_job(value.name): + license = ert.main.site_config.get_license_root_path if os.path.exists(value.path): job = ert.job_queue.ext_job_fscanf_alloc(value.name, license, True, value.path) - ert.job_queue.ext_joblist_add_job(jl, value.name, job) + jl.add_job(value.name, job) else: job = ert.job_queue.ext_job_alloc(value.name, license, True) - ert.job_queue.ext_job_set_config_file(job, value.path) - ert.job_queue.ext_joblist_add_job(jl, value.name, job) + job.set_config_file(value.path) + jl.add_job(value.name, job) return True return False def remove_job(ert, value): - jl = ert.enkf.site_config_get_installed_jobs(ert.site_config) - success = ert.job_queue.ext_joblist_del_job(jl, value.name) + jl = ert.main.site_config.get_installed_jobs + success = jl.del_job(value.name) if not success: QtGui.QMessageBox.question(parent, "Failed", "Unable to delete job!", QtGui.QMessageBox.Ok) return False return True - + r.getter = get_jobs + r.initialize = get_jobs r.setter = update_job r.insert = add_job r.remove = remove_job @@ -146,12 +159,14 @@ def createSystemPage(configPanel, parent): configPanel.addRow(internalPanel) r = configPanel.addRow(PathChooser(parent, "Log file", "config/systemenv/log_file", True)) - r.getter = lambda ert : ert.util.log_get_filename(ert.logh) - r.setter = lambda ert, value : ert.util.log_reset_filename(ert.logh, value) + r.initialize = lambda ert: ert.main.logh.get_filename + r.getter = lambda ert : ert.main.logh.get_filename + r.setter = lambda ert, value : ert.main.logh.reopen(value) r = configPanel.addRow(ert_gui.widgets.spinnerwidgets.IntegerSpinner(parent, "Log level", "config/systemenv/log_level", 0, 1000)) - r.getter = lambda ert : ert.util.log_get_level(ert.logh) - r.setter = lambda ert, value : ert.util.log_set_level(ert.logh, value) + r.initialize = lambda ert : ert.main.logh.get_level + r.getter = lambda ert : ert.main.logh.get_level + r.setter = lambda ert, value : ert.main.logh.set_level( value) configPanel.endPage() diff --git a/ThirdParty/Ert/devel/python/python/ert_gui/pages/init/CMakeLists.txt b/ThirdParty/Ert/devel/python/python/ert_gui/pages/init/CMakeLists.txt new file mode 100644 index 0000000000..f1b0339f60 --- /dev/null +++ b/ThirdParty/Ert/devel/python/python/ert_gui/pages/init/CMakeLists.txt @@ -0,0 +1 @@ +add_python_package( "Python ert_gui.pages.init" ${PYTHON_INSTALL_PREFIX}/ert_gui/pages/init "__init__.py;initandcopy.py;initpanel.py" True) diff --git a/ThirdParty/Ert/devel/libenkf/applications/ert_gui/lib/ert_gui/pages/init/__init__.py b/ThirdParty/Ert/devel/python/python/ert_gui/pages/init/__init__.py similarity index 100% rename from ThirdParty/Ert/devel/libenkf/applications/ert_gui/lib/ert_gui/pages/init/__init__.py rename to ThirdParty/Ert/devel/python/python/ert_gui/pages/init/__init__.py diff --git a/ThirdParty/Ert/devel/libenkf/applications/ert_gui/lib/ert_gui/pages/init/initandcopy.py b/ThirdParty/Ert/devel/python/python/ert_gui/pages/init/initandcopy.py similarity index 88% rename from ThirdParty/Ert/devel/libenkf/applications/ert_gui/lib/ert_gui/pages/init/initandcopy.py rename to ThirdParty/Ert/devel/python/python/ert_gui/pages/init/initandcopy.py index 092c4bd9f0..6573307996 100644 --- a/ThirdParty/Ert/devel/libenkf/applications/ert_gui/lib/ert_gui/pages/init/initandcopy.py +++ b/ThirdParty/Ert/devel/python/python/ert_gui/pages/init/initandcopy.py @@ -19,6 +19,9 @@ from ert_gui.widgets.helpedwidget import HelpedWidget from PyQt4 import QtGui, QtCore from ert_gui.widgets.util import resourceIcon, ListCheckPanel, ValidatedTimestepCombo, getItemsFromList from ert.ert.enums import ert_state_enum +from ert.util.stringlist import StringList +from ctypes import * +from ert.util.tvector import BoolVector class ParametersAndMembers(HelpedWidget): @@ -102,13 +105,14 @@ class ParametersAndMembers(HelpedWidget): def initializeCaseFromScratch(self, parameters, members): ert = self.getModel() - stringlist = ert.createStringList(parameters) + stringlist = StringList(parameters) for member in members: m = int(member.strip()) - ert.enkf.enkf_main_initialize_from_scratch(ert.main, stringlist, m , m) + ert.main.initialize_from_scratch(stringlist, m , m) + + stringlist.__del__ - ert.freeStringList(stringlist) def initializeCaseFromCase(self, selected_parameters, selected_members): ert = self.getModel() @@ -119,20 +123,18 @@ class ParametersAndMembers(HelpedWidget): source_case = str(self.sourceCase.currentText()) source_report_step = self.sourceReportStep.getSelectedValue() source_state = ert_state_enum.resolveName(str(self.sourceType.currentText())).value() - member_mask = ert.createBoolVector(self.membersList.count(), selected_members) + member_mask = BoolVector.active_mask(str(selected_members).strip('[]')) ranking_key = None - node_list = ert.createStringList(selected_parameters) + node_list = StringList(selected_parameters) - ert.enkf.enkf_main_initialize_from_existing__(ert.main, - source_case, + ert.main.initialize_from_existing__( source_case, source_report_step, source_state, member_mask, ranking_key, node_list) - ert.freeStringList(node_list) - ert.freeBoolVector(member_mask) + node_list.__del__ def copyEnsemble(self, selected_parameters, selected_members): ert = self.getModel() @@ -148,12 +150,11 @@ class ParametersAndMembers(HelpedWidget): target_report_step = self.targetReportStep.getSelectedValue() target_state = ert_state_enum.resolveName(str(self.targetType.currentText())).value() - member_mask = ert.createBoolVector(self.membersList.count(), selected_members) + member_mask = BoolVector.active_mask(str(selected_members).strip('[]')) ranking_key = None - node_list = ert.createStringList(selected_parameters) + node_list = StringList(selected_parameters) - ert.enkf.enkf_main_copy_ensemble(ert.main, - source_case, + ert.main.copy_ensemble( source_case, source_report_step, source_state, target_case, @@ -163,8 +164,7 @@ class ParametersAndMembers(HelpedWidget): ranking_key, node_list) - ert.freeStringList(node_list) - ert.freeBoolVector(member_mask) + node_list.__del__ def initializeOrCopy(self): selected_parameters = getItemsFromList(self.parametersList) @@ -227,25 +227,17 @@ class ParametersAndMembers(HelpedWidget): #enums from enkf_types.h PARAMETER = 1 DYNAMIC_STATE = 2 - keylist = ert.enkf.ensemble_config_alloc_keylist_from_var_type(ert.ensemble_config, PARAMETER ) + parameters = ert.main.ensemble_config.alloc_keylist_from_var_type( PARAMETER ) - parameters = ert.getStringList(keylist) - ert.freeStringList(keylist) + dynamicParameters = ert.main.ensemble_config.alloc_keylist_from_var_type( DYNAMIC_STATE ) - keylist = ert.enkf.ensemble_config_alloc_keylist_from_var_type(ert.ensemble_config, DYNAMIC_STATE ) - dynamicParameters = ert.getStringList(keylist) - ert.freeStringList(keylist) + members = ert.main.ens_size - members = ert.enkf.enkf_main_get_ensemble_size(ert.main) + fs = ert.main.get_fs + currentCase = ert.main.get_current_fs - fs = ert.enkf.enkf_main_get_fs(ert.main) - currentCase = "default" #ert.enkf.enkf_fs_get_read_dir(fs) - - #caseList = ert.enkf.enkf_fs_alloc_dirlist(fs) - #list = ert.getStringList(caseList) - #ert.freeStringList(caseList) - list = ["default"] - historyLength = ert.enkf.enkf_main_get_history_length(ert.main) + list = ert.main.alloc_caselist + historyLength = ert.main.get_history_length return {"parameters" : parameters, "dynamic_parameters" : dynamicParameters, diff --git a/ThirdParty/Ert/devel/libenkf/applications/ert_gui/lib/ert_gui/pages/init/initpanel.py b/ThirdParty/Ert/devel/python/python/ert_gui/pages/init/initpanel.py similarity index 79% rename from ThirdParty/Ert/devel/libenkf/applications/ert_gui/lib/ert_gui/pages/init/initpanel.py rename to ThirdParty/Ert/devel/python/python/ert_gui/pages/init/initpanel.py index 67289b9da6..7cbb0e547a 100644 --- a/ThirdParty/Ert/devel/libenkf/applications/ert_gui/lib/ert_gui/pages/init/initpanel.py +++ b/ThirdParty/Ert/devel/python/python/ert_gui/pages/init/initpanel.py @@ -42,11 +42,8 @@ class InitPanel(QtGui.QFrame): def get_case_list(ert): - fs = ert.enkf.enkf_main_get_fs(ert.main) - caseList = ["default"] #ert.enkf.enkf_fs_alloc_dirlist(fs) - - list = caseList #ert.getStringList(caseList) - #ert.freeStringList(caseList) + fs = ert.main.get_fs + list = ert.main.alloc_caselist return list self.get_case_list = get_case_list # convenience: used by several functions @@ -75,16 +72,13 @@ class InitPanel(QtGui.QFrame): cases.addRemoveWidget.enableRemoveButton(False) #todo: add support for removal cases.list.setMaximumHeight(150) - cases.initialize = lambda ert : [ert.prototype("long enkf_main_get_fs(long)"), - ert.prototype("void enkf_main_select_case(long , char*)"), - ert.prototype("long enkf_fs_alloc_dirlist(long)")] def create_case(ert, cases): - fs = ert.enkf.enkf_main_get_fs(ert.main) + fs = ert.main.get_fs for case in cases: - if not ert.enkf.enkf_fs_has_dir(fs, case): - ert.enkf.enkf_fs_select_write_dir(fs, case, True) + if not fs.has_dir(case): + fs.select_write_dir(case, True) break self.currentCase.updateList(self.get_case_list(ert)) @@ -92,6 +86,7 @@ class InitPanel(QtGui.QFrame): self.casesUpdated() cases.getter = self.get_case_list + cases.initialize = self.get_case_list cases.setter = create_case return cases @@ -103,17 +98,15 @@ class InitPanel(QtGui.QFrame): self.currentCase.combo.setMinimumWidth(150) def initialize_cases(ert): - ert.prototype("long enkf_main_get_fs(long)") - self.currentCase.updateList(self.get_case_list(ert)) self.currentCase.initialize = initialize_cases def get_current_case(ert): - fs = ert.enkf.enkf_main_get_fs(ert.main) + fs = ert.main.get_fs tmp = self.get_case_list(ert) - currentCase = tmp[0] #ert.enkf.enkf_fs_get_read_dir(fs) - #print "The selected case is: " + currentCase + currentCase = ert.main.get_current_fs + print "The selected case is: " + currentCase return currentCase self.currentCase.getter = get_current_case @@ -122,9 +115,11 @@ class InitPanel(QtGui.QFrame): def select_case(ert, case): case = str(case) if not case == "": - ert.enkf.enkf_main_select_case( ert.main , case ) + ert.main.user_select_fs( case ) self.casesUpdated() self.currentCase.setter = select_case return self.currentCase + + diff --git a/ThirdParty/Ert/devel/python/python/ert_gui/pages/plot/CMakeLists.txt b/ThirdParty/Ert/devel/python/python/ert_gui/pages/plot/CMakeLists.txt new file mode 100644 index 0000000000..137c02c8b7 --- /dev/null +++ b/ThirdParty/Ert/devel/python/python/ert_gui/pages/plot/CMakeLists.txt @@ -0,0 +1 @@ +add_python_package( "Python ert_gui.pages.plot" ${PYTHON_INSTALL_PREFIX}/ert_gui/pages/plot "__init__.py;fetcher.py;plotconfig.py;plotfigure.py;plotpanel.py;plotsettings.py;plotview.py;zoomslider.py;ensemblefetcher.py;plotdata.py;plotgenerator.py;plotrenderer.py;plotsettingsxml.py;rftfetcher.py" True) diff --git a/ThirdParty/Ert/devel/libenkf/applications/ert_gui/lib/ert_gui/pages/plot/__init__.py b/ThirdParty/Ert/devel/python/python/ert_gui/pages/plot/__init__.py similarity index 100% rename from ThirdParty/Ert/devel/libenkf/applications/ert_gui/lib/ert_gui/pages/plot/__init__.py rename to ThirdParty/Ert/devel/python/python/ert_gui/pages/plot/__init__.py diff --git a/ThirdParty/Ert/devel/libenkf/applications/ert_gui/lib/ert_gui/pages/plot/ensemblefetcher.py b/ThirdParty/Ert/devel/python/python/ert_gui/pages/plot/ensemblefetcher.py similarity index 70% rename from ThirdParty/Ert/devel/libenkf/applications/ert_gui/lib/ert_gui/pages/plot/ensemblefetcher.py rename to ThirdParty/Ert/devel/python/python/ert_gui/pages/plot/ensemblefetcher.py index 5e366ad39d..8f0b5e081b 100644 --- a/ThirdParty/Ert/devel/libenkf/applications/ert_gui/lib/ert_gui/pages/plot/ensemblefetcher.py +++ b/ThirdParty/Ert/devel/python/python/ert_gui/pages/plot/ensemblefetcher.py @@ -22,9 +22,10 @@ import ert.ert.ertwrapper as ertwrapper import ert.ert.enums as enums from PyQt4.QtGui import QWidget, QFormLayout, QSpinBox, QComboBox from PyQt4.QtCore import SIGNAL -from ert.ert.erttypes import time_t +from ert.ert.erttypes import time_t, time_vector import numpy - +from ert.util.tvector import DoubleVector +import datetime class EnsembleFetcher(PlotDataFetcherHandler): """A data fetcher for ensemble parameters.""" @@ -36,58 +37,29 @@ class EnsembleFetcher(PlotDataFetcherHandler): self.keyword_configuration = KeywordConfigurationWidget() self.data_configuration = DataConfigurationWidget() - def emitter(): - self.emit(SIGNAL('dataChanged()')) + def initialize(self, ert): + self.initialized = True + def emitter(): + self.emit(SIGNAL('dataChanged()')) self.connect(self.field_configuration, SIGNAL('configurationChanged()'), emitter) self.connect(self.summary_configuration, SIGNAL('configurationChanged()'), emitter) self.connect(self.keyword_configuration, SIGNAL('configurationChanged()'), emitter) self.connect(self.data_configuration, SIGNAL('configurationChanged()'), emitter) - def initialize(self, ert): - - - ert.prototype("long enkf_main_get_fs(long)") - ert.prototype("int enkf_main_get_ensemble_size(long)") - ert.prototype("long enkf_main_iget_member_config(long, int)") - ert.prototype("void enkf_main_get_observations(long, char*, int, long*, double*, double*)") #main, user_key, *time, *y, *std - ert.prototype("int enkf_main_get_observation_count(long, char*)") - - ert.prototype("bool enkf_fs_has_node(long, long, int, int, int)") - ert.prototype("void enkf_fs_fread_node(long, long, int, int, int)") - - ert.prototype("long enkf_node_alloc(long)") - ert.prototype("void enkf_node_free(long)") - ert.prototype("double enkf_node_user_get(long, char*, bool*)") - - ert.prototype("double member_config_iget_sim_days(long, int, int)") - ert.prototype("time_t member_config_iget_sim_time(long, int, int)") - ert.prototype("int enkf_main_get_history_length(long)") - - - ert.prototype("long enkf_config_node_get_ref(long)") - ert.prototype("bool field_config_ijk_active(long, int, int, int)") - - ert.prototype("bool ecl_sum_has_general_var(long, char*)", lib=ert.ecl) - ert.prototype("int ecl_sum_get_general_var_index(long, char*)", lib=ert.ecl) - - ert.prototype("time_vector ecl_sum_alloc_time_vector(long, bool)", lib=ert.ecl) - ert.prototype("double_vector ecl_sum_alloc_data_vector(long, int, bool)", lib=ert.ecl) - - + + def isHandlerFor(self, ert, key): - return ert.enkf.ensemble_config_has_key(ert.ensemble_config, key) - + return ert.main.ensemble_config.has_key( key) def fetch(self, ert, key, parameter, data, comparison_fs): data.x_data_type = "time" - - fs = ert.enkf.enkf_main_get_fs(ert.main) - config_node = ert.enkf.ensemble_config_get_node(ert.ensemble_config, key) - node = ert.enkf.enkf_node_alloc(config_node) - comp_node = ert.enkf.enkf_node_alloc(config_node) - num_realizations = ert.enkf.enkf_main_get_ensemble_size(ert.main) - + fs = ert.main.get_fs + config_node = ert.main.ensemble_config.get_node(key) + node = config_node.alloc_node + comp_node = config_node.alloc_node + num_realizations = ert.main.ens_size + var_type_set = False user_data = parameter.getUserData() if user_data is None: @@ -98,20 +70,28 @@ class EnsembleFetcher(PlotDataFetcherHandler): key_index = user_data['key_index'] if parameter.getType() == FieldModel.TYPE: - field_position = user_data['field_position'] - field_config = ert.enkf.enkf_config_node_get_ref(config_node) - if ert.enkf.field_config_ijk_active(field_config, field_position[0] - 1, field_position[1] - 1, field_position[2] - 1): + var_type = enums.enkf_var_type.PARAMETER + var_type_set = True + field_position = user_data['field_position'] + field_config = config_node.field_model + if field_config.ijk_active(field_position[0] - 1, field_position[1] - 1, field_position[2] - 1): key_index = "%i,%i,%i" % (field_position[0], field_position[1], field_position[2]) data.setKeyIndexIsIndex(True) else: return False + elif parameter.getType() == DataModel.TYPE: + var_type = enums.enkf_var_type.PARAMETER + var_type_set = True data_index = user_data['data_index'] key_index = "KEY:%d" % data_index data.setKeyIndexIsIndex(True) - data.setKeyIndex(key_index) + if not var_type_set: + var_type = enums.enkf_var_type.DYNAMIC_RESULT + + data.setKeyIndex(key_index) state_list = [user_data['state']] if state_list[0] == enums.ert_state_enum.BOTH: state_list = [enums.ert_state_enum.FORECAST, enums.ert_state_enum.ANALYZED] @@ -128,43 +108,49 @@ class EnsembleFetcher(PlotDataFetcherHandler): x_comp_time = data.x_comp_data[member] y_comp = data.y_comp_data[member] - member_config = ert.enkf.enkf_main_iget_member_config(ert.main, member) - stop_time = ert.enkf.enkf_main_get_history_length( ert.main ) - - for step in range(0, stop_time + 1): - for state in state_list: - if ert.enkf.enkf_fs_has_node(fs, config_node, step, member, state.value()): - sim_time = ert.enkf.member_config_iget_sim_time(member_config, step, fs) - ert.enkf.enkf_fs_fread_node(fs, node, step, member, state.value()) - valid = ertwrapper.c_int() - value = ert.enkf.enkf_node_user_get(node, key_index, ertwrapper.byref(valid)) - if valid.value == 1: - data.checkMaxMin(sim_time) - data.checkMaxMinY(value) - x_time.append(sim_time) - y.append(value) - #else: - # print "Not valid: ", key, member, step, key_index + stop_time = ert.main.get_history_length + for state in state_list: + start_time = 0 + if config_node.get_impl_type == SummaryModel.TYPE: + start_time = 1 + for step in range(start_time, stop_time): + pikk = True + time_map = fs.get_time_map + sim_time_as_c_int = time_map.iget(step) + sim_time_as_time_t = time_t(sim_time_as_c_int) + sim_time_as_ordinal = sim_time_as_time_t.datetime().toordinal() + valid = ertwrapper.c_double() + value = node.user_get(fs, key_index, step, member, state.value(), ertwrapper.byref(valid)) + if value == True: + data.checkMaxMin(sim_time_as_time_t) + data.checkMaxMinY(valid.value) + x_time.append(sim_time_as_ordinal) + y.append(valid.value) + #else: + #print "Not valid: ", key, member, step, key_index, value, state.value() + if not comparison_fs is None: - if ert.enkf.enkf_fs_has_node(comparison_fs, config_node, step, member, state.value()): - sim_time = ert.enkf.member_config_iget_sim_time(member_config, step, comparison_fs) - ert.enkf.enkf_fs_fread_node(comparison_fs, comp_node, step, member, state.value()) - valid = ertwrapper.c_int() - value = ert.enkf.enkf_node_user_get(comp_node, key_index, ertwrapper.byref(valid)) - if valid.value == 1: - #data.checkMaxMin(sim_time) - #data.checkMaxMinY(value) - x_comp_time.append(sim_time) - y_comp.append(value) - #else: - # print "Not valid: ", key, member, step, key_index - - data.x_data[member] = numpy.array([t.datetime() for t in x_time]) + time_map = comparison_fs.get_time_map + sim_time_as_c_int = time_map.iget(step) + sim_time_as_time_t = time_t(sim_time_as_c_int) + sim_time_as_ordinal = sim_time_as_time_t.datetime().toordinal() + valid = ertwrapper.c_double() + value = node.user_get(comparison_fs, key, step, member, state.value(), ertwrapper.byref(valid)) + if value == 1: + data.checkMaxMin(sim_time_as_time_t) + data.checkMaxMinY(valid.value) + x_comp_time.append(sim_time_as_ordinal) + y_comp.append(valid.value) + #else: + # print "Not valid: ", key, member, step, key_index + + + data.x_data[member] = numpy.array(x_time)#[t.datetime() for t in x_time]) data.y_data[member] = numpy.array(y) if not comparison_fs is None: - data.x_comp_data[member] = numpy.array([t.datetime() for t in x_comp_time]) + data.x_comp_data[member] = numpy.array(x_comp_time)#[t.datetime() for t in x_comp_time]) data.y_comp_data[member] = numpy.array(y_comp) @@ -172,8 +158,8 @@ class EnsembleFetcher(PlotDataFetcherHandler): self._getRefCase(ert, key, data) - ert.enkf.enkf_node_free(node) - ert.enkf.enkf_node_free(comp_node) + #node.__del__ + #comp_node.__del__ data.inverted_y_axis = False @@ -183,12 +169,12 @@ class EnsembleFetcher(PlotDataFetcherHandler): else: user_key = key - obs_count = ert.enkf.enkf_main_get_observation_count(ert.main, user_key) + obs_count = ert.main.get_observation_count(user_key) if obs_count > 0: obs_x = (time_t * obs_count)() obs_y = (ertwrapper.c_double * obs_count)() obs_std = (ertwrapper.c_double * obs_count)() - ert.enkf.enkf_main_get_observations(ert.main, user_key, obs_count, obs_x, obs_y, obs_std) + ert.main.get_observations(user_key, obs_count, obs_x, obs_y, obs_std) data.obs_x = numpy.array([t.datetime() for t in obs_x]) data.obs_y = numpy.array(obs_y) @@ -203,12 +189,13 @@ class EnsembleFetcher(PlotDataFetcherHandler): def _getRefCase(self, ert, key, data): - ecl_sum = ert.enkf.ecl_config_get_refcase(ert.ecl_config) + ecl_config = ert.main.ecl_config + ecl_sum = ecl_config.get_refcase - if(ert.ecl.ecl_sum_has_general_var(ecl_sum, key)): - ki = ert.ecl.ecl_sum_get_general_var_index(ecl_sum, key) - x_data = ert.ecl.ecl_sum_alloc_time_vector(ecl_sum, True) - y_data = ert.ecl.ecl_sum_alloc_data_vector(ecl_sum, ki, True) + if(ecl_sum.has_key(key)): + ki = ecl_sum.get_general_var_index(key) + x_data = ecl_sum.alloc_time_vector(True) + y_data = ecl_sum.alloc_data_vector(ki, True) data.refcase_x = [] data.refcase_y = [] @@ -216,7 +203,7 @@ class EnsembleFetcher(PlotDataFetcherHandler): for x in x_data: if not first: data.refcase_x.append(x) - data.checkMaxMin(x) + #data.checkMaxMin(x) else: first = False #skip first element because of eclipse behavior diff --git a/ThirdParty/Ert/devel/libenkf/applications/ert_gui/lib/ert_gui/pages/plot/fetcher.py b/ThirdParty/Ert/devel/python/python/ert_gui/pages/plot/fetcher.py similarity index 100% rename from ThirdParty/Ert/devel/libenkf/applications/ert_gui/lib/ert_gui/pages/plot/fetcher.py rename to ThirdParty/Ert/devel/python/python/ert_gui/pages/plot/fetcher.py diff --git a/ThirdParty/Ert/devel/libenkf/applications/ert_gui/lib/ert_gui/pages/plot/plotconfig.py b/ThirdParty/Ert/devel/python/python/ert_gui/pages/plot/plotconfig.py similarity index 99% rename from ThirdParty/Ert/devel/libenkf/applications/ert_gui/lib/ert_gui/pages/plot/plotconfig.py rename to ThirdParty/Ert/devel/python/python/ert_gui/pages/plot/plotconfig.py index efc16ac434..0917ace506 100644 --- a/ThirdParty/Ert/devel/libenkf/applications/ert_gui/lib/ert_gui/pages/plot/plotconfig.py +++ b/ThirdParty/Ert/devel/python/python/ert_gui/pages/plot/plotconfig.py @@ -120,7 +120,6 @@ class PlotConfig(object): picker = property(getPicker, setPicker, doc="Picker radius") - class PlotConfigPanel(QFrame): """A panel to interact with PlotConfig instances.""" plot_marker_styles = ["", ".", ",", "o", "*", "s", "+", "x", "p", "h", "H", "D", "d"] @@ -210,13 +209,12 @@ class PlotConfigPanel(QFrame): class ColorPicker(QWidget): """A widget that shows a colored box and pops up a color dialog.""" - color_dialog = QColorDialog() def __init__(self, plot_config): QWidget.__init__(self) self.plot_config = plot_config - + self.color_dialog = QColorDialog() size = 20 self.setMaximumSize(QSize(size, size)) self.setMinimumSize(QSize(size, size)) diff --git a/ThirdParty/Ert/devel/libenkf/applications/ert_gui/lib/ert_gui/pages/plot/plotdata.py b/ThirdParty/Ert/devel/python/python/ert_gui/pages/plot/plotdata.py similarity index 73% rename from ThirdParty/Ert/devel/libenkf/applications/ert_gui/lib/ert_gui/pages/plot/plotdata.py rename to ThirdParty/Ert/devel/python/python/ert_gui/pages/plot/plotdata.py index d5c9670b3a..1c46c364ef 100644 --- a/ThirdParty/Ert/devel/libenkf/applications/ert_gui/lib/ert_gui/pages/plot/plotdata.py +++ b/ThirdParty/Ert/devel/python/python/ert_gui/pages/plot/plotdata.py @@ -54,8 +54,7 @@ class PlotDataFetcher(ContentModel, QObject): handler.initialize(ert) self.connect(handler, SIGNAL('dataChanged()'), self.__dataChanged) - ert.prototype("long enkf_main_mount_extra_fs(long, char*)") - ert.prototype("void enkf_fs_free(long)") + #@print_timing @@ -113,12 +112,12 @@ class PlotDataFetcher(ContentModel, QObject): ert = self.getModel() if self.fs_for_comparison_plots: - ert.enkf.enkf_fs_free(self.fs_for_comparison_plots) + fs_for_comparison_plots.__del__ self.fs_for_comparison_plots = None self.comparison_fs_name = "None" if not new_fs == "None": - self.fs_for_comparison_plots = ert.enkf.enkf_main_mount_extra_fs(ert.main, new_fs) + self.fs_for_comparison_plots = ert.main.get_alt_fs(new_fs, false, true) self.comparison_fs_name = new_fs self.__dataChanged() @@ -163,7 +162,7 @@ class PlotData: if self.x_min is None or self.x_max is None: self.x_min = value self.x_max = value - + self.x_min = min(value, self.x_min) self.x_max = max(value, self.x_max) @@ -225,34 +224,12 @@ class PlotData: class PlotContextDataFetcher(ContentModel): - observation_icon = resourceIcon("observation") def __init__(self): ContentModel.__init__(self) + self.observation_icon = resourceIcon("observation") def initialize(self, ert): - - ert.prototype("long enkf_config_node_get_impl_type(long)") - ert.prototype("long enkf_config_node_get_ref(long)") - - ert.prototype("long gen_kw_config_alloc_name_list(long)") - - ert.prototype("long gen_data_config_get_initial_size(long)") - - ert.prototype("int field_config_get_nx(long)") - ert.prototype("int field_config_get_ny(long)") - ert.prototype("int field_config_get_nz(long)") - - ert.prototype("long enkf_main_get_fs(long)") - ert.prototype("char* enkf_fs_get_read_dir(long)") - ert.prototype("long enkf_fs_alloc_dirlist(long)") - - ert.prototype("int plot_config_get_errorbar_max(long)") - ert.prototype("char* plot_config_get_path(long)") - - ert.prototype("long enkf_main_get_obs(long)") - ert.prototype("long enkf_obs_alloc_typed_keylist(long, int)") - self.modelConnect("casesUpdated()", self.fetchContent) @@ -260,14 +237,14 @@ class PlotContextDataFetcher(ContentModel): def getter(self, ert): data = PlotContextData() - keys = ert.getStringList(ert.enkf.ensemble_config_alloc_keylist(ert.ensemble_config), free_after_use=True) + keys = ert.main.ensemble_config.alloc_keylist data.keys = keys data.parameters = [] for key in keys: - config_node = ert.enkf.ensemble_config_get_node(ert.ensemble_config, key) - type = ert.enkf.enkf_config_node_get_impl_type(config_node) - node_ref = ert.enkf.enkf_config_node_get_ref(config_node) + config_node = ert.main.ensemble_config.get_node( key) + type = config_node.get_impl_type + node_ref = config_node.get_ref if type == SummaryModel.TYPE: p = Parameter(key, SummaryModel.TYPE) @@ -278,44 +255,42 @@ class PlotContextDataFetcher(ContentModel): data.parameters.append(p) if data.field_bounds is None: - x = ert.enkf.field_config_get_nx(node_ref) - y = ert.enkf.field_config_get_ny(node_ref) - z = ert.enkf.field_config_get_nz(node_ref) + x = config_node.field_model.get_nx + y = config_node.field_model.get_ny + z = config_node.field_model.get_nz data.field_bounds = (x,y,z) elif type == DataModel.TYPE: data.parameters.append(Parameter(key, DataModel.TYPE)) - data.gen_data_size = ert.enkf.gen_data_config_get_initial_size(node_ref) + data.gen_data_size = 2#config_node.data_model.get_initial_size elif type == KeywordModel.TYPE: p = Parameter(key, KeywordModel.TYPE) data.parameters.append(p) - s = ert.enkf.gen_kw_config_alloc_name_list(node_ref) - data.key_index_list[key] = ert.getStringList(s, free_after_use=True) + s = config_node.keyword_model.alloc_name_list + data.key_index_list[key] = s - data.errorbar_max = ert.enkf.plot_config_get_errorbar_max(ert.plot_config) + data.errorbar_max = ert.main.plot_config.get_errorbar_max - fs = ert.enkf.enkf_main_get_fs(ert.main) - current_case = "default" #ert.enkf.enkf_fs_get_read_dir(fs) + fs = ert.main.get_fs + current_case = ert.main.get_current_fs - data.plot_config_path = ert.enkf.plot_config_get_path(ert.plot_config) - #data.plot_path = ert.enkf.plot_config_get_path(ert.plot_config) + "/" + current_case - data.plot_path = "PLOTXXX" + data.plot_config_path = ert.main.plot_config.get_path + data.plot_path = ert.main.plot_config.get_path + "/" + current_case - enkf_obs = ert.enkf.enkf_main_get_obs(ert.main) - key_list = ert.enkf.enkf_obs_alloc_typed_keylist(enkf_obs, obs_impl_type.FIELD_OBS.value()) - field_obs = ert.getStringList(key_list, free_after_use=True) + enkf_obs = ert.main.get_obs + key_list = enkf_obs.alloc_typed_keylist( obs_impl_type.FIELD_OBS.value()) - for obs in field_obs: - p = Parameter(obs, obs_impl_type.FIELD_OBS, PlotContextDataFetcher.observation_icon) + for obs in key_list: + p = Parameter(obs, obs_impl_type.FIELD_OBS, self.observation_icon) data.parameters.append(p) - #case_list_pointer = ert.enkf.enkf_fs_alloc_dirlist(fs) - #case_list = ert.getStringList(case_list_pointer) - case_list = ["default"] + + case_list = ert.main.alloc_caselist + data.current_case = current_case - #ert.freeStringList(case_list_pointer) + for case in case_list: data.case_list.append(case) diff --git a/ThirdParty/Ert/devel/libenkf/applications/ert_gui/lib/ert_gui/pages/plot/plotfigure.py b/ThirdParty/Ert/devel/python/python/ert_gui/pages/plot/plotfigure.py similarity index 100% rename from ThirdParty/Ert/devel/libenkf/applications/ert_gui/lib/ert_gui/pages/plot/plotfigure.py rename to ThirdParty/Ert/devel/python/python/ert_gui/pages/plot/plotfigure.py diff --git a/ThirdParty/Ert/devel/libenkf/applications/ert_gui/lib/ert_gui/pages/plot/plotgenerator.py b/ThirdParty/Ert/devel/python/python/ert_gui/pages/plot/plotgenerator.py similarity index 100% rename from ThirdParty/Ert/devel/libenkf/applications/ert_gui/lib/ert_gui/pages/plot/plotgenerator.py rename to ThirdParty/Ert/devel/python/python/ert_gui/pages/plot/plotgenerator.py diff --git a/ThirdParty/Ert/devel/libenkf/applications/ert_gui/lib/ert_gui/pages/plot/plotpanel.py b/ThirdParty/Ert/devel/python/python/ert_gui/pages/plot/plotpanel.py similarity index 98% rename from ThirdParty/Ert/devel/libenkf/applications/ert_gui/lib/ert_gui/pages/plot/plotpanel.py rename to ThirdParty/Ert/devel/python/python/ert_gui/pages/plot/plotpanel.py index c2b23c770b..a78439dd77 100644 --- a/ThirdParty/Ert/devel/libenkf/applications/ert_gui/lib/ert_gui/pages/plot/plotpanel.py +++ b/ThirdParty/Ert/devel/python/python/ert_gui/pages/plot/plotpanel.py @@ -82,7 +82,7 @@ class PlotPanel(QtGui.QWidget): plotLayout.addLayout(plot_view_layout) self.plotViewSettings = PlotViewSettingsPanel(plotView=self.plot, width=250) - self.connect(self.plotViewSettings, QtCore.SIGNAL('comparisonCaseSelected(String)'), self.plotDataFetcher.updateComparisonFS) + self.connect(self.plotViewSettings, QtCore.SIGNAL('comparisonCaseSelected(QString)'), self.plotDataFetcher.updateComparisonFS) plotLayout.addWidget(self.plotViewSettings) self.setLayout(plotLayout) @@ -175,12 +175,12 @@ class PlotViewSettingsPanel(QtGui.QFrame): for plot_config in plot_configs: config_panel = PlotConfigPanel(plot_config) tabbed_panel.addTab(config_panel, plot_config.name) - #self.connect(config_panel, SIGNAL('plotConfigChanged()'), self.plotView.drawPlot) + self.connect(config_panel, SIGNAL('plotConfigChanged()'), self.plotView.drawPlot) layout.addWidget(tabbed_panel) tabbed_panel = QTabWidget() - #tabbed_panel.setTabPosition(QTabWidget.West) + tabbed_panel.setTabPosition(QTabWidget.West) tabbed_panel.addTab(self.createMemberSelectionPanel(), "Members") tabbed_panel.addTab(self.createPlotRangePanel(), "Plot") diff --git a/ThirdParty/Ert/devel/libenkf/applications/ert_gui/lib/ert_gui/pages/plot/plotrenderer.py b/ThirdParty/Ert/devel/python/python/ert_gui/pages/plot/plotrenderer.py similarity index 100% rename from ThirdParty/Ert/devel/libenkf/applications/ert_gui/lib/ert_gui/pages/plot/plotrenderer.py rename to ThirdParty/Ert/devel/python/python/ert_gui/pages/plot/plotrenderer.py diff --git a/ThirdParty/Ert/devel/libenkf/applications/ert_gui/lib/ert_gui/pages/plot/plotsettings.py b/ThirdParty/Ert/devel/python/python/ert_gui/pages/plot/plotsettings.py similarity index 98% rename from ThirdParty/Ert/devel/libenkf/applications/ert_gui/lib/ert_gui/pages/plot/plotsettings.py rename to ThirdParty/Ert/devel/python/python/ert_gui/pages/plot/plotsettings.py index 4b58fb0587..b0bc0ec8cf 100644 --- a/ThirdParty/Ert/devel/libenkf/applications/ert_gui/lib/ert_gui/pages/plot/plotsettings.py +++ b/ThirdParty/Ert/devel/python/python/ert_gui/pages/plot/plotsettings.py @@ -65,8 +65,8 @@ class PlotSettings(QObject): self.errorbar_plot_config, self.comparison_plot_config] - for pc in self._plot_configs: - self.connect(pc.signal_handler, SIGNAL('plotConfigChanged(PlotConfig)'), self.notify) + #for pc in self._plot_configs: + # self.connect(pc.signal_handler, SIGNAL('plotConfigChanged(PlotConfig)'), self.notify) self._plot_config_dict = {} for pc in self._plot_configs: diff --git a/ThirdParty/Ert/devel/libenkf/applications/ert_gui/lib/ert_gui/pages/plot/plotsettingsxml.py b/ThirdParty/Ert/devel/python/python/ert_gui/pages/plot/plotsettingsxml.py similarity index 100% rename from ThirdParty/Ert/devel/libenkf/applications/ert_gui/lib/ert_gui/pages/plot/plotsettingsxml.py rename to ThirdParty/Ert/devel/python/python/ert_gui/pages/plot/plotsettingsxml.py diff --git a/ThirdParty/Ert/devel/libenkf/applications/ert_gui/lib/ert_gui/pages/plot/plotview.py b/ThirdParty/Ert/devel/python/python/ert_gui/pages/plot/plotview.py similarity index 99% rename from ThirdParty/Ert/devel/libenkf/applications/ert_gui/lib/ert_gui/pages/plot/plotview.py rename to ThirdParty/Ert/devel/python/python/ert_gui/pages/plot/plotview.py index 5f74965471..5c1e12618a 100644 --- a/ThirdParty/Ert/devel/libenkf/applications/ert_gui/lib/ert_gui/pages/plot/plotview.py +++ b/ThirdParty/Ert/devel/python/python/ert_gui/pages/plot/plotview.py @@ -22,7 +22,7 @@ import time from ert.ert.erttypes import time_t from ert_gui.widgets.util import print_timing -from plotdata import PlotData +from ert_gui.pages.plot.plotdata import PlotData import ert_gui.widgets from PyQt4.QtCore import SIGNAL diff --git a/ThirdParty/Ert/devel/python/python/ert_gui/pages/plot/rftfetcher.py b/ThirdParty/Ert/devel/python/python/ert_gui/pages/plot/rftfetcher.py new file mode 100644 index 0000000000..de87e4860c --- /dev/null +++ b/ThirdParty/Ert/devel/python/python/ert_gui/pages/plot/rftfetcher.py @@ -0,0 +1,164 @@ +# Copyright (C) 2011 Statoil ASA, Norway. +# +# The file 'rftfetcher.py' 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 +# for more details. + + +from fetcher import PlotDataFetcherHandler +import ert.ert.ertwrapper as ertwrapper +import ert.ert.enums as enums +from ert.ert.enums import ert_state_enum, obs_impl_type +import numpy + +class RFTFetcher(PlotDataFetcherHandler): + + def __init__(self): + PlotDataFetcherHandler.__init__(self) + + def initialize(self, ert): + self.initialized = True + + def isHandlerFor(self, ert, key): + enkf_obs = ert.main.get_obs + key_list = enkf_obs.alloc_typed_keylist(obs_impl_type.GEN_OBS.value()) + return key in key_list + + def fetch(self, ert, key, parameter, data, comparison_fs): + enkf_obs = ert.main.get_obs + obs_vector = enkf_obs.get_vector(key) + + num_active = obs_vector.get_num_active + if num_active == 1: + report_step = obs_vector.get_active_report_step + elif num_active > 1: + history_length = ert.main.get_history_length + active = [] + for index in range(history_length): + if obs_vector.iget_active(index): + active.append(index) + print "Active:", active + report_step = active[0] #todo: enable selection from GUI + else: + return + + fs = ert.main.get_fs + state_kw = obs_vector.get_state_kw + + ens_size = ert.main.get_ensemble_size + + config_node = ert.main.ensemble_config.get_node(state_kw) + field_config = config_node.get_ref + block_obs = obs_vector.iget_node(report_step) + + obs_size = block_obs.get_size + grid = field_config.get_grid + + node = config_node.alloc_node + + y_obs = [] + x_obs = [] + x_std = [] + xpos = (ertwrapper.c_double)() + ypos = (ertwrapper.c_double)() + zpos = (ertwrapper.c_double)() + value = (ertwrapper.c_double)() + std = (ertwrapper.c_double)() + for index in range(obs_size): + grid.get_xyz3(block_obs.iget_i(index),block_obs.iget_j(index),block_obs.iget_k(index), xpos, ypos , zpos) + y_obs.append(zpos.value) + block_obs.iget(index, value, std) + x_obs.append(value.value) + x_std.append(std.value) + data.checkMaxMin(value.value + std.value) + data.checkMaxMin(value.value - std.value) + data.obs_y = numpy.array(y_obs) + data.obs_x = numpy.array(x_obs) + data.obs_std_x = numpy.array(x_std) + data.obs_std_y = None + var_type = enums.enkf_var_type.DYNAMIC_RESULT + + for member in range(ens_size): + if node.vector_storage: + if fs.has_vector(config_node, member, ert_state_enum.ANALYZED.value()): + fs.fread_vector(node, member, ert_state_enum.ANALYZED.value()) + elif fs.has_vector(config_node, member, ert_state_enum.FORECAST.value()): + fs.fread_vector(node, member, ert_state_enum.FORECAST.value()) + else: + print "No data found for member %d/%d." % (member, report_step) + continue + else: + if fs.has_node(config_node, var_type, report_step, member, ert_state_enum.ANALYZED.value()): + fs.fread_node(node, var_type, report_step, member, ert_state_enum.ANALYZED.value()) + elif fs.has_node(config_node, var_type, report_step, member, ert_state_enum.FORECAST.value()): + fs.fread_node(node, var_type, report_step, member, ert_state_enum.FORECAST.value()) + else: + print "No data found for member %d/%d." % (member, report_step) + continue + + data.x_data[member] = [] + data.y_data[member] = [] + x_data = data.x_data[member] + y_data = data.y_data[member] + + field = node.value_ptr + for index in range(obs_size): + value = field.ijk_get_double(i[index] , j[index] , k[index]) + x_data.append(value) + y_data.append(y_obs[index]) + data.checkMaxMin(value) + + data.x_data[member] = numpy.array(x_data) + data.y_data[member] = numpy.array(y_data) + + if not comparison_fs is None: + comp_node = config_node.alloc + for member in range(ens_size): + if comparison_fs.has_node(config_node, report_step, member, ert_state_enum.ANALYZED.value()): + comparison_fs.fread_node(comp_node, report_step, member, ert_state_enum.ANALYZED.value()) + elif comparison_fs.has_node(config_node, report_step, member, ert_state_enum.FORECAST.value()): + comparison_fs.fread_node(comp_node, report_step, member, ert_state_enum.FORECAST.value()) + else: + print "No data found for member %d/%d." % (member, report_step) + continue + + data.x_comp_data[member] = [] + data.y_comp_data[member] = [] + x_data = data.x_comp_data[member] + y_data = data.y_comp_data[member] + + field = ert.enkf.enkf_node_value_ptr(comp_node) + for index in range(obs_size): + value = field.ijk_get_double(block_obs.iget_i(index),block_obs.iget_j(index),block_obs.iget_k(index)) + x_data.append(value) + y_data.append(y_obs[index]) + data.checkMaxMin(value) + + data.x_comp_data[member] = numpy.array(x_data) + data.y_comp_data[member] = numpy.array(y_data) + + comp_node.free + + node.free + + data.x_data_type = "number" + data.inverted_y_axis = True + + def getConfigurationWidget(self, context_data): + return None + + def configure(self, parameter, context_data): + pass #nothing to configure, yet + + + diff --git a/ThirdParty/Ert/devel/libenkf/applications/ert_gui/lib/ert_gui/pages/plot/zoomslider.py b/ThirdParty/Ert/devel/python/python/ert_gui/pages/plot/zoomslider.py similarity index 98% rename from ThirdParty/Ert/devel/libenkf/applications/ert_gui/lib/ert_gui/pages/plot/zoomslider.py rename to ThirdParty/Ert/devel/python/python/ert_gui/pages/plot/zoomslider.py index d33162c698..72fd79558c 100644 --- a/ThirdParty/Ert/devel/libenkf/applications/ert_gui/lib/ert_gui/pages/plot/zoomslider.py +++ b/ThirdParty/Ert/devel/python/python/ert_gui/pages/plot/zoomslider.py @@ -190,7 +190,6 @@ class ZoomSlider(QFrame): if self.max_value > 1.0: self.max_value = 1 - #print "max:", self.min_value, self.max_value self.emit(SIGNAL('zoomValueChanged(float, float)'), self.min_value, self.max_value) @@ -213,7 +212,6 @@ class ZoomSlider(QFrame): if self.min_value < 0.0: self.min_value = 0.0 - #print "min:", self.min_value, self.max_value self.emit(SIGNAL('zoomValueChanged(float, float)'), self.min_value, self.max_value) diff --git a/ThirdParty/Ert/devel/python/python/ert_gui/pages/run/CMakeLists.txt b/ThirdParty/Ert/devel/python/python/ert_gui/pages/run/CMakeLists.txt new file mode 100644 index 0000000000..4594781ddb --- /dev/null +++ b/ThirdParty/Ert/devel/python/python/ert_gui/pages/run/CMakeLists.txt @@ -0,0 +1 @@ +add_python_package( "Python ert_gui.pages.run" ${PYTHON_INSTALL_PREFIX}/ert_gui/pages/run "__init__.py;runpanel.py;simulation.py;simulationsdialog.py;legend.py" True) diff --git a/ThirdParty/Ert/devel/libenkf/applications/ert_gui/lib/ert_gui/pages/run/__init__.py b/ThirdParty/Ert/devel/python/python/ert_gui/pages/run/__init__.py similarity index 100% rename from ThirdParty/Ert/devel/libenkf/applications/ert_gui/lib/ert_gui/pages/run/__init__.py rename to ThirdParty/Ert/devel/python/python/ert_gui/pages/run/__init__.py diff --git a/ThirdParty/Ert/devel/libenkf/applications/ert_gui/lib/ert_gui/pages/run/legend.py b/ThirdParty/Ert/devel/python/python/ert_gui/pages/run/legend.py similarity index 100% rename from ThirdParty/Ert/devel/libenkf/applications/ert_gui/lib/ert_gui/pages/run/legend.py rename to ThirdParty/Ert/devel/python/python/ert_gui/pages/run/legend.py diff --git a/ThirdParty/Ert/devel/libenkf/applications/ert_gui/lib/ert_gui/pages/run/runpanel.py b/ThirdParty/Ert/devel/python/python/ert_gui/pages/run/runpanel.py similarity index 90% rename from ThirdParty/Ert/devel/libenkf/applications/ert_gui/lib/ert_gui/pages/run/runpanel.py rename to ThirdParty/Ert/devel/python/python/ert_gui/pages/run/runpanel.py index dfc44d7eb0..30e1f923bd 100644 --- a/ThirdParty/Ert/devel/libenkf/applications/ert_gui/lib/ert_gui/pages/run/runpanel.py +++ b/ThirdParty/Ert/devel/python/python/ert_gui/pages/run/runpanel.py @@ -30,7 +30,7 @@ from simulationsdialog import SimulationsDialog class RunWidget(HelpedWidget): """A widget that shows simulation parameters and the possibility to start the simulation""" - run_mode_type = {"ENKF_ASSIMILATION" : 1, "ENSEMBLE_EXPERIMENT" : 2, "ENSEMBLE_PREDICTION" : 3, "INIT_ONLY" : 4} + run_mode_type = {"ENKF_ASSIMILATION" : 1, "ENSEMBLE_EXPERIMENT" : 2, "ENSEMBLE_PREDICTION" : 3, "INIT_ONLY" : 4, "SMOOTHER" : 5} state_enum = {"UNDEFINED" : 0, "SERIALIZED" : 1, "FORECAST" : 2, "ANALYZED" : 4, "BOTH" : 6} def __init__(self, parent=None): @@ -40,8 +40,9 @@ class RunWidget(HelpedWidget): self.modelConnect("ensembleResized()", self.fetchContent) self.modelConnect("runpathChanged()", self.fetchContent) - #self.rbAssimilation.toggle() - self.rbExperiment.toggle() + self.rbAssimilation.toggle() + #self.rbExperiment.toggle() + #self.rbSmoother.toggle() def createPanel(self, parent): """Creates the panel with the simulation parameters.""" @@ -114,11 +115,9 @@ class RunWidget(HelpedWidget): QtGui.QMessageBox.warning(self, "Missing data", "At least one member must be selected!") return - member_mask = ert.createBoolVector(self.membersList.count(), selectedMembers) - if not ert.enkf.enkf_main_is_initialized(ert.main, member_mask): + if not ert.main.is_initialized: QtGui.QMessageBox.warning(self, "Case not initialized", "The case must be initialized before simulation can start!") return - ert.freeBoolVector(member_mask) simFrom = self.simulateFrom.getSelectedValue() @@ -126,11 +125,13 @@ class RunWidget(HelpedWidget): if self.rbAssimilation.isChecked(): mode = self.run_mode_type["ENKF_ASSIMILATION"] - else: + if self.rbExperiment.isChecked(): if simTo == -1: # -1 == End mode = self.run_mode_type["ENSEMBLE_PREDICTION"] else: mode = self.run_mode_type["ENSEMBLE_EXPERIMENT"] + if self.rbSmoother.isChecked(): + mode = self.run_mode_type["SMOOTHER"] state = self.state_enum["ANALYZED"] if self.startState.currentText() == "Forecast" and not simFrom == 0: @@ -183,18 +184,12 @@ class RunWidget(HelpedWidget): self.membersList.selectAll() - def initialize(self, ert): - """Prototype functions""" - ert.prototype("int enkf_main_get_ensemble_size(long)") - ert.prototype("int enkf_main_get_history_length(long)") - ert.prototype("char* model_config_get_runpath_as_char(long)") - ert.prototype("bool enkf_main_is_initialized(long)") def getter(self, ert): """Fetch data from EnKF. Such as number of realizations, runpath and number of timesteps.""" - members = ert.enkf.enkf_main_get_ensemble_size(ert.main) - historyLength = ert.enkf.enkf_main_get_history_length(ert.main) - runpath = ert.enkf.model_config_get_runpath_as_char(ert.model_config) + members = ert.main.ens_size + historyLength = ert.main.get_history_length + runpath = ert.main.model_config.get_runpath_as_char return {"members" : range(members), "history_length" : historyLength, "runpath" : runpath} @@ -210,17 +205,19 @@ class RunWidget(HelpedWidget): def createRadioButtons(self): """Create a toggle between assimilation and experiment.""" radioLayout = QtGui.QVBoxLayout() - radioLayout.setSpacing(2) + radioLayout.setSpacing(3) self.rbExperiment = QtGui.QRadioButton("Ensemble experiment") radioLayout.addWidget(self.rbExperiment) self.rbAssimilation = QtGui.QRadioButton("EnKF assimilation") radioLayout.addWidget(self.rbAssimilation) - + self.rbSmoother = QtGui.QRadioButton("Smoother") + radioLayout.addWidget(self.rbSmoother) self.connect(self.rbAssimilation , QtCore.SIGNAL('toggled(bool)'), lambda : self.rbToggle()) self.connect(self.rbExperiment , QtCore.SIGNAL('toggled(bool)'), lambda : self.rbToggle()) - + self.connect(self.rbSmoother , QtCore.SIGNAL('toggled(bool)'), lambda : self.rbToggle()) + return radioLayout diff --git a/ThirdParty/Ert/devel/libenkf/applications/ert_gui/lib/ert_gui/pages/run/simulation.py b/ThirdParty/Ert/devel/python/python/ert_gui/pages/run/simulation.py similarity index 92% rename from ThirdParty/Ert/devel/libenkf/applications/ert_gui/lib/ert_gui/pages/run/simulation.py rename to ThirdParty/Ert/devel/python/python/ert_gui/pages/run/simulation.py index 25b3b57d70..0a880b913c 100644 --- a/ThirdParty/Ert/devel/libenkf/applications/ert_gui/lib/ert_gui/pages/run/simulation.py +++ b/ThirdParty/Ert/devel/python/python/ert_gui/pages/run/simulation.py @@ -314,18 +314,9 @@ class SimulationPanelController: self.selectedSimulations = [] self.view.connect(self.view, QtCore.SIGNAL('simulationsUpdated()'), self.showSelectedSimulations) + def initialize(self, ert): - """Set prototypes for ERT""" if not self.initialized: - ert.prototype("bool job_queue_get_pause(long)", lib = ert.job_queue) - ert.prototype("void job_queue_set_pause_on(long)", lib = ert.job_queue) - ert.prototype("void job_queue_set_pause_off(long)", lib = ert.job_queue) - ert.prototype("void job_queue_user_exit(long)", lib = ert.job_queue) - ert.prototype("long enkf_main_iget_state(long, int)") - ert.prototype("void enkf_state_kill_simulation(long)") - ert.prototype("void enkf_state_resubmit_simulation(long, int)") - ert.prototype("int enkf_state_get_run_status(long)") - ert.prototype("long site_config_get_job_queue(long)") self.initialized = True def setModel(self, ert): @@ -336,39 +327,39 @@ class SimulationPanelController: def kill(self): """Kills the selected simulations.""" for simulation in self.selectedSimulations: - state = self.ert.enkf.enkf_main_iget_state(self.ert.main, simulation.name) - status = self.ert.enkf.enkf_state_get_run_status(state) + state = self.ert.main.iget_state(simulation.name) + status = state.get_run_status #if status == Simulation.RUNNING: - self.ert.enkf.enkf_state_kill_simulation(state) + state.kill_simulation def restart(self, resample): """Restarts the selected simulations. May also resample.""" for simulation in self.selectedSimulations: - state = self.ert.enkf.enkf_main_iget_state(self.ert.main, simulation.name) - status = self.ert.enkf.enkf_state_get_run_status(state) + state = self.ert.main.iget_state(simulation.name) + status = state.get_run_status #if status == Simulation.USER_KILLED: - self.ert.enkf.enkf_state_resubmit_simulation(state , resample) + state.resubmit_simulation(resample) def pause(self, pause): """Pause the job queue after the currently running jobs are finished.""" - job_queue = self.ert.enkf.site_config_get_job_queue(self.ert.site_config) + job_queue = self.ert.main.site_config.get_job_queue if pause: self.statistics.stop() - self.ert.job_queue.job_queue_set_pause_on(job_queue) + job_queue.set_pause_on else: self.statistics.startTiming() - self.ert.job_queue.job_queue_set_pause_off(job_queue) + job_queue.set_pause_off def killAll(self): """Kills all simulations""" killAll = QtGui.QMessageBox.question(self.view, "Remove all jobs?", "Are you sure you want to remove all jobs from the queue?", QtGui.QMessageBox.Yes | QtGui.QMessageBox.No) if killAll == QtGui.QMessageBox.Yes: - job_queue = self.ert.enkf.site_config_get_job_queue(self.ert.site_config) - self.ert.job_queue.job_queue_user_exit(job_queue) + job_queue = self.ert.main.site_config.get_job_queue + job_queue.user_exit def showSelectedSimulations(self): """Update information relating to a single job""" diff --git a/ThirdParty/Ert/devel/libenkf/applications/ert_gui/lib/ert_gui/pages/run/simulationsdialog.py b/ThirdParty/Ert/devel/python/python/ert_gui/pages/run/simulationsdialog.py similarity index 90% rename from ThirdParty/Ert/devel/libenkf/applications/ert_gui/lib/ert_gui/pages/run/simulationsdialog.py rename to ThirdParty/Ert/devel/python/python/ert_gui/pages/run/simulationsdialog.py index 9f41bd57b6..c6f51489c1 100644 --- a/ThirdParty/Ert/devel/libenkf/applications/ert_gui/lib/ert_gui/pages/run/simulationsdialog.py +++ b/ThirdParty/Ert/devel/python/python/ert_gui/pages/run/simulationsdialog.py @@ -25,6 +25,7 @@ import time from ert_gui.widgets.util import getItemsFromList from ert.ert.enums import ert_job_status_type from PyQt4.QtGui import QApplication +from ert.util.tvector import BoolVector class SimulationsDialog(QtGui.QDialog): """A dialog that shows the progress of a simulation""" @@ -159,17 +160,10 @@ class SimulationsDialogController: selection = getItemsFromList(self.view.simulationList, lambda item : item.simulation) self.view.simulationPanel.setSimulations(selection) - def initialize(self, ert): - """Protoype ERT functions""" if not self.initialized: - ert.prototype("long enkf_main_iget_state(long, int)") - ert.prototype("int enkf_state_get_run_status(long)") - ert.prototype("long site_config_queue_is_running(long)") - ert.prototype("long enkf_state_get_start_time(long)") - ert.prototype("long enkf_state_get_submit_time(long)") self.initialized = True - + def start(self, **kwargs): """Start the simulation. Two threads are started one for the simulation and one for progress monitoring""" ert = kwargs["ert"] @@ -196,11 +190,8 @@ class SimulationsDialogController: self.runthread = threading.Thread(name="enkf_main_run") def run(): self.view.setRunningState(True) - boolVector = ert.createBoolVector(memberCount, selectedMembers) - boolPtr = ert.getBoolVectorPtr(boolVector) - - ert.enkf.enkf_main_run(ert.main, mode, boolPtr, init_step_parameter, simFrom, state) - ert.freeBoolVector(boolVector) + boolVector = BoolVector.active_mask(str(selectedMembers).strip('[]')) + ert.main.run(boolVector, init_step_parameter, simFrom, state, mode) self.view.setRunningState(False) self.runthread.setDaemon(True) @@ -209,21 +200,21 @@ class SimulationsDialogController: self.pollthread = threading.Thread(name="polling_thread") def poll(): - while not ert.enkf.site_config_queue_is_running(ert.site_config): + while not ert.main.site_config.queue_is_running: time.sleep(0.5) job_start_time = int(time.time()) while(self.runthread.isAlive()): for member in selectedMembers: - state = ert.enkf.enkf_main_iget_state( ert.main , member) - status = ert.enkf.enkf_state_get_run_status( state ) + state = ert.main.iget_state(member) + status = state.get_run_status simulations[member].simulation.setStatus(ert_job_status_type.resolveValue(status)) if not ert_job_status_type.NOT_ACTIVE == status: - start_time = ert.enkf.enkf_state_get_start_time(state) - submit_time = ert.enkf.enkf_state_get_submit_time(state) + start_time = state.get_start_time + submit_time = state.get_submit_time simulations[member].simulation.setStartTime(start_time) simulations[member].simulation.setSubmitTime(submit_time) diff --git a/ThirdParty/Ert/devel/python/python/ert_gui/widgets/CMakeLists.txt b/ThirdParty/Ert/devel/python/python/ert_gui/widgets/CMakeLists.txt new file mode 100644 index 0000000000..95ee1e73ca --- /dev/null +++ b/ThirdParty/Ert/devel/python/python/ert_gui/widgets/CMakeLists.txt @@ -0,0 +1,2 @@ +add_python_package( "Python ert_gui.widgets" ${PYTHON_INSTALL_PREFIX}/ert_gui/widgets "__init__.py;activelabel.py;checkbox.py;cogwheel.py;combochoice.py;configpanel.py;helpedwidget.py;help.py;pathchooser.py;reloadbutton.py;searchablelist.py;spinnerwidgets.py;stringbox.py;tablewidgets.py;util.py;validateddialog.py" True) + diff --git a/ThirdParty/Ert/devel/libenkf/applications/ert_gui/lib/ert_gui/widgets/__init__.py b/ThirdParty/Ert/devel/python/python/ert_gui/widgets/__init__.py similarity index 100% rename from ThirdParty/Ert/devel/libenkf/applications/ert_gui/lib/ert_gui/widgets/__init__.py rename to ThirdParty/Ert/devel/python/python/ert_gui/widgets/__init__.py diff --git a/ThirdParty/Ert/devel/libenkf/applications/ert_gui/lib/ert_gui/widgets/activelabel.py b/ThirdParty/Ert/devel/python/python/ert_gui/widgets/activelabel.py similarity index 96% rename from ThirdParty/Ert/devel/libenkf/applications/ert_gui/lib/ert_gui/widgets/activelabel.py rename to ThirdParty/Ert/devel/python/python/ert_gui/widgets/activelabel.py index 56fd67d916..223fca5856 100644 --- a/ThirdParty/Ert/devel/libenkf/applications/ert_gui/lib/ert_gui/widgets/activelabel.py +++ b/ThirdParty/Ert/devel/python/python/ert_gui/widgets/activelabel.py @@ -44,4 +44,4 @@ class ActiveLabel(HelpedWidget): if self_get_from_model is None: self_get_from_model = "" - self.active_label.setText(self_get_from_model) + self.active_label.setText("%s" % self_get_from_model) diff --git a/ThirdParty/Ert/devel/libenkf/applications/ert_gui/lib/ert_gui/widgets/checkbox.py b/ThirdParty/Ert/devel/python/python/ert_gui/widgets/checkbox.py similarity index 100% rename from ThirdParty/Ert/devel/libenkf/applications/ert_gui/lib/ert_gui/widgets/checkbox.py rename to ThirdParty/Ert/devel/python/python/ert_gui/widgets/checkbox.py diff --git a/ThirdParty/Ert/devel/libenkf/applications/ert_gui/lib/ert_gui/widgets/cogwheel.py b/ThirdParty/Ert/devel/python/python/ert_gui/widgets/cogwheel.py similarity index 100% rename from ThirdParty/Ert/devel/libenkf/applications/ert_gui/lib/ert_gui/widgets/cogwheel.py rename to ThirdParty/Ert/devel/python/python/ert_gui/widgets/cogwheel.py diff --git a/ThirdParty/Ert/devel/libenkf/applications/ert_gui/lib/ert_gui/widgets/combochoice.py b/ThirdParty/Ert/devel/python/python/ert_gui/widgets/combochoice.py similarity index 90% rename from ThirdParty/Ert/devel/libenkf/applications/ert_gui/lib/ert_gui/widgets/combochoice.py rename to ThirdParty/Ert/devel/python/python/ert_gui/widgets/combochoice.py index 93ff0d700f..6813e8e99a 100644 --- a/ThirdParty/Ert/devel/libenkf/applications/ert_gui/lib/ert_gui/widgets/combochoice.py +++ b/ThirdParty/Ert/devel/python/python/ert_gui/widgets/combochoice.py @@ -14,7 +14,7 @@ # See the GNU General Public License at # for more details. - +import sys from PyQt4 import QtGui, QtCore from helpedwidget import * @@ -54,7 +54,11 @@ class ComboChoice(HelpedWidget): break if not indexSet: - raise AssertionError("ComboBox can not be set to: " + str(newValue)) + self.combo.setCurrentIndex(0) + sys.stderr.write("AssertionError: ComboBox can not be set to: " + str(newValue) + "\n") + #raise AssertionError("ComboBox can not be set to: " + str(newValue)) + + def updateList(self, choiceList): """Replace the list of choices with the specified items""" diff --git a/ThirdParty/Ert/devel/libenkf/applications/ert_gui/lib/ert_gui/widgets/configpanel.py b/ThirdParty/Ert/devel/python/python/ert_gui/widgets/configpanel.py similarity index 100% rename from ThirdParty/Ert/devel/libenkf/applications/ert_gui/lib/ert_gui/widgets/configpanel.py rename to ThirdParty/Ert/devel/python/python/ert_gui/widgets/configpanel.py diff --git a/ThirdParty/Ert/devel/libenkf/applications/ert_gui/lib/ert_gui/widgets/help.py b/ThirdParty/Ert/devel/python/python/ert_gui/widgets/help.py similarity index 100% rename from ThirdParty/Ert/devel/libenkf/applications/ert_gui/lib/ert_gui/widgets/help.py rename to ThirdParty/Ert/devel/python/python/ert_gui/widgets/help.py diff --git a/ThirdParty/Ert/devel/libenkf/applications/ert_gui/lib/ert_gui/widgets/helpedwidget.py b/ThirdParty/Ert/devel/python/python/ert_gui/widgets/helpedwidget.py similarity index 100% rename from ThirdParty/Ert/devel/libenkf/applications/ert_gui/lib/ert_gui/widgets/helpedwidget.py rename to ThirdParty/Ert/devel/python/python/ert_gui/widgets/helpedwidget.py diff --git a/ThirdParty/Ert/devel/libenkf/applications/ert_gui/lib/ert_gui/widgets/pathchooser.py b/ThirdParty/Ert/devel/python/python/ert_gui/widgets/pathchooser.py similarity index 99% rename from ThirdParty/Ert/devel/libenkf/applications/ert_gui/lib/ert_gui/widgets/pathchooser.py rename to ThirdParty/Ert/devel/python/python/ert_gui/widgets/pathchooser.py index b9ee45750e..0c24134f26 100644 --- a/ThirdParty/Ert/devel/libenkf/applications/ert_gui/lib/ert_gui/widgets/pathchooser.py +++ b/ThirdParty/Ert/devel/python/python/ert_gui/widgets/pathchooser.py @@ -182,7 +182,7 @@ class PathChooser(HelpedWidget): path = self.getFromModel() if path is None: path = "" - - self.pathLine.setText(path) + + self.pathLine.setText("%s" % path) self.editing = False diff --git a/ThirdParty/Ert/devel/libenkf/applications/ert_gui/lib/ert_gui/widgets/reloadbutton.py b/ThirdParty/Ert/devel/python/python/ert_gui/widgets/reloadbutton.py similarity index 100% rename from ThirdParty/Ert/devel/libenkf/applications/ert_gui/lib/ert_gui/widgets/reloadbutton.py rename to ThirdParty/Ert/devel/python/python/ert_gui/widgets/reloadbutton.py diff --git a/ThirdParty/Ert/devel/libenkf/applications/ert_gui/lib/ert_gui/widgets/searchablelist.py b/ThirdParty/Ert/devel/python/python/ert_gui/widgets/searchablelist.py similarity index 100% rename from ThirdParty/Ert/devel/libenkf/applications/ert_gui/lib/ert_gui/widgets/searchablelist.py rename to ThirdParty/Ert/devel/python/python/ert_gui/widgets/searchablelist.py diff --git a/ThirdParty/Ert/devel/libenkf/applications/ert_gui/lib/ert_gui/widgets/spinnerwidgets.py b/ThirdParty/Ert/devel/python/python/ert_gui/widgets/spinnerwidgets.py similarity index 100% rename from ThirdParty/Ert/devel/libenkf/applications/ert_gui/lib/ert_gui/widgets/spinnerwidgets.py rename to ThirdParty/Ert/devel/python/python/ert_gui/widgets/spinnerwidgets.py diff --git a/ThirdParty/Ert/devel/libenkf/applications/ert_gui/lib/ert_gui/widgets/stringbox.py b/ThirdParty/Ert/devel/python/python/ert_gui/widgets/stringbox.py similarity index 98% rename from ThirdParty/Ert/devel/libenkf/applications/ert_gui/lib/ert_gui/widgets/stringbox.py rename to ThirdParty/Ert/devel/python/python/ert_gui/widgets/stringbox.py index 88384e4eee..71064308a5 100644 --- a/ThirdParty/Ert/devel/libenkf/applications/ert_gui/lib/ert_gui/widgets/stringbox.py +++ b/ThirdParty/Ert/devel/python/python/ert_gui/widgets/stringbox.py @@ -56,7 +56,7 @@ class StringBox(HelpedWidget): if self_get_from_model is None: self_get_from_model = "" - self.boxString.setText(self_get_from_model) + self.boxString.setText("%s" % self_get_from_model) diff --git a/ThirdParty/Ert/devel/libenkf/applications/ert_gui/lib/ert_gui/widgets/tablewidgets.py b/ThirdParty/Ert/devel/python/python/ert_gui/widgets/tablewidgets.py similarity index 100% rename from ThirdParty/Ert/devel/libenkf/applications/ert_gui/lib/ert_gui/widgets/tablewidgets.py rename to ThirdParty/Ert/devel/python/python/ert_gui/widgets/tablewidgets.py diff --git a/ThirdParty/Ert/devel/libenkf/applications/ert_gui/lib/ert_gui/widgets/util.py b/ThirdParty/Ert/devel/python/python/ert_gui/widgets/util.py similarity index 99% rename from ThirdParty/Ert/devel/libenkf/applications/ert_gui/lib/ert_gui/widgets/util.py rename to ThirdParty/Ert/devel/python/python/ert_gui/widgets/util.py index 128830af34..d6c42ebee4 100644 --- a/ThirdParty/Ert/devel/libenkf/applications/ert_gui/lib/ert_gui/widgets/util.py +++ b/ThirdParty/Ert/devel/python/python/ert_gui/widgets/util.py @@ -22,7 +22,7 @@ import time # The variable @img_prefix should be set to point to a directory # containing icons and images. In the current implementation this # variable is set from the gert_main.py script. -img_prefix = None +img_prefix = "" def resourceIcon(name): """Load an image as an icon""" diff --git a/ThirdParty/Ert/devel/libenkf/applications/ert_gui/lib/ert_gui/widgets/validateddialog.py b/ThirdParty/Ert/devel/python/python/ert_gui/widgets/validateddialog.py similarity index 100% rename from ThirdParty/Ert/devel/libenkf/applications/ert_gui/lib/ert_gui/widgets/validateddialog.py rename to ThirdParty/Ert/devel/python/python/ert_gui/widgets/validateddialog.py diff --git a/ThirdParty/Ert/devel/python/test/CMakeLists.txt b/ThirdParty/Ert/devel/python/test/CMakeLists.txt index ddb67a7448..013b813580 100644 --- a/ThirdParty/Ert/devel/python/test/CMakeLists.txt +++ b/ThirdParty/Ert/devel/python/test/CMakeLists.txt @@ -1,22 +1,68 @@ -add_python_package("Python test" "${PYTHON_INSTALL_PREFIX}/test" "ecl_isosurf.py;enkf_test.py;ens_config_test.py;file_test.py;fortio_test.py;grav_test.py;grdecl_test.py;grid_test0.py;grid_test.py;import_test.py;job_test.py;kw_test.py;large_mem_test.py;latex_test.py;petrel_kw.py;poly_test.py;region_test.py;restart_test.py;rft_test.py;sched_test.py;stringlist_test.py;sum_test.py;test_all.py;test_fast.py;test_util.py;troll_test.py;util_test.py;ctest_run.py" OFF) +add_python_package("Python test" "${PYTHON_INSTALL_PREFIX}/test" "ecl_isosurf.py;enkf_test.py;ens_config_test.py;file_test.py;fortio_test.py;grav_test.py;grdecl_test.py;grid_test0.py;grid_test.py;import_test.py;job_test.py;kw_test.py;large_mem_test.py;latex_test.py;petrel_kw.py;poly_test.py;region_test.py;restart_test.py;rft_test.py;sched_test.py;stringlist_test.py;sum_test.py;test_all.py;test_fast.py;test_util.py;troll_test.py;util_test.py;ctest_run.py" True) -add_test( NAME python.import_all WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR} COMMAND ctest_run.py ${PROJECT_BINARY_DIR}/${PYTHON_INSTALL_PREFIX} import_test ) +# The test date is located in the current source directory; that is +# the reason we set that as the working directory for the test +# run. The module to import should then be in the default python +# module search path (i.e. current directory), whereas the location of +# the actual ert package is given by the first argument to ctest. -add_test( NAME python.ert.util.stringlist WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR} COMMAND ctest_run.py ${PROJECT_BINARY_DIR}/${PYTHON_INSTALL_PREFIX} stringlist_test ) +add_test( NAME python.import_all + WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR} + COMMAND ctest_run.py ${PROJECT_BINARY_DIR}/${PYTHON_INSTALL_PREFIX} import_test ) -add_test( NAME python.ert.ecl.ecl_grid WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR} COMMAND ctest_run.py ${PROJECT_BINARY_DIR}/${PYTHON_INSTALL_PREFIX} grid_test ) -add_test( NAME python.ert.ecl.ecl_kw WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR} COMMAND ctest_run.py ${PROJECT_BINARY_DIR}/${PYTHON_INSTALL_PREFIX} kw_test ) -add_test( NAME python.ert.ecl.ecl_sum WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR} COMMAND ctest_run.py ${PROJECT_BINARY_DIR}/${PYTHON_INSTALL_PREFIX} sum_test ) -add_test( NAME python.ert.ecl.ecl_file WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR} COMMAND ctest_run.py ${PROJECT_BINARY_DIR}/${PYTHON_INSTALL_PREFIX} file_test False) -add_test( NAME python.ert.ecl.ecl_file_slow WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR} COMMAND ctest_run.py ${PROJECT_BINARY_DIR}/${PYTHON_INSTALL_PREFIX} file_test True) +add_test( NAME python.import_local + WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR} + COMMAND ctest_run.py ${PROJECT_BINARY_DIR}/${PYTHON_INSTALL_PREFIX} import_local ) + +add_test( NAME python.ert.util.stringlist + WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR} + COMMAND ctest_run.py ${PROJECT_BINARY_DIR}/${PYTHON_INSTALL_PREFIX} stringlist_test ) + +add_test( NAME python.ert.util.tvector + WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR} + COMMAND ctest_run.py ${PROJECT_BINARY_DIR}/${PYTHON_INSTALL_PREFIX} tvector_test ) + +add_test( NAME python.ert.ecl.ecl_grid + WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR} + COMMAND ctest_run.py ${PROJECT_BINARY_DIR}/${PYTHON_INSTALL_PREFIX} grid_test ) + +add_test( NAME python.ert.ecl.ecl_kw + WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR} + COMMAND ctest_run.py ${PROJECT_BINARY_DIR}/${PYTHON_INSTALL_PREFIX} kw_test ) + +add_test( NAME python.ert.ecl.ecl_sum + WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR} + COMMAND ctest_run.py ${PROJECT_BINARY_DIR}/${PYTHON_INSTALL_PREFIX} sum_test ) + +add_test( NAME python.ert.ecl.ecl_file + WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR} + COMMAND ctest_run.py ${PROJECT_BINARY_DIR}/${PYTHON_INSTALL_PREFIX} file_test False) + +add_test( NAME python.ert.ecl.ecl_file_slow + WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR} + COMMAND ctest_run.py ${PROJECT_BINARY_DIR}/${PYTHON_INSTALL_PREFIX} file_test True) + +add_test( NAME python.ert.ecl.ecl_rft + WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR} + COMMAND ctest_run.py ${PROJECT_BINARY_DIR}/${PYTHON_INSTALL_PREFIX} rft_test) + +add_test( NAME python.ert.ecl.ecl_rft_cell + WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR} + COMMAND ctest_run.py ${PROJECT_BINARY_DIR}/${PYTHON_INSTALL_PREFIX} rft_cell_test) -set_property( TEST python.ert.ecl.ecl_file PROPERTY LABELS Python:Statoil ) -set_property( TEST python.ert.ecl.ecl_file_slow PROPERTY LABELS Python:Statoil:Slow ) -set_property( TEST python.ert.ecl.ecl_sum PROPERTY LABELS Python:Statoil ) -set_property( TEST python.ert.ecl.ecl_kw PROPERTY LABELS Python:Statoil ) -set_property( TEST python.ert.ecl.ecl_grid PROPERTY LABELS Python:Statoil:Slow ) -set_property( TEST python.import_all PROPERTY LABELS Python ) +set_property( TEST python.ert.ecl.ecl_file PROPERTY LABELS Python:StatoilData ) +set_property( TEST python.ert.ecl.ecl_file_slow PROPERTY LABELS Python:StatoilData:Slow ) +set_property( TEST python.ert.ecl.ecl_sum PROPERTY LABELS Python:StatoilData ) +set_property( TEST python.ert.ecl.ecl_kw PROPERTY LABELS Python:StatoilData ) +set_property( TEST python.ert.ecl.ecl_rft PROPERTY LABELS Python:StatoilData ) +set_property( TEST python.ert.ecl.ecl_grid PROPERTY LABELS Python:StatoilData:Slow ) +set_property( TEST python.import_local PROPERTY LABELS Python:StatoilBuild ) + +set_property( TEST python.import_all PROPERTY LABELS Python) set_property( TEST python.ert.util.stringlist PROPERTY LABELS Python ) +set_property( TEST python.ert.util.tvector PROPERTY LABELS Python ) +set_property( TEST python.import_all PROPERTY ENVIRONMENT "ERT_SHARE_PATH=${PROJECT_SOURCE_PATH}/share") + diff --git a/ThirdParty/Ert/devel/python/test/ctest_run.py b/ThirdParty/Ert/devel/python/test/ctest_run.py index 3a92296e4d..8ca5f144b3 100644 --- a/ThirdParty/Ert/devel/python/test/ctest_run.py +++ b/ThirdParty/Ert/devel/python/test/ctest_run.py @@ -5,11 +5,17 @@ import unittest def run_suite( test_suite ): test_result = unittest.TextTestRunner(verbosity = 0).run( test_suite ) - if test_result.errors: + if test_result.errors or test_result.failures: for (test , trace_back) in test_result.errors: sys.stderr.write("=================================================================\n") - sys.stderr.write("Test:%s failed \n" % test.id()) + sys.stderr.write("Test:%s error \n" % test.id()) sys.stderr.write("%s\n" % trace_back) + + for (test , trace_back) in test_result.failures: + sys.stderr.write("=================================================================\n") + sys.stderr.write("Test:%s failure \n" % test.id()) + sys.stderr.write("%s\n" % trace_back) + return False else: return True diff --git a/ThirdParty/Ert/devel/python/test/enkf_test.py b/ThirdParty/Ert/devel/python/test/enkf_test.py index 1126f0248f..b923a7ce9c 100644 --- a/ThirdParty/Ert/devel/python/test/enkf_test.py +++ b/ThirdParty/Ert/devel/python/test/enkf_test.py @@ -1,7 +1,7 @@ #!/usr/bin/env python # Copyright (C) 2012 Statoil ASA, Norway. # -# The file 'sum_test.py' is part of ERT - Ensemble based Reservoir Tool. +# The file 'enkf_test.py' 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 @@ -19,10 +19,12 @@ import datetime import unittest import ert import ert.enkf.enkf as enkf -from ert.util.tvector import * +from ert.util.tvector import * from test_util import approx_equal, approx_equalv -case = "../../../libenkf/src/Gurbat/enkf.ext" +case = "/private/inmyr/ERT-Intro/testcase/ert_config" +site_conf_file = "/project/res/etc/ERT/site-config" +obs_config_file = "/private/inmyr/ERT-Intro/testcase/observations" class EnKFtest( unittest.TestCase ): def setUp(self): @@ -30,30 +32,43 @@ class EnKFtest( unittest.TestCase ): def test_boot( self ): - self.main = enkf.EnKFMain.bootstrap( case ) + self.main = enkf.EnKFMain.bootstrap( case, site_conf_file ) self.assertTrue( self.main , "Load failed" ) del self - def test_enum(self): self.assertEqual( enkf.enkf_state_enum.FORECAST , 2 ) self.assertEqual( enkf.enkf_state_enum.ANALYZED , 4 ) - + del self def test_config( self ): - self.main = enkf.EnKFMain.bootstrap( case ) - config = self.main.config - self.assertTrue( isinstance( config , ert.enkf.ens_config.EnsConfig)) - - def test_update(self): - step_list = IntVector(0) - step_list.append(30) - self.main = enkf.EnKFMain.bootstrap( case ) - self.main.update(step_list) - - - #def test_sim(self): - # self.main = enkf.EnKFMain.bootstrap( case ) - # self.main.sim() - + self.main = enkf.EnKFMain.bootstrap( case, site_conf_file ) + config = self.main.ensemble_config + anal_config = self.main.analysis_config + mod_config = self.main.model_config + loc_config = self.main.local_config + site_conf = self.main.site_config + ecl_conf = self.main.ecl_config + plot_conf = self.main.plot_config + self.main.load_obs(obs_config_file) + ob = self.main.get_obs + temp = self.main.get_templates + enkf_fsout = self.main.get_fs + mem_conf = self.main.iget_member_config(0) + enkf_stat = self.main.iget_state(0) + self.assertTrue( isinstance( config , ert.enkf.ens_config.EnsConfig)) + self.assertTrue( isinstance( anal_config , ert.enkf.analysis_config.AnalysisConfig)) + self.assertTrue( isinstance( mod_config , ert.enkf.model_config.ModelConfig)) + self.assertTrue( isinstance( loc_config , ert.enkf.local_config.LocalConfig)) + self.assertTrue( isinstance( site_conf , ert.enkf.site_config.SiteConfig)) + self.assertTrue( isinstance( ecl_conf , ert.enkf.ecl_config.EclConfig)) + self.assertTrue( isinstance( plot_conf , ert.enkf.plot_config.PlotConfig)) + self.assertTrue( isinstance( ob , ert.enkf.enkf_obs.EnkfObs)) + self.assertTrue( isinstance( temp , ert.enkf.ert_templates.ErtTemplates)) + self.assertTrue( isinstance( enkf_fsout , ert.enkf.enkf_fs.EnkfFs)) + self.assertTrue( isinstance( mem_conf , ert.enkf.member_config.MemberConfig)) + self.assertTrue( isinstance( enkf_stat , ert.enkf.enkf_state.EnKFState)) + del self + unittest.main() +e diff --git a/ThirdParty/Ert/devel/python/test/ens_config_test.py b/ThirdParty/Ert/devel/python/test/ens_config_test.py index b62cd8948d..54fd984238 100644 --- a/ThirdParty/Ert/devel/python/test/ens_config_test.py +++ b/ThirdParty/Ert/devel/python/test/ens_config_test.py @@ -20,19 +20,29 @@ import unittest import ert import ert.enkf.enkf as enkf from test_util import approx_equal, approx_equalv +from ert.util.stringlist import StringList -case = "../../../libenkf/src/Gurbat/enkf.ext" +case = "/private/inmyr/ERT-Intro/testcase/ert_config" +site_conf_file = "/project/res/etc/ERT/site-config" +obs_config_file = "/private/inmyr/ERT-Intro/testcase/observations" class EnsConfigTest( unittest.TestCase ): def setUp(self): pass def test_key(self): - main = enkf.EnKFMain.bootstrap( case ) + main = enkf.EnKFMain.bootstrap( case , site_conf_file) conf = main.config self.assertTrue( conf.has_key("WWCT:OP_1" )) self.assertFalse( conf.has_key("WWCT:OP_1X" )) - + def test_enkf_conf_node(self): + main = enkf.EnKFMain.bootstrap( case , site_conf_file) + conf = main.config + s = StringList(initial = None, c_ptr=conf.alloc_keylist) + self.assertTrue( isinstance( conf.get_node("MULTFLT") , ert.enkf.enkf_config_node.EnkfConfigNode)) + self.assertTrue( isinstance( s , ert.util.stringlist.StringList)) + + unittest.main() diff --git a/ThirdParty/Ert/devel/python/test/grid_test.py b/ThirdParty/Ert/devel/python/test/grid_test.py index 10f35d67df..c51c868079 100644 --- a/ThirdParty/Ert/devel/python/test/grid_test.py +++ b/ThirdParty/Ert/devel/python/test/grid_test.py @@ -33,6 +33,10 @@ egrid_file = "test-data/Statoil/ECLIPSE/Gurbat/ECLIPSE.EGRID" grid_file = "test-data/Statoil/ECLIPSE/Gurbat/ECLIPSE.GRID" grdecl_file = "test-data/Statoil/ECLIPSE/Gurbat/include/example_grid_sim.GRDECL" +def load_does_not_exist(): + g = ecl.EclGrid( "/does/not/exist.EGRID" ) + + class GridTest( unittest.TestCase ): def setUp(self): @@ -163,6 +167,10 @@ class GridTest( unittest.TestCase ): self.assertTrue( g1.coarse_groups() == 3384) + def testRaiseIOError(self): + self.assertRaises( IOError , load_does_not_exist ) + + def testDual(self): grid = ecl.EclGrid( egrid_file ) @@ -224,6 +232,7 @@ def fast_suite(): suite.addTest( GridTest( 'testACTNUM') ) suite.addTest( GridTest( 'testRect' )) suite.addTest( GridTest( 'testCoarse' )) + suite.addTest( GridTest( 'testRaiseIOError' )) return suite def test_suite(argv): diff --git a/ThirdParty/Ert/devel/python/test/import_local.py b/ThirdParty/Ert/devel/python/test/import_local.py new file mode 100644 index 0000000000..f946682e69 --- /dev/null +++ b/ThirdParty/Ert/devel/python/test/import_local.py @@ -0,0 +1,33 @@ +#!/usr/bin/env python +# Copyright (C) 2013 Statoil ASA, Norway. +# +# The file 'import_local.py' 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 +# for more details. +import sys + +def test_import( module ): + print "Importing: %s ..." % module , + try: + __import__( module ) + print "OK" + except: + print "failed" + sys.exit(1) + + +test_import("ert.ecl.ecl_local") + + +def test_suite( argv ): + return False diff --git a/ThirdParty/Ert/devel/python/test/import_test.py b/ThirdParty/Ert/devel/python/test/import_test.py index ddb049ec2b..c5002ad5b6 100644 --- a/ThirdParty/Ert/devel/python/test/import_test.py +++ b/ThirdParty/Ert/devel/python/test/import_test.py @@ -14,34 +14,206 @@ # # See the GNU General Public License at # for more details. - +import sys def test_import( module ): print "Importing: %s ..." % module , __import__( module ) - print + print "OK" test_import( "ert" ) +test_import( "ert.config" ) test_import( "ert.cwrap" ) test_import( "ert.ecl" ) -test_import( "ert.util" ) +test_import( "ert.enkf" ) +test_import( "ert.ert") test_import( "ert.geo" ) -test_import( "ert.config" ) test_import( "ert.job_queue" ) test_import( "ert.rms" ) -test_import( "ert.enkf" ) test_import( "ert.sched" ) +test_import( "ert.util" ) test_import( "ert.well") -test_import("ert.ecl.ecl") -test_import("ert.rms.rms") -test_import("ert.enkf.enkf") test_import("ert.config.config") -test_import("ert.job_queue.job_queue") +test_import("ert.config.config_enums") +test_import("ert.config.config_parser") + +test_import("ert.cwrap.cclass") +test_import("ert.cwrap.cenum") +test_import("ert.cwrap.cfile") +test_import("ert.cwrap.clib") +test_import("ert.cwrap.cwrap") + +test_import("ert.ecl.ecl") +test_import("ert.ecl.ecl_case") +test_import("ert.ecl.ecl_default") +test_import("ert.ecl.ecl_file") +test_import("ert.ecl.ecl_grav_calc") +test_import("ert.ecl.ecl_grav") +test_import("ert.ecl.ecl_grid") +test_import("ert.ecl.ecl_kw") +test_import("ert.ecl.ecl") +test_import("ert.ecl.ecl_queue") +test_import("ert.ecl.ecl_region") +test_import("ert.ecl.ecl_rft") +test_import("ert.ecl.ecl_rft_cell") +test_import("ert.ecl.ecl_subsidence") +test_import("ert.ecl.ecl_sum") +test_import("ert.ecl.ecl_util") +test_import("ert.ecl.fortio") +test_import("ert.ecl.libecl") + +test_import("ert.enkf.enkf") +test_import("ert.enkf.analysis_config") +test_import("ert.enkf.block_obs") +test_import("ert.enkf.ecl_config") +test_import("ert.enkf.enkf_config_node") +test_import("ert.enkf.enkf_enum") +test_import("ert.enkf.enkf_fs") +test_import("ert.enkf.enkf_main") +test_import("ert.enkf.enkf_node") +test_import("ert.enkf.enkf_obs") +test_import("ert.enkf.enkf") +test_import("ert.enkf.enkf_state") +test_import("ert.enkf.ens_config") +test_import("ert.enkf.ert_template") +test_import("ert.enkf.ert_templates") +test_import("ert.enkf.field_config") +test_import("ert.enkf.field") +test_import("ert.enkf.gen_data_config") +test_import("ert.enkf.gen_kw_config") +test_import("ert.enkf.libenkf") +test_import("ert.enkf.local_config") +test_import("ert.enkf.model_config") +test_import("ert.enkf.obs_vector") +test_import("ert.enkf.plot_config") +test_import("ert.enkf.site_config") +test_import("ert.enkf.time_map") + +test_import("ert.ert.c_enums") +test_import("ert.ert.enums") +test_import("ert.ert.erttypes") +test_import("ert.ert.ertwrapper") + +test_import("ert.geo.geo_polygon") test_import("ert.geo.geo") +test_import("ert.geo.libgeo") + +test_import("ert.job_queue.job_queue") +test_import("ert.job_queue.driver") +test_import("ert.job_queue.ext_job") +test_import("ert.job_queue.queue") +test_import("ert.job_queue.ext_joblist") +test_import("ert.job_queue.forward_model") +test_import("ert.job_queue.job") +test_import("ert.job_queue.libjob_queue") + +test_import("ert.rms.librms") +test_import("ert.rms.rms") + +test_import("ert.sched.history") +test_import("ert.sched.libsched") +test_import("ert.sched.sched_file") +test_import("ert.sched.sched") + +test_import("ert.util.ctime") +test_import("ert.util.latex") +test_import("ert.util.lookup_table") +test_import("ert.util.tvector") +test_import("ert.util.buffer") +#test_import("ert.util.hash") +test_import("ert.util.libutil") +test_import("ert.util.matrix") +test_import("ert.util.stat") +test_import("ert.util.util_func") +test_import("ert.util.log") +test_import("ert.util.stringlist") + +test_import("ert.well.libwell") +test_import("ert.well.well_info") test_import("ert.well.well") +test_import("ert.well.well_state") +test_import("ert.well.well_ts") + +test_import("ert_gui") + +test_import("ert_gui.gert_main") +test_import("ert_gui.newconfig") +test_import("ert_gui.pages") +test_import("ert_gui.widgets") + +test_import("ert_gui.pages.application") +test_import("ert_gui.pages.config") +test_import("ert_gui.pages.init") +test_import("ert_gui.pages.plot") +test_import("ert_gui.pages.run") + +test_import("ert_gui.pages.config.analysis") +test_import("ert_gui.pages.config.configpages") +test_import("ert_gui.pages.config.eclipse") +test_import("ert_gui.pages.config.ensemble") +test_import("ert_gui.pages.config.observations") +test_import("ert_gui.pages.config.plot") +test_import("ert_gui.pages.config.queuesystem") +test_import("ert_gui.pages.config.simulation") +test_import("ert_gui.pages.config.systemenv") +test_import("ert_gui.pages.config.jobs") +test_import("ert_gui.pages.config.parameters") +test_import("ert_gui.pages.config.simulations") + +test_import("ert_gui.pages.config.jobs.forwardmodelpanel") +test_import("ert_gui.pages.config.jobs.jobsdialog") +test_import("ert_gui.pages.config.jobs.jobspanel") + +test_import("ert_gui.pages.config.parameters.datapanel") +test_import("ert_gui.pages.config.parameters.fieldpanel") +test_import("ert_gui.pages.config.parameters.keywordpanel") +test_import("ert_gui.pages.config.parameters.parameterdialog") +test_import("ert_gui.pages.config.parameters.parametermodels") +test_import("ert_gui.pages.config.parameters.parameterpanel") + +test_import("ert_gui.pages.config.simulations.runpathpanel") +test_import("ert_gui.pages.config.simulations.runtemplatepanel") + +test_import("ert_gui.pages.init.initandcopy") +test_import("ert_gui.pages.init.initpanel") + +test_import("ert_gui.pages.plot.ensemblefetcher") +test_import("ert_gui.pages.plot.fetcher") +test_import("ert_gui.pages.plot.plotconfig") +test_import("ert_gui.pages.plot.plotdata") +test_import("ert_gui.pages.plot.plotfigure") +test_import("ert_gui.pages.plot.plotgenerator") +test_import("ert_gui.pages.plot.plotpanel") +test_import("ert_gui.pages.plot.plotrenderer") +test_import("ert_gui.pages.plot.plotsettings") +test_import("ert_gui.pages.plot.plotsettingsxml") +test_import("ert_gui.pages.plot.plotview") +test_import("ert_gui.pages.plot.rftfetcher") +test_import("ert_gui.pages.plot.zoomslider") + +test_import("ert_gui.pages.run.legend") +test_import("ert_gui.pages.run.runpanel") +test_import("ert_gui.pages.run.simulation") +test_import("ert_gui.pages.run.simulationsdialog") + +test_import("ert_gui.widgets.activelabel") +test_import("ert_gui.widgets.checkbox") +test_import("ert_gui.widgets.cogwheel") +test_import("ert_gui.widgets.combochoice") +test_import("ert_gui.widgets.configpanel") +test_import("ert_gui.widgets.helpedwidget") +test_import("ert_gui.widgets.help") +test_import("ert_gui.widgets.pathchooser") +test_import("ert_gui.widgets.reloadbutton") +test_import("ert_gui.widgets.searchablelist") +test_import("ert_gui.widgets.spinnerwidgets") +test_import("ert_gui.widgets.stringbox") +test_import("ert_gui.widgets.tablewidgets") +test_import("ert_gui.widgets.util") +test_import("ert_gui.widgets.validateddialog") def test_suite( argv ): diff --git a/ThirdParty/Ert/devel/python/test/rft_cell_test.py b/ThirdParty/Ert/devel/python/test/rft_cell_test.py new file mode 100644 index 0000000000..9988a1cf56 --- /dev/null +++ b/ThirdParty/Ert/devel/python/test/rft_cell_test.py @@ -0,0 +1,122 @@ +#!/usr/bin/env python +# Copyright (C) 2013 Statoil ASA, Norway. +# +# The file 'rft_cell_test.py' 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 +# for more details. + + +import unittest +import ert.ecl.ecl as ecl +from test_util import approx_equal, approx_equalv + + +RFT_file = "test-data/Statoil/ECLIPSE/Gurbat/ECLIPSE.RFT" +PLT_file = "test-data/Statoil/ECLIPSE/RFT/TEST1_1A.RFT" + + + + +def out_of_range(): + rftFile = ecl.EclRFTFile( RFT_file ) + rft = rftFile[100] + + + +class RFTCellTest( unittest.TestCase ): + + def RFTCell(self): + i = 10 + j = 8 + k = 100 + depth = 100 + pressure = 65 + swat = 0.56 + sgas = 0.10 + cell = ecl.EclRFTCell.new( i , j , k , depth , pressure , swat , sgas ) + + self.assertTrue( i == cell.get_i() ) + self.assertTrue( j == cell.get_j() ) + self.assertTrue( k == cell.get_k() ) + + self.assertTrue( approx_equal( pressure , cell.pressure) ) + self.assertTrue( approx_equal( depth , cell.depth )) + self.assertTrue( approx_equal( swat , cell.swat) ) + self.assertTrue( approx_equal( sgas , cell.sgas )) + self.assertTrue( approx_equal( 1 - (sgas + swat) , cell.soil )) + + + + + + def PLTCell(self): + i = 2 + j = 16 + k = 100 + depth = 100 + pressure = 65 + orat = 0.78 + grat = 88 + wrat = 97213 + conn_start = 214 + flowrate = 111 + oil_flowrate = 12 + gas_flowrate = 132 + water_flowrate = 13344 + + cell = ecl.EclPLTCell.new( i , j , k , depth , pressure , orat , grat , wrat , conn_start , flowrate , oil_flowrate , gas_flowrate , water_flowrate) + + + self.assertTrue( i == cell.get_i() ) + self.assertTrue( j == cell.get_j() ) + self.assertTrue( k == cell.get_k() ) + + self.assertTrue( cell.get_i() + 1 == cell.i ) + self.assertTrue( cell.get_j() + 1 == cell.j ) + self.assertTrue( cell.get_k() + 1 == cell.k ) + + + self.assertTrue( approx_equal( pressure , cell.pressure) ) + self.assertTrue( approx_equal( depth , cell.depth )) + self.assertTrue( approx_equal( orat , cell.orat) ) + self.assertTrue( approx_equal( grat , cell.grat )) + self.assertTrue( approx_equal( wrat , cell.wrat )) + + self.assertTrue( approx_equal( conn_start , cell.conn_start) ) + self.assertTrue( approx_equal( flowrate , cell.flowrate )) + self.assertTrue( approx_equal( oil_flowrate , cell.oil_flowrate )) + self.assertTrue( approx_equal( gas_flowrate , cell.gas_flowrate )) + self.assertTrue( approx_equal( water_flowrate , cell.water_flowrate)) + + + + + + +def fast_suite(): + suite = unittest.TestSuite() + suite.addTest( RFTCellTest( 'RFTCell' )) + suite.addTest( RFTCellTest( 'PLTCell' )) + return suite + + + +def test_suite( argv ): + return fast_suite() + + +if __name__ == "__main__": + unittest.TextTestRunner().run( fast_suite() ) + + + diff --git a/ThirdParty/Ert/devel/python/test/rft_test.py b/ThirdParty/Ert/devel/python/test/rft_test.py index fa9b77aa0f..3d4583ccbe 100644 --- a/ThirdParty/Ert/devel/python/test/rft_test.py +++ b/ThirdParty/Ert/devel/python/test/rft_test.py @@ -16,12 +16,88 @@ # for more details. +import datetime +import unittest import ert.ecl.ecl as ecl +from test_util import approx_equal, approx_equalv -rft = ecl.EclRFTFile( "test-data/Statoil/ECLIPSE/Gurbat/ECLIPSE.RFT" ) - -for node in rft: - print rft +RFT_file = "test-data/Statoil/ECLIPSE/Gurbat/ECLIPSE.RFT" +PLT_file = "test-data/Statoil/ECLIPSE/RFT/TEST1_1A.RFT" + + +def out_of_range(): + rftFile = ecl.EclRFTFile( RFT_file ) + rft = rftFile[100] + + + +class RFTTest( unittest.TestCase ): + + def loadRFT( self ): + rftFile = ecl.EclRFTFile( RFT_file ) + + rft = rftFile[0] + cell = rft.ijkget( (32 , 53 , 0) ) + self.assertTrue( isinstance( cell , ecl.EclRFTCell )) + + self.assertEqual( 2 , rftFile.size( ) ) + self.assertEqual( 0 , rftFile.size( well = "OP*")) + self.assertEqual( 0 , rftFile.size( well = "XXX")) + self.assertEqual( 1 , rftFile.size( date = datetime.date( 2000 , 6 , 1 ))) + self.assertEqual( 0 , rftFile.size( date = datetime.date( 2000 , 6 , 17 ))) + + cell = rft.ijkget( (30 , 20 , 1880) ) + self.assertTrue( cell is None ) + + for rft in rftFile: + self.assertTrue( rft.is_RFT() ) + self.assertFalse( rft.is_SEGMENT( )) + self.assertFalse( rft.is_PLT( )) + self.assertFalse( rft.is_MSW( )) + + for cell in rft: + self.assertTrue( isinstance( cell , ecl.EclRFTCell )) + + cell0 = rft.iget_sorted( 0 ) + self.assertTrue( isinstance( cell , ecl.EclRFTCell )) + rft.sort() + + + + def loadPLT( self ): + pltFile = ecl.EclRFTFile( PLT_file ) + plt = pltFile[11] + self.assertTrue( plt.is_PLT() ) + self.assertFalse( plt.is_SEGMENT( )) + self.assertFalse( plt.is_RFT( )) + self.assertFalse( plt.is_MSW( )) + for cell in plt: + self.assertTrue( isinstance( cell , ecl.EclPLTCell )) + + + def exceptions( self ): + self.assertRaises( IndexError , out_of_range ) + + + + +def fast_suite(): + suite = unittest.TestSuite() + suite.addTest( RFTTest( 'loadRFT' )) + suite.addTest( RFTTest( 'loadPLT' )) + suite.addTest( RFTTest( 'exceptions' )) + return suite + + +def test_suite( argv ): + return fast_suite() + + +if __name__ == "__main__": + unittest.TextTestRunner().run( fast_suite() ) + + + diff --git a/ThirdParty/Ert/devel/python/test/tvector_test.py b/ThirdParty/Ert/devel/python/test/tvector_test.py index f3b5c4b70c..71fe3bf93f 100644 --- a/ThirdParty/Ert/devel/python/test/tvector_test.py +++ b/ThirdParty/Ert/devel/python/test/tvector_test.py @@ -27,6 +27,24 @@ from ert.util.tvector import BoolVector from test_util import approx_equal, approx_equalv +def add_size_error(): + l1 = IntVector() + l2 = IntVector() + + l1[100] = 10 + l2[10] = 1 + l1 += l2 + + +def mul_size_error(): + l1 = IntVector() + l2 = IntVector() + + l1[100] = 10 + l2[10] = 1 + l1 *= l2 + + class TVectorTest( unittest.TestCase ): @@ -69,13 +87,102 @@ class TVectorTest( unittest.TestCase ): + def test_default(self): + l = IntVector( default_value = 100 ) + self.assertTrue( l.default == 100 ) + l[10] = 1 + self.assertTrue( l[0] == 100 ) + self.assertTrue( l[9] == 100 ) + self.assertTrue( l[10] == 1 ) + + l.default = 200 + self.assertTrue( l.default == 200 ) + l[20] = 77 + self.assertTrue( l[19] == 200 ) + + + def test_copy(self): + l1 = IntVector( default_value = 77 ) + l1[99] = 100 + + l2 = l1.copy() + self.assertTrue( l1.default == l2.default ) + self.assertTrue( len(l1) == len(l2)) + self.assertTrue( l1[99] == l2[99] ) + + + def test_div(self): + l1 = IntVector( default_value = 100 ) + l1[99] = 100 + l2 = l1 / 10 + + self.assertTrue( l1.default == l2.default ) + self.assertTrue( len(l1) == len(l2)) + self.assertTrue( l2[99] == 10 ) + self.assertTrue( l2[9] == 10 ) + self.assertTrue( l2[1] == 10 ) + + + def test_add(self): + l1 = IntVector( default_value = 100 ) + l1[99] = 100 + l1 += 100 + + self.assertTrue( l1[99] == 200 ) + self.assertTrue( l1[9] == 200 ) + self.assertTrue( l1[1] == 200 ) + + l2 = IntVector( default_value = 75 ) + l2[99] = 75 + l1 += l2 + + self.assertTrue( l1[99] == 275 ) + self.assertTrue( l1[9] == 275 ) + self.assertTrue( l1[1] == 275 ) + + self.assertRaises( ValueError , add_size_error ) + + + def test_mul(self): + l1 = IntVector( default_value = 100 ) + l1[99] = 100 + l1 *= 2 + + self.assertTrue( l1[99] == 200 ) + self.assertTrue( l1[9] == 200 ) + self.assertTrue( l1[1] == 200 ) + + l2 = IntVector( default_value = 2 ) + l2[99] = 2 + l1 *= l2 + + self.assertTrue( l1[99] == 400 ) + self.assertTrue( l1[9] == 400 ) + self.assertTrue( l1[1] == 400 ) + + self.assertRaises( ValueError , mul_size_error ) + + + + + + def fast_suite(): suite = unittest.TestSuite() suite.addTest( TVectorTest( 'test_activeList' )) suite.addTest( TVectorTest( 'test_activeMask' )) suite.addTest( TVectorTest( 'test_true' )) + suite.addTest( TVectorTest( 'test_default' )) + suite.addTest( TVectorTest( 'test_copy' )) + suite.addTest( TVectorTest( 'test_div' )) + suite.addTest( TVectorTest( 'test_add' )) + suite.addTest( TVectorTest( 'test_mul' )) return suite +def test_suite(argv): + return fast_suite() + + if __name__ == "__main__": unittest.TextTestRunner().run( fast_suite() ) diff --git a/ThirdParty/Ert/devel/share/gui/img/newsplash.jpg b/ThirdParty/Ert/devel/share/gui/img/newsplash.jpg new file mode 100644 index 0000000000000000000000000000000000000000..4a605e7321dc830566ff22761877a8751bdb740a GIT binary patch literal 78813 zcmeFZ1yox>yEYn%dvUh{rFel-+>4b0g;LyFG*G;F@Z#>pDee?^cPLOCf)iX5N+Cdi zKRxF=@}Kp|x%dC>x_7O6HW{+BviGccXZFndywCeg9u^-q0FPfQC@TO^P*4DI$Unft zCO}`_184~VsHy@u0000M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