Skip to content

Commit c38ac3d

Browse files
committed
[1.3.38] 2025-07-05
- Added `.gitattributes` file and modified build options for Windows to deal with potential file encoding issues on Windows. - Edit to `utilities/run_samples.sh` to hopefully fix issues with log file outputting within GitHub Actions workflows. - Moved `AGENTD.md` back to the base directory because it was not being applied globally when in `doc`. - Added a check to `Context::addPolymeshObject()` to ensure that the UUIDs don't already belong to another object. - Refactored `Primitive::setPrimitiveData()`, `Primitive::getPrimitiveData()`, `Context::setPrimitiveData()`, and `Context::getPrimitiveData()` to use templates to avoid a lot of redundant code. - Refactored `Context::setGlobalData()` and `Context::getGlobalData()` to use templates to avoid a lot of redundant code. - Re-wrote how templates are handled for `helios::resize_vector()`, `helios::flatten()` and `helios::powi()` to be more robust and explicitly correct. - Removed overloaded version of `Context::setPrimitiveData( uint UUID, const char* label, HeliosDataType type, uint size, void* data )`, as it is not needed. The vector-based version of `Context::setPrimitiveData()` should be used instead. - Re-wrote libjpeg error handling to me more robust. - Some updates to object geometry updating. - Added check for very small petiole length or radius so that it can be set by the user to be exactly 0. - Fixed asset copy commands in CMakeLists.txt that could cause an error on some Windows systems. - Re-wrote libjpeg error handling to me more robust. - Fixed texture and shader copy commands in CMakeLists.txt that could cause an error on some Windows systems. - Fixed an error in `Visualizer::displayImage()` where the arguments to `read_JPEG_file()` and `read_png_file()` were swapped. - Fixed issues with `Visualizer::clearColor()` where the visualizer was not properly reverting to RGB coloring. - Fixed where the colorbar range was not being automatically updated when switching between different primitive/object data visualizations. - Fixed an error where tiled textures were showing ghost lines at the seams between adjacent tiles. - Fixed 'haloing' around texture-masked primitives. - Implemented a (temporary) fix to make sure that colors are updated if the user successively calls `Visualizer::colorContextPrimitivesByData()`, `Visualizer::colorContextObjectsByData()`, or `Visualizer::clearColor()`. A more efficient long-term fix is still needed. - `plantID` can now be set as primitive or object data. - Added an example to the documentation of manually grouping leaves into a plant ID - Added self-test to check `plantID` assignment. - CMake now uses consistent c++ standard for CUDA code based on the standard used for regular c++ code. It also now explicitly sets the c++ standard for Windows CUDA code. Co-authored by: Sean Banks <smbanx@users.noreply.github.com> Co-authored by: Kyle Rizzo <ktrizzo@users.noreply.github.com>
1 parent e3f2d85 commit c38ac3d

492 files changed

Lines changed: 50453 additions & 65368 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.

.clang-format

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,7 @@ BreakBeforeBraces: Custom
2929
BreakConstructorInitializers: AfterColon
3030
BreakConstructorInitializersBeforeComma: false
3131
ColumnLimit: 250
32+
PenaltyBreakString: 1000
3233
ConstructorInitializerAllOnOneLineOrOnePerLine: false
3334
ContinuationIndentWidth: 8
3435
IncludeCategories:

.gitattributes

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
# Text files: always LF line-endings, UTF-8 working tree
2+
*.cpp text eol=lf working-tree-encoding=UTF-8
3+
*.h text eol=lf working-tree-encoding=UTF-8
4+
*.cu text eol=lf working-tree-encoding=UTF-8
5+
*.cuh text eol=lf working-tree-encoding=UTF-8
6+
7+
# Everything else – let Git decide or treat as binary
8+
* text=auto
9+
*.png binary
10+
*.jpg binary
11+
*.jpeg binary

.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
45+
if ! ./run_samples.sh --nogpu --visbuildonly --log-file ../linux_selftests.log; then
4646
echo "==== run_samples.sh failed; dumping linux_selftests.log ===="
47-
cat linux_selftests.log
47+
cat ../linux_selftests.log
4848
exit 1
4949
fi

