Skip to content

Commit b297377

Browse files
Merge pull request #225 from OpenSEMBA/dev
Merge Dev into Master
2 parents e271e1d + a16bc9f commit b297377

24 files changed

+384
-267
lines changed

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,7 @@ venv/
4040
build/
4141
build-*/
4242

43+
CMakeUserPresets.json
4344
CMakeSettings.json
4445
/CppProperties.json
4546

CMakeLists.txt

Lines changed: 3 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -135,26 +135,14 @@ elseif(CMAKE_SYSTEM_NAME MATCHES "Windows")
135135
# This prevents a compilation error happening due to visual studio headers being too strict.
136136
# It can possibly can be removed in the future.
137137
add_compile_definitions("$<$<COMPILE_LANGUAGE:C,CXX>:-D_ALLOW_COMPILER_AND_STL_VERSION_MISMATCH>")
138-
138+
add_compile_options($<$<COMPILE_LANGUAGE:Fortran>:/nofpp>)
139139
set(CMAKE_CXX_FLAGS "/Qopenmp")
140-
set(CMAKE_Fortran_FLAGS "/Qopenmp /fpp")
140+
set(CMAKE_Fortran_FLAGS "/Qopenmp")
141141

142142
# Not tested
143-
144-
# set(CMAKE_Fortran_FLAGS_RELEASE "/fast")
145-
146-
set(CMAKE_CXX_FLAGS_FLAGS_DEBUG "/Qopenmp-simd- /Wno-debug-option-simd")
147-
# set(CMAKE_Fortran_FLAGS_DEBUG "/check all,nouninit /debug full -traceback")
148-
149-
elseif((CMAKE_Fortran_COMPILER_ID MATCHES "Intel"))
150-
message(STATUS "Using Intel (ifort) flags")
151-
set(CMAKE_CXX_FLAGS "/Qopenmp")
152-
153-
# Not tested
154-
# set(CMAKE_Fortran_FLAGS "/fpp /qopenmp")
155-
156143
# set(CMAKE_Fortran_FLAGS_RELEASE "/fast")
157144

145+
#set(CMAKE_CXX_FLAGS_FLAGS_DEBUG "/Qopenmp-simd- /Wno-debug-option-simd")
158146
# set(CMAKE_Fortran_FLAGS_DEBUG "/check all,nouninit /debug full -traceback")
159147
else()
160148
message(FATAL_ERROR "Unrecognized compiler id:" ${CMAKE_Fortran_COMPILER_ID})

CMakePresets.json

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
{
2+
"version": 3,
3+
"configurePresets": [
4+
{
5+
"name": "rls",
6+
"generator": "Ninja",
7+
"binaryDir": "build-rls/",
8+
"cacheVariables": {
9+
"CMAKE_BUILD_TYPE": "Release"
10+
}
11+
},
12+
{
13+
"name": "dbg",
14+
"inherits": "rls",
15+
"binaryDir": "build-dbg/",
16+
"cacheVariables": {
17+
"CMAKE_BUILD_TYPE": "Debug"
18+
}
19+
},
20+
{
21+
"name": "dbg-nomtln",
22+
"inherits": "dbg",
23+
"binaryDir": "build-dbg-nomtln/",
24+
"cacheVariables": {
25+
"SEMBA_FDTD_ENABLE_MTLN": "No"
26+
}
27+
}
28+
]
29+
}

doc/development.md

Lines changed: 37 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -138,38 +138,55 @@ Once the environment is loaded, follow the steps in the next section.
138138

139139
1. **Install necessary tools**:
140140
- Install **Intel Base Kit** and **Intel HPC Kit**.
141-
- Install Visual Studio 2019. This must be done **after** the intel Intel compilers. Visual Studio 2022 is not supported (as of Oct. 2024).
142-
- Ensure **CMake** is installed. It's recommended to use **CMake GUI** to simplify configuration on Windows.
141+
- Install Visual Studio 2022. This must be done **after** the intel Intel compilers.
142+
- Ensure **CMake** is installed.
143143

