Skip to content
Snippets Groups Projects

Compare revisions

Changes are shown as if the source revision was being merged into the target revision. Learn more about comparing revisions.

Source

Select target project
No results found

Target

Select target project
  • iwr/amdis
  • backofen/amdis
  • aland/amdis
3 results
Show changes
Showing
with 1707 additions and 0 deletions
macro(enable_umfpack _FLAGS_ _INC_DIRS_ _LIBS_)
if (${ARGC} GREATER 3)
set(LINK_EXECUTABLE ON)
else ()
set(LINK_EXECUTABLE OFF)
endif ()
if (WIN32)
set(SuiteSparse_USE_LAPACK_BLAS ON)
endif (WIN32)
if (SuiteSparse_DIR)
file(TO_CMAKE_PATH ${SuiteSparse_DIR} SuiteSparse_DIR)
endif (SuiteSparse_DIR)
# try to use a cmake-package of suitesparse
find_package(SuiteSparse QUIET HINTS ${AMDIS_SuiteSparse_DIR})
if (SuiteSparse_FOUND)
message(STATUS "Found SuiteSparse CMake-library")
include(${USE_SuiteSparse})
if (LINK_EXECUTABLE)
list(APPEND ${_LIBS_} ${SuiteSparse_LIBRARIES})
endif (LINK_EXECUTABLE)
list(APPEND ${_INC_DIRS_} ${SuiteSparse_INCLUDE_DIR} ${SuiteSparse_METIS_INCLUDE_DIR})
set(FOUND_SUITESPARSE_LIBS ${SuiteSparse_LIBRARIES})
else (SuiteSparse_FOUND)
# find umfpack manually by searching for umfpack.h header file
find_library(UMFPACK_LIBRARY umfpack
HINTS ${AMDIS_UMFPACK_LIB_DIR} ${SUITESPARSE_LIB} $ENV{SUITESPARSE_LIB}
DOC "Library file for UMFPACK")
find_file(UMFPACK_H umfpack.h
HINTS ${AMDIS_UMFPACK_INCLUDE_DIR} ${SUITESPARSE_INC} $ENV{SUITESPARSE_INC} ENV CPATH /usr/include /usr/include/suitesparse /usr/include/ufsparse
DOC "Headerfile umfpack.h for UMFPACK")
if (UMFPACK_H AND UMFPACK_LIBRARY)
get_filename_component(UMFPACK_PATH ${UMFPACK_H} PATH)
list(APPEND ${_INC_DIRS_} ${UMFPACK_PATH})
get_filename_component(UMFPACK_LIB_PATH ${UMFPACK_LIBRARY} PATH)
set(FOUND_SUITESPARSE_LIBS ${UMFPACK_LIBRARY})
if (LINK_EXECUTABLE)
# find all connected libraries
find_library(AMD_LIBRARY amd HINTS ${UMFPACK_LIB_PATH})
find_library(BLAS_LIB
NAMES blas fblas openblas
HINTS ${BLAS_DIR}/lib ${UMFPACK_LIB_PATH} /usr/lib/openblas-base /usr/lib/atlas-base)
if (BLAS_LIB)
set(BLAS_LIBRARIES ${BLAS_LIB})
else (BLAS_LIB)
find_package(BLAS REQUIRED)
endif (BLAS_LIB)
find_library(CHOLMOD_LIBRARY cholmod HINTS ${UMFPACK_LIB_PATH})
find_library(COLAMD_LIBRARY colamd HINTS ${UMFPACK_LIB_PATH})
find_library(SUITESPARSECONFIG_LIBRARY suitesparseconfig HINTS ${UMFPACK_LIB_PATH})
if (AMD_LIBRARY AND BLAS_LIBRARIES)
list(APPEND FOUND_SUITESPARSE_LIBS ${AMD_LIBRARY} ${BLAS_LIBRARIES})
endif (AMD_LIBRARY AND BLAS_LIBRARIES)
if (CHOLMOD_LIBRARY)
list(APPEND FOUND_SUITESPARSE_LIBS ${CHOLMOD_LIBRARY})
endif (CHOLMOD_LIBRARY)
if (COLAMD_LIBRARY)
list(APPEND FOUND_SUITESPARSE_LIBS ${COLAMD_LIBRARY})
endif (COLAMD_LIBRARY)
if (SUITESPARSECONFIG_LIBRARY)
list(APPEND FOUND_SUITESPARSE_LIBS ${SUITESPARSECONFIG_LIBRARY})
endif (SUITESPARSECONFIG_LIBRARY)
list(APPEND ${_LIBS_} ${FOUND_SUITESPARSE_LIBS})
endif (LINK_EXECUTABLE)
else()
message(FATAL_ERROR "Could not find the UMFPACK header umfpack.h.")
endif (UMFPACK_H AND UMFPACK_LIBRARY)
endif (SuiteSparse_FOUND)
# Check for clock_gettime in librt
if (NOT WIN32 AND LINK_EXECUTABLE)
include(CheckLibraryExists)
check_library_exists(rt clock_gettime "time.h" HAVE_CLOCK_GETTIME)
if (HAVE_CLOCK_GETTIME)
list(APPEND ${_LIBS_} rt)
else ()
check_library_exists(c clock_gettime "" HAVE_CLOCK_GETTIME)
endif (HAVE_CLOCK_GETTIME)
endif (NOT WIN32 AND LINK_EXECUTABLE)
# collect informations about umfpack version and found libraries
if (FOUND_SUITESPARSE_LIBS)
find_file(_UMFPACK_H umfpack.h PATHS ${SuiteSparse_INCLUDE_DIR} ${UMFPACK_PATH} NO_DEFAULT_PATH)
file(STRINGS ${_UMFPACK_H} UMFPACK_VERSION_LINE REGEX "#define UMFPACK_VERSION")
string(REGEX MATCH "\"UMFPACK V?([^\"]+)\"" UMFPACK_VERSION_REGEX ${UMFPACK_VERSION_LINE})
set(UMFPACK_VERSION ${CMAKE_MATCH_1})
unset(_UMFPACK_H CACHE)
message(STATUS "UMFPACK version: ${UMFPACK_VERSION}")
if (LINK_EXECUTABLE)
message(STATUS "Found the following SuiteSparse libraries:")
foreach (lib ${FOUND_SUITESPARSE_LIBS})
message(STATUS " ${lib}")
endforeach ()
endif (LINK_EXECUTABLE)
endif (FOUND_SUITESPARSE_LIBS)
list(APPEND ${_FLAGS_} "-DHAVE_UMFPACK=1" "-DMTL_HAS_UMFPACK=1")
endmacro(enable_umfpack)
include(parse_zoltan_makefile)
macro(enable_zoltan _FLAGS_ _INC_DIRS_ _LIBS_)
if (${ARGC} GREATER 3)
set(LINK_EXECUTABLE ON)
else ()
set(LINK_EXECUTABLE OFF)
endif ()
find_package(Zoltan QUIET)
if (Zoltan_FOUND)
find_file(ZOLTAN_HEADER_FILE "zoltan.h" PATHS ${Zoltan_INCLUDE_DIRS})
list(APPEND ${_INC_DIRS_} ${Zoltan_INCLUDE_DIRS})
if (LINK_EXECUTABLE)
foreach (LIB_NAME ${Zoltan_LIBRARIES})
find_library(_ZOLTAN_LIB ${LIB_NAME} HINTS ${Zoltan_LIBRARY_DIRS})
if (NOT _ZOLTAN_LIB)
message(FATAL_ERROR "Could not find library \"${LIB_NAME}\" in directories ${Zoltan_LIBRARY_DIRS}!")
else ()
list(APPEND ${_LIBS_} ${_ZOLTAN_LIB})
endif ()
unset(_ZOLTAN_LIB CACHE)
endforeach(LIB_NAME)
endif (LINK_EXECUTABLE)
else (Zoltan_FOUND)
find_file(ZOLTAN_HEADER_FILE "zoltan.h" HINTS ${ZOLTAN_DIR}/include ${PETSC_INCLUDE_DIRS})
if (ZOLTAN_HEADER_FILE)
get_filename_component(ZOLTAN_HEADER_DIR "${ZOLTAN_HEADER_FILE}" PATH CACHE)
list(APPEND ${_INC_DIRS_} ${ZOLTAN_HEADER_DIR})
else()
message(FATAL_ERROR "Could not find Zoltan include file 'zoltan_cpp.h'!")
endif(ZOLTAN_HEADER_FILE)
if (LINK_EXECUTABLE)
find_library(ZOLTAN_LIB zoltan
HINTS ENV LIBRARY_PATH DOC "Full path to the zoltan library")
if (NOT ZOLTAN_LIB)
message(FATAL_ERROR "Could not find zoltan library!")
endif (NOT ZOLTAN_LIB)
list(APPEND ${_LIBS_} ${ZOLTAN_LIB})
find_file(ZOLTAN_CONFIG_FILE "Makefile.export.zoltan" HINTS ${ZOLTAN_HEADER_DIR})
if (ZOLTAN_CONFIG_FILE)
parse_zoltan_makefile(${ZOLTAN_CONFIG_FILE} ${_TARGET_} ${_SCOPE_})
else ()
message(WARNING "Zoltan configuration file Makefile.export.zoltan not found!")
endif ()
endif (LINK_EXECUTABLE)
endif (Zoltan_FOUND)
if (ZOLTAN_HEADER_FILE)
file(STRINGS ${ZOLTAN_HEADER_FILE} ZOLTAN_VERSION_LINE REGEX "#define ZOLTAN_VERSION_NUMBER")
string(REGEX MATCH "([0-9]+[.][0-9]+)" ZOLTAN_VERSION_REGEX ${ZOLTAN_VERSION_LINE})
set(ZOLTAN_VERSION ${CMAKE_MATCH_1})
unset(ZOLTAN_HEADER_FILE CACHE)
message(STATUS "Zoltan version: ${ZOLTAN_VERSION}")
endif (ZOLTAN_HEADER_FILE)
list(APPEND ${_FLAGS_} "-DHAVE_ZOLTAN=1")
endmacro(enable_zoltan)
# specify the target and requirements for the muparser library
set(MUPARSER_SOURCE_DIR ${BASE_DIR}/lib/muparser_v134/src)
set(MUPARSER_INCLUDE_DIR ${BASE_DIR}/lib/muparser_v134/include)
add_library(muparser STATIC
${MUPARSER_SOURCE_DIR}/muParser.cpp
${MUPARSER_SOURCE_DIR}/muParserBase.cpp
${MUPARSER_SOURCE_DIR}/muParserBytecode.cpp
${MUPARSER_SOURCE_DIR}/muParserCallback.cpp
${MUPARSER_SOURCE_DIR}/muParserComplex.cpp
${MUPARSER_SOURCE_DIR}/muParserDLL.cpp
${MUPARSER_SOURCE_DIR}/muParserError.cpp
${MUPARSER_SOURCE_DIR}/muParserInt.cpp
${MUPARSER_SOURCE_DIR}/muParserTest.cpp
${MUPARSER_SOURCE_DIR}/muParserTokenReader.cpp)
include_directories(${MUPARSER_INCLUDE_DIR})
set_property(TARGET muparser PROPERTY POSITION_INDEPENDENT_CODE ON)
if (ENABLE_CXX11)
add_definitions(-DAMDIS_HAS_CXX11=1)
endif (ENABLE_CXX11)
# specify how to install this target:
# -----------------------------------
file(GLOB MUPARSER_HEADERS "${MUPARSER_SOURCE_DIR}/include/*.h")
install(FILES ${MUPARSER_HEADERS}
DESTINATION include/amdis/muparser)
install(TARGETS muparser
DESTINATION lib/amdis/ )
macro(parse_zoltan_makefile _FILE_ _LIBS_)
file(STRINGS ${_FILE_} ZOLTAN_MAKEFILE_LINE REGEX "ZOLTAN_EXTRA_LIBS")
get_filename_component(ZOLTAN_MAKEFILE_DIR "${ZOLTAN_MAKEFILE}" PATH CACHE)
string(STRIP "${ZOLTAN_MAKEFILE_LINE}" LINE)
if ("${LINE}" MATCHES "^ZOLTAN_EXTRA_LIBS[ ]*=[ ]*([a-zA-Z0-9_/. -]+)$")
string(REGEX REPLACE " " ";" ZOLTAN_EXTRA_LIBS_LIST "${CMAKE_MATCH_1}")
set(ZOLTAN_LIB_DIRS "")
foreach(LIBS ${ZOLTAN_EXTRA_LIBS_LIST})
string(STRIP "${LIBS}" LIBS)
string(SUBSTRING "${LIBS}" 0 2 LIB_PREFIX)
string(SUBSTRING "${LIBS}" 2 -1 LIB_NAME)
if ("${LIB_PREFIX}" STREQUAL "-L")
list(APPEND ZOLTAN_LIB_DIRS ${LIB_NAME})
elseif ("${LIB_PREFIX}" STREQUAL "-l")
find_library(_ZOLTAN_EXTERN_LIB ${LIB_NAME} HINTS ${ZOLTAN_LIB_DIRS})
if (NOT _ZOLTAN_EXTERN_LIB)
message(FATAL_ERROR "Could not find library \"${LIB_NAME}\" in directories ${ZOLTAN_LIB_DIRS}!")
else ()
list(APPEND ${_LIBS_} ${_ZOLTAN_EXTERN_LIB})
endif ()
unset(_ZOLTAN_EXTERN_LIB CACHE)
else ()
message(WARNING "Unknown link parameter \"${LIBS}\"")
endif ()
endforeach (LIBS)
endif()
endmacro(parse_zoltan_makefile)
set(AMDIS_NEED_UMFPACK @ENABLE_UMFPACK@)
set(AMDIS_NEED_COMPRESSION @ENABLE_COMPRESSION@)
set(AMDIS_NEED_EXTENSIONS @ENABLE_EXTENSIONS@)
set(AMDIS_NEED_BASE_PROBLEMS @ENABLE_BASE_PROBLEMS@)
set(AMDIS_NEED_REINIT @ENABLE_REINIT@)
set(AMDIS_NEED_COMPOSITE_FEM @ENABLE_COMPOSITE_FEM@)
set(AMDIS_NEED_ZOLTAN @ENABLE_ZOLTAN@)
set(AMDIS_NEED_BDDCML @ENABLE_BDDCML@)
set(AMDIS_NEED_HYPRE @ENABLE_HYPRE@)
set(AMDIS_NEED_PNG @ENABLE_PNG@)
set(AMDIS_NEED_SEQ_PETSC @ENABLE_SEQ_PETSC@)
set(BUILD_SHARED_LIBS @BUILD_SHARED_LIBS@)
add_library(amdis_base INTERFACE)
add_library(AMDiS ALIAS amdis_base)
target_compile_definitions(amdis_base INTERFACE)
target_enable_cxx14(SUPPORTS_CXX14 amdis_base INTERFACE)
if (NOT SUPPORTS_CXX14)
target_enable_cxx11(SUPPORTS_CXX11 amdis_base INTERFACE)
endif ()
if (NOT SUPPORTS_CXX11 AND NOT SUPPORTS_CXX14)
message(FATAL_ERROR "AMDiS was compiled with c++11 support, but the current compiler does not support this feature!")
endif ()
target_compile_definitions(amdis_base INTERFACE AMDIS_HAS_CXX11=1)
# try to detect the AMDiS include directory
# -------------------------------------------
find_file(_AMDIS_H AMDiS.h PATHS ${AMDIS_DIR}/../../include/amdis/)
if (_AMDIS_H)
get_filename_component(AMDIS_INCLUDE_DIR ${_AMDIS_H} PATH CACHE)
target_include_directories(amdis_base INTERFACE ${AMDIS_INCLUDE_DIR})
else ()
message(FATAL_ERROR "Could not detect the AMDiS include directory. Please set the variable AMDIS_INCLUDE_DIR to the directory containing the AMDiS headers.")
endif ()
unset(_AMDIS_H CACHE)
# MTL4 libraries
# --------------------
target_enable_mtl4(amdis_base INTERFACE ON)
# AMDiS base libraries
# --------------------
find_library(_AMDIS_LIB amdis${POSTFIX} PATHS ${AMDIS_DIR}/../../lib/amdis/)
find_library(_AMDIS_LIBD amdis${POSTFIX}d PATHS ${AMDIS_DIR}/../../lib/amdis/) # debug version
if (_AMDIS_LIB)
target_link_libraries(amdis_base INTERFACE optimized ${_AMDIS_LIB})
endif ()
if (_AMDIS_LIBD)
target_link_libraries(amdis_base INTERFACE debug ${_AMDIS_LIBD})
endif ()
if (NOT(_AMDIS_LIB OR _AMDIS_LIBD))
message(FATAL_ERROR "Could not detect the AMDiS${POSTFIX} library. Please set the variable _AMDIS_LIB to the AMDiS${POSTFIX} library.")
endif ()
# Boost libraries
# ---------------
if (NOT BOOST_ROOT)
set(BOOST_ROOT @BOOST_ROOT@)
endif (NOT BOOST_ROOT)
if (NOT BOOST_LIBRARYDIR)
set(BOOST_LIBRARYDIR @BOOST_LIBRARYDIR@)
endif (NOT BOOST_LIBRARYDIR)
target_enable_boost(amdis_base INTERFACE ON)
# umfpack library
# --------------------
if (AMDIS_NEED_UMFPACK)
set(AMDIS_SuiteSparse_DIR @SuiteSparse_DIR@)
set(AMDIS_UMFPACK_ROOT_DIR @UMFPACK_ROOT_DIR@)
target_enable_umfpack(amdis_base INTERFACE ON)
endif (AMDIS_NEED_UMFPACK)
# amdis extensions
# ----------------
if (AMDIS_NEED_EXTENSIONS)
find_library(_EXTENSIONS_LIB amdisextensions${POSTFIX} PATHS ${AMDIS_DIR}/../../lib/amdis/)
find_library(_EXTENSIONS_LIBD amdisextensions${POSTFIX}d PATHS ${AMDIS_DIR}/../../lib/amdis/) # debug version
if (_EXTENSIONS_LIB OR _EXTENSIONS_LIBD)
target_include_directories(amdis_base INTERFACE
${AMDIS_INCLUDE_DIR}/extensions
${AMDIS_INCLUDE_DIR}/extensions/nanoflann
${AMDIS_INCLUDE_DIR}/extensions/pugixml
${AMDIS_INCLUDE_DIR}/extensions/time)
target_compile_definitions(amdis_base INTERFACE HAVE_EXTENSIONS=1)
if (AMDIS_NEED_BASE_PROBLEMS)
target_include_directories(amdis_base INTERFACE ${AMDIS_INCLUDE_DIR}/extensions/base_problems)
endif (AMDIS_NEED_BASE_PROBLEMS)
else ()
message(FATAL_ERROR "Extensions library not found")
endif ()
if (_EXTENSIONS_LIB)
target_link_libraries(amdis_base INTERFACE optimized ${_EXTENSIONS_LIB})
endif ()
if (_EXTENSIONS_LIBD)
target_link_libraries(amdis_base INTERFACE debug ${_EXTENSIONS_LIBD})
endif ()
endif (AMDIS_NEED_EXTENSIONS)
# reinit library
# --------------
if (AMDIS_NEED_REINIT)
find_library(_REINIT_LIB amdisreinit${POSTFIX} PATHS ${AMDIS_DIR}/../../lib/amdis/)
find_library(_REINIT_LIBD amdisreinit${POSTFIX}d PATHS ${AMDIS_DIR}/../../lib/amdis/) # debug version
if (_REINIT_LIB OR _REINIT_LIBD)
target_include_directories(amdis_base INTERFACE ${AMDIS_INCLUDE_DIR}/reinit)
else ()
message(FATAL_ERROR "Reinit library not found")
endif ()
if (_REINIT_LIB)
target_link_libraries(amdis_base INTERFACE optimized ${_REINIT_LIB})
endif ()
if (_REINIT_LIBD)
target_link_libraries(amdis_base INTERFACE debug ${_REINIT_LIBD})
endif ()
endif (AMDIS_NEED_REINIT)
# compositeFEM library
# --------------------
if (AMDIS_NEED_COMPOSITE_FEM)
find_library(_COMPOSITE_FEM_LIB amdiscompositefem${POSTFIX} PATHS ${AMDIS_DIR}/../../lib/amdis/)
find_library(_COMPOSITE_FEM_LIBD amdiscompositefem${POSTFIX}d PATHS ${AMDIS_DIR}/../../lib/amdis/) # debug version
if (_COMPOSITE_FEM_LIB OR _COMPOSITE_FEM_LIBD)
target_include_directories(amdis_base INTERFACE ${AMDIS_INCLUDE_DIR}/compositeFEM)
else ()
message(FATAL_ERROR "CompositeFEM library not found")
endif ()
if (_COMPOSITE_FEM_LIB)
target_link_libraries(amdis_base INTERFACE optimized ${_COMPOSITE_FEM_LIB})
endif ()
if (_COMPOSITE_FEM_LIBD)
target_link_libraries(amdis_base INTERFACE debug ${_COMPOSITE_FEM_LIBD})
endif ()
endif (AMDIS_NEED_COMPOSITE_FEM)
# muparser library
# --------------------
find_library(_MUPARSER_LIB muparser PATHS ${AMDIS_DIR}/../../lib/amdis/)
if (_MUPARSER_LIB)
target_include_directories(amdis_base INTERFACE ${AMDIS_INCLUDE_DIR}/muparser)
target_link_libraries(amdis_base INTERFACE ${_MUPARSER_LIB})
else ()
message(FATAL_ERROR "MuParser library not found")
endif ()
unset(_MUPARSER_LIB CACHE)
# Additional libraries
# ==============================================================================
# Parallel amdis
# --------------
if (AMDIS_HAS_PARALLEL_DOMAIN)
target_enable_mpi(amdis_base INTERFACE ON)
target_enable_petsc(amdis_base INTERFACE ON)
target_compile_definitions(amdis_base INTERFACE
HAVE_PARALLEL_DOMAIN_AMDIS=1)
endif (AMDIS_HAS_PARALLEL_DOMAIN)
# Zoltan library
# --------------
if (AMDIS_NEED_ZOLTAN)
if (NOT DEFINED ZOLTAN_DIR)
set(ZOLTAN_DIR "@ZOLTAN_DIR@")
endif ()
target_enable_zoltan(amdis_base INTERFACE ON)
endif ()
# BSSCML library
# --------------
if (AMDIS_NEED_BDDCML)
target_enable_bddcml(amdis_base INTERFACE ON)
endif ()
# Hypre library
# --------------
if (AMDIS_NEED_HYPRE)
target_enable_hypre(amdis_base INTERFACE ON)
endif ()
# PNG library
# --------------
if (AMDIS_NEED_PNG)
target_enable_png(amdis_base INTERFACE ON)
endif ()
# Sequential PETSc library
# --------------
if (AMDIS_NEED_SEQ_PETSC AND NOT AMDIS_HAS_PARALLEL_DOMAIN)
target_enable_mpi(amdis_base INTERFACE ON)
target_enable_petsc(amdis_base INTERFACE ON)
target_compile_definitions(amdis_base INTERFACE HAVE_SEQ_PETSC=1)
endif ()
# ==============================================================================
# Extract some variables from INTERFACE target AMDiS
get_target_property(AMDIS_INCLUDE_DIRS AMDiS INTERFACE_INCLUDE_DIRECTORIES)
get_target_property(AMDIS_LIBRARIES AMDiS INTERFACE_LINK_LIBRARIES)
get_target_property(AMDIS_COMPILEFLAGS AMDiS INTERFACE_COMPILE_OPTIONS)
if (NOT AMDIS_COMPILEFLAGS)
set(AMDIS_COMPILEFLAGS "")
endif()
get_target_property(_DEFINITIONS AMDiS INTERFACE_COMPILE_DEFINITIONS)
foreach(defn ${_DEFINITIONS})
list(APPEND AMDIS_COMPILEFLAGS "-D${defn}")
endforeach(defn)
# This configuration file is shipped with the FEM-Toolbox AMDiS.
# It simplifies the configure of different amdis-versions.
#
# We set the following variables:
# AMDIS_INCLUDE_DIRS all include directories (mtl, umfpack, parmetis, metis, ...)
# AMDIS_LIBRARIES the needed libraries
# AMDiS_COMPILEFLAGS some compile flags for amdis
#
# Use this package in the following way:
#
# find_package(AMDiS REQUIRED [PARALLEL|SEQUENTIAL])
# add_executable(yourTarget <yourSources>)
# include_directories(${AMDIS_INCLUDE_DIRS})
# compile_definitions(${AMDIS_COMPILEFLAGS})
# target_link_libraries(yourTarget ${AMDIS_LIBRARIES})
#
# Or directly link against target AMDiS:
#
# find_package(AMDiS REQUIRED [ [PARALLEL|SEQUENTIAL] ])
# add_executable(yourTarget <yourSources>)
# target_link_libraries(yourTarget AMDiS)
#
# The default component for this package is SEQUENTIAL DEBUG.
#
if (${CMAKE_VERSION} VERSION_LESS "3.2")
message(FATAL_ERROR "The Configuration file was created for CMake version >= 3.2")
endif ()
list(APPEND CMAKE_MODULE_PATH ${AMDIS_DIR})
set(IS_AMDISCONFIG true)
set(AMDIS_USE_FILE ${AMDIS_DIR}/AMDISUse.cmake)
# Include macros
include(target_enable_cxx11)
include(target_enable_mtl4)
include(target_enable_boost)
include(target_enable_umfpack)
include(target_enable_petsc)
include(target_enable_zoltan)
include(target_enable_bddcml)
include(target_enable_hypre)
include(target_enable_png)
# enable components
# -----------------
if (AMDIS_FIND_REQUIRED_PARALLEL AND AMDIS_FIND_REQUIRED_SEQUENTIAL)
message(WARNING "Choose either SEQUENTIAL or PARALLEL as component, not both! Falling back to the default SEQUENTIAL.")
set(AMDIS_FIND_REQUIRED_PARALLEL OFF)
endif ()
set(AMDIS_CONFIGURATION "")
# parallel of sequential version
if (AMDIS_FIND_REQUIRED_PARALLEL)
set(AMDIS_HAS_PARALLEL_DOMAIN ON)
set(POSTFIX "-p")
list(APPEND AMDIS_CONFIGURATION "PARALLEL")
else ()
set(AMDIS_HAS_PARALLEL_DOMAIN OFF)
set(POSTFIX "-s")
list(APPEND AMDIS_CONFIGURATION "SEQUENTIAL")
endif ()
if (MSVC)
add_definitions(-DNOMINMAX -D_CONSOLE -DSTRICT -D_SCL_SECURE_NO_WARNINGS -D_CRT_SECURE_NO_WARNINGS)
endif (MSVC)
if (NOT EXISTS ${AMDIS_DIR}/AMDIS${POSTFIX}.cmake)
message(FATAL_ERROR "Configuration ${AMDIS_CONFIGURATION} can not be found in ${AMDIS_DIR}.")
endif ()
# include component configuration
include(AMDIS${POSTFIX})
# globally add compile options and include directories
add_definitions(${AMDIS_COMPILEFLAGS})
include_directories(${AMDIS_INCLUDE_DIRS})
cmake_minimum_required(VERSION 3.2 FATAL_ERROR)
project(AMDiS VERSION 1.1 LANGUAGES CXX)
list(APPEND CMAKE_MODULE_PATH ${BASE_DIR}/cmake3)
# Include macros
include(target_enable_cxx11)
include(target_enable_mtl4)
include(target_enable_boost)
include(target_enable_umfpack)
include(target_enable_petsc)
include(target_enable_zoltan)
include(target_enable_bddcml)
include(target_enable_hypre)
include(target_enable_png)
# ------------------------------------------------------------------------------
# define an interface-library for flags and compile-definitions
add_library(amdis_base INTERFACE)
add_library(AMDiS::base ALIAS amdis_base)
target_include_directories(amdis_base INTERFACE ${SOURCE_DIR})
target_compile_definitions(amdis_base INTERFACE)
target_enable_cxx14(SUPPORTS_CXX14 amdis_base INTERFACE)
if (SUPPORTS_CXX14)
target_compile_definitions(amdis_base INTERFACE AMDIS_HAS_CXX14=1)
else ()
target_enable_cxx11(SUPPORTS_CXX11 amdis_base INTERFACE)
endif ()
if (NOT SUPPORTS_CXX11 AND NOT SUPPORTS_CXX14)
message(FATAL_ERROR "AMDiS needs c++11 support, but the current compiler does not support this feature!")
endif ()
target_compile_definitions(amdis_base INTERFACE AMDIS_HAS_CXX11=1)
target_enable_mtl4(amdis_base INTERFACE)
target_enable_boost(amdis_base INTERFACE)
if (ENABLE_UMFPACK)
target_enable_umfpack(amdis_base INTERFACE)
endif (ENABLE_UMFPACK)
if (ENABLE_PNG)
target_enable_png(amdis_base INTERFACE)
endif (ENABLE_PNG)
# ------------------------------------------------------------------------------
add_library(amdis
${SOURCE_DIR}/AdaptBase.cc
${SOURCE_DIR}/AdaptInfo.cc
${SOURCE_DIR}/AdaptInstationary.cc
${SOURCE_DIR}/AdaptStationary.cc
${SOURCE_DIR}/AMDiS.cc
${SOURCE_DIR}/Assembler.cc
${SOURCE_DIR}/BasisFunction.cc
${SOURCE_DIR}/Boundary.cc
${SOURCE_DIR}/BoundaryManager.cc
${SOURCE_DIR}/BoundaryObject.cc
${SOURCE_DIR}/Bubble.cc
${SOURCE_DIR}/Cholesky.cc
${SOURCE_DIR}/CoarseningManager.cc
${SOURCE_DIR}/CoarseningManager1d.cc
${SOURCE_DIR}/CoarseningManager2d.cc
${SOURCE_DIR}/CoarseningManager3d.cc
${SOURCE_DIR}/ComponentTraverseInfo.cc
${SOURCE_DIR}/CouplingIterationInterface.cc
${SOURCE_DIR}/CreatorMap.cc
${SOURCE_DIR}/DOFAdmin.cc
${SOURCE_DIR}/DOFIndexed.cc
${SOURCE_DIR}/DOFMatrix.cc
${SOURCE_DIR}/DOFSerializer.cc
${SOURCE_DIR}/DOFVector.cc
${SOURCE_DIR}/DirichletBC.cc
${SOURCE_DIR}/DualTraverse.cc
${SOURCE_DIR}/ElInfo.cc
${SOURCE_DIR}/ElInfo1d.cc
${SOURCE_DIR}/ElInfo2d.cc
${SOURCE_DIR}/ElInfo3d.cc
${SOURCE_DIR}/ElInfoStack.cc
${SOURCE_DIR}/Element.cc
${SOURCE_DIR}/ElementData.cc
${SOURCE_DIR}/ElementDofIterator.cc
${SOURCE_DIR}/ElementRegion_ED.cc
${SOURCE_DIR}/FiniteElemSpace.cc
${SOURCE_DIR}/FirstOrderAssembler.cc
${SOURCE_DIR}/FirstOrderTerm.cc
${SOURCE_DIR}/FixVec.cc
${SOURCE_DIR}/Global.cc
${SOURCE_DIR}/Initfile.cc
${SOURCE_DIR}/Lagrange.cc
${SOURCE_DIR}/LeafData.cc
${SOURCE_DIR}/Line.cc
${SOURCE_DIR}/MacroElement.cc
${SOURCE_DIR}/Marker.cc
${SOURCE_DIR}/MatrixVector.cc
${SOURCE_DIR}/Mesh.cc
${SOURCE_DIR}/MeshStructure.cc
${SOURCE_DIR}/Operator.cc
${SOURCE_DIR}/OperatorTerm.cc
${SOURCE_DIR}/Parametric.cc
${SOURCE_DIR}/PeriodicBC.cc
${SOURCE_DIR}/ProblemInstat.cc
${SOURCE_DIR}/ProblemInterpol.cc
${SOURCE_DIR}/ProblemStat.cc
${SOURCE_DIR}/Projection.cc
${SOURCE_DIR}/QPInfo.cc
${SOURCE_DIR}/QPsiPhi.cc
${SOURCE_DIR}/Quadrature.cc
${SOURCE_DIR}/RCNeighbourList.cc
${SOURCE_DIR}/Recovery.cc
${SOURCE_DIR}/RefinementManager.cc
${SOURCE_DIR}/RefinementManager1d.cc
${SOURCE_DIR}/RefinementManager2d.cc
${SOURCE_DIR}/RefinementManager3d.cc
${SOURCE_DIR}/RobinBC.cc
${SOURCE_DIR}/ScalableQuadrature.cc
${SOURCE_DIR}/SecondOrderAssembler.cc
${SOURCE_DIR}/SecondOrderTerm.cc
${SOURCE_DIR}/Serializer.cc
${SOURCE_DIR}/StandardProblemIteration.cc
${SOURCE_DIR}/SubAssembler.cc
${SOURCE_DIR}/SubElInfo.cc
${SOURCE_DIR}/SubQuadrature.cc
${SOURCE_DIR}/SurfaceQuadrature.cc
${SOURCE_DIR}/SurfaceRegion_ED.cc
${SOURCE_DIR}/SystemVector.cc
${SOURCE_DIR}/Tetrahedron.cc
${SOURCE_DIR}/Timer.cc
${SOURCE_DIR}/Traverse.cc
${SOURCE_DIR}/Triangle.cc
${SOURCE_DIR}/VertexVector.cc
${SOURCE_DIR}/ZeroOrderAssembler.cc
${SOURCE_DIR}/ZeroOrderTerm.cc
${SOURCE_DIR}/est/Estimator.cc
${SOURCE_DIR}/est/RecoveryEstimator.cc
${SOURCE_DIR}/est/ResidualEstimator.cc
${SOURCE_DIR}/est/SimpleResidualEstimator.cc
${SOURCE_DIR}/io/ArhReader.cc
${SOURCE_DIR}/io/detail/ArhReader.cc
${SOURCE_DIR}/io/Arh2Reader.cc
${SOURCE_DIR}/io/Arh2Writer.cc
${SOURCE_DIR}/io/Arh3Reader.cc
${SOURCE_DIR}/io/Arh3Writer.cc
${SOURCE_DIR}/io/detail/Arh2Reader.cc
${SOURCE_DIR}/io/detail/ArhWriter.cc
${SOURCE_DIR}/io/detail/Arh2Writer.cc
${SOURCE_DIR}/io/detail/Arh3Reader.cc
${SOURCE_DIR}/io/detail/Arh3Writer.cc
${SOURCE_DIR}/io/DofWriter.cc
${SOURCE_DIR}/io/ElementFileWriter.cc
${SOURCE_DIR}/io/FileWriterInterface.cc
${SOURCE_DIR}/io/FileWriter.cc
${SOURCE_DIR}/io/GNUPlotWriter.cc
${SOURCE_DIR}/io/MacroInfo.cc
${SOURCE_DIR}/io/MacroReader.cc
${SOURCE_DIR}/io/MacroWriter.cc
${SOURCE_DIR}/io/PngReader.cc
${SOURCE_DIR}/io/PngWriter.cc
${SOURCE_DIR}/io/PovrayWriter.cc
${SOURCE_DIR}/io/Spreadsheet.cc
${SOURCE_DIR}/io/ValueReader.cc
${SOURCE_DIR}/io/ValueWriter.cc
${SOURCE_DIR}/io/VtkWriter.cc
${SOURCE_DIR}/io/VtkVectorWriter.cc
${SOURCE_DIR}/io/detail/VtkWriter.cc
${SOURCE_DIR}/nonlin/ProblemNonLin.cc
${SOURCE_DIR}/solver/SolverMatrix.cc
${SOURCE_DIR}/time/RosenbrockAdaptInstationary.cc
${SOURCE_DIR}/time/RosenbrockMethod.cc
${SOURCE_DIR}/time/RosenbrockStationary.cc
# debugging files
${SOURCE_DIR}/Debug.cc
${SOURCE_DIR}/GlobalDOFNumbering.cc # not used by any other class
${SOURCE_DIR}/GlobalElementNumbering.cc # not used by any other class
${SOURCE_DIR}/ProblemStatDbg.cc
)
if (ENABLE_MPI)
target_enable_mpi(amdis_base INTERFACE)
target_compile_definitions(amdis_base INTERFACE HAVE_MPI=1)
endif (ENABLE_MPI)
include(amdis_parallel) # adds sources to amdis
include(amdis_extensions) # -> target AMDiS::extensions
include(muparser) # -> target muparser
# ------------------------------------------------------------------------------
if (ENABLE_COMPRESSION)
target_compile_definitions(amdis PRIVATE AMDIS_HAS_COMPRESSION=1)
endif (ENABLE_COMPRESSION)
if (ENABLE_REINIT)
include(amdis_reinit) # -> target AMDiS::reinit
endif (ENABLE_REINIT)
if (ENABLE_COMPOSITE_FEM)
include(amdis_compositeFEM) # -> target AMDiS::compositeFEM
endif (ENABLE_COMPOSITE_FEM)
if (ENABLE_SEQ_PETSC)
include(amdis_seq_petsc) # -> target AMDiS::seq_petsc
endif (ENABLE_SEQ_PETSC)
# ------------------------------------------------------------------------------
target_link_libraries(amdis AMDiS::base muparser)
# specify how to install this target:
# -----------------------------------
set(INSTALL_SUBDIRS . config nonlin est expressions operations traits
utility time solver solver/details solver/itl io io/detail)
foreach (SUBDIR ${INSTALL_SUBDIRS})
file(GLOB HEADERS "${SOURCE_DIR}/${SUBDIR}/*.h*")
install(FILES ${HEADERS} DESTINATION include/amdis/${SUBDIR}/)
endforeach ()
file(GLOB CMAKE_MACROS "${BASE_DIR}/cmake3/target_enable_*.cmake")
install(FILES ${CMAKE_MACROS} DESTINATION share/amdis/)
install(FILES ${BASE_DIR}/cmake3/parse_zoltan_makefile.cmake DESTINATION share/amdis/)
install(DIRECTORY ${BASE_DIR}/lib/mtl4/ DESTINATION include/amdis/mtl4/
FILES_MATCHING PATTERN "*.hpp"
PATTERN ".svn" EXCLUDE
PATTERN ".svn/*" EXCLUDE
PATTERN "mtl4/libs" EXCLUDE
PATTERN "mtl4/extern" EXCLUDE)
set_target_properties(amdis PROPERTIES OUTPUT_NAME amdis${POSTFIX}
DEBUG_OUTPUT_NAME amdis${POSTFIX}d)
install(TARGETS amdis DESTINATION lib/amdis/ )
# generate configuration file:
# ----------------------------
# global configuration
configure_file(${BASE_DIR}/cmake3/AMDISConfig.cmake.in
${AMDiS_BINARY_DIR}/AMDISConfig.cmake
@ONLY
)
# component configuration
configure_file(${BASE_DIR}/cmake3/AMDIS.cmake.in
${AMDiS_BINARY_DIR}/AMDIS${POSTFIX}.cmake
@ONLY
)
install(FILES ${AMDiS_BINARY_DIR}/AMDISConfig.cmake DESTINATION share/amdis/)
install(FILES ${AMDiS_BINARY_DIR}/AMDIS${POSTFIX}.cmake DESTINATION share/amdis/)
install(FILES ${BASE_DIR}/cmake3/AMDISUse.cmake DESTINATION share/amdis/)
# CorrectWindowsPaths - this module defines one macro
#
# CONVERT_CYGWIN_PATH( PATH )
# This uses the command cygpath (provided by cygwin) to convert
# unix-style paths into paths useable by cmake on windows
macro (CONVERT_CYGWIN_PATH _path)
if (WIN32)
EXECUTE_PROCESS(COMMAND cygpath.exe -m ${${_path}}
OUTPUT_VARIABLE ${_path})
string (STRIP ${${_path}} ${_path})
endif (WIN32)
endmacro (CONVERT_CYGWIN_PATH)
# - Try to find PETSc
# Once done this will define
#
# PETSC_FOUND - system has PETSc
# PETSC_INCLUDES - the PETSc include directories
# PETSC_LIBRARIES - Link these to use PETSc
# PETSC_COMPILER - Compiler used by PETSc, helpful to find a compatible MPI
# PETSC_DEFINITIONS - Compiler switches for using PETSc
# PETSC_MPIEXEC - Executable for running MPI programs
# PETSC_VERSION - Version string (MAJOR.MINOR.SUBMINOR)
#
# Usage:
# find_package(PETSc COMPONENTS CXX) - required if build --with-clanguage=C++ --with-c-support=0
# find_package(PETSc COMPONENTS C) - standard behavior of checking build using a C compiler
# find_package(PETSc) - same as above
#
# Setting these changes the behavior of the search
# PETSC_DIR - directory in which PETSc resides
# PETSC_ARCH - build architecture
#
# Redistribution and use is allowed according to the terms of the BSD license.
# For details see the accompanying COPYING-CMAKE-SCRIPTS file.
#
set(PETSC_VALID_COMPONENTS
C
CXX)
if(NOT PETSc_FIND_COMPONENTS)
set(PETSC_LANGUAGE_BINDINGS "C")
else()
# Right now, this is designed for compatability with the --with-clanguage option, so
# only allow one item in the components list.
list(LENGTH ${PETSc_FIND_COMPONENTS} components_length)
if(${components_length} GREATER 1)
message(FATAL_ERROR "Only one component for PETSc is allowed to be specified")
endif()
# This is a stub for allowing multiple components should that time ever come. Perhaps
# to also test Fortran bindings?
foreach(component ${PETSc_FIND_COMPONENTS})
list(FIND PETSC_VALID_COMPONENTS ${component} component_location)
if(${component_location} EQUAL -1)
message(FATAL_ERROR "\"${component}\" is not a valid PETSc component.")
else()
list(APPEND PETSC_LANGUAGE_BINDINGS ${component})
endif()
endforeach()
endif()
function (petsc_get_version)
if (EXISTS "${PETSC_DIR}/include/petscversion.h")
file (STRINGS "${PETSC_DIR}/include/petscversion.h" vstrings REGEX "#define PETSC_VERSION_(RELEASE|MAJOR|MINOR|SUBMINOR|PATCH) ")
foreach (line ${vstrings})
string (REGEX REPLACE " +" ";" fields ${line}) # break line into three fields (the first is always "#define")
list (GET fields 1 var)
list (GET fields 2 val)
set (${var} ${val} PARENT_SCOPE)
set (${var} ${val}) # Also in local scope so we have access below
endforeach ()
if (PETSC_VERSION_RELEASE)
set (PETSC_VERSION "${PETSC_VERSION_MAJOR}.${PETSC_VERSION_MINOR}.${PETSC_VERSION_SUBMINOR}p${PETSC_VERSION_PATCH}" PARENT_SCOPE)
else ()
# make dev version compare higher than any patch level of a released version
set (PETSC_VERSION "${PETSC_VERSION_MAJOR}.${PETSC_VERSION_MINOR}.${PETSC_VERSION_SUBMINOR}.99" PARENT_SCOPE)
endif ()
else ()
message (SEND_ERROR "PETSC_DIR can not be used, ${PETSC_DIR}/include/petscversion.h does not exist")
endif ()
endfunction ()
find_path (PETSC_DIR include/petsc.h
HINTS /usr/lib/petsc ENV PETSC_DIR
PATHS
# Debian paths
/usr/lib/petscdir/3.5.1 /usr/lib/petscdir/3.5
/usr/lib/petscdir/3.4.2 /usr/lib/petscdir/3.4
/usr/lib/petscdir/3.3 /usr/lib/petscdir/3.2 /usr/lib/petscdir/3.1
/usr/lib/petscdir/3.0.0 /usr/lib/petscdir/2.3.3 /usr/lib/petscdir/2.3.2
# MacPorts path
/opt/local/lib/petsc
$ENV{HOME}/petsc
DOC "PETSc Directory")
find_program (MAKE_EXECUTABLE NAMES make gmake)
if (PETSC_DIR AND NOT PETSC_ARCH)
set (_petsc_arches
$ENV{PETSC_ARCH} # If set, use environment variable first
linux-gnu-c-debug linux-gnu-c-opt # Debian defaults
x86_64-unknown-linux-gnu i386-unknown-linux-gnu)
set (petscconf "NOTFOUND" CACHE FILEPATH "Cleared" FORCE)
foreach (arch ${_petsc_arches})
if (NOT PETSC_ARCH)
find_path (petscconf petscconf.h
HINTS ${PETSC_DIR}
PATH_SUFFIXES ${arch}/include bmake/${arch}
NO_DEFAULT_PATH)
if (petscconf)
set (PETSC_ARCH "${arch}" CACHE STRING "PETSc build architecture")
endif (petscconf)
endif (NOT PETSC_ARCH)
endforeach (arch)
set (petscconf "NOTFOUND" CACHE INTERNAL "Scratch variable" FORCE)
endif (PETSC_DIR AND NOT PETSC_ARCH)
set (petsc_slaves LIBRARIES_SYS LIBRARIES_VEC LIBRARIES_MAT LIBRARIES_DM LIBRARIES_KSP LIBRARIES_SNES LIBRARIES_TS
INCLUDE_DIR INCLUDE_CONF)
include (FindPackageMultipass)
find_package_multipass (PETSc petsc_config_current
STATES DIR ARCH
DEPENDENTS INCLUDES LIBRARIES COMPILER MPIEXEC ${petsc_slaves})
# Determine whether the PETSc layout is old-style (through 2.3.3) or
# new-style (>= 3.0.0)
if (EXISTS "${PETSC_DIR}/${PETSC_ARCH}/lib/petsc/conf/petscvariables") # > 3.5
set (petsc_conf_rules "${PETSC_DIR}/lib/petsc/conf/rules")
set (petsc_conf_variables "${PETSC_DIR}/lib/petsc/conf/variables")
elseif (EXISTS "${PETSC_DIR}/${PETSC_ARCH}/include/petscconf.h") # > 2.3.3
set (petsc_conf_rules "${PETSC_DIR}/conf/rules")
set (petsc_conf_variables "${PETSC_DIR}/conf/variables")
elseif (EXISTS "${PETSC_DIR}/bmake/${PETSC_ARCH}/petscconf.h") # <= 2.3.3
set (petsc_conf_rules "${PETSC_DIR}/bmake/common/rules")
set (petsc_conf_variables "${PETSC_DIR}/bmake/common/variables")
elseif (PETSC_DIR)
message (SEND_ERROR "The pair PETSC_DIR=${PETSC_DIR} PETSC_ARCH=${PETSC_ARCH} do not specify a valid PETSc installation")
endif ()
if (petsc_conf_rules AND petsc_conf_variables AND NOT petsc_config_current)
petsc_get_version()
# Put variables into environment since they are needed to get
# configuration (petscvariables) in the PETSc makefile
set (ENV{PETSC_DIR} "${PETSC_DIR}")
set (ENV{PETSC_ARCH} "${PETSC_ARCH}")
# A temporary makefile to probe the PETSc configuration
set (petsc_config_makefile "${PROJECT_BINARY_DIR}/Makefile.petsc")
file (WRITE "${petsc_config_makefile}"
"## This file was autogenerated by FindPETSc.cmake
# PETSC_DIR = ${PETSC_DIR}
# PETSC_ARCH = ${PETSC_ARCH}
include ${petsc_conf_rules}
include ${petsc_conf_variables}
show :
\t-@echo -n \${\${VARIABLE}}
")
macro (PETSC_GET_VARIABLE name var)
set (${var} "NOTFOUND" CACHE INTERNAL "Cleared" FORCE)
execute_process (COMMAND ${MAKE_EXECUTABLE} --no-print-directory -f ${petsc_config_makefile} show VARIABLE=${name}
OUTPUT_VARIABLE ${var}
RESULT_VARIABLE petsc_return)
endmacro (PETSC_GET_VARIABLE)
petsc_get_variable (PETSC_LIB_DIR petsc_lib_dir)
petsc_get_variable (PETSC_EXTERNAL_LIB_BASIC petsc_libs_external)
petsc_get_variable (PETSC_CCPPFLAGS petsc_cpp_line)
petsc_get_variable (PETSC_INCLUDE petsc_include)
petsc_get_variable (PCC petsc_cc)
petsc_get_variable (PCC_FLAGS petsc_cc_flags)
petsc_get_variable (MPIEXEC petsc_mpiexec)
# We are done with the temporary Makefile, calling PETSC_GET_VARIABLE after this point is invalid!
file (REMOVE ${petsc_config_makefile})
include (ResolveCompilerPaths)
# Extract include paths and libraries from compile command line
resolve_includes (petsc_includes_all "${petsc_cpp_line}")
#on windows we need to make sure we're linking against the right
#runtime library
if (WIN32)
if (petsc_cc_flags MATCHES "-MT")
set(using_md False)
foreach(flag_var
CMAKE_C_FLAGS CMAKE_C_FLAGS_DEBUG CMAKE_C_FLAGS_RELEASE
CMAKE_C_FLAGS_MINSIZEREL CMAKE_C_FLAGS_RELWITHDEBINFO
CMAKE_CXX_FLAGS CMAKE_CXX_FLAGS_DEBUG CMAKE_CXX_FLAGS_RELEASE
CMAKE_CXX_FLAGS_MINSIZEREL CMAKE_CXX_FLAGS_RELWITHDEBINFO)
if(${flag_var} MATCHES "/MD")
set(using_md True)
endif(${flag_var} MATCHES "/MD")
endforeach(flag_var)
if(${using_md} MATCHES "True")
message(WARNING "PETSc was built with /MT, but /MD is currently set.
See http://www.cmake.org/Wiki/CMake_FAQ#How_can_I_build_my_MSVC_application_with_a_static_runtime.3F")
endif(${using_md} MATCHES "True")
endif (petsc_cc_flags MATCHES "-MT")
endif (WIN32)
include (CorrectWindowsPaths)
convert_cygwin_path(petsc_lib_dir)
message (STATUS "petsc_lib_dir ${petsc_lib_dir}")
macro (PETSC_FIND_LIBRARY suffix name)
set (PETSC_LIBRARY_${suffix} "NOTFOUND" CACHE INTERNAL "Cleared" FORCE) # Clear any stale value, if we got here, we need to find it again
if (WIN32)
set (libname lib${name}) #windows expects "libfoo", linux expects "foo"
else (WIN32)
set (libname ${name})
endif (WIN32)
find_library (PETSC_LIBRARY_${suffix} NAMES ${libname} HINTS ${petsc_lib_dir} NO_DEFAULT_PATH)
set (PETSC_LIBRARIES_${suffix} "${PETSC_LIBRARY_${suffix}}")
mark_as_advanced (PETSC_LIBRARY_${suffix})
endmacro (PETSC_FIND_LIBRARY suffix name)
# Look for petscvec first, if it doesn't exist, we must be using single-library
petsc_find_library (VEC petscvec)
if (PETSC_LIBRARY_VEC)
petsc_find_library (SYS "petscsys;petsc") # libpetscsys is called libpetsc prior to 3.1 (when single-library was introduced)
petsc_find_library (MAT petscmat)
petsc_find_library (DM petscdm)
petsc_find_library (KSP petscksp)
petsc_find_library (SNES petscsnes)
petsc_find_library (TS petscts)
macro (PETSC_JOIN libs deps)
list (APPEND PETSC_LIBRARIES_${libs} ${PETSC_LIBRARIES_${deps}})
endmacro (PETSC_JOIN libs deps)
petsc_join (VEC SYS)
petsc_join (MAT VEC)
petsc_join (DM MAT)
petsc_join (KSP DM)
petsc_join (SNES KSP)
petsc_join (TS SNES)
petsc_join (ALL TS)
else ()
set (PETSC_LIBRARY_VEC "NOTFOUND" CACHE INTERNAL "Cleared" FORCE) # There is no libpetscvec
petsc_find_library (SINGLE petsc)
foreach (pkg SYS VEC MAT DM KSP SNES TS ALL)
set (PETSC_LIBRARIES_${pkg} "${PETSC_LIBRARY_SINGLE}")
endforeach ()
endif ()
if (PETSC_LIBRARY_TS)
message (STATUS "Recognized PETSc install with separate libraries for each package")
else ()
message (STATUS "Recognized PETSc install with single library for all packages")
endif ()
include(Check${PETSC_LANGUAGE_BINDINGS}SourceRuns)
macro (PETSC_TEST_RUNS includes libraries runs)
if(${PETSC_LANGUAGE_BINDINGS} STREQUAL "C")
set(_PETSC_ERR_FUNC "CHKERRQ(ierr)")
elseif(${PETSC_LANGUAGE_BINDINGS} STREQUAL "CXX")
set(_PETSC_ERR_FUNC "CHKERRXX(ierr)")
endif()
if (PETSC_VERSION VERSION_GREATER 3.1)
set (_PETSC_TSDestroy "TSDestroy(&ts)")
else ()
set (_PETSC_TSDestroy "TSDestroy(ts)")
endif ()
set(_PETSC_TEST_SOURCE "
static const char help[] = \"PETSc test program.\";
#include <petscts.h>
int main(int argc,char *argv[]) {
PetscErrorCode ierr;
TS ts;
ierr = PetscInitialize(&argc,&argv,0,help);${_PETSC_ERR_FUNC};
ierr = TSCreate(PETSC_COMM_WORLD,&ts);${_PETSC_ERR_FUNC};
ierr = TSSetFromOptions(ts);${_PETSC_ERR_FUNC};
ierr = ${_PETSC_TSDestroy};${_PETSC_ERR_FUNC};
ierr = PetscFinalize();${_PETSC_ERR_FUNC};
return 0;
}
")
multipass_source_runs ("${includes}" "${libraries}" "${_PETSC_TEST_SOURCE}" ${runs} "${PETSC_LANGUAGE_BINDINGS}")
if (${${runs}})
set (PETSC_EXECUTABLE_RUNS "YES" CACHE BOOL
"Can the system successfully run a PETSc executable? This variable can be manually set to \"YES\" to force CMake to accept a given PETSc configuration, but this will almost always result in a broken build. If you change PETSC_DIR, PETSC_ARCH, or PETSC_CURRENT you would have to reset this variable." FORCE)
endif (${${runs}})
endmacro (PETSC_TEST_RUNS)
find_path (PETSC_INCLUDE_DIR petscts.h HINTS "${PETSC_DIR}" PATH_SUFFIXES include NO_DEFAULT_PATH)
find_path (PETSC_INCLUDE_CONF petscconf.h HINTS "${PETSC_DIR}" PATH_SUFFIXES "${PETSC_ARCH}/include" "bmake/${PETSC_ARCH}" NO_DEFAULT_PATH)
mark_as_advanced (PETSC_INCLUDE_DIR PETSC_INCLUDE_CONF)
set (petsc_includes_minimal ${PETSC_INCLUDE_CONF} ${PETSC_INCLUDE_DIR})
petsc_test_runs ("${petsc_includes_minimal}" "${PETSC_LIBRARIES_TS}" petsc_works_minimal)
if (petsc_works_minimal)
message (STATUS "Minimal PETSc includes and libraries work. This probably means we are building with shared libs.")
set (petsc_includes_needed "${petsc_includes_minimal}")
else (petsc_works_minimal) # Minimal includes fail, see if just adding full includes fixes it
petsc_test_runs ("${petsc_includes_all}" "${PETSC_LIBRARIES_TS}" petsc_works_allincludes)
if (petsc_works_allincludes) # It does, we just need all the includes (
message (STATUS "PETSc requires extra include paths, but links correctly with only interface libraries. This is an unexpected configuration (but it seems to work fine).")
set (petsc_includes_needed ${petsc_includes_all})
else (petsc_works_allincludes) # We are going to need to link the external libs explicitly
resolve_libraries (petsc_libraries_external "${petsc_libs_external}")
foreach (pkg SYS VEC MAT DM KSP SNES TS ALL)
list (APPEND PETSC_LIBRARIES_${pkg} ${petsc_libraries_external})
endforeach (pkg)
petsc_test_runs ("${petsc_includes_minimal}" "${PETSC_LIBRARIES_TS}" petsc_works_alllibraries)
if (petsc_works_alllibraries)
message (STATUS "PETSc only need minimal includes, but requires explicit linking to all dependencies. This is expected when PETSc is built with static libraries.")
set (petsc_includes_needed ${petsc_includes_minimal})
else (petsc_works_alllibraries)
# It looks like we really need everything, should have listened to Matt
set (petsc_includes_needed ${petsc_includes_all})
petsc_test_runs ("${petsc_includes_all}" "${PETSC_LIBRARIES_TS}" petsc_works_all)
if (petsc_works_all) # We fail anyways
message (STATUS "PETSc requires extra include paths and explicit linking to all dependencies. This probably means you have static libraries and something unexpected in PETSc headers.")
else (petsc_works_all) # We fail anyways
message (STATUS "PETSc could not be used, maybe the install is broken.")
endif (petsc_works_all)
endif (petsc_works_alllibraries)
endif (petsc_works_allincludes)
endif (petsc_works_minimal)
# We do an out-of-source build so __FILE__ will be an absolute path, hence __INSDIR__ is superfluous
if (${PETSC_VERSION} VERSION_LESS 3.1)
set (PETSC_DEFINITIONS "-D__SDIR__=\"\"" CACHE STRING "PETSc definitions" FORCE)
else ()
set (PETSC_DEFINITIONS "-D__INSDIR__=" CACHE STRING "PETSc definitions" FORCE)
endif ()
# Sometimes this can be used to assist FindMPI.cmake
set (PETSC_MPIEXEC ${petsc_mpiexec} CACHE FILEPATH "Executable for running PETSc MPI programs" FORCE)
set (PETSC_INCLUDES ${petsc_includes_needed} CACHE STRING "PETSc include path" FORCE)
set (PETSC_LIBRARIES ${PETSC_LIBRARIES_ALL} CACHE STRING "PETSc libraries" FORCE)
set (PETSC_COMPILER ${petsc_cc} CACHE FILEPATH "PETSc compiler" FORCE)
# Note that we have forced values for all these choices. If you
# change these, you are telling the system to trust you that they
# work. It is likely that you will end up with a broken build.
mark_as_advanced (PETSC_INCLUDES PETSC_LIBRARIES PETSC_COMPILER PETSC_DEFINITIONS PETSC_MPIEXEC PETSC_EXECUTABLE_RUNS)
endif ()
include (FindPackageHandleStandardArgs)
find_package_handle_standard_args (PETSc
"PETSc could not be found. Be sure to set PETSC_DIR and PETSC_ARCH."
PETSC_INCLUDES PETSC_LIBRARIES PETSC_EXECUTABLE_RUNS)
# PackageMultipass - this module defines two macros
#
# FIND_PACKAGE_MULTIPASS (Name CURRENT
# STATES VAR0 VAR1 ...
# DEPENDENTS DEP0 DEP1 ...)
#
# This function creates a cache entry <UPPERCASED-Name>_CURRENT which
# the user can set to "NO" to trigger a reconfiguration of the package.
# The first time this function is called, the values of
# <UPPERCASED-Name>_VAR0, ... are saved. If <UPPERCASED-Name>_CURRENT
# is false or if any STATE has changed since the last time
# FIND_PACKAGE_MULTIPASS() was called, then CURRENT will be set to "NO",
# otherwise CURRENT will be "YES". IF not CURRENT, then
# <UPPERCASED-Name>_DEP0, ... will be FORCED to NOTFOUND.
# Example:
# find_path (FOO_DIR include/foo.h)
# FIND_PACKAGE_MULTIPASS (Foo foo_current
# STATES DIR
# DEPENDENTS INCLUDES LIBRARIES)
# if (NOT foo_current)
# # Make temporary files, run programs, etc, to determine FOO_INCLUDES and FOO_LIBRARIES
# endif (NOT foo_current)
#
# MULTIPASS_SOURCE_RUNS (Name INCLUDES LIBRARIES SOURCE RUNS LANGUAGE)
# Always runs the given test, use this when you need to re-run tests
# because parent variables have made old cache entries stale. The LANGUAGE
# variable is either C or CXX indicating which compiler the test should
# use.
# MULTIPASS_C_SOURCE_RUNS (Name INCLUDES LIBRARIES SOURCE RUNS)
# DEPRECATED! This is only included for backwards compatability. Use
# the more general MULTIPASS_SOURCE_RUNS instead.
# Always runs the given test, use this when you need to re-run tests
# because parent variables have made old cache entries stale.
macro (FIND_PACKAGE_MULTIPASS _name _current)
string (TOUPPER ${_name} _NAME)
set (_args ${ARGV})
list (REMOVE_AT _args 0 1)
set (_states_current "YES")
list (GET _args 0 _cmd)
if (_cmd STREQUAL "STATES")
list (REMOVE_AT _args 0)
list (GET _args 0 _state)
while (_state AND NOT _state STREQUAL "DEPENDENTS")
# The name of the stored value for the given state
set (_stored_var PACKAGE_MULTIPASS_${_NAME}_${_state})
if (NOT "${${_stored_var}}" STREQUAL "${${_NAME}_${_state}}")
set (_states_current "NO")
endif (NOT "${${_stored_var}}" STREQUAL "${${_NAME}_${_state}}")
set (${_stored_var} "${${_NAME}_${_state}}" CACHE INTERNAL "Stored state for ${_name}." FORCE)
list (REMOVE_AT _args 0)
list (GET _args 0 _state)
endwhile (_state AND NOT _state STREQUAL "DEPENDENTS")
endif (_cmd STREQUAL "STATES")
set (_stored ${_NAME}_CURRENT)
if (NOT ${_stored})
set (${_stored} "YES" CACHE BOOL "Is the configuration for ${_name} current? Set to \"NO\" to reconfigure." FORCE)
set (_states_current "NO")
endif (NOT ${_stored})
set (${_current} ${_states_current})
if (NOT ${_current} AND PACKAGE_MULTIPASS_${_name}_CALLED)
message (STATUS "Clearing ${_name} dependent variables")
# Clear all the dependent variables so that the module can reset them
list (GET _args 0 _cmd)
if (_cmd STREQUAL "DEPENDENTS")
list (REMOVE_AT _args 0)
foreach (dep ${_args})
set (${_NAME}_${dep} "NOTFOUND" CACHE INTERNAL "Cleared" FORCE)
endforeach (dep)
endif (_cmd STREQUAL "DEPENDENTS")
set (${_NAME}_FOUND "NOTFOUND" CACHE INTERNAL "Cleared" FORCE)
endif ()
set (PACKAGE_MULTIPASS_${name}_CALLED YES CACHE INTERNAL "Private" FORCE)
endmacro (FIND_PACKAGE_MULTIPASS)
macro (MULTIPASS_SOURCE_RUNS includes libraries source runs language)
include (Check${language}SourceRuns)
# This is a ridiculous hack. CHECK_${language}_SOURCE_* thinks that if the
# *name* of the return variable doesn't change, then the test does
# not need to be re-run. We keep an internal count which we
# increment to guarantee that every test name is unique. If we've
# gotten here, then the configuration has changed enough that the
# test *needs* to be rerun.
if (NOT MULTIPASS_TEST_COUNT)
set (MULTIPASS_TEST_COUNT 00)
endif (NOT MULTIPASS_TEST_COUNT)
math (EXPR _tmp "${MULTIPASS_TEST_COUNT} + 1") # Why can't I add to a cache variable?
set (MULTIPASS_TEST_COUNT ${_tmp} CACHE INTERNAL "Unique test ID")
set (testname MULTIPASS_TEST_${MULTIPASS_TEST_COUNT}_${runs})
set (CMAKE_REQUIRED_INCLUDES ${includes})
set (CMAKE_REQUIRED_LIBRARIES ${libraries})
if(${language} STREQUAL "C")
check_c_source_runs ("${source}" ${testname})
elseif(${language} STREQUAL "CXX")
check_cxx_source_runs ("${source}" ${testname})
endif()
set (${runs} "${${testname}}")
endmacro (MULTIPASS_SOURCE_RUNS)
macro (MULTIPASS_C_SOURCE_RUNS includes libraries source runs)
multipass_source_runs("${includes}" "${libraries}" "${source}" ${runs} "C")
endmacro (MULTIPASS_C_SOURCE_RUNS)
# ResolveCompilerPaths - this module defines two macros
#
# RESOLVE_LIBRARIES (XXX_LIBRARIES LINK_LINE)
# This macro is intended to be used by FindXXX.cmake modules.
# It parses a compiler link line and resolves all libraries
# (-lfoo) using the library path contexts (-L/path) in scope.
# The result in XXX_LIBRARIES is the list of fully resolved libs.
# Example:
#
# RESOLVE_LIBRARIES (FOO_LIBRARIES "-L/A -la -L/B -lb -lc -ld")
#
# will be resolved to
#
# FOO_LIBRARIES:STRING="/A/liba.so;/B/libb.so;/A/libc.so;/usr/lib/libd.so"
#
# if the filesystem looks like
#
# /A: liba.so libc.so
# /B: liba.so libb.so
# /usr/lib: liba.so libb.so libc.so libd.so
#
# and /usr/lib is a system directory.
#
# Note: If RESOLVE_LIBRARIES() resolves a link line differently from
# the native linker, there is a bug in this macro (please report it).
#
# RESOLVE_INCLUDES (XXX_INCLUDES INCLUDE_LINE)
# This macro is intended to be used by FindXXX.cmake modules.
# It parses a compile line and resolves all includes
# (-I/path/to/include) to a list of directories. Other flags are ignored.
# Example:
#
# RESOLVE_INCLUDES (FOO_INCLUDES "-I/A -DBAR='\"irrelevant -I/string here\"' -I/B")
#
# will be resolved to
#
# FOO_INCLUDES:STRING="/A;/B"
#
# assuming both directories exist.
# Note: as currently implemented, the -I/string will be picked up mistakenly (cry, cry)
include (CorrectWindowsPaths)
macro (RESOLVE_LIBRARIES LIBS LINK_LINE)
string (REGEX MATCHALL "((-L|-l|-Wl)([^\" ]+|\"[^\"]+\")|[^\" ]+\\.(a|so|dll|lib))" _all_tokens "${LINK_LINE}")
set (_libs_found "")
set (_directory_list "")
foreach (token ${_all_tokens})
if (token MATCHES "-L([^\" ]+|\"[^\"]+\")")
# If it's a library path, add it to the list
string (REGEX REPLACE "^-L" "" token ${token})
string (REGEX REPLACE "//" "/" token ${token})
convert_cygwin_path(token)
list (APPEND _directory_list ${token})
elseif (token MATCHES "^(-l([^\" ]+|\"[^\"]+\")|[^\" ]+\\.(a|so|dll|lib))")
# It's a library, resolve the path by looking in the list and then (by default) in system directories
if (WIN32) #windows expects "libfoo", linux expects "foo"
string (REGEX REPLACE "^-l" "lib" token ${token})
else (WIN32)
string (REGEX REPLACE "^-l" "" token ${token})
endif (WIN32)
set (_root "")
if (token MATCHES "^/") # We have an absolute path
#separate into a path and a library name:
string (REGEX MATCH "[^/]*\\.(a|so|dll|lib)$" libname ${token})
string (REGEX MATCH ".*[^${libname}$]" libpath ${token})
convert_cygwin_path(libpath)
set (_directory_list ${_directory_list} ${libpath})
set (token ${libname})
endif (token MATCHES "^/")
set (_lib "NOTFOUND" CACHE FILEPATH "Cleared" FORCE)
find_library (_lib ${token} HINTS ${_directory_list} ${_root})
if (_lib)
string (REPLACE "//" "/" _lib ${_lib})
list (APPEND _libs_found ${_lib})
else (_lib)
message (STATUS "Unable to find library ${token}")
endif (_lib)
endif (token MATCHES "-L([^\" ]+|\"[^\"]+\")")
endforeach (token)
set (_lib "NOTFOUND" CACHE INTERNAL "Scratch variable" FORCE)
# only the LAST occurence of each library is required since there should be no circular dependencies
if (_libs_found)
list (REVERSE _libs_found)
list (REMOVE_DUPLICATES _libs_found)
list (REVERSE _libs_found)
endif (_libs_found)
set (${LIBS} "${_libs_found}")
endmacro (RESOLVE_LIBRARIES)
macro (RESOLVE_INCLUDES INCS COMPILE_LINE)
string (REGEX MATCHALL "-I([^\" ]+|\"[^\"]+\")" _all_tokens "${COMPILE_LINE}")
set (_incs_found "")
foreach (token ${_all_tokens})
string (REGEX REPLACE "^-I" "" token ${token})
string (REGEX REPLACE "//" "/" token ${token})
convert_cygwin_path(token)
if (EXISTS ${token})
list (APPEND _incs_found ${token})
else (EXISTS ${token})
message (STATUS "Include directory ${token} does not exist")
endif (EXISTS ${token})
endforeach (token)
list (REMOVE_DUPLICATES _incs_found)
set (${INCS} "${_incs_found}")
endmacro (RESOLVE_INCLUDES)
# specify the target and requirements for the composite fem library
SET(COMPOSITE_SOURCE_DIR ${SOURCE_DIR}/compositeFEM)
add_library(amdis_compositeFEM
${COMPOSITE_SOURCE_DIR}/CFE_Integration.cc
${COMPOSITE_SOURCE_DIR}/CFE_NormAndErrorFcts.cc
${COMPOSITE_SOURCE_DIR}/CompositeFEMMethods.cc
${COMPOSITE_SOURCE_DIR}/CompositeFEMOperator.cc
${COMPOSITE_SOURCE_DIR}/LevelSetAdaptMesh.cc
${COMPOSITE_SOURCE_DIR}/PenaltyOperator.cc
${COMPOSITE_SOURCE_DIR}/ElementLevelSet.cc
${COMPOSITE_SOURCE_DIR}/SubPolytope.cc
${COMPOSITE_SOURCE_DIR}/SubElementAssembler.cc)
add_library(AMDiS::compositeFEM ALIAS amdis_compositeFEM)
target_compile_definitions(amdis_compositeFEM PUBLIC
HAVE_COMPOSITE_FEM=1)
target_include_directories(amdis_compositeFEM PRIVATE ${COMPOSITE_SOURCE_DIR})
target_link_libraries(amdis_compositeFEM amdis)
# specify how to install this target:
# -----------------------------------
file(GLOB COMPOSITE_HEADERS "${COMPOSITE_SOURCE_DIR}/*.h*")
install(FILES ${COMPOSITE_HEADERS} DESTINATION include/amdis/compositeFEM)
set_target_properties(amdis_compositeFEM PROPERTIES OUTPUT_NAME amdiscompositefem${POSTFIX}
DEBUG_OUTPUT_NAME amdiscompositefem${POSTFIX}d)
install(TARGETS amdis_compositeFEM DESTINATION lib/amdis/ )
if (ENABLE_EXTENSIONS)
option(ENABLE_BASE_PROBLEMS "Use base_problems" true)
mark_as_advanced(ENABLE_BASE_PROBLEMS)
find_path(EXTENSIONS_DIR NAMES Helpers.h
HINTS ${BASE_DIR}/../extensions
DOC "Path to AMDiS extensions.")
if (EXTENSIONS_DIR)
if (NOT EXISTS ${EXTENSIONS_DIR}/Helpers.h OR NOT EXISTS ${EXTENSIONS_DIR}/ExtendedProblemStat.h)
message(FATAL_ERROR "Wrong extensions directory! Directory must contain the files 'Helpers.h' and 'ExtendedProblemStat.h'")
endif ()
add_library(amdis_extensions
${EXTENSIONS_DIR}/Helpers.cc
${EXTENSIONS_DIR}/BackgroundMesh.cc
${EXTENSIONS_DIR}/GeometryTools.cc
${EXTENSIONS_DIR}/POperators.cc
${EXTENSIONS_DIR}/SingularDirichletBC2.cc
${EXTENSIONS_DIR}/time/ExtendedRosenbrockStationary.cc
${EXTENSIONS_DIR}/pugixml/src/pugixml.cpp
)
add_library(AMDiS::extensions ALIAS amdis_extensions)
target_compile_definitions(amdis_extensions PRIVATE HAVE_EXTENSIONS=1)
target_include_directories(amdis_extensions PRIVATE
${EXTENSIONS_DIR}
${EXTENSIONS_DIR}/time
${EXTENSIONS_DIR}/nanoflann
${EXTENSIONS_DIR}/pugixml/src
)
set(INSTALL_SUBDIRS . time preconditioner nanoflann)
if (ENABLE_SEQ_PETSC)
target_sources(amdis_extensions PRIVATE
${EXTENSIONS_DIR}/preconditioner/PetscPreconPfc.cc
${EXTENSIONS_DIR}/preconditioner/PetscPreconPfcDiag.cc
${EXTENSIONS_DIR}/preconditioner/PetscPreconCahnHilliard.cc)
endif (ENABLE_SEQ_PETSC)
if (ENABLE_PARALLEL_DOMAIN)
target_sources(amdis_extensions PRIVATE
${EXTENSIONS_DIR}/preconditioner/PetscSolverPfc.cc
${EXTENSIONS_DIR}/preconditioner/PetscSolverPfc_diag.cc)
target_link_libraries(amdis_extensions amdis_parallel)
endif (ENABLE_PARALLEL_DOMAIN)
if (ENABLE_BASE_PROBLEMS)
if (ENABLE_REINIT)
target_sources(amdis_extensions PRIVATE
${EXTENSIONS_DIR}/base_problems/CahnHilliard.cc
${EXTENSIONS_DIR}/base_problems/CahnHilliard_RB.cc
${EXTENSIONS_DIR}/base_problems/CahnHilliardNavierStokes.cc
${EXTENSIONS_DIR}/base_problems/CahnHilliardNavierStokes_RB.cc
${EXTENSIONS_DIR}/base_problems/CahnHilliardNavierStokes_TwoPhase.cc
${EXTENSIONS_DIR}/base_problems/CahnHilliardNavierStokes_TwoPhase_RB.cc)
endif (ENABLE_REINIT)
target_sources(amdis_extensions PRIVATE
${EXTENSIONS_DIR}/base_problems/DiffuseDomainFsi.cc
${EXTENSIONS_DIR}/base_problems/LinearElasticity.cc
${EXTENSIONS_DIR}/base_problems/LinearElasticityPhase.cc
${EXTENSIONS_DIR}/base_problems/NavierStokesCahnHilliard.cc
${EXTENSIONS_DIR}/base_problems/NavierStokesPhase_TaylorHood.cc
${EXTENSIONS_DIR}/base_problems/NavierStokes_TaylorHood.cc
${EXTENSIONS_DIR}/base_problems/NavierStokes_TaylorHood_RB.cc
${EXTENSIONS_DIR}/base_problems/NavierStokes_TH_MultiPhase.cc
${EXTENSIONS_DIR}/base_problems/NavierStokes_TH_MultiPhase_RB.cc
${EXTENSIONS_DIR}/base_problems/PhaseFieldCrystal.cc
${EXTENSIONS_DIR}/base_problems/PhaseFieldCrystal_Phase.cc
${EXTENSIONS_DIR}/base_problems/PhaseFieldCrystal_RB.cc
${EXTENSIONS_DIR}/base_problems/PolarizationField.cc
${EXTENSIONS_DIR}/base_problems/QuasiCrystal.cc
${EXTENSIONS_DIR}/base_problems/QuasiCrystal_RB.cc)
# ${EXTENSIONS_DIR}/base_problems/NavierStokes_Chorin.cc
# ${EXTENSIONS_DIR}/base_problems/NavierStokesPhase_Chorin.cc
# ${EXTENSIONS_DIR}/base_problems/VacancyPhaseFieldCrystal.cc
target_compile_definitions(amdis_extensions PRIVATE HAVE_BASE_PROBLEMS=1)
target_include_directories(amdis_extensions PRIVATE ${EXTENSIONS_DIR}/base_problems)
list(APPEND INSTALL_SUBDIRS base_problems)
endif (ENABLE_BASE_PROBLEMS)
target_link_libraries(amdis_extensions amdis amdis_reinit)
# specify how to install this target:
# -----------------------------------
foreach (SUBDIR ${INSTALL_SUBDIRS})
file(GLOB HEADERS "${EXTENSIONS_DIR}/${SUBDIR}/*.h*")
install(FILES ${HEADERS} DESTINATION include/amdis/extensions/${SUBDIR}/)
endforeach ()
file(GLOB HEADERS "${EXTENSIONS_DIR}/pugixml/src/*.hpp")
install(FILES ${HEADERS} DESTINATION include/amdis/extensions/pugixml/)
set_target_properties(amdis_extensions PROPERTIES OUTPUT_NAME amdisextensions${POSTFIX}
DEBUG_OUTPUT_NAME amdisextensions${POSTFIX}d)
install(TARGETS amdis_extensions DESTINATION lib/amdis/)
endif (EXTENSIONS_DIR)
endif (ENABLE_EXTENSIONS)
if (ENABLE_PARALLEL_DOMAIN)
add_library(amdis_parallel INTERFACE)
target_sources(amdis PRIVATE
${SOURCE_DIR}/parallel/DofComm.cc
${SOURCE_DIR}/parallel/CheckerPartitioner.cc
${SOURCE_DIR}/parallel/ElementObjectDatabase.cc
${SOURCE_DIR}/parallel/InteriorBoundary.cc
${SOURCE_DIR}/parallel/MeshDistributor.cc
${SOURCE_DIR}/parallel/MeshLevelData.cc
${SOURCE_DIR}/parallel/MeshManipulation.cc
${SOURCE_DIR}/parallel/MeshPartitioner.cc
${SOURCE_DIR}/parallel/MpiHelper.cc
${SOURCE_DIR}/parallel/ParallelDebug.cc
${SOURCE_DIR}/parallel/ParallelDofMapping.cc
${SOURCE_DIR}/parallel/ParallelProblemStat.cc
${SOURCE_DIR}/parallel/ParallelSolver.cc
${SOURCE_DIR}/parallel/PeriodicMap.cc
${SOURCE_DIR}/parallel/ParMetisPartitioner.cc
${SOURCE_DIR}/parallel/StdMpi.cc
)
target_compile_definitions(amdis_parallel INTERFACE
HAVE_PARALLEL_DOMAIN_AMDIS=1)
target_enable_petsc(amdis_parallel INTERFACE)
# add support for the zoltan library
if (ENABLE_ZOLTAN)
target_enable_zoltan(amdis_parallel INTERFACE)
target_sources(amdis PRIVATE
${SOURCE_DIR}/parallel/ZoltanPartitioner.cc)
endif (ENABLE_ZOLTAN)
if (ENABLE_BDDCML)
target_compile_definitions(amdis_parallel INTERFACE HAVE_BDDCML=1)
target_sources(amdis PRIVATE
${SOURCE_DIR}/parallel/BddcMlSolver.cc)
endif (ENABLE_BDDCML)
# add some more source-files that need petsc
target_sources(amdis PRIVATE
${SOURCE_DIR}/parallel/MatrixNnzStructure.cc
${SOURCE_DIR}/parallel/ParallelCoarseSpaceSolver.cc
${SOURCE_DIR}/parallel/PetscHelper.cc
${SOURCE_DIR}/parallel/PetscSolver.cc
${SOURCE_DIR}/parallel/PetscSolverGlobalMatrix.cc
${SOURCE_DIR}/parallel/PetscSolverGlobalBlockMatrix.cc
${SOURCE_DIR}/solver/PetscTypes.cc
)
if (ENABLE_PARALLEL_SOLVERS)
target_sources(amdis PRIVATE
${SOURCE_DIR}/parallel/PetscSolverFeti.cc
${SOURCE_DIR}/parallel/PetscSolverFetiDebug.cc
${SOURCE_DIR}/parallel/PetscSolverFetiMonitor.cc
${SOURCE_DIR}/parallel/PetscSolverFetiOperators.cc
${SOURCE_DIR}/parallel/PetscSolverFetiTimings.cc
${SOURCE_DIR}/parallel/PetscSolverNavierStokes.cc
${SOURCE_DIR}/parallel/PetscSolverNSCH.cc
${SOURCE_DIR}/parallel/PetscSolverCahnHilliard2.cc
${SOURCE_DIR}/parallel/PetscSolverCahnHilliard.cc
${SOURCE_DIR}/parallel/PetscSolverSchur.cc
)
target_compile_definitions(amdis_parallel INTERFACE
HAVE_PARALLEL_SOLVERS=1)
endif (ENABLE_PARALLEL_SOLVERS)
target_link_libraries(amdis amdis_parallel)
# specify how to install this target:
# -----------------------------------
file(GLOB AMDIS_PARALLEL_HEADERS "${SOURCE_DIR}/parallel/*.h")
install(FILES ${AMDIS_PARALLEL_HEADERS} DESTINATION include/amdis/parallel/)
install(FILES
${BASE_DIR}/cmake3/ResolveCompilerPaths.cmake
${BASE_DIR}/cmake3/FindPackageMultipass.cmake
${BASE_DIR}/cmake3/CorrectWindowsPaths.cmake
${BASE_DIR}/cmake3/FindPETSc.cmake
${BASE_DIR}/cmake3/target_enable_petsc.cmake
${BASE_DIR}/cmake3/target_enable_zoltan.cmake
DESTINATION share/amdis/)
endif (ENABLE_PARALLEL_DOMAIN)
# specify the target and requirements for the reinit library
SET(COMPOSITE_SOURCE_DIR ${SOURCE_DIR}/reinit)
set(REINIT_SOURCE_DIR ${SOURCE_DIR}/reinit)
file(GLOB REINIT_SRC ${REINIT_SOURCE_DIR}/*.cc)
add_library(amdis_reinit ${REINIT_SRC})
add_library(AMDiS::reinit ALIAS amdis_reinit)
target_compile_definitions(amdis_reinit PUBLIC
HAVE_REINIT=1)
target_include_directories(amdis_reinit PUBLIC ${REINIT_SOURCE_DIR})
target_link_libraries(amdis_reinit amdis)
# specify how to install this target:
# -----------------------------------
file(GLOB RINIT_HEADERS "${REINIT_SOURCE_DIR}/*.h*")
install(FILES ${RINIT_HEADERS} DESTINATION include/amdis/reinit)
set_target_properties(amdis_reinit PROPERTIES OUTPUT_NAME amdisreinit${POSTFIX}
DEBUG_OUTPUT_NAME amdisreinit${POSTFIX}d)
install(TARGETS amdis_reinit DESTINATION lib/amdis/ )
if (ENABLE_SEQ_PETSC)
target_enable_mpi(amdis PUBLIC)
target_enable_petsc(amdis PUBLIC)
target_compile_definitions(amdis PUBLIC HAVE_SEQ_PETSC=1)
target_sources(amdis PRIVATE
${SOURCE_DIR}/solver/PetscSolver.cc
${SOURCE_DIR}/solver/PetscTypes.cc)
endif (ENABLE_SEQ_PETSC)
# specify the target and requirements for the muparser library
set(MUPARSER_SOURCE_DIR ${BASE_DIR}/lib/muparser_v134/src)
set(MUPARSER_INCLUDE_DIR ${BASE_DIR}/lib/muparser_v134/include)
add_library(muparser STATIC
${MUPARSER_SOURCE_DIR}/muParser.cpp
${MUPARSER_SOURCE_DIR}/muParserBase.cpp
${MUPARSER_SOURCE_DIR}/muParserBytecode.cpp
${MUPARSER_SOURCE_DIR}/muParserCallback.cpp
${MUPARSER_SOURCE_DIR}/muParserComplex.cpp
${MUPARSER_SOURCE_DIR}/muParserDLL.cpp
${MUPARSER_SOURCE_DIR}/muParserError.cpp
${MUPARSER_SOURCE_DIR}/muParserInt.cpp
${MUPARSER_SOURCE_DIR}/muParserTest.cpp
${MUPARSER_SOURCE_DIR}/muParserTokenReader.cpp)
target_include_directories(muparser PUBLIC ${MUPARSER_INCLUDE_DIR})
set_property(TARGET muparser PROPERTY POSITION_INDEPENDENT_CODE ON)
target_enable_cxx11(MUPARSER_ENABLE_CXX11 muparser PRIVATE)
target_compile_definitions(muparser PRIVATE AMDIS_HAS_CXX11=1)
# specify how to install this target:
# -----------------------------------
file(GLOB MUPARSER_HEADERS "${MUPARSER_SOURCE_DIR}/include/*.h")
install(FILES ${MUPARSER_HEADERS}
DESTINATION include/amdis/muparser)
install(TARGETS muparser
DESTINATION lib/amdis/ )
macro(parse_zoltan_makefile _FILE_ _TARGET_ _SCOPE_)
# parse zoltan extra libs AND ld flags
file(STRINGS ${_FILE_} ZOLTAN_EXTRA_LIBS_LINE REGEX "ZOLTAN_EXTRA_LIBS")
file(STRINGS ${_FILE_} ZOLTAN_LDFLAGS_LINE REGEX "ZOLTAN_LDFLAGS")
get_filename_component(ZOLTAN_MAKEFILE_DIR "${ZOLTAN_MAKEFILE}" PATH CACHE)
string(STRIP "${ZOLTAN_EXTRA_LIBS_LINE}" ZOLTAN_EXTRA_LIBS_LINE)
string(STRIP "${ZOLTAN_LDFLAGS_LINE}" ZOLTAN_LDFLAGS_LINE)
if ("${ZOLTAN_EXTRA_LIBS_LINE}" MATCHES "^ZOLTAN_EXTRA_LIBS[ ]*=[ ]*([a-zA-Z0-9_/. -]+)*$")
string(REGEX REPLACE " " ";" ZOLTAN_EXTRA_LIBS_LIST "${CMAKE_MATCH_1}")
if ("${ZOLTAN_LDFLAGS_LINE}" MATCHES "^ZOLTAN_LDFLAGS[ ]*=[ ]*([a-zA-Z0-9_/. -]+)*$")
string(REGEX REPLACE " " ";" ZOLTAN_LDFLAGS_LIST "${CMAKE_MATCH_1}")
set(COMBINED_LIST ${ZOLTAN_LDFLAGS_LIST} ${ZOLTAN_EXTRA_LIBS_LIST})
set(ZOLTAN_LIB_DIRS "")
foreach(LIBS ${COMBINED_LIST})
string(STRIP "${LIBS}" LIBS)
string(SUBSTRING "${LIBS}" 0 2 LIB_PREFIX)
string(SUBSTRING "${LIBS}" 2 -1 LIB_NAME)
if ("${LIB_PREFIX}" STREQUAL "-L")
list(APPEND ZOLTAN_LIB_DIRS ${LIB_NAME})
elseif ("${LIB_PREFIX}" STREQUAL "-l")
find_library(_ZOLTAN_EXTERN_LIB ${LIB_NAME} HINTS ${ZOLTAN_LIB_DIRS})
if (NOT _ZOLTAN_EXTERN_LIB)
message(FATAL_ERROR "Could not find library \"${LIB_NAME}\" in directories ${ZOLTAN_LIB_DIRS}!")
else ()
target_link_libraries(${_TARGET_} ${_SCOPE_} ${_ZOLTAN_EXTERN_LIB})
endif ()
unset(_ZOLTAN_EXTERN_LIB CACHE)
else ()
message(WARNING "Unknown link parameter \"${LIBS}\"")
endif ()
endforeach (LIBS)
endif()
endif()
endmacro(parse_zoltan_makefile)
macro(target_enable_bddcml _TARGET_ _SCOPE_)
if (${ARGC} GREATER 2)
set(LINK_EXECUTABLE ON)
else ()
set(LINK_EXECUTABLE OFF)
endif ()
SET(BDDCML_LINK_LIST "" CACHE STRING "Further libraries to be linked with BDDCML")
find_file(BDDCML_H bddcml_interface_c.h
HINTS ENV CPATH
DOC "Header bddcml_interface_c.h for the BDDCML library.")
if (BDDCML_H)
get_filename_component(BDDCML_PATH ${BDDCML_H} PATH)
target_include_directories(${_TARGET_} ${_SCOPE_} ${BDDCML_PATH})
target_compile_definitions(${_TARGET_} ${_SCOPE_} HAVE_BDDC_ML=1 Add_)
else()
message(FATAL_ERROR "Could not find BDDCML headers.")
endif()
if (LINK_EXECUTABLE OR APPLE)
find_library(BDDCML_LIB bddcml
HINTS ENV LIBRARY_PATH
DOC "BDDCML library")
if(BDDCML_LIB)
target_link_libraries(${_TARGET_} ${_SCOPE_} ${BDDCML_LIB})
else()
message(FATAL_ERROR "Could not find the BDDCML library")
endif()
endif (LINK_EXECUTABLE OR APPLE)
target_compile_definitions(${_TARGET_} ${_SCOPE_} HAVE_BDDCML=1)
endmacro(target_enable_bddcml)