.github/workflows/mac_selftests.yaml

Lines changed: 3 additions & 3 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
31+
if ! ./run_samples.sh --nogpu --visbuildonly --log-file ../macos_selftests.log; then
3232
echo "==== run_samples.sh failed; dumping macos_selftests.log ===="
33-
cat macos_selftests.log
33+
cat ../macos_selftests.log
3434
exit 1
35-
fi
35+
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
29+
if ! ./run_samples.sh --nogpu --visbuildonly --log-file ../windows_selftests.log; then
3030
echo "==== run_samples.sh failed; dumping windows_selftests.log ===="
31-
cat windows_selftests.log
31+
cat ../windows_selftests.log
3232
exit 1
3333
fi
File renamed without changes.

core/CMake_project.cmake

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -55,6 +55,7 @@ if ( WIN32 )
5555
set( CMAKE_ARCHIVE_OUTPUT_DIRECTORY_${OUTPUTCONFIG} "${CMAKE_BINARY_DIR}/lib" )
5656
endforeach(OUTPUTCONFIG)
5757
endif()
58+
add_compile_options($<$<CXX_COMPILER_ID:MSVC>:/utf-8>)
5859
cmake_policy(SET CMP0079 NEW)
5960
set(CMAKE_WARN_DEPRECATED OFF CACHE BOOL "" FORCE)
6061

core/include/Context.h

Lines changed: 1410 additions & 2204 deletions
Large diffs are not rendered by default.

core/include/global.h

Lines changed: 68 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -57,6 +57,7 @@ constexpr float PI_F = 3.14159265358979323846f;
5757
#include <thread>
5858
#include <iomanip>
5959
#include <filesystem>
60+
#include <type_traits>
6061

