Skip to content

Commit

Permalink
Merge pull request #2 from visr/one
Browse files Browse the repository at this point in the history
update to julia 1.0
  • Loading branch information
evetion authored Dec 6, 2018
2 parents e2adad5 + 63d70f0 commit 2bbf94b
Show file tree
Hide file tree
Showing 8 changed files with 50 additions and 66 deletions.
33 changes: 9 additions & 24 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -1,35 +1,20 @@
## Documentation: http://docs.travis-ci.com/user/languages/julia/
# Documentation: http://docs.travis-ci.com/user/languages/julia/
language: julia
os:
- linux
- osx
julia:
- 0.6
- 1.0
- nightly
notifications:
email: false
git:
depth: 99999999

## uncomment the following lines to allow failures on nightly julia
## (tests will run but not make your overall status red)
matrix:
allow_failures:
- julia: nightly

## uncomment and modify the following lines to manually install system packages
#addons:
# apt: # apt-get for linux
# packages:
# - gfortran
#before_script: # homebrew for mac
# - if [ $TRAVIS_OS_NAME = osx ]; then brew install gcc; fi

## uncomment the following lines to override the default test script
- julia: nightly
notifications:
email: false
# 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("LASindex"); Pkg.test("LASindex"; coverage=true)'

after_success:
# push coverage results to Coveralls
- julia -e 'cd(Pkg.dir("LASindex")); Pkg.add("Coverage"); using Coverage; Coveralls.submit(Coveralls.process_folder())'
# push coverage results to Codecov
- julia -e 'cd(Pkg.dir("LASindex")); Pkg.add("Coverage"); using Coverage; Codecov.submit(Codecov.process_folder())'
- julia -e 'cd(Pkg.dir("LASindex")); Pkg.add("Coverage"); using Coverage; Codecov.submit(Codecov.process_folder())'
5 changes: 3 additions & 2 deletions REQUIRE
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
julia 0.6
RegionTrees 0.1.0
julia 0.7
RegionTrees 0.2.0
FileIO
StaticArrays
51 changes: 23 additions & 28 deletions appveyor.yml
Original file line number Diff line number Diff line change
@@ -1,16 +1,17 @@
environment:
matrix:
- JULIA_URL: "https://julialang-s3.julialang.org/bin/winnt/x86/0.6/julia-0.6-latest-win32.exe"
- JULIA_URL: "https://julialang-s3.julialang.org/bin/winnt/x64/0.6/julia-0.6-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"

## uncomment the following lines to allow failures on nightly julia
## (tests will run but not make your overall status red)
matrix:
allow_failures:
- 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: 1.0
- 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 @@ -24,24 +25,18 @@ notifications:
on_build_status_changed: false

