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
8 changes: 7 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -34,8 +34,12 @@ RUN_*
*.[0-9]*.[0-9]*.[0-9]*
TMP
*/test_data/simple_*/
test/test_data/
test/test_data/*
!test/test_data/.gitkeep
!test/test_data/get_test_data.sh
!test/test_data/simple.multiple_fieldline.in
!test/test_data/simple.single_fieldline.in
!test/test_data/simple.volume.in
*.geany
examples/test1/
examples/test2/
Expand All @@ -61,3 +65,5 @@ thirdparty/pyplot_module.F90
.claude
docs/_build/
build*/
artifacts/plots/
artifacts/notebooks/
7 changes: 4 additions & 3 deletions requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -5,15 +5,16 @@
numpy==2.2.6
scikit-build-core==0.10.0

# F90wrap - pinned to release version
f90wrap==0.2.16
# F90wrap - pinned to release version compatible with gvec
f90wrap==0.3.0

# Optional dependencies for testing
pytest==7.4.3
pytest-cov==6.2.1
netCDF4==1.7.2
gvec==1.4.0

# Optional dependencies for examples/plotting
matplotlib==3.9.4
scipy==1.15.2
shapely==2.0.5
shapely==2.1.2
44 changes: 41 additions & 3 deletions test/tests/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@
set(TEST_DATA_DIR "${CMAKE_SOURCE_DIR}/test/test_data")
set(WOUT_FILE "${TEST_DATA_DIR}/wout.nc")
set(WOUT_URL "https://github.com/hiddenSymmetries/simsopt/raw/master/tests/test_files/wout_LandremanPaul2021_QA_reactorScale_lowres_reference.nc")
set(WOUT_QH_FILE "${TEST_DATA_DIR}/wout_qh.nc")
set(WOUT_QH_URL "https://raw.githubusercontent.com/hiddenSymmetries/simsopt/master/tests/test_files/wout_LandremanPaul2021_QH_reactorScale_lowres_reference.nc")

# Download if not present
if(NOT EXISTS "${WOUT_FILE}")
Expand All @@ -14,8 +16,20 @@ if(NOT EXISTS "${WOUT_FILE}")
message(STATUS "Downloaded VMEC test file")
endif()

if(NOT EXISTS "${WOUT_QH_FILE}")
file(MAKE_DIRECTORY "${TEST_DATA_DIR}")
message(STATUS "Downloading QH VMEC file to ${WOUT_QH_FILE}...")
file(DOWNLOAD "${WOUT_QH_URL}" "${WOUT_QH_FILE}")
endif()

# Create symlink in test binary directory for backward compatibility
file(CREATE_LINK "${WOUT_FILE}" "${CMAKE_CURRENT_BINARY_DIR}/wout.nc" SYMBOLIC)
file(CREATE_LINK "${WOUT_QH_FILE}" "${CMAKE_CURRENT_BINARY_DIR}/wout_qh.nc" SYMBOLIC)

set(BOOZER_CHARTMAP_PYTHON "${Python_EXECUTABLE}")
if(EXISTS "${CMAKE_SOURCE_DIR}/.venv/bin/python")
set(BOOZER_CHARTMAP_PYTHON "${CMAKE_SOURCE_DIR}/.venv/bin/python")
endif()

# Generate chartmap file from VMEC for testing chartmap coordinate detection
# Uses libneo's vmec_to_chartmap tool built as part of dependencies
Expand Down Expand Up @@ -355,22 +369,46 @@ add_test(NAME test_array_utils COMMAND test_array_utils.x)
add_executable(test_boozer_chartmap_roundtrip.x test_boozer_chartmap_roundtrip.f90)
target_link_libraries(test_boozer_chartmap_roundtrip.x simple)
add_test(NAME test_boozer_chartmap_roundtrip
COMMAND test_boozer_chartmap_roundtrip.x)
COMMAND test_boozer_chartmap_roundtrip.x
${WOUT_FILE}
${CMAKE_CURRENT_BINARY_DIR}/roundtrip_test.nc
export
${CMAKE_CURRENT_BINARY_DIR}/boozer_chartmap_roundtrip
1.0e-4
1.0e-6)
set_tests_properties(test_boozer_chartmap_roundtrip PROPERTIES
WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}
LABELS "slow")

add_test(NAME test_boozer_chartmap_gvec_qa
COMMAND ${BOOZER_CHARTMAP_PYTHON}
${CMAKE_CURRENT_SOURCE_DIR}/run_gvec_qa_roundtrip.py)
set_tests_properties(test_boozer_chartmap_gvec_qa PROPERTIES
WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}
LABELS "slow;python"
TIMEOUT 7200)

# Export tool for e2e test
add_executable(export_boozer_chartmap_tool.x export_boozer_chartmap_tool.f90)
target_link_libraries(export_boozer_chartmap_tool.x simple)

# E2E test: VMEC-Boozer vs chartmap confined fractions
add_test(NAME test_e2e_boozer_chartmap
COMMAND ${Python_EXECUTABLE}
COMMAND ${BOOZER_CHARTMAP_PYTHON}
${CMAKE_CURRENT_SOURCE_DIR}/test_e2e_boozer_chartmap.py)
set_tests_properties(test_e2e_boozer_chartmap PROPERTIES
WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}
LABELS "slow")
LABELS "slow;plot;python"
TIMEOUT 7200)

add_test(NAME test_figure8_boozer_chartmap
COMMAND ${BOOZER_CHARTMAP_PYTHON}
${CMAKE_CURRENT_SOURCE_DIR}/test_figure8_boozer_chartmap.py)
set_tests_properties(test_figure8_boozer_chartmap PROPERTIES
WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}
LABELS "slow;plot;python;golden_record"
TIMEOUT 7200
DEPENDS test_e2e_boozer_chartmap)

if(SIMPLE_ENABLE_CGAL)
add_executable(test_stl_wall_intersection.x test_stl_wall_intersection.f90)
Expand Down
Loading
Loading