Skip to content

Create tutorials for the docs#153

Open
efaulhaber wants to merge 17 commits intomainfrom
ef/tutorials
Open

Create tutorials for the docs#153
efaulhaber wants to merge 17 commits intomainfrom
ef/tutorials

Conversation

@efaulhaber
Copy link
Copy Markdown
Member

@efaulhaber efaulhaber commented Apr 13, 2026

This has been on my to-do list for a long time. PointNeighbors.jl should be easy to use, but just from the docstrings, it is very difficult to figure out how it works.

This PR

  • adds several tutorials to demonstrate usage,
  • adds GPU tests that (so far only) test the GPU tutorial on GPUs in CI,
  • throws an error if the search_radius is an Integer. This error can happen easily and was previously throwing a cryptic "trying to convert float to int" exception. I don't want to add a hard dispatch to AbstractFloat because theoretically, this might work with more special custom data types. Just not with integers.
  • makes ParallelUpdate the default strategy for the FullGridCellList with DynamicVectorOfVectors backend. This is a change that I wanted to do for a long time now. ParallelUpdate is faster in most applications, especially on GPUs. Furthermore, it supports initialization on GPUs, whereas the previous default required updating the NHS on the CPU before adapting it to the GPU.

Find the rendered docs here: https://trixi-framework.github.io/PointNeighbors.jl/previews/PR153/

Closes #124.

@efaulhaber efaulhaber self-assigned this Apr 13, 2026
@efaulhaber efaulhaber added the documentation Improvements or additions to documentation label Apr 13, 2026
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR improves the usability of PointNeighbors.jl by adding a new Tutorials section to the documentation (generated from Literate.jl sources) and by adding a constructor guard against integer search_radius types that would lead to incorrect/failed distance computations.

Changes:

  • Add four new worked tutorials (basic usage, n-body, periodicity, GPU usage) and a Tutorials index page in the docs.
  • Integrate Literate.jl generation into docs/make.jl and add required docs build dependencies.
  • Add an Integer-typed search_radius validation guard to multiple neighborhood search constructors.

Reviewed changes

Copilot reviewed 10 out of 10 changed files in this pull request and generated 5 comments.

Show a summary per file
File Description
src/nhs_trivial.jl Reject integer search_radius in TrivialNeighborhoodSearch constructor to avoid integer distance conversions.
src/nhs_precomputed.jl Reject integer search_radius in PrecomputedNeighborhoodSearch constructor for the same reason.
src/nhs_grid.jl Clarify n_points docstring wording; reject integer search_radius in GridNeighborhoodSearch constructor.
docs/src/tutorial.md Adds Tutorials landing page with links to each tutorial.
docs/Project.toml Adds Literate, plus tutorial-imported deps (Adapt, KernelAbstractions) to the docs environment.
docs/make.jl Runs Literate conversion into docs/src/tutorials and adds Tutorials to the Documenter page structure.
docs/literate/src/tut_basic_usage.jl New basic fixed-radius neighbor search tutorial source.
docs/literate/src/tut_n_body.jl New n-body cutoff-radius example tutorial source.
docs/literate/src/tut_periodicity.jl New periodic domain tutorial source using PeriodicBox.
docs/literate/src/tut_gpu_usage.jl New GPU usage tutorial source (KernelAbstractions/Adapt-based workflow).

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread docs/make.jl Outdated
Comment thread docs/literate/src/tut_gpu_usage.jl
Comment thread docs/literate/src/tut_gpu_usage.jl
Comment thread src/nhs_grid.jl
Comment thread src/nhs_grid.jl
efaulhaber and others added 3 commits April 13, 2026 17:22
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
@efaulhaber efaulhaber marked this pull request as ready for review April 13, 2026 15:27
@efaulhaber efaulhaber requested review from LasNikas and svchb April 13, 2026 15:27
@codecov
Copy link
Copy Markdown

codecov bot commented Apr 13, 2026

Codecov Report

❌ Patch coverage is 57.14286% with 3 lines in your changes missing coverage. Please review.
✅ Project coverage is 86.00%. Comparing base (11a445c) to head (829990e).

Files with missing lines Patch % Lines
src/nhs_grid.jl 50.00% 1 Missing ⚠️
src/nhs_precomputed.jl 50.00% 1 Missing ⚠️
src/nhs_trivial.jl 50.00% 1 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main     #153      +/-   ##
==========================================
- Coverage   86.06%   86.00%   -0.06%     
==========================================
  Files          15       15              
  Lines         739      743       +4     
==========================================
+ Hits          636      639       +3     
- Misses        103      104       +1     
Flag Coverage Δ
unit 86.00% <57.14%> (-0.06%) ⬇️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@efaulhaber efaulhaber marked this pull request as draft April 13, 2026 15:40
@efaulhaber
Copy link
Copy Markdown
Member Author

/run-gpu-tests

@efaulhaber efaulhaber marked this pull request as ready for review April 13, 2026 16:56
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

documentation Improvements or additions to documentation

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Question: Where do inputs for benchmark_n_body come from?

2 participants