@@ -4,6 +4,8 @@ project(specfem2d_kokkos VERSION 0.1.0)
44
55set (CMAKE_CXX_STANDARD 17)
66option (MPI_PARALLEL "MPI enabled" OFF )
7+ option (BUILD_TESTS "Tests included" OFF )
8+ option (BUILD_EXAMPLES "Examples included" OFF )
79
810if (CMAKE_CXX_COMPILER_ID STREQUAL "IntelLLVM" )
911 set (CMAKE_CXX_FLAGS "-fp-model=precise" )
@@ -25,25 +27,37 @@ endif()
2527## TODO: Add options for on utilizing in house builds
2628include (FetchContent )
2729FetchContent_Declare (
28- kokkos
29- URL https://github.com/kokkos/kokkos/archive/refs/tags/4.0.00.zip
30+ kokkos
31+ URL https://github.com/kokkos/kokkos/archive/refs/tags/4.0.00.zip
3032)
3133FetchContent_MakeAvailable (kokkos)
3234
3335FetchContent_Declare (
3436 yaml
35- URL https://github.com/jbeder/yaml-cpp/archive/refs/tags/yaml-cpp-0.7 .0.zip
37+ URL https://github.com/jbeder/yaml-cpp/archive/refs/tags/0.8 .0.tar.gz
3638)
3739FetchContent_MakeAvailable (yaml)
38- include_directories (BEFORE SYSTEM ${yaml_SOURCE_DIR } ${yaml_BINARY_DIR } /include )
3940
40- add_subdirectory (boost-cmake )
41+ include_directories (BEFORE SYSTEM ${yaml_BINARY_DIR } ${yaml_SOURCE_DIR } /include )
42+
43+ # Try finding boost and if not found install.
44+ find_package (Boost 1.73.0 COMPONENTS program_options filesystem system )
45+
46+ if (NOT ${Boost_FOUND} )
47+ add_subdirectory (boost-cmake )
48+ else ()
49+ message (STATUS " LIB: ${Boost_LIBRARY_DIRS} " )
50+ message (STATUS " INC: ${Boost_INCLUDE_DIRS} " )
51+ message (STATUS " LIBSO: ${Boost_LIBRARIES} " )
52+ endif ()
4153
4254configure_file (constants.hpp.in constants.hpp )
4355
4456include_directories (include )
4557include_directories (${CMAKE_BINARY_DIR } )
4658
59+ add_subdirectory (meshfem2d )
60+
4761# Build specfem2d libraries
4862add_library (
4963 quadrature
@@ -85,16 +99,6 @@ else()
8599 message ("-- Compiling SPECFEM without MPI" )
86100endif (MPI_PARALLEL )
87101
88- add_library (
89- operators
90- src/mathematical_operators/mathematical_operators.cpp
91- )
92-
93- target_link_libraries (
94- operators
95- Kokkos::kokkos
96- )
97-
98102add_library (
99103 material_class
100104 src/material/elastic_material.cpp
@@ -113,12 +117,15 @@ add_library(
113117 src/mesh/IO/fortran/read_material_properties.cpp
114118 src/mesh/boundaries/forcing_boundaries.cpp
115119 src/mesh/boundaries/absorbing_boundaries.cpp
120+ src/mesh/boundaries/acoustic_free_surface.cpp
116121 src/mesh/elements/tangential_elements.cpp
117122 src/mesh/elements/axial_elements.cpp
118123 src/mesh/properties/properties.cpp
119124 src/mesh/mpi_interfaces/mpi_interfaces.cpp
120125 src/mesh/material_indic/material_indic.cpp
121- src/mesh/surfaces/acoustic_free_surface.cpp
126+ src/mesh/coupled_interfaces/elastic_acoustic.cpp
127+ src/mesh/coupled_interfaces/elastic_poroelastic.cpp
128+ src/mesh/coupled_interfaces/acoustic_poroelastic.cpp
122129 src/mesh/mesh.cpp
123130)
124131
@@ -157,6 +164,7 @@ target_link_libraries(
157164add_library (
158165 source_time_function
159166 src/source_time_function/dirac.cpp
167+ src/source_time_function/ricker.cpp
160168)
161169
162170target_link_libraries (
@@ -206,6 +214,8 @@ add_library(
206214 src/compute/compute_properties.cpp
207215 src/compute/compute_sources.cpp
208216 src/compute/compute_receivers.cpp
217+ src/compute/coupled_interfaces.cpp
218+ src/compute/compute_boundaries.cpp
209219)
210220
211221target_link_libraries (
@@ -218,22 +228,6 @@ target_link_libraries(
218228 Kokkos::kokkos
219229)
220230
221- # there seems to be a bug when compiling compute with -O3 mode using the icpx compiler.
222- # set_target_properties(compute PROPERTIES COMPILE_OPTIONS "$<$<CONFIG:RELEASE>:-fp-model=precise>")
223-
224- add_library (
225- domain
226- src/domain/elastic_domain.cpp
227- )
228-
229- target_link_libraries (
230- domain
231- compute
232- quadrature
233- operators
234- Kokkos::kokkos
235- )
236-
237231add_library (
238232 timescheme
239233 src/timescheme/timescheme.cpp
@@ -242,7 +236,9 @@ add_library(
242236
243237target_link_libraries (
244238 timescheme
245- domain
239+ Kokkos::kokkos
240+ yaml-cpp
241+ compute
246242)
247243
248244add_library (
@@ -256,18 +252,6 @@ target_link_libraries(
256252 receiver_class
257253)
258254
259- add_library (
260- solver
261- src/solver/time_marching.cpp
262- )
263-
264- target_link_libraries (
265- solver
266- domain
267- timescheme
268- writer
269- )
270-
271255add_library (
272256 parameter_reader
273257 src/parameter_parser/run_setup.cpp
@@ -288,6 +272,7 @@ target_link_libraries(
288272 timescheme
289273 receiver_class
290274 yaml-cpp
275+ writer
291276 Boost::filesystem
292277)
293278
@@ -306,17 +291,22 @@ target_link_libraries(
306291 compute
307292 source_class
308293 parameter_reader
309- domain
310- solver
311294 receiver_class
312295 writer
313296 Boost::program_options
314297)
315298
316299# Include tests
317- add_subdirectory (tests/unit-tests )
318- add_subdirectory (tests/regression-tests )
319- add_subdirectory (examples )
300+ if (BUILD_TESTS)
301+ message ("-- Including tests." )
302+ add_subdirectory (tests/unit-tests )
303+ add_subdirectory (tests/regression-tests )
304+ endif ()
305+
306+ if (BUILD_EXAMPLES)
307+ message ("-- Including examples." )
308+ add_subdirectory (examples )
309+ endif ()
320310
321311# Doxygen
322312
0 commit comments