Skip to content

Commit

Permalink
Merge pull request #538 from joakim-hove/smspec_c++
Browse files Browse the repository at this point in the history
Smspec c++
  • Loading branch information
joakim-hove committed Nov 30, 2018
2 parents 423c04d + 30f567b commit c7df730
Show file tree
Hide file tree
Showing 33 changed files with 1,620 additions and 1,387 deletions.
2 changes: 1 addition & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -116,7 +116,7 @@ endif()
# Treat warnings as errors if not on Windows
if (NOT ERT_WINDOWS)
set( CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -std=gnu99 -Wall -Wno-unknown-pragmas ")
set( CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wall -Wno-unknown-pragmas -Wno-unused-result -Wno-unused-parameter" )
set( CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wfatal-errors -Wall -Wno-unknown-pragmas -Wno-unused-result -Wno-unused-parameter" )
endif()

if (MSVC)
Expand Down
24 changes: 12 additions & 12 deletions applications/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
project(libecl-applications)

if (BUILD_APPLICATIONS)
add_executable(sum_write ecl/sum_write.c)
add_executable(sum_write ecl/sum_write.cpp)
add_executable(make_grid ecl/make_grid.c)
add_executable(grdecl_grid ecl/grdecl_grid.c)
add_executable(summary ecl/view_summary.c)
add_executable(summary ecl/view_summary.cpp)
target_link_libraries(sum_write ecl)
target_link_libraries(make_grid ecl)
target_link_libraries(grdecl_grid ecl)
Expand All @@ -13,16 +13,16 @@ if (BUILD_APPLICATIONS)

list(APPEND apps make_grid grdecl_grid summary)

foreach (app ecl_pack
ecl_unpack
kw_extract
grid_info
grid_dump
grid_dump_ascii
select_test
load_test
foreach (app ecl_pack.c
ecl_unpack.c
kw_extract.cpp
grid_info.c
grid_dump.c
grid_dump_ascii.c
select_test.c
load_test.c
)
add_executable(${app} ecl/${app}.c)
add_executable(${app} ecl/${app})
target_link_libraries(${app} ecl)
list(APPEND apps ${app})
if (ERT_LINUX)
Expand Down Expand Up @@ -71,7 +71,7 @@ if (BUILD_APPLICATIONS)
endif()

if (BUILD_ECL_SUMMARY)
add_executable(ecl_summary ecl/view_summary.c)
add_executable(ecl_summary ecl/view_summary.cpp)
target_link_libraries(ecl_summary ecl)
list(APPEND apps ecl_summary)

Expand Down
File renamed without changes.
10 changes: 5 additions & 5 deletions applications/ecl/sum_write.c → applications/ecl/sum_write.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -223,7 +223,7 @@ int main( int argc , char ** argv) {

/*
The return value from the ecl_sum_add_var() function is an
smspec_node_type instance (implemented in file smspec_node.c);
ecl::smspec_node instance (implemented in file smspec_node.c);
which is essentially a struct holding header information about
this varible. There are several options on how to handle the
return value from the ecl_sum_add_var() function; which affect how
Expand All @@ -243,8 +243,8 @@ int main( int argc , char ** argv) {
*/

smspec_node_type * wwct_wellx = ecl_sum_add_var( ecl_sum , "WWCT" , NULL , 0 , "(1)" , 0.0);
smspec_node_type * wopr_wellx = ecl_sum_add_var( ecl_sum , "WOPR" , NULL , 0 , "Barrels" , 0.0);
const ecl::smspec_node * wwct_wellx = ecl_sum_add_var( ecl_sum , "WWCT" , NULL , 0 , "(1)" , 0.0);
const ecl::smspec_node * wopr_wellx = ecl_sum_add_var( ecl_sum , "WOPR" , NULL , 0 , "Barrels" , 0.0);


{
Expand Down Expand Up @@ -297,8 +297,8 @@ int main( int argc , char ** argv) {
We can use the smspec_node value from the
ecl_sum_add_var() function directly:
*/
ecl_sum_tstep_set_from_node( tstep , wwct_wellx , sim_days );
ecl_sum_tstep_set_from_node( tstep, wopr_wellx, sim_days * 100);
ecl_sum_tstep_set_from_node( tstep , *wwct_wellx , sim_days );
ecl_sum_tstep_set_from_node( tstep, *wopr_wellx, sim_days * 100);
}
}
}
Expand Down
File renamed without changes.
8 changes: 5 additions & 3 deletions bin/summary_resample
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ parser.add_argument("input_case", metavar="input_case", type=str)
parser.add_argument("output_case", metavar="output_case", type=str)
parser.add_argument("--num-timestep", type=int, default=50)
parser.add_argument("--refcase", metavar="refcase", type=str)
parser.add_argument("--extrapolation", action="store_true")
args = parser.parse_args()

input_case = EclSum(args.input_case)
Expand All @@ -23,7 +24,8 @@ else:
end_time = input_case.get_end_time()
time_points = TimeVector.create_linear(CTime(start_time), CTime(end_time), args.num_timestep)


sys.stderr.write("The summary_resample code is partly broken as of October 24.th 2018. Should be fixed\n")
output_case = input_case.resample(args.output_case, time_points)
output_case = input_case.resample(args.output_case,
time_points,
lower_extrapolation=args.extrapolation,
upper_extrapolation=args.extrapolation)
output_case.fwrite( )
Loading

0 comments on commit c7df730

Please sign in to comment.