Merge remote-tracking branch 'upstream/master'
Conflicts: opm/core/linalg/LinearSolverIstl.cpp
This commit is contained in:
79
.gitignore
vendored
79
.gitignore
vendored
@@ -1,68 +1,43 @@
|
||||
# editor backup files
|
||||
*~
|
||||
.\#*
|
||||
\#*\#
|
||||
.\#*\#
|
||||
|
||||
# compiler output
|
||||
*.o
|
||||
*.mod
|
||||
|
||||
# libtool compatible files
|
||||
*.lo
|
||||
*.la
|
||||
.libs
|
||||
.deps
|
||||
*.pc
|
||||
stamp-*
|
||||
.dirstamp
|
||||
.autotools
|
||||
|
||||
# Eclipse project settings
|
||||
.cproject
|
||||
.project
|
||||
.settings/*
|
||||
|
||||
Makefile
|
||||
Makefile.in
|
||||
aclocal.m4
|
||||
am
|
||||
autom4te.cache
|
||||
config.*
|
||||
configure
|
||||
compile
|
||||
depcomp
|
||||
dependencies.m4
|
||||
install-sh
|
||||
libtool
|
||||
ltmain.sh
|
||||
m4/libtool.m4
|
||||
m4/lt*.m4
|
||||
missing
|
||||
ar-lib
|
||||
tutorials/tutorial[1-4]
|
||||
opmcore-config.cmake
|
||||
# QtCreator project settings
|
||||
CMakeLists.txt.user*
|
||||
|
||||
# in-tree build with CMake
|
||||
CMakeCache.txt
|
||||
CMakeFiles/
|
||||
cmake_install.cmake
|
||||
config.h
|
||||
opm-core-config.cmake
|
||||
opm-core-config-version.cmake
|
||||
opm-core-install.cmake
|
||||
Makefile
|
||||
bin/
|
||||
lib/
|
||||
Doxyfile
|
||||
Documentation/html
|
||||
dune.module
|
||||
*.pc
|
||||
install_manifest.txt
|
||||
|
||||
# Ignoring executables
|
||||
*_test
|
||||
examples/compute_tof
|
||||
examples/scaneclipsedeck
|
||||
examples/spu_2p
|
||||
examples/reorder-qfs
|
||||
examples/refine_wells
|
||||
examples/sim_2p_incomp_reorder
|
||||
examples/sim_2p_comp_reorder
|
||||
examples/sim_wateroil
|
||||
examples/wells_example
|
||||
tests/test_agmg
|
||||
tests/test_cfs_tpfa
|
||||
tests/test_jacsys
|
||||
tests/test_read_grid
|
||||
tests/test_readvector
|
||||
tests/test_sf2p
|
||||
tests/bo_fluid_p_and_z_deps
|
||||
tests/bo_fluid_pressuredeps
|
||||
tests/test_cartgrid
|
||||
tests/test_column_extract
|
||||
tests/test_lapack
|
||||
tests/test_read_vag
|
||||
tests/test_readpolymer
|
||||
tests/test_velocityinterpolation
|
||||
tests/test_wells
|
||||
tests/test_writeVtkData
|
||||
# testing framework
|
||||
CTestTestfile.cmake
|
||||
DartConfiguration.tcl
|
||||
Testing/
|
||||
|
||||
337
CMakeLists.txt
337
CMakeLists.txt
@@ -1,67 +1,296 @@
|
||||
cmake_minimum_required (VERSION 2.6)
|
||||
project (opm-core)
|
||||
# -*- mode: cmake; tab-width: 2; indent-tabs-mode: t; truncate-lines: t; compile-command: "cmake -Wdev" -*-
|
||||
# vim: set filetype=cmake autoindent tabstop=2 shiftwidth=2 noexpandtab softtabstop=2 nowrap:
|
||||
|
||||
enable_language(Fortran)
|
||||
set(CMAKE_MODULE_PATH ${CMAKE_CURRENT_SOURCE_DIR})
|
||||
SET(CMAKE_BUILD_TYPE "debug")
|
||||
SET(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} -D_GLIBCXX_DEBUG -pg -Wall -fopenmp -ggdb")
|
||||
SET(CMAKE_C_FLAGS_DEBUG "${CMAKE_C_FLAGS_DEBUG} -pg -Wall -fopenmp -ggdb")
|
||||
# key information about the library
|
||||
set (project "opm-core")
|
||||
set (${project}_NAME "${project}")
|
||||
set (${project}_DESCRIPTION "Open Porous Media Initiative Core Library")
|
||||
set (${project}_DIR "opm")
|
||||
set (${project}_VERSION_MAJOR 1)
|
||||
set (${project}_VERSION_MINOR 0)
|
||||
set (doxy_dir "Documentation")
|
||||
|
||||
set(Boost_USE_STATIC_LIBS ON)
|
||||
set(Boost_USE_MULTITHREADED ON)
|
||||
set(Boost_USE_STATIC_RUNTIME OFF)
|
||||
find_package(Boost 1.36.0 COMPONENTS date_time filesystem system unit_test_framework)
|
||||
find_package(UmfPack)
|
||||
find_package(LAPACK)
|
||||
# defines that must be present in config.h for our headers
|
||||
set (${project}_CONFIG_VAR
|
||||
HAVE_AGMG
|
||||
HAVE_DUNE_ISTL
|
||||
HAVE_DYNAMIC_BOOST_TEST
|
||||
HAVE_ERT
|
||||
HAVE_SUITESPARSE_UMFPACK_H
|
||||
HAVE_NULLPTR
|
||||
HAVE_STATIC_ASSERT
|
||||
)
|
||||
|
||||
include_directories(${PROJECT_SOURCE_DIR} ${Boost_INCLUDE_DIRS})
|
||||
# dependencies
|
||||
set (${project}_DEPS
|
||||
# compile with C99 support if available
|
||||
"C99"
|
||||
# compile with C++0x/11 support if available
|
||||
"CXX11Features"
|
||||
# various runtime library enhancements
|
||||
"Boost 1.39.0
|
||||
COMPONENTS date_time filesystem system unit_test_framework signals REQUIRED"
|
||||
# matrix library
|
||||
"BLAS REQUIRED"
|
||||
"LAPACK REQUIRED"
|
||||
# Tim Davis' SuiteSparse archive
|
||||
"SuiteSparse COMPONENTS umfpack"
|
||||
# solver
|
||||
"SuperLU"
|
||||
# xml processing (for config parsing)
|
||||
"TinyXML"
|
||||
# Ensembles-based Reservoir Tools (ERT)
|
||||
"ERT"
|
||||
# DUNE dependency
|
||||
"dune-common"
|
||||
"dune-istl"
|
||||
)
|
||||
|
||||
# additional search modules
|
||||
set (${project}_MODULE_DIR "${CMAKE_CURRENT_SOURCE_DIR}/cmake/Modules")
|
||||
list (APPEND CMAKE_MODULE_PATH ${${project}_MODULE_DIR})
|
||||
|
||||
# The opmcore library
|
||||
FILE(GLOB_RECURSE C_FILES_CORE "opm/core/*.c")
|
||||
FILE(GLOB_RECURSE CPP_FILES_CORE "opm/core/*.cpp")
|
||||
FILE(GLOB_RECURSE REMOVE_FILES "processgrid.c")
|
||||
FILE(GLOB_RECURSE REMOVE_FILESMX "mx*.c")
|
||||
FILE(GLOB_RECURSE REMOVE_FILESAGMG "*AGMG.cpp" "*test*")
|
||||
list(REMOVE_ITEM C_FILES_CORE ${REMOVE_FILES} ${REMOVE_FILESMX} )
|
||||
list(REMOVE_ITEM CPP_FILES_CORE ${REMOVE_FILES} ${REMOVE_FILESAGMG})
|
||||
add_library(opmcore ${C_FILES_CORE} ${CPP_FILES_CORE} )
|
||||
# include special
|
||||
if (CMAKE_VERSION VERSION_LESS "2.8.5")
|
||||
message (STATUS "Enabling compatibility modules for CMake 2.8.5")
|
||||
list (APPEND CMAKE_MODULE_PATH "${${project}_MODULE_DIR}/compat-2.8.5")
|
||||
endif (CMAKE_VERSION VERSION_LESS "2.8.5")
|
||||
|
||||
if (CMAKE_VERSION VERSION_LESS "2.8.7")
|
||||
message (STATUS "Enabling compatibility modules for CMake 2.8.7")
|
||||
list (APPEND CMAKE_MODULE_PATH "${${project}_MODULE_DIR}/compat-2.8.7")
|
||||
endif (CMAKE_VERSION VERSION_LESS "2.8.7")
|
||||
|
||||
target_link_libraries(opmcore
|
||||
${UMFPACK_LIBRARIES} ${LAPACK_LINKER_FLAGS} ${LAPACK_LIBRARIES} ${Boost_LIBRARIES}
|
||||
-lcholmod -lcamd -lccolamd -lmetis -ldunecommon
|
||||
)
|
||||
# don't write default flags into the cache, preserve that for user set values
|
||||
include (AddOptions)
|
||||
no_default_options ()
|
||||
|
||||
FILE(GLOB CPP_EXAMPLES "examples/*.cpp")
|
||||
FILE(GLOB CPP_tests "tests/*.cpp")
|
||||
add_executable(spu_2p examples/spu_2p.cpp)
|
||||
add_executable(sim_2p_incomp_reorder examples/sim_2p_incomp_reorder.cpp)
|
||||
add_executable(sim_wateroil examples/sim_wateroil.cpp)
|
||||
# C++ project
|
||||
cmake_minimum_required (VERSION 2.8)
|
||||
project (${${project}_NAME})
|
||||
enable_language (C)
|
||||
enable_language (CXX)
|
||||
|
||||
add_executable(pvt_test tests/pvt_test.cpp)
|
||||
add_executable(relperm_test tests/relperm_test.cpp)
|
||||
# print system information to better pinpoint issues from log alone
|
||||
include (UseSystemInfo)
|
||||
system_info ()
|
||||
|
||||
target_link_libraries(spu_2p
|
||||
opmcore
|
||||
)
|
||||
target_link_libraries(sim_2p_incomp_reorder
|
||||
opmcore
|
||||
)
|
||||
# very early try to print repo id (to pinpoint version if something goes wrong)
|
||||
include (UseVCSInfo)
|
||||
vcs_info ()
|
||||
|
||||
target_link_libraries(sim_wateroil
|
||||
opmcore
|
||||
)
|
||||
# print toolchain information to identify compilers with potential bugs
|
||||
include (UseCompVer)
|
||||
compiler_info ()
|
||||
|
||||
target_link_libraries(pvt_test
|
||||
opmcore
|
||||
)
|
||||
target_link_libraries(relperm_test
|
||||
opmcore
|
||||
)
|
||||
# default settings: build static debug library
|
||||
include (OpmDefaults)
|
||||
opm_defaults (${project})
|
||||
message (STATUS "Build type: ${CMAKE_BUILD_TYPE}")
|
||||
|
||||
#set_target_properties(opmcore spu_2p PROPERTIES COMPILE_FLAGS -m64 LINKER_LANGUAGE CXX LINK_FLAGS -m64)
|
||||
#set_target_properties(opmcore sim_2p_incomp_reorder PROPERTIES COMPILE_FLAGS -m64 LINKER_LANGUAGE CXX LINK_FLAGS -m64)
|
||||
#set_target_properties(opmcore sim_wateroil PROPERTIES COMPILE_FLAGS -m64 LINKER_LANGUAGE CXX LINK_FLAGS -m64)
|
||||
#set_target_properties(opmcore pvt_test PROPERTIES COMPILE_FLAGS -m64 LINKER_LANGUAGE CXX LINK_FLAGS -m64)
|
||||
set_target_properties(opmcore relperm_test PROPERTIES COMPILE_FLAGS -m64 LINKER_LANGUAGE CXX LINK_FLAGS -m64)
|
||||
# use tricks to do faster builds
|
||||
include (UseFastBuilds)
|
||||
|
||||
# precompiled headers
|
||||
include (UsePrecompHeaders)
|
||||
|
||||
# optimize full if we're not doing a debug build
|
||||
include (UseOptimization)
|
||||
|
||||
# turn on all warnings; this must be done before adding any
|
||||
# dependencies, in case they alter the list of warnings
|
||||
include (UseWarnings)
|
||||
|
||||
# parallel computing must be explicitly enabled
|
||||
option (USE_MPI "Use Message Passing Interface for parallel computing" OFF)
|
||||
if (NOT USE_MPI)
|
||||
set (CMAKE_DISABLE_FIND_PACKAGE_MPI TRUE)
|
||||
endif (NOT USE_MPI)
|
||||
|
||||
### --- begin opm-core specific --- ###
|
||||
include (UseOpenMP)
|
||||
find_openmp (${project})
|
||||
### --- end opm-core specific --- ###
|
||||
|
||||
# macro to set standard variables (INCLUDE_DIRS, LIBRARIES etc.)
|
||||
include (OpmFind)
|
||||
find_and_append_package_list_to (${project} ${${project}_DEPS})
|
||||
|
||||
# remove the dependency on the testing framework from the main library;
|
||||
# it is not possible to query for Boost twice with different components.
|
||||
list (REMOVE_ITEM ${project}_LIBRARIES ${Boost_UNIT_TEST_FRAMEWORK_LIBRARY})
|
||||
|
||||
# don't import more libraries than we need to
|
||||
include (UseOnlyNeeded)
|
||||
|
||||
# put debug information into every executable
|
||||
include (UseDebugSymbols)
|
||||
|
||||
# detect if Boost is in a shared library
|
||||
include (UseDynamicBoost)
|
||||
|
||||
# needed for Debian installation scheme
|
||||
include (UseMultiArch)
|
||||
|
||||
# this module contains code to figure out which files is where
|
||||
include (OpmFiles)
|
||||
opm_auto_dirs ()
|
||||
|
||||
# put libraries in lib/
|
||||
opm_out_dirs ()
|
||||
|
||||
# identify the compilation units in the library; sources in opm/,
|
||||
# tests files in tests/, examples in tutorials/ and examples/
|
||||
opm_sources (${project})
|
||||
|
||||
### --- begin AGMG specific --- ###
|
||||
# Algebraic Multigrid must be compiled together with our program;
|
||||
# if it is not available, then remove our corresponding component
|
||||
find_package (AGMG)
|
||||
if (AGMG_FOUND)
|
||||
list (APPEND ${project}_SOURCES ${AGMG_SOURCES})
|
||||
endif (AGMG_FOUND)
|
||||
### --- end AGMG specific --- ###
|
||||
|
||||
### --- begin opm-core specific --- ###
|
||||
# these solvers are only compiled in if their dependency is found
|
||||
if (NOT AGMG_FOUND)
|
||||
list (REMOVE_ITEM opm-core_SOURCES
|
||||
${PROJECT_SOURCE_DIR}/${opm-core_DIR}/core/linalg/LinearSolverAGMG.cpp
|
||||
)
|
||||
endif (NOT AGMG_FOUND)
|
||||
if (NOT dune-istl_FOUND)
|
||||
list (REMOVE_ITEM opm-core_SOURCES
|
||||
${PROJECT_SOURCE_DIR}/${opm-core_DIR}/core/linalg/LinearSolverIstl.cpp
|
||||
)
|
||||
endif (NOT dune-istl_FOUND)
|
||||
if (NOT SuiteSparse_FOUND)
|
||||
list (REMOVE_ITEM opm-core_SOURCES
|
||||
${PROJECT_SOURCE_DIR}/${opm-core_DIR}/core/linalg/call_umfpack.c
|
||||
${PROJECT_SOURCE_DIR}/${opm-core_DIR}/core/linalg/LinearSolverUmfpack.cpp
|
||||
)
|
||||
list (REMOVE_ITEM examples_SOURCES
|
||||
${PROJECT_SOURCE_DIR}/tutorials/tutorial2.cpp
|
||||
${PROJECT_SOURCE_DIR}/tutorials/tutorial3.cpp
|
||||
${PROJECT_SOURCE_DIR}/tutorials/tutorial4.cpp
|
||||
)
|
||||
endif (NOT SuiteSparse_FOUND)
|
||||
|
||||
# we are not supposed to include the TinyXML test prog. regardless
|
||||
list (REMOVE_ITEM opm-core_SOURCES
|
||||
${PROJECT_SOURCE_DIR}/${opm-core_DIR}/core/utility/parameters/tinyxml/xmltest.cpp
|
||||
)
|
||||
|
||||
# remove inline TinyXML if a system version was found
|
||||
if (TinyXML_FOUND)
|
||||
file (GLOB_RECURSE _inline_tinyxml "${opm-core_DIR}/core/utility/parameters/tinyxml/*")
|
||||
foreach (_file IN LISTS _inline_tinyxml)
|
||||
list (REMOVE_ITEM opm-core_SOURCES ${_file})
|
||||
endforeach (_file)
|
||||
endif (TinyXML_FOUND)
|
||||
|
||||
# anyhow remove it from the header list (so it doesn't get installed)
|
||||
list (REMOVE_ITEM opm-core_HEADERS "${PROJECT_SOURCE_DIR}/${opm-core_DIR}/core/utility/parameters/tinyxml/tinystr.h")
|
||||
list (REMOVE_ITEM opm-core_HEADERS "${PROJECT_SOURCE_DIR}/${opm-core_DIR}/core/utility/parameters/tinyxml/tinyxml.h")
|
||||
|
||||
# HAVE_ERT is used as an #ifdef, not as an #if in the source code, if it
|
||||
# is not true, then it should be unset altogether
|
||||
if (NOT HAVE_ERT)
|
||||
set (HAVE_ERT)
|
||||
list (REMOVE_ITEM examples_SOURCES
|
||||
${PROJECT_SOURCE_DIR}/examples/import_rewrite.cpp
|
||||
)
|
||||
endif (NOT HAVE_ERT)
|
||||
### --- end opm-core specific --- ###
|
||||
|
||||
# create configuration header which describes available features
|
||||
# necessary to compile this library. singular version is the names that
|
||||
# is required by this project alone, plural version transitively
|
||||
# includes the necessary defines by the dependencies
|
||||
include (ConfigVars)
|
||||
list (APPEND ${project}_CONFIG_VARS ${${project}_CONFIG_VAR})
|
||||
|
||||
# write configuration variables to this file. note that it is a temporary.
|
||||
message (STATUS "Writing config file \"${PROJECT_BINARY_DIR}/config.h\"...")
|
||||
set (CONFIG_H "${PROJECT_BINARY_DIR}/config.h.tmp")
|
||||
configure_vars (
|
||||
FILE CXX ${CONFIG_H}
|
||||
WRITE ${${project}_CONFIG_VARS}
|
||||
)
|
||||
|
||||
include (UseFortranWrappers)
|
||||
define_fc_func (
|
||||
APPEND ${CONFIG_H}
|
||||
IF HAVE_AGMG # HAVE_BLAS HAVE_LAPACK
|
||||
)
|
||||
|
||||
# overwrite the config.h that is used by the code only if we have some
|
||||
# real changes. thus, we don't have to recompile if a reconfigure is run
|
||||
# due to some files being added, for instance
|
||||
execute_process (COMMAND
|
||||
${CMAKE_COMMAND} -E copy_if_different ${CONFIG_H} ${PROJECT_BINARY_DIR}/config.h
|
||||
)
|
||||
|
||||
# compile main library; pull in all required includes and libraries
|
||||
include (OpmCompile)
|
||||
opm_compile (${project})
|
||||
|
||||
# installation target: copy the library together with debug and
|
||||
# configuration files to system directories
|
||||
include (OpmInstall)
|
||||
opm_install (${project})
|
||||
message (STATUS "This build defaults to installing in ${CMAKE_INSTALL_PREFIX}")
|
||||
|
||||
# installation of CMake modules to help user programs locate the library
|
||||
include (OpmProject)
|
||||
opm_cmake_config (${project})
|
||||
|
||||
# routines to build satellites such as tests, tutorials and samples
|
||||
include (OpmSatellites)
|
||||
|
||||
# example programs are found in the tutorials/ and examples/ directory
|
||||
opm_compile_satellites (${project} examples "" "")
|
||||
|
||||
# infrastructure for testing
|
||||
enable_testing ()
|
||||
include (CTest)
|
||||
|
||||
### --- begin opm-core specific --- ###
|
||||
# conditionally disable tests when features aren't available
|
||||
macro (cond_disable_test name)
|
||||
if ((NOT DEFINED HAVE_${name}) OR (NOT HAVE_${name}))
|
||||
message (STATUS "${name} test disabled, since ${name} is not found.")
|
||||
string (TOLOWER "${name}" name_lower)
|
||||
get_filename_component (test_${name}_FILE "tests/test_${name_lower}.cpp" ABSOLUTE)
|
||||
list (REMOVE_ITEM tests_SOURCES "${test_${name}_FILE}")
|
||||
endif ((NOT DEFINED HAVE_${name}) OR (NOT HAVE_${name}))
|
||||
endmacro (cond_disable_test name)
|
||||
cond_disable_test ("AGMG")
|
||||
cond_disable_test ("ERT")
|
||||
### --- end opm-core specific --- ###
|
||||
|
||||
# make datafiles necessary for tests available in output directory
|
||||
opm_data (tests datafiles "${tests_DIR}")
|
||||
opm_compile_satellites (${project} tests "" "${tests_REGEXP}")
|
||||
|
||||
# use this target to run all tests
|
||||
add_custom_target (check
|
||||
COMMAND ${CMAKE_CTEST_COMMAND}
|
||||
DEPENDS tests
|
||||
COMMENT "Checking if library is functional"
|
||||
VERBATIM
|
||||
)
|
||||
|
||||
# generate documentation from source code with Doxygen;
|
||||
# setup install target for this documentation
|
||||
include (OpmDoc)
|
||||
opm_doc (${project} ${doxy_dir})
|
||||
|
||||
# provide compatibility with using this build in dunecontrol
|
||||
include (DuneCompat)
|
||||
include (LibtoolArchives)
|
||||
configure_la (${project} ${${project}_TARGET} ${project}_LIBTOOL_ARCHIVE)
|
||||
|
||||
### clean in-source builds ###
|
||||
include (OpmDistClean)
|
||||
opm_dist_clean (${project})
|
||||
|
||||
334
CMakeLists_files.cmake
Normal file
334
CMakeLists_files.cmake
Normal file
@@ -0,0 +1,334 @@
|
||||
# -*- mode: cmake; tab-width: 2; indent-tabs-mode: t; truncate-lines: t; compile-command: "cmake -Wdev" -*-
|
||||
# vim: set filetype=cmake autoindent tabstop=2 shiftwidth=2 noexpandtab softtabstop=2 nowrap:
|
||||
|
||||
# This file sets up five lists:
|
||||
# MAIN_SOURCE_FILES List of compilation units which will be included in
|
||||
# the library. If it isn't on this list, it won't be
|
||||
# part of the library. Please try to keep it sorted to
|
||||
# maintain sanity.
|
||||
#
|
||||
# TEST_SOURCE_FILES List of programs that will be run as unit tests.
|
||||
#
|
||||
# TEST_DATA_FILES Files from the source three that should be made
|
||||
# available in the corresponding location in the build
|
||||
# tree in order to run tests there.
|
||||
#
|
||||
# EXAMPLE_SOURCE_FILES Other programs that will be compiled as part of the
|
||||
# build, but which is not part of the library nor is
|
||||
# run as tests.
|
||||
#
|
||||
# PUBLIC_HEADER_FILES List of public header files that should be
|
||||
# distributed together with the library. The source
|
||||
# files can of course include other files than these;
|
||||
# you should only add to this list if the *user* of
|
||||
# the library needs it.
|
||||
|
||||
# originally generated with the command:
|
||||
# find opm -name '*.c*' -printf '\t%p\n' | sort
|
||||
list (APPEND MAIN_SOURCE_FILES
|
||||
opm/core/grid/GridManager.cpp
|
||||
opm/core/grid/grid.c
|
||||
opm/core/grid/cart_grid.c
|
||||
opm/core/grid/cornerpoint_grid.c
|
||||
opm/core/grid/cpgpreprocess/facetopology.c
|
||||
opm/core/grid/cpgpreprocess/geometry.c
|
||||
opm/core/grid/cpgpreprocess/preprocess.c
|
||||
opm/core/grid/cpgpreprocess/uniquepoints.c
|
||||
opm/core/io/eclipse/EclipseGridInspector.cpp
|
||||
opm/core/io/eclipse/EclipseGridParser.cpp
|
||||
opm/core/io/eclipse/writeECLData.cpp
|
||||
opm/core/io/vag/vag.cpp
|
||||
opm/core/io/vtk/writeVtkData.cpp
|
||||
opm/core/linalg/LinearSolverAGMG.cpp
|
||||
opm/core/linalg/LinearSolverFactory.cpp
|
||||
opm/core/linalg/LinearSolverInterface.cpp
|
||||
opm/core/linalg/LinearSolverIstl.cpp
|
||||
opm/core/linalg/LinearSolverUmfpack.cpp
|
||||
opm/core/linalg/call_umfpack.c
|
||||
opm/core/linalg/sparse_sys.c
|
||||
opm/core/pressure/CompressibleTpfa.cpp
|
||||
opm/core/pressure/FlowBCManager.cpp
|
||||
opm/core/pressure/IncompTpfa.cpp
|
||||
opm/core/pressure/cfsh.c
|
||||
opm/core/pressure/flow_bc.c
|
||||
opm/core/pressure/fsh.c
|
||||
opm/core/pressure/fsh_common_impl.c
|
||||
opm/core/pressure/ifsh.c
|
||||
opm/core/pressure/mimetic/hybsys.c
|
||||
opm/core/pressure/mimetic/hybsys_global.c
|
||||
opm/core/pressure/mimetic/mimetic.c
|
||||
opm/core/pressure/msmfem/coarse_conn.c
|
||||
opm/core/pressure/msmfem/coarse_sys.c
|
||||
opm/core/pressure/msmfem/dfs.c
|
||||
opm/core/pressure/msmfem/hash_set.c
|
||||
opm/core/pressure/msmfem/ifsh_ms.c
|
||||
opm/core/pressure/msmfem/partition.c
|
||||
opm/core/pressure/tpfa/cfs_tpfa.c
|
||||
opm/core/pressure/tpfa/cfs_tpfa_residual.c
|
||||
opm/core/pressure/tpfa/compr_bc.c
|
||||
opm/core/pressure/tpfa/compr_quant.c
|
||||
opm/core/pressure/tpfa/compr_quant_general.c
|
||||
opm/core/pressure/tpfa/compr_source.c
|
||||
opm/core/pressure/tpfa/ifs_tpfa.c
|
||||
opm/core/pressure/tpfa/trans_tpfa.c
|
||||
opm/core/pressure/legacy_well.c
|
||||
opm/core/props/BlackoilPropertiesBasic.cpp
|
||||
opm/core/props/BlackoilPropertiesFromDeck.cpp
|
||||
opm/core/props/IncompPropertiesBasic.cpp
|
||||
opm/core/props/IncompPropertiesFromDeck.cpp
|
||||
opm/core/props/pvt/BlackoilPvtProperties.cpp
|
||||
opm/core/props/pvt/PvtPropertiesBasic.cpp
|
||||
opm/core/props/pvt/PvtPropertiesIncompFromDeck.cpp
|
||||
opm/core/props/pvt/SinglePvtDead.cpp
|
||||
opm/core/props/pvt/SinglePvtDeadSpline.cpp
|
||||
opm/core/props/pvt/SinglePvtInterface.cpp
|
||||
opm/core/props/pvt/SinglePvtLiveGas.cpp
|
||||
opm/core/props/pvt/SinglePvtLiveOil.cpp
|
||||
opm/core/props/rock/RockBasic.cpp
|
||||
opm/core/props/rock/RockCompressibility.cpp
|
||||
opm/core/props/rock/RockFromDeck.cpp
|
||||
opm/core/props/satfunc/SatFuncGwseg.cpp
|
||||
opm/core/props/satfunc/SatFuncSimple.cpp
|
||||
opm/core/props/satfunc/SatFuncStone2.cpp
|
||||
opm/core/props/satfunc/SaturationPropsBasic.cpp
|
||||
opm/core/props/satfunc/SaturationPropsFromDeck.cpp
|
||||
opm/core/simulator/SimulatorCompressibleTwophase.cpp
|
||||
opm/core/simulator/SimulatorIncompTwophase.cpp
|
||||
opm/core/simulator/SimulatorReport.cpp
|
||||
opm/core/simulator/SimulatorTimer.cpp
|
||||
opm/core/tof/DGBasis.cpp
|
||||
opm/core/tof/TofReorder.cpp
|
||||
opm/core/tof/TofDiscGalReorder.cpp
|
||||
opm/core/transport/TransportSolverTwophaseInterface.cpp
|
||||
opm/core/transport/implicit/TransportSolverTwophaseImplicit.cpp
|
||||
opm/core/transport/implicit/transport_source.c
|
||||
opm/core/transport/minimal/spu_explicit.c
|
||||
opm/core/transport/minimal/spu_implicit.c
|
||||
opm/core/transport/reorder/TransportSolverCompressibleTwophaseReorder.cpp
|
||||
opm/core/transport/reorder/ReorderSolverInterface.cpp
|
||||
opm/core/transport/reorder/TransportSolverTwophaseReorder.cpp
|
||||
opm/core/transport/reorder/reordersequence.cpp
|
||||
opm/core/transport/reorder/tarjan.c
|
||||
opm/core/utility/MonotCubicInterpolator.cpp
|
||||
opm/core/utility/StopWatch.cpp
|
||||
opm/core/utility/VelocityInterpolation.cpp
|
||||
opm/core/utility/WachspressCoord.cpp
|
||||
opm/core/utility/miscUtilities.cpp
|
||||
opm/core/utility/miscUtilitiesBlackoil.cpp
|
||||
opm/core/utility/parameters/Parameter.cpp
|
||||
opm/core/utility/parameters/ParameterGroup.cpp
|
||||
opm/core/utility/parameters/ParameterTools.cpp
|
||||
opm/core/utility/parameters/ParameterXML.cpp
|
||||
opm/core/utility/parameters/tinyxml/tinystr.cpp
|
||||
opm/core/utility/parameters/tinyxml/tinyxml.cpp
|
||||
opm/core/utility/parameters/tinyxml/tinyxmlerror.cpp
|
||||
opm/core/utility/parameters/tinyxml/tinyxmlparser.cpp
|
||||
opm/core/utility/parameters/tinyxml/xmltest.cpp
|
||||
opm/core/wells/InjectionSpecification.cpp
|
||||
opm/core/wells/ProductionSpecification.cpp
|
||||
opm/core/wells/WellCollection.cpp
|
||||
opm/core/wells/WellsGroup.cpp
|
||||
opm/core/wells/WellsManager.cpp
|
||||
opm/core/wells/wells.c
|
||||
)
|
||||
|
||||
# originally generated with the command:
|
||||
# find tests -name '*.cpp' -a ! -wholename '*/not-unit/*' -printf '\t%p\n' | sort
|
||||
list (APPEND TEST_SOURCE_FILES
|
||||
tests/test_dgbasis.cpp
|
||||
tests/test_nonuniformtablelinear.cpp
|
||||
tests/test_sparsevector.cpp
|
||||
tests/test_sparsetable.cpp
|
||||
tests/test_velocityinterpolation.cpp
|
||||
tests/test_quadratures.cpp
|
||||
tests/test_uniformtablelinear.cpp
|
||||
tests/test_wells.cpp
|
||||
tests/test_wachspresscoord.cpp
|
||||
tests/test_column_extract.cpp
|
||||
tests/test_geom2d.cpp
|
||||
tests/test_param.cpp
|
||||
)
|
||||
|
||||
# originally generated with the command:
|
||||
# find tests -name '*.xml' -a ! -wholename '*/not-unit/*' -printf '\t%p\n' | sort
|
||||
list (APPEND TEST_DATA_FILES
|
||||
tests/extratestdata.xml
|
||||
tests/testdata.xml
|
||||
)
|
||||
|
||||
# originally generated with the command:
|
||||
# find tutorials examples -name '*.c*' -printf '\t%p\n' | sort
|
||||
list (APPEND EXAMPLE_SOURCE_FILES
|
||||
examples/compute_tof.cpp
|
||||
examples/compute_tof_from_files.cpp
|
||||
examples/import_rewrite.cpp
|
||||
examples/sim_2p_comp_reorder.cpp
|
||||
examples/sim_2p_incomp.cpp
|
||||
examples/wells_example.cpp
|
||||
tutorials/tutorial1.cpp
|
||||
tutorials/tutorial2.cpp
|
||||
tutorials/tutorial3.cpp
|
||||
tutorials/tutorial4.cpp
|
||||
)
|
||||
|
||||
# programs listed here will not only be compiled, but also marked for
|
||||
# installation
|
||||
list (APPEND PROGRAM_SOURCE_FILES
|
||||
examples/sim_2p_comp_reorder.cpp
|
||||
examples/sim_2p_incomp.cpp
|
||||
)
|
||||
|
||||
# originally generated with the command:
|
||||
# find opm -name '*.h*' -a ! -name '*-pch.hpp' -printf '\t%p\n' | sort
|
||||
list (APPEND PUBLIC_HEADER_FILES
|
||||
opm/core/doxygen_main.hpp
|
||||
opm/core/grid.h
|
||||
opm/core/grid/CellQuadrature.hpp
|
||||
opm/core/grid/ColumnExtract.hpp
|
||||
opm/core/grid/FaceQuadrature.hpp
|
||||
opm/core/grid/GridManager.hpp
|
||||
opm/core/grid/cart_grid.h
|
||||
opm/core/grid/cornerpoint_grid.h
|
||||
opm/core/grid/cpgpreprocess/facetopology.h
|
||||
opm/core/grid/cpgpreprocess/geometry.h
|
||||
opm/core/grid/cpgpreprocess/grdecl.h
|
||||
opm/core/grid/cpgpreprocess/preprocess.h
|
||||
opm/core/grid/cpgpreprocess/uniquepoints.h
|
||||
opm/core/io/eclipse/CornerpointChopper.hpp
|
||||
opm/core/io/eclipse/EclipseGridInspector.hpp
|
||||
opm/core/io/eclipse/EclipseGridParser.hpp
|
||||
opm/core/io/eclipse/EclipseGridParserHelpers.hpp
|
||||
opm/core/io/eclipse/EclipseUnits.hpp
|
||||
opm/core/io/eclipse/SpecialEclipseFields.hpp
|
||||
opm/core/io/eclipse/writeECLData.hpp
|
||||
opm/core/io/vag/vag.hpp
|
||||
opm/core/io/vtk/writeVtkData.hpp
|
||||
opm/core/linalg/LinearSolverAGMG.hpp
|
||||
opm/core/linalg/LinearSolverFactory.hpp
|
||||
opm/core/linalg/LinearSolverInterface.hpp
|
||||
opm/core/linalg/LinearSolverIstl.hpp
|
||||
opm/core/linalg/LinearSolverUmfpack.hpp
|
||||
opm/core/linalg/blas_lapack.h
|
||||
opm/core/linalg/call_umfpack.h
|
||||
opm/core/linalg/sparse_sys.h
|
||||
opm/core/wells.h
|
||||
opm/core/pressure/CompressibleTpfa.hpp
|
||||
opm/core/pressure/FlowBCManager.hpp
|
||||
opm/core/pressure/IncompTpfa.hpp
|
||||
opm/core/pressure/flow_bc.h
|
||||
opm/core/pressure/fsh.h
|
||||
opm/core/pressure/fsh_common_impl.h
|
||||
opm/core/pressure/legacy_well.h
|
||||
opm/core/pressure/mimetic/hybsys.h
|
||||
opm/core/pressure/mimetic/hybsys_global.h
|
||||
opm/core/pressure/mimetic/mimetic.h
|
||||
opm/core/pressure/msmfem/coarse_conn.h
|
||||
opm/core/pressure/msmfem/coarse_sys.h
|
||||
opm/core/pressure/msmfem/dfs.h
|
||||
opm/core/pressure/msmfem/hash_set.h
|
||||
opm/core/pressure/msmfem/ifsh_ms.h
|
||||
opm/core/pressure/msmfem/partition.h
|
||||
opm/core/pressure/tpfa/cfs_tpfa.h
|
||||
opm/core/pressure/tpfa/cfs_tpfa_residual.h
|
||||
opm/core/pressure/tpfa/compr_bc.h
|
||||
opm/core/pressure/tpfa/compr_quant.h
|
||||
opm/core/pressure/tpfa/compr_quant_general.h
|
||||
opm/core/pressure/tpfa/compr_source.h
|
||||
opm/core/pressure/tpfa/ifs_tpfa.h
|
||||
opm/core/pressure/tpfa/trans_tpfa.h
|
||||
opm/core/props/BlackoilPhases.hpp
|
||||
opm/core/props/BlackoilPropertiesBasic.hpp
|
||||
opm/core/props/BlackoilPropertiesFromDeck.hpp
|
||||
opm/core/props/BlackoilPropertiesInterface.hpp
|
||||
opm/core/props/IncompPropertiesBasic.hpp
|
||||
opm/core/props/IncompPropertiesFromDeck.hpp
|
||||
opm/core/props/IncompPropertiesInterface.hpp
|
||||
opm/core/props/phaseUsageFromDeck.hpp
|
||||
opm/core/props/pvt/BlackoilPvtProperties.hpp
|
||||
opm/core/props/pvt/PvtPropertiesBasic.hpp
|
||||
opm/core/props/pvt/PvtPropertiesIncompFromDeck.hpp
|
||||
opm/core/props/pvt/SinglePvtConstCompr.hpp
|
||||
opm/core/props/pvt/SinglePvtDead.hpp
|
||||
opm/core/props/pvt/SinglePvtDeadSpline.hpp
|
||||
opm/core/props/pvt/SinglePvtInterface.hpp
|
||||
opm/core/props/pvt/SinglePvtLiveGas.hpp
|
||||
opm/core/props/pvt/SinglePvtLiveOil.hpp
|
||||
opm/core/props/rock/RockBasic.hpp
|
||||
opm/core/props/rock/RockCompressibility.hpp
|
||||
opm/core/props/rock/RockFromDeck.hpp
|
||||
opm/core/props/satfunc/SatFuncGwseg.hpp
|
||||
opm/core/props/satfunc/SatFuncSimple.hpp
|
||||
opm/core/props/satfunc/SatFuncStone2.hpp
|
||||
opm/core/props/satfunc/SaturationPropsBasic.hpp
|
||||
opm/core/props/satfunc/SaturationPropsFromDeck.hpp
|
||||
opm/core/props/satfunc/SaturationPropsFromDeck_impl.hpp
|
||||
opm/core/props/satfunc/SaturationPropsInterface.hpp
|
||||
opm/core/simulator/BlackoilState.hpp
|
||||
opm/core/simulator/SimulatorCompressibleTwophase.hpp
|
||||
opm/core/simulator/SimulatorIncompTwophase.hpp
|
||||
opm/core/simulator/SimulatorIncompTwophase_impl.hpp
|
||||
opm/core/simulator/SimulatorReport.hpp
|
||||
opm/core/simulator/SimulatorTimer.hpp
|
||||
opm/core/simulator/TwophaseState.hpp
|
||||
opm/core/simulator/WellState.hpp
|
||||
opm/core/simulator/initState.hpp
|
||||
opm/core/simulator/initState_impl.hpp
|
||||
opm/core/tof/DGBasis.hpp
|
||||
opm/core/tof/TofReorder.hpp
|
||||
opm/core/tof/TofDiscGalReorder.hpp
|
||||
opm/core/transport/TransportSolverTwophaseInterface.hpp
|
||||
opm/core/transport/implicit/CSRMatrixBlockAssembler.hpp
|
||||
opm/core/transport/implicit/CSRMatrixUmfpackSolver.hpp
|
||||
opm/core/transport/implicit/GravityColumnSolver.hpp
|
||||
opm/core/transport/implicit/GravityColumnSolver_impl.hpp
|
||||
opm/core/transport/implicit/ImplicitAssembly.hpp
|
||||
opm/core/transport/implicit/ImplicitTransport.hpp
|
||||
opm/core/transport/implicit/JacobianSystem.hpp
|
||||
opm/core/transport/implicit/NormSupport.hpp
|
||||
opm/core/transport/implicit/SinglePointUpwindTwoPhase.hpp
|
||||
opm/core/transport/implicit/TransportSolverTwophaseImplicit.hpp
|
||||
opm/core/transport/implicit/SimpleFluid2pWrappingProps.hpp
|
||||
opm/core/transport/implicit/SimpleFluid2pWrappingProps_impl.hpp
|
||||
opm/core/transport/implicit/transport_source.h
|
||||
opm/core/transport/minimal/spu_explicit.h
|
||||
opm/core/transport/minimal/spu_implicit.h
|
||||
opm/core/transport/reorder/TransportSolverCompressibleTwophaseReorder.hpp
|
||||
opm/core/transport/reorder/ReorderSolverInterface.hpp
|
||||
opm/core/transport/reorder/TransportSolverTwophaseReorder.hpp
|
||||
opm/core/transport/reorder/reordersequence.h
|
||||
opm/core/transport/reorder/tarjan.h
|
||||
opm/core/utility/Average.hpp
|
||||
opm/core/utility/DataMap.hpp
|
||||
opm/core/utility/ErrorMacros.hpp
|
||||
opm/core/utility/Factory.hpp
|
||||
opm/core/utility/MonotCubicInterpolator.hpp
|
||||
opm/core/utility/NonuniformTableLinear.hpp
|
||||
opm/core/utility/RootFinders.hpp
|
||||
opm/core/utility/SparseTable.hpp
|
||||
opm/core/utility/SparseVector.hpp
|
||||
opm/core/utility/StopWatch.hpp
|
||||
opm/core/utility/UniformTableLinear.hpp
|
||||
opm/core/utility/Units.hpp
|
||||
opm/core/utility/VelocityInterpolation.hpp
|
||||
opm/core/utility/WachspressCoord.hpp
|
||||
opm/core/utility/buildUniformMonotoneTable.hpp
|
||||
opm/core/utility/have_boost_redef.hpp
|
||||
opm/core/utility/linearInterpolation.hpp
|
||||
opm/core/utility/miscUtilities.hpp
|
||||
opm/core/utility/miscUtilitiesBlackoil.hpp
|
||||
opm/core/utility/parameters/Parameter.hpp
|
||||
opm/core/utility/parameters/ParameterGroup.hpp
|
||||
opm/core/utility/parameters/ParameterGroup_impl.hpp
|
||||
opm/core/utility/parameters/ParameterMapItem.hpp
|
||||
opm/core/utility/parameters/ParameterRequirement.hpp
|
||||
opm/core/utility/parameters/ParameterStrings.hpp
|
||||
opm/core/utility/parameters/ParameterTools.hpp
|
||||
opm/core/utility/parameters/ParameterXML.hpp
|
||||
opm/core/utility/parameters/tinyxml/tinystr.h
|
||||
opm/core/utility/parameters/tinyxml/tinyxml.h
|
||||
opm/core/wells/InjectionSpecification.hpp
|
||||
opm/core/wells/ProductionSpecification.hpp
|
||||
opm/core/wells/WellCollection.hpp
|
||||
opm/core/wells/WellsGroup.hpp
|
||||
opm/core/wells/WellsManager.hpp
|
||||
)
|
||||
674
COPYING
Normal file
674
COPYING
Normal file
@@ -0,0 +1,674 @@
|
||||
GNU GENERAL PUBLIC LICENSE
|
||||
Version 3, 29 June 2007
|
||||
|
||||
Copyright (C) 2007 Free Software Foundation, Inc. <http://fsf.org/>
|
||||
Everyone is permitted to copy and distribute verbatim copies
|
||||
of this license document, but changing it is not allowed.
|
||||
|
||||
Preamble
|
||||
|
||||
The GNU General Public License is a free, copyleft license for
|
||||
software and other kinds of works.
|
||||
|
||||
The licenses for most software and other practical works are designed
|
||||
to take away your freedom to share and change the works. By contrast,
|
||||
the GNU General Public License is intended to guarantee your freedom to
|
||||
share and change all versions of a program--to make sure it remains free
|
||||
software for all its users. We, the Free Software Foundation, use the
|
||||
GNU General Public License for most of our software; it applies also to
|
||||
any other work released this way by its authors. You can apply it to
|
||||
your programs, too.
|
||||
|
||||
When we speak of free software, we are referring to freedom, not
|
||||
price. Our General Public Licenses are designed to make sure that you
|
||||
have the freedom to distribute copies of free software (and charge for
|
||||
them if you wish), that you receive source code or can get it if you
|
||||
want it, that you can change the software or use pieces of it in new
|
||||
free programs, and that you know you can do these things.
|
||||
|
||||
To protect your rights, we need to prevent others from denying you
|
||||
these rights or asking you to surrender the rights. Therefore, you have
|
||||
certain responsibilities if you distribute copies of the software, or if
|
||||
you modify it: responsibilities to respect the freedom of others.
|
||||
|
||||
For example, if you distribute copies of such a program, whether
|
||||
gratis or for a fee, you must pass on to the recipients the same
|
||||
freedoms that you received. You must make sure that they, too, receive
|
||||
or can get the source code. And you must show them these terms so they
|
||||
know their rights.
|
||||
|
||||
Developers that use the GNU GPL protect your rights with two steps:
|
||||
(1) assert copyright on the software, and (2) offer you this License
|
||||
giving you legal permission to copy, distribute and/or modify it.
|
||||
|
||||
For the developers' and authors' protection, the GPL clearly explains
|
||||
that there is no warranty for this free software. For both users' and
|
||||
authors' sake, the GPL requires that modified versions be marked as
|
||||
changed, so that their problems will not be attributed erroneously to
|
||||
authors of previous versions.
|
||||
|
||||
Some devices are designed to deny users access to install or run
|
||||
modified versions of the software inside them, although the manufacturer
|
||||
can do so. This is fundamentally incompatible with the aim of
|
||||
protecting users' freedom to change the software. The systematic
|
||||
pattern of such abuse occurs in the area of products for individuals to
|
||||
use, which is precisely where it is most unacceptable. Therefore, we
|
||||
have designed this version of the GPL to prohibit the practice for those
|
||||
products. If such problems arise substantially in other domains, we
|
||||
stand ready to extend this provision to those domains in future versions
|
||||
of the GPL, as needed to protect the freedom of users.
|
||||
|
||||
Finally, every program is threatened constantly by software patents.
|
||||
States should not allow patents to restrict development and use of
|
||||
software on general-purpose computers, but in those that do, we wish to
|
||||
avoid the special danger that patents applied to a free program could
|
||||
make it effectively proprietary. To prevent this, the GPL assures that
|
||||
patents cannot be used to render the program non-free.
|
||||
|
||||
The precise terms and conditions for copying, distribution and
|
||||
modification follow.
|
||||
|
||||
TERMS AND CONDITIONS
|
||||
|
||||
0. Definitions.
|
||||
|
||||
"This License" refers to version 3 of the GNU General Public License.
|
||||
|
||||
"Copyright" also means copyright-like laws that apply to other kinds of
|
||||
works, such as semiconductor masks.
|
||||
|
||||
"The Program" refers to any copyrightable work licensed under this
|
||||
License. Each licensee is addressed as "you". "Licensees" and
|
||||
"recipients" may be individuals or organizations.
|
||||
|
||||
To "modify" a work means to copy from or adapt all or part of the work
|
||||
in a fashion requiring copyright permission, other than the making of an
|
||||
exact copy. The resulting work is called a "modified version" of the
|
||||
earlier work or a work "based on" the earlier work.
|
||||
|
||||
A "covered work" means either the unmodified Program or a work based
|
||||
on the Program.
|
||||
|
||||
To "propagate" a work means to do anything with it that, without
|
||||
permission, would make you directly or secondarily liable for
|
||||
infringement under applicable copyright law, except executing it on a
|
||||
computer or modifying a private copy. Propagation includes copying,
|
||||
distribution (with or without modification), making available to the
|
||||
public, and in some countries other activities as well.
|
||||
|
||||
To "convey" a work means any kind of propagation that enables other
|
||||
parties to make or receive copies. Mere interaction with a user through
|
||||
a computer network, with no transfer of a copy, is not conveying.
|
||||
|
||||
An interactive user interface displays "Appropriate Legal Notices"
|
||||
to the extent that it includes a convenient and prominently visible
|
||||
feature that (1) displays an appropriate copyright notice, and (2)
|
||||
tells the user that there is no warranty for the work (except to the
|
||||
extent that warranties are provided), that licensees may convey the
|
||||
work under this License, and how to view a copy of this License. If
|
||||
the interface presents a list of user commands or options, such as a
|
||||
menu, a prominent item in the list meets this criterion.
|
||||
|
||||
1. Source Code.
|
||||
|
||||
The "source code" for a work means the preferred form of the work
|
||||
for making modifications to it. "Object code" means any non-source
|
||||
form of a work.
|
||||
|
||||
A "Standard Interface" means an interface that either is an official
|
||||
standard defined by a recognized standards body, or, in the case of
|
||||
interfaces specified for a particular programming language, one that
|
||||
is widely used among developers working in that language.
|
||||
|
||||
The "System Libraries" of an executable work include anything, other
|
||||
than the work as a whole, that (a) is included in the normal form of
|
||||
packaging a Major Component, but which is not part of that Major
|
||||
Component, and (b) serves only to enable use of the work with that
|
||||
Major Component, or to implement a Standard Interface for which an
|
||||
implementation is available to the public in source code form. A
|
||||
"Major Component", in this context, means a major essential component
|
||||
(kernel, window system, and so on) of the specific operating system
|
||||
(if any) on which the executable work runs, or a compiler used to
|
||||
produce the work, or an object code interpreter used to run it.
|
||||
|
||||
The "Corresponding Source" for a work in object code form means all
|
||||
the source code needed to generate, install, and (for an executable
|
||||
work) run the object code and to modify the work, including scripts to
|
||||
control those activities. However, it does not include the work's
|
||||
System Libraries, or general-purpose tools or generally available free
|
||||
programs which are used unmodified in performing those activities but
|
||||
which are not part of the work. For example, Corresponding Source
|
||||
includes interface definition files associated with source files for
|
||||
the work, and the source code for shared libraries and dynamically
|
||||
linked subprograms that the work is specifically designed to require,
|
||||
such as by intimate data communication or control flow between those
|
||||
subprograms and other parts of the work.
|
||||
|
||||
The Corresponding Source need not include anything that users
|
||||
can regenerate automatically from other parts of the Corresponding
|
||||
Source.
|
||||
|
||||
The Corresponding Source for a work in source code form is that
|
||||
same work.
|
||||
|
||||
2. Basic Permissions.
|
||||
|
||||
All rights granted under this License are granted for the term of
|
||||
copyright on the Program, and are irrevocable provided the stated
|
||||
conditions are met. This License explicitly affirms your unlimited
|
||||
permission to run the unmodified Program. The output from running a
|
||||
covered work is covered by this License only if the output, given its
|
||||
content, constitutes a covered work. This License acknowledges your
|
||||
rights of fair use or other equivalent, as provided by copyright law.
|
||||
|
||||
You may make, run and propagate covered works that you do not
|
||||
convey, without conditions so long as your license otherwise remains
|
||||
in force. You may convey covered works to others for the sole purpose
|
||||
of having them make modifications exclusively for you, or provide you
|
||||
with facilities for running those works, provided that you comply with
|
||||
the terms of this License in conveying all material for which you do
|
||||
not control copyright. Those thus making or running the covered works
|
||||
for you must do so exclusively on your behalf, under your direction
|
||||
and control, on terms that prohibit them from making any copies of
|
||||
your copyrighted material outside their relationship with you.
|
||||
|
||||
Conveying under any other circumstances is permitted solely under
|
||||
the conditions stated below. Sublicensing is not allowed; section 10
|
||||
makes it unnecessary.
|
||||
|
||||
3. Protecting Users' Legal Rights From Anti-Circumvention Law.
|
||||
|
||||
No covered work shall be deemed part of an effective technological
|
||||
measure under any applicable law fulfilling obligations under article
|
||||
11 of the WIPO copyright treaty adopted on 20 December 1996, or
|
||||
similar laws prohibiting or restricting circumvention of such
|
||||
measures.
|
||||
|
||||
When you convey a covered work, you waive any legal power to forbid
|
||||
circumvention of technological measures to the extent such circumvention
|
||||
is effected by exercising rights under this License with respect to
|
||||
the covered work, and you disclaim any intention to limit operation or
|
||||
modification of the work as a means of enforcing, against the work's
|
||||
users, your or third parties' legal rights to forbid circumvention of
|
||||
technological measures.
|
||||
|
||||
4. Conveying Verbatim Copies.
|
||||
|
||||
You may convey verbatim copies of the Program's source code as you
|
||||
receive it, in any medium, provided that you conspicuously and
|
||||
appropriately publish on each copy an appropriate copyright notice;
|
||||
keep intact all notices stating that this License and any
|
||||
non-permissive terms added in accord with section 7 apply to the code;
|
||||
keep intact all notices of the absence of any warranty; and give all
|
||||
recipients a copy of this License along with the Program.
|
||||
|
||||
You may charge any price or no price for each copy that you convey,
|
||||
and you may offer support or warranty protection for a fee.
|
||||
|
||||
5. Conveying Modified Source Versions.
|
||||
|
||||
You may convey a work based on the Program, or the modifications to
|
||||
produce it from the Program, in the form of source code under the
|
||||
terms of section 4, provided that you also meet all of these conditions:
|
||||
|
||||
a) The work must carry prominent notices stating that you modified
|
||||
it, and giving a relevant date.
|
||||
|
||||
b) The work must carry prominent notices stating that it is
|
||||
released under this License and any conditions added under section
|
||||
7. This requirement modifies the requirement in section 4 to
|
||||
"keep intact all notices".
|
||||
|
||||
c) You must license the entire work, as a whole, under this
|
||||
License to anyone who comes into possession of a copy. This
|
||||
License will therefore apply, along with any applicable section 7
|
||||
additional terms, to the whole of the work, and all its parts,
|
||||
regardless of how they are packaged. This License gives no
|
||||
permission to license the work in any other way, but it does not
|
||||
invalidate such permission if you have separately received it.
|
||||
|
||||
d) If the work has interactive user interfaces, each must display
|
||||
Appropriate Legal Notices; however, if the Program has interactive
|
||||
interfaces that do not display Appropriate Legal Notices, your
|
||||
work need not make them do so.
|
||||
|
||||
A compilation of a covered work with other separate and independent
|
||||
works, which are not by their nature extensions of the covered work,
|
||||
and which are not combined with it such as to form a larger program,
|
||||
in or on a volume of a storage or distribution medium, is called an
|
||||
"aggregate" if the compilation and its resulting copyright are not
|
||||
used to limit the access or legal rights of the compilation's users
|
||||
beyond what the individual works permit. Inclusion of a covered work
|
||||
in an aggregate does not cause this License to apply to the other
|
||||
parts of the aggregate.
|
||||
|
||||
6. Conveying Non-Source Forms.
|
||||
|
||||
You may convey a covered work in object code form under the terms
|
||||
of sections 4 and 5, provided that you also convey the
|
||||
machine-readable Corresponding Source under the terms of this License,
|
||||
in one of these ways:
|
||||
|
||||
a) Convey the object code in, or embodied in, a physical product
|
||||
(including a physical distribution medium), accompanied by the
|
||||
Corresponding Source fixed on a durable physical medium
|
||||
customarily used for software interchange.
|
||||
|
||||
b) Convey the object code in, or embodied in, a physical product
|
||||
(including a physical distribution medium), accompanied by a
|
||||
written offer, valid for at least three years and valid for as
|
||||
long as you offer spare parts or customer support for that product
|
||||
model, to give anyone who possesses the object code either (1) a
|
||||
copy of the Corresponding Source for all the software in the
|
||||
product that is covered by this License, on a durable physical
|
||||
medium customarily used for software interchange, for a price no
|
||||
more than your reasonable cost of physically performing this
|
||||
conveying of source, or (2) access to copy the
|
||||
Corresponding Source from a network server at no charge.
|
||||
|
||||
c) Convey individual copies of the object code with a copy of the
|
||||
written offer to provide the Corresponding Source. This
|
||||
alternative is allowed only occasionally and noncommercially, and
|
||||
only if you received the object code with such an offer, in accord
|
||||
with subsection 6b.
|
||||
|
||||
d) Convey the object code by offering access from a designated
|
||||
place (gratis or for a charge), and offer equivalent access to the
|
||||
Corresponding Source in the same way through the same place at no
|
||||
further charge. You need not require recipients to copy the
|
||||
Corresponding Source along with the object code. If the place to
|
||||
copy the object code is a network server, the Corresponding Source
|
||||
may be on a different server (operated by you or a third party)
|
||||
that supports equivalent copying facilities, provided you maintain
|
||||
clear directions next to the object code saying where to find the
|
||||
Corresponding Source. Regardless of what server hosts the
|
||||
Corresponding Source, you remain obligated to ensure that it is
|
||||
available for as long as needed to satisfy these requirements.
|
||||
|
||||
e) Convey the object code using peer-to-peer transmission, provided
|
||||
you inform other peers where the object code and Corresponding
|
||||
Source of the work are being offered to the general public at no
|
||||
charge under subsection 6d.
|
||||
|
||||
A separable portion of the object code, whose source code is excluded
|
||||
from the Corresponding Source as a System Library, need not be
|
||||
included in conveying the object code work.
|
||||
|
||||
A "User Product" is either (1) a "consumer product", which means any
|
||||
tangible personal property which is normally used for personal, family,
|
||||
or household purposes, or (2) anything designed or sold for incorporation
|
||||
into a dwelling. In determining whether a product is a consumer product,
|
||||
doubtful cases shall be resolved in favor of coverage. For a particular
|
||||
product received by a particular user, "normally used" refers to a
|
||||
typical or common use of that class of product, regardless of the status
|
||||
of the particular user or of the way in which the particular user
|
||||
actually uses, or expects or is expected to use, the product. A product
|
||||
is a consumer product regardless of whether the product has substantial
|
||||
commercial, industrial or non-consumer uses, unless such uses represent
|
||||
the only significant mode of use of the product.
|
||||
|
||||
"Installation Information" for a User Product means any methods,
|
||||
procedures, authorization keys, or other information required to install
|
||||
and execute modified versions of a covered work in that User Product from
|
||||
a modified version of its Corresponding Source. The information must
|
||||
suffice to ensure that the continued functioning of the modified object
|
||||
code is in no case prevented or interfered with solely because
|
||||
modification has been made.
|
||||
|
||||
If you convey an object code work under this section in, or with, or
|
||||
specifically for use in, a User Product, and the conveying occurs as
|
||||
part of a transaction in which the right of possession and use of the
|
||||
User Product is transferred to the recipient in perpetuity or for a
|
||||
fixed term (regardless of how the transaction is characterized), the
|
||||
Corresponding Source conveyed under this section must be accompanied
|
||||
by the Installation Information. But this requirement does not apply
|
||||
if neither you nor any third party retains the ability to install
|
||||
modified object code on the User Product (for example, the work has
|
||||
been installed in ROM).
|
||||
|
||||
The requirement to provide Installation Information does not include a
|
||||
requirement to continue to provide support service, warranty, or updates
|
||||
for a work that has been modified or installed by the recipient, or for
|
||||
the User Product in which it has been modified or installed. Access to a
|
||||
network may be denied when the modification itself materially and
|
||||
adversely affects the operation of the network or violates the rules and
|
||||
protocols for communication across the network.
|
||||
|
||||
Corresponding Source conveyed, and Installation Information provided,
|
||||
in accord with this section must be in a format that is publicly
|
||||
documented (and with an implementation available to the public in
|
||||
source code form), and must require no special password or key for
|
||||
unpacking, reading or copying.
|
||||
|
||||
7. Additional Terms.
|
||||
|
||||
"Additional permissions" are terms that supplement the terms of this
|
||||
License by making exceptions from one or more of its conditions.
|
||||
Additional permissions that are applicable to the entire Program shall
|
||||
be treated as though they were included in this License, to the extent
|
||||
that they are valid under applicable law. If additional permissions
|
||||
apply only to part of the Program, that part may be used separately
|
||||
under those permissions, but the entire Program remains governed by
|
||||
this License without regard to the additional permissions.
|
||||
|
||||
When you convey a copy of a covered work, you may at your option
|
||||
remove any additional permissions from that copy, or from any part of
|
||||
it. (Additional permissions may be written to require their own
|
||||
removal in certain cases when you modify the work.) You may place
|
||||
additional permissions on material, added by you to a covered work,
|
||||
for which you have or can give appropriate copyright permission.
|
||||
|
||||
Notwithstanding any other provision of this License, for material you
|
||||
add to a covered work, you may (if authorized by the copyright holders of
|
||||
that material) supplement the terms of this License with terms:
|
||||
|
||||
a) Disclaiming warranty or limiting liability differently from the
|
||||
terms of sections 15 and 16 of this License; or
|
||||
|
||||
b) Requiring preservation of specified reasonable legal notices or
|
||||
author attributions in that material or in the Appropriate Legal
|
||||
Notices displayed by works containing it; or
|
||||
|
||||
c) Prohibiting misrepresentation of the origin of that material, or
|
||||
requiring that modified versions of such material be marked in
|
||||
reasonable ways as different from the original version; or
|
||||
|
||||
d) Limiting the use for publicity purposes of names of licensors or
|
||||
authors of the material; or
|
||||
|
||||
e) Declining to grant rights under trademark law for use of some
|
||||
trade names, trademarks, or service marks; or
|
||||
|
||||
f) Requiring indemnification of licensors and authors of that
|
||||
material by anyone who conveys the material (or modified versions of
|
||||
it) with contractual assumptions of liability to the recipient, for
|
||||
any liability that these contractual assumptions directly impose on
|
||||
those licensors and authors.
|
||||
|
||||
All other non-permissive additional terms are considered "further
|
||||
restrictions" within the meaning of section 10. If the Program as you
|
||||
received it, or any part of it, contains a notice stating that it is
|
||||
governed by this License along with a term that is a further
|
||||
restriction, you may remove that term. If a license document contains
|
||||
a further restriction but permits relicensing or conveying under this
|
||||
License, you may add to a covered work material governed by the terms
|
||||
of that license document, provided that the further restriction does
|
||||
not survive such relicensing or conveying.
|
||||
|
||||
If you add terms to a covered work in accord with this section, you
|
||||
must place, in the relevant source files, a statement of the
|
||||
additional terms that apply to those files, or a notice indicating
|
||||
where to find the applicable terms.
|
||||
|
||||
Additional terms, permissive or non-permissive, may be stated in the
|
||||
form of a separately written license, or stated as exceptions;
|
||||
the above requirements apply either way.
|
||||
|
||||
8. Termination.
|
||||
|
||||
You may not propagate or modify a covered work except as expressly
|
||||
provided under this License. Any attempt otherwise to propagate or
|
||||
modify it is void, and will automatically terminate your rights under
|
||||
this License (including any patent licenses granted under the third
|
||||
paragraph of section 11).
|
||||
|
||||
However, if you cease all violation of this License, then your
|
||||
license from a particular copyright holder is reinstated (a)
|
||||
provisionally, unless and until the copyright holder explicitly and
|
||||
finally terminates your license, and (b) permanently, if the copyright
|
||||
holder fails to notify you of the violation by some reasonable means
|
||||
prior to 60 days after the cessation.
|
||||
|
||||
Moreover, your license from a particular copyright holder is
|
||||
reinstated permanently if the copyright holder notifies you of the
|
||||
violation by some reasonable means, this is the first time you have
|
||||
received notice of violation of this License (for any work) from that
|
||||
copyright holder, and you cure the violation prior to 30 days after
|
||||
your receipt of the notice.
|
||||
|
||||
Termination of your rights under this section does not terminate the
|
||||
licenses of parties who have received copies or rights from you under
|
||||
this License. If your rights have been terminated and not permanently
|
||||
reinstated, you do not qualify to receive new licenses for the same
|
||||
material under section 10.
|
||||
|
||||
9. Acceptance Not Required for Having Copies.
|
||||
|
||||
You are not required to accept this License in order to receive or
|
||||
run a copy of the Program. Ancillary propagation of a covered work
|
||||
occurring solely as a consequence of using peer-to-peer transmission
|
||||
to receive a copy likewise does not require acceptance. However,
|
||||
nothing other than this License grants you permission to propagate or
|
||||
modify any covered work. These actions infringe copyright if you do
|
||||
not accept this License. Therefore, by modifying or propagating a
|
||||
covered work, you indicate your acceptance of this License to do so.
|
||||
|
||||
10. Automatic Licensing of Downstream Recipients.
|
||||
|
||||
Each time you convey a covered work, the recipient automatically
|
||||
receives a license from the original licensors, to run, modify and
|
||||
propagate that work, subject to this License. You are not responsible
|
||||
for enforcing compliance by third parties with this License.
|
||||
|
||||
An "entity transaction" is a transaction transferring control of an
|
||||
organization, or substantially all assets of one, or subdividing an
|
||||
organization, or merging organizations. If propagation of a covered
|
||||
work results from an entity transaction, each party to that
|
||||
transaction who receives a copy of the work also receives whatever
|
||||
licenses to the work the party's predecessor in interest had or could
|
||||
give under the previous paragraph, plus a right to possession of the
|
||||
Corresponding Source of the work from the predecessor in interest, if
|
||||
the predecessor has it or can get it with reasonable efforts.
|
||||
|
||||
You may not impose any further restrictions on the exercise of the
|
||||
rights granted or affirmed under this License. For example, you may
|
||||
not impose a license fee, royalty, or other charge for exercise of
|
||||
rights granted under this License, and you may not initiate litigation
|
||||
(including a cross-claim or counterclaim in a lawsuit) alleging that
|
||||
any patent claim is infringed by making, using, selling, offering for
|
||||
sale, or importing the Program or any portion of it.
|
||||
|
||||
11. Patents.
|
||||
|
||||
A "contributor" is a copyright holder who authorizes use under this
|
||||
License of the Program or a work on which the Program is based. The
|
||||
work thus licensed is called the contributor's "contributor version".
|
||||
|
||||
A contributor's "essential patent claims" are all patent claims
|
||||
owned or controlled by the contributor, whether already acquired or
|
||||
hereafter acquired, that would be infringed by some manner, permitted
|
||||
by this License, of making, using, or selling its contributor version,
|
||||
but do not include claims that would be infringed only as a
|
||||
consequence of further modification of the contributor version. For
|
||||
purposes of this definition, "control" includes the right to grant
|
||||
patent sublicenses in a manner consistent with the requirements of
|
||||
this License.
|
||||
|
||||
Each contributor grants you a non-exclusive, worldwide, royalty-free
|
||||
patent license under the contributor's essential patent claims, to
|
||||
make, use, sell, offer for sale, import and otherwise run, modify and
|
||||
propagate the contents of its contributor version.
|
||||
|
||||
In the following three paragraphs, a "patent license" is any express
|
||||
agreement or commitment, however denominated, not to enforce a patent
|
||||
(such as an express permission to practice a patent or covenant not to
|
||||
sue for patent infringement). To "grant" such a patent license to a
|
||||
party means to make such an agreement or commitment not to enforce a
|
||||
patent against the party.
|
||||
|
||||
If you convey a covered work, knowingly relying on a patent license,
|
||||
and the Corresponding Source of the work is not available for anyone
|
||||
to copy, free of charge and under the terms of this License, through a
|
||||
publicly available network server or other readily accessible means,
|
||||
then you must either (1) cause the Corresponding Source to be so
|
||||
available, or (2) arrange to deprive yourself of the benefit of the
|
||||
patent license for this particular work, or (3) arrange, in a manner
|
||||
consistent with the requirements of this License, to extend the patent
|
||||
license to downstream recipients. "Knowingly relying" means you have
|
||||
actual knowledge that, but for the patent license, your conveying the
|
||||
covered work in a country, or your recipient's use of the covered work
|
||||
in a country, would infringe one or more identifiable patents in that
|
||||
country that you have reason to believe are valid.
|
||||
|
||||
If, pursuant to or in connection with a single transaction or
|
||||
arrangement, you convey, or propagate by procuring conveyance of, a
|
||||
covered work, and grant a patent license to some of the parties
|
||||
receiving the covered work authorizing them to use, propagate, modify
|
||||
or convey a specific copy of the covered work, then the patent license
|
||||
you grant is automatically extended to all recipients of the covered
|
||||
work and works based on it.
|
||||
|
||||
A patent license is "discriminatory" if it does not include within
|
||||
the scope of its coverage, prohibits the exercise of, or is
|
||||
conditioned on the non-exercise of one or more of the rights that are
|
||||
specifically granted under this License. You may not convey a covered
|
||||
work if you are a party to an arrangement with a third party that is
|
||||
in the business of distributing software, under which you make payment
|
||||
to the third party based on the extent of your activity of conveying
|
||||
the work, and under which the third party grants, to any of the
|
||||
parties who would receive the covered work from you, a discriminatory
|
||||
patent license (a) in connection with copies of the covered work
|
||||
conveyed by you (or copies made from those copies), or (b) primarily
|
||||
for and in connection with specific products or compilations that
|
||||
contain the covered work, unless you entered into that arrangement,
|
||||
or that patent license was granted, prior to 28 March 2007.
|
||||
|
||||
Nothing in this License shall be construed as excluding or limiting
|
||||
any implied license or other defenses to infringement that may
|
||||
otherwise be available to you under applicable patent law.
|
||||
|
||||
12. No Surrender of Others' Freedom.
|
||||
|
||||
If conditions are imposed on you (whether by court order, agreement or
|
||||
otherwise) that contradict the conditions of this License, they do not
|
||||
excuse you from the conditions of this License. If you cannot convey a
|
||||
covered work so as to satisfy simultaneously your obligations under this
|
||||
License and any other pertinent obligations, then as a consequence you may
|
||||
not convey it at all. For example, if you agree to terms that obligate you
|
||||
to collect a royalty for further conveying from those to whom you convey
|
||||
the Program, the only way you could satisfy both those terms and this
|
||||
License would be to refrain entirely from conveying the Program.
|
||||
|
||||
13. Use with the GNU Affero General Public License.
|
||||
|
||||
Notwithstanding any other provision of this License, you have
|
||||
permission to link or combine any covered work with a work licensed
|
||||
under version 3 of the GNU Affero General Public License into a single
|
||||
combined work, and to convey the resulting work. The terms of this
|
||||
License will continue to apply to the part which is the covered work,
|
||||
but the special requirements of the GNU Affero General Public License,
|
||||
section 13, concerning interaction through a network will apply to the
|
||||
combination as such.
|
||||
|
||||
14. Revised Versions of this License.
|
||||
|
||||
The Free Software Foundation may publish revised and/or new versions of
|
||||
the GNU General Public License from time to time. Such new versions will
|
||||
be similar in spirit to the present version, but may differ in detail to
|
||||
address new problems or concerns.
|
||||
|
||||
Each version is given a distinguishing version number. If the
|
||||
Program specifies that a certain numbered version of the GNU General
|
||||
Public License "or any later version" applies to it, you have the
|
||||
option of following the terms and conditions either of that numbered
|
||||
version or of any later version published by the Free Software
|
||||
Foundation. If the Program does not specify a version number of the
|
||||
GNU General Public License, you may choose any version ever published
|
||||
by the Free Software Foundation.
|
||||
|
||||
If the Program specifies that a proxy can decide which future
|
||||
versions of the GNU General Public License can be used, that proxy's
|
||||
public statement of acceptance of a version permanently authorizes you
|
||||
to choose that version for the Program.
|
||||
|
||||
Later license versions may give you additional or different
|
||||
permissions. However, no additional obligations are imposed on any
|
||||
author or copyright holder as a result of your choosing to follow a
|
||||
later version.
|
||||
|
||||
15. Disclaimer of Warranty.
|
||||
|
||||
THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY
|
||||
APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT
|
||||
HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY
|
||||
OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO,
|
||||
THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
|
||||
PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM
|
||||
IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF
|
||||
ALL NECESSARY SERVICING, REPAIR OR CORRECTION.
|
||||
|
||||
16. Limitation of Liability.
|
||||
|
||||
IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
|
||||
WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS
|
||||
THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY
|
||||
GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE
|
||||
USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF
|
||||
DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD
|
||||
PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS),
|
||||
EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF
|
||||
SUCH DAMAGES.
|
||||
|
||||
17. Interpretation of Sections 15 and 16.
|
||||
|
||||
If the disclaimer of warranty and limitation of liability provided
|
||||
above cannot be given local legal effect according to their terms,
|
||||
reviewing courts shall apply local law that most closely approximates
|
||||
an absolute waiver of all civil liability in connection with the
|
||||
Program, unless a warranty or assumption of liability accompanies a
|
||||
copy of the Program in return for a fee.
|
||||
|
||||
END OF TERMS AND CONDITIONS
|
||||
|
||||
How to Apply These Terms to Your New Programs
|
||||
|
||||
If you develop a new program, and you want it to be of the greatest
|
||||
possible use to the public, the best way to achieve this is to make it
|
||||
free software which everyone can redistribute and change under these terms.
|
||||
|
||||
To do so, attach the following notices to the program. It is safest
|
||||
to attach them to the start of each source file to most effectively
|
||||
state the exclusion of warranty; and each file should have at least
|
||||
the "copyright" line and a pointer to where the full notice is found.
|
||||
|
||||
<one line to give the program's name and a brief idea of what it does.>
|
||||
Copyright (C) <year> <name of author>
|
||||
|
||||
This program 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.
|
||||
|
||||
This program 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 this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
Also add information on how to contact you by electronic and paper mail.
|
||||
|
||||
If the program does terminal interaction, make it output a short
|
||||
notice like this when it starts in an interactive mode:
|
||||
|
||||
<program> Copyright (C) <year> <name of author>
|
||||
This program comes with ABSOLUTELY NO WARRANTY; for details type `show w'.
|
||||
This is free software, and you are welcome to redistribute it
|
||||
under certain conditions; type `show c' for details.
|
||||
|
||||
The hypothetical commands `show w' and `show c' should show the appropriate
|
||||
parts of the General Public License. Of course, your program's commands
|
||||
might be different; for a GUI interface, you would use an "about box".
|
||||
|
||||
You should also get your employer (if you work as a programmer) or school,
|
||||
if any, to sign a "copyright disclaimer" for the program, if necessary.
|
||||
For more information on this, and how to apply and follow the GNU GPL, see
|
||||
<http://www.gnu.org/licenses/>.
|
||||
|
||||
The GNU General Public License does not permit incorporating your program
|
||||
into proprietary programs. If your program is a subroutine library, you
|
||||
may consider it more useful to permit linking proprietary applications with
|
||||
the library. If this is what you want to do, use the GNU Lesser General
|
||||
Public License instead of this License. But first, please read
|
||||
<http://www.gnu.org/philosophy/why-not-lgpl.html>.
|
||||
7
CTestConfig.cmake
Normal file
7
CTestConfig.cmake
Normal file
@@ -0,0 +1,7 @@
|
||||
# this is included after opm-core_NAME is set
|
||||
set(CTEST_PROJECT_NAME "${${project}_NAME}")
|
||||
set(CTEST_NIGHTLY_START_TIME "01:00:00 UTC")
|
||||
set(CTEST_DROP_METHOD "http")
|
||||
set(CTEST_DROP_SITE "opm-project.org")
|
||||
set(CTEST_DROP_LOCATION "/CDash/submit.php?project=${${project}_NAME}")
|
||||
set(CTEST_DROP_SITE_CDASH TRUE)
|
||||
61
Documentation/Doxylocal
Normal file
61
Documentation/Doxylocal
Normal file
@@ -0,0 +1,61 @@
|
||||
# The INPUT tag can be used to specify the files and/or directories that contain
|
||||
# documented source files. You may enter file names like "myfile.cpp" or
|
||||
# directories like "/usr/src/myproject". Separate the files or directories
|
||||
# with spaces.
|
||||
|
||||
INPUT = @PROJECT_SOURCE_DIR@/@src_DIR@/ \
|
||||
@PROJECT_SOURCE_DIR@/tutorials/ \
|
||||
@PROJECT_SOURCE_DIR@/examples/
|
||||
|
||||
# The EXCLUDE tag can be used to specify files and/or directories that should
|
||||
# excluded from the INPUT source files. This way you can easily exclude a
|
||||
# subdirectory from a directory tree whose root is specified with the INPUT tag.
|
||||
|
||||
EXCLUDE = @PROJECT_SOURCE_DIR@/@src_DIR@/core/utility/parameters/tinyxml
|
||||
|
||||
# If the FULL_PATH_NAMES tag is set to YES then the STRIP_FROM_PATH tag
|
||||
# can be used to strip a user-defined part of the path. Stripping is
|
||||
# only done if one of the specified strings matches the left-hand part of
|
||||
# the path. The tag can be used to show relative paths in the file list.
|
||||
# If left blank the directory from which doxygen is run is used as the
|
||||
# path to strip.
|
||||
|
||||
STRIP_FROM_PATH = @PROJECT_SOURCE_DIR@
|
||||
|
||||
# The EXAMPLE_PATH tag can be used to specify one or more files or
|
||||
# directories that contain example code fragments that are included (see
|
||||
# the \include command).
|
||||
|
||||
EXAMPLE_PATH = @PROJECT_SOURCE_DIR@/tutorials/
|
||||
|
||||
# The OUTPUT_DIRECTORY tag is used to specify the (relative or absolute)
|
||||
# base path where the generated documentation will be put.
|
||||
# If a relative path is entered, it will be relative to the location
|
||||
# where doxygen was started. If left blank the current directory will be used.
|
||||
|
||||
OUTPUT_DIRECTORY = @PROJECT_BINARY_DIR@/@doxy_dir@
|
||||
|
||||
# The IMAGE_PATH tag can be used to specify one or more files or
|
||||
# directories that contain image that are included in the documentation (see
|
||||
# the \image command).
|
||||
|
||||
IMAGE_PATH = @PROJECT_SOURCE_DIR@/@doxy_dir@/Figure
|
||||
|
||||
# The LAYOUT_FILE tag can be used to specify a layout file which will be parsed
|
||||
# by doxygen. The layout file controls the global structure of the generated
|
||||
# output files in an output format independent way. The create the layout file
|
||||
# that represents doxygen's defaults, run doxygen with the -l option.
|
||||
# You can optionally specify a file name after the option, if omitted
|
||||
# DoxygenLayout.xml will be used as the name of the layout file.
|
||||
|
||||
LAYOUT_FILE = @PROJECT_SOURCE_DIR@/@doxy_dir@/DoxygenLayout.xml
|
||||
|
||||
# The HTML_EXTRA_STYLESHEET tag can be used to specify an additional
|
||||
# user-defined cascading style sheet that is included after the standard
|
||||
# style sheets created by doxygen. Using this option one can overrule
|
||||
# certain style aspects. This is preferred over using HTML_STYLESHEET
|
||||
# since it does not replace the standard style sheet and is therefor more
|
||||
# robust against future updates. Doxygen will copy the style sheet file to
|
||||
# the output directory.
|
||||
|
||||
HTML_EXTRA_STYLESHEET = style.css
|
||||
1
Documentation/Figure/.gitignore
vendored
Normal file
1
Documentation/Figure/.gitignore
vendored
Normal file
@@ -0,0 +1 @@
|
||||
# intentionally empty -- present just to get directory created
|
||||
11
Documentation/style.css
Normal file
11
Documentation/style.css
Normal file
@@ -0,0 +1,11 @@
|
||||
/* Userspesific CSS for doxygen */
|
||||
body, table, div, p, dl {
|
||||
font-family: Lucida Grande, Verdana, Geneva, Arial, sans-serif;
|
||||
font-size: 16px;
|
||||
}
|
||||
h1 {
|
||||
font-size: 120%;
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -1,56 +0,0 @@
|
||||
if (UMFPACK_INCLUDES AND UMFPACK_LIBRARIES)
|
||||
set(UMFPACK_FIND_QUIETLY TRUE)
|
||||
endif (UMFPACK_INCLUDES AND UMFPACK_LIBRARIES)
|
||||
|
||||
find_package(BLAS)
|
||||
|
||||
if(BLAS_FOUND)
|
||||
|
||||
find_path(UMFPACK_INCLUDES
|
||||
NAMES
|
||||
umfpack.h
|
||||
PATHS
|
||||
$ENV{UMFPACKDIR}
|
||||
${INCLUDE_INSTALL_DIR}
|
||||
PATH_SUFFIXES
|
||||
suitesparse
|
||||
)
|
||||
|
||||
find_library(UMFPACK_LIBRARIES umfpack PATHS $ENV{UMFPACKDIR} ${LIB_INSTALL_DIR})
|
||||
|
||||
if(UMFPACK_LIBRARIES)
|
||||
|
||||
get_filename_component(UMFPACK_LIBDIR ${UMFPACK_LIBRARIES} PATH)
|
||||
|
||||
find_library(AMD_LIBRARY amd PATHS ${UMFPACK_LIBDIR} $ENV{UMFPACKDIR} ${LIB_INSTALL_DIR})
|
||||
if (AMD_LIBRARY)
|
||||
set(UMFPACK_LIBRARIES ${UMFPACK_LIBRARIES} ${AMD_LIBRARY})
|
||||
#else (AMD_LIBRARY)
|
||||
# set(UMFPACK_LIBRARIES FALSE)
|
||||
endif (AMD_LIBRARY)
|
||||
|
||||
endif(UMFPACK_LIBRARIES)
|
||||
|
||||
if(UMFPACK_LIBRARIES)
|
||||
|
||||
find_library(COLAMD_LIBRARY colamd PATHS ${UMFPACK_LIBDIR} $ENV{UMFPACKDIR} ${LIB_INSTALL_DIR})
|
||||
if (COLAMD_LIBRARY)
|
||||
set(UMFPACK_LIBRARIES ${UMFPACK_LIBRARIES} ${COLAMD_LIBRARY})
|
||||
#else (COLAMD_LIBRARY)
|
||||
# set(UMFPACK_LIBRARIES FALSE)
|
||||
endif (COLAMD_LIBRARY)
|
||||
|
||||
endif(UMFPACK_LIBRARIES)
|
||||
|
||||
if(UMFPACK_LIBRARIES)
|
||||
set(UMFPACK_LIBRARIES ${UMFPACK_LIBRARIES} ${BLAS_LIBRARIES})
|
||||
endif(UMFPACK_LIBRARIES)
|
||||
|
||||
endif(BLAS_FOUND)
|
||||
|
||||
|
||||
include(FindPackageHandleStandardArgs)
|
||||
find_package_handle_standard_args(UMFPACK DEFAULT_MSG
|
||||
UMFPACK_INCLUDES UMFPACK_LIBRARIES)
|
||||
|
||||
mark_as_advanced(UMFPACK_INCLUDES UMFPACK_LIBRARIES AMD_LIBRARY COLAMD_LIBRARY)
|
||||
335
Makefile.am
335
Makefile.am
@@ -1,335 +0,0 @@
|
||||
# Additional aclocal(1) macros located here.
|
||||
ACLOCAL_AMFLAGS = -I m4
|
||||
|
||||
# Recurse to build examples after libraries
|
||||
SUBDIRS = . tests examples tutorials
|
||||
|
||||
# ----------------------------------------------------------------------
|
||||
# Declare products (i.e., the library)
|
||||
lib_LTLIBRARIES = lib/libopmcore.la
|
||||
|
||||
# ----------------------------------------------------------------------
|
||||
# Build-time flags needed to build libopmcore.la
|
||||
|
||||
AM_CPPFLAGS = \
|
||||
$(ERT_CPPFLAGS) \
|
||||
$(OPM_BOOST_CPPFLAGS) \
|
||||
$(SUPERLU_CPPFLAGS)
|
||||
|
||||
# ----------------------------------------------------------------------
|
||||
# Link-time flags needed both to successfully link the library and to
|
||||
# (transitively) convey inter-library dependency information.
|
||||
|
||||
lib_libopmcore_la_LDFLAGS = \
|
||||
-R $(OPM_BOOST_LIBDIR) \
|
||||
$(OPM_BOOST_LDFLAGS) \
|
||||
$(ERT_LDFLAGS) \
|
||||
$(SUPERLU_LDFLAGS)
|
||||
|
||||
lib_libopmcore_la_LIBADD = \
|
||||
$(BOOST_FILESYSTEM_LIB) \
|
||||
$(BOOST_SYSTEM_LIB) \
|
||||
$(BOOST_DATE_TIME_LIB) \
|
||||
$(BOOST_UNIT_TEST_FRAMEWORK_LIB) \
|
||||
$(ERT_LIBS) \
|
||||
$(LAPACK_LIBS) $(SUPERLU_LIBS) $(BLAS_LIBS) $(LIBS)
|
||||
|
||||
# ----------------------------------------------------------------------
|
||||
# Library constituents. SOURCES followed by HEADERS.
|
||||
#
|
||||
# Please try to keep the list sorted.
|
||||
|
||||
# List of sources that should be built but not distributed. See AGMG
|
||||
# support below for additional details.
|
||||
nodist_lib_libopmcore_la_SOURCES =
|
||||
|
||||
lib_libopmcore_la_SOURCES = \
|
||||
opm/core/GridManager.cpp \
|
||||
opm/core/eclipse/EclipseGridInspector.cpp \
|
||||
opm/core/eclipse/EclipseGridParser.cpp \
|
||||
opm/core/fluid/BlackoilPropertiesBasic.cpp \
|
||||
opm/core/fluid/BlackoilPropertiesFromDeck.cpp \
|
||||
opm/core/fluid/IncompPropertiesBasic.cpp \
|
||||
opm/core/fluid/IncompPropertiesFromDeck.cpp \
|
||||
opm/core/fluid/PvtPropertiesBasic.cpp \
|
||||
opm/core/fluid/PvtPropertiesIncompFromDeck.cpp \
|
||||
opm/core/fluid/RockBasic.cpp \
|
||||
opm/core/fluid/RockCompressibility.cpp \
|
||||
opm/core/fluid/RockFromDeck.cpp \
|
||||
opm/core/fluid/SaturationPropsBasic.cpp \
|
||||
opm/core/fluid/SaturationPropsFromDeck.cpp \
|
||||
opm/core/fluid/SatFuncGwseg.cpp \
|
||||
opm/core/fluid/SatFuncStone2.cpp \
|
||||
opm/core/fluid/SatFuncSimple.cpp \
|
||||
opm/core/fluid/blackoil/BlackoilPvtProperties.cpp \
|
||||
opm/core/fluid/blackoil/SinglePvtDead.cpp \
|
||||
opm/core/fluid/blackoil/SinglePvtDeadSpline.cpp \
|
||||
opm/core/fluid/blackoil/SinglePvtInterface.cpp \
|
||||
opm/core/fluid/blackoil/SinglePvtLiveGas.cpp \
|
||||
opm/core/fluid/blackoil/SinglePvtLiveOil.cpp \
|
||||
opm/core/grid.c \
|
||||
opm/core/grid/cart_grid.c \
|
||||
opm/core/grid/cornerpoint_grid.c \
|
||||
opm/core/grid/cpgpreprocess/facetopology.c \
|
||||
opm/core/grid/cpgpreprocess/geometry.c \
|
||||
opm/core/grid/cpgpreprocess/preprocess.c \
|
||||
opm/core/grid/cpgpreprocess/uniquepoints.c \
|
||||
opm/core/linalg/LinearSolverFactory.cpp \
|
||||
opm/core/linalg/LinearSolverInterface.cpp \
|
||||
opm/core/linalg/sparse_sys.c \
|
||||
opm/core/newwells.c \
|
||||
opm/core/pressure/CompressibleTpfa.cpp \
|
||||
opm/core/pressure/FlowBCManager.cpp \
|
||||
opm/core/pressure/IncompTpfa.cpp \
|
||||
opm/core/pressure/cfsh.c \
|
||||
opm/core/pressure/flow_bc.c \
|
||||
opm/core/pressure/fsh.c \
|
||||
opm/core/pressure/fsh_common_impl.c \
|
||||
opm/core/pressure/ifsh.c \
|
||||
opm/core/pressure/mimetic/hybsys.c \
|
||||
opm/core/pressure/mimetic/hybsys_global.c \
|
||||
opm/core/pressure/mimetic/mimetic.c \
|
||||
opm/core/pressure/msmfem/coarse_conn.c \
|
||||
opm/core/pressure/msmfem/coarse_sys.c \
|
||||
opm/core/pressure/msmfem/dfs.c \
|
||||
opm/core/pressure/msmfem/hash_set.c \
|
||||
opm/core/pressure/msmfem/ifsh_ms.c \
|
||||
opm/core/pressure/msmfem/partition.c \
|
||||
opm/core/pressure/tpfa/cfs_tpfa.c \
|
||||
opm/core/pressure/tpfa/cfs_tpfa_residual.c \
|
||||
opm/core/pressure/tpfa/compr_bc.c \
|
||||
opm/core/pressure/tpfa/compr_quant.c \
|
||||
opm/core/pressure/tpfa/compr_quant_general.c \
|
||||
opm/core/pressure/tpfa/compr_source.c \
|
||||
opm/core/pressure/tpfa/ifs_tpfa.c \
|
||||
opm/core/pressure/tpfa/trans_tpfa.c \
|
||||
opm/core/pressure/well.c \
|
||||
opm/core/simulator/SimulatorCompressibleTwophase.cpp \
|
||||
opm/core/simulator/SimulatorIncompTwophase.cpp \
|
||||
opm/core/simulator/SimulatorReport.cpp \
|
||||
opm/core/simulator/SimulatorTimer.cpp \
|
||||
opm/core/transport/reorder/DGBasis.cpp \
|
||||
opm/core/transport/reorder/TransportModelCompressibleTwophase.cpp \
|
||||
opm/core/transport/reorder/TransportModelInterface.cpp \
|
||||
opm/core/transport/reorder/TransportModelTracerTof.cpp \
|
||||
opm/core/transport/reorder/TransportModelTracerTofDiscGal.cpp \
|
||||
opm/core/transport/reorder/TransportModelTwophase.cpp \
|
||||
opm/core/transport/reorder/nlsolvers.c \
|
||||
opm/core/transport/reorder/reordersequence.cpp \
|
||||
opm/core/transport/reorder/tarjan.c \
|
||||
opm/core/transport/spu_explicit.c \
|
||||
opm/core/transport/spu_implicit.c \
|
||||
opm/core/transport/transport_source.c \
|
||||
opm/core/utility/MonotCubicInterpolator.cpp \
|
||||
opm/core/utility/StopWatch.cpp \
|
||||
opm/core/utility/VelocityInterpolation.cpp \
|
||||
opm/core/utility/WachspressCoord.cpp \
|
||||
opm/core/utility/miscUtilities.cpp \
|
||||
opm/core/utility/miscUtilitiesBlackoil.cpp \
|
||||
opm/core/utility/parameters/Parameter.cpp \
|
||||
opm/core/utility/parameters/ParameterGroup.cpp \
|
||||
opm/core/utility/parameters/ParameterTools.cpp \
|
||||
opm/core/utility/parameters/ParameterXML.cpp \
|
||||
opm/core/utility/parameters/tinyxml/tinystr.cpp \
|
||||
opm/core/utility/parameters/tinyxml/tinyxml.cpp \
|
||||
opm/core/utility/parameters/tinyxml/tinyxmlerror.cpp \
|
||||
opm/core/utility/parameters/tinyxml/tinyxmlparser.cpp \
|
||||
opm/core/utility/writeECLData.cpp \
|
||||
opm/core/utility/writeVtkData.cpp \
|
||||
opm/core/vag_format/vag.cpp \
|
||||
opm/core/wells/InjectionSpecification.cpp \
|
||||
opm/core/wells/ProductionSpecification.cpp \
|
||||
opm/core/wells/WellCollection.cpp \
|
||||
opm/core/wells/WellsGroup.cpp \
|
||||
opm/core/wells/WellsManager.cpp
|
||||
|
||||
nobase_include_HEADERS = \
|
||||
opm/core/GridAdapter.hpp \
|
||||
opm/core/GridManager.hpp \
|
||||
opm/core/eclipse/CornerpointChopper.hpp \
|
||||
opm/core/eclipse/EclipseGridInspector.hpp \
|
||||
opm/core/eclipse/EclipseGridParser.hpp \
|
||||
opm/core/eclipse/EclipseGridParserHelpers.hpp \
|
||||
opm/core/eclipse/EclipseUnits.hpp \
|
||||
opm/core/eclipse/SpecialEclipseFields.hpp \
|
||||
opm/core/fluid/BlackoilPropertiesBasic.hpp \
|
||||
opm/core/fluid/BlackoilPropertiesFromDeck.hpp \
|
||||
opm/core/fluid/BlackoilPropertiesInterface.hpp \
|
||||
opm/core/fluid/IncompPropertiesBasic.hpp \
|
||||
opm/core/fluid/IncompPropertiesFromDeck.hpp \
|
||||
opm/core/fluid/IncompPropertiesInterface.hpp \
|
||||
opm/core/fluid/PvtPropertiesBasic.hpp \
|
||||
opm/core/fluid/PvtPropertiesIncompFromDeck.hpp \
|
||||
opm/core/fluid/RockBasic.hpp \
|
||||
opm/core/fluid/RockCompressibility.hpp \
|
||||
opm/core/fluid/RockFromDeck.hpp \
|
||||
opm/core/fluid/SatFuncGwseg.hpp \
|
||||
opm/core/fluid/SatFuncStone2.hpp \
|
||||
opm/core/fluid/SatFuncSimple.hpp \
|
||||
opm/core/fluid/SaturationPropsBasic.hpp \
|
||||
opm/core/fluid/SaturationPropsFromDeck.hpp \
|
||||
opm/core/fluid/SaturationPropsFromDeck_impl.hpp \
|
||||
opm/core/fluid/SaturationPropsInterface.hpp \
|
||||
opm/core/fluid/SimpleFluid2p.hpp \
|
||||
opm/core/fluid/blackoil/BlackoilPhases.hpp \
|
||||
opm/core/fluid/blackoil/BlackoilPvtProperties.hpp \
|
||||
opm/core/fluid/blackoil/SinglePvtConstCompr.hpp \
|
||||
opm/core/fluid/blackoil/SinglePvtDead.hpp \
|
||||
opm/core/fluid/blackoil/SinglePvtDeadSpline.hpp \
|
||||
opm/core/fluid/blackoil/SinglePvtInterface.hpp \
|
||||
opm/core/fluid/blackoil/SinglePvtLiveGas.hpp \
|
||||
opm/core/fluid/blackoil/SinglePvtLiveOil.hpp \
|
||||
opm/core/fluid/blackoil/phaseUsageFromDeck.hpp \
|
||||
opm/core/grid.h \
|
||||
opm/core/grid/CellQuadrature.hpp \
|
||||
opm/core/grid/FaceQuadrature.hpp \
|
||||
opm/core/grid/cart_grid.h \
|
||||
opm/core/grid/cornerpoint_grid.h \
|
||||
opm/core/grid/cpgpreprocess/facetopology.h \
|
||||
opm/core/grid/cpgpreprocess/geometry.h \
|
||||
opm/core/grid/cpgpreprocess/grdecl.h \
|
||||
opm/core/grid/cpgpreprocess/preprocess.h \
|
||||
opm/core/grid/cpgpreprocess/uniquepoints.h \
|
||||
opm/core/linalg/LinearSolverFactory.hpp \
|
||||
opm/core/linalg/LinearSolverInterface.hpp \
|
||||
opm/core/linalg/blas_lapack.h \
|
||||
opm/core/linalg/sparse_sys.h \
|
||||
opm/core/newwells.h \
|
||||
opm/core/pressure/CompressibleTpfa.hpp \
|
||||
opm/core/pressure/FlowBCManager.hpp \
|
||||
opm/core/pressure/HybridPressureSolver.hpp \
|
||||
opm/core/pressure/IncompTpfa.hpp \
|
||||
opm/core/pressure/TPFACompressiblePressureSolver.hpp \
|
||||
opm/core/pressure/TPFAPressureSolver.hpp \
|
||||
opm/core/pressure/flow_bc.h \
|
||||
opm/core/pressure/fsh.h \
|
||||
opm/core/pressure/fsh_common_impl.h \
|
||||
opm/core/pressure/mimetic/hybsys.h \
|
||||
opm/core/pressure/mimetic/hybsys_global.h \
|
||||
opm/core/pressure/mimetic/mimetic.h \
|
||||
opm/core/pressure/msmfem/coarse_conn.h \
|
||||
opm/core/pressure/msmfem/coarse_sys.h \
|
||||
opm/core/pressure/msmfem/dfs.h \
|
||||
opm/core/pressure/msmfem/hash_set.h \
|
||||
opm/core/pressure/msmfem/ifsh_ms.h \
|
||||
opm/core/pressure/msmfem/partition.h \
|
||||
opm/core/pressure/tpfa/cfs_tpfa.h \
|
||||
opm/core/pressure/tpfa/cfs_tpfa_residual.h \
|
||||
opm/core/pressure/tpfa/compr_bc.h \
|
||||
opm/core/pressure/tpfa/compr_quant.h \
|
||||
opm/core/pressure/tpfa/compr_quant_general.h \
|
||||
opm/core/pressure/tpfa/compr_source.h \
|
||||
opm/core/pressure/tpfa/ifs_tpfa.h \
|
||||
opm/core/pressure/tpfa/trans_tpfa.h \
|
||||
opm/core/simulator/BlackoilState.hpp \
|
||||
opm/core/simulator/SimulatorCompressibleTwophase.hpp \
|
||||
opm/core/simulator/SimulatorReport.hpp \
|
||||
opm/core/simulator/SimulatorIncompTwophase.hpp \
|
||||
opm/core/simulator/SimulatorTimer.hpp \
|
||||
opm/core/simulator/TwophaseState.hpp \
|
||||
opm/core/simulator/WellState.hpp \
|
||||
opm/core/transport/CSRMatrixBlockAssembler.hpp \
|
||||
opm/core/transport/CSRMatrixUmfpackSolver.hpp \
|
||||
opm/core/transport/GravityColumnSolver.hpp \
|
||||
opm/core/transport/GravityColumnSolver_impl.hpp \
|
||||
opm/core/transport/ImplicitAssembly.hpp \
|
||||
opm/core/transport/ImplicitTransport.hpp \
|
||||
opm/core/transport/JacobianSystem.hpp \
|
||||
opm/core/transport/NormSupport.hpp \
|
||||
opm/core/transport/SimpleFluid2pWrapper.hpp \
|
||||
opm/core/transport/SinglePointUpwindTwoPhase.hpp \
|
||||
opm/core/transport/reorder/DGBasis.hpp \
|
||||
opm/core/transport/reorder/TransportModelCompressibleTwophase.hpp \
|
||||
opm/core/transport/reorder/TransportModelInterface.hpp \
|
||||
opm/core/transport/reorder/TransportModelTracerTof.hpp \
|
||||
opm/core/transport/reorder/TransportModelTracerTofDiscGal.hpp \
|
||||
opm/core/transport/reorder/TransportModelTwophase.hpp \
|
||||
opm/core/transport/reorder/nlsolvers.h \
|
||||
opm/core/transport/reorder/reordersequence.h \
|
||||
opm/core/transport/reorder/tarjan.h \
|
||||
opm/core/transport/spu_explicit.h \
|
||||
opm/core/transport/spu_implicit.h \
|
||||
opm/core/transport/transport_source.h \
|
||||
opm/core/utility/Average.hpp \
|
||||
opm/core/utility/ColumnExtract.hpp \
|
||||
opm/core/utility/DataMap.hpp \
|
||||
opm/core/utility/ErrorMacros.hpp \
|
||||
opm/core/utility/Factory.hpp \
|
||||
opm/core/utility/MonotCubicInterpolator.hpp \
|
||||
opm/core/utility/NonuniformTableLinear.hpp \
|
||||
opm/core/utility/RootFinders.hpp \
|
||||
opm/core/utility/SparseTable.hpp \
|
||||
opm/core/utility/SparseVector.hpp \
|
||||
opm/core/utility/StopWatch.hpp \
|
||||
opm/core/utility/UniformTableLinear.hpp \
|
||||
opm/core/utility/Units.hpp \
|
||||
opm/core/utility/VelocityInterpolation.hpp \
|
||||
opm/core/utility/WachspressCoord.hpp \
|
||||
opm/core/utility/buildUniformMonotoneTable.hpp \
|
||||
opm/core/utility/have_boost_redef.hpp \
|
||||
opm/core/utility/initState.hpp \
|
||||
opm/core/utility/initState_impl.hpp \
|
||||
opm/core/utility/linInt.hpp \
|
||||
opm/core/utility/linearInterpolation.hpp \
|
||||
opm/core/utility/miscUtilities.hpp \
|
||||
opm/core/utility/miscUtilitiesBlackoil.hpp \
|
||||
opm/core/utility/parameters/Parameter.hpp \
|
||||
opm/core/utility/parameters/ParameterGroup.hpp \
|
||||
opm/core/utility/parameters/ParameterGroup_impl.hpp \
|
||||
opm/core/utility/parameters/ParameterMapItem.hpp \
|
||||
opm/core/utility/parameters/ParameterRequirement.hpp \
|
||||
opm/core/utility/parameters/ParameterStrings.hpp \
|
||||
opm/core/utility/parameters/ParameterTools.hpp \
|
||||
opm/core/utility/parameters/ParameterXML.hpp \
|
||||
opm/core/utility/parameters/tinyxml/tinystr.h \
|
||||
opm/core/utility/parameters/tinyxml/tinyxml.h \
|
||||
opm/core/utility/writeECLData.hpp \
|
||||
opm/core/utility/writeVtkData.hpp \
|
||||
opm/core/vag_format/vag.hpp \
|
||||
opm/core/well.h \
|
||||
opm/core/wells/InjectionSpecification.hpp \
|
||||
opm/core/wells/ProductionSpecification.hpp \
|
||||
opm/core/wells/WellCollection.hpp \
|
||||
opm/core/wells/WellsGroup.hpp \
|
||||
opm/core/wells/WellsManager.hpp
|
||||
|
||||
# ----------------------------------------------------------------------
|
||||
# Optional library constituents.
|
||||
|
||||
if UMFPACK
|
||||
lib_libopmcore_la_SOURCES += \
|
||||
opm/core/linalg/call_umfpack.c \
|
||||
opm/core/linalg/LinearSolverUmfpack.cpp
|
||||
|
||||
nobase_include_HEADERS += \
|
||||
opm/core/linalg/call_umfpack.h \
|
||||
opm/core/linalg/LinearSolverUmfpack.hpp
|
||||
endif
|
||||
|
||||
|
||||
if DUNE_ISTL
|
||||
lib_libopmcore_la_SOURCES += \
|
||||
opm/core/linalg/LinearSolverIstl.cpp
|
||||
|
||||
nobase_include_HEADERS += \
|
||||
opm/core/linalg/LinearSolverIstl.hpp
|
||||
endif
|
||||
|
||||
|
||||
if BUILD_AGMG
|
||||
nodist_lib_libopmcore_la_SOURCES += \
|
||||
$(AGMG_SRCDIR)/dagmg.f90 \
|
||||
$(AGMG_SRCDIR)/dagmg_mumps.f90
|
||||
|
||||
lib_libopmcore_la_SOURCES += \
|
||||
opm/core/linalg/LinearSolverAGMG.cpp
|
||||
|
||||
nobase_include_HEADERS += \
|
||||
opm/core/linalg/LinearSolverAGMG.hpp
|
||||
|
||||
lib_libopmcore_la_LDFLAGS += \
|
||||
$(FCLIBS)
|
||||
endif
|
||||
|
||||
pkgconfigdir = $(libdir)/pkgconfig
|
||||
pkgconfig_DATA = lib/pkgconfig/opm-core.pc
|
||||
124
README
124
README
@@ -39,8 +39,7 @@ DEPENDENCIES FOR DEBIAN BASED DISTRIBUTIONS (Debian Squeeze/Ubuntu Precise)
|
||||
---------------------------------------------------------------------------
|
||||
|
||||
# packages necessary for building
|
||||
sudo apt-get install -y build-essential gfortran pkg-config libtool \
|
||||
automake autoconf
|
||||
sudo apt-get install -y build-essential gfortran cmake cmake-data util-linux
|
||||
|
||||
# packages necessary for documentation
|
||||
sudo apt-get install -y doxygen ghostscript texlive-latex-recommended pgf
|
||||
@@ -62,25 +61,49 @@ sudo apt-get update
|
||||
sudo apt-get install libdune-common-dev libdune-istl-dev libdune-grid-dev
|
||||
|
||||
# libraries necessary for OPM
|
||||
sudo apt-get install -y libxml2-dev
|
||||
sudo apt-get install -y libtinyxml-dev
|
||||
|
||||
Note: You should compile the OPM modules using the same toolchain that
|
||||
was used to build DUNE. Otherwise, you can get strange ABI errors.
|
||||
|
||||
|
||||
DEPENDENCIES FOR SUSE BASED DISTRIBUTIONS
|
||||
-----------------------------------------
|
||||
|
||||
# libraries
|
||||
sudo zypper in blas libblas3 lapack liblapack3 libboost libxml2 umfpack
|
||||
sudo zypper in libblas3 liblapack3 libboost libtinyxml-devel libumfpack
|
||||
|
||||
# tools
|
||||
sudo zypper in gcc automake autoconf git doxygen
|
||||
sudo zypper in gcc cmake git doxygen
|
||||
|
||||
# DUNE libraries
|
||||
sudo zypper ar http://download.opensuse.org/repositories/science/openSUSE_12.2/science.repo
|
||||
sudo zypper in dune-common dune-istl
|
||||
|
||||
|
||||
DEPENDENCIES FOR RHEL BASED DISTRIBUTIONS
|
||||
-----------------------------------------
|
||||
|
||||
# packages necessary for building
|
||||
sudo yum install make gcc-c++ gcc-gfortran cmake28 util-linux
|
||||
|
||||
# packages necessary for documentation
|
||||
sudo yum install doxygen ghostscript texlive
|
||||
|
||||
# packages necessary for version control
|
||||
sudo yum install git
|
||||
|
||||
# basic libraries necessary for both DUNE and OPM
|
||||
sudo yum install boost-devel suitesparse-devel blas-devel lapack-devel
|
||||
|
||||
# libraries necessary for OPM
|
||||
sudo yum install tinyxml-devel
|
||||
|
||||
# optional libraries
|
||||
sudo yum-config-manager --add-repo \
|
||||
http://www.opm-project.org/packages/current/redhat/6/opm.repo
|
||||
sudo yum install libsuperlu3 ert.ecl-devel dune-istl-devel
|
||||
|
||||
DOWNLOADING
|
||||
-----------
|
||||
|
||||
@@ -93,17 +116,65 @@ If you want to contribute, fork OPM/opm-core on github.
|
||||
BUILDING
|
||||
--------
|
||||
|
||||
There are two ways to build the opm-core library:
|
||||
There are two ways to build the opm-core library.
|
||||
|
||||
1. As a stand-alone library.
|
||||
cd opm-core
|
||||
autoreconf -i
|
||||
./configure
|
||||
make -j -l 0.9
|
||||
If you want to install the library:
|
||||
make install
|
||||
or (if installing to /usr/local or similar)
|
||||
sudo make install
|
||||
In this setup we recommend creating an entirely separate directory
|
||||
outside the directory containing the source code and doing the build
|
||||
from that separate directory (termed "the build directory"). This
|
||||
configuration is sometimes referred to as an "out-of-source build".
|
||||
|
||||
As an example, consider the following layout in which "opm-core" refers
|
||||
to the directory containing the package source code as downloaded from
|
||||
GitHub
|
||||
|
||||
workspace
|
||||
|
|
||||
+-- build
|
||||
|
|
||||
+-- opm-core
|
||||
| |
|
||||
| +-- ...
|
||||
| |
|
||||
| +-- opm
|
||||
| |
|
||||
| +-- ...
|
||||
|
||||
We will configure a release-type (optimised) build using traditional
|
||||
Unix Makefiles within the "build" directory. The following command
|
||||
configures the build
|
||||
|
||||
cd path/to/build
|
||||
cmake ../opm-core -DCMAKE_BUILD_TYPE=Release
|
||||
|
||||
If you want to debug the library you should specify the build type
|
||||
"Debug" instead of "Release" in the command above. This will disable
|
||||
optimizations and make it easier to step through the code.
|
||||
|
||||
Building the software then amounts to typing
|
||||
|
||||
make
|
||||
|
||||
in the top-level "build" directory; i.e., the directory from which we
|
||||
invoked the "cmake" utility. On a multi-core computer system you may
|
||||
want to build the software in parallel (make(1)'s "job-server" mode) in
|
||||
order to reduce the total amount of time needed to complete the build.
|
||||
To do so, replace the above "make" command with
|
||||
|
||||
make -j N
|
||||
|
||||
or, possibly,
|
||||
|
||||
nice -20 make -j N
|
||||
|
||||
in which "N" is an integer that should typically not exceed the number
|
||||
of cores in the system.
|
||||
|
||||
Once the library has been built, it can be installed in a central,
|
||||
system-wide location (often in "/usr/local") through the command
|
||||
|
||||
sudo make install
|
||||
|
||||
|
||||
2. As a dune module.
|
||||
- Put the opm-core directory in the same directory
|
||||
@@ -120,5 +191,28 @@ DOCUMENTATION
|
||||
|
||||
Efforts have been made to document the code with Doxygen.
|
||||
In order to build the documentation, enter the command
|
||||
$ doxygen
|
||||
|
||||
make doc
|
||||
|
||||
in the topmost directory.
|
||||
|
||||
|
||||
REPORTING ISSUES
|
||||
----------------
|
||||
|
||||
Issues can be reported in the Git issue tracker online at:
|
||||
|
||||
http://github.com/OPM/opm-core/issues
|
||||
|
||||
To help diagnose build errors, please provide a link to a build log together
|
||||
with the issue description.
|
||||
|
||||
You can capture such a log from the build using the `script' utility, e.g.:
|
||||
|
||||
LOGFILE=$(date +%Y%m%d-%H%M-)build.log ;
|
||||
cmake -E cmake_echo_color --cyan --bold "Log file: $LOGFILE" ;
|
||||
script -q $LOGFILE -c 'cmake ../opm-core -DCMAKE_BUILD_TYPE=Debug' &&
|
||||
script -q $LOGFILE -a -c 'ionice nice make -j 4 -l 3' ||
|
||||
cat CMakeCache.txt CMakeFiles/CMake*.log >> $LOGFILE
|
||||
|
||||
The resulting file can be uploaded to for instance gist.github.com.
|
||||
|
||||
82
cmake/Modules/AddOptions.cmake
Normal file
82
cmake/Modules/AddOptions.cmake
Normal file
@@ -0,0 +1,82 @@
|
||||
# - Add options without repeating them on the command line
|
||||
#
|
||||
# Synopsis:
|
||||
#
|
||||
# add_options (lang build opts)
|
||||
#
|
||||
# where:
|
||||
#
|
||||
# lang Name of the language whose compiler should receive the
|
||||
# options, e.g. CXX. If a comma-separated list is received
|
||||
# then the option is added for all those languages. Use the
|
||||
# special value ALL_LANGUAGES for these languages: CXX, C
|
||||
# and Fortran
|
||||
#
|
||||
# build Kind of build to which this options should apply,
|
||||
# such as DEBUG and RELEASE. This can also be a comma-
|
||||
# separated list. Use the special value ALL_BUILDS to apply
|
||||
# to all builds.
|
||||
#
|
||||
# opts List of options to add. Each should be quoted.
|
||||
#
|
||||
# Example:
|
||||
#
|
||||
# add_options (CXX RELEASE "-O3" "-DNDEBUG" "-Wall")
|
||||
|
||||
function (add_options langs builds)
|
||||
# special handling of empty language specification
|
||||
if ("${langs}" STREQUAL "ALL_LANGUAGES")
|
||||
set (langs CXX C Fortran)
|
||||
endif ("${langs}" STREQUAL "ALL_LANGUAGES")
|
||||
foreach (lang IN LISTS langs)
|
||||
# prepend underscore if necessary
|
||||
foreach (build IN LISTS builds)
|
||||
if (NOT ("${build}" STREQUAL "ALL_BUILDS"))
|
||||
set (_bld "_${build}")
|
||||
string (TOUPPER "${_bld}" _bld)
|
||||
else (NOT ("${build}" STREQUAL "ALL_BUILDS"))
|
||||
set (_bld "")
|
||||
endif (NOT ("${build}" STREQUAL "ALL_BUILDS"))
|
||||
foreach (_opt IN LISTS ARGN)
|
||||
set (_var "CMAKE_${lang}_FLAGS${_bld}")
|
||||
#message (STATUS "Adding \"${_opt}\" to \${${_var}}")
|
||||
# remove it first
|
||||
string (REPLACE "${_opt}" "" _without "${${_var}}")
|
||||
string (STRIP "${_without}" _without)
|
||||
# we need to strip this one as well, so they are comparable
|
||||
string (STRIP "${${_var}}" _stripped)
|
||||
# if it wasn't there, then add it at the end
|
||||
if ("${_without}" STREQUAL "${_stripped}")
|
||||
# don't add any extra spaces if no options yet are set
|
||||
if (NOT ${_stripped} STREQUAL "")
|
||||
set (${_var} "${_stripped} ${_opt}")
|
||||
else (NOT ${_stripped} STREQUAL "")
|
||||
set (${_var} "${_opt}")
|
||||
endif (NOT ${_stripped} STREQUAL "")
|
||||
set (${_var} "${${_var}}" PARENT_SCOPE)
|
||||
endif ("${_without}" STREQUAL "${_stripped}")
|
||||
endforeach (_opt)
|
||||
endforeach (build)
|
||||
endforeach (lang)
|
||||
endfunction (add_options lang build)
|
||||
|
||||
# set varname to flag unless user has specified something that matches regex
|
||||
function (set_default_option varname flag regex)
|
||||
if (NOT "$ENV{CXXFLAGS}" MATCHES "${regex}"
|
||||
AND NOT "${CMAKE_CXX_FLAGS}" MATCHES "${regex}"
|
||||
AND NOT "${CMAKE_CXX_FLAGS_${CMAKE_BUILD_TYPE}}" MATCHES "${regex}")
|
||||
set (${varname} ${flag} PARENT_SCOPE)
|
||||
else (NOT "$ENV{CXXFLAGS}" MATCHES "${regex}"
|
||||
AND NOT "${CMAKE_CXX_FLAGS}" MATCHES "${regex}"
|
||||
AND NOT "${CMAKE_CXX_FLAGS_${CMAKE_BUILD_TYPE}}" MATCHES "${regex}")
|
||||
set (${varname} PARENT_SCOPE)
|
||||
endif (NOT "$ENV{CXXFLAGS}" MATCHES "${regex}"
|
||||
AND NOT "${CMAKE_CXX_FLAGS}" MATCHES "${regex}"
|
||||
AND NOT "${CMAKE_CXX_FLAGS_${CMAKE_BUILD_TYPE}}" MATCHES "${regex}")
|
||||
endfunction (set_default_option)
|
||||
|
||||
# note: this must be called before project()
|
||||
macro (no_default_options)
|
||||
# prevent the platform probe to set options
|
||||
set (CMAKE_NOT_USING_CONFIG_FLAGS TRUE)
|
||||
endmacro (no_default_options)
|
||||
109
cmake/Modules/ConfigVars.cmake
Normal file
109
cmake/Modules/ConfigVars.cmake
Normal file
@@ -0,0 +1,109 @@
|
||||
# - Create config.h based on a list of variables
|
||||
#
|
||||
# Synopsis:
|
||||
# configure_vars (FILE syntax filename verb varlist)
|
||||
# where
|
||||
# syntax CXX or CMAKE, depending on target
|
||||
# filename Full path (including name) of config.h
|
||||
# verb WRITE or APPEND if truncating or not
|
||||
# varlist List of variable names that has been defined
|
||||
#
|
||||
# In addition, this function will define HAVE_CONFIG_H for the
|
||||
# following compilations, (only) if the filename is "config.h".
|
||||
#
|
||||
# Example:
|
||||
# list (APPEND FOO_CONFIG_VARS
|
||||
# "/* bar library */"
|
||||
# "HAVE_BAR"
|
||||
# "HAVE_BAR_VERSION_2"
|
||||
# )
|
||||
# configure_vars (
|
||||
# FILE CXX ${PROJECT_BINARY_DIR}/config.h
|
||||
# WRITE ${FOO_CONFIG_VARS}
|
||||
# )
|
||||
|
||||
# Copyright (C) 2012 Uni Research AS
|
||||
# This file is licensed under the GNU General Public License v3.0
|
||||
|
||||
function (configure_vars obj syntax filename verb)
|
||||
# this is just to make the syntax look like the build-in commands
|
||||
if (NOT ("${obj}" STREQUAL "FILE" AND
|
||||
(("${verb}" STREQUAL "WRITE") OR ("${verb}" STREQUAL "APPEND"))))
|
||||
message (FATAL_ERROR "Syntax error in argument list")
|
||||
endif (NOT ("${obj}" STREQUAL "FILE" AND
|
||||
(("${verb}" STREQUAL "WRITE") OR ("${verb}" STREQUAL "APPEND"))))
|
||||
if (NOT (("${syntax}" STREQUAL "CXX") OR ("${syntax}" STREQUAL "CMAKE")))
|
||||
message (FATAL_ERROR "Invalid target syntax \"${syntax}\"")
|
||||
endif (NOT (("${syntax}" STREQUAL "CXX") OR ("${syntax}" STREQUAL "CMAKE")))
|
||||
|
||||
# truncate the file if the verb was "WRITE"
|
||||
if (verb STREQUAL "WRITE")
|
||||
file (WRITE "${filename}" "")
|
||||
endif (verb STREQUAL "WRITE")
|
||||
|
||||
# whenever we use this, we also signal to the header files that we
|
||||
# have "config.h". add this before any other files (known till now)
|
||||
# to avoid confusion from other configuration files.
|
||||
get_filename_component (_config_path "${filename}" PATH)
|
||||
get_filename_component (_config_file "${filename}" NAME)
|
||||
if ("${_config_file}" MATCHES "config\\.h(\\..+)?")
|
||||
add_definitions (-DHAVE_CONFIG_H=1)
|
||||
include_directories (BEFORE "${_config_path}")
|
||||
endif ("${_config_file}" MATCHES "config\\.h(\\..+)?")
|
||||
|
||||
# only write the current value of each variable once
|
||||
set (_args ${ARGN})
|
||||
if (_args)
|
||||
list (REMOVE_DUPLICATES _args)
|
||||
endif (_args)
|
||||
|
||||
# process each variable
|
||||
set (_prev_verbatim TRUE)
|
||||
foreach (_var IN LISTS _args)
|
||||
|
||||
# massage the name to remove source code formatting
|
||||
string (REGEX REPLACE "^[\\n\\t\\ ]+" "" _var "${_var}")
|
||||
string (REGEX REPLACE "[\\n\\t\\ ]+$" "" _var "${_var}")
|
||||
|
||||
# if the name of a variable has the syntax of a comments, write it
|
||||
# verbatim to the file; this can be used to create headings
|
||||
if ("${_var}" MATCHES "^/[/*]")
|
||||
if (NOT _prev_verbatim)
|
||||
file (APPEND "${filename}" "\n")
|
||||
endif (NOT _prev_verbatim)
|
||||
file (APPEND "${filename}" "${_var}\n")
|
||||
set (_prev_verbatim TRUE)
|
||||
|
||||
else ("${_var}" MATCHES "^/[/*]")
|
||||
|
||||
# check for empty variable; variables that are explicitly set to false
|
||||
# is not included in this clause
|
||||
if ((NOT DEFINED ${_var}) OR ("${${_var}}" STREQUAL ""))
|
||||
if ("${syntax}" STREQUAL "CMAKE")
|
||||
file (APPEND "${filename}" "set (${_var})\n")
|
||||
else ("${syntax}" STREQUAL "CMAKE")
|
||||
file (APPEND "${filename}" "/* #undef ${_var} */\n")
|
||||
endif ("${syntax}" STREQUAL "CMAKE")
|
||||
else ((NOT DEFINED ${_var}) OR ("${${_var}}" STREQUAL ""))
|
||||
|
||||
# integer variables (specifically 0 and 1) are written as they are,
|
||||
# whereas everything else (including version numbers, which could
|
||||
# be interpreted as floats) are quoted as strings
|
||||
if (${_var} MATCHES "[0-9]+")
|
||||
set (_quoted "${${_var}}")
|
||||
else (${_var} MATCHES "[0-9]+")
|
||||
set (_quoted "\"${${_var}}\"")
|
||||
endif (${_var} MATCHES "[0-9]+")
|
||||
|
||||
# write to file using the correct syntax
|
||||
if ("${syntax}" STREQUAL "CMAKE")
|
||||
file (APPEND "${filename}" "set (${_var} ${_quoted})\n")
|
||||
else ("${syntax}" STREQUAL "CMAKE")
|
||||
file (APPEND "${filename}" "#define ${_var} ${_quoted}\n")
|
||||
endif ("${syntax}" STREQUAL "CMAKE")
|
||||
|
||||
endif ((NOT DEFINED ${_var}) OR ("${${_var}}" STREQUAL ""))
|
||||
set (_prev_verbatim FALSE)
|
||||
endif ("${_var}" MATCHES "^/[/*]")
|
||||
endforeach(_var)
|
||||
endfunction (configure_vars obj syntax filename verb)
|
||||
47
cmake/Modules/DuneCompat.cmake
Normal file
47
cmake/Modules/DuneCompat.cmake
Normal file
@@ -0,0 +1,47 @@
|
||||
# - Dunecontrol compatibility
|
||||
#
|
||||
# Enables this build to be a part of a dunecontrol chain. The
|
||||
# DUNE_CHECK_MODULES macro greps the top-level Makefile for the
|
||||
# presence of the abs_top_srcdir variable (!) and uses that as
|
||||
# the include directory of a module. Also, the contents are not
|
||||
# checked so if the variable is not present, it generates an
|
||||
# invalid command line (-I without argument) which causes the
|
||||
# autoconf probe to fail. This module patches our Makefile (!!)
|
||||
# so the necessary string will be there; in itself this string
|
||||
# has no use for us, it is solemnly to satisfy the M4 scripts.
|
||||
|
||||
if (CMAKE_GENERATOR MATCHES "Unix Makefiles")
|
||||
# we need an up-to-date, patched Makefile. this is always checked when
|
||||
# the makefile is run, thus the need for a marker file to keep a
|
||||
# timestamp to see when it was last patched (by us)
|
||||
# amazingly, nothing depends on the generated Makefile, so this can be
|
||||
# run whenever in the build without trigging a compile of e.g. config.h
|
||||
add_custom_target (dune-compat ALL
|
||||
COMMAND ${CMAKE_COMMAND} -DCMAKE_HOME_DIRECTORY=${CMAKE_HOME_DIRECTORY} -P ${PROJECT_SOURCE_DIR}/cmake/Scripts/DuneCompat2.cmake
|
||||
COMMENT "Patching Makefile to be DUNE compatible"
|
||||
)
|
||||
endif (CMAKE_GENERATOR MATCHES "Unix Makefiles")
|
||||
|
||||
# dunecontrol refuses to use a build tree as module directory unless
|
||||
# there is a dune.module in it. however, if we are in a sub-dir. of
|
||||
# the source, we are probably using dunecontrol with a --build-dir
|
||||
# argument, and won't call dunecontrol from the parent (which is the
|
||||
# source dir and most likely doesn't contain other projects) anyway,
|
||||
# i.e. we only copy if we are truly out-of-source
|
||||
string (LENGTH "${PROJECT_SOURCE_DIR}/" _src_dir_len)
|
||||
string (LENGTH "${PROJECT_BINARY_DIR}/" _bin_dir_len)
|
||||
if (_src_dir_len GREATER _bin_dir_len)
|
||||
set (_not_substring TRUE)
|
||||
else (_src_dir_len GREATER _bin_dir_len)
|
||||
string (SUBSTRING "${PROJECT_BINARY_DIR}/" 0 ${_src_dir_len} _proj_prefix)
|
||||
if ("${PROJECT_SOURCE_DIR}/" STREQUAL "${_proj_prefix}")
|
||||
set (_not_substring FALSE)
|
||||
else ("${PROJECT_SOURCE_DIR}/" STREQUAL "${_proj_prefix}")
|
||||
set (_not_substring TRUE)
|
||||
endif ("${PROJECT_SOURCE_DIR}/" STREQUAL "${_proj_prefix}")
|
||||
endif (_src_dir_len GREATER _bin_dir_len)
|
||||
if (_not_substring)
|
||||
execute_process (COMMAND
|
||||
${CMAKE_COMMAND} -E copy_if_different ${PROJECT_SOURCE_DIR}/dune.module ${PROJECT_BINARY_DIR}/dune.module
|
||||
)
|
||||
endif (_not_substring)
|
||||
38
cmake/Modules/Duplicates.cmake
Normal file
38
cmake/Modules/Duplicates.cmake
Normal file
@@ -0,0 +1,38 @@
|
||||
# - Remove duplicate library declarations
|
||||
#
|
||||
# Synopsis:
|
||||
#
|
||||
# remove_duplicate_libraries (module)
|
||||
#
|
||||
# where
|
||||
# module Name of the module whose libraries should be pruned
|
||||
|
||||
# Copyright (C) 2013 Uni Research AS
|
||||
# This file is licensed under the GNU General Public License v3.0
|
||||
|
||||
# libraries should always be trimmed from the beginning, so that also
|
||||
# missing functions in those later in the list will be resolved
|
||||
macro (remove_duplicate_libraries module)
|
||||
if (DEFINED ${module}_LIBRARIES)
|
||||
list (REVERSE ${module}_LIBRARIES)
|
||||
list (REMOVE_DUPLICATES ${module}_LIBRARIES)
|
||||
list (REVERSE ${module}_LIBRARIES)
|
||||
endif (DEFINED ${module}_LIBRARIES)
|
||||
endmacro (remove_duplicate_libraries module)
|
||||
|
||||
# headers can be trimmed from the end, since adding a directory to
|
||||
# the list is an idempotent action
|
||||
macro (remove_duplicate_var module suffix)
|
||||
if (DEFINED ${module}_${suffix})
|
||||
list (REMOVE_DUPLICATES ${module}_${suffix})
|
||||
endif (DEFINED ${module}_${suffix})
|
||||
endmacro (remove_duplicate_var module suffix)
|
||||
|
||||
# fix up both headers and libraries, in case two dependencies have
|
||||
# included the same second-level library independently
|
||||
macro (remove_dup_deps module)
|
||||
remove_duplicate_var (${module} INCLUDE_DIRS)
|
||||
remove_duplicate_var (${module} LINKER_FLAGS)
|
||||
remove_duplicate_var (${module} CONFIG_VARS)
|
||||
remove_duplicate_libraries (${module})
|
||||
endmacro (remove_dup_deps module)
|
||||
44
cmake/Modules/FindAGMG.cmake
Normal file
44
cmake/Modules/FindAGMG.cmake
Normal file
@@ -0,0 +1,44 @@
|
||||
# - Find Notay's Algebraic Multigrid Solver
|
||||
#
|
||||
# Set the path to the source directory of AGMG in the cache variable
|
||||
# AGMG_ROOT.
|
||||
#
|
||||
# Note the difference between AGMG_DIR and AGMG_ROOT. The former will
|
||||
# cause find_package to switch to config mode and search for a file
|
||||
# named agmg-config.cmake, thereby bypassing this module altogether,
|
||||
# whereas the latter communicates the location of the library to this
|
||||
# module.
|
||||
#
|
||||
# When found, add the contents of AGMG_SOURCES to your own list of
|
||||
# sources to compile and link for the target.
|
||||
#
|
||||
# Use define_fc_func from UseFortranWrappers to write FC_FUNC to your
|
||||
# own config.h, and declare the function dagmg using this macro.
|
||||
|
||||
find_file (AGMG_SOURCES
|
||||
dagmg.f90
|
||||
PATHS ${AGMG_ROOT}
|
||||
PATH_SUFFIXES SRC
|
||||
DOC "Yvan Notay's Algebraic Multigrid Solver, Double Precision version"
|
||||
NO_DEFAULT_PATH
|
||||
)
|
||||
|
||||
# make sure that we can compile Fortran code
|
||||
if (AGMG_SOURCES)
|
||||
enable_language (Fortran)
|
||||
endif (AGMG_SOURCES)
|
||||
|
||||
# set value for config.h
|
||||
if (AGMG_SOURCES)
|
||||
set (HAVE_AGMG 1 CACHE INT "Is AGMG present?")
|
||||
else (AGMG_SOURCES)
|
||||
set (HAVE_AGMG "" CACHE INT "Is AGMG present?")
|
||||
endif (AGMG_SOURCES)
|
||||
|
||||
# handle REQUIRED and QUIET standard options
|
||||
include (FindPackageHandleStandardArgs)
|
||||
find_package_handle_standard_args (AGMG
|
||||
DEFAULT_MSG
|
||||
AGMG_SOURCES
|
||||
CMAKE_Fortran_COMPILER_SUPPORTS_F90
|
||||
)
|
||||
25
cmake/Modules/FindC99.cmake
Normal file
25
cmake/Modules/FindC99.cmake
Normal file
@@ -0,0 +1,25 @@
|
||||
# - Module that checks for supported C99 features.
|
||||
|
||||
# macro to only add option once
|
||||
include (AddOptions)
|
||||
|
||||
# try to use compiler flag -std=c99
|
||||
set (C_STD99_FLAGS "-std=c99")
|
||||
|
||||
# incidently, the C++ test is so simple that it can be used to compile C as well
|
||||
include (CheckCCompilerFlag)
|
||||
check_c_compiler_flag (${C_STD99_FLAGS} HAVE_C99)
|
||||
|
||||
# add option if we are capable
|
||||
if (HAVE_C99)
|
||||
add_options (C ALL_BUILDS "${C_STD99_FLAGS}")
|
||||
else (HAVE_C99)
|
||||
set (C_STD99_FLAGS)
|
||||
endif (HAVE_C99)
|
||||
|
||||
# handle quiet and required
|
||||
include (FindPackageHandleStandardArgs)
|
||||
find_package_handle_standard_args (C99
|
||||
DEFAULT_MSG
|
||||
C_STD99_FLAGS
|
||||
)
|
||||
282
cmake/Modules/FindCXX11Features.cmake
Normal file
282
cmake/Modules/FindCXX11Features.cmake
Normal file
@@ -0,0 +1,282 @@
|
||||
#
|
||||
# Module that checks for supported C++11 (former C++0x) features.
|
||||
#
|
||||
# Sets the follwing variable:
|
||||
#
|
||||
# HAVE_NULLPTR True if nullptr is available
|
||||
# HAVE_ARRAY True if header <array> and fill() are available
|
||||
# HAVE_ATTRIBUTE_ALWAYS_INLINE True if attribute always inline is supported
|
||||
# HAS_ATTRIBUTE_UNUSED True if attribute unused is supported
|
||||
# HAS_ATTRIBUTE_DEPRECATED True if attribute deprecated is supported
|
||||
# HAS_ATTRIBUTE_DEPRECATED_MSG True if attribute deprecated("msg") is supported
|
||||
# HAVE_CONSTEXPR True if constexpr attribute is available
|
||||
# HAVE_INTEGRAL_CONSTANT True if compiler supports integral_constant
|
||||
# HAVE_STATIC_ASSERT True if static_assert is available
|
||||
# HAVE_VARIADIC_TEMPLATES True if variadic templates are supprt
|
||||
# HAVE_VARIADIC_CONSTRUCTOR_SFINAE True if variadic constructor sfinae is supported
|
||||
# HAVE_RVALUE_REFERENCES True if rvalue references are supported
|
||||
# HAVE_TUPLE True if std::tuple is available
|
||||
# HAVE_TR1_TUPLE True if std::tr1::tuple is available
|
||||
|
||||
# test for C++11 flags
|
||||
include(TestCXXAcceptsFlag)
|
||||
include(CheckIncludeFileCXX)
|
||||
|
||||
# macro to only add option once
|
||||
include(AddOptions)
|
||||
|
||||
# try to use compiler flag -std=c++11
|
||||
CHECK_CXX_ACCEPTS_FLAG("-std=c++11" CXX_FLAG_CXX11)
|
||||
if(CXX_FLAG_CXX11)
|
||||
add_options (CXX ALL_BUILDS "-std=c++11")
|
||||
set(CXX_STD0X_FLAGS "-std=c++11")
|
||||
else()
|
||||
# try to use compiler flag -std=c++0x for older compilers
|
||||
CHECK_CXX_ACCEPTS_FLAG("-std=c++0x" CXX_FLAG_CXX0X)
|
||||
if(CXX_FLAG_CXX0X)
|
||||
add_options (CXX ALL_BUILDS "-std=c++0x")
|
||||
set(CXX_STD0X_FLAGS "-std=c++0x")
|
||||
endif(CXX_FLAG_CXX0X)
|
||||
endif(CXX_FLAG_CXX11)
|
||||
|
||||
# perform tests
|
||||
include(CheckCXXSourceCompiles)
|
||||
|
||||
# nullptr
|
||||
CHECK_CXX_SOURCE_COMPILES("
|
||||
int main(void)
|
||||
{
|
||||
char* ch = nullptr;
|
||||
return 0;
|
||||
}
|
||||
" HAVE_NULLPTR
|
||||
)
|
||||
|
||||
# constexpr
|
||||
CHECK_CXX_SOURCE_COMPILES("
|
||||
template <class T>
|
||||
inline constexpr int foo(T bar) { return bar*2; }
|
||||
int main(void)
|
||||
{
|
||||
constexpr int foobar = foo(100);
|
||||
return 0;
|
||||
}
|
||||
" HAVE_CONSTEXPR
|
||||
)
|
||||
|
||||
# array and fill
|
||||
CHECK_CXX_SOURCE_COMPILES("
|
||||
#include <array>
|
||||
|
||||
int main(void)
|
||||
{
|
||||
std::array<int,2> a;
|
||||
a.fill(9);
|
||||
return 0;
|
||||
}
|
||||
" HAVE_ARRAY
|
||||
)
|
||||
|
||||
# Check whether if std::integral_constant< T, v > is supported and casts into T
|
||||
CHECK_CXX_SOURCE_COMPILES("
|
||||
#include <type_traits>
|
||||
void f( int ){}
|
||||
|
||||
int main(void){
|
||||
f( std::integral_constant< int, 42 >() );
|
||||
}
|
||||
" HAVE_INTEGRAL_CONSTANT
|
||||
)
|
||||
|
||||
# Check whether if <tuple> is available
|
||||
check_include_file_cxx("tuple" HAVE_TUPLE)
|
||||
|
||||
# Check whether if <tr1/tuple> is available
|
||||
check_include_file_cxx("tr1/tuple" HAVE_TR1_TUPLE)
|
||||
|
||||
# __attribute__((always_inline))
|
||||
CHECK_CXX_SOURCE_COMPILES("
|
||||
void __attribute__((always_inline)) foo(void) {}
|
||||
int main(void)
|
||||
{
|
||||
foo();
|
||||
return 0;
|
||||
};
|
||||
" HAVE_ATTRIBUTE_ALWAYS_INLINE
|
||||
)
|
||||
|
||||
# __attribute__((unused))
|
||||
CHECK_CXX_SOURCE_COMPILES("
|
||||
int main(void)
|
||||
{
|
||||
int __attribute__((unused)) foo;
|
||||
return 0;
|
||||
};
|
||||
" HAS_ATTRIBUTE_UNUSED
|
||||
)
|
||||
|
||||
# __attribute__((deprecated))
|
||||
CHECK_CXX_SOURCE_COMPILES("
|
||||
#define DEP __attribute__((deprecated))
|
||||
class bar
|
||||
{
|
||||
bar() DEP;
|
||||
};
|
||||
|
||||
class peng { } DEP;
|
||||
|
||||
template <class T>
|
||||
class t_bar
|
||||
{
|
||||
t_bar() DEP;
|
||||
};
|
||||
|
||||
template <class T>
|
||||
class t_peng {
|
||||
t_peng() {};
|
||||
} DEP;
|
||||
|
||||
void foo() DEP;
|
||||
|
||||
void foo() {};
|
||||
|
||||
int main(void)
|
||||
{
|
||||
return 0;
|
||||
};
|
||||
" HAS_ATTRIBUTE_DEPRECATED
|
||||
)
|
||||
|
||||
# __attribute__((deprecated("msg")))
|
||||
CHECK_CXX_SOURCE_COMPILES("
|
||||
#define DEP __attribute__((deprecated(\"message\")))
|
||||
class bar {
|
||||
bar() DEP;
|
||||
};
|
||||
|
||||
class peng { } DEP;
|
||||
|
||||
template <class T>
|
||||
class t_bar
|
||||
{
|
||||
t_bar() DEP;
|
||||
};
|
||||
|
||||
template <class T>
|
||||
class t_peng
|
||||
{
|
||||
t_peng() {};
|
||||
} DEP;
|
||||
|
||||
void foo() DEP;
|
||||
|
||||
void foo() {};
|
||||
|
||||
int main(void)
|
||||
{
|
||||
return 0;
|
||||
};
|
||||
" HAS_ATTRIBUTE_DEPRECATED_MSG
|
||||
)
|
||||
|
||||
# static assert
|
||||
CHECK_CXX_SOURCE_COMPILES("
|
||||
int main(void)
|
||||
{
|
||||
static_assert(true,\"MSG\");
|
||||
return 0;
|
||||
}
|
||||
" HAVE_STATIC_ASSERT
|
||||
)
|
||||
|
||||
# variadic template support
|
||||
CHECK_CXX_SOURCE_COMPILES("
|
||||
#include <cassert>
|
||||
|
||||
template<typename... T>
|
||||
int addints(T... x);
|
||||
|
||||
int add_ints()
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
template<typename T1, typename... T>
|
||||
int add_ints(T1 t1, T... t)
|
||||
{
|
||||
return t1 + add_ints(t...);
|
||||
}
|
||||
|
||||
int main(void)
|
||||
{
|
||||
assert( 5 == add_ints(9,3,-5,-2) );
|
||||
return 0;
|
||||
}
|
||||
" HAVE_VARIADIC_TEMPLATES
|
||||
)
|
||||
|
||||
# SFINAE on variadic template constructors within template classes
|
||||
CHECK_CXX_SOURCE_COMPILES("
|
||||
#include <functional>
|
||||
|
||||
template<typename... U>
|
||||
struct A
|
||||
{
|
||||
template<typename... T,
|
||||
typename = typename std::enable_if<(sizeof...(T) < 2)>::type
|
||||
>
|
||||
A(T... t)
|
||||
: i(1)
|
||||
{}
|
||||
|
||||
template<typename... T,
|
||||
typename = typename std::enable_if<(sizeof...(T) >= 2)>::type,
|
||||
typename = void
|
||||
>
|
||||
A(T... t)
|
||||
: i(-1)
|
||||
{}
|
||||
|
||||
A()
|
||||
: i(1)
|
||||
{}
|
||||
|
||||
int i;
|
||||
};
|
||||
|
||||
int main(void)
|
||||
{
|
||||
return (A<int>().i + A<int>(2).i + A<int>(\"foo\",3.4).i + A<int>(8,'a',A<int>()).i == 0 ? 0 : 1);
|
||||
}
|
||||
" HAVE_VARIADIC_CONSTRUCTOR_SFINAE
|
||||
)
|
||||
|
||||
# rvalue references
|
||||
CHECK_CXX_SOURCE_COMPILES("
|
||||
#include <cassert>
|
||||
#include <utility>
|
||||
int foo(int&& x) { return 1; }
|
||||
int foo(const int& x) { return -1; }
|
||||
|
||||
template<typename T>
|
||||
int forward(T&& x)
|
||||
{
|
||||
return foo(std::forward<T>(x));
|
||||
}
|
||||
|
||||
int main(void)
|
||||
{
|
||||
int i = 0;
|
||||
assert( forward(i) + forward(int(2)) == 0);
|
||||
return 0;
|
||||
}
|
||||
" HAVE_RVALUE_REFERENCES
|
||||
)
|
||||
include(CheckIncludeFile)
|
||||
include(CheckIncludeFileCXX)
|
||||
# Search for some tr1 headers
|
||||
foreach(_HEADER tuple tr1/tuple type_traits tr1/type_traits)
|
||||
string(REPLACE "/" "_" _HEADER_VAR ${_HEADER})
|
||||
string(TOUPPER ${_HEADER_VAR} _HEADER_VAR )
|
||||
check_include_file_cxx(${_HEADER} "HAVE_${_HEADER_VAR}")
|
||||
endforeach(_HEADER tuple tr1/tuple tr1/type_traits)
|
||||
218
cmake/Modules/FindERT.cmake
Normal file
218
cmake/Modules/FindERT.cmake
Normal file
@@ -0,0 +1,218 @@
|
||||
# - Find the Ensemble-based Reservoir Tool (ERT)
|
||||
#
|
||||
# Set the cache variable ERT_ROOT to the install location of the ERT
|
||||
# libraries and header files.
|
||||
#
|
||||
# If found, it sets these variables:
|
||||
#
|
||||
# ERT_INCLUDE_DIRS Header file directories
|
||||
# ERT_LIBRARIES Archives and shared objects
|
||||
# ERT_CONFIG_VARS Definitions that goes in config.h
|
||||
# ERT_LINKER_FLAGS Options that must be passed to linker
|
||||
#
|
||||
# It will also add to CMAKE_C_FLAGS and CMAKE_CXX_FLAGS if necessary to
|
||||
# link with the ERT libraries.
|
||||
|
||||
# variables to pass on to other packages
|
||||
if (FIND_QUIETLY)
|
||||
set (ERT_QUIET "QUIET")
|
||||
else (FIND_QUIETLY)
|
||||
set (ERT_QUIET "")
|
||||
endif (FIND_QUIETLY)
|
||||
|
||||
# if a directory has been specified by the user, then don't go look
|
||||
# in the system directories as well
|
||||
if (ERT_ROOT)
|
||||
set (_no_default_path "NO_DEFAULT_PATH")
|
||||
else (ERT_ROOT)
|
||||
set (_no_default_path "")
|
||||
endif (ERT_ROOT)
|
||||
|
||||
# ERT doesn't have any config-mode file, so we need to specify the root
|
||||
# directory in its own variable
|
||||
find_path (ERT_ECL_INCLUDE_DIR
|
||||
NAMES "ert/ecl/ecl_util.h"
|
||||
HINTS "${ERT_ROOT}"
|
||||
PATHS "../ert"
|
||||
PATH_SUFFIXES "devel/libecl/include/" "include"
|
||||
DOC "Path to ERT Eclipse library header files"
|
||||
${_no_default_path}
|
||||
)
|
||||
find_path (ERT_UTIL_INCLUDE_DIR
|
||||
NAMES "ert/util/stringlist.h"
|
||||
HINTS "${ERT_ROOT}"
|
||||
PATHS "../ert"
|
||||
PATH_SUFFIXES "devel/libert_util/include/" "include"
|
||||
DOC "Path to ERT Eclipse library header files"
|
||||
${_no_default_path}
|
||||
)
|
||||
find_path (ERT_GEN_INCLUDE_DIR
|
||||
NAMES "ert/util/int_vector.h"
|
||||
HINTS "${ERT_ROOT}"
|
||||
PATHS "${PROJECT_BINARY_DIR}/../ert" "${PROJECT_BINARY_DIR}/../ert-build"
|
||||
"${PROJECT_BINARY_DIR}/../ert/devel"
|
||||
PATH_SUFFIXES "libert_util/include/" "include"
|
||||
DOC "Path to ERT generated library header files"
|
||||
${_no_default_path}
|
||||
)
|
||||
|
||||
# need all of these libraries
|
||||
if (CMAKE_SIZEOF_VOID_P)
|
||||
math (EXPR _BITS "8 * ${CMAKE_SIZEOF_VOID_P}")
|
||||
endif (CMAKE_SIZEOF_VOID_P)
|
||||
find_library (ERT_LIBRARY_ECL
|
||||
NAMES "ecl"
|
||||
HINTS "${ERT_ROOT}"
|
||||
PATHS "${PROJECT_BINARY_DIR}/../ert" "${PROJECT_BINARY_DIR}/../ert-build"
|
||||
"${PROJECT_BINARY_DIR}/../ert/devel"
|
||||
PATH_SUFFIXES "lib" "lib${_BITS}" "lib/${CMAKE_LIBRARY_ARCHITECTURE}"
|
||||
DOC "Path to ERT Eclipse library archive/shared object files"
|
||||
${_no_default_path}
|
||||
)
|
||||
find_library (ERT_LIBRARY_GEOMETRY
|
||||
NAMES "ert_geometry"
|
||||
HINTS "${ERT_ROOT}"
|
||||
PATHS "${PROJECT_BINARY_DIR}/../ert" "${PROJECT_BINARY_DIR}/../ert-build"
|
||||
"${PROJECT_BINARY_DIR}/../ert/devel"
|
||||
PATH_SUFFIXES "lib" "lib${_BITS}" "lib/${CMAKE_LIBRARY_ARCHITECTURE}"
|
||||
DOC "Path to ERT Geometry library archive/shared object files"
|
||||
${_no_default_path}
|
||||
)
|
||||
find_library (ERT_LIBRARY_UTIL
|
||||
NAMES "ert_util"
|
||||
HINTS "${ERT_ROOT}"
|
||||
PATHS "${PROJECT_BINARY_DIR}/../ert" "${PROJECT_BINARY_DIR}/../ert-build"
|
||||
"${PROJECT_BINARY_DIR}/../ert/devel"
|
||||
PATH_SUFFIXES "lib" "lib${_BITS}" "lib/${CMAKE_LIBRARY_ARCHITECTURE}"
|
||||
DOC "Path to ERT Utilities library archive/shared object files"
|
||||
${_no_default_path}
|
||||
)
|
||||
# the "library" found here is actually a list of several files
|
||||
list (APPEND ERT_INCLUDE_DIR
|
||||
${ERT_ECL_INCLUDE_DIR}
|
||||
${ERT_UTIL_INCLUDE_DIR}
|
||||
${ERT_GEN_INCLUDE_DIR}
|
||||
)
|
||||
list (APPEND ERT_LIBRARY
|
||||
${ERT_LIBRARY_ECL}
|
||||
${ERT_LIBRARY_GEOMETRY}
|
||||
${ERT_LIBRARY_UTIL}
|
||||
)
|
||||
list (APPEND ERT_LIBRARIES ${ERT_LIBRARY})
|
||||
list (APPEND ERT_INCLUDE_DIRS ${ERT_INCLUDE_DIR})
|
||||
|
||||
# if we didn't find any files, then don't proceed through the entire dependency list
|
||||
include (FindPackageHandleStandardArgs)
|
||||
if (ERT_INCLUDE_DIR MATCHES "-NOTFOUND" OR ERT_LIBRARIES MATCHES "-NOTFOUND")
|
||||
find_package_handle_standard_args (ERT
|
||||
DEFAULT_MSG
|
||||
ERT_INCLUDE_DIR ERT_LIBRARY
|
||||
)
|
||||
# write unsuccessful result to the cache, as the check_c_source_compiles
|
||||
# would do if it failed
|
||||
set (HAVE_ERT)
|
||||
set (HAVE_ERT "${HAVE_ERT}" CACHE INTERNAL "Did an ERT sample program compile?")
|
||||
return ()
|
||||
endif (ERT_INCLUDE_DIR MATCHES "-NOTFOUND" OR ERT_LIBRARIES MATCHES "-NOTFOUND")
|
||||
|
||||
# these system variables are probed for, and used in HEADER files (sic)
|
||||
list (APPEND ERT_CONFIG_VARS
|
||||
HAVE_ISFINITE
|
||||
HAVE_GLOB
|
||||
HAVE_FORK
|
||||
HAVE_GETUID
|
||||
HAVE_LOCKF
|
||||
HAVE_OPENDIR
|
||||
HAVE_PROC
|
||||
HAVE_READLINKAT
|
||||
HAVE_SYMLINK
|
||||
HAVE_VA_COPY
|
||||
)
|
||||
include (CheckSymbolExists)
|
||||
include (CheckFunctionExists)
|
||||
check_symbol_exists (isfinite math.h HAVE_ISFINITE)
|
||||
check_function_exists (glob HAVE_GLOB)
|
||||
check_function_exists (fork HAVE_FORK)
|
||||
check_function_exists (getuid HAVE_GETUID)
|
||||
check_function_exists (lockf HAVE_LOCKF)
|
||||
check_function_exists (opendir HAVE_OPENDIR)
|
||||
check_function_exists (readlinkat HAVE_READLINKAT)
|
||||
check_function_exists (symlink HAVE_SYMLINK)
|
||||
check_symbol_exists (va_copy stdarg.h HAVE_VA_COPY)
|
||||
|
||||
if (UNIX)
|
||||
set (HAVE_PROC 1)
|
||||
else (UNIX)
|
||||
set (HAVE_PROC)
|
||||
endif (UNIX)
|
||||
|
||||
# dependencies
|
||||
|
||||
# parallel programming
|
||||
include (UseOpenMP)
|
||||
find_openmp (ERT)
|
||||
|
||||
# compression library
|
||||
find_package (ZLIB ${ERT_QUIET})
|
||||
if (ZLIB_FOUND)
|
||||
list (APPEND ERT_INCLUDE_DIRS ${ZLIB_INCLUDE_DIRS})
|
||||
list (APPEND ERT_LIBRARIES ${ZLIB_LIBRARIES})
|
||||
endif (ZLIB_FOUND)
|
||||
|
||||
# numerics
|
||||
find_package (BLAS ${ERT_QUIET})
|
||||
if (BLAS_FOUND)
|
||||
list (APPEND ERT_INCLUDE_DIRS ${BLAS_INCLUDE_DIRS})
|
||||
list (APPEND ERT_LIBRARIES ${BLAS_LIBRARIES})
|
||||
list (APPEND ERT_LINKER_FLAGS ${BLAS_LINKER_FLAGS})
|
||||
endif (BLAS_FOUND)
|
||||
find_package (LAPACK ${ERT_QUIET})
|
||||
if (LAPACK_FOUND)
|
||||
list (APPEND ERT_INCLUDE_DIRS ${LAPACK_INCLUDE_DIRS})
|
||||
list (APPEND ERT_LIBRARIES ${LAPACK_LIBRARIES})
|
||||
list (APPEND ERT_LINKER_FLAGS ${LAPACK_LINKER_FLAGS})
|
||||
endif (LAPACK_FOUND)
|
||||
|
||||
# math library (should exist on all unices; automatically linked on Windows)
|
||||
if (UNIX)
|
||||
find_library (MATH_LIBRARY
|
||||
NAMES "m"
|
||||
)
|
||||
list (APPEND ERT_LIBRARIES ${MATH_LIBRARY})
|
||||
endif (UNIX)
|
||||
|
||||
# since OpenMP often implies pthreads, we need to tidy up
|
||||
# (last instance of library must be left standing, thus reversing that
|
||||
# list before removing duplicates)
|
||||
include (Duplicates)
|
||||
remove_dup_deps (ERT)
|
||||
|
||||
# see if we can compile a minimum example
|
||||
# CMake logical test doesn't handle lists (sic)
|
||||
if (NOT (ERT_INCLUDE_DIR MATCHES "-NOTFOUND" OR ERT_LIBRARIES MATCHES "-NOTFOUND"))
|
||||
include (CMakePushCheckState)
|
||||
include (CheckCSourceCompiles)
|
||||
cmake_push_check_state ()
|
||||
set (CMAKE_REQUIRED_INCLUDES ${ERT_INCLUDE_DIR})
|
||||
set (CMAKE_REQUIRED_LIBRARIES ${ERT_LIBRARIES})
|
||||
check_c_source_compiles (
|
||||
"#include <ert/ecl/ecl_util.h>
|
||||
int main (void) {
|
||||
int sz;
|
||||
sz = ecl_util_get_sizeof_ctype (ECL_INT_TYPE);
|
||||
return 0;
|
||||
}" HAVE_ERT)
|
||||
cmake_pop_check_state ()
|
||||
else (NOT (ERT_INCLUDE_DIR MATCHES "-NOTFOUND" OR ERT_LIBRARIES MATCHES "-NOTFOUND"))
|
||||
# write unsuccessful result to the cache, as the check_c_source_compiles
|
||||
# would do if it failed
|
||||
set (HAVE_ERT)
|
||||
set (HAVE_ERT "${HAVE_ERT}" CACHE INTERNAL "Did an ERT sample program compile?")
|
||||
endif (NOT (ERT_INCLUDE_DIR MATCHES "-NOTFOUND" OR ERT_LIBRARIES MATCHES "-NOTFOUND"))
|
||||
|
||||
# if the test program didn't compile, but was required to do so, bail
|
||||
# out now and display an error; otherwise limp on
|
||||
find_package_handle_standard_args (ERT
|
||||
DEFAULT_MSG
|
||||
ERT_INCLUDE_DIR ERT_LIBRARY HAVE_ERT
|
||||
)
|
||||
285
cmake/Modules/FindSuiteSparse.cmake
Normal file
285
cmake/Modules/FindSuiteSparse.cmake
Normal file
@@ -0,0 +1,285 @@
|
||||
# - Find Tim Davis' SuiteSparse collection of sparse matrix libraries
|
||||
#
|
||||
# Synopsis:
|
||||
# find_package (SuiteSparse COMPONENTS <list-of-components>)
|
||||
#
|
||||
# Components are:
|
||||
# amd Approximate Minimum Degree ordering
|
||||
# camd Constrained Approximate Minimum Degree ordering
|
||||
# colamd COLumn Approximate Minimum Degree ordering
|
||||
# ccolamd Constrained COLumn Approximate Minimum Degree ordering
|
||||
# cholmod Supernodal sparse Cholesky factorization and update
|
||||
# umfpack Unsymmetric MultiFrontal sparse LU factorization
|
||||
#
|
||||
# The following variables will be set:
|
||||
#
|
||||
# SuiteSparse_FOUND True if all dependencies are satisfied
|
||||
# SuiteSparse_Xxx_FOUND True if module Xxx is found
|
||||
# HAVE_SUITESPARSE_Xxx_H Binary value indicating presence of header
|
||||
# SuiteSparse_INCLUDE_DIRS Paths containing the SuiteSparse header files
|
||||
# SuiteSparse_LIBRARIES Name of the libraries which must be linked
|
||||
# SuiteSparse_DEFINITIONS Defines that must be passed to the compiler
|
||||
# SuiteSparse_LINKER_FLAGS Options that must be passed when linking
|
||||
#
|
||||
# See <http://www.cise.ufl.edu/research/sparse/SuiteSparse>.
|
||||
|
||||
# Copyright (C) 2012 Uni Research AS
|
||||
# This file is licensed under the GNU General Public License v3.0
|
||||
|
||||
function (try_compile_umfpack varname)
|
||||
include (CMakePushCheckState)
|
||||
include (CheckCSourceCompiles)
|
||||
cmake_push_check_state ()
|
||||
set (CMAKE_REQUIRED_INCLUDES ${UMFPACK_INCLUDE_DIRS})
|
||||
set (CMAKE_REQUIRED_LIBRARIES ${UMFPACK_LIBRARY} ${ARGN} ${SuiteSparse_EXTRA_LIBS})
|
||||
check_c_source_compiles (
|
||||
"#include <umfpack.h>
|
||||
int main (void) {
|
||||
void *Symbolic, *Numeric;
|
||||
double Info[UMFPACK_INFO], Control[UMFPACK_CONTROL];
|
||||
umfpack_dl_defaults(Control);
|
||||
umfpack_dl_symbolic(0, 0, 0, 0, 0,
|
||||
&Symbolic, Control, Info);
|
||||
umfpack_dl_numeric (0, 0, 0,
|
||||
Symbolic, &Numeric, Control, Info);
|
||||
umfpack_dl_free_symbolic(&Symbolic);
|
||||
umfpack_dl_solve(UMFPACK_A, 0, 0, 0, 0, 0,
|
||||
Numeric, Control, Info);
|
||||
umfpack_dl_free_numeric(&Numeric);
|
||||
umfpack_timer ();
|
||||
return 0;
|
||||
}" ${varname})
|
||||
cmake_pop_check_state ()
|
||||
set (${varname} "${${varname}}" PARENT_SCOPE)
|
||||
endfunction (try_compile_umfpack varname)
|
||||
|
||||
# variables to pass on to other packages
|
||||
if (FIND_QUIETLY)
|
||||
set (SuiteSparse_QUIET "QUIET")
|
||||
else (FIND_QUIETLY)
|
||||
set (SuiteSparse_QUIET "")
|
||||
endif (FIND_QUIETLY)
|
||||
|
||||
# we need to link to BLAS and LAPACK
|
||||
if (NOT BLAS_FOUND)
|
||||
find_package (BLAS ${SuiteSparse_QUIET} REQUIRED)
|
||||
endif (NOT BLAS_FOUND)
|
||||
if (NOT LAPACK_FOUND)
|
||||
find_package (LAPACK ${SuiteSparse_QUIET} REQUIRED)
|
||||
endif (NOT LAPACK_FOUND)
|
||||
|
||||
# we also need the math part of the runtime library
|
||||
find_library (MATH_LIBRARY NAMES "m")
|
||||
set (SuiteSparse_EXTRA_LIBS ${LAPACK_LIBRARIES} ${BLAS_LIBRARIES} ${MATH_LIBRARY})
|
||||
|
||||
# search paths for the library outside of standard system paths. these are the
|
||||
# paths in which the package managers on various distros put the files
|
||||
list (APPEND SuiteSparse_SEARCH_PATH "/usr") # Linux
|
||||
list (APPEND SuiteSparse_SEARCH_PATH "/opt/local") # MacOS X
|
||||
|
||||
# if we don't get any further clues about where to look, then start
|
||||
# roaming around the system
|
||||
set (_no_default_path "")
|
||||
|
||||
# pick up paths from the environment if specified there; these replace the
|
||||
# pre-defined paths so that we don't accidentially pick up old stuff
|
||||
if (NOT $ENV{SuiteSparse_DIR} STREQUAL "")
|
||||
set (SuiteSparse_SEARCH_PATH "$ENV{SuiteSparse_DIR}")
|
||||
set (_no_default_path "NO_DEFAULT_PATH")
|
||||
endif (NOT $ENV{SuiteSparse_DIR} STREQUAL "")
|
||||
if (${SuiteSparse_DIR})
|
||||
set (SuiteSparse_SEARCH_PATH "${SuiteSparse_DIR}")
|
||||
set (_no_default_path "NO_DEFAULT_PATH")
|
||||
endif (${SuiteSparse_DIR})
|
||||
# CMake uses _DIR suffix as default for config-mode files; it is unlikely
|
||||
# that we are building SuiteSparse ourselves; use _ROOT suffix to specify
|
||||
# location to pre-canned binaries
|
||||
if (NOT $ENV{SuiteSparse_ROOT} STREQUAL "")
|
||||
set (SuiteSparse_SEARCH_PATH "$ENV{SuiteSparse_ROOT}")
|
||||
set (_no_default_path "NO_DEFAULT_PATH")
|
||||
endif (NOT $ENV{SuiteSparse_ROOT} STREQUAL "")
|
||||
if (${SuiteSparse_ROOT})
|
||||
set (SuiteSparse_SEARCH_PATH "${SuiteSparse_ROOT}")
|
||||
set (_no_default_path "NO_DEFAULT_PATH")
|
||||
endif (${SuiteSparse_ROOT})
|
||||
|
||||
# transitive closure of dependencies; after this SuiteSparse_MODULES is the
|
||||
# full list of modules that must be found to satisfy the user's link demands
|
||||
set (SuiteSparse_MODULES ${SuiteSparse_FIND_COMPONENTS})
|
||||
list (FIND SuiteSparse_MODULES "umfpack" UMFPACK_DESIRED)
|
||||
if (NOT UMFPACK_DESIRED EQUAL -1)
|
||||
list (APPEND SuiteSparse_MODULES amd cholmod)
|
||||
endif (NOT UMFPACK_DESIRED EQUAL -1)
|
||||
list (FIND SuiteSparse_MODULES "cholmod" CHOLMOD_DESIRED)
|
||||
if (NOT CHOLMOD_DESIRED EQUAL -1)
|
||||
list (APPEND SuiteSparse_MODULES amd camd colamd)
|
||||
endif (NOT CHOLMOD_DESIRED EQUAL -1)
|
||||
if (SuiteSparse_MODULES)
|
||||
list (REMOVE_DUPLICATES SuiteSparse_MODULES)
|
||||
endif (SuiteSparse_MODULES)
|
||||
|
||||
# if someone else already have found all the packages for us, then don't do anything
|
||||
set (SuiteSparse_EVERYTHING_FOUND TRUE)
|
||||
foreach (module IN LISTS SuiteSparse_MODULES)
|
||||
string (TOUPPER ${module} MODULE)
|
||||
if (NOT SuiteSparse_${MODULE}_FOUND)
|
||||
set (SuiteSparse_EVERYTHING_FOUND FALSE)
|
||||
break ()
|
||||
endif (NOT SuiteSparse_${MODULE}_FOUND)
|
||||
endforeach (module)
|
||||
if (SuiteSparse_EVERYTHING_FOUND)
|
||||
return ()
|
||||
endif (SuiteSparse_EVERYTHING_FOUND)
|
||||
|
||||
# only search in architecture-relevant directory
|
||||
if (CMAKE_SIZEOF_VOID_P)
|
||||
math (EXPR _BITS "8 * ${CMAKE_SIZEOF_VOID_P}")
|
||||
endif (CMAKE_SIZEOF_VOID_P)
|
||||
|
||||
# if SuiteSparse >= 4.0 we must also link with libsuitesparseconfig
|
||||
# assume that this is the case if we find the library; otherwise just
|
||||
# ignore it (older versions don't have a file named like this)
|
||||
find_library (config_LIBRARY
|
||||
NAMES suitesparseconfig
|
||||
PATHS ${SuiteSparse_SEARCH_PATH}
|
||||
PATH_SUFFIXES ".libs" "lib" "lib${_BITS}" "lib/${CMAKE_LIBRARY_ARCHITECTURE}" "lib/ufsparse"
|
||||
${_no_default_path}
|
||||
)
|
||||
if (config_LIBRARY)
|
||||
list (APPEND SuiteSparse_EXTRA_LIBS ${config_LIBRARY})
|
||||
# POSIX.1-2001 REALTIME portion require us to link this library too for
|
||||
# clock_gettime() which is used by suitesparseconfig
|
||||
if ("${CMAKE_SYSTEM_NAME}" MATCHES "Linux")
|
||||
list (APPEND SuiteSparse_EXTRA_LIBS "-lrt")
|
||||
endif ("${CMAKE_SYSTEM_NAME}" MATCHES "Linux")
|
||||
endif (config_LIBRARY)
|
||||
|
||||
# search filesystem for each of the module individually
|
||||
foreach (module IN LISTS SuiteSparse_MODULES)
|
||||
string (TOUPPER ${module} MODULE)
|
||||
# search for files which implements this module
|
||||
find_path (${MODULE}_INCLUDE_DIR
|
||||
NAMES ${module}.h
|
||||
PATHS ${SuiteSparse_SEARCH_PATH}
|
||||
PATH_SUFFIXES "include" "include/suitesparse" "include/ufsparse"
|
||||
${_no_default_path}
|
||||
)
|
||||
find_library (${MODULE}_LIBRARY
|
||||
NAMES ${module}
|
||||
PATHS ${SuiteSparse_SEARCH_PATH}
|
||||
PATH_SUFFIXES "lib/.libs" "lib" "lib${_BITS}" "lib/${CMAKE_LIBRARY_ARCHITECTURE}" "lib/ufsparse"
|
||||
${_no_default_path}
|
||||
)
|
||||
# start out by including the module itself; other dependencies will be added later
|
||||
set (${MODULE}_INCLUDE_DIRS ${${MODULE}_INCLUDE_DIR})
|
||||
set (${MODULE}_LIBRARIES ${${MODULE}_LIBRARY})
|
||||
endforeach (module)
|
||||
|
||||
# insert any inter-modular dependencies here
|
||||
if (CHOLMOD_LIBRARY)
|
||||
list (APPEND CHOLMOD_LIBRARIES ${AMD_LIBRARIES} ${COLAMD_LIBRARIES})
|
||||
# optional libraries; don't insert any -NOT_FOUND paths
|
||||
if (CAMD_LIBRARY)
|
||||
list (APPEND CHOLMOD_LIBRARIES ${CAMD_LIBRARIES})
|
||||
endif (CAMD_LIBRARY)
|
||||
if (CCOLAMD_LIBRARY)
|
||||
list (APPEND CHOLMOD_LIBRARIES ${CCOLAMD_LIBRARIES})
|
||||
endif (CCOLAMD_LIBRARY)
|
||||
list (REVERSE CHOLMOD_LIBRARIES)
|
||||
# always remove the *first* library from the list
|
||||
list (REMOVE_DUPLICATES CHOLMOD_LIBRARIES)
|
||||
list (REVERSE CHOLMOD_LIBRARIES)
|
||||
endif (CHOLMOD_LIBRARY)
|
||||
if (UMFPACK_LIBRARY)
|
||||
set (UMFPACK_EXTRA_LIBS)
|
||||
# test if umfpack is usable with only amd and not cholmod
|
||||
try_compile_umfpack (HAVE_UMFPACK_WITHOUT_CHOLMOD ${AMD_LIBRARIES})
|
||||
if (HAVE_UMFPACK_WITHOUT_CHOLMOD)
|
||||
list (APPEND UMFPACK_EXTRA_LIBS ${AMD_LIBRARIES})
|
||||
else (HAVE_UMFPACK_WITHOUT_CHOLMOD)
|
||||
if (CHOLMOD_LIBRARIES)
|
||||
try_compile_umfpack (HAVE_UMFPACK_WITH_CHOLMOD ${CHOLMOD_LIBRARIES})
|
||||
if (HAVE_UMFPACK_WITH_CHOLMOD)
|
||||
list (APPEND UMFPACK_EXTRA_LIBS ${CHOLMOD_LIBRARIES})
|
||||
else (HAVE_UMFPACK_WITH_CHOLMOD)
|
||||
set (UMFPACK_EXTRA_LIBS "-NOTFOUND")
|
||||
endif (HAVE_UMFPACK_WITH_CHOLMOD)
|
||||
else (CHOLMOD_LIBRARIES)
|
||||
# if we don't have cholmod, then we certainly cannot have umfpack with cholmod
|
||||
set (UMFPACK_EXTRA_LIBS "-NOTFOUND")
|
||||
endif (CHOLMOD_LIBRARIES)
|
||||
endif (HAVE_UMFPACK_WITHOUT_CHOLMOD)
|
||||
# test if umfpack is underlinked (CentOS 5.9), i.e. doesn't specify
|
||||
# that it depends on amd. in that case, force amd to be linked
|
||||
if (UMFPACK_EXTRA_LIBS AND (CMAKE_CXX_PLATFORM_ID STREQUAL "Linux") AND CMAKE_COMPILER_IS_GNUCC)
|
||||
try_compile_umfpack (HAVE_UMFPACK_NOT_UNDERLINKED "-Wl,--as-needed" ${UMFPACK_EXTRA_LIBS})
|
||||
if (NOT HAVE_UMFPACK_NOT_UNDERLINKED)
|
||||
list (APPEND UMFPACK_LINKER_FLAGS "-Wl,--no-as-needed")
|
||||
endif (NOT HAVE_UMFPACK_NOT_UNDERLINKED)
|
||||
endif (UMFPACK_EXTRA_LIBS AND (CMAKE_CXX_PLATFORM_ID STREQUAL "Linux") AND CMAKE_COMPILER_IS_GNUCC)
|
||||
list (APPEND UMFPACK_LIBRARIES ${UMFPACK_EXTRA_LIBS})
|
||||
list (REVERSE UMFPACK_LIBRARIES)
|
||||
list (REMOVE_DUPLICATES UMFPACK_LIBRARIES)
|
||||
list (REVERSE UMFPACK_LIBRARIES)
|
||||
endif (UMFPACK_LIBRARY)
|
||||
|
||||
# don't reset these sets; if two packages request SuiteSparse with
|
||||
# different modules, we want the sets to be merged
|
||||
#set (SuiteSparse_LIBRARIES "")
|
||||
#set (SuiteSparse_INCLUDE_DIRS "")
|
||||
|
||||
# determine which modules were found based on whether all dependencies
|
||||
# were satisfied; create a list of ALL modules (specified) that was found
|
||||
# (to be included in one swoop in CMakeLists.txt)
|
||||
set (SuiteSparse_FOUND TRUE)
|
||||
foreach (module IN LISTS SuiteSparse_FIND_COMPONENTS)
|
||||
string (TOUPPER ${module} MODULE)
|
||||
set (SuiteSparse_${MODULE}_FOUND TRUE)
|
||||
foreach (file IN LISTS ${MODULE}_INCLUDE_DIRS ${MODULE}_LIBRARIES)
|
||||
if (NOT EXISTS ${file})
|
||||
set (SuiteSparse_${MODULE}_FOUND FALSE)
|
||||
endif (NOT EXISTS ${file})
|
||||
endforeach (file)
|
||||
if (NOT SuiteSparse_${MODULE}_FOUND)
|
||||
set (SuiteSparse_FOUND FALSE)
|
||||
# use empty string instead of zero, so it can be tested with #ifdef
|
||||
# as well as #if in the source code
|
||||
set (HAVE_SUITESPARSE_${MODULE}_H "" CACHE INT "Is ${module} header present?")
|
||||
else (NOT SuiteSparse_${MODULE}_FOUND)
|
||||
set (HAVE_SUITESPARSE_${MODULE}_H 1 CACHE INT "Is ${module} header present?")
|
||||
list (APPEND SuiteSparse_LIBRARIES "${${MODULE}_LIBRARIES}")
|
||||
list (APPEND SuiteSparse_LINKER_FLAGS "${${MODULE}_LINKER_FLAGS}")
|
||||
list (APPEND SuiteSparse_INCLUDE_DIRS "${${MODULE}_INCLUDE_DIRS}")
|
||||
endif (NOT SuiteSparse_${MODULE}_FOUND)
|
||||
mark_as_advanced (HAVE_SUITESPARSE_${MODULE}_H)
|
||||
mark_as_advanced (${MODULE}_INCLUDE_DIR)
|
||||
mark_as_advanced (${MODULE}_LIBRARY)
|
||||
endforeach (module)
|
||||
|
||||
if (SuiteSparse_INCLUDE_DIRS)
|
||||
list (REMOVE_DUPLICATES SuiteSparse_INCLUDE_DIRS)
|
||||
endif (SuiteSparse_INCLUDE_DIRS)
|
||||
if (SuiteSparse_LIBRARIES)
|
||||
list (REVERSE SuiteSparse_LIBRARIES)
|
||||
list (REMOVE_DUPLICATES SuiteSparse_LIBRARIES)
|
||||
list (REVERSE SuiteSparse_LIBRARIES)
|
||||
endif (SuiteSparse_LIBRARIES)
|
||||
|
||||
# on MacOS X the libraries are in a framework directory and an option must be
|
||||
# added on the compile line to relate headers to that directory
|
||||
if (${CMAKE_SYSTEM_NAME} MATCHES "Darwin")
|
||||
list (APPEND SuiteSparse_DEFINITIONS "-framework Accelerate")
|
||||
endif (${CMAKE_SYSTEM_NAME} MATCHES "Darwin")
|
||||
|
||||
# print a message to indicate status of this package
|
||||
include (FindPackageHandleStandardArgs)
|
||||
find_package_handle_standard_args (SuiteSparse
|
||||
DEFAULT_MSG
|
||||
SuiteSparse_LIBRARIES
|
||||
SuiteSparse_INCLUDE_DIRS
|
||||
)
|
||||
|
||||
# add these after checking to not pollute the message output (checking for
|
||||
# BLAS and LAPACK is REQUIRED so if they are not found, we'll have failed
|
||||
# already; suitesparseconfig is "optional" anyway)
|
||||
list (APPEND SuiteSparse_LIBRARIES ${SuiteSparse_EXTRA_LIBS})
|
||||
163
cmake/Modules/FindSuperLU.cmake
Normal file
163
cmake/Modules/FindSuperLU.cmake
Normal file
@@ -0,0 +1,163 @@
|
||||
#
|
||||
# Module that checks whether SuperLU is available and usable.
|
||||
# SuperLU must be a version released after the year 2005.
|
||||
#
|
||||
# Variables used by this module which you may want to set:
|
||||
# SUPERLU_ROOT Path list to search for SuperLU
|
||||
#
|
||||
# Sets the follwing variable:
|
||||
#
|
||||
# SUPERLU_FOUND True if SuperLU available and usable.
|
||||
# SUPERLU_MIN_VERSION_4_3 True if SuperLU version >= 4.3.
|
||||
# SUPERLU_POST_2005_VERSION True if SuperLU is from post-2005
|
||||
# SUPERLU_WITH_VERSION Human readable string containing version information.
|
||||
# SUPERLU_INCLUDE_DIRS Path to the SuperLU include dirs.
|
||||
# SUPERLU_LIBRARIES Name to the SuperLU library.
|
||||
#
|
||||
|
||||
# adds SuperLU flags to the targets
|
||||
function(add_dune_superlu_flags _targets)
|
||||
if(SUPERLU_FOUND)
|
||||
foreach(_target ${_targets})
|
||||
target_link_libraries(${_target} ${SUPERLU_DUNE_LIBRARIES})
|
||||
get_target_property(_props ${_target} COMPILE_FLAGS)
|
||||
string(REPLACE "_props-NOTFOUND" "" _props "${_props}")
|
||||
set_target_properties(${_target} PROPERTIES COMPILE_FLAGS
|
||||
"${_props} ${SUPERLU_DUNE_COMPILE_FLAGS} -DENABLE_SUPERLU=1")
|
||||
endforeach(_target ${_targets})
|
||||
endif(SUPERLU_FOUND)
|
||||
endfunction(add_dune_superlu_flags)
|
||||
|
||||
# look for BLAS
|
||||
find_package(BLAS QUIET REQUIRED)
|
||||
if(NOT BLAS_FOUND)
|
||||
message(WARNING "SuperLU requires BLAS which was not found, skipping the test.")
|
||||
return()
|
||||
endif(NOT BLAS_FOUND)
|
||||
|
||||
# look for files only at the positions given by the user if
|
||||
# an explicit path is specified
|
||||
if (SUPERLU_PREFIX OR SUPERLU_ROOT)
|
||||
set (_no_default_path "NO_DEFAULT_PATH")
|
||||
else (SUPERLU_PREFIX OR SUPERLU_ROOT)
|
||||
set (_no_default_path "")
|
||||
endif (SUPERLU_PREFIX OR SUPERLU_ROOT)
|
||||
|
||||
# look for header files
|
||||
find_path(SUPERLU_INCLUDE_DIR
|
||||
NAMES supermatrix.h
|
||||
PATHS ${SUPERLU_PREFIX} ${SUPERLU_ROOT}
|
||||
PATH_SUFFIXES "superlu" "include/superlu" "include" "SRC"
|
||||
${_no_default_path}
|
||||
)
|
||||
|
||||
# only search in architecture-relevant directory
|
||||
if (CMAKE_SIZEOF_VOID_P)
|
||||
math (EXPR _BITS "8 * ${CMAKE_SIZEOF_VOID_P}")
|
||||
endif (CMAKE_SIZEOF_VOID_P)
|
||||
|
||||
# look for library
|
||||
find_library(SUPERLU_LIBRARY
|
||||
NAMES "superlu_4.3" "superlu_4.2" "superlu_4.1" "superlu_4.0" "superlu_3.1" "superlu_3.0" "superlu"
|
||||
PATHS ${SUPERLU_PREFIX} ${SUPERLU_ROOT}
|
||||
PATH_SUFFIXES "lib" "lib${_BITS}" "lib/${CMAKE_LIBRARY_ARCHITECTURE}"
|
||||
${_no_default_path}
|
||||
)
|
||||
|
||||
# check version specific macros
|
||||
include(CheckCSourceCompiles)
|
||||
include(CMakePushCheckState)
|
||||
cmake_push_check_state()
|
||||
|
||||
# we need if clauses here because variable is set variable-NOTFOUND
|
||||
# if the searches above were not successful
|
||||
# Without them CMake print errors like:
|
||||
# "CMake Error: The following variables are used in this project, but they are set to NOTFOUND.
|
||||
# Please set them or make sure they are set and tested correctly in the CMake files:"
|
||||
#
|
||||
if(SUPERLU_INCLUDE_DIR)
|
||||
set(CMAKE_REQUIRED_INCLUDES ${CMAKE_REQUIRED_INCLUDES} ${SUPERLU_INCLUDE_DIR})
|
||||
endif(SUPERLU_INCLUDE_DIR)
|
||||
if(SUPERLU_LIBRARY)
|
||||
set(CMAKE_REQUIRED_LIBRARIES ${CMAKE_REQUIRED_LIBRARIES} ${SUPERLU_LIBRARY})
|
||||
endif(SUPERLU_LIBRARY)
|
||||
if(BLAS_LIBRARIES)
|
||||
set(CMAKE_REQUIRED_LIBRARIES ${CMAKE_REQUIRED_LIBRARIES} ${BLAS_LIBRARIES})
|
||||
endif(BLAS_LIBRARIES)
|
||||
# check whether "mem_usage_t.expansions" was found in "slu_ddefs.h"
|
||||
CHECK_C_SOURCE_COMPILES("
|
||||
#include <slu_ddefs.h>
|
||||
int main(void)
|
||||
{
|
||||
mem_usage_t mem;
|
||||
return mem.expansions;
|
||||
}"
|
||||
HAVE_MEM_USAGE_T_EXPANSIONS)
|
||||
|
||||
# check whether version is at least 4.3
|
||||
CHECK_C_SOURCE_COMPILES("
|
||||
#include <slu_ddefs.h>
|
||||
int main(void)
|
||||
{
|
||||
return SLU_DOUBLE;
|
||||
}"
|
||||
SUPERLU_MIN_VERSION_4_3)
|
||||
|
||||
# check whether version is at least post-2005
|
||||
CHECK_C_SOURCE_COMPILES("
|
||||
#include <slu_ddefs.h>
|
||||
int main(void)
|
||||
{
|
||||
GlobalLU_t g;
|
||||
return 0;
|
||||
}"
|
||||
SUPERLU_POST_2005_VERSION)
|
||||
cmake_pop_check_state()
|
||||
|
||||
if(SUPERLU_MIN_VERSION_4_3)
|
||||
set(SUPERLU_WITH_VERSION "SuperLU >= 4.3" CACHE STRING
|
||||
"Human readable string containing SuperLU version information.")
|
||||
else()
|
||||
set(SUPERLU_WITH_VERSION "SuperLU <= 4.2, post 2005" CACHE STRING
|
||||
"Human readable string containing SuperLU version information.")
|
||||
endif(SUPERLU_MIN_VERSION_4_3)
|
||||
|
||||
# behave like a CMake module is supposed to behave
|
||||
include(FindPackageHandleStandardArgs)
|
||||
find_package_handle_standard_args(
|
||||
"SuperLU"
|
||||
DEFAULT_MSG
|
||||
SUPERLU_INCLUDE_DIR
|
||||
SUPERLU_LIBRARY
|
||||
)
|
||||
|
||||
mark_as_advanced(SUPERLU_INCLUDE_DIR SUPERLU_LIBRARY)
|
||||
|
||||
# if both headers and library are found, store results
|
||||
if(SUPERLU_FOUND)
|
||||
set(SUPERLU_INCLUDE_DIRS ${SUPERLU_INCLUDE_DIR})
|
||||
set(SUPERLU_LIBRARIES ${SUPERLU_LIBRARY} ${BLAS_LIBRARIES})
|
||||
set(SUPERLU_DEFINITIONS "-DENABLE_SUPERLU=1")
|
||||
# log result
|
||||
file(APPEND ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeOutput.log
|
||||
"Determing location of ${SUPERLU_WITH_VERSION} succeded:\n"
|
||||
"Include directory: ${SUPERLU_INCLUDE_DIRS}\n"
|
||||
"Library directory: ${SUPERLU_LIBRARIES}\n\n")
|
||||
set(SUPERLU_DUNE_COMPILE_FLAGS "-I${SUPERLU_INCLUDE_DIRS}"
|
||||
CACHE STRING "Compile flags used by DUNE when compiling SuperLU programs")
|
||||
set(SUPERLU_DUNE_LIBRARIES ${SUPERLU_LIBRARIES} ${BLAS_LIBRARIES}
|
||||
CACHE STRING "Libraries used by DUNE when linking SuperLU programs")
|
||||
else(SUPERLU_FOUND)
|
||||
# log errornous result
|
||||
file(APPEND ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeError.log
|
||||
"Determing location of SuperLU failed:\n"
|
||||
"Include directory: ${SUPERLU_INCLUDE_DIRS}\n"
|
||||
"Library directory: ${SUPERLU_LIBRARIES}\n\n")
|
||||
endif(SUPERLU_FOUND)
|
||||
|
||||
# set HAVE_SUPERLU for config.h
|
||||
if(SUPERLU_FOUND)
|
||||
set(HAVE_SUPERLU 1)
|
||||
else(SUPERLU_FOUND)
|
||||
set(HAVE_SUPERLU "")
|
||||
endif(SUPERLU_FOUND)
|
||||
37
cmake/Modules/FindTinyXML.cmake
Normal file
37
cmake/Modules/FindTinyXML.cmake
Normal file
@@ -0,0 +1,37 @@
|
||||
# - Find TinyXML library
|
||||
#
|
||||
# Defines the following variables:
|
||||
# TinyXML_INCLUDE_DIRS Directory of header files
|
||||
# TinyXML_LIBRARIES Directory of shared object files
|
||||
# TinyXML_DEFINITIONS Defines that must be set to compile
|
||||
|
||||
# Copyright (C) 2012 Uni Research AS
|
||||
# This code is licensed under The GNU General Public License v3.0
|
||||
|
||||
# use the generic find routine
|
||||
include (OpmPackage)
|
||||
find_opm_package (
|
||||
# module name
|
||||
"TinyXML"
|
||||
|
||||
# dependencies
|
||||
""
|
||||
|
||||
# header to search for
|
||||
"tinyxml.h"
|
||||
|
||||
# library to search for
|
||||
"tinyxml"
|
||||
|
||||
# defines to be added to compilations
|
||||
""
|
||||
|
||||
# test program
|
||||
"#include <tinyxml.h>
|
||||
int main (void) {
|
||||
TiXmlDocument doc;
|
||||
return 0;
|
||||
}
|
||||
"
|
||||
# config variables
|
||||
"")
|
||||
58
cmake/Modules/Finddune-common.cmake
Normal file
58
cmake/Modules/Finddune-common.cmake
Normal file
@@ -0,0 +1,58 @@
|
||||
# - Find DUNE common library
|
||||
#
|
||||
# Defines the following variables:
|
||||
# dune-common_INCLUDE_DIRS Directory of header files
|
||||
# dune-common_LIBRARIES Directory of shared object files
|
||||
# dune-common_DEFINITIONS Defines that must be set to compile
|
||||
# dune-common_CONFIG_VARS List of defines that should be in config.h
|
||||
# HAVE_DUNE_COMMON Binary value to use in config.h
|
||||
|
||||
# Copyright (C) 2012 Uni Research AS
|
||||
# This code is licensed under The GNU General Public License v3.0
|
||||
|
||||
include (OpmPackage)
|
||||
find_opm_package (
|
||||
# module name
|
||||
"dune-common"
|
||||
|
||||
# dependencies
|
||||
"CXX11Features;
|
||||
BLAS REQUIRED;
|
||||
LAPACK REQUIRED;
|
||||
MPI
|
||||
"
|
||||
# header to search for
|
||||
"dune/common/fvector.hh"
|
||||
|
||||
# library to search for
|
||||
"dunecommon"
|
||||
|
||||
# defines to be added to compilations
|
||||
"DUNE_COMMON_FIELDVECTOR_SIZE_IS_METHOD=1"
|
||||
|
||||
# test program
|
||||
"#include <dune/common/fvector.hh>
|
||||
#include <dune/common/fmatrix.hh>
|
||||
int main (void) {
|
||||
Dune::FieldVector<double,1> v;
|
||||
Dune::FieldMatrix<double,1,1> m;
|
||||
m[0][0] = 1.0;
|
||||
v[0] = 1.0;
|
||||
Dune::FieldVector<double,1> w = m*v;
|
||||
return 0;
|
||||
}
|
||||
"
|
||||
# config variables
|
||||
"HAVE_ARRAY;
|
||||
HAVE_BOOST_MAKE_SHARED_HPP;
|
||||
HAVE_BOOST_SHARED_PTR_HPP;
|
||||
HAVE_GMP;
|
||||
HAVE_MAKE_SHARED;
|
||||
HAVE_MPI;
|
||||
HAVE_NULLPTR;
|
||||
HAVE_STATIC_ASSERT;
|
||||
HAVE_TR1_TUPLE;
|
||||
HAVE_TYPE_TRAITS;
|
||||
HAVE_TUPLE
|
||||
")
|
||||
#debug_find_vars ("dune-common")
|
||||
42
cmake/Modules/Finddune-cornerpoint.cmake
Normal file
42
cmake/Modules/Finddune-cornerpoint.cmake
Normal file
@@ -0,0 +1,42 @@
|
||||
# - Find OPM corner-point grid library
|
||||
#
|
||||
# Defines the following variables:
|
||||
# dune-cornerpoint_INCLUDE_DIRS Directory of header files
|
||||
# dune-cornerpoint_LIBRARIES Directory of shared object files
|
||||
# dune-cornerpoint_DEFINITIONS Defines that must be set to compile
|
||||
# dune-cornerpoint_CONFIG_VARS List of defines that should be in config.h
|
||||
# HAVE_DUNE_CORNERPOINT Binary value to use in config.h
|
||||
|
||||
# Copyright (C) 2013 Uni Research AS
|
||||
# This code is licensed under The GNU General Public License v3.0
|
||||
|
||||
include (OpmPackage)
|
||||
find_opm_package (
|
||||
# module name
|
||||
"dune-cornerpoint"
|
||||
|
||||
# dependencies
|
||||
"dune-common REQUIRED;
|
||||
dune-grid REQUIRED;
|
||||
opm-core REQUIRED
|
||||
"
|
||||
# header to search for
|
||||
"dune/grid/CpGrid.hpp"
|
||||
|
||||
# library to search for
|
||||
"dunecornerpoint"
|
||||
|
||||
# defines to be added to compilations
|
||||
""
|
||||
|
||||
# test program
|
||||
"#include <dune/grid/CpGrid.hpp>
|
||||
int main (void) {
|
||||
Dune::CpGrid g;
|
||||
return 0;
|
||||
}
|
||||
"
|
||||
# config variables
|
||||
"")
|
||||
|
||||
#debug_find_vars ("dune-cornerpoint")
|
||||
47
cmake/Modules/Finddune-geometry.cmake
Normal file
47
cmake/Modules/Finddune-geometry.cmake
Normal file
@@ -0,0 +1,47 @@
|
||||
# - Find DUNE geometry library
|
||||
#
|
||||
# Defines the following variables:
|
||||
# dune-geometry_INCLUDE_DIRS Directory of header files
|
||||
# dune-geometry_LIBRARIES Directory of shared object files
|
||||
# dune-geometry_DEFINITIONS Defines that must be set to compile
|
||||
# dune-geometry_CONFIG_VARS List of defines that should be in config.h
|
||||
# HAVE_DUNE_GEOMETRY Binary value to use in config.h
|
||||
|
||||
# Copyright (C) 2013 Uni Research AS
|
||||
# This code is licensed under The GNU General Public License v3.0
|
||||
|
||||
include (OpmPackage)
|
||||
find_opm_package (
|
||||
# module name
|
||||
"dune-geometry"
|
||||
|
||||
# dependencies
|
||||
# TODO: we should probe for all the HAVE_* values listed below;
|
||||
# however, we don't actually use them in our implementation, so
|
||||
# we just include them to forward here in case anyone else does
|
||||
"CXX11Features;
|
||||
dune-common REQUIRED
|
||||
"
|
||||
# header to search for
|
||||
"dune/geometry/quadraturerules.hh"
|
||||
|
||||
# library to search for
|
||||
"dunegeometry"
|
||||
|
||||
# defines to be added to compilations
|
||||
""
|
||||
|
||||
# test program
|
||||
"#include <dune/geometry/quadraturerules.hh>
|
||||
int main (void) {
|
||||
Dune::GeometryType gt;
|
||||
gt.makeQuadrilateral();
|
||||
Dune::QuadratureRules<double, 2>::rule(gt, 2).size();
|
||||
return 0;
|
||||
}
|
||||
"
|
||||
# config variables
|
||||
"HAVE_ALGLIB
|
||||
")
|
||||
|
||||
#debug_find_vars ("dune-geometry")
|
||||
55
cmake/Modules/Finddune-grid.cmake
Normal file
55
cmake/Modules/Finddune-grid.cmake
Normal file
@@ -0,0 +1,55 @@
|
||||
# - Find DUNE grid library
|
||||
#
|
||||
# Defines the following variables:
|
||||
# dune-grid_INCLUDE_DIRS Directory of header files
|
||||
# dune-grid_LIBRARIES Directory of shared object files
|
||||
# dune-grid_DEFINITIONS Defines that must be set to compile
|
||||
# dune-grid_CONFIG_VARS List of defines that should be in config.h
|
||||
# HAVE_DUNE_GRID Binary value to use in config.h
|
||||
|
||||
# Copyright (C) 2013 Uni Research AS
|
||||
# This code is licensed under The GNU General Public License v3.0
|
||||
|
||||
include (OpmPackage)
|
||||
find_opm_package (
|
||||
# module name
|
||||
"dune-grid"
|
||||
|
||||
# dependencies
|
||||
# TODO: we should probe for all the HAVE_* values listed below;
|
||||
# however, we don't actually use them in our implementation, so
|
||||
# we just include them to forward here in case anyone else does
|
||||
"CXX11Features;
|
||||
dune-common REQUIRED;
|
||||
dune-geometry REQUIRED
|
||||
"
|
||||
# header to search for
|
||||
"dune/grid/onedgrid.hh"
|
||||
|
||||
# library to search for
|
||||
"dunegrid"
|
||||
|
||||
# defines to be added to compilations
|
||||
""
|
||||
|
||||
# test program
|
||||
"#include <dune/grid/onedgrid.hh>
|
||||
int main (void) {
|
||||
Dune::OneDGrid grid(1, 0., 1.);
|
||||
return grid.lbegin<0>(0) == grid.lend<0>(0);
|
||||
}
|
||||
"
|
||||
# config variables
|
||||
"HAVE_MPI;
|
||||
HAVE_UG;
|
||||
HAVE_DUNE_FEM;
|
||||
HAVE_ALUGRID;
|
||||
HAVE_GRIDTYPE;
|
||||
HAVE_GRAPE;
|
||||
HAVE_PSURFACE;
|
||||
HAVE_AMIRAMESH;
|
||||
HAVE_ALBERTA;
|
||||
HAVE_STDINT_H
|
||||
")
|
||||
|
||||
#debug_find_vars ("dune-grid")
|
||||
62
cmake/Modules/Finddune-istl.cmake
Normal file
62
cmake/Modules/Finddune-istl.cmake
Normal file
@@ -0,0 +1,62 @@
|
||||
# - Find DUNE ISTL library
|
||||
#
|
||||
# Defines the following variables:
|
||||
# dune-istl_INCLUDE_DIRS Directory of header files
|
||||
# dune-istl_LIBRARIES Directory of shared object files
|
||||
# dune-istl_DEFINITIONS Defines that must be set to compile
|
||||
# dune-istl_CONFIG_VARS List of defines that should be in config.h
|
||||
# HAVE_DUNE_ISTL Binary value to use in config.h
|
||||
|
||||
# Copyright (C) 2012 Uni Research AS
|
||||
# This code is licensed under The GNU General Public License v3.0
|
||||
|
||||
# dune-common is only required if dune-istl is; the "required-ness" is
|
||||
# not transitive as far as CMake is concerned (i.e. if an optional package
|
||||
# requests a package to be required, the build will fail if it's not found)
|
||||
if (dune-istl_FIND_REQUIRED)
|
||||
set (_require_dune_common "REQUIRED")
|
||||
endif (dune-istl_FIND_REQUIRED)
|
||||
|
||||
include (OpmPackage)
|
||||
find_opm_package (
|
||||
# module name
|
||||
"dune-istl"
|
||||
|
||||
# required dependencies
|
||||
"dune-common ${_require_dune_common};
|
||||
SuperLU
|
||||
"
|
||||
# header to search for
|
||||
"dune/istl/bcrsmatrix.hh"
|
||||
|
||||
# library to search for
|
||||
""
|
||||
|
||||
# defines to be added to compilations
|
||||
""
|
||||
|
||||
# test program
|
||||
"#include <dune/common/deprecated.hh>
|
||||
#include <dune/istl/bcrsmatrix.hh>
|
||||
#include <dune/common/fmatrix.hh>
|
||||
|
||||
int main (void) {
|
||||
typedef Dune::BCRSMatrix<Dune::FieldMatrix<double,1,1> > Matrix;
|
||||
Matrix matrix( 3, 3, Matrix::random );
|
||||
for (int i = 0; i < 3; ++i) matrix.setrowsize(i, 2);
|
||||
matrix.endrowsizes();
|
||||
return 0;
|
||||
}
|
||||
"
|
||||
# config variables
|
||||
"HAVE_BOOST_FUSION;
|
||||
HAVE_MEM_USAGE_T_EXPANSIONS;
|
||||
HAVE_PARDISO;
|
||||
HAVE_BOOST;
|
||||
HAVE_MPI;
|
||||
HAVE_PARMETIS;
|
||||
HAVE_SUPERLU;
|
||||
SUPERLU_MIN_VERSION_4_3;
|
||||
SUPERLU_POST_2005_VERSION
|
||||
")
|
||||
#debug_find_vars ("dune-istl")
|
||||
60
cmake/Modules/Findopm-core.cmake
Normal file
60
cmake/Modules/Findopm-core.cmake
Normal file
@@ -0,0 +1,60 @@
|
||||
# - Find OPM core library
|
||||
#
|
||||
# Defines the following variables:
|
||||
# opm-core_INCLUDE_DIRS Directory of header files
|
||||
# opm-core_LIBRARIES Directory of shared object files
|
||||
# opm-core_DEFINITIONS Defines that must be set to compile
|
||||
# opm-core_CONFIG_VARS List of defines that should be in config.h
|
||||
# HAVE_OPM_CORE Binary value to use in config.h
|
||||
|
||||
# Copyright (C) 2012 Uni Research AS
|
||||
# This code is licensed under The GNU General Public License v3.0
|
||||
|
||||
# use the generic find routine
|
||||
include (OpmPackage)
|
||||
find_opm_package (
|
||||
# module name
|
||||
"opm-core"
|
||||
|
||||
# dependencies
|
||||
"C99;
|
||||
CXX11Features;
|
||||
Boost 1.39.0
|
||||
COMPONENTS date_time filesystem system unit_test_framework signals REQUIRED;
|
||||
BLAS REQUIRED;
|
||||
LAPACK REQUIRED;
|
||||
SuiteSparse COMPONENTS umfpack;
|
||||
SuperLU;
|
||||
TinyXML;
|
||||
ERT;
|
||||
dune-istl
|
||||
"
|
||||
# header to search for
|
||||
"opm/core/grid.h"
|
||||
|
||||
# library to search for
|
||||
"opmcore"
|
||||
|
||||
# defines to be added to compilations
|
||||
""
|
||||
|
||||
# test program
|
||||
"#include <opm/core/grid.h>
|
||||
int main (void) {
|
||||
struct UnstructuredGrid *g;
|
||||
g = create_grid_empty ();
|
||||
destroy_grid (g);
|
||||
return 0;
|
||||
}
|
||||
"
|
||||
# config variables
|
||||
"HAVE_AGMG;
|
||||
HAVE_DUNE_ISTL;
|
||||
HAVE_DYNAMIC_BOOST_TEST;
|
||||
HAVE_ERT;
|
||||
HAVE_SUITESPARSE_UMFPACK_H;
|
||||
HAVE_NULLPTR;
|
||||
HAVE_STATIC_ASSERT
|
||||
")
|
||||
include (UseDynamicBoost)
|
||||
#debug_find_vars ("opm-core")
|
||||
41
cmake/Modules/Findopm-polymer.cmake
Normal file
41
cmake/Modules/Findopm-polymer.cmake
Normal file
@@ -0,0 +1,41 @@
|
||||
# - Find OPM polymer library
|
||||
#
|
||||
# Defines the following variables:
|
||||
# opm-polymer_INCLUDE_DIRS Directory of header files
|
||||
# opm-polymer_LIBRARIES Directory of shared object files
|
||||
# opm-polymer_DEFINITIONS Defines that must be set to compile
|
||||
# opm-polymer_CONFIG_VARS List of defines that should be in config.h
|
||||
# HAVE_OPM_POLYMER Binary value to use in config.h
|
||||
|
||||
# Copyright (C) 2013 Uni Research AS
|
||||
# This code is licensed under The GNU General Public License v3.0
|
||||
|
||||
include (OpmPackage)
|
||||
find_opm_package (
|
||||
# module name
|
||||
"opm-polymer"
|
||||
|
||||
# dependencies
|
||||
"ERT;
|
||||
opm-core REQUIRED
|
||||
"
|
||||
# header to search for
|
||||
"opm/polymer/PolymerState.hpp"
|
||||
|
||||
# library to search for
|
||||
"opmpolymer"
|
||||
|
||||
# defines to be added to compilations
|
||||
""
|
||||
|
||||
# test program
|
||||
"#include <opm/polymer/PolymerState.hpp>
|
||||
int main (void) {
|
||||
Opm::PolymerState s;
|
||||
return 0;
|
||||
}
|
||||
"
|
||||
# config variables
|
||||
"HAVE_ERT")
|
||||
|
||||
#debug_find_vars ("opm-polymer")
|
||||
43
cmake/Modules/Findopm-porsol.cmake
Normal file
43
cmake/Modules/Findopm-porsol.cmake
Normal file
@@ -0,0 +1,43 @@
|
||||
# - Find OPM porous media solver library
|
||||
#
|
||||
# Defines the following variables:
|
||||
# opm-porsol_INCLUDE_DIRS Directory of header files
|
||||
# opm-porsol_LIBRARIES Directory of shared object files
|
||||
# opm-porsol_DEFINITIONS Defines that must be set to compile
|
||||
# opm-porsol_CONFIG_VARS List of defines that should be in config.h
|
||||
# HAVE_OPM_PORSOL Binary value to use in config.h
|
||||
|
||||
# Copyright (C) 2013 Uni Research AS
|
||||
# This code is licensed under The GNU General Public License v3.0
|
||||
|
||||
include (OpmPackage)
|
||||
find_opm_package (
|
||||
# module name
|
||||
"opm-porsol"
|
||||
|
||||
# dependencies
|
||||
"dune-common REQUIRED;
|
||||
dune-grid REQUIRED;
|
||||
dune-istl REQUIRED;
|
||||
opm-core REQUIRED;
|
||||
dune-cornerpoint REQUIRED
|
||||
"
|
||||
# header to search for
|
||||
"opm/porsol/mimetic/IncompFlowSolverHybrid.hpp"
|
||||
|
||||
# library to search for
|
||||
"opmporsol"
|
||||
|
||||
# defines to be added to compilations
|
||||
""
|
||||
|
||||
# test program
|
||||
"#include <opm/porsol/mimetic/IncompFlowSolverHybrid.hpp>
|
||||
int main (void) {
|
||||
return 0;
|
||||
}
|
||||
"
|
||||
# config variables
|
||||
"HAVE_VALGRIND")
|
||||
|
||||
#debug_find_vars ("opm-porsol")
|
||||
44
cmake/Modules/Findopm-upscaling.cmake
Normal file
44
cmake/Modules/Findopm-upscaling.cmake
Normal file
@@ -0,0 +1,44 @@
|
||||
# - Find OPM upscaling grid library
|
||||
#
|
||||
# Defines the following variables:
|
||||
# opm-upscaling_INCLUDE_DIRS Directory of header files
|
||||
# opm-upscaling_LIBRARIES Directory of shared object files
|
||||
# opm-upscaling_DEFINITIONS Defines that must be set to compile
|
||||
# opm-upscaling_CONFIG_VARS List of defines that should be in config.h
|
||||
# HAVE_OPM_UPSCALING Binary value to use in config.h
|
||||
|
||||
# Copyright (C) 2013 Uni Research AS
|
||||
# This code is licensed under The GNU General Public License v3.0
|
||||
|
||||
include (OpmPackage)
|
||||
find_opm_package (
|
||||
# module name
|
||||
"opm-upscaling"
|
||||
|
||||
# dependencies
|
||||
"dune-common REQUIRED;
|
||||
dune-grid REQUIRED;
|
||||
dune-istl REQUIRED;
|
||||
opm-core REQUIRED;
|
||||
dune-cornerpoint REQUIRED;
|
||||
opm-porsol REQUIRED
|
||||
"
|
||||
# header to search for
|
||||
"opm/upscaling/SinglePhaseUpscaler.hpp"
|
||||
|
||||
# library to search for
|
||||
"opmupscaling"
|
||||
|
||||
# defines to be added to compilations
|
||||
""
|
||||
|
||||
# test program
|
||||
"#include <opm/upscaling/SinglePhaseUpscaler.hpp>
|
||||
int main (void) {
|
||||
return 0;
|
||||
}
|
||||
"
|
||||
# config variables
|
||||
"HAVE_SUPERLU")
|
||||
|
||||
#debug_find_vars ("opm-upscaling")
|
||||
165
cmake/Modules/LibtoolArchives.cmake
Normal file
165
cmake/Modules/LibtoolArchives.cmake
Normal file
@@ -0,0 +1,165 @@
|
||||
# translate a list of libraries into a command-line that can be passed to the
|
||||
# compiler/linker. first parameter is the name of the variable that will
|
||||
# receive this list, the rest is considered the list of libraries
|
||||
function (linker_cmdline what INTO outvar FROM)
|
||||
# if we are going to put these in regexps, we must escape period
|
||||
string (REPLACE "." "\\." esc_dl_pref "${CMAKE_SHARED_LIBRARY_PREFIX}")
|
||||
string (REPLACE "." "\\." esc_dl_suff "${CMAKE_SHARED_LIBRARY_SUFFIX}")
|
||||
string (REPLACE "." "\\." esc_ar_pref "${CMAKE_STATIC_LIBRARY_PREFIX}")
|
||||
string (REPLACE "." "\\." esc_ar_suff "${CMAKE_STATIC_LIBRARY_PREFIX}")
|
||||
|
||||
# CMake loves absolute paths, whereas libtool won't have any of it!
|
||||
# (you get an error message about argument not parsed). translate each
|
||||
# of the libraries into a linker option
|
||||
set (deplib_list "")
|
||||
foreach (deplib IN LISTS ARGN)
|
||||
# starts with a hyphen already? then just add it
|
||||
string (SUBSTRING ${deplib} 0 1 dash)
|
||||
if (${dash} STREQUAL "-")
|
||||
list (APPEND deplib_list ${deplib})
|
||||
else (${dash} STREQUAL "-")
|
||||
# otherwise, parse the name into a directory and a name
|
||||
get_filename_component (deplib_dir ${deplib} PATH)
|
||||
get_filename_component (deplib_orig ${deplib} NAME)
|
||||
string (REGEX REPLACE
|
||||
"^${esc_dl_pref}(.*)${esc_dl_suff}$"
|
||||
"\\1"
|
||||
deplib_name
|
||||
${deplib_orig}
|
||||
)
|
||||
string (REGEX REPLACE
|
||||
"^${esc_ar_pref}(.*)${esc_ar_suff}$"
|
||||
"\\1"
|
||||
deplib_name
|
||||
${deplib_name}
|
||||
)
|
||||
# directory and name each on their own; this is somewhat
|
||||
# unsatisfactory because it may be that a system dir is specified
|
||||
# by an earlier directory and you start picking up libraries from
|
||||
# there instead of the "closest" path here. also, the soversion
|
||||
# is more or less lost. remove system default path, to lessen the
|
||||
# chance that we pick the wrong library
|
||||
if (NOT ((deplib_dir STREQUAL "/usr/lib") OR
|
||||
(deplib_dir STREQUAL "/usr/${CMAKE_INSTALL_LIBDIR}")))
|
||||
list (APPEND deplib_list "-L${deplib_dir}")
|
||||
endif (NOT ((deplib_dir STREQUAL "/usr/lib") OR
|
||||
(deplib_dir STREQUAL "/usr/${CMAKE_INSTALL_LIBDIR}")))
|
||||
# if there was no translation of the name, the library is named
|
||||
# unconventionally (.so.3gf, I'm looking at you), so pass this
|
||||
# name unmodified to the linker switch
|
||||
if (deplib_orig STREQUAL deplib_name)
|
||||
list (APPEND deplib_list "-l:${deplib_orig}")
|
||||
else (deplib_orig STREQUAL deplib_name)
|
||||
list (APPEND deplib_list "-l${deplib_name}")
|
||||
endif (deplib_orig STREQUAL deplib_name)
|
||||
endif (${dash} STREQUAL "-")
|
||||
endforeach (deplib)
|
||||
# caller determines whether we want it returned as a list or a string
|
||||
if ("${what}" STREQUAL "LIST")
|
||||
set (${outvar} ${deplib_list})
|
||||
else ("${what}" STREQUAL "LIST")
|
||||
set (${outvar} "${deplib_list}")
|
||||
string (REPLACE ";" " " ${outvar} "${${outvar}}")
|
||||
endif ("${what}" STREQUAL "LIST")
|
||||
set (${outvar} "${${outvar}}" PARENT_SCOPE)
|
||||
endfunction (linker_cmdline what INTO outvar FROM)
|
||||
|
||||
function (configure_la name target)
|
||||
if (NOT (UNIX OR MSYS OR MINGW))
|
||||
return ()
|
||||
endif (NOT (UNIX OR MSYS OR MINGW))
|
||||
|
||||
# these generic variables are initialized from the project info
|
||||
set (current "${${name}_VERSION_MAJOR}")
|
||||
set (age "${${name}_VERSION_MINOR}")
|
||||
set (inherited_linker_flags "${${name}_LINKER_FLAGS}")
|
||||
set (dependency_libs "${${name}_LIBRARIES}")
|
||||
|
||||
# translate list of libraries to command line
|
||||
linker_cmdline (LIST INTO dependency_libs FROM ${dependency_libs})
|
||||
|
||||
# convert from CMake list (i.e. semi-colon separated)
|
||||
string (REPLACE ";" " " inherited_linker_flags "${inherited_linker_flags}")
|
||||
string (REPLACE ";" " " dependency_libs "${dependency_libs}")
|
||||
|
||||
# this is the preferred installation path
|
||||
set (libdir "${CMAKE_INSTALL_PREFIX}/${CMAKE_INSTALL_LIBDIR}")
|
||||
|
||||
# ${name}_LIBRARY_TYPE is either SHARED or STATIC
|
||||
if (${name}_LIBRARY_TYPE STREQUAL "SHARED")
|
||||
set (libprefix "${CMAKE_SHARED_LIBRARY_PREFIX}")
|
||||
set (libsuffix "${CMAKE_SHARED_LIBRARY_SUFFIX}")
|
||||
set (libname "${CMAKE_SHARED_LIBRARY_PREFIX}${target}${CMAKE_SHARED_LIBRARY_SUFFIX}")
|
||||
# only Unix has soversion in library names
|
||||
if (UNIX)
|
||||
set (dlname "${libname}.${current}")
|
||||
set (library_names "${libname}.${current}.${age} ${libname}.${current} ${libname}")
|
||||
else (UNIX)
|
||||
set (dlname "${libname}")
|
||||
set (library_names "${libname}")
|
||||
endif (UNIX)
|
||||
set (old_library "")
|
||||
else (${name}_LIBRARY_TYPE STREQUAL "SHARED")
|
||||
set (dlname "")
|
||||
set (library_names "")
|
||||
set (old_library "${CMAKE_STATIC_LIBRARY_PREFIX}${target}${CMAKE_STATIC_LIBRARY_SUFFIX}")
|
||||
endif (${name}_LIBRARY_TYPE STREQUAL "SHARED")
|
||||
|
||||
# get the version of libtool installed on the system; this is
|
||||
# necessary because libtool checks that the file contains its own
|
||||
# signature(!)
|
||||
if (NOT libtool_MAIN)
|
||||
find_file (
|
||||
libtool_MAIN
|
||||
ltmain.sh
|
||||
PATHS /usr
|
||||
PATH_SUFFIXES share/libtool/config/
|
||||
DOC "Location of libtool"
|
||||
)
|
||||
mark_as_advanced (libtool_MAIN)
|
||||
# notify the user if it not found after we explicitly searched
|
||||
if (NOT libtool_MAIN)
|
||||
message (STATUS "Libtool not found!")
|
||||
endif (NOT libtool_MAIN)
|
||||
endif (NOT libtool_MAIN)
|
||||
if (libtool_MAIN)
|
||||
file (STRINGS
|
||||
${libtool_MAIN}
|
||||
ltversion_STRING
|
||||
REGEX "^VERSION=\".*\""
|
||||
)
|
||||
endif (libtool_MAIN)
|
||||
if (ltversion_STRING)
|
||||
string (REGEX REPLACE
|
||||
"^VERSION=\"?(.*)\"?"
|
||||
"\\1"
|
||||
ltversion
|
||||
${ltversion_STRING}
|
||||
)
|
||||
endif (ltversion_STRING)
|
||||
|
||||
# assume that we are in cmake/Modules, and that the template have been
|
||||
# put in cmake/Templates. we cannot use CMAKE_CURRENT_LIST_DIR because
|
||||
# this is in a function, and we cannot know who's calling us
|
||||
set (templ_dir "${PROJECT_SOURCE_DIR}/cmake/Templates")
|
||||
|
||||
|
||||
# only write an .la if libtool is found; otherwise we have no use
|
||||
# for it.
|
||||
if (ltversion)
|
||||
set (la_file "lib${target}.la")
|
||||
message (STATUS "Writing libtool archive for ${target}")
|
||||
configure_file (
|
||||
${templ_dir}/la.in
|
||||
${CMAKE_ARCHIVE_OUTPUT_DIRECTORY}/${la_file}
|
||||
@ONLY@
|
||||
)
|
||||
else (ltversion)
|
||||
set (la_file "")
|
||||
endif (ltversion)
|
||||
|
||||
# return this variable to the caller
|
||||
if (ARGV2)
|
||||
set (${ARGV2} "${la_file}" PARENT_SCOPE)
|
||||
endif (ARGV2)
|
||||
endfunction (configure_la target)
|
||||
54
cmake/Modules/OpmCompile.cmake
Normal file
54
cmake/Modules/OpmCompile.cmake
Normal file
@@ -0,0 +1,54 @@
|
||||
# - Compile main library target
|
||||
|
||||
macro (opm_compile opm)
|
||||
# some CMake properties do not do list expansion
|
||||
string (REPLACE ";" " " ${opm}_LINKER_FLAGS_STR "${${opm}_LINKER_FLAGS}")
|
||||
|
||||
# name of the library should not contain dashes, as CMake will
|
||||
# define a symbol with that name, and those cannot contain dashes
|
||||
string (REPLACE "-" "" ${opm}_TARGET "${${opm}_NAME}")
|
||||
|
||||
# all public header files are together with the source. prepend our own
|
||||
# source path to the one of the dependencies so that our version of any
|
||||
# ambigious paths are used.
|
||||
set (${opm}_INCLUDE_DIR "${PROJECT_SOURCE_DIR}")
|
||||
set (${opm}_INCLUDE_DIRS ${${opm}_INCLUDE_DIR} ${${opm}_INCLUDE_DIRS})
|
||||
|
||||
# create this library
|
||||
include_directories (${${opm}_INCLUDE_DIRS})
|
||||
link_directories (${${opm}_LIBRARY_DIRS})
|
||||
add_definitions (${${opm}_DEFINITIONS})
|
||||
add_library (${${opm}_TARGET} ${${opm}_LIBRARY_TYPE} ${${opm}_SOURCES})
|
||||
set (${opm}_VERSION "${${opm}_VERSION_MAJOR}.${${opm}_VERSION_MINOR}")
|
||||
set_target_properties (${${opm}_TARGET} PROPERTIES
|
||||
SOVERSION ${${opm}_VERSION_MAJOR}
|
||||
VERSION ${${opm}_VERSION}
|
||||
LINK_FLAGS "${${opm}_LINKER_FLAGS_STR}"
|
||||
)
|
||||
target_link_libraries (${${opm}_TARGET} ${${opm}_LIBRARIES})
|
||||
|
||||
# queue this executable to be stripped
|
||||
strip_debug_symbols (${${opm}_TARGET} ${opm}_DEBUG)
|
||||
|
||||
# pre-compile common headers; this is setup *after* the library to pick
|
||||
# up extra options set there
|
||||
if (PRECOMPILE_HEADERS)
|
||||
get_target_property (_type ${${opm}_TARGET} TYPE)
|
||||
precompile_header (CXX ${_type}
|
||||
HEADER "${${opm}_PRECOMP_CXX_HEADER}"
|
||||
TARGET ${opm}_CXX_pch
|
||||
FLAGS ${opm}_PRECOMP_CXX_FLAGS
|
||||
)
|
||||
# must set property on source files instead of entire target, because
|
||||
# it only applies to C++ modules (and cannot be used for C)
|
||||
set_source_files_properties (${${opm}_CXX_SOURCES} PROPERTIES
|
||||
OBJECT_DEPENDS "${${opm}_CXX_pch}"
|
||||
COMPILE_FLAGS "${${opm}_PRECOMP_CXX_FLAGS}"
|
||||
)
|
||||
message (STATUS "Precompiled headers: ${${opm}_CXX_pch}")
|
||||
endif (PRECOMPILE_HEADERS)
|
||||
|
||||
# we need to know the name of the library which is generated
|
||||
get_target_property (${opm}_LIBRARY ${${opm}_TARGET} LOCATION)
|
||||
|
||||
endmacro (opm_compile opm)
|
||||
50
cmake/Modules/OpmDefaults.cmake
Normal file
50
cmake/Modules/OpmDefaults.cmake
Normal file
@@ -0,0 +1,50 @@
|
||||
# - Default settings for the build
|
||||
|
||||
include (UseCompVer)
|
||||
|
||||
macro (opm_defaults opm)
|
||||
# build release by default
|
||||
if (NOT CMAKE_CONFIGURATION_TYPES AND NOT CMAKE_BUILD_TYPE)
|
||||
set (CMAKE_BUILD_TYPE "Release")
|
||||
endif (NOT CMAKE_CONFIGURATION_TYPES AND NOT CMAKE_BUILD_TYPE)
|
||||
|
||||
# default to building a static library, but let user override
|
||||
if (DEFINED BUILD_SHARED_LIBS)
|
||||
if (BUILD_SHARED_LIBS)
|
||||
set (${opm}_LIBRARY_TYPE SHARED)
|
||||
else (BUILD_SHARED_LIBS)
|
||||
set (${opm}_LIBRARY_TYPE STATIC)
|
||||
endif (BUILD_SHARED_LIBS)
|
||||
else (DEFINED BUILD_SHARED_LIBS)
|
||||
set (${opm}_LIBRARY_TYPE STATIC)
|
||||
endif (DEFINED BUILD_SHARED_LIBS)
|
||||
|
||||
# precompile standard headers to speed up compilation
|
||||
# unfortunately, this functionality is buggy and tends to segfault at
|
||||
# least up to version 4.7.2, so it should be disabled by default there
|
||||
get_gcc_version (CXX GCC_VERSION)
|
||||
if (GCC_VERSION VERSION_LESS "4.7.2")
|
||||
set (_precomp_def OFF)
|
||||
else (GCC_VERSION VERSION_LESS "4.7.2")
|
||||
set (_precomp_def ON)
|
||||
endif (GCC_VERSION VERSION_LESS "4.7.2")
|
||||
option (PRECOMPILE_HEADERS "Precompile common headers for speed." ${_precomp_def})
|
||||
mark_as_advanced (PRECOMPILE_HEADERS)
|
||||
if (NOT PRECOMPILE_HEADERS)
|
||||
message (STATUS "Precompiled headers: disabled")
|
||||
endif(NOT PRECOMPILE_HEADERS)
|
||||
|
||||
# Use of OpenMP is considered experimental
|
||||
set (USE_OPENMP_DEFAULT OFF)
|
||||
|
||||
# if we are on a system where CMake 2.6 is the default (Hi RHEL 6!),
|
||||
# the configuration files for Boost will trip up the library paths
|
||||
# (look for /usr/lib64/lib64/ in the log) when used with FindBoost
|
||||
# module bundled with CMake 2.8. this can be circumvented by turning
|
||||
# off config mode probing if we have not explicitly specified a
|
||||
# directory to look for it. for more details, see
|
||||
# <http://stackoverflow.com/questions/9948375/cmake-find-package-succeeds-but-returns-wrong-path>
|
||||
if (NOT BOOST_ROOT)
|
||||
set (Boost_NO_BOOST_CMAKE ON)
|
||||
endif (NOT BOOST_ROOT)
|
||||
endmacro (opm_defaults opm)
|
||||
63
cmake/Modules/OpmDistClean.cmake
Normal file
63
cmake/Modules/OpmDistClean.cmake
Normal file
@@ -0,0 +1,63 @@
|
||||
# - Cleanup configuration files
|
||||
#
|
||||
# Remove files generated by the configuration (not by the build); the
|
||||
# purpose is to get back a clean directory with no build artifacts
|
||||
# (some empty directories may be left behind, though)
|
||||
#
|
||||
# The following suffices are supported:
|
||||
# _NAME Name of the project
|
||||
# _STYLESHEET_COPIED Stylesheet that was copied for the documentation
|
||||
# _LIBTOOL_ARCHIVE Libtool archive file generated for library
|
||||
# _DEBUG Debug information extracted from library
|
||||
|
||||
macro (opm_dist_clean opm)
|
||||
|
||||
set (DISTCLEAN_FILES
|
||||
CMakeCache.txt
|
||||
cmake_install.cmake
|
||||
Makefile
|
||||
config.h
|
||||
config.h.tmp
|
||||
${${opm}_NAME}-config.cmake
|
||||
${${opm}_NAME}-config-version.cmake
|
||||
${${opm}_NAME}-install.cmake
|
||||
${${opm}_NAME}.pc
|
||||
${${opm}_NAME}-install.pc
|
||||
${doxy_dir}/Doxyfile
|
||||
${doxy_dir}/Doxyfile.in
|
||||
CTestTestfile.cmake
|
||||
DartConfiguration.tcl
|
||||
lib/${${opm}_LIBTOOL_ARCHIVE}
|
||||
${${opm}_DEBUG}
|
||||
${tests_DEBUG}
|
||||
${examples_DEBUG}
|
||||
${tutorial_DEBUG}
|
||||
install_manifest.txt
|
||||
${${opm}_STYLESHEET_COPIED}
|
||||
${tests_INPUT_FILES}
|
||||
)
|
||||
# only remove these files if they were actually copied
|
||||
if (NOT PROJECT_SOURCE_DIR STREQUAL PROJECT_BINARY_DIR)
|
||||
list (APPEND DISTCLEAN_FILES
|
||||
dune.module
|
||||
)
|
||||
endif (NOT PROJECT_SOURCE_DIR STREQUAL PROJECT_BINARY_DIR)
|
||||
# script to remove empty directories (can't believe this isn't included!)
|
||||
set (rmdir "${PROJECT_SOURCE_DIR}/cmake/Scripts/RemoveEmptyDir.cmake")
|
||||
add_custom_target (distclean
|
||||
COMMAND ${CMAKE_COMMAND} -E remove -f ${DISTCLEAN_FILES}
|
||||
COMMAND ${CMAKE_COMMAND} -E remove_directory CMakeFiles/
|
||||
COMMAND ${CMAKE_COMMAND} -E remove_directory Testing/
|
||||
COMMAND ${CMAKE_COMMAND} -DDIR=${CMAKE_LIBRARY_OUTPUT_DIRECTORY} -P ${rmdir}
|
||||
COMMAND ${CMAKE_COMMAND} -DDIR=${CMAKE_RUNTIME_OUTPUT_DIRECTORY} -P ${rmdir}
|
||||
COMMAND ${CMAKE_COMMAND} -DDIR:LOCATION=${doxy_dir} -P ${rmdir}
|
||||
COMMAND ${CMAKE_COMMAND} -DDIR:LOCATION=${tests_DIR} -P ${rmdir}
|
||||
# cannot depend on clean because it is only defined in the master Makefile
|
||||
# not in CMakeFiles/Makefile where this target will end up
|
||||
# DEPENDS clean
|
||||
WORKING_DIRECTORY ${PROJECT_BINARY_DIR}
|
||||
COMMENT Removing CMake-generated files
|
||||
VERBATIM
|
||||
)
|
||||
|
||||
endmacro (opm_dist_clean opm)
|
||||
81
cmake/Modules/OpmDoc.cmake
Normal file
81
cmake/Modules/OpmDoc.cmake
Normal file
@@ -0,0 +1,81 @@
|
||||
# - Setup documentation
|
||||
#
|
||||
# Assumes that a Doxyfile template is located in the project root
|
||||
# directory, and that all documentation is going to be generated
|
||||
# into its own Documentation/ directory. It will also generate an
|
||||
# installation target for the documentation (not built by default)
|
||||
#
|
||||
# Requires the following variables to be set:
|
||||
# ${opm}_NAME Name of the project
|
||||
#
|
||||
# Output the following variables:
|
||||
# ${opm}_STYLESHEET_COPIED Location of stylesheet to be removed in distclean
|
||||
|
||||
macro (opm_doc opm doxy_dir)
|
||||
# combine the template with local customization
|
||||
file (READ ${PROJECT_SOURCE_DIR}/cmake/Templates/Doxyfile _doxy_templ)
|
||||
string (REPLACE ";" "\\;" _doxy_templ "${_doxy_templ}")
|
||||
if (EXISTS ${PROJECT_SOURCE_DIR}/${doxy_dir}/Doxylocal)
|
||||
file (READ ${PROJECT_SOURCE_DIR}/${doxy_dir}/Doxylocal _doxy_local)
|
||||
string (REPLACE ";" "\\;" _doxy_local "${_doxy_local}")
|
||||
else (EXISTS ${PROJECT_SOURCE_DIR}/${doxy_dir}/Doxylocal)
|
||||
set (_doxy_local)
|
||||
endif (EXISTS ${PROJECT_SOURCE_DIR}/${doxy_dir}/Doxylocal)
|
||||
file (MAKE_DIRECTORY ${PROJECT_BINARY_DIR}/${doxy_dir})
|
||||
file (WRITE ${PROJECT_BINARY_DIR}/${doxy_dir}/Doxyfile.in ${_doxy_templ} ${_doxy_local})
|
||||
# set this generically named variable so even the custom file can be shared
|
||||
set (src_DIR "${${opm}_DIR}")
|
||||
# replace variables in this combined file
|
||||
configure_file (
|
||||
${PROJECT_BINARY_DIR}/${doxy_dir}/Doxyfile.in
|
||||
${PROJECT_BINARY_DIR}/${doxy_dir}/Doxyfile
|
||||
@ONLY
|
||||
)
|
||||
find_package (Doxygen)
|
||||
if (DOXYGEN_FOUND)
|
||||
add_custom_target (doc
|
||||
COMMAND ${DOXYGEN_EXECUTABLE} ${PROJECT_BINARY_DIR}/${doxy_dir}/Doxyfile
|
||||
SOURCES ${PROJECT_BINARY_DIR}/${doxy_dir}/Doxyfile
|
||||
WORKING_DIRECTORY ${PROJECT_BINARY_DIR}/${doxy_dir}
|
||||
COMMENT "Generating API documentation with Doxygen"
|
||||
VERBATIM
|
||||
)
|
||||
# distributions have various naming conventions; this enables the packager
|
||||
# to direct where the install target should put the documentation. the names
|
||||
# here are taken from GNUInstallDirs.cmake
|
||||
set (CMAKE_INSTALL_DATAROOTDIR "share" CACHE STRING "Read-only arch.-indep. data root")
|
||||
set (CMAKE_INSTALL_DOCDIR "${CMAKE_INSTALL_DATAROOTDIR}/doc/${${opm}_NAME}" CACHE STRING "Documentation root")
|
||||
set (_formats html)
|
||||
foreach (format IN LISTS _formats)
|
||||
string (TOUPPER ${format} FORMAT)
|
||||
install (
|
||||
DIRECTORY ${PROJECT_BINARY_DIR}/${doxy_dir}/${format}
|
||||
DESTINATION ${CMAKE_INSTALL_DOCDIR}
|
||||
COMPONENT ${format}
|
||||
OPTIONAL
|
||||
)
|
||||
# target to install just HTML documentation
|
||||
add_custom_target (install-${format}
|
||||
COMMAND ${CMAKE_COMMAND} -DCOMPONENT=${format} -P cmake_install.cmake
|
||||
COMMENT Installing ${FORMAT} documentation
|
||||
VERBATIM
|
||||
)
|
||||
# since the documentation is optional, it is not automatically built
|
||||
add_dependencies (install-${format} doc)
|
||||
endforeach (format)
|
||||
endif (DOXYGEN_FOUND)
|
||||
|
||||
# stylesheets must be specified with relative path in Doxyfile, or the
|
||||
# full path (to the source directory!) will be put in the output HTML.
|
||||
# thus, we'll need to copy the stylesheet to this path relative to where
|
||||
# Doxygen will be run (in the output tree)
|
||||
if ((NOT PROJECT_SOURCE_DIR STREQUAL PROJECT_BINARY_DIR) AND (EXISTS ${PROJECT_SOURCE_DIR}/${doxy_dir}/style.css))
|
||||
file (COPY ${PROJECT_SOURCE_DIR}/${doxy_dir}/style.css
|
||||
DESTINATION ${PROJECT_BINARY_DIR}/${doxy_dir}
|
||||
)
|
||||
set (${opm}_STYLESHEET_COPIED "${doxy_dir}/style.css")
|
||||
else ((NOT PROJECT_SOURCE_DIR STREQUAL PROJECT_BINARY_DIR) AND (EXISTS ${PROJECT_SOURCE_DIR}/${doxy_dir}/style.css))
|
||||
set (${opm}_STYLESHEET_COPIED "")
|
||||
endif ((NOT PROJECT_SOURCE_DIR STREQUAL PROJECT_BINARY_DIR) AND (EXISTS ${PROJECT_SOURCE_DIR}/${doxy_dir}/style.css))
|
||||
|
||||
endmacro (opm_doc opm)
|
||||
91
cmake/Modules/OpmFiles.cmake
Normal file
91
cmake/Modules/OpmFiles.cmake
Normal file
@@ -0,0 +1,91 @@
|
||||
# - Identify source code
|
||||
|
||||
macro (opm_out_dirs)
|
||||
# put libraries in lib/ (no multi-arch support in build tree)
|
||||
set (CMAKE_LIBRARY_OUTPUT_DIRECTORY "${PROJECT_BINARY_DIR}/lib")
|
||||
set (CMAKE_ARCHIVE_OUTPUT_DIRECTORY "${PROJECT_BINARY_DIR}/lib")
|
||||
set (CMAKE_RUNTIME_OUTPUT_DIRECTORY "${PROJECT_BINARY_DIR}/bin")
|
||||
set (CMAKE_Fortran_MODULE_DIRECTORY "${PROJECT_BINARY_DIR}/CMakeFiles")
|
||||
endmacro (opm_out_dirs)
|
||||
|
||||
# support for some of the variables that are used in Autotools
|
||||
# template files
|
||||
macro (opm_auto_dirs)
|
||||
set (abs_top_builddir "${PROJECT_BINARY_DIR}")
|
||||
set (abs_top_srcdir "${PROJECT_SOURCE_DIR}")
|
||||
endmacro (opm_auto_dirs)
|
||||
|
||||
macro (opm_sources opm)
|
||||
# this is necessary to set so that we know where we are going to
|
||||
# execute the test programs (and make datafiles available)
|
||||
set (tests_DIR "tests")
|
||||
|
||||
# how to retrieve the "fancy" name from the filename
|
||||
set (tests_REGEXP
|
||||
"^test_([^/]*)$"
|
||||
"^([^/]*)_test$"
|
||||
)
|
||||
|
||||
# start out with defined, empty lists which will be specified externally
|
||||
set (MAIN_SOURCE_FILES)
|
||||
set (EXAMPLE_SOURCE_FILES)
|
||||
set (TEST_SOURCE_FILES)
|
||||
set (TEST_DATA_FILES)
|
||||
set (PUBLIC_HEADER_FILES)
|
||||
set (PROGRAM_SOURCE_FILES)
|
||||
|
||||
# read the list of components from this file; it should set the above
|
||||
# lists (which are generic names)
|
||||
include (${PROJECT_SOURCE_DIR}/CMakeLists_files.cmake)
|
||||
|
||||
# rename from "friendly" names to ones that fit the "almost-structural"
|
||||
# scheme used in the .cmake modules, converting them to absolute file
|
||||
# names in the process
|
||||
foreach (_file IN LISTS MAIN_SOURCE_FILES)
|
||||
list (APPEND ${opm}_SOURCES ${PROJECT_SOURCE_DIR}/${_file})
|
||||
endforeach (_file)
|
||||
foreach (_file IN LISTS PUBLIC_HEADER_FILES)
|
||||
list (APPEND ${opm}_HEADERS ${PROJECT_SOURCE_DIR}/${_file})
|
||||
endforeach (_file)
|
||||
foreach (_file IN LISTS TEST_SOURCE_FILES)
|
||||
list (APPEND tests_SOURCES ${PROJECT_SOURCE_DIR}/${_file})
|
||||
endforeach (_file)
|
||||
foreach (_file IN LISTS TEST_DATA_FILES)
|
||||
list (APPEND tests_DATA ${PROJECT_SOURCE_DIR}/${_file})
|
||||
endforeach (_file)
|
||||
foreach (_file IN LISTS EXAMPLE_SOURCE_FILES)
|
||||
list (APPEND examples_SOURCES ${PROJECT_SOURCE_DIR}/${_file})
|
||||
endforeach (_file)
|
||||
foreach (_file IN LISTS PROGRAM_SOURCE_FILES)
|
||||
list (APPEND examples_SOURCES_DIST ${PROJECT_SOURCE_DIR}/${_file})
|
||||
endforeach (_file)
|
||||
|
||||
# identify pre-compile header; if the project is called opm-foobar,
|
||||
# then it should be in opm/foobar/opm-foobar-pch.hpp
|
||||
string (REPLACE "-" "/" opm_NAME_AS_DIR ${${opm}_NAME})
|
||||
set (${opm}_PRECOMP_CXX_HEADER "${opm_NAME_AS_DIR}/${${opm}_NAME}-pch.hpp")
|
||||
if (NOT EXISTS ${PROJECT_SOURCE_DIR}/${${opm}_PRECOMP_CXX_HEADER})
|
||||
set (${opm}_PRECOMP_CXX_HEADER "")
|
||||
endif (NOT EXISTS ${PROJECT_SOURCE_DIR}/${${opm}_PRECOMP_CXX_HEADER})
|
||||
endmacro (opm_sources opm)
|
||||
|
||||
# disable an entire directory from sources
|
||||
macro (opm_disable_source opm)
|
||||
foreach (_exp IN ITEMS ${ARGN})
|
||||
# regexp or directory?
|
||||
if (IS_ABSOLUTE "${_exp}")
|
||||
set (_prefix "")
|
||||
else (IS_ABSOLUTE "${_exp}")
|
||||
set (_prefix "${PROJECT_SOURCE_DIR}/")
|
||||
endif (IS_ABSOLUTE "${_exp}")
|
||||
if (IS_DIRECTORY "${_prefix}${_exp}")
|
||||
set (_glob "/*")
|
||||
else (IS_DIRECTORY "${_prefix}${_exp}")
|
||||
set (_glob "")
|
||||
endif (IS_DIRECTORY "${_prefix}${_exp}")
|
||||
file (GLOB_RECURSE _disabled RELATIVE ${PROJECT_SOURCE_DIR} "${_prefix}${_exp}${_glob}")
|
||||
foreach (_file IN ITEMS ${_disabled})
|
||||
list (REMOVE_ITEM ${opm}_SOURCES "${PROJECT_SOURCE_DIR}/${_file}")
|
||||
endforeach (_file)
|
||||
endforeach (_exp)
|
||||
endmacro (opm_disable_source opm reldir)
|
||||
201
cmake/Modules/OpmFind.cmake
Normal file
201
cmake/Modules/OpmFind.cmake
Normal file
@@ -0,0 +1,201 @@
|
||||
# - Generic inclusion of packages
|
||||
#
|
||||
# Synopsis:
|
||||
#
|
||||
# find_and_append_package (name args)
|
||||
#
|
||||
# where
|
||||
#
|
||||
# name Name of the package, e.g. Boost
|
||||
# args Other arguments, e.g. COMPONENTS, REQUIRED, QUIET etc.
|
||||
#
|
||||
# This macro will append the list of standard variables found by the
|
||||
# package to this project's standard variables
|
||||
#
|
||||
########################################################################
|
||||
#
|
||||
# - Generic inclusion of a list of packages
|
||||
#
|
||||
# Synopsis:
|
||||
#
|
||||
# find_and_append_package_list (args)
|
||||
#
|
||||
# where
|
||||
#
|
||||
# args List of package strings. Each string must be quoted if
|
||||
# it contains more than one word.
|
||||
#
|
||||
# Example:
|
||||
#
|
||||
# find_and_append_package_list (
|
||||
# "Boost COMPONENTS filesystem REQUIRED"
|
||||
# SUPERLU
|
||||
# )
|
||||
|
||||
include (Duplicates)
|
||||
|
||||
# list of suffixes for all the project variables
|
||||
set (_opm_proj_vars
|
||||
LINKER_FLAGS
|
||||
LIBRARIES
|
||||
DEFINITIONS
|
||||
INCLUDE_DIRS
|
||||
LIBRARY_DIRS
|
||||
CONFIG_VARS
|
||||
)
|
||||
|
||||
# ensure that they are at least the empty list after we're done
|
||||
foreach (name IN LISTS _opm_proj_vars)
|
||||
if (NOT DEFINED ${CMAKE_PROJECT_NAME}_${name})
|
||||
set (${CMAKE_PROJECT_NAME}_${name} "")
|
||||
endif (NOT DEFINED ${CMAKE_PROJECT_NAME}_${name})
|
||||
endforeach (name)
|
||||
|
||||
# these dependencies must always be handled by the find module
|
||||
set (_opm_proj_exemptions
|
||||
dune-common
|
||||
dune-istl
|
||||
dune-grid
|
||||
dune-geometry
|
||||
)
|
||||
|
||||
# although a DUNE module, it is delivered in the OPM suite
|
||||
set (dune-cornerpoint_SUITE "opm")
|
||||
set (ewoms_SUITE "opm")
|
||||
|
||||
# insert this boilerplate whenever we are going to find a new package
|
||||
macro (find_and_append_package_to prefix name)
|
||||
# special handling for Boost to avoid inadvertedly picking up system
|
||||
# libraries when we want our own version. this is done here because
|
||||
# having a custom Boost is common, but the logic to search only there
|
||||
# does not follow any particular convention.
|
||||
if (BOOST_ROOT AND NOT DEFINED Boost_NO_SYSTEM_PATHS)
|
||||
set (Boost_NO_SYSTEM_PATHS TRUE)
|
||||
endif (BOOST_ROOT AND NOT DEFINED Boost_NO_SYSTEM_PATHS)
|
||||
|
||||
# if we have specified a directory, don't revert to searching the
|
||||
# system default paths afterwards
|
||||
string (TOUPPER "${name}" NAME)
|
||||
string (REPLACE "-" "_" NAME "${NAME}")
|
||||
|
||||
# only use suite if module-specific variable is not set. this allows
|
||||
# us to override one dir in a suite
|
||||
if (NOT (${name}_DIR OR ${name}_ROOT OR ${NAME}_ROOT))
|
||||
# module is part of a suite if it has name with the pattern xxx-yyy
|
||||
if (("${name}" MATCHES "[^-]+-.+") OR ${name}_SUITE)
|
||||
# allow to override if the module doesn't quite fit the convention
|
||||
# e.g. dune-cornerpoint
|
||||
if (NOT DEFINED ${name}_SUITE)
|
||||
# extract suite name from module
|
||||
string (REGEX REPLACE "([^-]+)-.+" "\\1" ${name}_SUITE "${name}")
|
||||
endif (NOT DEFINED ${name}_SUITE)
|
||||
# assume that each module has its own subdir directly under suite dir
|
||||
string (TOUPPER "${${name}_SUITE}" ${name}_SUITE_UPPER)
|
||||
if (DEFINED ${${name}_SUITE_UPPER}_ROOT)
|
||||
set (${NAME}_ROOT ${${${name}_SUITE_UPPER}_ROOT}/${name})
|
||||
endif (DEFINED ${${name}_SUITE_UPPER}_ROOT)
|
||||
endif (("${name}" MATCHES "[^-]+-.+") OR ${name}_SUITE)
|
||||
endif (NOT (${name}_DIR OR ${name}_ROOT OR ${NAME}_ROOT))
|
||||
|
||||
# the documentation says that if *-config.cmake files are not found,
|
||||
# find_package will revert to doing a full search, but that is not
|
||||
# true, so unconditionally setting ${name}_DIR is not safe. however,
|
||||
# if the directory given to us contains a config file, then copy the
|
||||
# value over to this variable to switch to config mode (CMake will
|
||||
# always use config mode if *_DIR is defined)
|
||||
if (NOT DEFINED ${name}_DIR AND (DEFINED ${name}_ROOT OR DEFINED ${NAME}_ROOT))
|
||||
if (EXISTS ${${name}_ROOT}/${name}-config.cmake OR EXISTS ${${name}_ROOT}/${name}Config.cmake)
|
||||
set (${name}_DIR "${${name}_ROOT}")
|
||||
endif (EXISTS ${${name}_ROOT}/${name}-config.cmake OR EXISTS ${${name}_ROOT}/${name}Config.cmake)
|
||||
if (EXISTS ${${NAME}_ROOT}/${name}-config.cmake OR EXISTS ${${NAME}_ROOT}/${name}Config.cmake)
|
||||
set (${name}_DIR "${${NAME}_ROOT}")
|
||||
endif (EXISTS ${${NAME}_ROOT}/${name}-config.cmake OR EXISTS ${${NAME}_ROOT}/${name}Config.cmake)
|
||||
endif (NOT DEFINED ${name}_DIR AND (DEFINED ${name}_ROOT OR DEFINED ${NAME}_ROOT))
|
||||
|
||||
# these libraries need special handling which is not provided in
|
||||
# the -config.cmake file, but which must be provided by this project,
|
||||
# something which is done in our find module
|
||||
list (FIND _opm_proj_exemptions "${name}" _${name}_exempted)
|
||||
if ((NOT (_${name}_exempted EQUAL -1)) AND (DEFINED ${name}_DIR))
|
||||
set (${name}_ROOT "${${name}_DIR}")
|
||||
# store this for later, in case we reconfigure
|
||||
set (${name}_ROOT "${${name}_ROOT}" CACHE LOCATION "Path to ${name}")
|
||||
# clear this to not use config mode
|
||||
unset (${name}_DIR)
|
||||
# variables that are given on the command-line is also put in the cache
|
||||
# removing the local copy only "unshadows" this one
|
||||
unset (${name}_DIR CACHE)
|
||||
endif ((NOT (_${name}_exempted EQUAL -1)) AND (DEFINED ${name}_DIR))
|
||||
|
||||
# using config mode is better than using module (aka. find) mode
|
||||
# because then the package has already done all its probes and
|
||||
# stored them in the config file for us
|
||||
if (${name}_DIR)
|
||||
message (STATUS "Finding package ${name} using config mode")
|
||||
find_package (${name} ${ARGN} NO_MODULE PATHS ${${name}_DIR} NO_DEFAULT_PATH)
|
||||
else (${name}_DIR)
|
||||
message (STATUS "Finding package ${name} using module mode")
|
||||
find_package (${name} ${ARGN})
|
||||
endif (${name}_DIR)
|
||||
|
||||
# the variable "NAME" may be replaced during find_package (as this is
|
||||
# now a macro, and not a function anymore), so we must reinitialize
|
||||
string (TOUPPER "${name}" NAME)
|
||||
string (REPLACE "-" "_" NAME "${NAME}")
|
||||
|
||||
if (${name}_FOUND OR ${NAME}_FOUND)
|
||||
foreach (var IN LISTS _opm_proj_vars)
|
||||
if (DEFINED ${name}_${var})
|
||||
list (APPEND ${prefix}_${var} ${${name}_${var}})
|
||||
# some packages define an uppercase version of their own name
|
||||
elseif (DEFINED ${NAME}_${var})
|
||||
list (APPEND ${prefix}_${var} ${${NAME}_${var}})
|
||||
endif (DEFINED ${name}_${var})
|
||||
# some packages define _PATH instead of _DIRS (Hi, MPI!)
|
||||
if ("${var}" STREQUAL "INCLUDE_DIRS")
|
||||
if (DEFINED ${name}_INCLUDE_PATH)
|
||||
list (APPEND ${prefix}_INCLUDE_DIRS ${${name}_INCLUDE_PATH})
|
||||
elseif (DEFINED ${NAME}_INCLUDE_PATH)
|
||||
list (APPEND ${prefix}_INCLUDE_DIRS ${${NAME}_INCLUDE_PATH})
|
||||
endif (DEFINED ${name}_INCLUDE_PATH)
|
||||
# some packages define only _DIR and not _DIRS (Hi, Eigen3!)
|
||||
if (DEFINED ${name}_INCLUDE_DIR)
|
||||
list (APPEND ${prefix}_INCLUDE_DIRS ${${name}_INCLUDE_DIR})
|
||||
elseif (DEFINED ${NAME}_INCLUDE_DIR)
|
||||
list (APPEND ${prefix}_INCLUDE_DIRS ${${NAME}_INCLUDE_DIR})
|
||||
endif (DEFINED ${name}_INCLUDE_DIR)
|
||||
endif ("${var}" STREQUAL "INCLUDE_DIRS")
|
||||
# cleanup lists
|
||||
if ("${var}" STREQUAL "LIBRARIES")
|
||||
remove_duplicate_libraries (${prefix})
|
||||
else ("${var}" STREQUAL "LIBRARIES")
|
||||
remove_duplicate_var (${prefix} ${var})
|
||||
endif ("${var}" STREQUAL "LIBRARIES")
|
||||
endforeach (var)
|
||||
# some libraries only define xxx_FOUND and not a corresponding HAVE_xxx
|
||||
if (NOT DEFINED HAVE_${NAME})
|
||||
set (HAVE_${NAME} 1)
|
||||
endif (NOT DEFINED HAVE_${NAME})
|
||||
endif (${name}_FOUND OR ${NAME}_FOUND)
|
||||
endmacro (find_and_append_package_to prefix name)
|
||||
|
||||
# append to the list of variables associated with the project
|
||||
macro (find_and_append_package name)
|
||||
find_and_append_package_to (${CMAKE_PROJECT_NAME} ${name} ${ARGN})
|
||||
endmacro (find_and_append_package name)
|
||||
|
||||
# find a list of dependencies, adding each one of them
|
||||
macro (find_and_append_package_list_to prefix)
|
||||
# setting and separating is necessary to work around apparent bugs
|
||||
# in CMake's parser (sic)
|
||||
set (_deps ${ARGN})
|
||||
foreach (_dep IN LISTS _deps)
|
||||
separate_arguments (_args UNIX_COMMAND ${_dep})
|
||||
find_and_append_package_to (${prefix} ${_args})
|
||||
endforeach (_dep)
|
||||
endmacro (find_and_append_package_list_to prefix)
|
||||
|
||||
# convenience method to supply the project name as prefix
|
||||
macro (find_and_append_package_list)
|
||||
find_and_append_package_list_to (${CMAKE_PROJECT_NAME} ${ARGN})
|
||||
endmacro (find_and_append_package_list)
|
||||
81
cmake/Modules/OpmGrid.cmake
Normal file
81
cmake/Modules/OpmGrid.cmake
Normal file
@@ -0,0 +1,81 @@
|
||||
# - Recreate grid selection macros from DUNE
|
||||
#
|
||||
# If anyone requires Dune::GridSelector::GridType, they must call this
|
||||
# macro in *their* project, to add this information to config.h. (In
|
||||
# the autotools version, dunecontrol will automatically include m4
|
||||
# scripts that does this).
|
||||
#
|
||||
# Example:
|
||||
# opm_cornerpoint_grid (${CONFIG_H})
|
||||
|
||||
include (CMakeParseArguments)
|
||||
function (opm_grid_type)
|
||||
cmake_parse_arguments (a "" "FILENAME;SYMBOL;TYPE;CONDITION" "HEADERS" ${ARGN})
|
||||
|
||||
# write prelude of a condition to use this particular grid, an inclusion guard,
|
||||
# and checks to see if the number of dimensions fits for this type of grid
|
||||
file (APPEND ${a_FILENAME}
|
||||
"/* add GRIDTYPE typedef for grid implementation ${a_TYPE}:
|
||||
defining ${a_SYMBOL} during compilation typedefs this grid implementation as GridType
|
||||
in namespace Dune::GridSelector;
|
||||
also integer constants dimgrid and dimworld are set in this namespace.
|
||||
The required headers for this grid implementation are also included.
|
||||
*/
|
||||
#if defined ${a_SYMBOL} && ! defined USED_${a_SYMBOL}_GRIDTYPE
|
||||
/* someone else has already defined a gridtype */
|
||||
#if HAVE_GRIDTYPE
|
||||
#error \"Ambigious definition of GRIDTYPE\"
|
||||
#endif
|
||||
|
||||
#ifndef WORLDDIM
|
||||
#define WORLDDIM GRIDDIM
|
||||
#endif
|
||||
#if not (WORLDDIM >= GRIDDIM)
|
||||
#error \"WORLDDIM < GRIDDIM does not make sense.\"
|
||||
#endif
|
||||
|
||||
#if ! (${a_CONDITION})
|
||||
#error \"Preprocessor assertion ${a_CONDITION} failed.\"
|
||||
#endif
|
||||
|
||||
")
|
||||
|
||||
# write headers which are capable of defining the type. this should
|
||||
# really just have consisted of a forward declaration, but the damage
|
||||
# is done: clients expect to just pull in config.h and have the
|
||||
# proper type available.
|
||||
foreach (header IN LISTS a_HEADERS)
|
||||
file (APPEND ${a_FILENAME}
|
||||
"#include <${header}>\n"
|
||||
)
|
||||
endforeach (header)
|
||||
|
||||
# main part which does the typedef and then a postlude which marks
|
||||
# the grid as "taken" and make sure that no one else does the same
|
||||
file (APPEND ${a_FILENAME}
|
||||
"
|
||||
namespace Dune {
|
||||
namespace GridSelector {
|
||||
const int dimgrid = GRIDDIM;
|
||||
const int worldgrid = WORLDDIM;
|
||||
typedef ${a_TYPE} GridType;
|
||||
}
|
||||
}
|
||||
|
||||
#define HAVE_GRIDTYPE 1
|
||||
#define USED_${a_SYMBOL}_GRIDTYPE 1
|
||||
#endif
|
||||
")
|
||||
|
||||
endfunction (opm_grid_type)
|
||||
|
||||
# write the grid type for dune-cornerpoint
|
||||
function (opm_cornerpoint_grid config_h)
|
||||
opm_grid_type (
|
||||
FILENAME ${CONFIG_H}
|
||||
SYMBOL CPGRID
|
||||
HEADERS "dune/grid/CpGrid.hpp" "dune/grid/cpgrid/dgfparser.hh"
|
||||
TYPE Dune::CpGrid
|
||||
CONDITION "(GRIDDIM == 3) && (WORLDDIM == 3)"
|
||||
)
|
||||
endfunction (opm_cornerpoint_grid config_h)
|
||||
55
cmake/Modules/OpmInstall.cmake
Normal file
55
cmake/Modules/OpmInstall.cmake
Normal file
@@ -0,0 +1,55 @@
|
||||
# - Installation macro
|
||||
#
|
||||
# Set up installation targets for the binary library. The following
|
||||
# suffices must be defined for the prefix passed as parameter:
|
||||
#
|
||||
# _NAME Name of the library
|
||||
# _HEADERS List of header files to install
|
||||
# _TARGET CMake target which builds the library
|
||||
# _LIBRARY_TYPE Static or shared library
|
||||
# _DEBUG File containing debug symbols
|
||||
|
||||
macro (opm_install opm)
|
||||
foreach (_hdr IN LISTS ${opm}_HEADERS)
|
||||
get_filename_component (_dir ${_hdr} PATH)
|
||||
file (RELATIVE_PATH _rel_dir "${PROJECT_SOURCE_DIR}" "${_dir}")
|
||||
install (
|
||||
FILES ${_hdr}
|
||||
DESTINATION include/${_rel_dir}
|
||||
)
|
||||
endforeach (_hdr)
|
||||
install (
|
||||
TARGETS ${${opm}_TARGET}
|
||||
LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}
|
||||
ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR}
|
||||
)
|
||||
# only /usr/lib/debug seems to be searched for debug info; if we have
|
||||
# write access to that directory (package installation), then default
|
||||
# to use it; otherwise put the debug files together with the library
|
||||
# (local installation). everything can be overridden by the option.
|
||||
if (CMAKE_INSTALL_PREFIX STREQUAL "/usr")
|
||||
set (_sys_dbg_def ON)
|
||||
else (CMAKE_INSTALL_PREFIX STREQUAL "/usr")
|
||||
set (_sys_dbg_def OFF)
|
||||
endif (CMAKE_INSTALL_PREFIX STREQUAL "/usr")
|
||||
option (SYSTEM_DEBUG "Put .debug files in GDB debug file directory" ${_sys_dbg_def})
|
||||
set (DEBUG_FILE_DIRECTORY /usr/lib/debug CACHE LOCATION "GDB debug file directory")
|
||||
mark_as_advanced (DEBUG_FILE_DIRECTORY)
|
||||
if (SYSTEM_DEBUG)
|
||||
set (_dbg_prefix "${DEBUG_FILE_DIRECTORY}/")
|
||||
else (SYSTEM_DEBUG)
|
||||
set (_dbg_prefix "")
|
||||
endif (SYSTEM_DEBUG)
|
||||
# static libraries don't have their debug info stripped, so there is
|
||||
# only a separate file when we are building shared objects
|
||||
if (${opm}_LIBRARY_TYPE STREQUAL "SHARED")
|
||||
install (
|
||||
FILES ${PROJECT_BINARY_DIR}/${${opm}_DEBUG}
|
||||
DESTINATION ${_dbg_prefix}${CMAKE_INSTALL_PREFIX}/${CMAKE_INSTALL_LIBDIR}
|
||||
)
|
||||
endif (${opm}_LIBRARY_TYPE STREQUAL "SHARED")
|
||||
install (
|
||||
FILES ${PROJECT_SOURCE_DIR}/dune.module
|
||||
DESTINATION ${CMAKE_INSTALL_LIBDIR_NOARCH}/dunecontrol/${${opm}_NAME}
|
||||
)
|
||||
endmacro (opm_install opm)
|
||||
331
cmake/Modules/OpmPackage.cmake
Normal file
331
cmake/Modules/OpmPackage.cmake
Normal file
@@ -0,0 +1,331 @@
|
||||
# - Find routine for OPM-like modules
|
||||
#
|
||||
# Synopsis:
|
||||
#
|
||||
# find_opm_package (module deps header lib defs prog conf)
|
||||
#
|
||||
# where
|
||||
#
|
||||
# module Name of the module, e.g. "dune-common"; this will be the
|
||||
# stem of all variables defined (see below).
|
||||
# deps Semi-colon-separated list of dependent modules which must
|
||||
# be present; those that are required must be marked as such
|
||||
# explicitly. Quote if more than one word is necessary to
|
||||
# describe the dependency.
|
||||
# header Name of the header file to probe for, e.g.
|
||||
# "dune/common/fvector.hh". Note that you should have to same
|
||||
# relative path here as is used in the header files.
|
||||
# lib Name of the library to probe for, e.g. "dunecommon"
|
||||
# defs Symbols that should be passed to compilations
|
||||
# prog Program that should compile if library is present
|
||||
# conf Symbols that should be present in config.h
|
||||
#
|
||||
# It will provide these standard Find-module variables:
|
||||
#
|
||||
# ${module}_INCLUDE_DIRS Directory of header files
|
||||
# ${module}_LIBRARIES Directory of shared object files
|
||||
# ${module}_DEFINITIONS Defines that must be set to compile
|
||||
# ${module}_CONFIG_VARS List of defines that should be in config.h
|
||||
# ${module}_QUIET Verbosity of last find of this module
|
||||
# HAVE_${MODULE} Binary value to use in config.h
|
||||
#
|
||||
# Note: Arguments should be quoted, otherwise a list will spill into the
|
||||
# next argument!
|
||||
|
||||
# Copyright (C) 2012 Uni Research AS
|
||||
# This file is licensed under the GNU General Public License v3.0
|
||||
|
||||
# <http://www.vtk.org/Wiki/CMake:How_To_Find_Libraries>
|
||||
|
||||
include (OpmFind)
|
||||
|
||||
option (SIBLING_SEARCH "Search sibling directories before system paths" ON)
|
||||
mark_as_advanced (SIBLING_SEARCH)
|
||||
|
||||
# append all items from src into dst; both must be *names* of lists
|
||||
macro (append_found src dst)
|
||||
foreach (_item IN LISTS ${src})
|
||||
if (NOT "${_item}" MATCHES "-NOTFOUND$")
|
||||
list (APPEND ${dst} ${_item})
|
||||
endif (NOT "${_item}" MATCHES "-NOTFOUND$")
|
||||
endforeach (_item)
|
||||
endmacro (append_found src dst)
|
||||
|
||||
macro (find_opm_package module deps header lib defs prog conf)
|
||||
# variables to pass on to other packages
|
||||
if (FIND_QUIETLY)
|
||||
set (${module}_QUIET "QUIET")
|
||||
else (FIND_QUIETLY)
|
||||
set (${module}_QUIET "")
|
||||
endif (FIND_QUIETLY)
|
||||
|
||||
# if someone else has included this test, don't do it again
|
||||
if (${${module}_FOUND})
|
||||
return ()
|
||||
endif (${${module}_FOUND})
|
||||
|
||||
# see if there is a pkg-config entry for this package, and use those
|
||||
# settings as a starting point
|
||||
find_package (PkgConfig)
|
||||
pkg_check_modules (PkgConf_${module} QUIET ${module})
|
||||
|
||||
# these variables have non-standard names in FindPkgConfig (sic)
|
||||
set (${module}_DEFINITIONS ${PkgConf_${module}_CFLAGS_OTHER})
|
||||
set (${module}_LINKER_FLAG ${PkgConf_${module}_LDFLAGS_OTHER})
|
||||
|
||||
# in addition to accepting mod-ule_ROOT, we also accept the somewhat
|
||||
# more idiomatic MOD_ULE_ROOT variant
|
||||
string (TOUPPER ${module} MODULE_UPPER)
|
||||
string (REPLACE "-" "_" MODULE ${MODULE_UPPER})
|
||||
|
||||
# if the user hasn't specified any location, and it isn't found
|
||||
# in standard system locations either, then start to wander
|
||||
# about and look for it in proximity to ourself. Qt Creator likes
|
||||
# to put the build-directories as siblings to the source trees,
|
||||
# but with a -build suffix, DUNE likes to have the the build tree
|
||||
# in a "build-cmake" sub-directory of each module
|
||||
if (NOT (${module}_DIR OR ${module}_ROOT OR ${MODULE}_ROOT))
|
||||
string (TOLOWER "${module}" _module_lower)
|
||||
set (_guess
|
||||
"../${module}"
|
||||
"../${_module_lower}"
|
||||
)
|
||||
set (_guess_bin_only
|
||||
"../${module}-build"
|
||||
"../${_module_lower}-build"
|
||||
)
|
||||
# try to figure out whether we are in a subdir build tree, and attempt
|
||||
# to put the same name as the appropriate build tree for the module
|
||||
get_filename_component (_build_dir "${CMAKE_CURRENT_BINARY_DIR}" NAME)
|
||||
|
||||
# don't bother if we are in a project specific directory already
|
||||
# (assuming no-one wants to name the build dir after another module!)
|
||||
if ("${_build_dir}" STREQUAL "${PROJECT_NAME}")
|
||||
set (_build_dir "")
|
||||
endif ("${_build_dir}" STREQUAL "${PROJECT_NAME}")
|
||||
|
||||
# look in similar dirs for the other module
|
||||
list (APPEND _guess_bin_only
|
||||
"../../${module}/${_build_dir}"
|
||||
"../../${_module_lower}/${_build_dir}"
|
||||
)
|
||||
|
||||
# generate items that are in the build, not source dir
|
||||
set (_guess_bin)
|
||||
foreach (_item IN ITEMS ${_guess} ${_guess_bin_only})
|
||||
list (APPEND _guess_bin "${PROJECT_BINARY_DIR}/${_item}")
|
||||
endforeach (_item)
|
||||
set (_no_system "")
|
||||
else (NOT (${module}_DIR OR ${module}_ROOT OR ${MODULE}_ROOT))
|
||||
# start looking at the paths in this order
|
||||
set (_guess_bin
|
||||
${${module}_DIR}
|
||||
${${module}_ROOT}
|
||||
${${MODULE}_ROOT}
|
||||
)
|
||||
# if every package is installed directly in the "suite" directory
|
||||
# (e.g. /usr) then allow us to back-track one directory from the
|
||||
# module sub-dir that was added by OpmFind (this happens incidently
|
||||
# already for the source do to the out-of-source support)
|
||||
if ("${${MODULE}_ROOT}" MATCHES "/${module}$")
|
||||
get_filename_component (_suite_parent ${${MODULE}_ROOT} PATH)
|
||||
list (APPEND _guess_bin
|
||||
${_suite_parent}
|
||||
${_suite_parent}/${module}
|
||||
${_suite_parent}/${module}/${_build_dir}
|
||||
)
|
||||
endif ("${${MODULE}_ROOT}" MATCHES "/${module}$")
|
||||
# when we look for the source, it may be that we have been specified
|
||||
# a build directory which is a sub-dir of the source, so we look in
|
||||
# the parent also
|
||||
set (_guess
|
||||
${${module}_DIR}
|
||||
${${module}_ROOT}
|
||||
${${MODULE}_ROOT}
|
||||
${${module}_DIR}/..
|
||||
${${module}_ROOT}/..
|
||||
${${MODULE}_ROOT}/..
|
||||
)
|
||||
# don't search the system paths! that would be dangerous; if there
|
||||
# is a problem in our own specified directory, we don't necessarily
|
||||
# want an old version that is left in one of the system paths!
|
||||
set (_no_system "NO_DEFAULT_PATH")
|
||||
endif (NOT (${module}_DIR OR ${module}_ROOT OR ${MODULE}_ROOT))
|
||||
|
||||
# by specifying _guess in the HINTS section, it gets searched before
|
||||
# the system locations as well. the CMake documentation has a cloudy
|
||||
# recommendation, but it ends up like this: if NO_DEFAULT_PATH is
|
||||
# specified, then PATHS is used. Otherwise, it looks in HINTS, then in
|
||||
# system paths, and the finally in PATHS (!)
|
||||
if (SIBLING_SEARCH)
|
||||
set (_guess_hints ${_guess})
|
||||
set (_guess_hints_bin ${_guess_bin})
|
||||
else (SIBLING_SEARCH)
|
||||
set (_guess_hints)
|
||||
set (_guess_hints_bin)
|
||||
endif (SIBLING_SEARCH)
|
||||
|
||||
# search for this include and library file to get the installation
|
||||
# directory of the package; hints are searched before the system locations,
|
||||
# paths are searched afterwards
|
||||
find_path (${module}_INCLUDE_DIR
|
||||
NAMES "${header}"
|
||||
PATHS ${_guess}
|
||||
HINTS ${PkgConf_${module}_INCLUDE_DIRS} ${_guess_hints}
|
||||
PATH_SUFFIXES "include"
|
||||
${_no_system}
|
||||
)
|
||||
|
||||
# some modules are all in headers
|
||||
if (NOT "${lib}" STREQUAL "")
|
||||
if (CMAKE_SIZEOF_VOID_P)
|
||||
math (EXPR _BITS "8 * ${CMAKE_SIZEOF_VOID_P}")
|
||||
endif (CMAKE_SIZEOF_VOID_P)
|
||||
find_library (${module}_LIBRARY
|
||||
NAMES "${lib}"
|
||||
PATHS ${_guess_bin}
|
||||
HINTS ${PkgConf_${module}_LIBRARY_DIRS} ${_guess_hints_bin}
|
||||
PATH_SUFFIXES "lib" "lib/.libs" ".libs" "lib${_BITS}" "lib/${CMAKE_LIBRARY_ARCHITECTURE}" "build-cmake/lib"
|
||||
${_no_system}
|
||||
)
|
||||
else (NOT "${lib}" STREQUAL "")
|
||||
set (${module}_LIBRARY "")
|
||||
endif (NOT "${lib}" STREQUAL "")
|
||||
|
||||
# add dependencies so that our result variables are complete
|
||||
# list of necessities to build with the software
|
||||
set (${module}_INCLUDE_DIRS "${${module}_INCLUDE_DIR}")
|
||||
set (${module}_LIBRARIES "${${module}_LIBRARY}")
|
||||
set (_deps)
|
||||
foreach (_dep IN ITEMS ${deps})
|
||||
separate_arguments (_args UNIX_COMMAND ${_dep})
|
||||
if (_args)
|
||||
find_and_append_package_to (${module} ${_args} ${${module}_QUIET})
|
||||
list (GET _args 0 _name_only)
|
||||
list (APPEND _deps ${_name_only})
|
||||
else (_args)
|
||||
message (WARNING "Empty dependency in find module for ${module} (check for trailing semi-colon)")
|
||||
endif (_args)
|
||||
endforeach (_dep)
|
||||
|
||||
# since find_and_append_package_to is a macro, this variable have
|
||||
# probably been overwritten (due to its common name); it is now
|
||||
# this module's last dependency instead of the name of the module
|
||||
# itself, so it must be restored
|
||||
string (TOUPPER ${module} MODULE_UPPER)
|
||||
string (REPLACE "-" "_" MODULE ${MODULE_UPPER})
|
||||
|
||||
# compile with this option to avoid avalanche of warnings
|
||||
set (${module}_DEFINITIONS "${${module}_DEFINITIONS}")
|
||||
foreach (_def IN ITEMS ${defs})
|
||||
list (APPEND ${module}_DEFINITIONS "-D${_def}")
|
||||
endforeach (_def)
|
||||
|
||||
# tidy the lists before returning them
|
||||
remove_dup_deps (${module})
|
||||
|
||||
# these defines are used in dune/${module} headers, and should be put
|
||||
# in config.h when we include those
|
||||
foreach (_var IN ITEMS ${conf})
|
||||
# massage the name to remove source code formatting
|
||||
string (REGEX REPLACE "^[\n\t\ ]+" "" _var "${_var}")
|
||||
string (REGEX REPLACE "[\n\t\ ]+$" "" _var "${_var}")
|
||||
list (APPEND ${module}_CONFIG_VARS ${_var})
|
||||
endforeach (_var)
|
||||
|
||||
# these are the defines that should be set when compiling
|
||||
# without config.h
|
||||
config_cmd_line (${module}_CMD_CONFIG ${module}_CONFIG_VARS)
|
||||
|
||||
# check that we can compile a small test-program
|
||||
include (CMakePushCheckState)
|
||||
cmake_push_check_state ()
|
||||
include (CheckCXXSourceCompiles)
|
||||
# only add these if they are actually found; otherwise it won't
|
||||
# compile and the variable won't be set
|
||||
append_found (${module}_INCLUDE_DIRS CMAKE_REQUIRED_INCLUDES)
|
||||
append_found (${module}_LIBRARIES CMAKE_REQUIRED_LIBRARIES)
|
||||
# since we don't have any config.h yet
|
||||
list (APPEND CMAKE_REQUIRED_DEFINITIONS ${${module}_DEFINITIONS})
|
||||
list (APPEND CMAKE_REQUIRED_DEFINITIONS ${${module}_CMD_CONFIG})
|
||||
check_cxx_source_compiles ("${prog}" HAVE_${MODULE})
|
||||
cmake_pop_check_state ()
|
||||
|
||||
# write status message in the same manner as everyone else
|
||||
include (FindPackageHandleStandardArgs)
|
||||
if ("${lib}" STREQUAL "")
|
||||
set (_lib_var "")
|
||||
set (_and_lib_var)
|
||||
else ("${lib}" STREQUAL "")
|
||||
set (_lib_var "${module}_LIBRARY")
|
||||
set (_and_lib_var AND ${_lib_var})
|
||||
endif ("${lib}" STREQUAL "")
|
||||
# if the search is going to fail, then write these variables to
|
||||
# the console as well as a diagnostics
|
||||
if (NOT (${module}_INCLUDE_DIR ${_and_lib_var} AND HAVE_${MODULE})
|
||||
AND (${module}_FIND_REQUIRED OR NOT ${module}_FIND_QUIETLY))
|
||||
if (DEFINED ${module}_DIR)
|
||||
message ("${module}_DIR = ${${module}_DIR}")
|
||||
elseif (DEFINED ${module}_ROOT)
|
||||
message ("${module}_ROOT = ${${module}_ROOT}")
|
||||
elseif (DEFINED ${MODULE}_ROOT)
|
||||
message ("${MODULE}_ROOT = ${${MODULE}_ROOT}")
|
||||
endif (DEFINED ${module}_DIR)
|
||||
endif (NOT (${module}_INCLUDE_DIR ${_and_lib_var} AND HAVE_${MODULE})
|
||||
AND (${module}_FIND_REQUIRED OR NOT ${module}_FIND_QUIETLY))
|
||||
find_package_handle_standard_args (
|
||||
${module}
|
||||
DEFAULT_MSG
|
||||
${module}_INCLUDE_DIR ${_lib_var} HAVE_${MODULE}
|
||||
)
|
||||
|
||||
# allow the user to override these from user interface
|
||||
mark_as_advanced (${module}_INCLUDE_DIR)
|
||||
mark_as_advanced (${module}_LIBRARY)
|
||||
|
||||
# some genius that coded the FindPackageHandleStandardArgs figured out
|
||||
# that the module name should be in uppercase (?!)
|
||||
set (${module}_FOUND "${${MODULE_UPPER}_FOUND}")
|
||||
|
||||
# print everything out if we're asked to
|
||||
if (${module}_DEBUG)
|
||||
debug_find_vars (${module})
|
||||
endif (${module}_DEBUG)
|
||||
endmacro (find_opm_package module deps header lib defs prog conf)
|
||||
|
||||
# print all variables defined by the above macro
|
||||
function (debug_find_vars module)
|
||||
message (STATUS "${module}_FOUND = ${${module}_FOUND}")
|
||||
message (STATUS "${module}_INCLUDE_DIRS = ${${module}_INCLUDE_DIRS}")
|
||||
message (STATUS "${module}_LIBRARIES = ${${module}_LIBRARIES}")
|
||||
message (STATUS "${module}_DEFINITIONS = ${${module}_DEFINITIONS}")
|
||||
message (STATUS "${module}_CONFIG_VARS = ${${module}_CONFIG_VARS}")
|
||||
message (STATUS "${module}_LINKER_FLAGS = ${${module}_LINKER_FLAGS}")
|
||||
message (STATUS "${module}_QUIET = ${${module}_QUIET}")
|
||||
string (TOUPPER ${module} MODULE)
|
||||
string (REPLACE "-" "_" MODULE ${MODULE})
|
||||
message (STATUS "HAVE_${MODULE} = ${HAVE_${MODULE}}")
|
||||
endfunction (debug_find_vars module)
|
||||
|
||||
# generate a command-line that can be used to pass variables before
|
||||
# config.h is available (such as probe tests). varname is the *name*
|
||||
# of the variable to receive the result, defs is a list of the *names*
|
||||
# which should be passed
|
||||
function (config_cmd_line varname defs)
|
||||
# process each variable
|
||||
foreach (_var IN LISTS ${defs})
|
||||
# only generate an entry if the define was actually set
|
||||
if ((DEFINED ${_var}) AND (NOT "${${_var}}" STREQUAL ""))
|
||||
# numbers are not quoted, strings are
|
||||
if (${_var} MATCHES "[0-9]+")
|
||||
set (_quoted "${${_var}}")
|
||||
else (${_var} MATCHES "[0-9]+")
|
||||
set (_quoted "\"${${_var}}\"")
|
||||
endif (${_var} MATCHES "[0-9]+")
|
||||
# add command-line option to define this variable
|
||||
list (APPEND _cmdline "-D${_var}=${_quoted}")
|
||||
endif ((DEFINED ${_var}) AND (NOT "${${_var}}" STREQUAL ""))
|
||||
endforeach (_var)
|
||||
# return the resulting command-line options for defining vars
|
||||
set (${varname} "${_cmdline}" PARENT_SCOPE)
|
||||
endfunction (config_cmd_line)
|
||||
145
cmake/Modules/OpmProject.cmake
Normal file
145
cmake/Modules/OpmProject.cmake
Normal file
@@ -0,0 +1,145 @@
|
||||
# - Helper routines for opm-core like projects
|
||||
|
||||
include (LibtoolArchives) # linker_cmdline
|
||||
|
||||
# convert a list back to a command-line string
|
||||
function (unseparate_args var_name prefix value)
|
||||
separate_arguments (value)
|
||||
foreach (item IN LISTS value)
|
||||
set (prefixed_item "${prefix}${item}")
|
||||
if (${var_name})
|
||||
set (${var_name} "${${var_name}} ${prefixed_item}")
|
||||
else (${var_name})
|
||||
set (${var_name} "${prefixed_item}")
|
||||
endif (${var_name})
|
||||
endforeach (item)
|
||||
set (${var_name} "${${var_name}}" PARENT_SCOPE)
|
||||
endfunction (unseparate_args var_name prefix value)
|
||||
|
||||
# wrapper to set variables in pkg-config file
|
||||
function (configure_pc_file name source dest prefix libdir includedir)
|
||||
# escape set of standard strings
|
||||
unseparate_args (includes "-I" "${${name}_INCLUDE_DIRS}")
|
||||
unseparate_args (defs "" "${${name}_DEFINITIONS}")
|
||||
linker_cmdline (STRING INTO libs FROM ${${name}_LIBRARIES})
|
||||
|
||||
# necessary to make these variables visible to configure_file
|
||||
set (name "${${name}_NAME}")
|
||||
set (description "${${name}_DESCRIPTION}")
|
||||
set (major "${${name}_VERSION_MAJOR}")
|
||||
set (minor "${${name}_VERSION_MINOR}")
|
||||
set (target "${${name}_LIBRARY}")
|
||||
linker_cmdline (STRING INTO target from ${target})
|
||||
|
||||
configure_file (${source} ${dest} @ONLY)
|
||||
endfunction (configure_pc_file name source dist prefix libdir includedir)
|
||||
|
||||
function (configure_cmake_file name variant version)
|
||||
# declarative list of the variable names that are used in the template
|
||||
# and that must be defined in the project to be exported
|
||||
set (variable_suffices
|
||||
DESCRIPTION
|
||||
VERSION
|
||||
DEFINITIONS
|
||||
INCLUDE_DIRS
|
||||
LIBRARY_DIRS
|
||||
LINKER_FLAGS
|
||||
CONFIG_VARS
|
||||
LIBRARY
|
||||
LIBRARIES
|
||||
TARGET
|
||||
)
|
||||
|
||||
# set these variables temporarily (this is in a function scope) so
|
||||
# they are available to the template (only)
|
||||
foreach (suffix IN LISTS variable_suffices)
|
||||
set (opm-project_${suffix} "${${name}_${suffix}}")
|
||||
endforeach (suffix)
|
||||
set (opm-project_NAME "${${name}_NAME}")
|
||||
|
||||
# make the file substitutions
|
||||
configure_file (
|
||||
${template_dir}/opm-project-config${version}.cmake.in
|
||||
${PROJECT_BINARY_DIR}/${${name}_NAME}-${variant}${version}.cmake
|
||||
@ONLY
|
||||
)
|
||||
endfunction (configure_cmake_file name)
|
||||
|
||||
# installation of CMake modules to help user programs locate the library
|
||||
function (opm_cmake_config name)
|
||||
# assume that the template is located in cmake/Templates (cannot use
|
||||
# the current directory since this is in a function and the directory
|
||||
# at runtime not at definition will be used
|
||||
set (template_dir "${PROJECT_SOURCE_DIR}/cmake/Templates")
|
||||
|
||||
# write configuration file to locate library
|
||||
configure_cmake_file (${name} "config" "")
|
||||
configure_cmake_file (${name} "config" "-version")
|
||||
configure_vars (
|
||||
FILE CMAKE "${PROJECT_BINARY_DIR}/${${name}_NAME}-config.cmake"
|
||||
APPEND "${${name}_CONFIG_VARS}"
|
||||
)
|
||||
|
||||
# config-mode .pc file; use this to find the build tree
|
||||
configure_pc_file (
|
||||
${name}
|
||||
${template_dir}/opm-project.pc.in
|
||||
${PROJECT_BINARY_DIR}/${${name}_NAME}.pc
|
||||
${PROJECT_BINARY_DIR}
|
||||
${CMAKE_LIBRARY_OUTPUT_DIRECTORY}
|
||||
${PROJECT_SOURCE_DIR}
|
||||
)
|
||||
|
||||
# replace the build directory with the target directory in the
|
||||
# variables that contains build paths
|
||||
string (REPLACE
|
||||
"${PROJECT_SOURCE_DIR}"
|
||||
"${CMAKE_INSTALL_PREFIX}/include"
|
||||
${name}_INCLUDE_DIRS
|
||||
"${${name}_INCLUDE_DIRS}"
|
||||
)
|
||||
string (REPLACE
|
||||
"${CMAKE_LIBRARY_OUTPUT_DIRECTORY}"
|
||||
"${CMAKE_INSTALL_PREFIX}/${CMAKE_INSTALL_LIBDIR}"
|
||||
${name}_LIBRARY
|
||||
"${${name}_LIBRARY}"
|
||||
)
|
||||
set (CMAKE_LIBRARY_OUTPUT_DIRECTORY
|
||||
"${CMAKE_INSTALL_PREFIX}/${CMAKE_INSTALL_LIBDIR}"
|
||||
)
|
||||
# create a config mode file which targets the install directory instead
|
||||
# of the build directory (using the same input template)
|
||||
configure_cmake_file (${name} "install" "")
|
||||
configure_vars (
|
||||
FILE CMAKE "${PROJECT_BINARY_DIR}/${${name}_NAME}-install.cmake"
|
||||
APPEND "${${name}_CONFIG_VARS}"
|
||||
)
|
||||
# this file gets copied to the final installation directory
|
||||
install (
|
||||
FILES ${PROJECT_BINARY_DIR}/${${name}_NAME}-install.cmake
|
||||
DESTINATION share/cmake/${${name}_NAME}
|
||||
RENAME ${${name}_NAME}-config.cmake
|
||||
)
|
||||
# assume that there exists a version file already
|
||||
install (
|
||||
FILES ${PROJECT_BINARY_DIR}/${${name}_NAME}-config-version.cmake
|
||||
DESTINATION share/cmake/${${name}_NAME}
|
||||
)
|
||||
|
||||
# find-mode .pc file; use this to locate system installation
|
||||
configure_pc_file (
|
||||
${name}
|
||||
${template_dir}/opm-project.pc.in
|
||||
${PROJECT_BINARY_DIR}/${${name}_NAME}-install.pc
|
||||
${CMAKE_INSTALL_PREFIX}
|
||||
${CMAKE_INSTALL_PREFIX}/${CMAKE_INSTALL_LIBDIR}
|
||||
${CMAKE_INSTALL_PREFIX}/include
|
||||
)
|
||||
|
||||
# put this in the right system location; assume that we have binaries
|
||||
install (
|
||||
FILES ${PROJECT_BINARY_DIR}/${${name}_NAME}-install.pc
|
||||
DESTINATION ${CMAKE_INSTALL_PREFIX}/${CMAKE_INSTALL_LIBDIR}/pkgconfig/
|
||||
RENAME ${${name}_NAME}.pc
|
||||
)
|
||||
endfunction (opm_cmake_config name)
|
||||
157
cmake/Modules/OpmSatellites.cmake
Normal file
157
cmake/Modules/OpmSatellites.cmake
Normal file
@@ -0,0 +1,157 @@
|
||||
# - Build satellites that are dependent of main library
|
||||
#
|
||||
# Enumerate all source code in a "satellite" directory such as tests/,
|
||||
# compile each of them and optionally set them as a test for CTest to
|
||||
# run. They will be linked to the main library created by the project.
|
||||
#
|
||||
# The following suffices must be defined for the opm prefix passed as
|
||||
# parameter:
|
||||
#
|
||||
# _LINKER_FLAGS Necessary flags to link with this library
|
||||
# _TARGET CMake target which creates the library
|
||||
# _LIBRARIES Other dependencies that must also be linked
|
||||
|
||||
# Synopsis:
|
||||
# opm_compile_satellites (opm satellite excl_all test_regexp)
|
||||
#
|
||||
# Parameters:
|
||||
# opm Prefix of the variable which contain information
|
||||
# about the library these satellites depends on, e.g.
|
||||
# pass "opm-core" if opm-core_TARGET is the name of
|
||||
# the target the builds this library. Variables with
|
||||
# suffixes _TARGET and _LIBRARIES must exist.
|
||||
#
|
||||
# satellite Prefix of variable which contain the names of the
|
||||
# files, e.g. pass "tests" if the files are in the
|
||||
# variable tests_SOURCES. Variables with suffixes
|
||||
# _DATAFILES, _SOURCES and _DIR should exist. This
|
||||
# name is also used as name of the target that builds
|
||||
# all these files.
|
||||
#
|
||||
# excl_all EXCLUDE_ALL if these targets should not be built by
|
||||
# default, otherwise empty string.
|
||||
#
|
||||
# test_regexp Regular expression which picks the name of a test
|
||||
# out of the filename, or blank if no test should be
|
||||
# setup.
|
||||
#
|
||||
# Example:
|
||||
# opm_compile_satellites (opm-core test "" "^test_([^/]*)$")
|
||||
#
|
||||
macro (opm_compile_satellites opm satellite excl_all test_regexp)
|
||||
# if we are going to build the tests always, then make sure that
|
||||
# the datafiles are present too
|
||||
if (NOT (${excl_all} MATCHES "EXCLUDE_ALL"))
|
||||
set (_incl_all "ALL")
|
||||
else (NOT (${excl_all} MATCHES "EXCLUDE_ALL"))
|
||||
set (_incl_all "")
|
||||
endif (NOT (${excl_all} MATCHES "EXCLUDE_ALL"))
|
||||
|
||||
# if a set of datafiles has been setup, pull those in
|
||||
add_custom_target (${satellite} ${_incl_all})
|
||||
if (${satellite}_DATAFILES)
|
||||
add_dependencies (${satellite} ${${satellite}_DATAFILES})
|
||||
endif (${satellite}_DATAFILES)
|
||||
|
||||
# compile each of these separately
|
||||
foreach (_sat_FILE IN LISTS ${satellite}_SOURCES)
|
||||
get_filename_component (_sat_NAME "${_sat_FILE}" NAME_WE)
|
||||
add_executable (${_sat_NAME} ${excl_all} ${_sat_FILE})
|
||||
add_dependencies (${satellite} ${_sat_NAME})
|
||||
set_target_properties (${_sat_NAME} PROPERTIES
|
||||
LINK_FLAGS "${${opm}_LINKER_FLAGS_STR}"
|
||||
)
|
||||
# are we building a test? luckily, the testing framework doesn't
|
||||
# require anything else, so we don't have to figure out where it
|
||||
# should go in the library list
|
||||
if (NOT "${test_regexp}" STREQUAL "")
|
||||
set (_test_lib "${Boost_UNIT_TEST_FRAMEWORK_LIBRARY}")
|
||||
else (NOT "${test_regexp}" STREQUAL "")
|
||||
set (_test_lib "")
|
||||
endif (NOT "${test_regexp}" STREQUAL "")
|
||||
target_link_libraries (${_sat_NAME} ${${opm}_TARGET} ${${opm}_LIBRARIES} ${_test_lib})
|
||||
strip_debug_symbols (${_sat_NAME} _sat_DEBUG)
|
||||
list (APPEND ${satellite}_DEBUG ${_sat_DEBUG})
|
||||
|
||||
# variable with regular expression doubles as a flag for
|
||||
# whether tests should be setup or not
|
||||
if (NOT "${test_regexp}" STREQUAL "")
|
||||
foreach (_regexp IN ITEMS ${test_regexp})
|
||||
if ("${_sat_NAME}" MATCHES "${_regexp}")
|
||||
string (REGEX REPLACE "${_regexp}" "\\1" _sat_FANCY "${_sat_NAME}")
|
||||
endif ("${_sat_NAME}" MATCHES "${_regexp}")
|
||||
endforeach (_regexp)
|
||||
get_target_property (_sat_LOC ${_sat_NAME} LOCATION)
|
||||
if (CMAKE_VERSION VERSION_LESS "2.8.4")
|
||||
add_test (
|
||||
NAME ${_sat_FANCY}
|
||||
COMMAND ${CMAKE_COMMAND} -E chdir "${PROJECT_BINARY_DIR}/${${satellite}_DIR}" ${_sat_LOC}
|
||||
)
|
||||
else (CMAKE_VERSION VERSION_LESS "2.8.4")
|
||||
add_test (${_sat_FANCY} ${_sat_LOC})
|
||||
# run the test in the directory where the data files are
|
||||
set_tests_properties (${_sat_FANCY} PROPERTIES
|
||||
WORKING_DIRECTORY ${PROJECT_BINARY_DIR}/${${satellite}_DIR}
|
||||
)
|
||||
endif (CMAKE_VERSION VERSION_LESS "2.8.4")
|
||||
endif(NOT "${test_regexp}" STREQUAL "")
|
||||
|
||||
# if this program on the list of files that should be distributed?
|
||||
# we check by the name of the source file
|
||||
list (FIND ${satellite}_SOURCES_DIST "${_sat_FILE}" _is_util)
|
||||
if (NOT (_is_util EQUAL -1))
|
||||
install (TARGETS ${_sat_NAME} RUNTIME
|
||||
DESTINATION bin/
|
||||
)
|
||||
endif (NOT (_is_util EQUAL -1))
|
||||
endforeach (_sat_FILE)
|
||||
endmacro (opm_compile_satellites opm prefix)
|
||||
|
||||
# Synopsis:
|
||||
# opm_data (satellite target dirname files)
|
||||
#
|
||||
# provides these output variables:
|
||||
#
|
||||
# ${satellite}_INPUT_FILES List of all files that are copied
|
||||
# ${satellite}_DATAFILES Name of target which copies these files
|
||||
#
|
||||
# Example:
|
||||
#
|
||||
# opm_data (tests datafiles "tests/")
|
||||
#
|
||||
macro (opm_data satellite target dirname)
|
||||
# even if there are no datafiles, create the directory so the
|
||||
# satellite programs have a homedir to run in
|
||||
execute_process (
|
||||
COMMAND ${CMAKE_COMMAND} -E make_directory ${dirname}
|
||||
)
|
||||
|
||||
# if ever huge test datafiles are necessary, then change this
|
||||
# into "create_symlink" (on UNIX only, apparently)
|
||||
set (make_avail "copy")
|
||||
|
||||
# provide datafiles as inputs for the tests, by copying them
|
||||
# to a tests/ directory in the output tree (if different)
|
||||
set (${satellite}_INPUT_FILES)
|
||||
if (NOT PROJECT_SOURCE_DIR STREQUAL PROJECT_BINARY_DIR)
|
||||
foreach (input_datafile IN LISTS ${satellite}_DATA)
|
||||
file (RELATIVE_PATH rel_datafile "${PROJECT_SOURCE_DIR}" ${input_datafile})
|
||||
set (output_datafile "${PROJECT_BINARY_DIR}/${rel_datafile}")
|
||||
add_custom_command (
|
||||
OUTPUT ${output_datafile}
|
||||
COMMAND ${CMAKE_COMMAND}
|
||||
ARGS -E ${make_avail} ${input_datafile} ${output_datafile}
|
||||
DEPENDS ${input_datafile}
|
||||
VERBATIM
|
||||
)
|
||||
list (APPEND ${satellite}_INPUT_FILES "${output_datafile}")
|
||||
endforeach (input_datafile)
|
||||
endif(NOT PROJECT_SOURCE_DIR STREQUAL PROJECT_BINARY_DIR)
|
||||
|
||||
# setup a target which does all the copying
|
||||
set (${satellite}_DATAFILES "${target}")
|
||||
add_custom_target (${${satellite}_DATAFILES}
|
||||
DEPENDS ${${satellite}_INPUT_FILES}
|
||||
COMMENT "Making \"${satellite}\" data available in output tree"
|
||||
)
|
||||
endmacro (opm_data satellite target dirname files)
|
||||
47
cmake/Modules/UseCompVer.cmake
Normal file
47
cmake/Modules/UseCompVer.cmake
Normal file
@@ -0,0 +1,47 @@
|
||||
# - Get compiler version
|
||||
|
||||
# probe the GCC version, returns empty string if GCC is not compiler
|
||||
function (get_gcc_version language ver_name)
|
||||
if(CMAKE_${language}_COMPILER_ID STREQUAL GNU)
|
||||
# exec_program is deprecated, but execute_process does't work :-(
|
||||
exec_program (${CMAKE_${language}_COMPILER}
|
||||
ARGS ${CMAKE_${language}_COMPILER_ARG1} -dumpversion
|
||||
OUTPUT_VARIABLE _version
|
||||
)
|
||||
set (${ver_name} ${_version} PARENT_SCOPE)
|
||||
else (CMAKE_${language}_COMPILER_ID STREQUAL GNU)
|
||||
set (${ver_name} "" PARENT_SCOPE)
|
||||
endif (CMAKE_${language}_COMPILER_ID STREQUAL GNU)
|
||||
endfunction (get_gcc_version ver_name)
|
||||
|
||||
# less reliable, but includes the patch number
|
||||
function (get_gcc_patch language ver_name)
|
||||
if(CMAKE_${language}_COMPILER_ID STREQUAL GNU)
|
||||
# exec_program is deprecated, but execute_process does't work :-(
|
||||
exec_program (${CMAKE_${language}_COMPILER}
|
||||
ARGS ${CMAKE_${language}_COMPILER_ARG1} --version
|
||||
OUTPUT_VARIABLE _version
|
||||
)
|
||||
# split multi-line string into list
|
||||
if (WIN32)
|
||||
string (REPLACE "\r\n" ";" _version "${_version}")
|
||||
else (WIN32)
|
||||
string (REPLACE "\n" ";" _version "${_version}")
|
||||
endif (WIN32)
|
||||
# only keep first line
|
||||
list (GET _version 0 _version)
|
||||
# extract version number from it (this is the fragile part)
|
||||
string (REGEX REPLACE "^[^\\(]+(\\([^\\)]*\\))?[\ \t]*([0-9]+\\.[0-9]+\\.[0-9]+)(.*\\(.*\\))?" "\\2" _version "${_version}")
|
||||
# return this to the caller
|
||||
set (${ver_name} ${_version} PARENT_SCOPE)
|
||||
else (CMAKE_${language}_COMPILER_ID STREQUAL GNU)
|
||||
set (${ver_name} "" PARENT_SCOPE)
|
||||
endif (CMAKE_${language}_COMPILER_ID STREQUAL GNU)
|
||||
endfunction (get_gcc_patch language ver_name)
|
||||
|
||||
function (compiler_info)
|
||||
if (CMAKE_COMPILER_IS_GNUCXX)
|
||||
get_gcc_patch (CXX version)
|
||||
message (STATUS "GNU C++ compiler version: ${version}")
|
||||
endif (CMAKE_COMPILER_IS_GNUCXX)
|
||||
endfunction (compiler_info)
|
||||
102
cmake/Modules/UseDebugSymbols.cmake
Normal file
102
cmake/Modules/UseDebugSymbols.cmake
Normal file
@@ -0,0 +1,102 @@
|
||||
# - Generate debug symbols in a separate file
|
||||
#
|
||||
# (1) Include this file in your CMakeLists.txt; it will setup everything
|
||||
# to compile WITH debug symbols in any case.
|
||||
#
|
||||
# (2) Run the strip_debug_symbols function on every target that you want
|
||||
# to strip.
|
||||
|
||||
# Copyright (C) 2012 Uni Research AS
|
||||
# This code is licensed under The GNU General Public License v3.0
|
||||
|
||||
include (AddOptions)
|
||||
|
||||
# only debugging using the GNU toolchain is supported for now
|
||||
if (CMAKE_COMPILER_IS_GNUCXX)
|
||||
# default debug level, if not specified by the user
|
||||
set_default_option (_dbg_flag "-ggdb3" "(^|\ )-g")
|
||||
|
||||
# add debug symbols to *all* targets, regardless. there WILL come a
|
||||
# time when you need to find a bug which only manifests itself in a
|
||||
# release target on a production system!
|
||||
if (_dbg_flag)
|
||||
message (STATUS "Generating debug symbols: ${_dbg_flag}")
|
||||
add_options (ALL_LANGUAGES ALL_BUILDS "${_dbg_flag}")
|
||||
endif (_dbg_flag)
|
||||
|
||||
# extracting the debug info is done by a separate utility in the GNU
|
||||
# toolchain. check that this is actually installed.
|
||||
message (STATUS "Looking for strip utility")
|
||||
find_program (OBJCOPY
|
||||
objcopy
|
||||
${CYGWIN_INSTALL_PATH}/bin /usr/bin /usr/local/bin
|
||||
)
|
||||
mark_as_advanced (OBJCOPY)
|
||||
if (OBJCOPY)
|
||||
message (STATUS "Looking for strip utility - found")
|
||||
else (OBJCOPY)
|
||||
message (WARNING "Looking for strip utility - not found")
|
||||
endif (OBJCOPY)
|
||||
endif (CMAKE_COMPILER_IS_GNUCXX)
|
||||
|
||||
# command to separate the debug information from the executable into
|
||||
# its own file; this must be called for each target; optionally takes
|
||||
# the name of a variable to receive the list of .debug files
|
||||
function (strip_debug_symbols targets)
|
||||
if (CMAKE_COMPILER_IS_GNUCXX AND OBJCOPY)
|
||||
foreach (target IN LISTS targets)
|
||||
# libraries must retain the symbols in order to link to them, but
|
||||
# everything can be stripped in an executable
|
||||
get_target_property (_kind ${target} TYPE)
|
||||
|
||||
# don't strip static libraries
|
||||
if ("${_kind}" STREQUAL "STATIC_LIBRARY")
|
||||
return ()
|
||||
endif ("${_kind}" STREQUAL "STATIC_LIBRARY")
|
||||
|
||||
# don't strip public symbols in shared objects
|
||||
if ("${_kind}" STREQUAL "EXECUTABLE")
|
||||
set (_strip_args "--strip-all")
|
||||
else ("${_kind}" STREQUAL "EXECUTABLE")
|
||||
set (_strip_args "--strip-debug")
|
||||
endif ("${_kind}" STREQUAL "EXECUTABLE")
|
||||
|
||||
# add_custom_command doesn't support generator expressions in the
|
||||
# working_directory argument (sic; that's what you get when you do
|
||||
# ad hoc programming all the time), so we need to extract the
|
||||
# location up front (the location on the other hand should not be
|
||||
# used for libraries as it does not include the soversion -- sic
|
||||
# again)
|
||||
get_target_property (_full ${target} LOCATION)
|
||||
get_filename_component (_dir ${_full} PATH)
|
||||
get_filename_component (_name ${_full} NAME)
|
||||
# only libraries have soversion property attached
|
||||
get_target_property (_target_soversion ${target} SOVERSION)
|
||||
get_target_property (_target_version ${target} VERSION)
|
||||
if (_target_soversion)
|
||||
set (_target_file "${_full}.${_target_version}")
|
||||
set (_target_file_name "${_name}.${_target_version}")
|
||||
else (_target_soversion)
|
||||
set (_target_file "${_full}")
|
||||
set (_target_file_name "${_name}")
|
||||
endif (_target_soversion)
|
||||
# do without generator expressions (which doesn't work everywhere)
|
||||
add_custom_command (TARGET ${target}
|
||||
POST_BUILD
|
||||
WORKING_DIRECTORY ${_dir}
|
||||
COMMAND ${OBJCOPY} ARGS --only-keep-debug ${_target_file} ${_target_file}.debug
|
||||
COMMAND ${OBJCOPY} ARGS ${_strip_args} ${_target_file}
|
||||
COMMAND ${OBJCOPY} ARGS --add-gnu-debuglink=${_target_file_name}.debug ${_target_file}
|
||||
VERBATIM
|
||||
)
|
||||
# add this .debug file to the list
|
||||
file (RELATIVE_PATH _this_debug_file "${PROJECT_BINARY_DIR}" "${_target_file}.debug")
|
||||
set (_debug_files ${_debug_files} ${_this_debug_file})
|
||||
endforeach (target)
|
||||
# if optional debug list was requested, then copy to output parameter
|
||||
if (ARGV1)
|
||||
set (${ARGV1} ${_debug_files} PARENT_SCOPE)
|
||||
endif (ARGV1)
|
||||
endif (CMAKE_COMPILER_IS_GNUCXX AND OBJCOPY)
|
||||
endfunction (strip_debug_symbols targets)
|
||||
|
||||
33
cmake/Modules/UseDynamicBoost.cmake
Normal file
33
cmake/Modules/UseDynamicBoost.cmake
Normal file
@@ -0,0 +1,33 @@
|
||||
# be sure that this component is searched for
|
||||
find_package (Boost COMPONENTS unit_test_framework QUIET)
|
||||
|
||||
if (${Boost_UNIT_TEST_FRAMEWORK_FOUND})
|
||||
# setup to do a test compile
|
||||
include (CMakePushCheckState)
|
||||
cmake_push_check_state ()
|
||||
include (CheckCXXSourceCompiles)
|
||||
list (APPEND CMAKE_REQUIRED_INCLUDES ${Boost_INCLUDE_DIRS})
|
||||
list (APPEND CMAKE_REQUIRED_LIBRARIES ${Boost_LIBRARIES})
|
||||
|
||||
check_cxx_source_compiles("
|
||||
#define BOOST_TEST_DYN_LINK
|
||||
#define BOOST_TEST_MODULE DYNLINK_TEST
|
||||
#include <boost/test/unit_test.hpp>
|
||||
|
||||
int f(int x) { return 2 * x; }
|
||||
|
||||
BOOST_AUTO_TEST_CASE(DynlinkConfigureTest) {
|
||||
BOOST_CHECK_MESSAGE(f(2) == 4,
|
||||
\"Apparently, multiplication doesn't \"
|
||||
\"work: f(2) = \" << f(2));
|
||||
}" HAVE_DYNAMIC_BOOST_TEST)
|
||||
cmake_pop_check_state ()
|
||||
else (${Boost_UNIT_TEST_FRAMEWORK_FOUND})
|
||||
# no Boost, no compile
|
||||
set (HAVE_DYNAMIC_BOOST_TEST 0)
|
||||
endif (${Boost_UNIT_TEST_FRAMEWORK_FOUND})
|
||||
|
||||
# save this for later
|
||||
set (HAVE_DYNAMIC_BOOST_TEST "${HAVE_DYNAMIC_BOOST_TEST}"
|
||||
CACHE BOOL "Whether Boost::Test is dynamically linked or not"
|
||||
)
|
||||
8
cmake/Modules/UseFastBuilds.cmake
Normal file
8
cmake/Modules/UseFastBuilds.cmake
Normal file
@@ -0,0 +1,8 @@
|
||||
# - Try to build faster depending on the compiler
|
||||
|
||||
# faster builds by using a pipe instead of temp files
|
||||
include (AddOptions)
|
||||
if (CMAKE_COMPILER_IS_GNUCXX)
|
||||
add_options (ALL_LANGUAGES ALL_BUILDS "-pipe")
|
||||
endif (CMAKE_COMPILER_IS_GNUCXX)
|
||||
|
||||
78
cmake/Modules/UseFortranWrappers.cmake
Normal file
78
cmake/Modules/UseFortranWrappers.cmake
Normal file
@@ -0,0 +1,78 @@
|
||||
# - Provide C wrappers for Fortran code
|
||||
#
|
||||
# Synopsis:
|
||||
# define_fc_func (APPEND config.h IF HAVE_BLAS)
|
||||
|
||||
function (define_fc_func verb file)
|
||||
# check that we are being called correctly
|
||||
if (NOT (("${verb}" STREQUAL "APPEND") OR
|
||||
("${verb}" STREQUAL "WRITE")))
|
||||
message (FATAL_ERROR
|
||||
"Unknown verb \"${verb}\" passed as first argument."
|
||||
)
|
||||
endif (NOT (("${verb}" STREQUAL "APPEND") OR
|
||||
("${verb}" STREQUAL "WRITE")))
|
||||
|
||||
# check under which conditions we should do our work
|
||||
if (NOT "${ARGN}" STREQUAL "")
|
||||
set (args ${ARGN})
|
||||
list (GET args 0 keyword)
|
||||
if (NOT "${keyword}" STREQUAL "IF")
|
||||
message (FATAL_ERROR
|
||||
"Unknown conditional \"${keyword}\" passed as third argument."
|
||||
)
|
||||
endif (NOT "${keyword}" STREQUAL "IF")
|
||||
list (REMOVE_AT args 0)
|
||||
set (needed FALSE)
|
||||
foreach (condition IN LISTS args)
|
||||
if (${${condition}})
|
||||
set (needed TRUE)
|
||||
break ()
|
||||
endif (${${condition}})
|
||||
endforeach (condition)
|
||||
else (NOT "${ARGN}" STREQUAL "")
|
||||
# if called unconditionally, then always include the wrapper
|
||||
set (needed TRUE)
|
||||
endif (NOT "${ARGN}" STREQUAL "")
|
||||
|
||||
# only do something if we actually have some components which requires
|
||||
# the interaction -- don't load the Fortran compiler just to write
|
||||
# this macro (which apparently nobody uses then)
|
||||
if (needed)
|
||||
# enable languages needed
|
||||
if (NOT CMAKE_C_COMPILER_LOADED)
|
||||
enable_language (C)
|
||||
endif (NOT CMAKE_C_COMPILER_LOADED)
|
||||
if (NOT CMAKE_Fortran_COMPILER_LOADED)
|
||||
enable_language (Fortran)
|
||||
endif (NOT CMAKE_Fortran_COMPILER_LOADED)
|
||||
|
||||
# get a temporary file
|
||||
set (_tmp_hdr ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeTmp/config_f.h)
|
||||
|
||||
# write a small config file that contains the proper convention for
|
||||
# calling Fortran from C
|
||||
include (FortranCInterface)
|
||||
fortrancinterface_header (${_tmp_hdr})
|
||||
|
||||
# read the definition back in from the file
|
||||
file (STRINGS
|
||||
${_tmp_hdr}
|
||||
_str
|
||||
REGEX "^#define FortranCInterface_GLOBAL\\(name,NAME\\) .*$"
|
||||
)
|
||||
|
||||
# massage it to look like the one AC_FC_WRAPPERS provide
|
||||
string (REPLACE "FortranCInterface_GLOBAL" "FC_FUNC" _str ${_str})
|
||||
|
||||
# write this definition to the end of our own configuration file
|
||||
file (${verb} ${file}
|
||||
"\n/* Define to a macro mangling the given C identifier (in lower and upper
|
||||
case), which must not contain underscores, for linking with Fortran. */\n"
|
||||
${_str}
|
||||
"\n"
|
||||
)
|
||||
else (needed)
|
||||
message (STATUS "Fortran/C interface not activated")
|
||||
endif (needed)
|
||||
endfunction (define_fc_func)
|
||||
42
cmake/Modules/UseMultiArch.cmake
Normal file
42
cmake/Modules/UseMultiArch.cmake
Normal file
@@ -0,0 +1,42 @@
|
||||
# - Multiarch support in object code library directories
|
||||
#
|
||||
# This module sets the following variable
|
||||
# CMAKE_INSTALL_LIBDIR to lib, lib64 or lib/x86_64-linux-gnu
|
||||
# depending on the platform; use this path
|
||||
# for platform-specific binaries.
|
||||
#
|
||||
# CMAKE_INSTALL_LIBDIR_NOARCH to lib or lib64 depending on the platform;
|
||||
# use this path for architecture-independent
|
||||
# files.
|
||||
#
|
||||
# Note that it will override the results of GNUInstallDirs if included after
|
||||
# that module.
|
||||
|
||||
# Fedora uses lib64/ for 64-bit systems, Debian uses lib/x86_64-linux-gnu;
|
||||
# Fedora put module files in lib64/ too, but Debian uses lib/ for that
|
||||
if ("${CMAKE_SYSTEM_NAME}" MATCHES "Linux")
|
||||
# Debian or Ubuntu?
|
||||
if (EXISTS "/etc/debian_version")
|
||||
set (_libdir_def "lib/${CMAKE_LIBRARY_ARCHITECTURE}")
|
||||
set (_libdir_noarch "lib")
|
||||
else (EXISTS "/etc/debian_version")
|
||||
# 64-bit system?
|
||||
if (CMAKE_SIZEOF_VOID_P EQUAL 8)
|
||||
set (_libdir_noarch "lib64")
|
||||
else (CMAKE_SIZEOF_VOID_P EQUAL 8)
|
||||
set (_libdir_noarch "lib")
|
||||
endif (CMAKE_SIZEOF_VOID_P EQUAL 8)
|
||||
set (_libdir_def "${_libdir_noarch}")
|
||||
endif (EXISTS "/etc/debian_version")
|
||||
else ("${CMAKE_SYSTEM_NAME}" MATCHES "Linux")
|
||||
set (_libdir_def "lib")
|
||||
set (_libdir_noarch "lib")
|
||||
endif ("${CMAKE_SYSTEM_NAME}" MATCHES "Linux")
|
||||
|
||||
# let the user override if somewhere else is desirable
|
||||
set (CMAKE_INSTALL_LIBDIR "${_libdir_def}" CACHE PATH "Object code libraries")
|
||||
set (CMAKE_INSTALL_LIBDIR_NOARCH "${_libdir_noarch}" CACHE PATH "Architecture-independent library files")
|
||||
mark_as_advanced (
|
||||
CMAKE_INSTALL_LIBDIR
|
||||
CMAKE_INSTALL_LIBDIR_NOARCH
|
||||
)
|
||||
36
cmake/Modules/UseOnlyNeeded.cmake
Normal file
36
cmake/Modules/UseOnlyNeeded.cmake
Normal file
@@ -0,0 +1,36 @@
|
||||
# - Use only needed imports from libraries
|
||||
#
|
||||
# Add the -Wl,--as-needed flag to the default linker flags on Linux
|
||||
# in order to get only the minimal set of dependencies.
|
||||
|
||||
function (prepend var_name value)
|
||||
if (${var_name})
|
||||
set (${var_name} "${value} ${${var_name}}" PARENT_SCOPE)
|
||||
else (${var_name})
|
||||
set (${var_name} "${value}")
|
||||
endif (${var_name})
|
||||
endfunction (prepend var_name value)
|
||||
|
||||
# only ELF shared objects can be underlinked, and only GNU will accept
|
||||
# these parameters; otherwise just leave it to the defaults
|
||||
if ((CMAKE_CXX_PLATFORM_ID STREQUAL "Linux") AND CMAKE_COMPILER_IS_GNUCC)
|
||||
# these are the modules whose probes will turn up incompatible
|
||||
# flags on some systems
|
||||
set (_maybe_underlinked
|
||||
SuiteSparse
|
||||
)
|
||||
# check if any modules actually reported problems (by setting an
|
||||
# appropriate linker flag)
|
||||
set (_underlinked FALSE)
|
||||
foreach (_module IN LISTS _maybe_underlinked)
|
||||
if ("${${_module}_LINKER_FLAGS}" MATCHES "-Wl,--no-as-needed")
|
||||
set (_underlinked TRUE)
|
||||
endif ("${${_module}_LINKER_FLAGS}" MATCHES "-Wl,--no-as-needed")
|
||||
endforeach (_module)
|
||||
# if we didn't have any problems, then go ahead and add
|
||||
if (NOT _underlinked)
|
||||
prepend (CMAKE_EXE_LINKER_FLAGS "-Wl,--as-needed")
|
||||
prepend (CMAKE_MODULE_LINKER_FLAGS "-Wl,--as-needed")
|
||||
prepend (CMAKE_SHARED_LINKER_FLAGS "-Wl,--as-needed")
|
||||
endif (NOT _underlinked)
|
||||
endif ((CMAKE_CXX_PLATFORM_ID STREQUAL "Linux") AND CMAKE_COMPILER_IS_GNUCC)
|
||||
60
cmake/Modules/UseOpenMP.cmake
Normal file
60
cmake/Modules/UseOpenMP.cmake
Normal file
@@ -0,0 +1,60 @@
|
||||
# - Use OpenMP features
|
||||
#
|
||||
# Synopsis:
|
||||
#
|
||||
# find_openmp (module)
|
||||
#
|
||||
# where:
|
||||
#
|
||||
# module Name of the module to which OpenMP libraries
|
||||
# etc. should be added, e.g. "opm-core".
|
||||
#
|
||||
# Note: Compiler flags are always added globally, to avoid ABI
|
||||
# incompatibility problems.
|
||||
#
|
||||
# It is assumed that the following variables are available
|
||||
#
|
||||
# ${module}_QUIET Verbosity level of the parent's find module
|
||||
# ${module}_LIBRARIES List of libraries to which OpenMP will be added
|
||||
#
|
||||
# Example:
|
||||
# find_openmp (opm-core)
|
||||
# remove_dup_deps (opm-core)
|
||||
|
||||
include (AddOptions)
|
||||
macro (find_openmp opm)
|
||||
# user code can be conservative by setting USE_OPENMP_DEFAULT
|
||||
if (NOT DEFINED USE_OPENMP_DEFAULT)
|
||||
set (USE_OPENMP_DEFAULT ON)
|
||||
endif (NOT DEFINED USE_OPENMP_DEFAULT)
|
||||
option (USE_OPENMP "Enable OpenMP for parallelization" ${USE_OPENMP_DEFAULT})
|
||||
if (USE_OPENMP)
|
||||
|
||||
# enabling OpenMP is supposedly enough to make the compiler link with
|
||||
# the appropriate libraries
|
||||
find_package (OpenMP ${${opm}_QUIET})
|
||||
list (APPEND ${opm}_LIBRARIES ${OpenMP_LIBRARIES})
|
||||
if (OPENMP_FOUND)
|
||||
add_options (C ALL_BUILDS "${OpenMP_C_FLAGS}")
|
||||
add_options (CXX ALL_BUILDS "${OpenMP_CXX_FLAGS}")
|
||||
endif (OPENMP_FOUND)
|
||||
|
||||
# threading library (search for this *after* OpenMP
|
||||
set (CMAKE_THREAD_PREFER_PTHREAD TRUE)
|
||||
find_package (Threads ${${opm}_QUIET})
|
||||
if (CMAKE_USE_PTHREADS_INIT)
|
||||
list (APPEND ${opm}_LIBRARIES ${CMAKE_THREAD_LIBS_INIT})
|
||||
endif (CMAKE_USE_PTHREADS_INIT)
|
||||
|
||||
else (USE_OPENMP)
|
||||
message (STATUS "OpenMP: disabled")
|
||||
|
||||
# if we don't have OpenMP support, then don't show warnings that these
|
||||
# pragmas are unknown
|
||||
if (CMAKE_COMPILER_IS_GNUCXX)
|
||||
add_options (ALL_LANGUAGES ALL_BUILDS "-Wno-unknown-pragmas")
|
||||
elseif (MSVC)
|
||||
add_options (ALL_LANGUAGES ALL_BUILDS "-wd4068")
|
||||
endif(CMAKE_COMPILER_IS_GNUCXX)
|
||||
endif (USE_OPENMP)
|
||||
endmacro (find_openmp opm)
|
||||
61
cmake/Modules/UseOptimization.cmake
Normal file
61
cmake/Modules/UseOptimization.cmake
Normal file
@@ -0,0 +1,61 @@
|
||||
# - Turn on optimizations based on build type
|
||||
|
||||
include(TestCXXAcceptsFlag)
|
||||
include (AddOptions)
|
||||
|
||||
# mapping from profile name (in CMAKE_BUILD_TYPE) to variable part
|
||||
set (_prof_DEBUG "Debug")
|
||||
set (_prof_RELEASE "Release;RelWithDebInfo;MinSizeRel")
|
||||
|
||||
# if we are building a debug target, then disable all optimizations
|
||||
# otherwise, turn them on. indicate to the code what we have done
|
||||
# so it can turn on assertions etc.
|
||||
|
||||
if (CMAKE_COMPILER_IS_GNUCXX)
|
||||
# extra flags passed for optimization
|
||||
set (_opt_flags "")
|
||||
|
||||
# link-time (a.k.a. global) optimizations
|
||||
option (WHOLE_PROG_OPTIM "Whole program optimization (lto)" ON)
|
||||
if (WHOLE_PROG_OPTIM)
|
||||
check_cxx_accepts_flag ("-flto" HAVE_LINK_OPTS)
|
||||
if (HAVE_LINK_OPTS)
|
||||
list (APPEND _opt_flags "-flto")
|
||||
endif (HAVE_LINK_OPTS)
|
||||
endif (WHOLE_PROG_OPTIM)
|
||||
|
||||
# native instruction set tuning
|
||||
option (WITH_NATIVE "Use native instruction set" ON)
|
||||
if (WITH_NATIVE)
|
||||
check_cxx_accepts_flag ("-mtune=native" HAVE_MTUNE)
|
||||
if (HAVE_MTUNE)
|
||||
list (APPEND _opt_flags "-mtune=native")
|
||||
endif (HAVE_MTUNE)
|
||||
endif (WITH_NATIVE)
|
||||
|
||||
# default optimization flags, if not set by user
|
||||
set_default_option (_opt_dbg "-O0" "(^|\ )-O")
|
||||
set_default_option (_opt_rel "-O3" "(^|\ )-O")
|
||||
|
||||
# use these options for debug builds - no optimizations
|
||||
add_options (ALL_LANGUAGES "${_prof_DEBUG}" ${_opt_dbg} "-DDEBUG")
|
||||
|
||||
# use these options for release builds - full optimization
|
||||
add_options (ALL_LANGUAGES "${_prof_RELEASE}" ${_opt_rel} "-DNDEBUG" ${_opt_flags})
|
||||
|
||||
else (CMAKE_COMPILER_IS_GNUCXX)
|
||||
# default information from system
|
||||
foreach (lang IN ITEMS C CXX Fortran)
|
||||
if (lang STREQUAL "Fortran")
|
||||
set (_lang F)
|
||||
else (lang STREQUAL "Fortran")
|
||||
set (_lang ${lang})
|
||||
endif (lang STREQUAL "Fortran")
|
||||
foreach (profile IN ITEMS DEBUG RELEASE)
|
||||
if (NOT CMAKE_${lang}_FLAGS_${profile})
|
||||
add_options (${lang} "${_prof_${profile}}"
|
||||
"$ENV{${_lang}FLAGS} ${CMAKE_${lang}_FLAGS_${profile}_INIT}")
|
||||
endif (NOT CMAKE_${lang}_FLAGS_${profile})
|
||||
endforeach (profile)
|
||||
endforeach (lang)
|
||||
endif (CMAKE_COMPILER_IS_GNUCXX)
|
||||
157
cmake/Modules/UsePrecompHeaders.cmake
Normal file
157
cmake/Modules/UsePrecompHeaders.cmake
Normal file
@@ -0,0 +1,157 @@
|
||||
# - Use precompiled headers
|
||||
#
|
||||
# precompile_header takes these parameters
|
||||
#
|
||||
# language Language in which the header is written; C or CXX.
|
||||
#
|
||||
# type Type of target being build, SHARED_LIBRARY, STATIC_LIBRARY
|
||||
# or EXECUTABLE.
|
||||
#
|
||||
# header Relative path within the source tree to the header
|
||||
# that contains the list of includes to be precompiled.
|
||||
# This header should not be added to the installation,
|
||||
# as it will be specific for this project.
|
||||
#
|
||||
# target Name of target to be created. All targets that
|
||||
# use the precompiled header should depend on this target
|
||||
# so that it is built before them. A variable with this
|
||||
# name will also be created which contains the file name.
|
||||
#
|
||||
# flags_name Name of variable to receive the flags that should be
|
||||
# added to the command-line.
|
||||
#
|
||||
# Example:
|
||||
# get_target_property (type opmcore TYPE)
|
||||
# precompile_header (CXX ${type}
|
||||
# HEADER "opm/core/opm-core-pch.hpp"
|
||||
# TARGET opmcore_CXX_pch
|
||||
# FLAGS opmcore_PRECOMP_CXX_FLAGS
|
||||
# )
|
||||
# set_source_files_properties (${opmcore_CXX_SOURCES} PROPERTIES
|
||||
# OBJECT_DEPENDS "${opmcore_CXX_pch}"
|
||||
# COMPILE_FLAGS "${opmcore_PRECOMP_CXX_FLAGS}"
|
||||
# )
|
||||
|
||||
# get compiler version
|
||||
include (UseCompVer)
|
||||
|
||||
# reconstruct the compiler command line; this does NOT include the
|
||||
# DEFINE_SYMBOL that is added for shared libraries. type is the TYPE
|
||||
# target property.
|
||||
# see larsch's PrecompiledHeader.cmake: <https://gist.github.com/573926>
|
||||
# and <https://github.com/loaden/qtcreator/blob/wip/cmake/cmake/PrecompiledHeader.cmake>
|
||||
function (compiler_cmdline language type cmd_name args_name)
|
||||
# get the compiler for this particular language
|
||||
set (${cmd_name} "${CMAKE_${language}_COMPILER}" PARENT_SCOPE)
|
||||
|
||||
# in case someone has overridden the compiler (e.g. ccache)
|
||||
set (_args "${CMAKE_${language}_COMPILER_ARG1}")
|
||||
|
||||
# macro definitions
|
||||
get_directory_property (_defs DEFINITIONS)
|
||||
list (APPEND _args "${_defs}")
|
||||
|
||||
# global flags (such as -std=c++11); notice that there are both
|
||||
# release-dependent and non-release-dependent ones
|
||||
string (TOUPPER "CMAKE_${language}_FLAGS" _flags)
|
||||
list (APPEND _args "${${_flags}}")
|
||||
string (TOUPPER "CMAKE_${language}_FLAGS_${CMAKE_BUILD_TYPE}" _flags)
|
||||
list (APPEND _args "${${_flags}}")
|
||||
|
||||
# assume that we are always generating position-independent code
|
||||
# when compiling for a shared library
|
||||
if (type STREQUAL "SHARED_LIBRARY")
|
||||
list (APPEND _args "${CMAKE_SHARED_LIBRARY_${language}_FLAGS}")
|
||||
endif (type STREQUAL "SHARED_LIBRARY")
|
||||
|
||||
# directories included
|
||||
get_directory_property (_dirs INCLUDE_DIRECTORIES)
|
||||
foreach (_dir ${_dirs})
|
||||
list (APPEND _args "-I${_dir}")
|
||||
endforeach (_dir)
|
||||
|
||||
# make arguments a real list, and write to output variable
|
||||
separate_arguments (_args)
|
||||
set (${args_name} "${_args}" PARENT_SCOPE)
|
||||
endfunction (compiler_cmdline language type cmd_name args_name)
|
||||
|
||||
function (precompile_header
|
||||
language type hdr_kw header tgt_kw target flgs_kw flags_name)
|
||||
|
||||
# check "syntax"
|
||||
if (NOT hdr_kw STREQUAL "HEADER")
|
||||
message (FATAL "Third token to precompile_header shoulde be \"HEADER\"")
|
||||
endif (NOT hdr_kw STREQUAL "HEADER")
|
||||
if (NOT tgt_kw STREQUAL "TARGET")
|
||||
message (FATAL "Fifth token to precompile_header should be \"TARGET\"")
|
||||
endif (NOT tgt_kw STREQUAL "TARGET")
|
||||
if (NOT flgs_kw STREQUAL "FLAGS")
|
||||
message (FATAL "Seventh token to precompile_header should be \"FLAGS\"")
|
||||
endif (NOT flgs_kw STREQUAL "FLAGS")
|
||||
|
||||
# check language
|
||||
if (language STREQUAL "CXX")
|
||||
set (gcc_lang "c++-header")
|
||||
elseif (language STREQUAL "C")
|
||||
set (gcc_lang "c-header")
|
||||
else (language STREQUAL "CXX")
|
||||
message (FATAL "Only C or C++ can have precompiled headers")
|
||||
endif (language STREQUAL "CXX")
|
||||
|
||||
# if no precompiled header was found, then we shouldn't do anything here
|
||||
if (NOT header)
|
||||
return ()
|
||||
endif (NOT header)
|
||||
|
||||
# only support precompiled headers if the compiler is gcc >= 3.4
|
||||
get_gcc_version (${language} GCC_VERSION)
|
||||
if (GCC_VERSION)
|
||||
if (GCC_VERSION VERSION_EQUAL 3.4 OR GCC_VERSION VERSION_GREATER 3.4)
|
||||
# command-line used to compile modules in this kind of target
|
||||
compiler_cmdline (${language} ${type} _cmd _args)
|
||||
|
||||
# gcc will include any configurations which are in a directory
|
||||
# with the same name as the header included
|
||||
set (_pch_dir "CMakeFiles/pch")
|
||||
set (_pch_file "${_pch_dir}/${header}.gch/${target}")
|
||||
|
||||
# make sure that output directory exists
|
||||
get_filename_component (_outdir "${PROJECT_BINARY_DIR}/${_pch_file}" PATH)
|
||||
file (MAKE_DIRECTORY ${_outdir})
|
||||
|
||||
# we need to generate the precompiled header in the output tree, but
|
||||
# at the same time prevent the compiler to pick up the header from the
|
||||
# source tree. getting the order of the include paths right is fragile
|
||||
# in CMake. by copying the header, we can put the precompile dump
|
||||
# right next to it and have the compiler pick it up there
|
||||
add_custom_command (
|
||||
OUTPUT "${_pch_dir}/${header}"
|
||||
COMMAND ${CMAKE_COMMAND}
|
||||
ARGS -E copy "${PROJECT_SOURCE_DIR}/${header}" "${_pch_dir}/${header}"
|
||||
DEPENDS "${PROJECT_SOURCE_DIR}/${header}"
|
||||
)
|
||||
|
||||
# add a makefile rule to create the precompiled header
|
||||
add_custom_command (
|
||||
OUTPUT ${PROJECT_BINARY_DIR}/${_pch_file}
|
||||
COMMAND ${_cmd}
|
||||
ARGS ${_args} "-o" "${_pch_file}" "-x" "${gcc_lang}" "-c" "${_pch_dir}/${header}"
|
||||
DEPENDS "${_pch_dir}/${header}"
|
||||
COMMENT "Precompiling headers ${_pch_file}"
|
||||
)
|
||||
|
||||
# create a phony target that is always built, but which only checks
|
||||
# if the header file is OK (i.e. the header only gets rebuilt if
|
||||
# necessary)
|
||||
add_custom_target (${target} ALL
|
||||
DEPENDS ${PROJECT_BINARY_DIR}/${_pch_file}
|
||||
)
|
||||
|
||||
# these flags need to be added to the target
|
||||
set (${target} "${_pch_file}" PARENT_SCOPE)
|
||||
set (${flags_name} "-Winvalid-pch -include ${_pch_dir}/${header}" PARENT_SCOPE)
|
||||
endif (GCC_VERSION VERSION_EQUAL 3.4 OR GCC_VERSION VERSION_GREATER 3.4)
|
||||
endif (GCC_VERSION)
|
||||
|
||||
endfunction (precompile_header
|
||||
language type header tgt_kw target flgs_kw flags_name)
|
||||
174
cmake/Modules/UseSystemInfo.cmake
Normal file
174
cmake/Modules/UseSystemInfo.cmake
Normal file
@@ -0,0 +1,174 @@
|
||||
# - Print CMake and OS distribution version
|
||||
#
|
||||
function (system_info)
|
||||
message (STATUS "CMake version: ${CMAKE_VERSION}")
|
||||
if (CMAKE_SYSTEM MATCHES "Linux")
|
||||
distro_name (DISTRO_NAME)
|
||||
message (STATUS "Linux distribution: ${DISTRO_NAME}")
|
||||
else (CMAKE_SYSTEM MATCHES "Linux")
|
||||
message (STATUS "Operating system: ${CMAKE_SYSTEM}")
|
||||
endif (CMAKE_SYSTEM MATCHES "Linux")
|
||||
|
||||
target_architecture (TARGET_CPU)
|
||||
message (STATUS "Target architecture: ${TARGET_CPU}")
|
||||
endfunction (system_info)
|
||||
|
||||
# probe various system files that may be found
|
||||
function (distro_name varname)
|
||||
file (GLOB has_os_release /etc/os-release)
|
||||
file (GLOB has_lsb_release /etc/lsb-release)
|
||||
file (GLOB has_sys_release /etc/system-release)
|
||||
set (_descr)
|
||||
# start with /etc/os-release,
|
||||
# see <http://0pointer.de/blog/projects/os-release.html>
|
||||
if (NOT has_os_release STREQUAL "")
|
||||
read_release (PRETTY_NAME FROM /etc/os-release INTO _descr)
|
||||
# previous "standard", used on older Ubuntu and Debian
|
||||
elseif (NOT has_lsb_release STREQUAL "")
|
||||
read_release (DISTRIB_DESCRIPTION FROM /etc/lsb-release INTO _descr)
|
||||
endif (NOT has_os_release STREQUAL "")
|
||||
# RHEL/CentOS etc. has just a text-file
|
||||
if (NOT _descr)
|
||||
if (NOT has_sys_release STREQUAL "")
|
||||
file (READ /etc/system-release _descr)
|
||||
else (NOT has_sys_release STREQUAL "")
|
||||
# no yet known release file found
|
||||
set (_descr "unknown")
|
||||
endif (NOT has_sys_release STREQUAL "")
|
||||
endif (NOT _descr)
|
||||
# return from function (into appropriate variable)
|
||||
string (STRIP "${_descr}" _descr)
|
||||
set (${varname} "${_descr}" PARENT_SCOPE)
|
||||
endfunction (distro_name varname)
|
||||
|
||||
# read property from the newer /etc/os-release
|
||||
function (read_release valuename FROM filename INTO varname)
|
||||
file (STRINGS ${filename} _distrib
|
||||
REGEX "^${valuename}="
|
||||
)
|
||||
string (REGEX REPLACE
|
||||
"^${valuename}=\"?\(.*\)" "\\1" ${varname} "${_distrib}"
|
||||
)
|
||||
# remove trailing quote that got globbed by the wildcard (greedy match)
|
||||
string (REGEX REPLACE
|
||||
"\"$" "" ${varname} "${${varname}}"
|
||||
)
|
||||
set (${varname} "${${varname}}" PARENT_SCOPE)
|
||||
endfunction (read_release valuename FROM filename INTO varname)
|
||||
|
||||
# the following code is adapted from commit f7467762 of the code at
|
||||
# <https://github.com/petroules/solar-cmake/blob/master/TargetArch.cmake>
|
||||
# which is Copyright (c) 2012 Petroules Corporation, and which at the
|
||||
# time of download (2013-04-07 12:30 CET) is made available with a BSD license.
|
||||
#
|
||||
# it attempts to compile a program which detects the architecture from the
|
||||
# preprocessor symbols and communicate this back to us through an error message(!)
|
||||
function (target_architecture output_var)
|
||||
# OS X is capable of building for *several* architectures at once in
|
||||
# the Mach-O binary, and there is a variable that tells us which those
|
||||
# are, but they may be in any order, so they must be normalized
|
||||
if (APPLE AND CMAKE_OSX_ARCHITECTURES)
|
||||
# detect each of the possible candidates as a separate flag
|
||||
set (osx_arch_list i386 x86_64)
|
||||
foreach (osx_arch IN ITEMS ${CMAKE_OSX_ARCHITECTURES})
|
||||
foreach (candidate IN LISTS osx_arch_list)
|
||||
if ("${osx_arch}" STREQUAL "${candidate}")
|
||||
set (osx_arch_${candidate} TRUE)
|
||||
endif ("${osx_arch}" STREQUAL "${candidate}")
|
||||
endforeach (candidate)
|
||||
endforeach (osx_arch)
|
||||
|
||||
# add all architectures back in normalized order
|
||||
foreach (candidate IN LISTS osx_arch_list)
|
||||
if (osx_arch_${candidate})
|
||||
list (APPEND ARCH ${candidate})
|
||||
endif (osx_arch_${candidate})
|
||||
endforeach (candidate)
|
||||
|
||||
else (APPLE AND CMAKE_OSX_ARCHITECTURES)
|
||||
# use the preprocessor defines to determine which target architectures
|
||||
# that are available
|
||||
set (arch_c_src "
|
||||
#if defined(__arm__) || defined(__TARGET_ARCH_ARM)
|
||||
# if defined(__ARM_ARCH_7__) \\
|
||||
|| defined(__ARM_ARCH_7A__) \\
|
||||
|| defined(__ARM_ARCH_7R__) \\
|
||||
|| defined(__ARM_ARCH_7M__) \\
|
||||
|| (defined(__TARGET_ARCH_ARM) && __TARGET_ARCH_ARM-0 >= 7)
|
||||
# error cmake_ARCH armv7
|
||||
# elif defined(__ARM_ARCH_6__) \\
|
||||
|| defined(__ARM_ARCH_6J__) \\
|
||||
|| defined(__ARM_ARCH_6T2__) \\
|
||||
|| defined(__ARM_ARCH_6Z__) \\
|
||||
|| defined(__ARM_ARCH_6K__) \\
|
||||
|| defined(__ARM_ARCH_6ZK__) \\
|
||||
|| defined(__ARM_ARCH_6M__) \\
|
||||
|| (defined(__TARGET_ARCH_ARM) && __TARGET_ARCH_ARM-0 >= 6)
|
||||
# error cmake_ARCH armv6
|
||||
# elif defined(__ARM_ARCH_5TEJ__) \\
|
||||
|| (defined(__TARGET_ARCH_ARM) && __TARGET_ARCH_ARM-0 >= 5)
|
||||
# error cmake_ARCH armv5
|
||||
# else
|
||||
# error cmake_ARCH arm
|
||||
# endif
|
||||
#elif defined(__i386) \\
|
||||
|| defined(__i386__) \\
|
||||
|| defined(_M_IX86)
|
||||
# error cmake_ARCH i386
|
||||
#elif defined(__x86_64) \\
|
||||
|| defined(__x86_64__) \\
|
||||
|| defined(__amd64) \\
|
||||
|| defined(_M_X64)
|
||||
# error cmake_ARCH x86_64
|
||||
#elif defined(__ia64) \\
|
||||
|| defined(__ia64__) \\
|
||||
|| defined(_M_IA64)
|
||||
# error cmake_ARCH ia64
|
||||
#elif defined(__ppc__) \\
|
||||
|| defined(__ppc) \\
|
||||
|| defined(__powerpc__) \\
|
||||
|| defined(_ARCH_COM) \\
|
||||
|| defined(_ARCH_PWR) \\
|
||||
|| defined(_ARCH_PPC) \\
|
||||
|| defined(_M_MPPC) \\
|
||||
|| defined(_M_PPC)
|
||||
# if defined(__ppc64__) \\
|
||||
|| defined(__powerpc64__) \\
|
||||
|| defined(__64BIT__)
|
||||
# error cmake_ARCH ppc64
|
||||
# else
|
||||
# error cmake_ARCH ppc
|
||||
# endif
|
||||
#else
|
||||
# error cmake_ARCH unknown
|
||||
#endif
|
||||
")
|
||||
|
||||
# write a temporary program that can be compiled to get the result
|
||||
set (tmp_dir "${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeTmp")
|
||||
set (arch_c "${tmp_dir}/arch.c")
|
||||
file (WRITE "${arch_c}" "${arch_c_src}")
|
||||
try_compile (
|
||||
compile_result_unused
|
||||
"${tmp_dir}"
|
||||
"${arch_c}"
|
||||
CMAKE_FLAGS CMAKE_OSX_ARCHITECTURES=${CMAKE_OSX_ARCHITECTURES}
|
||||
OUTPUT_VARIABLE ARCH
|
||||
)
|
||||
|
||||
# parse the architecture name from the compiler output
|
||||
string (REGEX MATCH "cmake_ARCH ([a-zA-Z0-9_]+)" ARCH "${ARCH}")
|
||||
|
||||
# get rid of the value marker leaving just the architecture name
|
||||
string (REPLACE "cmake_ARCH " "" ARCH "${ARCH}")
|
||||
|
||||
# if we are compiling with an unknown architecture this variable should
|
||||
# already be set to "unknown" but in the case that it's empty (i.e. due
|
||||
# to a typo in the code), then set it to unknown
|
||||
if (NOT ARCH)
|
||||
set (ARCH "unknown")
|
||||
endif()
|
||||
endif()
|
||||
|
||||
set (${output_var} "${ARCH}" PARENT_SCOPE)
|
||||
endfunction()
|
||||
102
cmake/Modules/UseVCSInfo.cmake
Normal file
102
cmake/Modules/UseVCSInfo.cmake
Normal file
@@ -0,0 +1,102 @@
|
||||
# - Get version control information from source tree
|
||||
#
|
||||
# Sets the following variables
|
||||
#
|
||||
# VCS_SYSTEM Currently, this will only be "git", or empty if
|
||||
# no source code control system is found.
|
||||
#
|
||||
# VCS_SHA1 Hash code of the last commit. If this is empty,
|
||||
# then no source code repository was found.
|
||||
#
|
||||
# VCS_DECOR Characters that denotes any local modifications:
|
||||
# "*" - Unstaged local changes
|
||||
# "+" - Staged, but not committed, local changes
|
||||
# "%" - Untracked local files
|
||||
function (vcs_info)
|
||||
# if we haven't located git yet, then do it now
|
||||
if (NOT GIT_FOUND)
|
||||
find_package (Git)
|
||||
endif (NOT GIT_FOUND)
|
||||
|
||||
# if git is not installed (unpacked tarball), then just state that
|
||||
# the version practically is unknown
|
||||
set (VCS_DECOR "")
|
||||
if (GIT_FOUND)
|
||||
set (VCS_SYSTEM "git")
|
||||
|
||||
# assume that we have a .git subdirectory under the source directory;
|
||||
# if we have a bare repository, then we won't be able to build in there
|
||||
# and we won't be able to identify the git dir to use from only a work
|
||||
# tree, so we handle that like a regular unpacked tarball
|
||||
|
||||
# exec_program is used because execute_process is buggy on common
|
||||
# platforms (notable CMake 2.8.7 in Ubuntu Precise 12.04)
|
||||
|
||||
# get hash code
|
||||
exec_program (
|
||||
${GIT_EXECUTABLE} ${PROJECT_SOURCE_DIR}
|
||||
ARGS rev-parse --short --verify HEAD
|
||||
OUTPUT_VARIABLE VCS_SHA1
|
||||
RETURN_VALUE has_sha
|
||||
)
|
||||
|
||||
# exec_program mashes together output and error
|
||||
if (NOT ${has_sha} EQUAL 0)
|
||||
set (VCS_SHA1 "")
|
||||
endif (NOT ${has_sha} EQUAL 0)
|
||||
|
||||
# only proceed if we actually found a source tree in there
|
||||
if (VCS_SHA1)
|
||||
# check for unstaged local changes
|
||||
exec_program (
|
||||
${GIT_EXECUTABLE} ${PROJECT_SOURCE_DIR}
|
||||
ARGS diff --no-ext-diff --quiet --exit-code
|
||||
RETURN_VALUE dirty
|
||||
OUTPUT_VARIABLE _dummy
|
||||
)
|
||||
if (NOT ${dirty} EQUAL 0)
|
||||
list (APPEND VCS_DECOR "*")
|
||||
endif (NOT ${dirty} EQUAL 0)
|
||||
|
||||
# check for staged local changes
|
||||
exec_program (
|
||||
${GIT_EXECUTABLE} ${PROJECT_SOURCE_DIR}
|
||||
ARGS diff-index --no-ext-diff --cached --quiet --exit-code HEAD --
|
||||
RETURN_VALUE staged
|
||||
OUTPUT_VARIABLE _dummy
|
||||
)
|
||||
if (NOT ${staged} EQUAL 0)
|
||||
list (APPEND VCS_DECOR "+")
|
||||
endif (NOT ${staged} EQUAL 0)
|
||||
|
||||
# check for untracked files
|
||||
exec_program (
|
||||
${GIT_EXECUTABLE} ${PROJECT_SOURCE_DIR}
|
||||
ARGS ls-files --others --exclude-standard
|
||||
OUTPUT_VARIABLE untracked
|
||||
)
|
||||
if (untracked)
|
||||
list (APPEND VCS_DECOR "%")
|
||||
endif (untracked)
|
||||
|
||||
# convert list to regular string
|
||||
string (REPLACE ";" "" VCS_DECOR "${VCS_DECOR}")
|
||||
endif (VCS_SHA1)
|
||||
else (GIT_FOUND)
|
||||
set (VCS_SYSTEM "")
|
||||
set (VCS_SHA1 "")
|
||||
set (VCS_DECOR "")
|
||||
endif (GIT_FOUND)
|
||||
|
||||
# diagnostic output
|
||||
if (VCS_SYSTEM AND VCS_SHA1)
|
||||
message (STATUS "Source code repository: ${VCS_SYSTEM} ${VCS_SHA1}${VCS_DECOR}")
|
||||
else (VCS_SYSTEM AND VCS_SHA1)
|
||||
message (STATUS "Source code repository: not found!")
|
||||
endif (VCS_SYSTEM AND VCS_SHA1)
|
||||
|
||||
# export to parent context
|
||||
set (VCS_SYSTEM "${VCS_SYSTEM}" PARENT_SCOPE)
|
||||
set (VCS_SHA1 "${VCS_SHA1}" PARENT_SCOPE)
|
||||
set (VCS_DECOR "${VCS_DECOR}" PARENT_SCOPE)
|
||||
endfunction (vcs_info)
|
||||
11
cmake/Modules/UseWarnings.cmake
Normal file
11
cmake/Modules/UseWarnings.cmake
Normal file
@@ -0,0 +1,11 @@
|
||||
# - Turn on warnings when compiling
|
||||
|
||||
include (AddOptions)
|
||||
if (CMAKE_COMPILER_IS_GNUCXX)
|
||||
# default warnings flags, if not set by user
|
||||
set_default_option (_warn_flag "-Wall" "(^|\ )-W")
|
||||
if (_warn_flag)
|
||||
message (STATUS "All warnings enabled: ${_warn_flag}")
|
||||
add_options (ALL_LANGUAGES ALL_BUILDS "${_warn_flag}")
|
||||
endif (_warn_flag)
|
||||
endif (CMAKE_COMPILER_IS_GNUCXX)
|
||||
47
cmake/Modules/compat-2.8.5/FindGit.cmake
Normal file
47
cmake/Modules/compat-2.8.5/FindGit.cmake
Normal file
@@ -0,0 +1,47 @@
|
||||
# The module defines the following variables:
|
||||
# GIT_EXECUTABLE - path to git command line client
|
||||
# GIT_FOUND - true if the command line client was found
|
||||
# Example usage:
|
||||
# find_package(Git)
|
||||
# if(GIT_FOUND)
|
||||
# message("git found: ${GIT_EXECUTABLE}")
|
||||
# endif()
|
||||
|
||||
#=============================================================================
|
||||
# Copyright 2010 Kitware, Inc.
|
||||
#
|
||||
# Distributed under the OSI-approved BSD License (the "License");
|
||||
# see accompanying file Copyright.txt for details.
|
||||
#
|
||||
# This software is distributed WITHOUT ANY WARRANTY; without even the
|
||||
# implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
|
||||
# See the License for more information.
|
||||
#=============================================================================
|
||||
# (To distribute this file outside of CMake, substitute the full
|
||||
# License text for the above reference.)
|
||||
|
||||
# Look for 'git' or 'eg' (easy git)
|
||||
#
|
||||
set(git_names git eg)
|
||||
|
||||
# Prefer .cmd variants on Windows unless running in a Makefile
|
||||
# in the MSYS shell.
|
||||
#
|
||||
if(WIN32)
|
||||
if(NOT CMAKE_GENERATOR MATCHES "MSYS")
|
||||
set(git_names git.cmd git eg.cmd eg)
|
||||
endif()
|
||||
endif()
|
||||
|
||||
find_program(GIT_EXECUTABLE
|
||||
NAMES ${git_names}
|
||||
PATH_SUFFIXES Git/cmd Git/bin
|
||||
DOC "git command line client"
|
||||
)
|
||||
mark_as_advanced(GIT_EXECUTABLE)
|
||||
|
||||
# Handle the QUIETLY and REQUIRED arguments and set GIT_FOUND to TRUE if
|
||||
# all listed variables are TRUE
|
||||
|
||||
include(FindPackageHandleStandardArgs)
|
||||
find_package_handle_standard_args(Git DEFAULT_MSG GIT_EXECUTABLE)
|
||||
61
cmake/Modules/compat-2.8.7/CMakePushCheckState.cmake
Normal file
61
cmake/Modules/compat-2.8.7/CMakePushCheckState.cmake
Normal file
@@ -0,0 +1,61 @@
|
||||
# This module defines two macros:
|
||||
# CMAKE_PUSH_CHECK_STATE()
|
||||
# and
|
||||
# CMAKE_POP_CHECK_STATE()
|
||||
# These two macros can be used to save and restore the state of the variables
|
||||
# CMAKE_REQUIRED_FLAGS, CMAKE_REQUIRED_DEFINITIONS, CMAKE_REQUIRED_LIBRARIES
|
||||
# and CMAKE_REQUIRED_INCLUDES used by the various Check-files coming with CMake,
|
||||
# like e.g. check_function_exists() etc.
|
||||
# The variable contents are pushed on a stack, pushing multiple times is supported.
|
||||
# This is useful e.g. when executing such tests in a Find-module, where they have to be set,
|
||||
# but after the Find-module has been executed they should have the same value
|
||||
# as they had before.
|
||||
#
|
||||
# Usage:
|
||||
# cmake_push_check_state()
|
||||
# set(CMAKE_REQUIRED_DEFINITIONS ${CMAKE_REQUIRED_DEFINITIONS} -DSOME_MORE_DEF)
|
||||
# check_function_exists(...)
|
||||
# cmake_pop_check_state()
|
||||
|
||||
#=============================================================================
|
||||
# Copyright 2006-2011 Alexander Neundorf, <neundorf@kde.org>
|
||||
#
|
||||
# Distributed under the OSI-approved BSD License (the "License");
|
||||
# see accompanying file Copyright.txt for details.
|
||||
#
|
||||
# This software is distributed WITHOUT ANY WARRANTY; without even the
|
||||
# implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
|
||||
# See the License for more information.
|
||||
#=============================================================================
|
||||
# (To distribute this file outside of CMake, substitute the full
|
||||
# License text for the above reference.)
|
||||
|
||||
|
||||
MACRO(CMAKE_PUSH_CHECK_STATE)
|
||||
|
||||
IF(NOT DEFINED _CMAKE_PUSH_CHECK_STATE_COUNTER)
|
||||
SET(_CMAKE_PUSH_CHECK_STATE_COUNTER 0)
|
||||
ENDIF()
|
||||
|
||||
MATH(EXPR _CMAKE_PUSH_CHECK_STATE_COUNTER "${_CMAKE_PUSH_CHECK_STATE_COUNTER}+1")
|
||||
|
||||
SET(_CMAKE_REQUIRED_INCLUDES_SAVE_${_CMAKE_PUSH_CHECK_STATE_COUNTER} ${CMAKE_REQUIRED_INCLUDES})
|
||||
SET(_CMAKE_REQUIRED_DEFINITIONS_SAVE_${_CMAKE_PUSH_CHECK_STATE_COUNTER} ${CMAKE_REQUIRED_DEFINITIONS})
|
||||
SET(_CMAKE_REQUIRED_LIBRARIES_SAVE_${_CMAKE_PUSH_CHECK_STATE_COUNTER} ${CMAKE_REQUIRED_LIBRARIES})
|
||||
SET(_CMAKE_REQUIRED_FLAGS_SAVE_${_CMAKE_PUSH_CHECK_STATE_COUNTER} ${CMAKE_REQUIRED_FLAGS})
|
||||
ENDMACRO(CMAKE_PUSH_CHECK_STATE)
|
||||
|
||||
MACRO(CMAKE_POP_CHECK_STATE)
|
||||
|
||||
# don't pop more than we pushed
|
||||
IF("${_CMAKE_PUSH_CHECK_STATE_COUNTER}" GREATER "0")
|
||||
|
||||
SET(CMAKE_REQUIRED_INCLUDES ${_CMAKE_REQUIRED_INCLUDES_SAVE_${_CMAKE_PUSH_CHECK_STATE_COUNTER}})
|
||||
SET(CMAKE_REQUIRED_DEFINITIONS ${_CMAKE_REQUIRED_DEFINITIONS_SAVE_${_CMAKE_PUSH_CHECK_STATE_COUNTER}})
|
||||
SET(CMAKE_REQUIRED_LIBRARIES ${_CMAKE_REQUIRED_LIBRARIES_SAVE_${_CMAKE_PUSH_CHECK_STATE_COUNTER}})
|
||||
SET(CMAKE_REQUIRED_FLAGS ${_CMAKE_REQUIRED_FLAGS_SAVE_${_CMAKE_PUSH_CHECK_STATE_COUNTER}})
|
||||
|
||||
MATH(EXPR _CMAKE_PUSH_CHECK_STATE_COUNTER "${_CMAKE_PUSH_CHECK_STATE_COUNTER}-1")
|
||||
ENDIF()
|
||||
|
||||
ENDMACRO(CMAKE_POP_CHECK_STATE)
|
||||
624
cmake/Modules/compat-2.8.7/FindBLAS.cmake
Normal file
624
cmake/Modules/compat-2.8.7/FindBLAS.cmake
Normal file
@@ -0,0 +1,624 @@
|
||||
# - Find BLAS library
|
||||
# This module finds an installed fortran library that implements the BLAS
|
||||
# linear-algebra interface (see http://www.netlib.org/blas/).
|
||||
# The list of libraries searched for is taken
|
||||
# from the autoconf macro file, acx_blas.m4 (distributed at
|
||||
# http://ac-archive.sourceforge.net/ac-archive/acx_blas.html).
|
||||
#
|
||||
# This module sets the following variables:
|
||||
# BLAS_FOUND - set to true if a library implementing the BLAS interface
|
||||
# is found
|
||||
# BLAS_LINKER_FLAGS - uncached list of required linker flags (excluding -l
|
||||
# and -L).
|
||||
# BLAS_LIBRARIES - uncached list of libraries (using full path name) to
|
||||
# link against to use BLAS
|
||||
# BLAS95_LIBRARIES - uncached list of libraries (using full path name)
|
||||
# to link against to use BLAS95 interface
|
||||
# BLAS95_FOUND - set to true if a library implementing the BLAS f95 interface
|
||||
# is found
|
||||
# BLA_STATIC if set on this determines what kind of linkage we do (static)
|
||||
# BLA_VENDOR if set checks only the specified vendor, if not set checks
|
||||
# all the possibilities
|
||||
# BLA_F95 if set on tries to find the f95 interfaces for BLAS/LAPACK
|
||||
##########
|
||||
### List of vendors (BLA_VENDOR) valid in this module
|
||||
## Goto,ATLAS PhiPACK,CXML,DXML,SunPerf,SCSL,SGIMATH,IBMESSL,Intel10_32 (intel mkl v10 32 bit),Intel10_64lp (intel mkl v10 64 bit,lp thread model, lp64 model),
|
||||
## Intel( older versions of mkl 32 and 64 bit), ACML,ACML_MP,ACML_GPU,Apple, NAS, Generic
|
||||
# C/CXX should be enabled to use Intel mkl
|
||||
|
||||
#=============================================================================
|
||||
# Copyright 2007-2009 Kitware, Inc.
|
||||
#
|
||||
# Distributed under the OSI-approved BSD License (the "License");
|
||||
# see accompanying file Copyright.txt for details.
|
||||
#
|
||||
# This software is distributed WITHOUT ANY WARRANTY; without even the
|
||||
# implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
|
||||
# See the License for more information.
|
||||
#=============================================================================
|
||||
# (To distribute this file outside of CMake, substitute the full
|
||||
# License text for the above reference.)
|
||||
|
||||
include(CheckFunctionExists)
|
||||
include(CheckFortranFunctionExists)
|
||||
|
||||
set(_blas_ORIG_CMAKE_FIND_LIBRARY_SUFFIXES ${CMAKE_FIND_LIBRARY_SUFFIXES})
|
||||
|
||||
# Check the language being used
|
||||
get_property( _LANGUAGES_ GLOBAL PROPERTY ENABLED_LANGUAGES )
|
||||
if( _LANGUAGES_ MATCHES Fortran )
|
||||
set( _CHECK_FORTRAN TRUE )
|
||||
elseif( (_LANGUAGES_ MATCHES C) OR (_LANGUAGES_ MATCHES CXX) )
|
||||
set( _CHECK_FORTRAN FALSE )
|
||||
else()
|
||||
if(BLAS_FIND_REQUIRED)
|
||||
message(FATAL_ERROR "FindBLAS requires Fortran, C, or C++ to be enabled.")
|
||||
else(BLAS_FIND_REQUIRED)
|
||||
message(STATUS "Looking for BLAS... - NOT found (Unsupported languages)")
|
||||
return()
|
||||
endif(BLAS_FIND_REQUIRED)
|
||||
endif( )
|
||||
|
||||
macro(Check_Fortran_Libraries LIBRARIES _prefix _name _flags _list _thread)
|
||||
# This macro checks for the existence of the combination of fortran libraries
|
||||
# given by _list. If the combination is found, this macro checks (using the
|
||||
# Check_Fortran_Function_Exists macro) whether can link against that library
|
||||
# combination using the name of a routine given by _name using the linker
|
||||
# flags given by _flags. If the combination of libraries is found and passes
|
||||
# the link test, LIBRARIES is set to the list of complete library paths that
|
||||
# have been found. Otherwise, LIBRARIES is set to FALSE.
|
||||
|
||||
# N.B. _prefix is the prefix applied to the names of all cached variables that
|
||||
# are generated internally and marked advanced by this macro.
|
||||
|
||||
set(_libdir ${ARGN})
|
||||
|
||||
set(_libraries_work TRUE)
|
||||
set(${LIBRARIES})
|
||||
set(_combined_name)
|
||||
if (NOT _libdir)
|
||||
if (WIN32)
|
||||
set(_libdir ENV LIB)
|
||||
elseif (APPLE)
|
||||
set(_libdir /usr/local/lib /usr/lib /usr/local/lib64 /usr/lib64 ENV DYLD_LIBRARY_PATH)
|
||||
else ()
|
||||
set(_libdir /usr/local/lib /usr/lib /usr/local/lib64 /usr/lib64 ENV LD_LIBRARY_PATH)
|
||||
endif ()
|
||||
endif ()
|
||||
foreach(_library ${_list})
|
||||
set(_combined_name ${_combined_name}_${_library})
|
||||
|
||||
if(_libraries_work)
|
||||
if (BLA_STATIC)
|
||||
if (WIN32)
|
||||
set(CMAKE_FIND_LIBRARY_SUFFIXES .lib ${CMAKE_FIND_LIBRARY_SUFFIXES})
|
||||
endif ( WIN32 )
|
||||
if (APPLE)
|
||||
set(CMAKE_FIND_LIBRARY_SUFFIXES .lib ${CMAKE_FIND_LIBRARY_SUFFIXES})
|
||||
else (APPLE)
|
||||
set(CMAKE_FIND_LIBRARY_SUFFIXES .a ${CMAKE_FIND_LIBRARY_SUFFIXES})
|
||||
endif (APPLE)
|
||||
else (BLA_STATIC)
|
||||
if (CMAKE_SYSTEM_NAME STREQUAL "Linux")
|
||||
# for ubuntu's libblas3gf and liblapack3gf packages
|
||||
set(CMAKE_FIND_LIBRARY_SUFFIXES ${CMAKE_FIND_LIBRARY_SUFFIXES} .so.3gf)
|
||||
endif ()
|
||||
endif (BLA_STATIC)
|
||||
find_library(${_prefix}_${_library}_LIBRARY
|
||||
NAMES ${_library}
|
||||
PATHS ${_libdir}
|
||||
)
|
||||
mark_as_advanced(${_prefix}_${_library}_LIBRARY)
|
||||
set(${LIBRARIES} ${${LIBRARIES}} ${${_prefix}_${_library}_LIBRARY})
|
||||
set(_libraries_work ${${_prefix}_${_library}_LIBRARY})
|
||||
endif(_libraries_work)
|
||||
endforeach(_library ${_list})
|
||||
if(_libraries_work)
|
||||
# Test this combination of libraries.
|
||||
set(CMAKE_REQUIRED_LIBRARIES ${_flags} ${${LIBRARIES}} ${_threads})
|
||||
# message("DEBUG: CMAKE_REQUIRED_LIBRARIES = ${CMAKE_REQUIRED_LIBRARIES}")
|
||||
if (_CHECK_FORTRAN)
|
||||
check_fortran_function_exists("${_name}" ${_prefix}${_combined_name}_WORKS)
|
||||
else()
|
||||
check_function_exists("${_name}_" ${_prefix}${_combined_name}_WORKS)
|
||||
endif()
|
||||
set(CMAKE_REQUIRED_LIBRARIES)
|
||||
mark_as_advanced(${_prefix}${_combined_name}_WORKS)
|
||||
set(_libraries_work ${${_prefix}${_combined_name}_WORKS})
|
||||
endif(_libraries_work)
|
||||
if(NOT _libraries_work)
|
||||
set(${LIBRARIES} FALSE)
|
||||
endif(NOT _libraries_work)
|
||||
#message("DEBUG: ${LIBRARIES} = ${${LIBRARIES}}")
|
||||
endmacro(Check_Fortran_Libraries)
|
||||
|
||||
set(BLAS_LINKER_FLAGS)
|
||||
set(BLAS_LIBRARIES)
|
||||
set(BLAS95_LIBRARIES)
|
||||
if ($ENV{BLA_VENDOR} MATCHES ".+")
|
||||
set(BLA_VENDOR $ENV{BLA_VENDOR})
|
||||
else ($ENV{BLA_VENDOR} MATCHES ".+")
|
||||
if(NOT BLA_VENDOR)
|
||||
set(BLA_VENDOR "All")
|
||||
endif(NOT BLA_VENDOR)
|
||||
endif ($ENV{BLA_VENDOR} MATCHES ".+")
|
||||
|
||||
if (BLA_VENDOR STREQUAL "Goto" OR BLA_VENDOR STREQUAL "All")
|
||||
if(NOT BLAS_LIBRARIES)
|
||||
# gotoblas (http://www.tacc.utexas.edu/tacc-projects/gotoblas2)
|
||||
check_fortran_libraries(
|
||||
BLAS_LIBRARIES
|
||||
BLAS
|
||||
sgemm
|
||||
""
|
||||
"goto2"
|
||||
""
|
||||
)
|
||||
endif(NOT BLAS_LIBRARIES)
|
||||
endif (BLA_VENDOR STREQUAL "Goto" OR BLA_VENDOR STREQUAL "All")
|
||||
|
||||
if (BLA_VENDOR STREQUAL "ATLAS" OR BLA_VENDOR STREQUAL "All")
|
||||
if(NOT BLAS_LIBRARIES)
|
||||
# BLAS in ATLAS library? (http://math-atlas.sourceforge.net/)
|
||||
check_fortran_libraries(
|
||||
BLAS_LIBRARIES
|
||||
BLAS
|
||||
dgemm
|
||||
""
|
||||
"f77blas;atlas"
|
||||
""
|
||||
)
|
||||
endif(NOT BLAS_LIBRARIES)
|
||||
endif (BLA_VENDOR STREQUAL "ATLAS" OR BLA_VENDOR STREQUAL "All")
|
||||
|
||||
# BLAS in PhiPACK libraries? (requires generic BLAS lib, too)
|
||||
if (BLA_VENDOR STREQUAL "PhiPACK" OR BLA_VENDOR STREQUAL "All")
|
||||
if(NOT BLAS_LIBRARIES)
|
||||
check_fortran_libraries(
|
||||
BLAS_LIBRARIES
|
||||
BLAS
|
||||
sgemm
|
||||
""
|
||||
"sgemm;dgemm;blas"
|
||||
""
|
||||
)
|
||||
endif(NOT BLAS_LIBRARIES)
|
||||
endif (BLA_VENDOR STREQUAL "PhiPACK" OR BLA_VENDOR STREQUAL "All")
|
||||
|
||||
# BLAS in Alpha CXML library?
|
||||
if (BLA_VENDOR STREQUAL "CXML" OR BLA_VENDOR STREQUAL "All")
|
||||
if(NOT BLAS_LIBRARIES)
|
||||
check_fortran_libraries(
|
||||
BLAS_LIBRARIES
|
||||
BLAS
|
||||
sgemm
|
||||
""
|
||||
"cxml"
|
||||
""
|
||||
)
|
||||
endif(NOT BLAS_LIBRARIES)
|
||||
endif (BLA_VENDOR STREQUAL "CXML" OR BLA_VENDOR STREQUAL "All")
|
||||
|
||||
# BLAS in Alpha DXML library? (now called CXML, see above)
|
||||
if (BLA_VENDOR STREQUAL "DXML" OR BLA_VENDOR STREQUAL "All")
|
||||
if(NOT BLAS_LIBRARIES)
|
||||
check_fortran_libraries(
|
||||
BLAS_LIBRARIES
|
||||
BLAS
|
||||
sgemm
|
||||
""
|
||||
"dxml"
|
||||
""
|
||||
)
|
||||
endif(NOT BLAS_LIBRARIES)
|
||||
endif (BLA_VENDOR STREQUAL "DXML" OR BLA_VENDOR STREQUAL "All")
|
||||
|
||||
# BLAS in Sun Performance library?
|
||||
if (BLA_VENDOR STREQUAL "SunPerf" OR BLA_VENDOR STREQUAL "All")
|
||||
if(NOT BLAS_LIBRARIES)
|
||||
check_fortran_libraries(
|
||||
BLAS_LIBRARIES
|
||||
BLAS
|
||||
sgemm
|
||||
"-xlic_lib=sunperf"
|
||||
"sunperf;sunmath"
|
||||
""
|
||||
)
|
||||
if(BLAS_LIBRARIES)
|
||||
set(BLAS_LINKER_FLAGS "-xlic_lib=sunperf")
|
||||
endif(BLAS_LIBRARIES)
|
||||
endif(NOT BLAS_LIBRARIES)
|
||||
endif (BLA_VENDOR STREQUAL "SunPerf" OR BLA_VENDOR STREQUAL "All")
|
||||
|
||||
# BLAS in SCSL library? (SGI/Cray Scientific Library)
|
||||
if (BLA_VENDOR STREQUAL "SCSL" OR BLA_VENDOR STREQUAL "All")
|
||||
if(NOT BLAS_LIBRARIES)
|
||||
check_fortran_libraries(
|
||||
BLAS_LIBRARIES
|
||||
BLAS
|
||||
sgemm
|
||||
""
|
||||
"scsl"
|
||||
""
|
||||
)
|
||||
endif(NOT BLAS_LIBRARIES)
|
||||
endif (BLA_VENDOR STREQUAL "SCSL" OR BLA_VENDOR STREQUAL "All")
|
||||
|
||||
# BLAS in SGIMATH library?
|
||||
if (BLA_VENDOR STREQUAL "SGIMATH" OR BLA_VENDOR STREQUAL "All")
|
||||
if(NOT BLAS_LIBRARIES)
|
||||
check_fortran_libraries(
|
||||
BLAS_LIBRARIES
|
||||
BLAS
|
||||
sgemm
|
||||
""
|
||||
"complib.sgimath"
|
||||
""
|
||||
)
|
||||
endif(NOT BLAS_LIBRARIES)
|
||||
endif (BLA_VENDOR STREQUAL "SGIMATH" OR BLA_VENDOR STREQUAL "All")
|
||||
|
||||
# BLAS in IBM ESSL library? (requires generic BLAS lib, too)
|
||||
if (BLA_VENDOR STREQUAL "IBMESSL" OR BLA_VENDOR STREQUAL "All")
|
||||
if(NOT BLAS_LIBRARIES)
|
||||
check_fortran_libraries(
|
||||
BLAS_LIBRARIES
|
||||
BLAS
|
||||
sgemm
|
||||
""
|
||||
"essl;blas"
|
||||
""
|
||||
)
|
||||
endif(NOT BLAS_LIBRARIES)
|
||||
endif (BLA_VENDOR STREQUAL "IBMESSL" OR BLA_VENDOR STREQUAL "All")
|
||||
|
||||
#BLAS in acml library?
|
||||
if (BLA_VENDOR MATCHES "ACML.*" OR BLA_VENDOR STREQUAL "All")
|
||||
if( ((BLA_VENDOR STREQUAL "ACML") AND (NOT BLAS_ACML_LIB_DIRS)) OR
|
||||
((BLA_VENDOR STREQUAL "ACML_MP") AND (NOT BLAS_ACML_MP_LIB_DIRS)) OR
|
||||
((BLA_VENDOR STREQUAL "ACML_GPU") AND (NOT BLAS_ACML_GPU_LIB_DIRS))
|
||||
)
|
||||
# try to find acml in "standard" paths
|
||||
if( WIN32 )
|
||||
file( GLOB _ACML_ROOT "C:/AMD/acml*/ACML-EULA.txt" )
|
||||
else()
|
||||
file( GLOB _ACML_ROOT "/opt/acml*/ACML-EULA.txt" )
|
||||
endif()
|
||||
if( WIN32 )
|
||||
file( GLOB _ACML_GPU_ROOT "C:/AMD/acml*/GPGPUexamples" )
|
||||
else()
|
||||
file( GLOB _ACML_GPU_ROOT "/opt/acml*/GPGPUexamples" )
|
||||
endif()
|
||||
list(GET _ACML_ROOT 0 _ACML_ROOT)
|
||||
list(GET _ACML_GPU_ROOT 0 _ACML_GPU_ROOT)
|
||||
if( _ACML_ROOT )
|
||||
get_filename_component( _ACML_ROOT ${_ACML_ROOT} PATH )
|
||||
if( SIZEOF_INTEGER EQUAL 8 )
|
||||
set( _ACML_PATH_SUFFIX "_int64" )
|
||||
else()
|
||||
set( _ACML_PATH_SUFFIX "" )
|
||||
endif()
|
||||
if( CMAKE_Fortran_COMPILER_ID STREQUAL "Intel" )
|
||||
set( _ACML_COMPILER32 "ifort32" )
|
||||
set( _ACML_COMPILER64 "ifort64" )
|
||||
elseif( CMAKE_Fortran_COMPILER_ID STREQUAL "SunPro" )
|
||||
set( _ACML_COMPILER32 "sun32" )
|
||||
set( _ACML_COMPILER64 "sun64" )
|
||||
elseif( CMAKE_Fortran_COMPILER_ID STREQUAL "PGI" )
|
||||
set( _ACML_COMPILER32 "pgi32" )
|
||||
if( WIN32 )
|
||||
set( _ACML_COMPILER64 "win64" )
|
||||
else()
|
||||
set( _ACML_COMPILER64 "pgi64" )
|
||||
endif()
|
||||
elseif( CMAKE_Fortran_COMPILER_ID STREQUAL "Open64" )
|
||||
# 32 bit builds not supported on Open64 but for code simplicity
|
||||
# We'll just use the same directory twice
|
||||
set( _ACML_COMPILER32 "open64_64" )
|
||||
set( _ACML_COMPILER64 "open64_64" )
|
||||
elseif( CMAKE_Fortran_COMPILER_ID STREQUAL "NAG" )
|
||||
set( _ACML_COMPILER32 "nag32" )
|
||||
set( _ACML_COMPILER64 "nag64" )
|
||||
else() #if( CMAKE_Fortran_COMPILER_ID STREQUAL "GNU" )
|
||||
set( _ACML_COMPILER32 "gfortran32" )
|
||||
set( _ACML_COMPILER64 "gfortran64" )
|
||||
endif()
|
||||
|
||||
if( BLA_VENDOR STREQUAL "ACML_MP" )
|
||||
set(_ACML_MP_LIB_DIRS
|
||||
"${_ACML_ROOT}/${_ACML_COMPILER32}_mp${_ACML_PATH_SUFFIX}/lib"
|
||||
"${_ACML_ROOT}/${_ACML_COMPILER64}_mp${_ACML_PATH_SUFFIX}/lib" )
|
||||
else() #if( _BLAS_VENDOR STREQUAL "ACML" )
|
||||
set(_ACML_LIB_DIRS
|
||||
"${_ACML_ROOT}/${_ACML_COMPILER32}${_ACML_PATH_SUFFIX}/lib"
|
||||
"${_ACML_ROOT}/${_ACML_COMPILER64}${_ACML_PATH_SUFFIX}/lib" )
|
||||
endif()
|
||||
endif()
|
||||
elseif(BLAS_${BLA_VENDOR}_LIB_DIRS)
|
||||
set(_${BLA_VENDOR}_LIB_DIRS ${BLAS_${BLA_VENDOR}_LIB_DIRS})
|
||||
endif()
|
||||
|
||||
if( BLA_VENDOR STREQUAL "ACML_MP" )
|
||||
foreach( BLAS_ACML_MP_LIB_DIRS ${_ACML_MP_LIB_DIRS})
|
||||
check_fortran_libraries (
|
||||
BLAS_LIBRARIES
|
||||
BLAS
|
||||
sgemm
|
||||
"" "acml_mp;acml_mv" "" ${BLAS_ACML_MP_LIB_DIRS}
|
||||
)
|
||||
if( BLAS_LIBRARIES )
|
||||
break()
|
||||
endif()
|
||||
endforeach()
|
||||
elseif( BLA_VENDOR STREQUAL "ACML_GPU" )
|
||||
foreach( BLAS_ACML_GPU_LIB_DIRS ${_ACML_GPU_LIB_DIRS})
|
||||
check_fortran_libraries (
|
||||
BLAS_LIBRARIES
|
||||
BLAS
|
||||
sgemm
|
||||
"" "acml;acml_mv;CALBLAS" "" ${BLAS_ACML_GPU_LIB_DIRS}
|
||||
)
|
||||
if( BLAS_LIBRARIES )
|
||||
break()
|
||||
endif()
|
||||
endforeach()
|
||||
else() #if( _BLAS_VENDOR STREQUAL "ACML" )
|
||||
foreach( BLAS_ACML_LIB_DIRS ${_ACML_LIB_DIRS} )
|
||||
check_fortran_libraries (
|
||||
BLAS_LIBRARIES
|
||||
BLAS
|
||||
sgemm
|
||||
"" "acml;acml_mv" "" ${BLAS_ACML_LIB_DIRS}
|
||||
)
|
||||
if( BLAS_LIBRARIES )
|
||||
break()
|
||||
endif()
|
||||
endforeach()
|
||||
endif()
|
||||
|
||||
# Either acml or acml_mp should be in LD_LIBRARY_PATH but not both
|
||||
if(NOT BLAS_LIBRARIES)
|
||||
check_fortran_libraries(
|
||||
BLAS_LIBRARIES
|
||||
BLAS
|
||||
sgemm
|
||||
""
|
||||
"acml;acml_mv"
|
||||
""
|
||||
)
|
||||
endif(NOT BLAS_LIBRARIES)
|
||||
if(NOT BLAS_LIBRARIES)
|
||||
check_fortran_libraries(
|
||||
BLAS_LIBRARIES
|
||||
BLAS
|
||||
sgemm
|
||||
""
|
||||
"acml_mp;acml_mv"
|
||||
""
|
||||
)
|
||||
endif(NOT BLAS_LIBRARIES)
|
||||
if(NOT BLAS_LIBRARIES)
|
||||
check_fortran_libraries(
|
||||
BLAS_LIBRARIES
|
||||
BLAS
|
||||
sgemm
|
||||
""
|
||||
"acml;acml_mv;CALBLAS"
|
||||
""
|
||||
)
|
||||
endif(NOT BLAS_LIBRARIES)
|
||||
endif () # ACML
|
||||
|
||||
# Apple BLAS library?
|
||||
if (BLA_VENDOR STREQUAL "Apple" OR BLA_VENDOR STREQUAL "All")
|
||||
if(NOT BLAS_LIBRARIES)
|
||||
check_fortran_libraries(
|
||||
BLAS_LIBRARIES
|
||||
BLAS
|
||||
dgemm
|
||||
""
|
||||
"Accelerate"
|
||||
""
|
||||
)
|
||||
endif(NOT BLAS_LIBRARIES)
|
||||
endif (BLA_VENDOR STREQUAL "Apple" OR BLA_VENDOR STREQUAL "All")
|
||||
|
||||
if (BLA_VENDOR STREQUAL "NAS" OR BLA_VENDOR STREQUAL "All")
|
||||
if ( NOT BLAS_LIBRARIES )
|
||||
check_fortran_libraries(
|
||||
BLAS_LIBRARIES
|
||||
BLAS
|
||||
dgemm
|
||||
""
|
||||
"vecLib"
|
||||
""
|
||||
)
|
||||
endif ( NOT BLAS_LIBRARIES )
|
||||
endif (BLA_VENDOR STREQUAL "NAS" OR BLA_VENDOR STREQUAL "All")
|
||||
# Generic BLAS library?
|
||||
if (BLA_VENDOR STREQUAL "Generic" OR BLA_VENDOR STREQUAL "All")
|
||||
if(NOT BLAS_LIBRARIES)
|
||||
check_fortran_libraries(
|
||||
BLAS_LIBRARIES
|
||||
BLAS
|
||||
sgemm
|
||||
""
|
||||
"blas"
|
||||
""
|
||||
)
|
||||
endif(NOT BLAS_LIBRARIES)
|
||||
endif (BLA_VENDOR STREQUAL "Generic" OR BLA_VENDOR STREQUAL "All")
|
||||
|
||||
#BLAS in intel mkl 10 library? (em64t 64bit)
|
||||
if (BLA_VENDOR MATCHES "Intel*" OR BLA_VENDOR STREQUAL "All")
|
||||
if (NOT WIN32)
|
||||
set(LM "-lm")
|
||||
endif ()
|
||||
if (_LANGUAGES_ MATCHES C OR _LANGUAGES_ MATCHES CXX)
|
||||
if(BLAS_FIND_QUIETLY OR NOT BLAS_FIND_REQUIRED)
|
||||
find_package(Threads)
|
||||
else(BLAS_FIND_QUIETLY OR NOT BLAS_FIND_REQUIRED)
|
||||
find_package(Threads REQUIRED)
|
||||
endif(BLAS_FIND_QUIETLY OR NOT BLAS_FIND_REQUIRED)
|
||||
if (WIN32)
|
||||
if(BLA_F95)
|
||||
if(NOT BLAS95_LIBRARIES)
|
||||
check_fortran_libraries(
|
||||
BLAS95_LIBRARIES
|
||||
BLAS
|
||||
sgemm
|
||||
""
|
||||
"mkl_blas95;mkl_intel_c;mkl_intel_thread;mkl_core;libguide40"
|
||||
""
|
||||
)
|
||||
endif(NOT BLAS95_LIBRARIES)
|
||||
else(BLA_F95)
|
||||
if(NOT BLAS_LIBRARIES)
|
||||
check_fortran_libraries(
|
||||
BLAS_LIBRARIES
|
||||
BLAS
|
||||
SGEMM
|
||||
""
|
||||
"mkl_c_dll;mkl_intel_thread_dll;mkl_core_dll;libguide40"
|
||||
""
|
||||
)
|
||||
endif(NOT BLAS_LIBRARIES)
|
||||
endif(BLA_F95)
|
||||
else(WIN32)
|
||||
if (BLA_VENDOR STREQUAL "Intel10_32" OR BLA_VENDOR STREQUAL "All")
|
||||
if(BLA_F95)
|
||||
if(NOT BLAS95_LIBRARIES)
|
||||
check_fortran_libraries(
|
||||
BLAS95_LIBRARIES
|
||||
BLAS
|
||||
sgemm
|
||||
""
|
||||
"mkl_blas95;mkl_intel;mkl_intel_thread;mkl_core;guide"
|
||||
"${CMAKE_THREAD_LIBS_INIT};${LM}"
|
||||
)
|
||||
endif(NOT BLAS95_LIBRARIES)
|
||||
else(BLA_F95)
|
||||
if(NOT BLAS_LIBRARIES)
|
||||
check_fortran_libraries(
|
||||
BLAS_LIBRARIES
|
||||
BLAS
|
||||
sgemm
|
||||
""
|
||||
"mkl_intel;mkl_intel_thread;mkl_core;guide"
|
||||
"${CMAKE_THREAD_LIBS_INIT}"
|
||||
"${LM}"
|
||||
)
|
||||
endif(NOT BLAS_LIBRARIES)
|
||||
endif(BLA_F95)
|
||||
endif (BLA_VENDOR STREQUAL "Intel10_32" OR BLA_VENDOR STREQUAL "All")
|
||||
if (BLA_VENDOR STREQUAL "Intel10_64lp" OR BLA_VENDOR STREQUAL "All")
|
||||
if(BLA_F95)
|
||||
if(NOT BLAS95_LIBRARIES)
|
||||
check_fortran_libraries(
|
||||
BLAS95_LIBRARIES
|
||||
BLAS
|
||||
sgemm
|
||||
""
|
||||
"mkl_blas95;mkl_intel_lp64;mkl_intel_thread;mkl_core;guide"
|
||||
"${CMAKE_THREAD_LIBS_INIT};${LM}"
|
||||
)
|
||||
endif(NOT BLAS95_LIBRARIES)
|
||||
else(BLA_F95)
|
||||
if(NOT BLAS_LIBRARIES)
|
||||
check_fortran_libraries(
|
||||
BLAS_LIBRARIES
|
||||
BLAS
|
||||
sgemm
|
||||
""
|
||||
"mkl_intel_lp64;mkl_intel_thread;mkl_core;guide"
|
||||
"${CMAKE_THREAD_LIBS_INIT};${LM}"
|
||||
)
|
||||
endif(NOT BLAS_LIBRARIES)
|
||||
endif(BLA_F95)
|
||||
endif (BLA_VENDOR STREQUAL "Intel10_64lp" OR BLA_VENDOR STREQUAL "All")
|
||||
endif (WIN32)
|
||||
#older vesions of intel mkl libs
|
||||
# BLAS in intel mkl library? (shared)
|
||||
if(NOT BLAS_LIBRARIES)
|
||||
check_fortran_libraries(
|
||||
BLAS_LIBRARIES
|
||||
BLAS
|
||||
sgemm
|
||||
""
|
||||
"mkl;guide"
|
||||
"${CMAKE_THREAD_LIBS_INIT};${LM}"
|
||||
)
|
||||
endif(NOT BLAS_LIBRARIES)
|
||||
#BLAS in intel mkl library? (static, 32bit)
|
||||
if(NOT BLAS_LIBRARIES)
|
||||
check_fortran_libraries(
|
||||
BLAS_LIBRARIES
|
||||
BLAS
|
||||
sgemm
|
||||
""
|
||||
"mkl_ia32;guide"
|
||||
"${CMAKE_THREAD_LIBS_INIT};${LM}"
|
||||
)
|
||||
endif(NOT BLAS_LIBRARIES)
|
||||
#BLAS in intel mkl library? (static, em64t 64bit)
|
||||
if(NOT BLAS_LIBRARIES)
|
||||
check_fortran_libraries(
|
||||
BLAS_LIBRARIES
|
||||
BLAS
|
||||
sgemm
|
||||
""
|
||||
"mkl_em64t;guide"
|
||||
"${CMAKE_THREAD_LIBS_INIT};${LM}"
|
||||
)
|
||||
endif(NOT BLAS_LIBRARIES)
|
||||
endif (_LANGUAGES_ MATCHES C OR _LANGUAGES_ MATCHES CXX)
|
||||
endif (BLA_VENDOR MATCHES "Intel*" OR BLA_VENDOR STREQUAL "All")
|
||||
|
||||
|
||||
if(BLA_F95)
|
||||
if(BLAS95_LIBRARIES)
|
||||
set(BLAS95_FOUND TRUE)
|
||||
else(BLAS95_LIBRARIES)
|
||||
set(BLAS95_FOUND FALSE)
|
||||
endif(BLAS95_LIBRARIES)
|
||||
|
||||
if(NOT BLAS_FIND_QUIETLY)
|
||||
if(BLAS95_FOUND)
|
||||
message(STATUS "A library with BLAS95 API found.")
|
||||
else(BLAS95_FOUND)
|
||||
if(BLAS_FIND_REQUIRED)
|
||||
message(FATAL_ERROR
|
||||
"A required library with BLAS95 API not found. Please specify library location.")
|
||||
else(BLAS_FIND_REQUIRED)
|
||||
message(STATUS
|
||||
"A library with BLAS95 API not found. Please specify library location.")
|
||||
endif(BLAS_FIND_REQUIRED)
|
||||
endif(BLAS95_FOUND)
|
||||
endif(NOT BLAS_FIND_QUIETLY)
|
||||
set(BLAS_FOUND TRUE)
|
||||
set(BLAS_LIBRARIES "${BLAS95_LIBRARIES}")
|
||||
else(BLA_F95)
|
||||
if(BLAS_LIBRARIES)
|
||||
set(BLAS_FOUND TRUE)
|
||||
else(BLAS_LIBRARIES)
|
||||
set(BLAS_FOUND FALSE)
|
||||
endif(BLAS_LIBRARIES)
|
||||
|
||||
if(NOT BLAS_FIND_QUIETLY)
|
||||
if(BLAS_FOUND)
|
||||
message(STATUS "A library with BLAS API found.")
|
||||
else(BLAS_FOUND)
|
||||
if(BLAS_FIND_REQUIRED)
|
||||
message(FATAL_ERROR
|
||||
"A required library with BLAS API not found. Please specify library location."
|
||||
)
|
||||
else(BLAS_FIND_REQUIRED)
|
||||
message(STATUS
|
||||
"A library with BLAS API not found. Please specify library location."
|
||||
)
|
||||
endif(BLAS_FIND_REQUIRED)
|
||||
endif(BLAS_FOUND)
|
||||
endif(NOT BLAS_FIND_QUIETLY)
|
||||
endif(BLA_F95)
|
||||
|
||||
set(CMAKE_FIND_LIBRARY_SUFFIXES ${_blas_ORIG_CMAKE_FIND_LIBRARY_SUFFIXES})
|
||||
307
cmake/Modules/compat-2.8.7/FindLAPACK.cmake
Normal file
307
cmake/Modules/compat-2.8.7/FindLAPACK.cmake
Normal file
@@ -0,0 +1,307 @@
|
||||
# - Find LAPACK library
|
||||
# This module finds an installed fortran library that implements the LAPACK
|
||||
# linear-algebra interface (see http://www.netlib.org/lapack/).
|
||||
#
|
||||
# The approach follows that taken for the autoconf macro file, acx_lapack.m4
|
||||
# (distributed at http://ac-archive.sourceforge.net/ac-archive/acx_lapack.html).
|
||||
#
|
||||
# This module sets the following variables:
|
||||
# LAPACK_FOUND - set to true if a library implementing the LAPACK interface
|
||||
# is found
|
||||
# LAPACK_LINKER_FLAGS - uncached list of required linker flags (excluding -l
|
||||
# and -L).
|
||||
# LAPACK_LIBRARIES - uncached list of libraries (using full path name) to
|
||||
# link against to use LAPACK
|
||||
# LAPACK95_LIBRARIES - uncached list of libraries (using full path name) to
|
||||
# link against to use LAPACK95
|
||||
# LAPACK95_FOUND - set to true if a library implementing the LAPACK f95
|
||||
# interface is found
|
||||
# BLA_STATIC if set on this determines what kind of linkage we do (static)
|
||||
# BLA_VENDOR if set checks only the specified vendor, if not set checks
|
||||
# all the possibilities
|
||||
# BLA_F95 if set on tries to find the f95 interfaces for BLAS/LAPACK
|
||||
### List of vendors (BLA_VENDOR) valid in this module
|
||||
## Intel(mkl), ACML,Apple, NAS, Generic
|
||||
|
||||
#=============================================================================
|
||||
# Copyright 2007-2009 Kitware, Inc.
|
||||
#
|
||||
# Distributed under the OSI-approved BSD License (the "License");
|
||||
# see accompanying file Copyright.txt for details.
|
||||
#
|
||||
# This software is distributed WITHOUT ANY WARRANTY; without even the
|
||||
# implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
|
||||
# See the License for more information.
|
||||
#=============================================================================
|
||||
# (To distribute this file outside of CMake, substitute the full
|
||||
# License text for the above reference.)
|
||||
|
||||
set(_lapack_ORIG_CMAKE_FIND_LIBRARY_SUFFIXES ${CMAKE_FIND_LIBRARY_SUFFIXES})
|
||||
|
||||
get_property(_LANGUAGES_ GLOBAL PROPERTY ENABLED_LANGUAGES)
|
||||
if (NOT _LANGUAGES_ MATCHES Fortran)
|
||||
include(CheckFunctionExists)
|
||||
else (NOT _LANGUAGES_ MATCHES Fortran)
|
||||
include(CheckFortranFunctionExists)
|
||||
endif (NOT _LANGUAGES_ MATCHES Fortran)
|
||||
|
||||
set(LAPACK_FOUND FALSE)
|
||||
set(LAPACK95_FOUND FALSE)
|
||||
|
||||
# TODO: move this stuff to separate module
|
||||
|
||||
macro(Check_Lapack_Libraries LIBRARIES _prefix _name _flags _list _blas _threads)
|
||||
# This macro checks for the existence of the combination of fortran libraries
|
||||
# given by _list. If the combination is found, this macro checks (using the
|
||||
# Check_Fortran_Function_Exists macro) whether can link against that library
|
||||
# combination using the name of a routine given by _name using the linker
|
||||
# flags given by _flags. If the combination of libraries is found and passes
|
||||
# the link test, LIBRARIES is set to the list of complete library paths that
|
||||
# have been found. Otherwise, LIBRARIES is set to FALSE.
|
||||
|
||||
# N.B. _prefix is the prefix applied to the names of all cached variables that
|
||||
# are generated internally and marked advanced by this macro.
|
||||
|
||||
set(_libraries_work TRUE)
|
||||
set(${LIBRARIES})
|
||||
set(_combined_name)
|
||||
if (NOT _libdir)
|
||||
if (WIN32)
|
||||
set(_libdir ENV LIB)
|
||||
elseif (APPLE)
|
||||
set(_libdir /usr/local/lib /usr/lib /usr/local/lib64 /usr/lib64 ENV DYLD_LIBRARY_PATH)
|
||||
else ()
|
||||
set(_libdir /usr/local/lib /usr/lib /usr/local/lib64 /usr/lib64 ENV LD_LIBRARY_PATH)
|
||||
endif ()
|
||||
endif ()
|
||||
foreach(_library ${_list})
|
||||
set(_combined_name ${_combined_name}_${_library})
|
||||
|
||||
if(_libraries_work)
|
||||
if (BLA_STATIC)
|
||||
if (WIN32)
|
||||
set(CMAKE_FIND_LIBRARY_SUFFIXES .lib ${CMAKE_FIND_LIBRARY_SUFFIXES})
|
||||
endif ( WIN32 )
|
||||
if (APPLE)
|
||||
set(CMAKE_FIND_LIBRARY_SUFFIXES .lib ${CMAKE_FIND_LIBRARY_SUFFIXES})
|
||||
else (APPLE)
|
||||
set(CMAKE_FIND_LIBRARY_SUFFIXES .a ${CMAKE_FIND_LIBRARY_SUFFIXES})
|
||||
endif (APPLE)
|
||||
else (BLA_STATIC)
|
||||
if (CMAKE_SYSTEM_NAME STREQUAL "Linux")
|
||||
# for ubuntu's libblas3gf and liblapack3gf packages
|
||||
set(CMAKE_FIND_LIBRARY_SUFFIXES ${CMAKE_FIND_LIBRARY_SUFFIXES} .so.3gf)
|
||||
endif ()
|
||||
endif (BLA_STATIC)
|
||||
find_library(${_prefix}_${_library}_LIBRARY
|
||||
NAMES ${_library}
|
||||
PATHS ${_libdir}
|
||||
)
|
||||
mark_as_advanced(${_prefix}_${_library}_LIBRARY)
|
||||
set(${LIBRARIES} ${${LIBRARIES}} ${${_prefix}_${_library}_LIBRARY})
|
||||
set(_libraries_work ${${_prefix}_${_library}_LIBRARY})
|
||||
endif(_libraries_work)
|
||||
endforeach(_library ${_list})
|
||||
|
||||
if(_libraries_work)
|
||||
# Test this combination of libraries.
|
||||
if(UNIX AND BLA_STATIC)
|
||||
set(CMAKE_REQUIRED_LIBRARIES ${_flags} "-Wl,--start-group" ${${LIBRARIES}} ${_blas} "-Wl,--end-group" ${_threads})
|
||||
else(UNIX AND BLA_STATIC)
|
||||
set(CMAKE_REQUIRED_LIBRARIES ${_flags} ${${LIBRARIES}} ${_blas} ${_threads})
|
||||
endif(UNIX AND BLA_STATIC)
|
||||
# message("DEBUG: CMAKE_REQUIRED_LIBRARIES = ${CMAKE_REQUIRED_LIBRARIES}")
|
||||
if (NOT _LANGUAGES_ MATCHES Fortran)
|
||||
check_function_exists("${_name}_" ${_prefix}${_combined_name}_WORKS)
|
||||
else (NOT _LANGUAGES_ MATCHES Fortran)
|
||||
check_fortran_function_exists(${_name} ${_prefix}${_combined_name}_WORKS)
|
||||
endif (NOT _LANGUAGES_ MATCHES Fortran)
|
||||
set(CMAKE_REQUIRED_LIBRARIES)
|
||||
mark_as_advanced(${_prefix}${_combined_name}_WORKS)
|
||||
set(_libraries_work ${${_prefix}${_combined_name}_WORKS})
|
||||
#message("DEBUG: ${LIBRARIES} = ${${LIBRARIES}}")
|
||||
endif(_libraries_work)
|
||||
|
||||
if(_libraries_work)
|
||||
set(${LIBRARIES} ${${LIBRARIES}} ${_blas} ${_threads})
|
||||
else(_libraries_work)
|
||||
set(${LIBRARIES} FALSE)
|
||||
endif(_libraries_work)
|
||||
|
||||
endmacro(Check_Lapack_Libraries)
|
||||
|
||||
|
||||
set(LAPACK_LINKER_FLAGS)
|
||||
set(LAPACK_LIBRARIES)
|
||||
set(LAPACK95_LIBRARIES)
|
||||
|
||||
|
||||
if(LAPACK_FIND_QUIETLY OR NOT LAPACK_FIND_REQUIRED)
|
||||
find_package(BLAS)
|
||||
else(LAPACK_FIND_QUIETLY OR NOT LAPACK_FIND_REQUIRED)
|
||||
find_package(BLAS REQUIRED)
|
||||
endif(LAPACK_FIND_QUIETLY OR NOT LAPACK_FIND_REQUIRED)
|
||||
|
||||
|
||||
if(BLAS_FOUND)
|
||||
set(LAPACK_LINKER_FLAGS ${BLAS_LINKER_FLAGS})
|
||||
if ($ENV{BLA_VENDOR} MATCHES ".+")
|
||||
set(BLA_VENDOR $ENV{BLA_VENDOR})
|
||||
else ($ENV{BLA_VENDOR} MATCHES ".+")
|
||||
if(NOT BLA_VENDOR)
|
||||
set(BLA_VENDOR "All")
|
||||
endif(NOT BLA_VENDOR)
|
||||
endif ($ENV{BLA_VENDOR} MATCHES ".+")
|
||||
|
||||
if (BLA_VENDOR STREQUAL "Goto" OR BLA_VENDOR STREQUAL "All")
|
||||
if(NOT LAPACK_LIBRARIES)
|
||||
check_lapack_libraries(
|
||||
LAPACK_LIBRARIES
|
||||
LAPACK
|
||||
cheev
|
||||
""
|
||||
"goto2"
|
||||
"${BLAS_LIBRARIES}"
|
||||
""
|
||||
)
|
||||
endif(NOT LAPACK_LIBRARIES)
|
||||
endif (BLA_VENDOR STREQUAL "Goto" OR BLA_VENDOR STREQUAL "All")
|
||||
|
||||
|
||||
#acml lapack
|
||||
if (BLA_VENDOR MATCHES "ACML.*" OR BLA_VENDOR STREQUAL "All")
|
||||
if (BLAS_LIBRARIES MATCHES ".+acml.+")
|
||||
set (LAPACK_LIBRARIES ${BLAS_LIBRARIES})
|
||||
endif ()
|
||||
endif ()
|
||||
|
||||
# Apple LAPACK library?
|
||||
if (BLA_VENDOR STREQUAL "Apple" OR BLA_VENDOR STREQUAL "All")
|
||||
if(NOT LAPACK_LIBRARIES)
|
||||
check_lapack_libraries(
|
||||
LAPACK_LIBRARIES
|
||||
LAPACK
|
||||
cheev
|
||||
""
|
||||
"Accelerate"
|
||||
"${BLAS_LIBRARIES}"
|
||||
""
|
||||
)
|
||||
endif(NOT LAPACK_LIBRARIES)
|
||||
endif (BLA_VENDOR STREQUAL "Apple" OR BLA_VENDOR STREQUAL "All")
|
||||
if (BLA_VENDOR STREQUAL "NAS" OR BLA_VENDOR STREQUAL "All")
|
||||
if ( NOT LAPACK_LIBRARIES )
|
||||
check_lapack_libraries(
|
||||
LAPACK_LIBRARIES
|
||||
LAPACK
|
||||
cheev
|
||||
""
|
||||
"vecLib"
|
||||
"${BLAS_LIBRARIES}"
|
||||
""
|
||||
)
|
||||
endif ( NOT LAPACK_LIBRARIES )
|
||||
endif (BLA_VENDOR STREQUAL "NAS" OR BLA_VENDOR STREQUAL "All")
|
||||
# Generic LAPACK library?
|
||||
if (BLA_VENDOR STREQUAL "Generic" OR
|
||||
BLA_VENDOR STREQUAL "ATLAS" OR
|
||||
BLA_VENDOR STREQUAL "All")
|
||||
if ( NOT LAPACK_LIBRARIES )
|
||||
check_lapack_libraries(
|
||||
LAPACK_LIBRARIES
|
||||
LAPACK
|
||||
cheev
|
||||
""
|
||||
"lapack"
|
||||
"${BLAS_LIBRARIES}"
|
||||
""
|
||||
)
|
||||
endif ( NOT LAPACK_LIBRARIES )
|
||||
endif ()
|
||||
#intel lapack
|
||||
if (BLA_VENDOR MATCHES "Intel*" OR BLA_VENDOR STREQUAL "All")
|
||||
if (_LANGUAGES_ MATCHES C OR _LANGUAGES_ MATCHES CXX)
|
||||
if(LAPACK_FIND_QUIETLY OR NOT LAPACK_FIND_REQUIRED)
|
||||
find_PACKAGE(Threads)
|
||||
else(LAPACK_FIND_QUIETLY OR NOT LAPACK_FIND_REQUIRED)
|
||||
find_package(Threads REQUIRED)
|
||||
endif(LAPACK_FIND_QUIETLY OR NOT LAPACK_FIND_REQUIRED)
|
||||
if (BLA_F95)
|
||||
if(NOT LAPACK95_LIBRARIES)
|
||||
check_lapack_libraries(
|
||||
LAPACK95_LIBRARIES
|
||||
LAPACK
|
||||
cheev
|
||||
""
|
||||
"mkl_lapack95"
|
||||
"${BLAS95_LIBRARIES}"
|
||||
"${CMAKE_THREAD_LIBS_INIT}"
|
||||
)
|
||||
endif(NOT LAPACK95_LIBRARIES)
|
||||
else(BLA_F95)
|
||||
if(NOT LAPACK_LIBRARIES)
|
||||
check_lapack_libraries(
|
||||
LAPACK_LIBRARIES
|
||||
LAPACK
|
||||
cheev
|
||||
""
|
||||
"mkl_lapack"
|
||||
"${BLAS_LIBRARIES}"
|
||||
"${CMAKE_THREAD_LIBS_INIT}"
|
||||
)
|
||||
endif(NOT LAPACK_LIBRARIES)
|
||||
endif(BLA_F95)
|
||||
endif (_LANGUAGES_ MATCHES C OR _LANGUAGES_ MATCHES CXX)
|
||||
endif(BLA_VENDOR MATCHES "Intel*" OR BLA_VENDOR STREQUAL "All")
|
||||
else(BLAS_FOUND)
|
||||
message(STATUS "LAPACK requires BLAS")
|
||||
endif(BLAS_FOUND)
|
||||
|
||||
if(BLA_F95)
|
||||
if(LAPACK95_LIBRARIES)
|
||||
set(LAPACK95_FOUND TRUE)
|
||||
else(LAPACK95_LIBRARIES)
|
||||
set(LAPACK95_FOUND FALSE)
|
||||
endif(LAPACK95_LIBRARIES)
|
||||
if(NOT LAPACK_FIND_QUIETLY)
|
||||
if(LAPACK95_FOUND)
|
||||
message(STATUS "A library with LAPACK95 API found.")
|
||||
else(LAPACK95_FOUND)
|
||||
if(LAPACK_FIND_REQUIRED)
|
||||
message(FATAL_ERROR
|
||||
"A required library with LAPACK95 API not found. Please specify library location."
|
||||
)
|
||||
else(LAPACK_FIND_REQUIRED)
|
||||
message(STATUS
|
||||
"A library with LAPACK95 API not found. Please specify library location."
|
||||
)
|
||||
endif(LAPACK_FIND_REQUIRED)
|
||||
endif(LAPACK95_FOUND)
|
||||
endif(NOT LAPACK_FIND_QUIETLY)
|
||||
set(LAPACK_FOUND "${LAPACK95_FOUND}")
|
||||
set(LAPACK_LIBRARIES "${LAPACK95_LIBRARIES}")
|
||||
else(BLA_F95)
|
||||
if(LAPACK_LIBRARIES)
|
||||
set(LAPACK_FOUND TRUE)
|
||||
else(LAPACK_LIBRARIES)
|
||||
set(LAPACK_FOUND FALSE)
|
||||
endif(LAPACK_LIBRARIES)
|
||||
|
||||
if(NOT LAPACK_FIND_QUIETLY)
|
||||
if(LAPACK_FOUND)
|
||||
message(STATUS "A library with LAPACK API found.")
|
||||
else(LAPACK_FOUND)
|
||||
if(LAPACK_FIND_REQUIRED)
|
||||
message(FATAL_ERROR
|
||||
"A required library with LAPACK API not found. Please specify library location."
|
||||
)
|
||||
else(LAPACK_FIND_REQUIRED)
|
||||
message(STATUS
|
||||
"A library with LAPACK API not found. Please specify library location."
|
||||
)
|
||||
endif(LAPACK_FIND_REQUIRED)
|
||||
endif(LAPACK_FOUND)
|
||||
endif(NOT LAPACK_FIND_QUIETLY)
|
||||
endif(BLA_F95)
|
||||
|
||||
set(CMAKE_FIND_LIBRARY_SUFFIXES ${_lapack_ORIG_CMAKE_FIND_LIBRARY_SUFFIXES})
|
||||
25
cmake/Scripts/DuneCompat2.cmake
Normal file
25
cmake/Scripts/DuneCompat2.cmake
Normal file
@@ -0,0 +1,25 @@
|
||||
# - Emulate a rule to patch the Makefile, adding a line to the source
|
||||
# tree and write a marker file indicating it is done.
|
||||
|
||||
set (base_dir ".")
|
||||
set (marker_file "${base_dir}/CMakeFiles/marker")
|
||||
set (makefile "${base_dir}/Makefile")
|
||||
|
||||
# if the Makefile has changed, then update it
|
||||
if ("${makefile}" IS_NEWER_THAN "${marker_file}")
|
||||
# only add the string once, so it does not return multiple
|
||||
# results for the command line (will lead to syntax error)
|
||||
file (STRINGS "${makefile}" abs_top_srcdir_FOUND
|
||||
REGEX "^abs_top_srcdir = "
|
||||
)
|
||||
if (NOT abs_top_srcdir_FOUND)
|
||||
file (APPEND "${makefile}"
|
||||
"abs_top_srcdir = ${CMAKE_HOME_DIRECTORY}\n"
|
||||
)
|
||||
endif (NOT abs_top_srcdir_FOUND)
|
||||
# touch the marker so that we won't update the Makefile again
|
||||
execute_process (COMMAND
|
||||
${CMAKE_COMMAND} -E touch "${marker_file}"
|
||||
)
|
||||
endif ("${makefile}" IS_NEWER_THAN "${marker_file}")
|
||||
|
||||
15
cmake/Scripts/RemoveEmptyDir.cmake
Normal file
15
cmake/Scripts/RemoveEmptyDir.cmake
Normal file
@@ -0,0 +1,15 @@
|
||||
# - Remove a directory if and only if it contains no files
|
||||
#
|
||||
# Pass the name of the directory as the DIR variable
|
||||
|
||||
if (DIR)
|
||||
# check if empty
|
||||
file (GLOB_RECURSE files "${DIR}/*")
|
||||
|
||||
# remove only if
|
||||
if (NOT files)
|
||||
execute_process (COMMAND
|
||||
${CMAKE_COMMAND} -E remove_directory "${DIR}"
|
||||
)
|
||||
endif (NOT files)
|
||||
endif (DIR)
|
||||
@@ -46,13 +46,6 @@ PROJECT_BRIEF =
|
||||
|
||||
PROJECT_LOGO =
|
||||
|
||||
# The OUTPUT_DIRECTORY tag is used to specify the (relative or absolute)
|
||||
# base path where the generated documentation will be put.
|
||||
# If a relative path is entered, it will be relative to the location
|
||||
# where doxygen was started. If left blank the current directory will be used.
|
||||
|
||||
OUTPUT_DIRECTORY = ../Documentation
|
||||
|
||||
# If the CREATE_SUBDIRS tag is set to YES, then doxygen will create
|
||||
# 4096 sub-directories (in 2 levels) under the output directory of each output
|
||||
# format and will distribute the generated files over these directories.
|
||||
@@ -120,15 +113,6 @@ INLINE_INHERITED_MEMB = NO
|
||||
|
||||
FULL_PATH_NAMES = YES
|
||||
|
||||
# If the FULL_PATH_NAMES tag is set to YES then the STRIP_FROM_PATH tag
|
||||
# can be used to strip a user-defined part of the path. Stripping is
|
||||
# only done if one of the specified strings matches the left-hand part of
|
||||
# the path. The tag can be used to show relative paths in the file list.
|
||||
# If left blank the directory from which doxygen is run is used as the
|
||||
# path to strip.
|
||||
|
||||
STRIP_FROM_PATH =
|
||||
|
||||
# The STRIP_FROM_INC_PATH tag can be used to strip a user-defined part of
|
||||
# the path mentioned in the documentation of a class, which tells
|
||||
# the reader which header file to include in order to use a class.
|
||||
@@ -541,15 +525,6 @@ SHOW_NAMESPACES = YES
|
||||
|
||||
FILE_VERSION_FILTER =
|
||||
|
||||
# The LAYOUT_FILE tag can be used to specify a layout file which will be parsed
|
||||
# by doxygen. The layout file controls the global structure of the generated
|
||||
# output files in an output format independent way. The create the layout file
|
||||
# that represents doxygen's defaults, run doxygen with the -l option.
|
||||
# You can optionally specify a file name after the option, if omitted
|
||||
# DoxygenLayout.xml will be used as the name of the layout file.
|
||||
|
||||
LAYOUT_FILE = DoxygenLayout.xml
|
||||
|
||||
#---------------------------------------------------------------------------
|
||||
# configuration options related to warning and progress messages
|
||||
#---------------------------------------------------------------------------
|
||||
@@ -557,26 +532,26 @@ LAYOUT_FILE = DoxygenLayout.xml
|
||||
# The QUIET tag can be used to turn on/off the messages that are generated
|
||||
# by doxygen. Possible values are YES and NO. If left blank NO is used.
|
||||
|
||||
QUIET = NO
|
||||
QUIET = YES
|
||||
|
||||
# The WARNINGS tag can be used to turn on/off the warning messages that are
|
||||
# generated by doxygen. Possible values are YES and NO. If left blank
|
||||
# NO is used.
|
||||
|
||||
WARNINGS = YES
|
||||
WARNINGS = NO
|
||||
|
||||
# If WARN_IF_UNDOCUMENTED is set to YES, then doxygen will generate warnings
|
||||
# for undocumented members. If EXTRACT_ALL is set to YES then this flag will
|
||||
# automatically be disabled.
|
||||
|
||||
WARN_IF_UNDOCUMENTED = YES
|
||||
WARN_IF_UNDOCUMENTED = NO
|
||||
|
||||
# If WARN_IF_DOC_ERROR is set to YES, doxygen will generate warnings for
|
||||
# potential errors in the documentation, such as not documenting some
|
||||
# parameters in a documented function, or documenting parameters that
|
||||
# don't exist or using markup commands wrongly.
|
||||
|
||||
WARN_IF_DOC_ERROR = YES
|
||||
WARN_IF_DOC_ERROR = NO
|
||||
|
||||
# The WARN_NO_PARAMDOC option can be enabled to get warnings for
|
||||
# functions that are documented, but have no documentation for their parameters
|
||||
@@ -605,14 +580,6 @@ WARN_LOGFILE =
|
||||
# configuration options related to the input files
|
||||
#---------------------------------------------------------------------------
|
||||
|
||||
# The INPUT tag can be used to specify the files and/or directories that contain
|
||||
# documented source files. You may enter file names like "myfile.cpp" or
|
||||
# directories like "/usr/src/myproject". Separate the files or directories
|
||||
# with spaces.
|
||||
|
||||
INPUT = opm/core tutorials/tutorial1.cpp tutorials/tutorial2.cpp tutorials/tutorial3.cpp examples
|
||||
#INPUT = tutorials
|
||||
|
||||
# This tag can be used to specify the character encoding of the source files
|
||||
# that doxygen parses. Internally doxygen uses the UTF-8 encoding, which is
|
||||
# also the default input encoding. Doxygen uses libiconv (or the iconv built
|
||||
@@ -665,12 +632,6 @@ EXCLUDE_PATTERNS =
|
||||
|
||||
EXCLUDE_SYMBOLS =
|
||||
|
||||
# The EXAMPLE_PATH tag can be used to specify one or more files or
|
||||
# directories that contain example code fragments that are included (see
|
||||
# the \include command).
|
||||
|
||||
EXAMPLE_PATH = tutorials/
|
||||
|
||||
# If the value of the EXAMPLE_PATH tag contains directories, you can use the
|
||||
# EXAMPLE_PATTERNS tag to specify one or more wildcard pattern (like *.cpp
|
||||
# and *.h) to filter out the source-files in the directories. If left
|
||||
@@ -685,12 +646,6 @@ EXAMPLE_PATTERNS =
|
||||
|
||||
EXAMPLE_RECURSIVE = NO
|
||||
|
||||
# The IMAGE_PATH tag can be used to specify one or more files or
|
||||
# directories that contain image that are included in the documentation (see
|
||||
# the \image command).
|
||||
|
||||
IMAGE_PATH = ../Documentation/Figure/
|
||||
|
||||
# The INPUT_FILTER tag can be used to specify a program that doxygen should
|
||||
# invoke to filter for each input file. Doxygen will invoke the filter program
|
||||
# by executing (via popen()) the command <filter> <input-file>, where <filter>
|
||||
@@ -845,15 +800,6 @@ HTML_HEADER =
|
||||
|
||||
HTML_FOOTER =
|
||||
|
||||
# The HTML_STYLESHEET tag can be used to specify a user-defined cascading
|
||||
# style sheet that is used by each HTML page. It can be used to
|
||||
# fine-tune the look of the HTML output. If the tag is left blank doxygen
|
||||
# will generate a default style sheet. Note that doxygen will try to copy
|
||||
# the style sheet file to the HTML output directory, so don't put your own
|
||||
# stylesheet in the HTML output directory as well, or it will be erased!
|
||||
|
||||
HTML_STYLESHEET = style.css
|
||||
|
||||
# The HTML_EXTRA_FILES tag can be used to specify one or more extra images or
|
||||
# other source files which should be copied to the HTML output directory. Note
|
||||
# that these files will be copied to the base HTML output directory. Use the
|
||||
@@ -1161,13 +1107,13 @@ SERVER_BASED_SEARCH = NO
|
||||
# If the GENERATE_LATEX tag is set to YES (the default) Doxygen will
|
||||
# generate Latex output.
|
||||
|
||||
GENERATE_LATEX = YES
|
||||
GENERATE_LATEX = NO
|
||||
|
||||
# The LATEX_OUTPUT tag is used to specify where the LaTeX docs will be put.
|
||||
# If a relative path is entered the value of OUTPUT_DIRECTORY will be
|
||||
# put in front of it. If left blank `latex' will be used as the default path.
|
||||
|
||||
LATEX_OUTPUT = latex
|
||||
LATEX_OUTPUT = pdf
|
||||
|
||||
# The LATEX_CMD_NAME tag can be used to specify the LaTeX command name to be
|
||||
# invoked. If left blank `latex' will be used as the default command name.
|
||||
@@ -1232,7 +1178,7 @@ USE_PDFLATEX = YES
|
||||
# running if errors occur, instead of asking the user for help.
|
||||
# This option is also used when generating formulas in HTML.
|
||||
|
||||
LATEX_BATCHMODE = NO
|
||||
LATEX_BATCHMODE = YES
|
||||
|
||||
# If LATEX_HIDE_INDICES is set to YES then doxygen will not
|
||||
# include the index chapters (such as File Index, Compound Index, etc.)
|
||||
@@ -1529,7 +1475,7 @@ CLASS_DIAGRAMS = YES
|
||||
# the mscgen tool resides. If left empty the tool is assumed to be found in the
|
||||
# default search path.
|
||||
|
||||
MSCGEN_PATH =
|
||||
MSCGEN_PATH = @DOXYGEN_DOT_PATH@
|
||||
|
||||
# If set to YES, the inheritance and collaboration graphs will hide
|
||||
# inheritance and usage relations if the target is undocumented
|
||||
@@ -1655,7 +1601,7 @@ DOT_IMAGE_FORMAT = png
|
||||
# The tag DOT_PATH can be used to specify the path where the dot tool can be
|
||||
# found. If left blank, it is assumed the dot tool can be found in the path.
|
||||
|
||||
DOT_PATH =
|
||||
DOT_PATH = @DOXYGEN_DOT_PATH@
|
||||
|
||||
# The DOTFILE_DIRS tag can be used to specify one or more directories that
|
||||
# contain dot files that are included in the documentation (see the
|
||||
41
cmake/Templates/la.in
Normal file
41
cmake/Templates/la.in
Normal file
@@ -0,0 +1,41 @@
|
||||
# lib@target@.la - a libtool library file
|
||||
# Generated by libtool (GNU libtool) @ltversion@
|
||||
#
|
||||
# Please DO NOT delete this file!
|
||||
# It is necessary for linking the library.
|
||||
|
||||
# The name that we can dlopen(3).
|
||||
dlname='@dlname@'
|
||||
|
||||
# Names of this library.
|
||||
library_names='@library_names@'
|
||||
|
||||
# The name of the static archive.
|
||||
old_library='@old_library@'
|
||||
|
||||
# Linker flags that can not go in dependency_libs.
|
||||
inherited_linker_flags='@inherited_linker_flags@'
|
||||
|
||||
# Libraries that this one depends upon.
|
||||
dependency_libs='@dependency_libs@'
|
||||
|
||||
# Names of additional weak libraries provided by this library
|
||||
weak_library_names=''
|
||||
|
||||
# Version information for lib@target@.
|
||||
current=@current@
|
||||
age=@age@
|
||||
revision=0
|
||||
|
||||
# Is this an already installed library?
|
||||
installed=no
|
||||
|
||||
# Should we warn about portability when linking against -modules?
|
||||
shouldnotlink=no
|
||||
|
||||
# Files to dlopen/dlpreopen
|
||||
dlopen=''
|
||||
dlpreopen=''
|
||||
|
||||
# Directory that this library needs to be installed in:
|
||||
libdir='@libdir@'
|
||||
28
cmake/Templates/opm-project-config-version.cmake.in
Normal file
28
cmake/Templates/opm-project-config-version.cmake.in
Normal file
@@ -0,0 +1,28 @@
|
||||
# - CMake version file for @opm-project_NAME@
|
||||
#
|
||||
# Determine if requested version matches exactly or is compatible with
|
||||
# the installed package. It sets the following variables:
|
||||
#
|
||||
# PACKAGE_VERSION Full provided version string
|
||||
# PACKAGE_VERSION_COMPATIBLE True if version is compatible
|
||||
# PACKAGE_VERSION_EXACT True if version is exact match
|
||||
|
||||
# This file is used by find_package to see if the installed version of a
|
||||
# package can be used by the client, before the main -config.cmake file
|
||||
# is loaded.
|
||||
# see <http://www.cmake.org/Wiki/CMake/Tutorials/Packaging#Package_Version_Files>
|
||||
|
||||
# this is the version that is installed
|
||||
set (PACKAGE_VERSION @opm-project_VERSION@)
|
||||
|
||||
# if we wanted this exact version, then everything's fine
|
||||
if (PACKAGE_VERSION VERSION_EQUAL PACKAGE_FIND_VERSION)
|
||||
set (PACKAGE_VERSION_EXACT TRUE)
|
||||
endif (PACKAGE_VERSION VERSION_EQUAL PACKAGE_FIND_VERSION)
|
||||
|
||||
# in general, we assume that there is going to be API breakage between
|
||||
# released versions; this will hopefully change in the future
|
||||
## compatible versions
|
||||
#if (NOT PACKAGE_VERSION VERSION_LESS PACKAGE_FIND_VERSION)
|
||||
# set (PACKAGE_VERSION_COMPATIBLE TRUE)
|
||||
#endif (NOT PACKAGE_VERSION VERSION_LESS PACKAGE_FIND_VERSION)
|
||||
62
cmake/Templates/opm-project-config.cmake.in
Normal file
62
cmake/Templates/opm-project-config.cmake.in
Normal file
@@ -0,0 +1,62 @@
|
||||
# - @opm-project_DESCRIPTION@ config mode
|
||||
#
|
||||
# Defines the following variables:
|
||||
# @opm-project_NAME@_FOUND - true
|
||||
# @opm-project_NAME@_VERSION - version of the @opm-project_NAME@ library found, e.g. 0.2
|
||||
# @opm-project_NAME@_DEFINITIONS - defines to be made on the command line
|
||||
# @opm-project_NAME@_INCLUDE_DIRS - header directories with which to compile
|
||||
# @opm-project_NAME@_LINKER_FLAGS - flags that must be passed to the linker
|
||||
# @opm-project_NAME@_LIBRARIES - names of the libraries with which to link
|
||||
# @opm-project_NAME@_LIBRARY_DIRS - directories in which the libraries are situated
|
||||
#
|
||||
# You should put lines like this in your CMakeLists.txt
|
||||
# set (@opm-project_NAME@_DIR "${PROJECT_BINARY_DIR}/../@opm-project_NAME@" CACHE LOCATION "Build tree of @opm-project_NAME@")
|
||||
# find_package (@opm-project_NAME@)
|
||||
# configure_vars (
|
||||
# FILE CXX "${PROJECT_BINARY_DIR}/config.h"
|
||||
# WRITE ${@opm-project_NAME@_CONFIG_VARS}
|
||||
# )
|
||||
|
||||
# <http://www.vtk.org/Wiki/CMake/Tutorials/How_to_create_a_ProjectConfig.cmake_file>
|
||||
|
||||
# propagate these properties from one build system to the other
|
||||
set (@opm-project_NAME@_VERSION "@opm-project_VERSION@")
|
||||
set (@opm-project_NAME@_DEFINITIONS "@opm-project_DEFINITIONS@")
|
||||
set (@opm-project_NAME@_INCLUDE_DIRS "@opm-project_INCLUDE_DIRS@")
|
||||
set (@opm-project_NAME@_LIBRARY_DIRS "@CMAKE_LIBRARY_OUTPUT_DIRECTORY@")
|
||||
set (@opm-project_NAME@_LINKER_FLAGS "@opm-project_LINKER_FLAGS@")
|
||||
set (@opm-project_NAME@_CONFIG_VARS "@opm-project_CONFIG_VARS@")
|
||||
|
||||
# libraries come from the build tree where this file was generated
|
||||
set (@opm-project_NAME@_LIBRARY "@opm-project_LIBRARY@")
|
||||
set (@opm-project_NAME@_LIBRARIES ${@opm-project_NAME@_LIBRARY} "@opm-project_LIBRARIES@")
|
||||
mark_as_advanced (@opm-project_NAME@_LIBRARY)
|
||||
|
||||
# add the library as a target, so that other things in the project including
|
||||
# this file may depend on it and get rebuild if this library changes.
|
||||
add_library (@opm-project_TARGET@ UNKNOWN IMPORTED)
|
||||
set_property (TARGET @opm-project_TARGET@ PROPERTY IMPORTED_LOCATION "${@opm-project_NAME@_LIBRARY}")
|
||||
|
||||
# ensure that we build with support for C++11 to preserve ABI
|
||||
string (REPLACE "@CXX_STD0X_FLAGS@" "" CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS}")
|
||||
string (STRIP "${CMAKE_CXX_FLAGS}" CMAKE_CXX_FLAGS)
|
||||
set (CMAKE_CXX_FLAGS "@CXX_STD0X_FLAGS@ ${CMAKE_CXX_FLAGS}")
|
||||
|
||||
# same as above, but for C99
|
||||
string (REPLACE "@C_STD99_FLAGS@" "" CMAKE_C_FLAGS "${CMAKE_C_FLAGS}")
|
||||
string (STRIP "${CMAKE_C_FLAGS}" CMAKE_C_FLAGS)
|
||||
set (CMAKE_C_FLAG "@C_STD99_FLAGS@ ${CMAKE_C_FLAGS}")
|
||||
|
||||
# build with OpenMP if that was found
|
||||
if (NOT "@OpenMP_C_FLAGS@" STREQUAL "")
|
||||
string (REPLACE "@OpenMP_C_FLAGS@" "" CMAKE_C_FLAGS "${CMAKE_C_FLAGS}")
|
||||
string (STRIP "${CMAKE_C_FLAGS}" CMAKE_C_FLAGS)
|
||||
set (CMAKE_C_FLAG "@OpenMP_C_FLAGS@ ${CMAKE_C_FLAGS}")
|
||||
endif (NOT "@OpenMP_C_FLAGS@" STREQUAL "")
|
||||
if (NOT "@OpenMP_CXX_FLAGS@" STREQUAL "")
|
||||
string (REPLACE "@OpenMP_CXX_FLAGS@" "" CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS}")
|
||||
string (STRIP "${CMAKE_CXX_FLAGS}" CMAKE_CXX_FLAGS)
|
||||
set (CMAKE_C_FLAG "@OpenMP_CXX_FLAGS@ ${CMAKE_CXX_FLAGS}")
|
||||
endif (NOT "@OpenMP_CXX_FLAGS@" STREQUAL "")
|
||||
|
||||
# this is the contents of config.h as far as our probes can tell:
|
||||
13
cmake/Templates/opm-project.pc.in
Normal file
13
cmake/Templates/opm-project.pc.in
Normal file
@@ -0,0 +1,13 @@
|
||||
prefix=@prefix@
|
||||
libdir=@libdir@
|
||||
includedir=@includedir@
|
||||
CXX=@CMAKE_CXX_COMPILER@ @CXX_STD0X_FLAGS@ @OpenMP_CXX_FLAGS@
|
||||
CC=@CMAKE_C_COMPILER@ @C_STD99_FLAGS@ @OpenMP_C_FLAGS@
|
||||
DEPENDENCIES=
|
||||
|
||||
Name: @name@
|
||||
Description: @description@ @major@.@minor@
|
||||
Version: @major@.@minor@
|
||||
URL: http://opm-project.org
|
||||
Libs: @target@ @libs@
|
||||
Cflags: @includes@ @defs@
|
||||
353
configure
vendored
Executable file
353
configure
vendored
Executable file
@@ -0,0 +1,353 @@
|
||||
#!/bin/bash
|
||||
|
||||
# where is the source tree located
|
||||
srcdir=$(dirname "$0")
|
||||
|
||||
# display help text
|
||||
usage () {
|
||||
cat <<EOF
|
||||
Installation directories:
|
||||
--prefix=PREFIX install architecture-independent files in PREFIX
|
||||
[/usr/local]. Note: set DESTDIR=PATH when doing
|
||||
\`make install' to install to a different sysroot.
|
||||
|
||||
Optional Features:
|
||||
--disable-FEATURE do not include FEATURE
|
||||
--disable-gxx11check do not try flag -std=c++11 to enable C++11 features
|
||||
--enable-shared build a shared library [default=yes]
|
||||
--enable-static build a static library [default=no]. Note: only one
|
||||
of the options shared and static may be built.
|
||||
--enable-debug build a non-optimized version of the library
|
||||
[default=no]
|
||||
--disable-lto do not use whole program optimization [default=yes]
|
||||
--disable-pch do not use precompiled headers (if buggy compiler)
|
||||
--disable-silent-rules print every compilation statement as executed
|
||||
--enable-system-debug put .debug files in global GDB debug dir
|
||||
[default=yes if prefix=/usr, no otherwise]
|
||||
--enable-parallel process in parallel using MPI [default=no]
|
||||
--enable-openmp activate experimental support for OpenMP
|
||||
--disable-option-checking ignore unrecognized --enable/--with options
|
||||
|
||||
Optional Packages:
|
||||
--with-boost=PATH use Boost library from a specified location
|
||||
--with-dune=PATH specify parent of all DUNE modules not specified
|
||||
--with-dune-MODULE=PATH use given DUNE module from a specified location
|
||||
--with-opm=PATH specify parent of all OPM modules not specified
|
||||
--with-opm-MODULE=PATH use given OPM module from a specified location
|
||||
--with-superlu=PATH user defined path to SuperLU library
|
||||
--with-agmg=PATH Include DOUBLE PRECISION version Notay's of AGMG
|
||||
Algebraic Multigrid solver from specified source
|
||||
location. Note: this option requires a complete,
|
||||
working Fortran 90 environment.
|
||||
--with-umfpack=PATH use UMFPACK/SuiteSparse from a specified location
|
||||
--with-ert=PATH Use ERT libraries
|
||||
--with-tinyxml=PATH use TinyXML library from a specified location
|
||||
(Note: if not found, then a bundled library will
|
||||
be used)
|
||||
--with-cmake=PROGRAM use this program instead of \`cmake' to configure
|
||||
|
||||
Some influential environment variables:
|
||||
CC C compiler command
|
||||
CFLAGS C compiler flags
|
||||
LDFLAGS linker flags, e.g. -L<lib dir> if you have libraries in a
|
||||
nonstandard directory <lib dir>
|
||||
LIBS libraries to pass to the linker, e.g. -l<library>
|
||||
CPPFLAGS (Objective) C/C++ preprocessor flags, e.g. -I<include dir> if
|
||||
you have headers in a nonstandard directory <include dir>
|
||||
CPP C preprocessor
|
||||
CXX C++ compiler command
|
||||
CXXFLAGS C++ compiler flags
|
||||
CXXCPP C++ preprocessor
|
||||
F77 Fortran 77 compiler command
|
||||
FFLAGS Fortran 77 compiler flags
|
||||
FC Fortran compiler command
|
||||
FCFLAGS Fortran compiler flags
|
||||
CMAKE_COMMAND Executable used to run cmake scripts
|
||||
|
||||
Use these variables to override the choices made by \`configure' or to help
|
||||
it to find libraries and programs with nonstandard names/locations.
|
||||
EOF
|
||||
}
|
||||
|
||||
# report an error regarding the arguments
|
||||
invalid_arg () {
|
||||
cat <<EOF
|
||||
configure: error: unrecognized option: \`$1'
|
||||
Try \`$0 --help' for more information
|
||||
EOF
|
||||
}
|
||||
|
||||
# notify the user that this argument is not known
|
||||
unknown_arg () {
|
||||
cat <<EOF
|
||||
configure: warning: unrecognized option: \`$1'
|
||||
EOF
|
||||
}
|
||||
|
||||
# warn only if option checking is enabled
|
||||
invalid_opt () {
|
||||
if [ "${option_check}" = "yes" ]; then
|
||||
unknown_arg $@
|
||||
fi
|
||||
}
|
||||
|
||||
# default values
|
||||
prefix=/usr/local
|
||||
#buildtype=" -DCMAKE_BUILD_TYPE=Debug"
|
||||
buildtype=
|
||||
#pch_use=" -DPRECOMPILE_HEADERS:BOOL=ON"
|
||||
pch_use=
|
||||
#use_openmp=" -DUSE_OPENMP=OFF"
|
||||
use_openmp=
|
||||
use_mpi=
|
||||
#silent_rules=" -DCMAKE_VERBOSE_MAKEFILE=OFF"
|
||||
silent_rules=
|
||||
#debug_loc=" -DSYSTEM_DEBUG=OFF"
|
||||
debug_loc=
|
||||
#use_lto=" -DWHOLE_PROG_OPTIM=ON"
|
||||
use_lto=
|
||||
|
||||
# default is to warn for unknown options, but this can be disabled
|
||||
option_check=yes
|
||||
|
||||
# this variable will get feature options
|
||||
FEATURES=
|
||||
|
||||
# this array will get all variable assignments from command-line
|
||||
VARS=()
|
||||
|
||||
# command that launches cmake; look for 2.8 if available
|
||||
if [ "${CMAKE_COMMAND}" = "" ]; then
|
||||
if which cmake28 >/dev/null 2>&1; then
|
||||
CMAKE_COMMAND=cmake28
|
||||
else
|
||||
CMAKE_COMMAND=cmake
|
||||
fi
|
||||
fi
|
||||
|
||||
for OPT in "$@"; do
|
||||
case "$OPT" in
|
||||
--*)
|
||||
OPTARG=${OPT#--}
|
||||
# OPTARG now contains everything after double dashes
|
||||
case "${OPTARG}" in
|
||||
prefix=*)
|
||||
# remove prefix consisting of everything up to equal sign
|
||||
prefix=${OPTARG#*=}
|
||||
;;
|
||||
help)
|
||||
usage
|
||||
exit 0
|
||||
;;
|
||||
with-*)
|
||||
# get the name of the package; everything before equal sign
|
||||
pkgname=${OPTARG%=*}
|
||||
pkgname=${pkgname#with-}
|
||||
# get the location of the package; everyhing after equal sign
|
||||
pkgloc=${OPTARG#*=}
|
||||
# the parameter to this option is an executable program, so
|
||||
# skip the directory test in that case
|
||||
if [ "${pkgname}" = "cmake" ]; then
|
||||
CMAKE_COMMAND="${pkgloc}"
|
||||
break
|
||||
fi
|
||||
# tilde expansion; quote safely before running eval on it
|
||||
eval pkgloc=$(printf "%q" "${pkgloc}")
|
||||
# expand to full path since CMake changes to source directory (!)
|
||||
# this also normalize the path name wrt. not having a trailing slash
|
||||
test -d "${pkgloc}" && pkgloc=$(sh -c "cd \"${pkgloc}\"; pwd")
|
||||
# special aliases
|
||||
case "${pkgname}" in
|
||||
umfpack)
|
||||
pkgname="SuiteSparse"
|
||||
;;
|
||||
tinyxml)
|
||||
pkgname="TinyXML"
|
||||
;;
|
||||
esac
|
||||
# packages need different suffix for their root (sic)
|
||||
case "${pkgname}" in
|
||||
pch)
|
||||
pch_use=" -DPRECOMPILE_HEADERS:BOOL=ON"
|
||||
rootvar=""
|
||||
;;
|
||||
mpi |\
|
||||
mpi-prefix)
|
||||
rootvar="_MPI_PREFIX_PATH"
|
||||
;;
|
||||
agmg |\
|
||||
ert |\
|
||||
boost |\
|
||||
superlu |\
|
||||
SuiteSparse |\
|
||||
TinyXML |\
|
||||
opm |\
|
||||
opm-* |\
|
||||
dune |\
|
||||
dune-* |\
|
||||
zlib)
|
||||
rootvar="${pkgname^^}_ROOT"
|
||||
rootvar="${rootvar/-/_}"
|
||||
;;
|
||||
*)
|
||||
invalid_opt --with-${pkgname}
|
||||
rootvar=""
|
||||
;;
|
||||
esac
|
||||
# add this to the list of existing features
|
||||
test -n "${rootvar}" && \
|
||||
FEATURES="${FEATURES} \"-D${rootvar}=${pkgloc}\""
|
||||
;;
|
||||
without-* | \
|
||||
disable-*)
|
||||
# get the name of the package
|
||||
pkgname=$OPTARG
|
||||
pkgname=${pkgname#disable-}
|
||||
pkgname=${pkgname#without-}
|
||||
# special aliases
|
||||
case "${pkgname}" in
|
||||
umfpack)
|
||||
pkgname="SuiteSparse"
|
||||
;;
|
||||
tinyxml)
|
||||
pkgname="TinyXML"
|
||||
;;
|
||||
esac
|
||||
# casing is of course different
|
||||
case "${pkgname}" in
|
||||
option-checking)
|
||||
option_check=no
|
||||
# special flag: don't disable any particular package
|
||||
pkgname=""
|
||||
;;
|
||||
debug)
|
||||
buildtype=" -DCMAKE_BUILD_TYPE=Release"
|
||||
# special flag: don't disable any particular package
|
||||
pkgname=""
|
||||
;;
|
||||
pch)
|
||||
pch_use=" -DPRECOMPILE_HEADERS:BOOL=OFF"
|
||||
pkgname=""
|
||||
;;
|
||||
silent-rules)
|
||||
silent_rules=" -DCMAKE_VERBOSE_MAKEFILE=ON"
|
||||
pkgname=""
|
||||
;;
|
||||
system-debug)
|
||||
debug_loc=" -DSYSTEM_DEBUG=OFF"
|
||||
pkgname=""
|
||||
;;
|
||||
wpo |\
|
||||
lto )
|
||||
use_lto=" -DWHOLE_PROG_OPTIM=OFF"
|
||||
pkgname=""
|
||||
;;
|
||||
openmp)
|
||||
use_openmp=" -DUSE_OPENMP=OFF"
|
||||
pkgname=""
|
||||
;;
|
||||
mpi | \
|
||||
parallel)
|
||||
use_mpi=" -DUSE_MPI=OFF"
|
||||
pkgname=""
|
||||
;;
|
||||
agmg |\
|
||||
ert |\
|
||||
superlu)
|
||||
pkgname="${pkgname^^}"
|
||||
;;
|
||||
openmp)
|
||||
pkgname="OpenMP"
|
||||
;;
|
||||
gxx11check)
|
||||
pkgname="CXX11Features"
|
||||
;;
|
||||
*)
|
||||
invalid_opt --disable-${pkgname}
|
||||
pkgname=""
|
||||
;;
|
||||
esac
|
||||
# only disable packages if the flag refers to a proper one
|
||||
test -n "${pkgname}" && \
|
||||
FEATURES="${FEATURES} -DCMAKE_DISABLE_FIND_PACKAGE_${pkgname}=TRUE"
|
||||
;;
|
||||
enable-*)
|
||||
# what kind of library are we building; shared or static?
|
||||
kind=${OPTARG#enable-}
|
||||
case "${kind}" in
|
||||
system-debug)
|
||||
debug_loc=" -DSYSTEM_DEBUG=ON"
|
||||
# special flag; don't set shared/static
|
||||
shared=""
|
||||
;;
|
||||
openmp)
|
||||
use_openmp=" -DUSE_OPENMP=ON"
|
||||
# special flag; don't set shared/static
|
||||
shared=""
|
||||
;;
|
||||
mpi | \
|
||||
parallel)
|
||||
use_openmp=" -DUSE_MPI=ON"
|
||||
# special flag; don't set shared/static
|
||||
shared=""
|
||||
;;
|
||||
debug)
|
||||
buildtype=" -DCMAKE_BUILD_TYPE=Debug"
|
||||
shared=""
|
||||
;;
|
||||
pch)
|
||||
pch_use=" -DPRECOMPILE_HEADERS:BOOL=ON"
|
||||
shared=""
|
||||
;;
|
||||
# this flag is just for compatibility with the deprecation
|
||||
# flag in DUNE, so we can build without warnings
|
||||
fieldvector-size-is-method)
|
||||
shared=""
|
||||
;;
|
||||
shared)
|
||||
shared="ON"
|
||||
;;
|
||||
static)
|
||||
shared="OFF"
|
||||
;;
|
||||
*)
|
||||
invalid_opt --enable-${kind}
|
||||
shared=""
|
||||
;;
|
||||
esac
|
||||
test -n "${shared}" && \
|
||||
FEATURES="${FEATURES} -DBUILD_SHARED_LIBS:BOOL=${shared}"
|
||||
;;
|
||||
*)
|
||||
# remove everything *after* the equal sign
|
||||
arg=${OPTARG%=*}
|
||||
invalid_arg --$arg
|
||||
exit 1
|
||||
;;
|
||||
esac
|
||||
;;
|
||||
[A-Za-z0-9_]*=*)
|
||||
# collect for further processing later
|
||||
VARS+=("$OPT")
|
||||
;;
|
||||
*)
|
||||
invalid_arg $OPT
|
||||
exit 1
|
||||
;;
|
||||
esac
|
||||
done
|
||||
# remove all arguments processed by getopts
|
||||
shift $((OPTIND-1))
|
||||
|
||||
# remove Autotools-specific variables. notice the usage of a quoted
|
||||
# array: each element will be returned even with spaces.
|
||||
for a in "${VARS[@]}"; do
|
||||
a="${a/ACLOCAL_*=*/}"
|
||||
[ -n "$a" ] && ENVVARS="$ENVVARS \"${a/\"/\\\"}\""
|
||||
done
|
||||
|
||||
# pass everything on to CMake
|
||||
CMDLINE="env ${ENVVARS} ${CMAKE_COMMAND} \"${srcdir}\" \"-DCMAKE_INSTALL_PREFIX=$prefix\"${buildtype}${pch_use}${silent_rules}${debug_loc}${use_openmp}${use_mpi}${use_lto} ${FEATURES}"
|
||||
echo --- calling CMake ---
|
||||
echo ${CMDLINE}
|
||||
eval exec ${CMDLINE}
|
||||
64
configure.ac
64
configure.ac
@@ -1,64 +0,0 @@
|
||||
# -*- Autoconf -*-
|
||||
# Process this file with autoconf to produce a configure script.
|
||||
|
||||
AC_PREREQ([2.59])
|
||||
AC_INIT([OPM Core Library], [0.1], [atgeirr@sintef.no],
|
||||
[opmcore], [https://public.ict.sintef.no/opm/hg/opmcore])
|
||||
AM_INIT_AUTOMAKE([-Wall -Werror foreign subdir-objects])
|
||||
|
||||
m4_ifdef([AM_SILENT_RULES], [AM_SILENT_RULES([yes])])
|
||||
|
||||
# Needed for automake since version 1.12 because extra-portability
|
||||
# warnings were then added to -Wall. Ifdef makes it backwards compatible.
|
||||
m4_ifdef([AM_PROG_AR], [AM_PROG_AR])
|
||||
|
||||
AC_CONFIG_MACRO_DIR([m4])
|
||||
AC_CONFIG_SRCDIR([opm/core/grid.h])
|
||||
AC_CONFIG_HEADERS([config.h])
|
||||
|
||||
# Checks for programs.
|
||||
AC_PROG_CC
|
||||
AM_PROG_CC_C_O
|
||||
|
||||
dnl Initialize libtool; the funny indentation here is to
|
||||
dnl satisfy libtoolize' check for the presence of this macro
|
||||
m4_ifdef([LT_INIT],
|
||||
[
|
||||
LT_INIT[]dnl
|
||||
LT_LANG([C++])dnl
|
||||
LT_LANG([Fortran 77])dnl
|
||||
LT_LANG([Fortran])dnl
|
||||
],dnl
|
||||
[AC_PROG_LIBTOOL[]dnl
|
||||
AC_PROG_CXX[]dnl
|
||||
AC_PROG_F77[]dnl
|
||||
AC_PROG_FC[]dnl
|
||||
])[]dnl
|
||||
|
||||
OPM_CORE_CHECKS
|
||||
|
||||
OPM_DYNLINK_BOOST_TEST
|
||||
|
||||
ERT
|
||||
|
||||
dnl Substitute Autoconf's abs_*dir variables into the Makefiles for the
|
||||
dnl benefit of external code that uses these variables to derive
|
||||
dnl locations (e.g., Dune's DUNE_CHECK_MODULES macro). Automakes prior
|
||||
dnl to version 1.10 do not automatically substitute these variables into
|
||||
dnl output files.
|
||||
AC_SUBST([abs_srcdir])
|
||||
AC_SUBST([abs_builddir])
|
||||
AC_SUBST([abs_top_srcdir])
|
||||
AC_SUBST([abs_top_builddir])
|
||||
|
||||
AC_CONFIG_FILES([
|
||||
Makefile
|
||||
tests/Makefile
|
||||
examples/Makefile
|
||||
tutorials/Makefile
|
||||
opm-core.pc
|
||||
lib/pkgconfig/opm-core.pc
|
||||
opm-core-config.cmake
|
||||
])
|
||||
|
||||
AC_OUTPUT
|
||||
11
debian/changelog
vendored
Normal file
11
debian/changelog
vendored
Normal file
@@ -0,0 +1,11 @@
|
||||
opm-core (2013.03-2) precise; urgency=low
|
||||
|
||||
* Now compatible with precise + launchpad
|
||||
|
||||
-- Arne Morten Kvarving <arne.morten.kvarving@sintef.no> Wed, 03 Apr 2013 12:27:52 +0200
|
||||
|
||||
opm-core (2013.03-1) precise; urgency=low
|
||||
|
||||
* Initial release
|
||||
|
||||
-- Arne Morten Kvarving <arne.morten.kvarving@sintef.no> Mon, 14 Jan 2013 15:33:54 +0100
|
||||
1
debian/compat
vendored
Normal file
1
debian/compat
vendored
Normal file
@@ -0,0 +1 @@
|
||||
9
|
||||
106
debian/control
vendored
Normal file
106
debian/control
vendored
Normal file
@@ -0,0 +1,106 @@
|
||||
Source: opm-core
|
||||
Priority: extra
|
||||
Maintainer: Arne Morten Kvarving <arne.morten.kvarving@sintef.no>
|
||||
Build-Depends: build-essential, debhelper (>= 9), libboost-filesystem-dev,
|
||||
libboost-system-dev, libboost-date-time-dev, libboost-test-dev,
|
||||
libsuperlu3-dev, gfortran, libsuitesparse-dev, pkg-config,
|
||||
libdune-common-dev, libdune-istl-dev, cmake, libtinyxml-dev, bc,
|
||||
libert.ecl-dev, git, zlib1g-dev, libtool, doxygen,
|
||||
texlive-latex-extra, texlive-latex-recommended, ghostscript
|
||||
Standards-Version: 3.9.2
|
||||
Section: libs
|
||||
Homepage: http://opm-project.org
|
||||
Vcs-Git: git://github.com/OPM/opm-core.git
|
||||
Vcs-Browser: https://github.com/OPM/opm-core
|
||||
|
||||
Package: libopm-core1-dev
|
||||
Section: libdevel
|
||||
Architecture: any
|
||||
Multi-Arch: foreign
|
||||
Depends: libopm-core1 (= ${binary:Version}), libdune-istl-dev
|
||||
Provides: libopm-core-dev
|
||||
Suggests: libopm-core1-doc
|
||||
Description: OPM core library -- development files
|
||||
The OPM core library is the core library within OPM and contains
|
||||
* Eclipse deck input and preprosessing
|
||||
* Fluid properties (basic PVT models and rock properties)
|
||||
* Grid handling (cornerpoint grids, unstructured grid interface)
|
||||
* Linear Algebra (interface to different linear solvers)
|
||||
* Pressure solvers (various discretization schemes, flow models)
|
||||
* Simulators (some basic examples of simulators based on sequential splitting schemes)
|
||||
* Transport solvers (various discretization schemes, flow models)
|
||||
* Utilities (input and output processing, unit conversion)
|
||||
* Wells (basic well handling)
|
||||
|
||||
Package: libopm-core1
|
||||
Section: libs
|
||||
Pre-Depends: ${misc:Pre-Depends}, multiarch-support
|
||||
Architecture: any
|
||||
Multi-Arch: same
|
||||
Depends: ${shlibs:Depends}, ${misc:Depends}
|
||||
Provides: libopm-core
|
||||
Description: OPM core library
|
||||
The OPM core library is the core library within OPM and contains
|
||||
* Eclipse deck input and preprosessing
|
||||
* Fluid properties (basic PVT models and rock properties)
|
||||
* Grid handling (cornerpoint grids, unstructured grid interface)
|
||||
* Linear Algebra (interface to different linear solvers)
|
||||
* Pressure solvers (various discretization schemes, flow models)
|
||||
* Simulators (some basic examples of simulators based on sequential splitting schemes)
|
||||
* Transport solvers (various discretization schemes, flow models)
|
||||
* Utilities (input and output processing, unit conversion)
|
||||
* Wells (basic well handling)
|
||||
|
||||
Package: libopm-core1-bin
|
||||
Section: science
|
||||
Pre-Depends: ${misc:Pre-Depends}, multiarch-support
|
||||
Architecture: any
|
||||
Multi-Arch: same
|
||||
Depends: ${shlibs:Depends}, ${misc:Depends}
|
||||
Provides: libopm-core-bin
|
||||
Description: OPM core library -- applications
|
||||
The OPM core library is the core library within OPM and contains
|
||||
* Eclipse deck input and preprosessing
|
||||
* Fluid properties (basic PVT models and rock properties)
|
||||
* Grid handling (cornerpoint grids, unstructured grid interface)
|
||||
* Linear Algebra (interface to different linear solvers)
|
||||
* Pressure solvers (various discretization schemes, flow models)
|
||||
* Simulators (some basic examples of simulators based on sequential splitting schemes)
|
||||
* Transport solvers (various discretization schemes, flow models)
|
||||
* Utilities (input and output processing, unit conversion)
|
||||
* Wells (basic well handling)
|
||||
|
||||
Package: libopm-core1-doc
|
||||
Section: doc
|
||||
Architecture: all
|
||||
Multi-Arch: foreign
|
||||
Provides: libopm-core-doc
|
||||
Description: OPM core library -- documentation
|
||||
The OPM core library is the core library within OPM and contains
|
||||
* Eclipse deck input and preprosessing
|
||||
* Fluid properties (basic PVT models and rock properties)
|
||||
* Grid handling (cornerpoint grids, unstructured grid interface)
|
||||
* Linear Algebra (interface to different linear solvers)
|
||||
* Pressure solvers (various discretization schemes, flow models)
|
||||
* Simulators (some basic examples of simulators based on sequential splitting schemes)
|
||||
* Transport solvers (various discretization schemes, flow models)
|
||||
* Utilities (input and output processing, unit conversion)
|
||||
* Wells (basic well handling)
|
||||
|
||||
Package: libopm-core1-dbg
|
||||
Section: debug
|
||||
Architecture: any
|
||||
Multi-Arch: foreign
|
||||
Provides: libopm-core-dbg
|
||||
Depends: libopm-core1 (= ${binary:Version}), ${misc:Depends}
|
||||
Description: OPM core library -- debug symbols
|
||||
The OPM core library is the core library within OPM and contains
|
||||
* Eclipse deck input and preprosessing
|
||||
* Fluid properties (basic PVT models and rock properties)
|
||||
* Grid handling (cornerpoint grids, unstructured grid interface)
|
||||
* Linear Algebra (interface to different linear solvers)
|
||||
* Pressure solvers (various discretization schemes, flow models)
|
||||
* Simulators (some basic examples of simulators based on sequential splitting schemes)
|
||||
* Transport solvers (various discretization schemes, flow models)
|
||||
* Utilities (input and output processing, unit conversion)
|
||||
* Wells (basic well handling)
|
||||
13
debian/copyright
vendored
Normal file
13
debian/copyright
vendored
Normal file
@@ -0,0 +1,13 @@
|
||||
License: GPL-3+
|
||||
This package 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.
|
||||
|
||||
This package 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 this program. If not, see <http://www.gnu.org/licenses/>
|
||||
2
debian/docs
vendored
Normal file
2
debian/docs
vendored
Normal file
@@ -0,0 +1,2 @@
|
||||
README
|
||||
COPYING
|
||||
1
debian/libopm-core1-bin.install
vendored
Normal file
1
debian/libopm-core1-bin.install
vendored
Normal file
@@ -0,0 +1 @@
|
||||
usr/bin/*
|
||||
1
debian/libopm-core1-dbg.install
vendored
Normal file
1
debian/libopm-core1-dbg.install
vendored
Normal file
@@ -0,0 +1 @@
|
||||
usr/lib/debug/usr/lib/*/libopmcore*.debug
|
||||
5
debian/libopm-core1-dev.install
vendored
Normal file
5
debian/libopm-core1-dev.install
vendored
Normal file
@@ -0,0 +1,5 @@
|
||||
usr/include/*
|
||||
usr/lib/*/lib*.so
|
||||
usr/lib/dunecontrol/*
|
||||
usr/lib/*/pkgconfig/*
|
||||
usr/share/cmake/*
|
||||
1
debian/libopm-core1-doc.install
vendored
Normal file
1
debian/libopm-core1-doc.install
vendored
Normal file
@@ -0,0 +1 @@
|
||||
usr/share/doc/*
|
||||
1
debian/libopm-core1.install
vendored
Normal file
1
debian/libopm-core1.install
vendored
Normal file
@@ -0,0 +1 @@
|
||||
usr/lib/*/lib*.so.*
|
||||
28
debian/rules
vendored
Executable file
28
debian/rules
vendored
Executable file
@@ -0,0 +1,28 @@
|
||||
#!/usr/bin/make -f
|
||||
# -*- makefile -*-
|
||||
# Sample debian/rules that uses debhelper.
|
||||
# This file was originally written by Joey Hess and Craig Small.
|
||||
# As a special exception, when this file is copied by dh-make into a
|
||||
# dh-make output file, you may use that output file without restriction.
|
||||
# This special exception was added by Craig Small in version 0.37 of dh-make.
|
||||
|
||||
# Uncomment this to turn on verbose mode.
|
||||
#export DH_VERBOSE=1
|
||||
|
||||
%:
|
||||
dh $@
|
||||
|
||||
override_dh_auto_clean:
|
||||
dh_auto_clean --buildsystem=cmake
|
||||
|
||||
override_dh_auto_build:
|
||||
dh_auto_build --buildsystem=cmake
|
||||
|
||||
override_dh_auto_configure:
|
||||
dh_auto_configure --buildsystem=cmake -- -DCMAKE_BUILD_TYPE=Release -DBUILD_SHARED_LIBS=1 -DCMAKE_INSTALL_DOCDIR=share/doc/libopm-core1
|
||||
|
||||
override_dh_auto_install:
|
||||
dh_auto_install -- install-html
|
||||
|
||||
override_dh_installdocs:
|
||||
dh_installdocs --link-doc=libopm-core1
|
||||
1
debian/source/format
vendored
Normal file
1
debian/source/format
vendored
Normal file
@@ -0,0 +1 @@
|
||||
1.0
|
||||
@@ -1,7 +1,4 @@
|
||||
#dune module information file#
|
||||
##############################
|
||||
|
||||
#Name of the module
|
||||
Module: opm-core
|
||||
Version: 0.1
|
||||
Version: 1.0
|
||||
Maintainer: atgeirr@sintef.no
|
||||
Depends: dune-common (>= 2.2) dune-istl (>= 2.2)
|
||||
|
||||
@@ -1,89 +0,0 @@
|
||||
# Build-time flags needed to form example programs
|
||||
|
||||
AM_CPPFLAGS = \
|
||||
-I$(top_srcdir) \
|
||||
$(ERT_CPPFLAGS) \
|
||||
$(OPM_BOOST_CPPFLAGS)
|
||||
|
||||
# All targets link to the library
|
||||
LDADD = \
|
||||
$(top_builddir)/lib/libopmcore.la
|
||||
|
||||
# Convenience definition for targets that use Boost.Filesystem directly.
|
||||
# While libopmcore depends on (and references) Boost.Filesystem (through
|
||||
# the $(BOOST_FILESYSTEM_LIB) macro) this indirect dependency is not
|
||||
# sufficient to satisfy the requirements of targets that use the indirect
|
||||
# libraries directly.
|
||||
#
|
||||
# Additional details at
|
||||
# https://fedoraproject.org/wiki/UnderstandingDSOLinkChange
|
||||
#
|
||||
LINK_BOOST_FILESYSTEM = \
|
||||
$(OPM_BOOST_LDFLAGS) \
|
||||
$(BOOST_FILESYSTEM_LIB) \
|
||||
$(BOOST_SYSTEM_LIB)
|
||||
|
||||
# ----------------------------------------------------------------------
|
||||
# Declare products (i.e., the example programs).
|
||||
#
|
||||
# Please keep the list sorted.
|
||||
|
||||
noinst_PROGRAMS = \
|
||||
compute_tof \
|
||||
compute_tof_from_files \
|
||||
refine_wells \
|
||||
scaneclipsedeck \
|
||||
sim_2p_comp_reorder \
|
||||
sim_2p_incomp_reorder \
|
||||
sim_wateroil \
|
||||
wells_example
|
||||
|
||||
if HAVE_ERT
|
||||
noinst_PROGRAMS += import_rewrite
|
||||
endif
|
||||
|
||||
|
||||
|
||||
# ----------------------------------------------------------------------
|
||||
# Product constituents. Must be specified for every product that's
|
||||
# built from more than a single ".c" file and/or that link to anything
|
||||
# more than the OPM-Core library.
|
||||
#
|
||||
# Please maintain sort order from "noinst_PROGRAMS".
|
||||
|
||||
compute_tof_SOURCES = compute_tof.cpp
|
||||
compute_tof_LDADD = $(LDADD) $(LINK_BOOST_FILESYSTEM)
|
||||
|
||||
compute_tof_from_files_SOURCES = compute_tof_from_files.cpp
|
||||
compute_tof_from_files_LDADD = $(LDADD) $(LINK_BOOST_FILESYSTEM)
|
||||
|
||||
refine_wells_SOURCES = refine_wells.cpp
|
||||
|
||||
if HAVE_ERT
|
||||
import_rewrite_SOURCES = import_rewrite.cpp
|
||||
import_rewrite_LDADD = $(LDADD) $(LINK_BOOST_FILESYSTEM)
|
||||
endif
|
||||
|
||||
sim_2p_comp_reorder_SOURCES = sim_2p_comp_reorder.cpp
|
||||
sim_2p_comp_reorder_LDADD = $(LDADD) $(LINK_BOOST_FILESYSTEM)
|
||||
|
||||
sim_2p_incomp_reorder_SOURCES = sim_2p_incomp_reorder.cpp
|
||||
sim_2p_incomp_reorder_LDADD = $(LDADD) $(LINK_BOOST_FILESYSTEM)
|
||||
|
||||
sim_wateroil_SOURCES = sim_wateroil.cpp
|
||||
sim_wateroil_LDADD = $(LDADD) $(LINK_BOOST_FILESYSTEM)
|
||||
|
||||
wells_example_SOURCES = wells_example.cpp
|
||||
|
||||
# ----------------------------------------------------------------------
|
||||
# Optional examples, or examples that use optional add-on components.
|
||||
|
||||
if UMFPACK
|
||||
noinst_PROGRAMS += spu_2p
|
||||
|
||||
spu_2p_SOURCES = spu_2p.cpp
|
||||
spu_2p_LDADD = \
|
||||
$(LDADD) \
|
||||
$(LINK_BOOST_FILESYSTEM) \
|
||||
$(LAPACK_LIBS) $(BLAS_LIBS) $(LIBS)
|
||||
endif
|
||||
@@ -26,25 +26,26 @@
|
||||
#include <opm/core/pressure/FlowBCManager.hpp>
|
||||
|
||||
#include <opm/core/grid.h>
|
||||
#include <opm/core/GridManager.hpp>
|
||||
#include <opm/core/newwells.h>
|
||||
#include <opm/core/grid/GridManager.hpp>
|
||||
#include <opm/core/wells.h>
|
||||
#include <opm/core/wells/WellsManager.hpp>
|
||||
#include <opm/core/utility/ErrorMacros.hpp>
|
||||
#include <opm/core/utility/initState.hpp>
|
||||
#include <opm/core/utility/SparseTable.hpp>
|
||||
#include <opm/core/utility/StopWatch.hpp>
|
||||
#include <opm/core/utility/miscUtilities.hpp>
|
||||
#include <opm/core/utility/parameters/ParameterGroup.hpp>
|
||||
|
||||
#include <opm/core/fluid/IncompPropertiesBasic.hpp>
|
||||
#include <opm/core/fluid/IncompPropertiesFromDeck.hpp>
|
||||
#include <opm/core/props/IncompPropertiesBasic.hpp>
|
||||
#include <opm/core/props/IncompPropertiesFromDeck.hpp>
|
||||
|
||||
#include <opm/core/linalg/LinearSolverFactory.hpp>
|
||||
|
||||
#include <opm/core/simulator/TwophaseState.hpp>
|
||||
#include <opm/core/simulator/WellState.hpp>
|
||||
#include <opm/core/simulator/initState.hpp>
|
||||
#include <opm/core/pressure/IncompTpfa.hpp>
|
||||
#include <opm/core/transport/reorder/TransportModelTracerTof.hpp>
|
||||
#include <opm/core/transport/reorder/TransportModelTracerTofDiscGal.hpp>
|
||||
#include <opm/core/tof/TofReorder.hpp>
|
||||
#include <opm/core/tof/TofDiscGalReorder.hpp>
|
||||
|
||||
#include <boost/scoped_ptr.hpp>
|
||||
#include <boost/filesystem.hpp>
|
||||
@@ -65,6 +66,25 @@ namespace
|
||||
std::cout << "----------------------------------------------------------------" << std::endl;
|
||||
}
|
||||
}
|
||||
|
||||
void buildTracerheadsFromWells(const Wells* wells,
|
||||
const Opm::WellState& well_state,
|
||||
Opm::SparseTable<int>& tracerheads)
|
||||
{
|
||||
if (wells == 0) {
|
||||
return;
|
||||
}
|
||||
tracerheads.clear();
|
||||
const int num_wells = wells->number_of_wells;
|
||||
for (int w = 0; w < num_wells; ++w) {
|
||||
if (wells->type[w] != INJECTOR) {
|
||||
continue;
|
||||
}
|
||||
tracerheads.appendRow(wells->well_cells + wells->well_connpos[w],
|
||||
wells->well_cells + wells->well_connpos[w + 1]);
|
||||
}
|
||||
}
|
||||
|
||||
} // anon namespace
|
||||
|
||||
|
||||
@@ -170,16 +190,13 @@ main(int argc, char** argv)
|
||||
bool use_dg = param.getDefault("use_dg", false);
|
||||
bool use_multidim_upwind = false;
|
||||
// Need to initialize dg solver here, since it uses parameters now.
|
||||
boost::scoped_ptr<Opm::TransportModelTracerTofDiscGal> dg_solver;
|
||||
boost::scoped_ptr<Opm::TofDiscGalReorder> dg_solver;
|
||||
if (use_dg) {
|
||||
dg_solver.reset(new Opm::TransportModelTracerTofDiscGal(*grid->c_grid(), param));
|
||||
dg_solver.reset(new Opm::TofDiscGalReorder(*grid->c_grid(), param));
|
||||
} else {
|
||||
use_multidim_upwind = param.getDefault("use_multidim_upwind", false);
|
||||
}
|
||||
bool compute_tracer = param.getDefault("compute_tracer", false);
|
||||
if (use_dg && compute_tracer) {
|
||||
THROW("DG for tracer not yet implemented.");
|
||||
}
|
||||
|
||||
// Write parameters used for later reference.
|
||||
bool output = param.getDefault("output", true);
|
||||
@@ -234,12 +251,20 @@ main(int argc, char** argv)
|
||||
transport_timer.start();
|
||||
std::vector<double> tof;
|
||||
std::vector<double> tracer;
|
||||
Opm::SparseTable<int> tracerheads;
|
||||
if (compute_tracer) {
|
||||
buildTracerheadsFromWells(wells->c_wells(), well_state, tracerheads);
|
||||
}
|
||||
if (use_dg) {
|
||||
dg_solver->solveTof(&state.faceflux()[0], &porevol[0], &transport_src[0], tof);
|
||||
} else {
|
||||
Opm::TransportModelTracerTof tofsolver(*grid->c_grid(), use_multidim_upwind);
|
||||
if (compute_tracer) {
|
||||
tofsolver.solveTofTracer(&state.faceflux()[0], &porevol[0], &transport_src[0], tof, tracer);
|
||||
dg_solver->solveTofTracer(&state.faceflux()[0], &porevol[0], &transport_src[0], tracerheads, tof, tracer);
|
||||
} else {
|
||||
dg_solver->solveTof(&state.faceflux()[0], &porevol[0], &transport_src[0], tof);
|
||||
}
|
||||
} else {
|
||||
Opm::TofReorder tofsolver(*grid->c_grid(), use_multidim_upwind);
|
||||
if (compute_tracer) {
|
||||
tofsolver.solveTofTracer(&state.faceflux()[0], &porevol[0], &transport_src[0], tracerheads, tof, tracer);
|
||||
} else {
|
||||
tofsolver.solveTof(&state.faceflux()[0], &porevol[0], &transport_src[0], tof);
|
||||
}
|
||||
|
||||
@@ -25,25 +25,26 @@
|
||||
#include <opm/core/pressure/FlowBCManager.hpp>
|
||||
|
||||
#include <opm/core/grid.h>
|
||||
#include <opm/core/GridManager.hpp>
|
||||
#include <opm/core/newwells.h>
|
||||
#include <opm/core/grid/GridManager.hpp>
|
||||
#include <opm/core/wells.h>
|
||||
#include <opm/core/wells/WellsManager.hpp>
|
||||
#include <opm/core/utility/ErrorMacros.hpp>
|
||||
#include <opm/core/utility/initState.hpp>
|
||||
#include <opm/core/utility/SparseTable.hpp>
|
||||
#include <opm/core/utility/StopWatch.hpp>
|
||||
#include <opm/core/utility/miscUtilities.hpp>
|
||||
#include <opm/core/utility/parameters/ParameterGroup.hpp>
|
||||
|
||||
#include <opm/core/fluid/IncompPropertiesBasic.hpp>
|
||||
#include <opm/core/fluid/IncompPropertiesFromDeck.hpp>
|
||||
#include <opm/core/props/IncompPropertiesBasic.hpp>
|
||||
#include <opm/core/props/IncompPropertiesFromDeck.hpp>
|
||||
|
||||
#include <opm/core/linalg/LinearSolverFactory.hpp>
|
||||
|
||||
#include <opm/core/simulator/TwophaseState.hpp>
|
||||
#include <opm/core/simulator/WellState.hpp>
|
||||
#include <opm/core/simulator/initState.hpp>
|
||||
#include <opm/core/pressure/IncompTpfa.hpp>
|
||||
#include <opm/core/transport/reorder/TransportModelTracerTof.hpp>
|
||||
#include <opm/core/transport/reorder/TransportModelTracerTofDiscGal.hpp>
|
||||
#include <opm/core/tof/TofReorder.hpp>
|
||||
#include <opm/core/tof/TofDiscGalReorder.hpp>
|
||||
|
||||
#include <boost/scoped_ptr.hpp>
|
||||
#include <boost/filesystem.hpp>
|
||||
@@ -120,20 +121,33 @@ main(int argc, char** argv)
|
||||
}
|
||||
}
|
||||
|
||||
const bool compute_tracer = param.getDefault("compute_tracer", false);
|
||||
Opm::SparseTable<int> tracerheads;
|
||||
if (compute_tracer) {
|
||||
std::ifstream tr_stream(param.get<std::string>("tracerheads_filename").c_str());
|
||||
int num_rows;
|
||||
tr_stream >> num_rows;
|
||||
for (int row = 0; row < num_rows; ++row) {
|
||||
int row_size;
|
||||
tr_stream >> row_size;
|
||||
std::vector<int> rowdata(row_size);
|
||||
for (int elem = 0; elem < row_size; ++elem) {
|
||||
tr_stream >> rowdata[elem];
|
||||
}
|
||||
tracerheads.appendRow(rowdata.begin(), rowdata.end());
|
||||
}
|
||||
}
|
||||
|
||||
// Choice of tof solver.
|
||||
bool use_dg = param.getDefault("use_dg", false);
|
||||
bool use_multidim_upwind = false;
|
||||
// Need to initialize dg solver here, since it uses parameters now.
|
||||
boost::scoped_ptr<Opm::TransportModelTracerTofDiscGal> dg_solver;
|
||||
boost::scoped_ptr<Opm::TofDiscGalReorder> dg_solver;
|
||||
if (use_dg) {
|
||||
dg_solver.reset(new Opm::TransportModelTracerTofDiscGal(grid, param));
|
||||
dg_solver.reset(new Opm::TofDiscGalReorder(grid, param));
|
||||
} else {
|
||||
use_multidim_upwind = param.getDefault("use_multidim_upwind", false);
|
||||
}
|
||||
bool compute_tracer = param.getDefault("compute_tracer", false);
|
||||
if (use_dg && compute_tracer) {
|
||||
THROW("DG for tracer not yet implemented.");
|
||||
}
|
||||
|
||||
// Write parameters used for later reference.
|
||||
bool output = param.getDefault("output", true);
|
||||
@@ -161,11 +175,15 @@ main(int argc, char** argv)
|
||||
std::vector<double> tof;
|
||||
std::vector<double> tracer;
|
||||
if (use_dg) {
|
||||
dg_solver->solveTof(&flux[0], &porevol[0], &src[0], tof);
|
||||
} else {
|
||||
Opm::TransportModelTracerTof tofsolver(grid, use_multidim_upwind);
|
||||
if (compute_tracer) {
|
||||
tofsolver.solveTofTracer(&flux[0], &porevol[0], &src[0], tof, tracer);
|
||||
dg_solver->solveTofTracer(&flux[0], &porevol[0], &src[0], tracerheads, tof, tracer);
|
||||
} else {
|
||||
dg_solver->solveTof(&flux[0], &porevol[0], &src[0], tof);
|
||||
}
|
||||
} else {
|
||||
Opm::TofReorder tofsolver(grid, use_multidim_upwind);
|
||||
if (compute_tracer) {
|
||||
tofsolver.solveTofTracer(&flux[0], &porevol[0], &src[0], tracerheads, tof, tracer);
|
||||
} else {
|
||||
tofsolver.solveTof(&flux[0], &porevol[0], &src[0], tof);
|
||||
}
|
||||
|
||||
@@ -2,17 +2,17 @@
|
||||
#include "config.h"
|
||||
#endif // HAVE_CONFIG_H
|
||||
|
||||
#include <opm/core/eclipse/EclipseGridParser.hpp>
|
||||
#include <opm/core/io/eclipse/EclipseGridParser.hpp>
|
||||
|
||||
#include <boost/filesystem/convenience.hpp>
|
||||
|
||||
#ifdef HAVE_ERT
|
||||
#include <opm/core/utility/writeECLData.hpp>
|
||||
#include <util.h>
|
||||
#include <ecl_util.h>
|
||||
#include <ecl_kw.h>
|
||||
#include <ecl_endian_flip.h>
|
||||
#include <fortio.h>
|
||||
#include <opm/core/io/eclipse/writeECLData.hpp>
|
||||
#include <ert/util/util.h>
|
||||
#include <ert/ecl/ecl_util.h>
|
||||
#include <ert/ecl/ecl_kw.h>
|
||||
#include <ert/ecl/ecl_endian_flip.h>
|
||||
#include <ert/ecl/fortio.h>
|
||||
#endif
|
||||
|
||||
/*
|
||||
|
||||
@@ -1,50 +0,0 @@
|
||||
/*
|
||||
Copyright 2012 SINTEF ICT, Applied Mathematics.
|
||||
|
||||
This file is part of the Open Porous Media project (OPM).
|
||||
|
||||
OPM is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
OPM is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with OPM. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#include <opm/core/eclipse/EclipseGridParser.hpp>
|
||||
|
||||
// Double I and J coordinates of wells and completions.
|
||||
// Do not change any well productivity indices or any other data.
|
||||
int main(int argc, char** argv)
|
||||
{
|
||||
using namespace Opm;
|
||||
if (argc != 2) {
|
||||
std::cerr << "Usage: " << argv[0] << " deck\n";
|
||||
return 1;
|
||||
}
|
||||
EclipseGridParser deck(argv[1], false);
|
||||
|
||||
WELSPECS ws = deck.getWELSPECS();
|
||||
const int nw = ws.welspecs.size();
|
||||
for (int w = 0; w < nw; ++w) {
|
||||
ws.welspecs[w].I_ *= 2;
|
||||
ws.welspecs[w].J_ *= 2;
|
||||
}
|
||||
|
||||
COMPDAT cd = deck.getCOMPDAT();
|
||||
const int nc = cd.compdat.size();
|
||||
for (int c = 0; c < nc; ++c) {
|
||||
cd.compdat[c].grid_ind_[0] *= 2;
|
||||
cd.compdat[c].grid_ind_[1] *= 2;
|
||||
}
|
||||
|
||||
ws.write(std::cout);
|
||||
std::cout << '\n';
|
||||
cd.write(std::cout);
|
||||
}
|
||||
@@ -1,134 +0,0 @@
|
||||
/* scaneclipsedec finds technically valid Eclipse keywords in an ascii file.
|
||||
* Copyright (c) 2010 Jostein R. Natvig <jostein.natvig@gmail.com>
|
||||
*
|
||||
* The MIT License
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a
|
||||
* copy of this software and associated documentation files (the "Software"),
|
||||
* to deal in the Software without restriction, including without limitation
|
||||
* the rights to use, copy, modify, merge, publish, distribute, sublicense,
|
||||
* and/or sell copies of the Software, and to permit persons to whom the
|
||||
* Software is furnished to do so, subject to the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be included
|
||||
* in all copies or substantial portions of the Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
|
||||
* THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR
|
||||
* OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
|
||||
* ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
|
||||
* OTHER DEALINGS IN THE SOFTWARE.
|
||||
*/
|
||||
#include <string.h>
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <ctype.h>
|
||||
|
||||
|
||||
|
||||
static char*
|
||||
read_keyword(FILE *fp, char *buf)
|
||||
{
|
||||
int i, j, c;
|
||||
|
||||
/* Clear buf */
|
||||
for (i=0; i<9; ++i) {
|
||||
buf[i] = '\0';
|
||||
}
|
||||
|
||||
/* Read first character and check if it is uppercase*/
|
||||
buf[0] = fgetc(fp);
|
||||
if ( !isupper( buf[0] ) ) {
|
||||
return NULL; /* NOT VALID CHARACTER */
|
||||
ungetc(buf[0], fp);
|
||||
}
|
||||
|
||||
|
||||
/* Scan as much as possible possible keyword, 8 characters long */
|
||||
i = 1;
|
||||
while ( (c = fgetc(fp)) &&
|
||||
(c != EOF ) &&
|
||||
(c != '\n' ) &&
|
||||
(c != '/' ) &&
|
||||
(i < 8 )) {
|
||||
buf[i++] = c;
|
||||
}
|
||||
|
||||
/* Skip rest of line */
|
||||
if (c != '\n'){
|
||||
while ( (c = fgetc(fp)) &&
|
||||
(c != EOF ) &&
|
||||
(c != '\n' )) {
|
||||
;
|
||||
}
|
||||
}
|
||||
|
||||
if(c == '\n') {
|
||||
ungetc(c, fp);
|
||||
}
|
||||
|
||||
/* Find first non-uppercase or non-digit character */
|
||||
for (i=0; i<8; ++i) {
|
||||
if ( !(isupper(buf[i]) || isdigit(buf[i])) ) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
/* Check if remaining characters are blank */
|
||||
for (j = i; j<8; ++j) {
|
||||
if(!isspace(buf[j]) && buf[j] != '\0') {
|
||||
return NULL; /* CHARACTER AFTER SPACE OR INVALID CHARACTER */
|
||||
}
|
||||
buf[j] = '\0';
|
||||
}
|
||||
return buf;
|
||||
}
|
||||
|
||||
|
||||
int main(int argc, char *argv[])
|
||||
{
|
||||
int c, lineno, nkw;
|
||||
FILE *fp;
|
||||
char buf[10];
|
||||
|
||||
if (argc != 2)
|
||||
{
|
||||
fprintf(stderr, "Usage: <app> filename.grdecl\n");
|
||||
exit(EXIT_FAILURE);
|
||||
}
|
||||
fp = fopen(argv[1], "ra");
|
||||
if (fp == NULL)
|
||||
{
|
||||
fprintf(stderr, "No such file...\n");
|
||||
exit(EXIT_FAILURE);
|
||||
}
|
||||
|
||||
lineno = nkw = 0;
|
||||
|
||||
if (read_keyword(fp, buf) != NULL) {
|
||||
++nkw;
|
||||
fprintf(stderr, "%s\n", buf);
|
||||
}
|
||||
|
||||
|
||||
|
||||
while ((c = getc(fp)) != EOF) { /* Eat large chunks */
|
||||
if ( c == '\n') {
|
||||
++lineno;
|
||||
|
||||
if (read_keyword(fp, buf) != NULL) {
|
||||
fprintf(stderr, "%s\n", buf);
|
||||
++nkw;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
fprintf(stderr, "Scanned %d lines, found %d keywords.\n", lineno, nkw);
|
||||
|
||||
return 0;
|
||||
}
|
||||
/* Local Variables: */
|
||||
/* c-basic-offset:4 */
|
||||
/* End: */
|
||||
@@ -24,19 +24,19 @@
|
||||
#include <opm/core/pressure/FlowBCManager.hpp>
|
||||
|
||||
#include <opm/core/grid.h>
|
||||
#include <opm/core/GridManager.hpp>
|
||||
#include <opm/core/newwells.h>
|
||||
#include <opm/core/grid/GridManager.hpp>
|
||||
#include <opm/core/wells.h>
|
||||
#include <opm/core/wells/WellsManager.hpp>
|
||||
#include <opm/core/utility/ErrorMacros.hpp>
|
||||
#include <opm/core/utility/initState.hpp>
|
||||
#include <opm/core/simulator/initState.hpp>
|
||||
#include <opm/core/simulator/SimulatorReport.hpp>
|
||||
#include <opm/core/simulator/SimulatorTimer.hpp>
|
||||
#include <opm/core/utility/miscUtilities.hpp>
|
||||
#include <opm/core/utility/parameters/ParameterGroup.hpp>
|
||||
|
||||
#include <opm/core/fluid/BlackoilPropertiesBasic.hpp>
|
||||
#include <opm/core/fluid/BlackoilPropertiesFromDeck.hpp>
|
||||
#include <opm/core/fluid/RockCompressibility.hpp>
|
||||
#include <opm/core/props/BlackoilPropertiesBasic.hpp>
|
||||
#include <opm/core/props/BlackoilPropertiesFromDeck.hpp>
|
||||
#include <opm/core/props/rock/RockCompressibility.hpp>
|
||||
|
||||
#include <opm/core/linalg/LinearSolverFactory.hpp>
|
||||
|
||||
|
||||
@@ -25,19 +25,19 @@
|
||||
#include <opm/core/pressure/FlowBCManager.hpp>
|
||||
|
||||
#include <opm/core/grid.h>
|
||||
#include <opm/core/GridManager.hpp>
|
||||
#include <opm/core/newwells.h>
|
||||
#include <opm/core/grid/GridManager.hpp>
|
||||
#include <opm/core/wells.h>
|
||||
#include <opm/core/wells/WellsManager.hpp>
|
||||
#include <opm/core/utility/ErrorMacros.hpp>
|
||||
#include <opm/core/utility/initState.hpp>
|
||||
#include <opm/core/simulator/initState.hpp>
|
||||
#include <opm/core/simulator/SimulatorReport.hpp>
|
||||
#include <opm/core/simulator/SimulatorTimer.hpp>
|
||||
#include <opm/core/utility/miscUtilities.hpp>
|
||||
#include <opm/core/utility/parameters/ParameterGroup.hpp>
|
||||
|
||||
#include <opm/core/fluid/IncompPropertiesBasic.hpp>
|
||||
#include <opm/core/fluid/IncompPropertiesFromDeck.hpp>
|
||||
#include <opm/core/fluid/RockCompressibility.hpp>
|
||||
#include <opm/core/props/IncompPropertiesBasic.hpp>
|
||||
#include <opm/core/props/IncompPropertiesFromDeck.hpp>
|
||||
#include <opm/core/props/rock/RockCompressibility.hpp>
|
||||
|
||||
#include <opm/core/linalg/LinearSolverFactory.hpp>
|
||||
|
||||
@@ -78,6 +78,19 @@ main(int argc, char** argv)
|
||||
parameter::ParameterGroup param(argc, argv, false);
|
||||
std::cout << "--------------- Reading parameters ---------------" << std::endl;
|
||||
|
||||
#if ! HAVE_SUITESPARSE_UMFPACK_H
|
||||
// This is an extra check to intercept a potentially invalid request for the
|
||||
// implicit transport solver as early as possible for the user.
|
||||
{
|
||||
const bool use_reorder = param.getDefault("use_reorder", true);
|
||||
if (!use_reorder) {
|
||||
THROW("Cannot use implicit transport solver without UMFPACK. "
|
||||
"Either reconfigure opm-core with SuiteSparse/UMFPACK support and recompile, "
|
||||
"or use the reordering solver (use_reorder=true).");
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
// If we have a "deck_filename", grid and props will be read from that.
|
||||
bool use_deck = param.has("deck_filename");
|
||||
boost::scoped_ptr<EclipseGridParser> deck;
|
||||
@@ -1,477 +0,0 @@
|
||||
/*
|
||||
Copyright 2012 SINTEF ICT, Applied Mathematics.
|
||||
|
||||
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/>.
|
||||
*/
|
||||
|
||||
|
||||
#if HAVE_CONFIG_H
|
||||
#include "config.h"
|
||||
#endif // HAVE_CONFIG_H
|
||||
|
||||
#include <opm/core/pressure/CompressibleTpfa.hpp>
|
||||
|
||||
#include <opm/core/grid.h>
|
||||
#include <opm/core/GridManager.hpp>
|
||||
#include <opm/core/newwells.h>
|
||||
#include <opm/core/wells/WellsManager.hpp>
|
||||
#include <opm/core/utility/ErrorMacros.hpp>
|
||||
#include <opm/core/utility/initState.hpp>
|
||||
#include <opm/core/simulator/SimulatorTimer.hpp>
|
||||
#include <opm/core/utility/StopWatch.hpp>
|
||||
#include <opm/core/utility/Units.hpp>
|
||||
#include <opm/core/utility/writeVtkData.hpp>
|
||||
#include <opm/core/utility/miscUtilities.hpp>
|
||||
#include <opm/core/utility/miscUtilitiesBlackoil.hpp>
|
||||
#include <opm/core/utility/parameters/ParameterGroup.hpp>
|
||||
|
||||
#include <opm/core/fluid/BlackoilPropertiesBasic.hpp>
|
||||
#include <opm/core/fluid/BlackoilPropertiesFromDeck.hpp>
|
||||
#include <opm/core/fluid/RockCompressibility.hpp>
|
||||
|
||||
#include <opm/core/linalg/LinearSolverFactory.hpp>
|
||||
|
||||
#include <opm/core/utility/ColumnExtract.hpp>
|
||||
#include <opm/core/simulator/BlackoilState.hpp>
|
||||
#include <opm/core/simulator/WellState.hpp>
|
||||
#include <opm/core/transport/GravityColumnSolver.hpp>
|
||||
|
||||
#include <opm/core/transport/reorder/TransportModelCompressibleTwophase.hpp>
|
||||
|
||||
#include <boost/filesystem/convenience.hpp>
|
||||
#include <boost/scoped_ptr.hpp>
|
||||
#include <boost/lexical_cast.hpp>
|
||||
|
||||
#include <cassert>
|
||||
#include <cstddef>
|
||||
|
||||
#include <algorithm>
|
||||
#include <tr1/array>
|
||||
#include <functional>
|
||||
#include <iostream>
|
||||
#include <iomanip>
|
||||
#include <fstream>
|
||||
#include <iterator>
|
||||
#include <vector>
|
||||
#include <numeric>
|
||||
|
||||
|
||||
template <class State>
|
||||
static void outputState(const UnstructuredGrid& grid,
|
||||
const State& state,
|
||||
const int step,
|
||||
const std::string& output_dir)
|
||||
{
|
||||
// Write data in VTK format.
|
||||
std::ostringstream vtkfilename;
|
||||
vtkfilename << output_dir << "/output-" << std::setw(3) << std::setfill('0') << step << ".vtu";
|
||||
std::ofstream vtkfile(vtkfilename.str().c_str());
|
||||
if (!vtkfile) {
|
||||
THROW("Failed to open " << vtkfilename.str());
|
||||
}
|
||||
Opm::DataMap dm;
|
||||
dm["saturation"] = &state.saturation();
|
||||
dm["pressure"] = &state.pressure();
|
||||
std::vector<double> cell_velocity;
|
||||
Opm::estimateCellVelocity(grid, state.faceflux(), cell_velocity);
|
||||
dm["velocity"] = &cell_velocity;
|
||||
Opm::writeVtkData(grid, dm, vtkfile);
|
||||
|
||||
// Write data (not grid) in Matlab format
|
||||
for (Opm::DataMap::const_iterator it = dm.begin(); it != dm.end(); ++it) {
|
||||
std::ostringstream fname;
|
||||
fname << output_dir << "/" << it->first << "-" << std::setw(3) << std::setfill('0') << step << ".dat";
|
||||
std::ofstream file(fname.str().c_str());
|
||||
if (!file) {
|
||||
THROW("Failed to open " << fname.str());
|
||||
}
|
||||
const std::vector<double>& d = *(it->second);
|
||||
std::copy(d.begin(), d.end(), std::ostream_iterator<double>(file, "\n"));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
static void outputWaterCut(const Opm::Watercut& watercut,
|
||||
const std::string& output_dir)
|
||||
{
|
||||
// Write water cut curve.
|
||||
std::string fname = output_dir + "/watercut.txt";
|
||||
std::ofstream os(fname.c_str());
|
||||
if (!os) {
|
||||
THROW("Failed to open " << fname);
|
||||
}
|
||||
watercut.write(os);
|
||||
}
|
||||
|
||||
|
||||
static void outputWellReport(const Opm::WellReport& wellreport,
|
||||
const std::string& output_dir)
|
||||
{
|
||||
// Write well report.
|
||||
std::string fname = output_dir + "/wellreport.txt";
|
||||
std::ofstream os(fname.c_str());
|
||||
if (!os) {
|
||||
THROW("Failed to open " << fname);
|
||||
}
|
||||
wellreport.write(os);
|
||||
}
|
||||
|
||||
|
||||
// ----------------- Main program -----------------
|
||||
int
|
||||
main(int argc, char** argv)
|
||||
{
|
||||
using namespace Opm;
|
||||
|
||||
std::cout << "\n================ Test program for weakly compressible two-phase flow ===============\n\n";
|
||||
Opm::parameter::ParameterGroup param(argc, argv, false);
|
||||
std::cout << "--------------- Reading parameters ---------------" << std::endl;
|
||||
|
||||
// Reading various control parameters.
|
||||
const bool output = param.getDefault("output", true);
|
||||
std::string output_dir;
|
||||
int output_interval = 1;
|
||||
if (output) {
|
||||
output_dir = param.getDefault("output_dir", std::string("output"));
|
||||
// Ensure that output dir exists
|
||||
boost::filesystem::path fpath(output_dir);
|
||||
try {
|
||||
create_directories(fpath);
|
||||
}
|
||||
catch (...) {
|
||||
THROW("Creating directories failed: " << fpath);
|
||||
}
|
||||
output_interval = param.getDefault("output_interval", output_interval);
|
||||
}
|
||||
const int num_transport_substeps = param.getDefault("num_transport_substeps", 1);
|
||||
|
||||
// If we have a "deck_filename", grid and props will be read from that.
|
||||
bool use_deck = param.has("deck_filename");
|
||||
boost::scoped_ptr<Opm::GridManager> grid;
|
||||
boost::scoped_ptr<Opm::BlackoilPropertiesInterface> props;
|
||||
boost::scoped_ptr<Opm::WellsManager> wells;
|
||||
boost::scoped_ptr<Opm::RockCompressibility> rock_comp;
|
||||
Opm::SimulatorTimer simtimer;
|
||||
Opm::BlackoilState state;
|
||||
bool check_well_controls = false;
|
||||
int max_well_control_iterations = 0;
|
||||
double gravity[3] = { 0.0 };
|
||||
if (use_deck) {
|
||||
std::string deck_filename = param.get<std::string>("deck_filename");
|
||||
Opm::EclipseGridParser deck(deck_filename);
|
||||
// Grid init
|
||||
grid.reset(new Opm::GridManager(deck));
|
||||
// Rock and fluid init
|
||||
props.reset(new BlackoilPropertiesFromDeck(deck, *grid->c_grid(), param));
|
||||
// Wells init.
|
||||
wells.reset(new Opm::WellsManager(deck, *grid->c_grid(), props->permeability()));
|
||||
check_well_controls = param.getDefault("check_well_controls", false);
|
||||
max_well_control_iterations = param.getDefault("max_well_control_iterations", 10);
|
||||
// Timer init.
|
||||
if (deck.hasField("TSTEP")) {
|
||||
simtimer.init(deck);
|
||||
} else {
|
||||
simtimer.init(param);
|
||||
}
|
||||
// Rock compressibility.
|
||||
rock_comp.reset(new Opm::RockCompressibility(deck));
|
||||
// Gravity.
|
||||
gravity[2] = deck.hasField("NOGRAV") ? 0.0 : Opm::unit::gravity;
|
||||
// Init state variables (saturation and pressure).
|
||||
if (param.has("init_saturation")) {
|
||||
initStateBasic(*grid->c_grid(), *props, param, gravity[2], state);
|
||||
} else {
|
||||
initStateFromDeck(*grid->c_grid(), *props, deck, gravity[2], state);
|
||||
}
|
||||
initBlackoilSurfvol(*grid->c_grid(), *props, state);
|
||||
} else {
|
||||
// Grid init.
|
||||
const int nx = param.getDefault("nx", 100);
|
||||
const int ny = param.getDefault("ny", 100);
|
||||
const int nz = param.getDefault("nz", 1);
|
||||
const double dx = param.getDefault("dx", 1.0);
|
||||
const double dy = param.getDefault("dy", 1.0);
|
||||
const double dz = param.getDefault("dz", 1.0);
|
||||
grid.reset(new Opm::GridManager(nx, ny, nz, dx, dy, dz));
|
||||
// Rock and fluid init.
|
||||
props.reset(new Opm::BlackoilPropertiesBasic(param, grid->c_grid()->dimensions, grid->c_grid()->number_of_cells));
|
||||
// Wells init.
|
||||
wells.reset(new Opm::WellsManager());
|
||||
// Timer init.
|
||||
simtimer.init(param);
|
||||
// Rock compressibility.
|
||||
rock_comp.reset(new Opm::RockCompressibility(param));
|
||||
// Gravity.
|
||||
gravity[2] = param.getDefault("gravity", 0.0);
|
||||
// Init state variables (saturation and pressure).
|
||||
initStateBasic(*grid->c_grid(), *props, param, gravity[2], state);
|
||||
}
|
||||
|
||||
// Warn if gravity but no density difference.
|
||||
bool use_gravity = (gravity[0] != 0.0 || gravity[1] != 0.0 || gravity[2] != 0.0);
|
||||
if (use_gravity) {
|
||||
if (props->surfaceDensity()[0] == props->surfaceDensity()[1]) {
|
||||
std::cout << "**** Warning: nonzero gravity, but zero density difference." << std::endl;
|
||||
}
|
||||
}
|
||||
bool use_segregation_split = false;
|
||||
if (use_gravity) {
|
||||
use_segregation_split = param.getDefault("use_segregation_split", use_segregation_split);
|
||||
}
|
||||
|
||||
// Source-related variables init.
|
||||
int num_cells = grid->c_grid()->number_of_cells;
|
||||
std::vector<double> totmob;
|
||||
std::vector<double> omega; // Will remain empty if no gravity.
|
||||
std::vector<double> rc; // Will remain empty if no rock compressibility.
|
||||
|
||||
// Extra rock init.
|
||||
std::vector<double> porevol;
|
||||
if (rock_comp->isActive()) {
|
||||
computePorevolume(*grid->c_grid(), props->porosity(), *rock_comp, state.pressure(), porevol);
|
||||
} else {
|
||||
computePorevolume(*grid->c_grid(), props->porosity(), porevol);
|
||||
}
|
||||
std::vector<double> initial_porevol = porevol;
|
||||
double tot_porevol_init = std::accumulate(porevol.begin(), porevol.end(), 0.0);
|
||||
|
||||
|
||||
// Initialising src
|
||||
std::vector<double> src(num_cells, 0.0);
|
||||
if (wells->c_wells()) {
|
||||
// Do nothing, wells will be the driving force, not source terms.
|
||||
// Opm::wellsToSrc(*wells->c_wells(), num_cells, src);
|
||||
} else {
|
||||
const double default_injection = use_gravity ? 0.0 : 0.1;
|
||||
const double flow_per_sec = param.getDefault<double>("injected_porevolumes_per_day", default_injection)
|
||||
*tot_porevol_init/Opm::unit::day;
|
||||
src[0] = flow_per_sec;
|
||||
src[num_cells - 1] = -flow_per_sec;
|
||||
}
|
||||
|
||||
std::vector<double> reorder_src = src;
|
||||
|
||||
// Solvers init.
|
||||
// Linear solver.
|
||||
Opm::LinearSolverFactory linsolver(param);
|
||||
// Pressure solver.
|
||||
const double nl_press_res_tol = param.getDefault("nl_press_res_tol", 1e-6);
|
||||
const double nl_press_change_tol = param.getDefault("nl_press_change_tol", 10.0);
|
||||
const int nl_press_maxiter = param.getDefault("nl_press_maxiter", 20);
|
||||
const double *grav = use_gravity ? &gravity[0] : 0;
|
||||
Opm::CompressibleTpfa psolver(*grid->c_grid(), *props, rock_comp.get(), linsolver,
|
||||
nl_press_res_tol, nl_press_change_tol, nl_press_maxiter,
|
||||
grav, wells->c_wells());
|
||||
// Reordering solver.
|
||||
const double nl_tolerance = param.getDefault("nl_tolerance", 1e-9);
|
||||
const int nl_maxiter = param.getDefault("nl_maxiter", 30);
|
||||
Opm::TransportModelCompressibleTwophase reorder_model(*grid->c_grid(), *props, nl_tolerance, nl_maxiter);
|
||||
if (use_segregation_split) {
|
||||
reorder_model.initGravity(grav);
|
||||
}
|
||||
|
||||
// Column-based gravity segregation solver.
|
||||
std::vector<std::vector<int> > columns;
|
||||
if (use_segregation_split) {
|
||||
Opm::extractColumn(*grid->c_grid(), columns);
|
||||
}
|
||||
|
||||
// The allcells vector is used in calls to computeTotalMobility()
|
||||
// and computeTotalMobilityOmega().
|
||||
std::vector<int> allcells(num_cells);
|
||||
for (int cell = 0; cell < num_cells; ++cell) {
|
||||
allcells[cell] = cell;
|
||||
}
|
||||
|
||||
// Warn if any parameters are unused.
|
||||
if (param.anyUnused()) {
|
||||
std::cout << "-------------------- Unused parameters: --------------------\n";
|
||||
param.displayUsage();
|
||||
std::cout << "----------------------------------------------------------------" << std::endl;
|
||||
}
|
||||
|
||||
// Write parameters used for later reference.
|
||||
if (output) {
|
||||
param.writeParam(output_dir + "/spu_2p.param");
|
||||
}
|
||||
|
||||
// Main simulation loop.
|
||||
Opm::time::StopWatch pressure_timer;
|
||||
double ptime = 0.0;
|
||||
Opm::time::StopWatch transport_timer;
|
||||
double ttime = 0.0;
|
||||
Opm::time::StopWatch total_timer;
|
||||
total_timer.start();
|
||||
std::cout << "\n\n================ Starting main simulation loop ===============" << std::endl;
|
||||
double init_satvol[2] = { 0.0 };
|
||||
double satvol[2] = { 0.0 };
|
||||
double injected[2] = { 0.0 };
|
||||
double produced[2] = { 0.0 };
|
||||
double tot_injected[2] = { 0.0 };
|
||||
double tot_produced[2] = { 0.0 };
|
||||
Opm::computeSaturatedVol(porevol, state.saturation(), init_satvol);
|
||||
std::cout << "\nInitial saturations are " << init_satvol[0]/tot_porevol_init
|
||||
<< " " << init_satvol[1]/tot_porevol_init << std::endl;
|
||||
Opm::Watercut watercut;
|
||||
watercut.push(0.0, 0.0, 0.0);
|
||||
Opm::WellReport wellreport;
|
||||
Opm::WellState well_state;
|
||||
std::vector<double> fractional_flows;
|
||||
std::vector<double> well_resflows_phase;
|
||||
int num_wells = 0;
|
||||
if (wells->c_wells()) {
|
||||
num_wells = wells->c_wells()->number_of_wells;
|
||||
well_state.init(wells->c_wells(), state);
|
||||
well_resflows_phase.resize((wells->c_wells()->number_of_phases)*(num_wells), 0.0);
|
||||
wellreport.push(*props, *wells->c_wells(),
|
||||
state.pressure(), state.surfacevol(), state.saturation(),
|
||||
0.0, well_state.bhp(), well_state.perfRates());
|
||||
}
|
||||
for (; !simtimer.done(); ++simtimer) {
|
||||
// Report timestep and (optionally) write state to disk.
|
||||
simtimer.report(std::cout);
|
||||
if (output && (simtimer.currentStepNum() % output_interval == 0)) {
|
||||
outputState(*grid->c_grid(), state, simtimer.currentStepNum(), output_dir);
|
||||
}
|
||||
|
||||
// Solve pressure.
|
||||
if (check_well_controls) {
|
||||
computeFractionalFlow(*props, allcells, state.pressure(), state.surfacevol(), state.saturation(), fractional_flows);
|
||||
}
|
||||
if (check_well_controls) {
|
||||
wells->applyExplicitReinjectionControls(well_resflows_phase, well_resflows_phase);
|
||||
}
|
||||
bool well_control_passed = !check_well_controls;
|
||||
int well_control_iteration = 0;
|
||||
do { // Well control outer loop.
|
||||
pressure_timer.start();
|
||||
psolver.solve(simtimer.currentStepLength(), state, well_state);
|
||||
pressure_timer.stop();
|
||||
double pt = pressure_timer.secsSinceStart();
|
||||
std::cout << "Pressure solver took: " << pt << " seconds." << std::endl;
|
||||
ptime += pt;
|
||||
|
||||
if (check_well_controls) {
|
||||
Opm::computePhaseFlowRatesPerWell(*wells->c_wells(),
|
||||
fractional_flows,
|
||||
well_state.perfRates(),
|
||||
well_resflows_phase);
|
||||
std::cout << "Checking well conditions." << std::endl;
|
||||
// For testing we set surface := reservoir
|
||||
well_control_passed = wells->conditionsMet(well_state.bhp(), well_resflows_phase, well_resflows_phase);
|
||||
++well_control_iteration;
|
||||
if (!well_control_passed && well_control_iteration > max_well_control_iterations) {
|
||||
THROW("Could not satisfy well conditions in " << max_well_control_iterations << " tries.");
|
||||
}
|
||||
if (!well_control_passed) {
|
||||
std::cout << "Well controls not passed, solving again." << std::endl;
|
||||
} else {
|
||||
std::cout << "Well conditions met." << std::endl;
|
||||
}
|
||||
}
|
||||
} while (!well_control_passed);
|
||||
|
||||
// Process transport sources (to include bdy terms and well flows).
|
||||
Opm::computeTransportSource(*grid->c_grid(), src, state.faceflux(), 1.0,
|
||||
wells->c_wells(), well_state.perfRates(), reorder_src);
|
||||
|
||||
// Compute new porevolumes after pressure solve, if necessary.
|
||||
if (rock_comp->isActive()) {
|
||||
initial_porevol = porevol;
|
||||
computePorevolume(*grid->c_grid(), props->porosity(), *rock_comp, state.pressure(), porevol);
|
||||
}
|
||||
// Solve transport.
|
||||
transport_timer.start();
|
||||
double stepsize = simtimer.currentStepLength();
|
||||
if (num_transport_substeps != 1) {
|
||||
stepsize /= double(num_transport_substeps);
|
||||
std::cout << "Making " << num_transport_substeps << " transport substeps." << std::endl;
|
||||
}
|
||||
for (int tr_substep = 0; tr_substep < num_transport_substeps; ++tr_substep) {
|
||||
// Note that for now we do not handle rock compressibility,
|
||||
// although the transport solver should be able to.
|
||||
reorder_model.solve(&state.faceflux()[0], &state.pressure()[0],
|
||||
&porevol[0], &initial_porevol[0], &reorder_src[0], stepsize,
|
||||
state.saturation(), state.surfacevol());
|
||||
// Opm::computeInjectedProduced(*props, state.saturation(), reorder_src, stepsize, injected, produced);
|
||||
if (use_segregation_split) {
|
||||
reorder_model.solveGravity(columns,
|
||||
stepsize, state.saturation(), state.surfacevol());
|
||||
}
|
||||
}
|
||||
transport_timer.stop();
|
||||
double tt = transport_timer.secsSinceStart();
|
||||
std::cout << "Transport solver took: " << tt << " seconds." << std::endl;
|
||||
ttime += tt;
|
||||
|
||||
// Report volume balances.
|
||||
Opm::computeSaturatedVol(porevol, state.saturation(), satvol);
|
||||
tot_injected[0] += injected[0];
|
||||
tot_injected[1] += injected[1];
|
||||
tot_produced[0] += produced[0];
|
||||
tot_produced[1] += produced[1];
|
||||
std::cout.precision(5);
|
||||
const int width = 18;
|
||||
std::cout << "\nVolume balance report (all numbers relative to total pore volume).\n";
|
||||
std::cout << " Saturated volumes: "
|
||||
<< std::setw(width) << satvol[0]/tot_porevol_init
|
||||
<< std::setw(width) << satvol[1]/tot_porevol_init << std::endl;
|
||||
std::cout << " Injected volumes: "
|
||||
<< std::setw(width) << injected[0]/tot_porevol_init
|
||||
<< std::setw(width) << injected[1]/tot_porevol_init << std::endl;
|
||||
std::cout << " Produced volumes: "
|
||||
<< std::setw(width) << produced[0]/tot_porevol_init
|
||||
<< std::setw(width) << produced[1]/tot_porevol_init << std::endl;
|
||||
std::cout << " Total inj volumes: "
|
||||
<< std::setw(width) << tot_injected[0]/tot_porevol_init
|
||||
<< std::setw(width) << tot_injected[1]/tot_porevol_init << std::endl;
|
||||
std::cout << " Total prod volumes: "
|
||||
<< std::setw(width) << tot_produced[0]/tot_porevol_init
|
||||
<< std::setw(width) << tot_produced[1]/tot_porevol_init << std::endl;
|
||||
std::cout << " In-place + prod - inj: "
|
||||
<< std::setw(width) << (satvol[0] + tot_produced[0] - tot_injected[0])/tot_porevol_init
|
||||
<< std::setw(width) << (satvol[1] + tot_produced[1] - tot_injected[1])/tot_porevol_init << std::endl;
|
||||
std::cout << " Init - now - pr + inj: "
|
||||
<< std::setw(width) << (init_satvol[0] - satvol[0] - tot_produced[0] + tot_injected[0])/tot_porevol_init
|
||||
<< std::setw(width) << (init_satvol[1] - satvol[1] - tot_produced[1] + tot_injected[1])/tot_porevol_init
|
||||
<< std::endl;
|
||||
std::cout.precision(8);
|
||||
|
||||
watercut.push(simtimer.currentTime() + simtimer.currentStepLength(),
|
||||
produced[0]/(produced[0] + produced[1]),
|
||||
tot_produced[0]/tot_porevol_init);
|
||||
if (wells->c_wells()) {
|
||||
wellreport.push(*props, *wells->c_wells(),
|
||||
state.pressure(), state.surfacevol(), state.saturation(),
|
||||
simtimer.currentTime() + simtimer.currentStepLength(),
|
||||
well_state.bhp(), well_state.perfRates());
|
||||
}
|
||||
}
|
||||
total_timer.stop();
|
||||
|
||||
std::cout << "\n\n================ End of simulation ===============\n"
|
||||
<< "Total time taken: " << total_timer.secsSinceStart()
|
||||
<< "\n Pressure time: " << ptime
|
||||
<< "\n Transport time: " << ttime << std::endl;
|
||||
|
||||
if (output) {
|
||||
outputState(*grid->c_grid(), state, simtimer.currentStepNum(), output_dir);
|
||||
outputWaterCut(watercut, output_dir);
|
||||
if (wells->c_wells()) {
|
||||
outputWellReport(wellreport, output_dir);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,718 +0,0 @@
|
||||
/*===========================================================================
|
||||
//
|
||||
// File: spu_2p.cpp
|
||||
//
|
||||
// Created: 2011-10-05 10:29:01+0200
|
||||
//
|
||||
// Authors: Ingeborg S. Ligaarden <Ingeborg.Ligaarden@sintef.no>
|
||||
// Jostein R. Natvig <Jostein.R.Natvig@sintef.no>
|
||||
// Halvor M. Nilsen <HalvorMoll.Nilsen@sintef.no>
|
||||
// Atgeirr F. Rasmussen <atgeirr@sintef.no>
|
||||
// Bård Skaflestad <Bard.Skaflestad@sintef.no>
|
||||
//
|
||||
//==========================================================================*/
|
||||
|
||||
|
||||
/*
|
||||
Copyright 2011, 2012 SINTEF ICT, Applied Mathematics.
|
||||
Copyright 2011, 2012 Statoil ASA.
|
||||
|
||||
This file is part of the Open Porous Media Project (OPM).
|
||||
|
||||
OPM is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
OPM is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with OPM. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#if HAVE_CONFIG_H
|
||||
#include "config.h"
|
||||
#endif // HAVE_CONFIG_H
|
||||
|
||||
#include <opm/core/pressure/IncompTpfa.hpp>
|
||||
#include <opm/core/pressure/FlowBCManager.hpp>
|
||||
|
||||
#include <opm/core/grid.h>
|
||||
#include <opm/core/GridManager.hpp>
|
||||
#include <opm/core/newwells.h>
|
||||
#include <opm/core/wells/WellsManager.hpp>
|
||||
#include <opm/core/utility/ErrorMacros.hpp>
|
||||
#include <opm/core/utility/initState.hpp>
|
||||
#include <opm/core/simulator/SimulatorTimer.hpp>
|
||||
#include <opm/core/utility/StopWatch.hpp>
|
||||
#include <opm/core/utility/Units.hpp>
|
||||
#include <opm/core/utility/writeVtkData.hpp>
|
||||
#include <opm/core/utility/miscUtilities.hpp>
|
||||
#include <opm/core/utility/parameters/ParameterGroup.hpp>
|
||||
|
||||
#include <opm/core/fluid/SimpleFluid2p.hpp>
|
||||
#include <opm/core/fluid/IncompPropertiesBasic.hpp>
|
||||
#include <opm/core/fluid/IncompPropertiesFromDeck.hpp>
|
||||
#include <opm/core/fluid/RockCompressibility.hpp>
|
||||
|
||||
#include <opm/core/linalg/LinearSolverFactory.hpp>
|
||||
|
||||
#include <opm/core/transport/transport_source.h>
|
||||
#include <opm/core/transport/CSRMatrixUmfpackSolver.hpp>
|
||||
#include <opm/core/transport/NormSupport.hpp>
|
||||
#include <opm/core/transport/ImplicitAssembly.hpp>
|
||||
#include <opm/core/transport/ImplicitTransport.hpp>
|
||||
#include <opm/core/transport/JacobianSystem.hpp>
|
||||
#include <opm/core/transport/CSRMatrixBlockAssembler.hpp>
|
||||
#include <opm/core/transport/SinglePointUpwindTwoPhase.hpp>
|
||||
|
||||
#include <opm/core/utility/ColumnExtract.hpp>
|
||||
#include <opm/core/simulator/TwophaseState.hpp>
|
||||
#include <opm/core/simulator/WellState.hpp>
|
||||
#include <opm/core/transport/GravityColumnSolver.hpp>
|
||||
|
||||
#include <opm/core/transport/reorder/TransportModelTwophase.hpp>
|
||||
|
||||
#include <boost/filesystem/convenience.hpp>
|
||||
#include <boost/scoped_ptr.hpp>
|
||||
#include <boost/lexical_cast.hpp>
|
||||
|
||||
#include <cassert>
|
||||
#include <cstddef>
|
||||
|
||||
#include <algorithm>
|
||||
#include <tr1/array>
|
||||
#include <functional>
|
||||
#include <iostream>
|
||||
#include <iomanip>
|
||||
#include <fstream>
|
||||
#include <iterator>
|
||||
#include <vector>
|
||||
#include <numeric>
|
||||
|
||||
|
||||
#ifdef HAVE_ERT
|
||||
#include <opm/core/utility/writeECLData.hpp>
|
||||
#endif
|
||||
|
||||
|
||||
|
||||
static void outputState(const UnstructuredGrid& grid,
|
||||
const Opm::TwophaseState& state,
|
||||
const Opm::SimulatorTimer& simtimer,
|
||||
const std::string& output_dir)
|
||||
{
|
||||
// Write data in VTK format.
|
||||
int step = simtimer.currentStepNum();
|
||||
std::ostringstream vtkfilename;
|
||||
vtkfilename << output_dir << "/output-" << std::setw(3) << std::setfill('0') << step << ".vtu";
|
||||
std::ofstream vtkfile(vtkfilename.str().c_str());
|
||||
if (!vtkfile) {
|
||||
THROW("Failed to open " << vtkfilename.str());
|
||||
}
|
||||
Opm::DataMap dm;
|
||||
dm["saturation"] = &state.saturation();
|
||||
dm["pressure"] = &state.pressure();
|
||||
std::vector<double> cell_velocity;
|
||||
Opm::estimateCellVelocity(grid, state.faceflux(), cell_velocity);
|
||||
dm["velocity"] = &cell_velocity;
|
||||
Opm::writeVtkData(grid, dm, vtkfile);
|
||||
#ifdef HAVE_ERT
|
||||
Opm::writeECLData(grid, dm, simtimer.currentStepNum(), simtimer.currentTime(), simtimer.currentDateTime(), output_dir, "OPM" );
|
||||
#endif
|
||||
|
||||
// Write data (not grid) in Matlab format
|
||||
for (Opm::DataMap::const_iterator it = dm.begin(); it != dm.end(); ++it) {
|
||||
std::ostringstream fname;
|
||||
fname << output_dir << "/" << it->first << "-" << std::setw(3) << std::setfill('0') << step << ".dat";
|
||||
std::ofstream file(fname.str().c_str());
|
||||
if (!file) {
|
||||
THROW("Failed to open " << fname.str());
|
||||
}
|
||||
const std::vector<double>& d = *(it->second);
|
||||
std::copy(d.begin(), d.end(), std::ostream_iterator<double>(file, "\n"));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
static void outputWaterCut(const Opm::Watercut& watercut,
|
||||
const std::string& output_dir)
|
||||
{
|
||||
// Write water cut curve.
|
||||
std::string fname = output_dir + "/watercut.txt";
|
||||
std::ofstream os(fname.c_str());
|
||||
if (!os) {
|
||||
THROW("Failed to open " << fname);
|
||||
}
|
||||
watercut.write(os);
|
||||
}
|
||||
|
||||
|
||||
static void outputWellReport(const Opm::WellReport& wellreport,
|
||||
const std::string& output_dir)
|
||||
{
|
||||
// Write well report.
|
||||
std::string fname = output_dir + "/wellreport.txt";
|
||||
std::ofstream os(fname.c_str());
|
||||
if (!os) {
|
||||
THROW("Failed to open " << fname);
|
||||
}
|
||||
wellreport.write(os);
|
||||
}
|
||||
|
||||
|
||||
|
||||
// --------------- Types needed to define transport solver ---------------
|
||||
|
||||
class SimpleFluid2pWrappingProps
|
||||
{
|
||||
public:
|
||||
SimpleFluid2pWrappingProps(const Opm::IncompPropertiesInterface& props)
|
||||
: props_(props),
|
||||
smin_(props.numCells()*props.numPhases()),
|
||||
smax_(props.numCells()*props.numPhases())
|
||||
{
|
||||
if (props.numPhases() != 2) {
|
||||
THROW("SimpleFluid2pWrapper requires 2 phases.");
|
||||
}
|
||||
const int num_cells = props.numCells();
|
||||
std::vector<int> cells(num_cells);
|
||||
for (int c = 0; c < num_cells; ++c) {
|
||||
cells[c] = c;
|
||||
}
|
||||
props.satRange(num_cells, &cells[0], &smin_[0], &smax_[0]);
|
||||
}
|
||||
|
||||
double density(int phase) const
|
||||
{
|
||||
return props_.density()[phase];
|
||||
}
|
||||
|
||||
template <class Sat,
|
||||
class Mob,
|
||||
class DMob>
|
||||
void mobility(int c, const Sat& s, Mob& mob, DMob& dmob) const
|
||||
{
|
||||
props_.relperm(1, &s[0], &c, &mob[0], &dmob[0]);
|
||||
const double* mu = props_.viscosity();
|
||||
mob[0] /= mu[0];
|
||||
mob[1] /= mu[1];
|
||||
// Recall that we use Fortran ordering for kr derivatives,
|
||||
// therefore dmob[i*2 + j] is row j and column i of the
|
||||
// matrix.
|
||||
// Each row corresponds to a kr function, so which mu to
|
||||
// divide by also depends on the row, j.
|
||||
dmob[0*2 + 0] /= mu[0];
|
||||
dmob[0*2 + 1] /= mu[1];
|
||||
dmob[1*2 + 0] /= mu[0];
|
||||
dmob[1*2 + 1] /= mu[1];
|
||||
}
|
||||
|
||||
template <class Sat,
|
||||
class Pcap,
|
||||
class DPcap>
|
||||
void pc(int c, const Sat& s, Pcap& pcap, DPcap& dpcap) const
|
||||
{
|
||||
double pcow[2];
|
||||
double dpcow[4];
|
||||
props_.capPress(1, &s[0], &c, pcow, dpcow);
|
||||
pcap = pcow[0];
|
||||
ASSERT(pcow[1] == 0.0);
|
||||
dpcap = dpcow[0];
|
||||
ASSERT(dpcow[1] == 0.0);
|
||||
ASSERT(dpcow[2] == 0.0);
|
||||
ASSERT(dpcow[3] == 0.0);
|
||||
}
|
||||
|
||||
double s_min(int c) const
|
||||
{
|
||||
return smin_[2*c + 0];
|
||||
}
|
||||
|
||||
double s_max(int c) const
|
||||
{
|
||||
return smax_[2*c + 0];
|
||||
}
|
||||
|
||||
private:
|
||||
const Opm::IncompPropertiesInterface& props_;
|
||||
std::vector<double> smin_;
|
||||
std::vector<double> smax_;
|
||||
};
|
||||
|
||||
typedef SimpleFluid2pWrappingProps TwophaseFluid;
|
||||
typedef Opm::SinglePointUpwindTwoPhase<TwophaseFluid> TransportModel;
|
||||
|
||||
using namespace Opm::ImplicitTransportDefault;
|
||||
|
||||
typedef NewtonVectorCollection< ::std::vector<double> > NVecColl;
|
||||
typedef JacobianSystem < struct CSRMatrix, NVecColl > JacSys;
|
||||
|
||||
template <class Vector>
|
||||
class MaxNorm {
|
||||
public:
|
||||
static double
|
||||
norm(const Vector& v) {
|
||||
return AccumulationNorm <Vector, MaxAbs>::norm(v);
|
||||
}
|
||||
};
|
||||
|
||||
typedef Opm::ImplicitTransport<TransportModel,
|
||||
JacSys ,
|
||||
MaxNorm ,
|
||||
VectorNegater ,
|
||||
VectorZero ,
|
||||
MatrixZero ,
|
||||
VectorAssign > TransportSolver;
|
||||
|
||||
|
||||
|
||||
// ----------------- Main program -----------------
|
||||
int
|
||||
main(int argc, char** argv)
|
||||
{
|
||||
using namespace Opm;
|
||||
|
||||
std::cout << "\n================ Test program for incompressible two-phase flow ===============\n\n";
|
||||
Opm::parameter::ParameterGroup param(argc, argv, false);
|
||||
std::cout << "--------------- Reading parameters ---------------" << std::endl;
|
||||
|
||||
// Reading various control parameters.
|
||||
const bool guess_old_solution = param.getDefault("guess_old_solution", false);
|
||||
const bool use_reorder = param.getDefault("use_reorder", true);
|
||||
const bool output = param.getDefault("output", true);
|
||||
std::string output_dir;
|
||||
int output_interval = 1;
|
||||
if (output) {
|
||||
output_dir = param.getDefault("output_dir", std::string("output"));
|
||||
// Ensure that output dir exists
|
||||
boost::filesystem::path fpath(output_dir);
|
||||
try {
|
||||
create_directories(fpath);
|
||||
}
|
||||
catch (...) {
|
||||
THROW("Creating directories failed: " << fpath);
|
||||
}
|
||||
output_interval = param.getDefault("output_interval", output_interval);
|
||||
}
|
||||
const int num_transport_substeps = param.getDefault("num_transport_substeps", 1);
|
||||
|
||||
// If we have a "deck_filename", grid and props will be read from that.
|
||||
bool use_deck = param.has("deck_filename");
|
||||
boost::scoped_ptr<Opm::GridManager> grid;
|
||||
boost::scoped_ptr<Opm::IncompPropertiesInterface> props;
|
||||
boost::scoped_ptr<Opm::WellsManager> wells;
|
||||
boost::scoped_ptr<Opm::RockCompressibility> rock_comp;
|
||||
Opm::SimulatorTimer simtimer;
|
||||
Opm::TwophaseState state;
|
||||
bool check_well_controls = false;
|
||||
int max_well_control_iterations = 0;
|
||||
double gravity[3] = { 0.0 };
|
||||
if (use_deck) {
|
||||
std::string deck_filename = param.get<std::string>("deck_filename");
|
||||
Opm::EclipseGridParser deck(deck_filename);
|
||||
// Grid init
|
||||
grid.reset(new Opm::GridManager(deck));
|
||||
// Rock and fluid init
|
||||
props.reset(new Opm::IncompPropertiesFromDeck(deck, *grid->c_grid()));
|
||||
// Wells init.
|
||||
wells.reset(new Opm::WellsManager(deck, *grid->c_grid(), props->permeability()));
|
||||
check_well_controls = param.getDefault("check_well_controls", false);
|
||||
max_well_control_iterations = param.getDefault("max_well_control_iterations", 10);
|
||||
// Timer init.
|
||||
if (deck.hasField("TSTEP")) {
|
||||
simtimer.init(deck);
|
||||
} else {
|
||||
simtimer.init(param);
|
||||
}
|
||||
// Rock compressibility.
|
||||
rock_comp.reset(new Opm::RockCompressibility(deck));
|
||||
// Gravity.
|
||||
gravity[2] = deck.hasField("NOGRAV") ? 0.0 : Opm::unit::gravity;
|
||||
// Init state variables (saturation and pressure).
|
||||
if (param.has("init_saturation")) {
|
||||
initStateBasic(*grid->c_grid(), *props, param, gravity[2], state);
|
||||
} else {
|
||||
initStateFromDeck(*grid->c_grid(), *props, deck, gravity[2], state);
|
||||
}
|
||||
} else {
|
||||
// Grid init.
|
||||
const int nx = param.getDefault("nx", 100);
|
||||
const int ny = param.getDefault("ny", 100);
|
||||
const int nz = param.getDefault("nz", 1);
|
||||
const double dx = param.getDefault("dx", 1.0);
|
||||
const double dy = param.getDefault("dy", 1.0);
|
||||
const double dz = param.getDefault("dz", 1.0);
|
||||
grid.reset(new Opm::GridManager(nx, ny, nz, dx, dy, dz));
|
||||
// Rock and fluid init.
|
||||
props.reset(new Opm::IncompPropertiesBasic(param, grid->c_grid()->dimensions, grid->c_grid()->number_of_cells));
|
||||
// Wells init.
|
||||
wells.reset(new Opm::WellsManager());
|
||||
// Timer init.
|
||||
simtimer.init(param);
|
||||
// Rock compressibility.
|
||||
rock_comp.reset(new Opm::RockCompressibility(param));
|
||||
// Gravity.
|
||||
gravity[2] = param.getDefault("gravity", 0.0);
|
||||
// Init state variables (saturation and pressure).
|
||||
initStateBasic(*grid->c_grid(), *props, param, gravity[2], state);
|
||||
}
|
||||
|
||||
// Extra fluid init for transport solver.
|
||||
TwophaseFluid fluid(*props);
|
||||
|
||||
// Warn if gravity but no density difference.
|
||||
bool use_gravity = (gravity[0] != 0.0 || gravity[1] != 0.0 || gravity[2] != 0.0);
|
||||
if (use_gravity) {
|
||||
if (props->density()[0] == props->density()[1]) {
|
||||
std::cout << "**** Warning: nonzero gravity, but zero density difference." << std::endl;
|
||||
}
|
||||
}
|
||||
bool use_segregation_split = false;
|
||||
bool use_column_solver = false;
|
||||
bool use_gauss_seidel_gravity = false;
|
||||
if (use_gravity && use_reorder) {
|
||||
use_segregation_split = param.getDefault("use_segregation_split", use_segregation_split);
|
||||
if (use_segregation_split) {
|
||||
use_column_solver = param.getDefault("use_column_solver", use_column_solver);
|
||||
if (use_column_solver) {
|
||||
use_gauss_seidel_gravity = param.getDefault("use_gauss_seidel_gravity", use_gauss_seidel_gravity);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Check that rock compressibility is not used with solvers that do not handle it.
|
||||
int nl_pressure_maxiter = 0;
|
||||
double nl_pressure_residual_tolerance = 0.0;
|
||||
double nl_pressure_change_tolerance = 0.0;
|
||||
if (rock_comp->isActive()) {
|
||||
if (!use_reorder) {
|
||||
THROW("Cannot run implicit (non-reordering) transport solver with rock compressibility yet.");
|
||||
}
|
||||
nl_pressure_residual_tolerance = param.getDefault("nl_pressure_residual_tolerance", 0.0);
|
||||
nl_pressure_change_tolerance = param.getDefault("nl_pressure_change_tolerance", 1.0); // In Pascal.
|
||||
nl_pressure_maxiter = param.getDefault("nl_pressure_maxiter", 10);
|
||||
}
|
||||
|
||||
// Source-related variables init.
|
||||
int num_cells = grid->c_grid()->number_of_cells;
|
||||
|
||||
// Extra rock init.
|
||||
std::vector<double> porevol;
|
||||
if (rock_comp->isActive()) {
|
||||
computePorevolume(*grid->c_grid(), props->porosity(), *rock_comp, state.pressure(), porevol);
|
||||
} else {
|
||||
computePorevolume(*grid->c_grid(), props->porosity(), porevol);
|
||||
}
|
||||
double tot_porevol_init = std::accumulate(porevol.begin(), porevol.end(), 0.0);
|
||||
|
||||
// Initialising src
|
||||
std::vector<double> src(num_cells, 0.0);
|
||||
if (wells->c_wells()) {
|
||||
// Do nothing, wells will be the driving force, not source terms.
|
||||
// Opm::wellsToSrc(*wells->c_wells(), num_cells, src);
|
||||
} else {
|
||||
const double default_injection = use_gravity ? 0.0 : 0.1;
|
||||
const double flow_per_sec = param.getDefault<double>("injected_porevolumes_per_day", default_injection)
|
||||
*tot_porevol_init/Opm::unit::day;
|
||||
src[0] = flow_per_sec;
|
||||
src[num_cells - 1] = -flow_per_sec;
|
||||
}
|
||||
|
||||
TransportSource* tsrc = create_transport_source(2, 2);
|
||||
double ssrc[] = { 1.0, 0.0 };
|
||||
double ssink[] = { 0.0, 1.0 };
|
||||
double zdummy[] = { 0.0, 0.0 };
|
||||
for (int cell = 0; cell < num_cells; ++cell) {
|
||||
if (src[cell] > 0.0) {
|
||||
append_transport_source(cell, 2, 0, src[cell], ssrc, zdummy, tsrc);
|
||||
} else if (src[cell] < 0.0) {
|
||||
append_transport_source(cell, 2, 0, src[cell], ssink, zdummy, tsrc);
|
||||
}
|
||||
}
|
||||
std::vector<double> reorder_src = src;
|
||||
|
||||
// Boundary conditions.
|
||||
Opm::FlowBCManager bcs;
|
||||
if (param.getDefault("use_pside", false)) {
|
||||
int pside = param.get<int>("pside");
|
||||
double pside_pressure = param.get<double>("pside_pressure");
|
||||
bcs.pressureSide(*grid->c_grid(), Opm::FlowBCManager::Side(pside), pside_pressure);
|
||||
}
|
||||
|
||||
// Solvers init.
|
||||
// Linear solver.
|
||||
Opm::LinearSolverFactory linsolver(param);
|
||||
// Pressure solver.
|
||||
const double *grav = use_gravity ? &gravity[0] : 0;
|
||||
Opm::IncompTpfa psolver(*grid->c_grid(), *props, rock_comp.get(), linsolver,
|
||||
nl_pressure_residual_tolerance, nl_pressure_change_tolerance,
|
||||
nl_pressure_maxiter,
|
||||
grav, wells->c_wells(), src, bcs.c_bcs());
|
||||
// Reordering solver.
|
||||
const double nl_tolerance = param.getDefault("nl_tolerance", 1e-9);
|
||||
const int nl_maxiter = param.getDefault("nl_maxiter", 30);
|
||||
Opm::TransportModelTwophase reorder_model(*grid->c_grid(), *props, nl_tolerance, nl_maxiter);
|
||||
if (use_gauss_seidel_gravity) {
|
||||
reorder_model.initGravity(grav);
|
||||
}
|
||||
// Non-reordering solver.
|
||||
TransportModel model (fluid, *grid->c_grid(), porevol, grav, guess_old_solution);
|
||||
if (use_gravity) {
|
||||
model.initGravityTrans(*grid->c_grid(), psolver.getHalfTrans());
|
||||
}
|
||||
TransportSolver tsolver(model);
|
||||
// Column-based gravity segregation solver.
|
||||
std::vector<std::vector<int> > columns;
|
||||
if (use_column_solver) {
|
||||
Opm::extractColumn(*grid->c_grid(), columns);
|
||||
}
|
||||
Opm::GravityColumnSolver<TransportModel> colsolver(model, *grid->c_grid(), nl_tolerance, nl_maxiter);
|
||||
|
||||
// Control init.
|
||||
Opm::ImplicitTransportDetails::NRReport rpt;
|
||||
Opm::ImplicitTransportDetails::NRControl ctrl;
|
||||
if (!use_reorder || use_segregation_split) {
|
||||
ctrl.max_it = param.getDefault("max_it", 20);
|
||||
ctrl.verbosity = param.getDefault("verbosity", 0);
|
||||
ctrl.max_it_ls = param.getDefault("max_it_ls", 5);
|
||||
}
|
||||
|
||||
// Linear solver init.
|
||||
using Opm::ImplicitTransportLinAlgSupport::CSRMatrixUmfpackSolver;
|
||||
CSRMatrixUmfpackSolver linsolve;
|
||||
|
||||
// The allcells vector is used in calls to computeTotalMobility()
|
||||
// and computeTotalMobilityOmega().
|
||||
std::vector<int> allcells(num_cells);
|
||||
for (int cell = 0; cell < num_cells; ++cell) {
|
||||
allcells[cell] = cell;
|
||||
}
|
||||
|
||||
// Warn if any parameters are unused.
|
||||
if (param.anyUnused()) {
|
||||
std::cout << "-------------------- Unused parameters: --------------------\n";
|
||||
param.displayUsage();
|
||||
std::cout << "----------------------------------------------------------------" << std::endl;
|
||||
}
|
||||
|
||||
// Write parameters used for later reference.
|
||||
if (output) {
|
||||
param.writeParam(output_dir + "/simulation.param");
|
||||
}
|
||||
|
||||
// Main simulation loop.
|
||||
Opm::time::StopWatch pressure_timer;
|
||||
double ptime = 0.0;
|
||||
Opm::time::StopWatch transport_timer;
|
||||
double ttime = 0.0;
|
||||
Opm::time::StopWatch total_timer;
|
||||
total_timer.start();
|
||||
std::cout << "\n\n================ Starting main simulation loop ===============" << std::endl;
|
||||
double init_satvol[2] = { 0.0 };
|
||||
double satvol[2] = { 0.0 };
|
||||
double injected[2] = { 0.0 };
|
||||
double produced[2] = { 0.0 };
|
||||
double tot_injected[2] = { 0.0 };
|
||||
double tot_produced[2] = { 0.0 };
|
||||
Opm::computeSaturatedVol(porevol, state.saturation(), init_satvol);
|
||||
std::cout << "\nInitial saturations are " << init_satvol[0]/tot_porevol_init
|
||||
<< " " << init_satvol[1]/tot_porevol_init << std::endl;
|
||||
Opm::Watercut watercut;
|
||||
watercut.push(0.0, 0.0, 0.0);
|
||||
Opm::WellReport wellreport;
|
||||
Opm::WellState well_state;
|
||||
well_state.init(wells->c_wells(), state);
|
||||
std::vector<double> fractional_flows;
|
||||
std::vector<double> well_resflows_phase;
|
||||
int num_wells = 0;
|
||||
if (wells->c_wells()) {
|
||||
num_wells = wells->c_wells()->number_of_wells;
|
||||
well_resflows_phase.resize((wells->c_wells()->number_of_phases)*(wells->c_wells()->number_of_wells), 0.0);
|
||||
wellreport.push(*props, *wells->c_wells(), state.saturation(), 0.0, well_state.bhp(), well_state.perfRates());
|
||||
}
|
||||
for (; !simtimer.done(); ++simtimer) {
|
||||
// Report timestep and (optionally) write state to disk.
|
||||
simtimer.report(std::cout);
|
||||
if (output && (simtimer.currentStepNum() % output_interval == 0)) {
|
||||
outputState(*grid->c_grid(), state, simtimer , output_dir);
|
||||
}
|
||||
|
||||
// Solve pressure.
|
||||
if (check_well_controls) {
|
||||
computeFractionalFlow(*props, allcells, state.saturation(), fractional_flows);
|
||||
}
|
||||
if (check_well_controls) {
|
||||
wells->applyExplicitReinjectionControls(well_resflows_phase, well_resflows_phase);
|
||||
}
|
||||
bool well_control_passed = !check_well_controls;
|
||||
int well_control_iteration = 0;
|
||||
do {
|
||||
pressure_timer.start();
|
||||
std::vector<double> initial_pressure = state.pressure();
|
||||
psolver.solve(simtimer.currentStepLength(), state, well_state);
|
||||
if (!rock_comp->isActive()) {
|
||||
// Compute average pressures of previous and last
|
||||
// step, and total volume.
|
||||
double av_prev_press = 0.;
|
||||
double av_press = 0.;
|
||||
double tot_vol = 0.;
|
||||
for (int cell = 0; cell < num_cells; ++cell) {
|
||||
av_prev_press += initial_pressure[cell]*grid->c_grid()->cell_volumes[cell];
|
||||
av_press += state.pressure()[cell]*grid->c_grid()->cell_volumes[cell];
|
||||
tot_vol += grid->c_grid()->cell_volumes[cell];
|
||||
}
|
||||
// Renormalization constant
|
||||
const double ren_const = (av_prev_press - av_press)/tot_vol;
|
||||
for (int cell = 0; cell < num_cells; ++cell) {
|
||||
state.pressure()[cell] += ren_const;
|
||||
}
|
||||
for (int well = 0; well < num_wells; ++well) {
|
||||
well_state.bhp()[well] += ren_const;
|
||||
}
|
||||
}
|
||||
pressure_timer.stop();
|
||||
double pt = pressure_timer.secsSinceStart();
|
||||
std::cout << "Pressure solver took: " << pt << " seconds." << std::endl;
|
||||
ptime += pt;
|
||||
|
||||
|
||||
if (check_well_controls) {
|
||||
Opm::computePhaseFlowRatesPerWell(*wells->c_wells(),
|
||||
fractional_flows,
|
||||
well_state.perfRates(),
|
||||
well_resflows_phase);
|
||||
std::cout << "Checking well conditions." << std::endl;
|
||||
// For testing we set surface := reservoir
|
||||
well_control_passed = wells->conditionsMet(well_state.bhp(), well_resflows_phase, well_resflows_phase);
|
||||
++well_control_iteration;
|
||||
if (!well_control_passed && well_control_iteration > max_well_control_iterations) {
|
||||
THROW("Could not satisfy well conditions in " << max_well_control_iterations << " tries.");
|
||||
}
|
||||
if (!well_control_passed) {
|
||||
std::cout << "Well controls not passed, solving again." << std::endl;
|
||||
} else {
|
||||
std::cout << "Well conditions met." << std::endl;
|
||||
}
|
||||
}
|
||||
} while (!well_control_passed);
|
||||
|
||||
// Update pore volumes if rock is compressible.
|
||||
if (rock_comp->isActive()) {
|
||||
computePorevolume(*grid->c_grid(), props->porosity(), *rock_comp, state.pressure(), porevol);
|
||||
}
|
||||
|
||||
// Process transport sources (to include bdy terms and well flows).
|
||||
Opm::computeTransportSource(*grid->c_grid(), src, state.faceflux(), 1.0,
|
||||
wells->c_wells(), well_state.perfRates(), reorder_src);
|
||||
if (!use_reorder) {
|
||||
clear_transport_source(tsrc);
|
||||
for (int cell = 0; cell < num_cells; ++cell) {
|
||||
if (reorder_src[cell] > 0.0) {
|
||||
append_transport_source(cell, 2, 0, reorder_src[cell], ssrc, zdummy, tsrc);
|
||||
} else if (reorder_src[cell] < 0.0) {
|
||||
append_transport_source(cell, 2, 0, reorder_src[cell], ssink, zdummy, tsrc);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Solve transport.
|
||||
transport_timer.start();
|
||||
double stepsize = simtimer.currentStepLength();
|
||||
if (num_transport_substeps != 1) {
|
||||
stepsize /= double(num_transport_substeps);
|
||||
std::cout << "Making " << num_transport_substeps << " transport substeps." << std::endl;
|
||||
}
|
||||
for (int tr_substep = 0; tr_substep < num_transport_substeps; ++tr_substep) {
|
||||
if (use_reorder) {
|
||||
reorder_model.solve(&state.faceflux()[0], &porevol[0], &reorder_src[0],
|
||||
stepsize, state.saturation());
|
||||
Opm::computeInjectedProduced(*props, state.saturation(), reorder_src, stepsize, injected, produced);
|
||||
if (use_segregation_split) {
|
||||
if (use_column_solver) {
|
||||
if (use_gauss_seidel_gravity) {
|
||||
reorder_model.solveGravity(columns, &porevol[0], stepsize, state.saturation());
|
||||
} else {
|
||||
colsolver.solve(columns, stepsize, state.saturation());
|
||||
}
|
||||
} else {
|
||||
std::vector<double> fluxes = state.faceflux();
|
||||
std::fill(state.faceflux().begin(), state.faceflux().end(), 0.0);
|
||||
tsolver.solve(*grid->c_grid(), tsrc, stepsize, ctrl, state, linsolve, rpt);
|
||||
std::cout << rpt;
|
||||
state.faceflux() = fluxes;
|
||||
}
|
||||
}
|
||||
} else {
|
||||
tsolver.solve(*grid->c_grid(), tsrc, stepsize, ctrl, state, linsolve, rpt);
|
||||
std::cout << rpt;
|
||||
Opm::computeInjectedProduced(*props, state.saturation(), reorder_src, stepsize, injected, produced);
|
||||
}
|
||||
}
|
||||
transport_timer.stop();
|
||||
double tt = transport_timer.secsSinceStart();
|
||||
std::cout << "Transport solver took: " << tt << " seconds." << std::endl;
|
||||
ttime += tt;
|
||||
|
||||
// Report volume balances.
|
||||
Opm::computeSaturatedVol(porevol, state.saturation(), satvol);
|
||||
tot_injected[0] += injected[0];
|
||||
tot_injected[1] += injected[1];
|
||||
tot_produced[0] += produced[0];
|
||||
tot_produced[1] += produced[1];
|
||||
std::cout.precision(5);
|
||||
const int width = 18;
|
||||
std::cout << "\nVolume balance report (all numbers relative to total pore volume).\n";
|
||||
std::cout << " Saturated volumes: "
|
||||
<< std::setw(width) << satvol[0]/tot_porevol_init
|
||||
<< std::setw(width) << satvol[1]/tot_porevol_init << std::endl;
|
||||
std::cout << " Injected volumes: "
|
||||
<< std::setw(width) << injected[0]/tot_porevol_init
|
||||
<< std::setw(width) << injected[1]/tot_porevol_init << std::endl;
|
||||
std::cout << " Produced volumes: "
|
||||
<< std::setw(width) << produced[0]/tot_porevol_init
|
||||
<< std::setw(width) << produced[1]/tot_porevol_init << std::endl;
|
||||
std::cout << " Total inj volumes: "
|
||||
<< std::setw(width) << tot_injected[0]/tot_porevol_init
|
||||
<< std::setw(width) << tot_injected[1]/tot_porevol_init << std::endl;
|
||||
std::cout << " Total prod volumes: "
|
||||
<< std::setw(width) << tot_produced[0]/tot_porevol_init
|
||||
<< std::setw(width) << tot_produced[1]/tot_porevol_init << std::endl;
|
||||
std::cout << " In-place + prod - inj: "
|
||||
<< std::setw(width) << (satvol[0] + tot_produced[0] - tot_injected[0])/tot_porevol_init
|
||||
<< std::setw(width) << (satvol[1] + tot_produced[1] - tot_injected[1])/tot_porevol_init << std::endl;
|
||||
std::cout << " Init - now - pr + inj: "
|
||||
<< std::setw(width) << (init_satvol[0] - satvol[0] - tot_produced[0] + tot_injected[0])/tot_porevol_init
|
||||
<< std::setw(width) << (init_satvol[1] - satvol[1] - tot_produced[1] + tot_injected[1])/tot_porevol_init
|
||||
<< std::endl;
|
||||
std::cout.precision(8);
|
||||
|
||||
watercut.push(simtimer.currentTime() + simtimer.currentStepLength(),
|
||||
produced[0]/(produced[0] + produced[1]),
|
||||
tot_produced[0]/tot_porevol_init);
|
||||
if (wells->c_wells()) {
|
||||
wellreport.push(*props, *wells->c_wells(), state.saturation(),
|
||||
simtimer.currentTime() + simtimer.currentStepLength(),
|
||||
well_state.bhp(), well_state.perfRates());
|
||||
}
|
||||
}
|
||||
total_timer.stop();
|
||||
|
||||
std::cout << "\n\n================ End of simulation ===============\n"
|
||||
<< "Total time taken: " << total_timer.secsSinceStart()
|
||||
<< "\n Pressure time: " << ptime
|
||||
<< "\n Transport time: " << ttime << std::endl;
|
||||
|
||||
if (output) {
|
||||
outputState(*grid->c_grid(), state, simtimer, output_dir);
|
||||
outputWaterCut(watercut, output_dir);
|
||||
if (wells->c_wells()) {
|
||||
outputWellReport(wellreport, output_dir);
|
||||
}
|
||||
}
|
||||
|
||||
destroy_transport_source(tsrc);
|
||||
}
|
||||
@@ -1,22 +1,23 @@
|
||||
#include "config.h"
|
||||
#include <iostream>
|
||||
#include <opm/core/eclipse/EclipseGridParser.hpp>
|
||||
#include <opm/core/io/eclipse/EclipseGridParser.hpp>
|
||||
#include <opm/core/utility/parameters/ParameterGroup.hpp>
|
||||
|
||||
|
||||
#include <opm/core/utility/initState.hpp>
|
||||
#include <opm/core/simulator/initState.hpp>
|
||||
#include <opm/core/simulator/SimulatorTimer.hpp>
|
||||
#include <opm/core/wells/WellsManager.hpp>
|
||||
#include <opm/core/GridManager.hpp>
|
||||
#include <opm/core/grid/GridManager.hpp>
|
||||
#include <opm/core/pressure/IncompTpfa.hpp>
|
||||
#include <opm/core/fluid/IncompPropertiesFromDeck.hpp>
|
||||
#include <opm/core/newwells.h>
|
||||
#include <opm/core/props/IncompPropertiesFromDeck.hpp>
|
||||
#include <opm/core/wells.h>
|
||||
#include <opm/core/grid.h>
|
||||
#include <opm/core/utility/miscUtilities.hpp>
|
||||
#include <opm/core/simulator/TwophaseState.hpp>
|
||||
#include <opm/core/simulator/WellState.hpp>
|
||||
#include <opm/core/pressure/FlowBCManager.hpp>
|
||||
#include <opm/core/linalg/LinearSolverFactory.hpp>
|
||||
#include <opm/core/fluid/RockCompressibility.hpp>
|
||||
#include <opm/core/props/rock/RockCompressibility.hpp>
|
||||
|
||||
int main(int argc, char** argv)
|
||||
{
|
||||
|
||||
@@ -1,25 +0,0 @@
|
||||
prefix=@prefix@
|
||||
exec_prefix=@exec_prefix@
|
||||
libdir=@libdir@
|
||||
includedir=@includedir@
|
||||
|
||||
Name: @PACKAGE_NAME@
|
||||
Description: @PACKAGE_STRING@
|
||||
Version: @PACKAGE_VERSION@
|
||||
URL: @PACKAGE_URL@
|
||||
Libs: -L${libdir} -l@PACKAGE@ \
|
||||
@OPM_BOOST_LDFLAGS@ \
|
||||
@BOOST_FILESYSTEM_LIB@ \
|
||||
@BOOST_SYSTEM_LIB@ \
|
||||
@BOOST_DATE_TIME_LIB@ \
|
||||
@BOOST_UNIT_TEST_FRAMEWORK_LIB@ \
|
||||
@ERT_LDFLAGS@ \
|
||||
@ERT_LIBS@ \
|
||||
@LAPACK_LIBS@ \
|
||||
@SUPERLU_LIBS@ \
|
||||
@BLAS_LIBS@ \
|
||||
@LIBS@
|
||||
Cflags: -I${includedir} \
|
||||
@ERT_CPPFLAGS@ \
|
||||
@OPM_BOOST_CPPFLAGS@ \
|
||||
@SUPERLU_CPPFLAGS@
|
||||
@@ -3,7 +3,7 @@ AC_DEFUN([_ERT_SOURCE_TEXT],
|
||||
AC_LANG_PROGRAM(
|
||||
[[
|
||||
#include <stddef.h>
|
||||
#include <ecl_util.h>
|
||||
#include <ert/ecl/ecl_util.h>
|
||||
]],dnl
|
||||
[[
|
||||
int sz;
|
||||
@@ -30,7 +30,7 @@ AS_IF([test x"${with_ert}" != x"no"],
|
||||
|
||||
ERT_CPPFLAGS=
|
||||
ERT_LDFLAGS=
|
||||
ERT_LIBS="-lecl -lgeometry -lert_util -lpthread -lz -lgomp"
|
||||
ERT_LIBS="-lecl -lert_geometry -lert_util -lpthread -lz -lgomp"
|
||||
AS_IF([test x"${with_ert}" != x"yes"],
|
||||
[ERT_LDFLAGS="-L${with_ert}/lib"
|
||||
ERT_CPPFLAGS="-I${with_ert}/include"], [:])[]dnl
|
||||
|
||||
@@ -20,7 +20,7 @@
|
||||
# for my_slu_found=yes.
|
||||
# my_slu_found
|
||||
# Whether HEADER was found at all. Either "yes" or "no".
|
||||
AC_DEFUN([_slu_lib_path],
|
||||
AC_DEFUN([_opm_slu_lib_path],
|
||||
[
|
||||
my_include_path=include/superlu
|
||||
my_lib_path=lib
|
||||
@@ -58,13 +58,13 @@ AC_DEFUN([_slu_lib_path],
|
||||
# for my_slu_found=yes.
|
||||
# my_slu_found
|
||||
# Whether any of the headers. Either "yes" or "no".
|
||||
AC_DEFUN([_slu_search_versions],
|
||||
AC_DEFUN([_opm_slu_search_versions],
|
||||
[
|
||||
my_slu_header=slu_ddefs.h
|
||||
_slu_lib_path($1, $my_slu_header)
|
||||
_opm_slu_lib_path($1, $my_slu_header)
|
||||
if test "$my_slu_found" != "yes"; then
|
||||
my_slu_header="dsp_defs.h"
|
||||
_slu_lib_path($1, $my_slu_header)
|
||||
_opm_slu_lib_path($1, $my_slu_header)
|
||||
fi
|
||||
]
|
||||
)
|
||||
@@ -79,14 +79,14 @@ AC_DEFUN([_slu_search_versions],
|
||||
# Root of the SuperLU installation: first of "/usr" and "/usr/local".
|
||||
# Contents is only meaningful for my_slu_found=yes.
|
||||
# For other output variables see documentation of _slu_search_versions().
|
||||
AC_DEFUN([_slu_search_default],
|
||||
AC_DEFUN([_opm_slu_search_default],
|
||||
[
|
||||
with_superlu=/usr
|
||||
_slu_search_versions($with_superlu)
|
||||
opm_with_superlu=/usr
|
||||
_opm_slu_search_versions($opm_with_superlu)
|
||||
|
||||
if test "$my_slu_found" = "no"; then
|
||||
with_superlu=/usr/local
|
||||
_slu_search_versions($with_superlu)
|
||||
opm_with_superlu=/usr/local
|
||||
_opm_slu_search_versions($opm_with_superlu)
|
||||
fi
|
||||
]
|
||||
)
|
||||
@@ -156,18 +156,18 @@ AC_DEFUN([OPM_PATH_SUPERLU],[
|
||||
[dnl
|
||||
if test x"$withval" != xno ; then
|
||||
# get absolute path
|
||||
with_superlu=`eval cd $withval > /dev/null 2>&1 && pwd`
|
||||
if test x"$withval" = xyes; then
|
||||
# Search in default locations
|
||||
_slu_search_default
|
||||
_opm_slu_search_default
|
||||
else
|
||||
opm_with_superlu=`eval cd $withval > /dev/null 2>&1 && pwd`
|
||||
# Search for the headers in the specified location
|
||||
_slu_search_versions(["$with_superlu"])
|
||||
_opm_slu_search_versions(["$opm_with_superlu"])
|
||||
fi
|
||||
fi
|
||||
], [dnl
|
||||
# Search in default locations
|
||||
_slu_search_default
|
||||
_opm_slu_search_default
|
||||
])
|
||||
|
||||
AC_ARG_WITH([superlu-lib],
|
||||
@@ -200,10 +200,10 @@ AC_DEFUN([OPM_PATH_SUPERLU],[
|
||||
ac_save_LIBS="$LIBS"
|
||||
|
||||
# do nothing if --without-superlu is used
|
||||
if test x"$with_superlu" != x"no" ; then
|
||||
if test x"$opm_with_superlu" != x"no" ; then
|
||||
# defaultpath
|
||||
SUPERLU_LIB_PATH="$with_superlu/$my_lib_path"
|
||||
SUPERLU_INCLUDE_PATH="$with_superlu/$my_include_path"
|
||||
SUPERLU_LIB_PATH="$opm_with_superlu/$my_lib_path"
|
||||
SUPERLU_INCLUDE_PATH="$opm_with_superlu/$my_include_path"
|
||||
|
||||
# set variables so that tests can use them
|
||||
direct_SUPERLU_CPPFLAGS="-I$SUPERLU_INCLUDE_PATH -DENABLE_SUPERLU"
|
||||
@@ -274,7 +274,7 @@ AC_DEFUN([OPM_PATH_SUPERLU],[
|
||||
fi
|
||||
fi
|
||||
|
||||
else # $with_superlu = no
|
||||
else # $opm_with_superlu = no
|
||||
HAVE_SUPERLU=0
|
||||
fi
|
||||
|
||||
|
||||
@@ -1,37 +0,0 @@
|
||||
# - Open Porous Media Initiative Core Library config mode
|
||||
#
|
||||
# Defines the following variables:
|
||||
# opm-core_FOUND - true
|
||||
# opm-core_VERSION - version of the opm-core library found, e.g. 0.2
|
||||
# opm-core_DEFINITIONS - defines to be made on the command line
|
||||
# opm-core_INCLUDE_DIRS - header directories with which to compile
|
||||
# opm-core_LINKER_FLAGS - flags that must be passed to the linker
|
||||
# opm-core_LIBRARIES - names of the libraries with which to link
|
||||
# opm-core_LIBRARY_DIRS - directories in which the libraries are situated
|
||||
#
|
||||
# You should put lines like this in your CMakeLists.txt
|
||||
# set (opm-core_DIR "${PROJECT_BINARY_DIR}/../opm-core" CACHE LOCATION "Build tree of opm-core")
|
||||
# find_package (opm-core)
|
||||
|
||||
# <http://www.vtk.org/Wiki/CMake/Tutorials/How_to_create_a_ProjectConfig.cmake_file>
|
||||
|
||||
# propagate this property from one build system to the other
|
||||
set (opm-core_VERSION @PACKAGE_VERSION@)
|
||||
|
||||
# make the pkg-config portion of the configuration do the heavy lifting
|
||||
find_package (PkgConfig)
|
||||
set (ENV{PKG_CONFIG_PATH} "@abs_top_builddir@:$ENV{PKG_CONFIG_PATH}")
|
||||
pkg_check_modules (opm-core REQUIRED opm-core)
|
||||
|
||||
# these variables have non-standard names in FindPkgConfig (sic)
|
||||
set (opm-core_DEFINITIONS ${opm-core_CFLAGS_OTHER})
|
||||
set (opm-core_LINKER_FLAGS ${opm-core_LDFLAGS_OTHER})
|
||||
|
||||
# libraries come from the build tree where this file was generated
|
||||
find_library (opm-core_LOCATION NAMES "opmcore" PATHS "@abs_top_builddir@/lib/.libs")
|
||||
mark_as_advanced (opm-core_LOCATION)
|
||||
|
||||
# add the library as a target, so that other things in the project including
|
||||
# this file may depend on it and get rebuild if this library changes.
|
||||
add_library (opmcore UNKNOWN IMPORTED)
|
||||
set_property (TARGET opmcore PROPERTY IMPORTED_LOCATION "${opm-core_LOCATION}")
|
||||
@@ -1,32 +0,0 @@
|
||||
# This is the configuration for local builds. Use this by putting the
|
||||
# compilation output path (the directory in which you ran ./configure)
|
||||
# into the environment variable PKG_CONFIG_PATH. This will enable you
|
||||
# to use pkg-config in your code while making changes to opm-core.
|
||||
|
||||
# This is NOT the file that is installed in the system directories when
|
||||
# you do `make install`. That is the one in lib/pkgconfig. However, if
|
||||
# you make changes here, you should consider that one as well.
|
||||
|
||||
libdir=@abs_top_builddir@/lib/.libs
|
||||
includedir=@abs_top_srcdir@
|
||||
|
||||
Name: @PACKAGE_NAME@
|
||||
Description: @PACKAGE_STRING@
|
||||
Version: @PACKAGE_VERSION@
|
||||
URL: @PACKAGE_URL@
|
||||
Libs: -L${libdir} -l@PACKAGE@ \
|
||||
@OPM_BOOST_LDFLAGS@ \
|
||||
@BOOST_FILESYSTEM_LIB@ \
|
||||
@BOOST_SYSTEM_LIB@ \
|
||||
@BOOST_DATE_TIME_LIB@ \
|
||||
@BOOST_UNIT_TEST_FRAMEWORK_LIB@ \
|
||||
@ERT_LDFLAGS@ \
|
||||
@ERT_LIBS@ \
|
||||
@LAPACK_LIBS@ \
|
||||
@SUPERLU_LIBS@ \
|
||||
@BLAS_LIBS@ \
|
||||
@LIBS@
|
||||
Cflags: -I${includedir} \
|
||||
@ERT_CPPFLAGS@ \
|
||||
@OPM_BOOST_CPPFLAGS@ \
|
||||
@SUPERLU_CPPFLAGS@
|
||||
@@ -1,297 +0,0 @@
|
||||
/*
|
||||
Copyright 2010 SINTEF ICT, Applied Mathematics.
|
||||
|
||||
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_GRIDADAPTER_HEADER_INCLUDED
|
||||
#define OPM_GRIDADAPTER_HEADER_INCLUDED
|
||||
|
||||
|
||||
#include <opm/core/grid.h>
|
||||
#include <stdexcept>
|
||||
|
||||
class GridAdapter
|
||||
{
|
||||
public:
|
||||
/// @brief
|
||||
/// Initialize the grid.
|
||||
/// @tparam Grid This must conform to the SimpleGrid concept.
|
||||
/// @param grid The grid object.
|
||||
template <class Grid>
|
||||
void init(const Grid& grid)
|
||||
{
|
||||
buildTopology(grid);
|
||||
buildGeometry(grid);
|
||||
}
|
||||
|
||||
UnstructuredGrid* c_grid()
|
||||
{
|
||||
return &g_;
|
||||
}
|
||||
/// Access the underlying C grid.
|
||||
const UnstructuredGrid* c_grid() const
|
||||
{
|
||||
return &g_;
|
||||
}
|
||||
|
||||
// ------ Forwarding the same interface that init() expects ------
|
||||
//
|
||||
// This is only done in order to verify that init() works correctly.
|
||||
//
|
||||
|
||||
enum { dimension = 3 }; // This is actually a hack used for testing (dim is a runtime parameter).
|
||||
|
||||
struct Vector
|
||||
{
|
||||
explicit Vector(const double* source)
|
||||
{
|
||||
for (int i = 0; i < dimension; ++i) {
|
||||
data[i] = source[i];
|
||||
}
|
||||
}
|
||||
double& operator[] (const int ix)
|
||||
{
|
||||
return data[ix];
|
||||
}
|
||||
double operator[] (const int ix) const
|
||||
{
|
||||
return data[ix];
|
||||
}
|
||||
double data[dimension];
|
||||
};
|
||||
|
||||
// Topology
|
||||
int numCells() const
|
||||
{
|
||||
return g_.number_of_cells;
|
||||
}
|
||||
int numFaces() const
|
||||
{
|
||||
return g_.number_of_faces;
|
||||
}
|
||||
int numVertices() const
|
||||
{
|
||||
return g_.number_of_nodes;
|
||||
}
|
||||
|
||||
int numCellFaces(int cell) const
|
||||
{
|
||||
return cell_facepos_[cell + 1] - cell_facepos_[cell];
|
||||
}
|
||||
int cellFace(int cell, int local_index) const
|
||||
{
|
||||
return cell_faces_[cell_facepos_[cell] + local_index];
|
||||
}
|
||||
int faceCell(int face, int local_index) const
|
||||
{
|
||||
return face_cells_[2*face + local_index];
|
||||
}
|
||||
int numFaceVertices(int face) const
|
||||
{
|
||||
return face_nodepos_[face + 1] - face_nodepos_[face];
|
||||
}
|
||||
int faceVertex(int face, int local_index) const
|
||||
{
|
||||
return face_nodes_[face_nodepos_[face] + local_index];
|
||||
}
|
||||
|
||||
// Geometry
|
||||
Vector vertexPosition(int vertex) const
|
||||
{
|
||||
return Vector(&node_coordinates_[g_.dimensions*vertex]);
|
||||
}
|
||||
double faceArea(int face) const
|
||||
{
|
||||
return face_areas_[face];
|
||||
}
|
||||
Vector faceCentroid(int face) const
|
||||
{
|
||||
return Vector(&face_centroids_[g_.dimensions*face]);
|
||||
}
|
||||
Vector faceNormal(int face) const
|
||||
{
|
||||
Vector fn(&face_normals_[g_.dimensions*face]);
|
||||
// We must renormalize since the stored normals are
|
||||
// 'unit normal * face area'.
|
||||
double invfa = 1.0 / faceArea(face);
|
||||
for (int i = 0; i < dimension; ++i) {
|
||||
fn[i] *= invfa;
|
||||
}
|
||||
return fn;
|
||||
}
|
||||
double cellVolume(int cell) const
|
||||
{
|
||||
return cell_volumes_[cell];
|
||||
}
|
||||
Vector cellCentroid(int cell) const
|
||||
{
|
||||
return Vector(&cell_centroids_[g_.dimensions*cell]);
|
||||
}
|
||||
|
||||
bool operator==(const GridAdapter& other)
|
||||
{
|
||||
return face_nodes_ == other.face_nodes_
|
||||
&& face_nodepos_ == other.face_nodepos_
|
||||
&& face_cells_ == other.face_cells_
|
||||
&& cell_faces_ == other.cell_faces_
|
||||
&& cell_facepos_ == other.cell_facepos_
|
||||
&& node_coordinates_ == other.node_coordinates_
|
||||
&& face_centroids_ == other.face_centroids_
|
||||
&& face_areas_ == other.face_areas_
|
||||
&& face_normals_ == other.face_normals_
|
||||
&& cell_centroids_ == other.cell_centroids_
|
||||
&& cell_volumes_ == other.cell_volumes_;
|
||||
}
|
||||
// make a grid which looks periodic but do not have 2 half faces for each
|
||||
// periodic boundary
|
||||
void makeQPeriodic(const std::vector<int>& hf_ind,const std::vector<int>& periodic_cells){
|
||||
for(int i=0; i<int(hf_ind.size());++i){
|
||||
//std::array<int,2> cells;
|
||||
int& cell0=face_cells_[2*cell_faces_[ hf_ind[i] ]+0];
|
||||
int& cell1=face_cells_[2*cell_faces_[ hf_ind[i] ]+1];
|
||||
assert(periodic_cells[2*i+1]>=0);
|
||||
if(periodic_cells[2*i+0] == cell0){
|
||||
assert(cell1==-1);
|
||||
cell1=periodic_cells[2*i+1];
|
||||
}else{
|
||||
assert(periodic_cells[2*i+0] == cell1);
|
||||
assert(cell0==-1);
|
||||
cell0=periodic_cells[2*i+1];
|
||||
}
|
||||
}
|
||||
}
|
||||
private:
|
||||
UnstructuredGrid g_;
|
||||
// Topology storage.
|
||||
std::vector<int> face_nodes_;
|
||||
std::vector<int> face_nodepos_;
|
||||
std::vector<int> face_cells_;
|
||||
std::vector<int> cell_faces_;
|
||||
std::vector<int> cell_facepos_;
|
||||
// Geometry storage.
|
||||
std::vector<double> node_coordinates_;
|
||||
std::vector<double> face_centroids_;
|
||||
std::vector<double> face_areas_;
|
||||
std::vector<double> face_normals_;
|
||||
std::vector<double> cell_centroids_;
|
||||
std::vector<double> cell_volumes_;
|
||||
|
||||
/// Build (copy of) topological structure from grid.
|
||||
template <class Grid>
|
||||
void buildTopology(const Grid& grid)
|
||||
{
|
||||
// Face topology.
|
||||
int num_cells = grid.numCells();
|
||||
int num_faces = grid.numFaces();
|
||||
face_nodepos_.resize(num_faces + 1);
|
||||
int facenodecount = 0;
|
||||
for (int f = 0; f < num_faces; ++f) {
|
||||
face_nodepos_[f] = facenodecount;
|
||||
facenodecount += grid.numFaceVertices(f);
|
||||
}
|
||||
face_nodepos_.back() = facenodecount;
|
||||
face_nodes_.resize(facenodecount);
|
||||
for (int f = 0; f < num_faces; ++f) {
|
||||
for (int local = 0; local < grid.numFaceVertices(f); ++local) {
|
||||
face_nodes_[face_nodepos_[f] + local] = grid.faceVertex(f, local);
|
||||
}
|
||||
}
|
||||
face_cells_.resize(2*num_faces);
|
||||
for (int f = 0; f < num_faces; ++f) {
|
||||
face_cells_[2*f] = grid.faceCell(f, 0);
|
||||
face_cells_[2*f + 1] = grid.faceCell(f, 1);
|
||||
}
|
||||
|
||||
// Cell topology.
|
||||
int cellfacecount = 0;
|
||||
cell_facepos_.resize(num_cells + 1);
|
||||
for (int c = 0; c < num_cells; ++c) {
|
||||
cell_facepos_[c] = cellfacecount;
|
||||
cellfacecount += grid.numCellFaces(c);
|
||||
}
|
||||
cell_facepos_.back() = cellfacecount;
|
||||
cell_faces_.resize(cellfacecount);
|
||||
for (int c = 0; c < num_cells; ++c) {
|
||||
for (int local = 0; local < grid.numCellFaces(c); ++local) {
|
||||
cell_faces_[cell_facepos_[c] + local] = grid.cellFace(c, local);
|
||||
}
|
||||
}
|
||||
|
||||
// Set C grid members.
|
||||
g_.dimensions = Grid::dimension;
|
||||
g_.number_of_cells = grid.numCells();
|
||||
g_.number_of_faces = grid.numFaces();
|
||||
g_.number_of_nodes = grid.numVertices();
|
||||
g_.face_nodes = &face_nodes_[0];
|
||||
g_.face_nodepos = &face_nodepos_[0];
|
||||
g_.face_cells = &face_cells_[0];
|
||||
g_.cell_faces = &cell_faces_[0];
|
||||
g_.cell_facepos = &cell_facepos_[0];
|
||||
}
|
||||
|
||||
|
||||
/// Build (copy of) geometric properties of grid.
|
||||
/// Assumes that buildTopology() has been called.
|
||||
template <class Grid>
|
||||
void buildGeometry(const Grid& grid)
|
||||
{
|
||||
// Node geometry.
|
||||
int num_cells = grid.numCells();
|
||||
int num_nodes = grid.numVertices();
|
||||
int num_faces = grid.numFaces();
|
||||
int dim = Grid::dimension;
|
||||
node_coordinates_.resize(dim*num_nodes);
|
||||
for (int n = 0; n < num_nodes; ++n) {
|
||||
for (int dd = 0; dd < dim; ++dd) {
|
||||
node_coordinates_[dim*n + dd] = grid.vertexPosition(n)[dd];
|
||||
}
|
||||
}
|
||||
|
||||
// Face geometry.
|
||||
face_centroids_.resize(dim*num_faces);
|
||||
face_areas_.resize(num_faces);
|
||||
face_normals_.resize(dim*num_faces);
|
||||
for (int f = 0; f < num_faces; ++f) {
|
||||
face_areas_[f] = grid.faceArea(f);
|
||||
for (int dd = 0; dd < dim; ++dd) {
|
||||
face_centroids_[dim*f + dd] = grid.faceCentroid(f)[dd];
|
||||
face_normals_[dim*f + dd] = grid.faceNormal(f)[dd]*face_areas_[f];
|
||||
}
|
||||
}
|
||||
|
||||
// Cell geometry.
|
||||
cell_centroids_.resize(dim*num_cells);
|
||||
cell_volumes_.resize(num_cells);
|
||||
for (int c = 0; c < num_cells; ++c) {
|
||||
cell_volumes_[c] = grid.cellVolume(c);
|
||||
for (int dd = 0; dd < dim; ++dd) {
|
||||
cell_centroids_[dim*c + dd] = grid.cellCentroid(c)[dd];
|
||||
}
|
||||
}
|
||||
|
||||
// Set C grid members.
|
||||
g_.node_coordinates = &node_coordinates_[0];
|
||||
g_.face_centroids = &face_centroids_[0];
|
||||
g_.face_areas = &face_areas_[0];
|
||||
g_.face_normals = &face_normals_[0];
|
||||
g_.cell_centroids = &cell_centroids_[0];
|
||||
g_.cell_volumes = &cell_volumes_[0];
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
#endif // OPM_GRIDADAPTER_HEADER_INCLUDED
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user