From 3360e5bc9f63c0e6dca8599c82e0e933145e0261 Mon Sep 17 00:00:00 2001 From: Robin Deits Date: Mon, 13 Aug 2018 23:05:25 -0400 Subject: [PATCH] update to julia v0.7 --- .travis.yml | 10 ++++------ REQUIRE | 2 +- appveyor.yml | 40 +++++++++++++++++++++++--------------- src/Meshing.jl | 2 -- src/marching_cubes.jl | 2 +- src/marching_tetrahedra.jl | 28 ++++++-------------------- test/runtests.jl | 25 ++++++++++-------------- 7 files changed, 46 insertions(+), 63 deletions(-) diff --git a/.travis.yml b/.travis.yml index 01079fb..66829a9 100644 --- a/.travis.yml +++ b/.travis.yml @@ -3,7 +3,8 @@ language: julia os: - linux julia: - - 0.6 + - 0.7 + - 1.0 - nightly notifications: email: false @@ -13,9 +14,6 @@ branches: matrix: allow_failures: - julia: nightly -# uncomment the following lines to override the default test script -script: - - if [[ -a .git/shallow ]]; then git fetch --unshallow; fi - - julia -e 'Pkg.clone(pwd()); Pkg.build("Meshing"); Pkg.test("Meshing"; coverage=true)' after_success: - - julia -e 'cd(Pkg.dir("Meshing")); Pkg.add("Coverage"); using Coverage; Codecov.submit(process_folder())' + - julia -e 'using Pkg; import Meshing; Pkg.add("Coverage"); using Coverage; Codecov.submit(process_folder())' + diff --git a/REQUIRE b/REQUIRE index 5849e30..151ffdc 100644 --- a/REQUIRE +++ b/REQUIRE @@ -1,2 +1,2 @@ -julia 0.6 +julia 0.7 GeometryTypes 0.4 diff --git a/appveyor.yml b/appveyor.yml index 17a87a5..912635f 100644 --- a/appveyor.yml +++ b/appveyor.yml @@ -1,9 +1,18 @@ environment: matrix: - - JULIA_URL: "https://julialang-s3.julialang.org/bin/winnt/x86/0.3/julia-0.3-latest-win32.exe" - - JULIA_URL: "https://julialang-s3.julialang.org/bin/winnt/x64/0.3/julia-0.3-latest-win64.exe" - - JULIA_URL: "https://julialangnightlies-s3.julialang.org/bin/winnt/x86/julia-latest-win32.exe" - - JULIA_URL: "https://julialangnightlies-s3.julialang.org/bin/winnt/x64/julia-latest-win64.exe" + - julia_version: 0.7 + - julia_version: 1 + - julia_version: nightly + +platform: + - x86 # 32-bit + - x64 # 64-bit + +# # Uncomment the following lines to allow failures on nightly julia +# # (tests will run but not make your overall status red) +# matrix: +# allow_failures: +# - julia_version: nightly branches: only: @@ -17,19 +26,18 @@ notifications: on_build_status_changed: false install: - - ps: "[System.Net.ServicePointManager]::SecurityProtocol = [System.Net.SecurityProtocolType]::Tls12" -# Download most recent Julia Windows binary - - ps: (new-object net.webclient).DownloadFile( - $env:JULIA_URL, - "C:\projects\julia-binary.exe") -# Run installer silently, output to C:\projects\julia - - C:\projects\julia-binary.exe /S /D=C:\projects\julia + - ps: iex ((new-object net.webclient).DownloadString("https://raw.githubusercontent.com/JuliaCI/Appveyor.jl/version-1/bin/install.ps1")) build_script: -# Need to convert from shallow to complete for Pkg.clone to work - - IF EXIST .git\shallow (git fetch --unshallow) - - C:\projects\julia\bin\julia -e "versioninfo(); - Pkg.clone(pwd(), \"Meshing\"); Pkg.build(\"Meshing\")" + - echo "%JL_BUILD_SCRIPT%" + - C:\julia\bin\julia -e "%JL_BUILD_SCRIPT%" test_script: - - C:\projects\julia\bin\julia --check-bounds=yes -e "Pkg.test(\"Meshing\")" + - echo "%JL_TEST_SCRIPT%" + - C:\julia\bin\julia -e "%JL_TEST_SCRIPT%" + +# # Uncomment to support code coverage upload. Should only be enabled for packages +# # which would have coverage gaps without running on Windows +# on_success: +# - echo "%JL_CODECOV_SCRIPT%" +# - C:\julia\bin\julia -e "%JL_CODECOV_SCRIPT%" \ No newline at end of file diff --git a/src/Meshing.jl b/src/Meshing.jl index 017aa50..65f78a0 100644 --- a/src/Meshing.jl +++ b/src/Meshing.jl @@ -1,5 +1,3 @@ -VERSION >= v"0.4.0-dev+6521" && __precompile__() - module Meshing using GeometryTypes diff --git a/src/marching_cubes.jl b/src/marching_cubes.jl index a6da327..e0df81a 100644 --- a/src/marching_cubes.jl +++ b/src/marching_cubes.jl @@ -302,7 +302,7 @@ function marching_cubes(sdf::SignedDistanceField{3,ST,FT}, # arrays for vertices and faces vts = Point{3,Float64}[] fcs = Face{3,Int}[] - vertlist = Vector{Point{3,Float64}}(12) + vertlist = Vector{Point{3,Float64}}(undef, 12) @inbounds for xi = 1:nx-1, yi = 1:ny-1, zi = 1:nz-1 #Determine the index into the edge table which diff --git a/src/marching_tetrahedra.jl b/src/marching_tetrahedra.jl index 2b36b94..28e8ddb 100644 --- a/src/marching_tetrahedra.jl +++ b/src/marching_tetrahedra.jl @@ -254,10 +254,10 @@ an approximate isosurface by the method of marching tetrahedra. function marchingTetrahedra(lsf::AbstractArray{T,3}, iso::Real, eps::Real, indextype::Type{IT}) where {T<:Real, IT <: Integer} vertex_eltype = promote_type(T, typeof(iso), typeof(eps)) vts = Dict{indextype, Point{3,vertex_eltype}}() - fcs = Array{Face{3,indextype}}(0) + fcs = Array{Face{3,indextype}}(undef, 0) sizehint!(vts, div(length(lsf),8)) sizehint!(fcs, div(length(lsf),4)) - const vxidx = VoxelIndices{indextype}() + vxidx = VoxelIndices{indextype}() # process each voxel (nx::indextype,ny::indextype,nz::indextype) = size(lsf) vals = zeros(T, 8) @@ -307,22 +307,6 @@ function _correct_vertices!(vts, sdf::SignedDistanceField) end end - -function (::Type{MT})(volume::Array{T, 3}, iso_val::Real, eps_val=0.001) where {MT <: AbstractMesh, T} - Base.depwarn("(mesh type)(volume::Array, iso_val, eps_val) is deprecated. Please use: (mesh type)(volume, MarchingTetrahedra(iso_val, eps_val))", :Meshing_MT_array_eps) - iso_val = convert(T, iso_val) - eps_val = convert(T, eps_val) - vts, fcs = isosurface(volume, iso_val, eps_val) - MT(vts, fcs) -end - -function (::Type{MT})(df::SignedDistanceField, eps_val=0.001) where MT <: AbstractMesh - Base.depwarn("(mesh type)(sdf::SignedDistanceField, eps_val) is deprecated. Please use: (mesh type)(sdf, MarchingTetrahedra(0, eps))", :Meshing_MT_sdf_eps) - vts, fcs = isosurface(df.data, 0.0, eps_val) - _correct_vertices!(vts, df) - MT(vts, fcs) -end - struct MarchingTetrahedra{T} <: AbstractMeshingAlgorithm iso::T eps::T @@ -330,13 +314,13 @@ end MarchingTetrahedra(iso::T1=0.0, eps::T2=1e-3) where {T1, T2} = MarchingTetrahedra{promote_type(T1, T2)}(iso, eps) -function (::Type{MT})(sdf::SignedDistanceField, method::MarchingTetrahedra)::MT where {MT <: AbstractMesh} +function (::Type{MT})(sdf::SignedDistanceField, method::MarchingTetrahedra) where {MT <: AbstractMesh} vts, fcs = isosurface(sdf.data, method.iso, method.eps) _correct_vertices!(vts, sdf) - MT(vts, fcs) + MT(vts, fcs)::MT end -function (::Type{MT}){MT <: AbstractMesh, T}(volume::Array{T, 3}, method::MarchingTetrahedra)::MT +function (::Type{MT})(volume::Array{T, 3}, method::MarchingTetrahedra) where {MT <: AbstractMesh, T} vts, fcs = isosurface(volume, convert(T, method.iso), convert(T, method.eps)) - MT(vts, fcs) + MT(vts, fcs)::MT end diff --git a/test/runtests.jl b/test/runtests.jl index 6afc3d4..64dce13 100644 --- a/test/runtests.jl +++ b/test/runtests.jl @@ -1,7 +1,10 @@ using Meshing -using Base.Test +using Test using GeometryTypes using ForwardDiff +using Profile +using Statistics: mean +using LinearAlgebra: dot, norm @testset "meshing" begin @@ -83,23 +86,15 @@ using ForwardDiff sdf = SignedDistanceField(f, bounds, resolution) @testset "marching cubes" begin - m1 = @test_nowarn marching_cubes(sdf, 0.0, GLNormalMesh) - m2 = @test_nowarn GLNormalMesh(sdf, MarchingCubes()) - @test vertices(m1) == vertices(m2) - @test faces(m1) == faces(m2) + @test_nowarn GLNormalMesh(sdf, MarchingCubes()) + @inferred GLNormalMesh(sdf, MarchingCubes()) end @testset "marching tetrahedra" begin - m1 = @test_warn "is deprecated" GLNormalMesh(sdf) - m2 = @test_warn "is deprecated" GLNormalMesh(sdf, 1e-3) - m3 = @test_nowarn GLNormalMesh(sdf, MarchingTetrahedra()) - @test vertices(m1) == vertices(m2) == vertices(m3) - @test faces(m1) == faces(m2) == faces(m3) - - m4 = @test_warn "is deprecated" GLNormalMesh(sdf.data, 0.5) - m5 = @test_nowarn GLNormalMesh(sdf.data, MarchingTetrahedra(0.5)) - @test vertices(m4) == vertices(m5) - @test faces(m4) == faces(m5) + @test_nowarn GLNormalMesh(sdf, MarchingTetrahedra()) + @inferred GLNormalMesh(sdf, MarchingTetrahedra()) + @test_nowarn GLNormalMesh(sdf.data, MarchingTetrahedra(0.5)) + @inferred GLNormalMesh(sdf.data, MarchingTetrahedra(0.5)) end end