Commit 4975a2f3 authored by Alexander Jaust's avatar Alexander Jaust
Browse files

Add CMake macrot for file links to preCICE files

A CMake macro called `add_precice_file_links` is added. If one
calls this macro in a `CMakeLists.txt` via `add_precice_file_links()`,
file links to all XML files in the directory of the `CMakeLists.txt`
are created.

The paths in tests have been adapted accordingly to use 
`CMAKE_CURRENT_BINARY_DIR` instead to refering to the source directory.
parent b6b4b331
Pipeline #19923 passed with stages
in 2 minutes and 16 seconds
......@@ -2,6 +2,7 @@
## Not released yet
- 2022-08-02: Fix CMake macro that creates files links to preCICE configuration files.
- 2022-07-29: Updated tests to work with DuMuX 3.5. CI was updated to newer versions of DuMuX and preCICE accordingly.
- 2022-07-28: Remove monolithic test cases and examples from repository.
- 2022-07-28: Add Docker recipe used for CI.
......
......@@ -13,13 +13,11 @@ endif()
#find dune-common and set the module path
find_package(dune-common REQUIRED)
list(APPEND CMAKE_MODULE_PATH ${dune-common_MODULE_PATH}
"${PROJECT_SOURCE_DIR}/cmake/modules")
# Find preCICE library
find_package(precice 2 REQUIRED CONFIG)
list(APPEND CMAKE_MODULE_PATH ${dune-common_MODULE_PATH}
"${PROJECT_SOURCE_DIR}/cmake/modules")
#include the dune macros
include(DuneMacros)
......
# Create file links to preCICE configuration files
macro(add_precice_file_links)
FILE(GLOB precice_input_files *.xml)
foreach(VAR ${precice_input_files})
get_filename_component(file_name ${VAR} NAME)
dune_symlink_to_source_files(FILES ${file_name})
endforeach()
endmacro()
set(modules
"DumuxPreciceMacros.cmake"
"DumuxPreciceTestMacros.cmake"
DumuxPreciceMacros.cmake
DumuxPreciceTestMacros.cmake
AddPreciceConfigurationFileLinks.cmake
)
include(GNUInstallDirs)
......
# File for module specific CMake tests.
include(AddPreciceConfigurationFileLinks)
......@@ -9,14 +9,7 @@ target_link_libraries(test_pm_reversed-3d PRIVATE dumux-precice)
# add a symlink for each input file
add_input_file_links()
macro(add_precice_file_links)
FILE(GLOB precice_files *.xml)
foreach(VAR ${input_files})
get_filename_component(file_name ${VAR} NAME)
dune_symlink_to_source_files(FILES ${file_name})
endforeach()
endmacro()
# add a symlink for each preCICE configuration file
add_precice_file_links()
dune_symlink_to_source_files(FILES run-iterative-simulation-test.sh)
......
......@@ -8,14 +8,6 @@ target_link_libraries(test_ff_flow_over_square_2d PRIVATE dumux-precice)
target_link_libraries(test_pm_flow_over_square_2d PRIVATE dumux-precice)
add_input_file_links()
macro(add_precice_file_links)
FILE(GLOB precice_files *.xml)
foreach(VAR ${input_files})
get_filename_component(file_name ${VAR} NAME)
dune_symlink_to_source_files(FILES ${file_name})
endforeach()
endmacro()
add_precice_file_links()
# Dummy test is needed to build porous media solver. The default
......@@ -40,8 +32,8 @@ dumux_add_test(NAME test_ff_pm_part_flow_over_square_2d_si_st_first
${CMAKE_CURRENT_BINARY_DIR}/stokes-iterative-00005.vtu
${CMAKE_SOURCE_DIR}/test/reference-solutions/flow-over-square-2d/test_stokes_first_si_darcy.vtu
${CMAKE_CURRENT_BINARY_DIR}/darcy-iterative-00005.vtu
--dumux-param-file ${CMAKE_SOURCE_DIR}/test/flow-over-square-2d/params-stokesdarcy.input
--precice-config-file ${CMAKE_SOURCE_DIR}/test/flow-over-square-2d/precice-config-si-free-flow-first.xml
--dumux-param-file ${CMAKE_CURRENT_BINARY_DIR}/params-stokesdarcy.input
--precice-config-file ${CMAKE_CURRENT_BINARY_DIR}/precice-config-si-free-flow-first.xml
--precice-iteration-files ${CMAKE_SOURCE_DIR}/test/reference-solutions/flow-over-square-2d/test_stokes_first_si_coupliter_stokes.log ${CMAKE_CURRENT_BINARY_DIR}/precice-FreeFlow-iterations.log
--case-name "flow-over-box-2d-si-stokes-first"
--relative 5e-6
......@@ -62,8 +54,8 @@ dumux_add_test(NAME test_ff_pm_part_flow_over_square_2d_si_st_second
${CMAKE_CURRENT_BINARY_DIR}/stokes-iterative-00006.vtu
${CMAKE_SOURCE_DIR}/test/reference-solutions/flow-over-square-2d/test_stokes_second_si_darcy.vtu
${CMAKE_CURRENT_BINARY_DIR}/darcy-iterative-00006.vtu
--dumux-param-file ${CMAKE_SOURCE_DIR}/test/flow-over-square-2d/params-stokesdarcy.input
--precice-config-file ${CMAKE_SOURCE_DIR}/test/flow-over-square-2d/precice-config-si-free-flow-second.xml
--dumux-param-file ${CMAKE_CURRENT_BINARY_DIR}/params-stokesdarcy.input
--precice-config-file ${CMAKE_CURRENT_BINARY_DIR}/precice-config-si-free-flow-second.xml
--precice-iteration-files ${CMAKE_SOURCE_DIR}/test/reference-solutions/flow-over-square-2d/test_stokes_second_si_coupliter_darcy.log ${CMAKE_CURRENT_BINARY_DIR}/precice-Darcy-iterations.log
--case-name "flow-over-box-2d-si-stokes-second"
--relative 5e-6
......@@ -83,8 +75,8 @@ dumux_add_test(NAME test_ff_pm_part_flow_over_square_2d_pi_st
${CMAKE_CURRENT_BINARY_DIR}/stokes-iterative-00007.vtu
${CMAKE_SOURCE_DIR}/test/reference-solutions/flow-over-square-2d/test_stokes_pi_darcy.vtu
${CMAKE_CURRENT_BINARY_DIR}/darcy-iterative-00007.vtu
--dumux-param-file ${CMAKE_SOURCE_DIR}/test/flow-over-square-2d/params-stokesdarcy.input
--precice-config-file ${CMAKE_SOURCE_DIR}/test/flow-over-square-2d/precice-config-pi.xml
--dumux-param-file ${CMAKE_CURRENT_BINARY_DIR}/params-stokesdarcy.input
--precice-config-file ${CMAKE_CURRENT_BINARY_DIR}/precice-config-pi.xml
--precice-iteration-files ${CMAKE_SOURCE_DIR}/test/reference-solutions/flow-over-square-2d/test_stokes_pi_coupliter_stokes.log
${CMAKE_CURRENT_BINARY_DIR}/precice-FreeFlow-iterations.log
--case-name "flow-over-box-2d-pi"
......@@ -114,8 +106,8 @@ dumux_add_test(NAME test_ff_pm_part_flow_over_square_2d_si_ns_first
${CMAKE_CURRENT_BINARY_DIR}/navierstokes-iterative-00006.vtu
${CMAKE_SOURCE_DIR}/test/reference-solutions/flow-over-square-2d/test_navierstokes_first_si_darcy.vtu
${CMAKE_CURRENT_BINARY_DIR}/darcy-iterative-00006.vtu
--dumux-param-file ${CMAKE_SOURCE_DIR}/test/flow-over-square-2d/params-navierstokesdarcy.input
--precice-config-file ${CMAKE_SOURCE_DIR}/test/flow-over-square-2d/precice-config-si-free-flow-first.xml
--dumux-param-file ${CMAKE_CURRENT_BINARY_DIR}/params-navierstokesdarcy.input
--precice-config-file ${CMAKE_CURRENT_BINARY_DIR}/precice-config-si-free-flow-first.xml
--precice-iteration-files ${CMAKE_SOURCE_DIR}/test/reference-solutions/flow-over-square-2d/test_navierstokes_first_si_coupliter_navierstokes.log ${CMAKE_CURRENT_BINARY_DIR}/precice-FreeFlow-iterations.log
--case-name "flow-over-box-2d-si-navierstokes-first"
--relative 5e-6
......@@ -135,8 +127,8 @@ dumux_add_test(NAME test_ff_pm_part_flow_over_square_2d_si_ns_second
${CMAKE_CURRENT_BINARY_DIR}/navierstokes-iterative-00007.vtu
${CMAKE_SOURCE_DIR}/test/reference-solutions/flow-over-square-2d/test_navierstokes_second_si_darcy.vtu
${CMAKE_CURRENT_BINARY_DIR}/darcy-iterative-00007.vtu
--dumux-param-file ${CMAKE_SOURCE_DIR}/test/flow-over-square-2d/params-navierstokesdarcy.input
--precice-config-file ${CMAKE_SOURCE_DIR}/test/flow-over-square-2d/precice-config-si-free-flow-second.xml
--dumux-param-file ${CMAKE_CURRENT_BINARY_DIR}/params-navierstokesdarcy.input
--precice-config-file ${CMAKE_CURRENT_BINARY_DIR}/precice-config-si-free-flow-second.xml
--precice-iteration-files ${CMAKE_SOURCE_DIR}/test/reference-solutions/flow-over-square-2d/test_navierstokes_second_si_coupliter_darcy.log ${CMAKE_CURRENT_BINARY_DIR}/precice-Darcy-iterations.log
--case-name "flow-over-box-2d-si-navierstokes-second"
--relative 5e-6
......@@ -156,8 +148,8 @@ dumux_add_test(NAME test_ff_pm_part_flow_over_square_2d_pi_ns
${CMAKE_CURRENT_BINARY_DIR}/navierstokes-iterative-00011.vtu
${CMAKE_SOURCE_DIR}/test/reference-solutions/flow-over-square-2d/test_navierstokes_pi_darcy.vtu
${CMAKE_CURRENT_BINARY_DIR}/darcy-iterative-00011.vtu
--dumux-param-file ${CMAKE_SOURCE_DIR}/test/flow-over-square-2d/params-navierstokesdarcy.input
--precice-config-file ${CMAKE_SOURCE_DIR}/test/flow-over-square-2d/precice-config-pi.xml
--dumux-param-file ${CMAKE_CURRENT_BINARY_DIR}/params-navierstokesdarcy.input
--precice-config-file ${CMAKE_CURRENT_BINARY_DIR}/precice-config-pi.xml
--precice-iteration-files ${CMAKE_SOURCE_DIR}/test/reference-solutions/flow-over-square-2d/test_navierstokes_pi_coupliter_navierstokes.log
${CMAKE_CURRENT_BINARY_DIR}/precice-FreeFlow-iterations.log
--case-name "flow-over-box-2d-pi"
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment