Skip to content

Commit 491291a

Browse files
committed
[1.3.44] 2025-08-10
* Added `BUILD_TESTS` CMake option to conditionally build test executables instead of building them by default * Test file renamed to `run_tests.sh`, and now runs tests without needing any of the sample projects (`samples/`) * Deleted most of the `samples/[*]_selftest` directories, as they are no longer needed for testing. `context_selftest`, `energybalance_selftest`, and `radiation_selftest` were left because they are referenced in YouTube tutorials * Added compiler warning suppression for third-party libraries (zlib, libpng, libjpeg) to reduce build noise * Helios now builds with OpenMP parallelization enabled by default if available ## Context - Added automatic filtering of zero-area primitives in addSphere(), addTube(), addDisk(), addCone(), and other geometric construction methods - Improved tube generation robustness by handling degenerate cross products when axis vectors are parallel or near-vertical - Added minimum size validation (1e-6) for patch primitives to prevent numerical precision issues - Added debug warnings for malformed triangles with near-zero area - Deprecated `Context::getPrimitiveDataType(uint, const char*)` and `Context::getObjectDataType(uint, const char*)` in favor of `Context::getPrimitiveDataType(const char*)` and `Context::getObjectDataType(const char*)` - Added new `fzero()` function overload that returns convergence status - Implemented linspace utility functions in `global.h`/`global.cpp` for float, vec2, vec3, and vec4 types ## Plant Architecture - Fixed leaf prototype scale validation to ensure minimum positive values - Updated petiole handling to preserve intended leaf generation ## Radiation - Enhanced camera image processing pipeline with spectral correction and improved white balance workflow - Added Gray Edge white balance algorithm implementation for color constancy - Fixed gamma compression application in image processing pipeline - Improved gain adjustment and histogram equalization for better image quality - Substantially refactored `RadiationModel::updateGeometry()` and `RadiationModel::updateRadiativeProperties()` methods for improved efficiency: - Replaced O(n) std::find operations with O(1) unordered_set lookups in geometry updates - Added spectral integration caching to avoid redundant computations - Implemented OpenMP parallelization for radiative property calculations - Optimized map access patterns and reduced memory allocations ## Photosynthesis - Improved temporal continuity in Farquhar model by initializing Ci with previous timestep values - Enhanced convergence behavior with better initial guesses for intercellular CO2 concentration ## Stomatal Conductance - Enhanced Ball-Woodrow-Berry model convergence with improved initial surface vapor pressure estimates - Increased numerical solver tolerance and iteration limits for better stability in vapor pressure calculations ## Project Builder - Removed `linspace` function from `ProjectBuilder.cpp` since it is now available in the Helios core - `CMakeLists.txt` was missing the conditional include guards for the canopy generator plug-in, which would cause a linker error if the plug-in was not built
1 parent ed7be3e commit 491291a

File tree

657 files changed

+45594
-35860
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

657 files changed

+45594
-35860
lines changed

.github/workflows/linux_GPU_selftests.yaml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -36,8 +36,8 @@ jobs:
3636
- name: Bash script
3737
run: |
3838
cd utilities
39-
if ! ./run_samples.sh --visbuildonly --log-file linux_GPU_selftests.log; then
40-
echo "==== run_samples.sh failed; dumping linux_GPU_selftests.log ===="
39+
if ! ./run_tests.sh --visbuildonly --log-file linux_GPU_selftests.log; then
40+
echo "==== run_tests.sh failed; dumping linux_GPU_selftests.log ===="
4141
cat linux_GPU_selftests.log
4242
exit 1
4343
fi

.github/workflows/linux_selftests.yaml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -42,8 +42,8 @@ jobs:
4242
- name: Bash script
4343
run: |
4444
cd utilities
45-
if ! ./run_samples.sh --nogpu --visbuildonly --log-file ../linux_selftests.log; then
46-
echo "==== run_samples.sh failed; dumping linux_selftests.log ===="
45+
if ! ./run_tests.sh --nogpu --visbuildonly --log-file ../linux_selftests.log; then
46+
echo "==== run_tests.sh failed; dumping linux_selftests.log ===="
4747
cat ../linux_selftests.log
4848
exit 1
4949
fi

