diff --git a/lib/enkf/enkf_main.cpp b/lib/enkf/enkf_main.cpp index 1187825888..c42f4c081d 100644 --- a/lib/enkf/enkf_main.cpp +++ b/lib/enkf/enkf_main.cpp @@ -1343,51 +1343,27 @@ void enkf_main_isubmit_job( enkf_main_type * enkf_main , run_arg_type * run_arg } -void * enkf_main_icreate_run_path( enkf_main_type * enkf_main, run_arg_type * run_arg, init_mode_type init_mode) { - { - runpath_list_type * runpath_list = enkf_main_get_runpath_list(enkf_main); - runpath_list_add( runpath_list , - run_arg_get_iens( run_arg ), - run_arg_get_iter( run_arg ), - run_arg_get_runpath( run_arg ), - run_arg_get_job_name( run_arg )); - } - - /* This block accesses enkf_state - can it be removed?? */ - if (init_mode != INIT_NONE) { - stringlist_type * param_list = ensemble_config_alloc_keylist_from_var_type(enkf_main_get_ensemble_config(enkf_main), PARAMETER ); - enkf_fs_type * init_fs = run_arg_get_sim_fs( run_arg ); - rng_type * rng = rng_manager_iget( enkf_main->rng_manager, run_arg_get_iens( run_arg )); - enkf_state_type * enkf_state = enkf_main->ensemble[ run_arg_get_iens(run_arg) ]; - enkf_state_initialize( enkf_state , rng, init_fs , param_list , init_mode); - stringlist_free( param_list ); - } - - enkf_state_init_eclipse( enkf_main->res_config, - run_arg ); - - runpath_list_type * runpath_list = enkf_main_get_runpath_list(enkf_main); - runpath_list_fprintf( runpath_list ); - return NULL; -} - - -static void * enkf_main_create_run_path__( enkf_main_type * enkf_main, +static void enkf_main_write_run_path( enkf_main_type * enkf_main, const ert_run_context_type * run_context) { - - int iens; - for (iens = 0; iens < ert_run_context_get_size( run_context ); iens++) { + runpath_list_type * runpath_list = enkf_main_get_runpath_list(enkf_main); + runpath_list_clear(runpath_list); + for (int iens = 0; iens < ert_run_context_get_size( run_context ); iens++) { if (ert_run_context_iactive( run_context , iens)) { run_arg_type * run_arg = ert_run_context_iget_arg( run_context , iens); - enkf_main_icreate_run_path(enkf_main, run_arg, INIT_NONE); + runpath_list_add( runpath_list , + run_arg_get_iens( run_arg ), + run_arg_get_iter( run_arg ), + run_arg_get_runpath( run_arg ), + run_arg_get_job_name( run_arg )); + enkf_state_init_eclipse( enkf_main->res_config, run_arg ); } } - return NULL; + runpath_list_fprintf( runpath_list ); } void enkf_main_create_run_path(enkf_main_type * enkf_main , const ert_run_context_type * run_context) { enkf_main_init_run(enkf_main, run_context); - enkf_main_create_run_path__( enkf_main , run_context ); + enkf_main_write_run_path( enkf_main , run_context ); } diff --git a/lib/enkf/enkf_main_manage_fs.cpp b/lib/enkf/enkf_main_manage_fs.cpp index 8b03e077ca..cacb2baef4 100644 --- a/lib/enkf/enkf_main_manage_fs.cpp +++ b/lib/enkf/enkf_main_manage_fs.cpp @@ -121,7 +121,6 @@ static void * enkf_main_initialize_from_scratch_mt(void * void_arg) { void enkf_main_initialize_from_scratch(enkf_main_type * enkf_main , const stringlist_type * param_list , const ert_run_context_type * run_context) { - int num_cpu = 4; int ens_size = enkf_main_get_ensemble_size( enkf_main ); arg_pack_type ** arg_list = (arg_pack_type **) util_calloc( ens_size , sizeof * arg_list ); diff --git a/lib/include/ert/enkf/enkf_main.hpp b/lib/include/ert/enkf/enkf_main.hpp index 8aa597ff05..9c04423d3b 100644 --- a/lib/include/ert/enkf/enkf_main.hpp +++ b/lib/include/ert/enkf/enkf_main.hpp @@ -291,7 +291,6 @@ extern "C" { void enkf_main_isubmit_job( enkf_main_type * enkf_main , run_arg_type * run_arg , job_queue_type * job_queue); const char * enkf_main_get_site_config_file( const enkf_main_type * enkf_main ); const char * enkf_main_get_schedule_prediction_file( const enkf_main_type * enkf_main ); - void * enkf_main_icreate_run_path( enkf_main_type * enkf_main, run_arg_type * run_arg, init_mode_type init_mode); void enkf_main_add_data_kw(enkf_main_type * enkf_main , const char * key , const char * value); const res_config_type * enkf_main_get_res_config(const enkf_main_type * enkf_main); void * enkf_main_isubmit_job__( void * arg ); diff --git a/python/res/enkf/enkf_main.py b/python/res/enkf/enkf_main.py index 225686b66f..64ad57b28e 100644 --- a/python/res/enkf/enkf_main.py +++ b/python/res/enkf/enkf_main.py @@ -197,7 +197,6 @@ class _RealEnKFMain(BaseCClass): _load_from_forward_model = ResPrototype("int enkf_main_load_from_forward_model_from_gui(enkf_main, int, bool_vector, enkf_fs)") _load_from_run_context = ResPrototype("int enkf_main_load_from_run_context_from_gui(enkf_main, ert_run_context, enkf_fs)") _create_run_path = ResPrototype("void enkf_main_create_run_path(enkf_main , ert_run_context)") - _icreate_run_path = ResPrototype("void enkf_main_icreate_run_path(enkf_main , run_arg, enkf_init_mode_enum)") _submit_simulation = ResPrototype("void enkf_main_isubmit_job(enkf_main , run_arg, job_queue)") _alloc_run_context_ENSEMBLE_EXPERIMENT= ResPrototype("ert_run_context_obj enkf_main_alloc_ert_run_context_ENSEMBLE_EXPERIMENT( enkf_main , enkf_fs , bool_vector , int)") _get_runpath_list = ResPrototype("runpath_list_ref enkf_main_get_runpath_list(enkf_main)") @@ -414,12 +413,8 @@ def loadFromRunContext(self, run_context, fs): def initRun(self, run_context): self._init_run(run_context) - def createRunpath(self , run_context, iens = None): - if iens is None: - self._create_run_path( run_context ) - else: - run_arg = run_context[iens] - self._icreate_run_path( run_arg, EnkfInitModeEnum.INIT_CONDITIONAL) + def createRunpath(self , run_context): + self._create_run_path( run_context ) def submitSimulation(self , run_arg, queue): self._submit_simulation( run_arg, queue) diff --git a/python/tests/res/enkf/test_runpath_list_dump.py b/python/tests/res/enkf/test_runpath_list_dump.py index 9a571fad9a..06bf51a4fa 100644 --- a/python/tests/res/enkf/test_runpath_list_dump.py +++ b/python/tests/res/enkf/test_runpath_list_dump.py @@ -32,7 +32,7 @@ def setUp(self): self.config_path = self.createTestPath(self.config_rel_path) - def _verify_runpath_rendering(self, itr, elementwise_runpath_creation=False): + def _verify_runpath_rendering(self, itr): with ErtTestContext("add_all_runpath_dump", model_config=self.config_path) as ctx: res = ctx.getErt() fs_manager = res.getEnkfFsManager() @@ -53,11 +53,8 @@ def _verify_runpath_rendering(self, itr, elementwise_runpath_creation=False): for i, run_arg in enumerate(run_context): if mask[i]: run_arg.geo_id = 10*i - if elementwise_runpath_creation: - res.createRunpath(run_context, i) - if not elementwise_runpath_creation: - res.createRunpath(run_context) + res.createRunpath(run_context) for i, run_arg in enumerate(run_context): if not mask[i]: @@ -82,9 +79,6 @@ def _verify_runpath_rendering(self, itr, elementwise_runpath_creation=False): @tmpdir() def test_add_all(self): - test_base = itertools.product([0, 1, 2, 17], [True, False]) - for itr, elementwise_creation in test_base: - self._verify_runpath_rendering( - itr, - elementwise_runpath_creation=elementwise_creation, - ) + test_base = [0, 1, 2, 17] + for itr in test_base: + self._verify_runpath_rendering(itr)