144-
2. **Generate the Project with CMake GUI**:
145-
- In **CMake GUI**, select the option to create a project for **Visual Studio 2019** from the CMake files.
146-
- Set `-T fortran=ifx` to use intelLLVM compiler.
147-
- Specify the output folder where the `.sln` file for the project will be generated.
144+
3. **Open a terminal with the Intel One API variables loaded**:
145+
- Launch Visual Studio 2022 with
146+
```
147+
"C:\Program Files\Microsoft Visual Studio\2022\Community\Common7\IDE\devenv.exe"
148+
```
149+
- Open the opensemba/fdtd cloned repo as a folder.
148150
149-
3. **Open the Project in Visual Studio**:
150-
- Open the generated `.sln` file in Visual Studio 2019.
151-
- You will see multiple projects in the solution, one for each library and executable.
152151
153-
4. **Compilation Configuration**:
154-
- You may encounter specific errors in the **fdtd-tests** projects during compilation, particularly related to the `/Mtd` or `/MD` options.
155-
- To resolve this issue:
156-
- Right-click on the problematic project (`fdtd_tests`) and select **Properties**.
157-
- Go to **Code Generation** and change the corresponding option to `/Mtd`.
158-
159-
5. **Set the Main Project**:
160-
- Select the `semba-fdtd` project and set it as the main project.
152+
4. **Ensure cmake has nofpp option**:
153+
- The following command
154+
```
155+
add_compile_options($<$<COMPILE_LANGUAGE:Fortran>:/nofpp>)
156+
```
157+
must be present in CMakeLists.txt due to an issue https://gitlab.kitware.com/cmake/cmake/-/issues/21816
161158
162159
6. **Debugger Configuration**:
163-
- In the project properties, go to the **Debugger** section.
160+
- Select your current build as start up item
161+
- In Debug options, open `Debug and launch settings` for your start up item
164162
- Configure the following parameters:
165163
- **Working Directory**: Set the working directory based on the case you want to debug.
166164
- **Command Arguments**: Enter `-i filename` (where `filename` is the required input file).
165+
You should end up with something like this.
166+
```
167+
{
168+
"configurations": [
169+
{
170+
"type": "default",
171+
"project": "CMakeLists.txt",
172+
"projectTarget": "semba-fdtd.exe (bin\\semba-fdtd.exe)",
173+
"name": "semba-fdtd.exe (bin\\semba-fdtd.exe)",
174+
"currentDir": "<root-folder>\\tmp_cases\\coated_antenna",
175+
"args": [
176+
"-i",
177+
"coated_antenna.fdtd.json",
178+
"-mtlnwires"
179+
]
180+
}
181+
],
182+
"defaults": {},
183+
"version": "0.2.1"
184+
}
185+
```
167186
168187
7. **Debug the Project**:
169188
- Launch the project by pressing **F5** to begin debugging.
170189
171-
Following these steps, the project should be set up and ready to compile and debug in Visual Studio 2019 with Intel tools.
172-
173190
## WSL2 + Visual Studio Code + GFortran Setup Guide
174191
175192
### Prerequisites

src_json_parser/parser_tools.F90

Lines changed: 9 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
module parser_tools_mod
2-
2+
33
#ifdef CompileWithSMBJSON
44
use mesh_mod
55
use cells_mod
@@ -23,10 +23,6 @@ module parser_tools_mod
2323
integer :: cId
2424
type(coordinate_t) :: relPos
2525
end type
26-
27-
! type :: cable_ptr_t
28-
! type(cable_t), pointer :: p
29-
! end type
3026
#endif
3127

3228
contains
@@ -42,11 +38,11 @@ function getIntervalsInCellRegions(cellRegions, cellType) result (intervals)
4238
do i = 1, size(cellRegions)
4339
if (present(cellType)) then
4440
numberOfIntervals = numberOfIntervals + count(cellRegions(i)%intervals%getType() == cellType)
45-
else
41+
else
4642
numberOfIntervals = numberOfIntervals + size(cellRegions(i)%intervals)
4743
end if
4844
end do
49-
45+
5046
allocate(intervals(numberOfIntervals))
5147
copiedIntervals = 0
5248
do i = 1, size(cellRegions)
@@ -57,12 +53,12 @@ function getIntervalsInCellRegions(cellRegions, cellType) result (intervals)
5753
end if
5854
do j = 1, size(intervalsInRegion)
5955
copiedIntervals = copiedIntervals + 1
60-
intervals(copiedIntervals) = intervalsInRegion(j)
56+
intervals(copiedIntervals) = intervalsInRegion(j)
6157
end do
6258
end do
6359

6460
end function
65-
61+
6662
function cellRegionToCoords(cellRegion, cellType, tag) result(res)
6763
type(cell_region_t), intent(in) :: cellRegion
6864
integer, intent(in), optional :: cellType
@@ -75,7 +71,7 @@ function cellRegionToCoords(cellRegion, cellType, tag) result(res)
7571
intervals = getIntervalsInCellRegions([cellRegion], cellType)
7672
if (present(tag)) then
7773
cs = cellIntervalsToCoords(intervals, tag)
78-
else
74+
else
7975
cs = cellIntervalsToCoords(intervals)
8076
endif
8177
res = cs
@@ -115,7 +111,7 @@ function coordsToScaledCoords(cs) result(res)
115111
res(i)%zc = -1.0
116112
end select
117113
end do
118-
end
114+
end
119115

