diff --git a/.gitignore b/.gitignore new file mode 100644 index 000000000..2b7903a21 --- /dev/null +++ b/.gitignore @@ -0,0 +1,5 @@ +build +.dir-locals.el +TAGS +third-party/blackdynamite/ +third-party/cpp-array/ diff --git a/.gitmodules b/.gitmodules new file mode 100644 index 000000000..f55302454 --- /dev/null +++ b/.gitmodules @@ -0,0 +1,12 @@ +[submodule "extra_packages/extra-materials"] + path = extra_packages/extra-materials + url = git@lsmssrv1.epfl.ch:akantu-extra-materials.git +[submodule "extra_packages/igfem"] + path = extra_packages/igfem + url = git@lsmssrv1.epfl.ch:akantu-igfem.git +[submodule "extra_packages/parallel-cohesive-element"] + path = extra_packages/parallel-cohesive-element + url = git@lsmssrv1.epfl.ch:akantu-parallel-cohesive.git +[submodule "extra_packages/traction-at-split-node-contact"] + path = extra_packages/traction-at-split-node-contact + url = git@lsmssrv1.epfl.ch:akantu-traction-at-split-node-contact.git diff --git a/CMakeLists.txt b/CMakeLists.txt index 3eb6b972a..9350d072e 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -1,180 +1,174 @@ #=============================================================================== # @file CMakeLists.txt # # @author Nicolas Richart # # @date creation: Mon Jun 14 2010 # @date last modification: Mon Sep 15 2014 # # @brief main configuration file # # @section LICENSE # # Copyright (©) 2010-2012, 2014 EPFL (Ecole Polytechnique Fédérale de Lausanne) # Laboratory (LSMS - Laboratoire de Simulation en Mécanique des Solides) # # Akantu is free software: you can redistribute it and/or modify it under the # terms of the GNU Lesser General Public License as published by the Free # Software Foundation, either version 3 of the License, or (at your option) any # later version. # # Akantu 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 Lesser General Public License for more # details. # # You should have received a copy of the GNU Lesser General Public License # along with Akantu. If not, see . # # @section DESCRIPTION #------------------------------------------------------------------------------- # _ _ # | | | | # __ _| | ____ _ _ __ | |_ _ _ # / _` | |/ / _` | '_ \| __| | | | # | (_| | < (_| | | | | |_| |_| | # \__,_|_|\_\__,_|_| |_|\__|\__,_| # #=============================================================================== #=============================================================================== # CMake Project #=============================================================================== cmake_minimum_required(VERSION 2.8) # add this options before PROJECT keyword #set(CMAKE_DISABLE_SOURCE_CHANGES ON) set(CMAKE_DISABLE_IN_SOURCE_BUILD ON) project(Akantu) enable_language(CXX) #=============================================================================== # Misc. config for cmake #=============================================================================== set(AKANTU_CMAKE_DIR "${PROJECT_SOURCE_DIR}/cmake") set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} "${PROJECT_SOURCE_DIR}/cmake") set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} "${PROJECT_SOURCE_DIR}/cmake/Modules") set(BUILD_SHARED_LIBS ON CACHE BOOL "Build shared libraries.") mark_as_advanced(BUILD_SHARED_LIBS) if(NOT AKANTU_TARGETS_EXPORT) set(AKANTU_TARGETS_EXPORT AkantuLibraryDepends) endif() include(CMakeVersionGenerator) include(CMakePackagesSystem) include(CMakeFlagsHandling) include(AkantuMacros) #cmake_activate_debug_message() #=============================================================================== # Version Number #=============================================================================== # AKANTU version number. An even minor number corresponds to releases. set(AKANTU_MAJOR_VERSION 2) set(AKANTU_MINOR_VERSION 2) set(AKANTU_PATCH_VERSION 0) define_project_version() #=============================================================================== # Options #=============================================================================== # Debug #option(AKANTU_DEBUG "Compiles akantu with the debug messages" ON) #mark_as_advanced(AKANTU_DEBUG) set(CMAKE_CXX_FLAGS_RELEASE "-O3 -DNDEBUG -DAKANTU_NDEBUG" CACHE STRING "Flags used by the compiler during release builds" FORCE) add_flags(cxx "-Wall") # if(NOT AKANTU_DEBUG) # set(AKANTU_NDEBUG ON) # else() # set(AKANTU_NDEBUG OFF) # endif() #Profiling set(CMAKE_CXX_FLAGS_PROFILING "-g -pg" CACHE STRING "Flags used by the compiler during profiling builds") set(CMAKE_EXE_LINKER_FLAGS_PROFILING "-pg" CACHE STRING "Flags used by the linker during profiling builds") set(CMAKE_SHARED_LINKER_FLAGS_PROFILING "-pg" CACHE STRING "Flags used by the linker during profiling builds") mark_as_advanced(CMAKE_CXX_FLAGS_PROFILING) mark_as_advanced(CMAKE_EXE_LINKER_FLAGS_PROFILING) mark_as_advanced(CMAKE_SHARED_LINKER_FLAGS_PROFILING) include(CMakeDetermineCCompiler) cmake_deactivate_debug_message(PackagesSystem) #=============================================================================== # Dependencies #=============================================================================== set(AKANTU_BOOST_COMPONENT) -set(AKANTU_EXTRA_TARGET_DEPENDENCIES) -add_all_packages(${PROJECT_SOURCE_DIR}/packages ${PROJECT_SOURCE_DIR}/src) + +package_list_packages(${PROJECT_SOURCE_DIR}/packages + EXTRA_PACKAGES_FOLDER ${PROJECT_SOURCE_DIR}/extra_packages) include_boost() ## meta option \todo better way to do it when multiple package give enable the ## same feature if(AKANTU_SCOTCH) set(AKANTU_PARTITIONER ON) else() set(AKANTU_PARTITIONER OFF) endif() if(AKANTU_MUMPS) set(AKANTU_SOLVER ON) else() set(AKANTU_SOLVER OFF) endif() #=============================================================================== # Akantu library #=============================================================================== add_subdirectory(src) #=============================================================================== # Documentation #=============================================================================== if(AKANTU_DOCUMENTATION_DOXYGEN OR AKANTU_DOCUMENTATION_MANUAL) add_subdirectory(doc) else() set(AKANTU_DOC_EXCLUDE_FILES "${PROJECT_SOURCE_DIR}/doc/manual" CACHE INTERNAL "") endif() #=============================================================================== # Examples and tests #=============================================================================== option(AKANTU_EXAMPLES "Activate examples" OFF) option(AKANTU_TESTS "Activate tests" OFF) +include(AkantuTestAndExamples) + if(AKANTU_EXAMPLES OR AKANTU_TESTS) - include(AkantuTestAndExamples) find_package(GMSH REQUIRED) endif() if(AKANTU_EXAMPLES) add_subdirectory(examples) endif() -if(AKANTU_TESTS) - enable_testing() - include(CTest) - mark_as_advanced(BUILD_TESTING) - set(AKANTU_TESTS_EXCLUDE_FILES "" CACHE INTERNAL "") - add_subdirectory(test) -else() - set(AKANTU_TESTS_EXCLUDE_FILES "${PROJECT_SOURCE_DIR}/test" CACHE INTERNAL "") -endif() +add_test_tree(test) #=============================================================================== # Install and Packaging #=============================================================================== include(AkantuInstall) if(NOT AKANTU_DISABLE_CPACK) include(AkantuCPack) endif() diff --git a/cmake/AkantuMacros.cmake b/cmake/AkantuMacros.cmake index ef296e420..430e826cf 100644 --- a/cmake/AkantuMacros.cmake +++ b/cmake/AkantuMacros.cmake @@ -1,168 +1,211 @@ #=============================================================================== # @file AkantuMacros.cmake # # @author Guillaume Anciaux # @author Nicolas Richart # # @date creation: Thu Feb 17 2011 # @date last modification: Tue Aug 19 2014 # # @brief Set of macros used by akantu cmake files # # @section LICENSE # # Copyright (©) 2010-2012, 2014 EPFL (Ecole Polytechnique Fédérale de Lausanne) # Laboratory (LSMS - Laboratoire de Simulation en Mécanique des Solides) # # Akantu is free software: you can redistribute it and/or modify it under the # terms of the GNU Lesser General Public License as published by the Free # Software Foundation, either version 3 of the License, or (at your option) any # later version. # # Akantu 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 Lesser General Public License for more # details. # # You should have received a copy of the GNU Lesser General Public License # along with Akantu. If not, see . # #=============================================================================== macro(check_for_isnan result) include(CheckFunctionExists) check_function_exists(std::isnan HAVE_STD_ISNAN) if(HAVE_STD_ISNAN) set(result "std::isnan(x)") else() check_function_exists(isnan HAVE_ISNAN) if(HAVE_ISNAN) set(result "(::isnan(x))") else() check_function_exists(_isnan HAVE_ISNAN_MATH_H) if(HAVE_ISNAN_MATH_H) set(result "(_isnan(x))") else() set(result (x == std::numeric_limits::quiet_NAN())) endif() endif() endif() endmacro() #=============================================================================== macro(copy_files target_depend) foreach(_file ${ARGN}) set(_target ${CMAKE_CURRENT_BINARY_DIR}/${_file}) set(_source ${CMAKE_CURRENT_SOURCE_DIR}/${_file}) add_custom_command( OUTPUT ${_target} COMMAND ${CMAKE_COMMAND} -E copy_if_different ${_source} ${_target} DEPENDS ${_source} ) set(_target_name ${target_depend}_${_file}) add_custom_target(${_target_name} DEPENDS ${_target}) add_dependencies(${target_depend} ${_target_name}) endforeach() endmacro() #=============================================================================== macro(add_akantu_definitions) foreach(_definition ${AKANTU_DEFINITIONS}) add_definitions(-D${_definition}) endforeach() endmacro() - +#=============================================================================== macro(include_boost) set(Boost_LIBRARIES) find_package(Boost REQUIRED) mark_as_advanced(Boost_DIR) if(Boost_FOUND) list(APPEND AKANTU_EXTERNAL_LIB_INCLUDE_DIR ${Boost_INCLUDE_DIRS} ${Boost_INCLUDE_DIR}) endif() message(STATUS "Looking for Boost liraries") set(AKANTU_BOOST_COMPONENT_ALREADY_DONE) foreach(_comp ${AKANTU_BOOST_COMPONENTS}) list(FIND AKANTU_BOOST_COMPONENT_ALREADY_DONE ${_comp} _res) if(_res EQUAL -1) find_package(Boost COMPONENTS ${_comp} QUIET) string(TOUPPER ${_comp} _u_comp) if(Boost_${_u_comp}_FOUND) message(STATUS " ${_comp}: FOUND") set(AKANTU_BOOST_${_u_comp} TRUE CACHE INTERNAL "" FORCE) list(APPEND Boost_LIBRARIES ${Boost_${_u_comp}_LIBRARY}) list(APPEND AKANTU_EXTERNAL_LIBRARIES ${Boost_${_u_comp}_LIBRARY}) else() message(STATUS " ${_comp}: NOT FOUND") endif() list(APPEND AKANTU_BOOST_COMPONENT_ALREADY_DONE ${_comp}) endif() endforeach() endmacro() function(set_third_party_shared_libirary_name _var _lib) set(${_var} ${PROJECT_BINARY_DIR}/third-party/lib/${CMAKE_SHARED_LIBRARY_PREFIX}${_lib}${CMAKE_SHARED_LIBRARY_SUFFIX} CACHE FILEPATH "" FORCE) endfunction() +#=============================================================================== +# Generate the list of currently loaded materials +function(generate_material_list) + message(STATUS "Determining the list of recognized materials...") + + set(_include_dirs ${AKANTU_INCLUDE_DIRS} ${AKANTU_EXTERNAL_INCLUDE_DIR}) + + try_run(_material_list_run _material_list_compile + ${CMAKE_BINARY_DIR} + ${PROJECT_SOURCE_DIR}/cmake/material_lister.cc + CMAKE_FLAGS "-DINCLUDE_DIRECTORIES:STRING=${_include_dirs}" + COMPILE_DEFINITIONS "-DAKANTU_CMAKE_LIST_MATERIALS" + COMPILE_OUTPUT_VARIABLE _compile_results + RUN_OUTPUT_VARIABLE _result_material_list) + + if(_material_list_compile AND "${_material_list_run}" EQUAL 0) + message(STATUS "Materials included in Akantu:") + string(REPLACE "\n" ";" _material_list "${_result_material_list}") + foreach(_mat ${_material_list}) + string(REPLACE ":" ";" _mat_key "${_mat}") + list(GET _mat_key 0 _key) + list(GET _mat_key 1 _class) + list(LENGTH _mat_key _l) + + if("${_l}" GREATER 2) + list(REMOVE_AT _mat_key 0 1) + set(_opt " -- options: [") + foreach(_o ${_mat_key}) + set(_opt "${_opt} ${_o}") + endforeach() + set(_opt "${_opt} ]") + else() + set(_opt "") + endif() + + message(STATUS " ${_class} -- key: ${_key}${_opt}") + endforeach() + else() + message(STATUS "Could not determine the list of materials.") + message("${_compile_results}") + endif() +endfunction() + #=============================================================================== if(__CMAKE_PARSE_ARGUMENTS_INCLUDED) return() endif() set(__CMAKE_PARSE_ARGUMENTS_INCLUDED TRUE) function(CMAKE_PARSE_ARGUMENTS prefix _optionNames _singleArgNames _multiArgNames) # first set all result variables to empty/FALSE foreach(arg_name ${_singleArgNames} ${_multiArgNames}) set(${prefix}_${arg_name}) endforeach(arg_name) foreach(option ${_optionNames}) set(${prefix}_${option} FALSE) endforeach(option) set(${prefix}_UNPARSED_ARGUMENTS) set(insideValues FALSE) set(currentArgName) # now iterate over all arguments and fill the result variables foreach(currentArg ${ARGN}) list(FIND _optionNames "${currentArg}" optionIndex) # ... then this marks the end of the arguments belonging to this keyword list(FIND _singleArgNames "${currentArg}" singleArgIndex) # ... then this marks the end of the arguments belonging to this keyword list(FIND _multiArgNames "${currentArg}" multiArgIndex) # ... then this marks the end of the arguments belonging to this keyword if(${optionIndex} EQUAL -1 AND ${singleArgIndex} EQUAL -1 AND ${multiArgIndex} EQUAL -1) if(insideValues) if("${insideValues}" STREQUAL "SINGLE") set(${prefix}_${currentArgName} ${currentArg}) set(insideValues FALSE) elseif("${insideValues}" STREQUAL "MULTI") list(APPEND ${prefix}_${currentArgName} ${currentArg}) endif() else(insideValues) list(APPEND ${prefix}_UNPARSED_ARGUMENTS ${currentArg}) endif(insideValues) else() if(NOT ${optionIndex} EQUAL -1) set(${prefix}_${currentArg} TRUE) set(insideValues FALSE) elseif(NOT ${singleArgIndex} EQUAL -1) set(currentArgName ${currentArg}) set(${prefix}_${currentArgName}) set(insideValues "SINGLE") elseif(NOT ${multiArgIndex} EQUAL -1) set(currentArgName ${currentArg}) set(${prefix}_${currentArgName}) set(insideValues "MULTI") endif() endif() endforeach(currentArg) # propagate the result variables to the caller: foreach(arg_name ${_singleArgNames} ${_multiArgNames} ${_optionNames}) set(${prefix}_${arg_name} ${${prefix}_${arg_name}} PARENT_SCOPE) endforeach(arg_name) set(${prefix}_UNPARSED_ARGUMENTS ${${prefix}_UNPARSED_ARGUMENTS} PARENT_SCOPE) endfunction(CMAKE_PARSE_ARGUMENTS _options _singleArgs _multiArgs) diff --git a/cmake/AkantuTestAndExamples.cmake b/cmake/AkantuTestAndExamples.cmake index d22919e33..48ba72158 100644 --- a/cmake/AkantuTestAndExamples.cmake +++ b/cmake/AkantuTestAndExamples.cmake @@ -1,257 +1,458 @@ #=============================================================================== # @file AkantuTestAndExamples.cmake # # @author Guillaume Anciaux # @author Nicolas Richart # # @date creation: Mon Oct 25 2010 # @date last modification: Tue Jun 24 2014 # # @brief macros for tests and examples # # @section LICENSE # # Copyright (©) 2010-2012, 2014 EPFL (Ecole Polytechnique Fédérale de Lausanne) # Laboratory (LSMS - Laboratoire de Simulation en Mécanique des Solides) # # Akantu is free software: you can redistribute it and/or modify it under the # terms of the GNU Lesser General Public License as published by the Free # Software Foundation, either version 3 of the License, or (at your option) any # later version. # # Akantu 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 Lesser General Public License for more # details. # # You should have received a copy of the GNU Lesser General Public License # along with Akantu. If not, see . # # @section DESCRIPTION # #=============================================================================== set(AKANTU_DIFF_SCRIPT ${AKANTU_CMAKE_DIR}/akantu_diff.sh) #=============================================================================== function(manage_test_and_example et_name desc build_all label) string(TOUPPER ${et_name} upper_name) cmake_parse_arguments(manage_test_and_example "" "PACKAGE" "" ${ARGN} ) set(_activated ON) if(manage_test_and_example_PACKAGE) list(FIND ${_project}_PACKAGE_SYSTEM_PACKAGES_ON ${manage_test_and_example_PACKAGE} _ret) if(_ret EQUAL -1) set(_activated OFF) file(RELATIVE_PATH _dir ${PROJECT_SOURCE_DIR} ${CMAKE_CURRENT_SOURCE_DIR}/${et_name}) list(APPEND AKANTU_TESTS_EXCLUDE_FILES /${_dir}) set(AKANTU_TESTS_EXCLUDE_FILES ${AKANTU_TESTS_EXCLUDE_FILES} CACHE INTERNAL "") endif() endif() if(NOT EXISTS ${CMAKE_CURRENT_SOURCE_DIR}/${et_name} AND _activated) -# message("Example or test ${et_name} not present") + # message("Example or test ${et_name} not present") return() endif() option(AKANTU_BUILD${label}${upper_name} "${desc}") mark_as_advanced(AKANTU_BUILD_${upper_name}) if(${build_all} OR NOT _activated) set(AKANTU_BUILD${label}${upper_name}_OLD ${AKANTU_BUILD${label}${upper_name}} CACHE INTERNAL "${desc}" FORCE) set(AKANTU_BUILD${label}${upper_name} ${_activated} CACHE INTERNAL "${desc}" FORCE) else() if(DEFINED AKANTU_BUILD${label}${upper_name}_OLD) set(AKANTU_BUILD${label}${upper_name} ${AKANTU_BUILD${label}${upper_name}_OLD} CACHE BOOL "${desc}" FORCE) unset(AKANTU_BUILD${label}${upper_name}_OLD CACHE) endif(DEFINED AKANTU_BUILD${label}${upper_name}_OLD) endif() if(AKANTU_BUILD${label}${upper_name}) add_subdirectory(${et_name}) endif(AKANTU_BUILD${label}${upper_name}) endfunction() #=============================================================================== # Tests #=============================================================================== if(AKANTU_TESTS) - option(AKANTU_BUILD_ALL_TESTS "Build all tests") -# mark_as_advanced(AKANTU_BUILD_ALL_TESTS) + option(AKANTU_BUILD_ALL_TESTS "Build all tests" ON) + mark_as_advanced(AKANTU_BUILD_ALL_TESTS) endif(AKANTU_TESTS) #=============================================================================== macro(register_test_old test_name) add_executable(${test_name} ${ARGN}) target_link_libraries(${test_name} akantu ${AKANTU_EXTERNAL_LIBRARIES}) if(EXISTS ${CMAKE_CURRENT_SOURCE_DIR}/${test_name}.sh) file(COPY ${test_name}.sh DESTINATION .) endif() if(EXISTS ${CMAKE_CURRENT_BINARY_DIR}/${test_name}.sh) add_test(${test_name} ${CMAKE_CURRENT_BINARY_DIR}/${test_name}.sh) elseif(EXISTS ${CMAKE_CURRENT_SOURCE_DIR}/${test_name}.verified) add_test(${test_name} ${AKANTU_DIFF_SCRIPT} ${test_name} ${CMAKE_CURRENT_SOURCE_DIR}/${test_name}.verified) else() add_test(${test_name} ${CMAKE_CURRENT_BINARY_DIR}/${test_name}) endif() endmacro() #=============================================================================== -macro(add_akantu_test test_name desc) +macro(add_akantu_test1 test_name desc) manage_test_and_example(${test_name} ${desc} AKANTU_BUILD_ALL_TESTS _ ${ARGN}) endmacro() #=============================================================================== # Examples #=============================================================================== if(AKANTU_EXAMPLES) option(AKANTU_BUILD_ALL_EXAMPLES "Build all examples") -# mark_as_advanced(AKANTU_BUILD_ALL_EXAMPLES) + # mark_as_advanced(AKANTU_BUILD_ALL_EXAMPLES) endif(AKANTU_EXAMPLES) #=============================================================================== macro(register_example example_name) add_executable(${example_name} ${ARGN}) target_link_libraries(${example_name} akantu ${AKANTU_EXTERNAL_LIBRARIES}) endmacro() #=============================================================================== macro(add_example example_name desc) manage_test_and_example(${example_name} ${desc} AKANTU_BUILD_ALL_EXAMPLES _EXAMPLE_ ${ARGN}) endmacro() #=============================================================================== -function(register_test test_name) +function(register_test1 test_name) set(multi_variables SOURCES FILES_TO_COPY DEPENDENCIES DIRECTORIES_TO_CREATE COMPILE_OPTIONS EXTRA_FILES ) cmake_parse_arguments(register_test "" "PACKAGE" "${multi_variables}" ${ARGN} ) # add the test in a package if needed set(_test_define_package 0) set(_package_name AKANTU_CORE) if(register_test_PACKAGE) package_pkg_name(${register_test_PACKAGE} _package_name) set(_test_define_package 1) list(FIND ${_package_name}_TESTS ${test_name} _ret) if(_ret EQUAL -1) list(APPEND ${_package_name}_TESTS ${test_name}) endif() endif() # check if the test should be activated set(_activate_test 0) foreach(_pkg ${${_project}_PACKAGE_SYSTEM_PACKAGES_ON}) package_pkg_name(${_pkg} _package_name) list(FIND ${_package_name}_TESTS ${test_name} _ret) if(NOT _ret EQUAL -1) set(_activate_test 1) endif() endforeach() # check if the package is registered in at least a package set(_present_in_packages 0) foreach(_pkg ${${_project}_PACKAGE_SYSTEM_PACKAGES_NAMES_LIST_ALL}) package_pkg_name(${_pkg} _package_name) list(FIND ${_package_name}_TESTS ${test_name} _ret) if(NOT _ret EQUAL -1) set(_present_in_packages 1) endif() endforeach() if(NOT _present_in_packages AND NOT _test_define_package) message("The test ${test_name} is not registered in any packages") endif() if(_activate_test) set(_source_file) foreach(_file ${register_test_SOURCES} ${register_test_UNPARSED_ARGUMENTS} ${register_test_EXTRA_FILES}) if(EXISTS ${CMAKE_CURRENT_SOURCE_DIR}/${_file}) list(APPEND _source_file ${CMAKE_CURRENT_SOURCE_DIR}/${_file}) else() message("The file \"${_file}\" registred by the test \"${test_name}\" does not exists") endif() endforeach() add_executable(${test_name} ${register_test_SOURCES} ${register_test_UNPARSED_ARGUMENTS}) set_property(TARGET ${test_name} APPEND PROPERTY INCLUDE_DIRECTORIES ${AKANTU_INCLUDE_DIRS} ${AKANTU_EXTERNAL_LIB_INCLUDE_DIR}) target_link_libraries(${test_name} akantu ${AKANTU_EXTERNAL_LIBRARIES}) if(register_test_COMPILE_OPTIONS) set_target_properties(${test_name} PROPERTIES COMPILE_DEFINITIONS "${register_test_COMPILE_OPTIONS}") endif() if(register_test_FILES_TO_COPY) foreach(_file ${register_test_FILES_TO_COPY}) file(COPY ${_file} DESTINATION .) list(APPEND _source_file ${CMAKE_CURRENT_SOURCE_DIR}/${_file}) endforeach() endif() if(register_test_DIRECTORIES_TO_CREATE) foreach(_dir ${register_test_DIRECTORIES_TO_CREATE}) if(IS_ABSOLUTE ${dir}) file(MAKE_DIRECTORY ${_dir}) else() file(MAKE_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/${_dir}) endif() endforeach() endif() foreach(_dep ${register_test_DEPENDENCIES}) add_dependencies(${test_name} ${_dep}) get_target_property(_dep_in_ressources ${_dep} RESSOURCES) if(_dep_in_ressources) list(APPEND _source_file ${_dep_in_ressources}) endif() endforeach() if(EXISTS ${CMAKE_CURRENT_SOURCE_DIR}/${test_name}.sh) file(COPY ${test_name}.sh DESTINATION .) list(APPEND _source_file ${CMAKE_CURRENT_SOURCE_DIR}/${test_name}.sh) add_test(${test_name}_run ${CMAKE_CURRENT_BINARY_DIR}/${test_name}.sh) elseif(EXISTS ${CMAKE_CURRENT_SOURCE_DIR}/${test_name}.verified) list(APPEND _source_file ${CMAKE_CURRENT_SOURCE_DIR}/${test_name}.verified) add_test(${test_name}_run ${AKANTU_DIFF_SCRIPT} ${test_name} ${CMAKE_CURRENT_SOURCE_DIR}/${test_name}.verified) else() add_test(${test_name}_run ${CMAKE_CURRENT_BINARY_DIR}/${test_name}) endif() set_tests_properties(${test_name}_run PROPERTIES DEPENDS ${test_name}) set(_tmp ${AKANTU_TESTS_FILES}) foreach(_file ${_source_file}) get_filename_component(_full ${_file} ABSOLUTE) file(RELATIVE_PATH __file ${PROJECT_SOURCE_DIR} ${_full}) list(APPEND _tmp ${__file}) list(APPEND _pkg_tmp ${__file}) endforeach() set(AKANTU_TESTS_FILES ${_tmp} CACHE INTERNAL "") set(${_package_name}_TESTS_FILES ${_pkg_tmp} CACHE INTERNAL "") - endif() + endif() +endfunction() + + + +# ============================================================================== +# this should be a macro due to the enable_testing +macro(add_test_tree dir) + if(AKANTU_TESTS) + enable_testing() + include(CTest) + mark_as_advanced(BUILD_TESTING) + + set(AKANTU_TESTS_EXCLUDE_FILES "" CACHE INTERNAL "") + + set(_akantu_current_parent_test ${dir} CACHE INTERNAL "Current test folder" FORCE) + set(_akantu_${dir}_tests_count 0 CACHE INTERNAL "" FORCE) + + string(TOUPPER ${dir} _u_dir) + set(AKANTU_BUILD_${_u_dir} ON CACHE INTERNAL "${desc}" FORCE) + + package_get_all_test_folders(_test_dirs) + + foreach(_dir ${_test_dirs}) + add_subdirectory(${_dir}) + endforeach() + else() + set(AKANTU_TESTS_EXCLUDE_FILES "${CMAKE_CURRENT_BINARY_DIR}/${dir}" CACHE INTERNAL "") + endif() +endmacro() + +# ============================================================================== +function(add_akantu_test dir desc) + set(_my_parent_dir ${_akantu_current_parent_test}) + + # initialize variables + set(_akantu_current_parent_test ${dir} CACHE INTERNAL "Current test folder" FORCE) + set(_akantu_${dir}_tests_count 0 CACHE INTERNAL "" FORCE) + + # set the option for this directory + string(TOUPPER ${dir} _u_dir) + option(AKANTU_BUILD_${_u_dir} "${desc}") + mark_as_advanced(AKANTU_BUILD_${_u_dir}) + + # add the sub-directory + add_subdirectory(${dir}) + + + # if no test can be activated make the option disappear + set(_force_deactivate_count FALSE) + if(${_akantu_${dir}_tests_count} EQUAL 0) + set(_force_deactivate_count TRUE) + endif() + + # if parent off make the option disappear + set(_force_deactivate_parent FALSE) + string(TOUPPER ${_my_parent_dir} _u_parent_dir) + if(NOT AKANTU_BUILD_${_u_parent_dir}) + set(_force_deactivate_parent TRUE) + endif() + + if(_force_deactivate_parent OR _force_deactivate_count OR AKANTU_BUILD_ALL_TESTS) + if(NOT DEFINED _AKANTU_BUILD_${_u_dir}_SAVE) + set(_AKANTU_BUILD_${_u_dir}_SAVE ${AKANTU_BUILD_${_u_dir}} CACHE INTERNAL "" FORCE) + endif() + unset(AKANTU_BUILD_${_u_dir} CACHE) + if(AKANTU_BUILD_ALL_TESTS AND NOT _force_deactivate_count) + set(AKANTU_BUILD_${_u_dir} ON CACHE INTERNAL "${desc}" FORCE) + else() + set(AKANTU_BUILD_${_u_dir} OFF CACHE INTERNAL "${desc}" FORCE) + endif() + else() + if(DEFINED _AKANTU_BUILD_${_u_dir}_SAVE) + unset(AKANTU_BUILD_${_u_dir} CACHE) + set(AKANTU_BUILD_${_u_dir} ${_AKANTU_BUILD_${_u_dir}_SAVE} CACHE BOOL "${desc}") + unset(_AKANTU_BUILD_${_u_dir}_SAVE CACHE) + endif() + endif() + + # adding up to the parent count + math(EXPR _tmp_parent_count "${_akantu_${dir}_tests_count} + ${_akantu_${_my_parent_dir}_tests_count}") + set(_akantu_${_my_parent_dir}_tests_count ${_tmp_parent_count} CACHE INTERNAL "" FORCE) + + # restoring the parent current dir + set(_akantu_current_parent_test ${_my_parent_dir} CACHE INTERNAL "Current test folder" FORCE) +endfunction() + + +# ============================================================================== +function(register_test test_name) + set(multi_variables + SOURCES FILES_TO_COPY DEPENDENCIES DIRECTORIES_TO_CREATE COMPILE_OPTIONS EXTRA_FILES + ) + + cmake_parse_arguments(_register_test + "" + "PACKAGE" + "${multi_variables}" + ${ARGN} + ) + + if(NOT _register_test_PACKAGE) + message(FATAL_ERROR "No reference package was defined for the test ${test_name} in folder ${CMAKE_CURRENT_SOURCE_DIR}") + endif() + + package_get_name(${_register_test_PACKAGE} _pkg_name) + package_is_activated(${_pkg_name} _act) + + if(_act) + math(EXPR _tmp_parent_count "${_akantu_${_akantu_current_parent_test}_tests_count} + 1") + set(_akantu_${_akantu_current_parent_test}_tests_count ${_tmp_parent_count} CACHE INTERNAL "" FORCE) + + string(TOUPPER ${_akantu_current_parent_test} _u_parent) + if(AKANTU_BUILD_${_u_parent}) + package_get_include_directories( + AKANTU_LIBRARY_INCLUDE_DIRS + ) + + package_get_external_informations( + AKANTU_EXTERNAL_INCLUDE_DIR + AKANTU_EXTERNAL_LIBRARIES + ) + # Register the executable to compile + add_executable(${test_name} ${_register_test_SOURCES} ${_register_test_UNPARSED_ARGUMENTS}) + set_property(TARGET ${test_name} APPEND + PROPERTY INCLUDE_DIRECTORIES ${AKANTU_LIBRARY_INCLUDE_DIRS} ${AKANTU_EXTERNAL_INCLUDE_DIR}) + target_link_libraries(${test_name} akantu ${AKANTU_EXTERNAL_LIBRARIES}) + + # add the extra compilation options + if(_register_test_COMPILE_OPTIONS) + set_target_properties(${test_name} + PROPERTIES COMPILE_DEFINITIONS "${_register_test_COMPILE_OPTIONS}") + endif() + + set(_test_all_files) + # add the different dependencies (meshes, local libraries, ...) + foreach(_dep ${_register_test_DEPENDENCIES}) + add_dependencies(${test_name} ${_dep}) + get_target_property(_dep_in_ressources ${_dep} RESSOURCES) + + if(_dep_in_ressources) + list(APPEND _test_all_files ${_dep_in_ressources}) + endif() + endforeach() + + # copy the needed files to the build folder + if(_register_test_FILES_TO_COPY) + foreach(_file ${_register_test_FILES_TO_COPY}) + file(COPY ${_file} DESTINATION .) + list(APPEND _test_all_files ${CMAKE_CURRENT_SOURCE_DIR}/${_file}) + endforeach() + endif() + + # create the needed folders in the build folder + if(_register_test_DIRECTORIES_TO_CREATE) + foreach(_dir ${_register_test_DIRECTORIES_TO_CREATE}) + if(IS_ABSOLUTE ${dir}) + file(MAKE_DIRECTORY ${_dir}) + else() + file(MAKE_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/${_dir}) + endif() + endforeach() + endif() + + # add the source files in the list of all files + foreach(_file ${_register_test_SOURCES} ${_register_test_UNPARSED_ARGUMENTS} ${_register_test_EXTRA_FILES}) + if(EXISTS ${CMAKE_CURRENT_SOURCE_DIR}/${_file}) + list(APPEND _test_all_files ${CMAKE_CURRENT_SOURCE_DIR}/${_file}) + else() + message("The file \"${_file}\" registred by the test \"${test_name}\" does not exists") + endif() + endforeach() + + # register the test for ctest + if(EXISTS ${CMAKE_CURRENT_SOURCE_DIR}/${test_name}.sh) + file(COPY ${test_name}.sh DESTINATION .) + list(APPEND _test_all_files ${CMAKE_CURRENT_SOURCE_DIR}/${test_name}.sh) + add_test(${test_name}_run + ${CMAKE_CURRENT_BINARY_DIR}/${test_name}.sh) + elseif(EXISTS ${CMAKE_CURRENT_SOURCE_DIR}/${test_name}.verified) + list(APPEND _test_all_files ${CMAKE_CURRENT_SOURCE_DIR}/${test_name}.verified) + add_test(${test_name}_run + ${AKANTU_DIFF_SCRIPT} ${test_name} ${CMAKE_CURRENT_SOURCE_DIR}/${test_name}.verified) + else() + add_test(${test_name}_run + ${CMAKE_CURRENT_BINARY_DIR}/${test_name}) + endif() + + # add the executable as a dependency of the run + set_tests_properties(${test_name}_run PROPERTIES DEPENDS ${test_name}) + + # clean the list of all files for this test and add them in the total list + set(_tmp ${AKANTU_TESTS_FILES}) + foreach(_file ${_source_file}) + get_filename_component(_full ${_file} ABSOLUTE) + file(RELATIVE_PATH __file ${PROJECT_SOURCE_DIR} ${_full}) + list(APPEND _tmp ${__file}) + list(APPEND _pkg_tmp ${__file}) + endforeach() + set(AKANTU_TESTS_FILES ${_tmp} CACHE INTERNAL "") + endif() + endif() endfunction() \ No newline at end of file diff --git a/cmake/Modules/CMakePackagesSystem.cmake b/cmake/Modules/CMakePackagesSystem.cmake index 461d03656..2ab4cb5b2 100644 --- a/cmake/Modules/CMakePackagesSystem.cmake +++ b/cmake/Modules/CMakePackagesSystem.cmake @@ -1,413 +1,975 @@ #=============================================================================== # @file CMakePackagesSystem.cmake # -# @author Guillaume Anciaux # @author Nicolas Richart +# @author Guillaume Anciaux # # @date creation: Thu Dec 20 2012 # @date last modification: Wed Sep 10 2014 # # @brief Set of macros used by akantu to handle the package system # # @section LICENSE # # Copyright (©) 2014 EPFL (Ecole Polytechnique Fédérale de Lausanne) # Laboratory (LSMS - Laboratoire de Simulation en Mécanique des Solides) # # Akantu is free software: you can redistribute it and/or modify it under the # terms of the GNU Lesser General Public License as published by the Free # Software Foundation, either version 3 of the License, or (at your option) any # later version. # # Akantu 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 Lesser General Public License for more # details. # # You should have received a copy of the GNU Lesser General Public License # along with Akantu. If not, see . # #=============================================================================== include(CMakeParseArguments) + #=============================================================================== # Package Management #=============================================================================== if(__CMAKE_PACKAGES_SYSTEM) return() endif() set(__CMAKE_PACKAGES_SYSTEM TRUE) + include(CMakeDebugMessages) cmake_register_debug_message_module(PackagesSystem) -macro(package_pkg_name PKG PKG_NAME) - string(TOUPPER ${PROJECT_NAME} _project) - string(TOUPPER ${PKG} _u_package) - set(${PKG_NAME} ${_project}_${_u_package}) -endmacro() +#=============================================================================== +option(AUTO_MOVE_UNKNOWN_FILES + "Give to cmake the permission to move the unregistered files to the ${PROJECT_SOURCE_DIR}/tmp directory" FALSE) -macro(package_opt_name PKG OPT_NAME) - string(TOUPPER ${PROJECT_NAME} _project) - string(TOUPPER ${PKG} _u_package) - set(${OPT_NAME} ${_project}_USE_${_u_package}) -endmacro() +mark_as_advanced(AUTO_MOVE_UNKNOWN_FILES) -macro(package_nature PKG NATURE) +# ============================================================================== +# Accessors +# ============================================================================== +# Package name +function(package_get_name pkg pkg_name) string(TOUPPER ${PROJECT_NAME} _project) - string(TOUPPER ${PKG} _u_package) - set(${NATURE} ${_project}_${_u_package}_NATURE) -endmacro() + string(REPLACE "-" "_" _str_pkg "${pkg}") + string(TOUPPER ${_str_pkg} _u_package) + set(${pkg_name} ${_project}_PKG_${_u_package} PARENT_SCOPE) +endfunction() + +# ------------------------------------------------------------------------------ +# Real name +function(package_get_real_name pkg_name real_name) + set(${real_name} ${${pkg_name}} PARENT_SCOPE) +endfunction() + +function(_package_set_real_name pkg_name real_name) + set(${pkg_name} ${real_name} CACHE INTERNAL "" FORCE) +endfunction() + +# ------------------------------------------------------------------------------ +# Option name +function(package_get_option_name pkg_name opt_name) + string(TOUPPER "${PROJECT_NAME}" _project) + package_get_real_name(${pkg_name} _real_name) + string(TOUPPER "${_real_name}" _u_package) + + package_get_nature(${pkg_name} _nature) + + if(${_nature} MATCHES "internal" OR ${_nature} MATCHES "meta") + set(${opt_name} ${_project}_${_u_package} PARENT_SCOPE) + elseif(${_nature} MATCHES "external") + set(${opt_name} ${_project}_USE_${_u_package} PARENT_SCOPE) + else() + set(${opt_name} UNKNOWN_NATURE_${_project}_${_u_package} PARENT_SCOPE) + endif() +endfunction() + +# ------------------------------------------------------------------------------ +# Set if system package or compile external lib +function(_package_set_system_option pkg_name default) + string(TOUPPER "${PROJECT_NAME}" _project) + package_get_real_name(${pkg_name} _real_name) + string(TOUPPER "${_real_name}" _u_package) + + option(${_project}_USE_SYSTEM_${_u_package} + "Should akantu compile the third-party: \"${_real_name}\"" ${default}) + mark_as_advanced(${_project}_USE_SYSTEM_${_u_package}) +endfunction() + +function(package_use_system pkg_name use) + string(TOUPPER "${PROJECT_NAME}" _project) + package_get_real_name(${pkg_name} _real_name) + string(TOUPPER "${_real_name}" _u_package) + if(DEFINED ${_project}_USE_SYSTEM_${_u_package}) + set(${use} ${${_project}_USE_SYSTEM_${_u_package}} PARENT_SCOPE) + else() + set(${use} TRUE) + endif() +endfunction() -macro(package_desc_name PKG DESC_NAME) - string(TOUPPER ${PROJECT_NAME} _project) - string(TOUPPER ${PKG} _u_package) - set(${DESC_NAME} ${_project}_DESC_${_u_package}) -endmacro() +# ------------------------------------------------------------------------------ +# Nature +function(_package_set_nature pkg_name NATURE) + set(${pkg_name}_NATURE ${NATURE} CACHE INTERNAL "" FORCE) +endfunction() -#=============================================================================== -option(AUTO_MOVE_OLD_FILES "give cmake permission to move the unregistered files to ${PROJECT_SOURCE_DIR}/tmp directory" FALSE) -mark_as_advanced(AUTO_MOVE_OLD_FILES) +function(package_get_nature pkg_name NATURE) + if(${pkg_name}_NATURE) + set(${NATURE} ${${pkg_name}_NATURE} PARENT_SCOPE) + else() + set(${NATURE} "unknown" PARENT_SCOPE) + endif() +endfunction() -macro(add_all_packages package_dir src_dir) - string(TOUPPER ${PROJECT_NAME} _project) - cmake_debug_message(PackagesSystem "add_all_packages: PKG DIR : ${package_dir}") - file(GLOB ${_project}_package_list "${package_dir}/*.cmake") +# ------------------------------------------------------------------------------ +# Description +function(_package_set_description pkg_name DESC) + set(${pkg_name}_DESC ${DESC} CACHE INTERNAL "" FORCE) +endfunction() - set(_${_project}_src_dir ${src_dir}) +function(package_get_description pkg_name DESC) + if(${pkg_name}_DESC) + set(${DESC} ${${pkg_name}_DESC} PARENT_SCOPE) + else() + message("No description set for the package ${${pkg_name}}") + endif() +endfunction() - set(_package_files) - foreach(_pkg ${${_project}_package_list}) - get_filename_component(_basename ${_pkg} NAME) - list(APPEND _package_files ${_basename}) - endforeach() +# ------------------------------------------------------------------------------ +# Package file name +function(_package_set_filename pkg_name FILE) + set(${pkg_name}_FILE ${FILE} CACHE INTERNAL "" FORCE) +endfunction() - if(_package_files) - list(SORT _package_files) +function(package_get_filename pkg_name FILE) + if(${pkg_name}_FILE) + set(${FILE} ${${pkg_name}_FILE} PARENT_SCOPE) + else() + message(ERROR "No filename set for the package ${${pkg_name}}") endif() +endfunction() + +# ------------------------------------------------------------------------------ +# Source folder +function(_package_set_sources_folder pkg_name src_folder) + set(${pkg_name}_SRCS_FOLDER ${src_folder} CACHE INTERNAL "" FORCE) +endfunction() + +function(package_get_sources_folder pkg_name src_folder) + set(${src_folder} ${${pkg_name}_SRCS_FOLDER} PARENT_SCOPE) +endfunction() + +# ------------------------------------------------------------------------------ +# Test folder +function(_package_set_tests_folder pkg_name test_folder) + set(${pkg_name}_TESTS_FOLDER ${test_folder} CACHE INTERNAL "" FORCE) +endfunction() + +function(package_get_tests_folder pkg_name test_folder) + set(${test_folder} ${${pkg_name}_TESTS_FOLDER} PARENT_SCOPE) +endfunction() + + +# ------------------------------------------------------------------------------ +# Extra option for the find_package +function(_package_set_extra_options pkg_name) + set(${pkg_name}_OPTIONS ${ARGN} + CACHE INTERNAL "Extra option for the fin_package function" FORCE) +endfunction() + +function(package_get_extra_options pkg_name options) + set(${options} "${${pkg_name}_OPTIONS}" PARENT_SCOPE) +endfunction() + +# ------------------------------------------------------------------------------ +# Compilation flags +function(_package_set_compile_flags pkg_name) + set(${pkg_name}_COMPILE_FLAGS ${ARGN} + CACHE INTERNAL "Additional compile flags" FORCE) +endfunction() + +function(package_get_compile_flags pkg_name flags) + set(${flags} "${${pkg_name}_COMPILE_FLAGS}" PARENT_SCOPE) +endfunction() + +# ------------------------------------------------------------------------------ +# Include dir +function(package_set_include_dir pkg_name) + package_get_real_name(${pkg_name} _real_name) + set(${pkg_name}_INCLUDE_DIR "${ARGN}" + CACHE INTERNAL "Include folder for the package ${_real_name}" FORCE) +endfunction() + +function(package_get_include_dir pkg_name include_dir) + set(${include_dir} ${${pkg_name}_INCLUDE_DIR} PARENT_SCOPE) +endfunction() + +# ------------------------------------------------------------------------------ +# Libraries +function(package_set_libraries pkg_name) + package_get_real_name(${pkg_name} _real_name) + set(${pkg_name}_LIBRARIES "${ARGN}" + CACHE INTERNAL "Libraries for the package ${_real_name}" FORCE) +endfunction() + +function(package_get_libraries pkg_name libraries) + set(${libraries} ${${pkg_name}_LIBRARIES} PARENT_SCOPE) +endfunction() + +# ------------------------------------------------------------------------------ +# Extra dependencies like custom commands of ExternalProject +function(package_add_extra_dependency PACKAGE) + package_get_name(${PACKAGE} _pkg_name) + set(_tmp_dep ${${pkg_name}_EXTRA_DEPENDS}) + list(APPEND _tmp_dep ${ARGN}) + list(REMOVE_DUPLICATES _tmp_dep) + set(${pkg_name}_EXTRA_DEPENDS ${_tmp_dep} CACHE INTERNAL "External dependencies" FORCE) +endfunction() + +function(package_get_extra_dependency PACKAGE deps) + package_get_name(${PACKAGE} _pkg_name) + set(${deps} ${${pkg_name}_EXTRA_DEPENDS} PARENT_SCOPE) +endfunction() + +# ------------------------------------------------------------------------------ +# Activate/deactivate +function(package_activate pkg_name) + set(${pkg_name}_STATE ON CACHE INTERNAL "" FORCE) +endfunction() + +function(package_deactivate pkg_name) + set(${pkg_name}_STATE OFF CACHE INTERNAL "" FORCE) +endfunction() + +function(package_is_activated pkg_name _act) + if(${pkg_name}_STATE) + set(${_act} TRUE PARENT_SCOPE) + else() + set(${_act} FALSE PARENT_SCOPE) + endif() +endfunction() + +# ------------------------------------------------------------------------------ +# Direct dependencies +function(_package_set_dependencies pkg_name) + set(${pkg_name}_DEPENDENCIES "${ARGN}" + CACHE INTERNAL "List of dependencies for package ${_opt_name}" FORCE) +endfunction() + +function(package_get_dependencies pkg_name dependencies) + set(${dependencies} "${${pkg_name}_DEPENDENCIES}" PARENT_SCOPE) +endfunction() + +# ------------------------------------------------------------------------------ +# Functions to handle reverse dependencies +# ------------------------------------------------------------------------------ +function(_package_set_rdependencies pkg_name) + set(${pkg_name}_RDEPENDENCIES "${ARGN}" + CACHE INTERNAL "Dependencies ON with package ${pkg_name}" FORCE) +endfunction() + +function(package_get_rdependencies pkg_name RDEPENDENCIES) + set(${RDEPENDENCIES} "${${pkg_name}_RDEPENDENCIES}" PARENT_SCOPE) +endfunction() + +function(_package_add_rdependency pkg_name rdep) + # store the reverse dependency + set(_rdeps ${${pkg_name}_RDEPENDENCIES}) + list(APPEND _rdeps ${rdep}) + list(REMOVE_DUPLICATES _rdeps) + _package_set_rdependencies(${pkg_name} ${_rdeps}) +endfunction() + +function(_package_remove_rdependency pkg_name rdep) + set(_rdeps ${${pkg_name}_RDEPENDENCIES}) + list(FIND _rdeps ${rdep} pos) + if(NOT pos EQUAL -1) + list(REMOVE_AT _rdeps ${pos}) + _package_set_rdependencies(${pkg_name} ${_rdeps}) + endif() +endfunction() + +# ------------------------------------------------------------------------------ +# Function to handle forcing dependencies (Package turn ON that enforce their +# dependencies ON) +# ------------------------------------------------------------------------------ +function(_package_set_fdependencies pkg_name) + set(${pkg_name}_FDEPENDENCIES "${ARGN}" + CACHE INTERNAL "Dependencies ON with package ${pkg_name}" FORCE) +endfunction() + +function(package_get_fdependencies pkg_name fdependencies) + set(${fdependencies} "${${pkg_name}_FDEPENDENCIES}" PARENT_SCOPE) +endfunction() + +function(_package_add_fdependency pkg_name fdep) + # store the enforcing dependency + set(_fdeps ${${pkg_name}_FDEPENDENCIES}) + list(APPEND _fdeps ${fdep}) + list(REMOVE_DUPLICATES _fdeps) + _package_set_fdependencies(${pkg_name} ${_fdeps}) +endfunction() + +function(_package_remove_fdependency pkg_name fdep) + set(_fdeps ${${pkg_name}_FDEPENDENCIES}) + list(FIND _fdeps ${fdep} pos) + if(NOT pos EQUAL -1) + list(REMOVE_AT _fdeps ${pos}) + _package_set_fdependencies(${pkg_name} ${_fdeps}) + endif() +endfunction() + +# ============================================================================== +# Internal functions +# ============================================================================== - set(${_project}_PACKAGE_SYSTEM_PACKAGES_NAMES_LIST_ALL) - foreach(_pkg ${_package_files}) - string(REGEX REPLACE "[0-9]+_" "" _pkg_name ${_pkg}) - string(REGEX REPLACE "\\.cmake" "" _option_name ${_pkg_name}) - string(TOUPPER "${_option_name}" _option_name) - set(${_project}_${_option_name}_FILE ${_pkg} CACHE INTERNAL "" FORCE) - list(APPEND ${_project}_PACKAGE_SYSTEM_PACKAGES_NAMES_LIST_ALL ${_option_name}) +# ------------------------------------------------------------------------------ +# Build the reverse dependencies from the dependencies +# ------------------------------------------------------------------------------ +function(_package_build_rdependencies) + string(TOUPPER ${PROJECT_NAME} _project) + + # set empty lists + foreach(_pkg_name ${${_project}_ALL_PACKAGES_LIST}) + set(${_pkg_name}_rdeps) endforeach() - cmake_debug_message(PackagesSystem "add_all_packages: PKG LIST : ${${_project}_PACKAGE_SYSTEM_PACKAGES_NAMES_LIST_ALL}") + # fill the dependencies list + foreach(_pkg_name ${${_project}_ALL_PACKAGES_LIST}) + package_get_dependencies(${_pkg_name} _deps) + foreach(_dep_name ${_deps}) + list(APPEND ${_dep_name}_rdeps ${_pkg_name}) + endforeach() + endforeach() + + # clean and set the reverse dependencies + foreach(_pkg_name ${${_project}_ALL_PACKAGES_LIST}) + if(${_pkg_name}_rdeps) + list(REMOVE_DUPLICATES ${_pkg_name}_rdeps) + _package_set_rdependencies(${_pkg_name} ${${_pkg_name}_rdeps}) + endif() + endforeach() +endfunction() -# message("Packages: ${${_project}_PACKAGE_SYSTEM_PACKAGES_NAMES_LIST_ALL}") +# ------------------------------------------------------------------------------ +# This function resolve the dependance order run the needed find_packages +# ------------------------------------------------------------------------------ +function(_package_load_packages) + string(TOUPPER ${PROJECT_NAME} _project) - foreach(_pkg ${${_project}_PACKAGE_SYSTEM_PACKAGES_NAMES_LIST_ALL}) - cmake_debug_message(PackagesSystem "add_all_packages: including ${_pkg}") - string(TOLOWER "${_pkg}" _l_pkg) - include(${package_dir}/${${_project}_${_pkg}_FILE}) - package_pkg_name(${_l_pkg} _package_name) - if (${_package_name}) - list(APPEND ${_project}_PACKAGE_SYSTEM_PACKAGES_ON ${_l_pkg}) - list(APPEND ${_project}_PACKAGE_LIST ${_pkg}) - else (${_package_name}) - list(APPEND ${_project}_PACKAGE_SYSTEM_PACKAGES_OFF ${_l_pkg}) + # Activate the dependencies of activated package and generate an ordered list + # of dependencies + set(ordered_loading_list) + foreach(_pkg_name ${${_project}_ALL_PACKAGES_LIST}) + _package_load_dependencies_package(${_pkg_name} ordered_loading_list) + endforeach() + + # Load the packages in the propoer order + foreach(_pkg_name ${ordered_loading_list}) + package_use_system(${_pkg_name} _use_system) + if(_use_system) + _package_load_package(${_pkg_name}) endif() + endforeach() - foreach(_file ${${_package_name}_FILES}) - list(APPEND ${_project}_release_all_files ${_file}) - endforeach() + # generates the activated and unactivated lists of packages + set(_packages_activated) + set(_packages_deactivated) + foreach(_pkg_name ${${_project}_ALL_PACKAGES_LIST}) + package_is_activated(${_pkg_name} _act) + if(_act) + list(APPEND _packages_activated ${_pkg_name}) + else() + list(APPEND _packages_deactivated ${_pkg_name}) + endif() endforeach() - cmake_debug_message(PackagesSystem "add_all_packages: ON PKG : ${${_project}_PACKAGE_SYSTEM_PACKAGES_ON}") - cmake_debug_message(PackagesSystem "add_all_packages: ALL RELEASE FILES LIST : ${_project}_release_all_files ${${_project}_release_all_files}") + # generate the list usable by the calling code + set(${_project}_ACTIVATED_PACKAGE_LIST "${_packages_activated}" + CACHE INTERNAL "List of activated packages" FORCE) + set(${_project}_DEACTIVATED_PACKAGE_LIST "${_packages_deactivated}" + CACHE INTERNAL "List of deactivated packages" FORCE) +endfunction() + - #check if there are some file in the release that are not registered in a package - file(GLOB_RECURSE ${_project}_all_files "*.cc" "*.hh" "*.c" "*.h" "*.hpp") - cmake_debug_message(PackagesSystem "add_all_packages: ALL FILES LIST : ${_project}_all_files ${${_project}_all_files}") - cmake_debug_message(PackagesSystem "add_all_packages: SOURCE DIR : ${_${_project}_src_dir}") - foreach(_file ${${_project}_all_files}) - if("${_file}" MATCHES "${_${_project}_src_dir}") - file(RELATIVE_PATH __file "${_${_project}_src_dir}" ${_file}) - list(APPEND ${_project}_all_files_relatives ${__file}) +# ------------------------------------------------------------------------------ +# This load an external package and recursively all its dependencies +# ------------------------------------------------------------------------------ +function(_package_load_dependencies_package pkg_name loading_list) + # Get packages informations + package_get_option_name(${pkg_name} _pkg_option_name) + package_get_dependencies(${pkg_name} _dependencies) + + # handle the dependencies + foreach(_dep_name ${_dependencies}) + package_get_description(${_dep_name} _dep_desc) + package_get_option_name(${_dep_name} _dep_option_name) + + package_get_fdependencies(${_dep_name} _fdeps) + if(${_pkg_option_name}) + if("${_fdeps}" STREQUAL "") + set(${_dep_name}_OLD ${${_dep_option_name}} CACHE INTERNAL "" FORCE) + endif() + + # set the option to on + set(${_dep_option_name} ON CACHE BOOL "${_dep_desc}" FORCE) + + # store the reverse dependency + _package_add_fdependency(${_dep_name} ${pkg_name}) + else() + # check if this is the last reverse dependency + list(LENGTH _fdeps len) + list(FIND _fdeps ${pkg_name} pos) + if((len EQUAL 1) AND (NOT pos EQUAL -1)) + set(${_dep_option_name} ${${_dep_name}_OLD} CACHE BOOL "${_dep_desc}" FORCE) + unset(${_dep_name}_OLD CACHE) + endif() + + # remove the pkg_name form the reverse dependency + _package_remove_fdependency(${_dep_name} ${pkg_name}) endif() + + # recusively load the dependencies + _package_load_dependencies_package(${_dep_name} ${loading_list}) endforeach() - foreach(_file ${${_project}_all_files_relatives}) - if(NOT ${_file} MATCHES "test.*" AND NOT ${_file} MATCHES "third-party" AND NOT ${_file} MATCHES "doc") - list(FIND ${_project}_release_all_files ${_file} _index) - if (_index EQUAL -1) - list(APPEND ${_project}_missing_files_in_packages ${_file}) + # get the compile flags + package_get_compile_flags(${pkg_name} _pkg_comile_flags) + + # if package option is on add it in the list + if(${_pkg_option_name}) + list(FIND ${loading_list} ${pkg_name} _pos) + if(_pos EQUAL -1) + set(_tmp_loading_list ${${loading_list}}) + list(APPEND _tmp_loading_list ${pkg_name}) + set(${loading_list} "${_tmp_loading_list}" PARENT_SCOPE) + endif() + + #add the comilation flags if needed + if(_pkg_comile_flags) + add_flags(cxx ${_pkg_comile_flags}) + endif() + else() + package_deactivate(${pkg_name}) + + #remove the comilation flags if needed + if(_pkg_comile_flags) + remove_flags(cxx ${_pkg_comile_flags}) + endif() + endif() +endfunction() + +# ------------------------------------------------------------------------------ +# Load the package if it is an external one +# ------------------------------------------------------------------------------ +function(_package_load_package pkg_name) + package_get_option_name(${pkg_name} _pkg_option_name) + + # load the package if it is an external + package_get_nature(${pkg_name} _nature) + if(${_nature} MATCHES "external") + package_get_extra_options(${pkg_name} _options) + if(_options) + cmake_parse_arguments(_opt_pkg "" "LANGUAGE" "PREFIX;FOUND;ARGS" ${_options}) + if(_opt_pkg_UNPARSED_ARGUMENTS) + message("You passed too many options for the find_package related to ${${pkg_name}} \"${_opt_pkg_UNPARSED_ARGUMENTS}\"") endif() endif() - endforeach() - if (${_project}_missing_files_in_packages) - message("The files:") - message("*****************") - foreach(_file ${${_project}_missing_files_in_packages}) - message("${_file}") - endforeach() - message("*****************") - message("are not registered in any package.") - if (NOT AUTO_MOVE_OLD_FILES) - message("Please append these files in one of the packages within directory - ${PROJECT_SOURCE_DIR}/packages -or remove the files if useless. -") - message(FATAL_ERROR "abort") - else() - message("These files are getting displaced to directory ${PROJECT_SOURCE_DIR}/tmp/") - message("creating directory ${PROJECT_SOURCE_DIR}/tmp/") - file(MAKE_DIRECTORY ${PROJECT_SOURCE_DIR}/tmp/) - foreach(_file ${${_project}_missing_files_in_packages}) - get_filename_component(fname ${_file} NAME) - message("renaming ${src_dir}/${_file} to ${PROJECT_SOURCE_DIR}/tmp/${fname}") - file(RENAME ${src_dir}/${_file} ${PROJECT_SOURCE_DIR}/tmp/${fname}) + + if(_opt_pkg_LANGUAGE) + foreach(_language ${_opt_pkg_LANGUAGE}) + enable_language(${_language}) endforeach() endif() - endif() - if(${_project}_missing_files_in_packages) - message("A complete list of files missing in the packages description can be found here: ${PROJECT_BINARY_DIR}/missing_files_in_packages") - if(EXISTS ${PROJECT_BINARY_DIR}/missing_files_in_packages) - file(REMOVE ${PROJECT_BINARY_DIR}/missing_files_in_packages) + package_get_real_name(${pkg_name} _real_name) + + # find the package + find_package(${_real_name} REQUIRED ${_opt_pkg_ARGS}) + + # check if the package is found + if(_opt_pkg_PREFIX) + set(_package_prefix ${_opt_pkg_PREFIX}) + else() + string(TOUPPER ${${pkg_name}} _u_package) + set(_package_prefix ${_u_package}) endif() - foreach(_file ${${_project}_missing_files_in_packages}) - file(APPEND ${PROJECT_BINARY_DIR}/missing_files_in_packages "${_file} -") + + foreach(_prefix ${_package_prefix}) + if(${_prefix}_FOUND OR _opt_pkg_FOUND) + # Add the in the definition list + list(APPEND ${_project}_DEFINITIONS ${_option_name}) + + # Generate the include dir for the package + if(DEFINED ${_prefix}_INCLUDE_DIRS) + package_set_include_dir(${_pkg_name} ${${_prefix}_INCLUDE_DIRS}) + elseif(DEFINED ${_prefix}_INCLUDE_DIR) + package_set_include_dir(${_pkg_name} ${${_prefix}_INCLUDE_DIR}) + elseif(DEFINED ${_prefix}_INCLUDE_PATH) + package_set_include_dir(${_pkg_name} ${${_prefix}_INCLUDE_PATH}) + endif() + + # Generate the libraries for the package + package_set_libraries(${_pkg_name} ${${_prefix}_LIBRARIES}) + + package_activate(${_pkg_name}) + else() + package_deactivate(${_pkg_name}) + endif() endforeach() + elseif(${_nature} MATCHES "internal") + package_activate(${_pkg_name}) endif() +endfunction() - #check if there are some file in the package list that are not on the current directory - foreach(_file ${${_project}_release_all_files}) - list(FIND ${_project}_all_files_relatives ${_file} _index) - if (_index EQUAL -1) - message("The file ${_file} is registered in packages but is not present in the source directory.") - endif() +# ------------------------------------------------------------------------------ +# Sanity check functions +# ------------------------------------------------------------------------------ +function(_package_check_files_exists) + string(TOUPPER ${PROJECT_NAME} _project) + + set(_message FALSE) + + foreach(_pkg_name ${${_project}_ALL_PACKAGES_LIST}) + set(_pkg_files + ${${_pkg_name}_SRCS} + ${${_pkg_name}_PUBLIC_HEADERS} + ${${_pkg_name}_PRIVATE_HEADERS} + ) + + package_get_real_name(${_pkg_name} _real_name) + + foreach(_file ${_pkg_files}) + if(NOT EXISTS "${_file}") + if(NOT _message) + set(_message TRUE) + message("This file(s) is(are) present in a package but are not present on disk.") + endif() + + message(" PACKAGE ${_real_name} FILE ${_file}") + endif() + endforeach() endforeach() - #construct list of files for unactivated packages -# list(APPEND _tmp_${_project}_EXCLUDE_SOURCE_FILES ${${_project}_EXCLUDE_SOURCE_FILES}) - set(_tmp_${_project}_EXCLUDE_SOURCE_FILES "") - foreach(_pkg ${${_project}_PACKAGE_SYSTEM_PACKAGES_OFF}) - package_pkg_name(${_pkg} _pkg_name) - cmake_debug_message(PackagesSystem "add_all_packages: exlude ${_file}") - list(APPEND _tmp_${_project}_EXCLUDE_SOURCE_FILES ${${_pkg_name}_FILES}) + if(_message) + message(SEND_ERROR "Please check the content of your packages to correct this warnings") + endif() +endfunction() + +# ------------------------------------------------------------------------------ +function(_package_check_files_registered) + set(_pkg_files) + # generates a file list of registered files + foreach(_pkg_name ${${_project}_ALL_PACKAGES_LIST}) + list(APPEND _pkg_files + ${${_pkg_name}_SRCS} + ${${_pkg_name}_PUBLIC_HEADERS} + ${${_pkg_name}_PRIVATE_HEADERS} + ) endforeach() - set(${_project}_EXCLUDE_SOURCE_FILES "${_tmp_${_project}_EXCLUDE_SOURCE_FILES}" CACHE INTERNAL "File to exclude in the project ${_project} package" FORCE) - #check dependencies - foreach(_pkg ${${_project}_PACKAGE_SYSTEM_PACKAGES_OFF}) - # differentiate the file types - cmake_debug_message(PackagesSystem "add_all_packages: DEPENDS PKG : ${_pkg}") - cmake_debug_message(PackagesSystem "add_all_packages: DEPENDS LST : ${${_pkg}_DEPENDS}") - package_pkg_name(${_pkg} _pkg_name) - if (NOT "${${_pkg_name}_DEB_DEPEND}" STREQUAL "") - set(deb_depend "${deb_depend}, ${${_pkg}_DEB_DEPEND}") - endif() + # generates the list of files in the source folders + set(_all_src_files) + foreach(_src_folder ${ARGN}) + foreach(_ext "cc" "hh" "c" "h" "hpp") + file(GLOB_RECURSE _src_files "${_src_folder}/*.${_ext}") + list(APPEND _all_src_files ${_src_files}) + endforeach() endforeach() - set(${_project}_PACKAGE_SYSTEM_DEBIAN_PACKAGE_DEPENDS "${deb_depend}") -endmacro() -#=============================================================================== -macro(generate_source_list_from_packages source_dir source_files inline_files headers_files include_dirs) - string(TOUPPER ${PROJECT_NAME} _project) + if(_all_src_files) + list(REMOVE_DUPLICATES _all_src_files) + endif() - cmake_debug_message(PackagesSystem "generate_source_list_from_packages: SRC DIR : ${source_dir}") - foreach(_pkg ${${_project}_PACKAGE_SYSTEM_PACKAGES_ON}) - # differentiate the file types - package_pkg_name(${_pkg} _package_name) - cmake_debug_message(PackagesSystem "generate_source_list_from_packages: PKG ${_package_name} FILES : ${${_package_name}_FILES}") - foreach(_file ${${_package_name}_FILES}) - if(${_file} MATCHES ".*inline.*\\.cc") - list(APPEND ${_package_name}_inlines ${_file}) - elseif(${_file} MATCHES ".*\\.h+") - list(APPEND ${_package_name}_headers ${_file}) - else() - list(APPEND ${_package_name}_srcs ${_file}) + set(_not_registerd_files) + # check only sources files ine the source folders + foreach(_src_folder ${ARGN}) + foreach(_file ${_all_src_files}) + if("${_file}" MATCHES "${_src_folder}") + list(FIND _pkg_files "${_file}" _index) + if (_index EQUAL -1) + list(APPEND _not_registerd_files ${_file}) + endif() endif() endforeach() + endforeach() - # generates the include directory variable - foreach(_file ${${_package_name}_headers}) - get_filename_component(_absolute_name ${_file} ABSOLUTE) - get_filename_component(_include_dir ${_absolute_name} PATH) - list(APPEND ${_package_name}_include_dirs ${_include_dir}) - list(REMOVE_DUPLICATES ${_package_name}_include_dirs) + if(AUTO_MOVE_UNKNOWN_FILES) + file(MAKE_DIRECTORY ${PROJECT_SOURCE_DIR}/tmp/) + endif() + + # warn the user and move the files if needed + if(_not_registerd_files) + if(EXISTS ${PROJECT_BINARY_DIR}/missing_files_in_packages) + file(REMOVE ${PROJECT_BINARY_DIR}/missing_files_in_packages) + endif() + + message("This files are present in the source folders but are not registered in any package") + foreach(_file ${_not_registerd_files}) + message(" ${_file}") + if(AUTO_MOVE_UNKNOWN_FILES) + get_filename_component(_file_name ${_file} NAME) + file(RENAME ${_file} ${PROJECT_SOURCE_DIR}/tmp/${_file_name}) + endif() + + file(APPEND ${PROJECT_BINARY_DIR}/missing_files_in_packages "${_file} +") endforeach() - # generate global lists for akantu to know what to build - list(APPEND ${source_files} ${${_package_name}_srcs}) - list(APPEND ${inline_files} ${${_package_name}_inlines}) - list(APPEND ${headers_files} ${${_package_name}_headers}) - list(APPEND ${include_dirs} ${${_package_name}_include_dirs}) + if(AUTO_MOVE_UNKNOWN_FILES) + message(SEND_ERROR "The files where moved in the followinf folder ${PROJECT_SOURCE_DIR}/tmp/") + endif() + message(SEND_ERROR "Please register them in the good package or clean the sources") + endif() +endfunction() - cmake_debug_message(PackagesSystem "generate_source_list_from_packages: PKG ${_package_name} SRCS : ${${_package_name}_srcs}") - cmake_debug_message(PackagesSystem "generate_source_list_from_packages: PKG ${_package_name} INLINES : ${${_package_name}_inlines}") - cmake_debug_message(PackagesSystem "generate_source_list_from_packages: PKG ${_package_name} HRDS : ${${_package_name}_headers}") - cmake_debug_message(PackagesSystem "generate_source_list_from_packages: PKG ${_package_name} INCS : ${${_package_name}_include_dirs}") - endforeach() +# ============================================================================== +# User Functions +# ============================================================================== - cmake_debug_message(PackagesSystem "generate_source_list_from_packages: SRCS : ${${source_files}}") - cmake_debug_message(PackagesSystem "generate_source_list_from_packages: HRDS : ${${headers_files}}") - cmake_debug_message(PackagesSystem "generate_source_list_from_packages: INCS : ${${include_dirs}}") -endmacro() +# ------------------------------------------------------------------------------ +# list all the packages in the PACKAGE_FOLDER +# extra packages can be given with an EXTRA_PACKAGE_FOLDER +# /.cmake +# +# Extra packages folder structure +# //package.cmake +# /src +# /test +# /manual +# +# ------------------------------------------------------------------------------ +function(package_list_packages PACKAGE_FOLDER) + cmake_parse_arguments(_opt_pkg + "" + "SOURCE_FOLDER;EXTRA_PACKAGES_FOLDER;TEST_FOLDER;MANUAL_FOLDER" + "" + ${ARGN}) -#=============================================================================== -# macro to include optional packages -macro(add_optional_external_package PACKAGE DESC DEFAULT) - package_opt_name (${PACKAGE} _option_name) - package_desc_name(${PACKAGE} _desc_name) - set(${_desc_name} ${DESC}) - package_nature(${PACKAGE} _nature) - set(${_nature} "external_optional") - option(${_option_name} ${DESC} ${DEFAULT}) - _add_external_package(${PACKAGE} ${ARGN}) -endmacro() - -macro(add_external_package PACKAGE) - package_opt_name (${PACKAGE} _option_name) - set(${_option_name} ON) - package_nature(${PACKAGE} _nature) - set(${_nature} "external") - _add_external_package(${PACKAGE} ${ARGN}) -endmacro() - - -macro(_add_external_package PACKAGE) string(TOUPPER ${PROJECT_NAME} _project) - cmake_parse_arguments(_opt_pkg "" "LANGUAGE" "DEPENDS;PREFIX;FOUND;ARGS" ${ARGN}) - package_pkg_name (${PACKAGE} _pkg_name) - package_opt_name (${PACKAGE} _option_name) + if(_opt_pkg_SOURCE_FOLDER) + set(_src_folder "${_opt_pkg_SOURCE_FOLDER}") + else() + set(_src_folder "src/") + endif() - cmake_debug_message(PackagesSystem "add_optional_package: Registering ${PACKAGE} ${DESC} -> ${_option_name}") + get_filename_component(_abs_src_folder ${_src_folder} ABSOLUTE) - if(_opt_pkg_PREFIX) - set(_package_prefix ${_opt_pkg_PREFIX}) + if(_opt_pkg_TEST_FOLDER) + set(_test_folder "${_opt_pkg_TEST_FOLDER}") else() - string(TOUPPER ${PACKAGE} _u_package) - set(_package_prefix ${_u_package}) + set(_test_folder "test/") endif() - if(${_option_name}) - if(_opt_pkg_LANGUAGE) - foreach(_language ${_opt_pkg_LANGUAGE}) - cmake_debug_message(PackagesSystem "add_optional_package: Package ${PACKAGE} asked for language ${_language}") - enable_language(${_language}) - endforeach() - endif() + get_filename_component(_abs_test_folder ${_test_folder} ABSOLUTE) - foreach(_dep ${_opt_pkg_DEPENDS}) - add_external_package_dependencies(${PACKAGE} ${_dep}) - endforeach() + # check all the packages in the + file(GLOB _package_list "${PACKAGE_FOLDER}/*.cmake") - find_package(${PACKAGE} REQUIRED ${_opt_pkg_ARGS}) + set(_package_files) + foreach(_pkg ${_package_list}) + get_filename_component(_basename ${_pkg} NAME) + list(APPEND _package_files ${_basename}) + endforeach() - foreach(_prefix ${_package_prefix}) - if(${_prefix}_FOUND OR _opt_pkg_FOUND) - list(APPEND ${_project}_DEFINITIONS ${_option_name}) - if(DEFINED ${_prefix}_INCLUDE_DIRS) - list(APPEND ${_project}_EXTERNAL_LIB_INCLUDE_DIR ${${_prefix}_INCLUDE_DIRS}) - set(${_pkg_name}_INCLUDE_DIR ${${_prefix}_INCLUDE_DIRS}) - elseif(DEFINED ${_prefix}_INCLUDE_DIR) - list(APPEND ${_project}_EXTERNAL_LIB_INCLUDE_DIR ${${_prefix}_INCLUDE_DIR}) - set(${_pkg_name}_INCLUDE_DIR ${${_prefix}_INCLUDE_DIR}) - elseif(DEFINED ${_prefix}_INCLUDE_PATH) - list(APPEND ${_project}_EXTERNAL_LIB_INCLUDE_DIR ${${_prefix}_INCLUDE_PATH}) - set(${_pkg_name}_INCLUDE_DIR ${${_prefix}_INCLUDE_PATH}) - endif() - list(APPEND ${_project}_EXTERNAL_LIBRARIES ${${_prefix}_LIBRARIES}) - set(${_pkg_name}_LIBRARIES ${${_prefix}_LIBRARIES}) - set(${_pkg_name} ON) - string(TOUPPER ${PACKAGE} _u_package) - list(APPEND ${_project}_OPTION_LIST ${_u_package}) - cmake_debug_message(PackagesSystem "add_optional_package: Package ${PACKAGE} found! (PREFIX: ${_prefix})") - cmake_debug_message(PackagesSystem "add_optional_package: Package ${PACKAGE} includes : ${${_pkg_name}_INCLUDE_DIR}") - cmake_debug_message(PackagesSystem "add_optional_package: Package ${PACKAGE} libraries: ${${_pkg_name}_LIBRARIES}") - cmake_debug_message(PackagesSystem "add_optional_package: option list: ${${_project}_OPTION_LIST}") - else(${_prefix}_FOUND) - cmake_debug_message(PackagesSystem "add_optional_package: Package ${PACKAGE} not found! (PREFIX: ${_prefix})") - set(${_pkg_name} OFF) - endif() - endforeach() - endif(${_option_name}) -endmacro() + if(_package_files) + list(SORT _package_files) + endif() -#=============================================================================== -# macro to add meta packages -macro(add_meta_package PKG DESC DEFAULT) - cmake_debug_message(PackagesSystem "add_meta_package: register meta option ${PKG} ${DESC} ${DEFAULT}") - package_pkg_name (${PKG} _pkg_name) - package_desc_name(${PKG} _desc_name) - - set(${_desc_name} ${DESC}) - option(${_pkg_name} ${DESC} ${DEFAULT}) - - foreach(_dep ${ARGN}) - package_opt_name (${_dep} _dep_name) - mark_as_advanced(${_dep_name}) - add_external_package_dependencies(${PKG} ${_dep}) + # check all packages + set(_packages_list_all) + foreach(_pkg_file ${_package_files}) + string(REGEX REPLACE "[0-9]+_" "" _pkg_file_stripped ${_pkg_file}) + string(REGEX REPLACE "\\.cmake" "" _pkg ${_pkg_file_stripped}) + + package_get_name(${_pkg} _pkg_name) + _package_set_filename(${_pkg_name} "${PACKAGE_FOLDER}/${_pkg_file}") + _package_set_sources_folder(${_pkg_name} "${_abs_src_folder}") + + _package_set_tests_folder(${_pkg_name} + "${_abs_test_folder}") + + list(APPEND _packages_list_all ${_pkg_name}) + include("${PACKAGE_FOLDER}/${_pkg_file}") endforeach() -endmacro() -#=============================================================================== -macro(_add_package_dependencies PKG DEP _dep_name) - package_pkg_name (${PKG} _opt_name) - package_desc_name(${DEP} _var_dep_desc) - package_pkg_name (${DEP} _dep_pkg_name) + # check the extra_packages if they exists + if(_opt_pkg_EXTRA_PACKAGES_FOLDER) + file(GLOB _extra_package_list RELATIVE + "${_opt_pkg_EXTRA_PACKAGES_FOLDER}" "${_opt_pkg_EXTRA_PACKAGES_FOLDER}/*") + foreach(_pkg ${_extra_package_list}) + if(EXISTS "${_opt_pkg_EXTRA_PACKAGES_FOLDER}/${_pkg}/package.cmake") - if (NOT ${_opt_name}_dependencies) - set(${_opt_name}_dependencies) - endif() + package_get_name(${_pkg} _pkg_name) - list(APPEND ${_opt_name}_dependencies ${_dep_pkg_name}) - list(REMOVE_DUPLICATES ${_opt_name}_dependencies) + _package_set_filename(${_pkg_name} + "${_opt_pkg_EXTRA_PACKAGES_FOLDER}/${_pkg}/package.cmake") - set(${_opt_name}_dependencies ${${_opt_name}_dependencies} CACHE INTERNAL "List of dependencies for package ${_opt_name}" FORCE) + _package_set_sources_folder(${_pkg_name} + "${_opt_pkg_EXTRA_PACKAGES_FOLDER}/${_pkg}/src") - cmake_debug_message(PackagesSystem "add_package_dependecies: add dependence between ${_opt_name} and ${_dep_name}") - set(_dep_desc ${_var_dep_desc}) + if(EXISTS "${_opt_pkg_EXTRA_PACKAGES_FOLDER}/${_pkg}/test") + _package_set_tests_folder(${_pkg_name} + "${_opt_pkg_EXTRA_PACKAGES_FOLDER}/${_pkg}/test") + endif() - cmake_debug_message(PackagesSystem "add_package_dependecies: ON dependencies of ${_dep_name} are: ${${_dep_name}_DEPS}") - cmake_debug_message(PackagesSystem "add_package_dependecies: saved value for ${_dep_name} is: ${${_dep_name}_OLD}") - if(${_opt_name}) - if("${${_dep_name}_DEPS}" STREQUAL "") - cmake_debug_message(PackagesSystem "add_package_dependecies: Save dep state ${_dep_name}:${${_dep_name}}") - set(${_dep_name}_OLD ${${_dep_name}} CACHE INTERNAL "${_dep_desc}" FORCE) - endif() + list(APPEND _extra_pkg_src_folders "${_opt_pkg_EXTRA_PACKAGES_FOLDER}/${_pkg}/src") + + list(APPEND _packages_list_all ${_pkg_name}) + include("${_opt_pkg_EXTRA_PACKAGES_FOLDER}/${_pkg}/package.cmake") + endif() + endforeach() + endif() - cmake_debug_message(PackagesSystem "add_package_dependecies: force value to ON ${_dep_name}") - set(${_dep_name} ON CACHE BOOL "${_dep_desc}" FORCE) + # Store the list of packages + string(TOUPPER ${PROJECT_NAME} _project) + set(${_project}_ALL_PACKAGES_LIST ${_packages_list_all} + CACHE INTERNAL "List of available packages" FORCE) + + _package_build_rdependencies() + _package_load_packages() + _package_check_files_exists() + _package_check_files_registered(${_abs_src_folder} ${_extra_pkg_src_folders}) +endfunction() + +# ------------------------------------------------------------------------------ +# macro to include internal/external packages packages +# package_declare( +# [EXTERNAL] [META] [ADVANCED] [NOT_OPTIONAL] +# [DESCRIPTION ] [DEFAULT ] +# [DEPENDS ...] +# [EXTRA_PACKAGE_OPTIONS ...] +# [COMPILE_FLAGS ]) +# ------------------------------------------------------------------------------ +function(package_declare PACKAGE) + package_get_name(${PACKAGE} _pkg_name) + _package_set_real_name(${_pkg_name} ${PACKAGE}) + + cmake_parse_arguments(_opt_pkg + "EXTERNAL;NOT_OPTIONAL;META;ADVANCED" + "DEFAULT;DESCRIPTION;SYSTEM" + "DEPENDS;EXTRA_PACKAGE_OPTIONS;COMPILE_FLAGS" + ${ARGN}) + + if(_opt_pkg_UNPARSED_ARGUMENTS) + message("You gave to many arguments while registering the package ${PACKAGE} \"${_opt_pkg_UNPARSED_ARGUMENTS}\"") + endif() - list(FIND ${_dep_name}_DEPS ${_opt_name} pos) - if(pos EQUAL -1) - list(APPEND ${_dep_name}_DEPS ${_opt_name}) - set(${_dep_name}_DEPS ${${_dep_name}_DEPS} CACHE INTERNAL "Dependencies ON with package ${_dep_name}" FORCE) - endif() + # set description + if(_opt_pkg_DESCRIPTION) + _package_set_description(${_pkg_name} ${_opt_pkg_DESCRIPTION}) else() - list(LENGTH ${_dep_name}_DEPS len) - list(FIND ${_dep_name}_DEPS ${_opt_name} pos) - if((len EQUAL 1) AND (NOT pos EQUAL -1)) - cmake_debug_message(PackagesSystem "add_package_dependecies: Restore state ${_dep_name}:${${_dep_name}} (${pos})") - set(${_dep_name} ${${_dep_name}_OLD} CACHE BOOL "${_dep_desc}" FORCE) - unset(${_dep_name}_OLD CACHE) + _package_set_description(${_pkg_name} "") + endif() + + # set the nature + if(_opt_pkg_EXTERNAL) + _package_set_nature(${_pkg_name} "external") + elseif(_opt_pkg_META) + _package_set_nature(${_pkg_name} "meta") + else() + _package_set_nature(${_pkg_name} "internal") + endif() + + package_get_option_name(${_pkg_name} _option_name) + package_get_description(${_pkg_name} _description) + + # get the default value + if(DEFINED _opt_pkg_DEFAULT) + set(_default ${_opt_pkg_DEFAULT}) + else() + if(_opt_pkg_NOT_OPTIONAL) + set(_default ON) + else() + set(_default OFF) endif() + endif() - if(NOT pos EQUAL -1) - list(REMOVE_AT ${_dep_name}_DEPS ${pos}) - set(${_dep_name}_DEPS ${${_dep_name}_DEPS} CACHE INTERNAL "Nb dependencies with package ${_dep_name}" FORCE) + # set the option if needed + if(_opt_pkg_NOT_OPTIONAL) + package_get_nature(${_pkg_name} _nature) + _package_set_nature(${_pkg_name} "${_nature}_not_optional") + set(${_option_name} ${_default} CACHE INTERNAL "${_description}" FORCE) + else() + option(${_option_name} "${_description}" ${_default}) + if(_opt_pkg_ADVANCED OR _opt_pkg_EXTERNAL) + mark_as_advanced(${_option_name}) endif() endif() -endmacro() + # Set the option for third-partie that can be compiled as an ExternalProject + if(DEFINED _opt_pkg_SYSTEM) + _package_set_system_option(${_pkg_name} ${_opt_pkg_SYSTEM}) + endif() -#=============================================================================== -macro(add_internal_package_dependencies PKG DEP) - package_pkg_name (${DEP} _dep_name) - _add_package_dependencies(${PKG} ${DEP} ${_dep_name}) -endmacro() + # set the dependecies + if(_opt_pkg_DEPENDS) + set(_depends) + foreach(_dep ${_opt_pkg_DEPENDS}) + package_get_name(${_dep} _dep_pkg_name) + list(APPEND _depends ${_dep_pkg_name}) + endforeach() + _package_set_dependencies(${_pkg_name} ${_depends}) + package_get_dependencies(${_pkg_name} _deps) + endif() -#=============================================================================== -macro(add_external_package_dependencies PKG DEP) - package_opt_name (${DEP} _dep_name) - _add_package_dependencies(${PKG} ${DEP} ${_dep_name}) -endmacro() + # keep the extra option for the future find package + if(_opt_pkg_EXTRA_PACKAGE_OPTIONS) + _package_set_extra_options(${_pkg_name} "${_opt_pkg_EXTRA_PACKAGE_OPTIONS}") + endif() + + # register the compilation flags + if(_opt_pkg_COMPILE_FLAGS) + _package_set_compile_flags(${_pkg_name} "${_opt_pkg_COMPILE_FLAGS}") + endif() + +endfunction() + +# ------------------------------------------------------------------------------ +# declare the source files of a given package +# +# package_declare_sources( +# SOURCES ... +# PUBLIC_HEADER
... +# PRIVATE_HEADER
...) +# ------------------------------------------------------------------------------ +function(package_declare_sources pkg) + package_get_name(${pkg} _pkg_name) + + # get 3 lists, if non of the options given try to distinguish the different lists + cmake_parse_arguments(_opt_pkg + "" + "" + "SOURCES;PUBLIC_HEADERS;PRIVATE_HEADERS" + ${ARGN}) + + set(_tmp_srcs ${_opt_pkg_SOURCES}) + set(_tmp_pub_hdrs ${_opt_pkg_PUBLIC_HEADER}) + set(_tmp_pri_hdrs ${_opt_pkg_PRIVATE_HEADERS}) + + foreach(_file ${_opt_pkg_UNPARSED_ARGUMENTS}) + if(${_file} MATCHES ".*inline.*\\.cc") + list(APPEND _tmp_pub_hdrs ${_file}) + elseif(${_file} MATCHES ".*\\.h+") + list(APPEND _tmp_pub_hdrs ${_file}) + else() + list(APPEND _tmp_srcs ${_file}) + endif() + endforeach() + + package_get_sources_folder(${_pkg_name} _src_folder) + + foreach(_type _srcs _pub_hdrs _pri_hdrs) + set(${_type}) + foreach(_file ${_tmp${_type}}) + # get the full name + list(APPEND ${_type} "${_src_folder}/${_file}") + endforeach() + endforeach() + + set(${_pkg_name}_SRCS "${_srcs}" + CACHE INTERNAL "List of sources files" FORCE) + set(${_pkg_name}_PUBLIC_HEADERS "${_pub_hdrs}" + CACHE INTERNAL "List of public header files" FORCE) + set(${_pkg_name}_PRIVATE_HEADERS "${_pri_hdrs}" + CACHE INTERNAL "List of private header files" FORCE) +endfunction() + +# ------------------------------------------------------------------------------ +# get the list of source files +# ------------------------------------------------------------------------------ +function(package_get_source_files SRCS PUBLIC_HEADERS PRIVATE_HEADERS) + string(TOUPPER ${PROJECT_NAME} _project) + + set(tmp_SRCS) + set(tmp_PUBLIC_HEADERS) + set(tmp_PRIVATE_HEADERS) + + foreach(_pkg_name ${${_project}_ACTIVATED_PACKAGE_LIST}) + foreach(_type SRCS PUBLIC_HEADERS PRIVATE_HEADERS) + foreach(_file ${${_pkg_name}_${_type}}) + string(REPLACE "${CMAKE_CURRENT_SOURCE_DIR}/" "" _rel_file "${_file}") + list(APPEND tmp_${_type} "${_rel_file}") + endforeach() + endforeach() + endforeach() + + set(${SRCS} ${tmp_SRCS} PARENT_SCOPE) + set(${PUBLIC_HEADERS} ${tmp_PUBLIC_HEADERS} PARENT_SCOPE) + set(${PRIVATE_HEADERS} ${tmp_PRIVATE_HEADERS} PARENT_SCOPE) +endfunction() + + +# ------------------------------------------------------------------------------ +# Get include directories +# ------------------------------------------------------------------------------ +function(package_get_include_directories inc_dirs) + string(TOUPPER ${PROJECT_NAME} _project) + + set(_tmp) + foreach(_pkg_name ${${_project}_ACTIVATED_PACKAGE_LIST}) + foreach(_type SRCS PUBLIC_HEADERS PRIVATE_HEADERS) + foreach(_file ${${_pkg_name}_${_type}}) + get_filename_component(_path "${_file}" PATH) + list(APPEND _tmp "${_path}") + endforeach() + endforeach() + endforeach() + + list(REMOVE_DUPLICATES _tmp) + + set(${inc_dirs} ${_tmp} PARENT_SCOPE) +endfunction() + +# ------------------------------------------------------------------------------ +# Get external libraries informations +# ------------------------------------------------------------------------------ +function(package_get_external_informations INCLUDE_DIR LIBRARIES) + set(tmp_INCLUDE_DIR) + set(tmp_LIBRARIES) + foreach(_pkg_name ${${_project}_ACTIVATED_PACKAGE_LIST}) + package_get_nature(${_pkg_name} _nature) + if(${_nature} MATCHES "external") + package_get_include_dir(${_pkg_name} _inc) + package_get_libraries (${_pkg_name} _lib) + + list(APPEND tmp_INCLUDE_DIR ${_inc}) + list(APPEND tmp_LIBRARIES ${_lib}) + endif() + endforeach() + + set(${INCLUDE_DIR} ${tmp_INCLUDE_DIR} PARENT_SCOPE) + set(${LIBRARIES} ${tmp_LIBRARIES} PARENT_SCOPE) +endfunction() + +# ------------------------------------------------------------------------------ +# Get extra dependencies like external projects +# ------------------------------------------------------------------------------ +function(package_get_all_extra_dependency DEPS) + set(_tmp_DEPS) + foreach(_pkg_name ${${_project}_ACTIVATED_PACKAGE_LIST}) + package_get_extra_dependency(${_pkg_name} _dep) + list(APPEND _tmp_DEPS ${_dep}) + endforeach() + list(REMOVE_DUPLICATES _tmp_DEPS) + set(${DEPS} ${_tmp_DEPS} PARENT_SCOPE) +endfunction() + +# ------------------------------------------------------------------------------ +# Get extra dependencies like external projects +# ------------------------------------------------------------------------------ +function(package_get_all_test_folders TEST_DIRS) + set(_tmp_TEST_DIRS) + foreach(_pkg_name ${${_project}_ACTIVATED_PACKAGE_LIST}) + package_get_tests_folder(${_pkg_name} _test_dir) + list(APPEND _tmp_TEST_DIRS ${_test_dir}) + endforeach() + list(REMOVE_DUPLICATES _tmp_TEST_DIRS) + set(${TEST_DIRS} ${_tmp_TEST_DIRS} PARENT_SCOPE) +endfunction() diff --git a/cmake/Modules/FindGMSH.cmake b/cmake/Modules/FindGMSH.cmake index 0f3722fd9..94f8d7305 100644 --- a/cmake/Modules/FindGMSH.cmake +++ b/cmake/Modules/FindGMSH.cmake @@ -1,81 +1,82 @@ #=============================================================================== # @file FindGMSH.cmake # # @author Nicolas Richart # # @date creation: Fri Oct 15 2010 # @date last modification: Tue Sep 09 2014 # # @brief Find gmsh and delacre the add_mesh macro # # @section LICENSE # # Copyright (©) 2014 EPFL (Ecole Polytechnique Fédérale de Lausanne) # Laboratory (LSMS - Laboratoire de Simulation en Mécanique des Solides) # # Akantu is free software: you can redistribute it and/or modify it under the # terms of the GNU Lesser General Public License as published by the Free # Software Foundation, either version 3 of the License, or (at your option) any # later version. # # Akantu 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 Lesser General Public License for more # details. # # You should have received a copy of the GNU Lesser General Public License # along with Akantu. If not, see . # #=============================================================================== find_program(GMSH gmsh DOC "The mesh generetor gmsh") mark_as_advanced(GMSH) find_package(PackageHandleStandardArgs) find_package_handle_standard_args(GMSH DEFAULT_MSG GMSH) #=============================================================================== macro(ADD_MESH MESH_TARGET GEO_FILE DIM ORDER) if(GMSH_FOUND) set(arguments ${MESH_TARGET} ${GEO_FILE} ${DIM} ${ORDER} ${ARGN} ) cmake_parse_arguments(ADD_MESH "" "OUTPUT" "" ${arguments} ) set(_geo_file ${CMAKE_CURRENT_SOURCE_DIR}/${GEO_FILE}) + set(_r_geo_file "${GEO_FILE}") + if(ADD_MESH_OUTPUT) set(_msh_file ${CMAKE_CURRENT_BINARY_DIR}/${ADD_MESH_OUTPUT}) + set(_r_msh_file "${ADD_MESH_OUTPUT}") else(ADD_MESH_OUTPUT) get_filename_component(_msh_file "${GEO_FILE}" NAME_WE) set(_msh_file ${CMAKE_CURRENT_BINARY_DIR}/${_msh_file}.msh) + set(_r_msh_file "${_msh_file.msh}") endif(ADD_MESH_OUTPUT) - string(REPLACE "${CMAKE_SOURCE_DIR}/" "" _r_geo_file "${_geo_file}") - string(REPLACE "${CMAKE_BINARY_DIR}/" "" _r_msh_file "${_msh_file}") - if(EXISTS ${_geo_file}) add_custom_command( OUTPUT ${_msh_file} DEPENDS ${_geo_file} COMMAND ${GMSH} ARGS -${DIM} -order ${ORDER} -optimize -o ${_msh_file} ${_geo_file} 2>&1 > /dev/null COMMENT "Generating the ${DIM}D mesh ${_r_msh_file} (order ${ORDER}) form the geometry ${_r_geo_file}" ) add_custom_target(${MESH_TARGET} DEPENDS ${_msh_file}) set_target_properties(${MESH_TARGET} PROPERTIES RESSOURCES ${_geo_file}) #else(EXISTS ${_geo_file}) # message("File ${_geo_file} not found") endif(EXISTS ${_geo_file}) endif(GMSH_FOUND) endmacro(ADD_MESH) diff --git a/cmake/Modules/FindMumps.cmake b/cmake/Modules/FindMumps.cmake index d5e2293fd..e8f6987b0 100644 --- a/cmake/Modules/FindMumps.cmake +++ b/cmake/Modules/FindMumps.cmake @@ -1,112 +1,111 @@ #=============================================================================== # @file FindMumps.cmake # # @author Nicolas Richart # # @date creation: Mon Dec 13 2010 # @date last modification: Tue Sep 09 2014 # # @brief The find_package file for the Mumps solver # # @section LICENSE # # Copyright (©) 2014 EPFL (Ecole Polytechnique Fédérale de Lausanne) # Laboratory (LSMS - Laboratoire de Simulation en Mécanique des Solides) # # Akantu is free software: you can redistribute it and/or modify it under the # terms of the GNU Lesser General Public License as published by the Free # Software Foundation, either version 3 of the License, or (at your option) any # later version. # # Akantu 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 Lesser General Public License for more # details. # # You should have received a copy of the GNU Lesser General Public License # along with Akantu. If not, see . # #=============================================================================== #=============================================================================== if(NOT MUMPS_TYPE) set(MUMPS_TYPE par) endif() if("${MUMPS_TYPE}" STREQUAL "seq") set(MUMPS_PREFIX _seq) else() unset(MUMPS_PREFIX) endif() find_library(MUMPS_LIBRARY_DMUMPS NAMES dmumps${MUMPS_PREFIX} HINTS ${MUMPS_DIR} /usr PATH_SUFFIXES lib ) find_library(MUMPS_LIBRARY_COMMON NAMES mumps_common${MUMPS_PREFIX} HINTS ${MUMPS_DIR} PATH_SUFFIXES lib ) find_library(MUMPS_LIBRARY_PORD NAMES pord${MUMPS_PREFIX} HINTS ${MUMPS_DIR} PATH_SUFFIXES lib ) find_path(MUMPS_INCLUDE_DIR dmumps_c.h HINTS ${MUMPS_DIR} PATH_SUFFIXES include ) mark_as_advanced(MUMPS_LIBRARY_COMMON) mark_as_advanced(MUMPS_LIBRARY_DMUMPS) mark_as_advanced(MUMPS_LIBRARY_PORD) mark_as_advanced(MUMPS_INCLUDE_DIR) set(MUMPS_LIBRARIES_ALL ${MUMPS_LIBRARY_DMUMPS} ${MUMPS_LIBRARY_COMMON} ${MUMPS_LIBRARY_PORD}) if("${MUMPS_TYPE}" STREQUAL "par") find_library(BLACS_LIBRARY_C NAME blacsC HINTS ${MUMPS_DIR} PATH_SUFFIXES lib) find_library(BLACS_LIBRARY_F77 NAME blacsF77 HINTS ${MUMPS_DIR} PATH_SUFFIXES lib) find_library(BLACS_LIBRARY NAME blacs HINTS ${MUMPS_DIR} PATH_SUFFIXES lib) - find_library(SCALAPACK_LIBRARIES NAME scalapack + find_library(SCALAPACK_LIBRARY NAME scalapack HINTS ${MUMPS_DIR} PATH_SUFFIXES lib) mark_as_advanced(BLACS_LIBRARY_C) mark_as_advanced(BLACS_LIBRARY_F77) mark_as_advanced(BLACS_LIBRARY) mark_as_advanced(SCALAPACK_LIBRARY) - mark_as_advanced(SCALAPACK_LIBRARIES) if(SCALAPACK_LIBRARY) set(BLACS_LIBRARIES_ALL ${BLACS_LIBRARIES_ALL} ${SCALAPACK_LIBRARY}) endif() if(BLACS_LIBRARY_F77) set(BLACS_LIBRARIES_ALL ${BLACS_LIBRARIES_ALL} ${BLACS_LIBRARY_F77}) endif() if(BLACS_LIBRARY) set(BLACS_LIBRARIES_ALL ${BLACS_LIBRARIES_ALL} ${BLACS_LIBRARY}) endif() if(BLACS_LIBRARY_C) set(BLACS_LIBRARIES_ALL ${BLACS_LIBRARIES_ALL} ${BLACS_LIBRARY_C}) endif() if(BLACS_LIBRARY_F77) set(BLACS_LIBRARIES_ALL ${BLACS_LIBRARIES_ALL} ${BLACS_LIBRARY_F77}) endif() endif() set(MUMPS_LIBRARIES ${MUMPS_LIBRARIES_ALL} ${BLACS_LIBRARIES_ALL} ${BLAS_LIBRARIES} ${LAPACK_LIBRARIES} CACHE INTERNAL "Libraries for MUMPS" FORCE) #=============================================================================== if(NOT MUMPS_FOUND) set(MUMPS_DIR "" CACHE PATH "Prefix of MUMPS library.") mark_as_advanced(MUMPS_DIR) endif() #=============================================================================== include(FindPackageHandleStandardArgs) find_package_handle_standard_args(Mumps DEFAULT_MSG MUMPS_LIBRARIES MUMPS_INCLUDE_DIR) \ No newline at end of file diff --git a/cmake/Modules/FindPTScotch.cmake b/cmake/Modules/FindPTScotch.cmake index 0daeffc97..4099b7a33 100644 --- a/cmake/Modules/FindPTScotch.cmake +++ b/cmake/Modules/FindPTScotch.cmake @@ -1,87 +1,108 @@ #=============================================================================== # @file FindPTScotch.cmake # # @author Nicolas Richart # # @date creation: Tue Apr 05 2011 # @date last modification: Fri Jan 04 2013 # # @brief The find_package file for PT-Scotch # # @section LICENSE # # Copyright (©) 2014 EPFL (Ecole Polytechnique Fédérale de Lausanne) # Laboratory (LSMS - Laboratoire de Simulation en Mécanique des Solides) # # Akantu is free software: you can redistribute it and/or modify it under the # terms of the GNU Lesser General Public License as published by the Free # Software Foundation, either version 3 of the License, or (at your option) any # later version. # # Akantu 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 Lesser General Public License for more # details. # # You should have received a copy of the GNU Lesser General Public License # along with Akantu. If not, see . # #=============================================================================== #=============================================================================== #if(PTSCOTCH_DIR) # set(PTSCOTCH_LIBRARY "NOTFOUND" CACHE INTERNAL "Cleared" FORCE) #endif(PTSCOTCH_DIR) find_library(PTSCOTCH_LIBRARY ptscotch PATHS ${PTSCOTCH_DIR} PATH_SUFFIXES src/libscotch lib ) find_library(PTSCOTCH_LIBRARY_ERR ptscotcherr PATHS ${PTSCOTCH_DIR} PATH_SUFFIXES src/libscotch lib ) find_library(PTSCOTCH_LIBRARY_ESMUMPS ptesmumps PATHS ${PTSCOTCH_DIR} PATH_SUFFIXES src/libscotch lib ) +find_library(PTSCOTCH_LIBRARY_METIS ptscotchmetis + PATHS ${PTSCOTCH_DIR} + PATH_SUFFIXES src/libscotch lib + ) + +find_library(PTSCOTCH_LIBRARY_PARMETIS ptscotchparmetis + PATHS ${PTSCOTCH_DIR} + PATH_SUFFIXES src/libscotch lib + ) + find_path(PTSCOTCH_INCLUDE_PATH ptscotch.h PATHS ${PTSCOTCH_DIR} PATH_SUFFIXES include scotch src/libscotch include/scotch ) #=============================================================================== -mark_as_advanced(PTSCOTCH_LIBRARY) -mark_as_advanced(PTSCOTCH_LIBRARY_ERR) -mark_as_advanced(PTSCOTCH_LIBRARY_ESMUMPS) -mark_as_advanced(PTSCOTCH_INCLUDE_PATH) +mark_as_advanced( + PTSCOTCH_LIBRARY + PTSCOTCH_LIBRARY_ERR + PTSCOTCH_LIBRARY_ESMUMPS + PTSCOTCH_LIBRARY_METIS + PTSCOTCH_LIBRARY_PARMETIS + PTSCOTCH_INCLUDE_PATH) set(PTSCOTCH_LIBRARIES_ALL ${PTSCOTCH_LIBRARY} ${PTSCOTCH_LIBRARY_ERR}) if(PTSCOTCH_LIBRARY_ESMUMPS) set(PTSCOTCH_LIBRARIES_ALL ${PTSCOTCH_LIBRARY_ESMUMPS} ${PTSCOTCH_LIBRARIES_ALL}) endif() +if(PTSCOTCH_LIBRARY_METIS) + set(PTSCOTCH_LIBRARIES_ALL ${PTSCOTCH_LIBRARY_METIS} ${PTSCOTCH_LIBRARIES_ALL}) +endif() + +if(PTSCOTCH_LIBRARY_PARMETIS) + set(PTSCOTCH_LIBRARIES_ALL ${PTSCOTCH_LIBRARY_PARMETIS} ${PTSCOTCH_LIBRARIES_ALL}) +endif() + set(PTSCOTCH_LIBRARIES ${PTSCOTCH_LIBRARIES_ALL} CACHE INTERNAL "Libraries for PT-Scotch" FORCE) #=============================================================================== include(FindPackageHandleStandardArgs) find_package_handle_standard_args(PTSCOTCH DEFAULT_MSG PTSCOTCH_LIBRARY PTSCOTCH_LIBRARY_ERR PTSCOTCH_INCLUDE_PATH) if(PTSCOTCH_INCLUDE_PATH) file(STRINGS ${PTSCOTCH_INCLUDE_PATH}/scotch.h PTSCOTCH_INCLUDE_CONTENT) string(REGEX MATCH "_cplusplus" _match ${PTSCOTCH_INCLUDE_CONTENT}) if(_match) add_definitions(-DAKANTU_PTSCOTCH_NO_EXTERN) endif() endif() #=============================================================================== if(NOT PTSCOTCH_FOUND) set(PTSCOTCH_DIR "" CACHE PATH "Location of PT-Scotch library.") endif(NOT PTSCOTCH_FOUND) diff --git a/cmake/Modules/FindScotch.cmake b/cmake/Modules/FindScotch.cmake index 88a733c7d..240bf48ff 100644 --- a/cmake/Modules/FindScotch.cmake +++ b/cmake/Modules/FindScotch.cmake @@ -1,87 +1,107 @@ #=============================================================================== # @file FindScotch.cmake # # @author Nicolas Richart # # @date creation: Wed Sep 01 2010 # @date last modification: Tue Sep 09 2014 # # @brief The find_package file for Scotch # # @section LICENSE # # Copyright (©) 2014 EPFL (Ecole Polytechnique Fédérale de Lausanne) # Laboratory (LSMS - Laboratoire de Simulation en Mécanique des Solides) # # Akantu is free software: you can redistribute it and/or modify it under the # terms of the GNU Lesser General Public License as published by the Free # Software Foundation, either version 3 of the License, or (at your option) any # later version. # # Akantu 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 Lesser General Public License for more # details. # # You should have received a copy of the GNU Lesser General Public License # along with Akantu. If not, see . # #=============================================================================== #=============================================================================== #if(SCOTCH_DIR) # set(SCOTCH_LIBRARY "NOTFOUND" CACHE INTERNAL "Cleared" FORCE) #endif(SCOTCH_DIR) find_library(SCOTCH_LIBRARY scotch HINTS ${SCOTCH_DIR} PATH_SUFFIXES src/libscotch lib ) find_library(SCOTCH_LIBRARY_ERR scotcherr HINTS ${SCOTCH_DIR} PATH_SUFFIXES src/libscotch lib ) find_library(SCOTCH_LIBRARY_ERREXIT scotcherrexit HINTS ${SCOTCH_DIR} PATH_SUFFIXES src/libscotch lib ) find_library(SCOTCH_LIBRARY_ESMUMPS esmumps HINTS ${SCOTCH_DIR} PATH_SUFFIXES src/libscotch lib ) +find_library(SCOTCH_LIBRARY_METIS scotchmetis + PATHS ${SCOTCH_DIR} + PATH_SUFFIXES src/libscotch lib + ) + +find_library(SCOTCH_LIBRARY_PARMETIS scotchparmetis + PATHS ${SCOTCH_DIR} + PATH_SUFFIXES src/libscotch lib + ) + find_path(SCOTCH_INCLUDE_DIR scotch.h HINTS ${SCOTCH_DIR} PATH_SUFFIXES include scotch src/libscotch include/scotch ) #=============================================================================== -mark_as_advanced(SCOTCH_LIBRARY) -mark_as_advanced(SCOTCH_LIBRARY_ERR) -mark_as_advanced(SCOTCH_LIBRARY_ERREXIT) -mark_as_advanced(SCOTCH_LIBRARY_ESMUMPS) -mark_as_advanced(SCOTCH_INCLUDE_DIR) +mark_as_advanced(SCOTCH_LIBRARY + SCOTCH_LIBRARY_ERR + SCOTCH_LIBRARY_ERREXIT + SCOTCH_LIBRARY_ESMUMPS + SCOTCH_LIBRARY_PARMETIS + SCOTCH_INCLUDE_DIR) set(SCOTCH_LIBRARIES_ALL ${SCOTCH_LIBRARY} ${SCOTCH_LIBRARY_ERR}) if(SCOTCH_LIBRARY_ESMUMPS) set(SCOTCH_LIBRARIES_ALL ${SCOTCH_LIBRARY_ESMUMPS} ${SCOTCH_LIBRARIES_ALL}) endif() +if(SCOTCH_LIBRARY_METIS) + set(SCOTCH_LIBRARIES_ALL ${SCOTCH_LIBRARY_METIS} ${SCOTCH_LIBRARIES_ALL}) +endif() + +if(SCOTCH_LIBRARY_PARMETIS) + set(SCOTCH_LIBRARIES_ALL ${SCOTCH_LIBRARY_PARMETIS} ${SCOTCH_LIBRARIES_ALL}) +endif() + + set(SCOTCH_LIBRARIES ${SCOTCH_LIBRARIES_ALL} CACHE INTERNAL "Libraries for scotch" FORCE) #=============================================================================== if(NOT SCOTCH_FOUND) set(SCOTCH_DIR "" CACHE PATH "Location of Scotch library.") mark_as_advanced(SCOTCH_DIR) endif() #=============================================================================== include(FindPackageHandleStandardArgs) find_package_handle_standard_args(Scotch DEFAULT_MSG SCOTCH_LIBRARY SCOTCH_LIBRARY_ERR SCOTCH_INCLUDE_DIR) diff --git a/doc/manual/manual-bibliography.bib b/doc/manual/manual-bibliography.bib index 21b8a3a96..8cdccdbf6 100644 --- a/doc/manual/manual-bibliography.bib +++ b/doc/manual/manual-bibliography.bib @@ -1,464 +1,464 @@ %% This BibTeX bibliography file was created using BibDesk. %% http://bibdesk.sourceforge.net/ %% Created for Alejandro Marcos Aragón at 2014-09-16 15:21:18 +0200 %% Saved with string encoding Unicode (UTF-8) @phdthesis{Pietrzak:1997, Author = {Pietrzak, Grzegorz}, Date-Added = {2014-09-16 12:23:01 +0000}, Date-Modified = {2014-09-16 12:41:09 +0000}, Doi = {10.5075/epfl-thesis-1656}, School = {{\'E}cole {P}olytechnique {F}{\'e}d{\'e}rale de {L}ausanne}, Title = {Continuum mechanics modelling and augmented Lagrangian formulation of large deformation frictional contact problems}, Year = {1997}} @techreport{Omohundro:1989, Author = {Stephen M. Omohundro}, Date-Added = {2014-05-22 09:47:58 +0000}, Date-Modified = {2014-05-22 09:47:58 +0000}, Institution = {International Computer Science Institute, University of California at Berkeley}, Number = {TR-89-063}, Title = {Five Balltree Construction Algorithms}, Type = {Technical Report}, Url = {http://ftp.icsi.berkeley.edu/ftp/pub/techreports/1989/tr-89-063.pdf}, Year = {1989}, Bdsk-Url-1 = {http://ftp.icsi.berkeley.edu/ftp/pub/techreports/1989/tr-89-063.pdf}} @article{Aragon:2013d, Author = {Alejandro M. Arag{\'o}n and Jean-Fran{\c c}ois Molinari}, Date-Added = {2014-05-22 09:14:48 +0000}, Date-Modified = {2014-05-22 09:14:48 +0000}, Doi = {10.1016/j.cma.2013.10.001}, Issn = {0045-7825}, Journal = {Computer Methods in Applied Mechanics and Engineering}, Number = {0}, Pages = {574 - 588}, Title = {A hierarchical detection framework for computational contact mechanics}, Url = {http://dx.doi.org/10.1016/j.cma.2013.10.001}, Volume = {268}, Year = {2014}, Bdsk-Url-1 = {http://www.sciencedirect.com/science/article/pii/S0045782513002533}, Bdsk-Url-2 = {http://dx.doi.org/10.1016/j.cma.2013.10.001}} @book{Belytschko:2000, Author = {Ted Belytschko, Wing Kam Liu, Brian Moran}, Publisher = {Wiley}, Title = {Nonlinear Finite Elements for Continua and Structures}, Year = {2000}} @book{Laursen:2002, Author = {Laursen, T.A.}, Date-Added = {2014-03-21 13:24:56 +0000}, Date-Modified = {2014-03-21 13:24:56 +0000}, Isbn = {9783540429067}, Lccn = {2002511027}, Publisher = {Springer}, Series = {Engineering online library}, Title = {Computational Contact and Impact Mechanics: Fundamentals of Modeling Interfacial Phenomena in Nonlinear Finite Element Analysis}, Year = {2002}, Bdsk-Url-1 = {http://books.google.ch/books?id=umzsErNuyFgC}} @book{curnier92a, - Author = {Curnier, A. and Curnier, A. and Curnier, A.}, + Author = {Curnier, A.}, Publisher = {EPFL}, Title = {M{\'e}thodes num{\'e}riques en m{\'e}canique des solides}, Url = {http://books.google.ch/books?id=-Z2zygAACAAJ}, Year = {1992}, Bdsk-Url-1 = {http://books.google.ch/books?id=-Z2zygAACAAJ}} @article{hughes-83a, Author = {Hughes, T.J.R. and Belytschko, T.}, Journal = {Journal. of Applied Mechanics (ASME)}, Pages = {1033-1041}, Title = {A precis of developments in computational methods for transient analysis}, Volume = {50}, Year = {1983}} @book{simo92, Author = {Simo, J.C. and Hughes, T.J.R.}, Publisher = {Springer}, Title = {Computational Inelasticity}, Year = {1992}} @book{frey2009, Author = {Frey, F. and Jirousek, J.}, Isbn = {9782880748524}, Publisher = {PPUR}, Series = {Trait{\'e} de g{\'e}nie civil de l'Ecole Polytechnique F{\'e}d{\'e}rale de Lausanne}, Title = {M{\'e}thodes des {\'e}l{\'e}ments finis: Analyse des structures et milieux continus}, Url = {http://books.google.fr/books?id=bCBtQgAACAAJ}, Year = {2009}, Bdsk-Url-1 = {http://books.google.fr/books?id=bCBtQgAACAAJ}} @article{ortiz1999, Author = {Ortiz, M. and Pandolfi, A.}, Journal = {International Journal for Numerical Methods in Engineering (IJNME)}, Pages = {1267-1282}, Title = {Finite-deformation irreversible cohesive elements for three-dimensional crack-propagation analysis}, Volume = {44}, Year = {1999}} @article{gmsh, Author = {Geuzaine, Christophe and Remacle, Jean-Fran{\c c}ois}, Doi = {10.1002/nme.2579}, Issn = {1097-0207}, Journal = {International Journal for Numerical Methods in Engineering}, Keywords = {computer-aided design, mesh generation, post-processing, finite element method, open-source software}, Number = {11}, Pages = {1309--1331}, Publisher = {John Wiley & Sons, Ltd.}, Title = {Gmsh: A 3-D finite element mesh generator with built-in pre- and post-processing facilities}, Url = {http://dx.doi.org/10.1002/nme.2579}, Volume = {79}, Year = {2009}, Bdsk-Url-1 = {http://dx.doi.org/10.1002/nme.2579}} @misc{abaqus, Key = {Unified FEA}, Title = {Simulia ABAQUS FEA}, Url = {\url{http://www.3ds.com/products-services/simulia/portfolio/abaqus/}}, Bdsk-Url-1 = {http://www.3ds.com/products-services/simulia/portfolio/abaqus/}} @misc{diana, Key = {FEM}, Title = {TNO DIANA}, Url = {\url{http://tnodiana.com/content/DIANA}}, Bdsk-Url-1 = {http://tnodiana.com/content/DIANA}} @misc{mumps, Key = {sparse matrix, direct solver, parallelisme}, Title = {MUMPS : a parallel sparse direct solver}, Url = {\url{http://graal.ens-lyon.fr/MUMPS/}}, Bdsk-Url-1 = {http://graal.ens-lyon.fr/MUMPS/}} @misc{cmake, Title = {CMake - Cross Platform Make}, Url = {\url{http://www.cmake.org/}}, Bdsk-Url-1 = {http://www.cmake.org/}} @misc{paraview, Title = {ParaView - Open Source Scientific Visualization}, Url = {\url{http://www.paraview.org/}}, Bdsk-Url-1 = {http://www.paraview.org/}} @misc{visit, Title = {VisIt Visualization Tool}, Url = {\url{http://wci.llnl.gov/codes/visit/}}, Bdsk-Url-1 = {http://wci.llnl.gov/codes/visit/}} @misc{mayavi, Title = {The MayaVi Data Visualizer}, Url = {\url{http://mayavi.sourceforge.net/}}, Bdsk-Url-1 = {http://mayavi.sourceforge.net/}} @misc{scotch, Title = {SCOTCH: Static Mapping, Graph, Mesh and Hypergraph Partitioning}, Url = {\url{http://www.labri.fr/perso/pelegrin/scotch/}}, Bdsk-Url-1 = {http://www.labri.fr/perso/pelegrin/scotch/}} @article{camacho_computational_1996, Author = {Camacho, {G.T.} and Ortiz, M.}, Journal = {International Journal of Solids and Structures}, Month = aug, Number = {20{\textendash}22}, Pages = {2899--2938}, Title = {Computational modelling of impact damage in brittle materials}, Urldate = {2012-01-17}, Volume = {33}, Year = {1996}} @article{snozzi_cohesive_2013, Author = {Snozzi, Leonardo and Molinari, Jean-Francois}, Journal = {International Journal for Numerical Methods in Engineering}, Month = feb, Number = {5}, Pages = {510--526}, Title = {A cohesive element model for mixed mode loading with frictional contact capability}, Volume = {93}, Year = {2013}} @article{bazant76a, Author = {Zden\v{e}k P. Ba\v{z}ant}, Journal = {Journal of the Engineering Mechanics Division}, Number = 5, Pages = {331 - 344}, Title = {Instability, Ductility, and Size Effect in Strain-Softening Concrete}, Volume = 102, Year = 1976} @article{bazant85a, Author = {Zden\v{e}k P. Ba\v{z}ant and Ted Belytschko}, Journal = {Journal of Engineering Mechanics}, Number = 3, Pages = {381 - 389}, Title = {Wave Propagation in a Strain-Softening Bar: Exact Solution}, Volume = 111, Year = 1985} @article{bazant86a, Author = {Zden\v{e}k P. Ba\v{z}ant}, Journal = {Applied Mechanics Reviews}, Number = 5, Pages = {675 - 705}, Title = {Mechanics of distributed cracking}, Volume = 39, Year = 1986} @article{bazant88a, Author = {Zden\v{e}k P. Ba\v{z}ant and Gilles Pijaudier-Cabot}, Journal = {Journal of Applied Mechanics}, Number = {2}, Optdoi = {10.1115/1.3173674}, Pages = {287-293}, Publisher = {ASME}, Title = {{Nonlocal Continuum Damage, Localization Instability and Convergence}}, Volume = {55}, Year = {1988}} @article{devree95, Author = {J.H.P. de Vree and W.A.M. Brekelmans and M.A.J. van Gils}, Issn = {0045-7949}, Journal = {Computers \&; Structures}, Number = 4, Optdoi = {10.1016/0045-7949(94)00501-S}, Pages = {581 - 588}, Title = {Comparison of nonlocal approaches in continuum damage mechanics}, Volume = 55, Year = 1995} @article{giry11a, Author = {C. Giry and F. Dufour and J. Mazars}, Journal = {International Journal of Solids and Structures}, Pages = {3431 - 3443}, Title = {Stress-based nonlocal damage model}, Volume = 48, Year = 2011} @article{hughes83a, Author = {{Hughes}, T.~J.~R. and {Belytschko}, T.}, Journal = {Journal of Applied Mechanics}, Month = {December}, Optdoi = {10.1115/1.3167186}, Pages = {1033}, Title = {{A Pr{\'e}cis of Developments in Computational Methods for Transient Analysis}}, Volume = 50, Year = 1983} @article{jirasek98a, Author = {Milan Jir\'asek}, Journal = {International Journal of Solids and Structures}, Pages = {4133 - 4145}, Title = {Nonlocal models for damage and fracture: comparison of approaches}, Volume = 35, Year = 1998} @article{jirasek03a, Author = {Milan Jir\'asek and Simon Rolshoven}, Journal = {International Journal of Engineering Science}, Pages = {1553-1602}, Title = {Comparison of integral-type nonlocal plasticity models for strain-softening materials}, Volume = 41, Year = 2003} @article{jirasek04a, Author = {Milan Jir\'asek and S Rolshoven and P Grassl}, Journal = {International Journal for numerical and analytical methods in geomechanics}, Pages = {653 - 670}, Title = {Size effect on fracture energy induced by non-locality}, Volume = 28, Year = 2004} @articlel{jirasek07a, Author = {Milan Jir\'asek}, Journal = {Revue Europeenne de Genie Civil}, Pages = {977 - 991}, Title = {Mathematical analysis of strain localization}, Volume = 11, Year = 2007} @article{jirasek07b, Author = {Milan Jir\'asek}, Journal = {Revue Europeenne de Genie Civil}, Pages = {993 - 1021}, Title = {Nonlocal damage mechanics}, Volume = 11, Year = 2007} @article{marigo81a, Author = {Marigo, Jean-Jacques}, Issn = {0249-6305}, Journal = {{C. R. Acad. Sci., Paris, S\'er. II}}, Number = 19, Pages = {1309-1312}, Title = {{Formulation d'une loi d'endommagement d'un mat\'eriau \'elastique}}, Volume = 292, Year = {1981}} @phdthesis{mazars84a, Author = {Mazars, Jacky}, School = {Universit\'e Paris 6}, Title = {{Application de la m\'ecanique de l'endommagement au comportement non lin\'eaire et \`a la rupture du b\'eton de structure}}, Year = 1984} @article{needleman88a, Author = {A. Needleman}, Issn = {0045-7825}, Journal = {Computer Methods in Applied Mechanics and Engineering}, Number = 1, Optdoi = {10.1016/0045-7825(88)90069-2}, Pages = {69 - 85}, Title = {Material rate dependence and mesh sensitivity in localization problems}, Volume = 67, Year = 1988} @article{newmark59a, Author = {Nathan M. Newmark}, Editor = {ASCE}, Journal = {Journal of the Engineering Mechanics Division}, Month = {July}, Number = {3}, Pages = {67-94}, Title = {{A Method of Computation for Structural Dynamics}}, Volume = {85}, Year = {1959}} @article{pijaudier87a, Author = {Gilles Pijaudier-Cabot and Zden\v{e}k P. Ba\v{z}ant}, Journal = {Journal of Engineering Mechanics}, Number = 10, Pages = {1512 - 1533}, Title = {Nonlocal damage theory}, Volume = 113, Year = 1987} @article{rice76a, Author = {James R. Rice}, Journal = {Theoretical and Applied Mechanics (14th International Congress on Theoretical and Applied Mechanics, Delft, 1976, ed. W.T. Koiter)}, Pages = {207 - 220}, Title = {The Localisation of Plastic Deformation}, Volume = 1, Year = 1976} @article{sharon96a, Author = {Eran Sharon and Jay Fineberg}, Journal = {Physical Review B}, Number = 10, Pages = {7128 - 7139}, Title = {Microbranching instability and the dynamic fracture of brittle materials}, Volume = 54, Year = 1996} @article{aifantis84a, Author = {E. C. Aifantis}, Journal = {Journal of Engineering Materials and Technology}, Pages = {326 - 330}, Title = {On the microstructural origin of certain inelastic models}, Volume = {106}, Year = 1984} @article{ladeveze92a, Author = {P. Ladeveze}, Journal = {Computational \& Structures}, Pages = {79-87}, Title = {A damage computational method for composite structures}, Volume = {44}, Year = {1992}} @phdthesis{levy10a, Address = {Lausanne}, Affiliation = {EPFL}, Author = {Levy, Sarah}, Doctoral = {EDME}, Institute = {IIC}, Original-Unit = {LSMS}, Publisher = {EPFL}, School = {ENAC}, Title = {Exploring the {P}hysics behind {D}ynamic {F}ragmentation through {P}arallel {S}imulations}, Unit = {LSMS}, Year = 2010} @article{pandolfi12a, Author = {A Pandolfi and M Ortiz}, Journal = {International Journal for Numerical Methods in Engineering}, Pages = {694-714}, Title = {An eigenerosion approach to brittle fracture}, Volume = 92, Year = 2012} @article{belytschko03a, Author = {T Belytschko and H Chen and J Xu and G Zi}, Journal = {International Journal for Numerical Methods in Engineering}, Pages = {1875-1905}, Title = {Dynamic crack propagation based on loss of hyperbolicity and a new discontinuous enrichment}, Volume = 58, Year = 2003} @article{silling00a, Author = {S A Silling}, Journal = {Journal of the Mechanics and Physics of Solids}, Pages = {175-209}, Title = {Reformulation of elasticity theory for discontinuities and long-range forces}, Volume = 48, Year = 2000} @article{youn10a, Author = {Youn Doh-Ha and Florin Bobaru}, Journal = {International Journal of Fracture}, Pages = {229-1244}, Title = {Studies of dynamic crack propagation and crack branching with peridynamics}, Volume = 162, Year = 2010} @article{ortiz99a, Author = {M Ortiz and A Pandolfi}, Journal = {International Journal for Numerical Methods in Engineering}, Pages = {1267-1282}, Title = {Finite-deformation irreversible cohesive elements for three-dimensional crack-propagation analysis}, Volume = {44}, Year = 1999} @article{patzak01a, Author = {B. Patz{\'a}k and D. Rypl and Z. Bittnar}, Issn = {0045-7949}, Journal = {{Computers \& Structures}}, Number = {26--28}, Pages = {2287 - 2297}, Title = {Parallel explicit finite element dynamics with nonlocal constitutive models}, Volume = 79, Year = 2001} @book{lemaitre96a, Author = {Lemaitre, Jean}, Isbn = {978-3-540-60980-3}, Publisher = {Springer Berlin Heidelberg}, Title = {A Course on Damage Mechanics}, Year = {1996}} @book{courant56a, Address = {New York}, Author = {Courant, Richard and Friedrichs, Kurt Otto and Lewy, H.}, Publisher = {Courant Institute of Mathematical Sciences, New York University}, Title = {On the partial difference equations of mathematical physics}, Year = {1956}} @unpublished{wolff14a, Author = {C. Wolff and N. Richart and JF Molinari}, Note = {Submitted to IJNME}, Title = {A non-local continuum damage approach to model dynamic crack branching}, Year = {2014}} @article{caughey1960, Author = {Caughey, TK}, Journal = {Journal of Applied Mechanics}, Number = {2}, Pages = {269--271}, Publisher = {American Society of Mechanical Engineers}, Title = {Classical normal modes in damped linear dynamic systems}, Volume = {27}, Year = {1960}} diff --git a/extra_packages/extra-materials b/extra_packages/extra-materials new file mode 160000 index 000000000..03a1cd604 --- /dev/null +++ b/extra_packages/extra-materials @@ -0,0 +1 @@ +Subproject commit 03a1cd6042ba438531870dfec4e10b5e7e50e62d diff --git a/extra_packages/igfem b/extra_packages/igfem new file mode 160000 index 000000000..13cc7c60c --- /dev/null +++ b/extra_packages/igfem @@ -0,0 +1 @@ +Subproject commit 13cc7c60c4edcb9ec4e18b453bf7e2500b103803 diff --git a/extra_packages/parallel-cohesive-element b/extra_packages/parallel-cohesive-element new file mode 160000 index 000000000..85c66be60 --- /dev/null +++ b/extra_packages/parallel-cohesive-element @@ -0,0 +1 @@ +Subproject commit 85c66be60ee42d8851cb7848ba4bf323ddd5a0b5 diff --git a/extra_packages/traction-at-split-node-contact b/extra_packages/traction-at-split-node-contact new file mode 160000 index 000000000..353577827 --- /dev/null +++ b/extra_packages/traction-at-split-node-contact @@ -0,0 +1 @@ +Subproject commit 3535778275ec3f915bdea80ac17630ee37784154 diff --git a/packages/00_core.cmake b/packages/00_core.cmake index 8dc96d9a1..5ce3450f6 100644 --- a/packages/00_core.cmake +++ b/packages/00_core.cmake @@ -1,435 +1,391 @@ #=============================================================================== # @file 00_core.cmake # # @author Guillaume Anciaux # @author Nicolas Richart # # @date creation: Mon Nov 21 2011 # @date last modification: Fri Sep 19 2014 # # @brief package description for core # # @section LICENSE # # Copyright (©) 2010-2012, 2014 EPFL (Ecole Polytechnique Fédérale de Lausanne) # Laboratory (LSMS - Laboratoire de Simulation en Mécanique des Solides) # # Akantu is free software: you can redistribute it and/or modify it under the # terms of the GNU Lesser General Public License as published by the Free # Software Foundation, either version 3 of the License, or (at your option) any # later version. # # Akantu 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 Lesser General Public License for more # details. # # You should have received a copy of the GNU Lesser General Public License # along with Akantu. If not, see . # #=============================================================================== -set(AKANTU_CORE ON CACHE INTERNAL "core package for Akantu" FORCE) +package_declare(core NOT_OPTIONAL DESCRIPTION "core package for Akantu") -set(AKANTU_CORE_FILES +package_declare_sources(core common/aka_array.cc common/aka_array.hh common/aka_array_tmpl.hh common/aka_blas_lapack.hh common/aka_circular_array.hh common/aka_circular_array_inline_impl.cc common/aka_common.cc common/aka_common.hh common/aka_common_inline_impl.cc common/aka_csr.hh common/aka_error.cc common/aka_error.hh common/aka_event_handler_manager.hh common/aka_extern.cc common/aka_fwd.hh common/aka_grid_dynamic.hh common/aka_math.cc common/aka_math.hh common/aka_math_tmpl.hh common/aka_memory.cc common/aka_memory.hh common/aka_memory_inline_impl.cc common/aka_random_generator.hh common/aka_safe_enum.hh common/aka_static_memory.cc common/aka_static_memory.hh common/aka_static_memory_inline_impl.cc common/aka_static_memory_tmpl.hh common/aka_typelist.hh common/aka_types.hh common/aka_visitor.hh common/aka_voigthelper.hh common/aka_voigthelper.cc fe_engine/element_class.cc fe_engine/element_class.hh fe_engine/element_class_tmpl.hh fe_engine/element_classes/element_class_hexahedron_8_inline_impl.cc fe_engine/element_classes/element_class_pentahedron_6_inline_impl.cc fe_engine/element_classes/element_class_point_1_inline_impl.cc fe_engine/element_classes/element_class_quadrangle_4_inline_impl.cc fe_engine/element_classes/element_class_quadrangle_8_inline_impl.cc fe_engine/element_classes/element_class_segment_2_inline_impl.cc fe_engine/element_classes/element_class_segment_3_inline_impl.cc fe_engine/element_classes/element_class_tetrahedron_10_inline_impl.cc fe_engine/element_classes/element_class_tetrahedron_4_inline_impl.cc fe_engine/element_classes/element_class_triangle_3_inline_impl.cc fe_engine/element_classes/element_class_triangle_6_inline_impl.cc fe_engine/fe_engine.cc fe_engine/fe_engine.hh fe_engine/fe_engine_inline_impl.cc fe_engine/fe_engine_template.hh fe_engine/fe_engine_template_tmpl.hh fe_engine/geometrical_data_tmpl.hh fe_engine/geometrical_element.cc fe_engine/integration_element.cc fe_engine/integrator.hh fe_engine/integrator_gauss.hh fe_engine/integrator_gauss_inline_impl.cc fe_engine/interpolation_element.cc fe_engine/interpolation_element_tmpl.hh fe_engine/shape_functions.hh fe_engine/shape_functions_inline_impl.cc fe_engine/shape_lagrange.cc fe_engine/shape_lagrange.hh fe_engine/shape_lagrange_inline_impl.cc fe_engine/shape_linked.cc fe_engine/shape_linked.hh fe_engine/shape_linked_inline_impl.cc fe_engine/element.hh io/dumper/dumpable.hh io/dumper/dumpable.cc io/dumper/dumpable_inline_impl.hh io/dumper/dumper_field.hh io/dumper/dumper_material_padders.hh io/dumper/dumper_filtered_connectivity.hh io/dumper/dumper_element_type.hh io/dumper/dumper_element_partition.hh io/mesh_io.cc io/mesh_io.hh io/mesh_io/mesh_io_abaqus.cc io/mesh_io/mesh_io_abaqus.hh io/mesh_io/mesh_io_diana.cc io/mesh_io/mesh_io_diana.hh io/mesh_io/mesh_io_msh.cc io/mesh_io/mesh_io_msh.hh io/model_io.cc io/model_io.hh io/parser/algebraic_parser.hh io/parser/input_file_parser.hh io/parser/parsable.cc io/parser/parsable.hh io/parser/parsable_tmpl.hh io/parser/parser.cc io/parser/parser.hh io/parser/parser_tmpl.hh io/parser/cppargparse/cppargparse.hh io/parser/cppargparse/cppargparse.cc io/parser/cppargparse/cppargparse_tmpl.hh mesh/element_group.cc mesh/element_group.hh mesh/element_group_inline_impl.cc mesh/element_type_map.hh mesh/element_type_map_tmpl.hh mesh/element_type_map_filter.hh mesh/group_manager.cc mesh/group_manager.hh mesh/group_manager_inline_impl.cc mesh/mesh.cc mesh/mesh.hh mesh/mesh_filter.hh mesh/mesh_data.cc mesh/mesh_data.hh mesh/mesh_data_tmpl.hh mesh/mesh_inline_impl.cc mesh/node_group.cc mesh/node_group.hh mesh/node_group_inline_impl.cc mesh_utils/mesh_partition.cc mesh_utils/mesh_partition.hh mesh_utils/mesh_partition/mesh_partition_mesh_data.cc mesh_utils/mesh_partition/mesh_partition_mesh_data.hh mesh_utils/mesh_partition/mesh_partition_scotch.hh mesh_utils/mesh_pbc.cc mesh_utils/mesh_utils.cc mesh_utils/mesh_utils.hh mesh_utils/mesh_utils_inline_impl.cc model/boundary_condition.hh model/boundary_condition_functor.hh model/boundary_condition_functor_inline_impl.cc model/boundary_condition_tmpl.hh model/integration_scheme/generalized_trapezoidal.hh model/integration_scheme/generalized_trapezoidal_inline_impl.cc model/integration_scheme/integration_scheme_1st_order.hh model/integration_scheme/integration_scheme_2nd_order.hh model/integration_scheme/newmark-beta.hh model/integration_scheme/newmark-beta_inline_impl.cc model/model.cc model/model.hh model/model_inline_impl.cc model/solid_mechanics/material.cc model/solid_mechanics/material.hh model/solid_mechanics/material_inline_impl.cc model/solid_mechanics/material_list.hh model/solid_mechanics/material_random_internal.hh model/solid_mechanics/material_selector.hh model/solid_mechanics/material_selector_tmpl.hh model/solid_mechanics/materials/internal_field.hh model/solid_mechanics/materials/internal_field_tmpl.hh model/solid_mechanics/materials/random_internal_field.hh model/solid_mechanics/materials/random_internal_field_tmpl.hh model/solid_mechanics/solid_mechanics_model.cc model/solid_mechanics/solid_mechanics_model.hh model/solid_mechanics/solid_mechanics_model_inline_impl.cc model/solid_mechanics/solid_mechanics_model_mass.cc model/solid_mechanics/solid_mechanics_model_material.cc model/solid_mechanics/solid_mechanics_model_tmpl.hh model/solid_mechanics/solid_mechanics_model_event_handler.hh model/solid_mechanics/materials/plane_stress_toolbox.hh model/solid_mechanics/materials/plane_stress_toolbox_tmpl.hh model/solid_mechanics/materials/material_elastic.cc model/solid_mechanics/materials/material_elastic.hh model/solid_mechanics/materials/material_elastic_inline_impl.cc model/solid_mechanics/materials/material_thermal.cc model/solid_mechanics/materials/material_thermal.hh model/solid_mechanics/materials/material_elastic_linear_anisotropic.cc model/solid_mechanics/materials/material_elastic_linear_anisotropic.hh model/solid_mechanics/materials/material_elastic_orthotropic.cc model/solid_mechanics/materials/material_elastic_orthotropic.hh model/solid_mechanics/materials/material_damage/material_damage.hh model/solid_mechanics/materials/material_damage/material_damage_tmpl.hh model/solid_mechanics/materials/material_damage/material_marigo.cc model/solid_mechanics/materials/material_damage/material_marigo.hh model/solid_mechanics/materials/material_damage/material_marigo_inline_impl.cc model/solid_mechanics/materials/material_damage/material_mazars.cc model/solid_mechanics/materials/material_damage/material_mazars.hh model/solid_mechanics/materials/material_damage/material_mazars_inline_impl.cc model/solid_mechanics/materials/material_finite_deformation/material_neohookean.cc model/solid_mechanics/materials/material_finite_deformation/material_neohookean.hh model/solid_mechanics/materials/material_finite_deformation/material_neohookean_inline_impl.cc model/solid_mechanics/materials/material_plastic/material_plastic.cc model/solid_mechanics/materials/material_plastic/material_plastic.hh model/solid_mechanics/materials/material_plastic/material_plastic_inline_impl.cc model/solid_mechanics/materials/material_plastic/material_linear_isotropic_hardening.cc model/solid_mechanics/materials/material_plastic/material_linear_isotropic_hardening.hh model/solid_mechanics/materials/material_plastic/material_linear_isotropic_hardening_inline_impl.cc model/solid_mechanics/materials/material_viscoelastic/material_standard_linear_solid_deviatoric.cc model/solid_mechanics/materials/material_viscoelastic/material_standard_linear_solid_deviatoric.hh - - solver/solver.cc solver/solver.hh solver/solver_inline_impl.cc solver/sparse_matrix.cc solver/sparse_matrix.hh solver/sparse_matrix_inline_impl.cc solver/static_solver.hh solver/static_solver.cc synchronizer/communication_buffer.hh synchronizer/communication_buffer_inline_impl.cc synchronizer/data_accessor.cc synchronizer/data_accessor.hh synchronizer/data_accessor_inline_impl.cc synchronizer/distributed_synchronizer.cc synchronizer/distributed_synchronizer.hh synchronizer/distributed_synchronizer_tmpl.hh synchronizer/dof_synchronizer.cc synchronizer/dof_synchronizer.hh synchronizer/dof_synchronizer_inline_impl.cc synchronizer/filtered_synchronizer.cc synchronizer/filtered_synchronizer.hh synchronizer/mpi_type_wrapper.hh synchronizer/pbc_synchronizer.cc synchronizer/pbc_synchronizer.hh synchronizer/real_static_communicator.hh synchronizer/static_communicator.cc synchronizer/static_communicator.hh synchronizer/static_communicator_dummy.hh synchronizer/static_communicator_inline_impl.hh synchronizer/synchronizer.cc synchronizer/synchronizer.hh synchronizer/synchronizer_registry.cc synchronizer/synchronizer_registry.hh ) set(AKANTU_CORE_DEB_DEPEND libboost-dev ) -set(AKANTU_CORE_TESTS - test_csr - test_facet_element_mapping - test_facet_extraction_tetrahedron_4 - test_facet_extraction_triangle_3 - test_grid - test_interpolate_stress - test_local_material - test_material_damage_non_local - test_material_thermal - test_matrix - test_mesh_boundary - test_mesh_data - test_mesh_io_msh - test_mesh_io_msh_physical_names - test_mesh_partitionate_mesh_data - test_parser - test_dumper - test_pbc_tweak - test_purify_mesh - test_solid_mechanics_model_bar_traction2d - test_solid_mechanics_model_bar_traction2d_structured - test_solid_mechanics_model_bar_traction2d_structured_pbc - test_solid_mechanics_model_boundary_condition - test_solid_mechanics_model_circle_2 - test_solid_mechanics_model_cube3d - test_solid_mechanics_model_cube3d_pbc - test_solid_mechanics_model_cube3d_tetra10 - test_solid_mechanics_model_square - test_solid_mechanics_model_material_eigenstrain - test_static_memory - test_surface_extraction_tetrahedron_4 - test_surface_extraction_triangle_3 - test_vector - test_vector_iterator - test_weight - test_math - test_material_standard_linear_solid_deviatoric_relaxation - test_material_standard_linear_solid_deviatoric_relaxation_tension - test_material_plasticity - ) - set(AKANTU_CORE_MANUAL_FILES manual.sty manual.cls manual.tex manual-macros.sty manual-titlepages.tex manual-introduction.tex manual-gettingstarted.tex manual-io.tex manual-solidmechanicsmodel.tex manual-constitutive-laws.tex manual-lumping.tex manual-elements.tex manual-appendix-elements.tex manual-appendix-materials.tex manual-appendix-packages.tex manual-backmatter.tex manual-bibliography.bib manual-bibliographystyle.bst figures/bc_and_ic_example.pdf figures/boundary.pdf figures/boundary.svg figures/dirichlet.pdf figures/dirichlet.svg figures/doc_wheel.pdf figures/doc_wheel.svg figures/dynamic_analysis.png figures/explicit_dynamic.pdf figures/explicit_dynamic.svg figures/static.pdf figures/static.svg figures/hooke_law.pdf figures/hot-point-1.png figures/hot-point-2.png figures/implicit_dynamic.pdf figures/implicit_dynamic.svg figures/insertion.pdf figures/interpolate.pdf figures/interpolate.svg figures/problemDomain.pdf_tex figures/problemDomain.pdf figures/static_analysis.png figures/stress_strain_el.pdf figures/tangent.pdf figures/tangent.svg figures/vectors.pdf figures/vectors.svg figures/stress_strain_neo.pdf figures/visco_elastic_law.pdf figures/isotropic_hardening_plasticity.pdf figures/stress_strain_visco.pdf figures/elements/hexahedron_8.pdf figures/elements/hexahedron_8.svg figures/elements/quadrangle_4.pdf figures/elements/quadrangle_4.svg figures/elements/quadrangle_8.pdf figures/elements/quadrangle_8.svg figures/elements/segment_2.pdf figures/elements/segment_2.svg figures/elements/segment_3.pdf figures/elements/segment_3.svg figures/elements/tetrahedron_10.pdf figures/elements/tetrahedron_10.svg figures/elements/tetrahedron_4.pdf figures/elements/tetrahedron_4.svg figures/elements/triangle_3.pdf figures/elements/triangle_3.svg figures/elements/triangle_6.pdf figures/elements/triangle_6.svg figures/elements/xtemp.pdf ) find_program(READLINK_COMMAND readlink) find_program(ADDR2LINE_COMMAND addr2line) mark_as_advanced(READLINK_COMMAND) mark_as_advanced(ADDR2LINE_COMMAND) include(CheckFunctionExists) check_function_exists(clock_gettime _clock_gettime) if(NOT _clock_gettime) set(AKANTU_USE_OBSOLETE_GETTIMEOFDAY ON) else() set(AKANTU_USE_OBSOLETE_GETTIMEOFDAY OFF) endif() set(AKANTU_CORE_DOCUMENTATION " This package is the core engine of \\akantu. It depends on: \\begin{itemize} \\item A C++ compiler (\\href{http://gcc.gnu.org/}{GCC} >= 4, or \\href{https://software.intel.com/en-us/intel-compilers}{Intel}). \\item The cross-platform, open-source \\href{http://www.cmake.org/}{CMake} build system. \\item The \\href{http://www.boost.org/}{Boost} C++ portable libraries. \\item The \\href{http://www.zlib.net/}{zlib} compression library. \\end{itemize} Under Ubuntu (14.04 LTS) the installation can be performed using the commands: \\begin{command} > sudo apt-get install build-essential cmake-curses-gui libboost-dev zlib1g-dev \\end{command} Under Mac OS X the installation requires the following steps: \\begin{itemize} \\item Install Xcode \\item Install the command line tools. \\item Install the MacPorts project which allows to automatically download and install opensource packages. \\end{itemize} Then the following commands should be typed in a terminal: \\begin{command} > sudo port install cmake gcc48 boost \\end{command} ") \ No newline at end of file diff --git a/packages/00_core_cxx11.cmake b/packages/00_core_cxx11.cmake index 63fa5d402..9070baf76 100644 --- a/packages/00_core_cxx11.cmake +++ b/packages/00_core_cxx11.cmake @@ -1,80 +1,81 @@ #=============================================================================== # @file 00_core_cxx11.cmake # # @author Nicolas Richart # # @date creation: Mon May 06 2013 # @date last modification: Thu Jul 03 2014 # # @brief C++11 addition to the core package # # @section LICENSE # # Copyright (©) 2014 EPFL (Ecole Polytechnique Fédérale de Lausanne) # Laboratory (LSMS - Laboratoire de Simulation en Mécanique des Solides) # # Akantu is free software: you can redistribute it and/or modify it under the # terms of the GNU Lesser General Public License as published by the Free # Software Foundation, either version 3 of the License, or (at your option) any # later version. # # Akantu 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 Lesser General Public License for more # details. # # You should have received a copy of the GNU Lesser General Public License # along with Akantu. If not, see . # #=============================================================================== include(CheckCXXCompilerFlag) check_cxx_compiler_flag (-std=c++0x HAVE_NEW_STD) -set(AKANTU_CORE_CXX11_FILES +package_declare_sources(core_cxx11 common/aka_point.hh common/aka_ball.cc common/aka_ci_string.hh common/aka_plane.hh common/aka_polytope.hh common/aka_ball.hh common/aka_timer.hh common/aka_tree.hh common/aka_bounding_box.hh common/aka_bounding_box.cc common/aka_geometry.hh common/aka_geometry.cc model/solid_mechanics/solid_mechanics_model_element.hh ) if(HAVE_NEW_STD) - option(AKANTU_CORE_CXX11 "C++ 11 additions for Akantu core" ON) + package_declare(core_cxx11 ADVANCED + DESCRIPTION "C++ 11 additions for Akantu core" DEFAULT ON + COMPILE_FLAGS "-std=c++0x") if(CMAKE_CXX_COMPILER_ID STREQUAL "GNU") if(CMAKE_CXX_COMPILER_VERSION VERSION_LESS "4.6") set(AKANTU_CORE_CXX11 OFF CACHE BOOL "C++ 11 additions for Akantu core - not supported by the selected compiler" FORCE) elseif(CMAKE_CXX_COMPILER_VERSION VERSION_GREATER "4.8") if(AKANTU_CORE_CXX11) add_flags(cxx -DBOOST_RESULT_OF_USE_TR1) else() remove_flags(cxx -DBOOST_RESULT_OF_USE_TR1) endif() endif() endif() - if(AKANTU_CORE_CXX11) - add_flags(cxx "-std=c++0x") - else() - remove_flags(cxx "-std=c++0x") - endif() + package_get_name(core_cxx11 _pkg_name) + package_get_option_name(${_pkg_name} _option_name) + else() - set(AKANTU_CORE_CXX11 OFF CACHE BOOL "core package for Akantu" FORCE) - remove_flags(cxx "-std=c++0x") + package_declare(core_cxx11 ADVANCED + DESCRIPTION "C++ 11 additions for Akantu core" + DEFAULT OFF + NOT_OPTIONAL + COMPILE_FLAGS "-std=c++0x") endif() -mark_as_advanced(AKANTU_CORE_CXX11) - set(AKANTU_CORE_CXX11_DOCUMENTATION " This option activates some features of the C++11 standard. This is usable with GCC>=4.7 or Intel>=13.") diff --git a/packages/00_documentation_doxygen.cmake b/packages/00_documentation_doxygen.cmake index 0e3380df8..ae4007abb 100644 --- a/packages/00_documentation_doxygen.cmake +++ b/packages/00_documentation_doxygen.cmake @@ -1,47 +1,48 @@ #=============================================================================== # @file 00_documentation_doxygen.cmake # # @author Guillaume Anciaux # # @date creation: Tue Jun 10 2014 # @date last modification: Tue Jun 24 2014 # # @brief Doxygen documentation of the code # # @section LICENSE # # Copyright (©) 2014 EPFL (Ecole Polytechnique Fédérale de Lausanne) # Laboratory (LSMS - Laboratoire de Simulation en Mécanique des Solides) # # Akantu is free software: you can redistribute it and/or modify it under the # terms of the GNU Lesser General Public License as published by the Free # Software Foundation, either version 3 of the License, or (at your option) any # later version. # # Akantu 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 Lesser General Public License for more # details. # # You should have received a copy of the GNU Lesser General Public License # along with Akantu. If not, see . # #=============================================================================== -option(AKANTU_DOCUMENTATION_DOXYGEN "Build source documentation using Doxygen." OFF) +package_declare(documentation_doxygen + DESCRIPTION "Build source documentation using Doxygen.") set(AKANTU_DOCUMENTATION_DOXYGEN_DOCUMENTATION " This generates the Doxygen documantation of the source code. It depends on: \\begin{itemize} \\item \\href{http://www.stack.nl/~dimitri/doxygen/}{Doxygen} an automated source code documentations system. \\item Optional: \\href{http://www.graphviz.org/}{Graphviz} to generate the dependencies graph \\end{itemize} Under Ubuntu (14.04 LTS), the installation of the dependencies can be performed using the following command: \\begin{command} > sudo apt-get install doxygen > sudo apt-get install graphviz \\end{command} ") \ No newline at end of file diff --git a/packages/00_documentation_manual.cmake b/packages/00_documentation_manual.cmake index eeef47666..02dde1350 100644 --- a/packages/00_documentation_manual.cmake +++ b/packages/00_documentation_manual.cmake @@ -1,39 +1,40 @@ #=============================================================================== # @file 00_documentation_manual.cmake # # @author Guillaume Anciaux # # @date creation: Tue Jun 10 2014 # @date last modification: Thu Jul 03 2014 # # @brief Akantu's manual package # # @section LICENSE # # Copyright (©) 2014 EPFL (Ecole Polytechnique Fédérale de Lausanne) # Laboratory (LSMS - Laboratoire de Simulation en Mécanique des Solides) # # Akantu is free software: you can redistribute it and/or modify it under the # terms of the GNU Lesser General Public License as published by the Free # Software Foundation, either version 3 of the License, or (at your option) any # later version. # # Akantu 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 Lesser General Public License for more # details. # # You should have received a copy of the GNU Lesser General Public License # along with Akantu. If not, see . # #=============================================================================== -option(AKANTU_DOCUMENTATION_MANUAL "Build manual." OFF) +package_declare(documentation_manual + DESCRIPTION "Build the user manual.") set(AKANTU_DOCUMENTATION_MANUAL_DOCUMENTATION " This package alows to compile the user manual in the build folder \\shellcode{build/doc/manual/manual.pdf}. Under Ubuntu (14.04 LTS), the installation of the dependencies can be performed using the following command: \\begin{command} > sudo apt-get install install rubber texlive texlive-science texlive-latex-extra \\end{command}") \ No newline at end of file diff --git a/packages/10_heat_transfer.cmake b/packages/10_heat_transfer.cmake index 4b24506b4..40a8216b0 100644 --- a/packages/10_heat_transfer.cmake +++ b/packages/10_heat_transfer.cmake @@ -1,59 +1,60 @@ #=============================================================================== # @file 10_heat_transfer.cmake # # @author Guillaume Anciaux # # @date creation: Mon Nov 21 2011 # @date last modification: Thu Jun 12 2014 # # @brief package description for heat transfer # # @section LICENSE # # Copyright (©) 2014 EPFL (Ecole Polytechnique Fédérale de Lausanne) # Laboratory (LSMS - Laboratoire de Simulation en Mécanique des Solides) # # Akantu is free software: you can redistribute it and/or modify it under the # terms of the GNU Lesser General Public License as published by the Free # Software Foundation, either version 3 of the License, or (at your option) any # later version. # # Akantu 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 Lesser General Public License for more # details. # # You should have received a copy of the GNU Lesser General Public License # along with Akantu. If not, see . # #=============================================================================== -option(AKANTU_HEAT_TRANSFER "Use Heat Transfer package of Akantu" OFF) +package_declare(heat_transfer + DESCRIPTION "Use Heat Transfer package of Akantu") -set(AKANTU_HEAT_TRANSFER_FILES +package_declare_sources(heat_transfer model/heat_transfer/heat_transfer_model.cc model/heat_transfer/heat_transfer_model.hh model/heat_transfer/heat_transfer_model_inline_impl.cc ) set(AKANTU_HEAT_TRANSFER_DOC manual/manual-heattransfermodel.tex ) set(AKANTU_HEAT_TRANSFER_TESTS test_heat_transfer_model_cube3d test_heat_transfer_model_cube3d_pbc test_heat_transfer_model_square2d_pbc test_heat_transfer_model_square2d test_heat_transfer_model_cube3d_istropic_conductivity ) set(AKANTU_HEAT_TRANSFER_MANUAL_FILES manual-heattransfermodel.tex ) set(AKANTU_HEAT_TRANSFER_DOCUMENTATION " This package activates the heat transfer model within Akantu. It has no additional dependencies. ") \ No newline at end of file diff --git a/packages/10_structural_mechanics.cmake b/packages/10_structural_mechanics.cmake index 3578e4930..a6115e8df 100644 --- a/packages/10_structural_mechanics.cmake +++ b/packages/10_structural_mechanics.cmake @@ -1,80 +1,80 @@ #=============================================================================== # @file 10_structural_mechanics.cmake # # @author Nicolas Richart # # @date creation: Mon Nov 21 2011 # @date last modification: Mon Jul 07 2014 # # @brief package description for structural mechanics # # @section LICENSE # # Copyright (©) 2014 EPFL (Ecole Polytechnique Fédérale de Lausanne) # Laboratory (LSMS - Laboratoire de Simulation en Mécanique des Solides) # # Akantu is free software: you can redistribute it and/or modify it under the # terms of the GNU Lesser General Public License as published by the Free # Software Foundation, either version 3 of the License, or (at your option) any # later version. # # Akantu 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 Lesser General Public License for more # details. # # You should have received a copy of the GNU Lesser General Public License # along with Akantu. If not, see . # #=============================================================================== -option(AKANTU_STRUCTURAL_MECHANICS "Use Structural mechanics model package of Akantu" OFF) +package_declare(structural_mechanics + DESCRIPTION "Use Structural mechanics model package of Akantu" + DEPENDS implicit) -add_internal_package_dependencies(STRUCTURAL_MECHANICS IMPLICIT) - -set(AKANTU_STRUCTURAL_MECHANICS_FILES +package_declare_sources(structural_mechanics fe_engine/element_class_structural.hh fe_engine/element_classes/element_class_bernoulli_beam_inline_impl.cc fe_engine/fe_engine_template_tmpl_struct.hh fe_engine/element_classes/element_class_kirchhoff_shell_inline_impl.cc io/mesh_io/mesh_io_msh_struct.cc io/mesh_io/mesh_io_msh_struct.hh io/model_io/model_io_ibarras.cc io/model_io/model_io_ibarras.hh model/structural_mechanics/structural_mechanics_model.cc model/structural_mechanics/structural_mechanics_model.hh model/structural_mechanics/structural_mechanics_model_boundary.cc model/structural_mechanics/structural_mechanics_model_inline_impl.cc model/structural_mechanics/structural_mechanics_model_mass.cc ) set(AKANTU_STRUCTURAL_MECHANICS_DOC manual/manual-structuralmechanicsmodel.tex ) set(AKANTU_STRUCTURAL_MECHANICS_TESTS test_structural_mechanics_model_bernoulli_beam_2 test_structural_mechanics_model_boundary_bernoulli_beam_2 test_structural_mechanics_model_bernoulli_beam_2_exemple_1_1 test_structural_mechanics_model_bernoulli_beam_2_complicated test_structural_mechanics_model_bernoulli_beam_2_exemple_1_1_y test_structural_mechanics_model_bernoulli_beam_3_exemple_1_1_xy test_structural_mechanics_model_bernoulli_beam_3_exemple_1_1_zy test_structural_mechanics_model_bernoulli_beam_3_local_force test_structural_mechanics_model_bernoulli_beam_3_exercice_12_10_13 test_structural_mechanics_model_kirchhoff_shell_patch_test_4_5_5 test_structural_mechanics_model_bernoulli_beam_dynamics ) set(AKANTU_STRUCTURAL_MECHANICS_MANUAL_FILES manual-structuralmechanicsmodel.tex manual-structuralmechanicsmodel-elements.tex figures/beam_example.pdf figures/elements/bernoulli_2.pdf figures/elements/bernoulli_2.svg ) - + set(AKANTU_STRUCTURAL_MECHANICS_DOCUMENTATION " This package activates the compilation for the Structural Mechanics engine of Akantu ") diff --git a/packages/20_cohesive_element.cmake b/packages/20_cohesive_element.cmake index 66198a823..340568cb9 100644 --- a/packages/20_cohesive_element.cmake +++ b/packages/20_cohesive_element.cmake @@ -1,109 +1,110 @@ #=============================================================================== # @file 20_cohesive_element.cmake # # @author Marco Vocialta # @author Nicolas Richart # # @date creation: Tue Oct 16 2012 # @date last modification: Tue Sep 02 2014 # # @brief package description for cohesive elements # # @section LICENSE # # Copyright (©) 2014 EPFL (Ecole Polytechnique Fédérale de Lausanne) # Laboratory (LSMS - Laboratoire de Simulation en Mécanique des Solides) # # Akantu is free software: you can redistribute it and/or modify it under the # terms of the GNU Lesser General Public License as published by the Free # Software Foundation, either version 3 of the License, or (at your option) any # later version. # # Akantu 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 Lesser General Public License for more # details. # # You should have received a copy of the GNU Lesser General Public License # along with Akantu. If not, see . # #=============================================================================== -option(AKANTU_COHESIVE_ELEMENT "Use cohesive_element package of Akantu" OFF) -add_external_package_dependencies(cohesive_element lapack) +package_declare(cohesive_element + DESCRIPTION "Use cohesive_element package of Akantu" + DEPENDS lapack) -set(AKANTU_COHESIVE_ELEMENT_FILES +package_declare_sources(cohesive_element model/solid_mechanics/materials/material_cohesive_includes.hh mesh_utils/cohesive_element_inserter.hh mesh_utils/cohesive_element_inserter.cc fe_engine/cohesive_element.cc fe_engine/shape_cohesive.hh fe_engine/cohesive_element.hh fe_engine/fe_engine_template_cohesive.cc fe_engine/shape_cohesive_inline_impl.cc model/solid_mechanics/materials/material_cohesive/cohesive_internal_field_tmpl.hh model/solid_mechanics/materials/material_cohesive/cohesive_internal_field.hh model/solid_mechanics/materials/material_cohesive/material_cohesive_inline_impl.cc model/solid_mechanics/solid_mechanics_model_cohesive.cc model/solid_mechanics/fragment_manager.cc model/solid_mechanics/materials/material_cohesive/material_cohesive.cc model/solid_mechanics/materials/material_cohesive/constitutive_laws/material_cohesive_linear.cc model/solid_mechanics/materials/material_cohesive/constitutive_laws/material_cohesive_bilinear.cc model/solid_mechanics/materials/material_cohesive/constitutive_laws/material_cohesive_exponential.cc model/solid_mechanics/solid_mechanics_model_cohesive.hh model/solid_mechanics/fragment_manager.hh model/solid_mechanics/materials/material_cohesive/material_cohesive.hh model/solid_mechanics/materials/material_cohesive/constitutive_laws/material_cohesive_bilinear.hh model/solid_mechanics/materials/material_cohesive/constitutive_laws/material_cohesive_linear.hh model/solid_mechanics/materials/material_cohesive/constitutive_laws/material_cohesive_exponential.hh # io/dumper/dumper_iohelper_tmpl_connectivity_field.hh ) set(AKANTU_COHESIVE_ELEMENT_TESTS test_cohesive_buildfacets_tetrahedron test_cohesive_buildfacets_hexahedron test_cohesive_intrinsic test_cohesive_intrinsic_quadrangle test_cohesive_extrinsic test_cohesive_extrinsic_quadrangle test_cohesive_buildfragments test_cohesive_intrinsic_impl ) set(AKANTU_COHESIVE_ELEMENT_DOC manual/manual-cohesive_elements.tex manual/manual-cohesive_elements_insertion.tex manual/manual-cohesive_laws.tex manual/manual-appendix-materials-cohesive.tex ) set(AKANTU_COHESIVE_ELEMENT_MANUAL_FILES manual-cohesive_elements.tex manual-cohesive_elements_insertion.tex manual-cohesive_laws.tex manual-appendix-materials-cohesive.tex figures/cohesive2d.pdf figures/cohesive_exponential.pdf figures/linear_cohesive_law.pdf figures/bilinear_cohesive_law.pdf ) set(AKANTU_COHESIVE_ELEMENT_DOCUMENTATION "This package activates the cohesive elements engine within Akantu. It depends on: \\begin{itemize} \\item A fortran compiler. \\item An implementation of BLAS/LAPACK. \\end{itemize} ") diff --git a/packages/20_contact.cmake b/packages/20_contact.cmake index 53bbac44b..69e27e32c 100644 --- a/packages/20_contact.cmake +++ b/packages/20_contact.cmake @@ -1,99 +1,98 @@ #=============================================================================== # @file 20_contact.cmake # # @author Alejandro M. Aragón # @author Nicolas Richart # # @date creation: Mon Nov 21 2011 # @date last modification: Mon Sep 15 2014 # # @brief package description for contact # # @section LICENSE # # Copyright (©) 2014 EPFL (Ecole Polytechnique Fédérale de Lausanne) # Laboratory (LSMS - Laboratoire de Simulation en Mécanique des Solides) # # Akantu is free software: you can redistribute it and/or modify it under the # terms of the GNU Lesser General Public License as published by the Free # Software Foundation, either version 3 of the License, or (at your option) any # later version. # # Akantu 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 Lesser General Public License for more # details. # # You should have received a copy of the GNU Lesser General Public License # along with Akantu. If not, see . # #=============================================================================== -option(AKANTU_CONTACT "Use Contact package of Akantu" OFF) +package_declare(contact + DESCRIPTION "Use Contact package of Akantu" + DEPENDS cpparray implicit optimization) -set(AKANTU_CONTACT_FILES + +package_declare_sources(contact #cc files contact/discretization.cc contact/element.cc contact/friction.cc contact/resolution/resolution_augmented_lagrangian.cc contact/scheme.cc contact/search.cc contact/surface.cc contact/zone.cc contact/contact_impl.cc model/model_manager.cc # include files contact/contact_common.hh contact/contact_manager.hh contact/discretization.hh contact/element.hh contact/friction.hh contact/resolution.hh contact/resolution/resolution_augmented_lagrangian.hh contact/scheme.hh contact/search.hh contact/surface.hh contact/zone.hh contact/contact_impl.hh model/model_manager.hh model/contact_manager0.hh ) -add_external_package_dependencies(contact cpparray) -add_internal_package_dependencies(contact implicit) -add_internal_package_dependencies(contact optimization) if(AKANTU_CONTACT) list(APPEND AKANTU_BOOST_COMPONENTS chrono system ) endif() -mark_as_advanced(AKANTU_USE_CPPARRAY) set(AKANTU_CONTACT_TESTS test_hertz_2D test_hertz_3D test_offset_1slave test_offset_2slaves test_acurnier_2D_1 test_acurnier_2D_2 test_acurnier_2D_3 test_acurnier_3D_1 test_acurnier_3D_2 test_acurnier_3D_3 ) set(AKANTU_CONTACT_MANUAL_FILES manual-contact.tex figures/hertz_3D.png ) set(AKANTU_CONTACT_DOCUMENTATION " This package enables the contact mechanics engine for Akantu ") \ No newline at end of file diff --git a/packages/25_damage_non_local.cmake b/packages/25_damage_non_local.cmake index 75be7965f..4de673ec6 100644 --- a/packages/25_damage_non_local.cmake +++ b/packages/25_damage_non_local.cmake @@ -1,65 +1,65 @@ #=============================================================================== # @file 25_damage_non_local.cmake # # @author Nicolas Richart # # @date creation: Fri Jun 15 2012 # @date last modification: Fri Jun 13 2014 # # @brief package description for non-local materials # # @section LICENSE # # Copyright (©) 2014 EPFL (Ecole Polytechnique Fédérale de Lausanne) # Laboratory (LSMS - Laboratoire de Simulation en Mécanique des Solides) # # Akantu is free software: you can redistribute it and/or modify it under the # terms of the GNU Lesser General Public License as published by the Free # Software Foundation, either version 3 of the License, or (at your option) any # later version. # # Akantu 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 Lesser General Public License for more # details. # # You should have received a copy of the GNU Lesser General Public License # along with Akantu. If not, see . # #=============================================================================== -option(AKANTU_DAMAGE_NON_LOCAL "Package for Non-local damage constitutives laws Akantu" OFF) +package_declare(damage_non_local + DESCRIPTION "Package for Non-local damage constitutives laws Akantu" + DEPENDS lapack) -add_external_package_dependencies(damage_non_local lapack) - -set(AKANTU_DAMAGE_NON_LOCAL_FILES +package_declare_sources(damage_non_local model/solid_mechanics/materials/material_damage/material_damage_non_local.hh model/solid_mechanics/materials/material_damage/material_marigo_non_local.hh model/solid_mechanics/materials/material_damage/material_marigo_non_local_inline_impl.cc model/solid_mechanics/materials/material_damage/material_mazars_non_local.cc model/solid_mechanics/materials/material_damage/material_mazars_non_local.hh model/solid_mechanics/materials/material_non_local.hh model/solid_mechanics/materials/material_non_local_includes.hh model/solid_mechanics/materials/material_non_local_inline_impl.cc model/solid_mechanics/materials/weight_function.cc model/solid_mechanics/materials/weight_function.hh model/solid_mechanics/materials/weight_function_tmpl.hh synchronizer/grid_synchronizer.cc synchronizer/grid_synchronizer.hh ) set(AKANTU_DAMAGE_NON_LOCAL_TESTS test_material_damage_non_local test_grid_synchronizer ) set(AKANTU_DAMAGE_NON_LOCAL_MANUAL_FILES manual-constitutive-laws-non_local.tex manual-appendix-materials-non-local.tex) set(AKANTU_DAMAGE_NON_LOCAL_DOCUMENTATION " This package activates the non local damage feature of AKANTU ") diff --git a/packages/40_optimization.cmake b/packages/40_optimization.cmake index 90e1bd75d..9b8960d61 100644 --- a/packages/40_optimization.cmake +++ b/packages/40_optimization.cmake @@ -1,44 +1,46 @@ #=============================================================================== # @file 40_optimization.cmake # # @author Nicolas Richart # # @date creation: Fri Jan 04 2013 # @date last modification: Wed Jul 30 2014 # # @brief Optimization external library interface # # @section LICENSE # # Copyright (©) 2014 EPFL (Ecole Polytechnique Fédérale de Lausanne) # Laboratory (LSMS - Laboratoire de Simulation en Mécanique des Solides) # # Akantu is free software: you can redistribute it and/or modify it under the # terms of the GNU Lesser General Public License as published by the Free # Software Foundation, either version 3 of the License, or (at your option) any # later version. # # Akantu 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 Lesser General Public License for more # details. # # You should have received a copy of the GNU Lesser General Public License # along with Akantu. If not, see . # #=============================================================================== -option(AKANTU_OPTIMIZATION "Use optimization package in Akantu" OFF) +package_declare(optimization + DESCRIPTION "Use optimization package in Akantu" + DEPENDS nlopt + ADVANCED) -set(AKANTU_OPTIMIZATION_FILES + +package_declare_sources(optimization common/aka_optimize.hh common/aka_optimize.cc ) -add_external_package_dependencies(optimization nlopt) -mark_as_advanced(AKANTU_OPTIMIZATION) set(AKANTU_OPTIMIZATION_DOCUMENTATION " This activates the optimization routines of Akantu. This is currently needed by the contact detection algorithms. " ) diff --git a/packages/50_implicit.cmake b/packages/50_implicit.cmake index de84fd7e9..502512aaf 100644 --- a/packages/50_implicit.cmake +++ b/packages/50_implicit.cmake @@ -1,48 +1,43 @@ #=============================================================================== # @file 50_implicit.cmake # # @author Nicolas Richart # # @date creation: Tue Oct 16 2012 # @date last modification: Thu Jun 12 2014 # # @brief package description for the implicit solver # # @section LICENSE # # Copyright (©) 2010-2012, 2014 EPFL (Ecole Polytechnique Fédérale de Lausanne) # Laboratory (LSMS - Laboratoire de Simulation en Mécanique des Solides) # # Akantu is free software: you can redistribute it and/or modify it under the # terms of the GNU Lesser General Public License as published by the Free # Software Foundation, either version 3 of the License, or (at your option) any # later version. # # Akantu 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 Lesser General Public License for more # details. # # You should have received a copy of the GNU Lesser General Public License # along with Akantu. If not, see . # #=============================================================================== -add_meta_package(IMPLICIT "Add support for implicit time scheme" OFF SCOTCH MUMPS) +package_declare(implicit META + DESCRIPTION "Add support for implicit time scheme" + DEPENDS scotch mumps) -set(AKANTU_IMPLICIT_TESTS - test_solid_mechanics_model_bar_traction2d_mass_not_lumped - test_solid_mechanics_model_implicit_1d - test_solid_mechanics_model_implicit_2d - test_solid_mechanics_model_implicit_dynamic_2d - ) - -set(AKANTU_IMPLICIT_DOCUMENTATION +set(AKANTU_IMPLICIT_DOCUMENTATION " This package activates the sparse solver necessary to solve implicitely static/dynamic finite element problems. It depends on: \\begin{itemize} \\item \\href{http://mumps.enseeiht.fr/}{MUMPS}, a parallel sparse direct solver. \\item \\href{http://www.labri.fr/perso/pelegrin/scotch/}{Scotch}, a graph partitioner. \\end{itemize} ") \ No newline at end of file diff --git a/packages/50_parallel.cmake b/packages/50_parallel.cmake index 173a943d8..8c4fa85f8 100644 --- a/packages/50_parallel.cmake +++ b/packages/50_parallel.cmake @@ -1,49 +1,51 @@ #=============================================================================== # @file 50_parallel.cmake # # @author Nicolas Richart # # @date creation: Tue Oct 16 2012 # @date last modification: Wed Jun 11 2014 # # @brief meta package description for parallelization # # @section LICENSE # # Copyright (©) 2010-2012, 2014 EPFL (Ecole Polytechnique Fédérale de Lausanne) # Laboratory (LSMS - Laboratoire de Simulation en Mécanique des Solides) # # Akantu is free software: you can redistribute it and/or modify it under the # terms of the GNU Lesser General Public License as published by the Free # Software Foundation, either version 3 of the License, or (at your option) any # later version. # # Akantu 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 Lesser General Public License for more # details. # # You should have received a copy of the GNU Lesser General Public License # along with Akantu. If not, see . # #=============================================================================== -add_meta_package(PARALLEL "Add parallel support in Akantu" OFF MPI SCOTCH) +package_declare(parallel META + DESCRIPTION "Add parallel support in Akantu" + DEPENDS mpi scotch) set(AKANTU_PARALLEL_TESTS test_solid_mechanics_model_bar_traction2d_parallel test_solid_mechanics_model_segment_parallel test_solid_mechanics_model_pbc_parallel test_synchronizer_communication test_dof_synchronizer test_dof_synchronizer_communication test_solid_mechanics_model_reassign_material ) set(AKANTU_PARALLEL_MANUAL_FILES manual-parallel.tex ) set(AKANTU_PARALLEL_DOCUMENTATION " This option activates the parallel features of AKANTU. " ) diff --git a/packages/80_cpparray.cmake b/packages/80_cpparray.cmake index 74717a60f..fc27858e8 100644 --- a/packages/80_cpparray.cmake +++ b/packages/80_cpparray.cmake @@ -1,83 +1,81 @@ #=============================================================================== # @file cpp_array.cmake # # @author Guillaume Anciaux # @author Nicolas Richart # # @date Mon Nov 21 18:19:15 2011 # # @brief package description for cpp_array project # # @section LICENSE # # Copyright (©) 2010-2011 EPFL (Ecole Polytechnique Fédérale de Lausanne) # Laboratory (LSMS - Laboratoire de Simulation en Mécanique des Solides) # # Akantu is free software: you can redistribute it and/or modify it under the # terms of the GNU Lesser General Public License as published by the Free # Software Foundation, either version 3 of the License, or (at your option) any # later version. # # Akantu 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 Lesser General Public License for more # details. # # You should have received a copy of the GNU Lesser General Public License # along with Akantu. If not, see . # #=============================================================================== -option(AKANTU_USE_CPPARRAY "Use cpp-array library" OFF) -option(AKANTU_USE_THIRD_PARTY_CPPARRAY "Automatic download of the CPP-ARRAY library" ON) -mark_as_advanced(AKANTU_USE_THIRD_PARTY_CPPARRAY AKANTU_USE_CPPARRAY) +package_declare(CppArray EXTERNAL + DESCRIPTION "Use cpp-array library" + SYSTEM OFF) if(AKANTU_USE_CPPARRAY AND AKANTU_USE_THIRD_PARTY_CPPARRAY) find_package(Git) if(GIT_FOUND) if(EXISTS ${PROJECT_SOURCE_DIR}/third-party/cpp-array) execute_process( COMMAND ${GIT_EXECUTABLE} pull WORKING_DIRECTORY ${PROJECT_SOURCE_DIR}/third-party/cpp-array OUTPUT_VARIABLE _revision) message(STATUS "Updating Cpp-Array") else() message(STATUS "Cloning Cpp-Array") execute_process( COMMAND ${GIT_EXECUTABLE} clone https://code.google.com/p/cpp-array.git ${PROJECT_SOURCE_DIR}/third-party/cpp-array OUTPUT_QUIET) endif() endif() if(EXISTS ${PROJECT_SOURCE_DIR}/third-party/cpp-array/) set(cpp-array_TESTS OFF CACHE BOOL "cpparray tests" FORCE) add_subdirectory(${PROJECT_SOURCE_DIR}/third-party/cpp-array/) set(cpp-array_TESTS OFF CACHE BOOL "cpparray tests" FORCE) mark_as_advanced(cpp-array_DEV) mark_as_advanced(cpp-array_DOCUMENTATION) mark_as_advanced(cpp-array_TESTS) mark_as_advanced(CUDA) mark_as_advanced(ARRAY_USER_LIB_PATH) list(APPEND AKANTU_EXTERNAL_LIB_INCLUDE_DIR ${cpp-array_INCLUDE_DIRS} ${CPP-ARRAY_INCLUDE_DIRS}) list(APPEND AKANTU_EXTERNAL_LIBRARIES ${CPP-ARRAY_LIBRARIES}) list(APPEND AKANTU_EXTERNAL_LIB_INCLUDE_DIR ${CPP-ARRAY_INCLUDE_DIRS}) list(APPEND CPACK_SOURCE_IGNORE_FILES ${PROJECT_SOURCE_DIR}/third-party/cpp-array/) set(AKANTU_CPPARRAY_INCLUDE_DIR ${cpp-array_INCLUDE_DIRS} ${CPP-ARRAY_INCLUDE_DIRS}) set(AKANTU_CPPARRAY ON) list(APPEND AKANTU_OPTION_LIST CPPARRAY) set(AKANTU_CPPARRAY ${AKANTU_CPPARRAY} CACHE INTERNAL "Use cpp-array library" FORCE) else() message(STATUS "Cpp-Array could not be found! Please install git and/or place cpp-array in the third-party folder of Akantu") endif() -else() - add_optional_external_package(CppArray "Use cpp-array library" OFF) endif() set(AKANTU_CPPARRAY_DOCUMENTATION " This package provides access to the \\href{https://code.google.com/p/cpp-array/}{cpp-array} open-source project. If internet is accessible when configuring the project (during cmake call) this package will be auto-downloaded. ") diff --git a/packages/80_mpi.cmake b/packages/80_mpi.cmake index 07fe38fb2..1eeaba758 100644 --- a/packages/80_mpi.cmake +++ b/packages/80_mpi.cmake @@ -1,57 +1,64 @@ #=============================================================================== # @file 80_mpi.cmake # # @author Nicolas Richart # # @date creation: Mon Nov 21 2011 # @date last modification: Sat Jun 14 2014 # # @brief package description for mpi # # @section LICENSE # # Copyright (©) 2010-2012, 2014 EPFL (Ecole Polytechnique Fédérale de Lausanne) # Laboratory (LSMS - Laboratoire de Simulation en Mécanique des Solides) # # Akantu is free software: you can redistribute it and/or modify it under the # terms of the GNU Lesser General Public License as published by the Free # Software Foundation, either version 3 of the License, or (at your option) any # later version. # # Akantu 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 Lesser General Public License for more # details. # # You should have received a copy of the GNU Lesser General Public License # along with Akantu. If not, see . # #=============================================================================== if(AKANTU_USE_THIRD_PARTY_MUMPS) enable_language(Fortran) endif() -add_optional_external_package(MPI "Add MPI support in akantu" OFF PREFIX MPI_C MPI DEPENDS SCOTCH) -set(AKANTU_MPI_FILES +package_declare(MPI EXTERNAL + DESCRIPTION "Add MPI support in akantu" + EXTRA_PACKAGE_OPTIONS PREFIX MPI_C MPI + COMPILE_FLAGS "-DMPICH_IGNORE_CXX_SEEK" + DEPENDS scotch) + +package_declare_sources(MPI synchronizer/static_communicator_mpi.cc synchronizer/static_communicator_mpi_inline_impl.hh synchronizer/static_communicator_mpi.hh ) + + mark_as_advanced(MPI_EXTRA_LIBRARY MPI_LIBRARY) -set(AKANTU_MPI_DOCUMENTATION +set(AKANTU_MPI_DOCUMENTATION " This is a meta package providing access to MPI. Under Ubuntu (14.04 LTS) the installation can be performed using the commands: \\begin{command} > sudo apt-get install libopenmpi-dev \\end{command} Under Mac OS X the installation requires the following steps: \\begin{command} > sudo port install mpich-devel \\end{command} ") diff --git a/packages/80_nlopt.cmake b/packages/80_nlopt.cmake index fa223e4f9..0272994eb 100644 --- a/packages/80_nlopt.cmake +++ b/packages/80_nlopt.cmake @@ -1,82 +1,79 @@ #=============================================================================== # @file 80_nlopt.cmake # # @author Guillaume Anciaux # @author Nicolas Richart # # @date creation: Thu Jun 05 2014 # @date last modification: Thu Sep 18 2014 # # @brief package for the opitmization library NLopt # # @section LICENSE # # Copyright (©) 2014 EPFL (Ecole Polytechnique Fédérale de Lausanne) # Laboratory (LSMS - Laboratoire de Simulation en Mécanique des Solides) # # Akantu is free software: you can redistribute it and/or modify it under the # terms of the GNU Lesser General Public License as published by the Free # Software Foundation, either version 3 of the License, or (at your option) any # later version. # # Akantu 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 Lesser General Public License for more # details. # # You should have received a copy of the GNU Lesser General Public License # along with Akantu. If not, see . # #=============================================================================== - -option(AKANTU_USE_THIRD_PARTY_NLOPT "Automatic download of the NLOPT library" ON) -option(AKANTU_USE_NLOPT "Use NLOPT library" OFF) -mark_as_advanced(AKANTU_USE_THIRD_PARTY_NLOPT AKANTU_USE_NLOPT) +package_declare(nlopt EXTERNAL + DESCRIPTION "Use NLOPT library" + SYSTEM OFF) set(NLOPT_VERSION "2.4.2") set(NLOPT_ARCHIVE "${PROJECT_SOURCE_DIR}/third-party/nlopt-${NLOPT_VERSION}.tar.gz") set(NLOPT_ARCHIVE_HASH "MD5=d0b8f139a4acf29b76dbae69ade8ac54") if(NOT EXISTS ${NLOPT_ARCHIVE}) set(NLOPT_ARCHIVE "http://ab-initio.mit.edu/nlopt/nlopt-${NLOPT_VERSION}.tar.gz") endif() if (AKANTU_USE_THIRD_PARTY_NLOPT AND AKANTU_USE_NLOPT) set(NLOPT_CONFIGURE_COMMAND /configure --prefix= --enable-shared --with-cxx) set(NLOPT_DIR ${PROJECT_BINARY_DIR}/third-party) include(ExternalProject) ExternalProject_Add(NLopt PREFIX ${NLOPT_DIR} URL ${NLOPT_ARCHIVE} URL_HASH ${NLOPT_ARCHIVE_HASH} CONFIGURE_COMMAND ${NLOPT_CONFIGURE_COMMAND} BUILD_COMMAND make INSTALL_COMMAND make install ) set(NLOPT_LIBRARIES ${NLOPT_DIR}/lib/${CMAKE_SHARED_LIBRARY_PREFIX}nlopt_cxx${CMAKE_SHARED_LIBRARY_SUFFIX} CACHE PATH "Libraries for NLopt" FORCE) set(NLOPT_INCLUDE_DIR ${NLOPT_DIR}/include CACHE PATH "Include directories for NLopt" FORCE) mark_as_advanced(NLOPT_INCLUDE_DIR NLOPT_LIBRARIES) list(APPEND AKANTU_EXTERNAL_LIBRARIES ${NLOPT_LIBRARIES}) list(APPEND AKANTU_EXTERNAL_LIB_INCLUDE_DIR ${NLOPT_INCLUDE_DIR}) set(AKANTU_NLOPT_INCLUDE_DIR ${NLOPT_INCLUDE_DIR}) set(AKANTU_NLOPT_LIBRARIES ${NLOPT_LIBRARIES}) list(APPEND AKANTU_OPTION_LIST NLOPT) set(NLOPT_FOUND TRUE CACHE INTERNAL "" FORCE) set(AKANTU_NLOPT ON) list(APPEND AKANTU_EXTRA_TARGET_DEPENDENCIES NLopt) -else() - add_optional_external_package(NLopt "Use NLOPT library" OFF) endif() set(AKANTU_NLOPT_DOCUMENTATION " This package enable the use of the optimization alogorithm library \\href{http://ab-initio.mit.edu/wiki/index.php/NLopt}{NLopt}. Since there are no packaging for the common operating system by default \\akantu compiles it as a third-party project. This behavior can be modified with the option \\code{AKANTU\\_USE\\_THIRD\\_PARTY\\_NLOPT}. If the automated download fails please download \\href{http://ab-initio.mit.edu/nlopt/nlopt-${NLOPT_VERSION}.tar.gz}{nlopt-${NLOPT_VERSION}.tar.gz} and place it in \\shellcode{/third-party} download. ") diff --git a/packages/84_petsc.cmake b/packages/84_petsc.cmake index ddbec6201..03c16c98b 100644 --- a/packages/84_petsc.cmake +++ b/packages/84_petsc.cmake @@ -1,48 +1,51 @@ #=============================================================================== # @file petsc.cmake # # @author Nicolas Richart # @author Alejandro M. Aragón # @author Aurelia Cuba Ramos # # @date Mon Nov 21 18:19:15 2011 # # @brief package description for PETSc support # # @section LICENSE # # Copyright (©) 2010-2011 EPFL (Ecole Polytechnique Fédérale de Lausanne) # Laboratory (LSMS - Laboratoire de Simulation en Mécanique des Solides) # # Akantu is free software: you can redistribute it and/or modify it under the # terms of the GNU Lesser General Public License as published by the Free # Software Foundation, either version 3 of the License, or (at your option) any # later version. # # Akantu 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 Lesser General Public License for more # details. # # You should have received a copy of the GNU Lesser General Public License # along with Akantu. If not, see . # #=============================================================================== -add_optional_external_package(PETSc "Add PETSc support in akantu" OFF ARGS COMPONENT ARGS CXX) -add_internal_package_dependencies(petsc parallel) +package_declare(PETSc EXTERNAL + DESCRIPTION "Add PETSc support in akantu" + EXTRA_PACKAGE_OPTIONS ARGS COMPONENT CXX + DEPENDS parallel) -set(AKANTU_PETSC_FILES + +package_declare_sources(petsc solver/petsc_matrix.hh solver/petsc_matrix.cc solver/petsc_matrix_inline_impl.cc solver/solver_petsc.hh solver/solver_petsc.cc solver/petsc_wrapper.hh ) set(AKANTU_PETSC_TESTS test_petsc_matrix_profile test_petsc_matrix_apply_boundary test_solver_petsc ) diff --git a/packages/85_mumps.cmake b/packages/85_mumps.cmake index 7b59c554d..92f5c1d11 100644 --- a/packages/85_mumps.cmake +++ b/packages/85_mumps.cmake @@ -1,203 +1,202 @@ #=============================================================================== # @file 85_mumps.cmake # # @author Nicolas Richart # # @date creation: Mon Nov 21 2011 # @date last modification: Mon Sep 15 2014 # # @brief package description for mumps support # # @section LICENSE # # Copyright (©) 2010-2012, 2014 EPFL (Ecole Polytechnique Fédérale de Lausanne) # Laboratory (LSMS - Laboratoire de Simulation en Mécanique des Solides) # # Akantu is free software: you can redistribute it and/or modify it under the # terms of the GNU Lesser General Public License as published by the Free # Software Foundation, either version 3 of the License, or (at your option) any # later version. # # Akantu 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 Lesser General Public License for more # details. # # You should have received a copy of the GNU Lesser General Public License # along with Akantu. If not, see . # #=============================================================================== -set(AKANTU_MUMPS_FILES +package_declare_sources(Mumps solver/solver_mumps.cc solver/solver_mumps.hh ) -option(AKANTU_USE_THIRD_PARTY_MUMPS "Use the third-party Mumps instead of the one from the system" OFF) -option(AKANTU_USE_MUMPS "Add Mumps support in akantu") + +package_declare(Mumps EXTERNAL + DESCRIPTION "Add Mumps support in akantu" + SYSTEM ON) mark_as_advanced(AKANTU_USE_THIRD_PARTY_MUMPS) if(AKANTU_USE_THIRD_PARTY_MUMPS AND AKANTU_USE_MUMPS) set(MUMPS_DEPENDS) enable_language(Fortran) include(AkantuMacros) include(ExternalProject) if(AKANTU_USE_MPI) set(SCALAPACK_VERSION "2.0.2") set(SCALAPACK_ARCHIVE "http://www.netlib.org/scalapack/scalapack-${SCALAPACK_VERSION}.tgz") set(SCALAPACK_ARCHIVE_HASH "MD5=2f75e600a2ba155ed9ce974a1c4b536f") ExternalProject_Add(ScaLAPACK PREFIX ${PROJECT_BINARY_DIR}/third-party URL ${SCALAPACK_ARCHIVE} URL_HASH ${SCALAPACK_ARCHIVE_HASH} PATCH_COMMAND patch -p1 < ${PROJECT_SOURCE_DIR}/third-party/scalapack_${SCALAPACK_VERSION}.patch CMAKE_ARGS /ScaLAPACK CMAKE_CACHE_ARGS -DCMAKE_INSTALL_PREFIX:PATH= -DCMAKE_C_FLAGS:STRING=-fPIC -DCMAKE_Fortran_FLAGS:STRING=-fPIC -DBUILD_SHARED_LIBS:BOOL=ON ) set_third_party_shared_libirary_name(SCALAPACK_LIBRARIES scalapack) mark_as_advanced(SCALAPACK_LIBRARIES) install(FILES ${SCALAPACK_LIBRARIES} DESTINATION lib COMPONENT lib) list(APPEND MUMPS_DEPENDS ScaLAPACK) set(MUMPS_TYPE par) unset(MUMPS_PREFIX) else() set(MUMPS_TYPE seq) set(MUMPS_PREFIX _seq) endif() if(AKANTU_USE_THIRD_PARTY_SCOTCH) include(${PROJECT_SOURCE_DIR}/packages/90_scotch.cmake) list(APPEND MUMPS_DEPENDS Scotch) else() find_package(Scotch REQUIRED) endif() string(REPLACE ";" " " MUMPS_SCOTCH_LIBRARIES "${SCOTCH_LIBRARIES};${SCOTCH_LIBRARY_ESMUMPS}") find_package(BLAS REQUIRED) foreach(_blas_lib ${BLAS_LIBRARIES}) if("${_blas_lib}" MATCHES ".*\\.framework") get_filename_component(_blas_framework "${_blas_lib}" NAME_WE) set(MUMPS_BLAS_LIBRARIES "${MUMPS_BLAS_LIBRARIES} -framework ${_blas_framework}") else() set(MUMPS_BLAS_LIBRARIES "${MUMPS_BLAS_LIBRARIES} ${_blas_lib}") endif() endforeach() if("${MUMPS_TYPE}" STREQUAL "seq") set_third_party_shared_libirary_name(MUMPS_LIBRARY_MPI mpiseq${MUMPS_PREFIX}) mark_as_advanced(MUMPS_LIBRARY_MPI) else() set(MUMPS_LIBRARY_MPI "") endif() set(MUMPS_VERSION "4.10.0") set(MUMPS_ARCHIVE "${PROJECT_SOURCE_DIR}/third-party/MUMPS_${MUMPS_VERSION}.tar.gz") set(MUMPS_ARCHIVE_HASH "MD5=959e9981b606cd574f713b8422ef0d9f") if(NOT EXISTS ${MUMPS_ARCHIVE}) set(MUMPS_VERSION "4.9.2") set(MUMPS_ARCHIVE "${PROJECT_SOURCE_DIR}/third-party/MUMPS_${MUMPS_VERSION}.tar.gz") set(MUMPS_ARCHIVE_HASH "MD5=d0b8f139a4acf29b76dbae69ade8ac54") if(NOT EXISTS ${MUMPS_ARCHIVE}) MESSAGE(ERROR "To be able to compile MUMPS please download it from http://mumps.enseeiht.fr/ or http://graal.ens-lyon.fr/MUMPS and place it in the directory: ${PROJECT_SOURCE_DIR}/third-party Supported version for automated compilation in Akantu are 4.9.2 and 4.10.0") endif() endif() configure_file(${PROJECT_SOURCE_DIR}/third-party/MUMPS_${MUMPS_VERSION}_make.inc.cmake ${PROJECT_BINARY_DIR}/third-party/MUMPSmake.inc) ExternalProject_Add(MUMPS DEPENDS ${MUMPS_DEPENDS} PREFIX ${PROJECT_BINARY_DIR}/third-party URL ${MUMPS_ARCHIVE} URL_HASH ${MUMPS_ARCHIVE_HASH} BUILD_IN_SOURCE 1 PATCH_COMMAND patch -p2 < ${PROJECT_SOURCE_DIR}/third-party/MUMPS_${MUMPS_VERSION}.patch CONFIGURE_COMMAND cmake -E copy ${PROJECT_BINARY_DIR}/third-party/MUMPSmake.inc Makefile.inc BUILD_COMMAND make d INSTALL_COMMAND prefix= make install ) set_third_party_shared_libirary_name(MUMPS_LIBRARY_DMUMPS dmumps${MUMPS_PREFIX}) set_third_party_shared_libirary_name(MUMPS_LIBRARY_COMMON mumps_common${MUMPS_PREFIX}) set_third_party_shared_libirary_name(MUMPS_LIBRARY_PORD pord${MUMPS_PREFIX}) set(MUMPS_INCLUDE_DIR ${PROJECT_BINARY_DIR}/third-party/include CACHE PATH "" FORCE) set(MUMPS_LIBRARIES_ALL) mark_as_advanced(MUMPS_LIBRARY_COMMON MUMPS_LIBRARY_DMUMPS MUMPS_LIBRARY_PORD MUMPS_INCLUDE_DIR) list(APPEND MUMPS_LIBRARIES_ALL ${MPI_Fortran_LIBRARIES} ${MUMPS_LIBRARY_COMMON} ${MUMPS_LIBRARY_DMUMPS} ${MUMPS_LIBRARY_PORD} ${MUMPS_LIBRARY_MPI}) set(MUMPS_LIBRARIES ${MUMPS_LIBRARIES_ALL} CACHE INTERNAL "Libraries for MUMPS" FORCE) install(FILES ${MUMPS_LIBRARIES} DESTINATION lib COMPONENT lib) install(DIRECTORY ${PROJECT_BINARY_DIR}/third-party/include/ DESTINATION include/mumps COMPONENT dev FILES_MATCHING PATTERN "*mumps*.h") list(APPEND AKANTU_EXTERNAL_LIBRARIES ${MUMPS_LIBRARIES}) list(APPEND AKANTU_EXTERNAL_LIB_INCLUDE_DIR ${MUMPS_INCLUDE_DIR}) set(AKANTU_MUMPS_INCLUDE_DIR ${MUMPS_INCLUDE_DIR}) set(AKANTU_MUMPS_LIBRARIES ${MUMPS_LIBRARIES}) list(APPEND AKANTU_OPTION_LIST MUMPS) set(MUMPS_FOUND TRUE CACHE INTERNAL "" FORCE) set(AKANTU_MUMPS ON) list(APPEND AKANTU_EXTRA_TARGET_DEPENDENCIES MUMPS) else() if(AKANTU_USE_MPI) set(MUMPS_TYPE par) set(AKANTU_MUMPS_DEB_DEPEND libmumps-dev ) else() set(MUMPS_TYPE seq) set(AKANTU_MUMPS_DEB_DEPEND libmumps-seq-dev ) endif() - - add_optional_external_package(Mumps "Add Mumps support in akantu" OFF) - endif() set(AKANTU_MUMPS_TESTS test_sparse_matrix_profile test_sparse_matrix_assemble test_solver_mumps test_sparse_matrix_product ) set(AKANTU_MUMPS_DOCUMENTATION " This package enables the \\href{http://mumps.enseeiht.fr/}{MUMPS} parallel direct solver for sparce matrices. This is necessary to solve static or implicit problems. Under Ubuntu (14.04 LTS) the installation can be performed using the commands: \\begin{command} > sudo apt-get install libmumps-seq-dev # for sequential > sudo apt-get install libmumps-dev # for parallel \\end{command} Under Mac OS X the installation requires the following steps: \\begin{command} > sudo port install mumps \\end{command} If you activate the advanced option AKANTU\\_USE\\_THIRD\\_PARTY\\_MUMPS the make system of akantu can automatically compile MUMPS. For this you will have to download MUMPS from \\url{http://mumps.enseeiht.fr/} or \\url{http://graal.ens-lyon.fr/MUMPS} and place it in \\shellcode{/third-party} ") diff --git a/packages/89_lapack.cmake b/packages/89_lapack.cmake index 04db24fc1..989b890aa 100644 --- a/packages/89_lapack.cmake +++ b/packages/89_lapack.cmake @@ -1,41 +1,42 @@ #=============================================================================== # @file 89_lapack.cmake # # @author Nicolas Richart # # @date creation: Fri Oct 19 2012 # @date last modification: Thu Jun 12 2014 # # @brief package description for lapack support # # @section LICENSE # # Copyright (©) 2010-2012, 2014 EPFL (Ecole Polytechnique Fédérale de Lausanne) # Laboratory (LSMS - Laboratoire de Simulation en Mécanique des Solides) # # Akantu is free software: you can redistribute it and/or modify it under the # terms of the GNU Lesser General Public License as published by the Free # Software Foundation, either version 3 of the License, or (at your option) any # later version. # # Akantu 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 Lesser General Public License for more # details. # # You should have received a copy of the GNU Lesser General Public License # along with Akantu. If not, see . # #=============================================================================== -add_optional_external_package(LAPACK "Use LAPACK for arithmetic operations" OFF LANGUAGE Fortran) -mark_as_advanced(AKANTU_USE_LAPACK) +package_declare(LAPACK EXTERNAL + DESCRIPTION "Use LAPACK for arithmetic operations" + EXTRA_PACKAGE_OPTIONS LANGUAGE Fortran) set(AKANTU_LAPACK_DOCUMENTATION " This package provides access to a LAPACK implementation. Under Ubuntu (14.04 LTS), the installation can be performed using the following command: \\begin{command} > sudo apt-get install libatlas-base-dev \\end{command} " ) diff --git a/packages/90_blackdynamite.cmake b/packages/90_blackdynamite.cmake index 3dbd0deff..c21d59806 100644 --- a/packages/90_blackdynamite.cmake +++ b/packages/90_blackdynamite.cmake @@ -1,66 +1,70 @@ #=============================================================================== # @file blackdynamite.cmake # # @author Nicolas Richart # # @date Tue Nov 29 15:16:35 2011 # # @brief package description for BlackDynamite support # # @section LICENSE # # Copyright (©) 2010-2011 EPFL (Ecole Polytechnique Fédérale de Lausanne) # Laboratory (LSMS - Laboratoire de Simulation en Mécanique des Solides) # # Akantu is free software: you can redistribute it and/or modify it under the # terms of the GNU Lesser General Public License as published by the Free # Software Foundation, either version 3 of the License, or (at your option) any # later version. # # Akantu 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 Lesser General Public License for more # details. # # You should have received a copy of the GNU Lesser General Public License # along with Akantu. If not, see . # #=============================================================================== -option(AKANTU_USE_BLACKDYNAMITE "Use blackdynamite library" OFF) -mark_as_advanced(AKANTU_USE_BLACKDYNAMITE) -find_package(Subversion) +package_declare(BLACKDYNAMITE EXTERNAL + DESCRIPTION "Use blackdynamite library" + SYSTEM OFF) -if(SUBVERSION_FOUND) - if(AKANTU_USE_BLACKDYNAMITE) - set(BLACKDYNAMITE_SOURCE_DIR ${PROJECT_SOURCE_DIR}/third-party/blackdynamite) - - if(EXISTS ${BLACKDYNAMITE_SOURCE_DIR}) - execute_process( - COMMAND ${Subversion_SVN_EXECUTABLE} up ${BLACKDYNAMITE_SOURCE_DIR} - OUTPUT_VARIABLE _revision) - string(REGEX REPLACE ".*At revision ([0-9]*)\\..*" "\\1" _rev "${_revision}") - message(STATUS "Updating BlackDynamite: r${_rev} dynamite! dynamite!") - else() - message(STATUS "Checking out BlackDynamite: Can you digg it!") - execute_process( - COMMAND ${Subversion_SVN_EXECUTABLE} co svn+ssh://lsmssrv1.epfl.ch/space/repositories/SimulPack/BlackDynamite ${BLACKDYNAMITE_SOURCE_DIR} - OUTPUT_QUIET) - endif() +package_get_name(BLACKDYNAMITE _pkg_name) +package_use_system(${_pkg_name} _use_system) +package_get_option_name(${_pkg_name} _option_name) +if(NOT ${_use_system}) + if(${_option_name}) + find_package(Subversion) + if(SUBVERSION_FOUND) + set(BLACKDYNAMITE_SOURCE_DIR ${PROJECT_SOURCE_DIR}/third-party/blackdynamite) + if(EXISTS ${BLACKDYNAMITE_SOURCE_DIR}) + execute_process( + COMMAND ${Subversion_SVN_EXECUTABLE} up ${BLACKDYNAMITE_SOURCE_DIR} + OUTPUT_VARIABLE _revision) + string(REGEX REPLACE ".*At revision ([0-9]*)\\..*" "\\1" _rev "${_revision}") + message(STATUS "Updating BlackDynamite: r${_rev} dynamite! dynamite!") + else() + message(STATUS "Checking out BlackDynamite: Can you digg it!") + execute_process( + COMMAND ${Subversion_SVN_EXECUTABLE} co svn+ssh://lsmssrv1.epfl.ch/space/repositories/SimulPack/BlackDynamite ${BLACKDYNAMITE_SOURCE_DIR} + OUTPUT_QUIET) + endif() - set(BLACKDYNAMITE_TARGETS_EXPORT ${AKANTU_TARGETS_EXPORT}) - add_subdirectory(third-party/blackdynamite) + set(BLACKDYNAMITE_TARGETS_EXPORT ${AKANTU_TARGETS_EXPORT}) + add_subdirectory(third-party/blackdynamite) - list(APPEND AKANTU_EXTERNAL_LIBRARIES blackdynamite) - list(APPEND AKANTU_EXTERNAL_LIB_INCLUDE_DIR ${PROJECT_SOURCE_DIR}/third-party/blackdynamite/src ${BLACKDYNAMITE_EXTERNAL_INCLUDE_DIR}) + package_set_libraries(${_pkg_name} blackdynamite) + package_set_include_dir(${_pkg_name} + ${PROJECT_SOURCE_DIR}/third-party/blackdynamite/src + ${BLACKDYNAMITE_EXTERNAL_INCLUDE_DIR}) - list(APPEND AKANTU_EXPORT_LIST blackdynamite) - list(APPEND AKANTU_OPTION_LIST BLACKDYNAMITE) + list(APPEND AKANTU_EXPORT_LIST blackdynamite) - set(AKANTU_BLACKDYNAMITE_INCLUDE_DIR ${PROJECT_SOURCE_DIR}/third-party/blackdynamite/src ${BLACKDYNAMITE_EXTERNAL_INCLUDE_DIR}) - - set(AKANTU_BLACKDYNAMITE ON) - else() - set(AKANTU_BLACKDYNAMITE OFF) + package_activate(${_pkg_name}) + else() + package_deactivate(${_pkg_name}) + endif() endif() -endif() +endif() \ No newline at end of file diff --git a/packages/90_blas.cmake b/packages/90_blas.cmake index 6571f7d8a..88acbcae4 100644 --- a/packages/90_blas.cmake +++ b/packages/90_blas.cmake @@ -1,45 +1,46 @@ #=============================================================================== # @file 90_blas.cmake # # @author Nicolas Richart # # @date creation: Fri Oct 19 2012 # @date last modification: Tue Jun 24 2014 # # @brief package description for blas support # # @section LICENSE # # Copyright (©) 2010-2012, 2014 EPFL (Ecole Polytechnique Fédérale de Lausanne) # Laboratory (LSMS - Laboratoire de Simulation en Mécanique des Solides) # # Akantu is free software: you can redistribute it and/or modify it under the # terms of the GNU Lesser General Public License as published by the Free # Software Foundation, either version 3 of the License, or (at your option) any # later version. # # Akantu 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 Lesser General Public License for more # details. # # You should have received a copy of the GNU Lesser General Public License # along with Akantu. If not, see . # #=============================================================================== -add_optional_external_package(BLAS "Use BLAS for arithmetic operations" OFF LANGUAGE Fortran) -mark_as_advanced(AKANTU_USE_BLAS) +package_declare(BLAS EXTERNAL + DESCRIPTION "Use BLAS for arithmetic operations" + EXTRA_PACKAGE_OPTIONS LANGUAGE Fortran) if(BLAS_mkl_core_LIBRARY) set(AKANTU_USE_BLAS_MKL) endif() set(AKANTU_BLAS_DOCUMENTATION " This package provides access to a BLAS implementation. Under Ubuntu (14.04 LTS), the installation can be performed using the following command: \\begin{command} > sudo apt-get install libatlas-base-dev \\end{command} " ) diff --git a/packages/90_cblas.cmake b/packages/90_cblas.cmake index 4645c2d99..e69de29bb 100644 --- a/packages/90_cblas.cmake +++ b/packages/90_cblas.cmake @@ -1,2 +0,0 @@ -add_optional_external_package(CBLAS "Use CBLAS library" OFF) -mark_as_advanced(AKANTU_USE_CBLAS) diff --git a/packages/90_iohelper.cmake b/packages/90_iohelper.cmake index 4a69ab0df..4d97c3873 100644 --- a/packages/90_iohelper.cmake +++ b/packages/90_iohelper.cmake @@ -1,90 +1,93 @@ #=============================================================================== # @file 90_iohelper.cmake # # @author Nicolas Richart # # @date creation: Tue Nov 29 2011 # @date last modification: Tue Sep 02 2014 # # @brief package description for iohelper # # @section LICENSE # # Copyright (©) 2010-2012, 2014 EPFL (Ecole Polytechnique Fédérale de Lausanne) # Laboratory (LSMS - Laboratoire de Simulation en Mécanique des Solides) # # Akantu is free software: you can redistribute it and/or modify it under the # terms of the GNU Lesser General Public License as published by the Free # Software Foundation, either version 3 of the License, or (at your option) any # later version. # # Akantu 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 Lesser General Public License for more # details. # # You should have received a copy of the GNU Lesser General Public License # along with Akantu. If not, see . # #=============================================================================== -option(AKANTU_USE_THIRD_PARTY_IOHELPER "Automatic download of the IOHelper library" ON) -option(AKANTU_USE_IOHELPER "Add IOHelper support in akantu" ON) +package_declare(IOHelper EXTERNAL + DESCRIPTION "Add IOHelper support in akantu" + SYSTEM OFF) -mark_as_advanced(AKANTU_USE_IOHELPER) -mark_as_advanced(AKANTU_USE_THIRD_PARTY_IOHELPER) +package_get_name(IOHelper _pkg_name) +package_use_system(${_pkg_name} _use_system) -if (AKANTU_USE_THIRD_PARTY_IOHELPER AND AKANTU_USE_IOHELPER) - set(IOHELPER_VERSION "1.1") - set(IOHELPER_GIT "https://git.epfl.ch/repo/iohelper.git") +if(NOT ${_use_system}) + package_get_option_name(${_pkg_name} _option_name) - include(ExternalProject) + if(${_option_name}) + set(IOHELPER_VERSION "1.1") + set(IOHELPER_GIT "https://git.epfl.ch/repo/iohelper.git") - ExternalProject_Add(IOHelper - PREFIX ${PROJECT_BINARY_DIR}/third-party - GIT_REPOSITORY ${IOHELPER_GIT} - CMAKE_ARGS / - CMAKE_CACHE_ARGS -DCMAKE_INSTALL_PREFIX:PATH= -DCMAKE_BUILD_TYPE:STRING=${CMAKE_BUILD_TYPE} -DCMAKE_CXX_COMPILER:PATH=${CMAKE_CXX_COMPILER} - BUILD_COMMAND make - INSTALL_COMMAND make install - ) + include(ExternalProject) + + ExternalProject_Add(IOHelper + PREFIX ${PROJECT_BINARY_DIR}/third-party + GIT_REPOSITORY ${IOHELPER_GIT} + CMAKE_ARGS / + CMAKE_CACHE_ARGS -DCMAKE_INSTALL_PREFIX:PATH= -DCMAKE_BUILD_TYPE:STRING=${CMAKE_BUILD_TYPE} -DCMAKE_CXX_COMPILER:PATH=${CMAKE_CXX_COMPILER} + BUILD_COMMAND make + INSTALL_COMMAND make install + ) set_third_party_shared_libirary_name(IOHELPER_LIBRARIES iohelper) - list(APPEND AKANTU_EXTERNAL_LIBRARIES ${IOHELPER_LIBRARIES}) - list(APPEND AKANTU_EXTERNAL_LIB_INCLUDE_DIR ${PROJECT_BINARY_DIR}/third-party/include/iohelper) + package_set_libraries(${_pkg_name} ${IOHELPER_LIBRARIES}) + package_set_include_dir(${_pkg_name} ${PROJECT_BINARY_DIR}/third-party/include/iohelper) - list(APPEND AKANTU_EXTRA_TARGET_DEPENDENCIES IOHelper) - set(AKANTU_IOHELPER_INCLUDE_DIR ${PROJECT_BINARY_DIR}/third-party/include/iohelper) - set(AKANTU_IOHELPER ON) -else() - add_optional_external_package(IOHelper "Add IOHelper support in akantu" ON) + package_add_extra_dependency(IOHelper IOHelper) + package_activate(${_pkg_name}) + else() + package_deactivate(${_pkg_name}) + endif() endif() - -set(AKANTU_IOHELPER_FILES +package_declare_sources(IOHelper io/dumper/dumper_iohelper.hh io/dumper/dumper_iohelper.cc io/dumper/dumper_paraview.hh io/dumper/dumper_text.cc io/dumper/dumper_text.hh io/dumper/dumper_paraview.cc io/dumper/dumper_homogenizing_field.hh io/dumper/dumper_type_traits.hh io/dumper/dumper_compute.hh io/dumper/dumper_nodal_field.hh io/dumper/dumper_quadrature_points_field.hh io/dumper/dumper_variable.hh io/dumper/dumper_iterator_helper.hh io/dumper/dumper_connectivity_field.hh io/dumper/dumper_padding_helper.hh io/dumper/dumper_elemental_field.hh io/dumper/dumper_element_iterator.hh io/dumper/dumper_material_internal_field.hh io/dumper/dumper_generic_elemental_field.hh io/dumper/dumper_generic_elemental_field_tmpl.hh ) set(AKANTU_IOHELPER_DOCUMENTATION " This package activates the IOHelper facilities withing Akantu. This is mandatory if you want to be able to output Paraview files as well as any Dumper within Akantu. ") diff --git a/packages/90_qview.cmake b/packages/90_qview.cmake index d80ea1893..81a3b4890 100644 --- a/packages/90_qview.cmake +++ b/packages/90_qview.cmake @@ -1,34 +1,35 @@ #=============================================================================== # @file qview.cmake # # @author Nicolas Richart # # @date Tue Nov 29 15:16:35 2011 # # @brief package description for qview # # @section LICENSE # # Copyright (©) 2010-2011 EPFL (Ecole Polytechnique Fédérale de Lausanne) # Laboratory (LSMS - Laboratoire de Simulation en Mécanique des Solides) # # Akantu is free software: you can redistribute it and/or modify it under the # terms of the GNU Lesser General Public License as published by the Free # Software Foundation, either version 3 of the License, or (at your option) any # later version. # # Akantu 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 Lesser General Public License for more # details. # # You should have received a copy of the GNU Lesser General Public License # along with Akantu. If not, see . # #=============================================================================== -add_optional_external_package(QVIEW "Add QView support in akantu" OFF) -mark_as_advanced(AKANTU_USE_QVIEW) +package_declare(QVIEW EXTERNAL + DESCRIPTION "Add QView support in akantu") + set(AKANTU_QVIEW_DEB_DEPEND qview-client ) diff --git a/packages/90_scotch.cmake b/packages/90_scotch.cmake index 6dcdb6405..b840c840e 100644 --- a/packages/90_scotch.cmake +++ b/packages/90_scotch.cmake @@ -1,148 +1,150 @@ #=============================================================================== # @file 90_scotch.cmake # # @author Nicolas Richart # # @date creation: Mon Nov 21 2011 # @date last modification: Thu Jul 10 2014 # # @brief package description for scotch # # @section LICENSE # # Copyright (©) 2010-2012, 2014 EPFL (Ecole Polytechnique Fédérale de Lausanne) # Laboratory (LSMS - Laboratoire de Simulation en Mécanique des Solides) # # Akantu is free software: you can redistribute it and/or modify it under the # terms of the GNU Lesser General Public License as published by the Free # Software Foundation, either version 3 of the License, or (at your option) any # later version. # # Akantu 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 Lesser General Public License for more # details. # # You should have received a copy of the GNU Lesser General Public License # along with Akantu. If not, see . # #=============================================================================== -set(AKANTU_SCOTCH_FILES +package_declare(Scotch EXTERNAL + DESCRIPTION "Add Scotch support in akantu" + SYSTEM ON) + +package_declare_sources(Scotch mesh_utils/mesh_partition/mesh_partition_scotch.cc ) + if(AKANTU_SCOTCH_ON OR AKANTU_PTSCOTCH_ON) set(AKANTU_PARTITIONER_ON ON) else() set(AKANTU_PARTITIONER_ON OFF) endif() set(AKANTU_SCOTCH_TESTS test_mesh_partitionate_scotch test_mesh_partitionate_scotch_advanced ) -option(AKANTU_USE_SCOTCH "Add Scotch support in akantu" OFF) -option(AKANTU_USE_THIRD_PARTY_SCOTCH "Use the third-party Scotch instead of the one from the system" OFF) -mark_as_advanced(AKANTU_USE_THIRD_PARTY_SCOTCH) - -set(SCOTCH_VERSION "5.1.12b") -set(SCOTCH_ARCHIVE_HASH "MD5=e13b49be804755470b159d7052764dc0") -set(SCOTCH_ARCHIVE ${PROJECT_SOURCE_DIR}/third-party/scotch_${SCOTCH_VERSION}_esmumps.tar.gz) -if(NOT EXISTS ${SCOTCH_ARCHIVE}) - set(SCOTCH_ARCHIVE https://gforge.inria.fr/frs/download.php/28978/scotch_${SCOTCH_VERSION}_esmumps.tar.gz) -endif() - +package_get_name(Scotch _pkg_name) +package_use_system(${_pkg_name} _use_system) +package_get_option_name(${_pkg_name} _option_name) -if(AKANTU_USE_THIRD_PARTY_SCOTCH AND AKANTU_USE_SCOTCH) - if(TARGET Scotch) - return() +if(NOT ${_use_system}) + set(SCOTCH_VERSION "5.1.12b") + set(SCOTCH_ARCHIVE_HASH "MD5=e13b49be804755470b159d7052764dc0") + set(SCOTCH_ARCHIVE ${PROJECT_SOURCE_DIR}/third-party/scotch_${SCOTCH_VERSION}_esmumps.tar.gz) + if(NOT EXISTS ${SCOTCH_ARCHIVE}) + set(SCOTCH_ARCHIVE https://gforge.inria.fr/frs/download.php/28978/scotch_${SCOTCH_VERSION}_esmumps.tar.gz) endif() - find_package(BISON) - find_package(FLEX) - find_package(ZLIB) + if(${_option_name}) + if(TARGET Scotch) + return() + endif() - if (AKANTU_USE_OBSOLETE_GETTIMEOFDAY) - set (SCOTCH_TIMMING_OPTION -DCOMMON_TIMING_OLD) - endif() + find_package(BISON) + find_package(FLEX) + find_package(ZLIB) - if(CMAKE_SIZEOF_VOID_P EQUAL 8) - set(SCOTCH_ARCHITECTURE -DIDXSIZE64) - else() - set(SCOTCH_ARCHITECTURE) - endif() + if (AKANTU_USE_OBSOLETE_GETTIMEOFDAY) + set (SCOTCH_TIMMING_OPTION -DCOMMON_TIMING_OLD) + endif() - set(SCOTCH_DIR ${PROJECT_BINARY_DIR}/third-party) - configure_file(${PROJECT_SOURCE_DIR}/third-party/scotch_${SCOTCH_VERSION}_make.inc.cmake - ${SCOTCH_DIR}/scotch_make.inc) + if(CMAKE_SIZEOF_VOID_P EQUAL 8) + set(SCOTCH_ARCHITECTURE -DIDXSIZE64) + else() + set(SCOTCH_ARCHITECTURE) + endif() - include(ExternalProject) + set(SCOTCH_DIR ${PROJECT_BINARY_DIR}/third-party) + configure_file(${PROJECT_SOURCE_DIR}/third-party/scotch_${SCOTCH_VERSION}_make.inc.cmake + ${SCOTCH_DIR}/scotch_make.inc) - ExternalProject_Add(Scotch - PREFIX ${SCOTCH_DIR} - URL ${SCOTCH_ARCHIVE} - URL_HASH ${SCOTCH_ARCHIVE_HASH} - TLS_VERIFY FALSE - PATCH_COMMAND patch -p1 < ${PROJECT_SOURCE_DIR}/third-party/scotch_${SCOTCH_VERSION}.patch - CONFIGURE_COMMAND cmake -E copy ${SCOTCH_DIR}/scotch_make.inc src/Makefile.inc - BUILD_IN_SOURCE 1 - BUILD_COMMAND make -C src - INSTALL_COMMAND prefix= make -C src install - ) + include(ExternalProject) - set_third_party_shared_libirary_name(SCOTCH_LIBRARY scotch) - set_third_party_shared_libirary_name(SCOTCH_LIBRARY_ERR scotcherr) - set_third_party_shared_libirary_name(SCOTCH_LIBRARY_ERREXIT scotcherrexit) - set_third_party_shared_libirary_name(SCOTCH_LIBRARY_ESMUMPS esmumps) + ExternalProject_Add(Scotch + PREFIX ${SCOTCH_DIR} + URL ${SCOTCH_ARCHIVE} + URL_HASH ${SCOTCH_ARCHIVE_HASH} + TLS_VERIFY FALSE + PATCH_COMMAND patch -p1 < ${PROJECT_SOURCE_DIR}/third-party/scotch_${SCOTCH_VERSION}.patch + CONFIGURE_COMMAND cmake -E copy ${SCOTCH_DIR}/scotch_make.inc src/Makefile.inc + BUILD_IN_SOURCE 1 + BUILD_COMMAND make -C src + INSTALL_COMMAND prefix= make -C src install + ) - set(SCOTCH_INCLUDE_DIR ${SCOTCH_DIR}/include CACHE PATH "" FORCE) + set_third_party_shared_libirary_name(SCOTCH_LIBRARY scotch) + set_third_party_shared_libirary_name(SCOTCH_LIBRARY_ERR scotcherr) + set_third_party_shared_libirary_name(SCOTCH_LIBRARY_ERREXIT scotcherrexit) + set_third_party_shared_libirary_name(SCOTCH_LIBRARY_ESMUMPS esmumps) - mark_as_advanced(SCOTCH_LIBRARY SCOTCH_LIBRARY_ERR SCOTCH_LIBRARY_ERREXIT SCOTCH_LIBRARY_ESMUMPS - SCOTCH_INCLUDE_DIR) + set(SCOTCH_INCLUDE_DIR ${SCOTCH_DIR}/include CACHE PATH "" FORCE) - set(SCOTCH_LIBRARIES_ALL ${SCOTCH_LIBRARY} ${SCOTCH_LIBRARY_ERR}) - set(SCOTCH_LIBRARIES ${SCOTCH_LIBRARIES_ALL} CACHE INTERNAL "Libraries for scotch" FORCE) + mark_as_advanced(SCOTCH_LIBRARY SCOTCH_LIBRARY_ERR SCOTCH_LIBRARY_ERREXIT SCOTCH_LIBRARY_ESMUMPS + SCOTCH_INCLUDE_DIR) - list(APPEND AKANTU_EXTERNAL_LIBRARIES ${SCOTCH_LIBRARIES}) - list(APPEND AKANTU_EXTERNAL_LIB_INCLUDE_DIR ${SCOTCH_INCLUDE_DIR}) + set(SCOTCH_LIBRARIES_ALL ${SCOTCH_LIBRARY} ${SCOTCH_LIBRARY_ERR}) + set(SCOTCH_LIBRARIES ${SCOTCH_LIBRARIES_ALL} CACHE INTERNAL "Libraries for scotch" FORCE) - set(AKANTU_SCOTCH_INCLUDE_DIR ${SCOTCH_INCLUDE_DIR}) - set(AKANTU_SCOTCH_LIBRARIES ${SCOTCH_LIBRARIES}) + package_set_libraries(${_pkg_name} ${SCOTCH_LIBRARIRES}) + package_set_include_dir(${_pkg_name} ${SCOTCH_INCLUDE_DIR}) - list(APPEND AKANTU_OPTION_LIST SCOTCH) - set(SCOTCH_FOUND TRUE CACHE INTERNAL "" FORCE) - set(AKANTU_SCOTCH ON) + list(APPEND AKANTU_EXTRA_TARGET_DEPENDENCIES Scotch) - list(APPEND AKANTU_EXTRA_TARGET_DEPENDENCIES Scotch) -else() - add_optional_external_package(Scotch "Add Scotch support in akantu" OFF) - - if(SCOTCH_INCLUDE_DIR) - file(STRINGS ${SCOTCH_INCLUDE_DIR}/scotch.h SCOTCH_INCLUDE_CONTENT) - string(REGEX MATCH "_cplusplus" _match ${SCOTCH_INCLUDE_CONTENT}) - if(_match) - set(AKANTU_SCOTCH_NO_EXTERN ON) - list(APPEND AKANTU_DEFINITIONS AKANTU_SCOTCH_NO_EXTERN) - else() - set(AKANTU_SCOTCH_NO_EXTERN OFF) - endif() + package_activate(${_pkg_name}) + else() + package_deactivate(${_pkg_name}) endif() endif() +if(SCOTCH_INCLUDE_DIR) + file(STRINGS ${SCOTCH_INCLUDE_DIR}/scotch.h SCOTCH_INCLUDE_CONTENT) + string(REGEX MATCH "_cplusplus" _match ${SCOTCH_INCLUDE_CONTENT}) + if(_match) + set(AKANTU_SCOTCH_NO_EXTERN ON) + list(APPEND AKANTU_DEFINITIONS AKANTU_SCOTCH_NO_EXTERN) + else() + set(AKANTU_SCOTCH_NO_EXTERN OFF) + endif() +endif() + + set(AKANTU_SCOTCH_DOCUMENTATION " This package enables the use the \\href{http://www.labri.fr/perso/pelegrin/scotch/}{Scotch} library in order to perform a graph partitioning leading to the domain decomposition used within \\akantu Under Ubuntu (14.04 LTS) the installation can be performed using the commands: \\begin{command} > sudo apt-get install libscotch-dev \\end{command} If you activate the advanced option AKANTU\\_USE\\_THIRD\\_PARTY\\_SCOTCH the make system of akantu can automatically compile Scotch. If the automated download fails due to a SSL access not supported by your version of CMake please download the file \\href{https://gforge.inria.fr/frs/download.php/28978/scotch\\_${SCOTCH_VERSION}\\_esmumps.tar.gz}{scotch\\_${SCOTCH_VERSION}\\_esmumps.tar.gz} and then place it in the directory \\shellcode{/third-party} " ) diff --git a/packages/debug_tools.cmake b/packages/debug_tools.cmake index 67a9aaf8b..29f423b99 100644 --- a/packages/debug_tools.cmake +++ b/packages/debug_tools.cmake @@ -1,32 +1,33 @@ #=============================================================================== # @file debug_tools.cmake # # @author Nicolas Richart # # @brief some usefull tools to debug # # @section LICENSE # # Copyright (©) 2010-2011 EPFL (Ecole Polytechnique Fédérale de Lausanne) # Laboratory (LSMS - Laboratoire de Simulation en Mécanique des Solides) # # Akantu is free software: you can redistribute it and/or modify it under the # terms of the GNU Lesser General Public License as published by the Free # Software Foundation, either version 3 of the License, or (at your option) any # later version. # # Akantu 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 Lesser General Public License for more # details. # # You should have received a copy of the GNU Lesser General Public License # along with Akantu. If not, see . # #=============================================================================== -option(AKANTU_DEBUG_TOOLS "Compiles akantu with the advanced debug tools activated (/!\ can slow down the code)" OFF) -mark_as_advanced(AKANTU_DEBUG_TOOLS) +package_declare(debug_tools ADVANCED + DESCRIPTION "Compiles akantu with the advanced debug tools activated (/!\ can slow down the code)") -set(AKANTU_DEBUG_TOOLS_FILES + +package_declare_sources(debug_tools common/aka_debug_tools.hh ) \ No newline at end of file diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index b9ede9f2e..75b198fa8 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -1,159 +1,139 @@ #=============================================================================== # @file CMakeLists.txt # # @author Guillaume Anciaux # @author Nicolas Richart # # @date creation: Mon Nov 28 2011 # @date last modification: Tue Sep 16 2014 # # @brief CMake file for the library # # @section LICENSE # # Copyright (©) 2010-2012, 2014 EPFL (Ecole Polytechnique Fédérale de Lausanne) # Laboratory (LSMS - Laboratoire de Simulation en Mécanique des Solides) # # Akantu is free software: you can redistribute it and/or modify it under the # terms of the GNU Lesser General Public License as published by the Free # Software Foundation, either version 3 of the License, or (at your option) any # later version. # # Akantu 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 Lesser General Public License for more # details. # # You should have received a copy of the GNU Lesser General Public License # along with Akantu. If not, see . # #=============================================================================== #=============================================================================== # Package Management #=============================================================================== -generate_source_list_from_packages(${CMAKE_CURRENT_BINARY_DIR} +package_get_source_files( AKANTU_LIBRARY_SRCS - AKANTU_LIBRARY_INLINE_HDRS - AKANTU_LIBRARY_HDRS - AKANTU_LIBRARY_INCLUDE_DIRS) + AKANTU_LIBRARY_PUBLIC_HDRS + AKANTU_LIBRARY_PRIVATE_HDRS + ) + +package_get_include_directories( + AKANTU_LIBRARY_INCLUDE_DIRS + ) + +package_get_external_informations( + AKANTU_EXTERNAL_INCLUDE_DIR + AKANTU_EXTERNAL_LIBRARIES +) #=========================================================================== # header for blas/lapack (any other fortran libraries) #=========================================================================== -if(AKANTU_LAPACK OR AKANTU_BLAS) +package_get_name(BLAS _blas_pkg_name) +package_get_name(LAPACK _lapack_pkg_name) + +package_is_activated(${_blas_pkg_name} _blas_activated) +package_is_activated(${_lapack_pkg_name} _lapack_activated) + +if(_blas_activated OR _lapack_activated) + if(CMAKE_Fortran_COMPILER) + # ugly hack + set(CMAKE_Fortran_COMPILER_LOADED TRUE) + endif() + include(FortranCInterface) FortranCInterface_HEADER( ${CMAKE_CURRENT_BINARY_DIR}/aka_fortran_mangling.hh MACRO_NAMESPACE "AKA_FC_") mark_as_advanced(CDEFS) - list(APPEND AKANTU_LIBRARY_HDRS ${CMAKE_CURRENT_BINARY_DIR}/aka_fortran_mangling.hh) + list(APPEND AKANTU_LIBRARY_PUBLIC_HDRS ${CMAKE_CURRENT_BINARY_DIR}/aka_fortran_mangling.hh) endif() configure_file(common/aka_config.hh.in "${CMAKE_CURRENT_BINARY_DIR}/aka_config.hh" @ONLY) -list(APPEND AKANTU_LIBRARY_HDRS ${CMAKE_CURRENT_BINARY_DIR}/aka_config.hh) +list(APPEND AKANTU_LIBRARY_PUBLIC_HDRS ${CMAKE_CURRENT_BINARY_DIR}/aka_config.hh) #=========================================================================== # header precompilation #=========================================================================== set(AKANTU_COMMON_HDR_TO_PRECOMPILE common/aka_vector.hh common/aka_math.hh common/aka_types.hh fem/element_class.hh ) set(AKANTU_PRECOMPILE_HDR_INCLUDE_DIRS ${CMAKE_CURRENT_BINARY_DIR}/common/ ${CMAKE_CURRENT_BINARY_DIR}/fem/ ) set(AKANTU_INCLUDE_DIRS ${CMAKE_CURRENT_BINARY_DIR} ${AKANTU_LIBRARY_INCLUDE_DIRS} ${AKANTU_PRECOMPILE_HDR_INCLUDE_DIRS} CACHE INTERNAL "Internal include directories to link with Akantu as a subproject") -include_directories(${AKANTU_INCLUDE_DIRS} ${AKANTU_EXTERNAL_LIB_INCLUDE_DIR}) - -function(generate_material_list) - message(STATUS "Determining the list of recognized materials...") - - set(_include_dirs ${AKANTU_INCLUDE_DIRS} ${AKANTU_EXTERNAL_LIB_INCLUDE_DIR}) - - try_run(_material_list_run _material_list_compile - ${CMAKE_BINARY_DIR} - ${PROJECT_SOURCE_DIR}/cmake/material_lister.cc - CMAKE_FLAGS "-DINCLUDE_DIRECTORIES:STRING=${_include_dirs}" - COMPILE_DEFINITIONS "-DAKANTU_CMAKE_LIST_MATERIALS" - COMPILE_OUTPUT_VARIABLE _compile_results - RUN_OUTPUT_VARIABLE _result_material_list) - - if(_material_list_compile AND "${_material_list_run}" EQUAL 0) - message(STATUS "Materials included in Akantu:") - string(REPLACE "\n" ";" _material_list "${_result_material_list}") - foreach(_mat ${_material_list}) - string(REPLACE ":" ";" _mat_key "${_mat}") - list(GET _mat_key 0 _key) - list(GET _mat_key 1 _class) - list(LENGTH _mat_key _l) - - if("${_l}" GREATER 2) - list(REMOVE_AT _mat_key 0 1) - set(_opt " -- options: [") - foreach(_o ${_mat_key}) - set(_opt "${_opt} ${_o}") - endforeach() - set(_opt "${_opt} ]") - else() - set(_opt "") - endif() - - message(STATUS " ${_class} -- key: ${_key}${_opt}") - endforeach() - else() - message(STATUS "Could not determine the list of materials.") - message("${_compile_results}") - endif() -endfunction() +include_directories(${AKANTU_INCLUDE_DIRS} ${AKANTU_EXTERNAL_INCLUDE_DIR}) generate_material_list() if(CMAKE_COMPILER_IS_GNUCXX) include(PCHgcc) foreach(_header ${AKANTU_COMMON_HDR_TO_PRECOMPILE}) add_pch_rule(${_header} AKANTU_LIBRARY_SRCS) endforeach() elseif(CMAKE_COMPILER_IS_GNUCXX) endif() #=============================================================================== # Library generation #=============================================================================== add_library(akantu ${AKANTU_LIBRARY_SRCS}) target_link_libraries(akantu ${AKANTU_EXTERNAL_LIBRARIES}) -if(AKANTU_EXTRA_TARGET_DEPENDENCIES) - add_dependencies(akantu ${AKANTU_EXTRA_TARGET_DEPENDENCIES}) + +package_get_all_extra_dependency(_extra_target_dependencies) +if(_extra_target_dependencies) + add_dependencies(akantu ${_extra_target_dependencies}) endif() -list(APPEND AKANTU_PUBLIC_HDRS ${AKANTU_LIBRARY_HDRS} ${AKANTU_LIBRARY_INLINE_HDRS}) set_target_properties(akantu PROPERTIES ${AKANTU_LIBRARY_PROPERTIES}) -set_target_properties(akantu PROPERTIES PUBLIC_HEADER "${AKANTU_PUBLIC_HDRS}") +set_target_properties(akantu PROPERTIES PUBLIC_HEADER "${AKANTU_LIBRARY_PUBLIC_HDRS}") list(APPEND AKANTU_EXPORT_LIST akantu) install(TARGETS akantu EXPORT ${AKANTU_TARGETS_EXPORT} LIBRARY DESTINATION lib COMPONENT lib ARCHIVE DESTINATION lib COMPONENT lib PUBLIC_HEADER DESTINATION include/akantu/ COMPONENT dev ) if("${AKANTU_TARGETS_EXPORT}" STREQUAL "AkantuLibraryDepends") install(EXPORT AkantuLibraryDepends DESTINATION lib/akantu COMPONENT dev) endif() #Export for build tree export(TARGETS ${AKANTU_EXPORT_LIST} FILE "${CMAKE_BINARY_DIR}/AkantuLibraryDepends.cmake") export(PACKAGE Akantu) diff --git a/src/fe_engine/element_class_tmpl.hh b/src/fe_engine/element_class_tmpl.hh index 7f39a8d32..981621020 100644 --- a/src/fe_engine/element_class_tmpl.hh +++ b/src/fe_engine/element_class_tmpl.hh @@ -1,516 +1,516 @@ /** * @file element_class_tmpl.hh * * @author Thomas Menouillard * @author Nicolas Richart * * @date creation: Wed Jan 16 2013 * @date last modification: Fri Jun 13 2014 * * @brief Implementation of the inline templated function of the element class * descriptions * * @section LICENSE * * Copyright (©) 2014 EPFL (Ecole Polytechnique Fédérale de Lausanne) * Laboratory (LSMS - Laboratoire de Simulation en Mécanique des Solides) * * Akantu is free software: you can redistribute it and/or modify it under the * terms of the GNU Lesser General Public License as published by the Free * Software Foundation, either version 3 of the License, or (at your option) any * later version. * * Akantu 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 Lesser General Public License for more * details. * * You should have received a copy of the GNU Lesser General Public License * along with Akantu. If not, see . * */ /* -------------------------------------------------------------------------- */ /* GaussIntegrationElement */ /* -------------------------------------------------------------------------- */ template struct GaussIntergrationTypeDataHelper { typedef GaussIntegrationTypeData git_data; static UInt getNbQuadraturePoints() { return git_data::nb_quadrature_points; } static const Matrix getQuadraturePoints() { return Matrix(git_data::quad_positions, dimension, git_data::nb_quadrature_points); } static const Vector getWeights() { return Vector(git_data::quad_weights, git_data::nb_quadrature_points); } }; /* -------------------------------------------------------------------------- */ template struct GaussIntergrationTypeDataHelper<_git_segment, dimension, order> { typedef GaussIntegrationTypeData<_git_segment, order> git_data; static UInt getNbQuadraturePoints() { return Math::pow(git_data::nb_quadrature_points); } static const Matrix getQuadraturePoints() { UInt tot_nquad = getNbQuadraturePoints(); UInt nquad = git_data::nb_quadrature_points; Matrix quads(dimension, tot_nquad); Vector pos(git_data::quad_positions, nquad); UInt offset = 1; for (UInt d = 0; d < dimension; ++d) { for (UInt n = 0, q = 0; n < tot_nquad; ++n, q += offset) { UInt rq = q % tot_nquad + q / tot_nquad; quads(d, rq) = pos(n % nquad); } offset *= nquad; } return quads; } static const Vector getWeights() { UInt tot_nquad = getNbQuadraturePoints(); UInt nquad = git_data::nb_quadrature_points; Vector quads_weights(tot_nquad, 1.); Vector weights(git_data::quad_weights, nquad); UInt offset = 1; for (UInt d = 0; d < dimension; ++d) { for (UInt n = 0, q = 0; n < tot_nquad; ++n, q += offset) { UInt rq = q % tot_nquad + q / tot_nquad; quads_weights(rq) *= weights(n % nquad); } offset *= nquad; } return quads_weights; } }; template const Matrix GaussIntegrationElement::getQuadraturePoints() { const InterpolationType itp_type = ElementClassProperty::interpolation_type; typedef InterpolationPorperty interpolation_property; typedef GaussIntergrationTypeDataHelper::gauss_integration_type, interpolation_property::natural_space_dimension, order> data_helper; Matrix tmp(data_helper::getQuadraturePoints()); return tmp; } /* -------------------------------------------------------------------------- */ template const Vector GaussIntegrationElement::getWeights() { const InterpolationType itp_type = ElementClassProperty::interpolation_type; typedef InterpolationPorperty interpolation_property; typedef GaussIntergrationTypeDataHelper::gauss_integration_type, interpolation_property::natural_space_dimension, order> data_helper; Vector tmp(data_helper::getWeights()); return tmp; } /* -------------------------------------------------------------------------- */ template UInt GaussIntegrationElement::getNbQuadraturePoints() { const InterpolationType itp_type = ElementClassProperty::interpolation_type; typedef InterpolationPorperty interpolation_property; typedef GaussIntergrationTypeDataHelper::gauss_integration_type, interpolation_property::natural_space_dimension, order> data_helper; return data_helper::getNbQuadraturePoints(); } /* -------------------------------------------------------------------------- */ /* GeometricalElement */ /* -------------------------------------------------------------------------- */ template inline const MatrixProxy GeometricalElement::getFacetLocalConnectivityPerElement(UInt t) { return MatrixProxy(facet_connectivity[t], nb_facets[t], nb_nodes_per_facet[t]); } /* -------------------------------------------------------------------------- */ template inline UInt GeometricalElement::getNbFacetsPerElement(UInt t) { return nb_facets[t]; } /* -------------------------------------------------------------------------- */ template template inline bool GeometricalElement::contains(const vector_type & coords) { return GeometricalShapeContains::contains(coords); } /* -------------------------------------------------------------------------- */ template<> template inline bool GeometricalShapeContains<_gst_point>::contains(const vector_type & coords) { return (coords(0) < std::numeric_limits::epsilon()); } /* -------------------------------------------------------------------------- */ template<> template inline bool GeometricalShapeContains<_gst_square>::contains(const vector_type & coords) { bool in = true; for (UInt i = 0; i < coords.size() && in; ++i) in &= ((coords(i) >= -1.) && (coords(i) <= 1.)); return in; } /* -------------------------------------------------------------------------- */ template<> template inline bool GeometricalShapeContains<_gst_triangle>::contains(const vector_type & coords) { bool in = true; Real sum = 0; for (UInt i = 0; (i < coords.size()) && in; ++i) { in &= ((coords(i) >= 0) && (coords(i) <= 1.)); sum += coords(i); } if(in) return (in && (sum <= 1)); return in; } /* -------------------------------------------------------------------------- */ template<> template inline bool GeometricalShapeContains<_gst_prism>::contains(const vector_type & coords) { bool in = ((coords(0) >= -1.) && (coords(0) <= 1.)); // x in segement [-1, 1] // y and z in triangle in &= ((coords(1) >= 0) && (coords(1) <= 1.)); in &= ((coords(2) >= 0) && (coords(2) <= 1.)); Real sum = coords(1) + coords(2); return (in && (sum <= 1)); } /* -------------------------------------------------------------------------- */ /* InterpolationElement */ /* -------------------------------------------------------------------------- */ template inline void InterpolationElement::computeShapes(const Matrix & natural_coord, Matrix & N) { UInt nb_points = natural_coord.cols(); for (UInt p = 0; p < nb_points; ++p) { Vector Np(N(p)); Vector ncoord_p(natural_coord(p)); computeShapes(ncoord_p, Np); } } /* -------------------------------------------------------------------------- */ template inline void InterpolationElement::computeDNDS(const Matrix & natural_coord, Tensor3 & dnds) { UInt nb_points = natural_coord.cols(); for (UInt p = 0; p < nb_points; ++p) { Matrix dnds_p(dnds(p)); Vector ncoord_p(natural_coord(p)); computeDNDS(ncoord_p, dnds_p); } } /* -------------------------------------------------------------------------- */ /** * interpolate the field on a point given in natural coordinates the field which * values are given on the node of the element * * @param natural_coords natural coordinates of point where to interpolate \xi * @param nodal_values values of the function per node @f$ f_{ij} = f_{n_i j} @f$ so it should be a matrix of size nb_nodes_per_element @f$\times@f$ nb_degree_of_freedom * @param interpolated interpolated value of f @f$ f_j(\xi) = \sum_i f_{n_i j} N_i @f$ */ template inline void InterpolationElement::interpolateOnNaturalCoordinates(const Vector & natural_coords, const Matrix & nodal_values, Vector & interpolated) { Vector shapes(InterpolationPorperty::nb_nodes_per_element); computeShapes(natural_coords, shapes); Matrix interpm(interpolated.storage(), nodal_values.rows(), 1); Matrix shapesm(shapes.storage(), InterpolationPorperty::nb_nodes_per_element, 1); interpm.mul(nodal_values, shapesm); } /* -------------------------------------------------------------------------- */ /// @f$ gradient_{ij} = \frac{\partial f_j}{\partial s_i} = \sum_k \frac{\partial N_k}{\partial s_i}f_{j n_k} @f$ template inline void InterpolationElement::gradientOnNaturalCoordinates(const Vector & natural_coords, const Matrix & f, Matrix & gradient) { Matrix dnds(InterpolationPorperty::natural_space_dimension, InterpolationPorperty::nb_nodes_per_element); computeDNDS(natural_coords, dnds); gradient.mul(f, dnds); } /* -------------------------------------------------------------------------- */ /* ElementClass */ /* -------------------------------------------------------------------------- */ /* -------------------------------------------------------------------------- */ template inline void ElementClass::computeJMat(const Tensor3 & dnds, const Matrix & node_coords, Tensor3 & J) { UInt nb_points = dnds.size(2); for (UInt p = 0; p < nb_points; ++p) { Matrix J_p(J(p)); Matrix dnds_p(dnds(p)); computeJMat(dnds_p, node_coords, J_p); } } /* -------------------------------------------------------------------------- */ template inline void ElementClass::computeJMat(const Matrix & dnds, const Matrix & node_coords, Matrix & J) { /// @f$ J = dxds = dnds * x @f$ J.mul(dnds, node_coords); } /* -------------------------------------------------------------------------- */ template inline void ElementClass::computeJacobian(const Matrix & natural_coords, const Matrix & node_coords, Vector & jacobians) { UInt nb_points = natural_coords.cols(); Matrix dnds(interpolation_property::natural_space_dimension, interpolation_property::nb_nodes_per_element); Matrix J(natural_coords.rows(), - node_coords.rows()); + node_coords.rows()); for (UInt p = 0; p < nb_points; ++p) { Vector ncoord_p(natural_coords(p)); interpolation_element::computeDNDS(ncoord_p, dnds); computeJMat(dnds, node_coords, J); computeJacobian(J, jacobians(p)); } } /* -------------------------------------------------------------------------- */ template inline void ElementClass::computeJacobian(const Tensor3 & J, Vector & jacobians) { UInt nb_points = J.size(2); for (UInt p = 0; p < nb_points; ++p) { computeJacobian(J(p), jacobians(p)); } } /* -------------------------------------------------------------------------- */ template inline void ElementClass::computeJacobian(const Matrix & J, Real & jacobians) { if(J.rows() == J.cols()) { jacobians = Math::det(J.storage()); } else { interpolation_element::computeSpecialJacobian(J, jacobians); } } /* -------------------------------------------------------------------------- */ template inline void ElementClass::computeShapeDerivatives(const Tensor3 & J, const Tensor3 & dnds, Tensor3 & shape_deriv) { UInt nb_points = J.size(2); for (UInt p = 0; p < nb_points; ++p) { Matrix shape_deriv_p(shape_deriv(p)); computeShapeDerivatives(J(p), dnds(p), shape_deriv_p); } } /* -------------------------------------------------------------------------- */ template inline void ElementClass::computeShapeDerivatives(const Matrix & J, const Matrix & dnds, Matrix & shape_deriv) { Matrix inv_J(J.rows(), J.cols()); Math::inv(J.storage(), inv_J.storage()); shape_deriv.mul(inv_J, dnds); } /* -------------------------------------------------------------------------- */ template inline void ElementClass::computeNormalsOnNaturalCoordinates(const Matrix & coord, Matrix & f, Matrix & normals) { UInt dimension = normals.rows(); UInt nb_points = coord.cols(); AKANTU_DEBUG_ASSERT((dimension - 1) == interpolation_property::natural_space_dimension, "cannot extract a normal because of dimension mismatch " << dimension - 1 << " " << interpolation_property::natural_space_dimension); Matrix J(dimension, interpolation_property::natural_space_dimension); for (UInt p = 0; p < nb_points; ++p) { interpolation_element::gradientOnNaturalCoordinates(coord(p), f, J); if (dimension == 2) { Math::normal2(J.storage(), normals(p).storage()); } if (dimension == 3){ Math::normal3(J(0).storage(), J(1).storage(), normals(p).storage()); } } } /* ------------------------------------------------------------------------- */ /** * In the non linear cases we need to iterate to find the natural coordinates @f$\xi@f$ * provided real coordinates @f$x@f$. * * We want to solve: @f$ x- \phi(\xi) = 0@f$ with @f$\phi(\xi) = \sum_I N_I(\xi) x_I@f$ * the mapping function which uses the nodal coordinates @f$x_I@f$. * * To that end we use the Newton method and the following series: * * @f$ \frac{\partial \phi(x_k)}{\partial \xi} \left( \xi_{k+1} - \xi_k \right) = x - \phi(x_k)@f$ * * When we consider elements embedded in a dimension higher than them (2D triangle in a 3D space for example) * @f$ J = \frac{\partial \phi(\xi_k)}{\partial \xi}@f$ is of dimension @f$dim_{space} \times dim_{elem}@f$ which * is not invertible in most cases. Rather we can solve the problem: * * @f$ J^T J \left( \xi_{k+1} - \xi_k \right) = J^T \left( x - \phi(\xi_k) \right) @f$ * * So that * * @f$ d\xi = \xi_{k+1} - \xi_k = (J^T J)^{-1} J^T \left( x - \phi(\xi_k) \right) @f$ * * So that if the series converges we have: * * @f$ 0 = J^T \left( \phi(\xi_\infty) - x \right) @f$ * * And we see that this is ill-posed only if @f$ J^T x = 0@f$ which means that the vector provided * is normal to any tangent which means it is outside of the element itself. * * @param real_coords: the real coordinates the natural coordinates are sought for * @param node_coords: the coordinates of the nodes forming the element * @param natural_coords: output->the sought natural coordinates * @param spatial_dimension: spatial dimension of the problem * **/ template inline void ElementClass::inverseMap(const Vector & real_coords, const Matrix & node_coords, Vector & natural_coords, Real tolerance) { UInt spatial_dimension = real_coords.size(); UInt dimension = natural_coords.size(); //matrix copy of the real_coords Matrix mreal_coords(real_coords.storage(), spatial_dimension, 1); //initial guess // Matrix natural_guess(natural_coords.storage(), dimension, 1); natural_coords.clear(); // real space coordinates provided by initial guess Matrix physical_guess(dimension, 1); // objective function f = real_coords - physical_guess Matrix f(dimension, 1); // dnds computed on the natural_guess // Matrix dnds(interpolation_element::nb_nodes_per_element, spatial_dimension); // J Jacobian matrix computed on the natural_guess Matrix J(spatial_dimension, dimension); // G = J^t * J Matrix G(spatial_dimension, spatial_dimension); // Ginv = G^{-1} Matrix Ginv(spatial_dimension, spatial_dimension); // J = Ginv * J^t Matrix F(spatial_dimension, dimension); // dxi = \xi_{k+1} - \xi in the iterative process Matrix dxi(spatial_dimension, 1); /* --------------------------- */ /* init before iteration loop */ /* --------------------------- */ // do interpolation Vector physical_guess_v(physical_guess.storage(), dimension); interpolation_element::interpolateOnNaturalCoordinates(natural_coords, node_coords, physical_guess_v); // compute initial objective function value f = real_coords - physical_guess f = mreal_coords; f -= physical_guess; // compute initial error Real inverse_map_error = f.norm(); /* --------------------------- */ /* iteration loop */ /* --------------------------- */ while(tolerance < inverse_map_error) { //compute J^t interpolation_element::gradientOnNaturalCoordinates(natural_coords, node_coords, J); //compute G G.mul(J, J); // inverse G Ginv.inverse(G); //compute F F.mul(Ginv, J); //compute increment dxi.mul(F, f); //update our guess natural_coords += Vector(dxi(0)); //interpolate interpolation_element::interpolateOnNaturalCoordinates(natural_coords, node_coords, physical_guess_v); // compute error f = mreal_coords; f -= physical_guess; inverse_map_error = f.norm(); } // memcpy(natural_coords.storage(), natural_guess.storage(), sizeof(Real) * natural_coords.size()); } diff --git a/src/fe_engine/element_classes/element_class_quadrangle_4_inline_impl.cc b/src/fe_engine/element_classes/element_class_quadrangle_4_inline_impl.cc index f396e2459..29e8cef18 100644 --- a/src/fe_engine/element_classes/element_class_quadrangle_4_inline_impl.cc +++ b/src/fe_engine/element_classes/element_class_quadrangle_4_inline_impl.cc @@ -1,151 +1,151 @@ /** * @file element_class_quadrangle_4_inline_impl.cc * * @author Nicolas Richart * * @date creation: Mon Dec 13 2010 * @date last modification: Fri Jun 13 2014 * * @brief Specialization of the element_class class for the type _quadrangle_4 * * @section LICENSE * * Copyright (©) 2010-2012, 2014 EPFL (Ecole Polytechnique Fédérale de Lausanne) * Laboratory (LSMS - Laboratoire de Simulation en Mécanique des Solides) * * Akantu is free software: you can redistribute it and/or modify it under the * terms of the GNU Lesser General Public License as published by the Free * Software Foundation, either version 3 of the License, or (at your option) any * later version. * * Akantu 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 Lesser General Public License for more * details. * * You should have received a copy of the GNU Lesser General Public License * along with Akantu. If not, see . * * @section DESCRIPTION * * @verbatim \eta ^ (-1,1) | (1,1) x---------x | | | | | | --|---------|-----> \xi | | | | | | x---------x (-1,-1) | (1,-1) @endverbatim * * @subsection shapes Shape functions * @f[ * \begin{array}{lll} * N1 = (1 - \xi) (1 - \eta) / 4 * & \frac{\partial N1}{\partial \xi} = - (1 - \eta) / 4 * & \frac{\partial N1}{\partial \eta} = - (1 - \xi) / 4 \\ * N2 = (1 + \xi) (1 - \eta) / 4 \\ * & \frac{\partial N2}{\partial \xi} = (1 - \eta) / 4 * & \frac{\partial N2}{\partial \eta} = - (1 + \xi) / 4 \\ * N3 = (1 + \xi) (1 + \eta) / 4 \\ * & \frac{\partial N3}{\partial \xi} = (1 + \eta) / 4 * & \frac{\partial N3}{\partial \eta} = (1 + \xi) / 4 \\ * N4 = (1 - \xi) (1 + \eta) / 4 * & \frac{\partial N4}{\partial \xi} = - (1 + \eta) / 4 * & \frac{\partial N4}{\partial \eta} = (1 - \xi) / 4 \\ * \end{array} * @f] * * @subsection quad_points Position of quadrature points * @f{eqnarray*}{ * \xi_{q0} &=& 0 \qquad \eta_{q0} = 0 * @f} */ /* -------------------------------------------------------------------------- */ AKANTU_DEFINE_ELEMENT_CLASS_PROPERTY(_quadrangle_4, _gt_quadrangle_4, _itp_lagrange_quadrangle_4, _ek_regular, 2, _git_segment, 2); AKANTU_DEFINE_SHAPE(_gt_quadrangle_4, _gst_square); /* -------------------------------------------------------------------------- */ template <> template inline void InterpolationElement<_itp_lagrange_quadrangle_4>::computeShapes(const vector_type & c, vector_type & N) { - N(0) = .25 * (1 - c(0)) * (1 - c(1)); /// N1(q_0) - N(1) = .25 * (1 + c(0)) * (1 - c(1)); /// N2(q_0) - N(2) = .25 * (1 + c(0)) * (1 + c(1)); /// N3(q_0) - N(3) = .25 * (1 - c(0)) * (1 + c(1)); /// N4(q_0) + N(0) = 1./4. * (1. - c(0)) * (1. - c(1)); /// N1(q_0) + N(1) = 1./4. * (1. + c(0)) * (1. - c(1)); /// N2(q_0) + N(2) = 1./4. * (1. + c(0)) * (1. + c(1)); /// N3(q_0) + N(3) = 1./4. * (1. - c(0)) * (1. + c(1)); /// N4(q_0) } /* -------------------------------------------------------------------------- */ template <> template inline void InterpolationElement<_itp_lagrange_quadrangle_4>::computeDNDS(const vector_type & c, matrix_type & dnds) { /** * @f[ * dnds = \left( * \begin{array}{cccc} * \frac{\partial N1}{\partial \xi} & \frac{\partial N2}{\partial \xi} * & \frac{\partial N3}{\partial \xi} & \frac{\partial N4}{\partial \xi}\\ * \frac{\partial N1}{\partial \eta} & \frac{\partial N2}{\partial \eta} * & \frac{\partial N3}{\partial \eta} & \frac{\partial N4}{\partial \eta} * \end{array} * \right) * @f] */ - dnds(0, 0) = - .25 * (1 - c(1)); - dnds(0, 1) = .25 * (1 - c(1)); - dnds(0, 2) = .25 * (1 + c(1)); - dnds(0, 3) = - .25 * (1 + c(1)); + dnds(0, 0) = - 1./4. * (1. - c(1)); + dnds(0, 1) = 1./4. * (1. - c(1)); + dnds(0, 2) = 1./4. * (1. + c(1)); + dnds(0, 3) = - 1./4. * (1. + c(1)); - dnds(1, 0) = - .25 * (1 - c(0)); - dnds(1, 1) = - .25 * (1 + c(0)); - dnds(1, 2) = .25 * (1 + c(0)); - dnds(1, 3) = .25 * (1 - c(0)); + dnds(1, 0) = - 1./4. * (1. - c(0)); + dnds(1, 1) = - 1./4. * (1. + c(0)); + dnds(1, 2) = 1./4. * (1. + c(0)); + dnds(1, 3) = 1./4. * (1. - c(0)); } /* -------------------------------------------------------------------------- */ template <> inline void InterpolationElement<_itp_lagrange_quadrangle_4>::computeSpecialJacobian(const Matrix & J, Real & jac){ Vector vprod(J.cols()); Matrix Jt(J.transpose(), true); vprod.crossProduct(Jt(0), Jt(1)); jac = vprod.norm(); } /* -------------------------------------------------------------------------- */ template<> inline Real GeometricalElement<_gt_quadrangle_4>::getInradius(const Matrix & coord) { Vector u0 = coord(0); Vector u1 = coord(1); Vector u2 = coord(2); Vector u3 = coord(3); Real a = u0.distance(u1); Real b = u1.distance(u2); Real c = u2.distance(u3); Real d = u3.distance(u0); // Real septimetre = (a + b + c + d) / 2.; // Real p = Math::distance_2d(coord + 0, coord + 4); // Real q = Math::distance_2d(coord + 2, coord + 6); // Real area = sqrt(4*(p*p * q*q) - (a*a + b*b + c*c + d*d)*(a*a + c*c - b*b - d*d)) / 4.; // Real h = sqrt(area); // to get a length // Real h = area / septimetre; // formula of inradius for circumscritable quadrelateral Real h = std::min(a, std::min(b, std::min(c, d))); return h; } diff --git a/src/fe_engine/shape_lagrange.hh b/src/fe_engine/shape_lagrange.hh index 05b6a01ec..b0655ca8d 100644 --- a/src/fe_engine/shape_lagrange.hh +++ b/src/fe_engine/shape_lagrange.hh @@ -1,158 +1,165 @@ /** * @file shape_lagrange.hh * * @author Guillaume Anciaux * @author Nicolas Richart * * @date creation: Tue Feb 15 2011 * @date last modification: Fri Jun 13 2014 * * @brief lagrangian shape functions class * * @section LICENSE * * Copyright (©) 2014 EPFL (Ecole Polytechnique Fédérale de Lausanne) * Laboratory (LSMS - Laboratoire de Simulation en Mécanique des Solides) * * Akantu is free software: you can redistribute it and/or modify it under the * terms of the GNU Lesser General Public License as published by the Free * Software Foundation, either version 3 of the License, or (at your option) any * later version. * * Akantu 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 Lesser General Public License for more * details. * * You should have received a copy of the GNU Lesser General Public License * along with Akantu. If not, see . * */ #ifndef __AKANTU_SHAPE_LAGRANGE_HH__ #define __AKANTU_SHAPE_LAGRANGE_HH__ #include "shape_functions.hh" __BEGIN_AKANTU__ /* -------------------------------------------------------------------------- */ template class ShapeCohesive; template class ShapeLagrange : public ShapeFunctions{ /* ------------------------------------------------------------------------ */ /* Constructors/Destructors */ /* ------------------------------------------------------------------------ */ public: ShapeLagrange(const Mesh & mesh, const ID & id = "shape_lagrange", const MemoryID & memory_id = 0); virtual ~ShapeLagrange(){}; /* ------------------------------------------------------------------------ */ /* Methods */ /* ------------------------------------------------------------------------ */ public: inline void initShapeFunctions(const Array & nodes, const Matrix & control_points, const ElementType & type, const GhostType & ghost_type); /// pre compute all shapes on the element control points from natural coordinates template void precomputeShapesOnControlPoints(const Array & nodes, GhostType ghost_type); /// pre compute all shape derivatives on the element control points from natural coordinates template void precomputeShapeDerivativesOnControlPoints(const Array & nodes, GhostType ghost_type); /// interpolate nodal values on the control points template void interpolateOnControlPoints(const Array &u, Array &uq, UInt nb_degree_of_freedom, GhostType ghost_type = _not_ghost, const Array & filter_elements = empty_filter) const; /// compute the gradient of u on the control points template void gradientOnControlPoints(const Array &u, Array &nablauq, UInt nb_degree_of_freedom, GhostType ghost_type = _not_ghost, const Array & filter_elements = empty_filter) const; /// multiply a field by shape functions @f$ fts_{ij} = f_i * \varphi_j @f$ template void fieldTimesShapes(const Array & field, Array & field_times_shapes, GhostType ghost_type) const; /// find natural coords from real coords provided an element template void inverseMap(const Vector & real_coords, UInt element, Vector & natural_coords, const GhostType & ghost_type = _not_ghost) const; /// return true if the coordinates provided are inside the element, false otherwise template bool contains(const Vector & real_coords, UInt elem, const GhostType & ghost_type) const; /// compute the shape on a provided point template void computeShapes(const Vector & real_coords, UInt elem, Vector & shapes, const GhostType & ghost_type) const; + /// compute the shape derivatives on a provided point + template + void computeShapeDerivatives(const Matrix & real_coords, + UInt elem, + Tensor3 & shapes, + const GhostType & ghost_type) const; + /// function to print the containt of the class virtual void printself(std::ostream & stream, int indent = 0) const; protected: /// compute the shape derivatives on control points for a given element template inline void computeShapeDerivativesOnCPointsByElement(const Matrix & node_coords, const Matrix & natural_coords, - Tensor3 & shapesd); + Tensor3 & shapesd) const; /* ------------------------------------------------------------------------ */ /* Accessors */ /* ------------------------------------------------------------------------ */ public: /// get a the shapes vector inline const Array & getShapes(const ElementType & el_type, const GhostType & ghost_type = _not_ghost) const; /// get a the shapes derivatives vector inline const Array & getShapesDerivatives(const ElementType & el_type, const GhostType & ghost_type = _not_ghost) const; /* ------------------------------------------------------------------------ */ /* Class Members */ /* ------------------------------------------------------------------------ */ protected: /// shape functions for all elements ElementTypeMapArray shapes; /// shape functions derivatives for all elements ElementTypeMapArray shapes_derivatives; }; /* -------------------------------------------------------------------------- */ /* inline functions */ /* -------------------------------------------------------------------------- */ #include "shape_lagrange_inline_impl.cc" __END_AKANTU__ #endif /* __AKANTU_SHAPE_LAGRANGE_HH__ */ diff --git a/src/fe_engine/shape_lagrange_inline_impl.cc b/src/fe_engine/shape_lagrange_inline_impl.cc index cacca9d0f..02b561d0a 100644 --- a/src/fe_engine/shape_lagrange_inline_impl.cc +++ b/src/fe_engine/shape_lagrange_inline_impl.cc @@ -1,336 +1,396 @@ /** * @file shape_lagrange_inline_impl.cc * * @author Guillaume Anciaux * @author Nicolas Richart * * @date creation: Tue Feb 15 2011 * @date last modification: Fri Jun 13 2014 * * @brief ShapeLagrange inline implementation * * @section LICENSE * * Copyright (©) 2014 EPFL (Ecole Polytechnique Fédérale de Lausanne) * Laboratory (LSMS - Laboratoire de Simulation en Mécanique des Solides) * * Akantu is free software: you can redistribute it and/or modify it under the * terms of the GNU Lesser General Public License as published by the Free * Software Foundation, either version 3 of the License, or (at your option) any * later version. * * Akantu 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 Lesser General Public License for more * details. * * You should have received a copy of the GNU Lesser General Public License * along with Akantu. If not, see . * */ __END_AKANTU__ #include "fe_engine.hh" __BEGIN_AKANTU__ /* -------------------------------------------------------------------------- */ template inline const Array & ShapeLagrange::getShapes(const ElementType & el_type, const GhostType & ghost_type) const { return shapes(FEEngine::getInterpolationType(el_type), ghost_type); } /* -------------------------------------------------------------------------- */ template inline const Array & ShapeLagrange::getShapesDerivatives(const ElementType & el_type, const GhostType & ghost_type) const { return shapes_derivatives(FEEngine::getInterpolationType(el_type), ghost_type); } /* -------------------------------------------------------------------------- */ #define INIT_SHAPE_FUNCTIONS(type) \ setControlPointsByType(control_points, ghost_type); \ precomputeShapesOnControlPoints(nodes, ghost_type); \ if (ElementClass::getNaturalSpaceDimension() == \ mesh.getSpatialDimension() || kind != _ek_regular) \ precomputeShapeDerivativesOnControlPoints(nodes, ghost_type); template inline void ShapeLagrange::initShapeFunctions(const Array & nodes, const Matrix & control_points, const ElementType & type, const GhostType & ghost_type) { AKANTU_BOOST_REGULAR_ELEMENT_SWITCH(INIT_SHAPE_FUNCTIONS); } #if defined(AKANTU_STRUCTURAL_MECHANICS) /* -------------------------------------------------------------------------- */ template <> inline void ShapeLagrange<_ek_structural>::initShapeFunctions(__attribute__((unused)) const Array & nodes, __attribute__((unused)) const Matrix & control_points, __attribute__((unused)) const ElementType & type, __attribute__((unused)) const GhostType & ghost_type) { AKANTU_DEBUG_TO_IMPLEMENT(); } #endif #undef INIT_SHAPE_FUNCTIONS /* -------------------------------------------------------------------------- */ template template inline void ShapeLagrange:: computeShapeDerivativesOnCPointsByElement(const Matrix & node_coords, const Matrix & natural_coords, - Tensor3 & shapesd) { + Tensor3 & shapesd) const { + AKANTU_DEBUG_IN(); + // compute dnds Tensor3 dnds(node_coords.rows(), node_coords.cols(), natural_coords.cols()); ElementClass::computeDNDS(natural_coords, dnds); // compute dxds Tensor3 J(node_coords.rows(), natural_coords.rows(), natural_coords.cols()); ElementClass::computeJMat(dnds, node_coords, J); // compute shape derivatives ElementClass::computeShapeDerivatives(J, dnds, shapesd); + + AKANTU_DEBUG_OUT(); } /* -------------------------------------------------------------------------- */ template template void ShapeLagrange::inverseMap(const Vector & real_coords, UInt elem, Vector & natural_coords, const GhostType & ghost_type) const{ + AKANTU_DEBUG_IN(); + UInt spatial_dimension = mesh.getSpatialDimension(); UInt nb_nodes_per_element = ElementClass::getNbNodesPerInterpolationElement(); UInt * elem_val = mesh.getConnectivity(type, ghost_type).storage(); Matrix nodes_coord(spatial_dimension, nb_nodes_per_element); mesh.extractNodalValuesFromElement(mesh.getNodes(), nodes_coord.storage(), elem_val + elem*nb_nodes_per_element, nb_nodes_per_element, spatial_dimension); ElementClass::inverseMap(real_coords, nodes_coord, natural_coords); + + AKANTU_DEBUG_OUT(); } /* -------------------------------------------------------------------------- */ template template bool ShapeLagrange::contains(const Vector & real_coords, UInt elem, const GhostType & ghost_type) const{ UInt spatial_dimension = mesh.getSpatialDimension(); Vector natural_coords(spatial_dimension); inverseMap(real_coords, elem, natural_coords, ghost_type); return ElementClass::contains(natural_coords); } /* -------------------------------------------------------------------------- */ template template void ShapeLagrange::computeShapes(const Vector & real_coords, UInt elem, Vector & shapes, - const GhostType & ghost_type) const{ + const GhostType & ghost_type) const { + + AKANTU_DEBUG_IN(); UInt spatial_dimension = mesh.getSpatialDimension(); Vector natural_coords(spatial_dimension); inverseMap(real_coords, elem, natural_coords, ghost_type); ElementClass::computeShapes(natural_coords, shapes); + + AKANTU_DEBUG_OUT(); +} + +/* -------------------------------------------------------------------------- */ +template +template +void ShapeLagrange::computeShapeDerivatives(const Matrix & real_coords, + UInt elem, + Tensor3 & shapesd, + const GhostType & ghost_type) const { + + AKANTU_DEBUG_IN(); + + UInt spatial_dimension = mesh.getSpatialDimension(); + UInt nb_points = real_coords.cols(); + UInt nb_nodes_per_element = ElementClass::getNbNodesPerInterpolationElement(); + + AKANTU_DEBUG_ASSERT(mesh.getSpatialDimension() == shapesd.size(0) && nb_nodes_per_element == shapesd.size(1), + "Shape size doesn't match"); + AKANTU_DEBUG_ASSERT(nb_points == shapesd.size(2), + "Number of points doesn't match shapes size"); + + Matrix natural_coords(spatial_dimension, nb_points); + + // Creates the matrix of natural coordinates + for (UInt i = 0 ; i < nb_points ; i++) { + Vector real_point = real_coords(i); + Vector natural_point = natural_coords(i); + + inverseMap(real_point, elem, natural_point, ghost_type); + } + + + UInt * elem_val = mesh.getConnectivity(type, ghost_type).storage(); + Matrix nodes_coord(spatial_dimension, nb_nodes_per_element); + + mesh.extractNodalValuesFromElement(mesh.getNodes(), + nodes_coord.storage(), + elem_val + elem*nb_nodes_per_element, + nb_nodes_per_element, + spatial_dimension); + + computeShapeDerivativesOnCPointsByElement(nodes_coord, natural_coords, shapesd); + + AKANTU_DEBUG_OUT(); } /* -------------------------------------------------------------------------- */ template ShapeLagrange::ShapeLagrange(const Mesh & mesh, const ID & id, const MemoryID & memory_id) : ShapeFunctions(mesh, id, memory_id), shapes("shapes_generic", id), shapes_derivatives("shapes_derivatives_generic", id) { AKANTU_DEBUG_IN(); AKANTU_DEBUG_OUT(); } /* -------------------------------------------------------------------------- */ template template void ShapeLagrange::precomputeShapesOnControlPoints(__attribute__((unused)) const Array & nodes, GhostType ghost_type) { AKANTU_DEBUG_IN(); InterpolationType itp_type = ElementClassProperty::interpolation_type; Matrix & natural_coords = control_points(type, ghost_type); UInt nb_points = natural_coords.cols(); UInt size_of_shapes = ElementClass::getShapeSize(); UInt nb_element = mesh.getConnectivity(type, ghost_type).getSize();; Array & shapes_tmp = shapes.alloc(nb_element*nb_points, size_of_shapes, itp_type, ghost_type); Array::matrix_iterator shapes_it = shapes_tmp.begin_reinterpret(ElementClass::getNbNodesPerInterpolationElement(), nb_points, nb_element); for (UInt elem = 0; elem < nb_element; ++elem, ++shapes_it) { Matrix & N = *shapes_it; ElementClass::computeShapes(natural_coords, N); } AKANTU_DEBUG_OUT(); } /* -------------------------------------------------------------------------- */ template template void ShapeLagrange::precomputeShapeDerivativesOnControlPoints(const Array & nodes, GhostType ghost_type) { AKANTU_DEBUG_IN(); InterpolationType itp_type = ElementClassProperty::interpolation_type; // Real * coord = mesh.getNodes().storage(); UInt spatial_dimension = mesh.getSpatialDimension(); UInt nb_nodes_per_element = ElementClass::getNbNodesPerInterpolationElement(); UInt size_of_shapesd = ElementClass::getShapeDerivativesSize(); Matrix & natural_coords = control_points(type, ghost_type); UInt nb_points = natural_coords.cols(); UInt nb_element = mesh.getConnectivity(type, ghost_type).getSize(); Array & shapes_derivatives_tmp = shapes_derivatives.alloc(nb_element*nb_points, size_of_shapesd, itp_type, ghost_type); Array x_el(0, spatial_dimension * nb_nodes_per_element); FEEngine::extractNodalToElementField(mesh, nodes, x_el, type, ghost_type); Real * shapesd_val = shapes_derivatives_tmp.storage(); Array::matrix_iterator x_it = x_el.begin(spatial_dimension, nb_nodes_per_element); for (UInt elem = 0; elem < nb_element; ++elem, ++x_it) { Matrix & X = *x_it; Tensor3 B(shapesd_val, spatial_dimension, nb_nodes_per_element, nb_points); computeShapeDerivativesOnCPointsByElement(X, natural_coords, B); shapesd_val += size_of_shapesd*nb_points; } AKANTU_DEBUG_OUT(); } /* -------------------------------------------------------------------------- */ template template void ShapeLagrange::interpolateOnControlPoints(const Array &in_u, Array &out_uq, UInt nb_degree_of_freedom, GhostType ghost_type, const Array & filter_elements) const { AKANTU_DEBUG_IN(); InterpolationType itp_type = ElementClassProperty::interpolation_type; AKANTU_DEBUG_ASSERT(shapes.exists(itp_type, ghost_type), "No shapes for the type " << shapes.printType(itp_type, ghost_type)); UInt nb_nodes_per_element = ElementClass::getNbNodesPerInterpolationElement(); Array u_el(0, nb_degree_of_freedom * nb_nodes_per_element); FEEngine::extractNodalToElementField(mesh, in_u, u_el, type, ghost_type, filter_elements); this->interpolateElementalFieldOnControlPoints(u_el, out_uq, ghost_type, shapes(itp_type, ghost_type), filter_elements); AKANTU_DEBUG_OUT(); } /* -------------------------------------------------------------------------- */ template template void ShapeLagrange::gradientOnControlPoints(const Array &in_u, Array &out_nablauq, UInt nb_degree_of_freedom, GhostType ghost_type, const Array & filter_elements) const { AKANTU_DEBUG_IN(); InterpolationType itp_type = ElementClassProperty::interpolation_type; AKANTU_DEBUG_ASSERT(shapes_derivatives.exists(itp_type, ghost_type), "No shapes derivatives for the type " << shapes_derivatives.printType(itp_type, ghost_type)); UInt nb_nodes_per_element = ElementClass::getNbNodesPerInterpolationElement(); Array u_el(0, nb_degree_of_freedom * nb_nodes_per_element); FEEngine::extractNodalToElementField(mesh, in_u, u_el, type, ghost_type, filter_elements); this->gradientElementalFieldOnControlPoints(u_el, out_nablauq, ghost_type, shapes_derivatives(itp_type, ghost_type), filter_elements); AKANTU_DEBUG_OUT(); } /* -------------------------------------------------------------------------- */ template template void ShapeLagrange::fieldTimesShapes(const Array & field, Array & field_times_shapes, GhostType ghost_type) const { + AKANTU_DEBUG_IN(); + field_times_shapes.resize(field.getSize()); UInt size_of_shapes = ElementClass::getShapeSize(); InterpolationType itp_type = ElementClassProperty::interpolation_type; UInt nb_degree_of_freedom = field.getNbComponent(); const Array & shape = shapes(itp_type, ghost_type); Array::const_matrix_iterator field_it = field.begin(nb_degree_of_freedom, 1); Array::const_matrix_iterator shapes_it = shape.begin(1, size_of_shapes); Array::matrix_iterator it = field_times_shapes.begin(nb_degree_of_freedom, size_of_shapes); Array::matrix_iterator end = field_times_shapes.end (nb_degree_of_freedom, size_of_shapes); for (; it != end; ++it, ++field_it, ++shapes_it) { it->mul(*field_it, *shapes_it); } + + AKANTU_DEBUG_OUT(); } /* -------------------------------------------------------------------------- */ template void ShapeLagrange::printself(std::ostream & stream, int indent) const { std::string space; for(Int i = 0; i < indent; i++, space += AKANTU_INDENT); stream << space << "Shapes Lagrange [" << std::endl; ShapeFunctions::printself(stream, indent + 1); shapes.printself(stream, indent + 1); shapes_derivatives.printself(stream, indent + 1); stream << space << "]" << std::endl; } diff --git a/src/io/dumper/dumper_nodal_field.hh b/src/io/dumper/dumper_nodal_field.hh index 554910d95..9304f0629 100644 --- a/src/io/dumper/dumper_nodal_field.hh +++ b/src/io/dumper/dumper_nodal_field.hh @@ -1,245 +1,241 @@ /** * @file dumper_nodal_field.hh * * @author Nicolas Richart * * @date creation: Tue Sep 02 2014 * @date last modification: Tue Sep 02 2014 * * @brief Description of nodal fields * * @section LICENSE * * Copyright (©) 2014 EPFL (Ecole Polytechnique Fédérale de Lausanne) * Laboratory (LSMS - Laboratoire de Simulation en Mécanique des Solides) * * Akantu is free software: you can redistribute it and/or modify it under the * terms of the GNU Lesser General Public License as published by the Free * Software Foundation, either version 3 of the License, or (at your option) any * later version. * * Akantu 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 Lesser General Public License for more * details. * * You should have received a copy of the GNU Lesser General Public License * along with Akantu. If not, see . * */ #ifndef __AKANTU_DUMPER_NODAL_FIELD_HH__ #define __AKANTU_DUMPER_NODAL_FIELD_HH__ - - - - #include "dumper_field.hh" #include /* -------------------------------------------------------------------------- */ __BEGIN_AKANTU__ __BEGIN_AKANTU_DUMPER__ // This represents a iohelper compatible field template,class Filter = Array > class NodalField; /* -------------------------------------------------------------------------- */ template class NodalField : public dumper::Field { public: /* ------------------------------------------------------------------------ */ /* Typedefs */ /* ------------------------------------------------------------------------ */ /// associated iterator with any nodal field (non filetered) class iterator : public iohelper::iterator< T, iterator, Vector > { public: iterator(T * vect, UInt offset, UInt n, UInt stride, __attribute__ ((unused)) const UInt * filter = NULL) : internal_it(vect), offset(offset), n(n), stride(stride) {} bool operator!=(const iterator & it) const { return internal_it != it.internal_it; } iterator & operator++() { internal_it += offset; return *this; }; Vector operator* (){ return Vector(internal_it + stride, n); }; private: T * internal_it; UInt offset, n, stride; }; /* ------------------------------------------------------------------------ */ /* Constructors/Destructors */ /* ------------------------------------------------------------------------ */ NodalField(const Container & field, UInt n = 0, UInt stride = 0, __attribute__ ((unused)) const Filter * filter = NULL) : field(field), n(n), stride(stride), padding(0) { AKANTU_DEBUG_ASSERT(filter == NULL, "Filter passed to unfiltered NodalField!"); if(n == 0) { this->n = field.getNbComponent() - stride; } } /* ------------------------------------------------------------------------ */ /* Methods */ /* ------------------------------------------------------------------------ */ virtual void registerToDumper(const std::string & id, iohelper::Dumper & dumper) { dumper.addNodeDataField(id, *this); } inline iterator begin() { return iterator(field.storage(), field.getNbComponent(), n, stride); } inline iterator end () { return iterator(field.storage() + field.getNbComponent()*field.getSize(), field.getNbComponent(), n, stride); } bool isHomogeneous() { return true; } void checkHomogeneity() { this->homogeneous = true; } virtual UInt getDim() { if(this->padding) return this->padding; else return n; } void setPadding(UInt padding){this->padding = padding;} UInt size() { return field.getSize(); } iohelper::DataType getDataType() { return iohelper::getDataType(); } /* ------------------------------------------------------------------------ */ /* Class Members */ /* ------------------------------------------------------------------------ */ private: const Container & field; UInt n, stride; UInt padding; }; /* -------------------------------------------------------------------------- */ template class NodalField : public dumper::Field { /* ------------------------------------------------------------------------ */ /* Typedefs */ /* ------------------------------------------------------------------------ */ public: class iterator : public iohelper::iterator< T, iterator, Vector > { public: iterator(T * const vect, UInt _offset, UInt _n, UInt _stride, const UInt * filter) : internal_it(vect), offset(_offset), n(_n), stride(_stride), filter(filter) {} bool operator!=(const iterator & it) const { return filter != it.filter; } iterator & operator++() { ++filter; return *this; } Vector operator* () { return Vector(internal_it + *(filter)*offset + stride, n); } private: T * const internal_it; UInt offset, n, stride; const UInt * filter; }; /* ------------------------------------------------------------------------ */ /* Constructors/Destructors */ /* ------------------------------------------------------------------------ */ NodalField(const Container & _field, UInt _n = 0, UInt _stride = 0, const Filter * filter = NULL) : field(_field), n(_n), stride(_stride), filter(filter), padding(0) { AKANTU_DEBUG_ASSERT(this->filter != NULL, "No filter passed to filtered NodalField!"); AKANTU_DEBUG_ASSERT(this->filter->getNbComponent()==1, "Multi-component filter given to NodalField (" << this->filter->getNbComponent() << " components detected, sould be 1"); if(n == 0) { this->n = field.getNbComponent() - stride; } } /* ------------------------------------------------------------------------ */ /* Methods */ /* ------------------------------------------------------------------------ */ virtual void registerToDumper(const std::string & id, iohelper::Dumper & dumper) { dumper.addNodeDataField(id, *this); } inline iterator begin() { return iterator(field.storage(), field.getNbComponent(), n, stride, filter->storage()); } inline iterator end() { return iterator(field.storage(), field.getNbComponent(), n, stride, filter->storage()+filter->getSize()); } bool isHomogeneous() { return true; } void checkHomogeneity() { this->homogeneous = true; } virtual UInt getDim() { if(this->padding) return this->padding; else return n; } void setPadding(UInt padding){this->padding = padding;} UInt size() { return filter->getSize(); } iohelper::DataType getDataType() { return iohelper::getDataType(); } /* ------------------------------------------------------------------------ */ /* Class Members */ /* ------------------------------------------------------------------------ */ private: const Container & field; UInt n, stride; const Filter * filter; UInt padding; }; __END_AKANTU_DUMPER__ __END_AKANTU__ /* -------------------------------------------------------------------------- */ #endif /* __AKANTU_DUMPER_NODAL_FIELD_HH__ */ diff --git a/src/solver/static_solver.cc b/src/solver/static_solver.cc index 51448d661..006df3123 100644 --- a/src/solver/static_solver.cc +++ b/src/solver/static_solver.cc @@ -1,111 +1,109 @@ /** * @file static_solver.cc * @author Aurelia Cuba Ramos * @date Wed Jul 30 15:35:01 2014 * * @brief implementation of the static solver * * @section LICENSE * * Copyright (©) 2010-2011 EPFL (Ecole Polytechnique Fédérale de Lausanne) * Laboratory (LSMS - Laboratoire de Simulation en Mécanique des Solides) * * Akantu is free software: you can redistribute it and/or modify it under the * terms of the GNU Lesser General Public License as published by the Free * Software Foundation, either version 3 of the License, or (at your option) any * later version. * * Akantu 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 Lesser General Public License for more * details. * * You should have received a copy of the GNU Lesser General Public License * along with Akantu. If not, see . * */ /* -------------------------------------------------------------------------- */ #include "static_solver.hh" /* -------------------------------------------------------------------------- */ #ifdef AKANTU_USE_PETSC #include #endif /* -------------------------------------------------------------------------- */ __BEGIN_AKANTU__ /* -------------------------------------------------------------------------- */ StaticSolver::StaticSolver() : CommunicatorEventHandler(), is_initialized(false) { StaticCommunicator::getStaticCommunicator().registerEventHandler(*this); } /* -------------------------------------------------------------------------- */ StaticSolver::~StaticSolver() { --this->nb_references; if(this->nb_references == 0) delete this->static_solver; } /* -------------------------------------------------------------------------- */ StaticSolver & StaticSolver::getStaticSolver() { if(nb_references == 0) static_solver = new StaticSolver(); - ++nb_references; - return *static_solver; } #ifdef AKANTU_USE_PETSC #if PETSC_VERSION_MAJOR >= 3 && PETSC_VERSION_MINOR >= 5 static PetscErrorCode PETScErrorHandler(MPI_Comm, int line, const char * dir, const char *file, PetscErrorCode number, PetscErrorType type, const char *message, void *) { AKANTU_DEBUG_ERROR("An error occured in PETSc in file \"" << file << ":" << line << "\" - PetscErrorCode "<< number << " - \""<< message << "\""); } #else static PetscErrorCode PETScErrorHandler(MPI_Comm, int line, const char * func, const char * dir, const char *file, PetscErrorCode number, PetscErrorType type, const char *message, void *) { AKANTU_DEBUG_ERROR("An error occured in PETSc in file \"" << file << ":" << line << "\" - PetscErrorCode "<< number << " - \""<< message << "\""); } #endif #endif /* -------------------------------------------------------------------------- */ void StaticSolver::initialize(int & argc, char ** & argv) { AKANTU_DEBUG_ASSERT(this->is_initialized != true, "The static solver has already been initialized"); #ifdef AKANTU_USE_PETSC PetscErrorCode petsc_error = PetscInitialize(&argc, &argv, NULL, NULL); if(petsc_error != 0) { AKANTU_DEBUG_ERROR("An error occured while initializing Petsc (PetscErrorCode "<< petsc_error << ")"); } PetscPushErrorHandler(PETScErrorHandler, NULL); #endif this->is_initialized = true; } /* -------------------------------------------------------------------------- */ void StaticSolver::finalize() { ParentEventHandler::sendEvent(StaticSolverEvent::BeforeStaticSolverDestroyEvent()); AKANTU_DEBUG_ASSERT(this->is_initialized == true, "The static solver has not been initialized"); #ifdef AKANTU_USE_PETSC PetscFinalize(); #endif this->is_initialized = false; } __END_AKANTU__ diff --git a/test/CMakeLists.txt b/test/CMakeLists.txt index 85989d289..24a6bb8ec 100644 --- a/test/CMakeLists.txt +++ b/test/CMakeLists.txt @@ -1,85 +1,87 @@ #=============================================================================== # @file CMakeLists.txt # # @author Guillaume Anciaux # @author Alejandro M. Aragón # @author Nicolas Richart # # @date creation: Fri Sep 03 2010 # @date last modification: Thu Jul 03 2014 # # @brief configuration for tests # # @section LICENSE # # Copyright (©) 2010-2012, 2014 EPFL (Ecole Polytechnique Fédérale de Lausanne) # Laboratory (LSMS - Laboratoire de Simulation en Mécanique des Solides) # # Akantu is free software: you can redistribute it and/or modify it under the # terms of the GNU Lesser General Public License as published by the Free # Software Foundation, either version 3 of the License, or (at your option) any # later version. # # Akantu 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 Lesser General Public License for more # details. # # You should have received a copy of the GNU Lesser General Public License # along with Akantu. If not, see . # # @section DESCRIPTION # #=============================================================================== include_directories( ${AKANTU_INCLUDE_DIRS} ${AKANTU_EXTERNAL_LIB_INCLUDE_DIR} ) set(AKANTU_TESTS_FILES CACHE INTERNAL "") #=============================================================================== # List of tests #=============================================================================== add_akantu_test(test_common "Test the common part of Akantu") add_akantu_test(test_static_memory "Test static memory") add_akantu_test(test_fem "Test finite element functionalties") add_akantu_test(test_mesh_utils "Test mesh utils") add_akantu_test(test_model "Test model objects") -add_akantu_test(test_solver "Test solver function" PACKAGE mumps) +add_akantu_test(test_solver "Test solver function") add_akantu_test(test_io "Test the IO modules") -add_akantu_test(test_contact "Test the contact part of Akantu" PACKAGE contact) +add_akantu_test(test_contact "Test the contact part of Akantu") add_akantu_test(test_surface_extraction "Test mesh utils surface extraction") -add_akantu_test(test_synchronizer "Test synchronizers" PACKAGE parallel) +add_akantu_test(test_synchronizer "Test synchronizers") + + file(GLOB_RECURSE __all_files "*.*") set(_all_files) foreach(_file ${__all_files}) if("${_file}" MATCHES "${PROJECT_SOURCE_DIR}/test") file(RELATIVE_PATH __file ${PROJECT_SOURCE_DIR} ${_file}) list(APPEND _all_files ${__file}) endif() endforeach() file(GLOB_RECURSE __all_files "*CMakeLists.txt") foreach(_file ${__all_files}) if("${_file}" MATCHES "${PROJECT_SOURCE_DIR}/test") file(RELATIVE_PATH __file ${PROJECT_SOURCE_DIR} ${_file}) list(APPEND _cmakes ${__file}) endif() endforeach() list(APPEND AKANTU_TESTS_FILES ${_cmakes}) foreach(_file ${_all_files}) list(FIND AKANTU_TESTS_FILES ${_file} _ret) if(_ret EQUAL -1) list(APPEND AKANTU_TESTS_EXCLUDE_FILES /${_file}) endif() endforeach() set(AKANTU_TESTS_EXCLUDE_FILES ${AKANTU_TESTS_EXCLUDE_FILES} PARENT_SCOPE) #foreach(f ${AKANTU_TESTS_EXCLUDE_FILES}) # message(${f}) #endforeach() diff --git a/test/test_common/CMakeLists.txt b/test/test_common/CMakeLists.txt index 96213e2cf..2935e8141 100644 --- a/test/test_common/CMakeLists.txt +++ b/test/test_common/CMakeLists.txt @@ -1,38 +1,40 @@ #=============================================================================== # @file CMakeLists.txt # # @author Nicolas Richart # # @date creation: Mon Jul 30 2012 # @date last modification: Fri Feb 21 2014 # # @brief configurations for common tests # # @section LICENSE # # Copyright (©) 2010-2012, 2014 EPFL (Ecole Polytechnique Fédérale de Lausanne) # Laboratory (LSMS - Laboratoire de Simulation en Mécanique des Solides) # # Akantu is free software: you can redistribute it and/or modify it under the # terms of the GNU Lesser General Public License as published by the Free # Software Foundation, either version 3 of the License, or (at your option) any # later version. # # Akantu 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 Lesser General Public License for more # details. # # You should have received a copy of the GNU Lesser General Public License # along with Akantu. If not, see . # #=============================================================================== -add_mesh(test_grid_mesh circle.geo 2 1) add_akantu_test(test_vector "Test akantu vector") -register_test(test_csr test_csr.cc) +add_mesh(test_grid_mesh circle.geo 2 1) + +register_test(test_csr test_csr.cc PACKAGE core) register_test(test_grid test_grid.cc - DEPENDENCIES test_grid_mesh) + DEPENDENCIES test_grid_mesh + PACKAGE core) -register_test(test_math test_math.cc) \ No newline at end of file +register_test(test_math test_math.cc PACKAGE core) \ No newline at end of file diff --git a/test/test_common/test_vector/CMakeLists.txt b/test/test_common/test_vector/CMakeLists.txt index 48f14d2dd..1f7ec426d 100644 --- a/test/test_common/test_vector/CMakeLists.txt +++ b/test/test_common/test_vector/CMakeLists.txt @@ -1,35 +1,35 @@ #=============================================================================== # @file CMakeLists.txt # # @author Guillaume Anciaux # # @date creation: Fri Sep 03 2010 # @date last modification: Tue Nov 06 2012 # # @brief configuration for vector tests # # @section LICENSE # # Copyright (©) 2014 EPFL (Ecole Polytechnique Fédérale de Lausanne) # Laboratory (LSMS - Laboratoire de Simulation en Mécanique des Solides) # # Akantu is free software: you can redistribute it and/or modify it under the # terms of the GNU Lesser General Public License as published by the Free # Software Foundation, either version 3 of the License, or (at your option) any # later version. # # Akantu 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 Lesser General Public License for more # details. # # You should have received a copy of the GNU Lesser General Public License # along with Akantu. If not, see . # # @section DESCRIPTION # #=============================================================================== -register_test(test_vector test_vector.cc) -register_test(test_vector_iterator test_vector_iterator.cc) -register_test(test_matrix test_matrix.cc) +register_test(test_vector test_vector.cc PACKAGE core) +register_test(test_vector_iterator test_vector_iterator.cc PACKAGE core) +register_test(test_matrix test_matrix.cc PACKAGE core) diff --git a/test/test_contact/CMakeLists.txt b/test/test_contact/CMakeLists.txt index fe66b716e..2516ffeb7 100644 --- a/test/test_contact/CMakeLists.txt +++ b/test/test_contact/CMakeLists.txt @@ -1,115 +1,124 @@ #=============================================================================== # @file CMakeLists.txt # # @author Alejandro M. Aragón # # @date creation: Tue May 13 2014 # @date last modification: Mon Sep 15 2014 # # @brief configuration file for contact tests # # @section LICENSE # # Copyright (©) 2014 EPFL (Ecole Polytechnique Fédérale de Lausanne) # Laboratory (LSMS - Laboratoire de Simulation en Mécanique des Solides) # # Akantu is free software: you can redistribute it and/or modify it under the # terms of the GNU Lesser General Public License as published by the Free # Software Foundation, either version 3 of the License, or (at your option) any # later version. # # Akantu 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 Lesser General Public License for more # details. # # You should have received a copy of the GNU Lesser General Public License # along with Akantu. If not, see . # # @section DESCRIPTION # #=============================================================================== add_mesh(hertz_2D_mesh_test hertz_2D.geo 2 1) register_test(test_hertz_2D SOURCES hertz_2D.cc DEPENDENCIES hertz_2D_mesh_test FILES_TO_COPY steel.dat -) + PACKAGE contact + ) add_mesh(hertz_3D_mesh_test hertz_3D.geo 3 1) register_test(test_hertz_3D SOURCES hertz_3D.cc FILES_TO_COPY steel.dat hertz_3D.msh -) + PACKAGE contact + ) add_mesh(offset_1slave_mesh offset_1slave.geo 2 1) register_test(test_offset_1slave SOURCES offset_1slave.cc DEPENDENCIES offset_1slave_mesh FILES_TO_COPY steel.dat -) + PACKAGE contact + ) add_mesh(offset_2slaves_mesh offset_2slaves.geo 2 1) register_test(test_offset_2slaves SOURCES offset_2slaves.cc DEPENDENCIES offset_2slaves_mesh FILES_TO_COPY steel.dat -) + PACKAGE contact + ) #=============================================================================== # Alain Curnier suggested tests add_mesh(acurnier_2D_1_mesh acurnier_2D_1.geo 2 1) register_test(test_acurnier_2D_1 SOURCES acurnier_2D_1.cc DEPENDENCIES acurnier_2D_1_mesh FILES_TO_COPY material.dat -) + PACKAGE contact + ) add_mesh(acurnier_2D_2_mesh acurnier_2D_2.geo 2 1) register_test(test_acurnier_2D_2 SOURCES acurnier_2D_2.cc DEPENDENCIES acurnier_2D_2_mesh FILES_TO_COPY material.dat -) + PACKAGE contact + ) add_mesh(acurnier_2D_3_mesh acurnier_2D_3.geo 2 1) register_test(test_acurnier_2D_3 SOURCES acurnier_2D_3.cc DEPENDENCIES acurnier_2D_3_mesh FILES_TO_COPY material.dat -) + PACKAGE contact + ) add_mesh(acurnier_3D_1_mesh acurnier_3D_1.geo 3 1) register_test(test_acurnier_3D_1 SOURCES acurnier_3D_1.cc DEPENDENCIES acurnier_3D_1_mesh FILES_TO_COPY material.dat -) + PACKAGE contact + ) add_mesh(acurnier_3D_2_mesh acurnier_3D_2.geo 3 1) register_test(test_acurnier_3D_2 SOURCES acurnier_3D_2.cc DEPENDENCIES acurnier_3D_2_mesh FILES_TO_COPY material.dat -) + PACKAGE contact + ) add_mesh(acurnier_3D_3_mesh acurnier_3D_3.geo 3 1) register_test(test_acurnier_3D_3 SOURCES acurnier_3D_3.cc DEPENDENCIES acurnier_3D_3_mesh FILES_TO_COPY material.dat -) - + PACKAGE contact + ) diff --git a/test/test_io/test_dumper/CMakeLists.txt b/test/test_io/test_dumper/CMakeLists.txt index 382ac234f..954f17636 100644 --- a/test/test_io/test_dumper/CMakeLists.txt +++ b/test/test_io/test_dumper/CMakeLists.txt @@ -1,37 +1,38 @@ #=============================================================================== # @file CMakeLists.txt # # @author David Simon Kammer # # @date creation: Tue Sep 02 2014 # @date last modification: Tue Sep 02 2014 # # @brief configuration for tests # # @section LICENSE # # Copyright (©) 2014 EPFL (Ecole Polytechnique Fédérale de Lausanne) # Laboratory (LSMS - Laboratoire de Simulation en Mécanique des Solides) # # Akantu is free software: you can redistribute it and/or modify it under the # terms of the GNU Lesser General Public License as published by the Free # Software Foundation, either version 3 of the License, or (at your option) any # later version. # # Akantu 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 Lesser General Public License for more # details. # # You should have received a copy of the GNU Lesser General Public License # along with Akantu. If not, see . # # @section DESCRIPTION # #=============================================================================== register_test(test_dumper SOURCES test_dumper.cc FILES_TO_COPY input_file.dat test_dumper.msh DIRECTORIES_TO_CREATE paraview + PACKAGE iohelper ) diff --git a/test/test_io/test_parser/CMakeLists.txt b/test/test_io/test_parser/CMakeLists.txt index 8664d094f..06285dee7 100644 --- a/test/test_io/test_parser/CMakeLists.txt +++ b/test/test_io/test_parser/CMakeLists.txt @@ -1,36 +1,37 @@ #=============================================================================== # @file CMakeLists.txt # # @author Nicolas Richart # # @date creation: Wed Nov 13 2013 # @date last modification: Wed Nov 13 2013 # # @brief configuration for tests # # @section LICENSE # # Copyright (©) 2014 EPFL (Ecole Polytechnique Fédérale de Lausanne) # Laboratory (LSMS - Laboratoire de Simulation en Mécanique des Solides) # # Akantu is free software: you can redistribute it and/or modify it under the # terms of the GNU Lesser General Public License as published by the Free # Software Foundation, either version 3 of the License, or (at your option) any # later version. # # Akantu 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 Lesser General Public License for more # details. # # You should have received a copy of the GNU Lesser General Public License # along with Akantu. If not, see . # # @section DESCRIPTION # #=============================================================================== register_test(test_parser SOURCES test_parser.cc FILES_TO_COPY input_file.dat + PACKAGE core ) diff --git a/test/test_mesh_utils/CMakeLists.txt b/test/test_mesh_utils/CMakeLists.txt index 5302ae910..398a8eb47 100644 --- a/test/test_mesh_utils/CMakeLists.txt +++ b/test/test_mesh_utils/CMakeLists.txt @@ -1,47 +1,48 @@ #=============================================================================== # @file CMakeLists.txt # # @author Nicolas Richart # # @date creation: Mon Feb 07 2011 # @date last modification: Tue Nov 06 2012 # # @brief configuration for MeshUtils tests # # @section LICENSE # # Copyright (©) 2010-2012, 2014 EPFL (Ecole Polytechnique Fédérale de Lausanne) # Laboratory (LSMS - Laboratoire de Simulation en Mécanique des Solides) # # Akantu is free software: you can redistribute it and/or modify it under the # terms of the GNU Lesser General Public License as published by the Free # Software Foundation, either version 3 of the License, or (at your option) any # later version. # # Akantu 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 Lesser General Public License for more # details. # # You should have received a copy of the GNU Lesser General Public License # along with Akantu. If not, see . # # @section DESCRIPTION # #=============================================================================== #=============================================================================== # List of tests #=============================================================================== add_akantu_test(test_mesh_io "Test mesh io object") add_akantu_test(test_facet_extraction "Test mesh utils facet extraction") add_akantu_test(test_pbc_tweak "Test pbc facilities") register_test(test_purify_mesh SOURCES test_purify_mesh.cc - FILES_TO_COPY purify_mesh.msh DESTINATION + FILES_TO_COPY purify_mesh.msh + PACKAGE core ) -add_akantu_test(test_mesh_partitionate "Test mesh partition creation" PACKAGE scotch) +add_akantu_test(test_mesh_partitionate "Test mesh partition creation") diff --git a/test/test_mesh_utils/test_facet_extraction/CMakeLists.txt b/test/test_mesh_utils/test_facet_extraction/CMakeLists.txt index c6a2268e3..2f04bc5b9 100644 --- a/test/test_mesh_utils/test_facet_extraction/CMakeLists.txt +++ b/test/test_mesh_utils/test_facet_extraction/CMakeLists.txt @@ -1,49 +1,51 @@ #=============================================================================== # @file CMakeLists.txt # # @author Guillaume Anciaux # # @date creation: Fri Sep 03 2010 # @date last modification: Tue Nov 06 2012 # # @brief configuration for facet extraction tests # # @section LICENSE # # Copyright (©) 2010-2012, 2014 EPFL (Ecole Polytechnique Fédérale de Lausanne) # Laboratory (LSMS - Laboratoire de Simulation en Mécanique des Solides) # # Akantu is free software: you can redistribute it and/or modify it under the # terms of the GNU Lesser General Public License as published by the Free # Software Foundation, either version 3 of the License, or (at your option) any # later version. # # Akantu 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 Lesser General Public License for more # details. # # You should have received a copy of the GNU Lesser General Public License # along with Akantu. If not, see . # # @section DESCRIPTION # #=============================================================================== #=============================================================================== add_mesh(test_facet_square_mesh square.geo 2 2) register_test(test_facet_extraction_triangle_3 SOURCES test_facet_extraction_triangle_3.cc DEPENDENCIES test_facet_square_mesh DIRECTORIES_TO_CREATE paraview + PACKAGE core ) #=============================================================================== add_mesh(test_facet_cube_mesh cube.geo 3 1) register_test(test_facet_extraction_tetrahedron_4 SOURCES test_facet_extraction_tetrahedron_4.cc DEPENDENCIES test_facet_cube_mesh DIRECTORIES_TO_CREATE paraview + PACKAGE core ) diff --git a/test/test_mesh_utils/test_mesh_io/CMakeLists.txt b/test/test_mesh_utils/test_mesh_io/CMakeLists.txt index c46da6a3e..45b60ff1b 100644 --- a/test/test_mesh_utils/test_mesh_io/CMakeLists.txt +++ b/test/test_mesh_utils/test_mesh_io/CMakeLists.txt @@ -1,52 +1,54 @@ #=============================================================================== # @file CMakeLists.txt # # @author Guillaume Anciaux # @author Nicolas Richart # # @date creation: Fri Sep 03 2010 # @date last modification: Fri May 03 2013 # # @brief configuration for MeshIO tests # # @section LICENSE # # Copyright (©) 2014 EPFL (Ecole Polytechnique Fédérale de Lausanne) # Laboratory (LSMS - Laboratoire de Simulation en Mécanique des Solides) # # Akantu is free software: you can redistribute it and/or modify it under the # terms of the GNU Lesser General Public License as published by the Free # Software Foundation, either version 3 of the License, or (at your option) any # later version. # # Akantu 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 Lesser General Public License for more # details. # # You should have received a copy of the GNU Lesser General Public License # along with Akantu. If not, see . # # @section DESCRIPTION # #=============================================================================== add_mesh(test_msh_cube cube.geo 3 1) add_mesh(test_msh_cube_physical_names cube_physical_names.geo 3 1) register_test(test_mesh_io_msh SOURCES test_mesh_io_msh.cc DEPENDENCIES test_msh_cube DIRECTORIES_TO_CREATE paraview + PACKAGE core ) - + register_test(test_mesh_io_msh_physical_names SOURCES test_mesh_io_msh_physical_names.cc DEPENDENCIES test_msh_cube_physical_names -) + PACKAGE core + ) #=============================================================================== #register_test(test_mesh_io_diana test_mesh_io_diana.cc) #copy_files(test_mesh_io_diana dam.dat) #file(MAKE_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/paraview/mesh_io_diana) diff --git a/test/test_mesh_utils/test_mesh_partitionate/CMakeLists.txt b/test/test_mesh_utils/test_mesh_partitionate/CMakeLists.txt index adf742384..1e3e024ee 100644 --- a/test/test_mesh_utils/test_mesh_partitionate/CMakeLists.txt +++ b/test/test_mesh_utils/test_mesh_partitionate/CMakeLists.txt @@ -1,50 +1,52 @@ #=============================================================================== # @file CMakeLists.txt # # @author Guillaume Anciaux # # @date creation: Fri Sep 03 2010 # @date last modification: Wed May 08 2013 # # @brief configuration for mesh partitioner tests # # @section LICENSE # # Copyright (©) 2010-2012, 2014 EPFL (Ecole Polytechnique Fédérale de Lausanne) # Laboratory (LSMS - Laboratoire de Simulation en Mécanique des Solides) # # Akantu is free software: you can redistribute it and/or modify it under the # terms of the GNU Lesser General Public License as published by the Free # Software Foundation, either version 3 of the License, or (at your option) any # later version. # # Akantu 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 Lesser General Public License for more # details. # # You should have received a copy of the GNU Lesser General Public License # along with Akantu. If not, see . # # @section DESCRIPTION # #=============================================================================== add_mesh(test_mesh_partitionate_mesh triangle.geo 2 2) add_mesh(test_mesh_partitionate_mesh_data_mesh quad.geo 2 1) register_test(test_mesh_partitionate_scotch SOURCES test_mesh_partitionate_scotch.cc DEPENDENCIES test_mesh_partitionate_mesh DIRECTORIES_TO_CREATE paraview + PACKAGE scotch ) - register_test(test_mesh_partitionate_mesh_data SOURCES test_mesh_partitionate_mesh_data.cc DEPENDENCIES test_mesh_partitionate_mesh_data_mesh - DIRECTORIES_TO_CREATE paraview) + DIRECTORIES_TO_CREATE paraview + PACKAGE scotch + ) diff --git a/test/test_mesh_utils/test_pbc_tweak/CMakeLists.txt b/test/test_mesh_utils/test_pbc_tweak/CMakeLists.txt index adccbee1b..2ffeed57d 100644 --- a/test/test_mesh_utils/test_pbc_tweak/CMakeLists.txt +++ b/test/test_mesh_utils/test_pbc_tweak/CMakeLists.txt @@ -1,41 +1,42 @@ #=============================================================================== # @file CMakeLists.txt # # @author Guillaume Anciaux # # @date creation: Wed Feb 09 2011 # @date last modification: Tue Nov 06 2012 # # @brief configuration for pcb tweal test # # @section LICENSE # # Copyright (©) 2010-2012, 2014 EPFL (Ecole Polytechnique Fédérale de Lausanne) # Laboratory (LSMS - Laboratoire de Simulation en Mécanique des Solides) # # Akantu is free software: you can redistribute it and/or modify it under the # terms of the GNU Lesser General Public License as published by the Free # Software Foundation, either version 3 of the License, or (at your option) any # later version. # # Akantu 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 Lesser General Public License for more # details. # # You should have received a copy of the GNU Lesser General Public License # along with Akantu. If not, see . # # @section DESCRIPTION # #=============================================================================== #=============================================================================== add_mesh(test_pbc_cube_mesh cube.geo 3 1) register_test(test_pbc_tweak SOURCES test_pbc_tweak.cc DEPENDENCIES test_pbc_cube_mesh FILES_TO_COPY material.dat DIRECTORIES_TO_CREATE paraview + PACKAGE core ) diff --git a/test/test_model/CMakeLists.txt b/test/test_model/CMakeLists.txt index cf67ddfc0..b9b96137c 100644 --- a/test/test_model/CMakeLists.txt +++ b/test/test_model/CMakeLists.txt @@ -1,37 +1,37 @@ #=============================================================================== # @file CMakeLists.txt # # @author Guillaume Anciaux # # @date creation: Fri Nov 26 2010 # @date last modification: Thu Jul 03 2014 # # @brief configuration for model tests # # @section LICENSE # # Copyright (©) 2010-2012, 2014 EPFL (Ecole Polytechnique Fédérale de Lausanne) # Laboratory (LSMS - Laboratoire de Simulation en Mécanique des Solides) # # Akantu is free software: you can redistribute it and/or modify it under the # terms of the GNU Lesser General Public License as published by the Free # Software Foundation, either version 3 of the License, or (at your option) any # later version. # # Akantu 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 Lesser General Public License for more # details. # # You should have received a copy of the GNU Lesser General Public License # along with Akantu. If not, see . # # @section DESCRIPTION # #=============================================================================== #=============================================================================== -add_akantu_test(test_solid_mechanics_model "Test for the solid mechanics model" PACKAGE core) -add_akantu_test(test_heat_transfer_model "Test for the heat transfer model" PACKAGE heat_transfer) -add_akantu_test(test_structural_mechanics_model "Test for the structural mechanics model" PACKAGE structural_mechanics) \ No newline at end of file +add_akantu_test(test_solid_mechanics_model "Test for the solid mechanics model") +add_akantu_test(test_heat_transfer_model "Test for the heat transfer model") +add_akantu_test(test_structural_mechanics_model "Test for the structural mechanics model") \ No newline at end of file diff --git a/test/test_model/test_heat_transfer_model/CMakeLists.txt b/test/test_model/test_heat_transfer_model/CMakeLists.txt index 3a546e227..06c615202 100644 --- a/test/test_model/test_heat_transfer_model/CMakeLists.txt +++ b/test/test_model/test_heat_transfer_model/CMakeLists.txt @@ -1,75 +1,80 @@ #=============================================================================== # @file CMakeLists.txt # # @author Guillaume Anciaux # # @date creation: Sun May 01 2011 # @date last modification: Tue Nov 06 2012 # # @brief configuration for heat transfer model tests # # @section LICENSE # # Copyright (©) 2014 EPFL (Ecole Polytechnique Fédérale de Lausanne) # Laboratory (LSMS - Laboratoire de Simulation en Mécanique des Solides) # # Akantu is free software: you can redistribute it and/or modify it under the # terms of the GNU Lesser General Public License as published by the Free # Software Foundation, either version 3 of the License, or (at your option) any # later version. # # Akantu 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 Lesser General Public License for more # details. # # You should have received a copy of the GNU Lesser General Public License # along with Akantu. If not, see . # # @section DESCRIPTION # #=============================================================================== #=============================================================================== add_mesh(test_heat_cube3d_mesh1 cube.geo 3 1 OUTPUT cube1.msh) add_mesh(test_heat_square_mesh1 square.geo 2 1 OUTPUT square1.msh) add_mesh(test_heat_line_mesh line.geo 1 1 OUTPUT line.msh) register_test(test_heat_transfer_model_cube3d SOURCES test_heat_transfer_model_cube3d.cc DEPENDENCIES test_heat_cube3d_mesh1 test_heat_square_mesh1 test_heat_line_mesh FILES_TO_COPY material.dat DIRECTORIES_TO_CREATE paraview + PACKAGE heat_transfer ) add_mesh(test_heat_cube_tet4 cube_tet.geo 3 1 OUTPUT cube_tet4.msh) register_test(test_heat_transfer_model_cube3d_pbc SOURCES test_heat_transfer_model_cube3d_pbc.cc DEPENDENCIES test_heat_cube_tet4 FILES_TO_COPY material.dat DIRECTORIES_TO_CREATE paraview + PACKAGE heat_transfer ) add_mesh(test_heat_square_tri3 square_tri.geo 2 1 OUTPUT square_tri3.msh) register_test(test_heat_transfer_model_square2d_pbc SOURCES test_heat_transfer_model_square2d_pbc.cc DEPENDENCIES test_heat_square_tri3 FILES_TO_COPY material.dat DIRECTORIES_TO_CREATE paraview + PACKAGE heat_transfer ) register_test(test_heat_transfer_model_square2d SOURCES test_heat_transfer_model_square2d.cc DEPENDENCIES test_heat_square_tri3 FILES_TO_COPY material.dat DIRECTORIES_TO_CREATE paraview + PACKAGE heat_transfer ) register_test(test_heat_transfer_model_cube3d_istropic_conductivity SOURCES test_heat_transfer_model_cube3d_istropic_conductivity.cc DEPENDENCIES test_heat_cube3d_mesh1 FILES_TO_COPY material.dat DIRECTORIES_TO_CREATE paraview + PACKAGE heat_transfer ) diff --git a/test/test_model/test_solid_mechanics_model/CMakeLists.txt b/test/test_model/test_solid_mechanics_model/CMakeLists.txt index 0d6bdd76e..8a3aca11e 100644 --- a/test/test_model/test_solid_mechanics_model/CMakeLists.txt +++ b/test/test_model/test_solid_mechanics_model/CMakeLists.txt @@ -1,197 +1,214 @@ #=============================================================================== # @file CMakeLists.txt # # @author Guillaume Anciaux # # @date creation: Fri Sep 03 2010 # @date last modification: Thu Mar 27 2014 # # @brief configuratio for SolidMechanicsModel tests # # @section LICENSE # # Copyright (©) 2010-2012, 2014 EPFL (Ecole Polytechnique Fédérale de Lausanne) # Laboratory (LSMS - Laboratoire de Simulation en Mécanique des Solides) # # Akantu is free software: you can redistribute it and/or modify it under the # terms of the GNU Lesser General Public License as published by the Free # Software Foundation, either version 3 of the License, or (at your option) any # later version. # # Akantu 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 Lesser General Public License for more # details. # # You should have received a copy of the GNU Lesser General Public License # along with Akantu. If not, see . # # @section DESCRIPTION # #=============================================================================== add_akantu_test(test_materials "test_materials") add_akantu_test(patch_tests "patch_tests") -add_akantu_test(test_cohesive "cohesive_test" PACKAGE cohesive_element) -add_akantu_test(test_contact "test_contact" PACKAGE dead_contact) +add_akantu_test(test_cohesive "cohesive_test") #=============================================================================== add_mesh(test_solid_mechanics_model_square_mesh square.geo 2 1) add_mesh(test_solid_mechanics_model_circle_mesh1 circle.geo 2 1 OUTPUT circle1.msh) add_mesh(test_solid_mechanics_model_circle_mesh2 circle.geo 2 2 OUTPUT circle2.msh) register_test(test_solid_mechanics_model_square SOURCES test_solid_mechanics_model_square.cc DEPENDENCIES test_solid_mechanics_model_square_mesh FILES_TO_COPY material.dat test_cst_energy.pl DIRECTORIES_TO_CREATE paraview + PACKAGE core ) register_test(test_solid_mechanics_model_circle_2 SOURCES test_solid_mechanics_model_circle_2.cc DEPENDENCIES test_solid_mechanics_model_circle_mesh2 FILES_TO_COPY material.dat DIRECTORIES_TO_CREATE paraview + PACKAGE core ) #=============================================================================== add_mesh(test_bar_traction_2d_mesh1 bar.geo 2 1 OUTPUT bar1.msh) add_mesh(test_bar_traction_2d_mesh2 bar.geo 2 2 OUTPUT bar2.msh) add_mesh(test_bar_traction_2d_mesh_structured1 bar_structured.geo 2 1 OUTPUT bar_structured1.msh) register_test(test_solid_mechanics_model_bar_traction2d SOURCES test_solid_mechanics_model_bar_traction2d.cc DEPENDENCIES test_bar_traction_2d_mesh1 test_bar_traction_2d_mesh2 FILES_TO_COPY material.dat test_cst_energy.pl DIRECTORIES_TO_CREATE paraview + PACKAGE core ) register_test(test_solid_mechanics_model_bar_traction2d_structured SOURCES test_solid_mechanics_model_bar_traction2d_structured.cc DEPENDENCIES test_bar_traction_2d_mesh_structured1 FILES_TO_COPY material.dat test_cst_energy.pl DIRECTORIES_TO_CREATE paraview + PACKAGE core ) #=============================================================================== add_mesh(test_solid_mechanics_model_segment_mesh segment.geo 1 2) register_test(test_solid_mechanics_model_bar_traction2d_parallel SOURCES test_solid_mechanics_model_bar_traction2d_parallel.cc DEPENDENCIES test_bar_traction_2d_mesh2 FILES_TO_COPY material.dat test_cst_energy.pl DIRECTORIES_TO_CREATE paraview + PACKAGE parallel ) register_test(test_solid_mechanics_model_segment_parallel SOURCES test_solid_mechanics_model_segment_parallel.cc DEPENDENCIES test_solid_mechanics_model_segment_mesh FILES_TO_COPY material.dat test_cst_energy.pl DIRECTORIES_TO_CREATE paraview + PACKAGE parallel ) #=============================================================================== #register_test(test_solid_mechanics_model_bar_traction2d_mass_not_lumped # SOURCES test_solid_mechanics_model_bar_traction2d_mass_not_lumped.cc # DEPENDENCIES test_bar_traction_2d_mesh1 test_bar_traction_2d_mesh2 # FILES_TO_COPY material.dat # DIRECTORIES_TO_CREATE paraview +# PACKAGE implicit # ) #=============================================================================== add_mesh(test_solid_mechanics_model_segment_mesh1 segment.geo 1 1 OUTPUT segment1.msh) add_mesh(test_implicit_mesh1 square_implicit.geo 2 1 OUTPUT square_implicit1.msh) add_mesh(test_implicit_mesh2 square_implicit.geo 2 2 OUTPUT square_implicit2.msh) register_test(test_solid_mechanics_model_implicit_1d SOURCES test_solid_mechanics_model_implicit_1d.cc DEPENDENCIES test_solid_mechanics_model_segment_mesh1 FILES_TO_COPY material.dat DIRECTORIES_TO_CREATE paraview + PACKAGE implicit ) register_test(test_solid_mechanics_model_implicit_2d SOURCES test_solid_mechanics_model_implicit_2d.cc DEPENDENCIES test_implicit_mesh1 test_implicit_mesh2 FILES_TO_COPY material.dat DIRECTORIES_TO_CREATE paraview + PACKAGE implicit ) #=============================================================================== add_mesh(test_implicit_beam_2d_1 beam_2d.geo 2 1 OUTPUT beam_2d_lin.msh) add_mesh(test_implicit_beam_2d_2 beam_2d.geo 2 2 OUTPUT beam_2d_quad.msh) add_mesh(test_implicit_beam_3d_2 beam_3d.geo 3 2 OUTPUT beam_3d_quad.msh) add_mesh(test_implicit_beam_3d_1 beam_3d.geo 3 1 OUTPUT beam_3d_lin.msh) register_test(test_solid_mechanics_model_implicit_dynamic_2d SOURCES test_solid_mechanics_model_implicit_dynamic_2d.cc DEPENDENCIES test_implicit_beam_2d_1 test_implicit_beam_2d_2 test_implicit_beam_3d_2 test_implicit_beam_3d_1 FILES_TO_COPY material_implicit_dynamic.dat DIRECTORIES_TO_CREATE paraview + PACKAGE implicit ) #=============================================================================== add_mesh(test_pbc_parallel_mesh square_structured.geo 2 1 OUTPUT square_structured.msh) register_test(test_solid_mechanics_model_bar_traction2d_structured_pbc SOURCES test_solid_mechanics_model_bar_traction2d_structured_pbc.cc DEPENDENCIES test_bar_traction_2d_mesh_structured1 FILES_TO_COPY material.dat test_cst_energy.pl DIRECTORIES_TO_CREATE paraview + PACKAGE core ) #register_test(test_solid_mechanics_model_pbc_parallel # SOURCES test_solid_mechanics_model_pbc_parallel.cc # DEPENDENCIES test_pbc_parallel_mesh # FILES_TO_COPY material.dat # DIRECTORIES_TO_CREATE paraview +# PACKAGE parallel # ) #=============================================================================== add_mesh(test_cube3d_mesh1 cube.geo 3 1 OUTPUT cube1.msh) add_mesh(test_cube3d_mesh2 cube.geo 3 2 OUTPUT cube2.msh) add_mesh(test_cube3d_mesh_structured cube_structured.geo 3 1 OUTPUT cube_structured.msh) register_test(test_solid_mechanics_model_cube3d SOURCES test_solid_mechanics_model_cube3d.cc DEPENDENCIES test_cube3d_mesh1 FILES_TO_COPY material.dat DIRECTORIES_TO_CREATE paraview + PACKAGE core ) register_test(test_solid_mechanics_model_cube3d_tetra10 SOURCES test_solid_mechanics_model_cube3d_tetra10.cc DEPENDENCIES test_cube3d_mesh2 FILES_TO_COPY material.dat DIRECTORIES_TO_CREATE paraview + PACKAGE core ) register_test(test_solid_mechanics_model_cube3d_pbc SOURCES test_solid_mechanics_model_cube3d_pbc.cc DEPENDENCIES test_cube3d_mesh_structured FILES_TO_COPY material.dat DIRECTORIES_TO_CREATE paraview + PACKAGE core ) #add_mesh(test_solid_mechanics_model_boundary_condition_mesh cube_physical_names.geo 3 1) register_test(test_solid_mechanics_model_boundary_condition SOURCES test_solid_mechanics_model_boundary_condition.cc FILES_TO_COPY material.dat cube_physical_names.msh + PACKAGE core ) #=============================================================================== add_mesh(test_cube3d_two_mat_mesh cube_two_materials.geo 3 1) register_test(test_solid_mechanics_model_reassign_material SOURCES test_solid_mechanics_model_reassign_material.cc DEPENDENCIES test_cube3d_two_mat_mesh FILES_TO_COPY two_materials.dat + PACKAGE scotch ) #=============================================================================== register_test(test_solid_mechanics_model_material_eigenstrain SOURCES test_solid_mechanics_model_material_eigenstrain.cc FILES_TO_COPY cube_3d_tet_4.msh; material_elastic_plane_strain.dat + PACKAGE core ) diff --git a/test/test_model/test_solid_mechanics_model/patch_tests/CMakeLists.txt b/test/test_model/test_solid_mechanics_model/patch_tests/CMakeLists.txt index 9124c9f9b..6cf777925 100644 --- a/test/test_model/test_solid_mechanics_model/patch_tests/CMakeLists.txt +++ b/test/test_model/test_solid_mechanics_model/patch_tests/CMakeLists.txt @@ -1,64 +1,65 @@ #=============================================================================== # @file CMakeLists.txt # # @author David Simon Kammer # @author Nicolas Richart # # @date creation: Wed Apr 20 2011 # @date last modification: Thu Mar 27 2014 # # @brief configuration for patch tests # # @section LICENSE # # Copyright (©) 2010-2012, 2014 EPFL (Ecole Polytechnique Fédérale de Lausanne) # Laboratory (LSMS - Laboratoire de Simulation en Mécanique des Solides) # # Akantu is free software: you can redistribute it and/or modify it under the # terms of the GNU Lesser General Public License as published by the Free # Software Foundation, either version 3 of the License, or (at your option) any # later version. # # Akantu 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 Lesser General Public License for more # details. # # You should have received a copy of the GNU Lesser General Public License # along with Akantu. If not, see . # # @section DESCRIPTION # #=============================================================================== add_mesh(test_weight_hexa_mesh colone_hexa.geo 3 1) add_mesh(test_weight_tetra_mesh colone_tetra.geo 3 1) register_test(test_weight SOURCES colone_weight.cc DEPENDENCIES test_weight_hexa_mesh test_weight_tetra_mesh FILES_TO_COPY material_colone.dat DIRECTORIES_TO_CREATE paraview/test_weight_hexa paraview/test_weight_tetra + PACKAGE core ) #=============================================================================== set(LIST_TYPES segment_2 segment_3 tetrahedron_4 tetrahedron_10 hexahedron_8 # pentahedron_6 ) set(LIST_TYPES_2D triangle_3 triangle_6 quadrangle_4 quadrangle_8 ) -add_akantu_test(explicit "Explicit patch tests" PACKAGE core) -add_akantu_test(implicit "Implicit patch tests" PACKAGE implicit) +add_akantu_test(explicit "Explicit patch tests") +add_akantu_test(implicit "Implicit patch tests") -add_akantu_test(lumped_mass "Test the mass lumping" PACKAGE core) \ No newline at end of file +add_akantu_test(lumped_mass "Test the mass lumping") \ No newline at end of file diff --git a/test/test_model/test_solid_mechanics_model/patch_tests/explicit/CMakeLists.txt b/test/test_model/test_solid_mechanics_model/patch_tests/explicit/CMakeLists.txt index 9e8649a12..a110d27dc 100644 --- a/test/test_model/test_solid_mechanics_model/patch_tests/explicit/CMakeLists.txt +++ b/test/test_model/test_solid_mechanics_model/patch_tests/explicit/CMakeLists.txt @@ -1,67 +1,67 @@ #=============================================================================== # @file CMakeLists.txt # # @author David Simon Kammer # @author Nicolas Richart # # @date Thu Feb 17 16:05:48 2011 # # @brief configuration for the explicit patch test # # @section LICENSE # # Copyright (©) 2010-2011 EPFL (Ecole Polytechnique Fédérale de Lausanne) # Laboratory (LSMS - Laboratoire de Simulation en Mécanique des Solides) # # Akantu is free software: you can redistribute it and/or modify it under the # terms of the GNU Lesser General Public License as published by the Free # Software Foundation, either version 3 of the License, or (at your option) any # later version. # # Akantu 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 Lesser General Public License for more # details. # # You should have received a copy of the GNU Lesser General Public License # along with Akantu. If not, see . # # @section DESCRIPTION # #=============================================================================== macro(register_patch_test_anisotropic name ) set(_mat ../data/material_anisotropic.dat) register_test(patch_test_explicit_anisotropic SOURCES patch_test_explicit_anisotropic.cc FILES_TO_COPY ../data/_tetrahedron_4.msh ${_mat} - PACKAGE extra_materials + PACKAGE core ) endmacro() register_patch_test_anisotropic("Anisotropic") macro(register_patch_test name type plane_strain) if("${plane_strain}" STREQUAL "false") set(_mat ../data/material_check_stress_plane_stress.dat) else() set(_mat ../data/material_check_stress_plane_strain.dat) endif() register_test(patch_test_explicit_${name} SOURCES patch_test_explicit.cc FILES_TO_COPY ../data/_${type}.msh ${_mat} COMPILE_OPTIONS "TYPE=_${type};PLANE_STRAIN=${plane_strain}" PACKAGE core ) endmacro() foreach(_type ${LIST_TYPES}) register_patch_test(${_type} ${_type} true) endforeach() foreach(_type ${LIST_TYPES_2D}) register_patch_test(plane_strain_${_type} ${_type} true) register_patch_test(plane_stress_${_type} ${_type} false) endforeach() diff --git a/test/test_model/test_solid_mechanics_model/test_cohesive/CMakeLists.txt b/test/test_model/test_solid_mechanics_model/test_cohesive/CMakeLists.txt index 40b7da17b..7fbfafd1f 100644 --- a/test/test_model/test_solid_mechanics_model/test_cohesive/CMakeLists.txt +++ b/test/test_model/test_solid_mechanics_model/test_cohesive/CMakeLists.txt @@ -1,39 +1,39 @@ #=============================================================================== # @file CMakeLists.txt # # @author Marco Vocialta # # @date creation: Tue May 08 2012 # @date last modification: Fri Jun 21 2013 # # @brief configuration for cohesive elements tests # # @section LICENSE # # Copyright (©) 2014 EPFL (Ecole Polytechnique Fédérale de Lausanne) # Laboratory (LSMS - Laboratoire de Simulation en Mécanique des Solides) # # Akantu is free software: you can redistribute it and/or modify it under the # terms of the GNU Lesser General Public License as published by the Free # Software Foundation, either version 3 of the License, or (at your option) any # later version. # # Akantu 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 Lesser General Public License for more # details. # # You should have received a copy of the GNU Lesser General Public License # along with Akantu. If not, see . # # @section DESCRIPTION # #=============================================================================== -add_akantu_test(test_cohesive_buildfacets "test_cohesive_buildfacets" PACKAGE cohesive_element) -add_akantu_test(test_cohesive_intrinsic "test_cohesive_intrinsic" PACKAGE cohesive_element) -add_akantu_test(test_cohesive_extrinsic "test_cohesive_extrinsic" PACKAGE cohesive_element) -add_akantu_test(test_cohesive_buildfragments "test_cohesive_buildfragments" PACKAGE cohesive_element) -add_akantu_test(test_cohesive_intrinsic_impl "test_cohesive_intrinsic_impl" PACKAGE cohesive_element) -add_akantu_test(test_cohesive_1d_element "test_cohesive_1d_element" PACKAGE cohesive_element) +add_akantu_test(test_cohesive_buildfacets "test_cohesive_buildfacets") +add_akantu_test(test_cohesive_intrinsic "test_cohesive_intrinsic") +add_akantu_test(test_cohesive_extrinsic "test_cohesive_extrinsic") +add_akantu_test(test_cohesive_buildfragments "test_cohesive_buildfragments") +add_akantu_test(test_cohesive_intrinsic_impl "test_cohesive_intrinsic_impl") +add_akantu_test(test_cohesive_1d_element "test_cohesive_1d_element") #=============================================================================== diff --git a/test/test_model/test_solid_mechanics_model/test_cohesive/test_cohesive_1d_element/CMakeLists.txt b/test/test_model/test_solid_mechanics_model/test_cohesive/test_cohesive_1d_element/CMakeLists.txt index ae30b356d..38ee22977 100644 --- a/test/test_model/test_solid_mechanics_model/test_cohesive/test_cohesive_1d_element/CMakeLists.txt +++ b/test/test_model/test_solid_mechanics_model/test_cohesive/test_cohesive_1d_element/CMakeLists.txt @@ -1,42 +1,42 @@ #=============================================================================== # @file CMakeLists.txt # # @author Marco Vocialta # # @date creation: Fri Jun 14 2013 # @date last modification: Fri Jun 14 2013 # # @brief configuration for parallel test for extrinsic cohesive elements # # @section LICENSE # # Copyright (©) 2014 EPFL (Ecole Polytechnique Fédérale de Lausanne) # Laboratory (LSMS - Laboratoire de Simulation en Mécanique des Solides) # # Akantu is free software: you can redistribute it and/or modify it under the # terms of the GNU Lesser General Public License as published by the Free # Software Foundation, either version 3 of the License, or (at your option) any # later version. # # Akantu 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 Lesser General Public License for more # details. # # You should have received a copy of the GNU Lesser General Public License # along with Akantu. If not, see . # # @section DESCRIPTION # #=============================================================================== -add_mesh(test_cohesive_1d_element_mesh bar.geo 1 2) - if(AKANTU_PARALLEL) + add_mesh(test_cohesive_1d_element_mesh bar.geo 1 2) + register_test(test_cohesive_1d_element SOURCES test_cohesive_1d_element.cc DEPENDENCIES test_cohesive_1d_element_mesh - PACKAGE cohesive_element FILES_TO_COPY material.dat - DIRECTORIES_TO_CREATE paraview) + DIRECTORIES_TO_CREATE paraview + PACKAGE cohesive_element) endif() diff --git a/test/test_model/test_solid_mechanics_model/test_cohesive/test_cohesive_buildfacets/CMakeLists.txt b/test/test_model/test_solid_mechanics_model/test_cohesive/test_cohesive_buildfacets/CMakeLists.txt index 4f650f31d..9ccc985cc 100644 --- a/test/test_model/test_solid_mechanics_model/test_cohesive/test_cohesive_buildfacets/CMakeLists.txt +++ b/test/test_model/test_solid_mechanics_model/test_cohesive/test_cohesive_buildfacets/CMakeLists.txt @@ -1,41 +1,45 @@ #=============================================================================== # @file CMakeLists.txt # # @author Marco Vocialta # # @date Tue May 08 13:01:18 2012 # # @brief configuration for build facets test # # @section LICENSE # # Copyright (©) 2010-2011 EPFL (Ecole Polytechnique Fédérale de Lausanne) # Laboratory (LSMS - Laboratoire de Simulation en Mécanique des Solides) # # Akantu is free software: you can redistribute it and/or modify it under the # terms of the GNU Lesser General Public License as published by the Free # Software Foundation, either version 3 of the License, or (at your option) any # later version. # # Akantu 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 Lesser General Public License for more # details. # # You should have received a copy of the GNU Lesser General Public License # along with Akantu. If not, see . # # @section DESCRIPTION # #=============================================================================== register_test(test_cohesive_buildfacets_tetrahedron SOURCES test_cohesive_buildfacets_tetrahedron.cc - FILES_TO_COPY tetrahedron.msh) + FILES_TO_COPY tetrahedron.msh + PACKAGE cohesive_element + ) register_test(test_cohesive_buildfacets_hexahedron SOURCES test_cohesive_buildfacets_hexahedron.cc - FILES_TO_COPY hexahedron.msh) + FILES_TO_COPY hexahedron.msh + PACKAGE cohesive_element + ) #add_mesh(test_cohesive_buildfacets_mesh mesh.geo 3 2) #add_dependencies(test_cohesive_buildfacets test_cohesive_buildfacets_mesh) diff --git a/test/test_model/test_solid_mechanics_model/test_cohesive/test_cohesive_buildfragments/CMakeLists.txt b/test/test_model/test_solid_mechanics_model/test_cohesive/test_cohesive_buildfragments/CMakeLists.txt index a07111865..b6f2b32aa 100644 --- a/test/test_model/test_solid_mechanics_model/test_cohesive/test_cohesive_buildfragments/CMakeLists.txt +++ b/test/test_model/test_solid_mechanics_model/test_cohesive/test_cohesive_buildfragments/CMakeLists.txt @@ -1,40 +1,40 @@ #=============================================================================== # @file CMakeLists.txt # # @author Marco Vocialta # # @date Wed Jun 13 11:29:49 2012 # # @brief configuration for build fragments tests # # @section LICENSE # # Copyright (©) 2010-2011 EPFL (Ecole Polytechnique Fédérale de Lausanne) # Laboratory (LSMS - Laboratoire de Simulation en Mécanique des Solides) # # Akantu is free software: you can redistribute it and/or modify it under the # terms of the GNU Lesser General Public License as published by the Free # Software Foundation, either version 3 of the License, or (at your option) any # later version. # # Akantu 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 Lesser General Public License for more # details. # # You should have received a copy of the GNU Lesser General Public License # along with Akantu. If not, see . # # @section DESCRIPTION # #=============================================================================== add_mesh(test_cohesive_buildfragments_mesh mesh.geo 2 1) register_test(test_cohesive_buildfragments SOURCES test_cohesive_buildfragments.cc DEPENDENCIES test_cohesive_buildfragments_mesh FILES_TO_COPY material.dat - DIRECTORIES_TO_CREATE paraview) - -add_dependencies(test_cohesive_buildfragments test_cohesive_buildfragments_mesh) \ No newline at end of file + DIRECTORIES_TO_CREATE paraview + PACKAGE cohesive_element + ) diff --git a/test/test_model/test_solid_mechanics_model/test_cohesive/test_cohesive_extrinsic/CMakeLists.txt b/test/test_model/test_solid_mechanics_model/test_cohesive/test_cohesive_extrinsic/CMakeLists.txt index 87e332435..1245d44ec 100644 --- a/test/test_model/test_solid_mechanics_model/test_cohesive/test_cohesive_extrinsic/CMakeLists.txt +++ b/test/test_model/test_solid_mechanics_model/test_cohesive/test_cohesive_extrinsic/CMakeLists.txt @@ -1,52 +1,55 @@ #=============================================================================== # @file CMakeLists.txt # # @author Marco Vocialta # # @date creation: Tue May 08 2012 # @date last modification: Wed Oct 09 2013 # # @brief configuration for extrinsic cohesive elements tests # # @section LICENSE # # Copyright (©) 2014 EPFL (Ecole Polytechnique Fédérale de Lausanne) # Laboratory (LSMS - Laboratoire de Simulation en Mécanique des Solides) # # Akantu is free software: you can redistribute it and/or modify it under the # terms of the GNU Lesser General Public License as published by the Free # Software Foundation, either version 3 of the License, or (at your option) any # later version. # # Akantu 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 Lesser General Public License for more # details. # # You should have received a copy of the GNU Lesser General Public License # along with Akantu. If not, see . # # @section DESCRIPTION # #=============================================================================== add_mesh(test_cohesive_extrinsic_mesh triangle.geo 2 1) add_mesh(test_cohesive_extrinsic_quadrangle_mesh quadrangle.geo 2 2) add_mesh(test_cohesive_extrinsic_tetrahedron_mesh tetrahedron.geo 3 2) register_test(test_cohesive_extrinsic SOURCES test_cohesive_extrinsic.cc DEPENDENCIES test_cohesive_extrinsic_mesh - PACKAGE cohesive_element FILES_TO_COPY material.dat - DIRECTORIES_TO_CREATE paraview) + DIRECTORIES_TO_CREATE paraview + PACKAGE cohesive_element + ) register_test(test_cohesive_extrinsic_quadrangle SOURCES test_cohesive_extrinsic_quadrangle.cc DEPENDENCIES test_cohesive_extrinsic_quadrangle_mesh - PACKAGE cohesive_element) + PACKAGE cohesive_element + ) register_test(test_cohesive_extrinsic_tetrahedron SOURCES test_cohesive_extrinsic_tetrahedron.cc DEPENDENCIES test_cohesive_extrinsic_tetrahedron_mesh - PACKAGE cohesive_element) + PACKAGE cohesive_element + ) diff --git a/test/test_model/test_solid_mechanics_model/test_cohesive/test_cohesive_intrinsic/CMakeLists.txt b/test/test_model/test_solid_mechanics_model/test_cohesive/test_cohesive_intrinsic/CMakeLists.txt index 6231bd426..13c5375b3 100644 --- a/test/test_model/test_solid_mechanics_model/test_cohesive/test_cohesive_intrinsic/CMakeLists.txt +++ b/test/test_model/test_solid_mechanics_model/test_cohesive/test_cohesive_intrinsic/CMakeLists.txt @@ -1,59 +1,63 @@ #=============================================================================== # @file CMakeLists.txt # # @author Marco Vocialta # # @date creation: Tue May 08 2012 # @date last modification: Tue Nov 12 2013 # # @brief test for intrinsic cohesive element configuration # # @section LICENSE # # Copyright (©) 2014 EPFL (Ecole Polytechnique Fédérale de Lausanne) # Laboratory (LSMS - Laboratoire de Simulation en Mécanique des Solides) # # Akantu is free software: you can redistribute it and/or modify it under the # terms of the GNU Lesser General Public License as published by the Free # Software Foundation, either version 3 of the License, or (at your option) any # later version. # # Akantu 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 Lesser General Public License for more # details. # # You should have received a copy of the GNU Lesser General Public License # along with Akantu. If not, see . # # @section DESCRIPTION # #=============================================================================== add_mesh(test_cohesive_intrinsic_mesh triangle.geo 2 2) add_mesh(test_cohesive_intrinsic_quadrangle_mesh quadrangle.geo 2 1) add_mesh(test_cohesive_intrinsic_tetrahedron_mesh tetrahedron.geo 3 2) add_mesh(test_cohesive_intrinsic_tetrahedron_fragmentation_mesh tetrahedron_full.geo 3 2) register_test(test_cohesive_intrinsic SOURCES test_cohesive_intrinsic.cc DEPENDENCIES test_cohesive_intrinsic_mesh - PACKAGE cohesive_element FILES_TO_COPY material.dat - DIRECTORIES_TO_CREATE paraview) + DIRECTORIES_TO_CREATE paraview + PACKAGE cohesive_element + ) register_test(test_cohesive_intrinsic_quadrangle SOURCES test_cohesive_intrinsic_quadrangle.cc DEPENDENCIES test_cohesive_intrinsic_quadrangle_mesh - PACKAGE cohesive_element) + PACKAGE cohesive_element + ) register_test(test_cohesive_intrinsic_tetrahedron SOURCES test_cohesive_intrinsic_tetrahedron.cc DEPENDENCIES test_cohesive_intrinsic_tetrahedron_mesh FILES_TO_COPY material_tetrahedron.dat - PACKAGE cohesive_element) + PACKAGE cohesive_element + ) register_test(test_cohesive_intrinsic_tetrahedron_fragmentation SOURCES test_cohesive_intrinsic_tetrahedron_fragmentation.cc DEPENDENCIES test_cohesive_intrinsic_tetrahedron_fragmentation_mesh - PACKAGE cohesive_element) + PACKAGE cohesive_element + ) diff --git a/test/test_model/test_solid_mechanics_model/test_cohesive/test_cohesive_intrinsic_impl/CMakeLists.txt b/test/test_model/test_solid_mechanics_model/test_cohesive/test_cohesive_intrinsic_impl/CMakeLists.txt index 14695ce1d..e251d97d0 100644 --- a/test/test_model/test_solid_mechanics_model/test_cohesive/test_cohesive_intrinsic_impl/CMakeLists.txt +++ b/test/test_model/test_solid_mechanics_model/test_cohesive/test_cohesive_intrinsic_impl/CMakeLists.txt @@ -1,38 +1,39 @@ #=============================================================================== # @file CMakeLists.txt # # @author Seyedeh Mohadeseh Taheri Mousavi # @author Marco Vocialta # # @date creation: Mon Jul 09 2012 # @date last modification: Fri Feb 22 2013 # # @brief configuration for intrinsic implicit cohesive elements # # @section LICENSE # # Copyright (©) 2014 EPFL (Ecole Polytechnique Fédérale de Lausanne) # Laboratory (LSMS - Laboratoire de Simulation en Mécanique des Solides) # # Akantu is free software: you can redistribute it and/or modify it under the # terms of the GNU Lesser General Public License as published by the Free # Software Foundation, either version 3 of the License, or (at your option) any # later version. # # Akantu 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 Lesser General Public License for more # details. # # You should have received a copy of the GNU Lesser General Public License # along with Akantu. If not, see . # # @section DESCRIPTION # #=============================================================================== register_test(test_cohesive_intrinsic_impl SOURCES test_cohesive_intrinsic_impl.cc - PACKAGE cohesive_element FILES_TO_COPY material.dat implicit.msh - DIRECTORIES_TO_CREATE paraview) + DIRECTORIES_TO_CREATE paraview + PACKAGE cohesive_element + ) diff --git a/test/test_model/test_solid_mechanics_model/test_materials/CMakeLists.txt b/test/test_model/test_solid_mechanics_model/test_materials/CMakeLists.txt index 8cb966363..4f9679296 100644 --- a/test/test_model/test_solid_mechanics_model/test_materials/CMakeLists.txt +++ b/test/test_model/test_solid_mechanics_model/test_materials/CMakeLists.txt @@ -1,63 +1,61 @@ #=============================================================================== # @file CMakeLists.txt # # @author Guillaume Anciaux # # @date creation: Fri Nov 26 2010 # @date last modification: Fri Feb 14 2014 # # @brief configuration for materials tests # # @section LICENSE # # Copyright (©) 2010-2012, 2014 EPFL (Ecole Polytechnique Fédérale de Lausanne) # Laboratory (LSMS - Laboratoire de Simulation en Mécanique des Solides) # # Akantu is free software: you can redistribute it and/or modify it under the # terms of the GNU Lesser General Public License as published by the Free # Software Foundation, either version 3 of the License, or (at your option) any # later version. # # Akantu 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 Lesser General Public License for more # details. # # You should have received a copy of the GNU Lesser General Public License # along with Akantu. If not, see . # # @section DESCRIPTION # #=============================================================================== add_mesh(test_local_material_barre_trou_mesh barre_trou.geo 2 2) register_test(test_local_material SOURCES test_local_material.cc local_material_damage.cc EXTRA_FILES local_material_damage.hh local_material_damage_inline_impl.cc DEPENDENCIES test_local_material_barre_trou_mesh FILES_TO_COPY material.dat DIRECTORIES_TO_CREATE paraview + PACKAGE core ) add_mesh(test_material_thermal_mesh square.geo 2 1) register_test(test_material_thermal SOURCES test_material_thermal.cc DEPENDENCIES test_material_thermal_mesh FILES_TO_COPY material_thermal.dat -) -#=============================================================================== + PACKAGE core + ) +# ============================================================================== add_mesh(test_interpolate_stress_mesh interpolation.geo 3 2) register_test(test_interpolate_stress test_interpolate_stress.cc FILES_TO_COPY material.dat DEPENDENCIES test_interpolate_stress_mesh - DIRECTORIES_TO_CREATE paraview) -#=============================================================================== - -add_akantu_test(test_material_plasticity "test material plasticity" - PACKAGE extra_materials) - -add_akantu_test(test_material_viscoelastic "test the visco elastic materials" - PACKAGE extra_materials) + DIRECTORIES_TO_CREATE paraview + PACKAGE core + ) -add_akantu_test(test_material_non_local "test the non-local materials" - PACKAGE damage_non_local) +# ============================================================================== +add_akantu_test(test_material_viscoelastic "test the visco elastic materials") +add_akantu_test(test_material_non_local "test the non-local materials") diff --git a/test/test_model/test_solid_mechanics_model/test_materials/test_material_viscoelastic/CMakeLists.txt b/test/test_model/test_solid_mechanics_model/test_materials/test_material_viscoelastic/CMakeLists.txt index ce1507aa1..b7ae73649 100644 --- a/test/test_model/test_solid_mechanics_model/test_materials/test_material_viscoelastic/CMakeLists.txt +++ b/test/test_model/test_solid_mechanics_model/test_materials/test_material_viscoelastic/CMakeLists.txt @@ -1,43 +1,45 @@ #=============================================================================== # @file CMakeLists.txt # # @author Nicolas Richart # # @date Thu Aug 09 21:06:34 2012 # # @brief configuration for viscoelastic materials tests # # @section LICENSE # # Copyright (©) 2010-2011 EPFL (Ecole Polytechnique Fédérale de Lausanne) # Laboratory (LSMS - Laboratoire de Simulation en Mécanique des Solides) # # Akantu is free software: you can redistribute it and/or modify it under the # terms of the GNU Lesser General Public License as published by the Free # Software Foundation, either version 3 of the License, or (at your option) any # later version. # # Akantu 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 Lesser General Public License for more # details. # # You should have received a copy of the GNU Lesser General Public License # along with Akantu. If not, see . # #=============================================================================== add_mesh(test_material_standard_linear_solid_deviatoric_relaxation_mesh test_material_standard_linear_solid_deviatoric_relaxation.geo 2 1) register_test(test_material_standard_linear_solid_deviatoric_relaxation SOURCES test_material_standard_linear_solid_deviatoric_relaxation.cc DEPENDENCIES test_material_standard_linear_solid_deviatoric_relaxation_mesh FILES_TO_COPY material_standard_linear_solid_deviatoric_relaxation.dat + PACKAGE core ) register_test(test_material_standard_linear_solid_deviatoric_relaxation_tension SOURCES test_material_standard_linear_solid_deviatoric_relaxation_tension.cc DEPENDENCIES test_material_standard_linear_solid_deviatoric_relaxation_mesh FILES_TO_COPY material_standard_linear_solid_deviatoric_relaxation.dat + PACKAGE core ) diff --git a/test/test_model/test_structural_mechanics_model/CMakeLists.txt b/test/test_model/test_structural_mechanics_model/CMakeLists.txt index 3c13a5441..7ba2bce7e 100644 --- a/test/test_model/test_structural_mechanics_model/CMakeLists.txt +++ b/test/test_model/test_structural_mechanics_model/CMakeLists.txt @@ -1,57 +1,72 @@ #=============================================================================== # @file CMakeLists.txt # # @author Fabian Barras # # @date creation: Fri Jul 15 2011 # @date last modification: Mon Jul 07 2014 # # @brief Structural Mechanics Model Tests # # @section LICENSE # # Copyright (©) 2014 EPFL (Ecole Polytechnique Fédérale de Lausanne) # Laboratory (LSMS - Laboratoire de Simulation en Mécanique des Solides) # # Akantu is free software: you can redistribute it and/or modify it under the # terms of the GNU Lesser General Public License as published by the Free # Software Foundation, either version 3 of the License, or (at your option) any # later version. # # Akantu 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 Lesser General Public License for more # details. # # You should have received a copy of the GNU Lesser General Public License # along with Akantu. If not, see . # #=============================================================================== register_test(test_structural_mechanics_model_bernoulli_beam_2_exemple_1_1 - test_structural_mechanics_model_bernoulli_beam_2_exemple_1_1.cc) + test_structural_mechanics_model_bernoulli_beam_2_exemple_1_1.cc + PACKAGE structural_mechanics_model + ) register_test(test_structural_mechanics_model_bernoulli_beam_2_exemple_1_1_y - test_structural_mechanics_model_bernoulli_beam_2_exemple_1_1_y.cc) + test_structural_mechanics_model_bernoulli_beam_2_exemple_1_1_y.cc + PACKAGE structural_mechanics_model + ) register_test(test_structural_mechanics_model_bernoulli_beam_3_exemple_1_1_xy - test_structural_mechanics_model_bernoulli_beam_3_exemple_1_1_xy.cc) + test_structural_mechanics_model_bernoulli_beam_3_exemple_1_1_xy.cc + PACKAGE structural_mechanics_model + ) register_test(test_structural_mechanics_model_bernoulli_beam_3_exemple_1_1_zy - test_structural_mechanics_model_bernoulli_beam_3_exemple_1_1_zy.cc) + test_structural_mechanics_model_bernoulli_beam_3_exemple_1_1_zy.cc + PACKAGE structural_mechanics_model + ) register_test(test_structural_mechanics_model_bernoulli_beam_3_exercice_12_10_13 - test_structural_mechanics_model_bernoulli_beam_3_exercice_12_10_13.cc) + test_structural_mechanics_model_bernoulli_beam_3_exercice_12_10_13.cc + PACKAGE structural_mechanics_model + ) register_test(test_structural_mechanics_model_bernoulli_beam_dynamics - test_structural_mechanics_model_bernoulli_beam_dynamics.cc) + test_structural_mechanics_model_bernoulli_beam_dynamics.cc + PACKAGE structural_mechanics_model + ) register_test(test_structural_mechanics_model_kirchhoff_shell_patch_test_4_5_5 - test_structural_mechanics_model_kirchhoff_shell_patch_test_4_5_5.cc) + test_structural_mechanics_model_kirchhoff_shell_patch_test_4_5_5.cc + PACKAGE structural_mechanics_model + ) add_mesh(complicated_mesh complicated.geo 1 1) register_test(test_structural_mechanics_model_bernoulli_beam_2_complicated test_structural_mechanics_model_bernoulli_beam_2_complicated.cc - DEPENDENCIES complicated_mesh) + DEPENDENCIES complicated_mesh + PACKAGE structural_mechanics_model + ) -file(MAKE_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/paraview) diff --git a/test/test_solver/CMakeLists.txt b/test/test_solver/CMakeLists.txt index ee414464d..fd1de042c 100644 --- a/test/test_solver/CMakeLists.txt +++ b/test/test_solver/CMakeLists.txt @@ -1,64 +1,70 @@ #=============================================================================== # @file CMakeLists.txt # # @author Guillaume Anciaux # @author Nicolas Richart # # @date creation: Mon Dec 13 2010 # @date last modification: Tue Nov 06 2012 # # @brief configuration for solver tests # # @section LICENSE # # Copyright (©) 2014 EPFL (Ecole Polytechnique Fédérale de Lausanne) # Laboratory (LSMS - Laboratoire de Simulation en Mécanique des Solides) # # Akantu is free software: you can redistribute it and/or modify it under the # terms of the GNU Lesser General Public License as published by the Free # Software Foundation, either version 3 of the License, or (at your option) any # later version. # # Akantu 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 Lesser General Public License for more # details. # # You should have received a copy of the GNU Lesser General Public License # along with Akantu. If not, see . # # @section DESCRIPTION # #=============================================================================== add_mesh(test_solver_mesh triangle.geo 2 1) register_test(test_sparse_matrix_profile SOURCES test_sparse_matrix_profile.cc DEPENDENCIES test_solver_mesh + PACKAGE implicit ) register_test(test_sparse_matrix_assemble SOURCES test_sparse_matrix_assemble.cc DEPENDENCIES test_solver_mesh + PACKAGE implicit ) register_test(test_sparse_matrix_product SOURCES test_sparse_matrix_product.cc FILES_TO_COPY bar.msh + PACKAGE implicit ) register_test(test_petsc_matrix_profile SOURCES test_petsc_matrix_profile.cc DEPENDENCIES test_solver_mesh + PACKAGE petsc ) register_test(test_petsc_matrix_apply_boundary SOURCES test_petsc_matrix_apply_boundary.cc DEPENDENCIES test_solver_mesh + PACKAGE petsc ) register_test(test_solver_petsc SOURCES test_solver_petsc.cc DEPENDENCIES profile.mtx + PACKAGE petsc ) \ No newline at end of file diff --git a/test/test_static_memory/CMakeLists.txt b/test/test_static_memory/CMakeLists.txt index 7d3f3bb84..7d84dfc79 100644 --- a/test/test_static_memory/CMakeLists.txt +++ b/test/test_static_memory/CMakeLists.txt @@ -1,33 +1,33 @@ #=============================================================================== # @file CMakeLists.txt # # @author Guillaume Anciaux # # @date creation: Fri Sep 03 2010 # @date last modification: Tue Nov 06 2012 # # @brief configuration for static memory tests # # @section LICENSE # # Copyright (©) 2010-2012, 2014 EPFL (Ecole Polytechnique Fédérale de Lausanne) # Laboratory (LSMS - Laboratoire de Simulation en Mécanique des Solides) # # Akantu is free software: you can redistribute it and/or modify it under the # terms of the GNU Lesser General Public License as published by the Free # Software Foundation, either version 3 of the License, or (at your option) any # later version. # # Akantu 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 Lesser General Public License for more # details. # # You should have received a copy of the GNU Lesser General Public License # along with Akantu. If not, see . # # @section DESCRIPTION # #=============================================================================== -register_test(test_static_memory SOURCES test_static_memory.cc) +register_test(test_static_memory SOURCES test_static_memory.cc PACKAGE core) diff --git a/test/test_surface_extraction/CMakeLists.txt b/test/test_surface_extraction/CMakeLists.txt index 0f26d6f24..f8cd2f36c 100644 --- a/test/test_surface_extraction/CMakeLists.txt +++ b/test/test_surface_extraction/CMakeLists.txt @@ -1,47 +1,47 @@ #=============================================================================== # @file CMakeLists.txt # # @author Leonardo Snozzi # # @date creation: Tue Oct 26 2010 # @date last modification: Tue Nov 06 2012 # # @brief configuration for surface extraction tests # # @section LICENSE # # Copyright (©) 2010-2012, 2014 EPFL (Ecole Polytechnique Fédérale de Lausanne) # Laboratory (LSMS - Laboratoire de Simulation en Mécanique des Solides) # # Akantu is free software: you can redistribute it and/or modify it under the # terms of the GNU Lesser General Public License as published by the Free # Software Foundation, either version 3 of the License, or (at your option) any # later version. # # Akantu 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 Lesser General Public License for more # details. # # You should have received a copy of the GNU Lesser General Public License # along with Akantu. If not, see . # # @section DESCRIPTION # #=============================================================================== #=============================================================================== add_mesh(test_surface_extraction_2d_mesh squares.geo 2 1) register_test(test_surface_extraction_triangle_3 SOURCES test_surface_extraction_triangle_3.cc DEPENDENCIES test_surface_extraction_2d_mesh - DIRECTORIES_TO_CREATE paraview + PACKAGE core ) #=============================================================================== add_mesh(test_surface_extraction_3d_mesh cubes.geo 3 1) register_test(test_surface_extraction_tetrahedron_4 SOURCES test_surface_extraction_tetrahedron_4.cc DEPENDENCIES test_surface_extraction_3d_mesh - DIRECTORIES_TO_CREATE paraview -) + PACKAGE core + ) diff --git a/test/test_synchronizer/CMakeLists.txt b/test/test_synchronizer/CMakeLists.txt index 971dbc550..33461715c 100644 --- a/test/test_synchronizer/CMakeLists.txt +++ b/test/test_synchronizer/CMakeLists.txt @@ -1,68 +1,70 @@ #=============================================================================== # @file CMakeLists.txt # # @author Nicolas Richart # # @date creation: Sun Sep 12 2010 # @date last modification: Fri Sep 05 2014 # # @brief configuration for synchronizer tests # # @section LICENSE # # Copyright (©) 2010-2012, 2014 EPFL (Ecole Polytechnique Fédérale de Lausanne) # Laboratory (LSMS - Laboratoire de Simulation en Mécanique des Solides) # # Akantu is free software: you can redistribute it and/or modify it under the # terms of the GNU Lesser General Public License as published by the Free # Software Foundation, either version 3 of the License, or (at your option) any # later version. # # Akantu 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 Lesser General Public License for more # details. # # You should have received a copy of the GNU Lesser General Public License # along with Akantu. If not, see . # # @section DESCRIPTION # #=============================================================================== add_mesh(test_synchronizer_communication_mesh cube.geo 3 2) register_test(test_synchronizer_communication SOURCES test_synchronizer_communication.cc DEPENDENCIES test_synchronizer_communication_mesh PACKAGE parallel ) if(AKANTU_DAMAGE_NON_LOCAL) add_executable(test_grid_synchronizer_check_neighbors test_grid_synchronizer_check_neighbors.cc) target_link_libraries(test_grid_synchronizer_check_neighbors akantu) endif() register_test(test_grid_synchronizer SOURCES test_grid_synchronizer.cc test_data_accessor.hh DEPENDENCIES test_synchronizer_communication_mesh test_grid_synchronizer_check_neighbors EXTRA_FILES test_grid_synchronizer_check_neighbors.cc test_grid_tools.hh PACKAGE damage_non_local ) register_test(test_dof_synchronizer SOURCES test_dof_synchronizer.cc test_data_accessor.hh - FILES_TO_COPY bar.msh) + FILES_TO_COPY bar.msh + PACKAGE parallel + ) register_test(test_dof_synchronizer_communication SOURCES test_dof_synchronizer_communication.cc test_dof_data_accessor.hh DEPENDENCIES test_synchronizer_communication_mesh PACKAGE parallel ) register_test(test_data_distribution SOURCES test_data_distribution.cc FILES_TO_COPY data_split.msh PACKAGE parallel )