6162
#ifdef USE_OPENMP
6263
#include <omp.h>
@@ -441,9 +442,19 @@ namespace helios {
441442
* \param[in] value Value to be clamped
442443
* \param[in] min Lower bound
443444
* \param[in] max Upper bound
444-
* \ingroup functions */
445+
* \ingroup functions
446+
*/
445447
template<typename anytype>
446-
[[nodiscard]] anytype clamp(anytype value, anytype min, anytype max);
448+
[[nodiscard]] anytype clamp(anytype value, anytype min, anytype max){
449+
static_assert(std::is_same_v<anytype, int> || std::is_same_v<anytype, uint> || std::is_same_v<anytype, float> || std::is_same_v<anytype, double> || std::is_same_v<anytype, char> || std::is_same_v<anytype, unsigned char>,
450+
"helios::clamp() was called with an unsupported type.");
451+
if (value < min) {
452+
value = min;
453+
} else if (value > max) {
454+
value = max;
455+
}
456+
return value;
457+
}
447458

448459
//! Sum of a vector of floats
449460
/**
@@ -523,7 +534,10 @@ namespace helios {
523534
* \ingroup functions
524535
*/
525536
template<typename anytype>
526-
void resize_vector(std::vector<std::vector<anytype> > &vec, uint Nx, uint Ny);
537+
typename std::enable_if<std::is_default_constructible<anytype>::value>::type
538+
resize_vector(std::vector<std::vector<anytype>>& vec, size_t Nx, size_t Ny) {
539+
vec.assign(Ny, std::vector<anytype>(Nx));
540+
}
527541

528542
//! Resize 3D C++ vector
529543
/**
@@ -534,7 +548,10 @@ namespace helios {
534548
* \ingroup functions
535549
*/
536550
template<typename anytype>
537-
void resize_vector(std::vector<std::vector<std::vector<anytype> > > &vec, uint Nx, uint Ny, uint Nz);
551+
typename std::enable_if<std::is_default_constructible<anytype>::value>::type
552+
resize_vector(std::vector<std::vector<std::vector<anytype> > > &vec, size_t Nx, size_t Ny, size_t Nz){
553+
vec.assign(Nz, std::vector<std::vector<anytype>>(Ny, std::vector<anytype>(Nx)));
554+
}
538555

539556
//! Resize 4D C++ vector
540557
/**
@@ -546,7 +563,10 @@ namespace helios {
546563
* \ingroup functions
547564
*/
548565
template<typename anytype>
549-
void resize_vector(std::vector<std::vector<std::vector<std::vector<anytype> > > > &vec, uint Nx, uint Ny, uint Nz, uint Nw);
566+
typename std::enable_if<std::is_default_constructible<anytype>::value>::type
567+
resize_vector(std::vector<std::vector<std::vector<std::vector<anytype> > > > &vec, size_t Nx, size_t Ny, size_t Nz, size_t Nw){
568+
vec.assign(Nw, std::vector<std::vector<std::vector<anytype>>>(Nz, std::vector<std::vector<anytype>>(Ny, std::vector<anytype>(Nx))));
569+
}
550570

551571
//! Blend two RGB colors together
552572
/**
@@ -657,7 +677,22 @@ namespace helios {
657677
* \param[in] exp Exponent to which the base is raised (must be a non-negative integer)
658678
*/
659679
template<typename T>
660-
T powi(T base, std::size_t exp);
680+
T powi(T base, std::size_t exp){
681+
static_assert(std::is_same_v<T, uint> || std::is_same_v<T, int> || std::is_same_v<T, float> || std::is_same_v<T, double> || std::is_same_v<T, char> || std::is_same_v<T, size_t>,
682+
"helios::powi() was called with an unsupported type.");
683+
T result = static_cast<T>(1);
684+
while (exp > 0) {
685+
// If the low bit is set, multiply result by current base
686+
if (exp & 1) {
687+
result *= base;
688+
}
689+
// Square the base for the next bit
690+
base *= base;
691+
// Shift off the processed bit
692+
exp >>= 1;
693+
}
694+
return result;
695+
}
661696

662697
//!Determine if two line segments intersect. The lines segments are defined by vertices (p1,q1) and (p2,q2)
663698
/**
@@ -805,24 +840,47 @@ namespace helios {
805840
* @tparam T Type of elements in the vector
806841
*/
807842
template <typename T>
808-
[[nodiscard]] std::vector<T> flatten(const std::vector<std::vector<T>>& vec);
843+
[[nodiscard]] std::vector<T> flatten(const std::vector<std::vector<T>>& vec){
844+
std::vector<T> result;
845+
for (const auto &row: vec) {
846+
result.insert(result.end(), row.begin(), row.end());
847+
}
848+
return result;
849+
}
809850

810851
//! Template function to flatten a 3D vector into a 1D vector
811852
/**
812853
* \ingroup functions
813854
* @tparam T Type of elements in the vector
814855
*/
815856
template <typename T>
816-
[[nodiscard]] std::vector<T> flatten(const std::vector<std::vector<std::vector<T>>>& vec);
857+
[[nodiscard]] std::vector<T> flatten(const std::vector<std::vector<std::vector<T>>>& vec){
858+
std::vector<T> result;
859+
for (const auto &matrix: vec) {
860+
for (const auto &row: matrix) {
861+
result.insert(result.end(), row.begin(), row.end());
862+
}
863+
}
864+
return result;
865+
}
817866

818867
//! Template function to flatten a 4D vector into a 1D vector
819868
/**
820869
* \ingroup functions
821870
* @tparam T Type of elements in the vector
822871
*/
823872
template <typename T>
824-
[[nodiscard]] std::vector<T> flatten(const std::vector<std::vector<std::vector<std::vector<T>>>>& vec);
825-
873+
[[nodiscard]] std::vector<T> flatten(const std::vector<std::vector<std::vector<std::vector<T>>>>& vec){
874+
std::vector<T> result;
875+
for (const auto &tensor: vec) {
876+
for (const auto &matrix: tensor) {
877+
for (const auto &row: matrix) {
878+
result.insert(result.end(), row.begin(), row.end());
879+
}
880+
}
881+
}
882+
return result;
883+
}
826884

827885
//! Function to perform cubic Hermite spline interpolation
828886
/**

0 commit comments

Comments
 (0)