disortpp 1.0.3__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (42) hide show
  1. disortpp-1.0.3/.github/workflows/build_wheels.yml +73 -0
  2. disortpp-1.0.3/.gitignore +6 -0
  3. disortpp-1.0.3/CMakeLists.txt +130 -0
  4. disortpp-1.0.3/LICENSE +674 -0
  5. disortpp-1.0.3/PKG-INFO +169 -0
  6. disortpp-1.0.3/README.md +143 -0
  7. disortpp-1.0.3/pyproject.toml +56 -0
  8. disortpp-1.0.3/python/example.py +302 -0
  9. disortpp-1.0.3/python/example_spectral.py +439 -0
  10. disortpp-1.0.3/src/BandSolver.hpp +175 -0
  11. disortpp-1.0.3/src/DisortConfig.cpp +271 -0
  12. disortpp-1.0.3/src/DisortConfig.hpp +240 -0
  13. disortpp-1.0.3/src/DisortFluxConfig.cpp +167 -0
  14. disortpp-1.0.3/src/DisortFluxConfig.hpp +92 -0
  15. disortpp-1.0.3/src/DisortResult.cpp +49 -0
  16. disortpp-1.0.3/src/DisortResult.hpp +110 -0
  17. disortpp-1.0.3/src/DisortSolver.cpp +3996 -0
  18. disortpp-1.0.3/src/DisortSolver.hpp +800 -0
  19. disortpp-1.0.3/src/DisortTypes.hpp +53 -0
  20. disortpp-1.0.3/src/FluxResult.cpp +18 -0
  21. disortpp-1.0.3/src/FluxResult.hpp +40 -0
  22. disortpp-1.0.3/src/FluxSolver.cpp +1251 -0
  23. disortpp-1.0.3/src/FluxSolver.hpp +185 -0
  24. disortpp-1.0.3/src/Legendre.cpp +122 -0
  25. disortpp-1.0.3/src/Legendre.hpp +50 -0
  26. disortpp-1.0.3/src/LinearAlgebra.cpp +250 -0
  27. disortpp-1.0.3/src/LinearAlgebra.hpp +255 -0
  28. disortpp-1.0.3/src/PhaseFunction.cpp +119 -0
  29. disortpp-1.0.3/src/PhaseFunction.hpp +35 -0
  30. disortpp-1.0.3/src/Planck.cpp +171 -0
  31. disortpp-1.0.3/src/Planck.hpp +66 -0
  32. disortpp-1.0.3/src/Utils.hpp +163 -0
  33. disortpp-1.0.3/src/python_bindings.cpp +713 -0
  34. disortpp-1.0.3/tests/CMakeLists.txt +21 -0
  35. disortpp-1.0.3/tests/main.cpp +5 -0
  36. disortpp-1.0.3/tests/test_basic.cpp +37 -0
  37. disortpp-1.0.3/tests/test_flux_solver.cpp +539 -0
  38. disortpp-1.0.3/tests/test_linear_algebra.cpp +426 -0
  39. disortpp-1.0.3/tests/test_solver.cpp +5447 -0
  40. disortpp-1.0.3/tests/test_structures.cpp +206 -0
  41. disortpp-1.0.3/tests/test_utils.cpp +292 -0
  42. disortpp-1.0.3/tests/testing.hpp +308 -0
