Skip to content

Commit

Permalink
Merge pull request #357 from fhagemann/Int64
Browse files Browse the repository at this point in the history
Replace all Int64 by Int
  • Loading branch information
fhagemann authored Sep 14, 2023
2 parents 882dff4 + 094f07b commit e67d5a3
Show file tree
Hide file tree
Showing 9 changed files with 30 additions and 30 deletions.
6 changes: 3 additions & 3 deletions src/ConstructiveSolidGeometry/SurfacePrimitives/ConeMantle.jl
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,7 @@ function normal(cm::ConeMantle{T,Tuple{T,T},<:Any,:outwards}, pt::CartesianPoint
CartesianVector(CartesianPoint(CylindricalPoint{T}( one(T), cyl.φ, -Δr / Δz))), cm)
end

function vertices(cm::ConeMantle{T}, n_arc::Int64)::Vector{CartesianPoint{T}} where {T}
function vertices(cm::ConeMantle{T}, n_arc::Int)::Vector{CartesianPoint{T}} where {T}
φMin, φMax = get_φ_limits(cm)
n_arc = _get_n_points_in_arc_φ(cm, n_arc)
φ = range(φMin, φMax, length = n_arc+1)
Expand All @@ -127,12 +127,12 @@ function sample(cm::ConeMantle{T}, spacing::T)::Vector{CartesianPoint{T}} where
[_transform_into_global_coordinate_system(CartesianPoint{T}((radius_at_z(cm,z) .* reverse(sincos(φ)))..., z), cm) for z in z for r in [radius_at_z(cm,z)] for φ in (r == 0 ? [φMin] : range(φMin, φMax - full2π*spacing/radius_at_z(cm,z), length = max(2,1+Int(ceil(Δφ*radius_at_z(cm,z)/spacing)))))]
end

function connections(cm::ConeMantle, n_arc::Int64)::Vector{Vector{Int64}}
function connections(cm::ConeMantle, n_arc::Int)::Vector{Vector{Int}}
n_arc = _get_n_points_in_arc_φ(cm, n_arc)
[[i,i+1,i+n_arc+2,i+n_arc+1] for i in 1:n_arc]
end

function connections(cm::ConeMantle, n_arc::Int64, n_vert_lines::Int64)::Vector{Vector{Int64}}
function connections(cm::ConeMantle, n_arc::Int, n_vert_lines::Int)::Vector{Vector{Int}}
n_arc = _get_n_points_in_arc_φ(cm, n_arc)
verts = [[i, i + n_arc + 1] for i in _get_vert_lines_range(cm,n_arc,n_vert_lines)]
circ1 = [[i, i + 1] for i in 1:n_arc]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,7 @@ function normal(em::EllipsoidMantle{T,T,TP,TT,:outwards}, pt::CartesianPoint{T})
end
normal(em::EllipsoidMantle{T,TR,TP,TT,:inwards}, pt::CartesianPoint{T}) where {T,TR,TP,TT} = -normal(flip(em), pt)

function vertices(em::EllipsoidMantle{T}, n_arc::Int64)::Vector{CartesianPoint{T}} where {T}
function vertices(em::EllipsoidMantle{T}, n_arc::Int)::Vector{CartesianPoint{T}} where {T}
rx, ry, rz = get_radii(em)
φMin, φMax = get_φ_limits(em)
θMin, θMax = get_θ_limits(em)
Expand All @@ -134,13 +134,13 @@ function sample(em::EllipsoidMantle{T}, spacing::T)::Vector{CartesianPoint{T}} w
[_transform_into_global_coordinate_system(CartesianPoint{T}(rx*cos(θ)*cos(φ), ry*cos(θ)*sin(φ), rz*sin(θ)), em) for θ in range(θMin, θMax, length = max(2,1+Int(ceil(Δθ*r/spacing)))) for φ in (mod(θ, T(2π)) in T[π/2,3π/2] ? [φMin] : range(φMin, φMax - full2π*spacing/(r*cos(θ)), length = max(2,1+Int(ceil(Δφ*r*cos(θ)/spacing)))))]
end

