Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Rename package to PointNeighbors.jl #6

Merged
merged 3 commits into from
May 8, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 3 additions & 2 deletions Project.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
name = "TrixiNeighborhoodSearch"
name = "PointNeighbors"
uuid = "1c4d5385-0a27-49de-8e2c-43b175c8985c"
authors = ["Erik Faulhaber <[email protected]>"]
authors = ["Erik Faulhaber <[email protected]>"]
version = "0.1.0-pre"

[deps]
Expand All @@ -10,6 +10,7 @@ Reexport = "189a3867-3050-52da-a836-e630ba90ab69"
StaticArrays = "90137ffa-7385-5640-81b9-e52037218182"

[compat]
LinearAlgebra = "1"
Polyester = "0.7.5"
Reexport = "1"
StaticArrays = "1"
Expand Down
10 changes: 5 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
# TrixiNeighborhoodSearch.jl
# PointNeighbors.jl

[![Docs-stable](https://img.shields.io/badge/docs-stable-blue.svg)](https://trixi-framework.github.io/TrixiNeighborhoodSearch.jl/stable)
[![Docs-dev](https://img.shields.io/badge/docs-dev-blue.svg)](https://trixi-framework.github.io/TrixiNeighborhoodSearch.jl/dev)
[![Docs-stable](https://img.shields.io/badge/docs-stable-blue.svg)](https://trixi-framework.github.io/PointNeighbors.jl/stable)
[![Docs-dev](https://img.shields.io/badge/docs-dev-blue.svg)](https://trixi-framework.github.io/PointNeighbors.jl/dev)
[![Slack](https://img.shields.io/badge/chat-slack-e01e5a)](https://join.slack.com/t/trixi-framework/shared_invite/zt-sgkc6ppw-6OXJqZAD5SPjBYqLd8MU~g)
[![Youtube](https://img.shields.io/youtube/channel/views/UCpd92vU2HjjTPup-AIN0pkg?style=social)](https://www.youtube.com/@trixi-framework)
[![Build Status](https://github.com/trixi-framework/TrixiNeighborhoodSearch.jl/workflows/CI/badge.svg)](https://github.com/trixi-framework/TrixiNeighborhoodSearch.jl/actions?query=workflow%3ACI)
[![Codecov](https://codecov.io/gh/trixi-framework/TrixiNeighborhoodSearch.jl/branch/main/graph/badge.svg)](https://codecov.io/gh/trixi-framework/TrixiNeighborhoodSearch.jl)
[![Build Status](https://github.com/trixi-framework/PointNeighbors.jl/workflows/CI/badge.svg)](https://github.com/trixi-framework/PointNeighbors.jl/actions?query=workflow%3ACI)
[![Codecov](https://codecov.io/gh/trixi-framework/PointNeighbors.jl/branch/main/graph/badge.svg)](https://codecov.io/gh/trixi-framework/PointNeighbors.jl)
[![SciML Code Style](https://img.shields.io/static/v1?label=code%20style&message=SciML&color=9558b2&labelColor=389826)](https://github.com/SciML/SciMLStyle)
[![License: MIT](https://img.shields.io/badge/License-MIT-success.svg)](https://opensource.org/license/mit/)

Expand Down
2 changes: 1 addition & 1 deletion SECURITY.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ used in the Julia ecosystem is supported with security updates.
## Reporting a Vulnerability

To report a security issue, please use the GitHub Security Advisory
["Report a Vulnerability"](https://github.com/trixi-framework/TrixiNeighborhoodSearch.jl/security/advisories/new)
["Report a Vulnerability"](https://github.com/trixi-framework/PointNeighbors.jl/security/advisories/new)
tab.

We will send a response indicating the next steps in handling your report.
Expand Down
18 changes: 9 additions & 9 deletions docs/make.jl
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
using Documenter

# Get TrixiNeighborhoodSearch.jl root directory
# Get PointNeighbors.jl root directory
trixibase_root_dir = dirname(@__DIR__)

# Fix for https://github.com/trixi-framework/Trixi.jl/issues/668
Expand All @@ -9,11 +9,11 @@ if (get(ENV, "CI", nothing) != "true") &&
push!(LOAD_PATH, trixibase_root_dir)
end

using TrixiNeighborhoodSearch
using PointNeighbors

# Define module-wide setups such that the respective modules are available in doctests
DocMeta.setdocmeta!(TrixiNeighborhoodSearch, :DocTestSetup,
:(using TrixiNeighborhoodSearch); recursive = true)
DocMeta.setdocmeta!(PointNeighbors, :DocTestSetup,
:(using PointNeighbors); recursive = true)

# Copy files to not need to synchronize them manually
function copy_file(filename, replaces...; new_filename = lowercase(filename))
Expand All @@ -22,7 +22,7 @@ function copy_file(filename, replaces...; new_filename = lowercase(filename))

header = """
```@meta
EditURL = "https://github.com/trixi-framework/TrixiNeighborhoodSearch.jl/blob/main/$filename"
EditURL = "https://github.com/trixi-framework/PointNeighbors.jl/blob/main/$filename"
```
"""
content = header * content
Expand All @@ -39,14 +39,14 @@ copy_file("LICENSE.md",
"\n" => "\n> ", r"^" => "# License\n\n> ")

# Make documentation
makedocs(modules = [TrixiNeighborhoodSearch],
sitename = "TrixiNeighborhoodSearch.jl",
makedocs(modules = [PointNeighbors],
sitename = "PointNeighbors.jl",
# Provide additional formatting options
format = Documenter.HTML(
# Disable pretty URLs during manual testing
prettyurls = get(ENV, "CI", nothing) == "true",
# Set canonical URL to GitHub pages URL
canonical = "https://trixi-framework.github.io/TrixiNeighborhoodSearch.jl/stable"),
canonical = "https://trixi-framework.github.io/PointNeighbors.jl/stable"),
# Explicitly specify documentation structure
pages = [
"Home" => "index.md",
Expand All @@ -56,6 +56,6 @@ makedocs(modules = [TrixiNeighborhoodSearch],
])

deploydocs(;
repo = "github.com/trixi-framework/TrixiNeighborhoodSearch.jl",
repo = "github.com/trixi-framework/PointNeighbors.jl",
devbranch = "main",
push_preview = true)
4 changes: 2 additions & 2 deletions docs/src/reference.md
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
# API reference

```@meta
CurrentModule = TrixiNeighborhoodSearch
CurrentModule = PointNeighbors
```

```@autodocs
Modules = [TrixiNeighborhoodSearch]
Modules = [PointNeighbors]
```
4 changes: 2 additions & 2 deletions src/TrixiNeighborhoodSearch.jl → src/PointNeighbors.jl
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
module TrixiNeighborhoodSearch
module PointNeighbors

using Reexport: @reexport

Expand All @@ -15,4 +15,4 @@ export for_particle_neighbor
export TrivialNeighborhoodSearch, GridNeighborhoodSearch
export initialize!, update!

end # module TrixiNeighborhoodSearch
end # module PointNeighbors
2 changes: 1 addition & 1 deletion src/util.jl
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,6 @@ macro threaded(expr)
# Look at the comments for `wrap_array` when considering to change this macro.

return esc(quote
TrixiNeighborhoodSearch.@batch $(expr)
PointNeighbors.@batch $(expr)
end)
end
55 changes: 27 additions & 28 deletions test/grid_nhs.jl
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,11 @@
coords2 = [NaN, 0]
coords3 = [typemax(Int) + 1.0, -typemax(Int) - 1.0]

@test TrixiNeighborhoodSearch.cell_coords(coords1, nothing, (1.0, 1.0)) ==
@test PointNeighbors.cell_coords(coords1, nothing, (1.0, 1.0)) ==
(typemax(Int), typemin(Int))
@test TrixiNeighborhoodSearch.cell_coords(coords2, nothing, (1.0, 1.0)) ==
@test PointNeighbors.cell_coords(coords2, nothing, (1.0, 1.0)) ==
(typemax(Int), 0)
@test TrixiNeighborhoodSearch.cell_coords(coords3, nothing, (1.0, 1.0)) ==
@test PointNeighbors.cell_coords(coords3, nothing, (1.0, 1.0)) ==
(typemax(Int), typemin(Int))
end

Expand All @@ -32,8 +32,7 @@
initialize!(nhs1, coords_fun)

# Get each neighbor for `particle_position1`
neighbors1 = sort(collect(TrixiNeighborhoodSearch.eachneighbor(particle_position1,
nhs1)))
neighbors1 = sort(collect(PointNeighbors.eachneighbor(particle_position1, nhs1)))

# Move particles
coordinates2 = coordinates1 .+ [1.4, -3.5]
Expand All @@ -43,23 +42,23 @@
update!(nhs1, coords_fun2)

# Get each neighbor for updated NHS
neighbors2 = sort(collect(TrixiNeighborhoodSearch.eachneighbor(particle_position1,
nhs1)))
neighbors2 = sort(collect(PointNeighbors.eachneighbor(particle_position1,
nhs1)))

# Change position
particle_position2 = particle_position1 .+ [1.4, -3.5]

# Get each neighbor for `particle_position2`
neighbors3 = sort(collect(TrixiNeighborhoodSearch.eachneighbor(particle_position2,
nhs1)))
neighbors3 = sort(collect(PointNeighbors.eachneighbor(particle_position2,
nhs1)))

# Double search radius
nhs2 = GridNeighborhoodSearch{2}(2 * radius, size(coordinates1, 2))
initialize!(nhs2, coords_fun)

# Get each neighbor in double search radius
neighbors4 = sort(collect(TrixiNeighborhoodSearch.eachneighbor(particle_position1,
nhs2)))
neighbors4 = sort(collect(PointNeighbors.eachneighbor(particle_position1,
nhs2)))

# Move particles
coordinates2 = coordinates1 .+ [0.4, -0.4]
Expand All @@ -68,8 +67,8 @@
update!(nhs2, coords_fun2)

# Get each neighbor in double search radius
neighbors5 = sort(collect(TrixiNeighborhoodSearch.eachneighbor(particle_position1,
nhs2)))
neighbors5 = sort(collect(PointNeighbors.eachneighbor(particle_position1,
nhs2)))

#### Verification
@test neighbors1 == [17, 18, 19, 24, 25, 26, 31, 32, 33]
Expand Down Expand Up @@ -105,8 +104,8 @@
initialize!(nhs1, coords_fun)

# Get each neighbor for `particle_position1`
neighbors1 = sort(collect(TrixiNeighborhoodSearch.eachneighbor(particle_position1,
nhs1)))
neighbors1 = sort(collect(PointNeighbors.eachneighbor(particle_position1,
nhs1)))

# Move particles
coordinates2 = coordinates1 .+ [1.4, -3.5, 0.8]
Expand All @@ -116,15 +115,15 @@
update!(nhs1, coords_fun2)

# Get each neighbor for updated NHS
neighbors2 = sort(collect(TrixiNeighborhoodSearch.eachneighbor(particle_position1,
nhs1)))
neighbors2 = sort(collect(PointNeighbors.eachneighbor(particle_position1,
nhs1)))

# Change position
particle_position2 = particle_position1 .+ [1.4, -3.5, 0.8]

# Get each neighbor for `particle_position2`
neighbors3 = sort(collect(TrixiNeighborhoodSearch.eachneighbor(particle_position2,
nhs1)))
neighbors3 = sort(collect(PointNeighbors.eachneighbor(particle_position2,
nhs1)))

#### Verification
@test neighbors1 ==
Expand All @@ -150,8 +149,8 @@

initialize!(nhs, coords)

neighbors = [sort(collect(TrixiNeighborhoodSearch.eachneighbor(coords[:, i],
nhs)))
neighbors = [sort(collect(PointNeighbors.eachneighbor(coords[:, i],
nhs)))
for i in 1:5]

# Note that (1, 2) and (2, 3) are not neighbors, but they are in neighboring cells
Expand Down Expand Up @@ -189,8 +188,8 @@

initialize!(nhs, coords)

neighbors = [sort(collect(TrixiNeighborhoodSearch.eachneighbor(coords[:, i],
nhs)))
neighbors = [sort(collect(PointNeighbors.eachneighbor(coords[:, i],
nhs)))
for i in 1:5]

# Note that (1, 2) and (2, 3) are not neighbors, but they are in neighboring cells
Expand Down Expand Up @@ -224,7 +223,7 @@
# see the right particle, even though it is within the search distance.
# The domain size is an integer multiple of the cell size, but the NHS did not
# offset the grid based on the domain position.
# See https://github.com/trixi-framework/TrixiNeighborhoodSearch.jl/pull/211
# See https://github.com/trixi-framework/PointNeighbors.jl/pull/211
# for a more detailed explanation.
coords = [-1.4 1.9
0.0 0.0]
Expand All @@ -236,9 +235,9 @@

initialize!(nhs, coords)

neighbors = [sort(unique(collect(TrixiNeighborhoodSearch.eachneighbor(coords[:,
i],
nhs))))
neighbors = [sort(unique(collect(PointNeighbors.eachneighbor(coords[:,
i],
nhs))))
for i in 1:2]

@test neighbors[1] == [1, 2]
Expand All @@ -258,7 +257,7 @@

initialize!(nhs, coords)

neighbors = [sort(collect(TrixiNeighborhoodSearch.eachneighbor(coords[:, i], nhs)))
neighbors = [sort(collect(PointNeighbors.eachneighbor(coords[:, i], nhs)))
for i in 1:5]

# Note that (1, 2) and (2, 3) are not neighbors, but they are in neighboring cells
Expand Down
2 changes: 1 addition & 1 deletion test/runtests.jl
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
include("test_util.jl")

@testset verbose=true "TrixiNeighborhoodSearch.jl Tests" begin
@testset verbose=true "PointNeighbors.jl Tests" begin
include("trivial_nhs.jl")
include("grid_nhs.jl")
end
4 changes: 2 additions & 2 deletions test/test_util.jl
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# All `using` calls are in this file, so that one can run any test file
# after running only this file.
using Test: @test, @testset
using TrixiNeighborhoodSearch
using PointNeighbors

"""
@trixi_testset "name of the testset" #= code to test #=
Expand All @@ -18,7 +18,7 @@ macro trixi_testset(name, expr)
quote
@eval module $mod
using Test
using TrixiNeighborhoodSearch
using PointNeighbors

# We also include this file again to provide the definition of
# the other testing macros. This allows to use `@trixi_testset`
Expand Down
2 changes: 1 addition & 1 deletion test/trivial_nhs.jl
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
nhs = TrivialNeighborhoodSearch{2}(1.0, Base.OneTo(5))

# Get each neighbor for arbitrary coordinates
neighbors = collect(TrixiNeighborhoodSearch.eachneighbor([1.0, 2.0], nhs))
neighbors = collect(PointNeighbors.eachneighbor([1.0, 2.0], nhs))

#### Verification
@test neighbors == [1, 2, 3, 4, 5]
Expand Down
Loading