Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -76,3 +76,5 @@ git_info.txt

.venv/build2/
build2/

.venv/
10 changes: 10 additions & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ option(SEMBA_FDTD_ENABLE_SMBJSON "Use smbjson" ON)
option(SEMBA_FDTD_ENABLE_DOUBLE_PRECISION "Use double precision (CompileWithReal8)" OFF)

option(SEMBA_FDTD_ENABLE_TEST "Compile tests" ON)
option(SEMBA_FDTD_ENABLE_COVERAGE "Enable gcov coverage instrumentation (GNU only)" OFF)

option(SEMBA_FDTD_ENABLE_INTEL_XHOST_OPTIMIZATION "When compiling in Release, enables the -xHost optimization flag (not supported in github actions)" OFF)
option(SEMBA_FDTD_ENABLE_INTEL_IPO "When compiling in Release, enables the interprocedural optimization" OFF)
Expand Down Expand Up @@ -68,6 +69,15 @@ if (CMAKE_SYSTEM_NAME MATCHES "Linux")
set(CMAKE_CXX_FLAGS_DEBUG "-g -O0")
set(CMAKE_Fortran_FLAGS_DEBUG "-g -O0 -fno-inline -fcheck=all -fbacktrace")

if(SEMBA_FDTD_ENABLE_COVERAGE)
message(STATUS "Enabling coverage instrumentation")
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} --coverage")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} --coverage")
set(CMAKE_Fortran_FLAGS "${CMAKE_Fortran_FLAGS} --coverage")
set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} --coverage")
set(CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} --coverage")
endif()

elseif(CMAKE_Fortran_COMPILER_ID MATCHES "IntelLLVM")
message(STATUS "Using IntelLLVM (ifx) flags")

Expand Down
2 changes: 1 addition & 1 deletion external/ngspice
2 changes: 1 addition & 1 deletion src_main_pub/healer.F90
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ module CreateMatrices_m
& 0, 0,-1, 0, 0, 0,-1,-1, 0,-1, 0,-1, 0,-1, 0, 0, &
-1,-1,-1, 0 /), (/ 6, 3, 2 /))
!
public CreatePMLmatrix, Readjust
public CreatePMLmatrix, Readjust, SortInitEndWithIncreasingOrder
public CreateVolumeMM, CreateSurfaceMM, CreateLineMM
public CreateSurfaceSlotMM,CreateMagneticSurface
public CreateConformalPECVolume
Expand Down
1 change: 1 addition & 0 deletions src_main_pub/maloney_nostoch.F90
Original file line number Diff line number Diff line change
Expand Up @@ -87,6 +87,7 @@ module SGBC_nostoch_m
!!!
public Malon_t,SGBCSurface_t !el tipo es publico
public AdvanceSGBCE,AdvanceSGBCH,InitSGBCs,DestroySGBCs,StoreFieldsSGBCs,calc_SGBCconstants,GetSGBCs
public solve_tridiag_iguales

contains

Expand Down
19 changes: 13 additions & 6 deletions src_wires_pub/wires.F90
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ module HollandWires_m
!!!
private

public InitWires,AdvanceWiresE,AdvanceWiresH,AdvanceWiresEcrank,StoreFieldsWires,DestroyWires, GetHwires,ReportWireJunctions,calc_wirehollandconstants
public InitWires,AdvanceWiresE,AdvanceWiresH,AdvanceWiresEcrank,StoreFieldsWires,DestroyWires,DestroyWireMedia, GetHwires,ReportWireJunctions,calc_wirehollandconstants,evolucion



Expand Down Expand Up @@ -5831,11 +5831,7 @@ subroutine DestroyWires(sgg)

!free up memory !ojo no se como hacerlo
do i=1,sgg%NumMedia
if (sgg%Med(i)%Is%ThinWire) then
if (associated(sgg%Med(i)%wire(1)%Vsource)) deallocate(sgg%Med(i)%wire(1)%Vsource)
if (associated(sgg%Med(i)%wire(1)%Isource)) deallocate(sgg%Med(i)%wire(1)%Isource)
if (associated(sgg%Med(i)%wire)) deallocate(sgg%Med(i)%wire)
end if
call DestroyWireMedia(sgg%Med(i))
end do

if (associated(HWires%WireTipoMedio )) deallocate(HWires%WireTipoMedio )
Expand All @@ -5847,6 +5843,17 @@ subroutine DestroyWires(sgg)
#endif
end subroutine

subroutine DestroyWireMedia(media)
type(MediaData_t), intent(inout) :: media

