Skip to content

Commit 7efb337

Browse files
committed
[1.3.40] 2025-07-17
- Improvements to `utilities/run_benchmarks.sh` script with corresponding changes in `utilities/plot_benchmarks.py`. - Added benchmarks to documentation. - Added benchmark cases `energy_balance_dragon` and `plant_architecture_bean`. - Updated required CMake version to 3.15 for plug-ins, and made many updates to plug-in CMakeLists.txt files to use more modern CMake features. - Started transitioning tests to using the "doctest" framework. This will be a gradual process, and the old self-test framework will still be supported for now. - Reverted a previous change in `Context::setPrimitiveData()` and `Context::setObjectData()` to not use range-based for loops when it is an openmp paralell loop. - There was an issue in `Context::setObjectData()` and `Context::getObjectData()` where the openmp preprocessor directive needed to be placed after the static assert. - Moved third-party library pugixml into the `core/lib` directory for better organization. - Improved robustness of geometric intersection functions (`lineIntersection`, `pointInPolygon`, `fzero`). - Added new geometric utility function `pointOnSegment`. - Converted the self-tests to use the doctest framework. - Updated visualizer code to only transfer buffer data to the GPU that has changed, rather than re-building all geometry every time any geometry changes. - Changed the GLFW code to continuously update the window even when there are no new input events. This prevents the usual lag that can occur if the user doesn't move the mouse in the window. - Converted the self-tests to use the doctest framework. - Removed MacOS OptiX files from the repository. - Minor updates based on edge cases found in the self-tests. - Converted the self-tests to use the doctest framework.
1 parent 5d0ef4f commit 7efb337

582 files changed

Lines changed: 35505 additions & 59518 deletions

File tree

Some content is hidden

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

AGENTS.md

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,9 +4,13 @@
44

55
## Testing
66
- Do not try to run utilities/run_samples.sh. It will time out.
7+
### Documentation
78
- If changes are made to docstrings or function signatures, build the documentation file `doc/Doxyfile` using doxygen. Some notes on this are given below:
8-
- Run `doxygen doc/Doxyfile` to generate the documentation from the root directory not the `doc` directory.
9-
- Check doxygen output for warnings. It is ok to ignore warnings of the form " warning: Member XXX is not documented."
10-
- The main concern when changing docstrings or function signatures is the potential for breaking \ref references, which produces a warning like: warning: unable to resolve reference to XXX for \ref command".
9+
- Run `doxygen doc/Doxyfile` to generate the documentation from the root directory not the `doc` directory.
10+
- Check doxygen output for warnings. It is ok to ignore warnings of the form " warning: Member XXX is not documented."
11+
- The main concern when changing docstrings or function signatures is the potential for breaking \ref references, which produces a warning like: warning: unable to resolve reference to XXX for \ref command".
1112
When fixing these, don't just remove the funciton signature or use markdown `` ticks to suppress the warning. It is important to keep the signature in the reference for overloaded functions/methods. Figure out why the function signature is not matching and thus causing Doxygen to treat it as plain text.
12-
- You tend to flag hash symbols in code blocks as erroneous and propose to add a double hash (e.g., '##include "Context.h"'). This is not needed and ends up rendering the double hash.
13+
- You tend to flag hash symbols in code blocks as erroneous and propose to add a double hash (e.g., '##include "Context.h"'). This is not needed and ends up rendering the double hash.
14+
### Test Coverage
15+
- The script `utilitiesgenerate_coverage_report.sh` can be used to check test coverage.
16+
- It is recommended to use text-based output, which is achieved with the `-r text` option.
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
# Helios standard CMakeLists.txt file version 1.9
2+
cmake_minimum_required(VERSION 3.15)
3+
project(helios)
4+
5+
set(BASE_DIRECTORY "../..")
6+
set(EXECUTABLE_NAME "energy_balance_dragon")
7+
set(SOURCE_FILES "main.cpp")
8+
set(PLUGINS "energybalance")
9+
10+
include("${BASE_DIRECTORY}/core/CMake_project.cmake")
Lines changed: 54 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,54 @@
1+
#include "EnergyBalanceModel.h"
2+
3+
using namespace helios;
4+
5+
int main(){
6+
uint Nx = 500; // grid size in x
7+
uint Ny = 500; // grid size in y
8+
float D = 10.f; // domain width
9+
vec2 ground_size(D, D);
10+
11+
std::ofstream outfile("../results/runtime.txt");
12+
Timer timer;
13+
double elapsed;
14+
15+
Context context;
16+
std::vector<uint> ground_UUIDs, dragon_UUIDs, all_UUIDs;
17+
18+
timer.tic();
19+
dragon_UUIDs = context.loadPLY("../../../../PLY/StanfordDragon.ply");
20+
elapsed = timer.toc("PLY model load");
21+
outfile << "PLY model load, " << elapsed << "\n";
22+
23+
timer.tic();
24+
ground_UUIDs = context.addTile(nullorigin, ground_size, nullrotation, make_int2(Nx, Ny) );
25+
elapsed = timer.toc("Ground geometry creation");
26+
outfile << "Ground geometry creation, " << elapsed << "\n";
27+
28+
all_UUIDs = ground_UUIDs;
29+
all_UUIDs.insert(all_UUIDs.end(), dragon_UUIDs.begin(), dragon_UUIDs.end());
30+
31+
timer.tic();
32+
context.setPrimitiveData(all_UUIDs, "radiation_flux_SW", 300.f);
33+
float LW = 2.f * 5.67e-8f * pow(300.f, 4);
34+
context.setPrimitiveData(all_UUIDs, "radiation_flux_LW", LW);
35+
context.setPrimitiveData(all_UUIDs, "air_temperature", 300.f);
36+
context.setPrimitiveData(all_UUIDs, "wind_speed", 1.f);
37+
context.setPrimitiveData(all_UUIDs, "air_huidity", 0.5f);
38+
context.setPrimitiveData(all_UUIDs, "air_pressure", 101000.f);
39+
elapsed = timer.toc("Setting primitive data");
40+
outfile << "Setting primitive data, " << elapsed << "\n";
41+
42+
EnergyBalanceModel eb(&context);
43+
eb.disableMessages();
44+
45+
timer.tic();
46+
eb.addRadiationBand("SW");
47+
eb.addRadiationBand("LW");
48+
eb.run();
49+
elapsed = timer.toc("Energy balance run");
50+
outfile << "Energy balance run, " << elapsed << "\n";
51+
52+
outfile.close();
53+
return EXIT_SUCCESS;
54+
}

