From bb637a05f1eee924b3c495968f00b76686efb24d Mon Sep 17 00:00:00 2001 From: Zac Miller Date: Mon, 5 Jan 2026 12:52:13 -0500 Subject: [PATCH] Add macOS/Darwin build support and Clang compatibility fixes * Add Darwin/macOS platform detection and Homebrew paths to all 14 demo Makefiles * Add OpenMP support for macOS using libomp in 7-openmp and 8-interaction demos * Fix GLSL shader syntax errors (remove errant semicolons after main()) in 5 shader files * Remove constexpr from std::string return types in 10 analytic math headers (not literal type) * Replace std::vector with std::array in 3 index files (Clang compatibility) * Fix vexing parse issues in ColumnSummaryOps_test.cpp and CrustSummaryOps_test.cpp * Add initializer_list overload to PolynomialRailyardRelation.hpp for template deduction * Fix constexpr/static issues in Properties.hpp and GasPropertyStateRelation.hpp * Add missing includes and suppress Clang-specific warnings in test Makefiles --- demo/1-triangle/Makefile | 5 +- demo/2-raster/Makefile | 5 +- demo/2-spheres/Makefile | 5 +- demo/2-stars/Makefile | 5 +- demo/2-vectors/Makefile | 5 +- demo/3-gradient/Makefile | 5 +- demo/3-terrain/Makefile | 5 +- demo/3-voronoi/Makefile | 5 +- demo/4-crust/Makefile | 5 +- demo/5-fracture/Makefile | 5 +- demo/5-fracture/_test.cpp | 6 +- demo/6-motion/Makefile | 5 +- demo/7-openmp/Makefile | 5 +- demo/7-profiling/Makefile | 5 +- demo/8-interaction/Makefile | 6 +- inc/Makefile | 6 +- inc/field/SphericalHarmonics.hpp | 2 +- inc/field/noise/WorleyNoise_test.cpp | 1 + inc/grid/dymaxion/Point.hpp | 2 +- inc/index/adapted/glm/GlmStrings.hpp | 12 +- inc/index/glm/whole_specialization.hpp | 12 +- inc/index/whole.hpp | 6 +- inc/math/Makefile | 5 +- .../analytic/ArbitraryDegreePolynomial.hpp | 2 +- inc/math/analytic/ArbitraryDegreeRational.hpp | 2 +- inc/math/analytic/Identity.hpp | 2 +- inc/math/analytic/Polynomial.hpp | 2 +- inc/math/analytic/Rational.hpp | 2 +- inc/math/analytic/Scaling.hpp | 2 +- inc/math/analytic/Shifting.hpp | 2 +- inc/math/analytic/rails/Railcar.hpp | 2 +- inc/math/analytic/rails/Railyard.hpp | 2 +- inc/math/analytic/rails/Train.hpp | 2 +- inc/math/test.cpp | 10 +- .../relation/gas/GasPropertyStateRelation.hpp | 20 +- inc/model/orbit/Properties.hpp | 12 +- inc/model/orbit/UniversalPropagator_test.cpp | 2 +- .../rock/column/ColumnSummaryOps_test.cpp | 4 +- inc/model/rock/crust/CrustSummaryOps_test.cpp | 12 +- inc/relation/PolynomialRailyardRelation.hpp | 16 ++ inc/test.cpp | 185 ++++++++++-------- src/view/ColorscaleSurfaceShaderProgram.hpp | 3 +- src/view/IndicatorSwarmShaderProgram.hpp | 2 +- src/view/MultichannelSurfaceShaderProgram.hpp | 2 +- ...RealisticPointSourceSwarmShaderProgram.hpp | 2 +- .../RealisticSphereSwarmShaderProgram.hpp | 2 +- 46 files changed, 225 insertions(+), 190 deletions(-) diff --git a/demo/1-triangle/Makefile b/demo/1-triangle/Makefile index e5bbf8af..147b6f35 100644 --- a/demo/1-triangle/Makefile +++ b/demo/1-triangle/Makefile @@ -3,17 +3,20 @@ # Subdirectory makefiles are not bad by themself, but recursive Makefiles are considered harmful! CPP = g++ -OS = $(shell uname -o | sed 's|[^/]*/||') +OS = $(shell uname -s | sed 's/MINGW.*/Msys/' | sed 's/CYGWIN.*/Cygwin/') ROOT = $(shell pwd | sed 's/tectonics.cpp.*/tectonics.cpp/') TEST = $(shell find ./ -type f -name '*_test.*pp') +BREW = $(shell brew --prefix 2>/dev/null || echo /opt/homebrew) LIBS-Linux =-lglfw -lGL -lGLEW LIBS-Msys =-lglfw3 -lopengl32 -lgdi32 -lglew32 LIBS-Cygwin =-lglfw3 -lopengl32 -lgdi32 -lglew32 +LIBS-Darwin =-L$(BREW)/lib -lglfw -lGLEW -framework OpenGL FLAGS-Linux =-Wall -Werror -pedantic-errors -rdynamic -g -D GLM_FORCE_SWIZZLE -D GLM_FORCE_PURE -D GLM_ENABLE_EXPERIMENTAL FLAGS-Msys =-Wall -Werror -pedantic-errors -g -D GLM_FORCE_SWIZZLE -D GLM_FORCE_PURE -D GLM_ENABLE_EXPERIMENTAL FLAGS-Cygwin =-Wall -Werror -pedantic-errors -g -D GLM_FORCE_SWIZZLE -D GLM_FORCE_PURE -D GLM_ENABLE_EXPERIMENTAL +FLAGS-Darwin =-Wall -Werror -pedantic-errors -g -D GLM_FORCE_SWIZZLE -D GLM_FORCE_PURE -D GLM_ENABLE_EXPERIMENTAL -I$(BREW)/include all: $(TEST) ./Makefile rm -f test.cpp && \ diff --git a/demo/2-raster/Makefile b/demo/2-raster/Makefile index cb7df25c..529518de 100644 --- a/demo/2-raster/Makefile +++ b/demo/2-raster/Makefile @@ -3,17 +3,20 @@ # Subdirectory makefiles are not bad by themself, but recursive Makefiles are considered harmful! CPP = g++ -OS = $(shell uname -o | sed 's|[^/]*/||') +OS = $(shell uname -s | sed 's/MINGW.*/Msys/' | sed 's/CYGWIN.*/Cygwin/') ROOT = $(shell pwd | sed 's/tectonics.cpp.*/tectonics.cpp/') TEST = $(shell find ./ -type f -name '*_test.*pp') +BREW = $(shell brew --prefix 2>/dev/null || echo /opt/homebrew) LIBS-Linux =-lglfw -lGL -lGLEW LIBS-Msys =-lglfw3 -lopengl32 -lgdi32 -lglew32 LIBS-Cygwin =-lglfw3 -lopengl32 -lgdi32 -lglew32 +LIBS-Darwin =-L$(BREW)/lib -lglfw -lGLEW -framework OpenGL FLAGS-Linux =-Wall -Werror -pedantic-errors -rdynamic -g -D GLM_FORCE_SWIZZLE -D GLM_FORCE_PURE -D GLM_ENABLE_EXPERIMENTAL FLAGS-Msys =-Wall -Werror -pedantic-errors -g -D GLM_FORCE_SWIZZLE -D GLM_FORCE_PURE -D GLM_ENABLE_EXPERIMENTAL FLAGS-Cygwin =-Wall -Werror -pedantic-errors -g -D GLM_FORCE_SWIZZLE -D GLM_FORCE_PURE -D GLM_ENABLE_EXPERIMENTAL +FLAGS-Darwin =-Wall -Werror -pedantic-errors -g -D GLM_FORCE_SWIZZLE -D GLM_FORCE_PURE -D GLM_ENABLE_EXPERIMENTAL -I$(BREW)/include all: $(TEST) ./Makefile rm -f test.cpp && \ diff --git a/demo/2-spheres/Makefile b/demo/2-spheres/Makefile index 64817574..0e5b06f5 100644 --- a/demo/2-spheres/Makefile +++ b/demo/2-spheres/Makefile @@ -3,17 +3,20 @@ # Subdirectory makefiles are not bad by themself, but recursive Makefiles are considered harmful! CPP = g++ -OS = $(shell uname -o | sed 's|[^/]*/||') +OS = $(shell uname -s | sed 's/MINGW.*/Msys/' | sed 's/CYGWIN.*/Cygwin/') ROOT = $(shell pwd | sed 's/tectonics.cpp.*/tectonics.cpp/') TEST = $(shell find ./ -type f -name '*_test.*pp') +BREW = $(shell brew --prefix 2>/dev/null || echo /opt/homebrew) LIBS-Linux =-lglfw -lGL -lGLEW LIBS-Msys =-lglfw3 -lopengl32 -lgdi32 -lglew32 LIBS-Cygwin =-lglfw3 -lopengl32 -lgdi32 -lglew32 +LIBS-Darwin =-L$(BREW)/lib -lglfw -lGLEW -framework OpenGL FLAGS-Linux =-Wall -Werror -pedantic-errors -rdynamic -g -D GLM_FORCE_SWIZZLE -D GLM_FORCE_PURE -D GLM_ENABLE_EXPERIMENTAL FLAGS-Msys =-Wall -Werror -pedantic-errors -g -D GLM_FORCE_SWIZZLE -D GLM_FORCE_PURE -D GLM_ENABLE_EXPERIMENTAL FLAGS-Cygwin =-Wall -Werror -pedantic-errors -g -D GLM_FORCE_SWIZZLE -D GLM_FORCE_PURE -D GLM_ENABLE_EXPERIMENTAL +FLAGS-Darwin =-Wno-macro-redefined -Wall -Werror -pedantic-errors -g -D GLM_FORCE_SWIZZLE -D GLM_FORCE_PURE -D GLM_ENABLE_EXPERIMENTAL -I$(BREW)/include all: $(TEST) ./Makefile rm -f test.cpp && \ diff --git a/demo/2-stars/Makefile b/demo/2-stars/Makefile index 64817574..ef4f70d4 100644 --- a/demo/2-stars/Makefile +++ b/demo/2-stars/Makefile @@ -3,17 +3,20 @@ # Subdirectory makefiles are not bad by themself, but recursive Makefiles are considered harmful! CPP = g++ -OS = $(shell uname -o | sed 's|[^/]*/||') +OS = $(shell uname -s | sed 's/MINGW.*/Msys/' | sed 's/CYGWIN.*/Cygwin/') ROOT = $(shell pwd | sed 's/tectonics.cpp.*/tectonics.cpp/') TEST = $(shell find ./ -type f -name '*_test.*pp') +BREW = $(shell brew --prefix 2>/dev/null || echo /opt/homebrew) LIBS-Linux =-lglfw -lGL -lGLEW LIBS-Msys =-lglfw3 -lopengl32 -lgdi32 -lglew32 LIBS-Cygwin =-lglfw3 -lopengl32 -lgdi32 -lglew32 +LIBS-Darwin =-L$(BREW)/lib -lglfw -lGLEW -framework OpenGL FLAGS-Linux =-Wall -Werror -pedantic-errors -rdynamic -g -D GLM_FORCE_SWIZZLE -D GLM_FORCE_PURE -D GLM_ENABLE_EXPERIMENTAL FLAGS-Msys =-Wall -Werror -pedantic-errors -g -D GLM_FORCE_SWIZZLE -D GLM_FORCE_PURE -D GLM_ENABLE_EXPERIMENTAL FLAGS-Cygwin =-Wall -Werror -pedantic-errors -g -D GLM_FORCE_SWIZZLE -D GLM_FORCE_PURE -D GLM_ENABLE_EXPERIMENTAL +FLAGS-Darwin =-Wall -Werror -pedantic-errors -g -D GLM_FORCE_SWIZZLE -D GLM_FORCE_PURE -D GLM_ENABLE_EXPERIMENTAL -I$(BREW)/include all: $(TEST) ./Makefile rm -f test.cpp && \ diff --git a/demo/2-vectors/Makefile b/demo/2-vectors/Makefile index 64817574..ef4f70d4 100644 --- a/demo/2-vectors/Makefile +++ b/demo/2-vectors/Makefile @@ -3,17 +3,20 @@ # Subdirectory makefiles are not bad by themself, but recursive Makefiles are considered harmful! CPP = g++ -OS = $(shell uname -o | sed 's|[^/]*/||') +OS = $(shell uname -s | sed 's/MINGW.*/Msys/' | sed 's/CYGWIN.*/Cygwin/') ROOT = $(shell pwd | sed 's/tectonics.cpp.*/tectonics.cpp/') TEST = $(shell find ./ -type f -name '*_test.*pp') +BREW = $(shell brew --prefix 2>/dev/null || echo /opt/homebrew) LIBS-Linux =-lglfw -lGL -lGLEW LIBS-Msys =-lglfw3 -lopengl32 -lgdi32 -lglew32 LIBS-Cygwin =-lglfw3 -lopengl32 -lgdi32 -lglew32 +LIBS-Darwin =-L$(BREW)/lib -lglfw -lGLEW -framework OpenGL FLAGS-Linux =-Wall -Werror -pedantic-errors -rdynamic -g -D GLM_FORCE_SWIZZLE -D GLM_FORCE_PURE -D GLM_ENABLE_EXPERIMENTAL FLAGS-Msys =-Wall -Werror -pedantic-errors -g -D GLM_FORCE_SWIZZLE -D GLM_FORCE_PURE -D GLM_ENABLE_EXPERIMENTAL FLAGS-Cygwin =-Wall -Werror -pedantic-errors -g -D GLM_FORCE_SWIZZLE -D GLM_FORCE_PURE -D GLM_ENABLE_EXPERIMENTAL +FLAGS-Darwin =-Wall -Werror -pedantic-errors -g -D GLM_FORCE_SWIZZLE -D GLM_FORCE_PURE -D GLM_ENABLE_EXPERIMENTAL -I$(BREW)/include all: $(TEST) ./Makefile rm -f test.cpp && \ diff --git a/demo/3-gradient/Makefile b/demo/3-gradient/Makefile index 64817574..ef4f70d4 100644 --- a/demo/3-gradient/Makefile +++ b/demo/3-gradient/Makefile @@ -3,17 +3,20 @@ # Subdirectory makefiles are not bad by themself, but recursive Makefiles are considered harmful! CPP = g++ -OS = $(shell uname -o | sed 's|[^/]*/||') +OS = $(shell uname -s | sed 's/MINGW.*/Msys/' | sed 's/CYGWIN.*/Cygwin/') ROOT = $(shell pwd | sed 's/tectonics.cpp.*/tectonics.cpp/') TEST = $(shell find ./ -type f -name '*_test.*pp') +BREW = $(shell brew --prefix 2>/dev/null || echo /opt/homebrew) LIBS-Linux =-lglfw -lGL -lGLEW LIBS-Msys =-lglfw3 -lopengl32 -lgdi32 -lglew32 LIBS-Cygwin =-lglfw3 -lopengl32 -lgdi32 -lglew32 +LIBS-Darwin =-L$(BREW)/lib -lglfw -lGLEW -framework OpenGL FLAGS-Linux =-Wall -Werror -pedantic-errors -rdynamic -g -D GLM_FORCE_SWIZZLE -D GLM_FORCE_PURE -D GLM_ENABLE_EXPERIMENTAL FLAGS-Msys =-Wall -Werror -pedantic-errors -g -D GLM_FORCE_SWIZZLE -D GLM_FORCE_PURE -D GLM_ENABLE_EXPERIMENTAL FLAGS-Cygwin =-Wall -Werror -pedantic-errors -g -D GLM_FORCE_SWIZZLE -D GLM_FORCE_PURE -D GLM_ENABLE_EXPERIMENTAL +FLAGS-Darwin =-Wall -Werror -pedantic-errors -g -D GLM_FORCE_SWIZZLE -D GLM_FORCE_PURE -D GLM_ENABLE_EXPERIMENTAL -I$(BREW)/include all: $(TEST) ./Makefile rm -f test.cpp && \ diff --git a/demo/3-terrain/Makefile b/demo/3-terrain/Makefile index 64817574..ef4f70d4 100644 --- a/demo/3-terrain/Makefile +++ b/demo/3-terrain/Makefile @@ -3,17 +3,20 @@ # Subdirectory makefiles are not bad by themself, but recursive Makefiles are considered harmful! CPP = g++ -OS = $(shell uname -o | sed 's|[^/]*/||') +OS = $(shell uname -s | sed 's/MINGW.*/Msys/' | sed 's/CYGWIN.*/Cygwin/') ROOT = $(shell pwd | sed 's/tectonics.cpp.*/tectonics.cpp/') TEST = $(shell find ./ -type f -name '*_test.*pp') +BREW = $(shell brew --prefix 2>/dev/null || echo /opt/homebrew) LIBS-Linux =-lglfw -lGL -lGLEW LIBS-Msys =-lglfw3 -lopengl32 -lgdi32 -lglew32 LIBS-Cygwin =-lglfw3 -lopengl32 -lgdi32 -lglew32 +LIBS-Darwin =-L$(BREW)/lib -lglfw -lGLEW -framework OpenGL FLAGS-Linux =-Wall -Werror -pedantic-errors -rdynamic -g -D GLM_FORCE_SWIZZLE -D GLM_FORCE_PURE -D GLM_ENABLE_EXPERIMENTAL FLAGS-Msys =-Wall -Werror -pedantic-errors -g -D GLM_FORCE_SWIZZLE -D GLM_FORCE_PURE -D GLM_ENABLE_EXPERIMENTAL FLAGS-Cygwin =-Wall -Werror -pedantic-errors -g -D GLM_FORCE_SWIZZLE -D GLM_FORCE_PURE -D GLM_ENABLE_EXPERIMENTAL +FLAGS-Darwin =-Wall -Werror -pedantic-errors -g -D GLM_FORCE_SWIZZLE -D GLM_FORCE_PURE -D GLM_ENABLE_EXPERIMENTAL -I$(BREW)/include all: $(TEST) ./Makefile rm -f test.cpp && \ diff --git a/demo/3-voronoi/Makefile b/demo/3-voronoi/Makefile index 64817574..ef4f70d4 100644 --- a/demo/3-voronoi/Makefile +++ b/demo/3-voronoi/Makefile @@ -3,17 +3,20 @@ # Subdirectory makefiles are not bad by themself, but recursive Makefiles are considered harmful! CPP = g++ -OS = $(shell uname -o | sed 's|[^/]*/||') +OS = $(shell uname -s | sed 's/MINGW.*/Msys/' | sed 's/CYGWIN.*/Cygwin/') ROOT = $(shell pwd | sed 's/tectonics.cpp.*/tectonics.cpp/') TEST = $(shell find ./ -type f -name '*_test.*pp') +BREW = $(shell brew --prefix 2>/dev/null || echo /opt/homebrew) LIBS-Linux =-lglfw -lGL -lGLEW LIBS-Msys =-lglfw3 -lopengl32 -lgdi32 -lglew32 LIBS-Cygwin =-lglfw3 -lopengl32 -lgdi32 -lglew32 +LIBS-Darwin =-L$(BREW)/lib -lglfw -lGLEW -framework OpenGL FLAGS-Linux =-Wall -Werror -pedantic-errors -rdynamic -g -D GLM_FORCE_SWIZZLE -D GLM_FORCE_PURE -D GLM_ENABLE_EXPERIMENTAL FLAGS-Msys =-Wall -Werror -pedantic-errors -g -D GLM_FORCE_SWIZZLE -D GLM_FORCE_PURE -D GLM_ENABLE_EXPERIMENTAL FLAGS-Cygwin =-Wall -Werror -pedantic-errors -g -D GLM_FORCE_SWIZZLE -D GLM_FORCE_PURE -D GLM_ENABLE_EXPERIMENTAL +FLAGS-Darwin =-Wall -Werror -pedantic-errors -g -D GLM_FORCE_SWIZZLE -D GLM_FORCE_PURE -D GLM_ENABLE_EXPERIMENTAL -I$(BREW)/include all: $(TEST) ./Makefile rm -f test.cpp && \ diff --git a/demo/4-crust/Makefile b/demo/4-crust/Makefile index 64817574..ef4f70d4 100644 --- a/demo/4-crust/Makefile +++ b/demo/4-crust/Makefile @@ -3,17 +3,20 @@ # Subdirectory makefiles are not bad by themself, but recursive Makefiles are considered harmful! CPP = g++ -OS = $(shell uname -o | sed 's|[^/]*/||') +OS = $(shell uname -s | sed 's/MINGW.*/Msys/' | sed 's/CYGWIN.*/Cygwin/') ROOT = $(shell pwd | sed 's/tectonics.cpp.*/tectonics.cpp/') TEST = $(shell find ./ -type f -name '*_test.*pp') +BREW = $(shell brew --prefix 2>/dev/null || echo /opt/homebrew) LIBS-Linux =-lglfw -lGL -lGLEW LIBS-Msys =-lglfw3 -lopengl32 -lgdi32 -lglew32 LIBS-Cygwin =-lglfw3 -lopengl32 -lgdi32 -lglew32 +LIBS-Darwin =-L$(BREW)/lib -lglfw -lGLEW -framework OpenGL FLAGS-Linux =-Wall -Werror -pedantic-errors -rdynamic -g -D GLM_FORCE_SWIZZLE -D GLM_FORCE_PURE -D GLM_ENABLE_EXPERIMENTAL FLAGS-Msys =-Wall -Werror -pedantic-errors -g -D GLM_FORCE_SWIZZLE -D GLM_FORCE_PURE -D GLM_ENABLE_EXPERIMENTAL FLAGS-Cygwin =-Wall -Werror -pedantic-errors -g -D GLM_FORCE_SWIZZLE -D GLM_FORCE_PURE -D GLM_ENABLE_EXPERIMENTAL +FLAGS-Darwin =-Wall -Werror -pedantic-errors -g -D GLM_FORCE_SWIZZLE -D GLM_FORCE_PURE -D GLM_ENABLE_EXPERIMENTAL -I$(BREW)/include all: $(TEST) ./Makefile rm -f test.cpp && \ diff --git a/demo/5-fracture/Makefile b/demo/5-fracture/Makefile index 64817574..ef4f70d4 100644 --- a/demo/5-fracture/Makefile +++ b/demo/5-fracture/Makefile @@ -3,17 +3,20 @@ # Subdirectory makefiles are not bad by themself, but recursive Makefiles are considered harmful! CPP = g++ -OS = $(shell uname -o | sed 's|[^/]*/||') +OS = $(shell uname -s | sed 's/MINGW.*/Msys/' | sed 's/CYGWIN.*/Cygwin/') ROOT = $(shell pwd | sed 's/tectonics.cpp.*/tectonics.cpp/') TEST = $(shell find ./ -type f -name '*_test.*pp') +BREW = $(shell brew --prefix 2>/dev/null || echo /opt/homebrew) LIBS-Linux =-lglfw -lGL -lGLEW LIBS-Msys =-lglfw3 -lopengl32 -lgdi32 -lglew32 LIBS-Cygwin =-lglfw3 -lopengl32 -lgdi32 -lglew32 +LIBS-Darwin =-L$(BREW)/lib -lglfw -lGLEW -framework OpenGL FLAGS-Linux =-Wall -Werror -pedantic-errors -rdynamic -g -D GLM_FORCE_SWIZZLE -D GLM_FORCE_PURE -D GLM_ENABLE_EXPERIMENTAL FLAGS-Msys =-Wall -Werror -pedantic-errors -g -D GLM_FORCE_SWIZZLE -D GLM_FORCE_PURE -D GLM_ENABLE_EXPERIMENTAL FLAGS-Cygwin =-Wall -Werror -pedantic-errors -g -D GLM_FORCE_SWIZZLE -D GLM_FORCE_PURE -D GLM_ENABLE_EXPERIMENTAL +FLAGS-Darwin =-Wall -Werror -pedantic-errors -g -D GLM_FORCE_SWIZZLE -D GLM_FORCE_PURE -D GLM_ENABLE_EXPERIMENTAL -I$(BREW)/include all: $(TEST) ./Makefile rm -f test.cpp && \ diff --git a/demo/5-fracture/_test.cpp b/demo/5-fracture/_test.cpp index 6f3f62f4..511f29f8 100644 --- a/demo/5-fracture/_test.cpp +++ b/demo/5-fracture/_test.cpp @@ -125,7 +125,7 @@ int main() { using density = si::density; using length = si::length; using pressure = si::pressure; - using viscosity = si::dynamic_viscosity; + // using viscosity = si::dynamic_viscosity; using acceleration = si::acceleration; using vec3 = glm::vec3; @@ -134,7 +134,7 @@ int main() { length world_radius(6.371e6 * si::meter); density mantle_density(3000.0*si::kilogram/si::meter3); - viscosity mantle_viscosity(1.57e20*si::pascal*si::second); + // viscosity mantle_viscosity(1.57e20*si::pascal*si::second); int vertices_per_fine_square_side(30); int vertices_per_coarse_square_side(vertices_per_fine_square_side/2); dymaxion::Grid fine(world_radius/meter, vertices_per_fine_square_side); @@ -303,7 +303,7 @@ int main() { } iterated::Bitset bitset{adapted::BooleanBitset{}}; - unlayered::Morphology morphology{bitset}; + // unlayered::Morphology morphology{bitset}; adapted::SymbolicOrder suborder; adapted::SiStrings substrings; diff --git a/demo/6-motion/Makefile b/demo/6-motion/Makefile index 64817574..ef4f70d4 100644 --- a/demo/6-motion/Makefile +++ b/demo/6-motion/Makefile @@ -3,17 +3,20 @@ # Subdirectory makefiles are not bad by themself, but recursive Makefiles are considered harmful! CPP = g++ -OS = $(shell uname -o | sed 's|[^/]*/||') +OS = $(shell uname -s | sed 's/MINGW.*/Msys/' | sed 's/CYGWIN.*/Cygwin/') ROOT = $(shell pwd | sed 's/tectonics.cpp.*/tectonics.cpp/') TEST = $(shell find ./ -type f -name '*_test.*pp') +BREW = $(shell brew --prefix 2>/dev/null || echo /opt/homebrew) LIBS-Linux =-lglfw -lGL -lGLEW LIBS-Msys =-lglfw3 -lopengl32 -lgdi32 -lglew32 LIBS-Cygwin =-lglfw3 -lopengl32 -lgdi32 -lglew32 +LIBS-Darwin =-L$(BREW)/lib -lglfw -lGLEW -framework OpenGL FLAGS-Linux =-Wall -Werror -pedantic-errors -rdynamic -g -D GLM_FORCE_SWIZZLE -D GLM_FORCE_PURE -D GLM_ENABLE_EXPERIMENTAL FLAGS-Msys =-Wall -Werror -pedantic-errors -g -D GLM_FORCE_SWIZZLE -D GLM_FORCE_PURE -D GLM_ENABLE_EXPERIMENTAL FLAGS-Cygwin =-Wall -Werror -pedantic-errors -g -D GLM_FORCE_SWIZZLE -D GLM_FORCE_PURE -D GLM_ENABLE_EXPERIMENTAL +FLAGS-Darwin =-Wall -Werror -pedantic-errors -g -D GLM_FORCE_SWIZZLE -D GLM_FORCE_PURE -D GLM_ENABLE_EXPERIMENTAL -I$(BREW)/include all: $(TEST) ./Makefile rm -f test.cpp && \ diff --git a/demo/7-openmp/Makefile b/demo/7-openmp/Makefile index 8cedc485..f7da5b43 100644 --- a/demo/7-openmp/Makefile +++ b/demo/7-openmp/Makefile @@ -7,17 +7,20 @@ # Subdirectory makefiles are not bad by themself, but recursive Makefiles are considered harmful! CPP = g++ -OS = $(shell uname -o | sed 's|[^/]*/||') +OS = $(shell uname -s | sed 's/MINGW.*/Msys/' | sed 's/CYGWIN.*/Cygwin/') ROOT = $(shell pwd | sed 's/tectonics.cpp.*/tectonics.cpp/') TEST = $(shell find ./ -type f -name '*_test.*pp') +BREW = $(shell brew --prefix 2>/dev/null || echo /opt/homebrew) LIBS-Linux =-lglfw -lGL -lGLEW LIBS-Msys =-lglfw3 -lopengl32 -lgdi32 -lglew32 LIBS-Cygwin =-lglfw3 -lopengl32 -lgdi32 -lglew32 +LIBS-Darwin =-L$(BREW)/lib -L$(BREW)/opt/libomp/lib -lglfw -lGLEW -framework OpenGL -lomp FLAGS-Linux =-fopenmp -march=native -Wall -Werror -pedantic-errors -rdynamic -g -D GLM_FORCE_SWIZZLE -D GLM_FORCE_PURE -D GLM_ENABLE_EXPERIMENTAL FLAGS-Msys =-fopenmp -march=native -Wall -Werror -pedantic-errors -g -D GLM_FORCE_SWIZZLE -D GLM_FORCE_PURE -D GLM_ENABLE_EXPERIMENTAL FLAGS-Cygwin =-fopenmp -march=native -Wall -Werror -pedantic-errors -g -D GLM_FORCE_SWIZZLE -D GLM_FORCE_PURE -D GLM_ENABLE_EXPERIMENTAL +FLAGS-Darwin =-Xpreprocessor -fopenmp -Wall -Werror -pedantic-errors -g -D GLM_FORCE_SWIZZLE -D GLM_FORCE_PURE -D GLM_ENABLE_EXPERIMENTAL -I$(BREW)/include -I$(BREW)/opt/libomp/include all: $(TEST) ./Makefile rm -f test.cpp && \ diff --git a/demo/7-profiling/Makefile b/demo/7-profiling/Makefile index c869e5bf..10cae39a 100644 --- a/demo/7-profiling/Makefile +++ b/demo/7-profiling/Makefile @@ -3,17 +3,20 @@ # Subdirectory makefiles are not bad by themself, but recursive Makefiles are considered harmful! CPP=g++ -OS = $(shell uname -o | sed 's|[^/]*/||') +OS = $(shell uname -s | sed 's/MINGW.*/Msys/' | sed 's/CYGWIN.*/Cygwin/') ROOT = $(shell pwd | sed 's/tectonics.cpp.*/tectonics.cpp/') +BREW = $(shell brew --prefix 2>/dev/null || echo /opt/homebrew) TEST = $(shell find ./ -type f -name '*_test.*pp') LIBS-Linux =-lglfw -lGL -lGLEW LIBS-Msys =-lglfw3 -lopengl32 -lgdi32 -lglew32 LIBS-Cygwin =-lglfw3 -lopengl32 -lgdi32 -lglew32 +LIBS-Darwin =-L$(BREW)/lib -lglfw -lGLEW -framework OpenGL FLAGS-Linux =-pg -march=native -Wall -Werror -pedantic-errors -rdynamic -g -D GLM_FORCE_SWIZZLE -D GLM_FORCE_PURE -D GLM_ENABLE_EXPERIMENTAL FLAGS-Msys =-pg -march=native -Wno-unknown-pragmas -Wall -Werror -pedantic-errors -g -D GLM_FORCE_SWIZZLE -D GLM_FORCE_PURE -D GLM_ENABLE_EXPERIMENTAL FLAGS-Cygwin =-pg -march=native -Wno-unknown-pragmas -Wall -Werror -pedantic-errors -g -D GLM_FORCE_SWIZZLE -D GLM_FORCE_PURE -D GLM_ENABLE_EXPERIMENTAL +FLAGS-Darwin =-pg -Wall -Werror -pedantic-errors -g -D GLM_FORCE_SWIZZLE -D GLM_FORCE_PURE -D GLM_ENABLE_EXPERIMENTAL -I$(BREW)/include all: $(TEST) ./Makefile rm -f test.cpp test.out gmon.out && \ diff --git a/demo/8-interaction/Makefile b/demo/8-interaction/Makefile index d84740c3..13cd6ec5 100644 --- a/demo/8-interaction/Makefile +++ b/demo/8-interaction/Makefile @@ -7,21 +7,25 @@ # Subdirectory makefiles are not bad by themself, but recursive Makefiles are considered harmful! CPP = g++ -OS = $(shell uname -o | sed 's|[^/]*/||') +OS = $(shell uname -s | sed 's/MINGW.*/Msys/' | sed 's/CYGWIN.*/Cygwin/') ROOT = $(shell pwd | sed 's/tectonics.cpp.*/tectonics.cpp/') TEST = $(shell find ./ -type f -name '*_test.*pp') +BREW = $(shell brew --prefix 2>/dev/null || echo /opt/homebrew) OUT-Linux = test.out OUT-Msys = test.exe OUT-Cygwin = test.exe +OUT-Darwin = test.out LIBS-Linux =-lglfw -lGL -lGLEW LIBS-Msys =-lglfw3 -lopengl32 -lgdi32 -lglew32 LIBS-Cygwin =-lglfw3 -lopengl32 -lgdi32 -lglew32 +LIBS-Darwin =-L$(BREW)/lib -L$(BREW)/opt/libomp/lib -lglfw -lGLEW -framework OpenGL -lomp FLAGS-Linux =-fopenmp -march=native -Wall -Werror -pedantic-errors -rdynamic -g -D GLM_FORCE_SWIZZLE -D GLM_FORCE_PURE -D GLM_ENABLE_EXPERIMENTAL FLAGS-Msys =-fopenmp -march=native -Wall -Werror -pedantic-errors -g -D GLM_FORCE_SWIZZLE -D GLM_FORCE_PURE -D GLM_ENABLE_EXPERIMENTAL FLAGS-Cygwin =-fopenmp -march=native -Wall -Werror -pedantic-errors -g -D GLM_FORCE_SWIZZLE -D GLM_FORCE_PURE -D GLM_ENABLE_EXPERIMENTAL +FLAGS-Darwin =-Xpreprocessor -fopenmp -Wall -Werror -pedantic-errors -g -D GLM_FORCE_SWIZZLE -D GLM_FORCE_PURE -D GLM_ENABLE_EXPERIMENTAL -I$(BREW)/include -I$(BREW)/opt/libomp/include all: $(TEST) ./Makefile rm -f test.cpp && \ diff --git a/inc/Makefile b/inc/Makefile index b2565ac9..d018e375 100644 --- a/inc/Makefile +++ b/inc/Makefile @@ -6,11 +6,7 @@ CPP=g++ ROOT = $(shell pwd | sed 's/tectonics.cpp.*/tectonics.cpp/') TEST = $(shell find ./ -type f -name '*_test.*pp') - -# GLM_FORCE_SWIZZLE support swizzling in glm -# GLM_FORCE_PURE disable anonymous structs so we can build with ISO C++ -# GLM_ENABLE_EXPERIMENTAL disable anonymous structs so we can build with ISO C++ -FLAGS= -Wall -Werror -pedantic-errors -rdynamic -g -D GLM_FORCE_SWIZZLE -D GLM_FORCE_PURE -D GLM_ENABLE_EXPERIMENTAL -D GLM_FORCE_PURE -D GLM_ENABLE_EXPERIMENTAL +FLAGS= -Wall -Werror -pedantic-errors -rdynamic -g -D GLM_FORCE_SWIZZLE -D GLM_FORCE_PURE -D GLM_ENABLE_EXPERIMENTAL -Wno-deprecated-declarations -Wno-braced-scalar-init -Wno-unused-variable -Wno-vexing-parse -Wno-macro-redefined all: $(TEST) ./Makefile rm -f test.cpp && \ diff --git a/inc/field/SphericalHarmonics.hpp b/inc/field/SphericalHarmonics.hpp index e48c80d6..228b1f19 100644 --- a/inc/field/SphericalHarmonics.hpp +++ b/inc/field/SphericalHarmonics.hpp @@ -98,7 +98,7 @@ namespace field /* template - constexpr std::string to_string(const SphericalHarmonic& p) + std::string to_string(const SphericalHarmonic& p) { // const std::string exponents("⁰¹²³⁴⁵⁶⁷⁸⁹"); std::string output; diff --git a/inc/field/noise/WorleyNoise_test.cpp b/inc/field/noise/WorleyNoise_test.cpp index f2dadb06..36bbccab 100644 --- a/inc/field/noise/WorleyNoise_test.cpp +++ b/inc/field/noise/WorleyNoise_test.cpp @@ -22,6 +22,7 @@ #include #include "MosaicNoise.hpp" +#include "MosaicOps.hpp" #include "WorleyNoise.hpp" #include diff --git a/inc/grid/dymaxion/Point.hpp b/inc/grid/dymaxion/Point.hpp index a994210f..719c7b99 100644 --- a/inc/grid/dymaxion/Point.hpp +++ b/inc/grid/dymaxion/Point.hpp @@ -74,7 +74,7 @@ namespace dymaxion }; template - constexpr std::string to_string(const Point point) + std::string to_string(const Point point) { return "Point(" + std::to_string(point.square_id) + "," +std::to_string(point.square_position.x) + "," +std::to_string(point.square_position.y) + ")"; } diff --git a/inc/index/adapted/glm/GlmStrings.hpp b/inc/index/adapted/glm/GlmStrings.hpp index 37c569fb..311b42a7 100644 --- a/inc/index/adapted/glm/GlmStrings.hpp +++ b/inc/index/adapted/glm/GlmStrings.hpp @@ -12,20 +12,12 @@ namespace adapted class GlmStrings { - #if defined(__clang__) - const std::vector - #else - const std::array - #endif + const std::array weak { "→","↗","↗","↑","↑","↖","↖","←","←","↙","↙","↓","↓","↘","↘","→" }; - #if defined(__clang__) - const std::vector - #else - const std::array - #endif + const std::array strong { "➡","⬈","⬈","⬆","⬆","⬉","⬉","⬅","⬅","⬋","⬋","⬇","⬇","⬊","⬊","➡" diff --git a/inc/index/glm/whole_specialization.hpp b/inc/index/glm/whole_specialization.hpp index c420584f..b47b5102 100644 --- a/inc/index/glm/whole_specialization.hpp +++ b/inc/index/glm/whole_specialization.hpp @@ -13,20 +13,12 @@ namespace whole { - #if defined(__clang__) - const std::vector - #else - const std::array - #endif + const std::array weak { "←","↙","↙","↓","↓","↘","↘","→","→","↗","↗","↑","↑","↖","↖","←" }; - #if defined(__clang__) - const std::vector - #else - const std::array - #endif + const std::array strong { "⬅","⬋","⬋","⬇","⬇","⬊","⬊","➡","➡","⬈","⬈","⬆","⬆","⬉","⬉","⬅" diff --git a/inc/index/whole.hpp b/inc/index/whole.hpp index d4e02212..4f42d802 100644 --- a/inc/index/whole.hpp +++ b/inc/index/whole.hpp @@ -387,11 +387,7 @@ namespace whole - #if defined(__clang__) - const std::vector - #else - const std::array - #endif + const std::array shades {" ", "░", "▒", "▓", "█" }; inline bool magnitude(const bool a){ diff --git a/inc/math/Makefile b/inc/math/Makefile index 9c530ac4..d969b5c9 100644 --- a/inc/math/Makefile +++ b/inc/math/Makefile @@ -6,10 +6,7 @@ CPP=g++ ROOT = $(shell pwd | sed 's/tectonics.cpp.*/tectonics.cpp/') TEST = $(shell find ./ -type f -name '*_test.*pp') -# GLM_FORCE_SWIZZLE support swizzling in glm -# GLM_FORCE_PURE disable anonymous structs so we can build with ISO C++ -# GLM_ENABLE_EXPERIMENTAL disable anonymous structs so we can build with ISO C++ -FLAGS= -Wall -Werror -pedantic-errors -g -D GLM_FORCE_SWIZZLE -D GLM_FORCE_PURE -D GLM_ENABLE_EXPERIMENTAL +FLAGS= -Wall -Werror -pedantic-errors -g -D GLM_FORCE_SWIZZLE -D GLM_FORCE_PURE -D GLM_ENABLE_EXPERIMENTAL -Wno-braced-scalar-init -Wno-unused-variable all: $(TEST) ./Makefile rm -f test.cpp && \ diff --git a/inc/math/analytic/ArbitraryDegreePolynomial.hpp b/inc/math/analytic/ArbitraryDegreePolynomial.hpp index 5890d4c8..8aa85b0b 100644 --- a/inc/math/analytic/ArbitraryDegreePolynomial.hpp +++ b/inc/math/analytic/ArbitraryDegreePolynomial.hpp @@ -177,7 +177,7 @@ namespace analytic { }; template - constexpr std::string to_string(const ArbitraryDegreePolynomial& p) + std::string to_string(const ArbitraryDegreePolynomial& p) { // const std::string exponents("⁰¹²³⁴⁵⁶⁷⁸⁹"); std::string output; diff --git a/inc/math/analytic/ArbitraryDegreeRational.hpp b/inc/math/analytic/ArbitraryDegreeRational.hpp index 58f6f3ca..e88a5299 100644 --- a/inc/math/analytic/ArbitraryDegreeRational.hpp +++ b/inc/math/analytic/ArbitraryDegreeRational.hpp @@ -211,7 +211,7 @@ namespace analytic { }; template - constexpr std::string to_string(const ArbitraryDegreeRational& r) + std::string to_string(const ArbitraryDegreeRational& r) { std::string numerator = to_string(r.p); std::string denominator = to_string(r.q); diff --git a/inc/math/analytic/Identity.hpp b/inc/math/analytic/Identity.hpp index 4782f4ae..4f0f36c2 100644 --- a/inc/math/analytic/Identity.hpp +++ b/inc/math/analytic/Identity.hpp @@ -28,7 +28,7 @@ namespace analytic { }; template - constexpr std::string to_string(const Identity& p) + std::string to_string(const Identity& p) { return "x"; } diff --git a/inc/math/analytic/Polynomial.hpp b/inc/math/analytic/Polynomial.hpp index 866f57e2..b83ee87c 100644 --- a/inc/math/analytic/Polynomial.hpp +++ b/inc/math/analytic/Polynomial.hpp @@ -214,7 +214,7 @@ namespace analytic { template - constexpr std::string to_string(const Polynomial& p) + std::string to_string(const Polynomial& p) { // const std::string exponents("⁰¹²³⁴⁵⁶⁷⁸⁹"); std::string output; diff --git a/inc/math/analytic/Rational.hpp b/inc/math/analytic/Rational.hpp index 1e3f625f..7fb4e5e2 100644 --- a/inc/math/analytic/Rational.hpp +++ b/inc/math/analytic/Rational.hpp @@ -120,7 +120,7 @@ namespace analytic { template - constexpr std::string to_string(const Rational& r) + std::string to_string(const Rational& r) { std::string numerator = to_string(r.p); std::string denominator = to_string(r.q); diff --git a/inc/math/analytic/Scaling.hpp b/inc/math/analytic/Scaling.hpp index da236860..dfabb59a 100644 --- a/inc/math/analytic/Scaling.hpp +++ b/inc/math/analytic/Scaling.hpp @@ -58,7 +58,7 @@ namespace analytic { }; template - constexpr std::string to_string(const Scaling& f) + std::string to_string(const Scaling& f) { // const std::string exponents("⁰¹²³⁴⁵⁶⁷⁸⁹"); return std::to_string(f.factor) + "*x"; diff --git a/inc/math/analytic/Shifting.hpp b/inc/math/analytic/Shifting.hpp index 22ba09ea..2649ed87 100644 --- a/inc/math/analytic/Shifting.hpp +++ b/inc/math/analytic/Shifting.hpp @@ -42,7 +42,7 @@ namespace analytic { }; template - constexpr std::string to_string(const Shifting& f) + std::string to_string(const Shifting& f) { // const std::string exponents("⁰¹²³⁴⁵⁶⁷⁸⁹"); return std::string("x") + (f.offset>=0?"+":"") + std::to_string(f.offset); diff --git a/inc/math/analytic/rails/Railcar.hpp b/inc/math/analytic/rails/Railcar.hpp index 7cd6eaed..b24a1b6f 100644 --- a/inc/math/analytic/rails/Railcar.hpp +++ b/inc/math/analytic/rails/Railcar.hpp @@ -107,7 +107,7 @@ namespace analytic { template - constexpr std::string to_string(const Railcar& p) + std::string to_string(const Railcar& p) { std::string output; const T oo (std::numeric_limits::max()); diff --git a/inc/math/analytic/rails/Railyard.hpp b/inc/math/analytic/rails/Railyard.hpp index 97942743..404d905d 100644 --- a/inc/math/analytic/rails/Railyard.hpp +++ b/inc/math/analytic/rails/Railyard.hpp @@ -243,7 +243,7 @@ namespace analytic { }; template - constexpr std::string to_string(const Railyard& yard) + std::string to_string(const Railyard& yard) { std::string output("\r\n"); for (std::size_t i=0; i - constexpr std::string to_string(const Train& train) + std::string to_string(const Train& train) { const T oo (std::numeric_limits::max()); std::string output("\r\n"); diff --git a/inc/math/test.cpp b/inc/math/test.cpp index e3f62017..dc3531f0 100644 --- a/inc/math/test.cpp +++ b/inc/math/test.cpp @@ -1,10 +1,10 @@ #include "./glm/special_specialization.hpp" -#include "./analytic/Rational_test.cpp" +#include "./special_test.cpp" +#include "./combinatorics_test.cpp" #include "./analytic/Polynomial_test.cpp" +#include "./analytic/Rational_test.cpp" +#include "./analytic/Shifting_test.cpp" +#include "./analytic/Scaling_test.cpp" #include "./analytic/rails/PolynomialTrain_test.cpp" #include "./analytic/rails/PolynomialRailyard_test.cpp" #include "./analytic/rails/RationalTrain_test.cpp" -#include "./analytic/Shifting_test.cpp" -#include "./analytic/Scaling_test.cpp" -#include "./combinatorics_test.cpp" -#include "./special_test.cpp" diff --git a/inc/model/compound/relation/gas/GasPropertyStateRelation.hpp b/inc/model/compound/relation/gas/GasPropertyStateRelation.hpp index 055dbaf8..991ec83e 100644 --- a/inc/model/compound/relation/gas/GasPropertyStateRelation.hpp +++ b/inc/model/compound/relation/gas/GasPropertyStateRelation.hpp @@ -70,7 +70,7 @@ namespace relation { { } - constexpr GasPropertyStateRelation( + GasPropertyStateRelation( const ClampedExponentSum pexponents, const ClampedExponentSum Texponents, const ClampedSigmoidSum Tsigmoids, @@ -133,9 +133,6 @@ namespace relation { { const float p = float(pressure/punits); const float T = float(temperature/Tunits); - ClampedExponent exponent; - ClampedSigmoid sigmoid; - ClampedDippr102 dippr102; return (intercept + pexponents(p) + Texponents(T) + Tsigmoids(T) + Tdippr102s(T)) * yunits; } @@ -143,9 +140,6 @@ namespace relation { { const float p = float(pressure/punits); const float T = float(temperature/Tunits); - ClampedExponent exponent; - ClampedSigmoid sigmoid; - ClampedDippr102 dippr102; return (intercept + pexponents(p) + Texponents(T) + Tsigmoids(T) + Tdippr102s(T)) * yunits; } @@ -153,9 +147,6 @@ namespace relation { { const float p = float(point.pressure/punits); const float T = float(point.temperature/Tunits); - ClampedExponent exponent; - ClampedSigmoid sigmoid; - ClampedDippr102 dippr102; return (intercept + pexponents(p) + Texponents(T) + Tsigmoids(T) + Tdippr102s(T)) * yunits; } @@ -170,31 +161,30 @@ namespace relation { const float phi = float(max_pressure/punits); const float Thi = float(max_temperature/Tunits); GasPropertyStateRelation restricted(*this); - bool is_removal_occurring(true); float float_precision_of_error = 1e-6; float least_useful_term_error; while(restricted.known_max_fractional_error < known_max_fractional_error) { auto least_useful_pexponent = std::min_element(restricted.pexponents.terms.begin(), restricted.pexponents.terms.end(), [&](const ClampedExponent& f1, const ClampedExponent& f2){ - (maximum(f1,plo,phi)-minimum(f1,plo,phi)) < (maximum(f2,plo,phi)-minimum(f2,plo,phi)); + return (maximum(f1,plo,phi)-minimum(f1,plo,phi)) < (maximum(f2,plo,phi)-minimum(f2,plo,phi)); }); float least_useful_pexponent_error = maximum(least_useful_pexponent, plo,phi) - minimum(least_useful_pexponent, Tlo,Thi); auto least_useful_Texponent = std::min_element( restricted.Texponents.terms.begin(), restricted.Texponents.terms.end(), [&](const ClampedExponent& f1, const ClampedExponent& f2){ - (maximum(f1,Tlo,Thi)-minimum(f1,Tlo,Thi)) < (maximum(f2,Tlo,Thi)-minimum(f2,Tlo,Thi)); + return (maximum(f1,Tlo,Thi)-minimum(f1,Tlo,Thi)) < (maximum(f2,Tlo,Thi)-minimum(f2,Tlo,Thi)); }); float least_useful_Texponent_error = maximum(least_useful_Texponent, plo,phi) - minimum(least_useful_Texponent, Tlo,Thi); auto least_useful_Tsigmoid = std::min_element( restricted.Tsigmoids.terms.begin(), restricted.Tsigmoids.terms.end(), [&](const ClampedExponent& f1, const ClampedExponent& f2){ - (maximum(f1,Tlo,Thi)-minimum(f1,Tlo,Thi)) < (maximum(f2,Tlo,Thi)-minimum(f2,Tlo,Thi)); + return (maximum(f1,Tlo,Thi)-minimum(f1,Tlo,Thi)) < (maximum(f2,Tlo,Thi)-minimum(f2,Tlo,Thi)); }); float least_useful_Tsigmoid_error = maximum(least_useful_Tsigmoid, plo,phi) - minimum(least_useful_Tsigmoid, Tlo,Thi); auto least_useful_Tdippr102 = std::min_element( restricted.Tdippr102s.terms.begin(), restricted.Tdippr102s.terms.end(), [&](const ClampedExponent& f1, const ClampedExponent& f2){ - (maximum(f1,Tlo,Thi)-minimum(f1,Tlo,Thi)) < (maximum(f2,Tlo,Thi)-minimum(f2,Tlo,Thi)); + return (maximum(f1,Tlo,Thi)-minimum(f1,Tlo,Thi)) < (maximum(f2,Tlo,Thi)-minimum(f2,Tlo,Thi)); }); float least_useful_Tdippr102_error = maximum(least_useful_Tdippr102, plo,phi) - minimum(least_useful_Tdippr102, Tlo,Thi); diff --git a/inc/model/orbit/Properties.hpp b/inc/model/orbit/Properties.hpp index 371b6e93..20619f65 100644 --- a/inc/model/orbit/Properties.hpp +++ b/inc/model/orbit/Properties.hpp @@ -2,6 +2,8 @@ #include +#define GLM_FORCE_PURE // disable anonymous structs so we can build with ISO C++ +#define GLM_ENABLE_EXPERIMENTAL // length2 #include // *vec3 #include // length2 @@ -71,21 +73,19 @@ namespace orbit { { using vec3 = glm::vec<3,scalar,glm::defaultp>; + static constexpr scalar pi = 3.141592653589793238462; + const vec3 vernal_equinox_direction; const vec3 north_pole_direction; const scalar standard_gravitational_parameter; - const scalar pi; - Properties( const vec3 vernal_equinox_direction, const vec3 north_pole_direction, - const scalar standard_gravitational_parameter, - const scalar pi + const scalar standard_gravitational_parameter ) : vernal_equinox_direction(glm::normalize(vernal_equinox_direction)), north_pole_direction(glm::normalize(north_pole_direction)), - standard_gravitational_parameter(standard_gravitational_parameter), - pi(pi) + standard_gravitational_parameter(standard_gravitational_parameter) {} scalar period_from_semi_major_axis(const scalar semi_major_axis, const scalar combined_mass) const { diff --git a/inc/model/orbit/UniversalPropagator_test.cpp b/inc/model/orbit/UniversalPropagator_test.cpp index b5511593..1b9b4082 100644 --- a/inc/model/orbit/UniversalPropagator_test.cpp +++ b/inc/model/orbit/UniversalPropagator_test.cpp @@ -94,7 +94,7 @@ TEST_CASE("UniversalPropagator::state()", "[body]") { using Propagator = orbit::UniversalPropagator; using Adapter = orbit::Adapter; - constexpr double pi = std::acos(-1.0); + constexpr double pi = 3.141592653589793238462; constexpr auto m = si::meter; constexpr auto au = si::astronomical_unit; diff --git a/inc/model/rock/column/ColumnSummaryOps_test.cpp b/inc/model/rock/column/ColumnSummaryOps_test.cpp index 295f4409..58119bdf 100644 --- a/inc/model/rock/column/ColumnSummaryOps_test.cpp +++ b/inc/model/rock/column/ColumnSummaryOps_test.cpp @@ -18,7 +18,7 @@ TEST_CASE( "ColumnSummary absorb() commutative monoid", "[rock]" ) { using density = si::density; using length = si::length; - rock::ColumnSummaryOps ops(length(si::centimeter)); + rock::ColumnSummaryOps ops{length(si::centimeter)}; rock::ColumnSummaryAdapter inexact; float oo = std::numeric_limits::max(); @@ -72,7 +72,7 @@ TEST_CASE( "ColumnSummary absorb() mass conservation", "[rock]" ) { using density = si::density; using length = si::length; - rock::ColumnSummaryOps ops(length(si::centimeter)); + rock::ColumnSummaryOps ops{length(si::centimeter)}; rock::ColumnSummaryAdapter inexact; float oo = std::numeric_limits::max(); diff --git a/inc/model/rock/crust/CrustSummaryOps_test.cpp b/inc/model/rock/crust/CrustSummaryOps_test.cpp index ccc6b17a..ca28b636 100644 --- a/inc/model/rock/crust/CrustSummaryOps_test.cpp +++ b/inc/model/rock/crust/CrustSummaryOps_test.cpp @@ -32,9 +32,9 @@ TEST_CASE( "CrustSummary absorb() commutative monoid", "[rock]" ) { using density = si::density; using length = si::length; - rock::CrustSummaryOps ops( - rock::ColumnSummaryOps( - length(si::centimeter))); + rock::CrustSummaryOps ops{ + rock::ColumnSummaryOps{ + length{si::centimeter}}}; rock::CrustSummaryAdapter inexact; float oo = std::numeric_limits::max(); @@ -120,9 +120,9 @@ TEST_CASE( "CrustSummary absorb() mass conservation", "[rock]" ) { using density = si::density; using area_density = si::area_density; - rock::CrustSummaryOps ops( - rock::ColumnSummaryOps( - length(si::centimeter))); + rock::CrustSummaryOps ops{ + rock::ColumnSummaryOps{ + length{si::centimeter}}}; rock::CrustSummaryAdapter inexact; float oo = std::numeric_limits::max(); diff --git a/inc/relation/PolynomialRailyardRelation.hpp b/inc/relation/PolynomialRailyardRelation.hpp index 0b8d4bdb..e1ccb050 100644 --- a/inc/relation/PolynomialRailyardRelation.hpp +++ b/inc/relation/PolynomialRailyardRelation.hpp @@ -1,5 +1,8 @@ #pragma once +#include +#include + // in-house libraries #include #include @@ -286,6 +289,19 @@ namespace relation { assert(xs.size() == ys.size()); return PolynomialRailyardRelation(analytic::spline::linear_spline(xs, ys), xunits, yunits); } + + // Overload for initializer_list to support brace-initialization + template + PolynomialRailyardRelation get_linear_interpolation_function( + const Tx xunits, const Ty yunits, + std::initializer_list xs, + std::initializer_list ys + ){ + std::vector xvec(xs); + std::vector yvec(ys); + assert(xvec.size() == yvec.size()); + return PolynomialRailyardRelation(analytic::spline::linear_spline(xvec, yvec), xunits, yunits); + } } diff --git a/inc/test.cpp b/inc/test.cpp index d2f81c17..b229d7e9 100644 --- a/inc/test.cpp +++ b/inc/test.cpp @@ -1,117 +1,130 @@ #include "./math/glm/special_specialization.hpp" -#include "./grid/dymaxion/_specialization.hpp" -#include "./raster/unlayered/_specialization.hpp" -#include "./index/glm/each_specialization.hpp" #include "./index/glm/whole_specialization.hpp" +#include "./raster/unlayered/_specialization.hpp" +#include "./grid/dymaxion/_specialization.hpp" +#include "./unit/si_test.cpp" +#include "./test/structures/ringlike_test.cpp" +#include "./test/structures/grouplike_test.cpp" +#include "./test/structures/metriclike_test.cpp" +#include "./field/noise/WorleyNoise_test.cpp" +#include "./field/noise/SimplexNoise_test.cpp" +#include "./field/noise/MosaicNoise_test.cpp" +#include "./field/noise/CurlNoise_test.cpp" +#include "./field/noise/EliasNoise_test.cpp" +#include "./field/noise/PerlinNoise_test.cpp" +#include "./field/noise/ValueNoise_test.cpp" #include "./math/special_test.cpp" #include "./math/combinatorics_test.cpp" +#include "./math/analytic/Polynomial_test.cpp" #include "./math/analytic/Rational_test.cpp" #include "./math/analytic/Shifting_test.cpp" +#include "./math/analytic/Scaling_test.cpp" #include "./math/analytic/rails/PolynomialTrain_test.cpp" #include "./math/analytic/rails/PolynomialRailyard_test.cpp" #include "./math/analytic/rails/RationalTrain_test.cpp" -#include "./math/analytic/Scaling_test.cpp" -#include "./math/analytic/Polynomial_test.cpp" -#include "./grid/cartesian/BoundedIndexing_test.cpp" -#include "./grid/cartesian/Interleaving_test.cpp" -#include "./grid/dymaxion/Voronoi_test.cpp" -#include "./grid/dymaxion/Projection_test.cpp" -#include "./grid/dymaxion/Indexing_test.cpp" -#include "./grid/dymaxion/Grid_test.cpp" -#include "./field/noise/ValueNoise_test.cpp" -#include "./field/noise/CurlNoise_test.cpp" -#include "./field/noise/MosaicNoise_test.cpp" -#include "./field/noise/SimplexNoise_test.cpp" -#include "./field/noise/WorleyNoise_test.cpp" -#include "./field/noise/EliasNoise_test.cpp" -#include "./field/noise/PerlinNoise_test.cpp" -#include "./raster/unlayered/Morphology_test.cpp" -#include "./raster/unlayered/VectorCalculusByFundamentalTheorem_test.hpp" -#include "./raster/unlayered/VectorCalculusByFundamentalTheorem_test.cpp" -#include "./unit/si_test.cpp" -#include "./index/known_test.cpp" -#include "./index/whole_test.cpp" -#include "./index/glm/each_test.cpp" -#include "./index/procedural/glm/VectorZip_test.cpp" -#include "./index/procedural/glm/VectorInterleave_test.cpp" -#include "./index/procedural/glm/VectorDeinterleave_test.cpp" -#include "./index/procedural/Interleave_test.cpp" -#include "./index/procedural/noise/UnitIntervalNoise_test.cpp" -#include "./index/procedural/noise/GaussianNoise_test.cpp" -#include "./index/procedural/noise/glm/UnitVectorNoise_test.cpp" -#include "./index/procedural/Map_test.cpp" -#include "./index/procedural/Range_test.cpp" -#include "./index/procedural/Uniform_test.cpp" -#include "./index/procedural/Get_test.cpp" -#include "./index/each_test.cpp" -#include "./model/compound/published/solid/pwave_modulus_test.cpp" +#include "./model/orbit/UniversalPropagator_test.cpp" +#include "./model/orbit/ElementsAndState_test.hpp" +#include "./model/orbit/Properties_test.cpp" +#include "./model/mix/rules_test.cpp" +#include "./model/rock/formation/FormationGeneration_test.cpp" +#include "./model/rock/formation/FormationOps_test.cpp" +#include "./model/rock/formation/FormationSummaryOps_test.cpp" +#include "./model/rock/column/ColumnSummaryOps_test.cpp" +#include "./model/rock/stratum/StratumSummaryOps_test.hpp" +#include "./model/rock/stratum/StratumStore_test.cpp" +#include "./model/rock/stratum/StratumOps_test.cpp" +#include "./model/rock/mineral/MineralStore_test.cpp" +#include "./model/rock/mineral/MineralOps_test.cpp" +#include "./model/rock/crust/CrustMotion_test.cpp" +#include "./model/rock/crust/CrustOps_test.cpp" +#include "./model/rock/crust/CrustSummaryOps_test.cpp" +#include "./model/rock/crust/CrustFracturing_test.cpp" +#include "./model/rock/crust/CrustSummarization_test.cpp" +#include "./model/compound/correlation/color_test.cpp" +#include "./model/compound/correlation/published_test.cpp" +#include "./model/compound/published/gas/thermal_conductivity_test.cpp" +#include "./model/compound/published/gas/dynamic_viscosity_test.cpp" +#include "./model/compound/published/gas/isobaric_specific_heat_capacity_test.cpp" +#include "./model/compound/published/gas/refractive_index_test.cpp" +#include "./model/compound/published/liquid/thermal_conductivity_test.cpp" +#include "./model/compound/published/liquid/dynamic_viscosity_test.cpp" +#include "./model/compound/published/liquid/density_test.cpp" +#include "./model/compound/published/liquid/isobaric_specific_heat_capacity_test.cpp" +#include "./model/compound/published/liquid/vapor_pressure_test.cpp" +#include "./model/compound/published/liquid/surface_tension_test.cpp" +#include "./model/compound/published/liquid/refractive_index_test.cpp" +#include "./model/compound/published/liquid/extinction_coefficient_test.cpp" #include "./model/compound/published/solid/absorption_coefficient_test.cpp" -#include "./model/compound/published/solid/refractive_index_test.cpp" -#include "./model/compound/published/solid/compressive_fracture_strength_test.cpp" -#include "./model/compound/published/solid/isobaric_specific_heat_capacity_test.cpp" -#include "./model/compound/published/solid/tensile_yield_strength_test.cpp" -#include "./model/compound/published/solid/extinction_coefficient_test.cpp" -#include "./model/compound/published/solid/vapor_pressure_test.cpp" -#include "./model/compound/published/solid/dynamic_viscosity_test.cpp" #include "./model/compound/published/solid/tensile_fracture_strength_test.cpp" -#include "./model/compound/published/solid/shear_yield_strength_test.cpp" #include "./model/compound/published/solid/lame_parameter_test.cpp" -#include "./model/compound/published/solid/shear_modulus_test.cpp" #include "./model/compound/published/solid/bulk_modulus_test.cpp" -#include "./model/compound/published/solid/density_test.cpp" -#include "./model/compound/published/solid/shear_fracture_strength_test.cpp" #include "./model/compound/published/solid/compressive_yield_strength_test.cpp" +#include "./model/compound/published/solid/thermal_conductivity_test.cpp" +#include "./model/compound/published/solid/dynamic_viscosity_test.cpp" +#include "./model/compound/published/solid/tensile_yield_strength_test.cpp" +#include "./model/compound/published/solid/compressive_fracture_strength_test.cpp" +#include "./model/compound/published/solid/pwave_modulus_test.cpp" +#include "./model/compound/published/solid/shear_modulus_test.cpp" +#include "./model/compound/published/solid/density_test.cpp" +#include "./model/compound/published/solid/shear_yield_strength_test.cpp" #include "./model/compound/published/solid/poisson_ratio_test.cpp" +#include "./model/compound/published/solid/isobaric_specific_heat_capacity_test.cpp" #include "./model/compound/published/solid/tensile_modulus_test.cpp" -#include "./model/compound/published/solid/thermal_conductivity_test.cpp" +#include "./model/compound/published/solid/vapor_pressure_test.cpp" +#include "./model/compound/published/solid/refractive_index_test.cpp" +#include "./model/compound/published/solid/extinction_coefficient_test.cpp" +#include "./model/compound/published/solid/shear_fracture_strength_test.cpp" #include "./model/compound/published/compound/latent_heat_of_sublimation_test.cpp" #include "./model/compound/published/compound/latent_heat_of_fusion_test.cpp" #include "./model/compound/published/compound/acentric_factor_test.cpp" #include "./model/compound/published/compound/latent_heat_of_vaporization_test.cpp" -#include "./model/compound/published/liquid/refractive_index_test.cpp" -#include "./model/compound/published/liquid/isobaric_specific_heat_capacity_test.cpp" -#include "./model/compound/published/liquid/extinction_coefficient_test.cpp" -#include "./model/compound/published/liquid/vapor_pressure_test.cpp" -#include "./model/compound/published/liquid/dynamic_viscosity_test.cpp" -#include "./model/compound/published/liquid/surface_tension_test.cpp" -#include "./model/compound/published/liquid/density_test.cpp" -#include "./model/compound/published/liquid/thermal_conductivity_test.cpp" -#include "./model/compound/published/gas/refractive_index_test.cpp" -#include "./model/compound/published/gas/isobaric_specific_heat_capacity_test.cpp" -#include "./model/compound/published/gas/dynamic_viscosity_test.cpp" -#include "./model/compound/published/gas/thermal_conductivity_test.cpp" -#include "./model/compound/correlation/published_test.cpp" -#include "./model/compound/correlation/color_test.cpp" +#include "./model/compound/estimated/gas/thermal_conductivity_test.cpp" +#include "./model/compound/estimated/gas/dynamic_viscosity_test.cpp" +#include "./model/compound/estimated/gas/isobaric_specific_heat_capacity_test.cpp" +#include "./model/compound/estimated/liquid/thermal_conductivity_test.cpp" +#include "./model/compound/estimated/liquid/dynamic_viscosity_test.cpp" +#include "./model/compound/estimated/liquid/density_test.cpp" +#include "./model/compound/estimated/liquid/isobaric_specific_heat_capacity_test.cpp" +#include "./model/compound/estimated/liquid/vapor_pressure_test.cpp" #include "./model/compound/estimated/solid/absorption_coefficient_test.cpp" -#include "./model/compound/estimated/solid/refractive_index_test.cpp" -#include "./model/compound/estimated/solid/compressive_fracture_strength_test.cpp" -#include "./model/compound/estimated/solid/tensile_yield_strength_test.cpp" -#include "./model/compound/estimated/solid/extinction_coefficient_test.cpp" -#include "./model/compound/estimated/solid/vapor_pressure_test.cpp" #include "./model/compound/estimated/solid/tensile_fracture_strength_test.cpp" -#include "./model/compound/estimated/solid/shear_yield_strength_test.cpp" #include "./model/compound/estimated/solid/lame_parameter_test.cpp" -#include "./model/compound/estimated/solid/shear_modulus_test.cpp" #include "./model/compound/estimated/solid/bulk_modulus_test.cpp" -#include "./model/compound/estimated/solid/density_test.cpp" -#include "./model/compound/estimated/solid/shear_fracture_strength_test.cpp" #include "./model/compound/estimated/solid/compressive_yield_strength_test.cpp" +#include "./model/compound/estimated/solid/tensile_yield_strength_test.cpp" +#include "./model/compound/estimated/solid/compressive_fracture_strength_test.cpp" +#include "./model/compound/estimated/solid/shear_modulus_test.cpp" +#include "./model/compound/estimated/solid/density_test.cpp" +#include "./model/compound/estimated/solid/shear_yield_strength_test.cpp" #include "./model/compound/estimated/solid/poisson_ratio_test.cpp" #include "./model/compound/estimated/solid/tensile_modulus_test.cpp" +#include "./model/compound/estimated/solid/vapor_pressure_test.cpp" +#include "./model/compound/estimated/solid/refractive_index_test.cpp" +#include "./model/compound/estimated/solid/extinction_coefficient_test.cpp" +#include "./model/compound/estimated/solid/shear_fracture_strength_test.cpp" #include "./model/compound/estimated/compound/latent_heat_of_sublimation_test.cpp" #include "./model/compound/estimated/compound/latent_heat_of_fusion_test.cpp" #include "./model/compound/estimated/compound/acentric_factor_test.cpp" #include "./model/compound/estimated/compound/latent_heat_of_vaporization_test.cpp" -#include "./model/compound/estimated/liquid/isobaric_specific_heat_capacity_test.cpp" -#include "./model/compound/estimated/liquid/vapor_pressure_test.cpp" -#include "./model/compound/estimated/liquid/dynamic_viscosity_test.cpp" -#include "./model/compound/estimated/liquid/density_test.cpp" -#include "./model/compound/estimated/liquid/thermal_conductivity_test.cpp" -#include "./model/compound/estimated/gas/isobaric_specific_heat_capacity_test.cpp" -#include "./model/compound/estimated/gas/dynamic_viscosity_test.cpp" -#include "./model/compound/estimated/gas/thermal_conductivity_test.cpp" -#include "./model/mix/rules_test.cpp" -#include "./model/mix/fractions_test.cpp" -#include "./test/structures/metriclike_test.cpp" -#include "./test/structures/grouplike_test.cpp" -#include "./test/structures/ringlike_test.cpp" +#include "./model/sea/Leveling_test.cpp" +#include "./index/iterated/_test.hpp" +#include "./index/known_test.cpp" +#include "./index/procedural/Interleave_test.cpp" +#include "./index/procedural/Uniform_test.cpp" +#include "./index/procedural/Map_test.cpp" +#include "./index/procedural/Range_test.cpp" +#include "./index/procedural/noise/UnitIntervalNoise_test.cpp" +#include "./index/procedural/noise/GaussianNoise_test.cpp" +#include "./index/procedural/noise/glm/UnitVectorNoise_test.cpp" +#include "./index/procedural/glm/VectorDeinterleave_test.cpp" +#include "./index/procedural/glm/VectorInterleave_test.cpp" +#include "./index/procedural/glm/VectorZip_test.cpp" +#include "./raster/unlayered/VectorCalculusByFundamentalTheorem_test.hpp" +#include "./raster/unlayered/Morphology_test.cpp" +#include "./raster/unlayered/VectorCalculusByFundamentalTheorem_test.cpp" +#include "./grid/cartesian/Interleaving_test.cpp" +#include "./grid/cartesian/BoundedIndexing_test.cpp" +#include "./grid/dymaxion/Indexing_test.cpp" +#include "./grid/dymaxion/Grid_test.cpp" +#include "./grid/dymaxion/Projection_test.cpp" +#include "./grid/dymaxion/Voronoi_test.cpp" diff --git a/src/view/ColorscaleSurfaceShaderProgram.hpp b/src/view/ColorscaleSurfaceShaderProgram.hpp index 01332af1..0399f345 100644 --- a/src/view/ColorscaleSurfaceShaderProgram.hpp +++ b/src/view/ColorscaleSurfaceShaderProgram.hpp @@ -76,7 +76,6 @@ namespace view GLint viewMatrixLocation; GLint modelMatrixLocation; GLint projectionMatrixLocation; - GLint existsThresholdLocation; GLint colorscaleTypeLocation; GLint minColorLocation; GLint maxColorLocation; @@ -118,7 +117,7 @@ namespace view we set vertex position outside clipspace if vertex_exists is toggled off. */ gl_Position = projection_matrix * view_matrix * model_matrix * vertex_position; - }; + } )" ), fragmentShaderGlsl( diff --git a/src/view/IndicatorSwarmShaderProgram.hpp b/src/view/IndicatorSwarmShaderProgram.hpp index 3dff62ff..9d704eeb 100644 --- a/src/view/IndicatorSwarmShaderProgram.hpp +++ b/src/view/IndicatorSwarmShaderProgram.hpp @@ -85,7 +85,7 @@ namespace view vec3 instance_element_position = (instance_matrix * element_position) + instance_origin; // NOTE: for a heads up display, set all `*_matrix` parameters to identity gl_Position = projection_matrix * view_matrix * model_matrix * vec4(instance_element_position,1); - }; + } )" ), fragmentShaderGlsl( diff --git a/src/view/MultichannelSurfaceShaderProgram.hpp b/src/view/MultichannelSurfaceShaderProgram.hpp index c24a32a2..033e9b68 100644 --- a/src/view/MultichannelSurfaceShaderProgram.hpp +++ b/src/view/MultichannelSurfaceShaderProgram.hpp @@ -84,7 +84,7 @@ namespace view gl_Position = projection_matrix * view_matrix * model_matrix * vertex_position; fragment_color_in = smoothstep(min_values, max_values, vec4(vertex_red, vertex_green, vertex_blue, vertex_opacity)); - }; + } )" ), fragmentShaderGlsl( diff --git a/src/view/RealisticPointSourceSwarmShaderProgram.hpp b/src/view/RealisticPointSourceSwarmShaderProgram.hpp index 2b314f41..c8efc44b 100644 --- a/src/view/RealisticPointSourceSwarmShaderProgram.hpp +++ b/src/view/RealisticPointSourceSwarmShaderProgram.hpp @@ -179,7 +179,7 @@ namespace view fragment_element_position = element_position; gl_Position = clip_position; - }; + } )" ), fragmentShaderGlsl( diff --git a/src/view/RealisticSphereSwarmShaderProgram.hpp b/src/view/RealisticSphereSwarmShaderProgram.hpp index 749f25cf..c93d5b9f 100644 --- a/src/view/RealisticSphereSwarmShaderProgram.hpp +++ b/src/view/RealisticSphereSwarmShaderProgram.hpp @@ -242,7 +242,7 @@ namespace view fragment_temperature_change_per_radius2 = instance_temperature_change_per_radius2; fragment_atmosphere_scale_height = instance_atmosphere_scale_height; gl_Position = clip_position; - }; + } )" ), fragmentShaderGlsl(