Skip to content

Commit 51f3b60

Browse files
committed
More user control over the types in marching_triangles
1 parent 1b95b8e commit 51f3b60

File tree

1 file changed

+15
-10
lines changed

1 file changed

+15
-10
lines changed

src/marching.jl

+15-10
Original file line numberDiff line numberDiff line change
@@ -268,6 +268,9 @@ Input:
268268
func: function on the grid nodes to be evaluated
269269
lines: vector of line definitions [a,b,c], s.t., ax + by + c = 0 defines a line
270270
levels: vector of levels for the iso-surface
271+
Tc: scalar type of coordinates
272+
Tp: vector type of coordinates
273+
Tv: scalar type of function values
271274
272275
Output:
273276
points: vector of 2D points of the intersections of the grid with the iso-surfaces or lines
@@ -277,33 +280,35 @@ Output:
277280
Note that passing both nonempty `lines` and `levels` will create a result with both types of points mixed.
278281
"""
279282
function marching_triangles(
280-
coord::Matrix{Tc},
283+
coord::Matrix{T},
281284
cellnodes::Matrix{Ti},
282285
func,
283286
lines,
284287
levels;
285-
Tv = Float32,
286-
Tp = SVector{2, Tv}
287-
) where {Tc <: Number, Ti <: Number}
288-
return marching_triangles([coord], [cellnodes], [func], lines, levels; Tv, Tp)
288+
Tc = T,
289+
Tp = SVector{2, Tc},
290+
Tv = Float64
291+
) where {T <: Number, Ti <: Number}
292+
return marching_triangles([coord], [cellnodes], [func], lines, levels; Tc, Tp, Tv)
289293
end
290294

291295

292296
"""
293297
$(SIGNATURES)
294298
295299
296-
Variant of `marching_tetrahedra` with multiple grid input
300+
Variant of `marching_triangles` with multiple grid input
297301
"""
298302
function marching_triangles(
299-
coords::Vector{Matrix{Tc}},
303+
coords::Vector{Matrix{T}},
300304
cellnodes::Vector{Matrix{Ti}},
301305
funcs,
302306
lines,
303307
levels;
304-
Tv = Float32,
305-
Tp = SVector{2, Tv},
306-
) where {Tc <: Number, Ti <: Number}
308+
Tc = T,
309+
Tp = SVector{2, Tc},
310+
Tv = Float64
311+
) where {T <: Number, Ti <: Number}
307312
points = Vector{Tp}(undef, 0)
308313
values = Vector{Tv}(undef, 0)
309314
adjacencies = Vector{SVector{2, Ti}}(undef, 0)

0 commit comments

Comments
 (0)