120116
subroutine cellRegionsToScaledCoords(res, cellRegions, tag)
121117
type(coords_scaled), dimension(:), pointer :: res
@@ -124,7 +120,7 @@ subroutine cellRegionsToScaledCoords(res, cellRegions, tag)
124120
type(coords), dimension(:), allocatable :: cs
125121
type(coords_scaled), dimension(:), allocatable :: scaledCoords
126122
character (LEN=BUFSIZE), optional, intent(in) :: tag
127-
123+
128124
intervals = getIntervalsInCellRegions(cellRegions, CELL_TYPE_LINEL)
129125
if (present(tag)) then
130126
cs = cellIntervalsToCoords(intervals, tag)
@@ -160,7 +156,7 @@ subroutine convertInterval(xi, xe, interval, dir)
160156
type(cell_interval_t), intent(in) :: interval
161157
integer, intent(in) :: dir
162158
integer :: a, b
163-
a = interval%ini%cell(dir)
159+
a = interval%ini%cell(dir)
164160
b = interval%end%cell(dir)
165161
if (a < b) then
166162
xi = a

src_main_pub/anisotropic.F90

Lines changed: 3 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,7 @@ subroutine InitAnisotropic(sgg,media,ThereAreAnisotropic,ThereAreThinSlot,eps00,
7373
logical, INTENT(OUT) :: ThereAreAnisotropic,ThereAreThinSlot
7474
integer (kind=4) :: jmed,j1,conta,k1,i1,tempindex
7575

76-
eps0=eps00; mu0=mu00; !chapuz para convertir la variables de paso en globales
76+
eps0=eps00; mu0=mu00;
7777

7878
!!!
7979

@@ -318,10 +318,8 @@ subroutine InitAnisotropic(sgg,media,ThereAreAnisotropic,ThereAreThinSlot,eps00,
318318
(sgg%Eshared%elem(j1)%Field == iEx)) then
319319
AniMed%info(jmed)%Ex_Shared(i1)%times = sgg%Eshared%elem(j1)%Times
320320
if (sgg%Eshared%elem(j1)%Times > 1 ) then
321-
allocate (AniMed%info(jmed)%Ex_Shared(i1)%SharedMed(1:sgg%Eshared%elem(j1)%Times)) !OJO, EN EL ORIGINAL LO ALLOCATEABA HASTA -1
322-
!LO CAMBIO EL 26/10 POR ERROR EN LA NACELLE DEL SS5, PERO NO ESTOY SEGURO QUE HAYA UN BUG CON ESTO DE LOS SHARED !!?
321+
allocate (AniMed%info(jmed)%Ex_Shared(i1)%SharedMed(1:sgg%Eshared%elem(j1)%Times))
323322
endif
324-
!PRINT *,'---> eX',sgg%Eshared%elem(j1)%i,sgg%Eshared%elem(j1)%J,sgg%Eshared%elem(j1)%k,sgg%Eshared%elem(j1)%times
325323
exit buscaEx
326324
endif
327325
end do
@@ -337,7 +335,6 @@ subroutine InitAnisotropic(sgg,media,ThereAreAnisotropic,ThereAreThinSlot,eps00,
337335
if (sgg%Eshared%elem(j1)%Times > 1 ) then
338336
allocate (AniMed%info(jmed)%Ey_Shared(i1)%SharedMed(1:sgg%Eshared%elem(j1)%Times))
339337
endif
340-
!PRINT *,'---> ey',sgg%Eshared%elem(j1)%i,sgg%Eshared%elem(j1)%J,sgg%Eshared%elem(j1)%k,sgg%Eshared%elem(j1)%times
341338
exit buscaEy
342339
endif
343340
end do
@@ -412,9 +409,7 @@ subroutine InitAnisotropic(sgg,media,ThereAreAnisotropic,ThereAreThinSlot,eps00,
412409
end do
413410

414411
!STORE THE INDEXES OF THE SHARED MEDIA
415-
416-
417-
do jmed=1,AniMed%NumMed !barrelos ahora todos
412+
do jmed=1,AniMed%NumMed
418413
do i1=1,AniMed%info(jmed)%NumNodesEx
419414
conta=0
420415
do j1=1,sgg%Eshared%conta

src_main_pub/electricdispersive.F90

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,12 @@
11

22

33
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
4-
! Module EDispersives !ojo los polos conjugados DEBEN APARECER explicitamente 20JUNE'12
4+
! Module EDispersives !ojo los polos conjugados DEBEN APARECER explicitamente
55
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
66
! Beware in Dutton's model BOTH pair OF complex conjugate poles/residues
77
! in input from .nfde MUST APPEAR (this is why the factor /2 in the algorithm part
88
! for instance a 1 real-pole and 2 ccomplex-pole material would require in nfde
9-
! 5 poles (not 3) !UNTESTED SGG JUN'12
9+
! 5 poles (not 3)
1010
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
1111

1212
module EDispersives

src_main_pub/fdetypes.F90

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -656,7 +656,7 @@ module FDETYPES
656656
groundwires,noSlantedcrecepelo, &
657657
mibc,ADE,conformalskin,sgbc, sgbcDispersive, sgbccrank, &
658658
NOcompomur,strictOLD,TAPARRABOS, &
659-
noconformalmapvtk, hopf,experimentalVideal, &
659+
noconformalmapvtk, experimentalVideal, &
660660
forceresampled, mur_second,MurAfterPML, &
661661
stableradholland,singlefilewrite,NF2FFDecim, &
662662
fieldtotl,finishedwithsuccess, &
@@ -672,7 +672,7 @@ module FDETYPES
672672
real (kind=rkind_wires) :: factorradius,factordelta
673673

674674
character (len=BUFSIZE) :: nEntradaRoot, inductance_model,wiresflavor, nresumeable2
675-
CHARACTER (LEN=BUFSIZE) :: opcionestotales, ficherohopf
675+
CHARACTER (LEN=BUFSIZE) :: opcionestotales
676676

677677
integer (kind=4) :: finaltimestep, flushsecondsFields,flushsecondsData, layoutnumber,&
678678
mpidir, inductance_order, wirethickness, maxCPUtime, SGBCDepth, precision, size

src_main_pub/getargs.F90

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11

2-
2+
33
Module Getargs
44
USE NFDETYPES , ONLY: BUFSIZE
55
implicit none
6-
private
6+
private
77

88
public getBinaryPath, getcommandargument,commandargumentcount
99

@@ -23,18 +23,18 @@ subroutine getcommandargument(chain2,posic,argum,length,status, binaryPath)
2323

2424
! CALL getarg(0, binaryPath)
2525
binaryPathLenght = len(trim(adjustl(binaryPath)))
26-
26+
2727
!!Check if binary path is surrounded by double quotes. In that case, returns corrected binary path and lenght
2828
if ((chain2(1:1) == '"') .and. (chain2(binaryPathLenght+2 : binaryPathLenght+2) == '"')) then
29-
binaryPath = '"' // trim(adjustl(binaryPath)) // '"'
30-
binaryPathLenght = binaryPathLenght + 2
29+
binaryPath = '"' // trim(adjustl(binaryPath)) // '"'
30+
binaryPathLenght = binaryPathLenght + 2
3131
end if
3232

33-
if (posic == 1) then
33+
if (posic == 1) then
3434
argum = binaryPath
3535
return
3636
end if
37-
37+
3838
status=0
3939
argumentStart=0
4040
argumentEnd=0
@@ -59,7 +59,7 @@ subroutine getcommandargument(chain2,posic,argum,length,status, binaryPath)
5959
if (argumentStart+argumentEnd==0) status=1
6060
argum=trim(adjustl(chain2(argumentStart : argumentEnd)))
6161

62-
!100615 para evitar el crlf del .sh
62+
!Avoids crlf in .sh
6363
if ( (argum(1:1) ==char(10)) .or. (argum(1:1) ==char(13)) .or. (argum(1:1)==char( 0)) ) then
6464
argum=''
6565
return
@@ -82,8 +82,8 @@ subroutine removeDoubleWhiteSpaces(chain2)
8282
end do rebus
8383
endif
8484
end do
85-
86-
end subroutine
85+
86+
end subroutine
8787

8888
function commandargumentcount(chain2, binaryPath)
8989
character (LEN=BUFSIZE) :: chain2, binaryPath
@@ -93,19 +93,19 @@ function commandargumentcount(chain2, binaryPath)
9393

9494
! CALL getarg(0, binaryPath)
9595
binaryPathLenght = len(trim(adjustl(binaryPath)))
96-
96+
9797
!!Check if binary path is surrounded by double quotes. In that case, returns corrected binary path and lenght
9898
if ((chain2(1:1) == '"') .and. (chain2(binaryPathLenght+2 : binaryPathLenght+2) == '"')) then
99-
binaryPath = '"' // trim(adjustl(binaryPath)) // '"'
100-
binaryPathLenght = binaryPathLenght + 2
99+
binaryPath = '"' // trim(adjustl(binaryPath)) // '"'
100+
binaryPathLenght = binaryPathLenght + 2
101101
end if
102102

103103
n = 1
104104

105105
do i=binaryPathLenght ,len(trim(adjustl(chain2)))
106106
if (chain2(i : i)==' ') then
107107
n=n+1
108-
endif
108+
endif
109109
end do
110110

111111
status=0

0 commit comments

Comments
 (0)