Skip to content

Commit dcc5ba1

Browse files
authored
Merge pull request #234 from OpenSEMBA/dev
Merge Dev to master
2 parents 140d234 + 7cfd2e5 commit dcc5ba1

29 files changed

+6048
-4983
lines changed

.gitignore

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -68,3 +68,6 @@ testData/outputs/paul/paul_8.6_square.txt
6868
testing_hdf5_writing_and_reading.h5
6969
build
7070
fort.17
71+
72+
src_main_pub/version.F90
73+
git_info.txt

CMakeLists.txt

Lines changed: 12 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -44,9 +44,6 @@ add_definitions(
4444
-DCompileWithInt2
4545
-DCompileWithOpenMP
4646
)
47-
if (CMAKE_BUILD_TYPE STREQUAL "Debug")
48-
add_definitions(-DCompileWithDebug)
49-
endif()
5047

5148
include("${CMAKE_CURRENT_SOURCE_DIR}/set_precompiled_libraries.cmake")
5249

@@ -151,6 +148,8 @@ else()
151148
message(FATAL_ERROR "Unrecognized system name")
152149
endif()
153150

151+
# =========================================
152+
154153
add_subdirectory(external)
155154

156155
add_library(semba-types
@@ -228,6 +227,16 @@ if(SEMBA_FDTD_OUTPUTS_LIB)
228227
endif()
229228

230229
if(SEMBA_FDTD_MAIN_LIB)
230+
# Prepares variables containing information on commit-hash and build flags.
231+
# This information is only available at the configuration stage.
232+
set(PROGRAM_NAME "semba-fdtd")
233+
include("${CMAKE_CURRENT_SOURCE_DIR}/get_commit_info.cmake")
234+
configure_file(
235+
${CMAKE_SOURCE_DIR}/src_main_pub/version.F90.in
236+
${CMAKE_SOURCE_DIR}/src_main_pub/version.F90
237+
@ONLY
238+
)
239+
231240
add_library(semba-main
232241
"src_main_pub/semba_fdtd.F90"
233242
"src_main_pub/calc_constants.F90"

doc/tutorials/veritasium/closedCircuit.fdtd.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -114,6 +114,7 @@
114114
"component": "magnitude",
115115
"elementIds": [7],
116116
"domain": {
117+
"type": "time",
117118
"initialTime": 0.0,
118119
"finalTime": 2e-7,
119120
"samplingPeriod": 1.5e-10

get_commit_info.cmake

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
if(EXISTS "${CMAKE_SOURCE_DIR}/.git")
2+
# The most common situation is that code is being compiled from a git repository.
3+
# This assumes access to the git command and .git folder.
4+
find_program(GIT_EXECUTABLE git)
5+
if(GIT_EXECUTABLE)
6+
execute_process(
7+
COMMAND ${GIT_EXECUTABLE} rev-parse --short HEAD
8+
WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}
9+
OUTPUT_VARIABLE GIT_COMMIT
10+
OUTPUT_STRIP_TRAILING_WHITESPACE
11+
)
12+
endif()
13+
14+
message(STATUS "Git commit info found using git command: ${GIT_COMMIT}")
15+
elseif(EXISTS "${CMAKE_SOURCE_DIR}/git_info.txt")
16+
# git_info.txt is generated with the script write_git_info.sh
17+
# The intended use case for this is when the code is planned to be deployed
18+
# in a system which has no access to the command git and/or the .git folder.
19+
file(READ "${CMAKE_SOURCE_DIR}/git_info.txt" GIT_INFO_CONTENT)
20+
string(REGEX MATCH "GIT_COMMIT=\"([^\"]+)\"" _ "${GIT_INFO_CONTENT}")
21+
set(GIT_COMMIT "${CMAKE_MATCH_1}")
22+
23+
message(STATUS "Git commit info found in git_info.txt: ${GIT_COMMIT}")
24+
else()
25+
set(GIT_COMMIT "UNKNOWN")
26+
27+
message(STATUS "Git commit info not found, setting as ${GIT_COMMIT}")
28+
endif()

src_main_pub/errorreport.F90

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2126,7 +2126,7 @@ function openfile_mpi(layoutnumber,nombrefich) result (thefile8)
21262126
! IF (layoutnumber == 0) THEN
21272127
669 open (newunit=thefile8,file=trim(adjustl(nombrefich))//trim(adjustl(whoamishort))//'_tmp',err=667 )
21282128
goto 668
2129-
667 print *,' '//trim(adjustl(whoamishort))//' ','--> no hay cojones con open para borrar unidad ',thefile8
2129+
667 print *,' '//trim(adjustl(whoamishort))//' ','--> no se pudo borrar la unidad usando open',thefile8
21302130
call sleep(2)
21312131
goto 669
21322132
668 continue

src_main_pub/interpreta_switches.F90

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1392,12 +1392,22 @@ subroutine print_credits(l)
13921392
if (l%creditosyaprinteados) return
13931393
l%creditosyaprinteados=.true.
13941394
CALL print11 (l%layoutnumber, '=========================')
1395-
CALL print11 (l%layoutnumber, 'SEMBA-FDTD SOLVER')
1395+
CALL print11 (l%layoutnumber, program_name)
13961396
CALL print11 (l%layoutnumber, '=========================')
13971397

13981398
WRITE (dubuf,*) SEPARADOR // SEPARADOR // SEPARADOR
13991399
CALL print11 (l%layoutnumber, dubuf)
1400-
WRITE (dubuf,*) trim (adjustl(dataversion))
1400+
CALL print11 (l%layoutnumber, 'Compilation date: ' // compilation_date)
1401+
CALL print11 (l%layoutnumber, 'Compiler Id: ' // compiler_id)
1402+
CALL print11 (l%layoutnumber, 'git commit: ' // git_commit)
1403+
CALL print11 (l%layoutnumber, 'cmake build type: ' // cmake_build_type)
1404+
if (cmake_build_type == "Debug") then
1405+
CALL print11 (l%layoutnumber, 'cmake compilation flags: ' // compilation_flags_debug)
1406+
elseif(cmake_build_type == "Release") then
1407+
CALL print11 (l%layoutnumber, 'cmake compilation flags: ' // compilation_flags_release)
1408+
else
1409+
CALL print11 (l%layoutnumber, 'cmake compilation flags: ' // compilation_flags)
1410+
endif
14011411
CALL print11 (l%layoutnumber, dubuf)
14021412
WRITE (dubuf,*) SEPARADOR // SEPARADOR // SEPARADOR
14031413
CALL print11 (l%layoutnumber, dubuf)

0 commit comments

Comments
 (0)