Skip to content

Commit a552839

Browse files
authored
Merge pull request #626 from sebproell/dealii-support-initial
[deal.II] Converters for 4C discretization and vectors into deal.II equivalents
2 parents cef77db + 313e13c commit a552839

25 files changed

+2015
-2
lines changed

CMakeLists.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -120,6 +120,7 @@ four_c_configure_dependency(HDF5 DEFAULT ON)
120120
four_c_configure_dependency(MPI DEFAULT ON)
121121
four_c_configure_dependency(Qhull DEFAULT ON)
122122
four_c_configure_dependency(Trilinos DEFAULT ON)
123+
four_c_configure_dependency(deal.II DEFAULT OFF)
123124
four_c_configure_dependency(Boost DEFAULT ON)
124125
four_c_configure_dependency(ArborX DEFAULT OFF)
125126
four_c_configure_dependency(FFTW DEFAULT ON)
Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
# This file is part of 4C multiphysics licensed under the
2+
# GNU Lesser General Public License v3.0 or later.
3+
#
4+
# See the LICENSE.md file in the top-level for license information.
5+
#
6+
# SPDX-License-Identifier: LGPL-3.0-or-later
7+
8+
# At this point we deliberately turned on the option to use deal.II, so fail if it is not available.
9+
find_package(deal.II REQUIRED)
10+
11+
if(NOT DEAL_II_WITH_TRILINOS)
12+
message(
13+
FATAL_ERROR
14+
"deal.II was not compiled with Trilinos support. Please recompile deal.II with Trilinos support."
15+
)
16+
endif()
17+
18+
# N.B. We do NOT use dealii::dealii here, since this pulls in a lot of flags that we might not want.
19+
# Instead, deal.II potentially provides two targets: dealii::dealii_release and/or dealii::dealii_debug.
20+
if(TARGET dealii::dealii_release)
21+
message(STATUS "Using target dealii::dealii_release")
22+
target_link_libraries(four_c_all_enabled_external_dependencies INTERFACE dealii::dealii_release)
23+
elseif(TARGET dealii::dealii_debug)
24+
message(STATUS "Using target dealii::dealii_debug")
25+
target_link_libraries(four_c_all_enabled_external_dependencies INTERFACE dealii::dealii_debug)
26+
else()
27+
message(FATAL_ERROR "Could not find target dealii::dealii_release or dealii::dealii_debug.")
28+
endif()
29+
30+
include(${DEAL_II_GIT_CONFIG})
31+
set(FOUR_C_deal.II_GIT_HASH "${DEAL_II_GIT_REVISION}")
32+
33+
configure_file(
34+
"${PROJECT_SOURCE_DIR}/cmake/templates/deal.II.cmake.in"
35+
"${PROJECT_BINARY_DIR}/cmake/templates/deal.II.cmake"
36+
@ONLY
37+
)

cmake/setup_install.cmake

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -73,6 +73,7 @@ _add_dependency_to_settings(HDF5)
7373
_add_dependency_to_settings(MPI)
7474
_add_dependency_to_settings(Qhull)
7575
_add_dependency_to_settings(Trilinos)
76+
_add_dependency_to_settings(deal.II)
7677
_add_dependency_to_settings(Boost)
7778
_add_dependency_to_settings(ArborX)
7879
_add_dependency_to_settings(FFTW)

cmake/templates/4CConfig.cmake.in

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,10 @@ if(FOUR_C_WITH_TRILINOS)
2727
endif()
2828
endif()
2929

30+
if(FOUR_C_WITH_DEAL_II)
31+
find_package(deal.II REQUIRED CONFIG HINTS ${FOUR_C_DEAL_II_ROOT})
32+
endif()
33+
3034
if(FOUR_C_WITH_BOOST)
3135
find_package(
3236
Boost

cmake/templates/4CSettings.cmake.in

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ set(FOUR_C_WITH_HDF5 @FOUR_C_WITH_HDF5@)
99
set(FOUR_C_WITH_MPI @FOUR_C_WITH_MPI@)
1010
set(FOUR_C_WITH_QHULL @FOUR_C_WITH_QHULL@)
1111
set(FOUR_C_WITH_TRILINOS @FOUR_C_WITH_TRILINOS@)
12+
set(FOUR_C_WITH_DEAL_II @FOUR_C_WITH_DEAL_II@)
1213
set(FOUR_C_WITH_BOOST @FOUR_C_WITH_BOOST@)
1314
set(FOUR_C_WITH_ARBORX @FOUR_C_WITH_ARBORX@)
1415
set(FOUR_C_WITH_FFTW @FOUR_C_WITH_FFTW@)

cmake/templates/deal.II.cmake.in

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
set(FOUR_C_DEAL_II_ROOT "@FOUR_C_DEAL_II_ROOT@")
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
6890ca740b6e51530ebb7ae7e4932977010ef2be 2025.1 v9.6.2

presets/docker/CMakePresets.json

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@
1313
"FOUR_C_CXX_FLAGS": "-msse3",
1414
"FOUR_C_ENABLE_WARNINGS_AS_ERRORS": "ON",
1515
"FOUR_C_TRILINOS_ROOT": "/opt/4C-dependencies",
16+
"FOUR_C_DEAL_II_ROOT": "/opt/4C-dependencies",
1617
"FOUR_C_QHULL_ROOT": "/opt/4C-dependencies",
1718
"FOUR_C_PVPYTHON": "/opt/4C-dependencies-testing/ParaView-5.5.2-Qt5-MPI-Linux-64bit/bin/pvpython",
1819
"BUILD_SHARED_LIBS": "ON",
@@ -24,7 +25,8 @@
2425
"FOUR_C_WITH_ARBORX": "ON",
2526
"FOUR_C_WITH_BACKTRACE": "ON",
2627
"FOUR_C_BACKTRACE_ROOT": "/opt/4C-dependencies",
27-
"FOUR_C_WITH_MIRCO": "ON"
28+
"FOUR_C_WITH_MIRCO": "ON",
29+
"FOUR_C_WITH_DEAL_II": "ON"
2830
}
2931
},
3032
{
@@ -125,7 +127,8 @@
125127
"cacheVariables": {
126128
"FOUR_C_WITH_ARBORX": "OFF",
127129
"FOUR_C_WITH_BACKTRACE": "OFF",
128-
"FOUR_C_WITH_MIRCO": "OFF"
130+
"FOUR_C_WITH_MIRCO": "OFF",
131+
"FOUR_C_WITH_DEAL_II": "OFF"
129132
}
130133
}
131134
]

src/CMakeLists.txt

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,9 @@ add_subdirectory(contact_constitutivelaw)
2222
add_subdirectory(core)
2323
add_subdirectory(coupling)
2424
add_subdirectory(cut)
25+
if(FOUR_C_WITH_DEAL_II)
26+
add_subdirectory(deal_ii)
27+
endif()
2528
add_subdirectory(ehl)
2629
add_subdirectory(elch)
2730
add_subdirectory(fbi)

src/deal_ii/CMakeLists.txt

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
# This file is part of 4C multiphysics licensed under the
2+
# GNU Lesser General Public License v3.0 or later.
3+
#
4+
# See the LICENSE.md file in the top-level for license information.
5+
#
6+
# SPDX-License-Identifier: LGPL-3.0-or-later
7+
8+
four_c_auto_define_module(NO_CYCLES)
9+
10+
# deal.II support is a pure extension of the core module and may not depend on any other module
11+
four_c_add_dependency(${AUTO_DEFINED_MODULE_NAME} core)

0 commit comments

Comments
 (0)