Skip to content
This repository has been archived by the owner on Sep 30, 2020. It is now read-only.

Commit

Permalink
Adding PRE_SIMULATION hook support
Browse files Browse the repository at this point in the history
  • Loading branch information
arielalmendral committed May 3, 2016
1 parent d9f2fb0 commit 2951e31
Show file tree
Hide file tree
Showing 23 changed files with 614 additions and 368 deletions.
1 change: 0 additions & 1 deletion devel/docs/user/keywords/index.rst
Original file line number Diff line number Diff line change
Expand Up @@ -1952,7 +1952,6 @@ run. Observe that the workflows being 'hooked in' with the
:code:`HOOK_WORKFLOW` must be loaded with the :code:`LOAD_WORKFLOW`
keyword.

NB: Currently the :code:`PRE_SIMULATION` workflow is never called.

Manipulating the Unix environment
---------------------------------
Expand Down
4 changes: 2 additions & 2 deletions devel/libenkf/applications/ert_tui/enkf_tui_run.c
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,7 @@ void enkf_tui_run_exp(void * enkf_main) {
free( prompt );
}
if (bool_vector_count_equal(iactive , true))
enkf_main_run_exp(enkf_main , iactive , true );
enkf_main_run_exp(enkf_main , iactive );

bool_vector_free(iactive);
}
Expand All @@ -115,7 +115,7 @@ void enkf_tui_run_create_runpath__(void * __enkf_main) {
util_safe_free( select_string );
free( prompt );
}
enkf_main_run_exp(enkf_main , iactive , false );
enkf_main_create_run_path(enkf_main , iactive , 0 );
bool_vector_free(iactive);
}

