dsf-suite 6.0.2__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 (68) hide show
  1. dsf_suite-6.0.2/CMakeLists.txt +302 -0
  2. dsf_suite-6.0.2/Doxyfile +2824 -0
  3. dsf_suite-6.0.2/LICENSE +661 -0
  4. dsf_suite-6.0.2/MANIFEST.in +10 -0
  5. dsf_suite-6.0.2/PKG-INFO +175 -0
  6. dsf_suite-6.0.2/README.md +141 -0
  7. dsf_suite-6.0.2/pyproject.toml +86 -0
  8. dsf_suite-6.0.2/setup.cfg +4 -0
  9. dsf_suite-6.0.2/setup.py +158 -0
  10. dsf_suite-6.0.2/src/dsf/__init__.py +19 -0
  11. dsf_suite-6.0.2/src/dsf/base/Dynamics.hpp +104 -0
  12. dsf_suite-6.0.2/src/dsf/base/Edge.cpp +54 -0
  13. dsf_suite-6.0.2/src/dsf/base/Edge.hpp +123 -0
  14. dsf_suite-6.0.2/src/dsf/base/Network.hpp +1096 -0
  15. dsf_suite-6.0.2/src/dsf/base/Node.hpp +148 -0
  16. dsf_suite-6.0.2/src/dsf/base/PathCollection.cpp +39 -0
  17. dsf_suite-6.0.2/src/dsf/base/PathCollection.hpp +20 -0
  18. dsf_suite-6.0.2/src/dsf/bindings.cpp +1480 -0
  19. dsf_suite-6.0.2/src/dsf/cartography/__init__.py +7 -0
  20. dsf_suite-6.0.2/src/dsf/cartography/cartography.py +551 -0
  21. dsf_suite-6.0.2/src/dsf/dsf.hpp +50 -0
  22. dsf_suite-6.0.2/src/dsf/geometry/Point.cpp +46 -0
  23. dsf_suite-6.0.2/src/dsf/geometry/Point.hpp +80 -0
  24. dsf_suite-6.0.2/src/dsf/geometry/PolyLine.cpp +39 -0
  25. dsf_suite-6.0.2/src/dsf/geometry/PolyLine.hpp +38 -0
  26. dsf_suite-6.0.2/src/dsf/mdt/PointsCluster.cpp +100 -0
  27. dsf_suite-6.0.2/src/dsf/mdt/PointsCluster.hpp +69 -0
  28. dsf_suite-6.0.2/src/dsf/mdt/Trajectory.cpp +111 -0
  29. dsf_suite-6.0.2/src/dsf/mdt/Trajectory.hpp +48 -0
  30. dsf_suite-6.0.2/src/dsf/mdt/TrajectoryCollection.cpp +263 -0
  31. dsf_suite-6.0.2/src/dsf/mdt/TrajectoryCollection.hpp +69 -0
  32. dsf_suite-6.0.2/src/dsf/mobility/Agent.cpp +89 -0
  33. dsf_suite-6.0.2/src/dsf/mobility/Agent.hpp +194 -0
  34. dsf_suite-6.0.2/src/dsf/mobility/FirstOrderDynamics.cpp +2019 -0
  35. dsf_suite-6.0.2/src/dsf/mobility/FirstOrderDynamics.hpp +529 -0
  36. dsf_suite-6.0.2/src/dsf/mobility/Intersection.cpp +31 -0
  37. dsf_suite-6.0.2/src/dsf/mobility/Intersection.hpp +130 -0
  38. dsf_suite-6.0.2/src/dsf/mobility/Itinerary.cpp +59 -0
  39. dsf_suite-6.0.2/src/dsf/mobility/Itinerary.hpp +66 -0
  40. dsf_suite-6.0.2/src/dsf/mobility/Road.cpp +104 -0
  41. dsf_suite-6.0.2/src/dsf/mobility/Road.hpp +189 -0
  42. dsf_suite-6.0.2/src/dsf/mobility/RoadJunction.cpp +17 -0
  43. dsf_suite-6.0.2/src/dsf/mobility/RoadJunction.hpp +70 -0
  44. dsf_suite-6.0.2/src/dsf/mobility/RoadNetwork.cpp +1312 -0
  45. dsf_suite-6.0.2/src/dsf/mobility/RoadNetwork.hpp +330 -0
  46. dsf_suite-6.0.2/src/dsf/mobility/Roundabout.cpp +18 -0
  47. dsf_suite-6.0.2/src/dsf/mobility/Roundabout.hpp +58 -0
  48. dsf_suite-6.0.2/src/dsf/mobility/Sensors.hpp +35 -0
  49. dsf_suite-6.0.2/src/dsf/mobility/Station.cpp +36 -0
  50. dsf_suite-6.0.2/src/dsf/mobility/Station.hpp +56 -0
  51. dsf_suite-6.0.2/src/dsf/mobility/Street.cpp +242 -0
  52. dsf_suite-6.0.2/src/dsf/mobility/Street.hpp +244 -0
  53. dsf_suite-6.0.2/src/dsf/mobility/TrafficLight.cpp +173 -0
  54. dsf_suite-6.0.2/src/dsf/mobility/TrafficLight.hpp +180 -0
  55. dsf_suite-6.0.2/src/dsf/mobility/TrafficSimulator.cpp +1066 -0
  56. dsf_suite-6.0.2/src/dsf/mobility/TrafficSimulator.hpp +299 -0
  57. dsf_suite-6.0.2/src/dsf/utility/Measurement.hpp +40 -0
  58. dsf_suite-6.0.2/src/dsf/utility/TypeTraits/is_node.hpp +75 -0
  59. dsf_suite-6.0.2/src/dsf/utility/TypeTraits/is_numeric.hpp +23 -0
  60. dsf_suite-6.0.2/src/dsf/utility/TypeTraits/is_street.hpp +32 -0
  61. dsf_suite-6.0.2/src/dsf/utility/Typedef.hpp +59 -0
  62. dsf_suite-6.0.2/src/dsf/utility/progress_bar.hpp +329 -0
  63. dsf_suite-6.0.2/src/dsf/utility/queue.hpp +69 -0
  64. dsf_suite-6.0.2/src/dsf_suite.egg-info/PKG-INFO +175 -0
  65. dsf_suite-6.0.2/src/dsf_suite.egg-info/SOURCES.txt +66 -0
  66. dsf_suite-6.0.2/src/dsf_suite.egg-info/dependency_links.txt +1 -0
  67. dsf_suite-6.0.2/src/dsf_suite.egg-info/requires.txt +6 -0
  68. dsf_suite-6.0.2/src/dsf_suite.egg-info/top_level.txt +2 -0
