-
Notifications
You must be signed in to change notification settings - Fork 79
/
isperiodic.jl
57 lines (34 loc) · 1.49 KB
/
isperiodic.jl
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
# ------------------------------------------------------------------
# Licensed under the MIT License. See LICENSE in the project root.
# ------------------------------------------------------------------
"""
isperiodic(geometry)
Tells whether or not the `geometry` is periodic
along each parametric dimension.
"""
isperiodic(g::Geometry) = isperiodic(typeof(g))
isperiodic(::Type{<:Segment}) = (false,)
isperiodic(::Type{<:Ray}) = (false,)
isperiodic(::Type{<:Line}) = (false,)
isperiodic(b::BezierCurve) = (first(controls(b)) == last(controls(b)),)
isperiodic(::Type{<:Plane}) = (false, false)
isperiodic(::Type{<:Box{Dim}}) where {Dim} = ntuple(i -> false, Dim)
isperiodic(::Type{<:Ball{Dim}}) where {Dim} = ntuple(i -> i != 1, Dim)
isperiodic(::Type{<:Sphere{Dim}}) where {Dim} = ntuple(i -> true, Dim - 1)
isperiodic(::Type{<:Ellipsoid}) = (true, true)
isperiodic(::Type{<:Disk}) = (false, true)
isperiodic(::Type{<:Circle}) = (true,)
isperiodic(::Type{<:CylinderSurface}) = (true, false)
isperiodic(::Type{<:ConeSurface}) = (true, false)
isperiodic(::Type{<:FrustumSurface}) = (true, false)
isperiodic(::Type{<:ParaboloidSurface}) = (false, true)
isperiodic(::Type{<:Torus}) = (true, true)
isperiodic(c::Type{<:Chain}) = (isclosed(c),)
isperiodic(::Type{<:Quadrangle}) = (false, false)
isperiodic(::Type{<:Hexahedron}) = (false, false, false)
"""
isperiodic(grid)
Tells whether or not the `grid` is periodic
along each parametric dimension.
"""
isperiodic(g::Grid) = isperiodic(topology(g))