-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathCMakeLists.txt
More file actions
428 lines (352 loc) · 10.7 KB
/
CMakeLists.txt
File metadata and controls
428 lines (352 loc) · 10.7 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
cmake_minimum_required(VERSION 3.16)
project(efg_3d_electromagnetics_2006
VERSION 0.1.0
LANGUAGES C
)
# This repository is intentionally C11-only in the first didactic version.
# External numerical libraries remain optional validation paths.
set(CMAKE_C_STANDARD 11)
set(CMAKE_C_STANDARD_REQUIRED ON)
set(CMAKE_C_EXTENSIONS OFF)
add_library(efg_core
src/analytical.c
src/assembly.c
src/cube_problem.c
src/dense_solver.c
src/dirichlet.c
src/error_norm.c
src/gauss.c
src/global_stiffness.c
src/gmres.c
src/lagrange_system.c
src/lapack_dense_solver.c
src/mat4.c
src/mls.c
src/mls_diagnostic.c
src/nodes.c
src/sparse_matrix.c
src/stiffness.c
src/support.c
src/vec3.c
src/weight.c
)
target_include_directories(efg_core
PUBLIC
${PROJECT_SOURCE_DIR}/include
)
if(UNIX)
target_link_libraries(efg_core PUBLIC m)
endif()
find_package(LAPACK QUIET)
if(LAPACK_FOUND)
target_compile_definitions(efg_core PUBLIC EFG_HAVE_LAPACK=1)
target_link_libraries(efg_core PUBLIC ${LAPACK_LIBRARIES})
message(STATUS "LAPACK found: enabling optional lapack-dense solver")
else()
message(STATUS "LAPACK not found: lapack-dense solver will report unavailable")
endif()
add_executable(smoke_test
apps/smoke_test.c
)
target_link_libraries(smoke_test
PRIVATE
efg_core
)
add_executable(reproduce_analytical_slice
apps/reproduce_analytical_slice.c
)
target_link_libraries(reproduce_analytical_slice
PRIVATE
efg_core
)
add_executable(reproduce_cube_smoke
apps/reproduce_cube_smoke.c
)
target_link_libraries(reproduce_cube_smoke
PRIVATE
efg_core
)
add_executable(reproduce_cube_nonuniform_smoke
apps/reproduce_cube_nonuniform_smoke.c
)
add_executable(reproduce_cube_sparse
apps/reproduce_cube_sparse.c
)
target_link_libraries(reproduce_cube_nonuniform_smoke
PRIVATE
efg_core
)
target_link_libraries(reproduce_cube_sparse
PRIVATE
efg_core
)
add_executable(test_gauss_cube
apps/test_gauss_cube.c
)
target_link_libraries(test_gauss_cube
PRIVATE
efg_core
)
add_executable(test_dirichlet_constraints
tests/test_dirichlet_constraints.c
)
target_link_libraries(test_dirichlet_constraints
PRIVATE
efg_core
)
add_executable(test_cube_problem
tests/test_cube_problem.c
)
target_link_libraries(test_cube_problem
PRIVATE
efg_core
)
add_executable(test_cube_problem_dirichlet_from_nodes
tests/test_cube_problem_dirichlet_from_nodes.c
)
target_link_libraries(test_cube_problem_dirichlet_from_nodes
PRIVATE
efg_core
)
add_executable(test_cube_problem_nonuniform
tests/test_cube_problem_nonuniform.c
)
target_link_libraries(test_cube_problem_nonuniform
PRIVATE
efg_core
)
add_executable(test_cube_problem_solve_small
tests/test_cube_problem_solve_small.c
)
target_link_libraries(test_cube_problem_solve_small
PRIVATE
efg_core
)
add_executable(test_dense_solver
tests/test_dense_solver.c
)
target_link_libraries(test_dense_solver
PRIVATE
efg_core
)
add_executable(test_gauss
tests/test_gauss.c
)
target_link_libraries(test_gauss
PRIVATE
efg_core
)
add_executable(test_global_stiffness
tests/test_global_stiffness.c
)
target_link_libraries(test_global_stiffness
PRIVATE
efg_core
)
add_executable(test_lagrange_system
tests/test_lagrange_system.c
)
target_link_libraries(test_lagrange_system
PRIVATE
efg_core
)
add_executable(test_lagrange_solve
tests/test_lagrange_solve.c
)
target_link_libraries(test_lagrange_solve
PRIVATE
efg_core
)
add_executable(test_mat4
tests/test_mat4.c
)
target_link_libraries(test_mat4
PRIVATE
efg_core
)
add_executable(test_mls_partition
tests/test_mls_partition.c
)
target_link_libraries(test_mls_partition
PRIVATE
efg_core
)
add_executable(test_mls_linear_reproduction
tests/test_mls_linear_reproduction.c
)
target_link_libraries(test_mls_linear_reproduction
PRIVATE
efg_core
)
add_executable(test_mls_gradient_partition
tests/test_mls_gradient_partition.c
)
target_link_libraries(test_mls_gradient_partition
PRIVATE
efg_core
)
add_executable(test_mls_gradient_linear_reproduction
tests/test_mls_gradient_linear_reproduction.c
)
target_link_libraries(test_mls_gradient_linear_reproduction
PRIVATE
efg_core
)
add_executable(test_stiffness_cell
tests/test_stiffness_cell.c
)
target_link_libraries(test_stiffness_cell
PRIVATE
efg_core
)
add_executable(test_error_norm
tests/test_error_norm.c
)
target_link_libraries(test_error_norm
PRIVATE
efg_core
)
add_executable(test_efg_linear_patch_solve
tests/test_efg_linear_patch_solve.c
)
target_link_libraries(test_efg_linear_patch_solve
PRIVATE
efg_core
)
add_executable(test_support
tests/test_support.c
)
target_link_libraries(test_support
PRIVATE
efg_core
)
add_executable(test_weight
tests/test_weight.c
)
target_link_libraries(test_weight
PRIVATE
efg_core
)
add_executable(test_weight_derivatives
tests/test_weight_derivatives.c
)
target_link_libraries(test_weight_derivatives
PRIVATE
efg_core
)
add_executable(test_weight_tensor3d
tests/test_weight_tensor3d.c
)
target_link_libraries(test_weight_tensor3d
PRIVATE
efg_core
)
add_executable(test_mls_diagnostic
tests/test_mls_diagnostic.c
)
target_link_libraries(test_mls_diagnostic
PRIVATE
efg_core
)
add_executable(test_sparse_matrix
tests/test_sparse_matrix.c
)
target_link_libraries(test_sparse_matrix
PRIVATE
efg_core
)
add_executable(test_sparse_global_stiffness
tests/test_sparse_global_stiffness.c
)
target_link_libraries(test_sparse_global_stiffness
PRIVATE
efg_core
)
add_executable(test_lagrange_augmented_sparse
tests/test_lagrange_augmented_sparse.c
)
target_link_libraries(test_lagrange_augmented_sparse
PRIVATE
efg_core
)
add_executable(test_gmres
tests/test_gmres.c
)
target_link_libraries(test_gmres
PRIVATE
efg_core
)
add_executable(test_lapack_dense_solver
tests/test_lapack_dense_solver.c
)
target_link_libraries(test_lapack_dense_solver
PRIVATE
efg_core
)
if(CMAKE_C_COMPILER_ID MATCHES "GNU|Clang")
target_compile_options(efg_core PRIVATE -Wall -Wextra -Wpedantic)
target_compile_options(test_mls_diagnostic PRIVATE -Wall -Wextra -Wpedantic)
target_compile_options(test_sparse_matrix PRIVATE -Wall -Wextra -Wpedantic)
target_compile_options(test_sparse_global_stiffness PRIVATE -Wall -Wextra -Wpedantic)
target_compile_options(test_lagrange_augmented_sparse PRIVATE -Wall -Wextra -Wpedantic)
target_compile_options(test_gmres PRIVATE -Wall -Wextra -Wpedantic)
target_compile_options(test_lapack_dense_solver PRIVATE -Wall -Wextra -Wpedantic)
target_compile_options(smoke_test PRIVATE -Wall -Wextra -Wpedantic)
target_compile_options(reproduce_analytical_slice PRIVATE -Wall -Wextra -Wpedantic)
target_compile_options(reproduce_cube_smoke PRIVATE -Wall -Wextra -Wpedantic)
target_compile_options(reproduce_cube_nonuniform_smoke PRIVATE -Wall -Wextra -Wpedantic)
target_compile_options(reproduce_cube_sparse PRIVATE -Wall -Wextra -Wpedantic)
target_compile_options(test_gauss_cube PRIVATE -Wall -Wextra -Wpedantic)
target_compile_options(test_dirichlet_constraints PRIVATE -Wall -Wextra -Wpedantic)
target_compile_options(test_cube_problem PRIVATE -Wall -Wextra -Wpedantic)
target_compile_options(test_cube_problem_dirichlet_from_nodes PRIVATE -Wall -Wextra -Wpedantic)
target_compile_options(test_cube_problem_nonuniform PRIVATE -Wall -Wextra -Wpedantic)
target_compile_options(test_cube_problem_solve_small PRIVATE -Wall -Wextra -Wpedantic)
target_compile_options(test_dense_solver PRIVATE -Wall -Wextra -Wpedantic)
target_compile_options(test_gauss PRIVATE -Wall -Wextra -Wpedantic)
target_compile_options(test_global_stiffness PRIVATE -Wall -Wextra -Wpedantic)
target_compile_options(test_lagrange_system PRIVATE -Wall -Wextra -Wpedantic)
target_compile_options(test_lagrange_solve PRIVATE -Wall -Wextra -Wpedantic)
target_compile_options(test_mat4 PRIVATE -Wall -Wextra -Wpedantic)
target_compile_options(test_mls_partition PRIVATE -Wall -Wextra -Wpedantic)
target_compile_options(test_mls_linear_reproduction PRIVATE -Wall -Wextra -Wpedantic)
target_compile_options(test_mls_gradient_partition PRIVATE -Wall -Wextra -Wpedantic)
target_compile_options(test_mls_gradient_linear_reproduction PRIVATE -Wall -Wextra -Wpedantic)
target_compile_options(test_stiffness_cell PRIVATE -Wall -Wextra -Wpedantic)
target_compile_options(test_error_norm PRIVATE -Wall -Wextra -Wpedantic)
target_compile_options(test_efg_linear_patch_solve PRIVATE -Wall -Wextra -Wpedantic)
target_compile_options(test_support PRIVATE -Wall -Wextra -Wpedantic)
target_compile_options(test_weight PRIVATE -Wall -Wextra -Wpedantic)
target_compile_options(test_weight_derivatives PRIVATE -Wall -Wextra -Wpedantic)
target_compile_options(test_weight_tensor3d PRIVATE -Wall -Wextra -Wpedantic)
endif()
enable_testing()
add_test(NAME smoke_test COMMAND smoke_test)
add_test(NAME test_dirichlet_constraints COMMAND test_dirichlet_constraints)
add_test(NAME test_cube_problem COMMAND test_cube_problem)
add_test(NAME test_cube_problem_dirichlet_from_nodes COMMAND test_cube_problem_dirichlet_from_nodes)
add_test(NAME test_cube_problem_nonuniform COMMAND test_cube_problem_nonuniform)
add_test(NAME test_cube_problem_solve_small COMMAND test_cube_problem_solve_small)
add_test(NAME test_dense_solver COMMAND test_dense_solver)
add_test(NAME test_error_norm COMMAND test_error_norm)
add_test(NAME test_gauss COMMAND test_gauss)
add_test(NAME test_global_stiffness COMMAND test_global_stiffness)
add_test(NAME test_lagrange_system COMMAND test_lagrange_system)
add_test(NAME test_lagrange_solve COMMAND test_lagrange_solve)
add_test(NAME test_mat4 COMMAND test_mat4)
add_test(NAME test_mls_partition COMMAND test_mls_partition)
add_test(NAME test_mls_linear_reproduction COMMAND test_mls_linear_reproduction)
add_test(NAME test_mls_gradient_partition COMMAND test_mls_gradient_partition)
add_test(NAME test_mls_gradient_linear_reproduction COMMAND test_mls_gradient_linear_reproduction)
add_test(NAME test_stiffness_cell COMMAND test_stiffness_cell)
add_test(NAME test_support COMMAND test_support)
add_test(NAME test_efg_linear_patch_solve COMMAND test_efg_linear_patch_solve)
add_test(NAME test_weight COMMAND test_weight)
add_test(NAME test_weight_derivatives COMMAND test_weight_derivatives)
add_test(NAME test_weight_tensor3d COMMAND test_weight_tensor3d)
add_test(NAME test_mls_diagnostic COMMAND test_mls_diagnostic)
add_test(NAME test_sparse_matrix COMMAND test_sparse_matrix)
add_test(NAME test_sparse_global_stiffness COMMAND test_sparse_global_stiffness)
add_test(NAME test_lagrange_augmented_sparse COMMAND test_lagrange_augmented_sparse)
add_test(NAME test_gmres COMMAND test_gmres)
add_test(NAME test_lapack_dense_solver COMMAND test_lapack_dense_solver)