Skip to content

Commit 3e4fcfa

Browse files
committed
completely remove submodule structure
- there is only a single module now `WavePropBase` where everything resides - remove the clumsy `interface` idea - nothing is exported. You must now `import WavePropBase` and manually control what you want to use - adapt tests and code accordingly - small cleanups
1 parent 5a87936 commit 3e4fcfa

41 files changed

Lines changed: 628 additions & 1357 deletions

Some content is hidden

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

Project.toml

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,6 @@ version = "0.1.4"
66
[deps]
77
AbstractTrees = "1520ce14-60c1-5f80-bbc7-55ef81b5835c"
88
LinearAlgebra = "37e2e46d-f89d-539d-b4ee-838fcccc9c8e"
9-
OrderedCollections = "bac558e1-5e72-5ebc-8fee-abe8a469f55d"
109
Printf = "de0858da-6303-5e67-8744-51eddeeeb8d7"
1110
RecipesBase = "3cdcf5f2-1ef4-517c-9805-6587b60abb01"
1211
Requires = "ae029012-a4dd-5104-9daa-d747884805df"
@@ -15,7 +14,6 @@ Statistics = "10745b16-79ce-11e8-11f9-7d13ad32a3b2"
1514

1615
[compat]
1716
AbstractTrees = "0.3"
18-
OrderedCollections = "1"
1917
RecipesBase = "1.1"
2018
Requires = "1"
2119
StaticArrays = "1.2"

src/Geometry/Geometry.jl

Lines changed: 5 additions & 63 deletions
Original file line numberDiff line numberDiff line change
@@ -1,71 +1,13 @@
1-
"""
2-
module Geometry
1+
#=
32
4-
Module defining basic geometrical concepts.
5-
"""
6-
module Geometry
3+
Definition of basic geometrical concepts.
74
8-
import Base: ==, length, in, iterate, getindex, lastindex, isempty, eltype, keys
9-
import Base: union, setdiff, intersect, issubset
5+
=#
106

11-
using StaticArrays
12-
using LinearAlgebra
13-
using OrderedCollections
14-
using AbstractTrees
15-
using RecipesBase
16-
using Printf
17-
using Statistics:median
18-
19-
using WavePropBase
20-
using WavePropBase.Utils
21-
22-
WavePropBase.@import_interface
7+
# import Base: ==, length, in, iterate, getindex, lastindex, isempty, eltype, keys
8+
# import Base: union, setdiff, intersect, issubset
239

2410
include("point.jl")
2511
include("referenceshapes.jl")
2612
include("entities.jl")
2713
include("domain.jl")
28-
29-
export
30-
# abstract types
31-
AbstractReferenceShape,
32-
AbstractEntity,
33-
AbstractParametricBody,
34-
# types
35-
ElementaryEntity,
36-
ParametricEntity,
37-
ParametricCurve,
38-
Domain,
39-
ReferencePoint,
40-
ReferenceLine,
41-
ReferenceTriangle,
42-
ReferenceTetrahedron,
43-
ReferenceSquare,
44-
ReferenceHyperCube,
45-
Point2D,
46-
Point3D,
47-
# functions
48-
clear_entities!,
49-
entities,
50-
tag,
51-
key,
52-
assertequaldim,
53-
boundary,
54-
skeleton,
55-
internal_boundary,
56-
external_boundary,
57-
measure,
58-
vertices,
59-
line,
60-
new_tag,
61-
global_add_entity!,
62-
index_range,
63-
parent,
64-
container,
65-
loc2glob,
66-
points,
67-
# global variables
68-
TAGS,
69-
ENTITIES
70-
71-
end # module

src/Geometry/domain.jl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -153,7 +153,7 @@ function Base.issubset(Ω1::Domain, Ω2::Domain)
153153
end
154154

155155
"""
156-
boundary(Ω)
156+
boundary(Ω::Domain)
157157
158158
Return a domain comprising the external boundary of Ω.
159159

src/Geometry/entities.jl

Lines changed: 20 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,17 @@ Integer tag used to idetify geometrical entities.
2222
"""
2323
tag(e::AbstractEntity) = e.tag
2424

