-
Notifications
You must be signed in to change notification settings - Fork 11
/
CMakeLists.txt
360 lines (330 loc) · 10.3 KB
/
CMakeLists.txt
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
cmake_minimum_required(VERSION 3.12)
project (AMPE C CXX Fortran)
set(CMAKE_CXX_STANDARD 11)
set(CMAKE_CXX_STANDARD_REQUIRED ON)
set(CMAKE_CXX_EXTENSIONS OFF)
set(CMAKE_MODULE_PATH ${CMAKE_SOURCE_DIR}/cmake_modules)
find_package(MPI)
if(MPI_FOUND)
message(STATUS
"MPI was found:\n"
" MPI_CXX_COMPILER: ${MPI_CXX_COMPILER}\n"
" MPIEXEC_NUMPROC_FLAG: ${MPIEXEC_NUMPROC_FLAG}\n"
" MPIEXEC_MAX_NUMPROCS: ${MPIEXEC_MAX_NUMPROCS}\n"
" MPIEXEC: ${MPIEXEC}\n"
)
endif()
if(DEFINED MPI_EXEC)
set(MPIEXEC ${MPI_EXEC})
endif()
message(STATUS "MPIEXEC: ${MPIEXEC}\n")
set(HDF5_USE_STATIC_LIBRARIES ON)
find_package(HDF5 COMPONENTS C HL REQUIRED)
message(STATUS ${HDF5_VERSION} )
include_directories(${HDF5_INCLUDE_DIR})
message(STATUS "hdf5 libraries: ${HDF5_LIBRARIES}")
set(PROJECT_LINK_LIBS_HDF5 ${HDF5_HL_LIBRARIES} ${HDF5_LIBRARIES})
message(STATUS "hdf5 libraries: ${PROJECT_LINK_LIBS_HDF5}")
find_package(PkgConfig REQUIRED)
pkg_check_modules(NetCDF netcdf-cxx4 IMPORTED_TARGET)
if(NetCDF_FOUND)
message(STATUS "NETCDF link flags: ${NetCDF_LDFLAGS}")
set(PROJECT_LINK_LIBS_NETCDF ${NetCDF_LDFLAGS})
message(STATUS "NETCDF include directory: ${NetCDF_INCLUDE_DIRS}")
include_directories(${NetCDF_INCLUDE_DIRS})
else()
find_package(NetCDF REQUIRED COMPONENTS CXX)
set( PROJECT_LINK_LIBS_NETCDF NetCDF::NetCDF_CXX )
endif()
find_package(Boost)
if(Boost_FOUND)
include_directories(${Boost_INCLUDE_DIRS})
endif()
# gpu offload (optional)
set(GPU_OFFLOAD FALSE CACHE BOOL "GPU offload")
if(${GPU_OFFLOAD})
add_definitions(-DGPU_OFFLOAD)
endif()
# clang-format (optional)
set(AMPE_WITH_CLANG_FORMAT FALSE CACHE BOOL "Indent code with clang-format")
if(${AMPE_WITH_CLANG_FORMAT})
find_program(CLANG_FORMAT_EXECUTABLE
NAMES clang-format
DOC "clang-format executable")
mark_as_advanced(CLANG_FORMAT_EXECUTABLE)
if(CLANG_FORMAT_EXECUTABLE)
message(STATUS "Indent with clang-format")
file(GLOB_RECURSE FORMAT_SOURCES source/*.cc source/*.h
tests/*.cc tests/*.h
drivers/*.cc drivers/*.h)
add_custom_target(format
COMMAND ${CLANG_FORMAT_EXECUTABLE} -i -style=file ${FORMAT_SOURCES}
DEPENDS ${FORMAT_SOURCES})
endif(CLANG_FORMAT_EXECUTABLE)
endif()
include(FortranCInterface)
FortranCInterface_HEADER(
fc_samrai_mangle.h
MACRO_NAMESPACE "FC_SAMRAI_"
SYMBOLS
ADJUSTRHS2D
ADJUSTRHS3D
ADJBDRYCONSTOFFDIAGS2D
COMPDIAGVARIABLEC2D
COMPDIAGVARIABLEC3D
COMPDIAGSCALARC2D
COMPDIAGSCALARC3D
COMPDIAGZEROC2D
COMPDIAGZEROC3D
MULTIPLYOFFDIAGBYM
EFO_COMPFLUXVARDC2D
EFO_RBGSWITHFLUXMAXVARDCVARSF2D
EFO_RBGSWITHFLUXMAXCONDCVARSF2D
EFO_RBGSWITHFLUXMAXVARDCCONSF2D
EFO_RBGSWITHFLUXMAXCONDCCONSF2D
EFO_COMPRESVARSCA2D
EFO_COMPRESCONSCA2D
ACCUMOPVARSCA2D
ACCUMOPCONSCA2D
EFO_EWINGFIXFLUXVARDC2D
EFO_EWINGFIXFLUXCONDC2D
EFO_COMPFLUXVARDC3D
EFO_RBGSWITHFLUXMAXVARDCVARSF3D
EFO_RBGSWITHFLUXMAXCONDCVARSF3D
EFO_RBGSWITHFLUXMAXVARDCCONSF3D
EFO_RBGSWITHFLUXMAXCONDCCONSF3D
EFO_COMPRESVARSCA3D
EFO_COMPRESCONSCA3D
ACCUMOPVARSCA3D
ACCUMOPCONSCA3D
EFO_EWINGFIXFLUXVARDC3D
EFO_EWINGFIXFLUXCONDC3D
)
FortranCInterface_HEADER(
fc_functions_mangle.h
MACRO_NAMESPACE "FC_FUNCTIONS_"
SYMBOLS
WELL_FUNC
DERIV_WELL_FUNC
SECOND_DERIV_WELL_FUNC
INTERP_FUNC
DERIV_INTERP_FUNC
SECOND_DERIV_INTERP_FUNC
AVERAGE_FUNC
DERIV_AVERAGE_FUNC
INTERP_RATIO_FUNC
COMPL_INTERP_RATIO_FUNC
DERIV_TRIPLE_WELL_FUNC
)
FortranCInterface_HEADER(
fc_internal_mangle.h
MACRO_NAMESPACE "FC_INTERNAL_"
SYMBOLS
AB_DIFFUSION_OF_TEMPERATURE
ADD_AB_DIFFUSION
ADD_AB_DIFFUSION_SINGLE
ADD_AB_DIFFUSION_OF_TEMPERATURE_SINGLE
ADD_DIFFUSION_SCALAR_OF_TEMPERATURE
ADD_CAHNHILLIARDDOUBLEWELL_FLUX
ADD_WANG_SINTERING_FLUX
CONCENTRATION_PFMDIFFUSION_SCALAR
CONCENTRATION_PFMDIFFUSION_SCALAR_2PHASES
CONCENTRATION_PFMDIFFUSION_SCALAR_3PHASES
CONCENTRATIONFLUX
ADD_FLUX
ADD_FLUX_ISO
ADD_FLUX_4TH
ADDRBMOTION
CONCENTRATIONFLUX_SPINODAL
CONCENTRATION_PFMDIFFUSION
CONCENTRATION_PFMDIFFUSION_THREEPHASES
CONCENTRATION_PFMDIFFUSION_OF_TEMPERATURE
CONCENTRATION_PFMDIFFUSION_OF_TEMPERATURE_THREEPHASES
CONCENTRATION_PFMDIFFUSION_OF_TEMPERATURE_MULTIPHASES
CONCENTRATION_DIFFCOEFF_OF_TEMPERATURE
CONCENTRATIONDIFFUSION_BECKERMANN
COMPUTERHSCONCENTRATION
PHASERHS_FENERGY
PHASERHS_FENERGY_MULTIORDERP
PHIPHI_INTERFACIALENERGY
PHIPHI_FORCES
WANG_FORCES
ETARHS_FENERGY
CALPHAD_CONC_SOLV_THREE
CALPHAD_CONC_SOLV_TWO
CALPHAD_CONC_CEQ_TWO
ADDCONCENTRATIONFLUXFROMGRADT
ADDCONCENTRATIONFLUXFROMANTITRAPPING
ADDCONCENTRATIONFLUXFROMANTITRAPPING3PHASES
ADDCONCENTRATIONFLUXFROMANTITRAPPINGMULTIORDERP
INITGAUSSIAN
INITGRADIENT
INITGAUSSIANSOURCE
LINEARMELTINGLINE
COMPUTE_CONCENTRATION_FROM_PHASE_CONCENTRATIONS
SINGLE_INDEX_STIFFNESS
STORAGE_INDEX_STIFFNESS
SINGLE_INDEX_STIFFNESS
STORAGE_INDEX_STIFFNESS
GRADIENT_FLUX
COMPUTE_FLUX_ISOTROPIC
ANISOTROPIC_GRADIENT_FLUX
COMPUTERHSPBG
COMPUTERHSTHREEPHASES
COMPUTERHSMULTIORDER
COMPUTERHS_WANG_SINTERING
ADDVDPHIDX
ADDVDPHIDX_UPWIND3
COMPUTERHSTEMP
COMPUTERHSBIASWELL
COMPUTERHSBIASWELLBECKERMANN
COMPUTERHSDELTATEMPERATURE
COMPUTERHSETA
DIFFS
GRAD_CELL
GRAD_SIDE
GRAD_SIDE_ISOTROPIC
QUAT_SYMM_ROTATION
QUAT_FUNDAMENTAL
QUATDIFFS
QUATDIFFS_SYMM
QUATGRAD_CELL
QUATGRAD_CELL_SYMM
QUATGRAD_SIDE
QUATGRAD_SIDE_SYMM
QUATGRAD_SIDE_SYMM_ISOTROPIC
QUATGRAD_SIDE_ISOTROPIC
QUATGRAD_MODULUS
QUATGRAD_MODULUS_FROM_SIDES
QUATGRAD_MODULUS_FROM_SIDES_COMPACT
QUATDIFFUSION
QUATDIFFUSIONDERIV
CORRECTRHSQUATFORSYMMETRY
TAGFROMGRADS
TAGFROMQUATGRADS
QUATMOBILITY
QUATMOBILITYDERIV
QUATENERGY
BULKENERGY
TEMPERATURE_ENERGY
QUATAVG
SMOOTHQUAT
SETTOZERO
SOURCE_TEMPERATURE
HEAT_CAPACITY_NKR
VELOCITY
COMPUTE_FACE_COEF2D
COMPUTE_FACE_COEF3D
COMPUTE_DQUATDPHI_FACE_COEF2D
COMPUTE_DQUATDPHI_FACE_COEF3D
COMPUTE_FLUX2D
COMPUTE_FLUX3D
COMPUTE_FLUX2D_FROM_GRADQ
COMPUTE_FLUX3D_FROM_GRADQ
COMPUTE_SYM_FLUX2D
COMPUTE_SYM_FLUX3D
COMPUTE_Q_RESIDUAL2D
COMPUTE_Q_RESIDUAL3D
COMPUTE_Q_RESIDUAL2D_SYMM
COMPUTE_Q_RESIDUAL3D_SYMM
ADD_QUAT_OP2D
ADD_QUAT_OP3D
ADD_QUAT_PROJ_OP2D
ADD_QUAT_PROJ_OP3D
ADD_QUAT_PROJ_OP2D_SYMM
ADD_QUAT_PROJ_OP3D_SYMM
COMPUTE_LAMBDA_FLUX2D
COMPUTE_LAMBDA_FLUX3D
COMPUTE_LAMBDA_FLUX2D_SYMM
COMPUTE_LAMBDA_FLUX3D_SYMM
FIXFLUX2D
FIXFLUX3D
PROJECT2D
PROJECT3D
PROJECTPHI2D
PROJECTPHI3D
TAKE_SQUARE_ROOT2D
TAKE_SQUARE_ROOT3D
MULTICOMPONENT_MULTIPLY2D
MULTICOMPONENT_MULTIPLY3D
MULTICOMPONENT_DIVIDE2D
MULTICOMPONENT_DIVIDE3D
QUATLINREFINE2D
QUATLINREFINE3D
SET_J_IJ2D
SET_J_IJ3D
SET_STENCIL2D
SET_STENCIL3D
SET_SYMMETRIC_STENCIL2D
SET_SYMMETRIC_STENCIL3D
SIDE2CELL
COPY2D
COPY3D
ADJUST_BDRY2D
ADJUST_BDRY3D
ADJUST_QRHS2D
ADJUST_QRHS3D
QUATCOARSEN
COMPUTEDPHIDTEMPERATUREDELTATEMPERATURE
)
message(STATUS "Use THERMO4PFM...")
message(STATUS "THERMO4PFM_DIR = ${THERMO4PFM_DIR}")
set( PROJECT_LINK_LIBS_THERMO4PFM libthermo4pfm.a)
link_directories( ${THERMO4PFM_DIR}/lib )
include_directories( ${THERMO4PFM_DIR}/include )
if(${WITH_TLOGT4L})
add_definitions(-DMAX_POL_T_INDEX=3)
else()
add_definitions(-DMAX_POL_T_INDEX=2)
endif(${WITH_TLOGT4L})
include_directories( source/samrai)
set(internal_samrai ampe_samrai)
include_directories("${CMAKE_CURRENT_BINARY_DIR}")
link_directories( ${SAMRAI_DIR}/lib )
if(EXISTS ${HYPRE_DIR}/lib64)
link_directories( ${HYPRE_DIR}/lib64 )
else()
link_directories( ${HYPRE_DIR}/lib )
endif()
if(EXISTS ${SUNDIALS_DIR}/lib64)
link_directories( ${SUNDIALS_DIR}/lib64 )
else()
link_directories( ${SUNDIALS_DIR}/lib )
endif()
list(APPEND CMAKE_MODULE_PATH "${CMAKE_CURRENT_LIST_DIR}/cmake_modules")
set( PROJECT_LINK_LIBS1 libSAMRAI_tbox.a )
set( PROJECT_LINK_LIBS2 libSAMRAI_math.a )
set( PROJECT_LINK_LIBS3 libSAMRAI_hier.a )
set( PROJECT_LINK_LIBS4 libSAMRAI_pdat.a )
set( PROJECT_LINK_LIBS5 libSAMRAI_xfer.a )
set( PROJECT_LINK_LIBS6 libSAMRAI_geom.a )
set( PROJECT_LINK_LIBS7 libSAMRAI_mesh.a )
set( PROJECT_LINK_LIBS8 libSAMRAI_solv.a )
set( PROJECT_LINK_LIBS9 libSAMRAI_appu.a )
set( PROJECT_LINK_LIBS_SAMRAI ${PROJECT_LINK_LIBS9}
${PROJECT_LINK_LIBS8}
${PROJECT_LINK_LIBS7}
${PROJECT_LINK_LIBS6}
${PROJECT_LINK_LIBS5}
${PROJECT_LINK_LIBS4}
${PROJECT_LINK_LIBS3}
${PROJECT_LINK_LIBS2}
${PROJECT_LINK_LIBS1} )
set( PROJECT_LINK_LIBS_HYPRE libHYPRE.so )
message(STATUS "Link with Sundials...")
set( PROJECT_LINK_LIBS_CVODE libsundials_cvode.a )
include_directories( ${SAMRAI_DIR}/include )
include_directories( ${HYPRE_DIR}/include )
include_directories( ${SUNDIALS_DIR}/include )
include_directories( source/fortran )
enable_testing()
add_definitions(-DNDIM=${NDIM})
enable_language(Fortran C CXX)
set(CMAKE_CXX_FLAGS_DEBUG "-O0 -g -std=c++11")
if(CMAKE_C_COMPILER_ID STREQUAL "XL")
set( CMAKE_CXX_FLAGS_RELEASE "-O -DNDEBUG")
message(STATUS "Override C++ release flags: ${CMAKE_CXX_FLAGS_RELEASE}\n")
endif()
add_subdirectory(source)
add_subdirectory(drivers)
add_subdirectory(tests)