Skip to content

Commit

Permalink
Merge pull request #115 from Statoil/convert-cxx
Browse files Browse the repository at this point in the history
Convert to Cxx
  • Loading branch information
joakim-hove authored Jul 2, 2018
2 parents bf8a31c + ccdb786 commit cd988dc
Show file tree
Hide file tree
Showing 38 changed files with 532 additions and 810 deletions.
4 changes: 2 additions & 2 deletions libert/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
project(ert-ert C)
project(ert-ert CXX)

if (NOT BUILD_SHARED_LIBS)
message(WARNING "Building python - forcing shared libs.")
set(BUILD_SHARED_LIBS ON)
endif ()

add_library(ert src/ert_version.c)
add_library(ert src/ert_version.cpp)

target_include_directories(ert
PUBLIC $<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/include>
Expand Down
6 changes: 3 additions & 3 deletions libert/applications/ert_tui/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
include_directories( ${CMAKE_CURRENT_SOURCE_DIR} )

set( src_list main.c enkf_tui_main.c enkf_tui_fs.c enkf_tui_ranking.c enkf_tui_misc.c enkf_tui_table.c menu.c
enkf_tui_run.c enkf_tui_util.c enkf_tui_init.c enkf_tui_export.c enkf_tui_analysis.c enkf_tui_help.c enkf_tui_simple.c enkf_tui_workflow.c)
set( src_list main.cpp enkf_tui_main.cpp enkf_tui_fs.cpp enkf_tui_ranking.cpp enkf_tui_misc.cpp enkf_tui_table.cpp menu.cpp
enkf_tui_run.cpp enkf_tui_util.cpp enkf_tui_init.cpp enkf_tui_export.cpp enkf_tui_analysis.cpp enkf_tui_help.cpp enkf_tui_simple.cpp enkf_tui_workflow.cpp)

set_source_files_properties( main.c PROPERTIES COMPILE_DEFINITIONS "COMPILE_TIME_STAMP=\"${ERT_BUILD_TIME}\";GIT_COMMIT=\"${GIT_COMMIT}\"")
set_source_files_properties( main.cpp PROPERTIES COMPILE_DEFINITIONS "COMPILE_TIME_STAMP=\"${ERT_BUILD_TIME}\";GIT_COMMIT=\"${GIT_COMMIT}\"")

add_executable( ert_tui ${src_list} )
target_link_libraries( ert_tui res::res ert )
Expand Down
Original file line number Diff line number Diff line change
@@ -1,25 +1,25 @@
/*
Copyright (C) 2011 Statoil ASA, Norway.
The file 'ERT.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.
Copyright (C) 2011 Statoil ASA, Norway.
The file 'ERT.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.
*/

#define SPLASH_LENGTH 11
const char * splash_text[SPLASH_LENGTH] = {
" _________________________________ ",
" / \\",
" / \\",
" | ______ ______ _______ |",
" | | ____| | __ \\ |__ __| |",
" | | |__ | |__) | | | |",
Expand Down
Original file line number Diff line number Diff line change
@@ -1,19 +1,19 @@
/*
Copyright (C) 2012 Statoil ASA, Norway.
The file 'enkf_tui_QC.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.
Copyright (C) 2012 Statoil ASA, Norway.
The file 'enkf_tui_QC.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_ENKF_TUI_QC_H
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,20 +22,20 @@
#include <string.h>
#include <ctype.h>

#include <ert/util/util.h>
#include <ert/util/arg_pack.h>
#include <ert/util/stringlist.h>
#include <ert/util/util.hpp>
#include <ert/util/arg_pack.hpp>
#include <ert/util/stringlist.hpp>

#include <ert/analysis/analysis_module.h>
#include <ert/analysis/analysis_module.hpp>

#include <ert/enkf/enkf_main.h>
#include <ert/enkf/ensemble_config.h>
#include <ert/enkf/analysis_config.h>
#include <ert/enkf/enkf_main.hpp>
#include <ert/enkf/ensemble_config.hpp>
#include <ert/enkf/analysis_config.hpp>

#include <enkf_tui_util.h>
#include <enkf_tui_fs.h>
#include <ert_tui_const.h>
#include "menu.h"
#include <enkf_tui_util.hpp>
#include <enkf_tui_fs.hpp>
#include <ert_tui_const.hpp>
#include "menu.hpp"


void enkf_tui_analysis_scale_observation_std__(void * arg) {
Expand Down Expand Up @@ -66,10 +66,10 @@ static void enkf_tui_analysis_update_title( enkf_main_type * enkf_main , menu_ty
void enkf_tui_analysis_select_module__(void * arg) {
int prompt_len = 50;
arg_pack_type * arg_pack = arg_pack_safe_cast( arg );
enkf_main_type * enkf_main = arg_pack_iget_ptr( arg_pack , 0 );
menu_type * menu = arg_pack_iget_ptr( arg_pack , 1 );
enkf_main_type * enkf_main = (enkf_main_type *) arg_pack_iget_ptr( arg_pack , 0 );
menu_type * menu = (menu_type *) arg_pack_iget_ptr( arg_pack , 1 );

const analysis_config_type * analysis_config = enkf_main_get_analysis_config(enkf_main);
analysis_config_type * analysis_config = (analysis_config_type *) enkf_main_get_analysis_config(enkf_main);
char module_name[256];
util_printf_prompt("Name module to select" , prompt_len , '=' , "=> ");
scanf("%s", module_name);
Expand Down
Original file line number Diff line number Diff line change
@@ -1,20 +1,20 @@
/*
Copyright (C) 2011 Statoil ASA, Norway.
Copyright (C) 2011 Statoil ASA, Norway.
The file 'enkf_tui_analysis.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.
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_ENKF_TUI_ANALYSIS_H
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,20 +22,20 @@
#include <string.h>
#include <ctype.h>

#include <ert/util/util.h>

#include <ert/enkf/enkf_main.h>
#include <ert/enkf/field.h>
#include <ert/enkf/field_config.h>
#include <ert/enkf/enkf_state.h>
#include <ert/enkf/enkf_fs.h>
#include <ert/enkf/field_config.h>
#include <ert/enkf/gen_data.h>
#include <ert/enkf/gen_data_config.h>

#include <enkf_tui_util.h>
#include <enkf_tui_help.h>
#include "menu.h"
#include <ert/util/util.hpp>

#include <ert/enkf/enkf_main.hpp>
#include <ert/enkf/field.hpp>
#include <ert/enkf/field_config.hpp>
#include <ert/enkf/enkf_state.hpp>
#include <ert/enkf/enkf_fs.hpp>
#include <ert/enkf/field_config.hpp>
#include <ert/enkf/gen_data.hpp>
#include <ert/enkf/gen_data_config.hpp>

#include <enkf_tui_util.hpp>
#include <enkf_tui_help.hpp>
#include "menu.hpp"
#define PROMPT_LEN 60


Expand Down Expand Up @@ -78,7 +78,7 @@ void enkf_tui_export_field(const enkf_main_type * enkf_main , field_file_format_
}

{
const field_type * field = enkf_node_value_ptr(node);
const field_type * field = (const field_type *) enkf_node_value_ptr(node);
field_export(field , filename , NULL , file_type , output_transform, NULL);
}
free(filename);
Expand All @@ -91,23 +91,23 @@ void enkf_tui_export_field(const enkf_main_type * enkf_main , field_file_format_


void enkf_tui_export_grdecl(void * enkf_main) {
enkf_tui_export_field(enkf_main , ECL_GRDECL_FILE);
enkf_tui_export_field((enkf_main_type *) enkf_main , ECL_GRDECL_FILE);
}



void enkf_tui_export_roff(void * enkf_main) {
enkf_tui_export_field(enkf_main , RMS_ROFF_FILE);
enkf_tui_export_field((enkf_main_type *) enkf_main , RMS_ROFF_FILE);
}


void enkf_tui_export_restart_active(void * enkf_main) {
enkf_tui_export_field(enkf_main , ECL_KW_FILE_ACTIVE_CELLS);
enkf_tui_export_field((enkf_main_type *) enkf_main , ECL_KW_FILE_ACTIVE_CELLS);
}


void enkf_tui_export_restart_all(void * enkf_main) {
enkf_tui_export_field(enkf_main , ECL_KW_FILE_ALL_CELLS);
enkf_tui_export_field((enkf_main_type *) enkf_main , ECL_KW_FILE_ALL_CELLS);
}


Expand Down Expand Up @@ -137,7 +137,7 @@ void enkf_tui_export_gen_data(void * arg) {
{
enkf_fs_type * fs = enkf_main_tui_get_fs(enkf_main);
enkf_node_type * node = enkf_node_alloc(config_node);
gen_data_file_format_type export_type = gen_data_guess_export_type( enkf_node_value_ptr(node) );
gen_data_file_format_type export_type = gen_data_guess_export_type( (const gen_data_type *) enkf_node_value_ptr(node) );
int iens;

for (iens = iens1; iens <= iens2; iens++) {
Expand All @@ -149,7 +149,7 @@ void enkf_tui_export_gen_data(void * arg) {
if (path != NULL) util_make_path( path );

{
const gen_data_type * gen_data = enkf_node_value_ptr(node);
const gen_data_type * gen_data = (const gen_data_type *) enkf_node_value_ptr(node);
gen_data_export(gen_data , full_path , export_type);
}

Expand Down Expand Up @@ -197,11 +197,11 @@ void enkf_tui_export_fieldP(void * arg) {
enkf_node_clear( sum );
{
/* OK going low level */
field_type * sum_field = enkf_node_value_ptr( sum );
field_type * sum_field = (field_type *) enkf_node_value_ptr( sum );

for (iens = iens1; iens < iens2; iens++) {
if (ensemble[iens - iens1] != NULL) {
field_type * field = enkf_node_value_ptr( ensemble[iens - iens1] );
field_type * field = (field_type *) enkf_node_value_ptr( ensemble[iens - iens1] );
field_update_sum( sum_field , field , lower_limit , upper_limit);
active_ens_size++;
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,19 +1,19 @@
/*
Copyright (C) 2011 Statoil ASA, Norway.
The file 'enkf_tui_export.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.
Copyright (C) 2011 Statoil ASA, Norway.
The file 'enkf_tui_export.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_ENKF_TUI_EXPORT_H
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,18 +19,19 @@
#include <stdlib.h>
#include <string.h>

#include <ert/util/arg_pack.h>
#include <ert/util/util.h>
#include <ert/util/arg_pack.hpp>
#include <ert/util/util.hpp>

#include <ert/enkf/enkf_main.h>
#include <ert/enkf/enkf_types.h>
#include <ert/enkf/enkf_fs.h>
#include <ert/enkf/ranking_table.h>
#include <ert/enkf/enkf_main.hpp>
#include <ert/enkf/enkf_types.hpp>
#include <ert/enkf/enkf_fs.hpp>
#include <ert/enkf/ranking_table.hpp>

#include <enkf_tui_help.h>
#include <enkf_tui_init.h>
#include <enkf_tui_util.h>
#include "menu.h"
#include <enkf_tui_help.hpp>
#include <enkf_tui_init.hpp>
#include <enkf_tui_util.hpp>

#include "menu.hpp"

void enkf_tui_fs_ls_case(void * arg) {
enkf_main_type * enkf_main = enkf_main_safe_cast( arg );
Expand All @@ -54,7 +55,7 @@ void enkf_tui_fs_create_case(void * arg)

arg_pack_type * arg_pack = arg_pack_safe_cast( arg );
enkf_main_type * enkf_main = enkf_main_safe_cast( arg_pack_iget_ptr(arg_pack, 0) );
menu_type * menu = arg_pack_iget_ptr(arg_pack, 1);
menu_type * menu = (menu_type *) arg_pack_iget_ptr(arg_pack, 1);

util_printf_prompt("Name of new case" , prompt_len , '=' , "=> ");
if (fgets(new_case, prompt_len, stdin) != NULL){
Expand Down Expand Up @@ -113,7 +114,7 @@ void enkf_tui_fs_select_case(void * arg)

arg_pack_type * arg_pack = arg_pack_safe_cast( arg );
enkf_main_type * enkf_main = enkf_main_safe_cast( arg_pack_iget_ptr(arg_pack, 0) );
menu_type * menu = arg_pack_iget_ptr(arg_pack, 1);
menu_type * menu = (menu_type *) arg_pack_iget_ptr(arg_pack, 1);
new_case = enkf_tui_fs_alloc_existing_case( enkf_main , "Name of case" , prompt_len);
if (new_case != NULL) {
enkf_main_select_fs( enkf_main , new_case );
Expand Down Expand Up @@ -156,7 +157,7 @@ static void enkf_tui_fs_copy_ensemble__(
return;
}
}
identity_permutation_raw = util_calloc( ens_size , sizeof * identity_permutation_raw );
identity_permutation_raw = (int *) util_calloc( ens_size , sizeof * identity_permutation_raw );
{
int iens;
for (iens =0; iens < ens_size; iens++)
Expand Down
Loading

0 comments on commit cd988dc

Please sign in to comment.