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

speed up large polygon intersections using STRtrees and many other things #259

Open
wants to merge 105 commits into
base: as/stabletasks
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
105 commits
Select commit Hold shift + click to select a range
35d97e6
Support GeometryBasics v0.5, bump patch version (#251)
asinghvi17 Jan 21, 2025
6b50e2a
Update Project.toml
asinghvi17 Jan 21, 2025
375ea0a
speed up large polygon intersections using an STRtree on poly b
asinghvi17 Feb 14, 2025
32e77db
add staticarrays + strtree
asinghvi17 Feb 14, 2025
9995e7b
works but bad perf "do-everything-function"
asinghvi17 Feb 14, 2025
d98949c
Fix type instability
asinghvi17 Feb 14, 2025
cc5545d
WIP dual query
asinghvi17 Feb 14, 2025
05ee402
make the benchmark script work again
asinghvi17 Feb 14, 2025
c19730f
fixes
asinghvi17 Feb 14, 2025
7411f3b
add comments + simplify edgelist generation
asinghvi17 Feb 14, 2025
c7c1fbe
Final clean up
asinghvi17 Feb 14, 2025
25c414d
Move things around + loop state machine
asinghvi17 Feb 14, 2025
edc6123
some things got left behind
asinghvi17 Feb 14, 2025
b5c09f2
add a Return action
asinghvi17 Feb 14, 2025
0b98d8b
plotting quickfix
asinghvi17 Feb 14, 2025
6aa1187
Better tests and testsets (#260)
asinghvi17 Feb 14, 2025
dace097
Fix package.json that stopped doc build (#261)
asinghvi17 Feb 14, 2025
ae01d9b
Move doctests to a separate CI job
asinghvi17 Feb 14, 2025
1416bd5
Fix typo
asinghvi17 Feb 14, 2025
e25ef73
make watersheds reproducible, move it to the bottom
asinghvi17 Feb 14, 2025
ae1189b
fix++
asinghvi17 Feb 14, 2025
cd87f7b
edge thinning
rafaqz Feb 15, 2025
6385fd9
Merge branch 'as/non_working_do_everything' into edge_thinning
rafaqz Feb 15, 2025
1ba7bb8
abstracted indices
rafaqz Feb 15, 2025
5cbf798
working filtered single tree
rafaqz Feb 15, 2025
6d86135
all working
rafaqz Feb 15, 2025
726106b
Fix vancouver polygons benchmark
asinghvi17 Feb 15, 2025
1e00098
some minor edits to man-alg-op system
asinghvi17 Feb 15, 2025
0bba556
Merge remote-tracking branch 'origin/edge_thinning' into as/non_worki…
asinghvi17 Feb 15, 2025
9d01309
Add an algorithm (plus manifold and accelerator) to clipping
asinghvi17 Feb 15, 2025
047403d
add STRtree branch in CI
asinghvi17 Feb 15, 2025
95bd6f2
use package extents
rafaqz Feb 15, 2025
a136e2d
better circle benchmarks
asinghvi17 Feb 15, 2025
db39f96
fix branch name in CI
asinghvi17 Feb 15, 2025
a0e2772
better benchmark plot
asinghvi17 Feb 15, 2025
f7485c8
don't unnecessarily use densified geometries at this point
asinghvi17 Feb 15, 2025
09a549b
Fix cut
asinghvi17 Feb 15, 2025
800c131
fix difference and union
asinghvi17 Feb 15, 2025
49790bf
Remove DoubleSTR from optimization and tests
asinghvi17 Feb 15, 2025
f93665f
fix cut
asinghvi17 Feb 15, 2025
ad48339
Short circuit SingleSTRTree if there is no possible interaction
asinghvi17 Feb 15, 2025
c9878fe
force the loop to be at maximum n^2 iterations in vancouver bench
asinghvi17 Feb 16, 2025
eb1f921
`@processloopaction` -> `@controlflow`
asinghvi17 Feb 16, 2025
ae908b1
remove dual query code
asinghvi17 Feb 16, 2025
e904f65
fix
asinghvi17 Feb 16, 2025
38c731b
fix tests
asinghvi17 Feb 16, 2025
925eb1f
Implement difference targeting multipolygontrait
asinghvi17 Feb 16, 2025
53e2c61
add multipolygon-target intersection too
asinghvi17 Feb 16, 2025
a7d4743
add STRtree main
asinghvi17 Feb 18, 2025
7da7f60
Merge branch 'main' into as/usecore
asinghvi17 Feb 20, 2025
cfeaf67
Remove underscores from BoolsAsTypes
asinghvi17 Feb 22, 2025
ac97e0c
remove redundant assert + error on max_dist<0 in segmentize
asinghvi17 Feb 22, 2025
169ea52
Merge branch 'as/usecore' into as/non_working_do_everything
asinghvi17 Feb 22, 2025
66b7126
finish merge and changes that did not propagate correctly
asinghvi17 Feb 22, 2025
d158c3a
Transition to StableTasks for apply and applyreduce
asinghvi17 Feb 22, 2025
e6e2791
Fix segmentize
asinghvi17 Feb 22, 2025
b9cc39d
Merge branch 'as/usecore' into as/non_working_do_everything
asinghvi17 Feb 22, 2025
2c95b27
Use GeometryOpsCore for real (#223)
asinghvi17 Feb 22, 2025
d72e5f1
Fix package.json that stopped doc build (#262)
asinghvi17 Feb 22, 2025
18eb5e9
Bump patch version (#265)
asinghvi17 Feb 22, 2025
8a5ac83
Merge remote-tracking branch 'origin/main' into as/non_working_do_eve…
asinghvi17 Feb 23, 2025
e26f569
Fix booltype docstrings
asinghvi17 Feb 23, 2025
9ce89b3
Implement eachedge ring-wise on iterators
asinghvi17 Feb 23, 2025
aa17aeb
Remove DoubleSTRtree from benchmarks for now
asinghvi17 Feb 23, 2025
72781aa
Use foreach_pair_of_maybe_intersecting_edges in _intersection_point also
asinghvi17 Feb 23, 2025
50b0a4b
Add docstring to foreach_pair_of_maybe_intersecting_edges
asinghvi17 Feb 23, 2025
b57ee66
Check if the each_a functions are nothing, if they are then don't exe…
asinghvi17 Feb 23, 2025
7502259
tweak CI and docs + restrict STR version
asinghvi17 Feb 23, 2025
9122d41
fix CI
asinghvi17 Feb 23, 2025
83f3bbe
improve benchmark script
asinghvi17 Feb 23, 2025
ee9e414
remove redundant comment in intersection.jl
asinghvi17 Feb 23, 2025
8a3b0d6
fix
asinghvi17 Feb 23, 2025
b203cd2
Add a JTS testset parser and executor
asinghvi17 Feb 23, 2025
e30c0b8
use named constants for all default values
asinghvi17 Feb 24, 2025
2306b27
clean up booltypes.jl
asinghvi17 Feb 24, 2025
14c6dba
make it extremely clear that the Operation interface is not implemented
asinghvi17 Feb 24, 2025
1cceade
refactor tracing error to be more general
asinghvi17 Feb 27, 2025
cd86232
Implement a TGGeometry extension for that super fast tg goodness
asinghvi17 Feb 27, 2025
76764be
refactor tracing error pt 2
asinghvi17 Feb 27, 2025
c9e15df
refactor GEOS to use algorithm types, add TG algorithm to
asinghvi17 Feb 27, 2025
693bf7a
Get algorithms into GeometryOps
asinghvi17 Feb 27, 2025
e0c3efe
Fix multipolygon touches being too sensitive
asinghvi17 Feb 27, 2025
c3402f2
Add a `tg` testset reader and executor too
asinghvi17 Feb 27, 2025
cbd9267
more comments in types + add PROJ
asinghvi17 Feb 27, 2025
3bfebd8
move LoopStateMachine file
asinghvi17 Feb 27, 2025
637be94
Working natural index interface
asinghvi17 Feb 27, 2025
1cfe43c
first draft implementation of SpatialTreeInterface
asinghvi17 Feb 28, 2025
37181e3
update readme too
asinghvi17 Feb 28, 2025
159f873
finish natural index implementation
asinghvi17 Feb 28, 2025
4f9998e
use adaptive predicates in orient
asinghvi17 Feb 28, 2025
2df6772
use orient not cross in point-in-polygon, since that's adaptive
asinghvi17 Feb 28, 2025
0745007
Create a NaturallyIndexedRing that is like a prepared geometry
asinghvi17 Feb 28, 2025
73134b9
add AdaptivePredicates to project
asinghvi17 Feb 28, 2025
718de87
add edge_extents method to compute extent of each edge
asinghvi17 Feb 28, 2025
de0e6ba
Implement a FullReturn action in LoopStateMachine
asinghvi17 Feb 28, 2025
e67f606
add named geometries from tg as well, for testing
asinghvi17 Feb 28, 2025
5f7107b
finally create the module for NaturalIndexing
asinghvi17 Feb 28, 2025
1b0d864
controlflow everywhere to support early return with FullReturn
asinghvi17 Feb 28, 2025
1bb609a
fully commit (maybe we shouldn't though?)
asinghvi17 Feb 28, 2025
6041b61
revert change to point-in-polygon query
asinghvi17 Feb 28, 2025
dbc7338
describe how to do standard query with do_query
asinghvi17 Feb 28, 2025
3ea7e0d
Fix touches
asinghvi17 Feb 28, 2025
58a3090
make predicate return sign not anything else
asinghvi17 Mar 1, 2025
8242aa2
make trees work again
asinghvi17 Mar 1, 2025
3e55371
implement singal, dual, thinned each_maybe_intersecting_pair
asinghvi17 Mar 1, 2025
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
23 changes: 19 additions & 4 deletions .github/workflows/CI.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ jobs:
fail-fast: false
matrix:
version:
- '1.9'
- '1.10'
- '1'
- 'nightly'
os:
Expand All @@ -33,8 +33,8 @@ jobs:
version: ${{ matrix.version }}
arch: ${{ matrix.arch }}
- uses: julia-actions/cache@v1
- name: Dev GeometryOpsCore`
run: julia --project=. -e 'using Pkg; Pkg.develop(; path = joinpath(".", "GeometryOpsCore"))'
- name: Dev GeometryOpsCore and add other packages
run: julia --project=. -e 'using Pkg; Pkg.develop(; path = joinpath(".", "GeometryOpsCore"));'
- uses: julia-actions/julia-buildpkg@v1
- uses: julia-actions/julia-runtest@v1
- uses: julia-actions/julia-processcoverage@v1
Expand All @@ -60,13 +60,28 @@ jobs:
with:
version: '1'
- name: Build and add versions
run: julia --project=docs -e 'using Pkg; Pkg.develop([PackageSpec(path = "."), PackageSpec(path = joinpath(".", "GeometryOpsCore"))]); Pkg.add([PackageSpec(name = "GeoMakie", rev = "master"), PackageSpec(name="GeoInterface", rev="bugfix_vars")])'
run: julia --project=docs -e 'using Pkg; Pkg.add([PackageSpec(name = "GeoMakie", rev = "master")])'
- uses: julia-actions/julia-docdeploy@v1
with:
install-package: false
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
DOCUMENTER_KEY: ${{ secrets.DOCUMENTER_KEY }}
doctests:
name: Doctests
runs-on: ubuntu-latest
permissions:
contents: write
statuses: write
actions: write
steps:
- uses: actions/checkout@v2
- uses: julia-actions/cache@v1
- uses: julia-actions/setup-julia@v1
with:
version: '1'
- name: Build and add versions
run: julia --project=docs -e 'using Pkg; Pkg.add([PackageSpec(name = "GeoMakie", rev = "master")])'
- run: |
julia --project=docs -e '
using Documenter: DocMeta, doctest
Expand Down
1 change: 1 addition & 0 deletions GeometryOpsCore/src/GeometryOpsCore.jl
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ using DataAPI
import StableTasks

include("keyword_docs.jl")
include("constants.jl")

include("types/manifold.jl")
include("types/algorithm.jl")
Expand Down
61 changes: 21 additions & 40 deletions GeometryOpsCore/src/apply.jl
Original file line number Diff line number Diff line change
Expand Up @@ -126,8 +126,8 @@ end
@inline function apply(
f::F, target, geom; calc_extent=false, threaded=false, kw...
) where F
threaded = _booltype(threaded)
calc_extent = _booltype(calc_extent)
threaded = booltype(threaded)
calc_extent = booltype(calc_extent)
_apply(f, TraitTarget(target), geom; threaded, calc_extent, kw...)
end

Expand All @@ -139,7 +139,7 @@ end
# For an Array there is nothing else to do but map `_apply` over all values
# _maptasks may run this level threaded if `threaded==true`,
# but deeper `_apply` called in the closure will not be threaded
apply_to_array(i) = _apply(f, target, A[i]; threaded=_False(), kw...)
apply_to_array(i) = _apply(f, target, A[i]; threaded=False(), kw...)
_maptasks(apply_to_array, eachindex(A), threaded)
end
# There is no trait and this is not an AbstractArray.
Expand All @@ -150,7 +150,7 @@ end
if Tables.istable(iterable)
_apply_table(f, target, iterable; threaded, kw...)
else # this is probably some form of iterable...
if threaded isa _True
if threaded isa True
# `collect` first so we can use threads
_apply(f, target, collect(iterable); threaded, kw...)
else
Expand Down Expand Up @@ -226,14 +226,14 @@ end
# Rewrap all FeatureCollectionTrait feature collections as GI.FeatureCollection
# Maybe use threads to call _apply on component features
@inline function _apply(f::F, target, ::GI.FeatureCollectionTrait, fc;
crs=GI.crs(fc), calc_extent=_False(), threaded
crs=GI.crs(fc), calc_extent=False(), threaded
) where F

# Run _apply on all `features` in the feature collection, possibly threaded
apply_to_feature(i) =
_apply(f, target, GI.getfeature(fc, i); crs, calc_extent, threaded=_False())::GI.Feature
_apply(f, target, GI.getfeature(fc, i); crs, calc_extent, threaded=False())::GI.Feature
features = _maptasks(apply_to_feature, 1:GI.nfeature(fc), threaded)
if calc_extent isa _True
if calc_extent isa True
# Calculate the extent of the features
extent = mapreduce(GI.extent, Extents.union, features)
# Return a FeatureCollection with features, crs and calculated extent
Expand All @@ -245,13 +245,13 @@ end
end
# Rewrap all FeatureTrait features as GI.Feature, keeping the properties
@inline function _apply(f::F, target, ::GI.FeatureTrait, feature;
crs=GI.crs(feature), calc_extent=_False(), threaded
crs=GI.crs(feature), calc_extent=False(), threaded
) where F
# Run _apply on the contained geometry
geometry = _apply(f, target, GI.geometry(feature); crs, calc_extent, threaded)
# Get the feature properties
properties = GI.properties(feature)
if calc_extent isa _True
if calc_extent isa True
# Calculate the extent of the geometry
extent = GI.extent(geometry)
# Return a new Feature with the new geometry and calculated extent, but the original properties and crs
Expand All @@ -264,36 +264,36 @@ end
# Reconstruct nested geometries,
# maybe using threads to call _apply on component geoms
@inline function _apply(f::F, target, trait, geom;
crs=GI.crs(geom), calc_extent=_False(), threaded
crs=GI.crs(geom), calc_extent=False(), threaded
)::(GI.geointerface_geomtype(trait)) where F
# Map `_apply` over all sub geometries of `geom`
# to create a new vector of geometries
# TODO handle zero length
apply_to_geom(i) = _apply(f, target, GI.getgeom(geom, i); crs, calc_extent, threaded=_False())
apply_to_geom(i) = _apply(f, target, GI.getgeom(geom, i); crs, calc_extent, threaded=False())
geoms = _maptasks(apply_to_geom, 1:GI.ngeom(geom), threaded)
return _apply_inner(geom, geoms, crs, calc_extent)
end
@inline function _apply(f::F, target::TraitTarget{<:PointTrait}, trait::GI.PolygonTrait, geom;
crs=GI.crs(geom), calc_extent=_False(), threaded
crs=GI.crs(geom), calc_extent=False(), threaded
)::(GI.geointerface_geomtype(trait)) where F
# We need to force rebuilding a LinearRing not a LineString
geoms = _maptasks(1:GI.ngeom(geom), threaded) do i
lr = GI.getgeom(geom, i)
points = map(GI.getgeom(lr)) do p
_apply(f, target, p; crs, calc_extent, threaded=_False())
_apply(f, target, p; crs, calc_extent, threaded=False())
end
_linearring(_apply_inner(lr, points, crs, calc_extent))
end
return _apply_inner(geom, geoms, crs, calc_extent)
end
function _apply_inner(geom, geoms, crs, calc_extent::_True)
function _apply_inner(geom, geoms, crs, calc_extent::True)
# Calculate the extent of the sub geometries
extent = mapreduce(GI.extent, Extents.union, geoms)
# Return a new geometry of the same trait as `geom`,
# holding the new `geoms` with `crs` and calculated extent
return rebuild(geom, geoms; crs, extent)
end
function _apply_inner(geom, geoms, crs, calc_extent::_False)
function _apply_inner(geom, geoms, crs, calc_extent::False)
# Return a new geometry of the same trait as `geom`, holding the new `geoms` with `crs`
return rebuild(geom, geoms; crs)
end
Expand All @@ -319,41 +319,22 @@ end

using Base.Threads: nthreads, @threads, @spawn

# Threading utility, modified Mason Protters threading PSA
# run `f` over ntasks, where f receives an AbstractArray/range
# of linear indices
@inline function _maptasks(f::F, taskrange, threaded::_True)::Vector where F
ntasks = length(taskrange)
# Customize this as needed.
# More tasks have more overhead, but better load balancing
tasks_per_thread = 2
chunk_size = max(1, ntasks ÷ (tasks_per_thread * nthreads()))
# partition the range into chunks
task_chunks = Iterators.partition(taskrange, chunk_size)
# Map over the chunks
tasks = map(task_chunks) do chunk
# Spawn a task to process this chunk
@spawn begin
# Where we map `f` over the chunk indices
map(f, chunk)
end
end

# Finally we join the results into a new vector
return mapreduce(fetch, vcat, tasks)
end
#=
Here we used to use the compiler directive `@assume_effects :foldable` to force the compiler
to lookup through the closure. This alone makes e.g. `flip` 2.5x faster!

But it caused inference to fail, so we've removed it. No effect on runtime so far as we can tell,
at least in Julia 1.11.
=#
@inline function _maptasks(f::F, taskrange, threaded::_False)::Vector where F
@inline function _maptasks(f::F, taskrange, threaded::False)::Vector where F
map(f, taskrange)
end

@inline function _maptasks(f::F, taskrange, threaded::_TrueButStable)::Vector where F

# Threading utility, modified Mason Protters threading PSA
# run `f` over ntasks, where f receives an AbstractArray/range
# of linear indices
@inline function _maptasks(f::F, taskrange, threaded::True)::Vector where F
ntasks = length(taskrange)
# Customize this as needed.
# More tasks have more overhead, but better load balancing
Expand Down
40 changes: 9 additions & 31 deletions GeometryOpsCore/src/applyreduce.jl
Original file line number Diff line number Diff line change
Expand Up @@ -34,24 +34,24 @@ feature collections and nested geometries.
@inline function applyreduce(
f::F, op::O, target, geom; threaded=false, init=nothing
) where {F, O}
threaded = _booltype(threaded)
threaded = booltype(threaded)
_applyreduce(f, op, TraitTarget(target), geom; threaded, init)
end

@inline _applyreduce(f::F, op::O, target, geom; threaded, init) where {F, O} =
_applyreduce(f, op, target, GI.trait(geom), geom; threaded, init)
# Maybe use threads reducing over arrays
@inline function _applyreduce(f::F, op::O, target, ::Nothing, A::AbstractArray; threaded, init) where {F, O}
applyreduce_array(i) = _applyreduce(f, op, target, A[i]; threaded=_False(), init)
applyreduce_array(i) = _applyreduce(f, op, target, A[i]; threaded=False(), init)
_mapreducetasks(applyreduce_array, op, eachindex(A), threaded; init)
end
# Try to applyreduce over iterables
@inline function _applyreduce(f::F, op::O, target, ::Nothing, iterable::IterableType; threaded, init) where {F, O, IterableType}
if Tables.istable(iterable)
_applyreduce_table(f, op, target, iterable; threaded, init)
else
applyreduce_iterable(i) = _applyreduce(f, op, target, i; threaded=_False(), init)
if threaded isa _True # Try to `collect` and reduce over the vector with threads
applyreduce_iterable(i) = _applyreduce(f, op, target, i; threaded=False(), init)
if threaded isa True # Try to `collect` and reduce over the vector with threads
_applyreduce(f, op, target, collect(iterable); threaded, init)
else
# Try to `mapreduce` the iterable as-is
Expand All @@ -77,23 +77,23 @@ function _applyreduce_table(f::F, op::O, target::GI.FeatureTrait, iterable::Iter
end
# Maybe use threads reducing over features of feature collections
@inline function _applyreduce(f::F, op::O, target, ::GI.FeatureCollectionTrait, fc; threaded, init) where {F, O}
applyreduce_fc(i) = _applyreduce(f, op, target, GI.getfeature(fc, i); threaded=_False(), init)
applyreduce_fc(i) = _applyreduce(f, op, target, GI.getfeature(fc, i); threaded=False(), init)
_mapreducetasks(applyreduce_fc, op, 1:GI.nfeature(fc), threaded; init)
end
# Features just applyreduce to their geometry
@inline _applyreduce(f::F, op::O, target, ::GI.FeatureTrait, feature; threaded, init) where {F, O} =
_applyreduce(f, op, target, GI.geometry(feature); threaded, init)
# Maybe use threads over components of nested geometries
@inline function _applyreduce(f::F, op::O, target, trait, geom; threaded, init) where {F, O}
applyreduce_geom(i) = _applyreduce(f, op, target, GI.getgeom(geom, i); threaded=_False(), init)
applyreduce_geom(i) = _applyreduce(f, op, target, GI.getgeom(geom, i); threaded=False(), init)
_mapreducetasks(applyreduce_geom, op, 1:GI.ngeom(geom), threaded; init)
end
# Don't thread over points it won't pay off
@inline function _applyreduce(
f::F, op::O, target, trait::Union{GI.LinearRing,GI.LineString,GI.MultiPoint}, geom;
threaded, init
) where {F, O}
_applyreduce(f, op, target, GI.getgeom(geom); threaded=_False(), init)
_applyreduce(f, op, target, GI.getgeom(geom); threaded=False(), init)
end
# Apply f to the target
@inline function _applyreduce(f::F, op::O, ::TraitTarget{Target}, ::Trait, x; kw...) where {F,O,Target,Trait<:Target}
Expand Down Expand Up @@ -124,29 +124,7 @@ import Base.Threads: nthreads, @threads, @spawn
#
# If you absolutely need a single chunk, then `threaded = false` will always decompose
# to straight `mapreduce` without grouping.

@inline function _mapreducetasks(f::F, op, taskrange, threaded::_True; init) where F
ntasks = length(taskrange)
# Customize this as needed.
# More tasks have more overhead, but better load balancing
tasks_per_thread = 2
chunk_size = max(1, ntasks ÷ (tasks_per_thread * nthreads()))
# partition the range into chunks
task_chunks = Iterators.partition(taskrange, chunk_size)
# Map over the chunks
tasks = map(task_chunks) do chunk
# Spawn a task to process this chunk
Threads.@spawn begin
# Where we map `f` over the chunk indices
mapreduce(f, op, chunk; init)
end
end

# Finally we join the results into a new vector
return mapreduce(fetch, op, tasks; init)
end

@inline function _mapreducetasks(f::F, op, taskrange, threaded::_TrueButStable; init) where F
@inline function _mapreducetasks(f::F, op, taskrange, threaded::True; init) where F
ntasks = length(taskrange)
# Customize this as needed.
# More tasks have more overhead, but better load balancing
Expand All @@ -167,6 +145,6 @@ end
return mapreduce(fetch, op, tasks; init)
end

function _mapreducetasks(f::F, op, taskrange, threaded::_False; init) where F
function _mapreducetasks(f::F, op, taskrange, threaded::False; init) where F
mapreduce(f, op, taskrange; init)
end
8 changes: 8 additions & 0 deletions GeometryOpsCore/src/constants.jl
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
"The semi-major axis of the WGS84 ellipsoid"
const WGS84_EARTH_SEMI_MAJOR_RADIUS = 6378137.0

"The inverse flattening of the WGS84 ellipsoid"
const WGS84_EARTH_INV_FLATTENING = 298.257223563

"The mean radius of the WGS84 ellipsoid, used for spherical manifold default"
const WGS84_EARTH_MEAN_RADIUS = 6371008.8
11 changes: 11 additions & 0 deletions GeometryOpsCore/src/types/algorithm.jl
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,19 @@ Algorithms are:

=#

export Algorithm, AutoAlgorithm, ManifoldIndependentAlgorithm, SingleManifoldAlgorithm, NoAlgorithm

abstract type Algorithm{M <: Manifold} end

struct AutoAlgorithm{T, M <: Manifold} <: Algorithm{M}
manifold::M
x::T
end

AutoAlgorithm(m::Manifold; kwargs...) = AutoAlgorithm(m, kwargs)
AutoAlgorithm(; kwargs...) = AutoAlgorithm(AutoManifold(), kwargs)


abstract type ManifoldIndependentAlgorithm{M <: Manifold} <: Algorithm{M} end

abstract type SingleManifoldAlgorithm{M <: Manifold} <: Algorithm{M} end
Expand Down
Loading
Loading