benchmarks/radiation_homogeneous_canopy/build/.gitignore renamed to benchmarks/energy_balance_dragon/results/.gitignore

File renamed without changes.
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
# Helios standard CMakeLists.txt file version 1.9
2+
cmake_minimum_required(VERSION 3.15)
3+
project(helios)
4+
5+
set( BASE_DIRECTORY "../.." )
6+
set( EXECUTABLE_NAME "plant_architecture_bean" )
7+
set( SOURCE_FILES "main.cpp" )
8+
set( PLUGINS "plantarchitecture" )
9+
10+
include( "${BASE_DIRECTORY}/core/CMake_project.cmake" )
Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
#include "PlantArchitecture.h"
2+
3+
using namespace helios;
4+
5+
int main(){
6+
uint Nx = 5; // number of plants in x-direction
7+
uint Ny = 5; // number of plants in y-direction
8+
vec2 spacing(0.3f, 0.3f); // plant spacing
9+
float age = 45.f; // age of plants in days
10+
11+
std::ofstream outfile("../results/runtime.txt");
12+
Timer timer;
13+
double elapsed;
14+
15+
Context context;
16+
PlantArchitecture pa(&context);
17+
pa.loadPlantModelFromLibrary("bean");
18+
19+
timer.tic();
20+
pa.buildPlantCanopyFromLibrary(make_vec3(0.f, 0.f, 0.f), spacing, make_int2(Nx, Ny), age);
21+
elapsed = timer.toc("Canopy build");
22+
outfile << "Canopy build, " << elapsed << "\n";
23+
24+
outfile.close();
25+
return EXIT_SUCCESS;
26+
}

benchmarks/plant_architecture_bean/results/.gitignore

Whitespace-only changes.

benchmarks/radiation_homogeneous_canopy/CMakeLists.txt

Lines changed: 1 addition & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -2,21 +2,10 @@
22
cmake_minimum_required(VERSION 3.15)
33
project(helios)
44

5-
#-------- USER INPUTS ---------#
6-
7-
#provide the path to Helios base directory, either as an absolute path or a path relative to the location of this file
85
set( BASE_DIRECTORY "../.." )
9-
10-
#define the name of the executable to be created
116
set( EXECUTABLE_NAME "radiation_homogeneous_canopy" )
12-
13-
#provide name of source file(s) (separate multiple file names with semicolon)
147
set( SOURCE_FILES "main.cpp" )
15-
16-
#specify which plug-ins to use (separate plug-in names with semicolon)
178
set( PLUGINS "radiation" )
189

