Skip to content

Commit 5ae4d18

Browse files
authored
Merge pull request #18
Integral equations
2 parents 85c92ab + b3c5458 commit 5ae4d18

76 files changed

Lines changed: 3858 additions & 1870 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.JuliaFormatter.toml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
style = "yas"

.github/workflows/FormatCheck.yml

Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
# modified from https://github.com/SciML/DiffEqDocs.jl/tree/master/.github/workflows
2+
name: format-check
3+
4+
on:
5+
push:
6+
branches:
7+
- 'main'
8+
tags: '*'
9+
pull_request:
10+
11+
jobs:
12+
build:
13+
runs-on: ${{ matrix.os }}
14+
strategy:
15+
matrix:
16+
julia-version: [1]
17+
julia-arch: [x86]
18+
os: [ubuntu-latest]
19+
steps:
20+
- uses: julia-actions/setup-julia@latest
21+
with:
22+
version: ${{ matrix.julia-version }}
23+
24+
- uses: actions/checkout@v1
25+
- name: Install JuliaFormatter and format
26+
# This will use the latest version by default but you can set the version like so:
27+
#
28+
# julia -e 'using Pkg; Pkg.add(PackageSpec(name="JuliaFormatter", version="0.13.0"))'
29+
run: |
30+
julia -e 'using Pkg; Pkg.add(PackageSpec(name="JuliaFormatter"))'
31+
julia -e 'using JuliaFormatter; format(".", verbose=true)'
32+
- name: Format check
33+
run: |
34+
julia -e '
35+
out = Cmd(`git diff --name-only`) |> read |> String
36+
if out == ""
37+
exit(0)
38+
else
39+
@error "Some files have not been formatted !!!"
40+
write(stdout, out)
41+
exit(1)
42+
end'

