Compare commits

..

21 Commits

Author SHA1 Message Date
Markus Blatt
90d18f7d1a Changed version in dune.module to 2022.04 2022-05-12 11:39:24 +02:00
Markus Blatt
8f13f559f8 Merge pull request #3025 from blattms/backport-of-pr-3023
[backport] Do not hard-code shared-libs in package configuration if not needed.
2022-05-06 14:36:53 +02:00
Markus Blatt
e66fd64dba Do not hard-code shared-libs in package configuration if not needed.
We usually list all libraries that might be needed for linking in the
CMake package configuration files. This is needed when building static
libraries as we do not yet use CMake targets (which would allow to
list them differently). As we are doing this unconditionally and
also including the ones listed in modules that we depend on, changing
a library (e.g. moving from Python 3.9 to 3.10) requires a complete
rebuild of all modules to get rid of the stale dependency on
libpython3.9.

At least when building shared libraries listing the dependencies is
not needed and this patch simply removes all shared libraries form the
list in the CMake package configuration file. Thus we only need to
recompile the modules that have direct dependency on a stale library.
2022-05-06 14:33:28 +02:00
Markus Blatt
388c852c27 Merge pull request #3017 from blattms/backport-of-pr-3015
[backport] Install python bindings as default.
2022-05-02 12:47:39 +02:00
Markus Blatt
c7d50318e7 Install python bindings as default.
This is for consistency with opm-simulators, which (always)
installs them if they are built.

Closes #2976
2022-05-02 12:39:40 +02:00
Markus Blatt
23ad6d7383 Merge pull request #3013 from blattms/backport-of-pr-3012
[backport] Make not finding Quadmath non-fatal (e.g. not available on arm64)
2022-04-29 11:51:54 +02:00
Markus Blatt
c8e5935a19 Make not finding Quadmath non-fatal (e.g. not available on arm64)
Quadmath is usually unused except when a dependency uses it and
explicitly puts QuadMath::QuadMath into their CMake package
configuration file.

On most platforms the compiler has Quadmath available by
default. But on those that don't we should not stop CMake and fail.
Hence now we only print a message that Quadmath is not available.
2022-04-29 11:21:40 +02:00
Markus Blatt
28f9f86c65 Merge pull request #3011 from blattms/backport-of-pr-3006
[backport] Added default values for I, J, K1 and K2
2022-04-28 12:27:27 +02:00
Øyvind Lind-Johansen
783e6f6555 Added default values for I, J, K1 and K2 2022-04-28 12:23:33 +02:00
Markus Blatt
536641d5d7 Merge pull request #3010 from blattms/backport-of-pr-3007
[backport] fixed: avoid direct floating point comparisons in tests
2022-04-28 12:23:00 +02:00
Markus Blatt
1f40b8cdaa Merge pull request #3009 from blattms/backport-of-pr-3008
Spelling fixes (valied -> valid).
2022-04-28 12:21:12 +02:00
Markus Blatt
573609832d Spelling fixes (valied -> valid). 2022-04-28 12:19:05 +02:00
Arne Morten Kvarving
7945f45c5e fixed: avoid direct floating point comparisons in tests
we want to compare with an epsilon since these have gone
through calculations
2022-04-28 12:17:19 +02:00
Markus Blatt
dc207254ae Bump version to 2022.04-rc1 2022-04-26 20:02:39 +02:00
Markus Blatt
2721fe62bd Merge pull request #3001 from blattms/backport-of-pr-2997
[backport] Cleanup, update and improve man pages for 2022.04
2022-04-21 11:31:56 +02:00
Markus Blatt
4637126794 Cleanup, update and improve man pages for 2022.04 2022-04-21 11:29:25 +02:00
Markus Blatt
80e9abdd69 Merge pull request #3000 from blattms/backport-of-pr-2998
[backport] added: ability to use jenkins build scripts for release test building
2022-04-21 11:25:46 +02:00
Arne Morten Kvarving
c5a01d7d84 added: ability to use jenkins build scripts for release test building
we need to be able to specify absolute refs to use for the repos
rather than a pull request number.
2022-04-21 11:24:37 +02:00
Markus Blatt
a965a18320 Merge pull request #2996 from blattms/backport-of-pr-2995
[backport] Use dune buildsystem defaults
2022-04-20 20:24:45 +02:00
Markus Blatt
a561e68b41 Require UMFPack
A direct coarse solver of AMG is needed for good convergence and umfpack
was tested to work better than SuperLU previously. Hence we now require it.
2022-04-20 19:53:13 +02:00
Markus Blatt
a44c0ad80b Always build with MPI and search for SuperLU and Quadmath.
Concerning MPI, both DUNE and OPM must be compiled with the
same default. For DUNE that is to used MPI if it is found.
With the previous default Cmake in opm-grid would fail for
DUNE 2.8

Even if SuperLU is found umfpack will be used as the coarse
solver for AMG. But if dune-fem is used  that will need SuperL
if it is on the system otherwise linking will fail for DUNE 2.8

Quadmath is used by dune-fem if it is found and linking of flow
will fail in this case for DUNE 2.8 if we did not search for it.
2022-04-20 19:53:13 +02:00
534 changed files with 5361 additions and 14627 deletions

View File