19-
20-
#-------- DO NOT MODIFY ---------#
21-
include( "${BASE_DIRECTORY}/core/CMake_project.txt" )
10+
include( "${BASE_DIRECTORY}/core/CMake_project.cmake" )
2211

core/CMakeLists.txt

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,15 +13,19 @@ set(HELIOS_SOURCES
1313
src/Context_data.cpp
1414
src/global.cpp
1515
src/selfTest.cpp
16-
src/pugixml.cpp
16+
lib/pugixml/pugixml.cpp
1717
)
1818
add_library(helios STATIC ${HELIOS_SOURCES})
1919

2020
# Defining Helios Context include files
2121
target_include_directories(helios
2222
PUBLIC
2323
$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/include>
24+
$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/lib/pugixml>
25+
$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/lib/doctest>
2426
$<INSTALL_INTERFACE:include>
27+
$<INSTALL_INTERFACE:lib/pugixml>
28+
$<INSTALL_INTERFACE:lib/doctest>
2529
)
2630

2731
# External libraries
@@ -46,4 +50,6 @@ file( COPY "${CMAKE_CURRENT_SOURCE_DIR}/lib/images" DESTINATION "${CMAKE_BINARY_
4650
file( COPY "${CMAKE_CURRENT_SOURCE_DIR}/lib/models" DESTINATION "${CMAKE_BINARY_DIR}/lib/" )
4751
file( COPY "${CMAKE_CURRENT_SOURCE_DIR}/lib/testdata" DESTINATION "${CMAKE_BINARY_DIR}/lib/" )
4852

49-
set( PLUGIN_INCLUDE_PATHS "${CMAKE_CURRENT_SOURCE_DIR}/include;" PARENT_SCOPE )
53+
add_executable( context_tests "src/TestMain.cpp" )
54+
target_link_libraries( context_tests PRIVATE helios )
55+
add_test( NAME context_tests COMMAND context_tests )

core/CMake_project.cmake

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,7 @@ set( CMAKE_RUNTIME_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}" CACHE STRING "" )
6868
set( CMAKE_LIBRARY_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/lib" CACHE STRING "" )
6969
add_executable( ${EXECUTABLE_NAME} ${SOURCE_FILES} )
7070
add_subdirectory( "${BASE_DIRECTORY}/core" "lib" )
71-
target_link_libraries( ${EXECUTABLE_NAME} helios)
71+
target_link_libraries( ${EXECUTABLE_NAME} PUBLIC helios)
7272
if (CMAKE_CXX_COMPILER_ID STREQUAL "GNU" AND CMAKE_CXX_COMPILER_VERSION VERSION_LESS 9)
7373
target_link_libraries(${EXECUTABLE_NAME} stdc++fs)
7474
endif()
@@ -85,18 +85,16 @@ foreach(PLUGIN ${PLUGINS})
8585
message( FATAL_ERROR "[Helios] The executable name cannot be the same as a plugin name. Please rename your executable." )
8686
endif()
8787
add_subdirectory( "${BASE_DIRECTORY}/plugins/${PLUGIN}" "${PROJECT_BINARY_DIR}/plugins/${PLUGIN}" )
88-
target_link_libraries( ${EXECUTABLE_NAME} ${PLUGIN} )
88+
target_link_libraries( ${EXECUTABLE_NAME} PUBLIC ${PLUGIN} )
89+
target_link_libraries( ${PLUGIN} PUBLIC helios )
8990
if( NOT APPLE )
90-
target_link_libraries( ${PLUGIN} helios )
9191
if (CMAKE_CXX_COMPILER_ID STREQUAL "GNU" AND CMAKE_CXX_COMPILER_VERSION VERSION_LESS 9)
9292
target_link_libraries(${PLUGIN} stdc++fs)
9393
endif()
9494
endif()
9595
endforeach(PLUGIN)
96-
include_directories( "${PLUGIN_INCLUDE_PATHS};${CMAKE_CURRENT_SOURCE_DIRECTORY}" )
9796

9897
target_compile_definitions(helios PUBLIC $<$<CONFIG:Debug>:HELIOS_DEBUG> $<$<CONFIG:RelWithDebInfo>:HELIOS_DEBUG> )
99-
target_include_directories(helios PUBLIC "$<BUILD_INTERFACE:${CMAKE_BINARY_DIR}/include>" )
10098

10199
if( ENABLE_OPENMP )
102100
find_package(OpenMP)

0 commit comments

Comments
 (0)