Expand Down
12 changes: 6 additions & 6 deletions devel/libenkf/include/ert/enkf/enkf_main.h
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,7 @@ extern "C" {
#include <ert/enkf/pca_plot_data.h>
#include <ert/enkf/field_config.h>
#include <ert/enkf/ert_run_context.h>
#include <ert/enkf/ert_init_context.h>

/*****************************************************************/

Expand Down Expand Up @@ -106,12 +107,11 @@ extern "C" {

bool enkf_main_UPDATE(enkf_main_type * enkf_main , const int_vector_type * step_list, enkf_fs_type * source_fs, enkf_fs_type * target_fs , int target_step , run_mode_type run_mode);
bool enkf_main_smoother_update(enkf_main_type * enkf_main , enkf_fs_type * source_fs, enkf_fs_type * target_fs);

void enkf_main_create_run_path(enkf_main_type * enkf_main , bool_vector_type * iactive , int iter);
bool enkf_main_run_simple_step(enkf_main_type * enkf_main , bool_vector_type * iactive , init_mode_type init_mode, int iter);

void enkf_main_run_exp(enkf_main_type * enkf_main ,
bool_vector_type * iactive ,
bool simulate);
bool_vector_type * iactive);


void enkf_main_run_smoother(enkf_main_type * enkf_main , enkf_fs_type * source_fs, const char * target_fs_name , bool_vector_type * iactive , int iter , bool rerun);
Expand Down Expand Up @@ -264,14 +264,14 @@ extern "C" {
void enkf_main_set_case_table( enkf_main_type * enkf_main , const char * case_table_file );

void enkf_main_initialize_from_scratch(enkf_main_type * enkf_main ,
enkf_fs_type * init_fs,
enkf_fs_type * init_fs,
const stringlist_type * param_list ,
int iens1 ,
int iens2,
init_mode_type init_mode);

void enkf_main_initialize_from_scratch_with_bool_vector(enkf_main_type * enkf_main ,
enkf_fs_type * init_fs,
enkf_fs_type * init_fs,
const stringlist_type * param_list ,
const bool_vector_type * iens_mask ,
init_mode_type init_mode);
Expand Down Expand Up @@ -324,7 +324,7 @@ extern "C" {

runpath_list_type * enkf_main_get_runpath_list( const enkf_main_type * enkf_main );
ert_run_context_type * enkf_main_alloc_ert_run_context_ENSEMBLE_EXPERIMENT(const enkf_main_type * enkf_main , enkf_fs_type * fs , const bool_vector_type * iactive , init_mode_type init_mode , int iter);
ert_run_context_type * enkf_main_alloc_ert_run_context_INIT_ONLY(const enkf_main_type * enkf_main , enkf_fs_type * fs , const bool_vector_type * iactive , init_mode_type init_mode , int iter);
ert_init_context_type * enkf_main_alloc_ert_init_context(const enkf_main_type * enkf_main , enkf_fs_type * fs, const bool_vector_type * iactive , init_mode_type init_mode , int iter);


UTIL_SAFE_CAST_HEADER(enkf_main);
Expand Down
62 changes: 62 additions & 0 deletions devel/libenkf/include/ert/enkf/ert_init_context.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,62 @@
/*
Copyright (C) 2016 Statoil ASA, Norway.
The file 'ert_init_context.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 <http://www.gnu.org/licenses/gpl.html>
for more details.
*/

#ifndef ERT_INIT_CONTEXT_H
#define ERT_INIT_CONTEXT_H
#ifdef __cplusplus
extern "C" {
#endif

#include <ert/util/type_macros.h>
#include <ert/util/bool_vector.h>
#include <ert/util/path_fmt.h>
#include <ert/util/subst_list.h>

#include <ert/enkf/enkf_types.h>
#include <ert/enkf/run_arg.h>
#include <ert/enkf/enkf_fs.h>

typedef struct ert_init_context_struct ert_init_context_type;

stringlist_type * ert_init_context_alloc_runpath_list(const bool_vector_type * iactive , path_fmt_type * runpath_fmt , subst_list_type * subst_list , int iter);
char * ert_init_context_alloc_runpath( int iens , path_fmt_type * runpath_fmt , subst_list_type * subst_list , int iter);

ert_init_context_type * ert_init_context_alloc(enkf_fs_type * init_fs , const bool_vector_type * iactive ,
path_fmt_type * runpath_fmt ,
subst_list_type * subst_list ,
init_mode_type init_mode ,
int iter);

void ert_init_context_free( ert_init_context_type * );
int ert_init_context_get_size( const ert_init_context_type * context );
init_mode_type ert_init_context_get_init_mode( const ert_init_context_type * context );
bool_vector_type * ert_init_context_get_iactive( const ert_init_context_type * context );
int ert_init_context_get_iter( const ert_init_context_type * context );
run_arg_type * ert_init_context_iget_arg( const ert_init_context_type * context , int index);
run_arg_type * ert_init_context_iens_get_arg( const ert_init_context_type * context , int iens);


UTIL_IS_INSTANCE_HEADER( ert_init_context );


#ifdef __cplusplus
}
#endif
#endif


57 changes: 25 additions & 32 deletions devel/libenkf/include/ert/enkf/ert_run_context.h
Original file line number Diff line number Diff line change
@@ -1,19 +1,19 @@
/*
Copyright (C) 2014 Statoil ASA, Norway.
The file 'run_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 <http://www.gnu.org/licenses/gpl.html>
for more details.
Copyright (C) 2014 Statoil ASA, Norway.
The file 'ert_run_context.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 <http://www.gnu.org/licenses/gpl.html>
for more details.
*/

#ifndef ERT_RUN_CONTEXT_H
Expand All @@ -35,26 +35,19 @@ typedef struct ert_run_context_struct ert_run_context_type;

stringlist_type * ert_run_context_alloc_runpath_list(const bool_vector_type * iactive , path_fmt_type * runpath_fmt , subst_list_type * subst_list , int iter);
char * ert_run_context_alloc_runpath( int iens , path_fmt_type * runpath_fmt , subst_list_type * subst_list , int iter);
ert_run_context_type * ert_run_context_alloc_ENSEMBLE_EXPERIMENT(enkf_fs_type * fs ,
const bool_vector_type * iactive ,
path_fmt_type * runpath_fmt ,
ert_run_context_type * ert_run_context_alloc_ENSEMBLE_EXPERIMENT(enkf_fs_type * fs ,
const bool_vector_type * iactive ,
path_fmt_type * runpath_fmt ,
subst_list_type * subst_list ,
init_mode_type init_mode ,
init_mode_type init_mode ,
int iter);


ert_run_context_type * ert_run_context_alloc_INIT_ONLY(enkf_fs_type * init_fs , const bool_vector_type * iactive ,
path_fmt_type * runpath_fmt ,
subst_list_type * subst_list ,
init_mode_type init_mode ,
int iter);


ert_run_context_type * ert_run_context_alloc_SMOOTHER_RUN(enkf_fs_type * simulate_fs , enkf_fs_type * target_update_fs ,
const bool_vector_type * iactive ,
path_fmt_type * runpath_fmt ,
ert_run_context_type * ert_run_context_alloc_SMOOTHER_RUN(enkf_fs_type * simulate_fs , enkf_fs_type * target_update_fs ,
const bool_vector_type * iactive ,
path_fmt_type * runpath_fmt ,
subst_list_type * subst_list ,
init_mode_type init_mode ,
init_mode_type init_mode ,
int iter);
void ert_run_context_set_init_fs(ert_run_context_type * context, enkf_fs_type * init_fs);
void ert_run_context_set_result_fs(ert_run_context_type * context, enkf_fs_type * result_fs);
Expand All @@ -71,13 +64,13 @@ typedef struct ert_run_context_struct ert_run_context_type;
int ert_run_context_get_load_start( const ert_run_context_type * context );
run_arg_type * ert_run_context_iget_arg( const ert_run_context_type * context , int index);
run_arg_type * ert_run_context_iens_get_arg( const ert_run_context_type * context , int iens);

enkf_fs_type * ert_run_context_get_init_fs(const ert_run_context_type * run_context);
enkf_fs_type * ert_run_context_get_result_fs(const ert_run_context_type * run_context);
enkf_fs_type * ert_run_context_get_update_target_fs(const ert_run_context_type * run_context);

UTIL_IS_INSTANCE_HEADER( ert_run_context );


#ifdef __cplusplus
}
Expand Down
2 changes: 2 additions & 0 deletions devel/libenkf/src/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -83,6 +83,7 @@ set( source_files
ert_log.c
run_arg.c
ert_run_context.c
ert_init_context.c
custom_kw.c
custom_kw_config.c
custom_kw_config_set.c
Expand Down Expand Up @@ -182,6 +183,7 @@ set( header_files
run_arg.h
run_arg_type.h
ert_run_context.h
ert_init_context.h
custom_kw.h
custom_kw_config.h
custom_kw_config_set.h
Expand Down
Loading

0 comments on commit 2951e31

Please sign in to comment.