25+
"""
26+
geometric_dimension(x::AbstractEntity)
27+
geometric_dimension(Ω::Domain)
28+
29+
Number of degrees of freedom necessary to locally represent the geometrical
30+
object. For example, lines have geometric dimension of 1 (whether in `ℝ²` or in
31+
`ℝ³`), while surfaces have geometric dimension of 2.
32+
33+
When the argument is a `Domain`, return the largest geometric dimension
34+
encoutered.
35+
"""
2536
geometric_dimension(e::AbstractEntity) = e.dim
2637

2738
boundary(e::AbstractEntity) = e.boundary
@@ -59,9 +70,16 @@ Base.hash(ent::AbstractEntity,h::UInt)= hash((geometric_dimension(ent),abs(tag(e
5970
function normal(ent::AbstractEntity, u)
6071
s = tag(ent) |> sign
6172
jac::SMatrix = jacobian(ent, u)
62-
s*normal(jac)
73+
s*_normal(jac)
6374
end
64-
function normal(jac::SMatrix{N,M}) where {N,M}
75+
76+
"""
77+
_normal(jac::SMatrix{M,N})
78+
79+
Given a an `M` by `N` matrix representing the jacobian of a codimension one
80+
object, compute the normal vector.
81+
"""
82+
function _normal(jac::SMatrix{N,M}) where {N,M}
6583
msg = "computing the normal vector requires the element to be of co-dimension one."
6684
@assert (N - M == 1) msg
6785
if M == 1 # a line in 2d

src/Geometry/referenceshapes.jl

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,8 +11,20 @@ examples of concrete subtypes.
1111
"""
1212
abstract type AbstractReferenceShape{N} end
1313

14+
"""
15+
ambient_dimension(x)
16+
17+
Dimension of the ambient space where `x` lives. For geometrical objects this can
18+
differ from its [`geometric_dimension`](@ref); for example a triangle in `ℝ³` has
19+
ambient dimension `3` but geometric dimension `2`, while a curve in `ℝ³` has
20+
ambient dimension 3 but geometric dimension 1.
21+
"""
1422
ambient_dimension(::SType{<:AbstractReferenceShape{N}}) where {N} = N
23+
24+
1525
geometric_dimension(::SType{<:AbstractReferenceShape{N}}) where {N} = N
26+
27+
1628
dimension(::SType{<:AbstractReferenceShape{N}}) where {N} = N
1729

1830
"""

src/IO/IO.jl

Lines changed: 0 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -1,29 +1 @@
1-
module IO
2-
3-
using StaticArrays
4-
using Printf
5-
using RecipesBase
6-
using OrderedCollections
7-
using Requires # for conditional loading of vtkIO
8-
9-
using WavePropBase
10-
using WavePropBase.Utils
11-
using WavePropBase.Geometry
12-
using WavePropBase.Trees
13-
using WavePropBase.Integration
14-
using WavePropBase.Interpolation
15-
using WavePropBase.Mesh
16-
17-
WavePropBase.@import_interface
18-
191
include("plotsIO.jl")
20-
21-
function __init__()
22-
# if WriteVTK is available, include vtkIO
23-
@require WriteVTK="64499a7a-5c06-52f2-abe2-ccb03c286192" begin
24-
@info "including vtkIO.jl from WavePropBase/IO"
25-
include("vtkIO.jl")
26-
end
27-
end
28-
29-
end # module

src/IO/vtkIO.jl

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -94,7 +94,7 @@ function _vtk_cells(mesh::GenericMesh)
9494
# Loop on `AbstractElement`
9595
for (E,tags) in elements(mesh)
9696
# Export only the cells of the largest geometrical dimension
97-
if geometric_dimension(E) == ambient_dimension(mesh)
97+
if domain_dimension(E) == ambient_dimension(mesh)
9898
append!(cells, _vtk_cells(tags, E))
9999
end
100100
end
@@ -104,7 +104,7 @@ end
104104
"""
105105
const etype_to_vtk_cell_type
106106
107-
OrderedDictionary mapping internal element types to a tuple containing:
107+
Dictionary mapping internal element types to a tuple containing:
108108
- the corresponding `WriteVTK` cell types (following the convention
109109
chosen by `VTK`, see below);
110110
- the indices in the `elements` column that defines the element.
@@ -130,7 +130,7 @@ See VTK specification [Fig. 2] on
130130
- VTK_WEDGE (=13)
131131
- VTK_PYRAMID (=14)
132132
"""
133-
const etype_to_vtk_cell_type = OrderedDict(
133+
const etype_to_vtk_cell_type = Dict(
134134
SVector{3,Float64} => (VTKCellTypes.VTK_VERTEX, collect(1:1)),
135135
LagrangeLine{2,SVector{3,Float64}} => (VTKCellTypes.VTK_LINE, collect(1:2)),
136136
LagrangeTriangle{3,SVector{2,Float64}} => (VTKCellTypes.VTK_TRIANGLE, collect(1:3)),

src/Integration/Integration.jl

Lines changed: 2 additions & 50 deletions
Original file line numberDiff line numberDiff line change
@@ -1,59 +1,11 @@
1-
"""
2-
module Integration
3-
1+
#=
42
Methods for integrating over instances of [`AbstractReferenceShape`](@ref).
53
64
Besides some standard quadrature rules used to integrate smooth functions, it also defines
75
singular integration routines useful for (weakly) singular integrands.
8-
"""
9-
module Integration
10-
11-
using StaticArrays
12-
using LinearAlgebra
13-
14-
using WavePropBase.Utils
15-
using WavePropBase.Geometry
16-
using WavePropBase.Interpolation
17-
18-
# import all methods in WavePropBase.INTERFACE_METHODS
19-
using WavePropBase
20-
WavePropBase.@import_interface
21-
22-
export
23-
# abstract types
24-
AbstractQuadratureRule,
25-
AbstractSingularityHandler,
26-
# types
27-
Gauss,
28-
Trapezoidal,
29-
TrapezoidalOpen,
30-
Fejer,
31-
TensorProductQuadrature,
32-
Kress,
33-
KressR,
34-
KressP,
35-
IMT,
36-
Duffy,
37-
SingularQuadratureRule,
38-
CustomQuadratureRule,
39-
CustomLineQuadratureRule,
40-
CustomTriangleQuadratureRule,
41-
CustomSquareQuadratureRule,
42-
CustomTetrahedronQuadratureRule,
43-
# functions
44-
integrate,
45-
qnodes,
46-
qweights,
47-
qnormals,
48-
integration_measure,
49-
qrule_for_reference_shape,
50-
singular_weights,
51-
singular_quadrature,
52-
TensorProductSingularityHandler
6+
=#
537

548
include("quadrulestables.jl")
559
include("quadrule.jl")
5610
include("singularityhandler.jl")
5711
include("singularquadrule.jl")
58-
59-
end

src/Integration/quadrule.jl

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,11 @@ following methods:
1212
"""
1313
abstract type AbstractQuadratureRule{D} end
1414

15+
"""
16+
domain(f)
17+
18+
Given a function-like object `f: Ω → R`, return `Ω`.
19+
"""
1520
domain(q::AbstractQuadratureRule{D}) where {D} = D()
1621

1722
"""

src/Integration/singularityhandler.jl

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,12 @@ end
1818
IMT(;a=1,p=1) = IMT{a,p}()
1919

2020
domain(::IMT) = ReferenceLine()
21+
22+
"""
23+
image(f)
24+
25+
The a function-like object `f: Ω → R`, return `R`.
26+
"""
2127
image(::IMT) = ReferenceLine()
2228

2329
function (f::IMT{A,P})(x) where {A,P}

0 commit comments

Comments
 (0)