if (.not. media%Is%ThinWire) return
if (.not. associated(media%Wire)) return

if (associated(media%wire(1)%Vsource)) deallocate(media%wire(1)%Vsource)
if (associated(media%wire(1)%Isource)) deallocate(media%wire(1)%Isource)
if (associated(media%wire)) deallocate(media%wire)
end subroutine

!!!!!!!!!!!!!!!!!!!!!!!!!!!!
!Function to publish the private wire data (used in observation and in MPI)
!!!!!!!!!!!!!!!!!!!!!!!!!!!!
Expand Down
11 changes: 11 additions & 0 deletions test/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,8 @@ if (SEMBA_FDTD_ENABLE_SMBJSON)
set(ROTATE_TESTS_LIBRARY rotate_tests)
add_subdirectory(vtk)
set(VTK_TESTS_LIBRARY vtk_tests)
add_subdirectory(wires)
set(WIRES_TESTS_LIBRARY wires_tests)
if (NOT SEMBA_FDTD_ENABLE_MPI)
add_subdirectory(observation)
set(OBSERVATION_TESTS_LIBRARY observation_tests)
Expand All @@ -35,6 +37,12 @@ set(CONFORMAL_TESTS_LIBRARY conformal_tests)
add_subdirectory(preprocess)
set(PREPROCESS_TESTS_LIBRARY preprocess_tests)

add_subdirectory(healer)
set(HEALER_TESTS_LIBRARY healer_tests)

add_subdirectory(sgbc)
set(SGBC_TESTS_LIBRARY sgbc_tests)

add_executable(fdtd_tests
"fdtd_tests.cpp"
)
Expand All @@ -47,7 +55,10 @@ target_link_libraries(fdtd_tests
${ROTATE_TESTS_LIBRARY}
${HDF_TESTS_LIBRARY}
${VTK_TESTS_LIBRARY}
${WIRES_TESTS_LIBRARY}
${SYSTEM_TESTS_LIBRARY}
${OBSERVATION_TESTS_LIBRARY}
${HEALER_TESTS_LIBRARY}
${SGBC_TESTS_LIBRARY}
GTest::gtest_main
)
3 changes: 3 additions & 0 deletions test/fdtd_tests.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -8,12 +8,15 @@
#include "smbjson/smbjson_tests.h"
#include "rotate/rotate_tests.h"
#include "vtk/vtk_tests.h"
#include "wires/wires_tests.h"
#endif
#ifndef CompileWithMPI
#include "observation/observation_tests.h"
#endif
#include "conformal/conformal_tests.h"
#include "preprocess/preprocess_tests.h"
#include "healer/healer_tests.h"
#include "sgbc/sgbc_tests.h"

int main(int argc, char **argv) {
::testing::InitGoogleTest(&argc, argv);
Expand Down
20 changes: 20 additions & 0 deletions test/healer/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
message(STATUS "Creating build system for test/healer")

set(CMAKE_Fortran_MODULE_DIRECTORY ${CMAKE_BINARY_DIR}/mod)

add_library(healer_test_fortran
"test_healer.F90"
)

target_link_libraries(healer_test_fortran
semba-main
semba-reports
fhash
)

add_library(healer_tests "healer_tests.cpp")

target_link_libraries(healer_tests
healer_test_fortran
GTest::gtest
)
1 change: 1 addition & 0 deletions test/healer/healer_tests.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
#include "healer_tests.h"
39 changes: 39 additions & 0 deletions test/healer/healer_tests.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
#ifndef HEALER_TESTS_H
#define HEALER_TESTS_H

#include <gtest/gtest.h>

extern "C" {
int test_sort_all_swapped();
int test_sort_already_ordered();
int test_sort_x_reversed_yz_ok();
int test_readjust_grow();
int test_readjust_shrink();
int test_readjust_same_size();
}

TEST(healer, sort_all_swapped) {
EXPECT_EQ(0, test_sort_all_swapped());
}

TEST(healer, sort_already_ordered) {
EXPECT_EQ(0, test_sort_already_ordered());
}

TEST(healer, sort_x_reversed_yz_ok) {
EXPECT_EQ(0, test_sort_x_reversed_yz_ok());
}

TEST(healer, readjust_grow) {
EXPECT_EQ(0, test_readjust_grow());
}

TEST(healer, readjust_shrink) {
EXPECT_EQ(0, test_readjust_shrink());
}

TEST(healer, readjust_same_size) {
EXPECT_EQ(0, test_readjust_same_size());
}

#endif // HEALER_TESTS_H
Loading