@@ -0,0 +1,73 @@
1
+ name: Build and publish wheels
2
+
3
+ on:
4
+ push:
5
+ tags:
6
+ - "v*"
7
+ pull_request:
8
+ branches:
9
+ - main
10
+ workflow_dispatch:
11
+
12
+ jobs:
13
+ # ---- Source distribution ---------------------------------------------------
14
+ build_sdist:
15
+ name: Build sdist
16
+ runs-on: ubuntu-latest
17
+ steps:
18
+ - uses: actions/checkout@v4
19
+
20
+ - name: Build sdist
21
+ run: pipx run build --sdist
22
+
23
+ - uses: actions/upload-artifact@v4
24
+ with:
25
+ name: sdist
26
+ path: dist/*.tar.gz
27
+
28
+ # ---- Binary wheels via cibuildwheel ----------------------------------------
29
+ build_wheels:
30
+ name: Wheels on ${{ matrix.os }}
31
+ runs-on: ${{ matrix.os }}
32
+ strategy:
33
+ fail-fast: false
34
+ matrix:
35
+ os: [ubuntu-latest, macos-latest, windows-latest]
36
+
37
+ steps:
38
+ - uses: actions/checkout@v4
39
+
40
+ # QEMU for aarch64 Linux wheels
41
+ - name: Set up QEMU
42
+ if: runner.os == 'Linux'
43
+ uses: docker/setup-qemu-action@v3
44
+ with:
45
+ platforms: arm64
46
+
47
+ - name: Build wheels
48
+ uses: pypa/cibuildwheel@v2.21
49
+
50
+ - uses: actions/upload-artifact@v4
51
+ with:
52
+ name: wheels-${{ matrix.os }}
53
+ path: wheelhouse/*.whl
54
+
55
+ # ---- Publish to PyPI (only on tag push) ------------------------------------
56
+ publish:
57
+ name: Publish to PyPI
58
+ needs: [build_sdist, build_wheels]
59
+ runs-on: ubuntu-latest
60
+ if: github.event_name == 'push' && startsWith(github.ref, 'refs/tags/v')
61
+ permissions:
62
+ id-token: write
63
+ environment:
64
+ name: pypi_release
65
+ url: https://pypi.org/p/disortpp
66
+
67
+ steps:
68
+ - uses: actions/download-artifact@v4
69
+ with:
70
+ path: dist
71
+ merge-multiple: true
72
+
73
+ - uses: pypa/gh-action-pypi-publish@release/v1
@@ -0,0 +1,6 @@
1
+ # build files from cmake
2
+ build/*
3
+ CMakeFiles/*
4
+ .vscode/
5
+ .claude/*
6
+
@@ -0,0 +1,130 @@
1
+ cmake_minimum_required(VERSION 3.15)
2
+ project(disortpp VERSION 1.0.3 LANGUAGES CXX)
3
+
4
+ # Options
5
+ option(BUILD_PYTHON_BINDINGS "Build Python bindings via pybind11" OFF)
6
+ option(DISORTPP_MARCH_NATIVE "Use -march=native optimization (disable for portable binaries)" ON)
7
+
8
+ # C++17 Standard
9
+ set(CMAKE_CXX_STANDARD 17)
10
+ set(CMAKE_CXX_STANDARD_REQUIRED ON)
11
+ set(CMAKE_CXX_EXTENSIONS OFF)
12
+
13
+ # Build type
14
+ if(NOT CMAKE_BUILD_TYPE)
15
+ set(CMAKE_BUILD_TYPE Release)
16
+ endif()
17
+
18
+ # Compiler flags
19
+ if(MSVC)
20
+ add_compile_definitions(_USE_MATH_DEFINES)
21
+ add_compile_options(/bigobj)
22
+ set(CMAKE_CXX_FLAGS_RELEASE "/O2 /DNDEBUG /DEIGEN_NO_DEBUG")
23
+ else()
24
+ set(CMAKE_CXX_FLAGS_DEBUG "-g -Wall -Wextra -pedantic")
25
+ set(CMAKE_CXX_FLAGS_RELEASE "-O3 -DNDEBUG -DEIGEN_NO_DEBUG")
26
+ if(DISORTPP_MARCH_NATIVE)
27
+ string(APPEND CMAKE_CXX_FLAGS_RELEASE " -march=native")
28
+ endif()
29
+ endif()
30
+
31
+ # Dependencies: Eigen3 via FetchContent (downloaded into _deps/)
32
+ include(FetchContent)
33
+ FetchContent_Declare(
34
+ eigen
35
+ GIT_REPOSITORY https://gitlab.com/libeigen/eigen.git
36
+ GIT_TAG 3.4.0
37
+ GIT_SHALLOW TRUE
38
+ )
39
+ # Eigen's CMakeLists builds tests/docs by default — disable them
40
+ set(EIGEN_BUILD_DOC OFF CACHE BOOL "" FORCE)
41
+ set(EIGEN_BUILD_TESTING OFF CACHE BOOL "" FORCE)
42
+ set(BUILD_TESTING OFF CACHE BOOL "" FORCE)
43
+ # Use manual populate + EXCLUDE_FROM_ALL to prevent Eigen's install targets
44
+ # from polluting the Python wheel with thousands of header files
45
+ FetchContent_GetProperties(eigen)
46
+ if(NOT eigen_POPULATED)
47
+ FetchContent_Populate(eigen)
48
+ add_subdirectory(${eigen_SOURCE_DIR} ${eigen_BINARY_DIR} EXCLUDE_FROM_ALL)
49
+ endif()
50
+
51
+ # Dependencies: pybind11 via FetchContent (optional, for Python bindings)
52
+ if(BUILD_PYTHON_BINDINGS)
53
+ FetchContent_Declare(
54
+ pybind11
55
+ GIT_REPOSITORY https://github.com/pybind/pybind11.git
56
+ GIT_TAG v2.13.6
57
+ GIT_SHALLOW TRUE
58
+ )
59
+ FetchContent_MakeAvailable(pybind11)
60
+ endif()
61
+
62
+ # Source files
63
+ set(DISORTPP_SOURCES
64
+ src/DisortConfig.cpp
65
+ src/DisortFluxConfig.cpp
66
+ src/PhaseFunction.cpp
67
+ src/DisortResult.cpp
68
+ src/Legendre.cpp
69
+ src/Planck.cpp
70
+ src/LinearAlgebra.cpp
71
+ src/DisortSolver.cpp
72
+ src/FluxResult.cpp
73
+ src/FluxSolver.cpp
74
+ )
75
+
76
+ # Library target
77
+ add_library(disortpp ${DISORTPP_SOURCES})
78
+
79
+ target_include_directories(disortpp
80
+ PUBLIC
81
+ $<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/src>
82
+ $<INSTALL_INTERFACE:src>
83
+ )
84
+
85
+ target_link_libraries(disortpp PUBLIC Eigen3::Eigen)
86
+
87
+ # OpenMP (optional, for parallel spectral loops in Python bindings)
88
+ find_package(OpenMP)
89
+
90
+ # Python bindings (optional)
91
+ if(BUILD_PYTHON_BINDINGS)
92
+ set_target_properties(disortpp PROPERTIES POSITION_INDEPENDENT_CODE ON)
93
+ pybind11_add_module(disortpp_python src/python_bindings.cpp)
94
+ target_link_libraries(disortpp_python PRIVATE disortpp)
95
+ if(OpenMP_CXX_FOUND)
96
+ target_link_libraries(disortpp_python PRIVATE OpenMP::OpenMP_CXX)
97
+ endif()
98
+ set_target_properties(disortpp_python PROPERTIES OUTPUT_NAME "disortpp")
99
+ if(MSVC)
100
+ # Avoid import library name collision with the static library (both would be disortpp.lib)
101
+ set_target_properties(disortpp_python PROPERTIES ARCHIVE_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/_implib")
102
+ endif()
103
+ install(TARGETS disortpp_python LIBRARY DESTINATION .)
104
+ endif()
105
+
106
+ # Tests
107
+ enable_testing()
108
+ add_subdirectory(tests)
109
+
110
+ # Benchmarks (uncomment when benchmark sources are available)
111
+ # add_executable(bench_flux_solver bench_flux_solver.cpp)
112
+ # target_link_libraries(bench_flux_solver disortpp)
113
+
114
+ # add_executable(bench_intensity bench_intensity.cpp)
115
+ # target_link_libraries(bench_intensity disortpp)
116
+
117
+ # Installation
118
+ # install(TARGETS disortpp DESTINATION lib)
119
+ # install(DIRECTORY include/disortpp DESTINATION include)
120
+
121
+ # Print configuration
122
+ message(STATUS "")
123
+ message(STATUS "========== disort++ C++ Configuration ==========")
124
+ message(STATUS "Build type: ${CMAKE_BUILD_TYPE}")
125
+ message(STATUS "C++ standard: ${CMAKE_CXX_STANDARD}")
126
+ message(STATUS "Eigen3: fetched via FetchContent (3.4.0)")
127
+ message(STATUS "Python bindings: ${BUILD_PYTHON_BINDINGS}")
128
+ message(STATUS "OpenMP: ${OpenMP_CXX_FOUND}")
129
+ message(STATUS "==============================================")
130
+ message(STATUS "")