function connections(em::EllipsoidMantle, n_arc::Int64)::Vector{Vector{Int64}}
function connections(em::EllipsoidMantle, n_arc::Int)::Vector{Vector{Int}}
n_arcφ = _get_n_points_in_arc_φ(em, n_arc)
n_arcθ = _get_n_points_in_arc_θ(em, n_arc)
[[i+(n_arcφ+1)*j,i+1+(n_arcφ+1)*j,i+1+(n_arcφ+1)*(j+1),i+(n_arcφ+1)*(j+1)] for j in 0:n_arcθ-1 for i in 1:n_arcφ]
end

function _get_hor_lines_idx(em::EllipsoidMantle{T}, n_arcθ::Int64)::Vector{Int64} where {T}
function _get_hor_lines_idx(em::EllipsoidMantle{T}, n_arcθ::Int)::Vector{Int} where {T}
θMin, θMax = get_θ_limits(em)
θMin, θMax = minmax(mod(θMin, T(2π)), mod(θMax, T(2π)))
if θMin == T/2) && θMax == T(3π/2)
Expand All @@ -150,7 +150,7 @@ function _get_hor_lines_idx(em::EllipsoidMantle{T}, n_arcθ::Int64)::Vector{Int6
end
end

function connections(em::EllipsoidMantle, n_arc::Int64, n_vert_lines::Int64)::Vector{Vector{Int64}}
function connections(em::EllipsoidMantle, n_arc::Int, n_vert_lines::Int)::Vector{Vector{Int}}
n_arcφ = _get_n_points_in_arc_φ(em, n_arc)
n_arcθ = _get_n_points_in_arc_θ(em, n_arc)
vcircs = [[i*(n_arcφ+1)+c, (i+1)*(n_arcφ+1)+c] for c in _get_vert_lines_range(em,n_arcφ,n_vert_lines) for i in 0:n_arcθ-1]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -74,14 +74,14 @@ Plane(es::EllipticalSurface{T}) where {T} = Plane{T}(es.origin, normal(es))
normal(es::EllipticalSurface{T}, ::CartesianPoint{T} = zero(CartesianPoint{T})) where {T} =
_transform_into_global_coordinate_system(CartesianVector{T}(zero(T), zero(T), one(T)), es)

function vertices(es::EllipticalSurface{T, T}, n_arc::Int64)::Vector{CartesianPoint{T}} where {T}
function vertices(es::EllipticalSurface{T, T}, n_arc::Int)::Vector{CartesianPoint{T}} where {T}
φMin, φMax = get_φ_limits(es)
n_arc = _get_n_points_in_arc_φ(es, n_arc)
φ = range(φMin, φMax, length = n_arc+1)
append!([es.origin],[_transform_into_global_coordinate_system(CartesianPoint{T}(es.r*cos(φ), es.r*sin(φ), 0), es) for φ in φ])
end

function vertices(es::EllipticalSurface{T, Tuple{T,T}}, n_arc::Int64)::Vector{CartesianPoint{T}} where {T}
function vertices(es::EllipticalSurface{T, Tuple{T,T}}, n_arc::Int)::Vector{CartesianPoint{T}} where {T}
rMin, rMax = es.r
φMin, φMax = get_φ_limits(es)
n_arc = _get_n_points_in_arc_φ(es, n_arc)
Expand All @@ -97,24 +97,24 @@ function sample(es::EllipticalSurface{T}, spacing::T)::Vector{CartesianPoint{T}}
[_transform_into_global_coordinate_system(CartesianPoint{T}(r*cos(φ), r*sin(φ), 0), es) for r in range(rMin, rMax, length = max(2,1+Int(ceil((rMax-rMin)/spacing)))) for φ in (r == 0 ? [φMin] : range(φMin, φMax - full2π*spacing/r, length = max(2,1+Int(ceil(Δφ*r/spacing)))))]
end

function connections(es::EllipticalSurface{T, T}, n_arc::Int64)::Vector{Vector{Int64}} where {T}
function connections(es::EllipticalSurface{T, T}, n_arc::Int)::Vector{Vector{Int}} where {T}
n_arc = _get_n_points_in_arc_φ(es, n_arc)
[[1,i,i+1] for i in 2:n_arc+1]
end

function connections(es::EllipticalSurface{T, Tuple{T,T}}, n_arc::Int64)::Vector{Vector{Int64}} where {T}
function connections(es::EllipticalSurface{T, Tuple{T,T}}, n_arc::Int)::Vector{Vector{Int}} where {T}
n_arc = _get_n_points_in_arc_φ(es, n_arc)
[[i,i+1,i+n_arc+2,i+n_arc+1] for i in 1:n_arc]
end

function connections(es::EllipticalSurface{T, T}, n_arc::Int64, n_vert_lines::Int64)::Vector{Vector{Int64}} where {T}
function connections(es::EllipticalSurface{T, T}, n_arc::Int, n_vert_lines::Int)::Vector{Vector{Int}} where {T}
n_arc = _get_n_points_in_arc_φ(es, n_arc)
radii = [[1, i + 1] for i in _get_vert_lines_range(es,n_arc,n_vert_lines)]
circ = [[i, i+1] for i in 2:n_arc+1]
append!(radii, circ)
end

function connections(es::EllipticalSurface{T, Tuple{T,T}}, n_arc::Int64, n_vert_lines::Int64)::Vector{Vector{Int64}} where {T}
function connections(es::EllipticalSurface{T, Tuple{T,T}}, n_arc::Int, n_vert_lines::Int)::Vector{Vector{Int}} where {T}
n_arc = _get_n_points_in_arc_φ(es, n_arc)
radii = [[i, i + n_arc + 1] for i in _get_vert_lines_range(es,n_arc,n_vert_lines)]
circ1 = [[i, i + 1] for i in 1:n_arc]
Expand Down
8 changes: 4 additions & 4 deletions src/ConstructiveSolidGeometry/SurfacePrimitives/Polygon.jl
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ const Quadrangle{T} = Polygon{4, T}
normal(p::Polygon) = normalize((p.points[2] - p.points[1]) × (p.points[3] - p.points[1]))

vertices(p::Polygon) = p.points
vertices(p::Polygon, n::Int64) = vertices(p)
vertices(p::Polygon, n::Int) = vertices(p)

function _sample_excluding_border(t::Triangle{T}, spacing::T)::Vector{CartesianPoint{T}} where {T}
push = spacing/2.5#best value for not showing triangle edges
Expand All @@ -42,7 +42,7 @@ function _sample_excluding_border(t::Triangle{T}, spacing::T)::Vector{CartesianP
end

triangles(p::Polygon{N,T}) where {N,T} = [Triangle{T}([p.points[1], p.points[i], p.points[i+1]]) for i in 2:N-1]
triangles(p::Polygon, n_arc::Int64) = triangles(p)
triangles(p::Polygon, n_arc::Int) = triangles(p)

function sample(p::Polygon{N,T}, spacing::T)::Vector{CartesianPoint{T}} where {N,T}
v = [s for e in edges(p) for s in sample(e,n=max(2,Int(ceil(norm(e.b-e.a)/spacing))))]
Expand All @@ -58,8 +58,8 @@ function extremum(p::Polygon{N,T})::T where {N,T}
end

connections(p::Polygon{N}) where {N} = [collect(1:N)]
connections(p::Polygon, ::Int64) = connections(p)
connections(p::Polygon{N}, ::Int64, ::Int64) where {N} = [[i%N+1, (i+1)%N+1] for i in 0:N-1]
connections(p::Polygon, ::Int) = connections(p)
connections(p::Polygon{N}, ::Int, ::Int) where {N} = [[i%N+1, (i+1)%N+1] for i in 0:N-1]
get_label_name(::Polygon) = "Polygon"

extreme_points(p::Polygon) = p.points
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,19 +12,19 @@ include("TorusMantle.jl")
# but the normal method is generally called with a point.
normal(p::AbstractPlanarSurfacePrimitive, ::AbstractCoordinatePoint) = normal(p)

function _get_n_points_in_arc_φ(p::AbstractSurfacePrimitive{T}, n_arc::Int64)::Int64 where {T}
function _get_n_points_in_arc_φ(p::AbstractSurfacePrimitive{T}, n_arc::Int)::Int where {T}
φMin, φMax = get_φ_limits(p)
f = (φMax - φMin)/T(2π)
Int(ceil(n_arc*f))
end

function _get_n_points_in_arc_θ(p::AbstractSurfacePrimitive{T}, n_arc::Int64)::Int64 where {T}
function _get_n_points_in_arc_θ(p::AbstractSurfacePrimitive{T}, n_arc::Int)::Int where {T}
θMin, θMax = get_θ_limits(p)
f = (θMax - θMin)/T(2π)
Int(ceil(n_arc*f))
end

function _get_vert_lines_range(p::AbstractSurfacePrimitive{T}, n_arc::Int64, n_vert_lines::Int64)::Vector{Int64} where {T}
function _get_vert_lines_range(p::AbstractSurfacePrimitive{T}, n_arc::Int, n_vert_lines::Int)::Vector{Int} where {T}
φMin, φMax = get_φ_limits(p)
if mod(φMax-φMin, T(2π)) == 0
if n_vert_lines == 0
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,7 @@ function normal(tm::TorusMantle{T,TP,TT,:outwards}, pt::CartesianPoint{T})::Cart
end
normal(tm::TorusMantle{T,TP,TT,:inwards}, pt::CartesianPoint{T}) where {T,TP,TT} = -normal(flip(tm), pt)

function vertices(tm::TorusMantle{T}, n_arc::Int64)::Vector{CartesianPoint{T}} where {T}
function vertices(tm::TorusMantle{T}, n_arc::Int)::Vector{CartesianPoint{T}} where {T}
φMin, φMax = get_φ_limits(tm)
θMin, θMax = get_θ_limits(tm)
n_arcφ = _get_n_points_in_arc_φ(tm, n_arc)
Expand All @@ -118,13 +118,13 @@ function sample(tm::TorusMantle{T}, spacing::T)::Vector{CartesianPoint{T}} where
[_transform_into_global_coordinate_system(CartesianPoint{T}((tm.r_torus + tm.r_tube*cos(θ))*cos(φ), (tm.r_torus + tm.r_tube*cos(θ))*sin(φ), tm.r_tube*sin(θ)), tm) for θ in range(θMin, θMax - full2πθ*spacing/tm.r_tube, length = max(2,1+Int(ceil(Δθ*tm.r_tube/spacing)))) for φ in range(φMin, φMax - full2πφ*spacing/(tm.r_torus + tm.r_tube*cos(θ)), length = max(2,1+Int(ceil(Δφ*(tm.r_torus + tm.r_tube*cos(θ))/spacing))))]
end

function connections(tm::TorusMantle, n_arc::Int64)::Vector{Vector{Int64}}
function connections(tm::TorusMantle, n_arc::Int)::Vector{Vector{Int}}
n_arcφ = _get_n_points_in_arc_φ(tm, n_arc)
n_arcθ = _get_n_points_in_arc_θ(tm, n_arc)
[[i+(n_arcφ+1)*j,i+1+(n_arcφ+1)*j,i+1+(n_arcφ+1)*(j+1),i+(n_arcφ+1)*(j+1)] for j in 0:n_arcθ-1 for i in 1:n_arcφ]
end

function _get_hor_lines_idx(tm::TorusMantle{T}, n_arcθ::Int64)::Vector{Int64} where {T}
function _get_hor_lines_idx(tm::TorusMantle{T}, n_arcθ::Int)::Vector{Int} where {T}
θMin, θMax = get_θ_limits(tm)
if mod(θMax-θMin, T(2π)) == 0
l_0 = Int(floor(abs(θMin/(θMax-θMin))*n_arcθ)) + 1
Expand All @@ -135,7 +135,7 @@ function _get_hor_lines_idx(tm::TorusMantle{T}, n_arcθ::Int64)::Vector{Int64} w
end
end

function connections(tm::TorusMantle{T}, n_arc::Int64, n_vert_lines::Int64)::Vector{Vector{Int64}} where {T}
function connections(tm::TorusMantle{T}, n_arc::Int, n_vert_lines::Int)::Vector{Vector{Int}} where {T}
n_arcφ = _get_n_points_in_arc_φ(tm, n_arc)
n_arcθ = _get_n_points_in_arc_θ(tm, n_arc)
vcircs = [[i*(n_arcφ+1)+c, (i+1)*(n_arcφ+1)+c] for c in _get_vert_lines_range(tm,n_arcφ,n_vert_lines) for i in 0:n_arcθ-1]
Expand Down
4 changes: 2 additions & 2 deletions src/ConstructiveSolidGeometry/VolumePrimitives/Ellipsoid.jl
Original file line number Diff line number Diff line change
Expand Up @@ -71,8 +71,8 @@ end

function Ellipsoid(::Type{CO}=ClosedPrimitive;
r = 1,
origin = zero(CartesianPoint{Int64}),
rotation = one(SMatrix{3, 3, Int64, 9})
origin = zero(CartesianPoint{Int}),
rotation = one(SMatrix{3, 3, Int, 9})
) where {CO}
Ellipsoid(CO, r, origin, rotation)
end
Expand Down
6 changes: 3 additions & 3 deletions src/ConstructiveSolidGeometry/plotting/Meshing.jl
Original file line number Diff line number Diff line change
Expand Up @@ -12,17 +12,17 @@ struct Mesh{T}
x::Vector{T}
y::Vector{T}
z::Vector{T}
connections::Vector{Vector{Int64}}
connections::Vector{Vector{Int}}
end

function mesh(p::AbstractSurfacePrimitive{T}, n_arc::Int64)::Mesh{T} where {T}
function mesh(p::AbstractSurfacePrimitive{T}, n_arc::Int)::Mesh{T} where {T}
vs = vertices(p, n_arc)
x, y, z = broadcast(i -> getindex.(vs, i), (1,2,3))
c = connections(p, n_arc)
Mesh{T}(x,y,z,c)
end

function mesh(p::AbstractSurfacePrimitive{T}, n_arc::Int64, n_vert_lines::Int64)::Mesh{T} where {T}
function mesh(p::AbstractSurfacePrimitive{T}, n_arc::Int, n_vert_lines::Int)::Mesh{T} where {T}
vs = vertices(p, n_arc)
x, y, z = broadcast(i -> getindex.(vs, i), (1,2,3))
c = connections(p, n_arc, n_vert_lines)
Expand Down
2 changes: 1 addition & 1 deletion test/ADLChargeDriftModel.jl
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ config_dict = Dict(
"Silicon" => joinpath(@__DIR__,"../examples/example_config_files/ADLChargeDriftModel/drift_velocity_Si_300K_config.yaml")
)

geom_sigdigits(::Type{Int64})::Int = 12
geom_sigdigits(::Type{Int})::Int = 12
geom_sigdigits(::Type{Float32})::Int = 6
geom_sigdigits(::Type{Float64})::Int = 12

Expand Down

0 comments on commit e67d5a3

Please sign in to comment.