Skip to content

Commit

Permalink
Add tetrahedral grid (#230)
Browse files Browse the repository at this point in the history
* Add NestedDensityTreePolicy
- changed DensityTreePolicy & TreePolicy consequently
- added extra contains & intersects to Box

* Fix formatting, warning, and minor merge error

* move min/max level test into needsSubdivide()

* streamline property names and add documentation

* verify that inner box is nonempty

* tetra construction functional

* grid construction fully working
cleaned up unused stuff from voronoi
started work on PathSegmentGenerator

* working PathSegmentGenerator

* started work on efficient ray traversal

* implemented traversal from maria et al.

* tetgen functional

* refactored to Tetrahedron.cpp
added TetraMeshSpatialGrid options
added NeedsSubdivide as tetgen unsuitable

* fixed  traversal edge case
changed search tree to use vertices instead of centroids

* functional centroid kd-tree using breadth-first search of neighbors

* updated traversal algo to Martie (2017)

* temp fix for edge cases
(vertex intersection still not working)

* almost functional traversal with edge cases
only entry vertex intersection isn't working

* traversal funtioncal, uses plane intersection if unsure
small fixes to prepare TetraMeshSpatialGrid

* sped up Tetra::inside

* used traversal in CellIndex and refactored some code

* tetra stats

* fixes and var test

* var fix

* minVolume

* small fix; removed unused code

* started cleanup

* removed adaptive construction
added all Tetra classes
started work on refining Delaunay

* removed unnecessary code

* added refine option to Tetra grid
marked potential oversight in Voro
`TetraMeshSnapshot::readAndClose` still needs to infer cell properties from vertex properties

* moved class Tetrahedron to class TetraMeshSnapshot
removed unused code

* started basic tetra implemenation
moved all tetra code to TetraMeshSpatialGrid
removed unnecessary code/classes and fixed small oversights
added tetgen LICENSE

* removed unnecessary code
fixed compile errors

* formatted code

* formatting

* used block search structure

* temp: moved Tetra and Face to hpp to make it compile
reformatted code

* cleanup and documentation

* documentation

* rename property and fix small oversight in path generator

* final refactoring and documentation

* remove debug files

* avoid warnings with clang - not yet for other compilers

* fix warnings for GCC and MSVC

* try to fix warnings for GCC on MinGW

* add build check with Intel oneAPI

* try intel oneAPI runner again

* try oneAPI checker once more

* cosmetic updates to source code

* add error if no grid

* add 8 corner vertices to cover full domain

* trivial adjustments to comments

---------

Co-authored-by: Peter Camps <[email protected]>
  • Loading branch information
arlauwer and petercamps authored Dec 20, 2024
1 parent 25b0d18 commit 81d2eda
Show file tree
Hide file tree
Showing 13 changed files with 46,905 additions and 10 deletions.
30 changes: 28 additions & 2 deletions .github/workflows/check-builds.yml
Original file line number Diff line number Diff line change
@@ -1,8 +1,7 @@
# GitHub action workflow that checks the build process on multiple platforms.
#
# The workflow builds the code (without MPI and without MakeUp)
# using GCC on Ubuntu and using Clang on macOS, in two different jobs.
# Other compiler/platform combinations can be added if the need arises.
# using various compilers and operating systems, in different jobs.
# The workflow fails if there are any build errors and/or warnings.
#
name: Check builds
Expand Down Expand Up @@ -86,3 +85,30 @@ jobs:
- name: Build
shell: cmd
run: cd release && cmake --build . -j 2

# Intel on Ubuntu
check_build_intel:
# job name, displayed in the action log
name: Build using Intel oneAPI on Ubuntu
# run this job on the Github-provided runner with a recent Ubuntu version
runs-on: ubuntu-22.04
# steps that make up this job
steps:
# checkout using a recent version of the checkout action
- name: Checkout
uses: actions/checkout@v3
# add Intel oneAPI to apt repository
- name: add oneAPI to apt
run: |
wget -O- https://apt.repos.intel.com/intel-gpg-keys/GPG-PUB-KEY-INTEL-SW-PRODUCTS.PUB | gpg --dearmor | sudo tee /usr/share/keyrings/oneapi-archive-keyring.gpg > /dev/null
echo "deb [signed-by=/usr/share/keyrings/oneapi-archive-keyring.gpg] https://apt.repos.intel.com/oneapi all main" | sudo tee /etc/apt/sources.list.d/oneAPI.list
sudo apt update
# install Intel oneAPI
- name: install oneAPI
run: sudo apt install intel-oneapi-compiler-dpcpp-cpp
# configure the build files through CMake
- name: Configure
run: cmake -B release -DCMAKE_C_COMPILER=/opt/intel/oneapi/compiler/latest/bin/icx -DCMAKE_CXX_COMPILER=/opt/intel/oneapi/compiler/latest/bin/icpx -DCMAKE_BUILD_TYPE:STRING=Release -DWARNINGS_AS_ERRORS:BOOL=ON -DBUILD_DOX_STYLE:BOOL=ON -DBUILD_SMILE_SHAPES:BOOL=ON -DBUILD_SMILE_TOOL:BOOL=ON -L
# perform the actual build (Ubuntu runners have 2 cores)
- name: Build
run: make -C release -j 2
1 change: 1 addition & 0 deletions SKIRT/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
# add all relevant subdirectories; each subdirectory defines a single target
add_subdirectory(fitsio)
add_subdirectory(voro)
add_subdirectory(tetgen)
add_subdirectory(mpi)
add_subdirectory(utils)
add_subdirectory(core)
Expand Down
3 changes: 2 additions & 1 deletion SKIRT/core/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,9 @@ target_link_libraries(${TARGET} schema fundamentals)
include_directories(../../SMILE/schema ../../SMILE/fundamentals)

# add SKIRT library dependencies
target_link_libraries(${TARGET} fitsio voro mpi utils)
target_link_libraries(${TARGET} fitsio voro mpi utils tetgen)
include_directories(../fitsio ../voro ../mpi ../utils)
include_directories(SYSTEM ../tetgen) # suppress warnings in tetgen header

# adjust C++ compiler flags to our needs
include("../../SMILE/build/CompilerFlags.cmake")
2 changes: 2 additions & 0 deletions SKIRT/core/SimulationItemRegistry.cpp
100644 → 100755
Original file line number Diff line number Diff line change
Expand Up @@ -256,6 +256,7 @@
#include "TTauriDiskGeometry.hpp"
#include "TemperatureProbe.hpp"
#include "TemperatureWavelengthCellLibrary.hpp"
#include "TetraMeshSpatialGrid.hpp"
#include "ThemisDustMix.hpp"
#include "ToddlersSED.hpp"
#include "ToddlersSEDFamily.hpp"
Expand Down Expand Up @@ -494,6 +495,7 @@ SimulationItemRegistry::SimulationItemRegistry(string version, string format)
ItemRegistry::add<FileTreeSpatialGrid>();
ItemRegistry::add<AdaptiveMeshSpatialGrid>();
ItemRegistry::add<VoronoiMeshSpatialGrid>();
ItemRegistry::add<TetraMeshSpatialGrid>();

// spatial grid policies
ItemRegistry::add<TreePolicy>();
Expand Down
Loading

0 comments on commit 81d2eda

Please sign in to comment.