Skip to content

Commit 426e6f0

Browse files
authored
Merge pull request #467 from PrincetonUniversity/issue-463
Issue 463 -- Making header files configuration files
2 parents 3a02a2b + ef4828c commit 426e6f0

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

53 files changed

+1677
-1749
lines changed

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,3 +30,4 @@ profiles
3030
.cache/
3131
test*.cpp
3232
test*.hpp
33+
include/specfem_setup.hpp

CMakeLists.txt

Lines changed: 32 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
cmake_minimum_required(VERSION 3.17.5)
22

3-
project(SPECFEMPP VERSION 0.1.0)
3+
project(SPECFEMPP VERSION 0.1.0 LANGUAGES CXX Fortran)
44

55
set(CMAKE_CXX_STANDARD 17)
66
option(HDF5_CXX_BUILD "Build HDF5 C++" ON)
@@ -11,6 +11,8 @@ option(BUILD_EXAMPLES "Examples included" ON)
1111
option(ENABLE_SIMD "Enable SIMD" OFF)
1212
option(ENABLE_PROFILING "Enable profiling" OFF)
1313
option(SPECFEMPP_BINDING_PYTHON "Enable Python binding" OFF)
14+
option(ENABLE_DOUBLE_PRECISION "Enable double precision" OFF)
15+
1416
# set(CMAKE_BUILD_TYPE Release)
1517
set(CHUNK_SIZE 32)
1618
set(NUM_CHUNKS 1)
@@ -158,14 +160,6 @@ else()
158160
endif()
159161

160162

161-
configure_file(constants.hpp.in constants.hpp)
162-
163-
include_directories(include)
164-
include_directories(${CMAKE_BINARY_DIR})
165-
166-
add_subdirectory(fortran/meshfem2d)
167-
add_subdirectory(fortran/meshfem3d)
168-
169163
if (ENABLE_SIMD)
170164
message("-- Enabling SIMD")
171165
add_definitions(-DENABLE_SIMD)
@@ -176,6 +170,30 @@ if (ENABLE_PROFILING)
176170
add_definitions(-DENABLE_PROFILING)
177171
endif()
178172

173+
if (ENABLE_DOUBLE_PRECISION)
174+
message("-- Enabling double precision")
175+
set(TYPE_REAL "double")
176+
else(ENABLE_DOUBLE_PRECISION)
177+
message("-- Enabling single precision")
178+
set(TYPE_REAL "float")
179+
endif(ENABLE_DOUBLE_PRECISION)
180+
181+
# Configure the setup headers
182+
configure_file(${CMAKE_CURRENT_SOURCE_DIR}/setup/specfem_setup.hpp.in
183+
${CMAKE_BINARY_DIR}/include/specfem_setup.hpp)
184+
configure_file(${CMAKE_CURRENT_SOURCE_DIR}/setup/constants.hpp.in
185+
${CMAKE_BINARY_DIR}/include/constants.hpp)
186+
187+
# Add the include directories so that the generated files can be found
188+
include_directories(include)
189+
include_directories(${CMAKE_BINARY_DIR}/include)
190+
191+
# ========== MESHFEM ==============
192+
add_subdirectory(fortran/meshfem2d)
193+
add_subdirectory(fortran/meshfem3d)
194+
# =================================
195+
196+
179197
# Build specfem2d libraries
180198
add_library(
181199
quadrature
@@ -206,6 +224,8 @@ add_library(
206224
src/IO/mesh/impl/fortran/dim2/read_parameters.cpp
207225
# Fortran 3D part
208226
src/IO/mesh/impl/fortran/dim3/read_parameters.cpp
227+
src/IO/mesh/impl/fortran/dim3/read_mapping.cpp
228+
src/IO/mesh/impl/fortran/dim3/read_coordinates.cpp
209229
)
210230

211231
if (NOT HDF5_CXX_BUILD)
@@ -307,6 +327,9 @@ add_library(
307327
src/mesh/coupled_interfaces/interface_container.cpp
308328
src/mesh/coupled_interfaces/coupled_interfaces.cpp
309329
src/mesh/tags/tags.cpp
330+
src/mesh/parameters/parameters.cpp
331+
src/mesh/mapping/mapping.cpp
332+
src/mesh/coordinates/coordinates.cpp
310333
src/mesh/mesh.cpp
311334
)
312335

docs/developer_documentation/SPECFEM_architecture/architecture.rst

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,3 +29,7 @@ The code is divided into set of modules (classes and structs), the major of whic
2929
mesh
3030
compute
3131
domain
32+
33+
34+
35+
CUSTOM_REAL

fortran/meshfem2d/.gitignore

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
config.h
2+
constants.h
3+
precision.h
4+
config.fh
5+
version.fh

0 commit comments

Comments
 (0)