.gitignore

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,4 +6,4 @@
66
.gitignore
77
.vscode/*
88
Manifest.toml
9-
scratch/*
9+
sandbox/*

Project.toml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,10 +4,14 @@ version = "0.2.5"
44

55
[deps]
66
AbstractTrees = "1520ce14-60c1-5f80-bbc7-55ef81b5835c"
7+
DataStructures = "864edb3b-99cc-5e75-8d2d-829cb0a9cfe8"
78
LinearAlgebra = "37e2e46d-f89d-539d-b4ee-838fcccc9c8e"
9+
NearestNeighbors = "b8a86587-4115-5ab1-83bc-aa920d37bbce"
810
Printf = "de0858da-6303-5e67-8744-51eddeeeb8d7"
911
RecipesBase = "3cdcf5f2-1ef4-517c-9805-6587b60abb01"
1012
Requires = "ae029012-a4dd-5104-9daa-d747884805df"
13+
SparseArrays = "2f01184e-e22b-5df5-ae63-d93ebab69eaf"
14+
SpecialFunctions = "276daf66-3868-5448-9aa4-cd146d93841b"
1115
StaticArrays = "90137ffa-7385-5640-81b9-e52037218182"
1216
Statistics = "10745b16-79ce-11e8-11f9-7d13ad32a3b2"
1317

benchmarks/clustertree_bench.jl

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,6 @@ using BenchmarkTools
44

55
n = 1_000_000
66

7-
pts = rand(WPB.Point3D,n)
8-
splitter = WPB.GeometricSplitter(nmax=100)
9-
@btime WPB.ClusterTree($pts,$splitter;threads=false)
7+
pts = rand(WPB.Point3D, n)
8+
splitter = WPB.GeometricSplitter(; nmax=100)
9+
@btime WPB.ClusterTree($pts, $splitter; threads=false)

docs/make.jl

Lines changed: 21 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -1,31 +1,27 @@
11
using WavePropBase
22
using Documenter
33

4-
DocMeta.setdocmeta!(WavePropBase, :DocTestSetup, :(using WavePropBase; using WriteVTK); recursive=true)
4+
DocMeta.setdocmeta!(WavePropBase,
5+
:DocTestSetup,
6+
:(using WavePropBase; using WriteVTK);
7+
recursive=true)
58

69
makedocs(;
7-
modules=[WavePropBase],
8-
repo="https://github.com/WaveProp/WavePropBase.jl/blob/{commit}{path}#{line}",
9-
sitename="WavePropBase.jl",
10-
format=Documenter.HTML(;
11-
prettyurls=get(ENV, "CI", "false") == "true",
12-
canonical="https://WaveProp.github.io/WavePropBase.jl",
13-
assets=String[],
14-
),
15-
pages=[
16-
"WavePropBase" => "index.md",
17-
"Utils" => "utils.md",
18-
"Geometry" => "geometry.md",
19-
"Interpolation" => "interpolation.md",
20-
"Integration" => "integration.md",
21-
"Meshes" => "mesh.md",
22-
"Trees" => "trees.md",
23-
"IO" => "io.md",
24-
"References" => "references.md"
25-
],
26-
)
10+
modules=[WavePropBase],
11+
repo="https://github.com/WaveProp/WavePropBase.jl/blob/{commit}{path}#{line}",
12+
sitename="WavePropBase.jl",
13+
format=Documenter.HTML(;
14+
prettyurls=get(ENV, "CI", "false") == "true",
15+
canonical="https://WaveProp.github.io/WavePropBase.jl",
16+
assets=String[]),
17+
pages=["WavePropBase" => "index.md",
18+
"Utils" => "utils.md",
19+
"Geometry" => "geometry.md",
20+
"Interpolation" => "interpolation.md",
21+
"Integration" => "integration.md",
22+
"Meshes" => "mesh.md",
23+
"Trees" => "trees.md",
24+
"IO" => "io.md",
25+
"References" => "references.md"])
2726

28-
deploydocs(;
29-
repo="github.com/WaveProp/WavePropBase.jl",
30-
devbranch="main",
31-
)
27+
deploydocs(; repo="github.com/WaveProp/WavePropBase.jl", devbranch="main")

src/Geometry/domain.jl

Lines changed: 27 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -16,21 +16,21 @@ Return a vector of all elementary entities making up a domain.
1616
"""
1717
entities::Domain) = Ω.entities
1818

19-
Domain::AbstractEntity) = Domain([ω,])
19+
Domain::AbstractEntity) = Domain([ω])
2020
Domain() = Domain(AbstractEntity[])
2121

22-
function Base.show(io::IO,d::Domain)
22+
function Base.show(io::IO, d::Domain)
2323
ents = entities(d)
2424
n = length(entities(d))
25-
n == 1 ? print(io,"Domain with $n entity:\n") : print(io,"Domain with $n entities:")
25+
n == 1 ? print(io, "Domain with $n entity:\n") : print(io, "Domain with $n entities:")
2626
for ent in ents
27-
print(io,"\n\t $(ent)")
27+
print(io, "\n\t $(ent)")
2828
end
2929
return io
3030
end
3131

3232
function geometric_dimension::Domain)
33-
l,u = extrema(geometric_dimension(ent) for ent in entities(Ω))
33+
l, u = extrema(geometric_dimension(ent) for ent in entities(Ω))
3434
@assert l == u "geometric dimension of entities in a domain not equal"
3535
return u
3636
end
@@ -51,9 +51,9 @@ Return all the boundaries of the domain, i.e. the domain's skeleton.
5151
function skeleton::Domain)
5252
ents = AbstractEntity[]
5353
for ent in entities(Ω)
54-
append!(ents,boundary(ent))
54+
append!(ents, boundary(ent))
5555
end
56-
Domain(unique!(ents))
56+
return Domain(unique!(ents))
5757
end
5858

5959
"""
@@ -62,7 +62,7 @@ end
6262
Two `Domain`s are equal if all their entities are equal (regardless of order).
6363
"""
6464
function Base.:(==)(Ω1::Domain, Ω2::Domain)
65-
return issetequal(entities(Ω1),entities(Ω2))
65+
return issetequal(entities(Ω1), entities(Ω2))
6666
end
6767

6868
"""
@@ -77,7 +77,7 @@ function Base.in(ω::ElementaryEntity, Ω::Domain)
7777
# TODO: should we really recurse on the boundary of the entities composing
7878
# the domain for determining if an entity is in a domain.
7979
for ent in ents
80-
in(ω,Domain(boundary(ent))) && (return true)
80+
in(ω, Domain(boundary(ent))) && (return true)
8181
end
8282
return false
8383
end
@@ -97,22 +97,23 @@ function Base.iterate(Ω::Domain, state=1)
9797
return nothing
9898
end
9999
# Return (result, state)
100-
return (Ω[state], state+1)
100+
return (Ω[state], state + 1)
101101
end
102102

103103
Base.isempty::Domain) = length(entities(Ω)) == 0
104104

105105
function Base.setdiff(Ω1::Domain, Ω2::Domain)
106-
Domain(setdiff(entities(Ω1), entities(Ω2)))
106+
return Domain(setdiff(entities(Ω1), entities(Ω2)))
107107
end
108108

109-
function Base.union(Ω1::Domain,Ωs::Domain...)
110-
ents = vcat(entities(Ω1),entities.(Ωs)...)
111-
Domain(unique!(ents))
109+
function Base.union(Ω1::Domain, Ωs::Domain...)
110+
ents = vcat(entities(Ω1), entities.(Ωs)...)
111+
return Domain(unique!(ents))
112112
end
113113
Base.union::Domain) = Domain(unique(entities(Ω)))
114114

115-
Base.append!(Ω1,Ω2) = (append!(entities(Ω1),entities(Ω2)); Ω1)
115+
Base.append!(Ω1, Ω2) = (append!(entities(Ω1), entities(Ω2));
116+
Ω1)
116117

117118
"""
118119
assertequaldim(Ω1::Domain,Ω2::Domain)
@@ -145,8 +146,8 @@ function Base.intersect(Ω1::Domain, Ω2::Domain)
145146
end
146147
end
147148

148-
function Base.push!::Domain,ent::AbstractEntity)
149-
push!(entities(Ω),ent)
149+
function Base.push!::Domain, ent::AbstractEntity)
150+
return push!(entities(Ω), ent)
150151
end
151152

152153
function Base.issubset(Ω1::Domain, Ω2::Domain)
@@ -163,11 +164,10 @@ Return a domain comprising the external boundary of Ω.
163164
"""
164165
boundary::Domain) = external_boundary::Domain)
165166

166-
167167
"""Return the internal boundaries inside a domain."""
168168
function internal_boundary::Domain)
169169
Ω1 = Domain(Ω[1])
170-
γ = Domain()
170+
γ = Domain()
171171
for ω2 in Ω[2:end]
172172
Ω2 = Domain(ω2)
173173
γ1 = Domain(vcat(boundary.(entities(Ω1))...))
@@ -180,7 +180,7 @@ end
180180

181181
"""Return the external boundaries inside a domain."""
182182
function external_boundary::Domain)
183-
return setdiff(skeleton(Ω),internal_boundary(Ω))
183+
return setdiff(skeleton(Ω), internal_boundary(Ω))
184184
end
185185

186186
"""
@@ -192,20 +192,22 @@ function Base.keys(Ω::Domain, d::Integer)
192192
elseif d == geometric_dimension(Ω)
193193
return Vector{Tuple{Int64,Int64}}(vcat(key.(entities(Ω))))
194194
elseif d < geometric_dimension(Ω)
195-
return unique(keys(skeleton(Ω),d))
195+
return unique(keys(skeleton(Ω), d))
196196
else
197197
error("Asking for tags with dimension > dimension of domain")
198198
end
199199
end
200200
function Base.keys::Domain)
201-
isempty(Ω) ? Tuple{Int64, Int64}[] : keys(Ω, geometric_dimension(Ω))
201+
return isempty(Ω) ? Tuple{Int64,Int64}[] : keys(Ω, geometric_dimension(Ω))
202202
end
203203

204204
"""
205205
Return all tags of the elementary entities in the domain `Ω` corresponding to the dimensions contained in `dims`.
206206
"""
207-
function Base.keys::Domain, dims::Vector{T}) where T <: Integer
208-
tgs = Vector{Tuple{Int64, Int64}}(undef, 0)
209-
for d in dims push!(tgs, keys(Ω, d)...) end
207+
function Base.keys::Domain, dims::Vector{T}) where {T<:Integer}
208+
tgs = Vector{Tuple{Int64,Int64}}(undef, 0)
209+
for d in dims
210+
push!(tgs, keys(Ω, d)...)
211+
end
210212
return tgs
211213
end

0 commit comments

Comments
 (0)