install:
- ps: "[System.Net.ServicePointManager]::SecurityProtocol = [System.Net.SecurityProtocolType]::Tls12"
# If there's a newer build queued for the same PR, cancel this one
- ps: if ($env:APPVEYOR_PULL_REQUEST_NUMBER -and $env:APPVEYOR_BUILD_NUMBER -ne ((Invoke-RestMethod `
https://ci.appveyor.com/api/projects/$env:APPVEYOR_ACCOUNT_NAME/$env:APPVEYOR_PROJECT_SLUG/history?recordsNumber=50).builds | `
Where-Object pullRequestId -eq $env:APPVEYOR_PULL_REQUEST_NUMBER)[0].buildNumber) { `
throw "There are newer queued builds for this pull request, failing early." }
# 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(), \"LASindex\"); Pkg.build(\"LASindex\")"
- echo "%JL_BUILD_SCRIPT%"
- C:\julia\bin\julia -e "%JL_BUILD_SCRIPT%"

test_script:
- C:\projects\julia\bin\julia -e "Pkg.test(\"LASindex\")"
- 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%"
4 changes: 1 addition & 3 deletions src/LASindex.jl
Original file line number Diff line number Diff line change
@@ -1,10 +1,8 @@
__precompile__()

module LASindex

using FileIO
using RegionTrees
using StaticArrays
using StaticArrays

export
quadtree
Expand Down
14 changes: 7 additions & 7 deletions src/fileio.jl
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
using FileIO

type LaxHeader
struct LaxHeader
version::UInt32
end

Expand All @@ -10,7 +10,7 @@ function Base.read(io::IO, ::Type{LaxHeader})
)
end

type LaxQuadtreeHeader
struct LaxQuadtreeHeader
ssignature::UInt32 # LASS
stype::UInt32
qsignature::UInt32 # LASQ
Expand Down Expand Up @@ -41,7 +41,7 @@ function Base.read(io::IO, ::Type{LaxQuadtreeHeader})
)
end

type LaxIntervalHeader
struct LaxIntervalHeader
signature::UInt32
version::UInt32
number_cells::UInt32
Expand All @@ -55,7 +55,7 @@ function Base.read(io::IO, ::Type{LaxIntervalHeader})
)
end

type LaxIntervalCell
struct LaxIntervalCell
cell_index::Int32
number_intervals::UInt32
number_points::UInt32
Expand All @@ -69,7 +69,7 @@ function Base.read(io::IO, ::Type{LaxIntervalCell})
)
end

type LaxIntervalCellInterval
struct LaxIntervalCellInterval
_start::UInt32
_end::UInt32
end
Expand Down Expand Up @@ -112,7 +112,7 @@ function load(s::Stream{format"LAX"})
# Read cell and its intervals
qcell = read(s, LaxIntervalCell)
total_points += qcell.number_points
intervals = Vector{UnitRange{Integer}}(qcell.number_intervals)
intervals = Vector{UnitRange{Integer}}(undef, qcell.number_intervals)

for j = 1:qcell.number_intervals
intervals[j] = read(s, UnitRange{Integer})
Expand All @@ -126,7 +126,7 @@ function load(s::Stream{format"LAX"})
# assert we are at end of file
@assert eof(s)

info("Processed $(get(s.filename, ".lax")) with $(total_points) points.")
@info("Processed $(s.filename) with $(total_points) points.")

return qt
end
2 changes: 1 addition & 1 deletion src/quadtree.jl
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ end
"""Split a quadtree until the requested index is reached."""
function quadtree!(root::RegionTrees.Cell, index::Integer)
places = zlevels(index)
places = flipdim(places, 1) # bottom up
places = reverse(places, dims=1) # bottom up

for place in places
(place != 0) && (isleaf(root)) && (split!(root))
Expand Down
3 changes: 3 additions & 0 deletions src/util.jl
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
"""Merge vector of UnitRanges into Vector of UnitRanges that do not overlap."""
function merge(ranges::Vector{UnitRange{Integer}})
# prevent unwanted mutation
ranges = copy(ranges)

# Skip if there's nothing to merge
length(ranges) <= 1 && (return ranges)

Expand Down
4 changes: 3 additions & 1 deletion test/runtests.jl
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ using LASindex
using FileIO
using RegionTrees
using StaticArrays
using Base.Test
using Test

workdir = dirname(@__FILE__)

Expand Down Expand Up @@ -54,6 +54,8 @@ LASindex.quadtree!(root, 1, [2:5])
# Merge UnitRanges that do have overlap
r = Vector{UnitRange{Integer}}([1:5, 2:4, 12:13, 14:16])
@test LASindex.merge(r) == Vector{UnitRange{Integer}}([1:5, 12:16])
# and again to make sure it's not mutating
@test LASindex.merge(r) == Vector{UnitRange{Integer}}([1:5, 12:16])
r = Vector{UnitRange{Integer}}([1:5, 2:6, 12:13, 14:16, -1:2])
@test LASindex.merge(r) == Vector{UnitRange{Integer}}([-1:6, 12:16])
r = Vector{UnitRange{Integer}}()
Expand Down

0 comments on commit 2bbf94b

Please sign in to comment.