@@ -32,13 +32,13 @@ set(OPM_PROJECT_EXTRA_CODE_INSTALLED "#ENABLE_ECL_INPUT is needed by opm-common
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 available after find_package(opm-common)")
include(OpmPackage) #Make macros availabe after find_package(opm-common)")
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 available after find_package(opm-common)")
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)
@@ -136,7 +136,6 @@ macro (sources_hook)
list(INSERT opm-common_SOURCES 0 ${PROJECT_BINARY_DIR}/ParserInit.cpp)
foreach (name A B C D E F G H I J K L M N O P Q R S T U V W X Y Z)
list(INSERT opm-common_SOURCES 0 ${PROJECT_BINARY_DIR}/ParserKeywords/${name}.cpp)
list(INSERT opm-common_HEADERS 0 ${PROJECT_BINARY_DIR}/include/opm/input/eclipse/Parser/ParserKeywords/${name}.hpp)
endforeach()
if (OPM_ENABLE_EMBEDDED_PYTHON)
list(INSERT opm-common_SOURCES 0 ${PROJECT_BINARY_DIR}/python/cxx/builtin_pybind11.cpp)
@@ -164,14 +163,6 @@ macro (install_hook)
PATTERN *.hpp)
endmacro (install_hook)
# Used to append entries from one list to another.
# The output list is suitable for use in setup.py subtitution
macro(append_quoted OUT IN)
foreach(ENTRY ${${IN}})
list(APPEND ${OUT} "'${ARGN}${ENTRY}'")
endforeach()
endmacro()
# If opm-common is configured to embed the python interpreter we must make sure
# that all downstream modules link libpython transitively. Due to the required
# integration with Python+cmake machinery provided by pybind11 this is done by
@@ -193,8 +184,6 @@ if (OPM_ENABLE_PYTHON)
endif()
set(Python3_EXECUTABLE ${PYTHON_EXECUTABLE})
set(Python3_LIBRARIES ${PYTHON_LIBRARIES})
set(Python3_VERSION "${PYTHON_VERSION_STRING}")
set(Python3_VERSION_MINOR ${PYTHON_VERSION_MINOR})
else()
# Be backwards compatible.
if(PYTHON_EXECUTABLE AND NOT Python3_EXECUTABLE)
@@ -221,21 +210,10 @@ if (OPM_ENABLE_PYTHON)
"Either use \"apt-get install python3-setuptools\" (on Debian/Ubuntu) "
"or \"pip install setuptools\"")
endif()
if(Python3_VERSION_MINOR LESS 3)
# Python native namespace packages requires python >= 3.3
message(SEND_ERROR "OPM requires python >= 3.3 but only version ${Python3_VERSION} was found")
endif()
# Compatibility settings for PythonInterp and PythonLibs
# used e.g. in FindCwrap, pybind11
set(PYTHON_EXECUTABLE ${Python3_EXECUTABLE})
# Directory to install common (for opm modules) python scripts
include (GNUInstallDirs)
set(OPM_PYTHON_COMMON_DIR "${CMAKE_INSTALL_DATAROOTDIR}/opm/python")
set(OPM_PROJECT_EXTRA_CODE_INTREE "${OPM_PROJECT_EXTRA_CODE_INTREE}
set(opm-common_PYTHON_COMMON_DIR ${PROJECT_SOURCE_DIR}/python)")
set(OPM_PROJECT_EXTRA_CODE_INSTALLED "${OPM_PROJECT_EXTRA_CODE_INSTALLED}
set(opm-common_PYTHON_COMMON_DIR ${CMAKE_INSTALL_PREFIX}/${OPM_PYTHON_COMMON_DIR})")
endif()
# We always need the PYTHON_INCLUDE_DIR. Unfortunately
# When we build pypi packages CMake will fail to determine
@@ -356,7 +334,34 @@ install(FILES cmake/OPM-CMake.md
install(FILES etc/opm_bash_completion.sh.in DESTINATION share/opm/etc)
if (OPM_ENABLE_PYTHON)
include(PyInstallPrefix)
execute_process(COMMAND ${PYTHON_EXECUTABLE} -c "
import site, sys
try:
sys.stdout.write(site.getsitepackages()[-1])
except e:
sys.stdout.write('')" OUTPUT_VARIABLE PYTHON_SITE_PACKAGES_PATH)
# -------------------------------------------------------------------------
# 1: Wrap C++ functionality in Python
if (PYTHON_SITE_PACKAGES_PATH MATCHES ".*/dist-packages/?" AND
CMAKE_INSTALL_PREFIX MATCHES "^/usr.*")
# dist-packages is only used if we install below /usr and python's site packages
# path matches dist-packages
set(PYTHON_PACKAGE_PATH "dist-packages")
else()
set(PYTHON_PACKAGE_PATH "site-packages")
endif()
if(PYTHON_VERSION_MAJOR)
set(PY_MAJOR ${PYTHON_VERSION_MAJOR})
else()
set(PY_MAJOR ${Python3_VERSION_MAJOR})
endif()
if(PYTHON_VERSION_MINOR)
set(PY_MINOR ${PYTHON_VERSION_MINOR})
else()
set(PY_MINOR ${Python3_VERSION_MINOR})
endif()
set(PYTHON_INSTALL_PREFIX "lib/python${PY_MAJOR}.${PY_MINOR}/${PYTHON_PACKAGE_PATH}" CACHE STRING "Subdirectory to install Python modules in")
make_directory(${PROJECT_BINARY_DIR}/python)
get_target_property(_opmcommon_include_dirs opmcommon INCLUDE_DIRECTORIES)
list(APPEND _opmcommon_include_dirs ${_ecl_include_dirs})
@@ -398,38 +403,34 @@ if (OPM_ENABLE_PYTHON)
endif()
set(opm-common_PYTHON_PACKAGE_VERSION ${OPM_PYTHON_PACKAGE_VERSION_TAG})
set(SETUP_PY_FLAGS "'-std=c++17'")
# Generate versioned setup.py
if (pybind11_INCLUDE_DIRS)
append_quoted(SETUP_PY_INCLUDE_DIRS pybind11_INCLUDE_DIRS)
string(REGEX REPLACE ";" "', '" _tmp "${pybind11_INCLUDE_DIRS}")
set(SETUP_PY_PYBIND_INCLUDE_DIR "'${_tmp}'")
endif()
if (TARGET fmt::fmt)
get_target_property(SETUP_PY_FMT_LIBS fmt::fmt LOCATION)
get_target_property(FMT_FLAGS fmt::fmt INTERFACE_COMPILE_DEFINITIONS)
append_quoted(SETUP_PY_FLAGS FMT_FLAGS "-D")
append_quoted(opm-common_PYTHON_LINKAGE SETUP_PY_FMT_LIBS)
foreach(flag ${FMT_FLAGS})
set(SETUP_PY_FMT_FLAGS "${SETUP_PY_FMT_FLAGS} '-D${flag}',")
endforeach()
list(APPEND opm-common_PYTHON_LINKAGE "'${SETUP_PY_FMT_LIBS}'")
else()
list(APPEND SETUP_PY_FLAGS "'-DFMT_HEADER_ONLY'")
set(SETUP_PY_FMT_FLAGS "'-DFMT_HEADER_ONLY'")
endif()
if(cjson_FOUND)
append_quoted(opm-common_PYTHON_LINKAGE cjson_LIBRARIES)
append_quoted(SETUP_PY_INCLUDE_DIRS cjson_INCLUDE_DIRS)
list(APPEND opm-common_PYTHON_LINKAGE "'${cjson_LIBRARIES}'")
endif()
if(OpenMP_FOUND)
append_quoted(opm-common_PYTHON_LINKAGE OpenMP_CXX_LIBRARIES)
append_quoted(SETUP_PY_FLAGS OpenMP_CXX_FLAGS)
append_quoted(SETUP_PY_INCLUDE_DIRS OpenMP_CXX_INCLUDE_DIRS)
# opm-common_PYTHON_LINKAGE is used verbatim in a listin python.
# Hence items need to be comma separated.
if (opm-common_PYTHON_LINKAGE)
string(REPLACE ";" "," SETUP_PY_LINKAGE "${opm-common_PYTHON_LINKAGE}")
endif()
# Items need to be comma separated for setup.py generation
string(REPLACE ";" "," SETUP_PY_LINKAGE "${opm-common_PYTHON_LINKAGE}")
string(REPLACE ";" "," SETUP_PY_FLAGS "${SETUP_PY_FLAGS}")
string(REPLACE ";" "," SETUP_PY_INCLUDE_DIRS "${SETUP_PY_INCLUDE_DIRS}")
configure_file (${PROJECT_SOURCE_DIR}/python/setup.py.in ${PROJECT_BINARY_DIR}/python/setup.py)
file(COPY ${PROJECT_SOURCE_DIR}/python/README.md DESTINATION ${PROJECT_BINARY_DIR}/python)
execute_process(COMMAND ${Python3_EXECUTABLE} target_name.py
@@ -467,9 +468,6 @@ if (OPM_ENABLE_PYTHON)
# setup-install.sh - and completely bypass cmake in the installation phase.
if (OPM_INSTALL_PYTHON)
install( CODE "execute_process(COMMAND ${Python3_EXECUTABLE} ${PROJECT_BINARY_DIR}/python/install.py ${PROJECT_BINARY_DIR}/python/opm ${DEST_PREFIX}${CMAKE_INSTALL_PREFIX}/${PYTHON_INSTALL_PREFIX} 1)")
## Need to install this Python script such that it can be used by opm-simulators when building against an installed
## opm-common
install( PROGRAMS "python/install.py" DESTINATION "${OPM_PYTHON_COMMON_DIR}" )
endif()
# Observe that if the opmcommon library has been built as a shared library the

View File

@@ -180,7 +180,6 @@ if(ENABLE_ECL_INPUT)
src/opm/input/eclipse/EclipseState/Tables/Aqudims.cpp
src/opm/input/eclipse/EclipseState/Tables/ColumnSchema.cpp
src/opm/input/eclipse/EclipseState/Tables/DenT.cpp
src/opm/input/eclipse/EclipseState/Tables/JouleThomson.cpp
src/opm/input/eclipse/EclipseState/Tables/Eqldims.cpp
src/opm/input/eclipse/EclipseState/Tables/JFunc.cpp
src/opm/input/eclipse/EclipseState/Tables/PvtxTable.cpp
@@ -302,7 +301,6 @@ if(ENABLE_ECL_OUTPUT)
src/opm/io/eclipse/rst/connection.cpp
src/opm/io/eclipse/rst/group.cpp
src/opm/io/eclipse/rst/header.cpp
src/opm/io/eclipse/rst/netbalan.cpp
src/opm/io/eclipse/rst/network.cpp
src/opm/io/eclipse/rst/udq.cpp
src/opm/io/eclipse/rst/segment.cpp
@@ -365,7 +363,6 @@ list (APPEND TEST_SOURCE_FILES
if(ENABLE_ECL_INPUT)
list(APPEND TEST_SOURCE_FILES
tests/rst_test.cpp
tests/test_CopyablePtr.cpp
tests/test_ERsm.cpp
tests/test_GuideRate.cpp
tests/test_RestartFileView.cpp
@@ -376,7 +373,6 @@ if(ENABLE_ECL_INPUT)
tests/test_ESmry.cpp
tests/test_EInit.cpp
tests/test_ExtESmry.cpp
tests/test_Serialization.cpp
tests/parser/ACTIONX.cpp
tests/parser/ADDREGTests.cpp
tests/parser/AquiferTests.cpp
@@ -477,8 +473,8 @@ if(ENABLE_ECL_OUTPUT)
tests/test_Restart.cpp
tests/test_RFT.cpp
tests/test_rst.cpp
tests/test_rst_netbalan.cpp
tests/test_Solution.cpp
tests/test_Serializer.cpp
tests/test_Inplace.cpp
tests/test_Summary.cpp
tests/test_Summary_Group.cpp
@@ -634,10 +630,10 @@ list( APPEND PUBLIC_HEADER_FILES
opm/common/OpmLog/OpmLog.hpp
opm/common/OpmLog/StreamLog.hpp
opm/common/OpmLog/TimerLog.hpp
opm/common/utility/Serializer.hpp
opm/common/utility/ActiveGridCells.hpp
opm/common/utility/FileSystem.hpp
opm/common/utility/OpmInputError.hpp
opm/common/utility/Serializer.hpp
opm/common/utility/numeric/cmp.hpp
opm/common/utility/platform_dependent/disable_warnings.h
opm/common/utility/platform_dependent/reenable_warnings.h
@@ -698,7 +694,6 @@ if(ENABLE_ECL_INPUT)
opm/input/eclipse/EclipseState/Grid/SatfuncPropertyInitializers.hpp
opm/input/eclipse/EclipseState/Grid/Fault.hpp
opm/input/eclipse/EclipseState/Grid/Box.hpp
opm/input/eclipse/EclipseState/Grid/FieldProps.hpp
opm/input/eclipse/EclipseState/Grid/FieldPropsManager.hpp
opm/input/eclipse/EclipseState/Grid/FaultFace.hpp
opm/input/eclipse/EclipseState/Grid/NNC.hpp
@@ -711,7 +706,6 @@ if(ENABLE_ECL_INPUT)
opm/input/eclipse/EclipseState/TracerConfig.hpp
opm/input/eclipse/EclipseState/MICPpara.hpp
opm/input/eclipse/EclipseState/Tables/DenT.hpp
opm/input/eclipse/EclipseState/Tables/JouleThomson.hpp
opm/input/eclipse/EclipseState/Tables/SimpleTable.hpp
opm/input/eclipse/EclipseState/Tables/StandardCond.hpp
opm/input/eclipse/EclipseState/Tables/PolyInjTable.hpp
@@ -761,7 +755,6 @@ if(ENABLE_ECL_INPUT)
opm/input/eclipse/EclipseState/Tables/WatvisctTable.hpp
opm/input/eclipse/EclipseState/Tables/TableEnums.hpp
opm/input/eclipse/EclipseState/Tables/RvvdTable.hpp
opm/input/eclipse/EclipseState/Tables/RvwvdTable.hpp
opm/input/eclipse/EclipseState/Tables/TableContainer.hpp
opm/input/eclipse/EclipseState/Tables/AqutabTable.hpp
opm/input/eclipse/EclipseState/Tables/PlyadsTable.hpp
@@ -840,8 +833,10 @@ if(ENABLE_ECL_INPUT)
opm/input/eclipse/Schedule/Well/WellEconProductionLimits.hpp
opm/input/eclipse/Schedule/Well/WellFoamProperties.hpp
opm/input/eclipse/Schedule/Well/WellBrineProperties.hpp
opm/input/eclipse/Schedule/Well/WellInjectionProperties.hpp
opm/input/eclipse/Schedule/Well/WellMICPProperties.hpp
opm/input/eclipse/Schedule/Well/WellPolymerProperties.hpp
opm/input/eclipse/Schedule/Well/WellProductionProperties.hpp
opm/input/eclipse/Schedule/Well/WellTracerProperties.hpp
opm/input/eclipse/Schedule/Well/WVFPEXP.hpp
opm/input/eclipse/Schedule/Well/WellTestConfig.hpp
@@ -936,7 +931,6 @@ if(ENABLE_ECL_OUTPUT)
opm/io/eclipse/rst/connection.hpp
opm/io/eclipse/rst/group.hpp
opm/io/eclipse/rst/header.hpp
opm/io/eclipse/rst/netbalan.hpp
opm/io/eclipse/rst/network.hpp
opm/io/eclipse/rst/segment.hpp
opm/io/eclipse/rst/state.hpp
@@ -991,7 +985,6 @@ if(ENABLE_ECL_OUTPUT)
opm/output/eclipse/WriteRPT.hpp
opm/output/eclipse/WriteRestartHelpers.hpp
opm/output/OutputWriter.hpp
opm/utility/CopyablePtr.hpp
opm/utility/EModel.hpp
)
endif()

View File

@@ -59,6 +59,16 @@ foreach (test BoxTest
list(APPEND EXTRA_TESTS ${test})
endforeach ()
opm_add_test( rst_spe1
SOURCES tests/rst_test.cpp
LIBRARIES ${TEST_LIBS}
TEST_ARGS tests/SPE1CASE2.DATA tests/SPE1CASE2_RESTART.DATA )
opm_add_test( rst_msw
SOURCES tests/rst_test.cpp
LIBRARIES ${TEST_LIBS}
TEST_ARGS tests/MSW.DATA tests/MSW_RESTART.DATA )
add_test( NAME rst_deck_test
COMMAND ${PROJECT_SOURCE_DIR}/tests/rst_test_driver.sh ${PROJECT_BINARY_DIR}/bin/rst_deck ${PROJECT_BINARY_DIR}/bin/opmhash
${PROJECT_SOURCE_DIR}/tests/SPE1CASE2_INCLUDE.DATA)
@@ -94,6 +104,8 @@ if(HAVE_OPM_TESTS)
${OPM_TESTS_ROOT}/spe9/SPE9_CP_GROUP.DATA
${OPM_TESTS_ROOT}/spe9/SPE9_CP_SHORT.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
${OPM_TESTS_ROOT}/model2/0_BASE_MODEL2.DATA
${OPM_TESTS_ROOT}/model2/1_MULTREGT_MODEL2.DATA

View File

@@ -11,7 +11,6 @@ set(genkw_SOURCES src/opm/json/JsonObject.cpp
src/opm/input/eclipse/Deck/DeckOutput.cpp
src/opm/input/eclipse/Generator/KeywordGenerator.cpp
src/opm/input/eclipse/Generator/KeywordLoader.cpp
src/opm/input/eclipse/Schedule/UDQ/UDQEnums.cpp
src/opm/input/eclipse/Parser/ErrorGuard.cpp
src/opm/input/eclipse/Parser/ParseContext.cpp
src/opm/input/eclipse/Parser/ParserEnums.cpp
@@ -52,20 +51,67 @@ set( genkw_argv keyword_list.argv
opm/input/eclipse/Parser/ParserKeywords
${PROJECT_BINARY_DIR}/tmp_gen/TestKeywords.cpp)
foreach (name A B C D E F G H I J K L M N O P Q R S T U V W X Y Z)
list(APPEND _tmp_output ${PROJECT_BINARY_DIR}/tmp_gen/ParserKeywords/${name}.cpp
${PROJECT_BINARY_DIR}/tmp_gen/include/opm/input/eclipse/Parser/ParserKeywords/${name}.hpp)
list(APPEND _target_output ${PROJECT_BINARY_DIR}/ParserKeywords/${name}.cpp
${PROJECT_BINARY_DIR}/include/opm/input/eclipse/Parser/ParserKeywords/${name}.hpp)
endforeach()
set( _tmp_output
${PROJECT_BINARY_DIR}/tmp_gen/ParserKeywords/A.cpp
${PROJECT_BINARY_DIR}/tmp_gen/ParserKeywords/B.cpp
${PROJECT_BINARY_DIR}/tmp_gen/ParserKeywords/C.cpp
${PROJECT_BINARY_DIR}/tmp_gen/ParserKeywords/D.cpp
${PROJECT_BINARY_DIR}/tmp_gen/ParserKeywords/E.cpp
${PROJECT_BINARY_DIR}/tmp_gen/ParserKeywords/F.cpp
${PROJECT_BINARY_DIR}/tmp_gen/ParserKeywords/G.cpp
${PROJECT_BINARY_DIR}/tmp_gen/ParserKeywords/H.cpp
${PROJECT_BINARY_DIR}/tmp_gen/ParserKeywords/I.cpp
${PROJECT_BINARY_DIR}/tmp_gen/ParserKeywords/J.cpp
${PROJECT_BINARY_DIR}/tmp_gen/ParserKeywords/K.cpp
${PROJECT_BINARY_DIR}/tmp_gen/ParserKeywords/L.cpp
${PROJECT_BINARY_DIR}/tmp_gen/ParserKeywords/M.cpp
${PROJECT_BINARY_DIR}/tmp_gen/ParserKeywords/N.cpp
${PROJECT_BINARY_DIR}/tmp_gen/ParserKeywords/O.cpp
${PROJECT_BINARY_DIR}/tmp_gen/ParserKeywords/P.cpp
${PROJECT_BINARY_DIR}/tmp_gen/ParserKeywords/Q.cpp
${PROJECT_BINARY_DIR}/tmp_gen/ParserKeywords/R.cpp
${PROJECT_BINARY_DIR}/tmp_gen/ParserKeywords/S.cpp
${PROJECT_BINARY_DIR}/tmp_gen/ParserKeywords/T.cpp
${PROJECT_BINARY_DIR}/tmp_gen/ParserKeywords/U.cpp
${PROJECT_BINARY_DIR}/tmp_gen/ParserKeywords/V.cpp
${PROJECT_BINARY_DIR}/tmp_gen/ParserKeywords/W.cpp
${PROJECT_BINARY_DIR}/tmp_gen/ParserKeywords/X.cpp
${PROJECT_BINARY_DIR}/tmp_gen/ParserKeywords/Y.cpp
${PROJECT_BINARY_DIR}/tmp_gen/ParserKeywords/Z.cpp
${PROJECT_BINARY_DIR}/tmp_gen/ParserInit.cpp
${PROJECT_BINARY_DIR}/tmp_gen/TestKeywords.cpp)
foreach(name TestKeywords.cpp ParserInit.cpp)
list(APPEND _target_output ${PROJECT_BINARY_DIR}/${name})
list(APPEND _tmp_output ${PROJECT_BINARY_DIR}/tmp_gen/${name})
endforeach()
list(APPEND _target_output ${PROJECT_BINARY_DIR}/include/opm/input/eclipse/Parser/ParserKeywords/Builtin.hpp)
list(APPEND _tmp_output ${PROJECT_BINARY_DIR}/tmp_gen/include/opm/input/eclipse/Parser/ParserKeywords/Builtin.hpp)
set( _target_output
${PROJECT_BINARY_DIR}/ParserKeywords/A.cpp
${PROJECT_BINARY_DIR}/ParserKeywords/B.cpp
${PROJECT_BINARY_DIR}/ParserKeywords/C.cpp
${PROJECT_BINARY_DIR}/ParserKeywords/D.cpp
${PROJECT_BINARY_DIR}/ParserKeywords/E.cpp
${PROJECT_BINARY_DIR}/ParserKeywords/F.cpp
${PROJECT_BINARY_DIR}/ParserKeywords/G.cpp
${PROJECT_BINARY_DIR}/ParserKeywords/H.cpp
${PROJECT_BINARY_DIR}/ParserKeywords/I.cpp
${PROJECT_BINARY_DIR}/ParserKeywords/J.cpp
${PROJECT_BINARY_DIR}/ParserKeywords/K.cpp
${PROJECT_BINARY_DIR}/ParserKeywords/L.cpp
${PROJECT_BINARY_DIR}/ParserKeywords/M.cpp
${PROJECT_BINARY_DIR}/ParserKeywords/N.cpp
${PROJECT_BINARY_DIR}/ParserKeywords/O.cpp
${PROJECT_BINARY_DIR}/ParserKeywords/P.cpp
${PROJECT_BINARY_DIR}/ParserKeywords/Q.cpp
${PROJECT_BINARY_DIR}/ParserKeywords/R.cpp
${PROJECT_BINARY_DIR}/ParserKeywords/S.cpp
${PROJECT_BINARY_DIR}/ParserKeywords/T.cpp
${PROJECT_BINARY_DIR}/ParserKeywords/U.cpp
${PROJECT_BINARY_DIR}/ParserKeywords/V.cpp
${PROJECT_BINARY_DIR}/ParserKeywords/W.cpp
${PROJECT_BINARY_DIR}/ParserKeywords/X.cpp
${PROJECT_BINARY_DIR}/ParserKeywords/Y.cpp
${PROJECT_BINARY_DIR}/ParserKeywords/Z.cpp
${PROJECT_BINARY_DIR}/TestKeywords.cpp
${PROJECT_BINARY_DIR}/ParserInit.cpp)
if (OPM_ENABLE_PYTHON)
list(APPEND genkw_argv ${PROJECT_BINARY_DIR}/tmp_gen/builtin_pybind11.cpp)
@@ -73,6 +119,8 @@ if (OPM_ENABLE_PYTHON)
list(APPEND _target_output ${PROJECT_BINARY_DIR}/python/cxx/builtin_pybind11.cpp)
endif()
add_custom_command( OUTPUT
${_tmp_output}
COMMAND genkw ${genkw_argv}
@@ -81,5 +129,5 @@ add_custom_command( OUTPUT
# To avoid some rebuilds
add_custom_command(OUTPUT
${_target_output}
DEPENDS ${_tmp_output}
DEPENDS ${PROJECT_BINARY_DIR}/tmp_gen/ParserKeywords/A.cpp
COMMAND ${CMAKE_COMMAND} -DBASE_DIR=${PROJECT_BINARY_DIR} -P ${PROJECT_SOURCE_DIR}/CopyHeaders.cmake)

View File

@@ -55,13 +55,11 @@ if (METIS_INCLUDE_DIRS OR METIS_LIBRARIES)
endif()
endif()
if (NOT TARGET METIS::METIS)
add_library(METIS::METIS UNKNOWN IMPORTED)
set_target_properties(METIS::METIS PROPERTIES
IMPORTED_LOCATION ${METIS_LIBRARIES}
INTERFACE_INCLUDE_DIRECTORIES ${METIS_INCLUDE_DIRS}
INTERFACE_COMPILE_DEFINITIONS METIS_API_VERSION=${METIS_API_VERSION})
endif()
add_library(METIS::METIS UNKNOWN IMPORTED)
set_target_properties(METIS::METIS PROPERTIES
IMPORTED_LOCATION ${METIS_LIBRARIES}
INTERFACE_INCLUDE_DIRECTORIES ${METIS_INCLUDE_DIRS}
INTERFACE_COMPILE_DEFINITIONS METIS_API_VERSION=${METIS_API_VERSION})
endif()
# print a message to indicate status of this package

View File

@@ -34,13 +34,11 @@ int main(void){
if (QUADMATH_FOUND)
set(QUADMATH_LIBRARIES "quadmath")
set(HAVE_QUAD "${QUADMATH_FOUND}")
if (NOT TARGET QuadMath::QuadMath)
add_library(QuadMath::QuadMath INTERFACE IMPORTED)
set_target_properties(QuadMath::QuadMath PROPERTIES
INTERFACE_LINK_LIBRARIES quadmath
INTERFACE_COMPILE_DEFINITIONS _GLIBCXX_USE_FLOAT128
INTERFACE_COMPILE_OPTIONS $<$<CXX_COMPILER_ID:GNU>:-fext-numeric-literals>)
endif()
add_library(QuadMath::QuadMath INTERFACE IMPORTED)
set_target_properties(QuadMath::QuadMath PROPERTIES
INTERFACE_LINK_LIBRARIES quadmath
INTERFACE_COMPILE_DEFINITIONS _GLIBCXX_USE_FLOAT128
INTERFACE_COMPILE_OPTIONS $<$<CXX_COMPILER_ID:GNU>:-fext-numeric-literals>)
endif()
endif()

View File

@@ -3,10 +3,13 @@
# This module defines:
# VALGRIND_INCLUDE_DIR, where to find valgrind/memcheck.h, etc.
# VALGRIND_PROGRAM, the valgrind executable.
# Valgrind_FOUND, If false, do not try to use valgrind.
# VALGRIND_FOUND, If false, do not try to use valgrind.
#
# If you have valgrind installed in a non-standard place, you can define
# VALGRIND_ROOT to tell cmake where it is.
if (VALGRIND_FOUND)
return()
endif()
find_path(VALGRIND_INCLUDE_DIR valgrind/memcheck.h
/usr/include /usr/local/include ${VALGRIND_ROOT}/include)
@@ -15,7 +18,7 @@ find_path(VALGRIND_INCLUDE_DIR valgrind/memcheck.h
# path, but this does not hurt...
find_program(VALGRIND_PROGRAM NAMES valgrind PATH ${VALGRIND_ROOT}/bin)
find_package_handle_standard_args(Valgrind DEFAULT_MSG
find_package_handle_standard_args(VALGRIND DEFAULT_MSG
VALGRIND_INCLUDE_DIR
VALGRIND_PROGRAM)

View File

@@ -24,7 +24,7 @@ find_package(PTScotch)
#find_package(ParMETIS)
# search for files which implements this module
find_path (ZOLTAN_INCLUDE_DIR
find_path (ZOLTAN_INCLUDE_DIRS
NAMES "zoltan.h"
PATHS ${ZOLTAN_SEARCH_PATH}
PATH_SUFFIXES include trilinos
@@ -35,7 +35,7 @@ if (CMAKE_SIZEOF_VOID_P)
math (EXPR _BITS "8 * ${CMAKE_SIZEOF_VOID_P}")
endif (CMAKE_SIZEOF_VOID_P)
find_library(ZOLTAN_LIBRARY
find_library(ZOLTAN_LIBRARIES
NAMES zoltan trilinos_zoltan
PATHS ${ZOLTAN_SEARCH_PATH}
PATH_SUFFIXES "lib/.libs" "lib" "lib${_BITS}" "lib/${CMAKE_LIBRARY_ARCHITECTURE}"
@@ -50,20 +50,15 @@ include (FindPackageHandleStandardArgs)
find_package_handle_standard_args(ZOLTAN
DEFAULT_MSG
ZOLTAN_LIBRARY
ZOLTAN_INCLUDE_DIR
ZOLTAN_LIBRARIES
ZOLTAN_INCLUDE_DIRS
MPI_FOUND
)
if (ZOLTAN_FOUND)
set(HAVE_ZOLTAN 1)
set(ZOLTAN_LIBRARIES ${ZOLTAN_LIBRARY} ${PARMETIS_LIBRARIES} ${PTSCOTCH_LIBRARIES})
set(ZOLTAN_INCLUDE_DIRS ${ZOLTAN_INCLUDE_DIR} ${PARMETIS_INCLUDE_DIRS}
set(ZOLTAN_LIBRARIES ${ZOLTAN_LIBRARIES} ${PARMETIS_LIBRARIES} ${PTSCOTCH_LIBRARIES})
set(ZOLTAN_INCLUDE_DIRS ${ZOLTAN_INCLUDE_DIRS} ${PARMETIS_INCLUDE_DIRS}
${PTSCOTCH_INCLUDE_DIRS})
# log result
file(APPEND ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeOutput.log
"Determing location of ZOLTAN succeeded:\n"
" Include directory: ${ZOLTAN_INCLUDE_DIRS}\n"
" Library directory: ${ZOLTAN_LIBRARIES}\n\n")
endif()

View File

@@ -38,7 +38,7 @@ macro (opm_compile opm)
endif()
set (${opm}_VERSION "${${opm}_VERSION_MAJOR}.${${opm}_VERSION_MINOR}")
if (${opm}_SOURCES)
add_library (${${opm}_TARGET} ${${opm}_LIBRARY_TYPE} ${${opm}_SOURCES} ${${opm}_HEADERS})
add_library (${${opm}_TARGET} ${${opm}_LIBRARY_TYPE} ${${opm}_SOURCES})
set_target_properties (${${opm}_TARGET} PROPERTIES
SOVERSION ${${opm}_VERSION}
VERSION ${${opm}_VERSION}

View File

@@ -128,41 +128,35 @@ macro (find_and_append_package_to prefix name)
# 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
string(REGEX MATCH "(opm)-.*" _is_opm ${name})
if(NOT _is_opm)
# When using Boost >= 1.70 and e.g. CMake 3.18 we need to make sure that
# subsequent searches are using config mode too. Otherwise the library
# list will be completely messed up. We use a set Boost_Dir to detect that
# previous searches were done using config mode.
if("${name}" STREQUAL "Boost" AND Boost_DIR)
set(_CONFIG_MODE CONFIG)
if ( (NOT DEFINED ${name}_FOUND AND NOT DEFINED ${NAME}_FOUND )
OR _search_components GREATER -1)
string(REGEX MATCH "(opm)-.*" _is_opm ${name})
if(NOT _is_opm)
# When using Boost >= 1.70 and e.g. CMake 3.18 we need to make sure that
# subsequent searches are using config mode too. Otherwise the library
# list will be completely messed up. We use a set Boost_Dir to detect that
# previous searches were done using config mode.
if("${name}" STREQUAL "Boost" AND Boost_DIR)
set(_CONFIG_MODE CONFIG)
else()
set(_CONFIG_MODE "")
endif()
find_package (${name} ${ARGN} ${_CONFIG_MODE})
else()
set(_CONFIG_MODE "")
endif()
find_package (${name} ${ARGN} ${_CONFIG_MODE})
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( CMAKE_VERSION VERSION_GREATER_EQUAL "3.17")
# For some reason we will e.g. call
# find_package_handle_standard_args(opm-common)
# in a find_package(opm-material) call and this will
# usuallly print an annoying warnig. Prevent this at least
# for cmake >=3.17
# \todo Check why/whether these calls are even needed.
set(_NAME_MISMATCHED "NAME_MISMATCHED")
endif()
if(${name}_FOUND AND ${name}_LIBRARY STREQUAL "")
find_package_handle_standard_args(${name}
REQUIRED_VARS ${name}_INCLUDE_DIRS ${_NAME_MISMATCHED})
else()
find_package_handle_standard_args(${name}
REQUIRED_VARS ${name}_LIBRARY ${_NAME_MISMATCHED})
endif()
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}")

View File

@@ -148,8 +148,3 @@ option (USE_QUADMATH "Search for high precision floating point library (normally
if (NOT USE_QUADMATH)
set (CMAKE_DISABLE_FIND_PACKAGE_QuadMath TRUE)
endif ()
option (USE_SUPERLU "Use SuperLU direct solvers for AMG (if umfpack is not found)" ON)
if (NOT USE_SUPERLU)
set (CMAKE_DISABLE_FIND_PACKAGE_SuperLU TRUE)
endif ()

View File

@@ -63,6 +63,9 @@ find_openmp (${project})
include (UseThreads)
find_threads (${project})
# SuperLU is optional
option (USE_SUPERLU "Use SuperLU direct solvers for AMG (if umfpack is not found)" ON)
# PETSc is optional
option (USE_PETSC "Use PETSc iterative solvers" OFF)

View File

@@ -124,7 +124,7 @@ macro (find_opm_package module deps header lib defs prog conf)
# without config.h
config_cmd_line (${module}_CMD_CONFIG ${module}_CONFIG_VARS)
if(prog) # always evaluates to false, but makes tests with DUNE 2.6-2.7 work
if(prog)
# check that we can compile a small test-program
include (CMakePushCheckState)
cmake_push_check_state ()
@@ -138,16 +138,13 @@ macro (find_opm_package module deps header lib defs prog conf)
list (APPEND CMAKE_REQUIRED_DEFINITIONS ${${module}_CMD_CONFIG})
check_cxx_source_compiles ("${prog}" HAVE_${MODULE})
cmake_pop_check_state ()
else()
else(prog)
if(${module}_FOUND)
# No test code provided, mark compilation as successful
# if module was found
# Has to be cached because of scope. Otherwise it is not accessible
# where it is used.
set(HAVE_${MODULE} 1 CACHE BOOL "${module} found")
mark_as_advanced(HAVE_${MODULE})
# if module was founf
set(HAVE_${MODULE} 1)
endif(${module}_FOUND)
endif()
endif(prog)
# write status message in the same manner as everyone else
include (FindPackageHandleStandardArgs)

View File

@@ -1,28 +0,0 @@
# We make this a cmake module so it can be used from opm-simulators' CMakeLists.txt also
execute_process(COMMAND ${PYTHON_EXECUTABLE} -c "
import site, sys
try:
sys.stdout.write(site.getsitepackages()[-1])
except e:
sys.stdout.write('')" OUTPUT_VARIABLE PYTHON_SITE_PACKAGES_PATH)
# -------------------------------------------------------------------------
# 1: Wrap C++ functionality in Python
if (PYTHON_SITE_PACKAGES_PATH MATCHES ".*/dist-packages/?" AND
CMAKE_INSTALL_PREFIX MATCHES "^/usr.*")
# dist-packages is only used if we install below /usr and python's site packages
# path matches dist-packages
set(PYTHON_PACKAGE_PATH "dist-packages")
else()
set(PYTHON_PACKAGE_PATH "site-packages")
endif()
if(PYTHON_VERSION_MAJOR)
set(PY_MAJOR ${PYTHON_VERSION_MAJOR})
else()
set(PY_MAJOR ${Python3_VERSION_MAJOR})
endif()
if(PYTHON_VERSION_MINOR)
set(PY_MINOR ${PYTHON_VERSION_MINOR})
else()
set(PY_MINOR ${Python3_VERSION_MINOR})
endif()
set(PYTHON_INSTALL_PREFIX "lib/python${PY_MAJOR}.${PY_MINOR}/${PYTHON_PACKAGE_PATH}" CACHE STRING "Subdirectory to install Python modules in")

View File

@@ -1,27 +0,0 @@
if(USE_DAMARIS_LIB AND MPI_FOUND)
if (Damaris_FOUND)
set(HAVE_DAMARIS 1)
message(STATUS "The Damaris library was found: ${Damaris_VERSION} ${Damaris_DIR}")
if (Damaris_HAS_HDF5)
message(STATUS "The Damaris library has HDF5 support: ${HDF5_VERSION}")
else()
message(STATUS "The Damaris library does NOT have HDF5 support")
endif()
if (Damaris_HAS_VISIT)
message(STATUS "The Damaris library has VisIt support: ${VisIt_VERSION}")
else()
message(STATUS "The Damaris library does NOT have VisIt support")
endif()
if (Damaris_HAS_CATALYST)
message(STATUS "The Damaris library has Catalyst support: ${Catalyst_VERSION} ${Paraview_VERSION}")
else()
message(STATUS "The Damaris library does NOT have Catalyst support")
endif()
else()
message(STATUS "The Damaris library was requested but NOT found")
endif()
else() # User did not request Damaris support
unset(HAVE_DAMARIS)
endif()
mark_as_advanced(HAVE_DAMARIS)

View File

@@ -58,7 +58,6 @@ if(NOT @opm-project_NAME@_FOUND)
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}")
string(REPLACE ${@opm-project_NAME@_PREFIX} ${DEST_PREFIX} @opm-project_NAME@_PYTHON_COMMON_DIR "${@opm-project_NAME@_PYTHON_COMMON_DIR}")
endif()
@@ -108,18 +107,7 @@ if(NOT @opm-project_NAME@_FOUND)
# The settings in this block do not mix well with the DEST_PREFIX
# setting.
if (NOT DEST_PREFIX)
# if this file is not processed using the OPM CMake system but
# simply by a call to find_package(module) then the CMAKE_MODULE_PATH
# might not include the location of the OPM cmake module yet.
# Hence we search for opm-common using config mode to set it up.
# The check for opm-common_PREFIX is there to not do this in
# opm-common-config.cmake
if(NOT opm-common_PREFIX
AND NOT opm-common_FOUND)
# This needed to find the path to the CMake modules
find_package(opm-common CONFIG)
endif()
# This is required to include OpmPackage /opm-common-prereq.cmake
# This is required to include OpmPackage
set(CMAKE_MODULE_PATH "${CMAKE_MODULE_PATH}" @PREREQ_LOCATION@)
# extra code from variable OPM_PROJECT_EXTRA_CODE

View File

@@ -1,4 +1,4 @@
/* Userspecific CSS for doxygen */
/* Userspesific CSS for doxygen */
body, table, div, p, dl {
font-family: Lucida Grande, Verdana, Geneva, Arial, sans-serif;
font-size: 16px;

View File

@@ -1,11 +0,0 @@
.TH SUMMARY "1" "October 2022" "arraylist 2022.10" "User Commands"
.SH NAME
summary \- Printer for list of arrays in Eclipse summary files
.SH DESCRIPTION
List all arrays found in an EclFile specified on the command line.
.PP
.SH OPTIONS
\fB\-h\fR Print help and exit.
.TP
\fB\-r\fR List array for a specific report time step number. Option only valid for a unified restart file.
.PP

View File

@@ -1,4 +1,4 @@
.TH COMPAREECL "1" "October 2022" "compareECL 2022.10" "User Commands"
.TH COMPAREECL "1" "April 2022" "compareECL 2022.04" "User Commands"
.SH NAME
compareECL \- Comparator for Eclipse files
.SH DESCRIPTION
@@ -32,7 +32,7 @@ The integration test compares SGAS, SWAT and PRESSURE in unified restart files,
.TP
\fB\-p\fR Print keywords in both cases and exit.
.TP
\fB\-r\fR compare a specific report time step number in a restart file.
\fB\-r\fR compare a spesific report time step number in a restart file.
.TP
\fB\-t\fR Specify ECLIPSE filetype to compare, (default behaviour is that all files are compared if found). Different possible arguments are:
.IP
@@ -50,9 +50,6 @@ Compare two RFT files (.RFT).
.IP
\fB\-t\fR SMRY
Compare two cases consistent of (unified) summary files.
.IP
\fB\-t\fR RSM
Compare RSM file against a summary file.
.PP
\fB\-x\fR Allow extra keywords in case number 2. These additional keywords (not found in case number1) will be ignored in the comparison.
.PP

View File

@@ -1,4 +1,4 @@
.TH CONVERTECL "1" "October 2022" "convertECL 2022.10" "User Commands"
.TH CONVERTECL "1" "April 2022" "convertECL 2022.04" "User Commands"
.SH NAME
convertECL \- Converter for Eclipse files (binary <-> formatted format)
.SH DESCRIPTION
@@ -14,5 +14,5 @@ In addition, the program takes these options (which must be given before the arg
.TP
\fB\-i\fR Enforce IX standard on output file.
.TP
\fB\-r\fR extract and convert a specific report time step number from a unified restart file.
\fB\-r\fR extract and convert a spesific report time step number from a unified restart file.
.PP

View File

@@ -1,4 +1,4 @@
.TH OPMHASH "1" "October 2022" "opmhash 2022.10" "User Commands"
.TH OPMHASH "1" "April 2022" "opmhash 2022.04" "User Commands"
.SH NAME
opmhash \- Hasher for summary keywords in Eclipse files
.SH DESCRIPTION
@@ -39,11 +39,3 @@ depends on the keyword order.
\fB\-l\fR : Add filename and linenumber information to each keyword.
.HP
\fB\-s\fR : Short form \- only print the hash of the complete deck.
.HP
\fB\-S\fR : Silent form \- will not print any deck output.
.PP
It is possible to add multiple deck arguments, they are then scanned repeatedly,
and the decks are compared. In the case of multiple deck arguments the exit
status of the program will be zero if all are equal and nonzero in case of
differences.

View File

@@ -1,4 +1,4 @@
.TH OPMPACK "1" "October 2022" "opmpack 2022.10" "User Commands"
.TH OPMPACK "1" "April 2022" "opmpack 2022.04" "User Commands"
.SH NAME
opmpack \- Validator and printer of deck in Eclipse files without comments
.SH DESCRIPTION

View File

@@ -1,4 +1,4 @@
.TH RST_DECK: "1" "October 2022" "rst_deck 2022.10" "User Commands"
.TH RST_DECK: "1" "April 2022" "rst_deck 2022.04" "User Commands"
.SH NAME
rst_deck \- Convert simulation deck to a deck ready for restart
.SH DESCRIPTION
@@ -86,3 +86,95 @@ rst_deck \fI\,/path/to/history/HISTORY.DATA\/\fP rst/HISTORY:30 \fI\,/path/to/rs
1: The program has a compiled list of keywords which will be retained in the
.IP
SOLUTION section. The current value of that list is: RPTRST
.PP
\&../../opm\-parallel/bin/rst_deck: invalid option \fB\-\-\fR 'v'
\&../../opm\-parallel/bin/rst_deck: invalid option \fB\-\-\fR 'e'
\&../../opm\-parallel/bin/rst_deck: invalid option \fB\-\-\fR 'r'
\&../../opm\-parallel/bin/rst_deck: invalid option \fB\-\-\fR 'i'
\&../../opm\-parallel/bin/rst_deck: invalid option \fB\-\-\fR 'o'
\&../../opm\-parallel/bin/rst_deck: invalid option \fB\-\-\fR 'n'
.PP
The rst_deck program will load a simulation deck and parameters for a restart
and reformat the deck to become a restart deck. Before the updated deck is
output the program will update the SOLUTION and SCHEDULE sections. All keywords
from the SOLUTION section will be cleared out(1) and a RESTART keyword will be
inserted. In the SCHEDULE section the program can either remove all keywords up
until the restart date, or alternatively insert SKIPREST immediately following
the SCHEDULE keyword.
.PP
When creating the updated restart deck the program can either link to unmodified
include files with INCLUDE statements, create a copy of deck structure in an
alternative location or create one large file with all keywords in the same
file. Apart from the alterations to support restart the output deck will be
equivalent to the input deck, but formatting is not retained and comments have
been stripped away.
.PP
Arguments:
.PP
1. The data file we are starting with.
.PP
2. The restart source; this can either be a basename with an optional path
.IP
prefix and a :N to restart from step N; alternatively you can point to an
existing restart file. If you point to an existing restart file the input
will be validated in several ways:
.IP
a) Unified/multiple files will be checked against the UNIFIN setting of
.IP
the deck.
.IP
b) Formatted/unformatted will be checked against the FMTIn setting of the
.IP
deck.
.IP
c) If a single file like \fI\,/path/to/case/HISTORY.X0067\/\fP is given as argument the
.IP
:N notation to denote report step should not be used.
.IP
If the restart argument is given as the path to an existing file the content
of the RESTART keyword will be updated to contain the correct path from the
location of the restart deck to the location of the restart file. This path
awareness will be fooled if the restart deck is redirected from stdout to a
path different from cwd. If the restart argument is given as an absolute
filename the RESTART keyword will have an absolute path, if the restart
argument is a relative path the RESTART keyword will get a relative path \-
although an absolute path will be used if the restart file and the output
deck have different roots. If the restart argument is given as a string not
pointing to an existing file it will be inserted verbatim in the restart
deck.
.IP
A restart step value of 0 is interpreted as a dry run \- a deck which has not
been set up for restart will be written out.
.PP
3. Basename of the restart deck we create, can optionally contain a path prefix;
.IP
the path will be created if it does not already exist. This argument is
optional, if it is not provided the program will dump a restart deck on
stdout. If the argument corresponds to an existing directory the restart case
will get the same name as the base case.
.PP
\fB\-s\fR: Manipulate the SCHEDULE section by inserting a SKIPREST keyword immediately
.IP
following the SCHEDULE keyword. If the \fB\-s\fR option is not used the SCHEDULE
section will be modified by removing all keywords until we reach the restart
date.
.PP
\fB\-m\fR: [share|inline|copy] The restart deck can reuse the unmodified include files
.IP
from the base case, this is mode 'share' and is the default. With mode
\&'inline' the restart deck will be one long file and with mode 'copy' the
file structure of the base case will be retained. The default if no \fB\-m\fR
option is given is the 'share' mode.
.IP
In the case of 'share' and 'copy' the correct path to include files will be
negotiated based on the path given to the output case in the third argument.
If the restart deck is passed to stdout the include files will be resolved
based on output in cwd.
.PP
Example:
.IP
rst_deck \fI\,/path/to/history/HISTORY.DATA\/\fP rst/HISTORY:30 \fI\,/path/to/rst/RESTART\/\fP \fB\-s\fR
.PP
1: The program has a compiled list of keywords which will be retained in the
.IP
SOLUTION section. The current value of that list is: RPTRST

View File

@@ -1,4 +1,4 @@
.TH SUMMARY "1" "October 2022" "summary 2022.10" "User Commands"
.TH SUMMARY "1" "April 2022" "summary 2022.04" "User Commands"
.SH NAME
summary \- Printer for summary keys in Eclipse summary files
.SH DESCRIPTION

View File

@@ -5,8 +5,8 @@
Module: opm-common
Description: Open Porous Media Initiative shared infrastructure
Version: 2022.10-rc2
Label: 2022.10-rc2
Version: 2022.04
Label: 2022.04
Maintainer: opm@opm-project.org
MaintainerName: OPM community
Url: http://opm-project.org

View File

@@ -19,8 +19,6 @@
#include <opm/output/eclipse/EclipseIO.hpp>
#include <opm/input/eclipse/Deck/Deck.hpp>
#include <opm/input/eclipse/Parser/Parser.hpp>
#include <opm/input/eclipse/Parser/ParseContext.hpp>
#include <opm/input/eclipse/Parser/ErrorGuard.hpp>

View File

@@ -28,6 +28,10 @@
#include <opm/input/eclipse/Parser/ParseContext.hpp>
#include <opm/input/eclipse/Parser/ErrorGuard.hpp>
#include <opm/input/eclipse/Deck/Deck.hpp>
#include <opm/input/eclipse/EclipseState/EclipseState.hpp>
#include <opm/input/eclipse/EclipseState/EclipseState.hpp>
#include <opm/input/eclipse/EclipseState/SummaryConfig/SummaryConfig.hpp>
#include <opm/input/eclipse/Schedule/Schedule.hpp>
struct keyword {

View File

@@ -22,9 +22,6 @@
#include <iostream>
#include <getopt.h>
#include <opm/input/eclipse/Deck/Deck.hpp>
#include <opm/input/eclipse/EclipseState/InitConfig/InitConfig.hpp>
#include <opm/input/eclipse/EclipseState/IOConfig/IOConfig.hpp>
#include <opm/input/eclipse/Parser/ParserKeywords/I.hpp>
#include <opm/input/eclipse/Parser/ParserKeywords/P.hpp>
#include <opm/input/eclipse/Parser/ParserKeywords/G.hpp>
@@ -32,6 +29,7 @@
#include <opm/input/eclipse/Parser/ErrorGuard.hpp>
#include <opm/input/eclipse/Parser/ParseContext.hpp>
#include <opm/input/eclipse/Parser/InputErrorAction.hpp>
#include <opm/input/eclipse/Deck/Deck.hpp>
namespace fs = std::filesystem;

View File

@@ -20,7 +20,6 @@
#include <filesystem>
#include <fstream>
#include <iomanip>
#include <iostream>
#include <chrono>
#include <sstream>
@@ -29,6 +28,7 @@
#include <opm/input/eclipse/Parser/ErrorGuard.hpp>
#include <opm/input/eclipse/Deck/Deck.hpp>
#include <opm/input/eclipse/EclipseState/EclipseState.hpp>
#include <opm/input/eclipse/EclipseState/EclipseState.hpp>
#include <opm/input/eclipse/Schedule/Schedule.hpp>
#include <opm/input/eclipse/Python/Python.hpp>

View File

@@ -6,8 +6,12 @@
#include <map>
#include <string>
#include <opm/input/eclipse/Parser/ErrorGuard.hpp>
#include <opm/input/eclipse/Deck/Deck.hpp>
#include <opm/input/eclipse/Schedule/SummaryState.hpp>
#include <opm/input/eclipse/EclipseState/EclipseState.hpp>
#include <opm/input/eclipse/EclipseState/EclipseState.hpp>
#include <opm/input/eclipse/EclipseState/SummaryConfig/SummaryConfig.hpp>
#include <opm/input/eclipse/Schedule/Schedule.hpp>
#include <opm/input/eclipse/Schedule/Action/State.hpp>
@@ -23,6 +27,7 @@ class EclipseIO;
class ParseContext;
class Parser;
class Python;
class SummaryState;
class UDQState;
class WellTestState;

View File

@@ -49,22 +49,22 @@
// std::runtime_error.
//
// Usage: OPM_THROW(ExceptionClass, "Error message " << value);
#define OPM_THROW(Exception, message) \
do { \
std::ostringstream opmErrorMacroOStringStream; \
opmErrorMacroOStringStream << "[" << __FILE__ << ":" << __LINE__ << "] " << message; \
::Opm::OpmLog::error(opmErrorMacroOStringStream.str()); \
throw Exception(opmErrorMacroOStringStream.str()); \
#define OPM_THROW(Exception, message) \
do { \
std::ostringstream oss__; \
oss__ << "[" << __FILE__ << ":" << __LINE__ << "] " << message; \
::Opm::OpmLog::error(oss__.str()); \
throw Exception(oss__.str()); \
} while (false)
// Same as OPM_THROW, except for not making an OpmLog::error() call.
//
// Usage: OPM_THROW_NOLOG(ExceptionClass, "Error message " << value);
#define OPM_THROW_NOLOG(Exception, message) \
do { \
std::ostringstream opmErrorMacroOStringStream; \
opmErrorMacroOStringStream << "[" << __FILE__ << ":" << __LINE__ << "] " << message; \
throw Exception(opmErrorMacroOStringStream.str()); \
#define OPM_THROW_NOLOG(Exception, message) \
do { \
std::ostringstream oss__; \
oss__ << "[" << __FILE__ << ":" << __LINE__ << "] " << message; \
throw Exception(oss__.str()); \
} while (false)
// throw an exception if a condition is true

View File

@@ -53,7 +53,7 @@ public:
std::string format(const std::string& msg_fmt) const;
static KeywordLocation serializationTestObject()
static KeywordLocation serializeObject()
{
KeywordLocation result;
result.keyword = "KW";

View File

@@ -21,6 +21,7 @@
#define STREAMLOG_H
#include <fstream>
#include <iostream>
#include <cstdint>
#include <opm/common/OpmLog/LogBackend.hpp>

View File

@@ -22,7 +22,6 @@
#include <opm/input/eclipse/EclipseState/Grid/GridDims.hpp>
#include <array>
#include <vector>
namespace Opm
{
@@ -70,7 +69,6 @@ public:
/// \param k The index in the k direction
/// \return The local index or -1 if the cell is inactive
int localCell(std::size_t i, std::size_t j, std::size_t k) const;
protected:
/// \brief Maps the cartesian index to a compressed local index.
///

View File

@@ -1,9 +1,11 @@
/*
Copyright 2020 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 2 of the License, or
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,
@@ -13,513 +15,122 @@
You should have received a copy of the GNU General Public License
along with OPM. If not, see <http://www.gnu.org/licenses/>.
Consult the COPYING file in the top-level source directory of this
module for the precise wording of the license and the list of
copyright holders.
*/
#ifndef SERIALIZER_HPP
#define SERIALIZER_HPP
#include <algorithm>
#include <functional>
#include <map>
#include <memory>
#include <optional>
#include <set>
#include <type_traits>
#include <utility>
#ifndef OPM_SERIALIZER_HPP
#define OPM_SERIALIZER_HPP
#include <cstring>
#include <string>
#include <unordered_map>
#include <unordered_set>
#include <variant>
#include <vector>
namespace Opm {
namespace detail {
template<typename ...Ts>
struct MakeVariantImpl
{
template<std::size_t Index, typename, typename ...Rest>
static decltype(auto) make_variant(std::size_t index)
{
if(Index == index)
return std::variant<Ts...>{std::in_place_index_t<Index>{}};
if constexpr(sizeof...(Rest) != 0)
return make_variant<Index + 1, Rest...>(index);
else
throw std::runtime_error("Invalid variant index");
}
};
template<typename ...Ts>
decltype(auto) make_variant(std::size_t index)
{
return detail::MakeVariantImpl<Ts...>::template make_variant<0, Ts...>(index);
}
template<class T>
using remove_cvr_t = std::remove_cv_t<std::remove_reference_t<T>>;
} // namespace detail
/*! \brief Class for (de-)serializing.
*! \details If the class has a serializeOp member this is used,
* if not it is passed on to the underlying packer.
/*
This is a very basic serialization class used to support serialization of
small state objects from opm common. The main serialization code used in
opm/flow is initiated and controlled from the restart code, and therefor
slightly cumbersome to use for objects which should be serialized not as part
of the restart code.
*/
template<class Packer>
class Serializer {
public:
//! \brief Constructor.
//! \param packer Packer to use
explicit Serializer(const Packer& packer) :
m_packer(packer)
Serializer() = default;
explicit Serializer(const std::vector<char>& buffer_arg) :
buffer(buffer_arg)
{}
//! \brief Applies current serialization op to the passed data.
template<class T>
void operator()(const T& data)
{
if constexpr (is_ptr<T>::value) {
ptr(data);
} else if constexpr (is_pair_or_tuple<T>::value) {
tuple(data);
} else if constexpr (is_variant<T>::value) {
variant(data);
} else if constexpr (is_optional<T>::value) {
optional(data);
} else if constexpr (is_vector<T>::value) {
vector(data);
} else if constexpr (is_map<T>::value) {
map(data);
} else if constexpr (is_array<T>::value) {
array(data);
} else if constexpr (is_set<T>::value) {
set(data);
} else if constexpr (has_serializeOp<detail::remove_cvr_t<T>>::value) {
const_cast<T&>(data).serializeOp(*this);
} else {
if (m_op == Operation::PACKSIZE)
m_packSize += m_packer.packSize(data);
else if (m_op == Operation::PACK)
m_packer.pack(data, m_buffer, m_position);
else if (m_op == Operation::UNPACK)
m_packer.unpack(const_cast<T&>(data), m_buffer, m_position);
}
}
//! \brief Call this to serialize data.
//! \tparam T Type of class to serialize
//! \param data Class to serialize
template<class T>
void pack(const T& data)
{
m_op = Operation::PACKSIZE;
m_packSize = 0;
(*this)(data);
m_position = 0;
m_buffer.resize(m_packSize);
m_op = Operation::PACK;
(*this)(data);
}
//! \brief Call this to serialize data.
//! \tparam T Type of class to serialize
//! \param data Class to serialize
template<class... Args>
void pack(const Args&... data)
{
m_op = Operation::PACKSIZE;
m_packSize = 0;
variadic_call(data...);
m_position = 0;
m_buffer.resize(m_packSize);
m_op = Operation::PACK;
variadic_call(data...);
}
//! \brief Call this to de-serialize data.
//! \tparam T Type of class to de-serialize
//! \param data Class to de-serialize
template<class T>
void unpack(T& data)
{
m_position = 0;
m_op = Operation::UNPACK;
(*this)(data);
}
//! \brief Call this to de-serialize data.
//! \tparam T Type of class to de-serialize
//! \param data Class to de-serialize
template<class... Args>
void unpack(Args&... data)
{
m_position = 0;
m_op = Operation::UNPACK;
variadic_call(data...);
}
//! \brief Returns current position in buffer.
size_t position() const
{
return m_position;
}
//! \brief Returns true if we are currently doing a serialization operation.
bool isSerializing() const
{
return m_op != Operation::UNPACK;
}
protected:
//! \brief Handler for vectors.
//! \tparam T Type for vector elements
//! \param data The vector to (de-)serialize
template <typename T>
void vector(const std::vector<T>& data)
{
if constexpr (std::is_pod_v<T>) {
if (m_op == Operation::PACKSIZE) {
(*this)(data.size());
m_packSize += m_packer.packSize(data.data(), data.size());
} else if (m_op == Operation::PACK) {
(*this)(data.size());
m_packer.pack(data.data(), data.size(), m_buffer, m_position);
} else if (m_op == Operation::UNPACK) {
std::size_t size = 0;
(*this)(size);
auto& data_mut = const_cast<std::vector<T>&>(data);
data_mut.resize(size);
m_packer.unpack(data_mut.data(), size, m_buffer, m_position);
}
} else {
if (m_op == Operation::UNPACK) {
std::size_t size = 0;
(*this)(size);
auto& data_mut = const_cast<std::vector<T>&>(data);
data_mut.resize(size);
std::for_each(data_mut.begin(), data_mut.end(), std::ref(*this));
} else {
(*this)(data.size());
std::for_each(data.begin(), data.end(), std::ref(*this));
}
}
void put(const T& value) {
this->pack(std::addressof(value), sizeof(T));
}
//! \brief Handler for bool vectors.
//! \param data The vector to (de-)serialize
void vector(const std::vector<bool>& data)
{
if (m_op == Operation::UNPACK) {
std::size_t size = 0;
(*this)(size);
auto& data_mut = const_cast<std::vector<bool>&>(data);
data_mut.clear();
data_mut.reserve(size);
for (size_t i = 0; i < size; ++i) {
bool entry = false;
(*this)(entry);
data_mut.push_back(entry);
}
} else {
(*this)(data.size());
for (const auto entry : data) { // Not a reference: vector<bool> range
bool b = entry;
(*this)(b);
}
}
}
//! \brief Handler for arrays.
//! \param data The array to (de-)serialize
template <class Array>
void array(const Array& data)
{
using T = typename Array::value_type;
if constexpr (std::is_pod_v<T>) {
if (m_op == Operation::PACKSIZE)
m_packSize += m_packer.packSize(data.data(), data.size());
else if (m_op == Operation::PACK)
m_packer.pack(data.data(), data.size(), m_buffer, m_position);
else if (m_op == Operation::UNPACK) {
auto& data_mut = const_cast<Array&>(data);
m_packer.unpack(data_mut.data(), data_mut.size(), m_buffer, m_position);
}
} else {
std::for_each(data.begin(), data.end(), std::ref(*this));
}
}
//! \brief Handler for std::variant.
//! \param data The variant to (de-)serialize
template<class... Args>
void variant(const std::variant<Args...>& data)
{
if (m_op == Operation::UNPACK) {
std::size_t index = 0;
(*this)(index);
auto& data_mut = const_cast<std::variant<Args...>&>(data);
data_mut = detail::make_variant<Args...>(index);
std::visit(std::ref(*this), data_mut);
} else {
(*this)(data.index());
std::visit(std::ref(*this), data);
}
}
//! \brief Handler for std::optional.
//! \tparam T Type for data
//! \param data The optional to (de-)serialize
template<class T>
void optional(const std::optional<T>& data)
{
if (m_op == Operation::UNPACK) {
bool has = false;
(*this)(has);
if (has) {
T res;
(*this)(res);
const_cast<std::optional<T>&>(data) = res;
}
} else {
(*this)(data.has_value());
if (data.has_value()) {
(*this)(*data);
}
}
}
//! \brief Handler for std::tuple.
//! \param data The tuple to (de-)serialize
template<class Tuple>
void tuple(const Tuple& data)
{
tuple_call(data);
}
//! \brief Handler for maps.
//! \tparam Map map type
//! \param map The map to (de-)serialize
template<class Map>
void map(const Map& data)
{
if (m_op == Operation::UNPACK) {
std::size_t size = 0;
(*this)(size);
auto& data_mut = const_cast<Map&>(data);
for (size_t i = 0; i < size; ++i) {
typename Map::value_type entry;
(*this)(entry);
data_mut.insert(entry);
}
} else {
(*this)(data.size());
std::for_each(data.begin(), data.end(), std::ref(*this));
}
}
//! \brief Handler for sets.
//! \tparam Set set type
//! \param data The set to (de-)serialize
template<class Set>
void set(const Set& data)
{
if (m_op == Operation::UNPACK) {
std::size_t size = 0;
(*this)(size);
auto& data_mut = const_cast<Set&>(data);
for (size_t i = 0; i < size; ++i) {
typename Set::value_type entry;
(*this)(entry);
data_mut.insert(entry);
}
} else {
(*this)(data.size());
std::for_each(data.begin(), data.end(), std::ref(*this));
}
}
template<typename T, typename... Args>
void variadic_call(T& first,
Args&&... args)
{
(*this)(first);
if constexpr (sizeof...(args) > 0)
variadic_call(std::forward<Args>(args)...);
}
template<std::size_t I = 0, typename Tuple>
typename std::enable_if<I == std::tuple_size<Tuple>::value, void>::type
tuple_call(const Tuple&)
{
}
template<std::size_t I = 0, typename Tuple>
typename std::enable_if<I != std::tuple_size<Tuple>::value, void>::type
tuple_call(const Tuple& tuple)
{
(*this)(std::get<I>(tuple));
tuple_call<I+1>(tuple);
}
//! \brief Enumeration of operations.
enum class Operation {
PACKSIZE, //!< Calculating serialization buffer size
PACK, //!< Performing serialization
UNPACK //!< Performing de-serialization
};
//! \brief Predicate for detecting vectors.
template<class T>
struct is_vector {
constexpr static bool value = false;
};
template<class T1, class Allocator>
struct is_vector<std::vector<T1,Allocator>> {
constexpr static bool value = true;
};
//! \brief Predicate for detecting variants.
template<class T>
struct is_variant {
constexpr static bool value = false;
};
template<class... Ts>
struct is_variant<std::variant<Ts...>> {
constexpr static bool value = true;
};
//! \brief Predicate for detecting pairs and tuples.
template<class T>
struct is_pair_or_tuple {
constexpr static bool value = false;
};
template<class... Ts>
struct is_pair_or_tuple<std::tuple<Ts...>> {
constexpr static bool value = true;
};
template<class T1, class T2>
struct is_pair_or_tuple<std::pair<T1,T2>> {
constexpr static bool value = true;
};
//! \brief Predicate for smart pointers.
template<class T>
struct is_ptr {
constexpr static bool value = false;
};
template<class T1>
struct is_ptr<std::shared_ptr<T1>> {
constexpr static bool value = true;
};
template<class T1, class Deleter>
struct is_ptr<std::unique_ptr<T1, Deleter>> {
constexpr static bool value = true;
};
//! \brief Predicate for std::optional.
template<class T>
struct is_optional {
constexpr static bool value = false;
};
template<class T1>
struct is_optional<std::optional<T1>> {
constexpr static bool value = true;
};
//! \brief Predicate for maps
template<class T>
struct is_map {
constexpr static bool value = false;
};
template<class Key, class T, class Compare, class Allocator>
struct is_map<std::map<Key,T,Compare,Allocator>> {
constexpr static bool value = true;
};
template<class Key, class T, class Hash, class KeyEqual, class Allocator>
struct is_map<std::unordered_map<Key,T,Hash,KeyEqual,Allocator>> {
constexpr static bool value = true;
};
//! \brief Predicate for sets
template<class T>
struct is_set {
constexpr static bool value = false;
};
template<class Key, class Compare, class Allocator>
struct is_set<std::set<Key,Compare,Allocator>> {
constexpr static bool value = true;
};
template<class Key, class Hash, class KeyEqual, class Allocator>
struct is_set<std::unordered_set<Key,Hash,KeyEqual,Allocator>> {
constexpr static bool value = true;
};
//! \brief Predicate for arrays
template<class T>
struct is_array {
constexpr static bool value = false;
};
template<class T, std::size_t N>
struct is_array<std::array<T,N>> {
constexpr static bool value = true;
};
//! Detect existence of \c serializeOp member function
//!
//! Base case (no \c serializeOp member function)
template <typename, class = void>
struct has_serializeOp : public std::false_type {};
//! Detect existence of \c serializeOp member function
//!
//! Non-default, albeit common, case (type has \c serializeOp member
//! function)
template <typename T>
struct has_serializeOp<
T, std::void_t<decltype(std::declval<T>().serializeOp(std::declval<Serializer<Packer>&>()))>
> : public std::true_type {};
void put(const T* ) {
throw std::logic_error("Serializer can not pack pointers");
}
//! \brief Handler for smart pointers.
template<class PtrType>
void ptr(const PtrType& data)
{
using T1 = typename PtrType::element_type;
bool value = data ? true : false;
(*this)(value);
if (m_op == Operation::UNPACK && value) {
const_cast<PtrType&>(data).reset(new T1);
}
if (data) {
(*this)(*data);
template <typename T>
T get() {
T value;
std::memcpy(&value, &this->buffer[this->read_pos], sizeof(T));
this->read_pos += sizeof(T);
return value;
}
template<typename T>
void put_vector(const std::vector<T>& values) {
this->put(values.size());
this->pack(values.data(), values.size() * sizeof(T));
}
template<typename T>
std::vector<T> get_vector() {
std::size_t size = this->get<std::size_t>();
std::vector<T> values(size);
for (std::size_t index=0; index < size; index++)
values[index] = this->get<T>();
return values;
}
template<typename K, typename T>
void put_map(const std::unordered_map<K,T>& values) {
this->put(values.size());
for (const auto& value_pair : values) {
this->put(value_pair.first);
this->put(value_pair.second);
}
}
const Packer& m_packer; //!< Packer to use
Operation m_op = Operation::PACKSIZE; //!< Current operation
size_t m_packSize = 0; //!< Required buffer size after PACKSIZE has been done
int m_position = 0; //!< Current position in buffer
std::vector<char> m_buffer; //!< Buffer for serialized data
template<typename K, typename T>
std::unordered_map<K,T> get_map() {
std::unordered_map<K,T> values;
auto size = this->get<std::size_t>();
for (std::size_t index = 0; index < size; index++) {
auto key = this->get<K>();
auto value = this->get<T>();
values.insert( std::make_pair(key,value) );
}
return values;
}
std::vector<char> buffer;
private:
void pack(const void * ptr, std::size_t value_size) {
std::size_t write_pos = this->buffer.size();
std::size_t new_size = write_pos + value_size;
this->buffer.resize( new_size );
std::memcpy(&this->buffer[write_pos], ptr, value_size);
}
std::size_t read_pos = 0;
};
template <>
void inline Serializer::put(const std::string& value) {
this->put(value.size());
if (value.empty())
return;
this->pack(value.c_str(), value.size());
}
template<>
std::string inline Serializer::get<std::string>() {
std::string::size_type length = this->get<std::string::size_type>();
if (length == 0)
return std::string{};
this->read_pos += length;
return {std::addressof(this->buffer[this->read_pos - length]), length};
}
}
#endif

View File

@@ -45,7 +45,6 @@ namespace Opm {
std::time_t mkdatetime(int in_year, int in_month, int in_day, int hour, int minute, int second);
std::time_t mkdate(int in_year, int in_month, int in_day);
std::time_t portable_timegm(const std::tm* t);
std::time_t timeFromEclipse(const DeckRecord &dateRecord);
}
@@ -104,7 +103,7 @@ namespace Opm {
template<class Serializer>
void serializeOp(Serializer& serializer)
{
serializer(ymd_);
ymd_.serializeOp(serializer);
serializer(hour_);
serializer(minutes_);
serializer(seconds_);

View File

@@ -24,7 +24,7 @@
#include <exception>
#include <vector>
#include <utility>
#include <ostream>
#include <iostream>
#include <opm/common/ErrorMacros.hpp>

View File

@@ -21,9 +21,9 @@
#define DECK_HPP
#include <functional>
#include <iosfwd>
#include <map>
#include <memory>
#include <ostream>
#include <optional>
#include <vector>
#include <string>
@@ -69,7 +69,7 @@ namespace Opm {
Deck( const Deck& );
Deck( Deck&& );
static Deck serializationTestObject();
static Deck serializeObject();
Deck& operator=(const Deck& rhs);
bool operator==(const Deck& data) const;
@@ -116,8 +116,8 @@ namespace Opm {
template<class Serializer>
void serializeOp(Serializer& serializer)
{
serializer(keywordList);
serializer(defaultUnits);
serializer.vector(keywordList);
defaultUnits.serializeOp(serializer);
serializer(activeUnits);
serializer(m_dataFile);
serializer(input_path);

View File

@@ -23,7 +23,7 @@
#include <string>
#include <vector>
#include <memory>
#include <iosfwd>
#include <ostream>
#include <opm/input/eclipse/Units/Dimension.hpp>
#include <opm/input/eclipse/Utility/Typetools.hpp>
@@ -46,7 +46,7 @@ namespace Opm {
DeckItem( const std::string&, UDAValue, const std::vector<Dimension>& active_dim, const std::vector<Dimension>& default_dim);
DeckItem( const std::string&, double, const std::vector<Dimension>& active_dim, const std::vector<Dimension>& default_dim);
static DeckItem serializationTestObject();
static DeckItem serializeObject();
const std::string& name() const;
@@ -140,14 +140,14 @@ namespace Opm {
serializer(dval);
serializer(ival);
serializer(sval);
serializer(rsval);
serializer(uval);
serializer.vector(rsval);
serializer.vector(uval);
serializer(type);
serializer(item_name);
serializer(value_status);
serializer.template vector<value::status, false>(value_status);
serializer(raw_data);
serializer(active_dimensions);
serializer(default_dimensions);
serializer.vector(active_dimensions);
serializer.vector(default_dimensions);
}
void reserve_additionalRawString(std::size_t);

View File

@@ -46,7 +46,7 @@ namespace Opm {
DeckKeyword(const ParserKeyword& parserKeyword, const std::vector<int>& data);
DeckKeyword(const ParserKeyword& parserKeyword, const std::vector<double>& data, const UnitSystem& system_active, const UnitSystem& system_default);
static DeckKeyword serializationTestObject();
static DeckKeyword serializeObject();
const std::string& name() const;
void setFixedSize();
@@ -97,8 +97,8 @@ namespace Opm {
void serializeOp(Serializer& serializer)
{
serializer(m_keywordName);
serializer(m_location);
serializer(m_recordList);
m_location.serializeOp(serializer);
serializer.vector(m_recordList);
serializer(m_isDataKeyword);
serializer(m_slashTerminated);
serializer(m_isDoubleRecordKeyword);

View File

@@ -20,7 +20,7 @@
#ifndef DECK_OUTPUT_HPP
#define DECK_OUTPUT_HPP
#include <iosfwd>
#include <ostream>
#include <string>
#include <cstddef>

View File

@@ -23,7 +23,7 @@
#include <string>
#include <vector>
#include <memory>
#include <iosfwd>
#include <ostream>
#include <opm/input/eclipse/Deck/DeckItem.hpp>
@@ -36,7 +36,7 @@ namespace Opm {
DeckRecord() = default;
DeckRecord( std::vector< DeckItem >&& items, const bool check_for_duplicate_names = true );
static DeckRecord serializationTestObject();
static DeckRecord serializeObject();
size_t size() const;
void addItem( DeckItem deckItem );
@@ -75,7 +75,7 @@ namespace Opm {
template<class Serializer>
void serializeOp(Serializer& serializer)
{
serializer(m_items);
serializer.vector(m_items);
}
private:

View File

@@ -22,12 +22,10 @@
#include <string>
#include <opm/input/eclipse/Deck/DeckView.hpp>
#include <opm/input/eclipse/Deck/Deck.hpp>
namespace Opm {
class Deck;
enum class Section {
RUNSPEC,
GRID,

View File

@@ -25,7 +25,7 @@
#include <unordered_set>
#include <filesystem>
#include <fstream>
#include <iosfwd>
#include <iostream>
#include <fmt/format.h>
#include <opm/input/eclipse/Deck/DeckKeyword.hpp>

View File

@@ -51,7 +51,7 @@ public:
void update(const std::string& s);
void update_value(const UDAValue& other);
static UDAValue serializationTestObject();
static UDAValue serializeObject();
/*
The get<double>() and get<std::string>() methods will throw an
@@ -80,7 +80,7 @@ public:
bool operator==(const UDAValue& other) const;
bool operator!=(const UDAValue& other) const;
bool is_numeric() const { return numeric_value; }
bool is_numeric() { return numeric_value; }
template<class Serializer>
void serializeOp(Serializer& serializer)
@@ -88,7 +88,7 @@ public:
serializer(numeric_value);
serializer(double_value);
serializer(string_value);
serializer(dim);
dim.serializeOp(serializer);
}
void operator*=(double rhs);

View File

@@ -93,19 +93,18 @@ namespace Opm {
void pruneDeactivatedAquiferConnections(const std::vector<std::size_t>& deactivated_cells);
void loadFromRestart(const RestartIO::RstAquifer& rst_aquifers);
static Aquancon serializationTestObject();
static Aquancon serializeObject();
const std::unordered_map<int, std::vector<Aquancon::AquancCell>>& data() const;
bool operator==(const Aquancon& other) const;
bool active() const;
bool hasAquiferConnections(int aquiferID) const;
const std::vector<Aquancon::AquancCell>& getConnections(int aquiferID) const;
const std::vector<Aquancon::AquancCell>& operator[](int aquiferID) const;
template<class Serializer>
void serializeOp(Serializer& serializer)
{
serializer(this->cells);
serializer.map(this->cells);
}
private:

View File

@@ -81,7 +81,7 @@ namespace Opm {
std::vector<double> dimensionless_time{};
std::vector<double> dimensionless_pressure{};
static AQUCT_data serializationTestObject();
static AQUCT_data serializeObject();
double timeConstant() const { return this->time_constant_; }
double influxConstant() const { return this->influx_constant_; }
@@ -129,7 +129,7 @@ namespace Opm {
void loadFromRestart(const RestartIO::RstAquifer& rst,
const TableManager& tables);
static AquiferCT serializationTestObject();
static AquiferCT serializeObject();
std::size_t size() const;
std::vector<AquiferCT::AQUCT_data>::const_iterator begin() const;
@@ -142,7 +142,7 @@ namespace Opm {
template<class Serializer>
void serializeOp(Serializer& serializer)
{
serializer(m_aquct);
serializer.vector(m_aquct);
}
private:

View File

@@ -53,7 +53,7 @@ public:
void loadFromRestart(const RestartIO::RstAquifer& aquifers,
const TableManager& tables);
static AquiferConfig serializationTestObject();
static AquiferConfig serializeObject();
bool active() const;
const AquiferCT& ct() const;
@@ -61,7 +61,6 @@ public:
const Aquancon& connections() const;
bool operator==(const AquiferConfig& other) const;
bool hasAquifer(const int aquID) const;
bool hasAnalyticalAquifer(const int aquID) const;
bool hasNumericalAquifer() const;
bool hasAnalyticalAquifer() const;
@@ -71,10 +70,10 @@ public:
template<class Serializer>
void serializeOp(Serializer& serializer)
{
serializer(aquifetp);
serializer(aquiferct);
serializer(aqconn);
serializer(numerical_aquifers);
aquifetp.serializeOp(serializer);
aquiferct.serializeOp(serializer);
aqconn.serializeOp(serializer);
numerical_aquifers.serializeOp(serializer);
}
private:

View File

@@ -57,8 +57,7 @@ class Aquifetp {
const double C_t_,
const double V0_,
const double d0_,
const double p0_,
const double t0_);
const double p0_);
int aquiferID{};
int pvttableID{};
@@ -69,9 +68,8 @@ class Aquifetp {
double datum_depth{};
std::optional<double> initial_pressure{};
std::optional<double> initial_temperature{};
static AQUFETP_data serializationTestObject();
static AQUFETP_data serializeObject();
double timeConstant() const { return this->time_constant_; }
double waterDensity() const { return this->water_density_; }
@@ -91,7 +89,6 @@ class Aquifetp {
serializer(this->initial_watvolume);
serializer(this->datum_depth);
serializer(this->initial_pressure);
serializer(this->initial_temperature);
serializer(this->time_constant_);
serializer(this->water_density_);
serializer(this->water_viscosity_);
@@ -110,7 +107,7 @@ class Aquifetp {
void loadFromRestart(const RestartIO::RstAquifer& rst,
const TableManager& tables);
static Aquifetp serializationTestObject();
static Aquifetp serializeObject();
const std::vector<Aquifetp::AQUFETP_data>& data() const;
@@ -124,7 +121,7 @@ class Aquifetp {
template<class Serializer>
void serializeOp(Serializer& serializer)
{
serializer(m_aqufetp);
serializer.vector(m_aqufetp);
}
private:

View File

@@ -57,11 +57,11 @@ namespace Opm {
void initConnections(const Deck& deck, const EclipseGrid& grid);
void postProcessConnections(const EclipseGrid& grid, const std::vector<int>& actnum);
static NumericalAquifers serializationTestObject();
static NumericalAquifers serializeObject();
template <class Serializer>
void serializeOp(Serializer& serializer)
{
serializer(this->m_aquifers);
serializer.map(this->m_aquifers);
serializer(this->m_num_records);
}

View File

@@ -69,8 +69,8 @@ namespace Opm {
template<class Serializer>
void serializeOp(Serializer& serializer) {
serializer(this->id_);
serializer(this->cells_);
serializer(this->connections_);
serializer.vector(this->cells_);
serializer.vector(this->connections_);
}
private:

View File

@@ -34,7 +34,7 @@ namespace Opm {
explicit EclipseConfig(const Deck& deck);
EclipseConfig(const InitConfig& initConfig, const IOConfig& io_conf);
static EclipseConfig serializationTestObject();
static EclipseConfig serializeObject();
InitConfig& init();
IOConfig& io();
@@ -46,8 +46,8 @@ namespace Opm {
template<class Serializer>
void serializeOp(Serializer& serializer)
{
serializer(m_initConfig);
serializer(io_config);
m_initConfig.serializeOp(serializer);
io_config.serializeOp(serializer);
}
private:

View File

@@ -116,21 +116,20 @@ namespace Opm {
template<class Serializer>
void serializeOp(Serializer& serializer)
{
// FieldPropsManager is handled through a different mechanism.
// Do not add the member (i.e., field_props) to this list.
serializer(m_tables);
serializer(m_runspec);
serializer(m_eclipseConfig);
serializer(m_deckUnitSystem);
serializer(m_inputNnc);
serializer(m_gridDims);
serializer(m_simulationConfig);
serializer(aquifer_config);
serializer(m_transMult);
serializer(m_faults);
// FieldPropsManager is handled otherwise, do not add
m_tables.serializeOp(serializer);
m_runspec.serializeOp(serializer);
m_eclipseConfig.serializeOp(serializer);
m_deckUnitSystem.serializeOp(serializer);
m_inputNnc.serializeOp(serializer);
m_gridDims.serializeOp(serializer);
aquifer_config.serializeOp(serializer);
m_simulationConfig.serializeOp(serializer);
m_transMult.serializeOp(serializer);
m_faults.serializeOp(serializer);
serializer(m_title);
serializer(tracer_config);
serializer(m_micppara);
tracer_config.serializeOp(serializer);
m_micppara.serializeOp(serializer);
}
static bool rst_cmp(const EclipseState& full_state, const EclipseState& rst_state);
@@ -138,9 +137,6 @@ namespace Opm {
private:
void initIOConfigPostSchedule(const Deck& deck);
void assignRunTitle(const Deck& deck);
void reportNumberOfActivePhases() const;
void conveyNumericalAquiferEffects();
void applyMULTXYZ();
void initFaults(const Deck& deck);
void initPara(const Deck& deck);
@@ -159,14 +155,14 @@ namespace Opm {
NNC m_inputNnc;
GridDims m_gridDims;
FieldPropsManager field_props;
SimulationConfig m_simulationConfig;
AquiferConfig aquifer_config;
SimulationConfig m_simulationConfig;
TransMult m_transMult;
FaultCollection m_faults;
std::string m_title;
TracerConfig tracer_config;
MICPpara m_micppara;
std::string m_title{};
FaultCollection m_faults{};
};
} // namespace Opm

View File

@@ -30,7 +30,7 @@ class EndpointScaling {
EndpointScaling() noexcept = default;
explicit EndpointScaling( const Deck& );
static EndpointScaling serializationTestObject();
static EndpointScaling serializeObject();
/* true if endpoint scaling is enabled, otherwise false */
operator bool() const noexcept;

View File

@@ -17,76 +17,62 @@
along with OPM. If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef BOX_HPP_
#define BOX_HPP_
#include <opm/input/eclipse/EclipseState/Grid/GridDims.hpp>
#include <array>
#include <cstddef>
#include <functional>
#include <limits>
#include <vector>
namespace Opm {
class DeckRecord;
}
class EclipseGrid;
namespace Opm
{
class Box
{
class Box {
public:
using IsActive = std::function<bool(const std::size_t globalIdx)>;
using ActiveIdx = std::function<std::size_t(const std::size_t globalIdx)>;
struct cell_index
{
struct cell_index {
std::size_t global_index;
std::size_t active_index;
std::size_t data_index;
cell_index(std::size_t g,std::size_t a, std::size_t d)
: global_index(g)
, active_index(a)
, data_index(d)
cell_index(std::size_t g,std::size_t a, std::size_t d) :
global_index(g),
active_index(a),
data_index(d)
{}
// This constructor should is used by the global_index_list() member
// which will return a list of *all* the cells in the box. In this
// case the active_index will be set to the global_index. This is a
// hack to simplify the treatment of global fields in the FieldProps
// implementation.
cell_index(std::size_t g, std::size_t d)
: global_index(g)
, active_index(g)
, data_index(d)
/*
This constructor should is used by the global_index_list() member
which will return a list of *all* the cells in the box. In this
case the active_index will be set to the global_index. This is a
hack to simplify the treatment of global fields in the FieldProps
implementation.
*/
cell_index(std::size_t g, std::size_t d) :
global_index(g),
active_index(g),
data_index(d)
{}
};
explicit Box(const GridDims& gridDims,
IsActive isActive,
ActiveIdx activeIdx);
Box(const GridDims& gridDims,
IsActive isActive,
ActiveIdx activeIdx,
int i1, int i2,
int j1, int j2,
int k1, int k2);
explicit Box(const EclipseGrid& grid);
Box(const EclipseGrid& grid , int i1 , int i2 , int j1 , int j2 , int k1 , int k2);
void update(const DeckRecord& deckRecord);
void reset();
bool isGlobal() const;
std::size_t size() const;
std::size_t getDim(std::size_t idim) const;
size_t size() const;
bool isGlobal() const;
size_t getDim(size_t idim) const;
const std::vector<cell_index>& index_list() const;
const std::vector<cell_index>& global_index_list() const;
bool operator==(const Box& other) const;
const std::vector<Box::cell_index>& global_index_list() const;
bool equal(const Box& other) const;
int I1() const;
int I2() const;
int J1() const;
@@ -95,18 +81,17 @@ namespace Opm
int K2() const;
private:
GridDims m_globalGridDims_{};
IsActive m_globalIsActive_{};
ActiveIdx m_globalActiveIdx_{};
std::array<std::size_t, 3> m_dims{};
std::array<std::size_t, 3> m_offset{};
void init(int i1, int i2, int j1, int j2, int k1, int k2);
void initIndexList();
const EclipseGrid& grid;
size_t m_stride[3];
size_t m_dims[3] = { 0, 0, 0 };
size_t m_offset[3];
bool m_isGlobal;
std::vector<cell_index> m_active_index_list;
std::vector<cell_index> m_global_index_list;
void init(int i1, int i2, int j1, int j2, int k1, int k2);
void initIndexList();
int lower(int dim) const;
int upper(int dim) const;
};

View File

@@ -17,14 +17,15 @@
along with OPM. If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef BOXMANAGER_HPP_
#define BOXMANAGER_HPP_
#include <opm/input/eclipse/EclipseState/Grid/Box.hpp>
#include <opm/input/eclipse/EclipseState/Grid/GridDims.hpp>
#include <memory>
#include <vector>
#include <memory>
#include <opm/input/eclipse/EclipseState/Grid/Box.hpp>
#include <opm/input/eclipse/EclipseState/Grid/EclipseGrid.hpp>
/*
This class implements a simple book keeping system for the current
@@ -51,12 +52,9 @@
namespace Opm {
class BoxManager
{
class BoxManager {
public:
explicit BoxManager(const GridDims& gridDims,
Box::IsActive isActive,
Box::ActiveIdx activeIdx);
BoxManager(const EclipseGrid& grid);
void setInputBox( int i1,int i2 , int j1 , int j2 , int k1 , int k2);
void setKeywordBox( int i1,int i2 , int j1 , int j2 , int k1 , int k2);
@@ -69,20 +67,12 @@ namespace Opm {
const std::vector<Box::cell_index>& index_list() const;
private:
GridDims gridDims_{};
Box::IsActive isActive_{};
Box::ActiveIdx activeIdx_{};
const EclipseGrid& grid;
std::unique_ptr<Box> m_globalBox;
std::unique_ptr<Box> m_inputBox;
std::unique_ptr<Box> m_keywordBox;
std::unique_ptr<Box>
makeBox(const int i1, const int i2,
const int j1, const int j2,
const int k1, const int k2) const;
};
}
#endif // BOXMANAGER_HPP_
#endif

View File

@@ -60,12 +60,12 @@ namespace Opm {
These constructors will make a copy of the src grid, with
zcorn and or actnum have been adjustments.
*/
EclipseGrid(const EclipseGrid& src) = default;
EclipseGrid(const EclipseGrid& src, const std::vector<int>& actnum);
EclipseGrid(const EclipseGrid& src, const double* zcorn, const std::vector<int>& actnum);
EclipseGrid(size_t nx, size_t ny, size_t nz,
double dx = 1.0, double dy = 1.0, double dz = 1.0);
explicit EclipseGrid(const GridDims& gd);
EclipseGrid(const std::array<int, 3>& dims ,
const std::vector<double>& coord ,
@@ -208,17 +208,6 @@ namespace Opm {
void resetACTNUM( const std::vector<int>& actnum);
bool equal(const EclipseGrid& other) const;
static bool hasDVDEPTHZKeywords(const Deck&);
/*
For ALugrid we can *only* use the keyword <DXV, DXYV, DZV, DEPTHZ> so to
initialize a Regular Cartesian Grid; further we need equidistant mesh
spacing in each direction to initialize ALuGrid (mandatory for
mesh refinement!).
*/
static bool hasEqualDVDEPTHZ(const Deck&);
static bool allEqual(const std::vector<double> &v);
private:
std::vector<double> m_minpvVector;
@@ -271,10 +260,11 @@ namespace Opm {
void initCartesianGrid(const Deck&);
void initDTOPSGrid(const Deck&);
void initDVDEPTHZGrid(const Deck&);
void initGrid(const Deck&, const int* actnum);
void initGrid(const Deck&);
void initCornerPointGrid(const Deck&);
void assertCornerPointKeywords(const Deck&);
static bool hasDVDEPTHZKeywords(const Deck&);
static bool hasDTOPSKeywords(const Deck&);
static void assertVectorSize(const std::vector<double>& vector, size_t expectedSize, const std::string& msg);

View File

@@ -28,13 +28,12 @@ namespace Opm {
namespace FaceDir {
enum DirEnum {
Unknown = 0,
XPlus = 1,
XMinus = 2,
YPlus = 4,
YMinus = 8,
ZPlus = 16,
ZMinus = 32
XPlus = 1,
XMinus = 2,
YPlus = 4,
YMinus = 8,
ZPlus = 16,
ZMinus = 32
};
/**
The MULTREGTScanner will use these values as bitmaps;
@@ -44,9 +43,6 @@ namespace Opm {
DirEnum FromString(const std::string& stringValue);
int FromMULTREGTString(const std::string& stringValue);
DirEnum FromIntersectionIndex(int idx);
const std::string toString(DirEnum dir);
}
}

View File

@@ -35,7 +35,7 @@ public:
Fault() = default;
explicit Fault(const std::string& faultName);
static Fault serializationTestObject();
static Fault serializeObject();
const std::string& getName() const;
void setTransMult(double transMult);
@@ -52,7 +52,7 @@ public:
{
serializer(m_name);
serializer(m_transMult);
serializer(m_faceList);
serializer.vector(m_faceList);
}
private:

View File

@@ -37,7 +37,7 @@ public:
FaultCollection();
FaultCollection(const GRIDSection& gridSection, const GridDims& grid);
static FaultCollection serializationTestObject();
static FaultCollection serializeObject();
size_t size() const;
bool hasFault(const std::string& faultName) const;
@@ -55,14 +55,14 @@ public:
template<class Serializer>
void serializeOp(Serializer& serializer)
{
serializer(m_faults);
m_faults.serializeOp(serializer);
}
private:
void addFaultFaces(const GridDims& grid,
const DeckRecord& faultRecord,
const std::string& faultName);
OrderedMap<Fault, 8> m_faults;
OrderedMap<std::string, Fault> m_faults;
};
}

View File

@@ -36,7 +36,7 @@ public:
size_t K1 , size_t K2,
FaceDir::DirEnum faceDir);
static FaultFace serializationTestObject();
static FaultFace serializeObject();
std::vector<size_t>::const_iterator begin() const;
std::vector<size_t>::const_iterator end() const;

View File

@@ -43,8 +43,6 @@ public:
// The default constructed fieldProps object is **NOT** usable
FieldPropsManager() = default;
FieldPropsManager(const Deck& deck, const Phases& ph, const EclipseGrid& grid, const TableManager& tables);
virtual ~FieldPropsManager() = default;
virtual void reset_actnum(const std::vector<int>& actnum);
const std::string& default_region() const;
virtual std::vector<int> actnum() const;
@@ -230,8 +228,16 @@ public:
void apply_numerical_aquifers(const NumericalAquifers& aquifers);
const Fieldprops::TranMap& getTran() const;
/*
When using MPI the FieldPropsManager is typically only assembled on the
root node and then distributed to the other nodes afterwards. These
methods are support methods for that, the real data used by the
transmissibility calculators is in the form of custom 3D fields, they are
distributed the same way the rest of the 3D fields are distributed.
*/
virtual std::vector<char> serialize_tran() const;
virtual void deserialize_tran(const std::vector<char>& buffer);
private:
/*
Return the keyword values as a std::vector<>. All elements in the return
@@ -268,9 +274,14 @@ private:
template <typename T>
std::vector<T> get_global(const std::string& keyword) const;
std::shared_ptr<FieldProps> fp;
};
void deserialize_tran(std::unordered_map<std::string, Fieldprops::TranCalculator>& tran,
const std::vector<char>& buffer);
template<class MapType>
void apply_tran(const std::unordered_map<std::string, Fieldprops::TranCalculator>& tran,
const MapType& double_data,

View File

@@ -21,7 +21,8 @@
#define OPM_PARSER_GRIDDIMS_HPP
#include <array>
#include <cstddef>
#include <stdexcept>
#include <vector>
namespace Opm {
class Deck;
@@ -30,30 +31,32 @@ namespace Opm {
class GridDims
{
public:
GridDims();
explicit GridDims(const std::array<int, 3>& xyz);
GridDims(std::size_t nx, std::size_t ny, std::size_t nz);
static GridDims serializationTestObject();
GridDims();
explicit GridDims(std::array<int, 3> xyz);
GridDims(size_t nx, size_t ny, size_t nz);
static GridDims serializeObject();
explicit GridDims(const Deck& deck);
std::size_t getNX() const;
std::size_t getNY() const;
std::size_t getNZ() const;
std::size_t operator[](int dim) const;
size_t getNX() const;
std::array<int, 3> getNXYZ() const;
size_t getNY() const;
size_t getNZ() const;
size_t operator[](int dim) const;
std::size_t getGlobalIndex(std::size_t i, std::size_t j, std::size_t k) const;
const std::array<int, 3> getNXYZ() const;
std::array<int, 3> getIJK(std::size_t globalIndex) const;
size_t getGlobalIndex(size_t i, size_t j, size_t k) const;
std::size_t getCartesianSize() const;
const std::array<int, 3> getIJK(size_t globalIndex) const;
void assertGlobalIndex(std::size_t globalIndex) const;
size_t getCartesianSize() const;
void assertIJK(std::size_t i, std::size_t j, std::size_t k) const;
void assertGlobalIndex(size_t globalIndex) const;
void assertIJK(size_t i, size_t j, size_t k) const;
bool operator==(const GridDims& data) const;
@@ -66,9 +69,9 @@ namespace Opm {
}
protected:
std::size_t m_nx;
std::size_t m_ny;
std::size_t m_nz;
size_t m_nx;
size_t m_ny;
size_t m_nz;
private:
void init(const DeckKeyword& keyword);

View File

@@ -23,12 +23,13 @@
#include <opm/input/eclipse/EclipseState/Grid/FaceDir.hpp>
namespace Opm {
class FieldPropsManager;
class DeckRecord;
class DeckKeyword;
class FieldPropsManager;
class GridDims;
namespace MULTREGT {
@@ -92,7 +93,7 @@ namespace Opm {
const FieldPropsManager* fp_arg,
const std::vector< const DeckKeyword* >& keywords);
static MULTREGTScanner serializationTestObject();
static MULTREGTScanner serializeObject();
double getRegionMultiplier(size_t globalCellIdx1, size_t globalCellIdx2, FaceDir::DirEnum faceDir) const;
@@ -105,7 +106,7 @@ namespace Opm {
serializer(nx);
serializer(ny);
serializer(nz);
serializer(m_records);
serializer.vector(m_records);
ExternalSearchMap searchMap = getSearchMap();
serializer(searchMap);
if (m_searchMap.empty())

View File

@@ -106,7 +106,7 @@ public:
/// Construct from input deck.
NNC(const EclipseGrid& grid, const Deck& deck);
static NNC serializationTestObject();
static NNC serializeObject();
bool addNNC(const size_t cell1, const size_t cell2, const double trans);
const std::vector<NNCdata>& input() const { return m_input; }
@@ -120,8 +120,8 @@ public:
template<class Serializer>
void serializeOp(Serializer& serializer)
{
serializer(m_input);
serializer(m_edit);
serializer.vector(m_input);
serializer.vector(m_edit);
serializer(m_nnc_location);
serializer(m_edit_location);
}

View File

@@ -20,7 +20,6 @@
#define TRAN_CALCULATOR_HPP
#include <string>
#include <unordered_map>
#include <vector>
namespace Opm
@@ -51,13 +50,6 @@ public:
return this->op == other.op &&
this->field == other.field;
}
template<class Serializer>
void serializeOp(Serializer& serializer)
{
serializer(op);
serializer(field);
}
};
@@ -65,8 +57,6 @@ public:
m_name(name_arg)
{}
TranCalculator() = default;
std::string next_name() const {
return this->m_name + std::to_string( this->actions.size() );
}
@@ -98,27 +88,11 @@ public:
this->actions == other.actions;
}
template<class Serializer>
void serializeOp(Serializer& serializer)
{
serializer(m_name);
serializer(actions);
}
static TranCalculator serializationTestObject()
{
TranCalculator tran("test");
tran.add_action(ScalarOperation::MIN, "FGOP");
return tran;
}
private:
std::string m_name;
std::vector<TranAction> actions;
};
using TranMap = std::unordered_map<std::string, TranCalculator>;
} // namespace Fieldprops
} // end namespace Opm
#endif // TRAN_CALCULATOR_HPP

View File

@@ -50,7 +50,7 @@ namespace Opm {
TransMult() = default;
TransMult(const GridDims& dims, const Deck& deck, const FieldPropsManager& fp);
static TransMult serializationTestObject();
static TransMult serializeObject();
double getMultiplier(size_t globalIndex, FaceDir::DirEnum faceDir) const;
double getMultiplier(size_t i , size_t j , size_t k, FaceDir::DirEnum faceDir) const;
@@ -67,9 +67,10 @@ namespace Opm {
serializer(m_nx);
serializer(m_ny);
serializer(m_nz);
serializer(m_trans);
serializer(m_names);
serializer(m_multregtScanner);
// map used to avoid explicit instances with FaceDir::DirEnum in serializer
serializer.template map<decltype(m_trans),false>(m_trans);
serializer.template map<decltype(m_names),false>(m_names);
m_multregtScanner.serializeOp(serializer);
}
private:

View File

@@ -152,7 +152,7 @@ namespace Opm {
explicit IOConfig( const Deck& );
explicit IOConfig( const std::string& input_path );
static IOConfig serializationTestObject();
static IOConfig serializeObject();
void setEclCompatibleRST(bool ecl_rst);
bool getEclCompatibleRST() const;

View File

@@ -18,11 +18,10 @@ namespace Opm {
bool liveOilInitConstantRs() const;
bool wetGasInitConstantRv() const;
int initializationTargetAccuracy() const;
bool humidGasInitConstantRvw() const;
EquilRecord();
EquilRecord( double datum_depth_arg, double datum_depth_pc_arg, double woc_depth, double woc_pc, double goc_depth, double goc_pc, bool live_oil_init, bool wet_gas_init, int target_accuracy, bool humid_gas_init);
EquilRecord( double datum_depth_arg, double datum_depth_pc_arg, double woc_depth, double woc_pc, double goc_depth, double goc_pc, bool live_oil_init, bool wet_gas_init, int target_accuracy);
bool operator==(const EquilRecord& data) const;
@@ -38,7 +37,6 @@ namespace Opm {
serializer(live_oil_init_proc);
serializer(wet_gas_init_proc);
serializer(init_target_accuracy);
serializer(humid_gas_init_proc);
}
private:
@@ -52,7 +50,6 @@ namespace Opm {
bool live_oil_init_proc;
bool wet_gas_init_proc;
int init_target_accuracy;
bool humid_gas_init_proc;
};
class Equil {
@@ -62,7 +59,7 @@ namespace Opm {
Equil() = default;
explicit Equil( const DeckKeyword& );
static Equil serializationTestObject();
static Equil serializeObject();
const EquilRecord& getRecord( size_t id ) const;
@@ -77,7 +74,7 @@ namespace Opm {
template<class Serializer>
void serializeOp(Serializer& serializer)
{
serializer(m_records);
serializer.vector(m_records);
}
private:

View File

@@ -39,7 +39,7 @@ public:
FoamData(const DeckRecord& FOAMFSC_record, const DeckRecord& FOAMROCK_record);
explicit FoamData(const DeckRecord& FOAMROCK_record);
static FoamData serializationTestObject();
static FoamData serializeObject();
double referenceSurfactantConcentration() const;
double exponent() const;
@@ -80,7 +80,7 @@ public:
FoamConfig() = default;
explicit FoamConfig(const Deck&);
static FoamConfig serializationTestObject();
static FoamConfig serializeObject();
const FoamData& getRecord(std::size_t index) const;
@@ -99,7 +99,7 @@ public:
template<class Serializer>
void serializeOp(Serializer& serializer)
{
serializer(data_);
serializer.vector(data_);
serializer(transport_phase_);
serializer(mobility_model_);
}

View File

@@ -35,7 +35,7 @@ namespace Opm {
InitConfig();
explicit InitConfig(const Deck& deck);
static InitConfig serializationTestObject();
static InitConfig serializeObject();
void setRestart( const std::string& root, int step);
bool restartRequested() const;
@@ -63,8 +63,8 @@ namespace Opm {
template<class Serializer>
void serializeOp(Serializer& serializer)
{
serializer(equil);
serializer(foamconfig);
equil.serializeOp(serializer);
foamconfig.serializeOp(serializer);
serializer(m_filleps);
serializer(m_gravity);
serializer(m_restartRequested);

View File

@@ -31,7 +31,7 @@ class Deck;
explicit MICPpara(const Deck& deck);
static MICPpara serializationTestObject()
static MICPpara serializeObject()
{
MICPpara mp;
mp.m_density_biofilm = 100;

View File

@@ -60,7 +60,7 @@ class Phases {
Phases( bool oil, bool gas, bool wat, bool solvent = false, bool polymer = false, bool energy = false,
bool polymw = false, bool foam = false, bool brine = false, bool zfraction = false ) noexcept;
static Phases serializationTestObject();
static Phases serializeObject();
bool active( Phase ) const noexcept;
size_t size() const noexcept;
@@ -70,7 +70,13 @@ class Phases {
template<class Serializer>
void serializeOp(Serializer& serializer)
{
serializer(bits);
if (serializer.isSerializing())
serializer(bits.to_ulong());
else {
unsigned long Bits = 0;
serializer(Bits);
bits = std::bitset<NUM_PHASES_IN_ENUM>(Bits);
}
}
private:
@@ -83,7 +89,7 @@ public:
Welldims() = default;
explicit Welldims(const Deck& deck);
static Welldims serializationTestObject();
static Welldims serializeObject();
int maxConnPerWell() const
{
@@ -161,7 +167,7 @@ public:
WellSegmentDims();
explicit WellSegmentDims(const Deck& deck);
static WellSegmentDims serializationTestObject();
static WellSegmentDims serializeObject();
int maxSegmentedWells() const
@@ -200,7 +206,7 @@ public:
NetworkDims();
explicit NetworkDims(const Deck& deck);
static NetworkDims serializationTestObject();
static NetworkDims serializeObject();
int maxNONodes() const
{
@@ -240,7 +246,7 @@ public:
AquiferDimensions();
explicit AquiferDimensions(const Deck& deck);
static AquiferDimensions serializationTestObject();
static AquiferDimensions serializeObject();
int maxAnalyticAquifers() const
{
@@ -272,7 +278,7 @@ public:
EclHysterConfig() = default;
explicit EclHysterConfig(const Deck& deck);
static EclHysterConfig serializationTestObject();
static EclHysterConfig serializeObject();
/*!
* \brief Specify whether hysteresis is enabled or not.
@@ -300,20 +306,6 @@ public:
*/
int krHysteresisModel() const;
/*!
* \brief Regularisation parameter used for Killough model.
*
* default: 0.1
*/
double modParamTrapped() const;
/*!
* \brief Curvature parameter used for capillary pressure hysteresis.
*
* default: 0.1
*/
double curvatureCapPrs() const;
bool operator==(const EclHysterConfig& data) const;
template<class Serializer>
@@ -322,8 +314,6 @@ public:
serializer(activeHyst);
serializer(pcHystMod);
serializer(krHystMod);
serializer(modParamTrappedValue);
serializer(curvatureCapPrsValue);
}
private:
@@ -331,12 +321,8 @@ private:
bool activeHyst { false };
// the capillary pressure and the relperm hysteresis models to be used
int pcHystMod { -1 };
int krHystMod { -1 };
// regularisation parameter used for Killough model
double modParamTrappedValue { 0.1 };
// curvature parameter for capillary pressure
double curvatureCapPrsValue { 0.1 };
int pcHystMod { 0 };
int krHystMod { 0 };
};
class SatFuncControls {
@@ -359,7 +345,7 @@ public:
const ThreePhaseOilKrModel model,
const KeywordFamily family);
static SatFuncControls serializationTestObject();
static SatFuncControls serializeObject();
double minimumRelpermMobilityThreshold() const
{
@@ -400,7 +386,7 @@ public:
void update(int value);
int value() const;
static Nupcol serializationTestObject();
static Nupcol serializeObject();
bool operator==(const Nupcol& data) const;
template<class Serializer>
@@ -434,7 +420,7 @@ public:
serializer(this->min_iter);
}
static Tracers serializationTestObject();
static Tracers serializeObject();
bool operator==(const Tracers& data) const;
private:
@@ -455,7 +441,7 @@ public:
Runspec() = default;
explicit Runspec( const Deck& );
static Runspec serializationTestObject();
static Runspec serializeObject();
std::time_t start_time() const noexcept;
const UDQParams& udqParams() const noexcept;
@@ -483,19 +469,19 @@ public:
void serializeOp(Serializer& serializer)
{
serializer(this->m_start_time);
serializer(active_phases);
serializer(m_tabdims);
serializer(m_regdims);
serializer(endscale);
serializer(welldims);
serializer(wsegdims);
serializer(netwrkdims);
serializer(aquiferdims);
serializer(udq_params);
serializer(hystpar);
serializer(m_actdims);
serializer(m_sfuncctrl);
serializer(m_nupcol);
active_phases.serializeOp(serializer);
m_tabdims.serializeOp(serializer);
m_regdims.serializeOp(serializer);
endscale.serializeOp(serializer);
welldims.serializeOp(serializer);
wsegdims.serializeOp(serializer);
netwrkdims.serializeOp(serializer);
aquiferdims.serializeOp(serializer);
udq_params.serializeOp(serializer);
hystpar.serializeOp(serializer);
m_actdims.serializeOp(serializer);
m_sfuncctrl.serializeOp(serializer);
m_nupcol.serializeOp(serializer);
serializer(m_co2storage);
serializer(m_micp);
}

View File

@@ -24,7 +24,6 @@
#include <cstddef>
#include <opm/input/eclipse/EclipseState/Grid/FaceDir.hpp>
#include <opm/input/eclipse/EclipseState/Grid/GridDims.hpp>
namespace Opm {
@@ -60,9 +59,9 @@ public:
double rate;
BCFace() = default;
explicit BCFace(const DeckRecord& record, const GridDims& grid);
explicit BCFace(const DeckRecord& record);
static BCFace serializationTestObject();
static BCFace serializeObject();
bool operator==(const BCFace& other) const;
@@ -86,7 +85,7 @@ public:
BCConfig() = default;
explicit BCConfig(const Deck& deck);
static BCConfig serializationTestObject();
static BCConfig serializeObject();
std::size_t size() const;
std::vector<BCFace>::const_iterator begin() const;
@@ -96,7 +95,7 @@ public:
template<class Serializer>
void serializeOp(Serializer& serializer)
{
serializer(m_faces);
serializer.vector(m_faces);
}
private:

View File

@@ -61,7 +61,7 @@ struct RockComp {
RockConfig();
RockConfig(const Deck& deck, const FieldPropsManager& fp);
static RockConfig serializationTestObject();
static RockConfig serializeObject();
bool active() const;
const std::vector<RockConfig::RockComp>& comp() const;
@@ -76,7 +76,7 @@ struct RockComp {
void serializeOp(Serializer& serializer)
{
serializer(m_active);
serializer(m_comp);
serializer.vector(m_comp);
serializer(num_property);
serializer(num_tables);
serializer(m_water_compaction);

View File

@@ -38,7 +38,7 @@ namespace Opm {
const Deck& deck,
const FieldPropsManager& fp);
static SimulationConfig serializationTestObject();
static SimulationConfig serializeObject();
const RockConfig& rock_config() const;
const ThresholdPressure& getThresholdPressure() const;
@@ -58,9 +58,9 @@ namespace Opm {
template<class Serializer>
void serializeOp(Serializer& serializer)
{
serializer(m_ThresholdPressure);
serializer(m_bcconfig);
serializer(m_rock_config);
m_ThresholdPressure.serializeOp(serializer);
m_bcconfig.serializeOp(serializer);
m_rock_config.serializeOp(serializer);
serializer(m_useCPR);
serializer(m_DISGAS);
serializer(m_VAPOIL);

View File

@@ -46,7 +46,7 @@ namespace Opm {
{}
//! \brief Returns an instance for serialization tests.
static ThresholdPressure serializationTestObject();
static ThresholdPressure serializeObject();
/*
The hasRegionBarrier() method checks if a threshold pressure

View File

@@ -48,7 +48,7 @@ namespace Opm {
SummaryConfigNode() = default;
explicit SummaryConfigNode(std::string keyword, const Category cat, KeywordLocation loc_arg);
static SummaryConfigNode serializationTestObject();
static SummaryConfigNode serializeObject();
SummaryConfigNode& parameterType(const Type type);
SummaryConfigNode& namedEntity(std::string name);
@@ -76,7 +76,7 @@ namespace Opm {
{
serializer(keyword_);
serializer(category_);
serializer(loc);
loc.serializeOp(serializer);
serializer(type_);
serializer(name_);
serializer(number_);
@@ -160,7 +160,7 @@ namespace Opm {
const std::set<std::string>& shortKwds,
const std::set<std::string>& smryKwds);
static SummaryConfig serializationTestObject();
static SummaryConfig serializeObject();
const_iterator begin() const;
const_iterator end() const;
@@ -206,7 +206,7 @@ namespace Opm {
template<class Serializer>
void serializeOp(Serializer& serializer)
{
serializer(m_keywords);
serializer.vector(m_keywords);
serializer(short_keywords);
serializer(summary_keywords);
}

View File

@@ -38,7 +38,7 @@ namespace Opm {
explicit Aqudims(const Deck& deck);
static Aqudims serializationTestObject()
static Aqudims serializeObject()
{
Aqudims result;
result.m_mxnaqn = 1;

View File

@@ -27,7 +27,7 @@ namespace Opm {
class AqutabTable : public SimpleTable {
public:
AqutabTable( const DeckItem& item, const int tableID );
AqutabTable( const DeckItem& item );
const TableColumn& getTimeColumn() const;
const TableColumn& getPressureColumn() const;

View File

@@ -26,7 +26,7 @@ namespace Opm {
class BrineDensityTable {
public:
static BrineDensityTable serializationTestObject();
static BrineDensityTable serializeObject();
void init(const Opm::DeckRecord& record);
const std::vector<double>& getBrineDensityColumn() const;

View File

@@ -34,7 +34,7 @@ namespace Opm {
ColumnSchema(const std::string& name , Table::ColumnOrderEnum order, Table::DefaultAction defaultAction);
ColumnSchema(const std::string& name , Table::ColumnOrderEnum order, double defaultValue);
static ColumnSchema serializationTestObject();
static ColumnSchema serializeObject();
const std::string& name() const;
bool validOrder( double value1 , double value2) const;

View File

@@ -52,7 +52,7 @@ namespace Opm {
DenT() = default;
explicit DenT(const DeckKeyword& keyword);
static DenT serializationTestObject();
static DenT serializeObject();
const entry& operator[](const std::size_t index) const;
bool operator==(const DenT& other) const;
@@ -61,7 +61,7 @@ namespace Opm {
template<class Serializer>
void serializeOp(Serializer& serializer)
{
serializer(m_records);
serializer.vector(m_records);
}
private:

View File

@@ -28,7 +28,7 @@ namespace Opm {
class EnkrvdTable : public SimpleTable {
public:
EnkrvdTable( const DeckItem& item, const int tableID );
EnkrvdTable( const DeckItem& item );
// using this method is strongly discouraged but the current endpoint scaling

View File

@@ -27,7 +27,7 @@ namespace Opm {
class EnptvdTable : public SimpleTable {
public:
EnptvdTable( const DeckItem& item, const int tableID );
EnptvdTable( const DeckItem& item );
// using this method is strongly discouraged but the current endpoint scaling
// code makes it hard to avoid

View File

@@ -42,7 +42,7 @@ namespace Opm {
m_nstrvd( nstrvd )
{ }
static Eqldims serializationTestObject()
static Eqldims serializeObject()
{
return Eqldims(1, 2, 3, 4, 5);
}

View File

@@ -1,11 +1,6 @@
#ifndef OPM_FLAT_TABLE_HPP
#define OPM_FLAT_TABLE_HPP
#include <cstddef>
#include <initializer_list>
#include <string_view>
#include <vector>
namespace Opm {
class DeckKeyword;
@@ -21,86 +16,7 @@ struct FlatTable : public std::vector< T > {
template<class Serializer>
void serializeOp(Serializer& serializer)
{
serializer(static_cast<std::vector<T>&>(*this));
}
};
template <typename RecordType>
class FlatTableWithCopy
{
public:
FlatTableWithCopy() = default;
explicit FlatTableWithCopy(const DeckKeyword& kw,
std::string_view expect = "");
explicit FlatTableWithCopy(std::initializer_list<RecordType> records);
auto size() const { return this->table_.size(); }
bool empty() const { return this->table_.empty(); }
auto begin() const { return this->table_.begin(); }
auto end() const { return this->table_.end(); }
const RecordType& operator[](const std::size_t tableID) const
{
return this->table_[tableID];
}
const RecordType& at(const std::size_t tableID) const
{
return this->table_.at(tableID);
}
bool operator==(const FlatTableWithCopy& other) const
{
return this->table_ == other.table_;
}
template <class Serializer>
void serializeOp(Serializer& serializer)
{
serializer(this->table_);
}
protected:
std::vector<RecordType> table_{};
};
struct GRAVITYRecord {
static constexpr std::size_t size = 3;
double oil_api;
double water_sg;
double gas_sg;
bool operator==(const GRAVITYRecord& data) const {
return this->oil_api == data.oil_api &&
this->water_sg == data.water_sg &&
this->gas_sg == data.gas_sg;
}
template<class Serializer>
void serializeOp(Serializer& serializer)
{
serializer(this->oil_api);
serializer(this->water_sg);
serializer(this->gas_sg);
}
};
struct GravityTable : public FlatTableWithCopy<GRAVITYRecord>
{
GravityTable() = default;
explicit GravityTable(const DeckKeyword& kw);
explicit GravityTable(std::initializer_list<GRAVITYRecord> records);
static GravityTable serializationTestObject()
{
return GravityTable({{1.0, 2.0, 3.0}});
}
template <class Serializer>
void serializeOp(Serializer& serializer)
{
FlatTableWithCopy::serializeOp(serializer);
serializer.vector(*this);
}
};
@@ -126,22 +42,43 @@ struct DENSITYRecord {
}
};
struct DensityTable : public FlatTableWithCopy<DENSITYRecord>
{
DensityTable() = default;
explicit DensityTable(const DeckKeyword& kw);
explicit DensityTable(const GravityTable& gravity);
explicit DensityTable(std::initializer_list<DENSITYRecord> records);
struct DensityTable : public FlatTable< DENSITYRecord > {
using FlatTable< DENSITYRecord >::FlatTable;
static DensityTable serializationTestObject()
static DensityTable serializeObject()
{
return DensityTable({{1.0, 2.0, 3.0}});
}
};
template <class Serializer>
struct GRAVITYRecord {
static constexpr std::size_t size = 3;
double oil_api;
double water_sg;
double gas_sg;
bool operator==(const GRAVITYRecord& data) const {
return this->oil_api == data.oil_api &&
this->water_sg == data.water_sg &&
this->gas_sg == data.gas_sg;
}
template<class Serializer>
void serializeOp(Serializer& serializer)
{
FlatTableWithCopy::serializeOp(serializer);
serializer(this->oil_api);
serializer(this->water_sg);
serializer(this->gas_sg);
}
};
struct GravityTable : public FlatTable< GRAVITYRecord > {
using FlatTable< GRAVITYRecord >::FlatTable;
static GravityTable serializeObject()
{
return GravityTable({{1.0, 2.0, 3.0}});
}
};
@@ -185,7 +122,7 @@ struct DiffCoeffRecord {
struct DiffCoeffTable : public FlatTable< DiffCoeffRecord > {
using FlatTable< DiffCoeffRecord >::FlatTable;
static DiffCoeffTable serializationTestObject()
static DiffCoeffTable serializeObject()
{
return DiffCoeffTable({{1.0, 2.0, 3.0, 4.0, 5.0, 6.0, 7.0, 8.0}});
}
@@ -219,22 +156,13 @@ struct PVTWRecord {
}
};
struct PvtwTable : public FlatTableWithCopy<PVTWRecord>
{
PvtwTable() = default;
explicit PvtwTable(const DeckKeyword& kw);
explicit PvtwTable(std::initializer_list<PVTWRecord> records);
struct PvtwTable : public FlatTable< PVTWRecord > {
using FlatTable< PVTWRecord >::FlatTable;
static PvtwTable serializationTestObject()
static PvtwTable serializeObject()
{
return PvtwTable({{1.0, 2.0, 3.0, 4.0, 5.0}});
}
template <class Serializer>
void serializeOp(Serializer& serializer)
{
FlatTableWithCopy::serializeOp(serializer);
}
};
struct ROCKRecord {
@@ -259,7 +187,7 @@ struct ROCKRecord {
struct RockTable : public FlatTable< ROCKRecord > {
using FlatTable< ROCKRecord >::FlatTable;
static RockTable serializationTestObject()
static RockTable serializeObject()
{
return RockTable({{1.0, 2.0}});
}
@@ -296,7 +224,7 @@ struct PVCDORecord {
struct PvcdoTable : public FlatTable< PVCDORecord > {
using FlatTable< PVCDORecord >::FlatTable;
static PvcdoTable serializationTestObject()
static PvcdoTable serializeObject()
{
return PvcdoTable({{1.0, 2.0, 3.0, 4.0, 5.0}});
}
@@ -321,7 +249,7 @@ struct PlmixparRecord {
struct PlmixparTable : public FlatTable< PlmixparRecord> {
using FlatTable< PlmixparRecord >::FlatTable;
static PlmixparTable serializationTestObject()
static PlmixparTable serializeObject()
{
return PlmixparTable({PlmixparRecord{1.0}});
}
@@ -355,7 +283,7 @@ struct PlyvmhRecord {
struct PlyvmhTable : public FlatTable<PlyvmhRecord> {
using FlatTable< PlyvmhRecord >::FlatTable;
static PlyvmhTable serializationTestObject()
static PlyvmhTable serializeObject()
{
return PlyvmhTable({{1.0, 2.0, 3.0, 4.0}});
}
@@ -380,7 +308,7 @@ struct ShrateRecord {
struct ShrateTable : public FlatTable<ShrateRecord> {
using FlatTable< ShrateRecord >::FlatTable;
static ShrateTable serializationTestObject()
static ShrateTable serializeObject()
{
return ShrateTable({ShrateRecord{1.0}});
}
@@ -405,7 +333,7 @@ struct Stone1exRecord {
struct Stone1exTable : public FlatTable<Stone1exRecord> {
using FlatTable< Stone1exRecord >::FlatTable;
static Stone1exTable serializationTestObject()
static Stone1exTable serializeObject()
{
return Stone1exTable({Stone1exRecord{1.0}});
}
@@ -433,7 +361,7 @@ struct TlmixparRecord {
struct TlmixparTable : public FlatTable< TlmixparRecord> {
using FlatTable< TlmixparRecord >::FlatTable;
static TlmixparTable serializationTestObject()
static TlmixparTable serializeObject()
{
return TlmixparTable({{1.0, 2.0}});
}
@@ -461,7 +389,7 @@ struct VISCREFRecord {
struct ViscrefTable : public FlatTable< VISCREFRecord > {
using FlatTable< VISCREFRecord >::FlatTable;
static ViscrefTable serializationTestObject()
static ViscrefTable serializeObject()
{
return ViscrefTable({{1.0, 2.0}});
}
@@ -492,95 +420,12 @@ struct WATDENTRecord {
struct WatdentTable : public FlatTable< WATDENTRecord > {
using FlatTable< WATDENTRecord >::FlatTable;
static WatdentTable serializationTestObject()
static WatdentTable serializeObject()
{
return WatdentTable({{1.0, 2.0, 3.0}});
}
};
struct SatFuncLETRecord {
static constexpr std::size_t size = 17;
double s1_residual;
double s1_critical;
double l1_relperm;
double e1_relperm;
double t1_relperm;
double krt1_relperm;
double s2_residual;
double s2_critical;
double l2_relperm;
double e2_relperm;
double t2_relperm;
double krt2_relperm;
double l_pc;
double e_pc;
double t_pc;
double pcir_pc;
double pct_pc;
bool operator==(const SatFuncLETRecord& data) const {
return s1_residual == data.s1_residual &&
s1_critical == data.s1_critical &&
l1_relperm == data.l1_relperm &&
e1_relperm == data.e1_relperm &&
t1_relperm == data.t1_relperm &&
krt1_relperm == data.krt1_relperm &&
s2_residual == data.s2_residual &&
s2_critical == data.s2_critical &&
l2_relperm == data.l2_relperm &&
e2_relperm == data.e2_relperm &&
t2_relperm == data.t2_relperm &&
krt2_relperm == data.krt2_relperm &&
l_pc == data.l_pc &&
e_pc == data.e_pc &&
t_pc == data.t_pc &&
pcir_pc == data.pcir_pc &&
pct_pc == data.pct_pc;
}
template<class Serializer>
void serializeOp(Serializer& serializer)
{
serializer(s1_residual);
serializer(s1_critical);
serializer(l1_relperm);
serializer(e1_relperm);
serializer(t1_relperm);
serializer(krt1_relperm);
serializer(s2_residual);
serializer(s2_critical);
serializer(l2_relperm);
serializer(e2_relperm);
serializer(t2_relperm);
serializer(krt2_relperm);
serializer(l_pc);
serializer(e_pc);
serializer(t_pc);
serializer(pcir_pc);
serializer(pct_pc);
}
};
struct SwofletTable : public FlatTable< SatFuncLETRecord > {
using FlatTable< SatFuncLETRecord >::FlatTable;
static SwofletTable serializationTestObject()
{
return SwofletTable({{1.0, 2.0, 3.0, 4.0, 5.0, 6.0, 7.0, 8.0, 9.0, 10.0, 11.0, 12.0, 13.0, 14.0, 15.0, 16.0, 17.0}});
}
};
struct SgofletTable : public FlatTable< SatFuncLETRecord > {
using FlatTable< SatFuncLETRecord >::FlatTable;
static SgofletTable serializationTestObject()
{
return SgofletTable({{1.0, 2.0, 3.0, 4.0, 5.0, 6.0, 7.0, 8.0, 9.0, 10.0, 11.0, 12.0, 13.0, 14.0, 15.0, 16.0, 17.0}});
}
};
}
#endif //OPM_FLAT_TABLE_HPP

View File

@@ -28,7 +28,7 @@ namespace Opm {
class FoamadsTable : public SimpleTable {
public:
FoamadsTable( const DeckItem& item, const int tableID );
FoamadsTable( const DeckItem& item );
const TableColumn& getFoamConcentrationColumn() const;
const TableColumn& getAdsorbedFoamColumn() const;

View File

@@ -29,7 +29,7 @@ namespace Opm {
class FoammobTable : public SimpleTable {
public:
FoammobTable( const DeckItem& item, const int tableID );
FoammobTable( const DeckItem& item );
const TableColumn& getFoamConcentrationColumn() const;
const TableColumn& getMobilityMultiplierColumn() const;

View File

@@ -27,7 +27,7 @@ namespace Opm {
class ImkrvdTable : public SimpleTable {
public:
ImkrvdTable( const DeckItem& item, const int tableID );
ImkrvdTable( const DeckItem& item );
/*!
* \brief The datum depth for the remaining columns

View File

@@ -29,7 +29,7 @@ namespace Opm {
class ImptvdTable : public SimpleTable {
public:
ImptvdTable( const DeckItem& item, const int tableID );
ImptvdTable( const DeckItem& item );
const TableColumn& getDepthColumn() const;

View File

@@ -34,7 +34,7 @@ public:
JFunc();
explicit JFunc(const Deck& deck);
static JFunc serializationTestObject();
static JFunc serializeObject();
double alphaFactor() const;
double betaFactor() const;

View File

@@ -1,70 +0,0 @@
/*
Copyright (C) 2020 by Equinor
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 OPM_PARSER_JOULETHOMSON_HPP
#define OPM_PARSER_JOULETHOMSON_HPP
#include <cstddef>
#include <vector>
namespace Opm {
class DeckKeyword;
class DeckRecord;
class JouleThomson {
public:
struct entry {
double P0;
double C1;
entry() = default;
entry(double P0_, double C1_);
explicit entry(const DeckRecord& record);
bool operator==(const entry& other) const;
template<class Serializer>
void serializeOp(Serializer& serializer)
{
serializer(P0);
serializer(C1);
}
};
JouleThomson() = default;
explicit JouleThomson(const DeckKeyword& keyword);
static JouleThomson serializationTestObject();
const entry& operator[](const std::size_t index) const;
bool operator==(const JouleThomson& other) const;
std::size_t size() const;
template<class Serializer>
void serializeOp(Serializer& serializer)
{
serializer(m_records);
}
private:
std::vector<entry> m_records;
};
}
#endif

View File

@@ -28,7 +28,7 @@ namespace Opm {
class MiscTable : public SimpleTable {
public:
MiscTable( const DeckItem& item, const int tableID );
explicit MiscTable( const DeckItem& item );
const TableColumn& getSolventFractionColumn() const;
const TableColumn& getMiscibilityColumn() const;

View File

@@ -28,7 +28,7 @@ namespace Opm {
class MsfnTable : public SimpleTable {
public:
MsfnTable( const DeckItem& item, const int tableID );
explicit MsfnTable( const DeckItem& item );
const TableColumn& getGasPhaseFractionColumn() const;
const TableColumn& getGasSolventRelpermMultiplierColumn() const;

View File

@@ -27,7 +27,7 @@ namespace Opm {
class OilvisctTable : public SimpleTable {
public:
OilvisctTable( const DeckItem& item, const int tableID );
OilvisctTable( const DeckItem& item );
const TableColumn& getTemperatureColumn() const;
const TableColumn& getOilViscosityColumn() const;

View File

@@ -27,7 +27,7 @@ namespace Opm {
class OverburdTable : public SimpleTable {
public:
OverburdTable( const DeckItem& item, const int tableID );
OverburdTable( const DeckItem& item );
const TableColumn& getDepthColumn() const;
const TableColumn& getOverburdenPressureColumn() const;

View File

@@ -27,7 +27,7 @@ namespace Opm {
class PbvdTable : public SimpleTable {
public:
PbvdTable( const DeckItem& item, const int tableID );
PbvdTable( const DeckItem& item );
const TableColumn& getDepthColumn() const;
const TableColumn& getPbubColumn() const;

View File

@@ -27,7 +27,7 @@ namespace Opm {
class PdvdTable : public SimpleTable {
public:
PdvdTable( const DeckItem& item, const int tableID );
PdvdTable( const DeckItem& item );
const TableColumn& getDepthColumn() const;
const TableColumn& getPdewColumn() const;

View File

@@ -28,7 +28,7 @@ namespace Opm {
class PermfactTable : public SimpleTable {
public:
PermfactTable( const DeckItem& item, const int tableID );
PermfactTable( const DeckItem& item );
const TableColumn& getPorosityChangeColumn() const;
const TableColumn& getPermeabilityMultiplierColumn() const;

Some files were not shown because too many files have changed in this diff Show More