Compare commits
2 Commits
testing/20
...
release/20
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
fc48a12fc5 | ||
|
|
f040c2984e |
25
.gitignore
vendored
25
.gitignore
vendored
@@ -44,28 +44,3 @@ Testing/
|
||||
|
||||
# Build directory in source.
|
||||
build/
|
||||
|
||||
gmon.out
|
||||
log.log
|
||||
build
|
||||
install
|
||||
.cproject
|
||||
.project
|
||||
/testdata/statoil
|
||||
.idea
|
||||
/Debug/
|
||||
|
||||
# Compiled Dynamic libraries
|
||||
*.so
|
||||
*.dylib
|
||||
|
||||
# Compiled Static libraries
|
||||
*.lai
|
||||
*.la
|
||||
*.a
|
||||
|
||||
# Mac OS X debug info
|
||||
*.dSYM
|
||||
|
||||
# emacs directory setting:
|
||||
.dir-locals.el
|
||||
|
||||
30
.travis.yml
Normal file
30
.travis.yml
Normal file
@@ -0,0 +1,30 @@
|
||||
language: cpp
|
||||
|
||||
compiler:
|
||||
- gcc
|
||||
|
||||
addons:
|
||||
apt:
|
||||
sources:
|
||||
- boost-latest
|
||||
- ubuntu-toolchain-r-test
|
||||
packages:
|
||||
- libboost1.55-all-dev
|
||||
- gcc-4.8
|
||||
- g++-4.8
|
||||
- gfortran-4.8
|
||||
- liblapack-dev
|
||||
- libgmp3-dev
|
||||
- libsuitesparse-dev
|
||||
- libeigen3-dev
|
||||
|
||||
before_script:
|
||||
- export CXX="g++-4.8" CC="gcc-4.8" FC="gfortran-4.8"
|
||||
- cd ..
|
||||
- opm-common/travis/build-prereqs.sh
|
||||
- opm-common/travis/clone-opm.sh opm-common
|
||||
|
||||
|
||||
script: opm-common/travis/build-and-test.sh opm-common
|
||||
|
||||
|
||||
145
CMakeLists.txt
145
CMakeLists.txt
@@ -1,65 +1,25 @@
|
||||
project(opm-common C CXX)
|
||||
cmake_minimum_required (VERSION 2.8)
|
||||
|
||||
option(SIBLING_SEARCH "Search for other modules in sibling directories?" ON)
|
||||
list(APPEND CMAKE_MODULE_PATH ${PROJECT_SOURCE_DIR}/cmake/Modules)
|
||||
set(OPM_MACROS_ROOT ${PROJECT_SOURCE_DIR})
|
||||
|
||||
option(ENABLE_ECL_INPUT "Enable eclipse input support?" ON)
|
||||
option(ENABLE_ECL_OUTPUT "Enable eclipse output support?" ON)
|
||||
option(ENABLE_MOCKSIM "Build the mock simulator for io testing" ON)
|
||||
option(ENABLE_WELL_TEST "Enable testing of well code when building Schedule object" OFF)
|
||||
|
||||
if (ENABLE_WELL_TEST)
|
||||
add_definitions(-DWELL_TEST)
|
||||
endif()
|
||||
|
||||
# Output implies input
|
||||
if(ENABLE_ECL_OUTPUT)
|
||||
set(ENABLE_ECL_INPUT ON)
|
||||
endif()
|
||||
|
||||
# And likewise, no input means no output
|
||||
if(NOT ENABLE_ECL_INPUT)
|
||||
set(ENABLE_ECL_OUTPUT OFF)
|
||||
endif()
|
||||
|
||||
|
||||
# not the same location as most of the other projects; this hook overrides
|
||||
macro (dir_hook)
|
||||
endmacro (dir_hook)
|
||||
|
||||
# We need to define this variable in the installed cmake config file.
|
||||
set(OPM_PROJECT_EXTRA_CODE_INSTALLED "#ENABLE_ECL_INPUT is needed by opm-common-prereq.cmake
|
||||
set(ENABLE_ECL_INPUT ${ENABLE_ECL_INPUT})
|
||||
set(OPM_MACROS_ROOT ${CMAKE_INSTALL_PREFIX}/share/opm)
|
||||
list(APPEND CMAKE_MODULE_PATH \${OPM_MACROS_ROOT}/cmake/Modules)
|
||||
include(OpmPackage) #Make macros availabe after find_package(opm-common)")
|
||||
set(OPM_PROJECT_EXTRA_CODE_INSTALLED "set(OPM_MACROS_ROOT ${CMAKE_INSTALL_PREFIX}/share/opm)
|
||||
list(APPEND CMAKE_MODULE_PATH \${OPM_MACROS_ROOT}/cmake/Modules)")
|
||||
|
||||
set(OPM_PROJECT_EXTRA_CODE_INTREE "#ENABLE_ECL_INPUT is needed by opm-common-prereq.cmake
|
||||
set(ENABLE_ECL_INPUT ${ENABLE_ECL_INPUT})
|
||||
set(OPM_MACROS_ROOT ${OPM_MACROS_ROOT})
|
||||
list(APPEND CMAKE_MODULE_PATH \${OPM_MACROS_ROOT}/cmake/Modules)
|
||||
include(OpmPackage) #Make macros availabe after find_package(opm-common)")
|
||||
if(ENABLE_ECL_OUTPUT)
|
||||
set(OPM_PROJECT_EXTRA_CODE_INSTALLED "${OPM_PROJECT_EXTRA_CODE_INSTALLED}
|
||||
set(COMPARE_ECL_COMMAND ${CMAKE_INSTALL_PREFIX}/bin${${name}_VER_DIR}/compareECL)
|
||||
set(OPM_PACK_COMMAND ${CMAKE_INSTALL_PREFIX}/bin${${name}_VER_DIR}/opmpack)")
|
||||
|
||||
set(OPM_PROJECT_EXTRA_CODE_INTREE "${OPM_PROJECT_EXTRA_CODE_INTREE}
|
||||
set(COMPARE_ECL_COMMAND ${PROJECT_BINARY_DIR}/bin/compareECL)
|
||||
set(OPM_PACK_COMMAND ${PROJECT_BINARY_DIR}/bin/opmpack)")
|
||||
endif()
|
||||
set(OPM_PROJECT_EXTRA_CODE_INTREE "set(OPM_MACROS_ROOT ${OPM_COMMON_ROOT})
|
||||
list(APPEND CMAKE_MODULE_PATH \${OPM_MACROS_ROOT}/cmake/Modules)")
|
||||
|
||||
# project information is in dune.module. Read this file and set variables.
|
||||
# we cannot generate dune.module since it is read by dunecontrol before
|
||||
# the build starts, so it makes sense to keep the data there then.
|
||||
include (OpmInit)
|
||||
|
||||
# Look for the opm-tests repository; if found the variable
|
||||
# HAVE_OPM_TESTS will be set to true.
|
||||
include(Findopm-tests)
|
||||
|
||||
# list of prerequisites for this particular project; this is in a
|
||||
# separate file (in cmake/Modules sub-directory) because it is shared
|
||||
# with the find module
|
||||
@@ -70,50 +30,12 @@ include (${project}-prereqs)
|
||||
include (CMakeLists_files.cmake)
|
||||
|
||||
macro (config_hook)
|
||||
if(ENABLE_ECL_INPUT)
|
||||
if(NOT cjson_FOUND)
|
||||
list(APPEND EXTRA_INCLUDES ${PROJECT_SOURCE_DIR}/external/cjson)
|
||||
endif()
|
||||
# For this project
|
||||
include_directories(${EXTRA_INCLUDES} ${PROJECT_BINARY_DIR}/include)
|
||||
|
||||
# For downstreams
|
||||
list(APPEND EXTRA_INCLUDES ${PROJECT_BINARY_DIR}/include)
|
||||
set(OPM_PROJECT_EXTRA_CODE_INTREE "${OPM_PROJECT_EXTRA_CODE_INTREE}
|
||||
list(APPEND opm-common_INCLUDE_DIRS ${EXTRA_INCLUDES})")
|
||||
if(ENABLE_ECL_INPUT)
|
||||
set(OPM_PROJECT_EXTRA_CODE_INTREE "${OPM_PROJECT_EXTRA_CODE_INTREE}
|
||||
set(HAVE_ECL_INPUT 1)")
|
||||
set(OPM_PROJECT_EXTRA_CODE_INSTALLED "${OPM_PROJECT_EXTRA_CODE_INSTALLED}
|
||||
set(HAVE_ECL_INPUT 1)")
|
||||
endif()
|
||||
if(ENABLE_ECL_OUTPUT)
|
||||
set(OPM_PROJECT_EXTRA_CODE_INTREE "${OPM_PROJECT_EXTRA_CODE_INTREE}
|
||||
set(HAVE_ECL_OUTPUT 1)")
|
||||
set(OPM_PROJECT_EXTRA_CODE_INSTALLED "${OPM_PROJECT_EXTRA_CODE_INSTALLED}
|
||||
set(HAVE_ECL_OUTPUT 1)")
|
||||
endif()
|
||||
|
||||
# Configure boost targets for old cmake
|
||||
include(cmake/Modules/BoostTargets.cmake)
|
||||
|
||||
if (HAVE_DYNAMIC_BOOST_TEST)
|
||||
set_target_properties(Boost::unit_test_framework PROPERTIES INTERFACE_COMPILE_DEFINITIONS BOOST_TEST_DYN_LINK=1)
|
||||
endif()
|
||||
endif()
|
||||
endmacro (config_hook)
|
||||
|
||||
macro (prereqs_hook)
|
||||
endmacro (prereqs_hook)
|
||||
|
||||
macro (sources_hook)
|
||||
if(ENABLE_ECL_INPUT)
|
||||
# Keyword generation
|
||||
include(GenerateKeywords.cmake)
|
||||
|
||||
# Append generated sources
|
||||
list(APPEND opm-common_SOURCES ${PROJECT_BINARY_DIR}/ParserKeywords.cpp)
|
||||
endif()
|
||||
endmacro (sources_hook)
|
||||
|
||||
macro (fortran_hook)
|
||||
@@ -123,69 +45,10 @@ macro (files_hook)
|
||||
endmacro (files_hook)
|
||||
|
||||
macro (tests_hook)
|
||||
if(ENABLE_ECL_INPUT)
|
||||
include(ExtraTests.cmake)
|
||||
endif()
|
||||
endmacro (tests_hook)
|
||||
|
||||
macro (install_hook)
|
||||
install(DIRECTORY ${PROJECT_BINARY_DIR}/include/
|
||||
DESTINATION include
|
||||
PATTERN *.hpp)
|
||||
endmacro (install_hook)
|
||||
|
||||
# all setup common to the OPM library modules is done here
|
||||
include (OpmLibMain)
|
||||
|
||||
if (ENABLE_MOCKSIM)
|
||||
add_library(mocksim
|
||||
msim/src/msim.cpp)
|
||||
target_link_libraries(mocksim opmcommon)
|
||||
target_include_directories(mocksim PUBLIC msim/include)
|
||||
add_executable(msim examples/msim.cpp)
|
||||
target_link_libraries(msim mocksim)
|
||||
|
||||
set(_libs mocksim opmcommon
|
||||
${Boost_UNIT_TEST_FRAMEWORK_LIBRARY})
|
||||
|
||||
foreach( test test_msim test_msim_ACTIONX )
|
||||
opm_add_test(${test} SOURCES tests/msim/${test}
|
||||
LIBRARIES ${_libs}
|
||||
WORKING_DIRECTORY ${PROJECT_BINARY_DIR}/tests)
|
||||
endforeach()
|
||||
endif()
|
||||
|
||||
# Build the compare utilities
|
||||
if(ENABLE_ECL_INPUT)
|
||||
add_library(testutil STATIC
|
||||
examples/test_util/EclFile.cpp
|
||||
examples/test_util/EclFilesComparator.cpp
|
||||
examples/test_util/EclOutput.cpp
|
||||
examples/test_util/EclRegressionTest.cpp
|
||||
examples/test_util/EclUtil.cpp
|
||||
examples/test_util/EGrid.cpp
|
||||
examples/test_util/ERft.cpp
|
||||
examples/test_util/ERst.cpp
|
||||
examples/test_util/ESmry.cpp)
|
||||
foreach(target compareECL convertECL)
|
||||
add_executable(${target} examples/test_util/${target}.cpp)
|
||||
target_link_libraries(${target} testutil opmcommon)
|
||||
install(TARGETS ${target} DESTINATION bin)
|
||||
endforeach()
|
||||
|
||||
# Add the tests
|
||||
set(_libs testutil opmcommon
|
||||
${Boost_UNIT_TEST_FRAMEWORK_LIBRARY})
|
||||
foreach(test test_EclFilesComparator test_EclIO test_EclRegressionTest
|
||||
test_EGrid test_ERft test_ERst test_ESmry)
|
||||
opm_add_test(${test} CONDITION ENABLE_ECL_INPUT
|
||||
LIBRARIES ${_libs}
|
||||
WORKING_DIRECTORY ${PROJECT_BINARY_DIR}/tests)
|
||||
endforeach()
|
||||
endif()
|
||||
|
||||
# Install build system files
|
||||
install(DIRECTORY cmake DESTINATION share/opm)
|
||||
|
||||
# Install tab completion skeleton
|
||||
install(FILES etc/opm_bash_completion.sh.in DESTINATION share/opm/etc)
|
||||
|
||||
@@ -21,331 +21,35 @@
|
||||
# the library needs it.
|
||||
|
||||
list (APPEND MAIN_SOURCE_FILES
|
||||
src/opm/common/data/SimulationDataContainer.cpp
|
||||
src/opm/common/OpmLog/CounterLog.cpp
|
||||
src/opm/common/OpmLog/EclipsePRTLog.cpp
|
||||
src/opm/common/OpmLog/LogBackend.cpp
|
||||
src/opm/common/OpmLog/Logger.cpp
|
||||
src/opm/common/OpmLog/LogUtil.cpp
|
||||
src/opm/common/OpmLog/OpmLog.cpp
|
||||
src/opm/common/OpmLog/StreamLog.cpp
|
||||
src/opm/common/OpmLog/TimerLog.cpp
|
||||
src/opm/common/utility/numeric/MonotCubicInterpolator.cpp
|
||||
src/opm/common/utility/parameters/Parameter.cpp
|
||||
src/opm/common/utility/parameters/ParameterGroup.cpp
|
||||
src/opm/common/utility/parameters/ParameterTools.cpp
|
||||
src/opm/common/utility/numeric/calculateCellVol.cpp
|
||||
opm/common/data/SimulationDataContainer.cpp
|
||||
opm/common/OpmLog/CounterLog.cpp
|
||||
opm/common/OpmLog/EclipsePRTLog.cpp
|
||||
opm/common/OpmLog/LogBackend.cpp
|
||||
opm/common/OpmLog/Logger.cpp
|
||||
opm/common/OpmLog/LogUtil.cpp
|
||||
opm/common/OpmLog/OpmLog.cpp
|
||||
opm/common/OpmLog/StreamLog.cpp
|
||||
opm/common/OpmLog/TimerLog.cpp
|
||||
)
|
||||
if(ENABLE_ECL_INPUT)
|
||||
list(APPEND MAIN_SOURCE_FILES
|
||||
src/opm/json/JsonObject.cpp
|
||||
src/opm/parser/eclipse/Deck/Deck.cpp
|
||||
src/opm/parser/eclipse/Deck/DeckItem.cpp
|
||||
src/opm/parser/eclipse/Deck/DeckKeyword.cpp
|
||||
src/opm/parser/eclipse/Deck/DeckRecord.cpp
|
||||
src/opm/parser/eclipse/Deck/DeckOutput.cpp
|
||||
src/opm/parser/eclipse/Deck/Section.cpp
|
||||
src/opm/parser/eclipse/Deck/UDAValue.cpp
|
||||
src/opm/parser/eclipse/EclipseState/AquiferCT.cpp
|
||||
src/opm/parser/eclipse/EclipseState/Aquifetp.cpp
|
||||
src/opm/parser/eclipse/EclipseState/Aquancon.cpp
|
||||
src/opm/parser/eclipse/EclipseState/checkDeck.cpp
|
||||
src/opm/parser/eclipse/EclipseState/Eclipse3DProperties.cpp
|
||||
src/opm/parser/eclipse/EclipseState/EclipseConfig.cpp
|
||||
src/opm/parser/eclipse/EclipseState/EclipseState.cpp
|
||||
src/opm/parser/eclipse/EclipseState/EndpointScaling.cpp
|
||||
src/opm/parser/eclipse/EclipseState/Edit/EDITNNC.cpp
|
||||
src/opm/parser/eclipse/EclipseState/Grid/Box.cpp
|
||||
src/opm/parser/eclipse/EclipseState/Grid/BoxManager.cpp
|
||||
src/opm/parser/eclipse/EclipseState/Grid/EclipseGrid.cpp
|
||||
src/opm/parser/eclipse/EclipseState/Grid/FaceDir.cpp
|
||||
src/opm/parser/eclipse/EclipseState/Grid/FaultCollection.cpp
|
||||
src/opm/parser/eclipse/EclipseState/Grid/Fault.cpp
|
||||
src/opm/parser/eclipse/EclipseState/Grid/FaultFace.cpp
|
||||
src/opm/parser/eclipse/EclipseState/Grid/GridDims.cpp
|
||||
src/opm/parser/eclipse/EclipseState/Grid/GridProperties.cpp
|
||||
src/opm/parser/eclipse/EclipseState/Grid/GridProperty.cpp
|
||||
src/opm/parser/eclipse/EclipseState/Grid/MULTREGTScanner.cpp
|
||||
src/opm/parser/eclipse/EclipseState/Grid/NNC.cpp
|
||||
src/opm/parser/eclipse/EclipseState/Grid/PinchMode.cpp
|
||||
src/opm/parser/eclipse/EclipseState/Grid/SatfuncPropertyInitializers.cpp
|
||||
src/opm/parser/eclipse/EclipseState/Grid/setKeywordBox.cpp
|
||||
src/opm/parser/eclipse/EclipseState/Grid/TransMult.cpp
|
||||
src/opm/parser/eclipse/EclipseState/InitConfig/Equil.cpp
|
||||
src/opm/parser/eclipse/EclipseState/InitConfig/InitConfig.cpp
|
||||
src/opm/parser/eclipse/EclipseState/IOConfig/IOConfig.cpp
|
||||
src/opm/parser/eclipse/EclipseState/IOConfig/RestartConfig.cpp
|
||||
src/opm/parser/eclipse/EclipseState/Runspec.cpp
|
||||
src/opm/parser/eclipse/EclipseState/Schedule/Action/ActionAST.cpp
|
||||
src/opm/parser/eclipse/EclipseState/Schedule/Action/ActionContext.cpp
|
||||
src/opm/parser/eclipse/EclipseState/Schedule/Action/Actions.cpp
|
||||
src/opm/parser/eclipse/EclipseState/Schedule/Action/ActionX.cpp
|
||||
src/opm/parser/eclipse/EclipseState/Schedule/Action/ActionParser.cpp
|
||||
src/opm/parser/eclipse/EclipseState/Schedule/Action/ActionValue.cpp
|
||||
src/opm/parser/eclipse/EclipseState/Schedule/Action/ASTNode.cpp
|
||||
src/opm/parser/eclipse/EclipseState/Schedule/ArrayDimChecker.cpp
|
||||
src/opm/parser/eclipse/EclipseState/Schedule/Events.cpp
|
||||
src/opm/parser/eclipse/EclipseState/Schedule/Group.cpp
|
||||
src/opm/parser/eclipse/EclipseState/Schedule/GroupTree.cpp
|
||||
src/opm/parser/eclipse/EclipseState/Schedule/injection.cpp
|
||||
src/opm/parser/eclipse/EclipseState/Schedule/MessageLimits.cpp
|
||||
src/opm/parser/eclipse/EclipseState/Schedule/MSW/Compsegs.cpp
|
||||
src/opm/parser/eclipse/EclipseState/Schedule/MSW/Segment.cpp
|
||||
src/opm/parser/eclipse/EclipseState/Schedule/MSW/WellSegments.cpp
|
||||
src/opm/parser/eclipse/EclipseState/Schedule/MSW/updatingConnectionsWithSegments.cpp
|
||||
src/opm/parser/eclipse/EclipseState/Schedule/OilVaporizationProperties.cpp
|
||||
src/opm/parser/eclipse/EclipseState/Schedule/RFTConfig.cpp
|
||||
src/opm/parser/eclipse/EclipseState/Schedule/Schedule.cpp
|
||||
src/opm/parser/eclipse/EclipseState/Schedule/ScheduleEnums.cpp
|
||||
src/opm/parser/eclipse/EclipseState/Schedule/SummaryState.cpp
|
||||
src/opm/parser/eclipse/EclipseState/Schedule/TimeMap.cpp
|
||||
src/opm/parser/eclipse/EclipseState/Schedule/Tuning.cpp
|
||||
src/opm/parser/eclipse/EclipseState/Schedule/Well/Connection.cpp
|
||||
src/opm/parser/eclipse/EclipseState/Schedule/Well/Well.cpp
|
||||
src/opm/parser/eclipse/EclipseState/Schedule/Well/Well2.cpp
|
||||
src/opm/parser/eclipse/EclipseState/Schedule/Well/WellConnections.cpp
|
||||
src/opm/parser/eclipse/EclipseState/Schedule/Well/WList.cpp
|
||||
src/opm/parser/eclipse/EclipseState/Schedule/Well/WListManager.cpp
|
||||
src/opm/parser/eclipse/EclipseState/Schedule/Well/WellEconProductionLimits.cpp
|
||||
src/opm/parser/eclipse/EclipseState/Schedule/Well/WellInjectionProperties.cpp
|
||||
src/opm/parser/eclipse/EclipseState/Schedule/Well/WellPolymerProperties.cpp
|
||||
src/opm/parser/eclipse/EclipseState/Schedule/Well/WellTracerProperties.cpp
|
||||
src/opm/parser/eclipse/EclipseState/Schedule/Well/WellProductionProperties.cpp
|
||||
src/opm/parser/eclipse/EclipseState/Schedule/Well/WellTestConfig.cpp
|
||||
src/opm/parser/eclipse/EclipseState/Schedule/Well/WellTestState.cpp
|
||||
src/opm/parser/eclipse/EclipseState/SimulationConfig/SimulationConfig.cpp
|
||||
src/opm/parser/eclipse/EclipseState/SimulationConfig/ThresholdPressure.cpp
|
||||
src/opm/parser/eclipse/EclipseState/SummaryConfig/SummaryConfig.cpp
|
||||
src/opm/parser/eclipse/EclipseState/Tables/ColumnSchema.cpp
|
||||
src/opm/parser/eclipse/EclipseState/Tables/JFunc.cpp
|
||||
src/opm/parser/eclipse/EclipseState/Tables/PvtxTable.cpp
|
||||
src/opm/parser/eclipse/EclipseState/Tables/SimpleTable.cpp
|
||||
src/opm/parser/eclipse/EclipseState/Tables/PolyInjTables.cpp
|
||||
src/opm/parser/eclipse/EclipseState/Tables/TableColumn.cpp
|
||||
src/opm/parser/eclipse/EclipseState/Tables/TableContainer.cpp
|
||||
src/opm/parser/eclipse/EclipseState/Tables/TableIndex.cpp
|
||||
src/opm/parser/eclipse/EclipseState/Tables/TableManager.cpp
|
||||
src/opm/parser/eclipse/EclipseState/Tables/TableSchema.cpp
|
||||
src/opm/parser/eclipse/EclipseState/Tables/Tables.cpp
|
||||
src/opm/parser/eclipse/EclipseState/Tables/Rock2dTable.cpp
|
||||
src/opm/parser/eclipse/EclipseState/Tables/Rock2dtrTable.cpp
|
||||
src/opm/parser/eclipse/EclipseState/Schedule/UDQ/UDQASTNode.cpp
|
||||
src/opm/parser/eclipse/EclipseState/Schedule/UDQ/UDQParams.cpp
|
||||
src/opm/parser/eclipse/EclipseState/Schedule/UDQ/UDQParser.cpp
|
||||
src/opm/parser/eclipse/EclipseState/Schedule/UDQ/UDQSet.cpp
|
||||
src/opm/parser/eclipse/EclipseState/Schedule/UDQ/UDQWellSet.cpp
|
||||
src/opm/parser/eclipse/EclipseState/Schedule/UDQ/UDQAssign.cpp
|
||||
src/opm/parser/eclipse/EclipseState/Schedule/UDQ/UDQDefine.cpp
|
||||
src/opm/parser/eclipse/EclipseState/Schedule/UDQ/UDQEnums.cpp
|
||||
src/opm/parser/eclipse/EclipseState/Schedule/UDQ/UDQInput.cpp
|
||||
src/opm/parser/eclipse/EclipseState/Schedule/UDQ/UDQContext.cpp
|
||||
src/opm/parser/eclipse/EclipseState/Schedule/UDQ/UDQFunction.cpp
|
||||
src/opm/parser/eclipse/EclipseState/Schedule/UDQ/UDQFunctionTable.cpp
|
||||
src/opm/parser/eclipse/EclipseState/Schedule/VFPInjTable.cpp
|
||||
src/opm/parser/eclipse/EclipseState/Schedule/VFPProdTable.cpp
|
||||
src/opm/parser/eclipse/Parser/ErrorGuard.cpp
|
||||
src/opm/parser/eclipse/Parser/ParseContext.cpp
|
||||
src/opm/parser/eclipse/Parser/Parser.cpp
|
||||
src/opm/parser/eclipse/Parser/ParserEnums.cpp
|
||||
src/opm/parser/eclipse/Parser/ParserItem.cpp
|
||||
src/opm/parser/eclipse/Parser/ParserKeyword.cpp
|
||||
src/opm/parser/eclipse/Parser/ParserRecord.cpp
|
||||
src/opm/parser/eclipse/RawDeck/RawKeyword.cpp
|
||||
src/opm/parser/eclipse/RawDeck/RawRecord.cpp
|
||||
src/opm/parser/eclipse/RawDeck/StarToken.cpp
|
||||
src/opm/parser/eclipse/Units/Dimension.cpp
|
||||
src/opm/parser/eclipse/Units/UnitSystem.cpp
|
||||
src/opm/parser/eclipse/Utility/Functional.cpp
|
||||
src/opm/parser/eclipse/Utility/Stringview.cpp
|
||||
)
|
||||
|
||||
if(NOT cjson_FOUND)
|
||||
list(APPEND MAIN_SOURCE_FILES external/cjson/cJSON.c)
|
||||
endif()
|
||||
endif()
|
||||
if(ENABLE_ECL_OUTPUT)
|
||||
list( APPEND MAIN_SOURCE_FILES
|
||||
src/opm/output/eclipse/AggregateConnectionData.cpp
|
||||
src/opm/output/eclipse/AggregateGroupData.cpp
|
||||
src/opm/output/eclipse/AggregateMSWData.cpp
|
||||
src/opm/output/eclipse/AggregateWellData.cpp
|
||||
src/opm/output/eclipse/CreateDoubHead.cpp
|
||||
src/opm/output/eclipse/CreateInteHead.cpp
|
||||
src/opm/output/eclipse/CreateLogiHead.cpp
|
||||
src/opm/output/eclipse/DoubHEAD.cpp
|
||||
src/opm/output/eclipse/EclipseGridInspector.cpp
|
||||
src/opm/output/eclipse/EclipseIO.cpp
|
||||
src/opm/output/eclipse/InteHEAD.cpp
|
||||
src/opm/output/eclipse/libECLRestart.cpp
|
||||
src/opm/output/eclipse/LinearisedOutputTable.cpp
|
||||
src/opm/output/eclipse/LoadRestart.cpp
|
||||
src/opm/output/eclipse/LogiHEAD.cpp
|
||||
src/opm/output/eclipse/RestartIO.cpp
|
||||
src/opm/output/eclipse/Summary.cpp
|
||||
src/opm/output/eclipse/Tables.cpp
|
||||
src/opm/output/eclipse/RegionCache.cpp
|
||||
src/opm/output/eclipse/RestartValue.cpp
|
||||
src/opm/output/data/Solution.cpp
|
||||
)
|
||||
endif()
|
||||
|
||||
list (APPEND TEST_SOURCE_FILES
|
||||
tests/test_calculateCellVol.cpp
|
||||
tests/test_cmp.cpp
|
||||
tests/test_cubic.cpp
|
||||
tests/test_messagelimiter.cpp
|
||||
tests/test_nonuniformtablelinear.cpp
|
||||
tests/test_OpmLog.cpp
|
||||
tests/test_param.cpp
|
||||
tests/test_SimulationDataContainer.cpp
|
||||
tests/test_sparsevector.cpp
|
||||
tests/test_uniformtablelinear.cpp
|
||||
)
|
||||
if(ENABLE_ECL_INPUT)
|
||||
list(APPEND TEST_SOURCE_FILES
|
||||
tests/parser/ACTIONX.cpp
|
||||
tests/parser/ADDREGTests.cpp
|
||||
tests/parser/AquiferCTTests.cpp
|
||||
tests/parser/AquifetpTests.cpp
|
||||
tests/parser/AqudimsTests.cpp
|
||||
tests/parser/AquanconTests.cpp
|
||||
tests/parser/BoxTests.cpp
|
||||
tests/parser/ColumnSchemaTests.cpp
|
||||
tests/parser/ConnectionTests.cpp
|
||||
tests/parser/COMPSEGUnits.cpp
|
||||
tests/parser/CopyRegTests.cpp
|
||||
tests/parser/DeckTests.cpp
|
||||
tests/parser/DynamicStateTests.cpp
|
||||
tests/parser/DynamicVectorTests.cpp
|
||||
tests/parser/Eclipse3DPropertiesTests.cpp
|
||||
tests/parser/EclipseGridTests.cpp
|
||||
tests/parser/EqualRegTests.cpp
|
||||
tests/parser/EventTests.cpp
|
||||
tests/parser/FaceDirTests.cpp
|
||||
tests/parser/FaultTests.cpp
|
||||
tests/parser/FunctionalTests.cpp
|
||||
tests/parser/GeomodifierTests.cpp
|
||||
tests/parser/GridPropertyTests.cpp
|
||||
tests/parser/GroupTests.cpp
|
||||
tests/parser/InitConfigTest.cpp
|
||||
tests/parser/IOConfigTests.cpp
|
||||
tests/parser/MessageLimitTests.cpp
|
||||
tests/parser/MultiRegTests.cpp
|
||||
tests/parser/MultisegmentWellTests.cpp
|
||||
tests/parser/MULTREGTScannerTests.cpp
|
||||
tests/parser/OrderedMapTests.cpp
|
||||
tests/parser/ParseContextTests.cpp
|
||||
tests/parser/ParseContext_EXIT1.cpp
|
||||
tests/parser/PORVTests.cpp
|
||||
tests/parser/RawKeywordTests.cpp
|
||||
tests/parser/RestartConfigTests.cpp
|
||||
tests/parser/RockTableTests.cpp
|
||||
tests/parser/RunspecTests.cpp
|
||||
tests/parser/SatfuncPropertyInitializersTests.cpp
|
||||
tests/parser/ScheduleTests.cpp
|
||||
tests/parser/SectionTests.cpp
|
||||
tests/parser/SimpleTableTests.cpp
|
||||
tests/parser/SimulationConfigTest.cpp
|
||||
tests/parser/StarTokenTests.cpp
|
||||
tests/parser/StringTests.cpp
|
||||
tests/parser/SummaryConfigTests.cpp
|
||||
tests/parser/TabdimsTests.cpp
|
||||
tests/parser/TableColumnTests.cpp
|
||||
tests/parser/TableContainerTests.cpp
|
||||
tests/parser/TableManagerTests.cpp
|
||||
tests/parser/TableSchemaTests.cpp
|
||||
tests/parser/ThresholdPressureTest.cpp
|
||||
tests/parser/TimeMapTest.cpp
|
||||
tests/parser/TransMultTests.cpp
|
||||
tests/parser/TuningTests.cpp
|
||||
tests/parser/UDQTests.cpp
|
||||
tests/parser/UnitTests.cpp
|
||||
tests/parser/ValueTests.cpp
|
||||
tests/parser/WellSolventTests.cpp
|
||||
tests/parser/WellTracerTests.cpp
|
||||
tests/parser/WellTests.cpp
|
||||
tests/parser/WLIST.cpp
|
||||
tests/parser/WTEST.cpp)
|
||||
endif()
|
||||
if(ENABLE_ECL_OUTPUT)
|
||||
list (APPEND TEST_SOURCE_FILES
|
||||
tests/test_AggregateWellData.cpp
|
||||
tests/test_AggregateGroupData.cpp
|
||||
tests/test_AggregateMSWData.cpp
|
||||
tests/test_AggregateConnectionData.cpp
|
||||
tests/test_ArrayDimChecker.cpp
|
||||
tests/test_CharArrayNullTerm.cpp
|
||||
tests/test_EclipseIO.cpp
|
||||
tests/test_DoubHEAD.cpp
|
||||
tests/test_InteHEAD.cpp
|
||||
tests/test_LinearisedOutputTable.cpp
|
||||
tests/test_LogiHEAD.cpp
|
||||
tests/test_regionCache.cpp
|
||||
tests/test_Restart.cpp
|
||||
tests/test_RFT.cpp
|
||||
tests/test_Solution.cpp
|
||||
tests/test_Summary.cpp
|
||||
tests/test_Tables.cpp
|
||||
tests/test_Wells.cpp
|
||||
tests/test_WindowedArray.cpp
|
||||
tests/test_writenumwells.cpp
|
||||
tests/test_cmp.cpp
|
||||
tests/test_OpmLog.cpp
|
||||
tests/test_messagelimiter.cpp
|
||||
)
|
||||
endif()
|
||||
|
||||
list (APPEND TEST_DATA_FILES
|
||||
tests/testdata.param
|
||||
)
|
||||
if(ENABLE_ECL_OUTPUT)
|
||||
list (APPEND TEST_DATA_FILES
|
||||
tests/expect-wdims.err.out
|
||||
tests/FIRST_SIM.DATA
|
||||
tests/FIRST_SIM_THPRES.DATA
|
||||
tests/summary_deck.DATA
|
||||
tests/group_group.DATA
|
||||
tests/testblackoilstate3.DATA
|
||||
tests/testrft.DATA
|
||||
tests/table_deck.DATA
|
||||
tests/summary_deck_non_constant_porosity.DATA
|
||||
tests/SUMMARY_EFF_FAC.DATA
|
||||
tests/SPE1CASE1.DATA
|
||||
tests/SPE1CASE1.SMSPEC
|
||||
tests/SPE9_CP_PACKED.DATA
|
||||
tests/SOFR_TEST.DATA
|
||||
)
|
||||
endif()
|
||||
)
|
||||
|
||||
list (APPEND EXAMPLE_SOURCE_FILES
|
||||
)
|
||||
if(ENABLE_ECL_INPUT)
|
||||
list (APPEND TEST_DATA_FILES
|
||||
tests/ECLFILE.INIT
|
||||
tests/ECLFILE.FINIT
|
||||
tests/SPE1CASE1.EGRID
|
||||
tests/SPE1CASE1.RFT
|
||||
tests/SPE1_TESTCASE.UNRST
|
||||
tests/SPE1_TESTCASE.FUNRST
|
||||
tests/SPE1CASE1.UNSMRY
|
||||
tests/SPE1CASE1_RST60.SMSPEC
|
||||
tests/SPE1CASE1_RST60.UNSMRY
|
||||
)
|
||||
list (APPEND EXAMPLE_SOURCE_FILES
|
||||
examples/opmi.cpp
|
||||
examples/opmpack.cpp
|
||||
examples/opmhash.cpp
|
||||
)
|
||||
endif()
|
||||
)
|
||||
|
||||
# programs listed here will not only be compiled, but also marked for
|
||||
# installation
|
||||
list (APPEND PROGRAM_SOURCE_FILES
|
||||
)
|
||||
if(ENABLE_ECL_INPUT)
|
||||
list (APPEND PROGRAM_SOURCE_FILES
|
||||
examples/opmi.cpp
|
||||
examples/opmpack.cpp
|
||||
examples/opmhash.cpp
|
||||
)
|
||||
endif()
|
||||
)
|
||||
|
||||
|
||||
list( APPEND PUBLIC_HEADER_FILES
|
||||
opm/common/ErrorMacros.hpp
|
||||
@@ -361,238 +65,6 @@ list( APPEND PUBLIC_HEADER_FILES
|
||||
opm/common/OpmLog/OpmLog.hpp
|
||||
opm/common/OpmLog/StreamLog.hpp
|
||||
opm/common/OpmLog/TimerLog.hpp
|
||||
opm/common/utility/numeric/cmp.hpp
|
||||
opm/common/util/numeric/cmp.hpp
|
||||
opm/common/utility/platform_dependent/disable_warnings.h
|
||||
opm/common/utility/platform_dependent/reenable_warnings.h
|
||||
opm/common/utility/numeric/blas_lapack.h
|
||||
opm/common/utility/numeric/buildUniformMonotoneTable.hpp
|
||||
opm/common/utility/numeric/linearInterpolation.hpp
|
||||
opm/common/utility/numeric/MonotCubicInterpolator.hpp
|
||||
opm/common/utility/numeric/NonuniformTableLinear.hpp
|
||||
opm/common/utility/numeric/RootFinders.hpp
|
||||
opm/common/utility/numeric/SparseVector.hpp
|
||||
opm/common/utility/numeric/UniformTableLinear.hpp
|
||||
opm/common/utility/parameters/ParameterGroup.hpp
|
||||
opm/common/utility/parameters/ParameterGroup_impl.hpp
|
||||
opm/common/utility/parameters/Parameter.hpp
|
||||
opm/common/utility/parameters/ParameterMapItem.hpp
|
||||
opm/common/utility/parameters/ParameterRequirement.hpp
|
||||
opm/common/utility/parameters/ParameterStrings.hpp
|
||||
opm/common/utility/parameters/ParameterTools.hpp
|
||||
opm/common/utility/numeric/calculateCellVol.hpp
|
||||
)
|
||||
if(ENABLE_ECL_INPUT)
|
||||
list(APPEND PUBLIC_HEADER_FILES
|
||||
opm/json/JsonObject.hpp
|
||||
opm/parser/eclipse/Utility/Stringview.hpp
|
||||
opm/parser/eclipse/Utility/Functional.hpp
|
||||
opm/parser/eclipse/Utility/Typetools.hpp
|
||||
opm/parser/eclipse/Utility/String.hpp
|
||||
opm/parser/eclipse/Generator/KeywordGenerator.hpp
|
||||
opm/parser/eclipse/Generator/KeywordLoader.hpp
|
||||
opm/parser/eclipse/Units/UnitSystem.hpp
|
||||
opm/parser/eclipse/Units/Units.hpp
|
||||
opm/parser/eclipse/Units/Dimension.hpp
|
||||
opm/parser/eclipse/Parser/ErrorGuard.hpp
|
||||
opm/parser/eclipse/Parser/ParserItem.hpp
|
||||
opm/parser/eclipse/Parser/Parser.hpp
|
||||
opm/parser/eclipse/Parser/ParserRecord.hpp
|
||||
opm/parser/eclipse/Parser/ParserKeyword.hpp
|
||||
opm/parser/eclipse/Parser/InputErrorAction.hpp
|
||||
opm/parser/eclipse/Parser/ParserEnums.hpp
|
||||
opm/parser/eclipse/Parser/ParseContext.hpp
|
||||
opm/parser/eclipse/Parser/ParserConst.hpp
|
||||
opm/parser/eclipse/EclipseState/InitConfig/InitConfig.hpp
|
||||
opm/parser/eclipse/EclipseState/InitConfig/Equil.hpp
|
||||
opm/parser/eclipse/EclipseState/Util/Value.hpp
|
||||
opm/parser/eclipse/EclipseState/Util/OrderedMap.hpp
|
||||
opm/parser/eclipse/EclipseState/SummaryConfig/SummaryConfig.hpp
|
||||
opm/parser/eclipse/EclipseState/Edit/EDITNNC.hpp
|
||||
opm/parser/eclipse/EclipseState/Grid/GridDims.hpp
|
||||
opm/parser/eclipse/EclipseState/Grid/TransMult.hpp
|
||||
opm/parser/eclipse/EclipseState/Grid/GridProperties.hpp
|
||||
opm/parser/eclipse/EclipseState/Grid/PinchMode.hpp
|
||||
opm/parser/eclipse/EclipseState/Grid/MULTREGTScanner.hpp
|
||||
opm/parser/eclipse/EclipseState/Grid/FaultCollection.hpp
|
||||
opm/parser/eclipse/EclipseState/Grid/SatfuncPropertyInitializers.hpp
|
||||
opm/parser/eclipse/EclipseState/Grid/Fault.hpp
|
||||
opm/parser/eclipse/EclipseState/Grid/Box.hpp
|
||||
opm/parser/eclipse/EclipseState/Grid/GridProperty.hpp
|
||||
opm/parser/eclipse/EclipseState/Grid/FaultFace.hpp
|
||||
opm/parser/eclipse/EclipseState/Grid/NNC.hpp
|
||||
opm/parser/eclipse/EclipseState/Grid/EclipseGrid.hpp
|
||||
opm/parser/eclipse/EclipseState/Grid/BoxManager.hpp
|
||||
opm/parser/eclipse/EclipseState/Grid/FaceDir.hpp
|
||||
opm/parser/eclipse/EclipseState/Grid/MinpvMode.hpp
|
||||
opm/parser/eclipse/EclipseState/Eclipse3DProperties.hpp
|
||||
opm/parser/eclipse/EclipseState/EndpointScaling.hpp
|
||||
opm/parser/eclipse/EclipseState/Tables/SimpleTable.hpp
|
||||
opm/parser/eclipse/EclipseState/Tables/PolyInjTable.hpp
|
||||
opm/parser/eclipse/EclipseState/Tables/PdvdTable.hpp
|
||||
opm/parser/eclipse/EclipseState/Tables/TlpmixpaTable.hpp
|
||||
opm/parser/eclipse/EclipseState/Tables/PvdgTable.hpp
|
||||
opm/parser/eclipse/EclipseState/Tables/MsfnTable.hpp
|
||||
opm/parser/eclipse/EclipseState/Tables/GasvisctTable.hpp
|
||||
opm/parser/eclipse/EclipseState/Tables/Regdims.hpp
|
||||
opm/parser/eclipse/EclipseState/Tables/Eqldims.hpp
|
||||
opm/parser/eclipse/EclipseState/Tables/SpecrockTable.hpp
|
||||
opm/parser/eclipse/EclipseState/Tables/PlydhflfTable.hpp
|
||||
opm/parser/eclipse/EclipseState/Tables/PlymwinjTable.hpp
|
||||
opm/parser/eclipse/EclipseState/Tables/PlyshlogTable.hpp
|
||||
opm/parser/eclipse/EclipseState/Tables/RsvdTable.hpp
|
||||
opm/parser/eclipse/EclipseState/Tables/SkprwatTable.hpp
|
||||
opm/parser/eclipse/EclipseState/Tables/SkprpolyTable.hpp
|
||||
opm/parser/eclipse/EclipseState/Tables/SpecheatTable.hpp
|
||||
opm/parser/eclipse/EclipseState/Tables/SgcwmisTable.hpp
|
||||
opm/parser/eclipse/EclipseState/Tables/Sof2Table.hpp
|
||||
opm/parser/eclipse/EclipseState/Tables/TableManager.hpp
|
||||
opm/parser/eclipse/EclipseState/Tables/SwfnTable.hpp
|
||||
opm/parser/eclipse/EclipseState/Tables/EnptvdTable.hpp
|
||||
opm/parser/eclipse/EclipseState/Tables/SwofTable.hpp
|
||||
opm/parser/eclipse/EclipseState/Tables/FlatTable.hpp
|
||||
opm/parser/eclipse/EclipseState/Tables/Aqudims.hpp
|
||||
opm/parser/eclipse/EclipseState/Tables/JFunc.hpp
|
||||
opm/parser/eclipse/EclipseState/Tables/TableIndex.hpp
|
||||
opm/parser/eclipse/EclipseState/Tables/PvtgTable.hpp
|
||||
opm/parser/eclipse/EclipseState/Tables/Tabdims.hpp
|
||||
opm/parser/eclipse/EclipseState/Tables/TableSchema.hpp
|
||||
opm/parser/eclipse/EclipseState/Tables/RocktabTable.hpp
|
||||
opm/parser/eclipse/EclipseState/Tables/EnkrvdTable.hpp
|
||||
opm/parser/eclipse/EclipseState/Tables/PlyrockTable.hpp
|
||||
opm/parser/eclipse/EclipseState/Tables/PvtxTable.hpp
|
||||
opm/parser/eclipse/EclipseState/Tables/WatvisctTable.hpp
|
||||
opm/parser/eclipse/EclipseState/Tables/TableEnums.hpp
|
||||
opm/parser/eclipse/EclipseState/Tables/RvvdTable.hpp
|
||||
opm/parser/eclipse/EclipseState/Tables/TableContainer.hpp
|
||||
opm/parser/eclipse/EclipseState/Tables/AqutabTable.hpp
|
||||
opm/parser/eclipse/EclipseState/Tables/PlyadsTable.hpp
|
||||
opm/parser/eclipse/EclipseState/Tables/PbvdTable.hpp
|
||||
opm/parser/eclipse/EclipseState/Tables/SorwmisTable.hpp
|
||||
opm/parser/eclipse/EclipseState/Tables/PlymaxTable.hpp
|
||||
opm/parser/eclipse/EclipseState/Tables/PlyviscTable.hpp
|
||||
opm/parser/eclipse/EclipseState/Tables/TableColumn.hpp
|
||||
opm/parser/eclipse/EclipseState/Tables/SsfnTable.hpp
|
||||
opm/parser/eclipse/EclipseState/Tables/PvdoTable.hpp
|
||||
opm/parser/eclipse/EclipseState/Tables/OilvisctTable.hpp
|
||||
opm/parser/eclipse/EclipseState/Tables/SgfnTable.hpp
|
||||
opm/parser/eclipse/EclipseState/Tables/MiscTable.hpp
|
||||
opm/parser/eclipse/EclipseState/Tables/SgwfnTable.hpp
|
||||
opm/parser/eclipse/EclipseState/Tables/PvdsTable.hpp
|
||||
opm/parser/eclipse/EclipseState/Tables/PvtoTable.hpp
|
||||
opm/parser/eclipse/EclipseState/Tables/Rock2dTable.hpp
|
||||
opm/parser/eclipse/EclipseState/Tables/Rock2dtrTable.hpp
|
||||
opm/parser/eclipse/EclipseState/Tables/RockwnodTable.hpp
|
||||
opm/parser/eclipse/EclipseState/Tables/OverburdTable.hpp
|
||||
opm/parser/eclipse/EclipseState/Tables/ColumnSchema.hpp
|
||||
opm/parser/eclipse/EclipseState/Tables/PmiscTable.hpp
|
||||
opm/parser/eclipse/EclipseState/Tables/RtempvdTable.hpp
|
||||
opm/parser/eclipse/EclipseState/Tables/SlgofTable.hpp
|
||||
opm/parser/eclipse/EclipseState/Tables/ImptvdTable.hpp
|
||||
opm/parser/eclipse/EclipseState/Tables/ImkrvdTable.hpp
|
||||
opm/parser/eclipse/EclipseState/Tables/Sof3Table.hpp
|
||||
opm/parser/eclipse/EclipseState/Tables/SgofTable.hpp
|
||||
opm/parser/eclipse/EclipseState/EclipseState.hpp
|
||||
opm/parser/eclipse/EclipseState/EclipseConfig.hpp
|
||||
opm/parser/eclipse/EclipseState/Aquancon.hpp
|
||||
opm/parser/eclipse/EclipseState/AquiferCT.hpp
|
||||
opm/parser/eclipse/EclipseState/Aquifetp.hpp
|
||||
opm/parser/eclipse/EclipseState/Schedule/Action/ActionAST.hpp
|
||||
opm/parser/eclipse/EclipseState/Schedule/Action/ActionContext.hpp
|
||||
opm/parser/eclipse/EclipseState/Schedule/Action/Actions.hpp
|
||||
opm/parser/eclipse/EclipseState/Schedule/Action/ActionX.hpp
|
||||
opm/parser/eclipse/EclipseState/Schedule/ArrayDimChecker.hpp
|
||||
opm/parser/eclipse/EclipseState/Schedule/TimeMap.hpp
|
||||
opm/parser/eclipse/EclipseState/Schedule/VFPInjTable.hpp
|
||||
opm/parser/eclipse/EclipseState/Schedule/VFPProdTable.hpp
|
||||
opm/parser/eclipse/EclipseState/Schedule/Well/Connection.hpp
|
||||
opm/parser/eclipse/EclipseState/Schedule/Well/Well.hpp
|
||||
opm/parser/eclipse/EclipseState/Schedule/Well/WellInjectionProperties.hpp
|
||||
opm/parser/eclipse/EclipseState/Schedule/Well/Well2.hpp
|
||||
opm/parser/eclipse/EclipseState/Schedule/Well/WList.hpp
|
||||
opm/parser/eclipse/EclipseState/Schedule/Well/WListManager.hpp
|
||||
opm/parser/eclipse/EclipseState/Schedule/Well/WellEconProductionLimits.hpp
|
||||
opm/parser/eclipse/EclipseState/Schedule/Well/WellPolymerProperties.hpp
|
||||
opm/parser/eclipse/EclipseState/Schedule/Well/WellTracerProperties.hpp
|
||||
opm/parser/eclipse/EclipseState/Schedule/Well/WellProductionProperties.hpp
|
||||
opm/parser/eclipse/EclipseState/Schedule/Well/WellTestConfig.hpp
|
||||
opm/parser/eclipse/EclipseState/Schedule/Well/WellTestState.hpp
|
||||
opm/parser/eclipse/EclipseState/Schedule/Well/WellConnections.hpp
|
||||
opm/parser/eclipse/EclipseState/Schedule/DynamicVector.hpp
|
||||
opm/parser/eclipse/EclipseState/Schedule/SummaryState.hpp
|
||||
opm/parser/eclipse/EclipseState/Schedule/RFTConfig.hpp
|
||||
opm/parser/eclipse/EclipseState/Schedule/Schedule.hpp
|
||||
opm/parser/eclipse/EclipseState/Schedule/Tuning.hpp
|
||||
opm/parser/eclipse/EclipseState/Schedule/Group.hpp
|
||||
opm/parser/eclipse/EclipseState/Schedule/MessageLimits.hpp
|
||||
opm/parser/eclipse/EclipseState/Schedule/Events.hpp
|
||||
opm/parser/eclipse/EclipseState/Schedule/ScheduleEnums.hpp
|
||||
opm/parser/eclipse/EclipseState/Schedule/OilVaporizationProperties.hpp
|
||||
opm/parser/eclipse/EclipseState/Schedule/GroupTree.hpp
|
||||
opm/parser/eclipse/EclipseState/Schedule/DynamicState.hpp
|
||||
opm/parser/eclipse/EclipseState/Schedule/MSW/Segment.hpp
|
||||
opm/parser/eclipse/EclipseState/Schedule/MSW/WellSegments.hpp
|
||||
opm/parser/eclipse/EclipseState/Schedule/MSW/updatingConnectionsWithSegments.hpp
|
||||
opm/parser/eclipse/EclipseState/SimulationConfig/ThresholdPressure.hpp
|
||||
opm/parser/eclipse/EclipseState/SimulationConfig/SimulationConfig.hpp
|
||||
opm/parser/eclipse/EclipseState/IOConfig/RestartConfig.hpp
|
||||
opm/parser/eclipse/EclipseState/IOConfig/IOConfig.hpp
|
||||
opm/parser/eclipse/EclipseState/checkDeck.hpp
|
||||
opm/parser/eclipse/EclipseState/Runspec.hpp
|
||||
opm/parser/eclipse/EclipseState/Schedule/UDQ/UDQAssign.hpp
|
||||
opm/parser/eclipse/EclipseState/Schedule/UDQ/UDQDefine.hpp
|
||||
opm/parser/eclipse/EclipseState/Schedule/UDQ/UDQContext.hpp
|
||||
opm/parser/eclipse/EclipseState/Schedule/UDQ/UDQInput.hpp
|
||||
opm/parser/eclipse/EclipseState/Schedule/UDQ/UDQEnums.hpp
|
||||
opm/parser/eclipse/EclipseState/Schedule/UDQ/UDQParams.hpp
|
||||
opm/parser/eclipse/EclipseState/Schedule/UDQ/UDQInput.hpp
|
||||
opm/parser/eclipse/EclipseState/Schedule/UDQ/UDQWellSet.hpp
|
||||
opm/parser/eclipse/EclipseState/Schedule/UDQ/UDQSet.hpp
|
||||
opm/parser/eclipse/EclipseState/Schedule/UDQ/UDQFunction.hpp
|
||||
opm/parser/eclipse/EclipseState/Schedule/UDQ/UDQFunctionTable.hpp
|
||||
opm/parser/eclipse/Deck/DeckItem.hpp
|
||||
opm/parser/eclipse/Deck/Deck.hpp
|
||||
opm/parser/eclipse/Deck/Section.hpp
|
||||
opm/parser/eclipse/Deck/DeckOutput.hpp
|
||||
opm/parser/eclipse/Deck/DeckKeyword.hpp
|
||||
opm/parser/eclipse/Deck/DeckRecord.hpp
|
||||
opm/parser/eclipse/Deck/UDAValue.hpp
|
||||
opm/parser/eclipse/RawDeck/StarToken.hpp
|
||||
opm/parser/eclipse/RawDeck/RawEnums.hpp
|
||||
opm/parser/eclipse/RawDeck/RawRecord.hpp
|
||||
opm/parser/eclipse/RawDeck/RawKeyword.hpp
|
||||
opm/parser/eclipse/RawDeck/RawConsts.hpp)
|
||||
endif()
|
||||
if(ENABLE_ECL_OUTPUT)
|
||||
list(APPEND PUBLIC_HEADER_FILES
|
||||
opm/output/data/Cells.hpp
|
||||
opm/output/data/Solution.hpp
|
||||
opm/output/data/Wells.hpp
|
||||
opm/output/eclipse/VectorItems/connection.hpp
|
||||
opm/output/eclipse/VectorItems/group.hpp
|
||||
opm/output/eclipse/VectorItems/intehead.hpp
|
||||
opm/output/eclipse/VectorItems/logihead.hpp
|
||||
opm/output/eclipse/VectorItems/msw.hpp
|
||||
opm/output/eclipse/VectorItems/well.hpp
|
||||
opm/output/eclipse/AggregateGroupData.hpp
|
||||
opm/output/eclipse/AggregateConnectionData.hpp
|
||||
opm/output/eclipse/AggregateMSWData.hpp
|
||||
opm/output/eclipse/AggregateWellData.hpp
|
||||
opm/output/eclipse/CharArrayNullTerm.hpp
|
||||
opm/output/eclipse/DoubHEAD.hpp
|
||||
opm/output/eclipse/EclipseGridInspector.hpp
|
||||
opm/output/eclipse/EclipseIO.hpp
|
||||
opm/output/eclipse/EclipseIOUtil.hpp
|
||||
opm/output/eclipse/InteHEAD.hpp
|
||||
opm/output/eclipse/libECLRestart.hpp
|
||||
opm/output/eclipse/LinearisedOutputTable.hpp
|
||||
opm/output/eclipse/LogiHEAD.hpp
|
||||
opm/output/eclipse/RegionCache.hpp
|
||||
opm/output/eclipse/RestartIO.hpp
|
||||
opm/output/eclipse/RestartValue.hpp
|
||||
opm/output/eclipse/Summary.hpp
|
||||
opm/output/eclipse/Tables.hpp
|
||||
opm/output/eclipse/WindowedArray.hpp
|
||||
opm/output/eclipse/WriteRestartHelpers.hpp
|
||||
opm/output/OutputWriter.hpp
|
||||
)
|
||||
endif()
|
||||
opm/common/utility/platform_dependent/reenable_warnings.h)
|
||||
|
||||
@@ -1,21 +0,0 @@
|
||||
execute_process(COMMAND ${CMAKE_COMMAND} -E copy_if_different
|
||||
${BASE_DIR}/tmp_gen/ParserKeywords.cpp
|
||||
${BASE_DIR}/ParserKeywords.cpp)
|
||||
|
||||
execute_process(COMMAND ${CMAKE_COMMAND} -E copy_if_different
|
||||
${BASE_DIR}/tmp_gen/inlinekw.cpp
|
||||
${BASE_DIR}/inlinekw.cpp)
|
||||
|
||||
execute_process(COMMAND ${CMAKE_COMMAND} -E copy_if_different
|
||||
${BASE_DIR}/tmp_gen/include/opm/parser/eclipse/Parser/ParserKeywords.hpp
|
||||
${BASE_DIR}/include/opm/parser/eclipse/Parser/ParserKeywords.hpp)
|
||||
|
||||
|
||||
file(GLOB HDRS ${BASE_DIR}/tmp_gen/include/opm/parser/eclipse/Parser/ParserKeywords/*.hpp)
|
||||
|
||||
foreach(HDR ${HDRS})
|
||||
file(RELATIVE_PATH hdr ${BASE_DIR}/tmp_gen/include/opm/parser/eclipse/Parser/ParserKeywords ${HDR})
|
||||
execute_process(COMMAND ${CMAKE_COMMAND} -E copy_if_different
|
||||
${HDR}
|
||||
${BASE_DIR}/include/opm/parser/eclipse/Parser/ParserKeywords/${hdr})
|
||||
endforeach()
|
||||
108
ExtraTests.cmake
108
ExtraTests.cmake
@@ -1,108 +0,0 @@
|
||||
# Libs to link tests against
|
||||
set(TEST_LIBS opmcommon ecl Boost::unit_test_framework)
|
||||
set(EXTRA_TESTS)
|
||||
|
||||
# Generated source, needs to be here
|
||||
opm_add_test(InlineKeywordTest
|
||||
EXE_NAME inlinekw
|
||||
SOURCES ${PROJECT_BINARY_DIR}/inlinekw.cpp
|
||||
LIBRARIES ${TEST_LIBS})
|
||||
list(APPEND EXTRA_TESTS inlinekw)
|
||||
|
||||
# Extra compile definitions and extra parameters
|
||||
include(cmake/Modules/CheckCaseSensitiveFileSystem.cmake)
|
||||
set(_testdir ${PROJECT_SOURCE_DIR}/tests/parser/data)
|
||||
|
||||
opm_add_test(LoaderTest
|
||||
SOURCES tests/parser/KeywordLoaderTests.cpp
|
||||
src/opm/parser/eclipse/Generator/KeywordLoader.cpp
|
||||
LIBRARIES ${TEST_LIBS}
|
||||
TEST_ARGS ${_testdir}/parser/keyword-generator/)
|
||||
list(APPEND EXTRA_TESTS LoaderTest)
|
||||
|
||||
opm_add_test(ParserTests
|
||||
SOURCES tests/parser/ParserTests.cpp
|
||||
LIBRARIES ${TEST_LIBS}
|
||||
TEST_ARGS ${_testdir}/)
|
||||
list(APPEND EXTRA_TESTS ParserTests)
|
||||
|
||||
opm_add_test(ParserIncludeTests
|
||||
SOURCES tests/parser/ParserIncludeTests.cpp
|
||||
LIBRARIES ${TEST_LIBS}
|
||||
TEST_ARGS ${_testdir}/parser/)
|
||||
target_compile_definitions(ParserIncludeTests PRIVATE
|
||||
-DHAVE_CASE_SENSITIVE_FILESYSTEM=${HAVE_CASE_SENSITIVE_FILESYSTEM})
|
||||
list(APPEND EXTRA_TESTS ParserIncludeTests)
|
||||
|
||||
opm_add_test(PvtxTableTests
|
||||
SOURCES tests/parser/PvtxTableTests.cpp
|
||||
LIBRARIES ${TEST_LIBS}
|
||||
TEST_ARGS ${_testdir}/integration_tests/)
|
||||
list(APPEND EXTRA_TESTS PvtxTableTests)
|
||||
|
||||
opm_add_test(EclipseStateTests
|
||||
SOURCES tests/parser/EclipseStateTests.cpp
|
||||
LIBRARIES ${TEST_LIBS}
|
||||
TEST_ARGS ${_testdir}/integration_tests/)
|
||||
list(APPEND EXTRA_TESTS EclipseStateTests)
|
||||
|
||||
foreach (test BoxTest
|
||||
CheckDeckValidity
|
||||
EclipseGridCreateFromDeck
|
||||
EDITNNCTests
|
||||
IncludeTest
|
||||
IntegrationTests
|
||||
IOConfigIntegrationTest
|
||||
NNCTests
|
||||
ParseKEYWORD
|
||||
ParseDATAWithDefault
|
||||
Polymer
|
||||
ResinsightTest
|
||||
ScheduleCreateFromDeck
|
||||
TransMultIntegrationTests)
|
||||
|
||||
opm_add_test(${test}
|
||||
SOURCES tests/parser/integration/${test}.cpp
|
||||
LIBRARIES ${TEST_LIBS}
|
||||
TEST_ARGS ${_testdir}/integration_tests/)
|
||||
list(APPEND EXTRA_TESTS ${test})
|
||||
endforeach ()
|
||||
|
||||
# opm-tests dependent tests
|
||||
if(HAVE_OPM_TESTS)
|
||||
opm_add_test(parse_write ONLY_COMPILE
|
||||
SOURCES tests/parser/integration/parse_write.cpp
|
||||
LIBRARIES ${TEST_LIBS})
|
||||
list(APPEND EXTRA_TESTS parse_write)
|
||||
foreach (deck ${OPM_TESTS_ROOT}/norne/NORNE_ATW2013.DATA
|
||||
${OPM_TESTS_ROOT}/spe1_solvent/SPE1CASE2_SOLVENT.DATA
|
||||
${OPM_TESTS_ROOT}/spe9_solvent/SPE9_CP_SOLVENT_CO2.DATA
|
||||
${OPM_TESTS_ROOT}/spe5/SPE5CASE1.DATA
|
||||
${OPM_TESTS_ROOT}/polymer_simple2D/2D_THREEPHASE_POLY_HETER.DATA
|
||||
${OPM_TESTS_ROOT}/spe1/SPE1CASE1.DATA
|
||||
${OPM_TESTS_ROOT}/spe1/SPE1CASE2.DATA
|
||||
${OPM_TESTS_ROOT}/spe1/SPE1CASE2_FAMII.DATA
|
||||
${OPM_TESTS_ROOT}/spe1/SPE1CASE2_SLGOF.DATA
|
||||
${OPM_TESTS_ROOT}/spe3/SPE3CASE1.DATA
|
||||
${OPM_TESTS_ROOT}/spe3/SPE3CASE2.DATA
|
||||
${OPM_TESTS_ROOT}/spe9/SPE9_CP.DATA
|
||||
${OPM_TESTS_ROOT}/spe9/SPE9_CP_GROUP.DATA
|
||||
${OPM_TESTS_ROOT}/spe9/SPE9.DATA
|
||||
${OPM_TESTS_ROOT}/spe10model1/SPE10_MODEL1.DATA
|
||||
${OPM_TESTS_ROOT}/spe10model2/SPE10_MODEL2.DATA
|
||||
${OPM_TESTS_ROOT}/msw_2d_h/2D_H__.DATA )
|
||||
get_filename_component(test_name ${deck} NAME_WE)
|
||||
opm_add_test(${test_name} NO_COMPILE
|
||||
EXE_NAME parse_write
|
||||
TEST_ARGS ${deck})
|
||||
endforeach()
|
||||
set_property(TEST NORNE_ATW2013
|
||||
PROPERTY ENVIRONMENT "OPM_ERRORS_IGNORE=PARSE_RANDOM_SLASH")
|
||||
endif()
|
||||
|
||||
# JSON tests
|
||||
opm_add_test(jsonTests
|
||||
SOURCES tests/json/jsonTests.cpp
|
||||
LIBRARIES ${TEST_LIBS}
|
||||
TEST_ARGS ${PROJECT_SOURCE_DIR}/tests/json/example1.json)
|
||||
list(APPEND EXTRA_TESTS jsonTests)
|
||||
@@ -1,56 +0,0 @@
|
||||
set(genkw_SOURCES src/opm/json/JsonObject.cpp
|
||||
src/opm/parser/eclipse/Parser/createDefaultKeywordList.cpp
|
||||
src/opm/parser/eclipse/Deck/UDAValue.cpp
|
||||
src/opm/parser/eclipse/Deck/Deck.cpp
|
||||
src/opm/parser/eclipse/Deck/DeckItem.cpp
|
||||
src/opm/parser/eclipse/Deck/DeckKeyword.cpp
|
||||
src/opm/parser/eclipse/Deck/DeckRecord.cpp
|
||||
src/opm/parser/eclipse/Deck/DeckOutput.cpp
|
||||
src/opm/parser/eclipse/Generator/KeywordGenerator.cpp
|
||||
src/opm/parser/eclipse/Generator/KeywordLoader.cpp
|
||||
src/opm/parser/eclipse/Parser/ErrorGuard.cpp
|
||||
src/opm/parser/eclipse/Parser/ParseContext.cpp
|
||||
src/opm/parser/eclipse/Parser/ParserEnums.cpp
|
||||
src/opm/parser/eclipse/Parser/ParserItem.cpp
|
||||
src/opm/parser/eclipse/Parser/ParserKeyword.cpp
|
||||
src/opm/parser/eclipse/Parser/ParserRecord.cpp
|
||||
src/opm/parser/eclipse/RawDeck/RawKeyword.cpp
|
||||
src/opm/parser/eclipse/RawDeck/RawRecord.cpp
|
||||
src/opm/parser/eclipse/RawDeck/StarToken.cpp
|
||||
src/opm/parser/eclipse/Units/Dimension.cpp
|
||||
src/opm/parser/eclipse/Units/UnitSystem.cpp
|
||||
src/opm/parser/eclipse/Utility/Stringview.cpp
|
||||
src/opm/common/OpmLog/OpmLog.cpp
|
||||
src/opm/common/OpmLog/Logger.cpp
|
||||
src/opm/common/OpmLog/StreamLog.cpp
|
||||
src/opm/common/OpmLog/LogBackend.cpp
|
||||
src/opm/common/OpmLog/LogUtil.cpp
|
||||
)
|
||||
if(NOT cjson_FOUND)
|
||||
list(APPEND genkw_SOURCES external/cjson/cJSON.c)
|
||||
endif()
|
||||
add_executable(genkw ${genkw_SOURCES})
|
||||
|
||||
target_link_libraries(genkw ecl Boost::regex Boost::filesystem Boost::system)
|
||||
|
||||
# Generate keyword list
|
||||
include(src/opm/parser/eclipse/share/keywords/keyword_list.cmake)
|
||||
string(REGEX REPLACE "([^;]+)" "${PROJECT_SOURCE_DIR}/src/opm/parser/eclipse/share/keywords/\\1" keyword_files "${keywords}")
|
||||
configure_file(src/opm/parser/eclipse/keyword_list.argv.in keyword_list.argv)
|
||||
|
||||
# Generate keyword source
|
||||
add_custom_command(
|
||||
OUTPUT ${PROJECT_BINARY_DIR}/tmp_gen/ParserKeywords.cpp ${PROJECT_BINARY_DIR}/tmp_gen/inlinekw.cpp
|
||||
COMMAND genkw keyword_list.argv
|
||||
${PROJECT_BINARY_DIR}/tmp_gen/ParserKeywords.cpp
|
||||
${PROJECT_BINARY_DIR}/tmp_gen/include/
|
||||
opm/parser/eclipse/Parser/ParserKeywords
|
||||
${PROJECT_BINARY_DIR}/tmp_gen/inlinekw.cpp
|
||||
DEPENDS genkw ${keyword_files} src/opm/parser/eclipse/share/keywords/keyword_list.cmake
|
||||
)
|
||||
|
||||
# To avoid some rebuilds
|
||||
add_custom_command(OUTPUT ParserKeywords.cpp inlinekw.cpp
|
||||
DEPENDS ${PROJECT_BINARY_DIR}/tmp_gen/ParserKeywords.cpp
|
||||
COMMAND ${CMAKE_COMMAND} -DBASE_DIR=${PROJECT_BINARY_DIR}
|
||||
-P ${PROJECT_SOURCE_DIR}/CopyHeaders.cmake)
|
||||
@@ -1,3 +1,3 @@
|
||||
# opm-common
|
||||
# opm-common 
|
||||
Contains common components used throughout all of OPM,
|
||||
in particular CMake modules for the build system.
|
||||
|
||||
45
changelog.md
45
changelog.md
@@ -1,45 +0,0 @@
|
||||
# Changelog
|
||||
|
||||
A short month-by-month synopsis of change highlights. Most bugfixes won't make
|
||||
it in here, only the bigger features and interface changes.
|
||||
|
||||
# 2016.12
|
||||
* ZCORN adjustments improved, considers cell-cell relations
|
||||
* Slightly more robust compilation - won't crash if locales are broken
|
||||
* Accessing the PVTW table has a richer interface
|
||||
* FAULTS face direction accepts X+, I+, Y+, J+, Z+ and K+
|
||||
* WELOPEN can be controlled with completion numbers (last two parameters)
|
||||
* COMPLUMP is now supported
|
||||
* Don't crash on aquifer keywords
|
||||
* GMWSET and FMWSET are expanded properly
|
||||
* Don't crash on DEBUG
|
||||
* Read support for COORDSYS, GRUPRIG, LGR, PRORDER, TRACERS, TUNINGDP,
|
||||
WDFACCOR, WEFAC, and WORKLIM, no longer crashes.
|
||||
* RS and RV support.
|
||||
* Support for DENSITY, PVTW, and ROCK tables
|
||||
* JFUNC is understood and exposed
|
||||
|
||||
# 2016.11
|
||||
* A new class, Runspec, for the RUNSPEC section, has been introduced
|
||||
* Nodes in the FIELD group are no longer added to the Summary config
|
||||
* WCONHIST only adds phases present in the deck
|
||||
* cJSON can now be installed externally
|
||||
* DeckItem and ParserItem internals refactored
|
||||
* Build time reduced by only giving necessary source files to the json compiler
|
||||
* Support for OPERATE, WSEGITER and GCONPROD
|
||||
* Internal shared_ptrs removed from Schedule and children; interface updated
|
||||
* Schedule is now copyable with regular C++ copy semantics - no internal refs
|
||||
* Well head I/J is now time step dependent
|
||||
* Well reference depth is time step dependent
|
||||
* Some ZCORN issues fixed
|
||||
* gas/oil and oil/gas ratio unit fixed for FIELD units
|
||||
|
||||
# 2016.10
|
||||
* Significant improvements in overall parser performance
|
||||
* shared_ptr has largely been removed from all public interfaces
|
||||
* JFUNC keyword can be parsed
|
||||
* Boolean conversions are explicit
|
||||
* The Units.hpp header from core is moved here, replacing ConversionFactors
|
||||
* The ConstPtr and Ptr shared pointer aliases are removed
|
||||
* UnitSystem, Eclipse3DProperties, and OilVaporizationProperties are default
|
||||
constructible
|
||||
@@ -1,49 +0,0 @@
|
||||
# make targets for boost if find module did not do the job
|
||||
|
||||
if(NOT TARGET Boost::system)
|
||||
add_library(Boost::system UNKNOWN IMPORTED)
|
||||
set_target_properties(Boost::system PROPERTIES
|
||||
INTERFACE_INCLUDE_DIRECTORIES "${Boost_INCLUDE_DIRS}"
|
||||
INTERFACE_SYSTEM_INCLUDE_DIRECTORIES "${Boost_INCLUDE_DIRS}"
|
||||
IMPORTED_LOCATION "${Boost_SYSTEM_LIBRARY}"
|
||||
IMPORTED_LOCATION_DEBUG "${Boost_SYSTEM_LIBRARY_DEBUG}"
|
||||
IMPORTED_LOCATION_RELEASE "${Boost_SYSTEM_LIBRARY_RELEASE}"
|
||||
)
|
||||
endif()
|
||||
|
||||
if(NOT TARGET Boost::filesystem)
|
||||
add_library(Boost::filesystem UNKNOWN IMPORTED)
|
||||
set_target_properties(Boost::filesystem PROPERTIES
|
||||
INTERFACE_INCLUDE_DIRECTORIES "${Boost_INCLUDE_DIRS}"
|
||||
INTERFACE_SYSTEM_INCLUDE_DIRECTORIES "${Boost_INCLUDE_DIRS}"
|
||||
INTERFACE_COMPILE_DEFINITIONS BOOST_FILESYSTEM_VERSION=3
|
||||
INTERFACE_LINK_LIBRARIES "${boost_system}"
|
||||
IMPORTED_LOCATION "${Boost_FILESYSTEM_LIBRARY}"
|
||||
IMPORTED_LOCATION_DEBUG "${Boost_FILESYSTEM_LIBRARY_DEBUG}"
|
||||
IMPORTED_LOCATION_RELEASE "${Boost_FILESYSTEM_LIBRARY_RELEASE}"
|
||||
)
|
||||
endif()
|
||||
|
||||
if(NOT TARGET Boost::regex)
|
||||
add_library(Boost::regex UNKNOWN IMPORTED)
|
||||
set_target_properties(Boost::regex PROPERTIES
|
||||
INTERFACE_INCLUDE_DIRECTORIES "${Boost_INCLUDE_DIRS}"
|
||||
INTERFACE_SYSTEM_INCLUDE_DIRECTORIES "${Boost_INCLUDE_DIRS}"
|
||||
INTERFACE_LINK_LIBRARIES "${boost_system}"
|
||||
IMPORTED_LOCATION "${Boost_REGEX_LIBRARY}"
|
||||
IMPORTED_LOCATION_DEBUG "${Boost_REGEX_LIBRARY_DEBUG}"
|
||||
IMPORTED_LOCATION_RELEASE "${Boost_REGEX_LIBRARY_RELEASE}"
|
||||
)
|
||||
endif()
|
||||
|
||||
if(NOT TARGET Boost::unit_test_framework)
|
||||
add_library(Boost::unit_test_framework UNKNOWN IMPORTED)
|
||||
set_target_properties(Boost::unit_test_framework PROPERTIES
|
||||
INTERFACE_INCLUDE_DIRECTORIES "${Boost_INCLUDE_DIRS}"
|
||||
INTERFACE_SYSTEM_INCLUDE_DIRECTORIES "${Boost_INCLUDE_DIRS}"
|
||||
INTERFACE_LINK_LIBRARIES "${boost_system}"
|
||||
IMPORTED_LOCATION "${Boost_UNIT_TEST_FRAMEWORK_LIBRARY}"
|
||||
IMPORTED_LOCATION_DEBUG "${Boost_UNIT_TEST_FRAMEWORK_LIBRARY_DEBUG}"
|
||||
IMPORTED_LOCATION_RELEASE "${Boost_UNIT_TEST_FRAMEWORK_LIBRARY_RELEASE}"
|
||||
)
|
||||
endif()
|
||||
@@ -1,29 +0,0 @@
|
||||
#
|
||||
# Module to check whether the file system is case sensitive or not
|
||||
#
|
||||
# Sets the following variable:
|
||||
#
|
||||
# HAVE_CASE_SENSITIVE_FILESYSTEM True if the file system honors the case of files
|
||||
|
||||
message(STATUS "Checking whether the file system is case-sensitive")
|
||||
# create a file containing uppercase characters
|
||||
file(WRITE "${CMAKE_BINARY_DIR}/UPPER" "Foo")
|
||||
|
||||
# check if the all-lowercase file with the same name can be opened
|
||||
set(FooContents "")
|
||||
if (EXISTS "${CMAKE_BINARY_DIR}/upper")
|
||||
file(READ "${CMAKE_BINARY_DIR}/upper" FooContents)
|
||||
endif()
|
||||
|
||||
# remove the file again in order not to have it dangling around...
|
||||
file(REMOVE "${CMAKE_BINARY_DIR}/UPPER")
|
||||
|
||||
# check the contents of the file opened with lower-case. If it is
|
||||
# empty, the file system is case sensitive.
|
||||
if ("${FooContents}" STREQUAL "Foo")
|
||||
message(STATUS "File system is not case-sensitive")
|
||||
set(HAVE_CASE_SENSITIVE_FILESYSTEM 0)
|
||||
else()
|
||||
message(STATUS "File system is case-sensitive")
|
||||
set(HAVE_CASE_SENSITIVE_FILESYSTEM 1)
|
||||
endif()
|
||||
@@ -78,17 +78,7 @@ function (configure_vars obj syntax filename verb)
|
||||
# write a CMake statements that warns if the value has changed
|
||||
if ("${syntax}" STREQUAL "CMAKE")
|
||||
set (_db "\${") # to avoid parsing problems
|
||||
# special case: if we have a truth variable HAVE_ and this is
|
||||
# either just defined (as is), or set to 1 explicitly, then both
|
||||
# of these count as "true", so put in a check that also accepts
|
||||
# both of these values.
|
||||
if (("${_var}" MATCHES "^HAVE_.*") AND
|
||||
(("${${_var}}" STREQUAL "") OR ("${${_var}}" STREQUAL "1")))
|
||||
set (_cond "(\"${_db}${_var}}\" STREQUAL \"\") OR (\"${_db}${_var}}\" STREQUAL \"1\")")
|
||||
else ()
|
||||
set (_cond "\"${_db}${_var}}\" STREQUAL \"${${_var}}\"")
|
||||
endif ()
|
||||
file (APPEND "${filename}" "if (DEFINED ${_var} AND NOT (${_cond}))\n")
|
||||
file (APPEND "${filename}" "if (DEFINED ${_var} AND NOT \"${_db}${_var}}\" STREQUAL \"${${_var}}\")\n")
|
||||
file (APPEND "${filename}" "\tmessage (WARNING \"Incompatible value \\\"${_db}${_var}}\\\" of variable \\\"${_var}\\\"\")\n")
|
||||
file (APPEND "${filename}" "endif ()\n")
|
||||
endif ()
|
||||
|
||||
47
cmake/Modules/DuneCompat.cmake
Normal file
47
cmake/Modules/DuneCompat.cmake
Normal file
@@ -0,0 +1,47 @@
|
||||
# - Dunecontrol compatibility
|
||||
#
|
||||
# Enables this build to be a part of a dunecontrol chain. The
|
||||
# DUNE_CHECK_MODULES macro greps the top-level Makefile for the
|
||||
# presence of the abs_top_srcdir variable (!) and uses that as
|
||||
# the include directory of a module. Also, the contents are not
|
||||
# checked so if the variable is not present, it generates an
|
||||
# invalid command line (-I without argument) which causes the
|
||||
# autoconf probe to fail. This module patches our Makefile (!!)
|
||||
# so the necessary string will be there; in itself this string
|
||||
# has no use for us, it is solemnly to satisfy the M4 scripts.
|
||||
|
||||
if (CMAKE_GENERATOR MATCHES "Unix Makefiles")
|
||||
# we need an up-to-date, patched Makefile. this is always checked when
|
||||
# the makefile is run, thus the need for a marker file to keep a
|
||||
# timestamp to see when it was last patched (by us)
|
||||
# amazingly, nothing depends on the generated Makefile, so this can be
|
||||
# run whenever in the build without trigging a compile of e.g. config.h
|
||||
add_custom_target (dune-compat ALL
|
||||
COMMAND ${CMAKE_COMMAND} -DCMAKE_HOME_DIRECTORY=${CMAKE_HOME_DIRECTORY} -P ${OPM_MACROS_ROOT}/cmake/Scripts/DuneCompat2.cmake
|
||||
COMMENT "Patching Makefile to be DUNE compatible"
|
||||
)
|
||||
endif (CMAKE_GENERATOR MATCHES "Unix Makefiles")
|
||||
|
||||
# dunecontrol refuses to use a build tree as module directory unless
|
||||
# there is a dune.module in it. however, if we are in a sub-dir. of
|
||||
# the source, we are probably using dunecontrol with a --build-dir
|
||||
# argument, and won't call dunecontrol from the parent (which is the
|
||||
# source dir and most likely doesn't contain other projects) anyway,
|
||||
# i.e. we only copy if we are truly out-of-source
|
||||
string (LENGTH "${PROJECT_SOURCE_DIR}/" _src_dir_len)
|
||||
string (LENGTH "${PROJECT_BINARY_DIR}/" _bin_dir_len)
|
||||
if (_src_dir_len GREATER _bin_dir_len)
|
||||
set (_not_substring TRUE)
|
||||
else (_src_dir_len GREATER _bin_dir_len)
|
||||
string (SUBSTRING "${PROJECT_BINARY_DIR}/" 0 ${_src_dir_len} _proj_prefix)
|
||||
if ("${PROJECT_SOURCE_DIR}/" STREQUAL "${_proj_prefix}")
|
||||
set (_not_substring FALSE)
|
||||
else ("${PROJECT_SOURCE_DIR}/" STREQUAL "${_proj_prefix}")
|
||||
set (_not_substring TRUE)
|
||||
endif ("${PROJECT_SOURCE_DIR}/" STREQUAL "${_proj_prefix}")
|
||||
endif (_src_dir_len GREATER _bin_dir_len)
|
||||
if (_not_substring)
|
||||
execute_process (COMMAND
|
||||
${CMAKE_COMMAND} -E copy_if_different ${PROJECT_SOURCE_DIR}/dune.module ${PROJECT_BINARY_DIR}/dune.module
|
||||
)
|
||||
endif (_not_substring)
|
||||
@@ -1,46 +0,0 @@
|
||||
find_library(ALBERTA_LTDL_LIB
|
||||
NAMES ltdl
|
||||
PATH_SUFFIXES lib lib32 lib64
|
||||
)
|
||||
find_path(ALBERTA_INCLUDE_DIR
|
||||
NAMES alberta/alberta.h
|
||||
PATHS ${ALBERTA_ROOT}
|
||||
PATH_SUFFIXES alberta include NO_DEFAULT_PATH
|
||||
DOC "Include path of Alberta")
|
||||
find_path(ALBERTA_INCLUDE_DIR
|
||||
NAMES
|
||||
alberta/alberta.h
|
||||
PATHS /usr/local /opt
|
||||
PATH_SUFFIXES alberta)
|
||||
#look for libraries
|
||||
find_library(ALBERTA_UTIL_LIB
|
||||
NAMES alberta_util alberta_utilities
|
||||
PATHS ${ALBERTA_ROOT}
|
||||
PATH_SUFFIXES lib lib32 lib64
|
||||
NO_DEFAULT_PATH)
|
||||
find_library(ALBERTA_UTIL_LIB
|
||||
NAMES alberta_util alberta_utilities
|
||||
PATH_SUFFIXES lib lib32 lib64)
|
||||
|
||||
foreach(dim RANGE 1 9)
|
||||
find_library(ALBERTA_${dim}D_LIB alberta_${dim}d
|
||||
PATHS ${ALBERTA_ROOT}
|
||||
PATH_SUFFIXES lib lib32 lib64
|
||||
Cache FILEPATH DOC "Alberta lib for ${dim}D" NO_DEFAULT_PATH)
|
||||
find_library(ALBERTA_${dim}D_LIB alberta_${dim}d PATH_SUFFIXES lib lib32 lib64)
|
||||
if(ALBERTA_${dim}D_LIB)
|
||||
set(ALBERTA_LIBRARIES ${ALBERTA_LIBRARIES} ${ALBERTA_${dim}D_LIB})
|
||||
endif()
|
||||
endforeach(dim RANGE 1 9)
|
||||
|
||||
if(ALBERTA_LIBRARIES AND ALBERTA_INCLUDE_DIR)
|
||||
set(ALBERTA_INCLUDE_DIRS ${ALBERTA_INCLUDE_DIR})
|
||||
set(ALBERTA_LIBRARIES ${ALBERTA_LIBRARIES} ${ALBERTA_UTIL_LIB} ${ALBERTA_LTDL_LIB})
|
||||
set(ALBERTA_FOUND ON)
|
||||
set(Alberta_FOUND ON)
|
||||
set(HAVE_ALBERTA 1)
|
||||
set(DUNE_ALBERTA_VERSION 0x300)
|
||||
else()
|
||||
set(ALBERTA_FOUND OFF)
|
||||
set(Alberta_FOUND OFF)
|
||||
endif()
|
||||
@@ -33,34 +33,23 @@ include(CheckIncludeFileCXX)
|
||||
# macro to only add option once
|
||||
include(AddOptions)
|
||||
|
||||
# Force CXX Standard cross platfrom for CMakeVersion >=3.1
|
||||
set(CMAKE_CXX_EXTENSIONS OFF)
|
||||
|
||||
if(NOT CMAKE_CXX_STANDARD)
|
||||
set(CMAKE_CXX_STANDARD 11)
|
||||
|
||||
|
||||
if(NOT MSVC)
|
||||
foreach(_flag "14" "11")
|
||||
set(_FLAG "CXX_FLAG_CXX${_flag}")
|
||||
string(TOUPPER ${_FLAG} _FLAG)
|
||||
# try to use compiler flag -std=c++${_flag}
|
||||
CHECK_CXX_ACCEPTS_FLAG("-std=c++${_flag}" ${_FLAG})
|
||||
|
||||
if(${_FLAG})
|
||||
if(CMAKE_VERSION VERSION_LESS 3.1)
|
||||
add_options (CXX ALL_BUILDS "-std=c++${_flag}")
|
||||
endif()
|
||||
set(CXX_STD0X_FLAGS "-std=c++${_flag}")
|
||||
#Use vriables for CMake > 3.1 set the standard with no extensions
|
||||
set(CMAKE_CXX_STANDARD ${_flag})
|
||||
break()
|
||||
endif()
|
||||
endforeach()
|
||||
endif(NOT MSVC)
|
||||
endif()
|
||||
|
||||
if(CMAKE_VERSION VERSION_LESS 3.1)
|
||||
if(NOT MSVC)
|
||||
# try to use compiler flag -std=c++11
|
||||
CHECK_CXX_ACCEPTS_FLAG("-std=c++11" CXX_FLAG_CXX11)
|
||||
if(CXX_FLAG_CXX11)
|
||||
add_options (CXX ALL_BUILDS "-std=c++11")
|
||||
set(CXX_STD0X_FLAGS "-std=c++11")
|
||||
else()
|
||||
# try to use compiler flag -std=c++0x for older compilers
|
||||
CHECK_CXX_ACCEPTS_FLAG("-std=c++0x" CXX_FLAG_CXX0X)
|
||||
if(CXX_FLAG_CXX0X)
|
||||
add_options (CXX ALL_BUILDS "-std=c++0x")
|
||||
set(CXX_STD0X_FLAGS "-std=c++0x")
|
||||
endif(CXX_FLAG_CXX0X)
|
||||
endif(CXX_FLAG_CXX11)
|
||||
endif(NOT MSVC)
|
||||
|
||||
# if we are building with an Apple toolchain in MacOS X,
|
||||
# we cannot use the old GCC 4.2 fork, but must use the
|
||||
# new runtime library
|
||||
@@ -69,8 +58,8 @@ if(CMAKE_VERSION VERSION_LESS 3.1)
|
||||
if (APPLE AND (_comp_id MATCHES "CLANG"))
|
||||
CHECK_CXX_ACCEPTS_FLAG ("-stdlib=libc++" CXX_FLAG_STDLIB_LIBCXX)
|
||||
if (CXX_FLAG_STDLIB_LIBCXX)
|
||||
add_options (CXX ALL_BUILDS "-stdlib=libc++")
|
||||
set (CXX_STDLIB_FLAGS "-stdlib=libc++")
|
||||
add_options (CXX ALL_BUILDS "-stdlib=libc++")
|
||||
set (CXX_STDLIB_FLAGS "-stdlib=libc++")
|
||||
endif (CXX_FLAG_STDLIB_LIBCXX)
|
||||
endif (APPLE AND (_comp_id MATCHES "CLANG"))
|
||||
|
||||
@@ -80,9 +69,13 @@ if(CMAKE_VERSION VERSION_LESS 3.1)
|
||||
else (CXX_STD0X_FLAGS AND CXX_STDLIB_FLAGS)
|
||||
set (CXX_SPACE)
|
||||
endif (CXX_STD0X_FLAGS AND CXX_STDLIB_FLAGS)
|
||||
endif()
|
||||
else()
|
||||
if(NOT CMAKE_CXX_STANDARD)
|
||||
set(CMAKE_CXX_STANDARD 11)
|
||||
endif()
|
||||
set(CMAKE_CXX_STANDARD_REQUIRED ON)
|
||||
set(CMAKE_CXX_EXTENSIONS OFF)
|
||||
|
||||
if(NOT CMAKE_VERSION VERSION_LESS 3.1)
|
||||
# Workaround bug in cmake:
|
||||
# cxx standard flags are not applied in CheckCXXSourceCompiles
|
||||
if (CMAKE_CXX_STANDARD EQUAL 14)
|
||||
@@ -92,7 +85,6 @@ if(NOT CMAKE_VERSION VERSION_LESS 3.1)
|
||||
endif()
|
||||
endif()
|
||||
|
||||
|
||||
# perform tests
|
||||
include(CheckCXXSourceCompiles)
|
||||
|
||||
|
||||
@@ -1,11 +0,0 @@
|
||||
# Find clang-check.
|
||||
#
|
||||
# This module defines:
|
||||
# CLANGCHECK_PROGRAM, the clang-check executable.
|
||||
# CLANGHCECK_FOUND, If false, do not try to use cppcheck.
|
||||
#
|
||||
find_program(CLANGCHECK_PROGRAM NAMES clang-check clang-check-3.8)
|
||||
|
||||
find_package_handle_standard_args(ClangCheck DEFAULT_MSG CLANGCHECK_PROGRAM)
|
||||
|
||||
mark_as_advanced(CLANGCHECK_PROGRAM)
|
||||
@@ -1,11 +0,0 @@
|
||||
# Find CppCheck.
|
||||
#
|
||||
# This module defines:
|
||||
# CPPCHECK_PROGRAM, the cppcheck executable.
|
||||
# CPPCHECK_FOUND, If false, do not try to use cppcheck.
|
||||
#
|
||||
find_program(CPPCHECK_PROGRAM NAMES cppcheck)
|
||||
|
||||
find_package_handle_standard_args(CppCheck DEFAULT_MSG CPPCHECK_PROGRAM)
|
||||
|
||||
mark_as_advanced(CPPCHECK_PROGRAM)
|
||||
@@ -33,7 +33,7 @@ endif (ERT_ROOT)
|
||||
find_path (ERT_ECL_INCLUDE_DIR
|
||||
NAMES "ert/ecl/ecl_util.h"
|
||||
HINTS "${ERT_ROOT}"
|
||||
PATHS "${PROJECT_SOURCE_DIR}/../libecl" "${PROJECT_SOURCE_DIR}/../ert"
|
||||
PATHS "${PROJECT_SOURCE_DIR}/../ert"
|
||||
PATH_SUFFIXES "libecl/include/" "include"
|
||||
DOC "Path to ERT Eclipse library header files"
|
||||
${_no_default_path}
|
||||
@@ -41,7 +41,7 @@ find_path (ERT_ECL_INCLUDE_DIR
|
||||
find_path (ERT_ECL_WELL_INCLUDE_DIR
|
||||
NAMES "ert/ecl_well/well_const.h"
|
||||
HINTS "${ERT_ROOT}"
|
||||
PATHS "${PROJECT_SOURCE_DIR}/../libecl" "${PROJECT_SOURCE_DIR}/../ert"
|
||||
PATHS "${PROJECT_SOURCE_DIR}/../ert"
|
||||
PATH_SUFFIXES "libecl_well/include/" "include"
|
||||
DOC "Path to ERT Eclipse library header files"
|
||||
${_no_default_path}
|
||||
@@ -49,7 +49,7 @@ find_path (ERT_ECL_WELL_INCLUDE_DIR
|
||||
find_path (ERT_ECLXX_INCLUDE_DIR
|
||||
NAMES "ert/ecl/EclKW.hpp"
|
||||
HINTS "${ERT_ROOT}"
|
||||
PATHS "${PROJECT_SOURCE_DIR}/../libecl" "${PROJECT_SOURCE_DIR}/../ert"
|
||||
PATHS "${PROJECT_SOURCE_DIR}/../ert"
|
||||
PATH_SUFFIXES "libeclxx/include/" "include"
|
||||
DOC "Path to ERT Eclipse C++ library header files"
|
||||
${_no_default_path}
|
||||
@@ -57,7 +57,7 @@ find_path (ERT_ECLXX_INCLUDE_DIR
|
||||
find_path (ERT_UTIL_INCLUDE_DIR
|
||||
NAMES "ert/util/stringlist.h"
|
||||
HINTS "${ERT_ROOT}"
|
||||
PATHS "${PROJECT_SOURCE_DIR}/../libecl" "${PROJECT_SOURCE_DIR}/../ert"
|
||||
PATHS "${PROJECT_SOURCE_DIR}/../ert"
|
||||
PATH_SUFFIXES "libert_util/include/" "include"
|
||||
DOC "Path to ERT Eclipse library header files"
|
||||
${_no_default_path}
|
||||
@@ -65,7 +65,7 @@ find_path (ERT_UTIL_INCLUDE_DIR
|
||||
find_path (ERT_UTILXX_INCLUDE_DIR
|
||||
NAMES "ert/util/ert_unique_ptr.hpp"
|
||||
HINTS "${ERT_ROOT}"
|
||||
PATHS "${PROJECT_SOURCE_DIR}/../libecl" "${PROJECT_SOURCE_DIR}/../ert"
|
||||
PATHS "${PROJECT_SOURCE_DIR}/../ert"
|
||||
PATH_SUFFIXES "libert_utilxx/include/" "include"
|
||||
DOC "Path to ERT Eclipse C++ library header files"
|
||||
${_no_default_path}
|
||||
@@ -73,7 +73,7 @@ find_path (ERT_UTILXX_INCLUDE_DIR
|
||||
find_path (ERT_GEN_INCLUDE_DIR
|
||||
NAMES "ert/util/int_vector.h"
|
||||
HINTS "${ERT_ROOT}"
|
||||
PATHS "${PROJECT_SOURCE_DIR}/../libecl" "${PROJECT_SOURCE_DIR}/../ert"
|
||||
PATHS "${PROJECT_SOURCE_DIR}/../ert"
|
||||
PATH_SUFFIXES "libert_util/include"
|
||||
"include" "build/libert_util/include" "build/libert_util/include"
|
||||
DOC "Path to ERT generated library header files"
|
||||
@@ -88,10 +88,7 @@ endif (CMAKE_SIZEOF_VOID_P)
|
||||
find_library (ERT_LIBRARY_ECL
|
||||
NAMES "ecl"
|
||||
HINTS "${ERT_ROOT}"
|
||||
PATHS "${PROJECT_BINARY_DIR}/../libecl"
|
||||
"${PROJECT_SOURCE_DIR}/../libecl/build"
|
||||
"${PROJECT_BINARY_DIR}/../libecl-build"
|
||||
"${PROJECT_BINARY_DIR}/../ert"
|
||||
PATHS "${PROJECT_BINARY_DIR}/../ert"
|
||||
"${PROJECT_SOURCE_DIR}/../ert/build"
|
||||
"${PROJECT_BINARY_DIR}/../ert-build"
|
||||
PATH_SUFFIXES "lib" "lib/Release" "lib/Debug" "lib${_BITS}" "lib/${CMAKE_LIBRARY_ARCHITECTURE}"
|
||||
@@ -101,10 +98,7 @@ find_library (ERT_LIBRARY_ECL
|
||||
find_library (ERT_LIBRARY_ECLXX
|
||||
NAMES "eclxx"
|
||||
HINTS "${ERT_ROOT}"
|
||||
PATHS "${PROJECT_BINARY_DIR}/../libecl"
|
||||
"${PROJECT_SOURCE_DIR}/../libecl/build"
|
||||
"${PROJECT_BINARY_DIR}/../libecl-build"
|
||||
"${PROJECT_BINARY_DIR}/../ert"
|
||||
PATHS "${PROJECT_BINARY_DIR}/../ert"
|
||||
"${PROJECT_SOURCE_DIR}/../ert/build"
|
||||
"${PROJECT_BINARY_DIR}/../ert-build"
|
||||
PATH_SUFFIXES "lib" "lib/Release" "lib/Debug" "lib${_BITS}" "lib/${CMAKE_LIBRARY_ARCHITECTURE}"
|
||||
@@ -114,10 +108,7 @@ find_library (ERT_LIBRARY_ECLXX
|
||||
find_library (ERT_LIBRARY_ECL_WELL
|
||||
NAMES "ecl_well"
|
||||
HINTS "${ERT_ROOT}"
|
||||
PATHS "${PROJECT_BINARY_DIR}/../libecl"
|
||||
"${PROJECT_SOURCE_DIR}/../libecl/build"
|
||||
"${PROJECT_BINARY_DIR}/../libecl-build"
|
||||
"${PROJECT_BINARY_DIR}/../ert"
|
||||
PATHS "${PROJECT_BINARY_DIR}/../ert"
|
||||
"${PROJECT_SOURCE_DIR}/../ert/build"
|
||||
"${PROJECT_BINARY_DIR}/../ert-build"
|
||||
PATH_SUFFIXES "lib" "lib/Release" "lib/Debug" "lib${_BITS}" "lib/${CMAKE_LIBRARY_ARCHITECTURE}"
|
||||
@@ -127,10 +118,7 @@ find_library (ERT_LIBRARY_ECL_WELL
|
||||
find_library (ERT_LIBRARY_GEOMETRY
|
||||
NAMES "ert_geometry"
|
||||
HINTS "${ERT_ROOT}"
|
||||
PATHS "${PROJECT_BINARY_DIR}/../libecl"
|
||||
"${PROJECT_SOURCE_DIR}/../libecl/build"
|
||||
"${PROJECT_BINARY_DIR}/../libecl-build"
|
||||
"${PROJECT_BINARY_DIR}/../ert"
|
||||
PATHS "${PROJECT_BINARY_DIR}/../ert"
|
||||
"${PROJECT_SOURCE_DIR}/../ert/build"
|
||||
"${PROJECT_BINARY_DIR}/../ert-build"
|
||||
PATH_SUFFIXES "lib" "lib/Release" "lib/Debug" "lib${_BITS}" "lib/${CMAKE_LIBRARY_ARCHITECTURE}"
|
||||
@@ -140,10 +128,7 @@ find_library (ERT_LIBRARY_GEOMETRY
|
||||
find_library (ERT_LIBRARY_UTIL
|
||||
NAMES "ert_util"
|
||||
HINTS "${ERT_ROOT}"
|
||||
PATHS "${PROJECT_BINARY_DIR}/../libecl"
|
||||
"${PROJECT_SOURCE_DIR}/../libecl/build"
|
||||
"${PROJECT_BINARY_DIR}/../libecl-build"
|
||||
"${PROJECT_BINARY_DIR}/../ert"
|
||||
PATHS "${PROJECT_BINARY_DIR}/../ert"
|
||||
"${PROJECT_SOURCE_DIR}/../ert/build"
|
||||
"${PROJECT_BINARY_DIR}/../ert-build"
|
||||
PATH_SUFFIXES "lib" "lib/Release" "lib/Debug" "lib${_BITS}" "lib/${CMAKE_LIBRARY_ARCHITECTURE}"
|
||||
@@ -153,10 +138,7 @@ find_library (ERT_LIBRARY_UTIL
|
||||
find_library (ERT_LIBRARY_UTILXX
|
||||
NAMES "ert_utilxx"
|
||||
HINTS "${ERT_ROOT}"
|
||||
PATHS "${PROJECT_BINARY_DIR}/../libecl"
|
||||
"${PROJECT_SOURCE_DIR}/../libecl/build"
|
||||
"${PROJECT_BINARY_DIR}/../libecl-build"
|
||||
"${PROJECT_BINARY_DIR}/../ert"
|
||||
PATHS "${PROJECT_BINARY_DIR}/../ert"
|
||||
"${PROJECT_SOURCE_DIR}/../ert/build"
|
||||
"${PROJECT_BINARY_DIR}/../ert-build"
|
||||
PATH_SUFFIXES "lib" "lib/Release" "lib/Debug" "lib${_BITS}" "lib/${CMAKE_LIBRARY_ARCHITECTURE}"
|
||||
@@ -260,10 +242,9 @@ if (NOT (ERT_INCLUDE_DIR MATCHES "-NOTFOUND" OR ERT_LIBRARIES MATCHES "-NOTFOUND
|
||||
set (CMAKE_REQUIRED_INCLUDES ${ERT_INCLUDE_DIR})
|
||||
set (CMAKE_REQUIRED_LIBRARIES ${ERT_LIBRARIES})
|
||||
check_cxx_source_compiles (
|
||||
"#include <ert/ecl/ecl_grid.h>
|
||||
"#include <ert/ecl/EclKW.hpp>
|
||||
int main ( ) {
|
||||
ecl_grid_type * grid = ecl_grid_alloc_rectangular( 10,10,10,1,1,1, NULL);
|
||||
ecl_grid_free( grid );
|
||||
ERT::EclKW< int > kw( ecl_kw_alloc( \"SATNUM\", 0, ECL_INT_TYPE ) );
|
||||
return 0;
|
||||
}" HAVE_ERT)
|
||||
cmake_pop_check_state ()
|
||||
|
||||
@@ -16,11 +16,6 @@
|
||||
|
||||
# find out the size of a pointer. this is required to only search for
|
||||
# libraries in the directories relevant for the architecture
|
||||
|
||||
if(NOT USE_PETSC)
|
||||
return()
|
||||
endif()
|
||||
|
||||
if (CMAKE_SIZEOF_VOID_P)
|
||||
math (EXPR _BITS "8 * ${CMAKE_SIZEOF_VOID_P}")
|
||||
endif (CMAKE_SIZEOF_VOID_P)
|
||||
|
||||
@@ -15,10 +15,6 @@
|
||||
# SUPERLU_LIBRARIES Name to the SuperLU library.
|
||||
#
|
||||
|
||||
if(NOT USE_SUPERLU)
|
||||
return()
|
||||
endif()
|
||||
|
||||
include(CheckIncludeFiles)
|
||||
include(CMakePushCheckState)
|
||||
include(CheckCSourceCompiles)
|
||||
@@ -122,19 +118,6 @@ int main(void)
|
||||
return 0;
|
||||
}"
|
||||
SUPERLU_POST_2005_VERSION)
|
||||
|
||||
# check whether version is at least 5.0
|
||||
CHECK_C_SOURCE_COMPILES("
|
||||
typedef int int_t;
|
||||
#include <supermatrix.h>
|
||||
#include <slu_util.h>
|
||||
int main(void)
|
||||
{
|
||||
GlobalLU_t glu;
|
||||
return 0;
|
||||
}"
|
||||
SUPERLU_MIN_VERSION_5)
|
||||
|
||||
cmake_pop_check_state()
|
||||
|
||||
if(SUPERLU_MIN_VERSION_4_3)
|
||||
@@ -145,17 +128,6 @@ else()
|
||||
"Human readable string containing SuperLU version information.")
|
||||
endif()
|
||||
|
||||
if(SUPERLU_MIN_VERSION_5)
|
||||
include(UseDuneVer)
|
||||
find_dune_version("dune" "istl")
|
||||
set(DUNE_ISTL_VERSION ${DUNE_ISTL_VERSION_MAJOR}.${DUNE_ISTL_VERSION_MINOR}.${DUNE_ISTL_VERSION_REVISION})
|
||||
if(DUNE_ISTL_VERSION VERSION_LESS 2.5)
|
||||
message(STATUS "SuperLU requested, but version found not compatible with dune-istl ${DUNE_ISTL_VERSION}")
|
||||
set(SUPERLU_LIBRARY "")
|
||||
set(SUPERLU_INCLUDE_DIR "")
|
||||
endif()
|
||||
endif()
|
||||
|
||||
# behave like a CMake module is supposed to behave
|
||||
include(FindPackageHandleStandardArgs)
|
||||
find_package_handle_standard_args(
|
||||
@@ -170,13 +142,7 @@ mark_as_advanced(SUPERLU_INCLUDE_DIR SUPERLU_LIBRARY)
|
||||
if(SUPERLU_FOUND)
|
||||
set(SUPERLU_INCLUDE_DIRS ${SUPERLU_INCLUDE_DIR})
|
||||
set(SUPERLU_LIBRARIES ${SUPERLU_LIBRARY})
|
||||
set(SUPERLU_INT_TYPE int)
|
||||
if(SUPERLU_MIN_VERSION_4_3)
|
||||
set(HAVE_SLU_DDEFS_H 1)
|
||||
check_include_files(slu_sdefs.h HAVE_SLU_SDEFS_H)
|
||||
check_include_files(slu_cdefs.h HAVE_SLU_CDEFS_H)
|
||||
check_include_files(slu_zdefs.h HAVE_SLU_ZDEFS_H)
|
||||
endif()
|
||||
|
||||
if (SUPERLU_BLAS_LIBRARY)
|
||||
list(APPEND SUPERLU_LIBRARIES ${SUPERLU_BLAS_LIBRARY})
|
||||
endif()
|
||||
|
||||
37
cmake/Modules/FindTinyXML.cmake
Normal file
37
cmake/Modules/FindTinyXML.cmake
Normal file
@@ -0,0 +1,37 @@
|
||||
# - Find TinyXML library
|
||||
#
|
||||
# Defines the following variables:
|
||||
# TinyXML_INCLUDE_DIRS Directory of header files
|
||||
# TinyXML_LIBRARIES Directory of shared object files
|
||||
# TinyXML_DEFINITIONS Defines that must be set to compile
|
||||
|
||||
# Copyright (C) 2012 Uni Research AS
|
||||
# This code is licensed under The GNU General Public License v3.0
|
||||
|
||||
# use the generic find routine
|
||||
include (OpmPackage)
|
||||
find_opm_package (
|
||||
# module name
|
||||
"TinyXML"
|
||||
|
||||
# dependencies
|
||||
""
|
||||
|
||||
# header to search for
|
||||
"tinyxml.h"
|
||||
|
||||
# library to search for
|
||||
"tinyxml"
|
||||
|
||||
# defines to be added to compilations
|
||||
""
|
||||
|
||||
# test program
|
||||
"#include <tinyxml.h>
|
||||
int main (void) {
|
||||
TiXmlDocument doc;
|
||||
return 0;
|
||||
}
|
||||
"
|
||||
# config variables
|
||||
"")
|
||||
@@ -20,8 +20,8 @@ endif (CJSON_ROOT)
|
||||
find_path (CJSON_INCLUDE_DIR
|
||||
NAMES "cjson/cJSON.h"
|
||||
HINTS "${CJSON_ROOT}"
|
||||
PATHS "${PROJECT_SOURCE_DIR}"
|
||||
PATH_SUFFIXES "include" "external"
|
||||
PATHS "${PROJECT_SOURCE_DIR}" "${PROJECT_SOURCE_DIR}/../opm-parser"
|
||||
PATH_SUFFIXES "include" "opm/json"
|
||||
DOC "Path to cjson library header files"
|
||||
${_no_default_path} )
|
||||
|
||||
|
||||
@@ -25,10 +25,8 @@ find_opm_package (
|
||||
"CXX11Features REQUIRED;
|
||||
dune-common REQUIRED;
|
||||
dune-geometry REQUIRED;
|
||||
dune-uggrid;
|
||||
MPI;
|
||||
UG;
|
||||
Alberta
|
||||
UG
|
||||
"
|
||||
# header to search for
|
||||
"dune/grid/onedgrid.hh"
|
||||
@@ -43,7 +41,7 @@ find_opm_package (
|
||||
"#include <dune/grid/onedgrid.hh>
|
||||
int main (void) {
|
||||
Dune::OneDGrid grid(1, 0., 1.);
|
||||
return grid.size(0);
|
||||
return grid.lbegin<0>(0) == grid.lend<0>(0);
|
||||
}
|
||||
"
|
||||
# config variables
|
||||
@@ -56,8 +54,7 @@ int main (void) {
|
||||
HAVE_AMIRAMESH;
|
||||
HAVE_ALBERTA;
|
||||
HAVE_STDINT_H;
|
||||
DUNE_GRID_EXPERIMENTAL_GRID_EXTENSIONS;
|
||||
DUNE_ALBERTA_VERSION
|
||||
DUNE_GRID_EXPERIMENTAL_GRID_EXTENSIONS
|
||||
")
|
||||
|
||||
#debug_find_vars ("dune-grid")
|
||||
|
||||
@@ -52,14 +52,7 @@ int main (void) {
|
||||
HAVE_PARMETIS;
|
||||
HAVE_SUPERLU;
|
||||
HAVE_UMFPACK;
|
||||
HAVE_SUITESPARSE_UMFPACK;
|
||||
SUPERLU_INT_TYPE;
|
||||
HAVE_SLU_CDEFS_H;
|
||||
HAVE_SLU_DDEFS_H;
|
||||
HAVE_SLU_SDEFS_H;
|
||||
HAVE_SLU_ZDEFS_H;
|
||||
SUPERLU_MIN_VERSION_4_3;
|
||||
SUPERLU_MIN_VERSION_5;
|
||||
SUPERLU_POST_2005_VERSION
|
||||
")
|
||||
#debug_find_vars ("dune-istl")
|
||||
|
||||
@@ -1,34 +0,0 @@
|
||||
include (OpmPackage)
|
||||
|
||||
find_opm_package (
|
||||
# module name
|
||||
"dune-uggrid"
|
||||
|
||||
# dependencies
|
||||
# TODO: we should probe for all the HAVE_* values listed below;
|
||||
# however, we don't actually use them in our implementation, so
|
||||
"CXX11Features REQUIRED;
|
||||
dune-common REQUIRED
|
||||
"
|
||||
# header to search for
|
||||
""
|
||||
|
||||
# library to search for
|
||||
"duneuggrid"
|
||||
|
||||
# defines to be added to compilations
|
||||
""
|
||||
|
||||
# test program
|
||||
""
|
||||
# config variable
|
||||
"")
|
||||
|
||||
#debug_find_vars ("dune-uggrid")
|
||||
|
||||
# make version number available in config.h
|
||||
include (UseDuneVer)
|
||||
find_dune_version ("dune" "uggrid")
|
||||
|
||||
# deactivate search for UG
|
||||
set(UG_FOUND ${dune-uggrid_FOUND})
|
||||
42
cmake/Modules/Findewoms.cmake
Normal file
42
cmake/Modules/Findewoms.cmake
Normal file
@@ -0,0 +1,42 @@
|
||||
# - Find OPM eWoms module
|
||||
#
|
||||
# Defines the following variables:
|
||||
# ewoms_INCLUDE_DIRS Directory of header files
|
||||
# ewoms_LIBRARIES Directory of shared object files
|
||||
# ewoms_DEFINITIONS Defines that must be set to compile
|
||||
# ewoms_CONFIG_VARS List of defines that should be in config.h
|
||||
# HAVE_EWOMS Binary value to use in config.h
|
||||
|
||||
# Copyright (C) 2012 Uni Research AS
|
||||
# This code is licensed under The GNU General Public License v3.0
|
||||
|
||||
# use the generic find routine
|
||||
include (ewoms-prereqs)
|
||||
include (OpmPackage)
|
||||
find_opm_package (
|
||||
# module name
|
||||
"ewoms"
|
||||
|
||||
# dependencies
|
||||
"${ewoms_DEPS}"
|
||||
|
||||
# header to search for
|
||||
"ewoms/common/start.hh"
|
||||
|
||||
# library to search for
|
||||
""
|
||||
|
||||
# defines to be added to compilations
|
||||
""
|
||||
|
||||
# test program
|
||||
"#include <ewoms/common/start.hh>
|
||||
int main (void) {
|
||||
return 0;
|
||||
}
|
||||
"
|
||||
# config variables
|
||||
"${ewoms_CONFIG_VAR}"
|
||||
)
|
||||
#include (UseDynamicBoost)
|
||||
#debug_find_vars ("ewoms")
|
||||
43
cmake/Modules/Findopm-common.cmake
Normal file
43
cmake/Modules/Findopm-common.cmake
Normal file
@@ -0,0 +1,43 @@
|
||||
# - Find the opm-common module
|
||||
#
|
||||
# Defines the following variables:
|
||||
# opm-common_INCLUDE_DIRS Directory of header files
|
||||
# opm-common_LIBRARIES Directory of shared object files
|
||||
# opm-common_DEFINITIONS Defines that must be set to compile
|
||||
# opm-common_CONFIG_VARS List of defines that should be in config.h
|
||||
# HAVE_OPM_COMMON Binary value to use in config.h
|
||||
|
||||
# Copyright (C) 2013 Uni Research AS
|
||||
# This code is licensed under The GNU General Public License v3.0
|
||||
|
||||
# use the generic find routine
|
||||
include (opm-common-prereqs)
|
||||
include (OpmPackage)
|
||||
find_opm_package (
|
||||
# module name
|
||||
"opm-common"
|
||||
|
||||
# dependencies
|
||||
"${opm-common_DEPS}"
|
||||
|
||||
# header to search for
|
||||
"opm/common/utility/platform_dependent/disable_warnings.h"
|
||||
|
||||
# library to search for
|
||||
"opmcommon"
|
||||
|
||||
# defines to be added to compilations
|
||||
""
|
||||
|
||||
# test program
|
||||
"#include <opm/common/utility/platform_dependent/disable_warnings.h>
|
||||
int main (void) {
|
||||
return 0;
|
||||
}
|
||||
"
|
||||
|
||||
# config variables
|
||||
"${opm-common_CONFIG_VAR}"
|
||||
)
|
||||
include (UseDynamicBoost)
|
||||
#debug_find_vars ("opm-common")
|
||||
45
cmake/Modules/Findopm-core.cmake
Normal file
45
cmake/Modules/Findopm-core.cmake
Normal file
@@ -0,0 +1,45 @@
|
||||
# - Find OPM core library
|
||||
#
|
||||
# Defines the following variables:
|
||||
# opm-core_INCLUDE_DIRS Directory of header files
|
||||
# opm-core_LIBRARIES Directory of shared object files
|
||||
# opm-core_DEFINITIONS Defines that must be set to compile
|
||||
# opm-core_CONFIG_VARS List of defines that should be in config.h
|
||||
# HAVE_OPM_CORE Binary value to use in config.h
|
||||
|
||||
# Copyright (C) 2012 Uni Research AS
|
||||
# This code is licensed under The GNU General Public License v3.0
|
||||
|
||||
# use the generic find routine
|
||||
include (opm-core-prereqs)
|
||||
include (OpmPackage)
|
||||
find_opm_package (
|
||||
# module name
|
||||
"opm-core"
|
||||
|
||||
# dependencies
|
||||
"${opm-core_DEPS}"
|
||||
|
||||
# header to search for
|
||||
"opm/core/grid.h"
|
||||
|
||||
# library to search for
|
||||
"opmcore"
|
||||
|
||||
# defines to be added to compilations
|
||||
""
|
||||
|
||||
# test program
|
||||
"#include <opm/core/grid.h>
|
||||
int main (void) {
|
||||
struct UnstructuredGrid *g;
|
||||
g = create_grid_empty ();
|
||||
destroy_grid (g);
|
||||
return 0;
|
||||
}
|
||||
"
|
||||
# config variables
|
||||
"${opm-core_CONFIG_VAR}"
|
||||
)
|
||||
include (UseDynamicBoost)
|
||||
#debug_find_vars ("opm-core")
|
||||
24
cmake/Modules/Findopm-data.cmake
Normal file
24
cmake/Modules/Findopm-data.cmake
Normal file
@@ -0,0 +1,24 @@
|
||||
# This module searches for the opm-data repository. Since the opm-data
|
||||
# has no libraries or header files the find implementation is quite
|
||||
# naive.
|
||||
#
|
||||
# If the opm-data repository is found, the following variables are set:
|
||||
#
|
||||
# HAVE_OPM_DATA
|
||||
# OPM_DATA_ROOT
|
||||
|
||||
if (OPM_DATA_ROOT)
|
||||
set( _opm_data_root ${OPM_DATA_ROOT})
|
||||
else()
|
||||
set( _opm_data_root "${PROJECT_SOURCE_DIR}/../opm-data")
|
||||
endif()
|
||||
|
||||
|
||||
if (EXISTS "${_opm_data_root}/norne/NORNE_ATW2013.DATA")
|
||||
set( HAVE_OPM_DATA True )
|
||||
set( OPM_DATA_ROOT ${_opm_data_root} )
|
||||
message( "-- Setting OPM_DATA_ROOT: ${OPM_DATA_ROOT}")
|
||||
else()
|
||||
set( HAVE_OPM_DATA False )
|
||||
message( "opm-data not found - integration tests using opm-data will be skipped.")
|
||||
endif()
|
||||
42
cmake/Modules/Findopm-grid.cmake
Normal file
42
cmake/Modules/Findopm-grid.cmake
Normal file
@@ -0,0 +1,42 @@
|
||||
# - Find OPM corner-point grid library
|
||||
#
|
||||
# Defines the following variables:
|
||||
# opm-grid_INCLUDE_DIRS Directory of header files
|
||||
# opm-grid_LIBRARIES Directory of shared object files
|
||||
# opm-grid_DEFINITIONS Defines that must be set to compile
|
||||
# opm-grid_CONFIG_VARS List of defines that should be in config.h
|
||||
# HAVE_OPM_GRID Binary value to use in config.h
|
||||
|
||||
# Copyright (C) 2013 Uni Research AS
|
||||
# This code is licensed under The GNU General Public License v3.0
|
||||
|
||||
include (opm-grid-prereqs)
|
||||
include (OpmPackage)
|
||||
find_opm_package (
|
||||
# module name
|
||||
"opm-grid"
|
||||
|
||||
# dependencies
|
||||
"${opm-grid_DEPS}"
|
||||
|
||||
# header to search for
|
||||
"dune/grid/CpGrid.hpp"
|
||||
|
||||
# library to search for
|
||||
"opmgrid"
|
||||
|
||||
# defines to be added to compilations
|
||||
"HAVE_OPM_GRID"
|
||||
|
||||
# test program
|
||||
"#include <dune/grid/CpGrid.hpp>
|
||||
int main (void) {
|
||||
Dune::CpGrid g;
|
||||
return 0;
|
||||
}
|
||||
"
|
||||
# config variables
|
||||
"${opm-grid_CONFIG_VAR}"
|
||||
)
|
||||
|
||||
#debug_find_vars ("opm-grid")
|
||||
43
cmake/Modules/Findopm-material.cmake
Normal file
43
cmake/Modules/Findopm-material.cmake
Normal file
@@ -0,0 +1,43 @@
|
||||
# - Find OPM materials library
|
||||
#
|
||||
# Defines the following variables:
|
||||
# opm-material_INCLUDE_DIRS Directory of header files
|
||||
# opm-material_LIBRARIES Directory of shared object files
|
||||
# opm-material_DEFINITIONS Defines that must be set to compile
|
||||
# opm-material_CONFIG_VARS List of defines that should be in config.h
|
||||
# HAVE_OPM_MATERIAL Binary value to use in config.h
|
||||
|
||||
# Copyright (C) 2013 Uni Research AS
|
||||
# This code is licensed under The GNU General Public License v3.0
|
||||
|
||||
# use the generic find routine
|
||||
include (opm-material-prereqs)
|
||||
include (OpmPackage)
|
||||
find_opm_package (
|
||||
# module name
|
||||
"opm-material"
|
||||
|
||||
# dependencies
|
||||
"${opm-material_DEPS}"
|
||||
|
||||
# header to search for
|
||||
"opm/material/Constants.hpp"
|
||||
|
||||
# library to search for
|
||||
""
|
||||
|
||||
# defines to be added to compilations
|
||||
""
|
||||
|
||||
# test program
|
||||
"#include <opm/material/Constants.hpp>
|
||||
int main (void) {
|
||||
double c = Opm::Constants<double>::c;
|
||||
return 0;
|
||||
}
|
||||
"
|
||||
# config variables
|
||||
"${opm-material_CONFIG_VAR}"
|
||||
)
|
||||
include (UseDynamicBoost)
|
||||
#debug_find_vars ("opm-material")
|
||||
55
cmake/Modules/Findopm-output.cmake
Normal file
55
cmake/Modules/Findopm-output.cmake
Normal file
@@ -0,0 +1,55 @@
|
||||
# - Find OPM output library
|
||||
#
|
||||
# Defines the following variables:
|
||||
# opm-output_INCLUDE_DIRS Directory of header files
|
||||
# opm-output_LIBRARIES Directory of shared object files
|
||||
# opm-output_DEFINITIONS Defines that must be set to compile
|
||||
# opm-output_CONFIG_VARS List of defines that should be in config.h
|
||||
# HAVE_OPM_OUTPUT Binary value to use in config.h
|
||||
|
||||
# Copyright (C) 2012 Uni Research AS
|
||||
# This code is licensed under The GNU General Public License v3.0
|
||||
|
||||
# use the generic find routine
|
||||
include (opm-output-prereqs)
|
||||
include (OpmPackage)
|
||||
find_opm_package (
|
||||
# module name
|
||||
"opm-output"
|
||||
|
||||
# dependencies
|
||||
"${opm-output_DEPS}"
|
||||
|
||||
# header to search for
|
||||
"opm/output/OutputWriter.hpp"
|
||||
|
||||
# library to search for
|
||||
"opmoutput"
|
||||
|
||||
# defines to be added to compilations
|
||||
""
|
||||
|
||||
# test program
|
||||
"#include <opm/output/eclipse/Summary.hpp>
|
||||
int main (void) {
|
||||
return 0;
|
||||
}
|
||||
"
|
||||
# config variables
|
||||
"${opm-output_CONFIG_VAR}"
|
||||
)
|
||||
include (UseDynamicBoost)
|
||||
#debug_find_vars ("opm-output")
|
||||
|
||||
|
||||
if(OPM_OUTPUT_FOUND)
|
||||
get_filename_component(opm-output_PREFIX_DIR ${opm-output_LIBRARY} PATH)
|
||||
find_program(COMPARE_SUMMARY_COMMAND compareSummary
|
||||
PATHS ${opm-output_PREFIX_DIR}/../bin
|
||||
${opm-output_PREFIX_DIR}/../../bin)
|
||||
find_program(COMPARE_ECL_COMMAND compareECL
|
||||
PATHS ${opm-output_PREFIX_DIR}/../bin
|
||||
${opm-output_PREFIX_DIR}/../../bin)
|
||||
|
||||
endif()
|
||||
|
||||
169
cmake/Modules/Findopm-parser.cmake
Normal file
169
cmake/Modules/Findopm-parser.cmake
Normal file
@@ -0,0 +1,169 @@
|
||||
# Find the OPM Eclipse input parser.
|
||||
#
|
||||
# Set the cache variable OPM_PARSER_ROOT to the install location of the
|
||||
# library, or OPM_ROOT to the parent directory of the build tree.
|
||||
#
|
||||
# If found, it sets these variables:
|
||||
#
|
||||
# HAVE_OPM_PARSER Defined if a test program compiled
|
||||
# OPM_PARSER_INCLUDE_DIRS Header file directories
|
||||
# OPM_PARSER_LIBRARIES Archives and shared objects
|
||||
|
||||
include (FindPackageHandleStandardArgs)
|
||||
|
||||
# variables to pass on to other packages
|
||||
if (FIND_QUIETLY)
|
||||
set (OPM_PARSER_QUIET "QUIET")
|
||||
else ()
|
||||
set (OPM_PARSER_QUIET "")
|
||||
endif ()
|
||||
|
||||
# use lowercase versions of the variables if those are set
|
||||
if (opm-parser_ROOT)
|
||||
set (OPM_PARSER_ROOT ${opm-parser_ROOT})
|
||||
endif ()
|
||||
if (opm_ROOT)
|
||||
set (OPM_ROOT ${opm_ROOT})
|
||||
endif ()
|
||||
|
||||
# inherit "suite" root if not specifically set for this library
|
||||
if ((NOT OPM_PARSER_ROOT) AND OPM_ROOT)
|
||||
set (OPM_PARSER_ROOT "${OPM_ROOT}/opm-parser")
|
||||
endif ()
|
||||
|
||||
# Detect the build dir suffix or subdirectory
|
||||
string(REGEX REPLACE "${PROJECT_SOURCE_DIR}/?(.*)" "\\1" BUILD_DIR_SUFFIX "${PROJECT_BINARY_DIR}")
|
||||
|
||||
# if a root is specified, then don't search in system directories
|
||||
# or in relative directories to this one
|
||||
if (OPM_PARSER_ROOT)
|
||||
set (_no_default_path "NO_DEFAULT_PATH")
|
||||
set (_opm_parser_source "")
|
||||
set (_opm_parser_build "")
|
||||
else ()
|
||||
set (_no_default_path "")
|
||||
set (_opm_parser_source
|
||||
"${PROJECT_SOURCE_DIR}/../opm-parser")
|
||||
set (_opm_parser_build
|
||||
"${PROJECT_BINARY_DIR}/../opm-parser"
|
||||
"${PROJECT_BINARY_DIR}/../opm-parser${BUILD_DIR_SUFFIX}"
|
||||
"${PROJECT_BINARY_DIR}/../../opm-parser/${BUILD_DIR_SUFFIX}")
|
||||
endif ()
|
||||
|
||||
# use this header as signature
|
||||
find_path (OPM_PARSER_INCLUDE_DIR
|
||||
NAMES "opm/parser/eclipse/Parser/Parser.hpp"
|
||||
HINTS "${OPM_PARSER_ROOT}"
|
||||
PATHS ${_opm_parser_source}
|
||||
PATH_SUFFIXES "include"
|
||||
DOC "Path to OPM parser header files"
|
||||
${_no_default_path} )
|
||||
|
||||
find_path (OPM_PARSER_GEN_INCLUDE_DIR
|
||||
NAMES "opm/parser/eclipse/Parser/ParserKeywords.hpp"
|
||||
HINTS "${OPM_PARSER_ROOT}"
|
||||
PATHS ${_opm_parser_build}
|
||||
PATH_SUFFIXES "generated-source/include" "include"
|
||||
DOC "Path to OPM parser generated header files"
|
||||
${_no_default_path} )
|
||||
|
||||
|
||||
# backup: if we didn't find any headers there, but a CMakeCache.txt,
|
||||
# then it is probably a build directory; read the CMake cache of
|
||||
# opm-parser to figure out where the source directory is
|
||||
if ((NOT OPM_PARSER_INCLUDE_DIR) AND
|
||||
(OPM_PARSER_ROOT AND (EXISTS "${OPM_PARSER_ROOT}/CMakeCache.txt")))
|
||||
set (_regex "^OPMParser_SOURCE_DIR:STATIC=\(.*\)$")
|
||||
file (STRINGS
|
||||
"${OPM_PARSER_ROOT}/CMakeCache.txt"
|
||||
_cache_entry
|
||||
REGEX "${_regex}")
|
||||
string(REGEX REPLACE "${_regex}" "\\1"
|
||||
OPM_PARSER_INCLUDE_DIR
|
||||
"${_cache_entry}")
|
||||
if (OPM_PARSER_INCLUDE_DIR)
|
||||
set (OPM_PARSER_INCLUDE_DIR "${OPM_PARSER_INCLUDE_DIR}"
|
||||
CACHE PATH "Path to OPM parser header files" FORCE)
|
||||
endif ()
|
||||
endif ()
|
||||
|
||||
# find out the size of a pointer. this is required to only search for
|
||||
# libraries in the directories relevant for the architecture
|
||||
if (CMAKE_SIZEOF_VOID_P)
|
||||
math (EXPR _BITS "8 * ${CMAKE_SIZEOF_VOID_P}")
|
||||
endif ()
|
||||
|
||||
# these libraries constitute the parser core
|
||||
find_library (OPM_PARSER_LIBRARY
|
||||
NAMES "opmparser"
|
||||
HINTS "${OPM_PARSER_ROOT}"
|
||||
PATHS ${_opm_parser_build}
|
||||
PATH_SUFFIXES "lib" "lib${_BITS}" "lib/${CMAKE_LIBRARY_ARCHITECTURE}"
|
||||
"opm/parser/eclipse"
|
||||
DOC "Path to OPM parser library archive/shared object files"
|
||||
${_no_default_path} )
|
||||
|
||||
# find the OPM-parser wrapper library around cJSON
|
||||
find_library (OPM_JSON_LIBRARY
|
||||
NAMES "opmjson"
|
||||
HINTS "${OPM_PARSER_ROOT}"
|
||||
PATHS ${_opm_parser_build}
|
||||
PATH_SUFFIXES "lib" "lib${_BITS}" "lib/${CMAKE_LIBRARY_ARCHITECTURE}"
|
||||
"opm/json"
|
||||
DOC "Path to OPM JSON library archive/shared object files"
|
||||
${_no_default_path} )
|
||||
|
||||
# get the prerequisite ERT libraries
|
||||
if (NOT ERT_FOUND)
|
||||
find_package(ERT ${OPM_PARSER_QUIET})
|
||||
endif ()
|
||||
|
||||
# get the prerequisite Boost libraries
|
||||
find_package(Boost 1.44.0 COMPONENTS filesystem date_time system unit_test_framework regex ${OPM_PARSER_QUIET})
|
||||
|
||||
if (ERT_FOUND AND Boost_FOUND AND
|
||||
OPM_PARSER_LIBRARY AND OPM_JSON_LIBRARY AND OPM_PARSER_INCLUDE_DIR)
|
||||
# setup list of all required libraries to link with opm-parser. notice that
|
||||
# we use the plural form to get *all* the libraries needed by cjson
|
||||
set (opm-parser_INCLUDE_DIRS
|
||||
${OPM_PARSER_INCLUDE_DIR}
|
||||
${OPM_PARSER_GEN_INCLUDE_DIR}
|
||||
${Boost_INCLUDE_DIRS}
|
||||
${ERT_INCLUDE_DIRS})
|
||||
|
||||
set (opm-parser_LIBRARIES
|
||||
${OPM_PARSER_LIBRARY}
|
||||
${OPM_JSON_LIBRARY}
|
||||
${Boost_LIBRARIES}
|
||||
${ERT_LIBRARIES})
|
||||
|
||||
# see if we can compile a minimum example
|
||||
# CMake logical test doesn't handle lists (sic)
|
||||
include (CMakePushCheckState)
|
||||
include (CheckCSourceCompiles)
|
||||
cmake_push_check_state ()
|
||||
set (CMAKE_REQUIRED_INCLUDES ${opm-parser_INCLUDE_DIRS})
|
||||
set (CMAKE_REQUIRED_LIBRARIES ${opm-parser_LIBRARIES})
|
||||
|
||||
check_cxx_source_compiles (
|
||||
"#include <cstdlib>
|
||||
#include <opm/parser/eclipse/Deck/Deck.hpp>
|
||||
|
||||
int main (void) {
|
||||
return EXIT_SUCCESS;
|
||||
}" HAVE_OPM_PARSER)
|
||||
cmake_pop_check_state ()
|
||||
endif()
|
||||
|
||||
# if the test program didn't compile, but was required to do so, bail
|
||||
# out now and display an error; otherwise limp on
|
||||
set (OPM_PARSER_FIND_REQUIRED ${opm-parser_FIND_REQUIRED})
|
||||
find_package_handle_standard_args (opm-parser
|
||||
DEFAULT_MSG
|
||||
opm-parser_INCLUDE_DIRS opm-parser_LIBRARIES HAVE_OPM_PARSER
|
||||
)
|
||||
|
||||
set (opm-parser_CONFIG_VARS "HAVE_OPM_PARSER;HAVE_REGEX")
|
||||
set (opm-parser_FOUND ${OPM-PARSER_FOUND})
|
||||
|
||||
mark_as_advanced(opm-parser_LIBRARIES opm-parser_INCLUDE_DIRS OPM-PARSER_FOUND)
|
||||
44
cmake/Modules/Findopm-simulators.cmake
Normal file
44
cmake/Modules/Findopm-simulators.cmake
Normal file
@@ -0,0 +1,44 @@
|
||||
# - Find OPM automatic differentiation library
|
||||
#
|
||||
# Defines the following variables:
|
||||
# opm-simulators_INCLUDE_DIRS Directory of header files
|
||||
# opm-simulators_LIBRARIES Directory of shared object files
|
||||
# opm-simulators_DEFINITIONS Defines that must be set to compile
|
||||
# opm-simulators_CONFIG_VARS List of defines that should be in config.h
|
||||
# HAVE_OPM_SIMULATORS Binary value to use in config.h
|
||||
|
||||
# Copyright (C) 2012 Uni Research AS
|
||||
# This code is licensed under The GNU General Public License v3.0
|
||||
|
||||
# use the generic find routine
|
||||
include (opm-simulators-prereqs)
|
||||
include (OpmPackage)
|
||||
find_opm_package (
|
||||
# module name
|
||||
"opm-simulators"
|
||||
|
||||
# dependencies
|
||||
"${opm-simulators_DEPS}"
|
||||
|
||||
# header to search for
|
||||
"opm/autodiff/AutoDiff.hpp"
|
||||
|
||||
# library to search for
|
||||
"opmsimulators"
|
||||
|
||||
# defines to be added to compilations
|
||||
""
|
||||
|
||||
# test program
|
||||
"#include <opm/autodiff/AutoDiff.hpp>
|
||||
int main (void) {
|
||||
Opm::AutoDiff<double> x = Opm::AutoDiff<double>::constant(42.);
|
||||
(void) x;
|
||||
return 0;
|
||||
}
|
||||
"
|
||||
# config variables
|
||||
"${opm-simulators_CONFIG_VAR}"
|
||||
)
|
||||
include (UseDynamicBoost)
|
||||
#debug_find_vars ("opm-simulators")
|
||||
@@ -1,27 +0,0 @@
|
||||
# This module searches for the opm-tests repository. Since opm-tests
|
||||
# has no libraries or header files the find implementation is quite
|
||||
# naive.
|
||||
#
|
||||
# If the opm-tests repository is found, the following variables are set:
|
||||
#
|
||||
# HAVE_OPM_TESTS
|
||||
# OPM_TESTS_ROOT
|
||||
|
||||
if (OPM_TESTS_ROOT)
|
||||
set( _opm_tests_root ${OPM_TESTS_ROOT})
|
||||
else()
|
||||
set( _opm_tests_root "${PROJECT_SOURCE_DIR}/../opm-tests")
|
||||
endif()
|
||||
|
||||
|
||||
if (EXISTS "${_opm_tests_root}/norne/NORNE_ATW2013.DATA")
|
||||
set( HAVE_OPM_DATA True )
|
||||
set( HAVE_OPM_TESTS True )
|
||||
set( OPM_TESTS_ROOT ${_opm_tests_root} )
|
||||
set( OPM_DATA_ROOT ${_opm_tests_root} )
|
||||
message(STATUS "Setting OPM_TESTS_ROOT: ${OPM_TESTS_ROOT}")
|
||||
else()
|
||||
set( HAVE_OPM_TESTS False )
|
||||
set( HAVE_OPM_DATA False )
|
||||
message(WARNING "opm-tests not found - integration tests using opm-tests will be skipped.")
|
||||
endif()
|
||||
@@ -123,7 +123,7 @@ function (configure_la name target)
|
||||
mark_as_advanced (libtool_MAIN)
|
||||
# notify the user if it not found after we explicitly searched
|
||||
if (NOT libtool_MAIN)
|
||||
message (STATUS "Not generating libtool archive (.la) since libtool was not found")
|
||||
message (STATUS "Libtool not found!")
|
||||
endif (NOT libtool_MAIN)
|
||||
endif (NOT libtool_MAIN)
|
||||
if (libtool_MAIN)
|
||||
|
||||
@@ -9,7 +9,6 @@ function (set_aliases)
|
||||
# are separated by space
|
||||
set (aliases
|
||||
"HAVE_UMFPACK HAVE_SUITESPARSE_UMFPACK_H"
|
||||
"HAVE_SUITESPARSE_UMFPACK HAVE_SUITESPARSE_UMFPACK_H"
|
||||
"HAVE_DUNE_BOOST HAVE_BOOST"
|
||||
)
|
||||
foreach (alias IN LISTS aliases)
|
||||
|
||||
@@ -1,6 +0,0 @@
|
||||
# Installs bash tab completion for a product
|
||||
macro(opm_add_bash_completion binary)
|
||||
set(PRODUCT ${binary})
|
||||
configure_file(${OPM_MACROS_ROOT}/etc/opm_bash_completion.sh.in ${binary}_bash_completion.sh @ONLY)
|
||||
install(FILES ${PROJECT_BINARY_DIR}/${binary}_bash_completion.sh DESTINATION ${CMAKE_INSTALL_SYSCONFDIR}/bash_completion.d)
|
||||
endmacro()
|
||||
@@ -13,53 +13,28 @@ macro (opm_compile opm)
|
||||
# all public header files are together with the source. prepend our own
|
||||
# source path to the one of the dependencies so that our version of any
|
||||
# ambigious paths are used.
|
||||
|
||||
option(SILENCE_CROSSMODULE_WARNINGS "Disable warnings from cross-module includes" OFF)
|
||||
if (SILENCE_CROSSMODULE_WARNINGS)
|
||||
include_directories("${PROJECT_SOURCE_DIR}")
|
||||
include_directories (SYSTEM ${${opm}_INCLUDE_DIRS})
|
||||
set (${opm}_INCLUDE_DIR "${PROJECT_SOURCE_DIR}")
|
||||
set (${opm}_INCLUDE_DIRS ${${opm}_INCLUDE_DIR} ${${opm}_INCLUDE_DIRS})
|
||||
else()
|
||||
set (${opm}_INCLUDE_DIR "${PROJECT_SOURCE_DIR}")
|
||||
set (${opm}_INCLUDE_DIRS ${${opm}_INCLUDE_DIR} ${${opm}_INCLUDE_DIRS})
|
||||
include_directories (${${opm}_INCLUDE_DIRS})
|
||||
endif()
|
||||
|
||||
set (${opm}_INCLUDE_DIR "${PROJECT_SOURCE_DIR}")
|
||||
set (${opm}_INCLUDE_DIRS ${${opm}_INCLUDE_DIR} ${${opm}_INCLUDE_DIRS})
|
||||
|
||||
# create this library, if there are any compilation units
|
||||
include_directories (${${opm}_INCLUDE_DIRS})
|
||||
link_directories (${${opm}_LIBRARY_DIRS})
|
||||
add_definitions (${${opm}_DEFINITIONS})
|
||||
set (${opm}_VERSION "${${opm}_VERSION_MAJOR}.${${opm}_VERSION_MINOR}")
|
||||
if (${opm}_SOURCES)
|
||||
add_library (${${opm}_TARGET} ${${opm}_LIBRARY_TYPE} ${${opm}_SOURCES})
|
||||
set_target_properties (${${opm}_TARGET} PROPERTIES
|
||||
SOVERSION ${${opm}_VERSION_MAJOR}
|
||||
VERSION ${${opm}_VERSION}
|
||||
LINK_FLAGS "${${opm}_LINKER_FLAGS_STR}"
|
||||
add_library (${${opm}_TARGET} ${${opm}_LIBRARY_TYPE} ${${opm}_SOURCES})
|
||||
set_target_properties (${${opm}_TARGET} PROPERTIES
|
||||
SOVERSION ${${opm}_VERSION_MAJOR}
|
||||
VERSION ${${opm}_VERSION}
|
||||
LINK_FLAGS "${${opm}_LINKER_FLAGS_STR}"
|
||||
POSITION_INDEPENDENT_CODE TRUE
|
||||
)
|
||||
if (${${opm}_LIBRARY_TYPE} STREQUAL "SHARED")
|
||||
# libs that will be linked with the main lib
|
||||
string(REGEX REPLACE "([;^])[^;]+\\.a[;$]" "\\1" _public_libs
|
||||
"${${opm}_LIBRARIES}")
|
||||
# libs that will not actually linked to the library but
|
||||
# transitively linked to binaries that link to the main library
|
||||
string(REGEX REPLACE "([^;]+\\.[^a][a-zA-Z0-9]*|-[a-z]*)[;$]" "" _interface_libs
|
||||
"${${opm}_LIBRARIES}")
|
||||
else()
|
||||
# Use all libs for real and transitive linking
|
||||
set(_public_libs ${${opm}_LIBRARIES})
|
||||
unset(_interface)
|
||||
endif()
|
||||
target_link_libraries (${${opm}_TARGET} PUBLIC ${_public_libs}
|
||||
INTERFACE ${_interface_libs})
|
||||
target_link_libraries (${${opm}_TARGET} ${${opm}_LIBRARIES})
|
||||
|
||||
if (STRIP_DEBUGGING_SYMBOLS)
|
||||
# queue this executable to be stripped
|
||||
strip_debug_symbols (${${opm}_TARGET} ${opm}_DEBUG)
|
||||
endif()
|
||||
add_static_analysis_tests(${opm}_SOURCES ${opm}_INCLUDE_DIRS)
|
||||
else (${opm}_SOURCES)
|
||||
# unset this variable to signal that no library is generated
|
||||
set (${opm}_TARGET)
|
||||
|
||||
@@ -47,7 +47,7 @@ macro (opm_defaults opm)
|
||||
endif(NOT PRECOMPILE_HEADERS)
|
||||
|
||||
# Use of OpenMP is considered experimental
|
||||
set (USE_OPENMP_DEFAULT ON)
|
||||
set (USE_OPENMP_DEFAULT OFF)
|
||||
|
||||
# if we are on a system where CMake 2.6 is the default (Hi RHEL 6!),
|
||||
# the configuration files for Boost will trip up the library paths
|
||||
|
||||
@@ -2,10 +2,8 @@
|
||||
|
||||
macro (opm_out_dirs)
|
||||
# put libraries in lib/ (no multi-arch support in build tree)
|
||||
if(MAIN_SOURCE_FILES)
|
||||
set (CMAKE_LIBRARY_OUTPUT_DIRECTORY "${PROJECT_BINARY_DIR}/lib")
|
||||
set (CMAKE_ARCHIVE_OUTPUT_DIRECTORY "${PROJECT_BINARY_DIR}/lib")
|
||||
endif()
|
||||
set (CMAKE_LIBRARY_OUTPUT_DIRECTORY "${PROJECT_BINARY_DIR}/lib")
|
||||
set (CMAKE_ARCHIVE_OUTPUT_DIRECTORY "${PROJECT_BINARY_DIR}/lib")
|
||||
set (CMAKE_RUNTIME_OUTPUT_DIRECTORY "${PROJECT_BINARY_DIR}/bin")
|
||||
set (CMAKE_Fortran_MODULE_DIRECTORY "${PROJECT_BINARY_DIR}/CMakeFiles")
|
||||
endmacro (opm_out_dirs)
|
||||
|
||||
@@ -33,7 +33,6 @@
|
||||
# )
|
||||
|
||||
include (Duplicates)
|
||||
include (OpmSiblingSearch)
|
||||
|
||||
# list of suffixes for all the project variables
|
||||
set (_opm_proj_vars
|
||||
@@ -54,16 +53,13 @@ foreach (name IN LISTS _opm_proj_vars)
|
||||
endif (NOT DEFINED ${CMAKE_PROJECT_NAME}_${name})
|
||||
endforeach (name)
|
||||
|
||||
# these dependencies needs special treatment
|
||||
# these dependencies must always be handled by the find module
|
||||
set (_opm_proj_exemptions
|
||||
dune-common
|
||||
dune-istl
|
||||
dune-grid
|
||||
dune-geometry
|
||||
dune-uggrid
|
||||
dune-alugrid
|
||||
dune-localfunctions
|
||||
dune-fem
|
||||
opm-parser
|
||||
)
|
||||
|
||||
# although a DUNE module, it is delivered in the OPM suite
|
||||
@@ -139,67 +135,24 @@ macro (find_and_append_package_to prefix name)
|
||||
set (${name}_FOUND FALSE)
|
||||
set (${NAME}_FOUND FALSE)
|
||||
else ()
|
||||
# List of components might differ for every module. Therefore we will
|
||||
# need to research for a library multiple times. _search_components
|
||||
# will hold the index of the string COMPONENTS in the list
|
||||
set(_ARGN_LIST ${ARGN}) # Create a real list to use with list commands
|
||||
list(FIND _ARGN_LIST "COMPONENTS" _search_components)
|
||||
|
||||
# using config mode is better than using module (aka. find) mode
|
||||
# because then the package has already done all its probes and
|
||||
# stored them in the config file for us
|
||||
# For dune and opm modules and exempted packages we force module mode.
|
||||
# For dune and opm it will use config mode underneath.
|
||||
# We even need to repeat the search for opm-common once as this is done
|
||||
# in the top most CMakeLists.txt without querying defines, setting dependencies
|
||||
# and the likes which is only done via opm_find_package
|
||||
if ( (NOT DEFINED ${name}_FOUND AND NOT DEFINED ${NAME}_FOUND )
|
||||
OR _search_components GREATER -1)
|
||||
string(REGEX MATCH "(dune|opm)-.*" _is_opm ${name})
|
||||
if(NOT _is_opm)
|
||||
string(REGEX MATCH "ewoms" _is_opm ${name})
|
||||
endif()
|
||||
if(${name} STREQUAL "ecl")
|
||||
# Give us a chance to find ecl installed to CMAKE_INSTALL_PREFIX.
|
||||
# We need to deactivate the package registry for this.
|
||||
create_module_dir_var(ecl)
|
||||
set(ARGN_NO_REQUIRED ${ARGN})
|
||||
if(ARGN)
|
||||
list(REMOVE_ITEM ARGN_NO_REQUIRED "REQUIRED")
|
||||
endif()
|
||||
find_package (${name} ${ARGN_NO_REQUIRED} NO_CMAKE_SYSTEM_PACKAGE_REGISTRY NO_CMAKE_PACKAGE_REGISTRY)
|
||||
if(TARGET ecl)
|
||||
# Need to grab from target to enable transitional depends
|
||||
#get_target_property(ecl_INCLUDE_DIRS ecl INTERFACE_INCLUDE_DIRECTORIES)
|
||||
set(ecl_LIBRARIES ecl)
|
||||
set(HAVE_ERT 1)
|
||||
endif()
|
||||
elseif(_${name}_exempted LESS 0 AND NOT _is_opm)
|
||||
find_package (${name} ${ARGN})
|
||||
elseif(_${name}_exempted GREATER -1)
|
||||
find_package (${name} ${ARGN})
|
||||
else()
|
||||
if(${name}_DIR)
|
||||
find_package (${name} ${${prefix}_VERSION_MAJOR}.${${prefix}_VERSION_MINOR} ${ARGN} NO_MODULE PATHS ${${name}_DIR} NO_DEFAULT_PATH)
|
||||
else()
|
||||
find_package (${name} ${${prefix}_VERSION_MAJOR}.${${prefix}_VERSION_MINOR} ${ARGN} NO_MODULE)
|
||||
endif()
|
||||
include(FindPackageHandleStandardArgs)
|
||||
if(${name}_FOUND AND ${name}_LIBRARY STREQUAL "")
|
||||
find_package_handle_standard_args(${name}
|
||||
REQUIRED_VARS ${name}_INCLUDE_DIRS)
|
||||
else()
|
||||
find_package_handle_standard_args(${name}
|
||||
REQUIRED_VARS ${name}_LIBRARY)
|
||||
endif()
|
||||
endif ()
|
||||
endif ()
|
||||
if (NOT DEFINED ${name}_FOUND)
|
||||
set (${name}_FOUND "${${NAME}_FOUND}")
|
||||
endif ()
|
||||
if (NOT DEFINED ${NAME}_FOUND)
|
||||
set (${NAME}_FOUND "${${name}_FOUND}")
|
||||
endif ()
|
||||
# using config mode is better than using module (aka. find) mode
|
||||
# because then the package has already done all its probes and
|
||||
# stored them in the config file for us
|
||||
if (NOT DEFINED ${name}_FOUND AND NOT DEFINED ${NAME}_FOUND)
|
||||
if (${name}_DIR)
|
||||
message (STATUS "Finding package ${name} using config mode")
|
||||
find_package (${name} ${ARGN} NO_MODULE PATHS ${${name}_DIR} NO_DEFAULT_PATH)
|
||||
else ()
|
||||
message (STATUS "Finding package ${name} using module mode")
|
||||
find_package (${name} ${ARGN})
|
||||
endif ()
|
||||
endif ()
|
||||
if (NOT DEFINED ${name}_FOUND)
|
||||
set (${name}_FOUND "${${NAME}_FOUND}")
|
||||
endif ()
|
||||
if (NOT DEFINED ${NAME}_FOUND)
|
||||
set (${NAME}_FOUND "${${name}_FOUND}")
|
||||
endif ()
|
||||
endif ()
|
||||
|
||||
# the variable "NAME" may be replaced during find_package (as this is
|
||||
|
||||
@@ -60,9 +60,6 @@ endmacro ()
|
||||
OpmInitProjVars ()
|
||||
OpmInitDirVars ()
|
||||
|
||||
list(APPEND CMAKE_MODULE_PATH ${PROJECT_SOURCE_DIR})
|
||||
include(OpmPackage)
|
||||
|
||||
# if we are backporting this release to a system which already have an
|
||||
# earlier version, set this flag to have everything scoped into a directory
|
||||
# which incorporates the label of the release. this is done by interjecting
|
||||
@@ -74,17 +71,3 @@ if (USE_VERSIONED_DIR)
|
||||
else ()
|
||||
set (${project}_VER_DIR "")
|
||||
endif ()
|
||||
|
||||
# parallel computing must be explicitly enabled
|
||||
# This needs to be in OpmInit as prereqs is called before OpmLibMain is included.
|
||||
option (USE_MPI "Use Message Passing Interface for parallel computing" OFF)
|
||||
if (NOT USE_MPI)
|
||||
set (CMAKE_DISABLE_FIND_PACKAGE_MPI TRUE)
|
||||
endif ()
|
||||
|
||||
# quadmath must be explicitly enabled
|
||||
# This needs to be in OpmInit as prereqs is called before OpmLibMain is included.
|
||||
option (USE_QUADMATH "Use high precision floating point library (slow)" OFF)
|
||||
if (NOT USE_QUADMATH)
|
||||
set (CMAKE_DISABLE_FIND_PACKAGE_QuadMath TRUE)
|
||||
endif ()
|
||||
|
||||
@@ -8,7 +8,7 @@
|
||||
# _TARGET CMake target which builds the library
|
||||
# _LIBRARY_TYPE Static or shared library
|
||||
# _DEBUG File containing debug symbols
|
||||
include (GNUInstallDirs)
|
||||
include (UseMultiArch)
|
||||
|
||||
macro (opm_install opm)
|
||||
foreach (_hdr IN LISTS ${opm}_HEADERS)
|
||||
@@ -20,16 +20,10 @@ macro (opm_install opm)
|
||||
)
|
||||
endforeach (_hdr)
|
||||
install (
|
||||
TARGETS ${${opm}_TARGET} ${${opm}_EXTRA_TARGETS}
|
||||
EXPORT ${opm}-targets
|
||||
TARGETS ${${opm}_TARGET}
|
||||
LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}${${opm}_VER_DIR}
|
||||
ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR}${${opm}_VER_DIR}
|
||||
)
|
||||
if(NOT "${${opm}_TARGET}" STREQUAL "")
|
||||
export(TARGETS ${${opm}_TARGET} ${${opm}_EXTRA_TARGETS}
|
||||
FILE ${opm}-targets.cmake)
|
||||
install(EXPORT ${opm}-targets DESTINATION "share/cmake/${opm}")
|
||||
endif()
|
||||
# only /usr/lib/debug seems to be searched for debug info; if we have
|
||||
# write access to that directory (package installation), then default
|
||||
# to use it; otherwise put the debug files together with the library
|
||||
@@ -65,10 +59,6 @@ macro (opm_install opm)
|
||||
# multiarch-aware and will thus put in lib64/ on RHEL and lib/ on Debian
|
||||
install (
|
||||
FILES ${PROJECT_SOURCE_DIR}/dune.module
|
||||
DESTINATION lib/${${opm}_VER_DIR}/dunecontrol/${${opm}_NAME}
|
||||
DESTINATION ${LIBDIR_MULTIARCH_UNAWARE}${${opm}_VER_DIR}/dunecontrol/${${opm}_NAME}
|
||||
)
|
||||
install (
|
||||
FILES ${PROJECT_SOURCE_DIR}/${CMAKE_PROJECT_NAME}-prereqs.cmake
|
||||
DESTINATION ${CMAKE_INSTALL_PREFIX}/share/opm/cmake/Modules
|
||||
)
|
||||
endmacro (opm_install opm)
|
||||
|
||||
@@ -90,22 +90,18 @@ include (UseOptimization)
|
||||
# dependencies, in case they alter the list of warnings
|
||||
include (UseWarnings)
|
||||
|
||||
# parallel computing must be explicitly enabled
|
||||
option (USE_MPI "Use Message Passing Interface for parallel computing" OFF)
|
||||
if (NOT USE_MPI)
|
||||
set (CMAKE_DISABLE_FIND_PACKAGE_MPI TRUE)
|
||||
endif (NOT USE_MPI)
|
||||
|
||||
# parallel programming
|
||||
include (UseOpenMP)
|
||||
find_openmp (${project})
|
||||
include (UseThreads)
|
||||
find_threads (${project})
|
||||
|
||||
# SuperLU is optional
|
||||
option (USE_SUPERLU "Use SuperLU direct solvers" OFF)
|
||||
|
||||
# PETSc is optional
|
||||
option (USE_PETSC "Use PETSc iterative solvers" OFF)
|
||||
|
||||
# static code analysis
|
||||
include(UseStaticAnalysis)
|
||||
setup_static_analysis_tools()
|
||||
|
||||
# callback hook to setup additional dependencies
|
||||
if (COMMAND prereqs_hook)
|
||||
prereqs_hook ()
|
||||
@@ -132,7 +128,7 @@ include (UseDebugSymbols)
|
||||
include (UseDynamicBoost)
|
||||
|
||||
# needed for Debian installation scheme
|
||||
include (GNUInstallDirs)
|
||||
include (UseMultiArch)
|
||||
|
||||
# Run conditional file hook
|
||||
files_hook()
|
||||
@@ -270,11 +266,10 @@ if (COMMAND tests_hook)
|
||||
endif (COMMAND tests_hook)
|
||||
|
||||
# make datafiles necessary for tests available in output directory
|
||||
opm_data (tests datafiles "${tests_DIR}")
|
||||
if(NOT BUILD_TESTING)
|
||||
set(excl_all EXCLUDE_FROM_ALL)
|
||||
endif()
|
||||
opm_compile_satellites (${project} tests "${excl_all}" "${tests_REGEXP}")
|
||||
if (BUILD_TESTING)
|
||||
opm_data (tests datafiles "${tests_DIR}")
|
||||
opm_compile_satellites (${project} tests "" "${tests_REGEXP}")
|
||||
endif (BUILD_TESTING)
|
||||
|
||||
# use this target to check local git commits
|
||||
add_custom_target(check-commits
|
||||
@@ -288,6 +283,13 @@ add_custom_target(check-commits
|
||||
include (OpmDoc)
|
||||
opm_doc (${project} ${doxy_dir})
|
||||
|
||||
# provide compatibility with using this build in dunecontrol
|
||||
include (DuneCompat)
|
||||
include (LibtoolArchives)
|
||||
if (${project}_TARGET)
|
||||
configure_la (${project} ${${project}_TARGET} ${project}_LIBTOOL_ARCHIVE)
|
||||
endif ()
|
||||
|
||||
### clean in-source builds ###
|
||||
include (OpmDistClean)
|
||||
opm_dist_clean (${project})
|
||||
|
||||
@@ -37,7 +37,9 @@
|
||||
# <http://www.vtk.org/Wiki/CMake:How_To_Find_Libraries>
|
||||
|
||||
include (OpmFind)
|
||||
include (OpmSiblingSearch)
|
||||
|
||||
option (SIBLING_SEARCH "Search sibling directories before system paths" ON)
|
||||
mark_as_advanced (SIBLING_SEARCH)
|
||||
|
||||
# append all items from src into dst; both must be *names* of lists
|
||||
macro (append_found src dst)
|
||||
@@ -55,11 +57,8 @@ macro (find_opm_package module deps header lib defs prog conf)
|
||||
string (REPLACE "-" "_" MODULE "${MODULE_UPPER}")
|
||||
|
||||
# if someone else has included this test, don't do it again
|
||||
# one exception is opm-common which is already found in the
|
||||
# top most CMakeLists.txt but we still need to search for its
|
||||
# dependencies
|
||||
if (${MODULE}_FOUND OR ${module}_FOUND)
|
||||
return ()
|
||||
return ()
|
||||
endif ()
|
||||
|
||||
# variables to pass on to other packages
|
||||
@@ -74,17 +73,222 @@ macro (find_opm_package module deps header lib defs prog conf)
|
||||
set (_${module}_required "")
|
||||
endif (${module}_FIND_REQUIRED)
|
||||
|
||||
create_module_dir_var(${module})
|
||||
# see if there is a pkg-config entry for this package, and use those
|
||||
# settings as a starting point
|
||||
find_package (PkgConfig)
|
||||
pkg_check_modules (PkgConf_${module} QUIET ${module})
|
||||
|
||||
# This will also set all the needed variables with the exception of
|
||||
# ${module}_CONFIG_VARS for dune modules.
|
||||
find_package(${module} ${_${module}_quiet} ${_${module}_required} CONFIG)
|
||||
# these variables have non-standard names in FindPkgConfig (sic)
|
||||
set (${module}_DEFINITIONS ${PkgConf_${module}_CFLAGS_OTHER})
|
||||
set (${module}_LINKER_FLAG ${PkgConf_${module}_LDFLAGS_OTHER})
|
||||
|
||||
if(NOT ${module}_DEPS)
|
||||
# set the dependencies used in find_package_deps
|
||||
set(${module}_DEPS "${deps}")
|
||||
# try to figure out whether we are in a subdir build tree, and attempt
|
||||
# to put the same name as the appropriate build tree for the module
|
||||
get_filename_component (_build_dir "${CMAKE_CURRENT_BINARY_DIR}" NAME)
|
||||
|
||||
# don't bother if we are in a project specific directory already
|
||||
# (assuming no-one wants to name the build dir after another module!)
|
||||
if ("${_build_dir}" STREQUAL "${PROJECT_NAME}")
|
||||
set (_build_dir "")
|
||||
endif ("${_build_dir}" STREQUAL "${PROJECT_NAME}")
|
||||
|
||||
# if the user hasn't specified any location, and it isn't found
|
||||
# in standard system locations either, then start to wander
|
||||
# about and look for it in proximity to ourself. Qt Creator likes
|
||||
# to put the build-directories as siblings to the source trees,
|
||||
# but with a -build suffix, DUNE likes to have the the build tree
|
||||
# in a "build-cmake" sub-directory of each module
|
||||
set(workaround_cmake_bug 0)
|
||||
if(${module}_DIR})
|
||||
set(workaround_cmake_bug 1)
|
||||
endif()
|
||||
find_package_deps(${module})
|
||||
if(${module}_ROOT})
|
||||
set(workaround_cmake_bug 1)
|
||||
endif()
|
||||
if(${MODULE}_ROOT})
|
||||
set(workaround_cmake_bug 1)
|
||||
endif()
|
||||
if (NOT workaround_cmake_bug)
|
||||
string (TOLOWER "${module}" _module_lower)
|
||||
set (_guess
|
||||
"../${module}"
|
||||
"../${_module_lower}"
|
||||
)
|
||||
set (_guess_bin_only
|
||||
"../${module}-build"
|
||||
"../${_module_lower}-build"
|
||||
)
|
||||
|
||||
# look in similar dirs for the other module
|
||||
if (_build_dir)
|
||||
list (APPEND _guess_bin_only
|
||||
"../../${module}/${_build_dir}"
|
||||
"../../${_module_lower}/${_build_dir}"
|
||||
)
|
||||
endif (_build_dir)
|
||||
|
||||
# generate items that are in the build, not source dir
|
||||
set (_guess_bin)
|
||||
foreach (_item IN ITEMS ${_guess} ${_guess_bin_only})
|
||||
list (APPEND _guess_bin "${PROJECT_BINARY_DIR}/${_item}")
|
||||
endforeach (_item)
|
||||
set (_no_system "")
|
||||
else ()
|
||||
# start looking at the paths in this order
|
||||
set (_guess_bin
|
||||
${${module}_DIR}
|
||||
${${module}_ROOT}
|
||||
${${MODULE}_ROOT}
|
||||
)
|
||||
# if every package is installed directly in the "suite" directory
|
||||
# (e.g. /usr) then allow us to back-track one directory from the
|
||||
# module sub-dir that was added by OpmFind (this happens incidently
|
||||
# already for the source do to the out-of-source support)
|
||||
if ("${${MODULE}_ROOT}" MATCHES "/${module}$")
|
||||
get_filename_component (_suite_parent ${${MODULE}_ROOT} PATH)
|
||||
list (APPEND _guess_bin
|
||||
${_suite_parent}
|
||||
${_suite_parent}/${module}
|
||||
${_suite_parent}/${module}/${_build_dir}
|
||||
)
|
||||
endif ("${${MODULE}_ROOT}" MATCHES "/${module}$")
|
||||
# when we look for the source, it may be that we have been specified
|
||||
# a build directory which is a sub-dir of the source, so we look in
|
||||
# the parent also
|
||||
set (_guess
|
||||
${${module}_DIR}
|
||||
${${module}_ROOT}
|
||||
${${MODULE}_ROOT}
|
||||
)
|
||||
# only add parent directories for those variants that are actually set
|
||||
# (otherwise, we'll inadvertedly add the root directory (=all))
|
||||
if (${module}_DIR)
|
||||
list (APPEND _guess ${${module}_DIR}/..)
|
||||
endif (${module}_DIR)
|
||||
if (${module}_ROOT)
|
||||
list (APPEND _guess ${${module}_ROOT}/..)
|
||||
endif (${module}_ROOT)
|
||||
if (${MODULE}_ROOT)
|
||||
list (APPEND _guess ${${MODULE}_ROOT}/..)
|
||||
endif (${MODULE}_ROOT)
|
||||
# don't search the system paths! that would be dangerous; if there
|
||||
# is a problem in our own specified directory, we don't necessarily
|
||||
# want an old version that is left in one of the system paths!
|
||||
set (_no_system "NO_DEFAULT_PATH")
|
||||
endif ()
|
||||
|
||||
# by specifying _guess in the HINTS section, it gets searched before
|
||||
# the system locations as well. the CMake documentation has a cloudy
|
||||
# recommendation, but it ends up like this: if NO_DEFAULT_PATH is
|
||||
# specified, then PATHS is used. Otherwise, it looks in HINTS, then in
|
||||
# system paths, and the finally in PATHS (!)
|
||||
if (SIBLING_SEARCH)
|
||||
set (_guess_hints ${_guess})
|
||||
set (_guess_hints_bin ${_guess_bin})
|
||||
else (SIBLING_SEARCH)
|
||||
set (_guess_hints)
|
||||
set (_guess_hints_bin)
|
||||
endif (SIBLING_SEARCH)
|
||||
|
||||
# if an include directory is specified directly (e.g. OPM_CORE_INCLUDE_DIR=
|
||||
# /usr/include/opm-2013.03) then this overrides everything else. Notice that
|
||||
# this variable uses the fully capitalized version of the name.
|
||||
if (${MODULE}_INCLUDE_DIR)
|
||||
set (_guess "${${MODULE}_INCLUDE_DIR}")
|
||||
set (_no_system_incl "NO_DEFAULT_PATH")
|
||||
else ()
|
||||
set (_no_system_incl "${_no_system}")
|
||||
endif ()
|
||||
|
||||
# search for this include and library file to get the installation
|
||||
# directory of the package; hints are searched before the system locations,
|
||||
# paths are searched afterwards
|
||||
find_path (${module}_INCLUDE_DIR
|
||||
NAMES "${header}"
|
||||
PATHS ${_guess}
|
||||
HINTS ${PkgConf_${module}_INCLUDE_DIRS} ${_guess_hints}
|
||||
PATH_SUFFIXES "include"
|
||||
${_no_system_incl}
|
||||
)
|
||||
|
||||
# some modules are all in headers
|
||||
if (NOT "${lib}" STREQUAL "")
|
||||
if (CMAKE_SIZEOF_VOID_P)
|
||||
math (EXPR _BITS "8 * ${CMAKE_SIZEOF_VOID_P}")
|
||||
endif (CMAKE_SIZEOF_VOID_P)
|
||||
|
||||
# again, we may directly override the location of the library alone by
|
||||
# specifying e.g. OPM_CORE_LIB_DIR. notice that this is a *directory*
|
||||
# and not the name of the library
|
||||
if (${MODULE}_LIB_DIR)
|
||||
set (_guess_bin "${${MODULE}_LIB_DIR}")
|
||||
set (_no_system_lib "NO_DEFAULT_PATH")
|
||||
else ()
|
||||
set (_no_system_lib "${_no_system}")
|
||||
endif ()
|
||||
|
||||
# if there is more than one library, then look for all of them, putting
|
||||
# them in variables with the name of the library appended. however, the
|
||||
# first entry is assumed to be the "primary" library and will be named
|
||||
# like the module. thus, with a lib entry of "foo;bar", the first library
|
||||
# is called ${module}_LIBRARY and the second ${module}_LIBRARY_bar
|
||||
foreach (_lib IN ITEMS ${lib})
|
||||
# don't include any suffix if it is the first one
|
||||
if ("${lib}" MATCHES "^${_lib}")
|
||||
set (_which)
|
||||
else ()
|
||||
set (_which "_${_lib}")
|
||||
endif ()
|
||||
find_library (${module}_LIBRARY${_which}
|
||||
NAMES "${_lib}"
|
||||
PATHS ${_guess_bin}
|
||||
HINTS ${PkgConf_${module}_LIBRARY_DIRS} ${_guess_hints_bin}
|
||||
PATH_SUFFIXES "lib" "lib/Debug" "lib/Release" "lib/.libs" ".libs" "lib${_BITS}" "lib/${CMAKE_LIBRARY_ARCHITECTURE}" "build-cmake/lib"
|
||||
${_no_system_lib}
|
||||
)
|
||||
# debug info if we didn't find the desired library
|
||||
if (NOT ${module}_LIBRARY${_which})
|
||||
message (STATUS "Failed to find library \"${_lib}\" for module ${module}")
|
||||
endif ()
|
||||
endforeach (_lib)
|
||||
else (NOT "${lib}" STREQUAL "")
|
||||
set (${module}_LIBRARY "")
|
||||
endif (NOT "${lib}" STREQUAL "")
|
||||
|
||||
# add dependencies so that our result variables are complete
|
||||
# list of necessities to build with the software
|
||||
set (${module}_INCLUDE_DIRS "${${module}_INCLUDE_DIR}")
|
||||
foreach (_lib IN ITEMS ${lib})
|
||||
if ("${lib}" MATCHES "^${_lib}")
|
||||
set (${module}_LIBRARIES "${${module}_LIBRARY}")
|
||||
else ()
|
||||
list (APPEND ${module}_LIBRARIES "${${module}_LIBRARY_${_lib}}")
|
||||
endif ()
|
||||
endforeach (_lib)
|
||||
# period because it should be something that evaluates to true
|
||||
# in find_package_handle_standard_args
|
||||
set (${module}_ALL_PREREQS ".")
|
||||
foreach (_dep IN ITEMS ${deps})
|
||||
separate_arguments (_${module}_args UNIX_COMMAND ${_dep})
|
||||
if (_${module}_args)
|
||||
# keep REQUIRED in the arguments only if we were required ourself
|
||||
# "required-ness" is not transitive as far as CMake is concerned
|
||||
# (i.e. if an optional package requests a package to be required,
|
||||
# the build will fail if it's not found)
|
||||
string (REPLACE "REQUIRED" "${_${module}_required}" _args_req "${_${module}_args}")
|
||||
find_and_append_package_to (${module} ${_args_req} ${_${module}_quiet})
|
||||
list (GET _${module}_args 0 _name_only)
|
||||
string (TOUPPER "${_name_only}" _NAME_ONLY)
|
||||
string (REPLACE "-" "_" _NAME_ONLY "${_NAME_ONLY}")
|
||||
# check manually if it was found if REQUIRED; otherwise poison the
|
||||
# dependency list which is checked later (so that it will fail)
|
||||
if (("${_${module}_args}" MATCHES "REQUIRED") AND NOT (${_name_only}_FOUND OR ${_NAME_ONLY}_FOUND))
|
||||
list (APPEND ${module}_ALL_PREREQS "${_name_only}-NOTFOUND")
|
||||
endif ()
|
||||
else ()
|
||||
message (WARNING "Empty dependency in find module for ${module} (check for trailing semi-colon)")
|
||||
endif ()
|
||||
endforeach (_dep)
|
||||
|
||||
# since find_and_append_package_to is a macro, this variable have
|
||||
# probably been overwritten (due to its common name); it is now
|
||||
@@ -105,10 +309,10 @@ macro (find_opm_package module deps header lib defs prog conf)
|
||||
# these defines are used in dune/${module} headers, and should be put
|
||||
# in config.h when we include those
|
||||
foreach (_var IN ITEMS ${conf})
|
||||
# massage the name to remove source code formatting
|
||||
string (REGEX REPLACE "^[\n\t\ ]+" "" _var "${_var}")
|
||||
string (REGEX REPLACE "[\n\t\ ]+$" "" _var "${_var}")
|
||||
list (APPEND ${module}_CONFIG_VARS ${_var})
|
||||
# massage the name to remove source code formatting
|
||||
string (REGEX REPLACE "^[\n\t\ ]+" "" _var "${_var}")
|
||||
string (REGEX REPLACE "[\n\t\ ]+$" "" _var "${_var}")
|
||||
list (APPEND ${module}_CONFIG_VARS ${_var})
|
||||
endforeach (_var)
|
||||
|
||||
# these are the defines that should be set when compiling
|
||||
@@ -131,82 +335,57 @@ macro (find_opm_package module deps header lib defs prog conf)
|
||||
|
||||
# write status message in the same manner as everyone else
|
||||
include (FindPackageHandleStandardArgs)
|
||||
if ("${lib}" STREQUAL "")
|
||||
set (_lib_var "")
|
||||
set (_and_lib_var)
|
||||
else ("${lib}" STREQUAL "")
|
||||
foreach (_lib IN ITEMS ${lib})
|
||||
if ("${lib}" MATCHES "^${_lib}")
|
||||
set (_lib_var "${module}_LIBRARY")
|
||||
set (_and_lib_var AND ${_lib_var})
|
||||
else ()
|
||||
list (APPEND _lib_var "${module}_LIBRARY_${_lib}")
|
||||
set (_and_lib_var ${_and_lib_var} AND "${module}_LIBRARY_${_lib}")
|
||||
endif ()
|
||||
endforeach (_lib)
|
||||
endif ("${lib}" STREQUAL "")
|
||||
# if the search is going to fail, then write these variables to
|
||||
# the console as well as a diagnostics
|
||||
if ((NOT (${module}_INCLUDE_DIR ${_and_lib_var} AND HAVE_${MODULE}))
|
||||
AND (_${module}_required OR NOT _${module}_quiet))
|
||||
if (DEFINED ${module}_DIR)
|
||||
message (STATUS "${module}_DIR = ${${module}_DIR}")
|
||||
elseif (DEFINED ${module}_ROOT)
|
||||
message (STATUS "${module}_ROOT = ${${module}_ROOT}")
|
||||
elseif (DEFINED ${MODULE}_ROOT)
|
||||
message (STATUS "${MODULE}_ROOT = ${${MODULE}_ROOT}")
|
||||
endif (DEFINED ${module}_DIR)
|
||||
endif ((NOT (${module}_INCLUDE_DIR ${_and_lib_var} AND HAVE_${MODULE}))
|
||||
AND (_${module}_required OR NOT _${module}_quiet))
|
||||
if ("${${module}_ALL_PREREQS}" MATCHES "-NOTFOUND")
|
||||
message (STATUS "${module} prereqs: ${${module}_ALL_PREREQS}")
|
||||
endif ()
|
||||
find_package_handle_standard_args (
|
||||
${module}
|
||||
DEFAULT_MSG
|
||||
${module}_INCLUDE_DIRS ${module}_LIBRARIES ${module}_FOUND ${module}_ALL_PREREQS
|
||||
)
|
||||
${module}
|
||||
DEFAULT_MSG
|
||||
${module}_INCLUDE_DIR ${_lib_var} HAVE_${MODULE} ${module}_ALL_PREREQS
|
||||
)
|
||||
|
||||
# allow the user to override these from user interface
|
||||
mark_as_advanced (${module}_INCLUDE_DIR)
|
||||
mark_as_advanced (${module}_LIBRARY)
|
||||
|
||||
# some genius that coded the FindPackageHandleStandardArgs figured out
|
||||
# that the module name should be in uppercase (?!)
|
||||
set (${module}_FOUND "${${MODULE_UPPER}_FOUND}")
|
||||
set (${MODULE}_FOUND "${${MODULE_UPPER}_FOUND}")
|
||||
|
||||
# This variable is used by UseDuneVer
|
||||
list(GET ${module}_INCLUDE_DIRS 0 ${module}_INCLUDE_DIR)
|
||||
# print everything out if we're asked to
|
||||
if (${module}_DEBUG)
|
||||
debug_find_vars (${module})
|
||||
endif (${module}_DEBUG)
|
||||
endmacro (find_opm_package module deps header lib defs prog conf)
|
||||
|
||||
macro (find_package_deps module)
|
||||
# period because it should be something that evaluates to true
|
||||
# in find_package_handle_standard_args
|
||||
set (${module}_ALL_PREREQS ".")
|
||||
foreach (_dep IN ITEMS ${${module}_DEPS})
|
||||
separate_arguments (_${module}_args UNIX_COMMAND "${_dep}")
|
||||
if (_${module}_args)
|
||||
# keep REQUIRED in the arguments only if we were required ourself
|
||||
# "required-ness" is not transitive as far as CMake is concerned
|
||||
# (i.e. if an optional package requests a package to be required,
|
||||
# the build will fail if it's not found)
|
||||
string (REPLACE "REQUIRED" "${_${module}_required}" _args_req "${_${module}_args}")
|
||||
if(_dep MATCHES "opm-" OR _dep MATCHES "ewoms")
|
||||
set(deplist ${_dep})
|
||||
string(STRIP "${_dep}" _dep)
|
||||
string(REPLACE " " ";" deplist "${_dep}")
|
||||
list(GET deplist 0 depname)
|
||||
create_module_dir_var(${depname})
|
||||
endif()
|
||||
find_and_append_package_to (${module} ${_${module}_args} ${_${module}_quiet})
|
||||
list (GET _${module}_args 0 _name_only)
|
||||
string (TOUPPER "${_name_only}" _NAME_ONLY)
|
||||
string (REPLACE "-" "_" _NAME_ONLY "${_NAME_ONLY}")
|
||||
# check manually if it was found if REQUIRED; otherwise poison the
|
||||
# dependency list which is checked later (so that it will fail)
|
||||
if (("${_${module}_args}" MATCHES "REQUIRED") AND NOT (${_name_only}_FOUND OR ${_NAME_ONLY}_FOUND))
|
||||
list (APPEND ${module}_ALL_PREREQS "${_name_only}-NOTFOUND")
|
||||
endif ()
|
||||
else ()
|
||||
message (WARNING "Empty dependency in find module for ${module} (check for trailing semi-colon)")
|
||||
endif ()
|
||||
endforeach (_dep)
|
||||
|
||||
# tidy the lists before returning them
|
||||
remove_dup_deps (${module})
|
||||
|
||||
# these defines are used in dune/${module} headers, and should be put
|
||||
# in config.h when we include those
|
||||
foreach (_var IN ITEMS ${conf})
|
||||
# massage the name to remove source code formatting
|
||||
string (REGEX REPLACE "^[\n\t\ ]+" "" _var "${_var}")
|
||||
string (REGEX REPLACE "[\n\t\ ]+$" "" _var "${_var}")
|
||||
list (APPEND ${module}_CONFIG_VARS ${_var})
|
||||
endforeach (_var)
|
||||
|
||||
# these are the defines that should be set when compiling
|
||||
# without config.h
|
||||
config_cmd_line (${module}_CMD_CONFIG ${module}_CONFIG_VARS)
|
||||
|
||||
# This variable is used by UseDuneVer
|
||||
list(GET ${module}_INCLUDE_DIRS 0 ${module}_INCLUDE_DIR)
|
||||
# print everything out if we're asked to
|
||||
if (${module}_DEBUG)
|
||||
debug_find_vars (${module})
|
||||
endif (${module}_DEBUG)
|
||||
endmacro ()
|
||||
|
||||
# print all variables defined by the above macro
|
||||
function (debug_find_vars module)
|
||||
message (STATUS "${module}_FOUND = ${${module}_FOUND}")
|
||||
@@ -216,7 +395,7 @@ function (debug_find_vars module)
|
||||
message (STATUS "${module}_CONFIG_VARS = ${${module}_CONFIG_VARS}")
|
||||
message (STATUS "${module}_LINKER_FLAGS = ${${module}_LINKER_FLAGS}")
|
||||
string (TOUPPER ${module} MODULE)
|
||||
string (REPLACE "-" "_" MODULE ${MODULE})
|
||||
string (REPLACE "-" "_" MODULE ${MODULE})
|
||||
message (STATUS "HAVE_${MODULE} = ${HAVE_${MODULE}}")
|
||||
endfunction (debug_find_vars module)
|
||||
|
||||
|
||||
@@ -56,9 +56,6 @@ function (configure_cmake_file name variant version)
|
||||
set (opm-project_${suffix} "${${name}_${suffix}}")
|
||||
endforeach (suffix)
|
||||
set (opm-project_NAME "${${name}_NAME}")
|
||||
set (opm-project_NAME_UC "${${name}_NAME}")
|
||||
string(TOUPPER "${opm-project_NAME}" opm-project_NAME_UC)
|
||||
string(REPLACE "-" "_" opm-project_NAME_UC "${opm-project_NAME_UC}")
|
||||
|
||||
# make the file substitutions
|
||||
configure_file (
|
||||
@@ -76,9 +73,7 @@ function (opm_cmake_config name)
|
||||
set (template_dir "${OPM_MACROS_ROOT}/cmake/Templates")
|
||||
|
||||
# write configuration file to locate library
|
||||
set(DUNE_PREFIX ${PROJECT_SOURCE_DIR})
|
||||
set(OPM_PROJECT_EXTRA_CODE ${OPM_PROJECT_EXTRA_CODE_INTREE})
|
||||
set(PREREQ_LOCATION "${PROJECT_SOURCE_DIR}")
|
||||
configure_cmake_file (${name} "config" "")
|
||||
configure_cmake_file (${name} "config" "-version")
|
||||
configure_vars (
|
||||
@@ -92,17 +87,10 @@ function (opm_cmake_config name)
|
||||
${template_dir}/opm-project.pc.in
|
||||
${PROJECT_BINARY_DIR}/${${name}_NAME}.pc
|
||||
${PROJECT_BINARY_DIR}
|
||||
"${CMAKE_LIBRARY_OUTPUT_DIRECTORY}"
|
||||
${CMAKE_LIBRARY_OUTPUT_DIRECTORY}
|
||||
${PROJECT_SOURCE_DIR}
|
||||
)
|
||||
|
||||
# The next replace will result in bogus entries if install directory is
|
||||
# a subdirectory of source tree,
|
||||
# and we have existing entries pointing to that install directory.
|
||||
# Since they will yield a duplicate in next replace anyways, we filter them out first
|
||||
# to get avoid those the bogus entries.
|
||||
string(REPLACE "${CMAKE_INSTALL_PREFIX}/include${${name}_VER_DIR}" "" ${name}_INCLUDE_DIRS "${${name}_INCLUDE_DIRS}")
|
||||
|
||||
# replace the build directory with the target directory in the
|
||||
# variables that contains build paths
|
||||
string (REPLACE
|
||||
@@ -123,8 +111,6 @@ function (opm_cmake_config name)
|
||||
# create a config mode file which targets the install directory instead
|
||||
# of the build directory (using the same input template)
|
||||
set(OPM_PROJECT_EXTRA_CODE ${OPM_PROJECT_EXTRA_CODE_INSTALLED})
|
||||
set(PREREQ_LOCATION "${CMAKE_INSTALL_PREFIX}/share/opm/cmake/Modules")
|
||||
set(DUNE_PREFIX ${CMAKE_INSTALL_PREFIX})
|
||||
configure_cmake_file (${name} "install" "")
|
||||
configure_vars (
|
||||
FILE CMAKE "${PROJECT_BINARY_DIR}/${${name}_NAME}-install.cmake"
|
||||
@@ -158,7 +144,7 @@ function (opm_cmake_config name)
|
||||
if (${name}_TARGET)
|
||||
set (_pkg_dir ${CMAKE_INSTALL_LIBDIR})
|
||||
else ()
|
||||
set (_pkg_dir lib)
|
||||
set (_pkg_dir ${LIBDIR_MULTIARCH_UNAWARE})
|
||||
endif ()
|
||||
install (
|
||||
FILES ${PROJECT_BINARY_DIR}/${${name}_NAME}-install.pc
|
||||
|
||||
@@ -65,11 +65,6 @@ macro (opm_compile_satellites opm satellite excl_all test_regexp)
|
||||
set_target_properties (${_sat_NAME} PROPERTIES
|
||||
LINK_FLAGS "${${opm}_LINKER_FLAGS_STR}"
|
||||
)
|
||||
if(HAVE_DYNAMIC_BOOST_TEST)
|
||||
set_target_properties (${_sat_NAME} PROPERTIES
|
||||
COMPILE_DEFINITIONS BOOST_TEST_DYN_LINK
|
||||
)
|
||||
endif()
|
||||
# are we building a test? luckily, the testing framework doesn't
|
||||
# require anything else, so we don't have to figure out where it
|
||||
# should go in the library list
|
||||
@@ -77,7 +72,6 @@ macro (opm_compile_satellites opm satellite excl_all test_regexp)
|
||||
set (_test_lib "${Boost_UNIT_TEST_FRAMEWORK_LIBRARY}")
|
||||
else (NOT "${test_regexp}" STREQUAL "")
|
||||
set (_test_lib "")
|
||||
add_static_analysis_tests(_sat_FILE ${opm}_INCLUDE_DIRS)
|
||||
endif (NOT "${test_regexp}" STREQUAL "")
|
||||
target_link_libraries (${_sat_NAME} ${${opm}_TARGET} ${${opm}_LIBRARIES} ${_test_lib})
|
||||
if (STRIP_DEBUGGING_SYMBOLS)
|
||||
@@ -87,14 +81,11 @@ macro (opm_compile_satellites opm satellite excl_all test_regexp)
|
||||
|
||||
# variable with regular expression doubles as a flag for
|
||||
# whether tests should be setup or not
|
||||
set(_sat_FANCY)
|
||||
if (NOT "${test_regexp}" STREQUAL "")
|
||||
foreach (_regexp IN ITEMS ${test_regexp})
|
||||
if ("${_sat_NAME}" MATCHES "${_regexp}")
|
||||
string (REGEX REPLACE "${_regexp}" "\\1" _sat_FANCY "${_sat_NAME}")
|
||||
elseif(NOT _sat_FANCY)
|
||||
set(_sat_FANCY ${_sat_NAME})
|
||||
endif()
|
||||
endif ("${_sat_NAME}" MATCHES "${_regexp}")
|
||||
endforeach (_regexp)
|
||||
get_target_property (_sat_LOC ${_sat_NAME} LOCATION)
|
||||
# Run tests through mpi-run. Ubuntu 14.04 provided mpi libs will crash
|
||||
@@ -147,7 +138,7 @@ macro (opm_data satellite target dirname)
|
||||
# even if there are no datafiles, create the directory so the
|
||||
# satellite programs have a homedir to run in
|
||||
execute_process (
|
||||
COMMAND ${CMAKE_COMMAND} -E make_directory ${PROJECT_BINARY_DIR}/${dirname}
|
||||
COMMAND ${CMAKE_COMMAND} -E make_directory ${dirname}
|
||||
)
|
||||
|
||||
# if ever huge test datafiles are necessary, then change this
|
||||
@@ -192,7 +183,6 @@ endmacro (opm_data satellite target dirname files)
|
||||
# Parameters:
|
||||
# TestName Name of test
|
||||
# ONLY_COMPILE Only build test but do not run it (optional)
|
||||
# DEFAULT_ENABLE_IF Only enable by default if a given condition is true (optional)
|
||||
# ALWAYS_ENABLE Force enabling test even if -DBUILD_TESTING=OFF was set (optional)
|
||||
# EXE_NAME Name of test executable (optional, default: ./bin/${TestName})
|
||||
# CONDITION Condition to enable test (optional, cmake code)
|
||||
@@ -219,7 +209,7 @@ macro(opm_add_test TestName)
|
||||
cmake_parse_arguments(CURTEST
|
||||
"NO_COMPILE;ONLY_COMPILE;ALWAYS_ENABLE" # flags
|
||||
"EXE_NAME;PROCESSORS;WORKING_DIRECTORY" # one value args
|
||||
"CONDITION;DEFAULT_ENABLE_IF;TEST_DEPENDS;DRIVER;DRIVER_ARGS;DEPENDS;TEST_ARGS;SOURCES;LIBRARIES" # multi-value args
|
||||
"CONDITION;TEST_DEPENDS;DRIVER;DRIVER_ARGS;DEPENDS;TEST_ARGS;SOURCES;LIBRARIES" # multi-value args
|
||||
${ARGN})
|
||||
|
||||
set(BUILD_TESTING "${BUILD_TESTING}")
|
||||
@@ -229,13 +219,6 @@ macro(opm_add_test TestName)
|
||||
set(CURTEST_EXE_NAME ${TestName})
|
||||
endif()
|
||||
|
||||
# Strip test_ prefix from name
|
||||
if ("${TestName}" MATCHES "^test_([^/]*)$")
|
||||
string (REGEX REPLACE "^test_([^/]*)$" "\\1" _FANCY "${TestName}")
|
||||
else()
|
||||
set(_FANCY ${TestName})
|
||||
endif()
|
||||
|
||||
# try to auto-detect the name of the source file if SOURCES are not
|
||||
# explicitly specified.
|
||||
if (NOT CURTEST_SOURCES)
|
||||
@@ -267,11 +250,6 @@ macro(opm_add_test TestName)
|
||||
# case. They can still be build using 'make test-suite' and they can
|
||||
# be build and run using 'make check'
|
||||
set(CURTEST_EXCLUDE_FROM_ALL "")
|
||||
if (NOT "AND OR ${CURTEST_DEFAULT_ENABLE_IF}" STREQUAL "AND OR ")
|
||||
if (NOT ${CURTEST_DEFAULT_ENABLE_IF})
|
||||
set(CURTEST_EXCLUDE_FROM_ALL "EXCLUDE_FROM_ALL")
|
||||
endif()
|
||||
endif()
|
||||
if (NOT BUILD_TESTING AND NOT CURTEST_ALWAYS_ENABLE)
|
||||
set(CURTEST_EXCLUDE_FROM_ALL "EXCLUDE_FROM_ALL")
|
||||
endif()
|
||||
@@ -288,7 +266,7 @@ macro(opm_add_test TestName)
|
||||
|
||||
# the libraries to link against
|
||||
if (NOT CURTEST_LIBRARIES)
|
||||
SET(CURTEST_LIBRARIES "${${project}_LIBRARIES}")
|
||||
SET(CURTEST_LIBRARIES "${${CMAKE_PROJECT_NAME}_LIBRARIES}")
|
||||
endif()
|
||||
|
||||
# determine if the test should be completely ignored, i.e., the
|
||||
@@ -310,9 +288,6 @@ macro(opm_add_test TestName)
|
||||
add_executable("${CURTEST_EXE_NAME}" ${CURTEST_EXCLUDE_FROM_ALL} ${CURTEST_SOURCES})
|
||||
target_link_libraries (${CURTEST_EXE_NAME} ${CURTEST_LIBRARIES})
|
||||
|
||||
if(TARGET ${project}_prepare)
|
||||
add_dependencies("${CURTEST_EXE_NAME}" ${project}_prepare)
|
||||
endif()
|
||||
if(CURTEST_DEPENDS)
|
||||
add_dependencies("${CURTEST_EXE_NAME}" ${CURTEST_DEPENDS})
|
||||
endif()
|
||||
@@ -322,19 +297,16 @@ macro(opm_add_test TestName)
|
||||
# run-only case occurs if the binary is already compiled by an
|
||||
# earlier test.)
|
||||
add_executable("${CURTEST_EXE_NAME}" ${CURTEST_EXCLUDE_FROM_ALL} ${CURTEST_SOURCES})
|
||||
if(HAVE_DYNAMIC_BOOST_TEST)
|
||||
set_target_properties (${CURTEST_EXE_NAME} PROPERTIES
|
||||
COMPILE_DEFINITIONS BOOST_TEST_DYN_LINK
|
||||
)
|
||||
endif()
|
||||
target_link_libraries (${CURTEST_EXE_NAME} ${CURTEST_LIBRARIES})
|
||||
|
||||
if(CURTEST_DEPENDS)
|
||||
add_dependencies("${CURTEST_EXE_NAME}" ${CURTEST_DEPENDS})
|
||||
endif()
|
||||
if(TARGET ${project}_prepare)
|
||||
add_dependencies("${CURTEST_EXE_NAME}" ${project}_prepare)
|
||||
|
||||
if(NOT TARGET test-suite)
|
||||
add_custom_target(test-suite)
|
||||
endif()
|
||||
add_dependencies(test-suite "${CURTEST_EXE_NAME}")
|
||||
endif()
|
||||
|
||||
# figure out how the test should be run. if a test driver script
|
||||
@@ -349,35 +321,28 @@ macro(opm_add_test TestName)
|
||||
endif()
|
||||
endif()
|
||||
|
||||
add_test(NAME ${_FANCY}
|
||||
add_test(NAME ${TestName}
|
||||
WORKING_DIRECTORY "${CURTEST_WORKING_DIRECTORY}"
|
||||
COMMAND ${CURTEST_COMMAND})
|
||||
|
||||
# specify the dependencies between the tests
|
||||
if (CURTEST_TEST_DEPENDS)
|
||||
set_tests_properties(${_FANCY} PROPERTIES DEPENDS "${CURTEST_TEST_DEPENDS}")
|
||||
set_tests_properties(${TestName} PROPERTIES DEPENDS "${CURTEST_TEST_DEPENDS}")
|
||||
endif()
|
||||
|
||||
# tell ctest how many cores it should reserve to run the test
|
||||
if (CURTEST_PROCESSORS)
|
||||
set_tests_properties(${_FANCY} PROPERTIES PROCESSORS "${CURTEST_PROCESSORS}")
|
||||
set_tests_properties(${TestName} PROPERTIES PROCESSORS "${CURTEST_PROCESSORS}")
|
||||
endif()
|
||||
endif()
|
||||
|
||||
if (NOT CURTEST_NO_COMPILE)
|
||||
if(NOT TARGET test-suite)
|
||||
add_custom_target(test-suite)
|
||||
endif()
|
||||
add_dependencies(test-suite "${CURTEST_EXE_NAME}")
|
||||
endif()
|
||||
|
||||
else() # test is skipped
|
||||
|
||||
# the following causes the test to appear as 'skipped' in the
|
||||
# CDash dashboard. it this is removed, the test is just silently
|
||||
# ignored.
|
||||
if (NOT CURTEST_ONLY_COMPILE AND ADD_DISABLED_CTESTS)
|
||||
add_test(${_FANCY} skip_test_dummy)
|
||||
add_test(${TestName} skip_test_dummy)
|
||||
endif()
|
||||
endif()
|
||||
endmacro()
|
||||
|
||||
@@ -1,36 +0,0 @@
|
||||
option (SIBLING_SEARCH "Search sibling directories before system paths" ON)
|
||||
mark_as_advanced (SIBLING_SEARCH)
|
||||
|
||||
macro(create_module_dir_var module)
|
||||
if(SIBLING_SEARCH AND NOT ${module}_DIR)
|
||||
# guess the sibling dir
|
||||
get_filename_component(_leaf_dir_name ${PROJECT_BINARY_DIR} NAME)
|
||||
get_filename_component(_parent_full_dir ${PROJECT_BINARY_DIR} DIRECTORY)
|
||||
get_filename_component(_parent_dir_name ${_parent_full_dir} NAME)
|
||||
#Try if <module-name>/<build-dir> is used
|
||||
get_filename_component(_modules_dir ${_parent_full_dir} DIRECTORY)
|
||||
if ("${module}" STREQUAL "ecl")
|
||||
#use clone directory libecl
|
||||
set(_clone_dir "libecl")
|
||||
else()
|
||||
set(_clone_dir "${module}")
|
||||
endif()
|
||||
if(IS_DIRECTORY ${_modules_dir}/${_clone_dir}/${_leaf_dir_name})
|
||||
set(${module}_DIR ${_modules_dir}/${_clone_dir}/${_leaf_dir_name})
|
||||
else()
|
||||
string(REPLACE ${PROJECT_NAME} ${_clone_dir} _module_leaf ${_leaf_dir_name})
|
||||
if(NOT _leaf_dir_name STREQUAL _module_leaf
|
||||
AND IS_DIRECTORY ${_parent_full_dir}/${_module_leaf})
|
||||
# We are using build directories named <prefix><module-name><postfix>
|
||||
set(${module}_DIR ${_parent_full_dir}/${_module_leaf})
|
||||
elseif(IS_DIRECTORY ${_parent_full_dir}/${_clone_dir})
|
||||
# All modules are in a common build dir
|
||||
set(${module}_DIR "${_parent_full_dir}/${_clone_dir}")
|
||||
endif()
|
||||
endif()
|
||||
endif()
|
||||
if(${module}_DIR AND NOT IS_DIRECTORY ${${module}_DIR})
|
||||
message(WARNING "Value ${${module}_DIR} passed to variable"
|
||||
" ${module}_DIR is not a directory")
|
||||
endif()
|
||||
endmacro()
|
||||
@@ -50,7 +50,7 @@ macro(opm_static_add_dependencies target)
|
||||
endmacro()
|
||||
|
||||
include(ExternalProject)
|
||||
include(GNUInstallDirs)
|
||||
include(UseMultiArch)
|
||||
|
||||
# Defaults to building master
|
||||
if(NOT OPM_BENCHMARK_VERSION)
|
||||
|
||||
@@ -14,19 +14,139 @@
|
||||
# Add these variables to ${project}_CONFIG_IMPL_VARS in CMakeLists.txt
|
||||
# if you need these in the code.
|
||||
|
||||
include (UseMultiArch)
|
||||
|
||||
function (find_dune_version suite module)
|
||||
# CMake's find_package will set <package>_VERSION_(MAJOR|MINOR|REVISION)
|
||||
# we simply rely on that.
|
||||
# the _ROOT variable may or may not be set, but the include
|
||||
# variable should always be; get the prefix from the header path
|
||||
# if we have a multilib installation where the package maintainer
|
||||
# have installed it in e.g. /usr/include/dune-2.2/dune/istl, then
|
||||
# stash this extra indirection and add it back later in lib/
|
||||
set (_inc_path "${${suite}-${module}_INCLUDE_DIR}")
|
||||
file (TO_CMAKE_PATH _inc_path "${_inc_path}")
|
||||
set (_multilib_regexp "(.*)/include(/${suite}[^/]+)?")
|
||||
if (_inc_path MATCHES "${_multilib_regexp}")
|
||||
set (_orig_inc "${_inc_path}")
|
||||
string (REGEX REPLACE "${_multilib_regexp}" "\\1" _inc_path "${_orig_inc}")
|
||||
# only get the second group if it is really there (there is
|
||||
# probably a better way to do this in CMake)
|
||||
if ("${_inc_path}/include" STREQUAL "${_orig_inc}")
|
||||
set (_multilib "")
|
||||
else ()
|
||||
string (REGEX REPLACE "${_multilib_regexp}" "\\2" _multilib "${_orig_inc}")
|
||||
endif ()
|
||||
else ()
|
||||
set (_multilib "")
|
||||
endif ()
|
||||
|
||||
# some modules does not have a library, use the directory of the
|
||||
# header files to find what would be the library dir.
|
||||
# note that when we refer to a build tree, then the libraries always
|
||||
# go into lib/, but we don't care about that because in that case,
|
||||
# dune.module isn't in the lib/ directory anyway but must be retrieved
|
||||
# from the source. hence, we only have to worry about the library
|
||||
# directory of a system installation here.
|
||||
if (NOT ${suite}-${module}_LIBRARY)
|
||||
# this suffix is gotten from UseMultiArch.cmake
|
||||
set (_lib_path "${_inc_path}/${CMAKE_INSTALL_LIBDIR}")
|
||||
else ()
|
||||
get_filename_component (_lib_path "${${suite}-${module}_LIBRARY}" PATH)
|
||||
endif ()
|
||||
|
||||
# if we have a source tree, dune.module is available there
|
||||
set (_dune_mod "${_inc_path}/dune.module")
|
||||
if (NOT EXISTS "${_dune_mod}")
|
||||
set (_last_dune_mod_src "${_dune_mod}")
|
||||
set (_dune_mod "")
|
||||
endif ()
|
||||
|
||||
if (NOT _dune_mod)
|
||||
# look for the build tree; if we found the library, then the
|
||||
# dune.module file should be in a sub-directory
|
||||
get_filename_component (_immediate "${_lib_path}" NAME)
|
||||
if ("${_immediate}" STREQUAL ".libs")
|
||||
# remove autotools internal path
|
||||
get_filename_component (_lib_path "${_lib_path}" PATH)
|
||||
endif ()
|
||||
get_filename_component (_immediate "${_lib_path}" NAME)
|
||||
if ("${_immediate}" STREQUAL "${CMAKE_LIBRARY_ARCHITECTURE}")
|
||||
# remove multi-arch part of the library path to get parent
|
||||
get_filename_component (_lib_path "${_lib_path}" PATH)
|
||||
endif ()
|
||||
get_filename_component (_immediate "${_lib_path}" NAME)
|
||||
if (("${_immediate}" STREQUAL "${CMAKE_INSTALL_LIBDIR}")
|
||||
OR ("${_immediate}" STREQUAL "lib")
|
||||
OR ("${_immediate}" STREQUAL "${LIBDIR_MULTIARCH_UNAWARE}"))
|
||||
# remove library part of the path; this also undo the suffix
|
||||
# we added if we used the library as a standin
|
||||
get_filename_component (_lib_path "${_lib_path}" PATH)
|
||||
endif ()
|
||||
# from this point on, _lib_path does not contain an architecture-
|
||||
# specific component anymore; dune.module is always put in straight
|
||||
# noarch lib/ since it does not contain any paths to binaries
|
||||
set (_suffix "${_multilib}/dunecontrol/${suite}-${module}/dune.module")
|
||||
set (_dune_mod "${_lib_path}/${LIBDIR_MULTIARCH_UNAWARE}${_suffix}")
|
||||
if (NOT EXISTS "${_dune_mod}")
|
||||
set (_last_dune_mod_bld "${_dune_mod}")
|
||||
# one more try, if we have a private install, then it doesn't use
|
||||
# e.g. lib64 but always lib (!)
|
||||
if ("${LIBDIR_MULTIARCH_UNAWARE}" STREQUAL "lib")
|
||||
set (_dune_mod "")
|
||||
else ()
|
||||
set (_dune_mod "${_lib_path}/lib${_suffix}")
|
||||
if (NOT EXISTS "${_dune_mod}")
|
||||
set (_last_dune_mod_pri "${_dune_mod}")
|
||||
# use the name itself as a flag for whether it was found or not
|
||||
set (_dune_mod "")
|
||||
endif ()
|
||||
endif ()
|
||||
endif ()
|
||||
endif ()
|
||||
|
||||
# if it is not available, it may make havoc having empty defines in the source
|
||||
# code later, so we bail out early
|
||||
if (NOT _dune_mod)
|
||||
if (${suite}-${module}_FOUND)
|
||||
set (_searched_paths "\"${_last_dune_mod_src}\"")
|
||||
if (NOT ("${_last_dune_mod_bld}" STREQUAL ""))
|
||||
set (_searched_paths "either ${_searched_paths} or \"${_last_dune_mod_bld}\"")
|
||||
endif ()
|
||||
if (NOT ("${_last_dune_mod_pri}" STREQUAL ""))
|
||||
set (_searched_paths "${_searched_paths} or \"${_last_dune_mod_pri}\"")
|
||||
endif ()
|
||||
message (FATAL_ERROR "Failed to locate dune.module for ${suite}-${module} (looking for ${_searched_paths})")
|
||||
else ()
|
||||
return ()
|
||||
endif ()
|
||||
endif ()
|
||||
|
||||
# parse the file for the Version: field
|
||||
set (_ver_regexp "[ ]*Version:[ ]*([0-9]+)\\.([0-9]+)(.*)")
|
||||
file (STRINGS "${_dune_mod}" _ver_field REGEX "${_ver_regexp}")
|
||||
string (REGEX REPLACE "${_ver_regexp}" "\\1" _major "${_ver_field}")
|
||||
string (REGEX REPLACE "${_ver_regexp}" "\\2" _minor "${_ver_field}")
|
||||
string (REGEX REPLACE "${_ver_regexp}" "\\3" _revision "${_ver_field}")
|
||||
|
||||
# revision may or may not be there
|
||||
set (_rev_regexp "\\.([0-9]+).*")
|
||||
if (_revision MATCHES "${_rev_regexp}")
|
||||
string (REGEX REPLACE "${_rev_regexp}" "\\1" _revision "${_revision}")
|
||||
else ()
|
||||
set (_revision "0")
|
||||
endif ()
|
||||
|
||||
# generate variable for what we have found
|
||||
string (TOUPPER "${suite}" _SUITE)
|
||||
string (TOUPPER "${module}" _MODULE)
|
||||
string (REPLACE "-" "_" _MODULE "${_MODULE}")
|
||||
set (${_SUITE}_${_MODULE}_VERSION_MAJOR "${${suite}-${module}_VERSION_MAJOR}" PARENT_SCOPE)
|
||||
set (${_SUITE}_${_MODULE}_VERSION_MINOR "${${suite}-${module}_VERSION_MINOR}" PARENT_SCOPE)
|
||||
set (${_SUITE}_${_MODULE}_VERSION_REVISION "${${suite}-${module}_VERSION_PATCH}" PARENT_SCOPE)
|
||||
if ((NOT DEFINED ${_SUITE}_${_MODULE}_VERSION_MAJOR) AND
|
||||
(NOT DEFINED ${_SUITE}_${_MODULE}_VERSION_MINOR) AND
|
||||
(NOT DEFINED ${_SUITE}_${_MODULE}_VERSION_REVISION))
|
||||
set (${_SUITE}_${_MODULE}_VERSION_MAJOR "${_major}" PARENT_SCOPE)
|
||||
set (${_SUITE}_${_MODULE}_VERSION_MINOR "${_minor}" PARENT_SCOPE)
|
||||
set (${_SUITE}_${_MODULE}_VERSION_REVISION "${_revision}" PARENT_SCOPE)
|
||||
endif ()
|
||||
|
||||
if( ${suite}-${module}_FOUND )
|
||||
# print the version number we detected in the configuration log
|
||||
message (STATUS "Version ${${suite}-${module}_VERSION_MAJOR}.${${suite}-${module}_VERSION_MINOR}.${${suite}-${module}_VERSION_PATCH} of ${suite}-${module} from ${${suite}-${module}_DIR}")
|
||||
endif()
|
||||
# print the version number we detected in the configuration log
|
||||
message (STATUS "Version ${_major}.${_minor}.${_revision} of ${suite}-${module} from ${_dune_mod}")
|
||||
endfunction (find_dune_version suite module)
|
||||
|
||||
@@ -1,4 +1,6 @@
|
||||
find_package (Boost 1.44.0 COMPONENTS unit_test_framework QUIET)
|
||||
if (NOT Boost_UNIT_TEST_FRAMEWORK_FOUND)
|
||||
find_package (Boost 1.44.0 COMPONENTS unit_test_framework QUIET)
|
||||
endif ()
|
||||
|
||||
if (Boost_UNIT_TEST_FRAMEWORK_FOUND)
|
||||
# setup to do a test compile
|
||||
|
||||
35
cmake/Modules/UseMultiArch.cmake
Normal file
35
cmake/Modules/UseMultiArch.cmake
Normal file
@@ -0,0 +1,35 @@
|
||||
# - Multiarch support in object code library directories
|
||||
#
|
||||
# This module sets the following variable
|
||||
# CMAKE_INSTALL_LIBDIR to lib, lib64 or lib/x86_64-linux-gnu
|
||||
# depending on the platform; use this path
|
||||
# for platform-specific binaries.
|
||||
#
|
||||
# Note that it will override the results of GNUInstallDirs if included after
|
||||
# that module.
|
||||
|
||||
# default if we need to put something in the library directory for a
|
||||
# component that is *not* multiarch-aware
|
||||
set (LIBDIR_MULTIARCH_UNAWARE "lib")
|
||||
|
||||
# Fedora uses lib64/ for 64-bit systems, Debian uses lib/x86_64-linux-gnu
|
||||
if ("${CMAKE_SYSTEM_NAME}" MATCHES "Linux")
|
||||
# Debian or Ubuntu?
|
||||
if (EXISTS "/etc/debian_version")
|
||||
set (_libdir_def "lib/${CMAKE_LIBRARY_ARCHITECTURE}")
|
||||
else (EXISTS "/etc/debian_version")
|
||||
# 64-bit system?
|
||||
if (CMAKE_SIZEOF_VOID_P EQUAL 8)
|
||||
set (_libdir_def "lib64")
|
||||
set (LIBDIR_MULTIARCH_UNAWARE "${_libdir_def}")
|
||||
else (CMAKE_SIZEOF_VOID_P EQUAL 8)
|
||||
set (_libdir_def "lib")
|
||||
endif (CMAKE_SIZEOF_VOID_P EQUAL 8)
|
||||
endif (EXISTS "/etc/debian_version")
|
||||
else ("${CMAKE_SYSTEM_NAME}" MATCHES "Linux")
|
||||
set (_libdir_def "lib")
|
||||
endif ("${CMAKE_SYSTEM_NAME}" MATCHES "Linux")
|
||||
|
||||
# let the user override if somewhere else is desirable
|
||||
set (CMAKE_INSTALL_LIBDIR "${_libdir_def}" CACHE PATH "Object code libraries")
|
||||
mark_as_advanced (CMAKE_INSTALL_LIBDIR)
|
||||
@@ -21,28 +21,10 @@ if (CXX_COMPAT_GCC)
|
||||
# disabled due to widespread bugs in the linker plugin
|
||||
option (WHOLE_PROG_OPTIM "Whole program optimization (lto)" OFF)
|
||||
if (WHOLE_PROG_OPTIM)
|
||||
check_cxx_accepts_flag ("-flto" HAVE_LINK_OPTS)
|
||||
check_cxx_accepts_flag ("-fuse-linker-plugin" HAVE_LINK_PLUGIN)
|
||||
if (HAVE_LINK_OPTS)
|
||||
list (APPEND _opt_flags "-flto")
|
||||
endif (HAVE_LINK_OPTS)
|
||||
if (HAVE_LINK_PLUGIN)
|
||||
list (APPEND _opt_flags "-fuse-linker-plugin")
|
||||
endif (HAVE_LINK_PLUGIN)
|
||||
if(HAVE_LINK_OPTS AND CMAKE_CXX_COMPILER_ID STREQUAL "GNU")
|
||||
string(REPLACE "." ";" VERSION_LIST "${CMAKE_C_COMPILER_VERSION}")
|
||||
list(GET VERSION_LIST 0 VER_MAJOR)
|
||||
find_program(LTO_AR_COMMAND NAMES ${CMAKE_C_COMPILER}-ar gcc-ar-${VER_MAJOR} gcc-ar)
|
||||
find_program(LTO_RANLIB_COMMAND NAMES ${CMAKE_C_COMPILER}-ranlib gcc-ranlib-${VER_MAJOR} gcc-ranlib)
|
||||
if(LTO_AR_COMMAND)
|
||||
set(CMAKE_AR ${LTO_AR_COMMAND})
|
||||
message(STATUS "Using LTO-enabled ar: ${CMAKE_AR}")
|
||||
endif()
|
||||
if(LTO_RANLIB_COMMAND)
|
||||
set(CMAKE_RANLIB ${LTO_RANLIB_COMMAND})
|
||||
message(STATUS "Using LTO-enabled ranlib: ${CMAKE_RANLIB}")
|
||||
endif()
|
||||
endif()
|
||||
check_cxx_accepts_flag ("-flto" HAVE_LINK_OPTS)
|
||||
if (HAVE_LINK_OPTS)
|
||||
list (APPEND _opt_flags "-flto")
|
||||
endif (HAVE_LINK_OPTS)
|
||||
endif (WHOLE_PROG_OPTIM)
|
||||
|
||||
# native instruction set tuning
|
||||
@@ -56,17 +38,13 @@ if (CXX_COMPAT_GCC)
|
||||
|
||||
# default optimization flags, if not set by user
|
||||
set_default_option (CXX _opt_dbg "-O0" "(^|\ )-O")
|
||||
set_default_option (CXX _opt_rel "-O3" "(^|\ )-O")
|
||||
set_default_option (CXX _opt_rel "-O2" "(^|\ )-O")
|
||||
|
||||
# use these options for debug builds - no optimizations
|
||||
add_options (ALL_LANGUAGES "${_prof_DEBUG}" ${_opt_dbg} "-DDEBUG")
|
||||
|
||||
# use these options for release builds - full optimization
|
||||
add_options (ALL_LANGUAGES "${_prof_RELEASE}" ${_opt_rel} ${_opt_flags})
|
||||
option(WITH_NDEBUG "Disable asserts in release mode" ON)
|
||||
if(WITH_NDEBUG)
|
||||
add_options (ALL_LANGUAGES "${_prof_RELEASE}" -DNDEBUG)
|
||||
endif()
|
||||
add_options (ALL_LANGUAGES "${_prof_RELEASE}" ${_opt_rel} "-DNDEBUG" ${_opt_flags})
|
||||
|
||||
else ()
|
||||
# default information from system
|
||||
|
||||
@@ -1,50 +0,0 @@
|
||||
# Add static analysis tests for a given source file
|
||||
|
||||
macro(setup_static_analysis_tools)
|
||||
find_package(CppCheck)
|
||||
if(CMAKE_EXPORT_COMPILE_COMMANDS)
|
||||
find_package(ClangCheck)
|
||||
else()
|
||||
message(STATUS "Disabling clang-check as CMAKE_EXPORT_COMPILE_COMMANDS is not enabled")
|
||||
endif()
|
||||
if(OPM_COMMON_ROOT)
|
||||
set(DIR ${OPM_COMMON_ROOT})
|
||||
elseif(OPM_MACROS_ROOT)
|
||||
set(DIR ${OPM_MACROS_ROOT})
|
||||
else()
|
||||
set(DIR ${CMAKE_CURRENT_SOURCE_DIR})
|
||||
endif()
|
||||
if(CPPCHECK_FOUND)
|
||||
file(COPY ${DIR}/cmake/Scripts/cppcheck-test.sh
|
||||
DESTINATION bin
|
||||
FILE_PERMISSIONS OWNER_READ OWNER_WRITE OWNER_EXECUTE GROUP_READ GROUP_EXECUTE WORLD_READ WORLD_EXECUTE)
|
||||
endif()
|
||||
if(CLANGCHECK_FOUND AND CMAKE_EXPORT_COMPILE_COMMANDS)
|
||||
configure_file(${DIR}/cmake/Scripts/clang-check-test.sh.in
|
||||
${CMAKE_BINARY_DIR}/CMakeFiles/clang-check-test.sh)
|
||||
file(COPY ${CMAKE_BINARY_DIR}/CMakeFiles/clang-check-test.sh
|
||||
DESTINATION bin
|
||||
FILE_PERMISSIONS OWNER_READ OWNER_WRITE OWNER_EXECUTE GROUP_READ GROUP_EXECUTE WORLD_READ WORLD_EXECUTE)
|
||||
endif()
|
||||
endmacro()
|
||||
|
||||
function(add_static_analysis_tests sources includes)
|
||||
if(CPPCHECK_FOUND OR (CLANGCHECK_FOUND AND CMAKE_EXPORT_COMPILE_COMMANDS))
|
||||
foreach(dep ${${includes}})
|
||||
list(APPEND IPATHS -I ${dep})
|
||||
endforeach()
|
||||
foreach(src ${${sources}})
|
||||
file(RELATIVE_PATH name ${PROJECT_SOURCE_DIR} ${src})
|
||||
if(CPPCHECK_FOUND)
|
||||
add_test(NAME cppcheck+${name}
|
||||
COMMAND bin/cppcheck-test.sh ${CPPCHECK_PROGRAM} ${src} ${IPATHS}
|
||||
CONFIGURATIONS analyze cppcheck)
|
||||
endif()
|
||||
if(CLANGCHECK_FOUND AND CMAKE_EXPORT_COMPILE_COMMANDS)
|
||||
add_test(NAME clang-check+${name}
|
||||
COMMAND bin/clang-check-test.sh ${CLANGCHECK_PROGRAM} ${src}
|
||||
CONFIGURATIONS analyze clang-check)
|
||||
endif()
|
||||
endforeach()
|
||||
endif()
|
||||
endfunction()
|
||||
44
cmake/Modules/ewoms-prereqs.cmake
Normal file
44
cmake/Modules/ewoms-prereqs.cmake
Normal file
@@ -0,0 +1,44 @@
|
||||
# -*- mode: cmake; tab-width: 2; indent-tabs-mode: t; truncate-lines: t; compile-command: "cmake -Wdev" -*-
|
||||
# vim: set filetype=cmake autoindent tabstop=2 shiftwidth=2 noexpandtab softtabstop=2 nowrap:
|
||||
|
||||
# this avoids an annoying deprecation warning on DUNE 2.4 (which we
|
||||
# are not interested in anyway)
|
||||
set(DUNE_AVOID_CAPABILITIES_IS_PARALLEL_DEPRECATION_WARNING 1)
|
||||
|
||||
# defines that must be present in config.h for our headers
|
||||
set (ewoms_CONFIG_VAR
|
||||
HAVE_QUAD
|
||||
HAVE_VALGRIND
|
||||
HAVE_DUNE_COMMON
|
||||
HAVE_DUNE_GEOMETRY
|
||||
HAVE_DUNE_GRID
|
||||
HAVE_DUNE_LOCALFUNCTIONS
|
||||
HAVE_DUNE_ISTL
|
||||
HAVE_DUNE_ALUGRID
|
||||
HAVE_DUNE_FEM
|
||||
DUNE_AVOID_CAPABILITIES_IS_PARALLEL_DEPRECATION_WARNING
|
||||
)
|
||||
|
||||
# dependencies
|
||||
set (ewoms_DEPS
|
||||
# compile with C++0x/11 support if available
|
||||
"CXX11Features REQUIRED"
|
||||
# DUNE prerequisites
|
||||
"dune-common REQUIRED"
|
||||
"dune-geometry REQUIRED"
|
||||
"dune-grid REQUIRED"
|
||||
"dune-istl REQUIRED"
|
||||
"opm-common REQUIRED"
|
||||
"opm-material REQUIRED"
|
||||
"dune-localfunctions"
|
||||
"dune-alugrid"
|
||||
"dune-fem"
|
||||
"opm-parser"
|
||||
"opm-grid"
|
||||
# librt (on some systems necessary for clock_gettime())
|
||||
"librt REQUIRED"
|
||||
# valgrind client requests
|
||||
"Valgrind"
|
||||
# quadruple precision floating point calculations
|
||||
"Quadmath"
|
||||
)
|
||||
19
cmake/Modules/opm-benchmarks-prereqs.cmake
Normal file
19
cmake/Modules/opm-benchmarks-prereqs.cmake
Normal file
@@ -0,0 +1,19 @@
|
||||
# -*- mode: cmake; tab-width: 2; indent-tabs-mode: t; truncate-lines: t; compile-command: "cmake -Wdev" -*-
|
||||
# vim: set filetype=cmake autoindent tabstop=2 shiftwidth=2 noexpandtab softtabstop=2 nowrap:
|
||||
|
||||
# defines that must be present in config.h for our headers
|
||||
set (opm-benchmarks_CONFIG_VAR
|
||||
)
|
||||
|
||||
# dependencies
|
||||
set (opm-benchmarks_DEPS
|
||||
# compile with C++0x/11 support if available
|
||||
"CXX11Features REQUIRED"
|
||||
# various runtime library enhancements
|
||||
"Boost 1.44.0
|
||||
COMPONENTS date_time filesystem system unit_test_framework REQUIRED"
|
||||
# OPM dependency
|
||||
"opm-common"
|
||||
"opm-core REQUIRED"
|
||||
"opm-upscaling REQUIRED"
|
||||
)
|
||||
17
cmake/Modules/opm-common-prereqs.cmake
Normal file
17
cmake/Modules/opm-common-prereqs.cmake
Normal file
@@ -0,0 +1,17 @@
|
||||
# -*- mode: cmake; tab-width: 2; indent-tabs-mode: t; truncate-lines: t; compile-command: "cmake -Wdev" -*-
|
||||
# vim: set filetype=cmake autoindent tabstop=2 shiftwidth=2 noexpandtab softtabstop=2 nowrap:
|
||||
|
||||
# defines that must be present in config.h for our headers
|
||||
set (opm-common_CONFIG_VAR
|
||||
)
|
||||
|
||||
# dependencies
|
||||
set (opm-common_DEPS
|
||||
# compile with C99 support if available
|
||||
"C99"
|
||||
# compile with C++0x/11 support if available
|
||||
"CXX11Features REQUIRED"
|
||||
# various runtime library enhancements
|
||||
"Boost 1.44.0
|
||||
COMPONENTS system unit_test_framework REQUIRED"
|
||||
)
|
||||
46
cmake/Modules/opm-core-prereqs.cmake
Normal file
46
cmake/Modules/opm-core-prereqs.cmake
Normal file
@@ -0,0 +1,46 @@
|
||||
# -*- mode: cmake; tab-width: 2; indent-tabs-mode: t; truncate-lines: t; compile-command: "cmake -Wdev" -*-
|
||||
# vim: set filetype=cmake autoindent tabstop=2 shiftwidth=2 noexpandtab softtabstop=2 nowrap:
|
||||
|
||||
# defines that must be present in config.h for our headers
|
||||
set (opm-core_CONFIG_VAR
|
||||
HAVE_ERT
|
||||
HAVE_SUITESPARSE_UMFPACK_H
|
||||
HAVE_DUNE_ISTL
|
||||
HAVE_MPI
|
||||
HAVE_PETSC
|
||||
)
|
||||
|
||||
# dependencies
|
||||
set (opm-core_DEPS
|
||||
# compile with C99 support if available
|
||||
"C99"
|
||||
# compile with C++0x/11 support if available
|
||||
"CXX11Features REQUIRED"
|
||||
# various runtime library enhancements
|
||||
"Boost 1.44.0
|
||||
COMPONENTS date_time filesystem system unit_test_framework REQUIRED"
|
||||
# matrix library
|
||||
"BLAS REQUIRED"
|
||||
"LAPACK REQUIRED"
|
||||
# Tim Davis' SuiteSparse archive
|
||||
"SuiteSparse COMPONENTS umfpack"
|
||||
# solver
|
||||
"SuperLU"
|
||||
# xml processing (for config parsing)
|
||||
"TinyXML"
|
||||
# Ensembles-based Reservoir Tools (ERT)
|
||||
"ERT REQUIRED"
|
||||
# Look for MPI support
|
||||
"MPI"
|
||||
# PETSc numerical backend
|
||||
"PETSc"
|
||||
# DUNE dependency
|
||||
"dune-common"
|
||||
"dune-istl"
|
||||
"opm-common REQUIRED"
|
||||
# Parser library for ECL-type simulation models
|
||||
"opm-parser REQUIRED"
|
||||
# the code which implements the material laws
|
||||
"opm-material REQUIRED"
|
||||
"opm-output REQUIRED"
|
||||
)
|
||||
21
cmake/Modules/opm-flowdiagnostics-applications-prereqs.cmake
Normal file
21
cmake/Modules/opm-flowdiagnostics-applications-prereqs.cmake
Normal file
@@ -0,0 +1,21 @@
|
||||
# -*- mode: cmake; tab-width: 2; indent-tabs-mode: t; truncate-lines: t; compile-command: "cmake -Wdev" -*-
|
||||
# vim: set filetype=cmake autoindent tabstop=2 shiftwidth=2 noexpandtab softtabstop=2 nowrap:
|
||||
|
||||
# defines that must be present in config.h for our headers
|
||||
set (opm-flowdiagnostics-applications_CONFIG_VAR
|
||||
)
|
||||
|
||||
# dependencies
|
||||
set (opm-flowdiagnostics-applications_DEPS
|
||||
# compile with C99 support if available
|
||||
"C99"
|
||||
# compile with C++0x/11 support if available
|
||||
"CXX11Features REQUIRED"
|
||||
"Boost 1.44.0
|
||||
COMPONENTS filesystem system unit_test_framework REQUIRED"
|
||||
"ERT REQUIRED"
|
||||
# prerequisite OPM modules
|
||||
"opm-common REQUIRED;
|
||||
opm-flowdiagnostics REQUIRED;
|
||||
opm-core REQUIRED"
|
||||
)
|
||||
18
cmake/Modules/opm-flowdiagnostics-prereqs.cmake
Normal file
18
cmake/Modules/opm-flowdiagnostics-prereqs.cmake
Normal file
@@ -0,0 +1,18 @@
|
||||
# -*- mode: cmake; tab-width: 2; indent-tabs-mode: t; truncate-lines: t; compile-command: "cmake -Wdev" -*-
|
||||
# vim: set filetype=cmake autoindent tabstop=2 shiftwidth=2 noexpandtab softtabstop=2 nowrap:
|
||||
|
||||
# defines that must be present in config.h for our headers
|
||||
set (opm-flowdiagnostics_CONFIG_VAR
|
||||
)
|
||||
|
||||
# dependencies
|
||||
set (opm-flowdiagnostics_DEPS
|
||||
# compile with C99 support if available
|
||||
"C99"
|
||||
# compile with C++0x/11 support if available
|
||||
"CXX11Features REQUIRED"
|
||||
"Boost 1.44.0
|
||||
COMPONENTS unit_test_framework REQUIRED"
|
||||
# prerequisite OPM modules
|
||||
"opm-common REQUIRED"
|
||||
)
|
||||
36
cmake/Modules/opm-grid-prereqs.cmake
Normal file
36
cmake/Modules/opm-grid-prereqs.cmake
Normal file
@@ -0,0 +1,36 @@
|
||||
# -*- mode: cmake; tab-width: 2; indent-tabs-mode: t; truncate-lines: t; compile-command: "cmake -Wdev" -*-
|
||||
# vim: set filetype=cmake autoindent tabstop=2 shiftwidth=2 noexpandtab softtabstop=2 nowrap:
|
||||
|
||||
# defines that must be present in config.h for our headers
|
||||
set (opm-grid_CONFIG_VAR
|
||||
DUNE_GRID_VERSION_MAJOR
|
||||
DUNE_GRID_VERSION_MINOR
|
||||
DUNE_GRID_VERSION_REVISION
|
||||
DUNE_COMMON_VERSION_MAJOR
|
||||
DUNE_COMMON_VERSION_MINOR
|
||||
DUNE_COMMON_VERSION_REVISION
|
||||
DUNE_ISTL_VERSION_MAJOR
|
||||
DUNE_ISTL_VERSION_MINOR
|
||||
DUNE_ISTL_VERSION_REVISION
|
||||
HAVE_ZOLTAN
|
||||
)
|
||||
|
||||
# dependencies
|
||||
set (opm-grid_DEPS
|
||||
# compile with C99 support if available
|
||||
"C99"
|
||||
# compile with C++0x/11 support if available
|
||||
"CXX11Features"
|
||||
# various runtime library enhancements
|
||||
"Boost 1.44.0
|
||||
COMPONENTS date_time filesystem system unit_test_framework REQUIRED"
|
||||
# DUNE dependency
|
||||
"dune-common REQUIRED;
|
||||
dune-grid REQUIRED;
|
||||
dune-geometry REQUIRED
|
||||
dune-istl"
|
||||
# OPM dependency
|
||||
"opm-common REQUIRED;
|
||||
opm-core REQUIRED"
|
||||
"ZOLTAN"
|
||||
)
|
||||
23
cmake/Modules/opm-material-prereqs.cmake
Normal file
23
cmake/Modules/opm-material-prereqs.cmake
Normal file
@@ -0,0 +1,23 @@
|
||||
# -*- mode: cmake; tab-width: 2; indent-tabs-mode: t; truncate-lines: t; compile-command: "cmake -Wdev" -*-
|
||||
# vim: set filetype=cmake autoindent tabstop=2 shiftwidth=2 noexpandtab softtabstop=2 nowrap:
|
||||
|
||||
# defines that must be present in config.h for our headers
|
||||
set (opm-material_CONFIG_VAR
|
||||
HAVE_MPI
|
||||
HAVE_TYPE_TRAITS
|
||||
HAVE_VALGRIND
|
||||
HAVE_FINAL
|
||||
)
|
||||
|
||||
# dependencies
|
||||
set (opm-material_DEPS
|
||||
# compile with C99 support if available
|
||||
"C99"
|
||||
# compile with C++0x/11 support if available
|
||||
"CXX11Features REQUIRED"
|
||||
# prerequisite OPM modules
|
||||
"opm-parser"
|
||||
"opm-common REQUIRED"
|
||||
# DUNE dependency
|
||||
"dune-common REQUIRED"
|
||||
)
|
||||
24
cmake/Modules/opm-output-prereqs.cmake
Normal file
24
cmake/Modules/opm-output-prereqs.cmake
Normal file
@@ -0,0 +1,24 @@
|
||||
# -*- mode: cmake; tab-width: 2; indent-tabs-mode: t; truncate-lines: t; compile-command: "cmake -Wdev" -*-
|
||||
# vim: set filetype=cmake autoindent tabstop=2 shiftwidth=2 noexpandtab softtabstop=2 nowrap:
|
||||
|
||||
# defines that must be present in config.h for our headers
|
||||
set (opm-output_CONFIG_VAR
|
||||
HAVE_ERT
|
||||
)
|
||||
|
||||
# dependencies
|
||||
set (opm-output_DEPS
|
||||
# compile with C99 support if available
|
||||
"C99"
|
||||
# compile with C++0x/11 support if available
|
||||
"CXX11Features REQUIRED"
|
||||
# various runtime library enhancements
|
||||
"Boost 1.44.0
|
||||
COMPONENTS unit_test_framework REQUIRED"
|
||||
# Ensembles-based Reservoir Tools (ERT)
|
||||
"ERT REQUIRED"
|
||||
# Look for MPI support
|
||||
"opm-common REQUIRED"
|
||||
# Parser library for ECL-type simulation models
|
||||
"opm-parser REQUIRED"
|
||||
)
|
||||
31
cmake/Modules/opm-simulators-prereqs.cmake
Normal file
31
cmake/Modules/opm-simulators-prereqs.cmake
Normal file
@@ -0,0 +1,31 @@
|
||||
# -*- mode: cmake; tab-width: 2; indent-tabs-mode: t; truncate-lines: t; compile-command: "cmake -Wdev" -*-
|
||||
# vim: set filetype=cmake autoindent tabstop=2 shiftwidth=2 noexpandtab softtabstop=2 nowrap:
|
||||
|
||||
# defines that must be present in config.h for our headers
|
||||
set (opm-simulators_CONFIG_VAR
|
||||
HAVE_OPM_GRID
|
||||
HAVE_PTHREAD
|
||||
)
|
||||
|
||||
# dependencies
|
||||
set (opm-simulators_DEPS
|
||||
# Compile with C99 support if available
|
||||
"C99"
|
||||
# Compile with C++0x/11 support if available
|
||||
"CXX11Features"
|
||||
# Various runtime library enhancements
|
||||
"Boost 1.44.0
|
||||
COMPONENTS date_time filesystem system unit_test_framework REQUIRED"
|
||||
# DUNE prerequisites
|
||||
"dune-common REQUIRED;
|
||||
dune-istl REQUIRED"
|
||||
"ERTPython"
|
||||
# OPM dependency
|
||||
"opm-common REQUIRED;
|
||||
opm-parser REQUIRED;
|
||||
opm-core REQUIRED;
|
||||
opm-output REQUIRED;
|
||||
opm-grid"
|
||||
# Eigen
|
||||
"Eigen3 3.2.0"
|
||||
)
|
||||
32
cmake/Modules/opm-upscaling-prereqs.cmake
Normal file
32
cmake/Modules/opm-upscaling-prereqs.cmake
Normal file
@@ -0,0 +1,32 @@
|
||||
# -*- mode: cmake; tab-width: 2; indent-tabs-mode: t; truncate-lines: t; compile-command: "cmake -Wdev" -*-
|
||||
# vim: set filetype=cmake autoindent tabstop=2 shiftwidth=2 noexpandtab softtabstop=2 nowrap:
|
||||
|
||||
# defines that must be present in config.h for our headers
|
||||
set (opm-upscaling_CONFIG_VAR
|
||||
HAVE_SUPERLU
|
||||
)
|
||||
|
||||
# dependencies
|
||||
set (opm-upscaling_DEPS
|
||||
# compile with C99 support if available
|
||||
"C99"
|
||||
# compile with C++0x/11 support if available
|
||||
"CXX11Features"
|
||||
# various runtime library enhancements
|
||||
"Boost 1.44.0
|
||||
COMPONENTS date_time filesystem system iostreams unit_test_framework REQUIRED"
|
||||
# matrix library
|
||||
"BLAS REQUIRED"
|
||||
"LAPACK REQUIRED"
|
||||
# solver
|
||||
"SuperLU"
|
||||
# DUNE dependency
|
||||
"dune-common REQUIRED;
|
||||
dune-istl REQUIRED;
|
||||
dune-geometry REQUIRED;
|
||||
dune-grid REQUIRED;
|
||||
opm-common REQUIRED;
|
||||
opm-core REQUIRED;
|
||||
opm-grid REQUIRED;
|
||||
opm-output REQUIRED"
|
||||
)
|
||||
@@ -1,23 +0,0 @@
|
||||
#!/bin/bash
|
||||
|
||||
# This script performs a single analysis using clang-check
|
||||
# It is used by the 'make test' target in the buildsystems
|
||||
# Usually you should use 'ctest -C clang-check' rather than calling this script directly
|
||||
#
|
||||
# Parameters: $1 = Application binary
|
||||
# $2 = Source file to process
|
||||
|
||||
clangcheck_cmd=$1
|
||||
source_file=$2
|
||||
|
||||
tmpfil=`mktemp`
|
||||
$clangcheck_cmd -p @CMAKE_BINARY_DIR@ -analyze $source_file &> $tmpfil
|
||||
cat $tmpfil
|
||||
if test -s $tmpfil
|
||||
then
|
||||
rm $tmpfil
|
||||
exit 1
|
||||
fi
|
||||
|
||||
rm $tmpfil
|
||||
exit 0
|
||||
553
cmake/Scripts/configure
vendored
Executable file
553
cmake/Scripts/configure
vendored
Executable file
@@ -0,0 +1,553 @@
|
||||
#!/bin/bash
|
||||
|
||||
# where is the source tree located by default relative to here
|
||||
srcdir=$(dirname "$(dirname "$(dirname "$0")")")
|
||||
|
||||
# display help text
|
||||
usage () {
|
||||
cat <<EOF
|
||||
Installation directories:
|
||||
--prefix=PREFIX install architecture-independent files in PREFIX
|
||||
[/usr/local]. Note: set DESTDIR=PATH when doing
|
||||
\`make install' to install to a different sysroot.
|
||||
|
||||
Optional Features:
|
||||
--disable-FEATURE do not include FEATURE
|
||||
--disable-gxx11check do not try flag -std=c++11 to enable C++11 features
|
||||
--enable-shared build a shared library [default=yes]
|
||||
--enable-static build a static library [default=no]. Note: only one
|
||||
of the options shared and static may be built.
|
||||
--enable-debug build a non-optimized version of the library
|
||||
[default=no]
|
||||
--disable-runpath do not use RUNPATH in installed library [default=yes]
|
||||
--enable-lto use whole program optimization [default=no]
|
||||
--enable-strip-debug separate the executable code and the debugging symbols [default=no]
|
||||
--disable-tests do not compile and enable unit tests [default=yes]
|
||||
--disable-examples do not compile example programs [default=yes]
|
||||
--disable-pch do not use precompiled headers (if buggy compiler)
|
||||
--disable-silent-rules print every compilation statement as executed
|
||||
--enable-system-debug put .debug files in global GDB debug dir
|
||||
[default=yes if prefix=/usr, no otherwise]
|
||||
--enable-parallel process in parallel using MPI [default=no]
|
||||
--enable-openmp activate experimental support for OpenMP
|
||||
--disable-option-checking ignore unrecognized --enable/--with options
|
||||
--enable-underscoring assume Fortran routines have _ suffix [default=no]
|
||||
--enable-ninja use Ninja build generator [default=no]
|
||||
(automatically implies --enable-underscoring)
|
||||
--config-cache Reuse build configuration cache from a previous run
|
||||
|
||||
Optional Packages:
|
||||
--with-ug=PATH use the UG libraries from a specified location
|
||||
--with-alugrid=PATH use the ALUGrid library from a specified location
|
||||
--with-metis=PATH use the METIS graph partitioning library from a specified location
|
||||
--with-boost=PATH use Boost library from a specified location
|
||||
--with-dune=PATH specify parent of all DUNE modules not specified
|
||||
--with-dune-MODULE=PATH use given DUNE module from a specified location
|
||||
--with-opm=PATH specify parent of all OPM modules not specified
|
||||
--with-opm-MODULE=PATH use given OPM module from a specified location
|
||||
--with-superlu=PATH user defined path to SuperLU library
|
||||
--with-umfpack=PATH use UMFPACK/SuiteSparse from a specified location
|
||||
--with-ert=PATH Use ERT libraries
|
||||
--with-zoltan=PATH Use ZOLTAN libraries
|
||||
--with-tinyxml=PATH use TinyXML library from a specified location
|
||||
(Note: if not found, then a bundled library will
|
||||
be used)
|
||||
--with-cmake=PROGRAM use this program instead of \`cmake' to configure
|
||||
--with-buildname=TEXT description passed to the CDash configuration
|
||||
--with-site=TEXT site passed to the CDash configuration
|
||||
|
||||
Some influential environment variables:
|
||||
CC C compiler command
|
||||
CFLAGS C compiler flags
|
||||
LDFLAGS linker flags, e.g. -L<lib dir> if you have libraries in a
|
||||
nonstandard directory <lib dir>
|
||||
LIBS libraries to pass to the linker, e.g. -l<library>
|
||||
CPPFLAGS (Objective) C/C++ preprocessor flags, e.g. -I<include dir> if
|
||||
you have headers in a nonstandard directory <include dir>
|
||||
CPP C preprocessor
|
||||
CXX C++ compiler command
|
||||
CXXFLAGS C++ compiler flags
|
||||
CXXCPP C++ preprocessor
|
||||
F77 Fortran 77 compiler command
|
||||
FFLAGS Fortran 77 compiler flags
|
||||
FC Fortran compiler command
|
||||
FCFLAGS Fortran compiler flags
|
||||
CMAKE_COMMAND Executable used to run cmake scripts
|
||||
|
||||
Use these variables to override the choices made by \`configure' or to help
|
||||
it to find libraries and programs with nonstandard names/locations.
|
||||
EOF
|
||||
}
|
||||
|
||||
# report an error regarding the arguments
|
||||
invalid_arg () {
|
||||
cat <<EOF
|
||||
configure: error: unrecognized option: \`$1'
|
||||
Try \`$0 --help' for more information
|
||||
EOF
|
||||
}
|
||||
|
||||
# notify the user that this argument is not known
|
||||
unknown_arg () {
|
||||
cat <<EOF
|
||||
configure: warning: unrecognized option: \`$1'
|
||||
EOF
|
||||
}
|
||||
|
||||
# warn only if option checking is enabled
|
||||
invalid_opt () {
|
||||
if [ "${option_check}" = "yes" ]; then
|
||||
unknown_arg "$@"
|
||||
fi
|
||||
}
|
||||
|
||||
# default values
|
||||
prefix=/usr/local
|
||||
#c_compiler=" -DCMAKE_C_COMPILER=cc"
|
||||
c_compiler=
|
||||
c_opts=
|
||||
#cxx_compiler=" -DCMAKE_CXX_COMPILER=c++"
|
||||
cxx_compiler=
|
||||
cxx_opts=
|
||||
#fort_compiler=" -DCMAKE_Fortran_COMPILER=fc"
|
||||
fort_compiler=
|
||||
fort_opts=
|
||||
#buildtype=" -DCMAKE_BUILD_TYPE=Debug"
|
||||
buildtype=
|
||||
#pch_use=" -DPRECOMPILE_HEADERS:BOOL=ON"
|
||||
pch_use=
|
||||
#use_openmp=" -DUSE_OPENMP=OFF"
|
||||
use_openmp=
|
||||
use_mpi=
|
||||
#silent_rules=" -DCMAKE_VERBOSE_MAKEFILE=OFF"
|
||||
silent_rules=
|
||||
#debug_loc=" -DSYSTEM_DEBUG=OFF"
|
||||
debug_loc=
|
||||
#use_lto=" -DWHOLE_PROG_OPTIM=OFF"
|
||||
use_lto=
|
||||
#strip_debug=" -DSTRIP_DEBUGGING_SYMBOLS=OFF"
|
||||
strip_debug=
|
||||
#use_runpath=" -DUSE_RUNPATH=OFF"
|
||||
use_runpath=
|
||||
#use_tests=" -DBUILD_TESTING=ON"
|
||||
use_tests=
|
||||
#use_samples=" -DBUILD_EXAMPLES=ON"
|
||||
use_samples=
|
||||
#use_ninja="-G\"Unix Makefiles\" "
|
||||
use_ninja=
|
||||
#use_underscoring=" -DUSE_UNDERSCORING=OFF"
|
||||
use_underscoring=
|
||||
# boost_root=""
|
||||
boost_root=
|
||||
boost_libdir=
|
||||
boost_opts=
|
||||
# configuration that is passed on to CTest/CDash
|
||||
buildname=
|
||||
site=
|
||||
# if set, this prevents the previous CMake cache from being deleted
|
||||
config_cache=
|
||||
|
||||
# default is to warn for unknown options, but this can be disabled
|
||||
option_check=yes
|
||||
|
||||
# this variable will get feature options
|
||||
FEATURES=
|
||||
|
||||
# this array will get all variable assignments from command-line
|
||||
VARS=()
|
||||
|
||||
# command that launches cmake; look for 2.8 if available
|
||||
if [ "${CMAKE_COMMAND}" = "" ]; then
|
||||
if [ -x "$(command -v cmake28)" ]; then
|
||||
CMAKE_COMMAND=cmake28
|
||||
else
|
||||
CMAKE_COMMAND=cmake
|
||||
fi
|
||||
fi
|
||||
|
||||
# helper routine
|
||||
uppercase () {
|
||||
echo "$@" | tr "a-z-" "A-Z_"
|
||||
}
|
||||
|
||||
for OPT in "$@"; do
|
||||
case "$OPT" in
|
||||
--*)
|
||||
OPTARG=${OPT#--}
|
||||
# OPTARG now contains everything after double dashes
|
||||
case "${OPTARG}" in
|
||||
config-cache|cache-file=*)
|
||||
# prevent the previous CMake cache from being deleted. The
|
||||
# second option is only here for Dune/autotools compatibility
|
||||
config_cache="1"
|
||||
;;
|
||||
src-dir=*)
|
||||
# allow the user to use these build macros for another
|
||||
# project (so source-dir is not relative to us)
|
||||
srcdir=${OPTARG#*=}
|
||||
;;
|
||||
prefix=*)
|
||||
# remove prefix consisting of everything up to equal sign
|
||||
prefix=${OPTARG#*=}
|
||||
;;
|
||||
help)
|
||||
usage
|
||||
exit 0
|
||||
;;
|
||||
with-*)
|
||||
# get the name of the package; everything before equal sign
|
||||
pkgname=${OPTARG%=*}
|
||||
pkgname=${pkgname#with-}
|
||||
# get the location of the package; everyhing after equal sign
|
||||
test -n "${OPTARG#with-${pkgname}}" && pkgloc=${OPTARG#*=} || pkgloc=""
|
||||
# the parameter to this option is an executable program, so
|
||||
# skip the directory test in that case. if we match any of
|
||||
# these special options, then stop further processing (the
|
||||
# argument is not a directory anyway)
|
||||
case "${pkgname}" in
|
||||
cmake)
|
||||
CMAKE_COMMAND="${pkgloc}"
|
||||
continue
|
||||
;;
|
||||
buildname)
|
||||
buildname=" -DBUILDNAME=\"${pkgloc}\""
|
||||
continue
|
||||
;;
|
||||
site)
|
||||
site=" -DSITE=\"${pkgloc}\""
|
||||
continue
|
||||
;;
|
||||
esac
|
||||
# tilde expansion; quote safely before running eval on it
|
||||
eval pkgloc=$(printf "%q" "${pkgloc}")
|
||||
# expand to full path since CMake changes to source directory (!)
|
||||
# this also normalize the path name wrt. not having a trailing slash
|
||||
test -d "${pkgloc}" && pkgloc=$(sh -c "cd \"${pkgloc}\"; pwd")
|
||||
# special aliases
|
||||
case "${pkgname}" in
|
||||
umfpack)
|
||||
pkgname="SuiteSparse"
|
||||
;;
|
||||
tinyxml)
|
||||
pkgname="TinyXML"
|
||||
;;
|
||||
esac
|
||||
# packages need different suffix for their root (sic)
|
||||
case "${pkgname}" in
|
||||
pch)
|
||||
pch_use=" -DPRECOMPILE_HEADERS:BOOL=ON"
|
||||
rootvar=""
|
||||
;;
|
||||
mpi |\
|
||||
mpi-prefix)
|
||||
# specifying path implies use of package
|
||||
use_mpi=" -DUSE_MPI=ON"
|
||||
# only set prefix if specified, i.e. setting doubles as flag
|
||||
test -n "${pkgloc}" && rootvar="_MPI_PREFIX_PATH" || rootvar=""
|
||||
;;
|
||||
boost)
|
||||
# special handling of this package, see further below
|
||||
boost_root="${pkgloc}"
|
||||
rootvar=""
|
||||
;;
|
||||
boost-libdir)
|
||||
boost_libdir="${pkgloc}"
|
||||
rootvar=""
|
||||
;;
|
||||
alugrid |\
|
||||
eigen3 |\
|
||||
ert |\
|
||||
metis |\
|
||||
superlu |\
|
||||
SuiteSparse |\
|
||||
TinyXML |\
|
||||
ug |\
|
||||
opm |\
|
||||
opm-* |\
|
||||
dune |\
|
||||
dune-* |\
|
||||
zoltan |\
|
||||
zlib)
|
||||
rootvar="$(uppercase ${pkgname})_ROOT"
|
||||
rootvar="${rootvar/-/_}"
|
||||
;;
|
||||
*)
|
||||
invalid_opt --with-${pkgname}
|
||||
rootvar=""
|
||||
;;
|
||||
esac
|
||||
# add this to the list of existing features
|
||||
test -n "${rootvar}" && \
|
||||
FEATURES="${FEATURES} \"-D${rootvar}=${pkgloc}\""
|
||||
;;
|
||||
without-* | \
|
||||
disable-*)
|
||||
# get the name of the package
|
||||
pkgname=$OPTARG
|
||||
pkgname=${pkgname#disable-}
|
||||
pkgname=${pkgname#without-}
|
||||
# casing is of course different
|
||||
case "${pkgname}" in
|
||||
option-checking)
|
||||
option_check=no
|
||||
# special flag: don't disable any particular package
|
||||
pkgname=""
|
||||
;;
|
||||
debug)
|
||||
buildtype=" -DCMAKE_BUILD_TYPE=Release"
|
||||
# special flag: don't disable any particular package
|
||||
pkgname=""
|
||||
;;
|
||||
pch)
|
||||
pch_use=" -DPRECOMPILE_HEADERS:BOOL=OFF"
|
||||
pkgname=""
|
||||
;;
|
||||
runpath)
|
||||
use_runpath=" -DUSE_RUNPATH=OFF"
|
||||
pkgname=""
|
||||
;;
|
||||
silent-rules)
|
||||
silent_rules=" -DCMAKE_VERBOSE_MAKEFILE=ON"
|
||||
pkgname=""
|
||||
;;
|
||||
system-debug)
|
||||
debug_loc=" -DSYSTEM_DEBUG=OFF"
|
||||
pkgname=""
|
||||
;;
|
||||
wpo |\
|
||||
lto )
|
||||
use_lto=" -DWHOLE_PROG_OPTIM=OFF"
|
||||
pkgname=""
|
||||
;;
|
||||
strip-debug )
|
||||
strip_debug=" -DSTRIP_DEBUGGING_SYMBOLS=OFF"
|
||||
pkgname=""
|
||||
;;
|
||||
openmp)
|
||||
use_openmp=" -DUSE_OPENMP=OFF"
|
||||
pkgname=""
|
||||
;;
|
||||
mpi | \
|
||||
parallel)
|
||||
use_mpi=" -DUSE_MPI=OFF"
|
||||
pkgname=""
|
||||
;;
|
||||
tests)
|
||||
use_tests=" -DBUILD_TESTING=OFF"
|
||||
pkgname=""
|
||||
;;
|
||||
examples)
|
||||
use_samples=" -DBUILD_EXAMPLES=OFF"
|
||||
pkgname=""
|
||||
;;
|
||||
ninja)
|
||||
# just for symmetry with the --enable-ninja option
|
||||
use_ninja=""
|
||||
pkgname=""
|
||||
;;
|
||||
ert |\
|
||||
superlu)
|
||||
pkgname="$(uppercase ${pkgname})"
|
||||
;;
|
||||
openmp)
|
||||
pkgname="OpenMP"
|
||||
;;
|
||||
gxx11check)
|
||||
pkgname="CXX11Features"
|
||||
;;
|
||||
umfpack)
|
||||
pkgname="SuiteSparse"
|
||||
;;
|
||||
tinyxml)
|
||||
pkgname="TinyXML"
|
||||
;;
|
||||
*)
|
||||
invalid_opt --disable-${pkgname}
|
||||
pkgname=""
|
||||
;;
|
||||
esac
|
||||
# only disable packages if the flag refers to a proper one
|
||||
test -n "${pkgname}" && \
|
||||
FEATURES="${FEATURES} -DCMAKE_DISABLE_FIND_PACKAGE_${pkgname}=TRUE"
|
||||
;;
|
||||
enable-*)
|
||||
# what kind of library are we building; shared or static?
|
||||
kind=${OPTARG#enable-}
|
||||
case "${kind}" in
|
||||
system-debug)
|
||||
debug_loc=" -DSYSTEM_DEBUG=ON"
|
||||
# special flag; don't set shared/static
|
||||
shared=""
|
||||
;;
|
||||
openmp)
|
||||
use_openmp=" -DUSE_OPENMP=ON"
|
||||
# special flag; don't set shared/static
|
||||
shared=""
|
||||
;;
|
||||
mpi | \
|
||||
parallel)
|
||||
use_mpi=" -DUSE_MPI=ON"
|
||||
# special flag; don't set shared/static
|
||||
shared=""
|
||||
;;
|
||||
debug)
|
||||
buildtype=" -DCMAKE_BUILD_TYPE=Debug"
|
||||
shared=""
|
||||
;;
|
||||
pch)
|
||||
pch_use=" -DPRECOMPILE_HEADERS:BOOL=ON"
|
||||
shared=""
|
||||
;;
|
||||
runpath)
|
||||
use_runpath=" -DUSE_RUNPATH=ON"
|
||||
shared=""
|
||||
;;
|
||||
lto)
|
||||
use_lto=" -DWHOLE_PROG_OPTIM=ON"
|
||||
shared=""
|
||||
;;
|
||||
strip-debug )
|
||||
strip_debug=" -DSTRIP_DEBUGGING_SYMBOLS=ON"
|
||||
pkgname=""
|
||||
;;
|
||||
tests)
|
||||
use_tests=" -DBUILD_TESTING=ON"
|
||||
pkgname=""
|
||||
;;
|
||||
examples)
|
||||
use_samples=" -DBUILD_EXAMPLES=ON"
|
||||
pkgname=""
|
||||
;;
|
||||
underscoring)
|
||||
use_underscoring=" -DUSE_UNDERSCORING=ON"
|
||||
pkgname=""
|
||||
;;
|
||||
ninja)
|
||||
# Ninja doesn't support using the Fortran compiler, so
|
||||
# we'll have to resort to making this assumption
|
||||
use_underscoring=" -DUSE_UNDERSCORING=ON"
|
||||
use_ninja="-GNinja "
|
||||
pkgname=""
|
||||
;;
|
||||
# this flag is just for compatibility with the deprecation
|
||||
# flag in DUNE, so we can build without warnings
|
||||
fieldvector-size-is-method)
|
||||
shared=""
|
||||
;;
|
||||
shared)
|
||||
shared="ON"
|
||||
;;
|
||||
static)
|
||||
shared="OFF"
|
||||
;;
|
||||
*)
|
||||
invalid_opt "--enable-${kind}"
|
||||
shared=""
|
||||
;;
|
||||
esac
|
||||
test -n "${shared}" && \
|
||||
FEATURES="${FEATURES} -DBUILD_SHARED_LIBS:BOOL=${shared}"
|
||||
# once we have added this, reset so we don't add again for next opt
|
||||
shared=""
|
||||
;;
|
||||
*)
|
||||
# remove everything *after* the equal sign
|
||||
arg=${OPTARG%=*}
|
||||
invalid_arg "--$arg"
|
||||
exit 1
|
||||
;;
|
||||
esac
|
||||
;;
|
||||
[A-Za-z0-9_]*=*)
|
||||
# collect for further processing later
|
||||
VARS+=("$OPT")
|
||||
;;
|
||||
*)
|
||||
invalid_arg "$OPT"
|
||||
exit 1
|
||||
;;
|
||||
esac
|
||||
done
|
||||
# remove all arguments processed by getopts
|
||||
shift $((OPTIND-1))
|
||||
|
||||
# special handling of Boost: if --with-boost-libdir has been used,
|
||||
# then the --with-boost turns into specifying the header directory
|
||||
# and not the search root. this mirrors the functionality in the
|
||||
# Autotools ax_boost_base.m4. necessary because FindBoost in CMake
|
||||
# uses two different variables if you want to specify them separately
|
||||
if [ -n "${boost_libdir}" ]; then
|
||||
boost_opts=" -DBOOST_LIBRARYDIR=\"${boost_libdir}\""
|
||||
if [ -n "${boost_root}" ]; then
|
||||
boost_opts="${boost_opts} -DBOOST_INCLUDEDIR=\"${boost_root}\""
|
||||
fi
|
||||
else
|
||||
if [ -n "${boost_root}" ]; then
|
||||
boost_opts=" -DBOOST_ROOT=\"${boost_root}\""
|
||||
else
|
||||
boost_opts=""
|
||||
fi
|
||||
fi
|
||||
|
||||
# notice the usage of a quoted array: each element will be returned
|
||||
# even with spaces.
|
||||
for a in "${VARS[@]}"; do
|
||||
case "$a" in
|
||||
ACLOCAL_*=*)
|
||||
# remove Autotools-specific variables.
|
||||
;;
|
||||
CC=*)
|
||||
# special processing for compiler options
|
||||
a=${a#CC=}
|
||||
[ -x "$(command -v "$a")" ] && a=$(command -v "$a")
|
||||
c_compiler=" -DCMAKE_C_COMPILER=\"${a/\"/\\\"}\""
|
||||
;;
|
||||
CXX=*)
|
||||
a=${a#CXX=}
|
||||
[ -x "$(command -v "$a")" ] && a=$(command -v "$a")
|
||||
cxx_compiler=" -DCMAKE_CXX_COMPILER=\"${a/\"/\\\"}\""
|
||||
;;
|
||||
CFLAGS=*)
|
||||
a=${a#CFLAGS=}
|
||||
c_opts=" -DCMAKE_BUILD_TYPE=Custom -DCMAKE_C_FLAGS=\"${a/\"/\\\"}\""
|
||||
;;
|
||||
CXXFLAGS=*)
|
||||
a=${a#CXXFLAGS=}
|
||||
cxx_opts=" -DCMAKE_BUILD_TYPE=Custom -DCMAKE_CXX_FLAGS=\"${a/\"/\\\"}\""
|
||||
;;
|
||||
FC=*)
|
||||
a=${a#FC=}
|
||||
[ -x "$(command -v "$a")" ] && a=$(command -v "$a")
|
||||
fort_compiler=" -DCMAKE_Fortran_COMPILER=\"${a/\"/\\\"}\""
|
||||
;;
|
||||
FFLAGS=*)
|
||||
a=${a#FFLAGS=}
|
||||
fort_opts=" -DCMAKE_BUILD_TYPE=Custom -DCMAKE_Fortran_FLAGS=\"${a/\"/\\\"}\""
|
||||
;;
|
||||
*)
|
||||
ENVVARS="$ENVVARS \"${a/\"/\\\"}\""
|
||||
;;
|
||||
esac
|
||||
done
|
||||
|
||||
# only wrap in env command if any variable were actually passed
|
||||
[ -n "${ENVVARS}" ] && ENVVARS="env ${ENVVARS} "
|
||||
|
||||
# delete the previous 'CMakeFiles' directory. this prevents an endless
|
||||
# loop if variables that require a full regeneration of the cache are
|
||||
# set (most notably 'CXX' and 'CXX_FLAGS').
|
||||
# For more details, see http://www.cmake.org/Bug/view.php?id=14119
|
||||
if test "$config_cache" = ""; then
|
||||
echo "--- deleting previous CMake files ---"
|
||||
rm -rf CMakeFiles
|
||||
rm -f CMakeCache.txt
|
||||
elif test "$c_compiler$c_opts$cxx_compiler$cxx_opts$fort_compiler$fort_opts" != ""; then
|
||||
echo "--- WARNING '--config-cache' option specified but a compiler was set"
|
||||
echo "--- from the command line. This may lead to an infinite loop!"
|
||||
fi
|
||||
|
||||
# pass everything on to CMake
|
||||
CMDLINE="${ENVVARS}${CMAKE_COMMAND} \"${srcdir}\" ${use_ninja}\"-DCMAKE_INSTALL_PREFIX=$prefix\" -DSIBLING_SEARCH=OFF${buildtype}${pch_use}${silent_rules}${debug_loc}${use_openmp}${use_mpi}${use_lto}${strip_debug}${use_runpath}${use_tests}${use_samples}${use_underscoring}${c_compiler}${c_opts}${cxx_compiler}${cxx_opts}${fort_compiler}${fort_opts}${boost_opts}${buildname}${site} ${FEATURES}"
|
||||
echo --- calling CMake ---
|
||||
echo "${CMDLINE}"
|
||||
eval exec "${CMDLINE}"
|
||||
@@ -1,30 +0,0 @@
|
||||
#!/bin/bash
|
||||
|
||||
# This script performs a single analysis using cppcheck
|
||||
# It is used by the 'make test' target in the buildsystems
|
||||
# Usually you should use 'ctest -C cppcheck' rather than calling this script directly
|
||||
#
|
||||
# Parameters: $1 = Application binary
|
||||
# $2 = Source file to process
|
||||
# $3..$N = include path parameters (-I dir1 -I dir2 ...)
|
||||
|
||||
cppcheck_cmd=$1
|
||||
source_file=$2
|
||||
shift 2
|
||||
|
||||
tmpfil=`mktemp`
|
||||
$cppcheck_cmd $@ --enable=all --suppress=unusedFunction $source_file &> $tmpfil
|
||||
nmatch=`cat $tmpfil | grep "\[.*\]" | wc -l`
|
||||
nsys=`cat $tmpfil | grep "\[/usr.*\]" | wc -l`
|
||||
nnone=`cat $tmpfil | grep "\[\\*]" | wc -l`
|
||||
ndef=`cat $tmpfil | grep "\[.*Too many #ifdef" | wc -l`
|
||||
let "nval=$nmatch-$nsys-$nnone-$ndef"
|
||||
if test $nval -gt 0
|
||||
then
|
||||
cat $tmpfil
|
||||
rm $tmpfil
|
||||
exit 1
|
||||
fi
|
||||
|
||||
rm $tmpfil
|
||||
exit 0
|
||||
@@ -19,92 +19,51 @@
|
||||
|
||||
# <http://www.vtk.org/Wiki/CMake/Tutorials/How_to_create_a_ProjectConfig.cmake_file>
|
||||
|
||||
# Prevent multiple inclusions
|
||||
if(NOT @opm-project_NAME@_FOUND)
|
||||
# propagate these properties from one build system to the other
|
||||
set (@opm-project_NAME@_PREFIX "@DUNE_PREFIX@")
|
||||
set (@opm-project_NAME@_VERSION "@opm-project_VERSION@")
|
||||
set (@opm-project_NAME@_DEFINITIONS "@opm-project_DEFINITIONS@")
|
||||
set (@opm-project_NAME@_INCLUDE_DIRS "@opm-project_INCLUDE_DIRS@")
|
||||
set (@opm-project_NAME@_LIBRARY_DIRS "@opm-project_LIBRARY_DIRS@" "@CMAKE_LIBRARY_OUTPUT_DIRECTORY@")
|
||||
set (@opm-project_NAME@_LINKER_FLAGS "@opm-project_LINKER_FLAGS@")
|
||||
set (@opm-project_NAME@_CONFIG_VARS "@opm-project_CONFIG_VARS@")
|
||||
# propagate these properties from one build system to the other
|
||||
set (@opm-project_NAME@_VERSION "@opm-project_VERSION@")
|
||||
set (@opm-project_NAME@_DEFINITIONS "@opm-project_DEFINITIONS@")
|
||||
set (@opm-project_NAME@_INCLUDE_DIRS "@opm-project_INCLUDE_DIRS@")
|
||||
set (@opm-project_NAME@_LIBRARY_DIRS "@CMAKE_LIBRARY_OUTPUT_DIRECTORY@")
|
||||
set (@opm-project_NAME@_LINKER_FLAGS "@opm-project_LINKER_FLAGS@")
|
||||
set (@opm-project_NAME@_CONFIG_VARS "@opm-project_CONFIG_VARS@")
|
||||
|
||||
# libraries come from the build tree where this file was generated
|
||||
set (@opm-project_NAME@_LIBRARY "@opm-project_LIBRARY@")
|
||||
set (@opm-project_NAME@_LIBRARIES ${@opm-project_NAME@_LIBRARY} "@opm-project_LIBRARIES@")
|
||||
# libraries come from the build tree where this file was generated
|
||||
set (@opm-project_NAME@_LIBRARY "@opm-project_LIBRARY@")
|
||||
set (@opm-project_NAME@_LIBRARIES ${@opm-project_NAME@_LIBRARY} "@opm-project_LIBRARIES@")
|
||||
mark_as_advanced (@opm-project_NAME@_LIBRARY)
|
||||
|
||||
# The purpose of this string replacement operation is to enable use of the
|
||||
# generated opm-project-config.cmake file also in the situation where 'make
|
||||
# install' has been invoked with the DESTDIR option:
|
||||
#
|
||||
# opm-common/build> cmake .. -DCMAKE_INSTALL_PREFIX=/real/prefix
|
||||
# opm-common/budil> make install DESTDIR=/tmp/prefix
|
||||
#
|
||||
# downstream/build> cmake .. -DDEST_PREFIX=/tmp/prefix -DCMAKE_PREFIX_PATH=/tmp/prefix
|
||||
# downstream/build> make install
|
||||
#
|
||||
# That way the downstream dependency can still use find_package( opm-common )
|
||||
# even though the opm-common-config.cmake file is not internally consistent
|
||||
# with it's own location in the filesystem.
|
||||
# not all projects have targets; conditionally add this part
|
||||
if (NOT "@opm-project_TARGET@" STREQUAL "")
|
||||
# add the library as a target, so that other things in the project including
|
||||
# this file may depend on it and get rebuild if this library changes.
|
||||
add_library (@opm-project_TARGET@ UNKNOWN IMPORTED)
|
||||
set_property (TARGET @opm-project_TARGET@ PROPERTY IMPORTED_LOCATION "${@opm-project_NAME@_LIBRARY}")
|
||||
endif (NOT "@opm-project_TARGET@" STREQUAL "")
|
||||
|
||||
if(DEST_PREFIX)
|
||||
set(DEST_PREFIX "${DEST_PREFIX}${@opm-project_NAME@_PREFIX}")
|
||||
string(REPLACE ${@opm-project_NAME@_PREFIX} ${DEST_PREFIX} @opm-project_NAME@_INCLUDE_DIRS "${@opm-project_NAME@_INCLUDE_DIRS}")
|
||||
string(REPLACE ${@opm-project_NAME@_PREFIX} ${DEST_PREFIX} @opm-project_NAME@_LIBRARY_DIRS "${@opm-project_NAME@_LIBRARY_DIRS}")
|
||||
string(REPLACE ${@opm-project_NAME@_PREFIX} ${DEST_PREFIX} @opm-project_NAME@_LIBRARY "${@opm-project_NAME@_LIBRARY}")
|
||||
endif()
|
||||
# ensure that we build with support for C++11 to preserve ABI
|
||||
string (REPLACE "@CXX_STD0X_FLAGS@" "" CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS}")
|
||||
string (REPLACE "@CXX_STDLIB_FLAGS@" "" CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS}")
|
||||
string (STRIP "${CMAKE_CXX_FLAGS}" CMAKE_CXX_FLAGS)
|
||||
set (CMAKE_CXX_FLAGS "@CXX_STD0X_FLAGS@@CXX_SPACE@@CXX_STDLIB_FLAGS@ ${CMAKE_CXX_FLAGS}")
|
||||
|
||||
# same as above, but for C99
|
||||
string (REPLACE "@C_STD99_FLAGS@" "" CMAKE_C_FLAGS "${CMAKE_C_FLAGS}")
|
||||
string (STRIP "${CMAKE_C_FLAGS}" CMAKE_C_FLAGS)
|
||||
set (CMAKE_C_FLAG "@C_STD99_FLAGS@ ${CMAKE_C_FLAGS}")
|
||||
|
||||
set (HAVE_@opm-project_NAME_UC@ 1)
|
||||
mark_as_advanced (@opm-project_NAME@_LIBRARY)
|
||||
|
||||
# not all projects have targets; conditionally add this part
|
||||
if (NOT "@opm-project_TARGET@" STREQUAL "")
|
||||
# add the library as a target, so that other things in the project including
|
||||
# this file may depend on it and get rebuild if this library changes.
|
||||
if(NOT TARGET @opm-project_TARGET@)
|
||||
get_filename_component(_dir "${CMAKE_CURRENT_LIST_FILE}" PATH)
|
||||
include("${_dir}/@opm-project_NAME@-targets.cmake")
|
||||
endif()
|
||||
endif (NOT "@opm-project_TARGET@" STREQUAL "")
|
||||
|
||||
# ensure that we build with support for C++11 to preserve ABI
|
||||
string (REPLACE "@CXX_STD0X_FLAGS@" "" CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS}")
|
||||
string (REPLACE "@CXX_STDLIB_FLAGS@" "" CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS}")
|
||||
string (STRIP "${CMAKE_CXX_FLAGS}" CMAKE_CXX_FLAGS)
|
||||
set (CMAKE_CXX_FLAGS "@CXX_STD0X_FLAGS@@CXX_SPACE@@CXX_STDLIB_FLAGS@ ${CMAKE_CXX_FLAGS}")
|
||||
|
||||
# same as above, but for C99
|
||||
string (REPLACE "@C_STD99_FLAGS@" "" CMAKE_C_FLAGS "${CMAKE_C_FLAGS}")
|
||||
# build with OpenMP if that was found
|
||||
if (NOT "@OpenMP_C_FLAGS@" STREQUAL "")
|
||||
string (REPLACE "@OpenMP_C_FLAGS@" "" CMAKE_C_FLAGS "${CMAKE_C_FLAGS}")
|
||||
string (STRIP "${CMAKE_C_FLAGS}" CMAKE_C_FLAGS)
|
||||
set (CMAKE_C_FLAG "@C_STD99_FLAGS@ ${CMAKE_C_FLAGS}")
|
||||
set (CMAKE_C_FLAG "@OpenMP_C_FLAGS@ ${CMAKE_C_FLAGS}")
|
||||
endif (NOT "@OpenMP_C_FLAGS@" STREQUAL "")
|
||||
if (NOT "@OpenMP_CXX_FLAGS@" STREQUAL "")
|
||||
string (REPLACE "@OpenMP_CXX_FLAGS@" "" CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS}")
|
||||
string (STRIP "${CMAKE_CXX_FLAGS}" CMAKE_CXX_FLAGS)
|
||||
set (CMAKE_C_FLAG "@OpenMP_CXX_FLAGS@ ${CMAKE_CXX_FLAGS}")
|
||||
endif (NOT "@OpenMP_CXX_FLAGS@" STREQUAL "")
|
||||
|
||||
# build with OpenMP if that was found
|
||||
if (NOT "@OpenMP_C_FLAGS@" STREQUAL "")
|
||||
string (REPLACE "@OpenMP_C_FLAGS@" "" CMAKE_C_FLAGS "${CMAKE_C_FLAGS}")
|
||||
string (STRIP "${CMAKE_C_FLAGS}" CMAKE_C_FLAGS)
|
||||
set (CMAKE_C_FLAG "@OpenMP_C_FLAGS@ ${CMAKE_C_FLAGS}")
|
||||
endif (NOT "@OpenMP_C_FLAGS@" STREQUAL "")
|
||||
if (NOT "@OpenMP_CXX_FLAGS@" STREQUAL "")
|
||||
string (REPLACE "@OpenMP_CXX_FLAGS@" "" CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS}")
|
||||
string (STRIP "${CMAKE_CXX_FLAGS}" CMAKE_CXX_FLAGS)
|
||||
set (CMAKE_C_FLAG "@OpenMP_CXX_FLAGS@ ${CMAKE_CXX_FLAGS}")
|
||||
endif (NOT "@OpenMP_CXX_FLAGS@" STREQUAL "")
|
||||
# this is the contents of config.h as far as our probes can tell:
|
||||
|
||||
# this is the contents of config.h as far as our probes can tell:
|
||||
|
||||
|
||||
# The settings in this block do not mix well with the DEST_PREFIX
|
||||
# setting.
|
||||
if (NOT DEST_PREFIX)
|
||||
# This is required to include OpmPackage
|
||||
set(CMAKE_MODULE_PATH "${CMAKE_MODULE_PATH}" @PREREQ_LOCATION@)
|
||||
|
||||
# extra code from variable OPM_PROJECT_EXTRA_CODE
|
||||
@OPM_PROJECT_EXTRA_CODE@
|
||||
# end extra code
|
||||
|
||||
include(@opm-project_NAME@-prereqs)
|
||||
endif()
|
||||
endif()
|
||||
# extra code
|
||||
@OPM_PROJECT_EXTRA_CODE@
|
||||
|
||||
42
configure
vendored
Executable file
42
configure
vendored
Executable file
@@ -0,0 +1,42 @@
|
||||
#!/bin/sh
|
||||
# this file is supposed to be located in the source directory
|
||||
src_dir=$(dirname $0)
|
||||
|
||||
# scan the arguments and set this if build macros could be specified
|
||||
mod_dir=
|
||||
for OPT in "$@"; do
|
||||
case "$OPT" in
|
||||
--with-opm-common=*)
|
||||
# remove everything before equal sign and assign the rest
|
||||
mod_dir=${OPT#*=}
|
||||
# tilde expansion; note that doing eval may have side effects
|
||||
mod_dir=$(eval echo $mod_dir)
|
||||
# absolute path
|
||||
[ -d "$mod_dir" ] && mod_dir=$(cd $mod_dir ; pwd)
|
||||
;;
|
||||
esac
|
||||
done
|
||||
|
||||
# special work around the fact that dunecontrol does not specify
|
||||
# --with-$MODULE for the module it attempts to build
|
||||
ADDITIONAL_PARAMS=""
|
||||
if test -z "$mod_dir"; then
|
||||
ADDITIONAL_PARAMS="--with-opm-common=\"$(pwd)\""
|
||||
fi
|
||||
|
||||
# if it isn't specified, the look around in other known places
|
||||
conf_file=cmake/Scripts/configure
|
||||
if [ -z "$mod_dir" ]; then
|
||||
if [ -r "$src_dir/$conf_file" ]; then
|
||||
mod_dir="$src_dir"
|
||||
fi
|
||||
fi
|
||||
|
||||
# terminate with error message here if the module directory is not found
|
||||
if [ ! -r "$mod_dir/$conf_file" ]; then
|
||||
echo Build macros not located in \"$mod_dir\", use --with-opm-common= to specify! 1>&2
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# forward to the corresponding script in the cmake/Scripts/ directory
|
||||
exec "$mod_dir/$conf_file" --src-dir="$src_dir" "$@" $ADDITIONAL_PARAMS
|
||||
8
debian/changelog
vendored
8
debian/changelog
vendored
@@ -1,4 +1,10 @@
|
||||
opm-common (2019.04-pre~xenial) xenial; urgency=medium
|
||||
opm-common (2016.10-rc1-1~xenial) xenial; urgency=medium
|
||||
|
||||
* New release
|
||||
|
||||
-- Arne Morten Kvarving <arne.morten.kvarving@sintef.no> Wed, 26 Oct 2016 09:55:11 +0200
|
||||
|
||||
opm-common (2015.10-1~trusty) trusty; urgency=medium
|
||||
|
||||
* New release
|
||||
|
||||
|
||||
4
debian/control
vendored
4
debian/control
vendored
@@ -4,9 +4,7 @@ Maintainer: Arne Morten Kvarving <arne.morten.kvarving@sintef.no>
|
||||
Build-Depends: build-essential, debhelper (>= 9),
|
||||
pkg-config, cmake, git, libtool, doxygen,
|
||||
texlive-latex-extra, texlive-latex-recommended,
|
||||
ghostscript, libboost-system-dev, libboost-test-dev,
|
||||
libecl-dev, libboost-regex-dev, libboost-filesystem-dev,
|
||||
zlib1g-dev
|
||||
ghostscript, libboost-system-dev, libboost-test-dev
|
||||
Standards-Version: 3.9.2
|
||||
Section: libs
|
||||
Homepage: http://opm-project.org
|
||||
|
||||
2
debian/rules
vendored
2
debian/rules
vendored
@@ -20,7 +20,7 @@ override_dh_auto_build:
|
||||
|
||||
# consider using -DUSE_VERSIONED_DIR=ON if backporting
|
||||
override_dh_auto_configure:
|
||||
dh_auto_configure --buildsystem=cmake -- -DCMAKE_BUILD_TYPE=RelWithDebInfo -DSTRIP_DEBUGGING_SYMBOLS=ON -DBUILD_SHARED_LIBS=1 -DCMAKE_INSTALL_DOCDIR=share/doc/libopm-common1 -DWHOLE_PROG_OPTIM=ON -DUSE_RUNPATH=OFF -DWITH_NATIVE=OFF
|
||||
dh_auto_configure --buildsystem=cmake -- -DCMAKE_BUILD_TYPE=RelWithDebInfo -DSTRIP_DEBUGGING_SYMBOLS=ON -DBUILD_SHARED_LIBS=1 -DCMAKE_INSTALL_DOCDIR=share/doc/libopm-common1 -DWHOLE_PROG_OPTIM=ON -DUSE_RUNPATH=OFF
|
||||
|
||||
override_dh_auto_install:
|
||||
dh_auto_install -- install-html
|
||||
|
||||
@@ -1,336 +0,0 @@
|
||||
Keywords is the most important aspect of the ECLIPSE datafile
|
||||
parser.
|
||||
|
||||
1. The structure of a keyword
|
||||
-----------------------------
|
||||
|
||||
A keyword is the fundamental unit when parsing. Keywords are added to
|
||||
the parser by schema definitions. The schema definition of the keywords
|
||||
are given as Json files under the opm/share/keywords directory. Json
|
||||
can be thought of as a lean alternative to XML, you will find it described
|
||||
here: http://www.json.org/
|
||||
As part of the build process these keyword definitions are compiled
|
||||
to ParserKeyword instances.
|
||||
|
||||
|
||||
1.1 Starting a keyword
|
||||
----------------------
|
||||
The keywords are defined as follows:
|
||||
|
||||
1. The keyword should start in column 0; everything beyond character
|
||||
8 is ignored.
|
||||
|
||||
2. The keyword should start with a alphabet character, subsequent
|
||||
characters should be alphanumeric or in the set [-,_,+].
|
||||
|
||||
3. We think ECLIPSE is case insensitive.
|
||||
|
||||
This is cehcked by the static method:
|
||||
ParserKeyword::validDeckName(). An important part of the parsing of
|
||||
keywords is to detect when the keyword specification is complete. For
|
||||
most keywords we can detect that either by a terminating '/' or the
|
||||
keywords have a predefined size, but for some odd keywords we can not
|
||||
reliably detect the end-of-keyword condition and instead we terminate
|
||||
keyword1 when we find a string which corresponds to the start of a new
|
||||
keyword. Examples of such oddball keywords include: VFPPROD and
|
||||
VFPINJ.
|
||||
|
||||
|
||||
1.2 Records
|
||||
-----------
|
||||
|
||||
The data content of a keyword comes as a collection of
|
||||
records. Records are a collection of 'data', terminated by a '/'. Here
|
||||
are three examples of records:
|
||||
|
||||
'METRES' /
|
||||
|
||||
1 'OFF' 100 '*' 24.0 /
|
||||
|
||||
0.26 0.27 0.26 0.78
|
||||
0.82 0.66 0.27 0.78
|
||||
0.76 0.56 0.23 0.67 /
|
||||
|
||||
From these examples we see that:
|
||||
|
||||
1. One record can contain a mix of integer, float and string values.
|
||||
2. Records typically correspond to one line in the data-file, but
|
||||
that is purely convention; the records can be sprinkled with
|
||||
newlines.
|
||||
3. Each record is terminated with a '/'
|
||||
|
||||
|
||||
1.3 How many records in a keyword
|
||||
---------------------------------
|
||||
|
||||
One of the first structural elements which must be configured into the
|
||||
the parser keywords is the number of records in the different
|
||||
keywords, this is closely related to how the keyboard is
|
||||
terminated. Here comes some typical examples of keywords:
|
||||
|
||||
|
||||
GRID
|
||||
|
||||
|
||||
WCONHIST
|
||||
... /
|
||||
... /
|
||||
... /
|
||||
/
|
||||
|
||||
---\
|
||||
EQLDIMS |
|
||||
.... / |
|
||||
|
|
||||
EQUIL |
|
||||
.... / |
|
||||
.... / |
|
||||
---/
|
||||
|
||||
VFPPROD
|
||||
A .. /
|
||||
B... /
|
||||
.... /
|
||||
.... /
|
||||
|
||||
|
||||
PVGO
|
||||
/
|
||||
/
|
||||
|
||||
|
||||
In the list above here the GRID keyword has zero records, i.e. no data
|
||||
at all. The WCONHIST keyword has three records of data, the EQLDIMS
|
||||
keyword has one record, the EQUIL keyword has two records and finally
|
||||
the VFPPROD keyword has four records. The number of records, or how to
|
||||
infer it, must be configured with the "size" attribute in the JSON
|
||||
configuration. When it comes to the number of records and termination
|
||||
we currently have five different categories:
|
||||
|
||||
1. Keywords with a fixed number of records. Both the GRID keyword
|
||||
and the EQLDIMS keyword have a fixed number of records, zero and
|
||||
one respectively. These keywords are therefor not explicitly
|
||||
terminated in any way, and the "size" attribute has the numerical
|
||||
explicitly:
|
||||
|
||||
{"name" : "EQLDIMS" , "size" : 1 , ....}
|
||||
{"name" : "GRID" , "size" : 0, .... }
|
||||
|
||||
|
||||
2. Keywords with a variable number of records like the
|
||||
WCONHIST. Becase the number of records is not known in advance
|
||||
this keyword must be explicitly terminated with a '/'. This is
|
||||
the most common configuration and for keywords of this type it is
|
||||
not necessary to specify a size attribute at all:
|
||||
|
||||
{"name" : "WCONHIST" , .... }
|
||||
|
||||
|
||||
3. Keywords where the number of records is inferred from the content
|
||||
of another keyword; this is the case with EQUIL which reads the
|
||||
number of records from the xxx item of the EQLDIMS keyword. Since
|
||||
the number of records is known in advance (indirectly through the
|
||||
EQLDIMS keyword) the EQUIL keyword is not explicitly terminated
|
||||
with a '/'. In the json file this is specified with the "size"
|
||||
attribute being an object containing the name and item of keyword
|
||||
which should be consulted to infer the size; so for the EQUIL
|
||||
keyword the size attribute looks like:
|
||||
|
||||
{"name" : "EQUIL" ,
|
||||
"size" : {"keyword" : "EQLDIMS" , "item" : "NTEQUL"} , ...
|
||||
|
||||
When parsing the EQUIL keyword the parser will consult the
|
||||
already parsed content of the 'EQLDIMS' keyword (i.e. a
|
||||
DeckKeyword instance) and get the numerical value of the 'NTEQUL'
|
||||
item.
|
||||
|
||||
|
||||
4. For some keywords the number of records should be calculated
|
||||
run-time based based on the content of the first records in the
|
||||
keyword - this at least applies to VFPPROD and VFPINJ. Since the
|
||||
size of the keyword is deterministic - given the first few
|
||||
records - the keyword is not slash terminated.
|
||||
|
||||
To infer the number of records in the keyword based on an
|
||||
internal calculation is not supported, hence for these keywords
|
||||
size is given as unkown, and the keywords are terminated when the
|
||||
next valid keyword is found:
|
||||
|
||||
{"name" : "VFPPROD" , "size" : "UNKNOWN", ....
|
||||
|
||||
|
||||
|
||||
5. Tables PVTG and PVTO: The two tables PVTG and PVTO are special
|
||||
cased. The special casing should probably be removed, and the
|
||||
"size" : "UNKNOWN" could be used for these two keyword.
|
||||
|
||||
|
||||
|
||||
|
||||
1.4 The content of a record: items
|
||||
----------------------------------
|
||||
|
||||
A record consist of one or several items. An item can consist of one
|
||||
or several values from the record, for items with more than one value
|
||||
it is not possible to specify the exact number of values - the item
|
||||
will just consume the remaining values in the input stream. An item
|
||||
has a name, a data type and optionally a default value. For instance
|
||||
the WCONHIST keyword has the the following items specification:
|
||||
|
||||
"items":
|
||||
[{"name" : "WELL" , "value_type" : "STRING"},
|
||||
{"name" : "STATUS" , "value_type" : "STRING" , "default" : "OPEN"},
|
||||
{"name" : "CMODE" , "value_type" : "STRING"},
|
||||
{"name" : "ORAT" , "value_type" : "DOUBLE", "default" : 0.0, "dimension" : "LiquidSurfaceVolume/Time"},
|
||||
{"name" : "WRAT" , "value_type" : "DOUBLE" , "default" : 0.0, "dimension" : "LiquidSurfaceVolume/Time"},
|
||||
{"name" : "GRAT" , "value_type" : "DOUBLE" , "default" : 0.0, "dimension" : "GasSurfaceVolume/Time"},
|
||||
{"name" : "VFPTable" , "value_type" : "INT" , "default" : 0.0 , "comment":"The default is a state variable"},
|
||||
{"name" : "Lift" , "value_type" : "DOUBLE" , "default" : 0.0 , "comment":"The default is a state variable"},
|
||||
{"name" : "THP" , "value_type" : "DOUBLE" , "default" : 0.0 , "dimension" : "Pressure"},
|
||||
{"name" : "BHP" , "value_type" : "DOUBLE" , "default" : 0.0 ,"dimension" : "Pressure"},
|
||||
{"name" : "NGLRAT" , "value_type" : "DOUBLE" , "default" : 0.0 ,"dimension" : "LiquidSurfaceVolume/Time"}]}
|
||||
|
||||
Here we can see the following:
|
||||
|
||||
1. The items can be of types string, integer and float, the type is
|
||||
specified with the "value_type" attribute which must equal
|
||||
"STRING", "DOUBLE" or "INT".
|
||||
|
||||
2. You can optionally specify a default value, see the discussion of
|
||||
the parsing workflow below for the treatment of defaults.
|
||||
|
||||
3. For items of type double you can specify a dimension, see XXXX for
|
||||
the available dimensions. For quantities with a dimension the
|
||||
parser will convert to SI units, and the DeckDoubleItem class has
|
||||
a getSIDouble() and getRawDouble() method.
|
||||
|
||||
|
||||
Items consuming the rest of the record
|
||||
--------------------------------------
|
||||
|
||||
Most of the items will consume exactly one value from the input deck,
|
||||
but it is also possible that the last item consumes the remaining
|
||||
items in the input deck, these typically correspond to table keywords
|
||||
or lists of memnonics. In the input deck the PVTG keyword will
|
||||
typically appear like this:
|
||||
|
||||
PVTG
|
||||
200 0.15 0.15 10
|
||||
0.20 0.20 12
|
||||
0.25 0.20 15 /
|
||||
250 0.05 0.05 20
|
||||
0.15 0.10 40 /
|
||||
...
|
||||
|
||||
In the manual this is described as two tables with three columns, one
|
||||
with three rows and one with two rows. The leading values of 200 and
|
||||
250 are the pressure values where the two tables apply. The visual
|
||||
formatting in the deck, and also the written desciption in the manual,
|
||||
strongly hints at a table structure - however from a parsing point of
|
||||
view this corresponds to just two records of different length. Both
|
||||
records start with a pressure value, and then follows 3n consecutive
|
||||
values. The item configuration of PVTG looks like this:
|
||||
|
||||
"items" : [
|
||||
{"name":"GAS_PRESSURE", "value_type" : "DOUBLE", "dimension":"Pressure" },
|
||||
{"name":"DATA", "size_type" : "ALL" , "value_type":"DOUBLE" ,
|
||||
"dimension" : ["OilDissolutionFactor","OilDissolutionFactor","Viscosity"]}
|
||||
]
|
||||
|
||||
I.e. first we consume one value from the input deck and assign it to
|
||||
the GAS_PRESSURE item, then the DATA item has "size_type" : "ALL" -
|
||||
meaning that this item will consume the the rest of the values in the
|
||||
input record. Also observe that for the "DATA" item the dimension is a
|
||||
vector of three elements, when converting to SI the dimension applied
|
||||
to element i is given as:
|
||||
|
||||
dim[i] = dimension[i % 3]
|
||||
|
||||
In addition to tables the grid property keywords use items which
|
||||
consume the rest of the record. For instance the PORO keyword will
|
||||
typcially look like this in the input deck:
|
||||
|
||||
PORO
|
||||
0.14 0.15 0.0 0.10
|
||||
0.16 0.25 0.1 0.11
|
||||
0.14 0.15 0.0 0.09
|
||||
...
|
||||
0.21 0.07 0.1 0.13
|
||||
/
|
||||
|
||||
From a parsing point of view this is one single record; which contains
|
||||
one item consuming all of the values in the input deck. In the
|
||||
configuration this could have been configured as:
|
||||
|
||||
"items" : [{"name" : "DATA",
|
||||
"value_type" : "DOUBLE" ,
|
||||
"size_type" : "ALL" ,
|
||||
"default" : 0 ,
|
||||
"dimension" : "1"}]
|
||||
|
||||
However, since keywords containing large data arrays, like e.g. COORD
|
||||
and PERMX are quite common a shortcut has been created for such
|
||||
keywords, for instance the PORO keyword is configures as:
|
||||
|
||||
{"name" : "PORO" , "sections" : ["GRID"],
|
||||
"data" : {"value_type" : "DOUBLE" , "default" : 0 , "dimension":"1"}}
|
||||
|
||||
i.e. the "data" attribute is used as shorthand to configure a keyword
|
||||
with one record and one item which consumes all the data of the input
|
||||
deck.
|
||||
|
||||
|
||||
Multirecord keyword configuration
|
||||
---------------------------------
|
||||
|
||||
|
||||
Units and dimensions
|
||||
--------------------
|
||||
|
||||
The values given in the input dataset are generally dimensionfull, and
|
||||
before the simulator can start we must convert to internal SI values
|
||||
based on the unit system used in the input deck. In the input deck the
|
||||
different physical quantities are generally expressed with
|
||||
per-quantity units. The unit system is *not* based on selecting a unit
|
||||
for the fundamental dimensions length, mass and time and then deriving
|
||||
composite units based on the dimension of the composite quantity. As a
|
||||
consequence the list of dimensions supported by the parser is long,
|
||||
and growing. The current list can be found in the source file:
|
||||
|
||||
opm/parser/eclipse/Units/UnitSystem.cpp
|
||||
|
||||
|
||||
|
||||
Default values
|
||||
--------------
|
||||
|
||||
|
||||
|
||||
|
||||
Classes:
|
||||
--------
|
||||
|
||||
The library contains classes along two dimensions:
|
||||
|
||||
+----------------+ +----------------+ +----------------+
|
||||
| Parser | | RawDeck | | Deck |
|
||||
+----------------+ +----------------+ +----------------+
|
||||
|
||||
+----------------+ +----------------+ +----------------+
|
||||
| ParserKeyword | | Rawkeyword | | DeckKeyword |
|
||||
+----------------+ +----------------+ +----------------+
|
||||
|
||||
+----------------+ +----------------+ +----------------+
|
||||
| ParserRecord | | RawRecord | | DeckRecord |
|
||||
+----------------+ +----------------+ +----------------+
|
||||
|
||||
+----------------+ +----------------+
|
||||
| ParserItem | | DeckItem |
|
||||
+----------------+ +----------------+
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -5,9 +5,8 @@
|
||||
|
||||
Module: opm-common
|
||||
Description: Open Porous Media Initiative shared infrastructure
|
||||
Version: 2019.10-pre
|
||||
Label: 2019.10-pre
|
||||
Version: 2016.10
|
||||
Label: 2016.10
|
||||
Maintainer: opm@opm-project.org
|
||||
MaintainerName: OPM community
|
||||
Url: http://opm-project.org
|
||||
Depends: dune-common
|
||||
|
||||
@@ -1,60 +0,0 @@
|
||||
# this snippet enables parameter completion via the tabulator key
|
||||
# for bash for opm products.
|
||||
|
||||
# this is a bash readline completer for the case where a binary is
|
||||
# already known to be an eWoms simulator.
|
||||
_ewoms_parameter_completor()
|
||||
{
|
||||
if test "$COMP_WORDS" == ""; then
|
||||
return 0
|
||||
fi
|
||||
|
||||
cmd="${COMP_WORDS[0]}"
|
||||
cur="${COMP_WORDS[COMP_CWORD]}"
|
||||
fullcmd="$(which "$cmd" 2> /dev/null)"
|
||||
ALL_OPTS=$("$fullcmd" --help 2> /dev/null | grep '^ *--' | sed 's/ *\(--[a-zA-Z0-9\-]*\)=.*/\1=/')
|
||||
ALL_OPTS=$(echo "$ALL_OPTS" | sed 's/^ *--help.*/--help/')
|
||||
COMPREPLY=( $(compgen -A file -W "$ALL_OPTS" -- "${cur}") )
|
||||
}
|
||||
|
||||
# this is a bash readline default completer which attempts to find out
|
||||
# if a given binary is an eWoms simulation. this needs to be set as a
|
||||
# default completer because the name of eWoms binaries cannot be known
|
||||
# a-priori.
|
||||
_ewoms_generic_parameter_completor()
|
||||
{
|
||||
if test "$COMP_WORDS" == ""; then
|
||||
return 0
|
||||
fi
|
||||
|
||||
COMPREPLY=()
|
||||
local cmd cur ALL_OPTS
|
||||
cmd="${COMP_WORDS[0]}"
|
||||
cur="${COMP_WORDS[COMP_CWORD]}"
|
||||
|
||||
fullcmd="$(which "$cmd" 2> /dev/null)"
|
||||
if test -z "$fullcmd" || \
|
||||
! test -x "$fullcmd" || \
|
||||
(! test -f "$fullcmd" && ! test -h "$fullcmd" ) || \
|
||||
! test -r "$fullcmd" || \
|
||||
! grep -q "Ewoms[a-zA-Z0-9]*Simulator[a-zA-Z0-0]" "$fullcmd"
|
||||
then
|
||||
if test -n "$DEFAULT_COMPLETION_LOADER"; then
|
||||
"$DEFAULT_COMPLETION_LOADER" $@
|
||||
elif type -t _completion_loader 2>&1 > /dev/null; then
|
||||
# the default DEFAULT_COMPLETION_LOADER variable has not
|
||||
# been set and the _completion_loader function exists, so
|
||||
# we use _completion_loader as the default completer.
|
||||
_completion_loader $@
|
||||
else
|
||||
return 1
|
||||
fi
|
||||
|
||||
return $?
|
||||
fi
|
||||
|
||||
_ewoms_parameter_completor $@
|
||||
return 0
|
||||
}
|
||||
|
||||
complete -o nospace -F _ewoms_parameter_completor @PRODUCT@
|
||||
@@ -1,53 +0,0 @@
|
||||
/*
|
||||
Copyright 2013 Statoil ASA.
|
||||
|
||||
This file is part of the Open Porous Media project (OPM).
|
||||
|
||||
OPM 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.
|
||||
|
||||
OPM 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 for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with OPM. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#include <opm/output/eclipse/EclipseIO.hpp>
|
||||
|
||||
#include <opm/parser/eclipse/Parser/Parser.hpp>
|
||||
#include <opm/parser/eclipse/Parser/ParseContext.hpp>
|
||||
#include <opm/parser/eclipse/Parser/ErrorGuard.hpp>
|
||||
|
||||
#include <opm/parser/eclipse/EclipseState/EclipseState.hpp>
|
||||
#include <opm/parser/eclipse/EclipseState/Schedule/Schedule.hpp>
|
||||
#include <opm/parser/eclipse/EclipseState/SummaryConfig/SummaryConfig.hpp>
|
||||
|
||||
#include <opm/msim/msim.hpp>
|
||||
|
||||
|
||||
int main(int /* argc */, char** argv) {
|
||||
std::string deck_file = argv[1];
|
||||
Opm::Parser parser;
|
||||
Opm::ParseContext parse_context;
|
||||
Opm::ErrorGuard error_guard;
|
||||
|
||||
Opm::Deck deck = parser.parseFile(deck_file, parse_context, error_guard);
|
||||
Opm::EclipseState state(deck, parse_context, error_guard);
|
||||
Opm::Schedule schedule(deck, state.getInputGrid(), state.get3DProperties(), state.runspec(), parse_context, error_guard);
|
||||
Opm::SummaryConfig summary_config(deck, schedule, state.getTableManager(), parse_context, error_guard);
|
||||
|
||||
if (error_guard) {
|
||||
error_guard.dump();
|
||||
error_guard.terminate();
|
||||
}
|
||||
|
||||
Opm::msim msim(state);
|
||||
Opm::EclipseIO io(state, state.getInputGrid(), schedule, summary_config);
|
||||
msim.run(schedule, io);
|
||||
}
|
||||
|
||||
@@ -1,157 +0,0 @@
|
||||
/*
|
||||
Copyright 2019 Equinor ASA.
|
||||
|
||||
This file is part of the Open Porous Media project (OPM).
|
||||
|
||||
OPM 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.
|
||||
|
||||
OPM 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 for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with OPM. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
#include <getopt.h>
|
||||
|
||||
#include <iostream>
|
||||
#include <iomanip>
|
||||
#include <vector>
|
||||
|
||||
#include <opm/parser/eclipse/Parser/Parser.hpp>
|
||||
#include <opm/parser/eclipse/Parser/ParseContext.hpp>
|
||||
#include <opm/parser/eclipse/Parser/ErrorGuard.hpp>
|
||||
#include <opm/parser/eclipse/Deck/Deck.hpp>
|
||||
#include <opm/parser/eclipse/EclipseState/EclipseState.hpp>
|
||||
#include <opm/parser/eclipse/EclipseState/EclipseState.hpp>
|
||||
#include <opm/parser/eclipse/EclipseState/SummaryConfig/SummaryConfig.hpp>
|
||||
#include <opm/parser/eclipse/EclipseState/Schedule/Schedule.hpp>
|
||||
|
||||
|
||||
struct keyword {
|
||||
keyword(const std::string& name, const std::string& filename, std::size_t line_number, std::size_t content_hash) :
|
||||
name(name),
|
||||
filename(filename),
|
||||
line_number(line_number),
|
||||
content_hash(content_hash)
|
||||
{}
|
||||
|
||||
|
||||
std::string name;
|
||||
std::string filename;
|
||||
std::size_t line_number;
|
||||
std::size_t content_hash;
|
||||
};
|
||||
|
||||
|
||||
std::vector<keyword> load_deck(const char * deck_file) {
|
||||
Opm::ParseContext parseContext;
|
||||
Opm::ErrorGuard errors;
|
||||
Opm::Parser parser;
|
||||
std::vector<keyword> keywords;
|
||||
|
||||
/* Use the same default ParseContext as flow. */
|
||||
parseContext.update(Opm::ParseContext::PARSE_RANDOM_SLASH, Opm::InputError::IGNORE);
|
||||
parseContext.update(Opm::ParseContext::PARSE_MISSING_DIMS_KEYWORD, Opm::InputError::WARN);
|
||||
parseContext.update(Opm::ParseContext::SUMMARY_UNKNOWN_WELL, Opm::InputError::WARN);
|
||||
parseContext.update(Opm::ParseContext::SUMMARY_UNKNOWN_GROUP, Opm::InputError::WARN);
|
||||
|
||||
auto deck = parser.parseFile(deck_file, parseContext, errors);
|
||||
for (const auto& kw : deck) {
|
||||
std::stringstream ss;
|
||||
ss << kw;
|
||||
|
||||
keywords.emplace_back(kw.name(), kw.getFileName(), kw.getLineNumber(), std::hash<std::string>{}(ss.str()));
|
||||
}
|
||||
return keywords;
|
||||
}
|
||||
|
||||
|
||||
std::size_t deck_hash(const std::vector<keyword>& keywords) {
|
||||
std::stringstream ss;
|
||||
for (const auto& kw : keywords)
|
||||
ss << kw.content_hash;
|
||||
|
||||
return std::hash<std::string>{}(ss.str());
|
||||
}
|
||||
|
||||
|
||||
void print_keywords(const std::vector<keyword>& keywords, bool location_info) {
|
||||
for (const auto& kw : keywords) {
|
||||
if (location_info)
|
||||
std::cout << std::setw(8) << std::left << kw.name << " : " << kw.filename << ":" << kw.line_number << " " << kw.content_hash << std::endl;
|
||||
else
|
||||
std::cout << std::setw(8) << std::left << kw.name << " : " << kw.content_hash << std::endl;
|
||||
}
|
||||
std::cout << std::endl;
|
||||
std::cout << std::setw(8) << std::left << "Total" << " : " << deck_hash(keywords) << std::endl;
|
||||
}
|
||||
|
||||
|
||||
void print_help_and_exit() {
|
||||
const char * help_text = R"(The purpose of the opmhash program is to load a deck and create a summary, by
|
||||
diffing two such summaries it is simple to determine if two decks are similar.
|
||||
For each keyword a hash of the normalized content is calculated. The output of
|
||||
the program will look like this:
|
||||
|
||||
RUNSPEC : 13167205945009276792
|
||||
TITLE : 16047371705964514902
|
||||
DIMENS : 1264233216877515756
|
||||
NONNC : 10052807539267647959
|
||||
OIL : 6013609912232720008
|
||||
WATER : 14106203893673265964
|
||||
|
||||
Total : 7362809723723482303
|
||||
|
||||
Where the 'random' integer following each keyword is the hash of the content of
|
||||
that keyword. The hashing is insensitive to changes in white-space and comments
|
||||
and file location. At the bottom comes a total hash of the complete content. The
|
||||
hash of each keyword is insensitive to shuffling of keywords, but the total hash
|
||||
depends on the keyword order.
|
||||
|
||||
Options:
|
||||
|
||||
-l : Add filename and linenumber information to each keyword.
|
||||
-s : Short form - only print the hash of the complete deck.
|
||||
|
||||
)";
|
||||
std::cerr << help_text << std::endl;
|
||||
exit(1);
|
||||
}
|
||||
|
||||
|
||||
int main(int argc, char** argv) {
|
||||
int arg_offset = 1;
|
||||
bool location_info = false;
|
||||
bool short_form = false;
|
||||
|
||||
while (true) {
|
||||
int c;
|
||||
c = getopt(argc, argv, "ls");
|
||||
if (c == -1)
|
||||
break;
|
||||
|
||||
switch(c) {
|
||||
case 'l':
|
||||
location_info = true;
|
||||
break;
|
||||
case 's':
|
||||
short_form = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
arg_offset = optind;
|
||||
if (arg_offset >= argc)
|
||||
print_help_and_exit();
|
||||
|
||||
auto keywords = load_deck(argv[arg_offset]);
|
||||
if (short_form)
|
||||
std::cout << deck_hash(keywords) << std::endl;
|
||||
else
|
||||
print_keywords(keywords, location_info);
|
||||
}
|
||||
|
||||
@@ -1,51 +0,0 @@
|
||||
/*
|
||||
Copyright 2013 Statoil ASA.
|
||||
|
||||
This file is part of the Open Porous Media project (OPM).
|
||||
|
||||
OPM 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.
|
||||
|
||||
OPM 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 for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with OPM. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#include <iostream>
|
||||
|
||||
#include <opm/parser/eclipse/Parser/Parser.hpp>
|
||||
#include <opm/parser/eclipse/Parser/ParseContext.hpp>
|
||||
#include <opm/parser/eclipse/Parser/ErrorGuard.hpp>
|
||||
#include <opm/parser/eclipse/Deck/Deck.hpp>
|
||||
#include <opm/parser/eclipse/EclipseState/EclipseState.hpp>
|
||||
#include <opm/parser/eclipse/EclipseState/EclipseState.hpp>
|
||||
#include <opm/parser/eclipse/EclipseState/SummaryConfig/SummaryConfig.hpp>
|
||||
#include <opm/parser/eclipse/EclipseState/Schedule/Schedule.hpp>
|
||||
|
||||
|
||||
inline void loadDeck( const char * deck_file) {
|
||||
Opm::ParseContext parseContext;
|
||||
Opm::ErrorGuard errors;
|
||||
Opm::Parser parser;
|
||||
|
||||
std::cout << "Loading deck: " << deck_file << " ..... "; std::cout.flush();
|
||||
auto deck = parser.parseFile(deck_file, parseContext, errors);
|
||||
std::cout << "parse complete - creating EclipseState .... "; std::cout.flush();
|
||||
Opm::EclipseState state( deck, parseContext, errors );
|
||||
Opm::Schedule schedule( deck, state.getInputGrid(), state.get3DProperties(), state.runspec(), parseContext, errors);
|
||||
Opm::SummaryConfig summary( deck, schedule, state.getTableManager( ), parseContext, errors );
|
||||
std::cout << "complete." << std::endl;
|
||||
}
|
||||
|
||||
|
||||
int main(int argc, char** argv) {
|
||||
for (int iarg = 1; iarg < argc; iarg++)
|
||||
loadDeck( argv[iarg] );
|
||||
}
|
||||
|
||||
@@ -1,110 +0,0 @@
|
||||
/*
|
||||
Copyright 2018 Statoil ASA.
|
||||
|
||||
This file is part of the Open Porous Media project (OPM).
|
||||
|
||||
OPM 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.
|
||||
|
||||
OPM 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 for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with OPM. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#include <iostream>
|
||||
#include <getopt.h>
|
||||
#include <boost/filesystem.hpp>
|
||||
|
||||
#include <opm/parser/eclipse/Parser/Parser.hpp>
|
||||
#include <opm/parser/eclipse/Parser/ErrorGuard.hpp>
|
||||
#include <opm/parser/eclipse/Parser/ParseContext.hpp>
|
||||
#include <opm/parser/eclipse/Parser/InputErrorAction.hpp>
|
||||
#include <opm/parser/eclipse/Deck/Deck.hpp>
|
||||
|
||||
|
||||
inline void pack_deck( const char * deck_file, std::ostream& os) {
|
||||
Opm::ParseContext parseContext(Opm::InputError::WARN);
|
||||
Opm::ErrorGuard errors;
|
||||
Opm::Parser parser;
|
||||
|
||||
auto deck = parser.parseFile(deck_file, parseContext, errors);
|
||||
os << deck;
|
||||
|
||||
}
|
||||
|
||||
|
||||
void print_help_and_exit() {
|
||||
const char * help_text = R"(
|
||||
The opmpack program will load a deck, resolve all include
|
||||
files and then print it out again on stdout. All comments
|
||||
will be stripped and the value types will be validated.
|
||||
|
||||
By passing the option -o you can redirect the output to a file
|
||||
or a directory.
|
||||
|
||||
Print on stdout:
|
||||
|
||||
opmpack /path/to/case/CASE.DATA
|
||||
|
||||
|
||||
Print MY_CASE.DATA in /tmp:
|
||||
|
||||
opmpack -o /tmp /path/to/MY_CASE.DATA
|
||||
|
||||
|
||||
Print NEW_CASE in cwd:
|
||||
|
||||
opmpack -o NEW_CASE.DATA path/to/MY_CASE.DATA
|
||||
|
||||
|
||||
)";
|
||||
std::cerr << help_text << std::endl;
|
||||
exit(1);
|
||||
}
|
||||
|
||||
|
||||
int main(int argc, char** argv) {
|
||||
int arg_offset = 1;
|
||||
bool stdout_output = true;
|
||||
const char * coutput_arg;
|
||||
|
||||
while (true) {
|
||||
int c;
|
||||
c = getopt(argc, argv, "o:");
|
||||
if (c == -1)
|
||||
break;
|
||||
|
||||
switch(c) {
|
||||
case 'o':
|
||||
stdout_output = false;
|
||||
coutput_arg = optarg;
|
||||
break;
|
||||
}
|
||||
}
|
||||
arg_offset = optind;
|
||||
if (arg_offset >= argc)
|
||||
print_help_and_exit();
|
||||
|
||||
if (stdout_output)
|
||||
pack_deck(argv[arg_offset], std::cout);
|
||||
else {
|
||||
std::ofstream os;
|
||||
using path = boost::filesystem::path;
|
||||
path input_arg(argv[arg_offset]);
|
||||
path output_arg(coutput_arg);
|
||||
if (boost::filesystem::is_directory(output_arg)) {
|
||||
path output_path = output_arg / input_arg.filename();
|
||||
os.open(output_path.string());
|
||||
} else
|
||||
os.open(output_arg.string());
|
||||
|
||||
pack_deck(argv[arg_offset], os);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,32 +0,0 @@
|
||||
/*
|
||||
Copyright 2016 Statoil ASA.
|
||||
|
||||
This file is part of the Open Porous Media project (OPM).
|
||||
|
||||
OPM 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.
|
||||
|
||||
OPM 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 for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with OPM. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#ifndef DEVIATION_HPP
|
||||
#define DEVIATION_HPP
|
||||
|
||||
/*! \brief Deviation struct.
|
||||
\details The member variables are default initialized to -1,
|
||||
which is an invalid deviation value.
|
||||
*/
|
||||
struct Deviation {
|
||||
double abs = -1; //!< Absolute deviation
|
||||
double rel = -1; //!< Relative deviation
|
||||
};
|
||||
|
||||
#endif
|
||||
@@ -1,186 +0,0 @@
|
||||
/*
|
||||
Copyright 2019 Equinor ASA.
|
||||
|
||||
This file is part of the Open Porous Media project (OPM).
|
||||
|
||||
OPM 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.
|
||||
|
||||
OPM 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 for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with OPM. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#include "EGrid.hpp"
|
||||
|
||||
#include <opm/common/ErrorMacros.hpp>
|
||||
#include <string>
|
||||
#include <string.h>
|
||||
#include <sstream>
|
||||
#include <iterator>
|
||||
#include <iomanip>
|
||||
#include <algorithm>
|
||||
#include <numeric>
|
||||
|
||||
|
||||
EGrid::EGrid(const std::string &filename) : EclFile(filename)
|
||||
{
|
||||
EclFile file(filename);
|
||||
|
||||
auto gridhead = get<int>("GRIDHEAD");
|
||||
|
||||
nijk[0] = gridhead[1];
|
||||
nijk[1] = gridhead[2];
|
||||
nijk[2] = gridhead[3];
|
||||
|
||||
if (file.hasKey("ACTNUM")) {
|
||||
auto actnum = get<int>("ACTNUM");
|
||||
|
||||
nactive = 0;
|
||||
for (unsigned int i = 0; i < actnum.size(); i++) {
|
||||
if (actnum[i] > 0) {
|
||||
act_index.push_back(nactive);
|
||||
glob_index.push_back(i);
|
||||
nactive++;
|
||||
} else {
|
||||
act_index.push_back(-1);
|
||||
}
|
||||
}
|
||||
} else {
|
||||
int nCells = nijk[0] * nijk[1] * nijk[2];
|
||||
act_index.resize(nCells);
|
||||
glob_index.resize(nCells);
|
||||
std::iota(act_index.begin(), act_index.end(), 0);
|
||||
std::iota(glob_index.begin(), glob_index.end(), 0);
|
||||
}
|
||||
|
||||
coord_array = get<float>("COORD");
|
||||
zcorn_array = get<float>("ZCORN");
|
||||
}
|
||||
|
||||
|
||||
int EGrid::global_index(int i, int j, int k) const
|
||||
{
|
||||
if (i < 0 || i >= nijk[0] || j < 0 || j >= nijk[1] || k < 0 || k >= nijk[2]) {
|
||||
OPM_THROW(std::invalid_argument, "i, j or/and k out of range");
|
||||
}
|
||||
|
||||
return i + j * nijk[0] + k * nijk[0] * nijk[1];
|
||||
}
|
||||
|
||||
|
||||
int EGrid::active_index(int i, int j, int k) const
|
||||
{
|
||||
int n = i + j * nijk[0] + k * nijk[0] * nijk[1];
|
||||
|
||||
if (i < 0 || i >= nijk[0] || j < 0 || j >= nijk[1] || k < 0 || k >= nijk[2]) {
|
||||
OPM_THROW(std::invalid_argument, "i, j or/and k out of range");
|
||||
}
|
||||
|
||||
return act_index[n];
|
||||
}
|
||||
|
||||
|
||||
std::array<int, 3> EGrid::ijk_from_active_index(int actInd) const
|
||||
{
|
||||
if (actInd < 0 || actInd >= nactive) {
|
||||
OPM_THROW(std::invalid_argument, "active index out of range");
|
||||
}
|
||||
|
||||
int _glob = glob_index[actInd];
|
||||
|
||||
std::array<int, 3> result;
|
||||
result[2] = _glob / (nijk[0] * nijk[1]);
|
||||
|
||||
int rest = _glob % (nijk[0] * nijk[1]);
|
||||
|
||||
result[1] = rest / nijk[0];
|
||||
result[0] = rest % nijk[0];
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
|
||||
std::array<int, 3> EGrid::ijk_from_global_index(int globInd) const
|
||||
{
|
||||
if (globInd < 0 || globInd >= nijk[0] * nijk[1] * nijk[2]) {
|
||||
OPM_THROW(std::invalid_argument, "global index out of range");
|
||||
}
|
||||
|
||||
std::array<int, 3> result;
|
||||
result[2] = globInd / (nijk[0] * nijk[1]);
|
||||
|
||||
int rest = globInd % (nijk[0] * nijk[1]);
|
||||
|
||||
result[1] = rest / nijk[0];
|
||||
result[0] = rest % nijk[0];
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
|
||||
void EGrid::getCellCorners(const std::array<int, 3>& ijk,
|
||||
std::vector<double>& X,
|
||||
std::vector<double>& Y,
|
||||
std::vector<double>& Z) const
|
||||
{
|
||||
std::vector<int> zind;
|
||||
std::vector<int> pind;
|
||||
|
||||
if (X.size() < 8 || Y.size() < 8 || Z.size() < 8) {
|
||||
OPM_THROW(std::invalid_argument,
|
||||
"In routine cellConrner. X, Y and Z should be a vector of size 8");
|
||||
}
|
||||
|
||||
if (ijk[0] < 0 || ijk[0] >= nijk[0] || ijk[1] < 0 || ijk[1] >= nijk[1] || ijk[2] < 0 || ijk[2] >= nijk[2]) {
|
||||
OPM_THROW(std::invalid_argument, "i, j and/or k out of range");
|
||||
}
|
||||
|
||||
// calculate indices for grid pillars in COORD arrray
|
||||
pind.push_back(ijk[1]*(nijk[0]+1)*6 + ijk[0]*6);
|
||||
pind.push_back(pind[0] + 6);
|
||||
pind.push_back(pind[0] + (nijk[0]+1)*6);
|
||||
pind.push_back(pind[2] + 6);
|
||||
|
||||
// get depths from zcorn array in ZCORN array
|
||||
zind.push_back(ijk[2]*nijk[0]*nijk[1]*8 + ijk[1]*nijk[0]*4 + ijk[0]*2);
|
||||
zind.push_back(zind[0] + 1);
|
||||
zind.push_back(zind[0] + nijk[0]*2);
|
||||
zind.push_back(zind[2] + 1);
|
||||
|
||||
for (int n = 0; n < 4; n++) {
|
||||
zind.push_back(zind[n] + nijk[0]*nijk[1]*4);
|
||||
}
|
||||
|
||||
for (int n = 0; n< 8; n++){
|
||||
Z[n] = zcorn_array[zind[n]];
|
||||
}
|
||||
|
||||
for (int n = 0; n < 4; n++) {
|
||||
double xt = coord_array[pind[n]];
|
||||
double yt = coord_array[pind[n] + 1];
|
||||
double zt = coord_array[pind[n] + 2];
|
||||
|
||||
double xb = coord_array[pind[n] + 3];
|
||||
double yb = coord_array[pind[n] + 4];
|
||||
double zb = coord_array[pind[n]+5];
|
||||
|
||||
X[n] = xt + (xb-xt) / (zt-zb) * (zt - Z[n]);
|
||||
X[n+4] = xt + (xb-xt) / (zt-zb) * (zt-Z[n+4]);
|
||||
|
||||
Y[n] = yt+(yb-yt)/(zt-zb)*(zt-Z[n]);
|
||||
Y[n+4] = yt+(yb-yt)/(zt-zb)*(zt-Z[n+4]);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void EGrid::getCellCorners(int globindex, std::vector<double>& X,
|
||||
std::vector<double>& Y, std::vector<double>& Z) const
|
||||
{
|
||||
return getCellCorners(ijk_from_global_index(globindex),X,Y,Z);
|
||||
}
|
||||
@@ -1,62 +0,0 @@
|
||||
/*
|
||||
Copyright 2019 Equinor ASA.
|
||||
|
||||
This file is part of the Open Porous Media project (OPM).
|
||||
|
||||
OPM 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.
|
||||
|
||||
OPM 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 for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with OPM. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#ifndef EGRID_HPP
|
||||
#define EGRID_HPP
|
||||
|
||||
#include "EclFile.hpp"
|
||||
|
||||
#include <array>
|
||||
#include <iostream>
|
||||
#include <string>
|
||||
#include <fstream>
|
||||
#include <vector>
|
||||
#include <ctime>
|
||||
#include <map>
|
||||
|
||||
|
||||
class EGrid : public EclFile
|
||||
{
|
||||
public:
|
||||
explicit EGrid(const std::string& filename);
|
||||
|
||||
int global_index(int i, int j, int k) const;
|
||||
int active_index(int i, int j, int k) const;
|
||||
|
||||
const std::array<int, 3>& dimension() const { return nijk; }
|
||||
|
||||
std::array<int, 3> ijk_from_active_index(int actInd) const;
|
||||
std::array<int, 3> ijk_from_global_index(int globInd) const;
|
||||
|
||||
void getCellCorners(int globindex, std::vector<double>& X, std::vector<double>& Y, std::vector<double>& Z) const;
|
||||
void getCellCorners(const std::array<int, 3>& ijk, std::vector<double>& X, std::vector<double>& Y, std::vector<double>& Z) const;
|
||||
|
||||
int activeCells() const { return nactive; }
|
||||
int totalNumberOfCells() const { return nijk[0] * nijk[1] * nijk[2]; }
|
||||
|
||||
private:
|
||||
std::array<int, 3> nijk;
|
||||
int nNNC, nactive;
|
||||
|
||||
std::vector<int> act_index;
|
||||
std::vector<int> glob_index;
|
||||
std::vector<float> coord_array;
|
||||
std::vector<float> zcorn_array;
|
||||
};
|
||||
|
||||
#endif
|
||||
@@ -1,310 +0,0 @@
|
||||
/*
|
||||
Copyright 2019 Equinor ASA.
|
||||
|
||||
This file is part of the Open Porous Media project (OPM).
|
||||
|
||||
OPM 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.
|
||||
|
||||
OPM 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 for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with OPM. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#include "ERft.hpp"
|
||||
|
||||
#include <opm/common/ErrorMacros.hpp>
|
||||
#include <string>
|
||||
#include <string.h>
|
||||
#include <sstream>
|
||||
#include <iterator>
|
||||
#include <iomanip>
|
||||
#include <algorithm>
|
||||
|
||||
|
||||
ERft::ERft(const std::string &filename) : EclFile(filename)
|
||||
{
|
||||
loadData();
|
||||
std::vector<int> first;
|
||||
std::vector<int> second;
|
||||
|
||||
std::vector<std::string> wellName;
|
||||
std::vector<RftDate> dates;
|
||||
|
||||
auto listOfArrays = getList();
|
||||
|
||||
for (size_t i = 0; i < listOfArrays.size(); i++) {
|
||||
std::string name = std::get<0>(listOfArrays[i]);
|
||||
|
||||
if (name == "TIME") {
|
||||
first.push_back(i);
|
||||
auto vect1 = get<float>(i);
|
||||
timeList.push_back(vect1[0]);
|
||||
}
|
||||
|
||||
if (name == "DATE") {
|
||||
auto vect1 = get<int>(i);
|
||||
RftDate date(vect1[2],vect1[1],vect1[0]);
|
||||
dateList.insert(date);
|
||||
dates.push_back(date);
|
||||
}
|
||||
|
||||
if (name == "WELLETC"){
|
||||
auto vect1 = get<std::string>(i);
|
||||
wellList.insert(vect1[1]);
|
||||
wellName.push_back(vect1[1]);
|
||||
}
|
||||
}
|
||||
|
||||
for (size_t i = 0; i < first.size(); i++) {
|
||||
std::pair<int,int> range;
|
||||
range.first = first[i];
|
||||
|
||||
if (i == first.size() - 1) {
|
||||
range.second = listOfArrays.size();
|
||||
} else {
|
||||
range.second = first[i+1];
|
||||
}
|
||||
|
||||
arrIndexRange[i] = range;
|
||||
}
|
||||
|
||||
numReports = first.size();
|
||||
|
||||
for (size_t i = 0; i < wellName.size(); i++) {
|
||||
std::pair<std::string,RftDate> wellDatePair(wellName[i],dates[i]);
|
||||
reportIndex[wellDatePair] = i;
|
||||
rftReportList.push_back(wellDatePair);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
bool ERft::hasRft(const std::string& wellName, const RftDate& date) const
|
||||
{
|
||||
return reportIndex.find({wellName, date}) != reportIndex.end();
|
||||
}
|
||||
|
||||
|
||||
bool ERft::hasRft(const std::string& wellName, int year, int month, int day) const
|
||||
{
|
||||
RftDate date(year, month, day);
|
||||
return reportIndex.find({wellName,date}) != reportIndex.end();
|
||||
}
|
||||
|
||||
|
||||
int ERft::getReportIndex(const std::string& wellName, const RftDate& date) const
|
||||
{
|
||||
std::pair<std::string,std::tuple<int,int,int>> wellDatePair(wellName,date);
|
||||
auto rIndIt = reportIndex.find(wellDatePair);
|
||||
|
||||
if (rIndIt == reportIndex.end()) {
|
||||
int y = std::get<0>(date);
|
||||
int m = std::get<1>(date);
|
||||
int d = std::get<2>(date);
|
||||
|
||||
std::string dateStr=std::to_string(y) + "/" + std::to_string(m) + "/" + std::to_string(d);
|
||||
std::string message="RFT data not found for well " + wellName + " at date: " + dateStr;
|
||||
OPM_THROW(std::invalid_argument, message);
|
||||
}
|
||||
|
||||
return rIndIt->second;
|
||||
}
|
||||
|
||||
|
||||
bool ERft::hasArray(const std::string& arrayName, const std::string& wellName,
|
||||
const RftDate& date) const
|
||||
{
|
||||
int reportInd = getReportIndex(wellName, date);
|
||||
|
||||
auto searchInd = arrIndexRange.find(reportInd);
|
||||
|
||||
int fromInd = searchInd->second.first;
|
||||
int toInd = searchInd->second.second;
|
||||
|
||||
auto it = std::find(array_name.begin()+fromInd,array_name.begin()+toInd,arrayName);
|
||||
return it != array_name.begin() + toInd;
|
||||
}
|
||||
|
||||
|
||||
int ERft::getArrayIndex(const std::string& name, const std::string& wellName,
|
||||
const RftDate& date) const
|
||||
{
|
||||
int rInd= getReportIndex(wellName, date);
|
||||
|
||||
auto searchInd = arrIndexRange.find(rInd);
|
||||
|
||||
int fromInd =searchInd->second.first;
|
||||
int toInd = searchInd->second.second;
|
||||
auto it=std::find(array_name.begin()+fromInd,array_name.begin()+toInd,name);
|
||||
|
||||
if (std::distance(array_name.begin(),it) == toInd) {
|
||||
int y = std::get<0>(date);
|
||||
int m = std::get<1>(date);
|
||||
int d = std::get<2>(date);
|
||||
|
||||
std::string dateStr = std::to_string(y) + "/" + std::to_string(m) + "/" + std::to_string(d);
|
||||
std::string message = "Array " + name + " not found for RFT, well: " + wellName + " date: " + dateStr;
|
||||
OPM_THROW(std::invalid_argument, message);
|
||||
}
|
||||
|
||||
return std::distance(array_name.begin(),it);
|
||||
}
|
||||
|
||||
|
||||
template<> const std::vector<float>&
|
||||
ERft::getRft<float>(const std::string& name, const std::string &wellName,
|
||||
const RftDate& date) const
|
||||
{
|
||||
int arrInd = getArrayIndex(name, wellName, date);
|
||||
|
||||
if (array_type[arrInd] != EIOD::REAL) {
|
||||
std::string message = "Array " + name + " found in RFT file for selected date and well, but called with wrong type";
|
||||
OPM_THROW(std::runtime_error, message);
|
||||
}
|
||||
|
||||
auto search_array = real_array.find(arrInd);
|
||||
return search_array->second;
|
||||
}
|
||||
|
||||
|
||||
template<> const std::vector<double>&
|
||||
ERft::getRft<double>(const std::string& name, const std::string& wellName,
|
||||
const RftDate& date) const
|
||||
{
|
||||
int arrInd = getArrayIndex(name, wellName, date);
|
||||
|
||||
if (array_type[arrInd] != EIOD::DOUB) {
|
||||
std::string message = "Array " + name + " found in RFT file for selected date and well, but called with wrong type";
|
||||
OPM_THROW(std::runtime_error, message);
|
||||
}
|
||||
|
||||
auto search_array = doub_array.find(arrInd);
|
||||
return search_array->second;
|
||||
}
|
||||
|
||||
|
||||
template<> const std::vector<int>&
|
||||
ERft::getRft<int>(const std::string& name, const std::string& wellName,
|
||||
const RftDate& date) const
|
||||
{
|
||||
int arrInd = getArrayIndex(name, wellName, date);
|
||||
|
||||
if (array_type[arrInd] != EIOD::INTE) {
|
||||
std::string message = "Array " + name + " found in RFT file for selected date and well, but called with wrong type";
|
||||
OPM_THROW(std::runtime_error, message);
|
||||
}
|
||||
|
||||
auto search_array = inte_array.find(arrInd);
|
||||
return search_array->second;
|
||||
}
|
||||
|
||||
|
||||
template<> const std::vector<bool>&
|
||||
ERft::getRft<bool>(const std::string& name, const std::string& wellName,
|
||||
const RftDate& date) const
|
||||
{
|
||||
int arrInd = getArrayIndex(name, wellName, date);
|
||||
|
||||
if (array_type[arrInd] != EIOD::LOGI) {
|
||||
std::string message = "Array " + name + " found in RFT file for selected date and well, but called with wrong type";
|
||||
OPM_THROW(std::runtime_error, message);
|
||||
}
|
||||
|
||||
auto search_array = logi_array.find(arrInd);
|
||||
return search_array->second;
|
||||
}
|
||||
|
||||
|
||||
template<> const std::vector<std::string>&
|
||||
ERft::getRft<std::string>(const std::string& name, const std::string& wellName,
|
||||
const RftDate& date) const
|
||||
{
|
||||
int arrInd = getArrayIndex(name, wellName, date);
|
||||
|
||||
if (array_type[arrInd] != EIOD::CHAR) {
|
||||
std::string message = "Array " + name + " found in RFT file for selected date and well, but called with wrong type";
|
||||
OPM_THROW(std::runtime_error, message);
|
||||
}
|
||||
|
||||
auto search_array = char_array.find(arrInd);
|
||||
return search_array->second;
|
||||
}
|
||||
|
||||
|
||||
template<> const std::vector<int>&
|
||||
ERft::getRft<int>(const std::string& name, const std::string& wellName,
|
||||
int year, int month, int day) const
|
||||
{
|
||||
return getRft<int>(name, wellName, RftDate{year, month, day});
|
||||
}
|
||||
|
||||
|
||||
template<> const std::vector<float>&
|
||||
ERft::getRft<float>(const std::string& name, const std::string& wellName,
|
||||
int year, int month, int day) const
|
||||
{
|
||||
return getRft<float>(name, wellName, RftDate{year, month, day});
|
||||
}
|
||||
|
||||
|
||||
template<> const std::vector<double>&
|
||||
ERft::getRft<double>(const std::string& name, const std::string& wellName,
|
||||
int year, int month, int day) const
|
||||
{
|
||||
return getRft<double>(name, wellName, RftDate{year, month, day});
|
||||
}
|
||||
|
||||
|
||||
template<> const std::vector<std::string>&
|
||||
ERft::getRft<std::string>(const std::string& name, const std::string& wellName,
|
||||
int year, int month, int day) const
|
||||
{
|
||||
return getRft<std::string>(name, wellName, RftDate{year, month, day});
|
||||
}
|
||||
|
||||
|
||||
template<> const std::vector<bool>&
|
||||
ERft::getRft<bool>(const std::string& name, const std::string& wellName,
|
||||
int year, int month, int day) const
|
||||
{
|
||||
return getRft<bool>(name, wellName, RftDate{year, month, day});
|
||||
}
|
||||
|
||||
|
||||
std::vector<EclFile::EclEntry> ERft::listOfRftArrays(const std::string& wellName,
|
||||
const RftDate& date) const
|
||||
{
|
||||
std::vector<EclEntry> list;
|
||||
int rInd = getReportIndex(wellName, date);
|
||||
|
||||
auto searchInd = arrIndexRange.find(rInd);
|
||||
for (int i = searchInd->second.first; i < searchInd->second.second; i++) {
|
||||
list.emplace_back(array_name[i], array_type[i], array_size[i]);
|
||||
}
|
||||
|
||||
return list;
|
||||
}
|
||||
|
||||
|
||||
std::vector<EclFile::EclEntry> ERft::listOfRftArrays(const std::string& wellName,
|
||||
int year, int month, int day) const
|
||||
{
|
||||
return listOfRftArrays(wellName, RftDate{year, month, day});
|
||||
}
|
||||
|
||||
|
||||
std::vector<std::string> ERft::listOfWells() const
|
||||
{
|
||||
return { this->wellList.begin(), this->wellList.end() };
|
||||
}
|
||||
|
||||
|
||||
std::vector<ERft::RftDate> ERft::listOfdates() const
|
||||
{
|
||||
return { this->dateList.begin(), this->dateList.end() };
|
||||
}
|
||||
@@ -1,83 +0,0 @@
|
||||
/*
|
||||
Copyright 2019 Equinor ASA.
|
||||
|
||||
This file is part of the Open Porous Media project (OPM).
|
||||
|
||||
OPM 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.
|
||||
|
||||
OPM 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 for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with OPM. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#ifndef ERFT_HPP
|
||||
#define ERFT_HPP
|
||||
|
||||
|
||||
#include "EclFile.hpp"
|
||||
|
||||
#include <iostream>
|
||||
#include <string>
|
||||
#include <fstream>
|
||||
#include <vector>
|
||||
#include <ctime>
|
||||
#include <map>
|
||||
#include <set>
|
||||
|
||||
|
||||
class ERft : public EclFile
|
||||
{
|
||||
public:
|
||||
explicit ERft(const std::string &filename);
|
||||
|
||||
using RftDate = std::tuple<int,int,int>;
|
||||
template <typename T>
|
||||
const std::vector<T>& getRft(const std::string& name, const std::string& wellName,
|
||||
const RftDate& date) const;
|
||||
|
||||
template <typename T>
|
||||
const std::vector<T>& getRft(const std::string& name, const std::string& wellName,
|
||||
int year, int month, int day) const;
|
||||
|
||||
std::vector<std::string> listOfWells() const;
|
||||
std::vector<RftDate> listOfdates() const;
|
||||
|
||||
using RftReportList = std::vector<std::pair<std::string, RftDate>>;
|
||||
const RftReportList& listOfRftReports() const { return rftReportList; }
|
||||
|
||||
bool hasRft(const std::string& wellName, const RftDate& date) const;
|
||||
bool hasRft(const std::string& wellName, int year, int month, int day) const;
|
||||
|
||||
std::vector<EclEntry> listOfRftArrays(const std::string& wellName,
|
||||
const RftDate& date) const;
|
||||
|
||||
std::vector<EclEntry> listOfRftArrays(const std::string& wellName,
|
||||
int year, int month, int day) const;
|
||||
|
||||
bool hasArray(const std::string& arrayName, const std::string& wellName,
|
||||
const RftDate& date) const;
|
||||
|
||||
private:
|
||||
std::map<int, std::pair<int,int>> arrIndexRange;
|
||||
int numReports;
|
||||
std::vector<float> timeList;
|
||||
|
||||
std::set<std::string> wellList;
|
||||
std::set<RftDate> dateList;
|
||||
RftReportList rftReportList;
|
||||
|
||||
std::map<std::pair<std::string,RftDate>,int> reportIndex; // mapping report index to wellName and date (tupe)
|
||||
|
||||
int getReportIndex(const std::string& wellName, const RftDate& date) const;
|
||||
int getArrayIndex(const std::string& name, const std::string& wellName,
|
||||
const RftDate& date) const;
|
||||
};
|
||||
|
||||
#endif
|
||||
|
||||
@@ -1,178 +0,0 @@
|
||||
/*
|
||||
Copyright 2019 Equinor ASA.
|
||||
|
||||
This file is part of the Open Porous Media project (OPM).
|
||||
|
||||
OPM 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.
|
||||
|
||||
OPM 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 for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with OPM. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#include "ERst.hpp"
|
||||
|
||||
#include <string>
|
||||
#include <string.h>
|
||||
#include <sstream>
|
||||
#include <iterator>
|
||||
#include <iomanip>
|
||||
#include <algorithm>
|
||||
|
||||
|
||||
ERst::ERst(const std::string& filename) : EclFile(filename)
|
||||
{
|
||||
loadData("SEQNUM");
|
||||
|
||||
std::vector<int> firstIndex;
|
||||
|
||||
for (size_t i = 0; i < array_name.size(); i++) {
|
||||
if (array_name[i] == "SEQNUM") {
|
||||
auto seqn = get<int>(i);
|
||||
seqnum.push_back(seqn[0]);
|
||||
firstIndex.push_back(i);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
for (size_t i = 0; i < seqnum.size(); i++) {
|
||||
std::pair<int,int> range;
|
||||
range.first = firstIndex[i];
|
||||
|
||||
if (i != seqnum.size() - 1) {
|
||||
range.second = firstIndex[i+1];
|
||||
} else {
|
||||
range.second = array_name.size();
|
||||
}
|
||||
|
||||
arrIndexRange[seqnum[i]] = range;
|
||||
}
|
||||
|
||||
nReports = seqnum.size();
|
||||
|
||||
for (int i = 0; i < nReports; i++) {
|
||||
reportLoaded[seqnum[i]] = false;
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
bool ERst::hasReportStepNumber(int number) const
|
||||
{
|
||||
auto search = arrIndexRange.find(number);
|
||||
return search != arrIndexRange.end();
|
||||
}
|
||||
|
||||
|
||||
void ERst::loadReportStepNumber(int number)
|
||||
{
|
||||
if (!hasReportStepNumber(number)) {
|
||||
std::string message="Trying to load non existing report step number " + std::to_string(number);
|
||||
OPM_THROW(std::invalid_argument, message);
|
||||
}
|
||||
|
||||
std::vector<int> arrayIndexList;
|
||||
arrayIndexList.reserve(arrIndexRange[number].second - arrIndexRange[number].first + 1);
|
||||
|
||||
for (int i = arrIndexRange[number].first; i < arrIndexRange[number].second; i++) {
|
||||
arrayIndexList.push_back(i);
|
||||
}
|
||||
|
||||
loadData(arrayIndexList);
|
||||
|
||||
reportLoaded[number] = true;
|
||||
}
|
||||
|
||||
|
||||
std::vector<EclFile::EclEntry> ERst::listOfRstArrays(int reportStepNumber)
|
||||
{
|
||||
std::vector<EclEntry> list;
|
||||
|
||||
if (!hasReportStepNumber(reportStepNumber)) {
|
||||
std::string message = "Trying to get list of arrays from non existing report step number " + std::to_string(reportStepNumber);
|
||||
OPM_THROW(std::invalid_argument, message);
|
||||
}
|
||||
|
||||
const auto& rng = this->arrIndexRange[reportStepNumber];
|
||||
list.reserve(rng.second - rng.first);
|
||||
|
||||
for (int i = rng.first; i < rng.second; i++) {
|
||||
list.emplace_back(array_name[i], array_type[i], array_size[i]);
|
||||
}
|
||||
|
||||
return list;
|
||||
}
|
||||
|
||||
|
||||
int ERst::getArrayIndex(const std::string& name, int number) const
|
||||
{
|
||||
if (!hasReportStepNumber(number)) {
|
||||
std::string message = "Trying to get vector " + name + " from non existing sequence " + std::to_string(number);
|
||||
OPM_THROW(std::invalid_argument, message);
|
||||
}
|
||||
|
||||
auto search = reportLoaded.find(number);
|
||||
|
||||
if (!search->second) {
|
||||
std::string message = "Data not loaded for sequence " + std::to_string(number);
|
||||
OPM_THROW(std::runtime_error, message);
|
||||
}
|
||||
|
||||
auto range_it = arrIndexRange.find(number);
|
||||
|
||||
std::pair<int,int> indexRange = range_it->second;
|
||||
|
||||
auto it = std::find(array_name.begin() + indexRange.first,
|
||||
array_name.begin() + indexRange.second, name);
|
||||
|
||||
if (std::distance(array_name.begin(),it) == indexRange.second) {
|
||||
std::string message = "Array " + name + " not found in sequence " + std::to_string(number);
|
||||
OPM_THROW(std::runtime_error, message);
|
||||
}
|
||||
|
||||
return std::distance(array_name.begin(), it);
|
||||
}
|
||||
|
||||
|
||||
template<>
|
||||
const std::vector<int>& ERst::getRst<int>(const std::string& name, int reportStepNumber)
|
||||
{
|
||||
int ind = getArrayIndex(name, reportStepNumber);
|
||||
return getImpl(ind, EIOD::INTE, inte_array, "integer");
|
||||
}
|
||||
|
||||
|
||||
template<>
|
||||
const std::vector<float>& ERst::getRst<float>(const std::string& name, int reportStepNumber)
|
||||
{
|
||||
int ind = getArrayIndex(name, reportStepNumber);
|
||||
return getImpl(ind, EIOD::REAL, real_array, "float");
|
||||
}
|
||||
|
||||
|
||||
template<>
|
||||
const std::vector<double>& ERst::getRst<double>(const std::string& name, int reportStepNumber)
|
||||
{
|
||||
int ind = getArrayIndex(name, reportStepNumber);
|
||||
return getImpl(ind, EIOD::DOUB, doub_array, "double");
|
||||
}
|
||||
|
||||
|
||||
template<>
|
||||
const std::vector<bool>& ERst::getRst<bool>(const std::string& name, int reportStepNumber)
|
||||
{
|
||||
int ind = getArrayIndex(name, reportStepNumber);
|
||||
return getImpl(ind, EIOD::LOGI, logi_array, "bool");
|
||||
}
|
||||
|
||||
template<>
|
||||
const std::vector<std::string>& ERst::getRst<std::string>(const std::string& name, int reportStepNumber)
|
||||
{
|
||||
int ind = getArrayIndex(name, reportStepNumber);
|
||||
return getImpl(ind, EIOD::CHAR, char_array, "string");
|
||||
}
|
||||
@@ -1,57 +0,0 @@
|
||||
/*
|
||||
Copyright 2019 Equinor ASA.
|
||||
|
||||
This file is part of the Open Porous Media project (OPM).
|
||||
|
||||
OPM 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.
|
||||
|
||||
OPM 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 for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with OPM. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#ifndef ERST_HPP
|
||||
#define ERST_HPP
|
||||
|
||||
|
||||
#include "EclFile.hpp"
|
||||
|
||||
#include <iostream>
|
||||
#include <string>
|
||||
#include <fstream>
|
||||
#include <vector>
|
||||
#include <ctime>
|
||||
#include <map>
|
||||
|
||||
|
||||
class ERst : public EclFile
|
||||
{
|
||||
public:
|
||||
explicit ERst(const std::string& filename);
|
||||
bool hasReportStepNumber(int number) const;
|
||||
|
||||
void loadReportStepNumber(int number);
|
||||
|
||||
template <typename T>
|
||||
const std::vector<T>& getRst(const std::string& name, int reportStepNumber);
|
||||
|
||||
const std::vector<int>& listOfReportStepNumbers() const { return seqnum; }
|
||||
|
||||
std::vector<EclEntry> listOfRstArrays(int reportStepNumber);
|
||||
|
||||
private:
|
||||
int nReports;
|
||||
std::vector<int> seqnum; // report step numbers, from SEQNUM array in restart file
|
||||
std::unordered_map<int,bool> reportLoaded;
|
||||
std::map<int, std::pair<int,int>> arrIndexRange; // mapping report step number to array indeces (start and end)
|
||||
|
||||
int getArrayIndex(const std::string& name, int seqnum) const;
|
||||
};
|
||||
|
||||
#endif
|
||||
@@ -1,431 +0,0 @@
|
||||
/*
|
||||
Copyright 2019 Equinor ASA.
|
||||
|
||||
This file is part of the Open Porous Media project (OPM).
|
||||
|
||||
OPM 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.
|
||||
|
||||
OPM 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 for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with OPM. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
|
||||
#include <string>
|
||||
#include <string.h>
|
||||
#include <sstream>
|
||||
#include <iterator>
|
||||
#include <iomanip>
|
||||
#include <algorithm>
|
||||
#include <unistd.h>
|
||||
#include <limits>
|
||||
#include <set>
|
||||
|
||||
#include "EclFile.hpp"
|
||||
#include "ESmry.hpp"
|
||||
|
||||
/*
|
||||
|
||||
KEYWORDS WGNAMES NUMS | PARAM index Corresponding ERT key
|
||||
------------------------------------------------+--------------------------------------------------
|
||||
WGOR OP_1 0 | 0 WGOR:OP_1
|
||||
FOPT +-+-+-+- 0 | 1 FOPT
|
||||
WWCT OP_1 0 | 2 WWCT:OP_1
|
||||
WIR OP_1 0 | 3 WIR:OP_1
|
||||
WGOR WI_1 0 | 4 WWCT:OP_1
|
||||
WWCT W1_1 0 | 5 WWCT:WI_1
|
||||
BPR +-+-+- 12675 | 6 BPR:12675, BPR:i,j,k
|
||||
RPR +-+-+- 1 | 7 RPR:1
|
||||
FOPT +-+-+- 0 | 8 FOPT
|
||||
GGPR NORTH 0 | 9 GGPR:NORTH
|
||||
COPR OP_1 5628 | 10 COPR:OP_1:56286, COPR:OP_1:i,j,k
|
||||
RXF +-+-+- 32768*R1(R2 + 10) | 11 RXF:2-3
|
||||
SOFX OP_1 12675 | 12 SOFX:OP_1:12675, SOFX:OP_1:i,j,jk
|
||||
|
||||
*/
|
||||
|
||||
ESmry::ESmry(const std::string &filename, bool loadBaseRunData)
|
||||
{
|
||||
std::string rootN;
|
||||
std::vector<int> actInd;
|
||||
bool formatted=false;
|
||||
|
||||
char buff[1000];
|
||||
getcwd( buff, 1000 );
|
||||
|
||||
std::string currentWorkingDir(buff);
|
||||
std::string currentDir=currentWorkingDir;
|
||||
|
||||
std::string smspec_filen;
|
||||
std::string unsmry_filen;
|
||||
|
||||
if (filename.substr(filename.length() - 7, 7) == ".SMSPEC") {
|
||||
rootN = filename.substr(0,filename.length() -7);
|
||||
} else if (filename.substr(filename.length() -8, 8) == ".FSMSPEC") {
|
||||
rootN=filename.substr(0,filename.length() -8);
|
||||
formatted = true;
|
||||
} else {
|
||||
rootN = filename;
|
||||
}
|
||||
|
||||
path = currentWorkingDir;
|
||||
updatePathAndRootName(path, rootN);
|
||||
|
||||
if (formatted) {
|
||||
smspec_filen = path + "/" + rootN + ".FSMSPEC";
|
||||
unsmry_filen = path + "/" + rootN + ".FUNSMRY";
|
||||
} else {
|
||||
smspec_filen = path + "/" + rootN + ".SMSPEC";
|
||||
unsmry_filen = path + "/" + rootN + ".UNSMRY";
|
||||
}
|
||||
|
||||
std::vector<std::pair<std::string,int>> smryArray;
|
||||
|
||||
EclFile smspec1(smspec_filen);
|
||||
|
||||
smspec1.loadData(); // loading all data
|
||||
|
||||
std::set<std::string> keywList;
|
||||
|
||||
std::vector<int> dimens = smspec1.get<int>("DIMENS");
|
||||
|
||||
nI = dimens[1];
|
||||
nJ = dimens[2];
|
||||
nK = dimens[3];
|
||||
|
||||
std::vector<std::string> restartArray = smspec1.get<std::string>("RESTART");
|
||||
std::vector<std::string> keywords = smspec1.get<std::string>("KEYWORDS");
|
||||
std::vector<std::string> wgnames = smspec1.get<std::string>("WGNAMES");
|
||||
std::vector<int> nums = smspec1.get<int>("NUMS");
|
||||
|
||||
for (unsigned int i=0; i<keywords.size(); i++) {
|
||||
std::string str1 = makeKeyString(keywords[i], wgnames[i], nums[i]);
|
||||
if (str1.length() > 0) {
|
||||
keywList.insert(str1);
|
||||
}
|
||||
}
|
||||
|
||||
std::string rstRootN = "";
|
||||
std::string pathRstFile = path;
|
||||
|
||||
getRstString(restartArray, pathRstFile, rstRootN);
|
||||
|
||||
smryArray.push_back({smspec_filen, dimens[5]});
|
||||
|
||||
// checking if this is a restart run. Supporting nested restarts (restart, from restart, ...)
|
||||
// std::set keywList is storing keywords from all runs involved
|
||||
|
||||
while ((rstRootN != "") && (loadBaseRunData)) {
|
||||
|
||||
std::string rstFile=pathRstFile+"/"+rstRootN+".SMSPEC";
|
||||
|
||||
EclFile smspec_rst(rstFile);
|
||||
smspec_rst.loadData();
|
||||
|
||||
std::vector<int> dimens = smspec_rst.get<int>("DIMENS");
|
||||
std::vector<std::string> restartArray = smspec_rst.get<std::string>("RESTART");
|
||||
std::vector<std::string> keywords = smspec_rst.get<std::string>("KEYWORDS");
|
||||
std::vector<std::string> wgnames = smspec_rst.get<std::string>("WGNAMES");
|
||||
std::vector<int> nums = smspec_rst.get<int>("NUMS");
|
||||
std::vector<std::string> units = smspec_rst.get<std::string>("UNITS");
|
||||
|
||||
for (size_t i = 0; i < keywords.size(); i++) {
|
||||
std::string str1 = makeKeyString(keywords[i], wgnames[i], nums[i]);
|
||||
if (str1.length() > 0) {
|
||||
keywList.insert(str1);
|
||||
}
|
||||
}
|
||||
|
||||
smryArray.push_back({rstFile,dimens[5]});
|
||||
|
||||
getRstString(restartArray, pathRstFile, rstRootN);
|
||||
}
|
||||
|
||||
int nFiles = static_cast<int>(smryArray.size());
|
||||
|
||||
// arrayInd should hold indices for each vector and runs
|
||||
// n=file number, i = position in param array in file n (one array pr time step), example arrayInd[n][i] = position in keyword list (std::set)
|
||||
|
||||
std::vector<std::vector<int>> arrayInd;
|
||||
|
||||
for (int i = 0; i < nFiles; i++){
|
||||
arrayInd.push_back({});
|
||||
}
|
||||
|
||||
int n = nFiles - 1;
|
||||
|
||||
while (n >= 0){
|
||||
|
||||
auto smry = smryArray[n];
|
||||
|
||||
EclFile smspec(std::get<0>(smry));
|
||||
smspec.loadData();
|
||||
|
||||
std::vector<int> dimens = smspec.get<int>("DIMENS");
|
||||
|
||||
nI = dimens[1];
|
||||
nJ = dimens[2];
|
||||
nK = dimens[3];
|
||||
|
||||
std::vector<std::string> keywords = smspec.get<std::string>("KEYWORDS");
|
||||
std::vector<std::string> wgnames = smspec.get<std::string>("WGNAMES");
|
||||
std::vector<int> nums = smspec.get<int>("NUMS");
|
||||
|
||||
std::vector<int> tmpVect(keywords.size(), -1);
|
||||
arrayInd[n]=tmpVect;
|
||||
|
||||
std::set<std::string>::iterator it;
|
||||
|
||||
for (size_t i=0; i < keywords.size(); i++) {
|
||||
std::string keyw = makeKeyString(keywords[i], wgnames[i], nums[i]);
|
||||
it = std::find(keywList.begin(), keywList.end(), keyw);
|
||||
|
||||
if (it != keywList.end()){
|
||||
arrayInd[n][i] = distance(keywList.begin(), it);
|
||||
}
|
||||
}
|
||||
|
||||
n--;
|
||||
}
|
||||
|
||||
// param array used to stor data for the object, defined in the private section of the class
|
||||
param.assign(keywList.size(), {});
|
||||
|
||||
int fromReportStepNumber = 0;
|
||||
int reportStepNumber = 0;
|
||||
int toReportStepNumber;
|
||||
|
||||
float time = 0.0;
|
||||
int step = 0;
|
||||
|
||||
n = nFiles - 1;
|
||||
|
||||
while (n >= 0){
|
||||
|
||||
reportStepNumber = fromReportStepNumber;
|
||||
|
||||
if (n > 0) {
|
||||
auto rstFrom = smryArray[n-1];
|
||||
toReportStepNumber = std::get<1>(rstFrom);
|
||||
} else {
|
||||
toReportStepNumber = std::numeric_limits<int>::max();
|
||||
}
|
||||
|
||||
std::string smspecFile = std::get<0>(smryArray[n]);
|
||||
std::string unsmryFile = smspecFile.substr(0, smspecFile.size() - 6) + "UNSMRY";
|
||||
|
||||
EclFile unsmry(unsmryFile);
|
||||
unsmry.loadData();
|
||||
|
||||
std::vector<EclFile::EclEntry> list1 = unsmry.getList();
|
||||
|
||||
// 2 or 3 arrays pr time step.
|
||||
// If timestep is a report step: MINISTEP, PARAMS and SEQHDR
|
||||
// else : MINISTEP and PARAMS
|
||||
|
||||
// if summary file starts with a SEQHDR, this will be ignored
|
||||
|
||||
int i = 0;
|
||||
|
||||
if (std::get<0>(list1[0]) == "SEQHDR") {
|
||||
i = 1;
|
||||
}
|
||||
|
||||
while (i < static_cast<int>(list1.size())){
|
||||
|
||||
if (std::get<0>(list1[i]) != "MINISTEP"){
|
||||
std::string message="Reading summary file, expecting keyword MINISTEP, found '" + std::get<0>(list1[i]) + "'";
|
||||
throw std::invalid_argument(message);
|
||||
}
|
||||
|
||||
std::vector<int> ministep = unsmry.get<int>(i);
|
||||
|
||||
i++;
|
||||
|
||||
if (std::get<0>(list1[i]) != "PARAMS") {
|
||||
std::string message="Reading summary file, expecting keyword PARAMS, found '" + std::get<0>(list1[i]) + "'";
|
||||
throw std::invalid_argument(message);
|
||||
}
|
||||
|
||||
std::vector<float> tmpData = unsmry.get<float>(i);
|
||||
|
||||
time = tmpData[0];
|
||||
|
||||
if (time == 0.0) {
|
||||
seqTime.push_back(time);
|
||||
seqIndex.push_back(step);
|
||||
}
|
||||
|
||||
i++;
|
||||
|
||||
if (i < static_cast<int>(list1.size())){
|
||||
if (std::get<0>(list1[i]) == "SEQHDR") {
|
||||
i++;
|
||||
reportStepNumber++;
|
||||
seqTime.push_back(time);
|
||||
seqIndex.push_back(step);
|
||||
}
|
||||
} else {
|
||||
reportStepNumber++;
|
||||
seqTime.push_back(time);
|
||||
seqIndex.push_back(step);
|
||||
}
|
||||
|
||||
// adding defaut values (0.0) in case vector not found in this particular summary file
|
||||
|
||||
for (size_t i = 0; i < param.size(); i++){
|
||||
param[i].push_back(0.0);
|
||||
}
|
||||
|
||||
for (size_t j = 0; j < tmpData.size(); j++) {
|
||||
int ind = arrayInd[n][j];
|
||||
|
||||
if (ind > -1) {
|
||||
param[ind][step] = tmpData[j];
|
||||
}
|
||||
}
|
||||
|
||||
if (reportStepNumber >= toReportStepNumber) {
|
||||
i = static_cast<int>(list1.size());
|
||||
}
|
||||
|
||||
step++;
|
||||
}
|
||||
|
||||
fromReportStepNumber = toReportStepNumber;
|
||||
|
||||
n--;
|
||||
}
|
||||
|
||||
nVect = keywList.size();
|
||||
|
||||
for (auto keyw : keywList){
|
||||
keyword.push_back(keyw);
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
void ESmry::getRstString(const std::vector<std::string>& restartArray, std::string& pathRst, std::string& rootN) const {
|
||||
|
||||
rootN = "";
|
||||
|
||||
for (auto str : restartArray) {
|
||||
rootN = rootN + str;
|
||||
}
|
||||
|
||||
updatePathAndRootName(pathRst, rootN);
|
||||
}
|
||||
|
||||
void ESmry::updatePathAndRootName(std::string& dir, std::string& rootN) const {
|
||||
|
||||
if (rootN.substr(0,2) == "./") {
|
||||
rootN = rootN.substr(2, rootN.size() - 2);
|
||||
}
|
||||
|
||||
if (rootN.substr(0,1) == "/") {
|
||||
int p = rootN.find_last_of("/");
|
||||
dir = rootN.substr(0, p);
|
||||
rootN = rootN.substr(p + 1, rootN.size() - p - 1);
|
||||
} else if (rootN.find_first_of("/") != std::string::npos) {
|
||||
int p = rootN.find_last_of("/");
|
||||
dir = dir + "/" + rootN.substr(0, p);
|
||||
rootN = rootN.substr(p + 1, rootN.size() - p - 1);
|
||||
};
|
||||
}
|
||||
|
||||
bool ESmry::hasKey(const std::string &key) const
|
||||
{
|
||||
return std::find(keyword.begin(), keyword.end(), key) != keyword.end();
|
||||
}
|
||||
|
||||
|
||||
void ESmry::ijk_from_global_index(int glob,int &i,int &j,int &k)
|
||||
{
|
||||
int tmpGlob = glob - 1;
|
||||
|
||||
k = 1 + tmpGlob / (nI * nJ);
|
||||
int rest = tmpGlob % (nI * nJ);
|
||||
|
||||
j = 1 + rest / nI;
|
||||
i = 1 + rest % nI;
|
||||
}
|
||||
|
||||
|
||||
std::string ESmry::makeKeyString(const std::string &keyword, const std::string &wgname, int num)
|
||||
{
|
||||
std::string keyStr;
|
||||
std::vector<std::string> segmExcep= {"STEPTYPE", "SEPARATE", "SUMTHIN"};
|
||||
|
||||
if (keyword.substr(0, 1) == "A") {
|
||||
keyStr = keyword + ":" + std::to_string(num);
|
||||
} else if (keyword.substr(0, 1) == "B") {
|
||||
int _i,_j,_k;
|
||||
ijk_from_global_index(num, _i, _j, _k);
|
||||
|
||||
keyStr = keyword + ":" + std::to_string(_i) + "," + std::to_string(_j) + "," + std::to_string(_k);
|
||||
|
||||
} else if (keyword.substr(0, 1) == "C") {
|
||||
int _i,_j,_k;
|
||||
|
||||
if (num > 0) {
|
||||
ijk_from_global_index(num, _i, _j, _k);
|
||||
keyStr = keyword + ":" + wgname+ ":" + std::to_string(_i) + "," + std::to_string(_j) + "," + std::to_string(_k);
|
||||
}
|
||||
} else if (keyword.substr(0, 1) == "G") {
|
||||
if ( wgname != ":+:+:+:+") {
|
||||
keyStr = keyword + ":" + wgname;
|
||||
}
|
||||
} else if (keyword.substr(0, 1) == "R" && keyword.substr(2, 1) == "F") {
|
||||
// NUMS = R1 + 32768*(R2 + 10)
|
||||
int r2 = 0;
|
||||
int y = 32768 * (r2 + 10) - num;
|
||||
|
||||
while (y <0 ) {
|
||||
r2++;
|
||||
y = 32768 * (r2 + 10) - num;
|
||||
}
|
||||
|
||||
r2--;
|
||||
int r1 = num - 32768 * (r2 + 10);
|
||||
|
||||
keyStr = keyword + ":" + std::to_string(r1) + "-" + std::to_string(r2);
|
||||
} else if (keyword.substr(0, 1) == "R") {
|
||||
keyStr = keyword + ":" + std::to_string(num);
|
||||
} else if (keyword.substr(0, 1) == "S") {
|
||||
auto it = std::find(segmExcep.begin(), segmExcep.end(), keyword);
|
||||
if (it != segmExcep.end()) {
|
||||
keyStr = keyword;
|
||||
} else {
|
||||
keyStr = keyword + ":" + wgname + ":" + std::to_string(num);
|
||||
}
|
||||
} else if (keyword.substr(0,1) == "W") {
|
||||
if (wgname != ":+:+:+:+") {
|
||||
keyStr = keyword + ":" + wgname;
|
||||
}
|
||||
} else {
|
||||
keyStr = keyword;
|
||||
}
|
||||
|
||||
return keyStr;
|
||||
}
|
||||
|
||||
|
||||
const std::vector<float>& ESmry::get(const std::string& name) const
|
||||
{
|
||||
auto it = std::find(keyword.begin(), keyword.end(), name);
|
||||
|
||||
if (it == keyword.end()) {
|
||||
std::string message="keyword " + name + " not found ";
|
||||
OPM_THROW(std::invalid_argument, message);
|
||||
}
|
||||
|
||||
int ind = std::distance(keyword.begin(), it);
|
||||
|
||||
return param[ind];
|
||||
}
|
||||
@@ -1,60 +0,0 @@
|
||||
/*
|
||||
Copyright 2019 Equinor ASA.
|
||||
|
||||
This file is part of the Open Porous Media project (OPM).
|
||||
|
||||
OPM 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.
|
||||
|
||||
OPM 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 for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with OPM. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#ifndef ESMRY_HPP
|
||||
#define ESMRY_HPP
|
||||
|
||||
#include <iostream>
|
||||
#include <string>
|
||||
#include <fstream>
|
||||
#include <vector>
|
||||
#include <ctime>
|
||||
#include <map>
|
||||
|
||||
class ESmry
|
||||
{
|
||||
public:
|
||||
explicit ESmry(const std::string& filename, bool loadBaseRunData=false); // filename (smspec file) or file root name
|
||||
|
||||
const int numberOfVectors() const { return nVect; }
|
||||
|
||||
bool hasKey(const std::string& key) const;
|
||||
|
||||
const std::vector<float>& get(const std::string& name) const;
|
||||
const std::vector<std::string>& keywordList() const { return keyword; }
|
||||
|
||||
private:
|
||||
int nVect, nI, nJ, nK;
|
||||
std::string path="";
|
||||
|
||||
void ijk_from_global_index(int glob, int &i, int &j, int &k);
|
||||
std::vector<std::vector<float>> param;
|
||||
std::vector<std::string> keyword;
|
||||
|
||||
std::vector<int> seqIndex;
|
||||
std::vector<float> seqTime;
|
||||
|
||||
void getRstString(const std::vector<std::string> &restartArray, std::string &path, std::string &rootN) const;
|
||||
void updatePathAndRootName(std::string &path, std::string &rootN) const;
|
||||
|
||||
std::string makeKeyString(const std::string& keyword, const std::string& wgname, int num);
|
||||
};
|
||||
|
||||
#endif
|
||||
|
||||
|
||||
@@ -1,824 +0,0 @@
|
||||
/*
|
||||
Copyright 2019 Equinor ASA.
|
||||
|
||||
This file is part of the Open Porous Media project (OPM).
|
||||
|
||||
OPM 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.
|
||||
|
||||
OPM 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 for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with OPM. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#include "EclFile.hpp"
|
||||
#include "EclUtil.hpp"
|
||||
|
||||
#include <array>
|
||||
#include <functional>
|
||||
#include <string>
|
||||
#include <string.h>
|
||||
#include <sstream>
|
||||
#include <iterator>
|
||||
#include <iomanip>
|
||||
#include <algorithm>
|
||||
|
||||
#include <opm/common/ErrorMacros.hpp>
|
||||
|
||||
|
||||
// anonymous namespace for EclFile
|
||||
|
||||
namespace {
|
||||
|
||||
|
||||
bool isFormatted(const std::string& filename)
|
||||
{
|
||||
int p = filename.find_last_of(".");
|
||||
int l = filename.length();
|
||||
|
||||
std::string rootN = filename.substr(0,p);
|
||||
std::string extension = filename.substr(p,l-p);
|
||||
|
||||
return extension.substr(1,1) == "F" || extension.substr(1,1) == "A";
|
||||
}
|
||||
|
||||
|
||||
bool isEOF(std::fstream* fileH)
|
||||
{
|
||||
int num;
|
||||
long int pos = fileH->tellg();
|
||||
fileH->read(reinterpret_cast<char*>(&num), sizeof(num));
|
||||
|
||||
if (fileH->eof()) {
|
||||
return true;
|
||||
} else {
|
||||
fileH->seekg (pos);
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void readBinaryHeader(std::fstream& fileH, std::string& arrName,
|
||||
int& size, EIOD::eclArrType &arrType)
|
||||
{
|
||||
int bhead;
|
||||
std::string tmpStrName(8,' ');
|
||||
std::string tmpStrType(4,' ');
|
||||
|
||||
fileH.read(reinterpret_cast<char*>(&bhead), sizeof(bhead));
|
||||
bhead = EIOD::flipEndianInt(bhead);
|
||||
|
||||
if (bhead != 16) {
|
||||
std::string message="Error reading binary header. Expected 16 bytes of header data, found " + std::to_string(bhead);
|
||||
OPM_THROW(std::runtime_error, message);
|
||||
}
|
||||
|
||||
fileH.read(&tmpStrName[0], 8);
|
||||
|
||||
fileH.read(reinterpret_cast<char*>(&size), sizeof(size));
|
||||
size = EIOD::flipEndianInt(size);
|
||||
|
||||
fileH.read(&tmpStrType[0], 4);
|
||||
|
||||
fileH.read(reinterpret_cast<char*>(&bhead), sizeof(bhead));
|
||||
bhead = EIOD::flipEndianInt(bhead);
|
||||
|
||||
if (bhead != 16) {
|
||||
std::string message="Error reading binary header. Expected 16 bytes of header data, found " + std::to_string(bhead);
|
||||
OPM_THROW(std::runtime_error, message);
|
||||
}
|
||||
|
||||
arrName = tmpStrName;
|
||||
if (tmpStrType == "INTE")
|
||||
arrType = EIOD::INTE;
|
||||
else if (tmpStrType == "REAL")
|
||||
arrType = EIOD::REAL;
|
||||
else if (tmpStrType == "DOUB")
|
||||
arrType = EIOD::DOUB;
|
||||
else if (tmpStrType == "CHAR")
|
||||
arrType = EIOD::CHAR;
|
||||
else if (tmpStrType =="LOGI")
|
||||
arrType = EIOD::LOGI;
|
||||
else if (tmpStrType == "MESS")
|
||||
arrType = EIOD::MESS;
|
||||
else
|
||||
OPM_THROW(std::runtime_error, "Error, unknown array type '" + tmpStrType +"'");
|
||||
}
|
||||
|
||||
|
||||
unsigned long int sizeOnDiskBinary(int num, EIOD::eclArrType arrType)
|
||||
{
|
||||
unsigned long int size = 0;
|
||||
|
||||
if (arrType == EIOD::MESS) {
|
||||
if (num > 0) {
|
||||
std::string message = "In routine calcSizeOfArray, type MESS can not have size > 0";
|
||||
OPM_THROW(std::invalid_argument, message);
|
||||
}
|
||||
} else {
|
||||
auto sizeData = EIOD::block_size_data_binary(arrType);
|
||||
|
||||
int sizeOfElement = std::get<0>(sizeData);
|
||||
int maxBlockSize = std::get<1>(sizeData);
|
||||
int maxNumberOfElements = maxBlockSize / sizeOfElement;
|
||||
|
||||
size = num * sizeOfElement;
|
||||
size = size + ((num-1) / maxNumberOfElements) * 2 * EIOD::sizeOfInte; // 8 byte (two integers) every 1000 element
|
||||
|
||||
if (num > 0) {
|
||||
size = size + 2 * EIOD::sizeOfInte;
|
||||
}
|
||||
}
|
||||
|
||||
return size;
|
||||
}
|
||||
|
||||
unsigned long int sizeOnDiskFormatted(const int num, EIOD::eclArrType arrType)
|
||||
{
|
||||
unsigned long int size = 0;
|
||||
|
||||
if (arrType == EIOD::MESS) {
|
||||
if (num > 0) {
|
||||
OPM_THROW(std::invalid_argument, "In routine calcSizeOfArray, type MESS can not have size > 0");
|
||||
}
|
||||
} else {
|
||||
auto sizeData = block_size_data_formatted(arrType);
|
||||
|
||||
int maxBlockSize = std::get<0>(sizeData);
|
||||
int nColumns = std::get<1>(sizeData);
|
||||
int columnWidth = std::get<2>(sizeData);
|
||||
|
||||
int nBlocks = num /maxBlockSize;
|
||||
int sizeOfLastBlock = num % maxBlockSize;
|
||||
|
||||
size = 0;
|
||||
|
||||
if (nBlocks > 0) {
|
||||
int nLinesBlock = maxBlockSize / nColumns;
|
||||
int rest = maxBlockSize % nColumns;
|
||||
|
||||
if (rest > 0) {
|
||||
nLinesBlock++;
|
||||
}
|
||||
|
||||
long int blockSize = maxBlockSize * columnWidth + nLinesBlock;
|
||||
size = nBlocks * blockSize;
|
||||
}
|
||||
|
||||
int nLines = sizeOfLastBlock / nColumns;
|
||||
int rest = sizeOfLastBlock % nColumns;
|
||||
|
||||
size = size + sizeOfLastBlock * columnWidth + nLines;
|
||||
|
||||
if (rest > 0) {
|
||||
size++;
|
||||
}
|
||||
}
|
||||
|
||||
return size;
|
||||
}
|
||||
|
||||
|
||||
template<typename T, typename T2>
|
||||
std::vector<T> readBinaryArray(std::fstream& fileH, const int size, EIOD::eclArrType type,
|
||||
std::function<T(T2)>& flip)
|
||||
{
|
||||
std::vector<T> arr;
|
||||
|
||||
auto sizeData = block_size_data_binary(type);
|
||||
int sizeOfElement = std::get<0>(sizeData);
|
||||
int maxBlockSize = std::get<1>(sizeData);
|
||||
int maxNumberOfElements = maxBlockSize / sizeOfElement;
|
||||
|
||||
arr.reserve(size);
|
||||
|
||||
int rest = size;
|
||||
while (rest > 0) {
|
||||
int dhead;
|
||||
fileH.read(reinterpret_cast<char*>(&dhead), sizeof(dhead));
|
||||
dhead = EIOD::flipEndianInt(dhead);
|
||||
|
||||
int num = dhead / sizeOfElement;
|
||||
|
||||
if ((num > maxNumberOfElements) || (num < 0)) {
|
||||
OPM_THROW(std::runtime_error, "Error reading binary data, inconsistent header data or incorrect number of elements");
|
||||
}
|
||||
|
||||
for (int i = 0; i < num; i++) {
|
||||
T2 value;
|
||||
fileH.read(reinterpret_cast<char*>(&value), sizeOfElement);
|
||||
arr.push_back(flip(value));
|
||||
}
|
||||
|
||||
rest -= num;
|
||||
|
||||
if (( num < maxNumberOfElements && rest != 0) ||
|
||||
(num == maxNumberOfElements && rest < 0)) {
|
||||
std::string message = "Error reading binary data, incorrect number of elements";
|
||||
OPM_THROW(std::runtime_error, message);
|
||||
}
|
||||
|
||||
int dtail;
|
||||
fileH.read(reinterpret_cast<char*>(&dtail), sizeof(dtail));
|
||||
dtail = EIOD::flipEndianInt(dtail);
|
||||
|
||||
if (dhead != dtail) {
|
||||
OPM_THROW(std::runtime_error, "Error reading binary data, tail not matching header.");
|
||||
}
|
||||
}
|
||||
|
||||
return arr;
|
||||
}
|
||||
|
||||
|
||||
std::vector<int> readBinaryInteArray(std::fstream &fileH, const int size)
|
||||
{
|
||||
std::function<int(int)> f = EIOD::flipEndianInt;
|
||||
return readBinaryArray<int,int>(fileH, size, EIOD::INTE, f);
|
||||
}
|
||||
|
||||
|
||||
std::vector<float> readBinaryRealArray(std::fstream& fileH, const int size)
|
||||
{
|
||||
std::function<float(float)> f = EIOD::flipEndianFloat;
|
||||
return readBinaryArray<float,float>(fileH, size, EIOD::REAL, f);
|
||||
}
|
||||
|
||||
|
||||
std::vector<double> readBinaryDoubArray(std::fstream& fileH, const int size)
|
||||
{
|
||||
std::function<double(double)> f = EIOD::flipEndianDouble;
|
||||
return readBinaryArray<double,double>(fileH, size, EIOD::DOUB, f);
|
||||
}
|
||||
|
||||
std::vector<bool> readBinaryLogiArray(std::fstream &fileH, const int size)
|
||||
{
|
||||
std::function<bool(unsigned int)> f = [](unsigned int intVal)
|
||||
{
|
||||
bool value;
|
||||
if (intVal == EIOD::true_value) {
|
||||
value = true;
|
||||
} else if (intVal == EIOD::false_value) {
|
||||
value = false;
|
||||
} else {
|
||||
OPM_THROW(std::runtime_error, "Error reading logi value");
|
||||
}
|
||||
|
||||
return value;
|
||||
};
|
||||
return readBinaryArray<bool,unsigned int>(fileH, size, EIOD::LOGI, f);
|
||||
}
|
||||
|
||||
|
||||
std::vector<std::string> readBinaryCharArray(std::fstream& fileH, const int size)
|
||||
{
|
||||
using Char8 = std::array<char, 8>;
|
||||
std::function<std::string(Char8)> f = [](const Char8& val)
|
||||
{
|
||||
std::string res(val.begin(), val.end());
|
||||
return EIOD::trimr(res);
|
||||
};
|
||||
return readBinaryArray<std::string,Char8>(fileH, size, EIOD::CHAR, f);
|
||||
}
|
||||
|
||||
|
||||
std::vector<std::string> split_string(const std::string& inputStr)
|
||||
{
|
||||
std::istringstream iss(inputStr);
|
||||
|
||||
std::vector<std::string> tokens {std::istream_iterator<std::string>{iss},
|
||||
std::istream_iterator<std::string>{}
|
||||
};
|
||||
|
||||
return tokens;
|
||||
}
|
||||
|
||||
|
||||
void readFormattedHeader(std::fstream& fileH, std::string& arrName,
|
||||
int &num, EIOD::eclArrType &arrType)
|
||||
{
|
||||
std::string line;
|
||||
getline(fileH,line);
|
||||
|
||||
int p1 = line.find_first_of("'");
|
||||
int p2 = line.find_first_of("'",p1+1);
|
||||
int p3 = line.find_first_of("'",p2+1);
|
||||
int p4 = line.find_first_of("'",p3+1);
|
||||
|
||||
if (p1 == -1 || p2 == -1 || p3 == -1 || p4 == -1) {
|
||||
OPM_THROW(std::runtime_error, "Header name and type should be enclosed with '");
|
||||
}
|
||||
|
||||
arrName = line.substr(p1 + 1, p2 - p1 - 1);
|
||||
std::string antStr = line.substr(p2 + 1, p3 - p2 - 1);
|
||||
std::string arrTypeStr = line.substr(p3 + 1, p4 - p3 - 1);
|
||||
|
||||
num = std::stoi(antStr);
|
||||
|
||||
if (arrTypeStr == "INTE")
|
||||
arrType = EIOD::INTE;
|
||||
else if (arrTypeStr == "REAL")
|
||||
arrType = EIOD::REAL;
|
||||
else if (arrTypeStr == "DOUB")
|
||||
arrType = EIOD::DOUB;
|
||||
else if (arrTypeStr == "CHAR")
|
||||
arrType = EIOD::CHAR;
|
||||
else if (arrTypeStr == "LOGI")
|
||||
arrType = EIOD::LOGI;
|
||||
else if (arrTypeStr == "MESS")
|
||||
arrType = EIOD::MESS;
|
||||
else
|
||||
OPM_THROW(std::runtime_error, "Error, unknown array type '" + arrTypeStr +"'");
|
||||
|
||||
if (arrName.size() != 8) {
|
||||
OPM_THROW(std::runtime_error, "Header name should be 8 characters");
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
template<typename T>
|
||||
std::vector<T> readFormattedArray(std::fstream& fileH, const int size,
|
||||
std::function<T(const std::string&)>& process)
|
||||
{
|
||||
std::vector<T> arr;
|
||||
std::vector<std::string> tokens;
|
||||
std::string line;
|
||||
|
||||
int num = 0;
|
||||
while (num < size) {
|
||||
if (fileH.eof()) {
|
||||
OPM_THROW(std::runtime_error, "End of file reached when reading array");
|
||||
}
|
||||
|
||||
getline(fileH, line);
|
||||
tokens = split_string(line);
|
||||
|
||||
for (const std::string& token : tokens) {
|
||||
arr.push_back(process(token));
|
||||
}
|
||||
|
||||
num = num + tokens.size();
|
||||
}
|
||||
|
||||
return arr;
|
||||
}
|
||||
|
||||
|
||||
std::vector<int> readFormattedInteArray(std::fstream& fileH, const int size)
|
||||
{
|
||||
std::function<int(const std::string&)> f = [](const std::string& val)
|
||||
{
|
||||
return std::stoi(val);
|
||||
};
|
||||
return readFormattedArray(fileH, size, f);
|
||||
}
|
||||
|
||||
|
||||
std::vector<std::string> readFormattedCharArray(std::fstream& fileH, const int size)
|
||||
{
|
||||
if (!fileH.is_open()) {
|
||||
OPM_THROW(std::runtime_error, "fstream fileH not open for reading");
|
||||
}
|
||||
|
||||
std::vector<std::string> arr;
|
||||
int num = 0;
|
||||
while (num < size) {
|
||||
std::string line;
|
||||
getline(fileH, line);
|
||||
|
||||
if (line.empty()) {
|
||||
std::string message="Reading formatted char array, end of file or blank line, read " + std::to_string(arr.size()) + " of " + std::to_string(size) + " elements";
|
||||
OPM_THROW(std::runtime_error, message);
|
||||
}
|
||||
|
||||
int p1 = line.find_first_of("'");
|
||||
|
||||
if (p1 == -1) {
|
||||
std::string message="Reading formatted char array, all strings must be enclosed by apostrophe (')";
|
||||
OPM_THROW(std::runtime_error, message);
|
||||
}
|
||||
|
||||
while (p1 > -1) {
|
||||
int p2 = line.find_first_of("'", p1 + 1);
|
||||
|
||||
if (p2 == -1) {
|
||||
std::string message="Reading formatted char array, all strings must be enclosed by apostrophe (')";
|
||||
OPM_THROW(std::runtime_error, message);
|
||||
}
|
||||
|
||||
std::string value = line.substr(p1 + 1, p2 - p1 - 1);
|
||||
|
||||
if (value.size() != 8) {
|
||||
std::string message="Reading formatted char array, all strings should have 8 characters";
|
||||
OPM_THROW(std::runtime_error, message);
|
||||
}
|
||||
|
||||
if (value == " ") {
|
||||
arr.push_back("");
|
||||
} else {
|
||||
arr.push_back(EIOD::trimr(value));
|
||||
}
|
||||
|
||||
num++;
|
||||
|
||||
p1 = line.find_first_of("'", p2 + 1);
|
||||
}
|
||||
}
|
||||
|
||||
return arr;
|
||||
}
|
||||
|
||||
|
||||
std::vector<float> readFormattedRealArray(std::fstream &fileH, const int size)
|
||||
{
|
||||
std::function<float(const std::string&)> f = [](const std::string& val)
|
||||
{
|
||||
// tskille: temporary fix, need to be discussed. OPM flow writes numbers
|
||||
// that are outside valid range for float, and function stof will fail
|
||||
double dtmpv = std::stod(val);
|
||||
return dtmpv;
|
||||
};
|
||||
return readFormattedArray<float>(fileH, size, f);
|
||||
}
|
||||
|
||||
|
||||
std::vector<bool> readFormattedLogiArray(std::fstream& fileH, const int size)
|
||||
{
|
||||
std::function<bool(const std::string&)> f = [](const std::string& val)
|
||||
{
|
||||
if (val == "T") {
|
||||
return true;
|
||||
} else if (val == "F") {
|
||||
return false;
|
||||
} else {
|
||||
std::string message="Could not convert '" + val + "' to a bool value ";
|
||||
OPM_THROW(std::invalid_argument, message);
|
||||
}
|
||||
};
|
||||
return readFormattedArray<bool>(fileH, size, f);
|
||||
}
|
||||
|
||||
std::vector<double> readFormattedDoubArray(std::fstream& fileH, const int size)
|
||||
{
|
||||
std::function<double(const std::string&)> f = [](const std::string& value)
|
||||
{
|
||||
std::string val(value);
|
||||
int p1 = val.find_first_of("D");
|
||||
|
||||
if (p1 == -1) {
|
||||
p1 = val.find_first_of("-", 1);
|
||||
if (p1 > -1) {
|
||||
val = val.insert(p1,"E");
|
||||
} else {
|
||||
p1 = val.find_first_of("+", 1);
|
||||
|
||||
if (p1 == -1) {
|
||||
std::string message="In Routine Read readFormattedDoubArray, could not convert '" + val + "' to double.";
|
||||
OPM_THROW(std::invalid_argument,message);
|
||||
}
|
||||
|
||||
val = val.insert(p1,"E");
|
||||
}
|
||||
} else {
|
||||
val.replace(p1,1,"E");
|
||||
}
|
||||
|
||||
return std::stod(val);
|
||||
};
|
||||
return readFormattedArray<double>(fileH, size, f);
|
||||
}
|
||||
|
||||
} // anonymous namespace
|
||||
|
||||
|
||||
EclFile::EclFile(const std::string& filename) : inputFilename(filename)
|
||||
{
|
||||
std::fstream fileH;
|
||||
|
||||
formatted = isFormatted(filename);
|
||||
|
||||
if (formatted) {
|
||||
fileH.open(filename, std::ios::in);
|
||||
} else {
|
||||
fileH.open(filename, std::ios::in | std::ios::binary);
|
||||
}
|
||||
|
||||
if (!fileH) {
|
||||
std::string message="Could not open file: " + filename;
|
||||
OPM_THROW(std::runtime_error, message);
|
||||
}
|
||||
|
||||
int n = 0;
|
||||
while (!isEOF(&fileH)) {
|
||||
std::string arrName(8,' ');
|
||||
EIOD::eclArrType arrType;
|
||||
int num;
|
||||
|
||||
if (formatted) {
|
||||
readFormattedHeader(fileH,arrName,num,arrType);
|
||||
} else {
|
||||
readBinaryHeader(fileH,arrName,num,arrType);
|
||||
}
|
||||
|
||||
array_size.push_back(num);
|
||||
array_type.push_back(arrType);
|
||||
|
||||
array_name.push_back(EIOD::trimr(arrName));
|
||||
array_index[array_name[n]] = n;
|
||||
|
||||
unsigned long int pos = fileH.tellg();
|
||||
ifStreamPos.push_back(pos);
|
||||
|
||||
arrayLoaded.push_back(false);
|
||||
|
||||
if (formatted) {
|
||||
unsigned long int sizeOfNextArray = sizeOnDiskFormatted(num, arrType);
|
||||
fileH.ignore(sizeOfNextArray);
|
||||
} else {
|
||||
unsigned long int sizeOfNextArray = sizeOnDiskBinary(num, arrType);
|
||||
fileH.ignore(sizeOfNextArray);
|
||||
}
|
||||
|
||||
n++;
|
||||
};
|
||||
|
||||
fileH.close();
|
||||
}
|
||||
|
||||
|
||||
void EclFile::loadArray(std::fstream& fileH, int arrIndex)
|
||||
{
|
||||
fileH.seekg (ifStreamPos[arrIndex], fileH.beg);
|
||||
|
||||
if (formatted) {
|
||||
switch (array_type[arrIndex]) {
|
||||
case EIOD::INTE:
|
||||
inte_array[arrIndex] = readFormattedInteArray(fileH, array_size[arrIndex]);
|
||||
break;
|
||||
case EIOD::REAL:
|
||||
real_array[arrIndex] = readFormattedRealArray(fileH, array_size[arrIndex]);
|
||||
break;
|
||||
case EIOD::DOUB:
|
||||
doub_array[arrIndex] = readFormattedDoubArray(fileH, array_size[arrIndex]);
|
||||
break;
|
||||
case EIOD::LOGI:
|
||||
logi_array[arrIndex] = readFormattedLogiArray(fileH, array_size[arrIndex]);
|
||||
break;
|
||||
case EIOD::CHAR:
|
||||
char_array[arrIndex] = readFormattedCharArray(fileH, array_size[arrIndex]);
|
||||
break;
|
||||
case EIOD::MESS:
|
||||
break;
|
||||
default:
|
||||
OPM_THROW(std::runtime_error, "Asked to read unexpected array type");
|
||||
break;
|
||||
}
|
||||
|
||||
} else {
|
||||
switch (array_type[arrIndex]) {
|
||||
case EIOD::INTE:
|
||||
inte_array[arrIndex] = readBinaryInteArray(fileH, array_size[arrIndex]);
|
||||
break;
|
||||
case EIOD::REAL:
|
||||
real_array[arrIndex] = readBinaryRealArray(fileH, array_size[arrIndex]);
|
||||
break;
|
||||
case EIOD::DOUB:
|
||||
doub_array[arrIndex] = readBinaryDoubArray(fileH, array_size[arrIndex]);
|
||||
break;
|
||||
case EIOD::LOGI:
|
||||
logi_array[arrIndex] = readBinaryLogiArray(fileH, array_size[arrIndex]);
|
||||
break;
|
||||
case EIOD::CHAR:
|
||||
char_array[arrIndex] = readBinaryCharArray(fileH, array_size[arrIndex]);
|
||||
break;
|
||||
case EIOD::MESS:
|
||||
break;
|
||||
default:
|
||||
OPM_THROW(std::runtime_error, "Asked to read unexpected array type");
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
arrayLoaded[arrIndex] = true;
|
||||
}
|
||||
|
||||
|
||||
void EclFile::loadData()
|
||||
{
|
||||
std::fstream fileH;
|
||||
|
||||
if (formatted) {
|
||||
fileH.open(inputFilename, std::ios::in);
|
||||
} else {
|
||||
fileH.open(inputFilename, std::ios::in | std::ios::binary);
|
||||
}
|
||||
|
||||
if (!fileH) {
|
||||
std::string message="Could not open file: '" + inputFilename +"'";
|
||||
OPM_THROW(std::runtime_error, message);
|
||||
}
|
||||
|
||||
for (size_t i = 0; i < array_name.size(); i++) {
|
||||
loadArray(fileH, i);
|
||||
}
|
||||
|
||||
fileH.close();
|
||||
}
|
||||
|
||||
|
||||
void EclFile::loadData(const std::string& name)
|
||||
{
|
||||
std::fstream fileH;
|
||||
|
||||
if (formatted) {
|
||||
fileH.open(inputFilename, std::ios::in);
|
||||
} else {
|
||||
fileH.open(inputFilename, std::ios::in | std::ios::binary);
|
||||
}
|
||||
|
||||
if (!fileH) {
|
||||
std::string message="Could not open file: '" + inputFilename +"'";
|
||||
OPM_THROW(std::runtime_error, message);
|
||||
}
|
||||
|
||||
for (size_t i = 0; i < array_name.size(); i++) {
|
||||
if (array_name[i] == name) {
|
||||
loadArray(fileH, i);
|
||||
}
|
||||
}
|
||||
|
||||
fileH.close();
|
||||
}
|
||||
|
||||
|
||||
void EclFile::loadData(const std::vector<int>& arrIndex)
|
||||
{
|
||||
std::fstream fileH;
|
||||
|
||||
if (formatted) {
|
||||
fileH.open(inputFilename, std::ios::in);
|
||||
} else {
|
||||
fileH.open(inputFilename, std::ios::in | std::ios::binary);
|
||||
}
|
||||
|
||||
if (!fileH) {
|
||||
std::string message="Could not open file: '" + inputFilename +"'";
|
||||
OPM_THROW(std::runtime_error, message);
|
||||
}
|
||||
|
||||
for (int ind : arrIndex) {
|
||||
loadArray(fileH, ind);
|
||||
}
|
||||
|
||||
fileH.close();
|
||||
}
|
||||
|
||||
|
||||
void EclFile::loadData(int arrIndex)
|
||||
{
|
||||
std::fstream fileH;
|
||||
|
||||
if (formatted) {
|
||||
fileH.open(inputFilename, std::ios::in);
|
||||
} else {
|
||||
fileH.open(inputFilename, std::ios::in | std::ios::binary);
|
||||
}
|
||||
|
||||
if (!fileH) {
|
||||
std::string message="Could not open file: '" + inputFilename +"'";
|
||||
OPM_THROW(std::runtime_error, message);
|
||||
}
|
||||
|
||||
loadArray(fileH, arrIndex);
|
||||
|
||||
fileH.close();
|
||||
}
|
||||
|
||||
|
||||
std::vector<EclFile::EclEntry> EclFile::getList() const
|
||||
{
|
||||
std::vector<EclEntry> list;
|
||||
list.reserve(this->array_name.size());
|
||||
|
||||
for (size_t i = 0; i < array_name.size(); i++) {
|
||||
list.emplace_back(array_name[i], array_type[i], array_size[i]);
|
||||
}
|
||||
|
||||
return list;
|
||||
}
|
||||
|
||||
|
||||
template<>
|
||||
const std::vector<int>& EclFile::get<int>(int arrIndex)
|
||||
{
|
||||
return getImpl(arrIndex, EIOD::INTE, inte_array, "integer");
|
||||
}
|
||||
|
||||
template<>
|
||||
const std::vector<float>&
|
||||
EclFile::get<float>(int arrIndex)
|
||||
{
|
||||
return getImpl(arrIndex, EIOD::REAL, real_array, "float");
|
||||
}
|
||||
|
||||
|
||||
template<>
|
||||
const std::vector<double> &EclFile::get<double>(int arrIndex)
|
||||
{
|
||||
return getImpl(arrIndex, EIOD::DOUB, doub_array, "double");
|
||||
}
|
||||
|
||||
|
||||
template<>
|
||||
const std::vector<bool>& EclFile::get<bool>(int arrIndex)
|
||||
{
|
||||
return getImpl(arrIndex, EIOD::LOGI, logi_array, "bool");
|
||||
}
|
||||
|
||||
|
||||
template<>
|
||||
const std::vector<std::string>& EclFile::get<std::string>(int arrIndex)
|
||||
{
|
||||
return getImpl(arrIndex, EIOD::CHAR, char_array, "string");
|
||||
}
|
||||
|
||||
|
||||
bool EclFile::hasKey(const std::string &name) const
|
||||
{
|
||||
auto search = array_index.find(name);
|
||||
return search != array_index.end();
|
||||
}
|
||||
|
||||
|
||||
template<>
|
||||
const std::vector<int>& EclFile::get<int>(const std::string& name)
|
||||
{
|
||||
auto search = array_index.find(name);
|
||||
|
||||
if (search == array_index.end()) {
|
||||
std::string message="key '"+name + "' not found";
|
||||
OPM_THROW(std::invalid_argument, message);
|
||||
}
|
||||
|
||||
return getImpl(search->second, EIOD::INTE, inte_array, "integer");
|
||||
}
|
||||
|
||||
template<>
|
||||
const std::vector<float>& EclFile::get<float>(const std::string& name)
|
||||
{
|
||||
auto search = array_index.find(name);
|
||||
|
||||
if (search == array_index.end()) {
|
||||
std::string message="key '"+name + "' not found";
|
||||
OPM_THROW(std::invalid_argument, message);
|
||||
}
|
||||
|
||||
return getImpl(search->second, EIOD::REAL, real_array, "float");
|
||||
}
|
||||
|
||||
|
||||
template<>
|
||||
const std::vector<double>& EclFile::get<double>(const std::string &name)
|
||||
{
|
||||
auto search = array_index.find(name);
|
||||
|
||||
if (search == array_index.end()) {
|
||||
std::string message="key '"+name + "' not found";
|
||||
OPM_THROW(std::invalid_argument, message);
|
||||
}
|
||||
|
||||
return getImpl(search->second, EIOD::DOUB, doub_array, "double");
|
||||
}
|
||||
|
||||
|
||||
template<>
|
||||
const std::vector<bool>& EclFile::get<bool>(const std::string &name)
|
||||
{
|
||||
auto search = array_index.find(name);
|
||||
|
||||
if (search == array_index.end()) {
|
||||
std::string message="key '"+name + "' not found";
|
||||
OPM_THROW(std::invalid_argument, message);
|
||||
}
|
||||
|
||||
return getImpl(search->second, EIOD::LOGI, logi_array, "bool");
|
||||
}
|
||||
|
||||
|
||||
template<>
|
||||
const std::vector<std::string>& EclFile::get<std::string>(const std::string &name)
|
||||
{
|
||||
auto search = array_index.find(name);
|
||||
|
||||
if (search == array_index.end()) {
|
||||
std::string message="key '"+name + "' not found";
|
||||
OPM_THROW(std::invalid_argument, message);
|
||||
}
|
||||
|
||||
return getImpl(search->second, EIOD::CHAR, char_array, "string");
|
||||
}
|
||||
@@ -1,110 +0,0 @@
|
||||
/*
|
||||
Copyright 2019 Equinor ASA.
|
||||
|
||||
This file is part of the Open Porous Media project (OPM).
|
||||
|
||||
OPM 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.
|
||||
|
||||
OPM 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 for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with OPM. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#ifndef ECLFILE_HPP
|
||||
#define ECLFILE_HPP
|
||||
|
||||
#include <opm/common/ErrorMacros.hpp>
|
||||
#include <examples/test_util/data/EclIOdata.hpp>
|
||||
|
||||
#include <iostream>
|
||||
#include <string>
|
||||
#include <fstream>
|
||||
#include <vector>
|
||||
#include <ctime>
|
||||
#include <map>
|
||||
#include <unordered_map>
|
||||
#include <stdio.h>
|
||||
|
||||
namespace EIOD = Opm::ecl;
|
||||
|
||||
class EclFile
|
||||
{
|
||||
public:
|
||||
explicit EclFile(const std::string& filename);
|
||||
bool formattedInput() { return formatted; }
|
||||
|
||||
void loadData(); // load all data
|
||||
void loadData(const std::string& arrName); // load all arrays with array name equal to arrName
|
||||
void loadData(int arrIndex); // load data based on array indices in vector arrIndex
|
||||
void loadData(const std::vector<int>& arrIndex); // load data based on array indices in vector arrIndex
|
||||
|
||||
void clearData()
|
||||
{
|
||||
inte_array.clear();
|
||||
real_array.clear();
|
||||
doub_array.clear();
|
||||
logi_array.clear();
|
||||
char_array.clear();
|
||||
}
|
||||
|
||||
using EclEntry = std::tuple<std::string, EIOD::eclArrType, int>;
|
||||
std::vector<EclEntry> getList() const;
|
||||
|
||||
template <typename T>
|
||||
const std::vector<T>& get(int arrIndex);
|
||||
|
||||
template <typename T>
|
||||
const std::vector<T>& get(const std::string& name);
|
||||
|
||||
bool hasKey(const std::string &name) const;
|
||||
|
||||
const std::vector<std::string>& arrayNames() const { return array_name; }
|
||||
|
||||
protected:
|
||||
bool formatted;
|
||||
std::string inputFilename;
|
||||
|
||||
std::unordered_map<int, std::vector<int>> inte_array;
|
||||
std::unordered_map<int, std::vector<bool>> logi_array;
|
||||
std::unordered_map<int, std::vector<double>> doub_array;
|
||||
std::unordered_map<int, std::vector<float>> real_array;
|
||||
std::unordered_map<int, std::vector<std::string>> char_array;
|
||||
|
||||
std::vector<std::string> array_name;
|
||||
std::vector<EIOD::eclArrType> array_type;
|
||||
std::vector<int> array_size;
|
||||
|
||||
std::vector<unsigned long int> ifStreamPos;
|
||||
|
||||
std::map<std::string, int> array_index;
|
||||
|
||||
template<class T>
|
||||
const std::vector<T>& getImpl(int arrIndex, EIOD::eclArrType type,
|
||||
const std::unordered_map<int, std::vector<T>>& array,
|
||||
const std::string& typeStr)
|
||||
{
|
||||
if (array_type[arrIndex] != type) {
|
||||
std::string message = "Array with index " + std::to_string(arrIndex) + " is not of type " + typeStr;
|
||||
OPM_THROW(std::runtime_error, message);
|
||||
}
|
||||
|
||||
if (!arrayLoaded[arrIndex]) {
|
||||
loadData(arrIndex);
|
||||
}
|
||||
|
||||
return array.find(arrIndex)->second;
|
||||
}
|
||||
|
||||
private:
|
||||
std::vector<bool> arrayLoaded;
|
||||
|
||||
void loadArray(std::fstream& fileH, int arrIndex);
|
||||
};
|
||||
|
||||
#endif
|
||||
@@ -1,148 +0,0 @@
|
||||
/*
|
||||
Copyright 2016 Statoil ASA.
|
||||
|
||||
This file is part of the Open Porous Media project (OPM).
|
||||
|
||||
OPM 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.
|
||||
|
||||
OPM 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 for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with OPM. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#include "EclFilesComparator.hpp"
|
||||
#include <opm/common/ErrorMacros.hpp>
|
||||
|
||||
#include <stdio.h>
|
||||
|
||||
#include <set>
|
||||
#include <iostream>
|
||||
#include <iomanip>
|
||||
#include <algorithm>
|
||||
#include <cmath>
|
||||
#include <numeric>
|
||||
#include <vector>
|
||||
#include <type_traits>
|
||||
|
||||
// helper macro to handle error throws or not
|
||||
#define HANDLE_ERROR(type, message) \
|
||||
{ \
|
||||
if (throwOnError) \
|
||||
OPM_THROW(type, message); \
|
||||
else { \
|
||||
std::cerr << message << std::endl; \
|
||||
++num_errors; \
|
||||
} \
|
||||
}
|
||||
|
||||
|
||||
template <typename T>
|
||||
void ECLFilesComparator::printValuesForCell(const std::string& keyword, const std::string reference, size_t kw_size, size_t cell, EGrid *grid, const T& value1, const T& value2) const {
|
||||
|
||||
int nActive = -1;
|
||||
int nTot = -1;
|
||||
|
||||
if (grid) {
|
||||
nActive = grid->activeCells();
|
||||
nTot = grid->totalNumberOfCells();
|
||||
}
|
||||
|
||||
if (static_cast<int>(kw_size) == nActive) {
|
||||
auto ijk = grid->ijk_from_active_index(cell);
|
||||
|
||||
ijk[0]++, ijk[1]++, ijk[2]++;
|
||||
|
||||
std::cout << std::endl
|
||||
<< "\nKeyword: " << keyword << ", origin " << reference << "\n"
|
||||
<< "Global index (zero based) = " << cell << "\n"
|
||||
<< "Grid coordinate = (" << ijk[0] << ", " << ijk[1] << ", " << ijk[2] << ")" << "\n"
|
||||
<< "(first value, second value) = (" << value1 << ", " << value2 << ")\n\n";
|
||||
return;
|
||||
}
|
||||
|
||||
if (static_cast<int>(kw_size) == nTot) {
|
||||
|
||||
auto ijk = grid->ijk_from_global_index(cell);
|
||||
|
||||
ijk[0]++, ijk[1]++, ijk[2]++;
|
||||
|
||||
std::cout << std::endl
|
||||
<< "\nKeyword: " << keyword << ", origin " << reference << "\n\n"
|
||||
<< "Global index (zero based) = " << cell << "\n"
|
||||
<< "Grid coordinate = (" << ijk[0] << ", " << ijk[1] << ", " << ijk[2] << ")" << "\n"
|
||||
<< "(first value, second value) = (" << value1 << ", " << value2 << ")\n\n";
|
||||
return;
|
||||
}
|
||||
|
||||
std::cout << std::endl
|
||||
<< "\nKeyword: " << keyword << ", origin " << reference << "\n\n"
|
||||
<< "Value index = " << cell << "\n"
|
||||
<< "(first value, second value) = (" << value1 << ", " << value2 << ")\n\n";
|
||||
}
|
||||
|
||||
template void ECLFilesComparator::printValuesForCell<bool> (const std::string& keyword, const std::string reference, size_t kw_size, size_t cell, EGrid *grid, const bool& value1, const bool& value2) const;
|
||||
template void ECLFilesComparator::printValuesForCell<int> (const std::string& keyword, const std::string reference, size_t kw_size, size_t cell, EGrid *grid, const int& value1, const int& value2) const;
|
||||
template void ECLFilesComparator::printValuesForCell<double> (const std::string& keyword, const std::string reference, size_t kw_size, size_t cell, EGrid *grid, const double& value1, const double& value2) const;
|
||||
template void ECLFilesComparator::printValuesForCell<std::string>(const std::string& keyword, const std::string reference, size_t kw_size, size_t cell, EGrid *grid, const std::string& value1, const std::string& value2) const;
|
||||
// Hack to work around case where std::vector<bool>::const_reference is not a bool. If it is we will initialize printValuesForCell<char> otherwise printValuesForCell<std::vector<bool>::const_reference>
|
||||
using boolConstReference = typename std::vector<bool>::const_reference;
|
||||
using boolTypeHelper = typename std::remove_const<typename std::remove_reference<boolConstReference>::type>::type;
|
||||
using boolType = typename std::conditional<std::is_same<boolTypeHelper, bool>::value, char, boolTypeHelper>::type;
|
||||
template void ECLFilesComparator::printValuesForCell<boolType> (const std::string& keyword, const std::string reference, size_t kw_size, size_t cell, EGrid *grid, const boolType& value1, const boolType& value2) const;
|
||||
|
||||
ECLFilesComparator::ECLFilesComparator(const std::string& basename1,
|
||||
const std::string& basename2,
|
||||
double absToleranceArg, double relToleranceArg) :
|
||||
absTolerance(absToleranceArg), relTolerance(relToleranceArg) {
|
||||
|
||||
rootName1 = basename1;
|
||||
rootName2 = basename2;
|
||||
}
|
||||
|
||||
|
||||
Deviation ECLFilesComparator::calculateDeviations(double val1, double val2) {
|
||||
val1 = std::abs(val1);
|
||||
val2 = std::abs(val2);
|
||||
Deviation deviation;
|
||||
if (val1 != 0 || val2 != 0) {
|
||||
deviation.abs = std::abs(val1 - val2);
|
||||
if (val1 != 0 && val2 != 0) {
|
||||
deviation.rel = deviation.abs/(std::max(val1, val2));
|
||||
}
|
||||
}
|
||||
return deviation;
|
||||
}
|
||||
|
||||
|
||||
double ECLFilesComparator::median(std::vector<double> vec) {
|
||||
if (vec.empty()) {
|
||||
return 0;
|
||||
}
|
||||
else {
|
||||
size_t n = vec.size() / 2;
|
||||
nth_element(vec.begin(), vec.begin() + n, vec.end());
|
||||
if (vec.size() % 2 == 0) {
|
||||
return 0.5 * (vec[n-1] + vec[n]);
|
||||
}
|
||||
else {
|
||||
return vec[n];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
double ECLFilesComparator::average(const std::vector<double>& vec) {
|
||||
if (vec.empty()) {
|
||||
return 0;
|
||||
}
|
||||
double sum = std::accumulate(vec.begin(), vec.end(), 0.0);
|
||||
return sum/vec.size();
|
||||
}
|
||||
|
||||
|
||||
@@ -1,85 +0,0 @@
|
||||
/*
|
||||
Copyright 2016 Statoil ASA.
|
||||
|
||||
This file is part of the Open Porous Media project (OPM).
|
||||
|
||||
OPM 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.
|
||||
|
||||
OPM 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 for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with OPM. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#ifndef ECLFILESCOMPARATOR_HPP
|
||||
#define ECLFILESCOMPARATOR_HPP
|
||||
|
||||
#include "Deviation.hpp"
|
||||
#include <map>
|
||||
#include <vector>
|
||||
#include <string>
|
||||
|
||||
#include <examples/test_util/EGrid.hpp>
|
||||
|
||||
|
||||
class ECLFilesComparator {
|
||||
public:
|
||||
ECLFilesComparator(const std::string& basename1,
|
||||
const std::string& basename2,
|
||||
double absTolerance, double relTolerance);
|
||||
|
||||
void throwOnErrors(bool dothrow) {
|
||||
throwOnError = dothrow;
|
||||
}
|
||||
|
||||
void doAnalysis(bool analize) {
|
||||
analysis = analize;
|
||||
}
|
||||
|
||||
size_t getNoErrors() const {
|
||||
return num_errors;
|
||||
}
|
||||
|
||||
//! \brief Returns the absolute tolerance stored as a private member variable in the class
|
||||
double getAbsTolerance() const {
|
||||
return absTolerance;
|
||||
}
|
||||
//! \brief Returns the relative tolerance stored as a private member variable in the class
|
||||
double getRelTolerance() const {
|
||||
return relTolerance;
|
||||
}
|
||||
|
||||
//! \brief Calculate deviations for two values.
|
||||
//! \details Using absolute values of the input arguments: If one of the values are non-zero, the Deviation::abs returned is the difference between the two input values. In addition, if both values are non-zero, the Deviation::rel returned is the absolute deviation divided by the largest value.
|
||||
static Deviation calculateDeviations(double val1, double val2);
|
||||
//! \brief Calculate median of a vector.
|
||||
//! \details Returning the median of the input vector, i.e. the middle value of the sorted vector if the number of elements is odd or the mean of the two middle values if the number of elements are even. Copy is intentional.
|
||||
static double median(std::vector<double> vec);
|
||||
//! \brief Calculate average of a vector.
|
||||
//! \details Returning the average of the input vector, i.e. the sum of all values divided by the number of elements.
|
||||
static double average(const std::vector<double>& vec);
|
||||
|
||||
protected:
|
||||
std::vector<std::string> keywords1, keywords2;
|
||||
bool throwOnError = true; //!< Throw on first error
|
||||
bool analysis = false; //!< Perform full error analysis
|
||||
std::map<std::string, std::vector<Deviation>> deviations;
|
||||
mutable size_t num_errors = 0;
|
||||
|
||||
std::string rootName1, rootName2;
|
||||
|
||||
template <typename T>
|
||||
void printValuesForCell(const std::string& keyword, const std::string reference, size_t kw_size, size_t cell, EGrid *grid, const T& value1, const T& value2) const;
|
||||
|
||||
private:
|
||||
double absTolerance = 0;
|
||||
double relTolerance = 0;
|
||||
};
|
||||
|
||||
#endif
|
||||
@@ -1,397 +0,0 @@
|
||||
/*
|
||||
Copyright 2019 Statoil ASA.
|
||||
|
||||
This file is part of the Open Porous Media project (OPM).
|
||||
|
||||
OPM 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.
|
||||
|
||||
OPM 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 for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with OPM. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#include "EclOutput.hpp"
|
||||
#include "EclUtil.hpp"
|
||||
#include <opm/common/ErrorMacros.hpp>
|
||||
|
||||
#include <algorithm>
|
||||
#include <iterator>
|
||||
#include <iomanip>
|
||||
#include <stdexcept>
|
||||
#include <typeinfo>
|
||||
#include <sstream>
|
||||
#include <stdio.h>
|
||||
|
||||
|
||||
EclOutput::EclOutput(const std::string& inputFile, bool formatted) :
|
||||
isFormatted(formatted)
|
||||
{
|
||||
ofileH.open(inputFile, isFormatted ? std::ios::out : std::ios::out | std::ios::binary);
|
||||
}
|
||||
|
||||
|
||||
template<>
|
||||
void EclOutput::write<std::string>(const std::string& name,
|
||||
const std::vector<std::string>& data)
|
||||
{
|
||||
if (isFormatted)
|
||||
{
|
||||
writeFormattedHeader(name, data.size(), EIOD::CHAR);
|
||||
writeFormattedCharArray(data);
|
||||
}
|
||||
else
|
||||
{
|
||||
writeBinaryHeader(name, data.size(), EIOD::CHAR);
|
||||
writeBinaryCharArray(data);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void EclOutput::writeBinaryHeader(const std::string&arrName, int size, EIOD::eclArrType arrType)
|
||||
{
|
||||
std::string name = arrName + std::string(8 - arrName.size(),' ');
|
||||
|
||||
int flippedSize = EIOD::flipEndianInt(size);
|
||||
int bhead = EIOD::flipEndianInt(16);
|
||||
|
||||
ofileH.write(reinterpret_cast<char*>(&bhead), sizeof(bhead));
|
||||
|
||||
ofileH.write(name.c_str(), 8);
|
||||
ofileH.write(reinterpret_cast<char*>(&flippedSize), sizeof(flippedSize));
|
||||
|
||||
switch(arrType) {
|
||||
case EIOD::INTE:
|
||||
ofileH.write("INTE", 4);
|
||||
break;
|
||||
case EIOD::REAL:
|
||||
ofileH.write("REAL", 4);
|
||||
break;
|
||||
case EIOD::DOUB:
|
||||
ofileH.write("DOUB", 4);
|
||||
break;
|
||||
case EIOD::LOGI:
|
||||
ofileH.write("LOGI", 4);
|
||||
break;
|
||||
case EIOD::CHAR:
|
||||
ofileH.write("CHAR", 4);
|
||||
break;
|
||||
case EIOD::MESS:
|
||||
ofileH.write("MESS", 4);
|
||||
break;
|
||||
}
|
||||
|
||||
ofileH.write(reinterpret_cast<char *>(&bhead), sizeof(bhead));
|
||||
}
|
||||
|
||||
|
||||
template <typename T>
|
||||
void EclOutput::writeBinaryArray(const std::vector<T>& data)
|
||||
{
|
||||
int rest,num,rval;
|
||||
int dhead;
|
||||
float value_f;
|
||||
double value_d;
|
||||
int intVal;
|
||||
|
||||
int n = 0;
|
||||
int size = data.size();
|
||||
|
||||
EIOD::eclArrType arrType = EIOD::MESS;
|
||||
|
||||
if (typeid(std::vector<T>) == typeid(std::vector<int>)) {
|
||||
arrType = EIOD::INTE;
|
||||
} else if (typeid(std::vector<T>) == typeid(std::vector<float>)) {
|
||||
arrType = EIOD::REAL;
|
||||
} else if (typeid(std::vector<T>) == typeid(std::vector<double>)) {
|
||||
arrType = EIOD::DOUB;
|
||||
} else if (typeid(std::vector<T>) == typeid(std::vector<bool>)) {
|
||||
arrType = EIOD::LOGI;
|
||||
}
|
||||
|
||||
auto sizeData = block_size_data_binary(arrType);
|
||||
|
||||
int sizeOfElement = std::get<0>(sizeData);
|
||||
int maxBlockSize = std::get<1>(sizeData);
|
||||
int maxNumberOfElements = maxBlockSize / sizeOfElement;
|
||||
|
||||
if (!ofileH.is_open()) {
|
||||
OPM_THROW(std::runtime_error, "fstream fileH not open for writing");
|
||||
}
|
||||
|
||||
rest = size * sizeOfElement;
|
||||
while (rest > 0) {
|
||||
if (rest > maxBlockSize) {
|
||||
rest -= maxBlockSize;
|
||||
num = maxNumberOfElements;
|
||||
} else {
|
||||
num = rest / sizeOfElement;
|
||||
rest = 0;
|
||||
}
|
||||
|
||||
dhead = EIOD::flipEndianInt(num * sizeOfElement);
|
||||
|
||||
ofileH.write(reinterpret_cast<char*>(&dhead), sizeof(dhead));
|
||||
|
||||
for (int i = 0; i < num; i++) {
|
||||
if (arrType == EIOD::INTE) {
|
||||
rval = EIOD::flipEndianInt(data[n]);
|
||||
ofileH.write(reinterpret_cast<char*>(&rval), sizeof(rval));
|
||||
} else if (arrType == EIOD::REAL) {
|
||||
value_f = EIOD::flipEndianFloat(data[n]);
|
||||
ofileH.write(reinterpret_cast<char*>(&value_f), sizeof(value_f));
|
||||
} else if (arrType == EIOD::DOUB) {
|
||||
value_d = EIOD::flipEndianDouble(data[n]);
|
||||
ofileH.write(reinterpret_cast<char*>(&value_d), sizeof(value_d));
|
||||
} else if (arrType == EIOD::LOGI) {
|
||||
intVal = data[n] ? EIOD::true_value : EIOD::false_value;
|
||||
ofileH.write(reinterpret_cast<char*>(&intVal), sizeOfElement);
|
||||
} else {
|
||||
std::cout << "type not supported in write binaryarray" << std::endl;
|
||||
exit(1);
|
||||
}
|
||||
|
||||
n++;
|
||||
}
|
||||
|
||||
ofileH.write(reinterpret_cast<char*>(&dhead), sizeof(dhead));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
template void EclOutput::writeBinaryArray<int>(const std::vector<int>& data);
|
||||
template void EclOutput::writeBinaryArray<float>(const std::vector<float>& data);
|
||||
template void EclOutput::writeBinaryArray<double>(const std::vector<double>& data);
|
||||
template void EclOutput::writeBinaryArray<bool>(const std::vector<bool>& data);
|
||||
template void EclOutput::writeBinaryArray<char>(const std::vector<char>& data);
|
||||
|
||||
|
||||
void EclOutput::writeBinaryCharArray(const std::vector<std::string>& data)
|
||||
{
|
||||
int num,dhead;
|
||||
|
||||
int n = 0;
|
||||
int size = data.size();
|
||||
|
||||
auto sizeData = EIOD::block_size_data_binary(EIOD::CHAR);
|
||||
|
||||
int sizeOfElement = std::get<0>(sizeData);
|
||||
int maxBlockSize = std::get<1>(sizeData);
|
||||
int maxNumberOfElements = maxBlockSize / sizeOfElement;
|
||||
|
||||
int rest = size * sizeOfElement;
|
||||
|
||||
if (!ofileH.is_open()) {
|
||||
OPM_THROW(std::runtime_error,"fstream fileH not open for writing");
|
||||
}
|
||||
|
||||
while (rest > 0) {
|
||||
if (rest > maxBlockSize) {
|
||||
rest -= maxBlockSize;
|
||||
num = maxNumberOfElements;
|
||||
} else {
|
||||
num = rest / sizeOfElement;
|
||||
rest = 0;
|
||||
}
|
||||
|
||||
dhead = EIOD::flipEndianInt(num * sizeOfElement);
|
||||
|
||||
ofileH.write(reinterpret_cast<char*>(&dhead), sizeof(dhead));
|
||||
|
||||
for (int i = 0; i < num; i++) {
|
||||
std::string tmpStr = data[n] + std::string(8 - data[n].size(),' ');
|
||||
ofileH.write(tmpStr.c_str(), sizeOfElement);
|
||||
n++;
|
||||
}
|
||||
|
||||
ofileH.write(reinterpret_cast<char*>(&dhead), sizeof(dhead));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void EclOutput::writeFormattedHeader(const std::string& arrName, int size, EIOD::eclArrType arrType)
|
||||
{
|
||||
std::string name = arrName + std::string(8 - arrName.size(),' ');
|
||||
|
||||
ofileH << " '" << name << "' " << std::setw(11) << size;
|
||||
|
||||
switch (arrType) {
|
||||
case EIOD::INTE:
|
||||
ofileH << " 'INTE'" << std::endl;
|
||||
break;
|
||||
case EIOD::REAL:
|
||||
ofileH << " 'REAL'" << std::endl;
|
||||
break;
|
||||
case EIOD::DOUB:
|
||||
ofileH << " 'DOUB'" << std::endl;
|
||||
break;
|
||||
case EIOD::LOGI:
|
||||
ofileH << " 'LOGI'" << std::endl;
|
||||
break;
|
||||
case EIOD::CHAR:
|
||||
ofileH << " 'CHAR'" << std::endl;
|
||||
break;
|
||||
case EIOD::MESS:
|
||||
ofileH << " 'MESS'" << std::endl;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
std::string EclOutput::make_real_string(float value) const
|
||||
{
|
||||
char buffer [15];
|
||||
sprintf (buffer, "%10.7E", value);
|
||||
|
||||
if (value == 0.0) {
|
||||
return "0.00000000E+00";
|
||||
} else {
|
||||
std::string tmpstr(buffer);
|
||||
|
||||
int exp = value < 0.0 ? std::stoi(tmpstr.substr(11, 3)) : std::stoi(tmpstr.substr(10, 3));
|
||||
|
||||
if (value < 0.0) {
|
||||
tmpstr = "-0." + tmpstr.substr(1, 1) + tmpstr.substr(3, 7) + "E";
|
||||
} else {
|
||||
tmpstr = "0." + tmpstr.substr(0, 1) + tmpstr.substr(2, 7) +"E";
|
||||
}
|
||||
|
||||
sprintf (buffer, "%+03i", exp+1);
|
||||
tmpstr = tmpstr+buffer;
|
||||
|
||||
return tmpstr;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
std::string EclOutput::make_doub_string(double value) const
|
||||
{
|
||||
char buffer [21];
|
||||
sprintf (buffer, "%19.13E", value);
|
||||
|
||||
if (value == 0.0) {
|
||||
return "0.00000000000000D+00";
|
||||
} else {
|
||||
std::string tmpstr(buffer);
|
||||
|
||||
int exp = value < 0.0 ? std::stoi(tmpstr.substr(17, 4)) : std::stoi(tmpstr.substr(16, 4));
|
||||
|
||||
if (value < 0.0) {
|
||||
if (abs(exp) < 100) {
|
||||
tmpstr = "-0." + tmpstr.substr(1, 1) + tmpstr.substr(3, 13) + "D";
|
||||
} else {
|
||||
tmpstr = "-0." + tmpstr.substr(1, 1) + tmpstr.substr(3, 13);
|
||||
}
|
||||
} else {
|
||||
if (abs(exp) < 100) {
|
||||
tmpstr = "0." + tmpstr.substr(0, 1) + tmpstr.substr(2, 13) + "D";
|
||||
} else {
|
||||
tmpstr = "0." + tmpstr.substr(0, 1) + tmpstr.substr(2, 13);
|
||||
}
|
||||
}
|
||||
|
||||
sprintf (buffer, "%+03i", exp+1);
|
||||
tmpstr = tmpstr + buffer;
|
||||
|
||||
return tmpstr;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
template <typename T>
|
||||
void EclOutput::writeFormattedArray(const std::vector<T>& data)
|
||||
{
|
||||
int size = data.size();
|
||||
int n = 0;
|
||||
|
||||
EIOD::eclArrType arrType = EIOD::MESS;
|
||||
if (typeid(T) == typeid(int)) {
|
||||
arrType = EIOD::INTE;
|
||||
} else if (typeid(T) == typeid(float)) {
|
||||
arrType = EIOD::REAL;
|
||||
} else if (typeid(T) == typeid(double)) {
|
||||
arrType = EIOD::DOUB;
|
||||
} else if (typeid(T) == typeid(bool)) {
|
||||
arrType = EIOD::LOGI;
|
||||
}
|
||||
|
||||
auto sizeData = EIOD::block_size_data_formatted(arrType);
|
||||
|
||||
int maxBlockSize = std::get<0>(sizeData);
|
||||
int nColumns = std::get<1>(sizeData);
|
||||
int columnWidth = std::get<2>(sizeData);
|
||||
|
||||
for (int i = 0; i < size; i++) {
|
||||
n++;
|
||||
|
||||
switch (arrType) {
|
||||
case EIOD::INTE:
|
||||
ofileH << std::setw(columnWidth) << data[i];
|
||||
break;
|
||||
case EIOD::REAL:
|
||||
ofileH << std::setw(columnWidth) << make_real_string(data[i]);
|
||||
break;
|
||||
case EIOD::DOUB:
|
||||
ofileH << std::setw(columnWidth) << make_doub_string(data[i]);
|
||||
break;
|
||||
case EIOD::LOGI:
|
||||
if (data[i]) {
|
||||
ofileH << " T";
|
||||
} else {
|
||||
ofileH << " F";
|
||||
}
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
if ((n % nColumns) == 0 || (n % maxBlockSize) == 0) {
|
||||
ofileH << std::endl;
|
||||
}
|
||||
|
||||
if ((n % maxBlockSize) == 0) {
|
||||
n=0;
|
||||
}
|
||||
}
|
||||
|
||||
if ((n % nColumns) != 0 && (n % maxBlockSize) != 0) {
|
||||
ofileH << std::endl;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
template void EclOutput::writeFormattedArray<int>(const std::vector<int>& data);
|
||||
template void EclOutput::writeFormattedArray<float>(const std::vector<float>& data);
|
||||
template void EclOutput::writeFormattedArray<double>(const std::vector<double>& data);
|
||||
template void EclOutput::writeFormattedArray<bool>(const std::vector<bool>& data);
|
||||
template void EclOutput::writeFormattedArray<char>(const std::vector<char>& data);
|
||||
|
||||
|
||||
void EclOutput::writeFormattedCharArray(const std::vector<std::string>& data)
|
||||
{
|
||||
auto sizeData = EIOD::block_size_data_formatted(EIOD::CHAR);
|
||||
|
||||
int nColumns = std::get<1>(sizeData);
|
||||
|
||||
int size = data.size();
|
||||
|
||||
for (int i = 0; i < size; i++) {
|
||||
std::string str1(8,' ');
|
||||
str1 = data[i] + std::string(8 - data[i].size(),' ');
|
||||
|
||||
ofileH << " '" << str1 << "'";
|
||||
|
||||
if ((i+1) % nColumns == 0) {
|
||||
ofileH << std::endl;
|
||||
}
|
||||
}
|
||||
|
||||
if ((size % nColumns) != 0) {
|
||||
ofileH << std::endl;
|
||||
}
|
||||
}
|
||||
@@ -1,94 +0,0 @@
|
||||
/*
|
||||
Copyright 2019 Statoil ASA.
|
||||
|
||||
This file is part of the Open Porous Media project (OPM).
|
||||
|
||||
OPM 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.
|
||||
|
||||
OPM 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 for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with OPM. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
#ifndef ECL_OUTPUT_HPP
|
||||
#define ECL_OUTPUT_HPP
|
||||
|
||||
#include <iostream>
|
||||
#include <fstream>
|
||||
#include <vector>
|
||||
#include <iomanip>
|
||||
#include <typeinfo>
|
||||
|
||||
#include <examples/test_util/data/EclIOdata.hpp>
|
||||
|
||||
namespace EIOD = Opm::ecl;
|
||||
|
||||
|
||||
class EclOutput
|
||||
{
|
||||
public:
|
||||
EclOutput(const std::string& inputFile, bool formatted);
|
||||
|
||||
template<typename T>
|
||||
void write(const std::string& name,
|
||||
const std::vector<T>& data)
|
||||
{
|
||||
EIOD::eclArrType arrType = EIOD::MESS;
|
||||
if (typeid(T) == typeid(int))
|
||||
arrType = EIOD::INTE;
|
||||
else if (typeid(T) == typeid(float))
|
||||
arrType = EIOD::REAL;
|
||||
else if (typeid(T) == typeid(double))
|
||||
arrType = EIOD::DOUB;
|
||||
else if (typeid(T) == typeid(bool))
|
||||
arrType = EIOD::LOGI;
|
||||
else if (typeid(T) == typeid(char))
|
||||
arrType = EIOD::MESS;
|
||||
|
||||
if (isFormatted)
|
||||
{
|
||||
writeFormattedHeader(name, data.size(), arrType);
|
||||
if (arrType != EIOD::MESS)
|
||||
writeFormattedArray(data);
|
||||
}
|
||||
else
|
||||
{
|
||||
writeBinaryHeader(name, data.size(), arrType);
|
||||
if (arrType != EIOD::MESS)
|
||||
writeBinaryArray(data);
|
||||
}
|
||||
}
|
||||
|
||||
private:
|
||||
void writeBinaryHeader(const std::string& arrName, int size, EIOD::eclArrType arrType);
|
||||
|
||||
template <typename T>
|
||||
void writeBinaryArray(const std::vector<T>& data);
|
||||
|
||||
void writeBinaryCharArray(const std::vector<std::string>& data);
|
||||
|
||||
void writeFormattedHeader(const std::string& arrName, int size, EIOD::eclArrType arrType);
|
||||
|
||||
template <typename T>
|
||||
void writeFormattedArray(const std::vector<T>& data);
|
||||
|
||||
void writeFormattedCharArray(const std::vector<std::string>& data);
|
||||
|
||||
std::string make_real_string(float value) const;
|
||||
std::string make_doub_string(double value) const;
|
||||
|
||||
std::ofstream ofileH;
|
||||
bool isFormatted;
|
||||
};
|
||||
|
||||
|
||||
template<>
|
||||
void EclOutput::write<std::string>(const std::string& name,
|
||||
const std::vector<std::string>& data);
|
||||
|
||||
#endif
|
||||
File diff suppressed because it is too large
Load Diff
@@ -1,179 +0,0 @@
|
||||
/*
|
||||
Copyright 2019 Equinor ASA.
|
||||
|
||||
This file is part of the Open Porous Media project (OPM).
|
||||
|
||||
OPM 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.
|
||||
|
||||
OPM 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 for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with OPM. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#ifndef ECLREGRESSIONTEST_HPP
|
||||
#define ECLREGRESSIONTEST_HPP
|
||||
|
||||
#include "EclFilesComparator.hpp"
|
||||
#include "data/EclIOdata.hpp"
|
||||
|
||||
|
||||
namespace EIOD = Opm::ecl;
|
||||
|
||||
|
||||
/*! \brief A class for executing a regression test for two ECLIPSE files.
|
||||
\details This class inherits from ECLFilesComparator, which opens and
|
||||
closes the input cases and stores keywordnames.
|
||||
The three public functions gridCompare(), results() and
|
||||
resultsForKeyword() can be invoked to compare griddata
|
||||
or keyworddata for all keywords or a given keyword (resultsForKeyword()).
|
||||
*/
|
||||
class ECLRegressionTest: public ECLFilesComparator {
|
||||
public:
|
||||
//! \brief Sets up the regression test.
|
||||
//! \param[in] basename1 Full path without file extension to the first case.
|
||||
//! \param[in] basename2 Full path without file extension to the second case.
|
||||
//! \param[in] absTolerance Tolerance for absolute deviation.
|
||||
//! \param[in] relTolerance Tolerance for relative deviation.
|
||||
//! \details This constructor only calls the constructor of the superclass, see the docs for ECLFilesComparator for more information.
|
||||
ECLRegressionTest(const std::string& basename1, const std::string& basename2, double absTolerance, double relTolerance):
|
||||
ECLFilesComparator(basename1, basename2, absTolerance, relTolerance) {}
|
||||
|
||||
~ECLRegressionTest();
|
||||
|
||||
//! \brief Option to only compare last occurrence
|
||||
void setOnlyLastReportNumber(bool onlyLastSequenceArg) {
|
||||
this->onlyLastSequence = onlyLastSequenceArg;
|
||||
}
|
||||
|
||||
int countDev() { return deviations.size(); }
|
||||
|
||||
// Accept extra keywords: If this switch is set to true the comparison
|
||||
// will ignore extra keywords which are only present
|
||||
// in the new simulation.
|
||||
|
||||
void setAcceptExtraKeywords(bool acceptExtraKeywordsArg) {
|
||||
this->acceptExtraKeywords = acceptExtraKeywordsArg;
|
||||
}
|
||||
|
||||
void setIntegrationTest(bool inregrationTestArg) {
|
||||
this->integrationTest = inregrationTestArg;
|
||||
}
|
||||
|
||||
void setPrintKeywordOnly(bool printArg) {
|
||||
this->printKeywordOnly = printArg;
|
||||
}
|
||||
|
||||
void compareSpesificKeyword(std::string keyword) {
|
||||
this->spesificKeyword = keyword;
|
||||
}
|
||||
void compareSpesificRstReportStepNumber(int seqn) {
|
||||
this->spesificSequence = seqn;
|
||||
}
|
||||
|
||||
void setLoadBaseRunData(bool loadArg) {
|
||||
this->loadBaseRunData = loadArg;
|
||||
}
|
||||
|
||||
void loadGrids();
|
||||
void printDeviationReport();
|
||||
|
||||
void gridCompare();
|
||||
|
||||
void results_rst();
|
||||
void results_init();
|
||||
void results_smry();
|
||||
void results_rft();
|
||||
|
||||
private:
|
||||
bool checkFileName(const std::string& rootName, const std::string& extension, std::string& filename);
|
||||
|
||||
// Prints results stored in absDeviation and relDeviation.
|
||||
void printResultsForKeyword(const std::string& keyword) const;
|
||||
void printComparisonForKeywordLists(const std::vector<std::string>& arrayList1,
|
||||
const std::vector<std::string>& arrayList2) const;
|
||||
|
||||
void printComparisonForKeywordLists(const std::vector<std::string>& arrayList1,
|
||||
const std::vector<std::string>& arrayList2,
|
||||
const std::vector<EIOD::eclArrType>& arrayType1,
|
||||
const std::vector<EIOD::eclArrType>& arrayType2) const;
|
||||
|
||||
void printMissingKeywords(const std::vector<std::string>& arrayList1,
|
||||
const std::vector<std::string>& arrayList2) const;
|
||||
|
||||
void compareKeywords(const std::vector<std::string>& keywords1,
|
||||
const std::vector<std::string>& keywords2,
|
||||
const std::string& reference);
|
||||
|
||||
void checkSpesificKeyword(std::vector<std::string>& keywords1,
|
||||
std::vector<std::string>& keywords2,
|
||||
std::vector<EIOD::eclArrType>& arrayType1,
|
||||
std::vector<EIOD::eclArrType>& arrayType2,
|
||||
const std::string& reference);
|
||||
|
||||
template <typename T>
|
||||
void compareVectors(const std::vector<T>& t1, const std::vector<T>& t2,
|
||||
const std::string& keyword, const std::string& reference);
|
||||
|
||||
template <typename T>
|
||||
void compareFloatingPointVectors(const std::vector<T>& t1, const std::vector<T> &t2,
|
||||
const std::string& keyword, const std::string& reference);
|
||||
|
||||
// deviationsForCell throws an exception if both the absolute deviation AND the relative deviation
|
||||
// are larger than absTolerance and relTolerance, respectively. In addition,
|
||||
// if allowNegativeValues is passed as false, an exception will be thrown when the absolute value
|
||||
// of a negative value exceeds absTolerance. If no exceptions are thrown, the absolute and relative deviations are added to absDeviation and relDeviation.
|
||||
// void deviationsForCell(double val1, double val2, const std::string& keyword, const std::string reference, size_t kw_size, size_t cell, bool allowNegativeValues = true);
|
||||
|
||||
void deviationsForCell(double val1, double val2, const std::string& keyword,
|
||||
const std::string& reference, size_t kw_size, size_t cell,
|
||||
bool allowNegativeValues, bool useStrictTol);
|
||||
|
||||
template <typename T>
|
||||
void deviationsForNonFloatingPoints(T val1, T val2, const std::string& keyword,
|
||||
const std::string& reference,
|
||||
size_t kw_size, size_t cell);
|
||||
|
||||
// These vectors store absolute and relative deviations, respecively. Note that they are whiped clean for every new keyword comparison.
|
||||
std::vector<double> absDeviation, relDeviation;
|
||||
|
||||
// Keywords which should not contain negative values, i.e. uses allowNegativeValues = false in deviationsForCell():
|
||||
const std::vector<std::string> keywordDisallowNegatives = {"SGAS", "SWAT", "PRESSURE"};
|
||||
|
||||
double strictAbsTol = 1e-6;
|
||||
double strictRelTol = 1e-6;
|
||||
|
||||
// keywords that triggers strict tolerances
|
||||
const std::vector<std::string> keywordsStrictTol = {"COORD", "ZCORN", "PORV", "DEPTH", "DX", "DY", "DZ", "PERMX", "PERMY", "PERMZ", "NTG",
|
||||
"TRANX", "TRANY", "TRANZ", "TRANNNC", "SGRP", "SWEL", "SCON", "DOUBHEAD"
|
||||
};
|
||||
|
||||
// Only compare last occurrence
|
||||
bool onlyLastSequence = false;
|
||||
|
||||
bool integrationTest = false;
|
||||
|
||||
bool printKeywordOnly = false;
|
||||
|
||||
bool loadBaseRunData = false;
|
||||
|
||||
// spesific keyword to be compared
|
||||
std::string spesificKeyword;
|
||||
|
||||
// spesific restart sequence to be compared
|
||||
int spesificSequence = -1;
|
||||
|
||||
// Accept extra keywords in the restart file of the 'new' simulation.
|
||||
bool acceptExtraKeywords = false;
|
||||
|
||||
EGrid* grid1 = nullptr;
|
||||
EGrid* grid2 = nullptr;
|
||||
};
|
||||
|
||||
#endif
|
||||
@@ -1,127 +0,0 @@
|
||||
/*
|
||||
Copyright 2019 Equinor ASA.
|
||||
|
||||
This file is part of the Open Porous Media project (OPM).
|
||||
|
||||
OPM 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.
|
||||
|
||||
OPM 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 for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with OPM. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#include "EclUtil.hpp"
|
||||
#include <opm/common/ErrorMacros.hpp>
|
||||
|
||||
#include <algorithm>
|
||||
#include <stdexcept>
|
||||
|
||||
|
||||
namespace EIOD = Opm::ecl;
|
||||
|
||||
|
||||
int Opm::ecl::flipEndianInt(int num)
|
||||
{
|
||||
unsigned int tmp = __builtin_bswap32(num);
|
||||
return static_cast<int>(tmp);
|
||||
}
|
||||
|
||||
|
||||
float Opm::ecl::flipEndianFloat(float num)
|
||||
{
|
||||
float value = num;
|
||||
|
||||
char* floatToConvert = reinterpret_cast<char*>(&value);
|
||||
std::reverse(floatToConvert, floatToConvert+4);
|
||||
|
||||
return value;
|
||||
}
|
||||
|
||||
|
||||
double Opm::ecl::flipEndianDouble(double num)
|
||||
{
|
||||
double value = num;
|
||||
|
||||
char* doubleToConvert = reinterpret_cast<char*>(&value);
|
||||
std::reverse(doubleToConvert, doubleToConvert+8);
|
||||
|
||||
return value;
|
||||
}
|
||||
|
||||
|
||||
std::tuple<int, int> Opm::ecl::block_size_data_binary(eclArrType arrType)
|
||||
{
|
||||
using BlockSizeTuple = std::tuple<int, int>;
|
||||
|
||||
switch (arrType) {
|
||||
case EIOD::INTE:
|
||||
return BlockSizeTuple{EIOD::sizeOfInte, EIOD::MaxBlockSizeInte};
|
||||
break;
|
||||
case EIOD::REAL:
|
||||
return BlockSizeTuple{EIOD::sizeOfReal, EIOD::MaxBlockSizeReal};
|
||||
break;
|
||||
case EIOD::DOUB:
|
||||
return BlockSizeTuple{EIOD::sizeOfDoub, EIOD::MaxBlockSizeDoub};
|
||||
break;
|
||||
case EIOD::LOGI:
|
||||
return BlockSizeTuple{EIOD::sizeOfLogi, EIOD::MaxBlockSizeLogi};
|
||||
break;
|
||||
case EIOD::CHAR:
|
||||
return BlockSizeTuple{EIOD::sizeOfChar, EIOD::MaxBlockSizeChar};
|
||||
break;
|
||||
case EIOD::MESS:
|
||||
OPM_THROW(std::invalid_argument, "Type 'MESS' have no associated data");
|
||||
break;
|
||||
default:
|
||||
OPM_THROW(std::invalid_argument, "Unknown field type");
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
std::tuple<int, int, int> Opm::ecl::block_size_data_formatted(EIOD::eclArrType arrType)
|
||||
{
|
||||
using BlockSizeTuple = std::tuple<int, int, int>;
|
||||
|
||||
switch (arrType) {
|
||||
case EIOD::INTE:
|
||||
return BlockSizeTuple{EIOD::MaxNumBlockInte, EIOD::numColumnsInte, EIOD::columnWidthInte};
|
||||
break;
|
||||
case EIOD::REAL:
|
||||
return BlockSizeTuple{EIOD::MaxNumBlockReal,EIOD::numColumnsReal, EIOD::columnWidthReal};
|
||||
break;
|
||||
case EIOD::DOUB:
|
||||
return BlockSizeTuple{EIOD::MaxNumBlockDoub,EIOD::numColumnsDoub, EIOD::columnWidthDoub};
|
||||
break;
|
||||
case EIOD::LOGI:
|
||||
return BlockSizeTuple{EIOD::MaxNumBlockLogi,EIOD::numColumnsLogi, EIOD::columnWidthLogi};
|
||||
break;
|
||||
case EIOD::CHAR:
|
||||
return BlockSizeTuple{EIOD::MaxNumBlockChar,EIOD::numColumnsChar, EIOD::columnWidthChar};
|
||||
break;
|
||||
case EIOD::MESS:
|
||||
OPM_THROW(std::invalid_argument, "Type 'MESS' have no associated data") ;
|
||||
break;
|
||||
default:
|
||||
OPM_THROW(std::invalid_argument, "Unknown field type");
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
std::string Opm::ecl::trimr(const std::string &str1)
|
||||
{
|
||||
if (str1 == " ") {
|
||||
return "";
|
||||
} else {
|
||||
int p = str1.find_last_not_of(" ");
|
||||
|
||||
return str1.substr(0,p+1);
|
||||
}
|
||||
}
|
||||
@@ -1,40 +0,0 @@
|
||||
/*
|
||||
Copyright 2019 Equinor ASA.
|
||||
|
||||
This file is part of the Open Porous Media project (OPM).
|
||||
|
||||
OPM 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.
|
||||
|
||||
OPM 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 for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with OPM. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#ifndef ECL_UTIL_HPP
|
||||
#define ECL_UTIL_HPP
|
||||
|
||||
#include <string>
|
||||
#include <tuple>
|
||||
#include <examples/test_util/data/EclIOdata.hpp>
|
||||
|
||||
|
||||
namespace Opm {
|
||||
namespace ecl {
|
||||
int flipEndianInt(int num);
|
||||
float flipEndianFloat(float num);
|
||||
double flipEndianDouble(double num);
|
||||
|
||||
std::tuple<int, int> block_size_data_binary(eclArrType arrType);
|
||||
std::tuple<int, int, int> block_size_data_formatted(eclArrType arrType);
|
||||
|
||||
std::string trimr(const std::string &str1);
|
||||
}
|
||||
}
|
||||
|
||||
#endif
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user