-
Notifications
You must be signed in to change notification settings - Fork 5
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
Attempt to handle AbstractRange
types for coordinate vectors
#29
Conversation
Hi, @Kevin-Mattheus-Moerman. An julia> supertypes(AbstractRange)
(AbstractRange, AbstractVector, Any) , so I think Regarding the test failures, I think we must adapt to JuliaGeometry/GeometryBasics.jl#226: |
Yes, sorry, I missed that. I'll revert that so. @t-bltg so the only "issue" in terms of handling ranges then seems to be relating to that
I can have a look, but I take it this issue does not relate to my PR. |
This seems to work: x::RefValue{<:AbstractVector{F}}
y::RefValue{<:AbstractVector{F}}
z::RefValue{<:AbstractVector{F}} The Can you add a small test too ? |
I don't mind you fixing the tests in this PR, since the |
Cool, thanks. I implemented the |
@t-bltg there seems to be a new testing error now where edit: I now sometimes see this error locally too. Not sure what is causing it though. |
@t-bltg I think the latest commit fixes the GeometryBasics |
Heck, there seems to be a julia> using MarchingCubes, AllocCheck
julia> mc = MarchingCubes.scenario(case = :cushin)
julia> @check_allocs foo(mc) = march(mc)
julia> try
foo(mc)
catch err
foreach(display, err.errors)
end
Allocation of Memory{StaticArraysCore.SVector{3, Float32}} in ./boot.jl:516
| ccall(:jl_alloc_genericmemory, Ref{GenericMemory{kind,T,addrspace}}, (Any, Int), self, m)
Stacktrace:
[1] GenericMemory
@ ./boot.jl:516 [inlined]
[2] array_new_memory
@ ./array.jl:1058 [inlined]
[3] (::Base.var"#133#134"{Vector{StaticArraysCore.SVector{3, Float32}}, Int64, Int64, Int64, Int64, Int64, Memory{StaticArraysCore.SVector{3, Float32}}, MemoryRef{StaticArraysCore.SVector{3, Float32}}})()
@ Base ./array.jl:1129
[4] multiple call sites
@ unknown:0
Allocation of Memory{StaticArraysCore.SVector{3, Int64}} in ./boot.jl:516
| ccall(:jl_alloc_genericmemory, Ref{GenericMemory{kind,T,addrspace}}, (Any, Int), self, m)
Stacktrace:
[1] GenericMemory
@ ./boot.jl:516 [inlined]
[2] array_new_memory
@ ./array.jl:1058 [inlined]
[3] (::Base.var"#133#134"{Vector{StaticArraysCore.SVector{3, Int64}}, Int64, Int64, Int64, Int64, Int64, Memory{StaticArraysCore.SVector{3, Int64}}, MemoryRef{StaticArraysCore.SVector{3, Int64}}})()
@ Base ./array.jl:1129
[4] multiple call sites
@ unknown:0
# other errors related to `@warn` or `@error` calls omitted ... |
Hum, no I was wrong, I think that So I think we should restore |
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## main #29 +/- ##
==========================================
- Coverage 99.58% 98.75% -0.84%
==========================================
Files 2 2
Lines 483 482 -1
==========================================
- Hits 481 476 -5
- Misses 2 6 +4 ☔ View full report in Codecov by Sentry. |
The tests are now passing. |
AbstractRange
types for coordinate vectors
@t-bltg okay I added testing for ranged coordinate input just now. The tests seem to pass mostly. Note my added tests might be a bit verbose with comments, as I noticed the other tests did not have comments. Feel free to purge it of the comments if you feel that is cleaner. Let me know if you feel the tests I added are appropriate or if more or some changes are needed. The tests I added check if for vector or range based coordinate input the following are the same:
I tried addressing the format issue there but not sure what it relates to. Also not sure why the Julia nightly tests relating to Side note, I removed |
Thanks for the added tests ! For the nightly failures, me don't mind about them, we will when an rc or a beta version will be out. |
@t-bltg thanks for developing MarchingCubes.jl! I am working on using it in my Comodo.jl package.
I wanted to extend MarchingCubes to allow for range type coordinate input, i.e. such that when using this:
the entries
xr
etc can be of the typeAbstractRange
.Currently I think I implemented a very basic fix, but perhaps you can point me to improving it if what I propose is not efficient.
In
MarchingCubes.jl
I changed the types fromAbstractVector{F} = F[],
toUnion{AbstractVector{F}, AbstractRange{F}} = F[],
Next in the definition of
MC
I added stuff like the below to collect the range into a vector before it is passed toRef(x)
:I did the simple
collect
mainly because I could not quickly figure out how to use/fix thatRef
andRefValue
business, so any advise on that is welcome.Below is the code I used for testing (which also contains Makie based visualisation):
Let me know if this is going in a direction you like or if the feature is not at all of interest (or what changes would be needed to have it fit).
Thanks!