@@ -0,0 +1,302 @@
1
+ cmake_minimum_required(VERSION 3.16.0)
2
+
3
+ # Read version from header file
4
+ file(READ "${CMAKE_CURRENT_SOURCE_DIR}/src/dsf/dsf.hpp" DSF_HPP_CONTENT)
5
+ string(REGEX MATCH "DSF_VERSION_MAJOR = ([0-9]+)" _ ${DSF_HPP_CONTENT})
6
+ set(DSF_VERSION_MAJOR ${CMAKE_MATCH_1})
7
+ string(REGEX MATCH "DSF_VERSION_MINOR = ([0-9]+)" _ ${DSF_HPP_CONTENT})
8
+ set(DSF_VERSION_MINOR ${CMAKE_MATCH_1})
9
+ string(REGEX MATCH "DSF_VERSION_PATCH = ([0-9]+)" _ ${DSF_HPP_CONTENT})
10
+ set(DSF_VERSION_PATCH ${CMAKE_MATCH_1})
11
+
12
+ set(DSF_VERSION
13
+ "${DSF_VERSION_MAJOR}.${DSF_VERSION_MINOR}.${DSF_VERSION_PATCH}")
14
+
15
+ project(
16
+ dsf
17
+ VERSION ${DSF_VERSION}
18
+ LANGUAGES CXX)
19
+
20
+ option(DSF_TESTS "Build DSF tests" OFF)
21
+ option(DSF_EXAMPLES "Build DSF examples" OFF)
22
+ option(DSF_BENCHMARKS "Build DSF benchmarks" OFF)
23
+ option(DSF_BUILD_PIC "Build DSF with position-independent code" OFF)
24
+ option(BUILD_PYTHON_BINDINGS "Build Python bindings" OFF)
25
+ option(DSF_COMPATIBILITY_BUILD "Build DSF in compatibility mode" OFF)
26
+
27
+ # If CMAKE_BUILD_TYPE not set, default to Debug
28
+ if(NOT CMAKE_BUILD_TYPE)
29
+ if(BUILD_PYTHON_BINDINGS OR DSF_BENCHMARKS)
30
+ set(CMAKE_BUILD_TYPE
31
+ "Release"
32
+ CACHE STRING
33
+ "Build type (default: Release when building Python bindings or benchmarks)"
34
+ FORCE)
35
+ else()
36
+ set(CMAKE_BUILD_TYPE
37
+ "Debug"
38
+ CACHE STRING "Build type (default: Debug)" FORCE)
39
+ endif()
40
+ endif()
41
+ if(BUILD_PYTHON_BINDINGS)
42
+ set(CMAKE_POSITION_INDEPENDENT_CODE ON)
43
+ endif()
44
+
45
+ # Set the C++ standard
46
+ set(CMAKE_CXX_STANDARD 20)
47
+ set(CMAKE_CXX_STANDARD_REQUIRED ON)
48
+ set(CMAKE_CXX_EXTENSIONS OFF)
49
+
50
+ # Ensure optimization flags are applied only in Release mode
51
+ if(CMAKE_BUILD_TYPE MATCHES "Release")
52
+ if(CMAKE_CXX_COMPILER_ID MATCHES "GNU|Clang")
53
+ if(DSF_COMPATIBILITY_BUILD)
54
+ set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -O3")
55
+ else()
56
+ set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Ofast -flto=auto -march=native")
57
+ endif()
58
+ elseif(CMAKE_CXX_COMPILER_ID MATCHES "MSVC")
59
+ set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /O2")
60
+ endif()
61
+ elseif(CMAKE_BUILD_TYPE MATCHES "Profile")
62
+ if(CMAKE_CXX_COMPILER_ID MATCHES "GNU|Clang")
63
+ if(DSF_COMPATIBILITY_BUILD)
64
+ set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -O3 -pg")
65
+ else()
66
+ set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Ofast -flto=auto -march=native -pg")
67
+ endif()
68
+ endif()
69
+ elseif(CMAKE_BUILD_TYPE MATCHES "Coverage")
70
+ set(DSF_TESTS ON)
71
+ message(STATUS "Enable code coverage")
72
+ if(CMAKE_CXX_COMPILER_ID MATCHES "GNU|Clang")
73
+ set(CMAKE_CXX_FLAGS
74
+ "${CMAKE_CXX_FLAGS} -Wall -Wextra -Wpedantic -Werror -g -pg --coverage -fprofile-update=atomic"
75
+ )
76
+ set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} --coverage")
77
+ endif()
78
+ else() # Default to Debug settings
79
+ set(DSF_TESTS ON)
80
+ if(CMAKE_CXX_COMPILER_ID MATCHES "GNU")
81
+ set(CMAKE_CXX_FLAGS
82
+ "${CMAKE_CXX_FLAGS} -Wall -Wextra -Wpedantic -Werror -g -pg -fsanitize=address")
83
+ elseif(CMAKE_CXX_COMPILER_ID MATCHES "Clang")
84
+ set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wall -Wextra -Wpedantic -Werror -g -pg")
85
+ elseif(CMAKE_CXX_COMPILER_ID MATCHES "MSVC")
86
+ set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /W4")
87
+ endif()
88
+ endif()
89
+
90
+ # MSVC: make __cplusplus report the actual standard (needed by csv-parser)
91
+ if(CMAKE_CXX_COMPILER_ID MATCHES "MSVC")
92
+ add_compile_options(/Zc:__cplusplus)
93
+ endif()
94
+
95
+ file(
96
+ GLOB
97
+ SOURCES
98
+ "src/dsf/base/*.cpp"
99
+ "src/dsf/mobility/*.cpp"
100
+ "src/dsf/utility/*.cpp"
101
+ "src/dsf/geometry/*.cpp"
102
+ "src/dsf/mdt/*.cpp")
103
+
104
+ include(FetchContent)
105
+ # Get csv-parser
106
+ set(CSV_BUILD_PROGRAMS
107
+ OFF
108
+ CACHE BOOL "Build csv-parser executable" FORCE)
109
+ FetchContent_Declare(
110
+ csv-parser
111
+ GIT_REPOSITORY https://github.com/vincentlaucsb/csv-parser
112
+ GIT_TAG 5.2.0)
113
+ FetchContent_GetProperties(csv-parser)
114
+ if(NOT csv-parser_POPULATED)
115
+ FetchContent_MakeAvailable(csv-parser)
116
+ endif()
117
+ # Get spdlog
118
+ set(SPDLOG_USE_STD_FORMAT
119
+ ON
120
+ CACHE BOOL "Use std::format instead of fmt" FORCE)
121
+ set(SPDLOG_FMT_EXTERNAL
122
+ OFF
123
+ CACHE BOOL "Use bundled fmt library" FORCE)
124
+ set(SPDLOG_INSTALL
125
+ ON
126
+ CACHE BOOL "Install spdlog targets" FORCE)
127
+ if(BUILD_PYTHON_BINDINGS)
128
+ set(SPDLOG_BUILD_PIC
129
+ ON
130
+ CACHE BOOL "Build position-independent code for spdlog" FORCE)
131
+ endif()
132
+ FetchContent_Declare(
133
+ spdlog
134
+ GIT_REPOSITORY https://github.com/gabime/spdlog
135
+ GIT_TAG v1.17.0)
136
+ FetchContent_GetProperties(spdlog)
137
+ if(NOT spdlog_POPULATED)
138
+ FetchContent_MakeAvailable(spdlog)
139
+ endif()
140
+ # Get simdjson
141
+ FetchContent_Declare(
142
+ simdjson
143
+ GIT_REPOSITORY https://github.com/simdjson/simdjson
144
+ GIT_TAG v4.6.1)
145
+ FetchContent_GetProperties(simdjson)
146
+ if(NOT simdjson_POPULATED)
147
+ FetchContent_MakeAvailable(simdjson)
148
+ endif()
149
+ # Check if the user has TBB installed
150
+ find_package(TBB QUIET)
151
+
152
+ if(NOT TBB_FOUND)
153
+ find_path(TBB_INCLUDE_DIR NAMES tbb/tbb.h)
154
+ find_library(TBB_LIBRARY NAMES tbb)
155
+
156
+ if(TBB_INCLUDE_DIR AND TBB_LIBRARY)
157
+ set(TBB_FOUND TRUE)
158
+ if(NOT TARGET TBB::tbb)
159
+ add_library(TBB::tbb UNKNOWN IMPORTED)
160
+ set_target_properties(TBB::tbb PROPERTIES
161
+ INTERFACE_INCLUDE_DIRECTORIES "${TBB_INCLUDE_DIR}"
162
+ IMPORTED_LOCATION "${TBB_LIBRARY}"
163
+ )
164
+ endif()
165
+ else()
166
+ message(FATAL_ERROR "TBB not found. Install tbb-devel (RHEL) or libtbb-dev (Debian)")
167
+ endif()
168
+ endif()
169
+ # Get SQLiteCpp
170
+ # Disable cppcheck on Windows to avoid issues with missing cppcheck installation
171
+ if(WIN32)
172
+ set(SQLITECPP_RUN_CPPCHECK
173
+ OFF
174
+ CACHE BOOL "Run cppcheck on SQLiteCpp" FORCE)
175
+ endif()
176
+ FetchContent_Declare(
177
+ SQLiteCpp
178
+ GIT_REPOSITORY https://github.com/SRombauts/SQLiteCpp
179
+ GIT_TAG 3.3.3)
180
+ FetchContent_GetProperties(SQLiteCpp)
181
+ if(NOT SQLiteCpp_POPULATED)
182
+ FetchContent_MakeAvailable(SQLiteCpp)
183
+ endif()
184
+
185
+ add_library(dsf STATIC ${SOURCES})
186
+ target_compile_definitions(dsf PRIVATE SPDLOG_USE_STD_FORMAT)
187
+ target_include_directories(
188
+ dsf PUBLIC $<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/src>
189
+ $<INSTALL_INTERFACE:include>)
190
+
191
+ # Link other libraries
192
+ target_link_libraries(dsf PUBLIC TBB::tbb SQLiteCpp
193
+ PRIVATE $<BUILD_INTERFACE:simdjson::simdjson> spdlog::spdlog $<BUILD_INTERFACE:csv>)
194
+
195
+ # Install dsf library
196
+ install(
197
+ TARGETS dsf
198
+ EXPORT dsfConfig
199
+ ARCHIVE DESTINATION lib
200
+ LIBRARY DESTINATION lib
201
+ RUNTIME DESTINATION bin)
202
+
203
+ install(DIRECTORY ${PROJECT_SOURCE_DIR}/src/
204
+ DESTINATION ${CMAKE_INSTALL_PREFIX}/include)
205
+
206
+ install(
207
+ EXPORT dsfConfig
208
+ FILE dsfConfig.cmake
209
+ NAMESPACE dsf::
210
+ DESTINATION lib/cmake/dsf)
211
+
212
+ # Optional Python bindings - only build if requested
213
+ if(BUILD_PYTHON_BINDINGS)
214
+ include(FetchContent)
215
+
216
+ # Get pybind11
217
+ FetchContent_Declare(
218
+ pybind11
219
+ GIT_REPOSITORY https://github.com/pybind/pybind11.git
220
+ GIT_TAG v3.0.3)
221
+ FetchContent_GetProperties(pybind11)
222
+ if(NOT pybind11_POPULATED)
223
+ FetchContent_MakeAvailable(pybind11)
224
+ endif()
225
+
226
+ # Add the Python binding module
227
+ pybind11_add_module(dsf_python_module src/dsf/bindings.cpp)
228
+
229
+ # Ensure the Python module name has no 'lib' prefix on Unix systems
230
+ set_target_properties(dsf_python_module PROPERTIES OUTPUT_NAME "dsf_cpp")
231
+
232
+ # Link the pybind11 module with your static library and pybind11
233
+ target_link_libraries(
234
+ dsf_python_module PRIVATE dsf pybind11::headers TBB::tbb
235
+ spdlog::spdlog)
236
+ target_compile_definitions(dsf_python_module PRIVATE SPDLOG_USE_STD_FORMAT)
237
+
238
+ target_include_directories(dsf_python_module
239
+ PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/src)
240
+
241
+ endif()
242
+
243
+ # Tests
244
+ message(STATUS "Build DSF tests: ${DSF_TESTS}")
245
+ if(DSF_TESTS)
246
+ include(CTest)
247
+ enable_testing()
248
+
249
+ # Get Doctest library
250
+ FetchContent_Declare(
251
+ doctest
252
+ GIT_REPOSITORY https://github.com/doctest/doctest.git
253
+ GIT_TAG v2.5.2)
254
+ FetchContent_GetProperties(doctest)
255
+ if(NOT doctest_POPULATED)
256
+ FetchContent_MakeAvailable(doctest)
257
+ endif()
258
+
259
+ macro(add_unit_test testname)
260
+ add_executable(${testname} ${ARGN})
261
+ target_include_directories(${testname}
262
+ PRIVATE ../src/ ../src/dsf/utility/TypeTraits/)
263
+ target_include_directories(
264
+ ${testname} SYSTEM PRIVATE ${doctest_SOURCE_DIR}/doctest)
265
+ target_compile_definitions(${testname} PRIVATE SPDLOG_USE_STD_FORMAT)
266
+ target_link_libraries(${testname} PRIVATE dsf TBB::tbb simdjson::simdjson spdlog::spdlog)
267
+ # Put test binaries under build/tests so they are easy to find. Use
268
+ # per-config output dirs to play nicely with multi-config generators.
269
+ set_target_properties(
270
+ ${testname}
271
+ PROPERTIES RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/tests
272
+ RUNTIME_OUTPUT_DIRECTORY_DEBUG ${CMAKE_BINARY_DIR}/tests
273
+ RUNTIME_OUTPUT_DIRECTORY_RELEASE ${CMAKE_BINARY_DIR}/tests
274
+ RUNTIME_OUTPUT_DIRECTORY_MINSIZEREL ${CMAKE_BINARY_DIR}/tests
275
+ RUNTIME_OUTPUT_DIRECTORY_RELWITHDEBINFO
276
+ ${CMAKE_BINARY_DIR}/tests)
277
+
278
+ # Register the test using the full target file so CTest invokes the correct
279
+ # executable regardless of output directory or generator.
280
+ add_test(NAME ${testname} COMMAND $<TARGET_FILE:${testname}>)
281
+ endmacro()
282
+
283
+ file(GLOB TEST_SOURCES "test/*/*.cpp")
284
+ foreach(testsource ${TEST_SOURCES})
285
+ get_filename_component(testname ${testsource} NAME_WE)
286
+ add_unit_test(${testname} ${testsource})
287
+ endforeach()
288
+ endif()
289
+
290
+ # Examples
291
+ message(STATUS "Build DSF examples: ${DSF_EXAMPLES}")
292
+ if(DSF_EXAMPLES)
293
+ set(CMAKE_PREFIX_PATH "${CMAKE_INSTALL_PREFIX};${CMAKE_PREFIX_PATH}")
294
+ add_subdirectory(examples)
295
+ endif()
296
+
297
+ # Benchmarks
298
+ message(STATUS "Build DSF benchmarks: ${DSF_BENCHMARKS}")
299
+ if(DSF_BENCHMARKS)
300
+ set(CMAKE_PREFIX_PATH "${CMAKE_INSTALL_PREFIX};${CMAKE_PREFIX_PATH}")
301
+ add_subdirectory(benchmark)
302
+ endif()