.github/workflows/mac_selftests.yaml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -28,8 +28,8 @@ jobs:
2828
- name: Bash script
2929
run: |
3030
cd utilities
31-
if ! ./run_samples.sh --nogpu --visbuildonly --log-file ../macos_selftests.log; then
32-
echo "==== run_samples.sh failed; dumping macos_selftests.log ===="
31+
if ! ./run_tests.sh --nogpu --visbuildonly --log-file ../macos_selftests.log; then
32+
echo "==== run_tests.sh failed; dumping macos_selftests.log ===="
3333
cat ../macos_selftests.log
3434
exit 1
3535
fi

.github/workflows/windows_selftests.yaml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,8 +26,8 @@ jobs:
2626
shell: bash
2727
run: |
2828
cd utilities
29-
if ! ./run_samples.sh --nogpu --visbuildonly --log-file ../windows_selftests.log; then
30-
echo "==== run_samples.sh failed; dumping windows_selftests.log ===="
29+
if ! ./run_tests.sh --nogpu --visbuildonly --log-file ../windows_selftests.log; then
30+
echo "==== run_tests.sh failed; dumping windows_selftests.log ===="
3131
cat ../windows_selftests.log
3232
exit 1
3333
fi

core/CMakeLists.txt

Lines changed: 16 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -47,12 +47,25 @@ add_subdirectory("${CMAKE_CURRENT_SOURCE_DIR}/lib/libjpeg-9a" "${CMAKE_BINARY_DI
4747

4848
target_link_libraries( helios PRIVATE png_static jpeg ) #note that zlib is already linked by libpng
4949

50+
# Suppress warnings for third-party libraries
51+
if(TARGET zlibstatic)
52+
target_compile_options(zlibstatic PRIVATE $<$<C_COMPILER_ID:Clang,AppleClang,GNU>:-w>)
53+
endif()
54+
if(TARGET png_static)
55+
target_compile_options(png_static PRIVATE $<$<C_COMPILER_ID:Clang,AppleClang,GNU>:-w>)
56+
endif()
57+
if(TARGET jpeg)
58+
target_compile_options(jpeg PRIVATE $<$<C_COMPILER_ID:Clang,AppleClang,GNU>:-w>)
59+
endif()
60+
5061
set(CMAKE_MESSAGE_LOG_LEVEL ${SAVED_LOG_LEVEL})
5162

5263
file( COPY "${CMAKE_CURRENT_SOURCE_DIR}/lib/images" DESTINATION "${CMAKE_BINARY_DIR}/lib/" )
5364
file( COPY "${CMAKE_CURRENT_SOURCE_DIR}/lib/models" DESTINATION "${CMAKE_BINARY_DIR}/lib/" )
5465
file( COPY "${CMAKE_CURRENT_SOURCE_DIR}/lib/testdata" DESTINATION "${CMAKE_BINARY_DIR}/lib/" )
5566

56-
add_executable( context_tests tests/TestMain.cpp )
57-
target_link_libraries( context_tests PRIVATE helios )
58-
add_test( NAME context_tests COMMAND context_tests )
67+
if(BUILD_TESTS)
68+
add_executable( context_tests tests/TestMain.cpp )
69+
target_link_libraries( context_tests PRIVATE helios )
70+
add_test( NAME context_tests COMMAND context_tests )
71+
endif()

core/CMake_project.cmake

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
1-
option(ENABLE_OPENMP "Enable building with OpenMP" OFF)
1+
option(ENABLE_OPENMP "Enable building with OpenMP" ON)
2+
option(BUILD_TESTS "Build test executables" OFF)
23

34
# Set CMake policies to avoid warnings on newer CMake versions
45
if(POLICY CMP0074)

core/include/Context.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3166,7 +3166,7 @@ namespace helios {
31663166
* \return Helios data type of primitive data
31673167
* \sa HeliosDataType
31683168
*/
3169-
HeliosDataType getPrimitiveDataType(uint UUID, const char *label) const;
3169+
DEPRECATED( HeliosDataType getPrimitiveDataType(uint UUID, const char *label) const );
31703170

31713171
//! Get the expected data type for a primitive data label (cached lookup)
31723172
/**
@@ -4115,7 +4115,7 @@ namespace helios {
41154115
* \return Helios data type of primitive data
41164116
* \sa HeliosDataType
41174117
*/
4118-
HeliosDataType getObjectDataType(uint objID, const char *label) const;
4118+
DEPRECATED( HeliosDataType getObjectDataType(uint objID, const char *label) const );
41194119

41204120
//! Get the expected data type for an object data label (cached lookup)
41214121
/**

core/include/global.h

Lines changed: 80 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -16,16 +16,37 @@
1616
#ifndef HELIOS_GLOBAL
1717
#define HELIOS_GLOBAL
1818

19-
//! Macro for marking functions as deprecated.
20-
#ifdef __GNUC__
21-
#define DEPRECATED(func) func __attribute__((deprecated))
19+
//! Macro for marking functions as deprecated with optional custom message.
20+
// MSVC requires __declspec to come BEFORE the function declaration
21+
#if __cplusplus >= 201402L && defined(__has_cpp_attribute) && __has_cpp_attribute(deprecated)
22+
#define DEPRECATED_MSG(msg, func) [[deprecated(msg)]] func
23+
#define DEPRECATED_NOMSG(func) [[deprecated]] func
24+
#elif defined(__GNUC__) || defined(__clang__)
25+
#define DEPRECATED_MSG(msg, func) func __attribute__((deprecated(msg)))
26+
#define DEPRECATED_NOMSG(func) func __attribute__((deprecated))
2227
#elif defined(_MSC_VER)
23-
#define DEPRECATED(func) __declspec(deprecated) func
28+
// MSVC has issues with custom deprecation messages, use simple deprecation
29+
#define DEPRECATED_MSG(msg, func) __declspec(deprecated) func
30+
#define DEPRECATED_NOMSG(func) __declspec(deprecated) func
2431
#else
25-
#pragma message("WARNING: You need to implement DEPRECATED for this compiler")
26-
#define DEPRECATED(func) func
32+
#pragma message("WARNING: You need to implement DEPRECATED for this compiler")
33+
#define DEPRECATED_MSG(msg, func) func
34+
#define DEPRECATED_NOMSG(func) func
2735
#endif
2836

37+
// Helper macro to count arguments
38+
#define GET_ARG_COUNT(...) GET_ARG_COUNT_IMPL(__VA_ARGS__, 2, 1)
39+
#define GET_ARG_COUNT_IMPL(_1, _2, N, ...) N
40+
41+
// Main DEPRECATED macro that dispatches based on argument count with corrected parameter order
42+
#define DEPRECATED(...) GET_DEPRECATED_MACRO(__VA_ARGS__)(__VA_ARGS__)
43+
#define GET_DEPRECATED_MACRO(...) GET_DEPRECATED_MACRO_IMPL(GET_ARG_COUNT(__VA_ARGS__))
44+
#define GET_DEPRECATED_MACRO_IMPL(count) GET_DEPRECATED_MACRO_IMPL2(count)
45+
#define GET_DEPRECATED_MACRO_IMPL2(count) DEPRECATED_##count##_ARGS
46+
47+
#define DEPRECATED_1_ARGS(func) DEPRECATED_NOMSG(func)
48+
#define DEPRECATED_2_ARGS(func, msg) DEPRECATED_MSG(msg, func)
49+
2950
//! Pi constant.
3051
#ifndef M_PI
3152
#define M_PI 3.14159265358979323846
@@ -980,6 +1001,19 @@ namespace helios {
9801001
*/
9811002
[[nodiscard]] float fzero(float (*function)(float value, std::vector<float> &variables, const void *parameters), std::vector<float> &variables, const void *parameters, float init_guess, float err_tol = 0.0001f, int max_iterations = 100);
9821003

1004+
//! Use Newton-Raphson method to find the zero of a function with convergence status
1005+
/**
1006+
* \param[in] function Function to be evaluated. The function should take as its first argument the value at which the function should be evaluated, as second argument any function arguments.
1007+
* \param[in] variables Vector of function arguments
1008+
* \param[in] parameters Pointer to any additional parameters needed by the function
1009+
* \param[in] init_guess Initial guess for the zero of the function.
1010+
* \param[out] converged Boolean indicating whether the solver converged successfully.
1011+
* \param[in] err_tol [optional] Maximum allowable relative error in solution.
1012+
* \param[in] max_iterations [optional] Maximum number of iterations to allow before exiting solver.
1013+
* \return Value of function zero (best estimate even if not converged).
1014+
*/
1015+
[[nodiscard]] float fzero(float (*function)(float value, std::vector<float> &variables, const void *parameters), std::vector<float> &variables, const void *parameters, float init_guess, bool &converged, float err_tol = 0.0001f, int max_iterations = 100);
1016+
9831017
//! Function to perform linear interpolation based on a vector of discrete (x,y) values
9841018
/**
9851019
* \param[in] points Vector of (x,y) pairs. x values must be monotonically increasing and not duplicated.
@@ -996,6 +1030,46 @@ namespace helios {
9961030
*/
9971031
[[nodiscard]] float point_distance(const helios::vec3 &p1, const helios::vec3 &p2);
9981032

1033+
//! Generate linearly spaced values between two endpoints
1034+
/**
1035+
* \param[in] start Starting value
1036+
* \param[in] end Ending value
1037+
* \param[in] num Number of uniformly spaced points to generate
1038+
* \return Vector of linearly spaced float values
1039+
* \ingroup functions
1040+
*/
1041+
[[nodiscard]] std::vector<float> linspace(float start, float end, int num);
1042+
1043+
//! Generate linearly spaced vec2 values between two endpoints
1044+
/**
1045+
* \param[in] start Starting vec2 value
1046+
* \param[in] end Ending vec2 value
1047+
* \param[in] num Number of uniformly spaced points to generate
1048+
* \return Vector of linearly spaced vec2 values
1049+
* \ingroup functions
1050+
*/
1051+
[[nodiscard]] std::vector<vec2> linspace(const vec2 &start, const vec2 &end, int num);
1052+
1053+
//! Generate linearly spaced vec3 values between two endpoints
1054+
/**
1055+
* \param[in] start Starting vec3 value
1056+
* \param[in] end Ending vec3 value
1057+
* \param[in] num Number of uniformly spaced points to generate
1058+
* \return Vector of linearly spaced vec3 values
1059+
* \ingroup functions
1060+
*/
1061+
[[nodiscard]] std::vector<vec3> linspace(const vec3 &start, const vec3 &end, int num);
1062+
1063+
//! Generate linearly spaced vec4 values between two endpoints
1064+
/**
1065+
* \param[in] start Starting vec4 value
1066+
* \param[in] end Ending vec4 value
1067+
* \param[in] num Number of uniformly spaced points to generate
1068+
* \return Vector of linearly spaced vec4 values
1069+
* \ingroup functions
1070+
*/
1071+
[[nodiscard]] std::vector<vec4> linspace(const vec4 &start, const vec4 &end, int num);
1072+
9991073
//! Parse a file string to get the extension
10001074
/**
10011075
* Example: /path/to/file/filename.ext -> extension=".ext"

0 commit comments

Comments
 (0)