Skip to content

Commit 83bf90f

Browse files
committed
Remove eltype
1 parent b1ef2b7 commit 83bf90f

File tree

2 files changed

+1
-15
lines changed

2 files changed

+1
-15
lines changed

src/coordinatesystems.jl

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -12,8 +12,6 @@ Polar(r::T, θ::A) where {T<:AbstractFloat, A<:Integer} = Polar(promote(r, θ)..
1212
Polar(r::T, θ::A) where {T<:Integer, A<:AbstractFloat} = Polar(promote(r, θ)...)
1313
Base.show(io::IO, x::Polar) = print(io, "Polar(r=$(x.r), θ=$(x.θ) rad)")
1414
Base.isapprox(p1::Polar, p2::Polar; kwargs...) = isapprox(p1.r, p2.r; kwargs...) && isapprox(p1.θ, p2.θ; kwargs...)
15-
Base.eltype(::Polar{T,A}) where {T,A} = promote_type(T, A)
16-
Base.eltype(::Type{Polar{T,A}}) where {T,A} = promote_type(T, A)
1715

1816
"`PolarFromCartesian()` - transformation from `AbstractVector` of length 2 to `Polar` type"
1917
struct PolarFromCartesian <: Transformation; end
@@ -78,8 +76,6 @@ Spherical(r::T, θ::A, ϕ::A) where {T<:AbstractFloat, A<:Integer} = Spherical(p
7876
Spherical(r::T, θ::A, ϕ::A) where {T<:Integer, A<:AbstractFloat} = Spherical(promote(r, θ, ϕ)...)
7977
Base.show(io::IO, x::Spherical) = print(io, "Spherical(r=$(x.r), θ=$(x.θ) rad, ϕ=$(x.ϕ) rad)")
8078
Base.isapprox(p1::Spherical, p2::Spherical; kwargs...) = isapprox(p1.r, p2.r; kwargs...) && isapprox(p1.θ, p2.θ; kwargs...) && isapprox(p1.ϕ, p2.ϕ; kwargs...)
81-
Base.eltype(::Spherical{T,A}) where {T,A} = promote_type(T, A)
82-
Base.eltype(::Type{Spherical{T,A}}) where {T,A} = promote_type(T, A)
8379

8480
"""
8581
Cylindrical(r, θ, z) - 3D cylindrical coordinates
@@ -95,8 +91,6 @@ Cylindrical(r::T1, θ::A, z::T2) where {T1<:AbstractFloat, T2<:Integer, A<:Abstr
9591
Cylindrical(r::T1, θ::A, z::T2) where {T1<:Integer, T2<:AbstractFloat, A<:AbstractFloat} = Cylindrical(promote(r, θ, z)...)
9692
Base.show(io::IO, x::Cylindrical) = print(io, "Cylindrical(r=$(x.r), θ=$(x.θ) rad, z=$(x.z))")
9793
Base.isapprox(p1::Cylindrical, p2::Cylindrical; kwargs...) = isapprox(p1.r, p2.r; kwargs...) && isapprox(p1.θ, p2.θ; kwargs...) && isapprox(p1.z, p2.z; kwargs...)
98-
Base.eltype(::Cylindrical{T,A}) where {T,A} = promote_type(T, A)
99-
Base.eltype(::Type{Cylindrical{T,A}}) where {T,A} = promote_type(T, A)
10094

10195
"`SphericalFromCartesian()` - transformation from 3D point to `Spherical` type"
10296
struct SphericalFromCartesian <: Transformation; end

test/coordinatesystems.jl

Lines changed: 1 addition & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -107,11 +107,8 @@
107107
p2 = Polar(1.0, 2)
108108
= Polar(2.23606797749979, 1.1071487177940904)
109109

110-
@test eltype(p1) == Float32
111110
@test typeof(p1.r) == typeof(p1.θ)
112-
@test eltype(p2) == Float64
113111
@test typeof(p2.r) == typeof(p2.θ)
114-
@test eltype(p_from_c(xy_i)) == Float64
115112

116113
@test p_from_c(xy_i)
117114
@test p_from_c(xy)
@@ -478,11 +475,8 @@
478475
s1 = Spherical(1, 2.0, 3.0)
479476
s2 = Spherical(1.0, 2, 3)
480477

481-
@test eltype(s1) == Float64
482478
@test typeof(s1.r) == typeof(s1.θ) == typeof(s1.ϕ)
483-
@test eltype(s2) == Float64
484479
@test typeof(s2.r) == typeof(s2.θ) == typeof(s2.ϕ)
485-
@test eltype(s_from_cart(xyz_i)) == Float64
486480
end
487481

488482
@testset "Cylindrical" begin
@@ -497,13 +491,11 @@
497491
c2 = Cylindrical(1.0, 2, 3.0)
498492
c3 = Cylindrical(1, 2, 3)
499493

500-
@test eltype(c1) == Float64
501494
@test typeof(c1.r) == typeof(c1.z)
502495
@test typeof(c1.θ) == Float64
503-
@test eltype(c2) == Float64
504496
@test typeof(c2.r) == typeof(c2.z)
505497
@test typeof(c2.θ) == Int
506-
@test eltype(cyl_from_cart(xyz_i)) == Float64
498+
@test typeof(cyl_from_cart(xyz_i).r) == typeof(cyl_from_cart(xyz_i).z) == Float64
507499
end
508500
end
509501

0 commit comments

Comments
 (0)