Skip to content

Commit

Permalink
Use eachvertex in more places (#140)
Browse files Browse the repository at this point in the history
  • Loading branch information
juliohm authored Nov 19, 2024
1 parent 572966b commit 3b72677
Show file tree
Hide file tree
Showing 7 changed files with 9 additions and 9 deletions.
2 changes: 1 addition & 1 deletion Project.toml
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ GeoTables = "1.24.0"
GslibIO = "1.5"
ImageIO = "0.6"
MappedArrays = "0.4"
Meshes = "0.50 - 0.52"
Meshes = "0.52.4"
NCDatasets = "0.13, 0.14"
PlyIO = "1.1"
PrecompileTools = "1.2"
Expand Down
2 changes: 1 addition & 1 deletion src/extra/msh.jl
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@ function mshwrite(fname, geotable; vcolumn=nothing, ecolumn=nothing)
write(io, "$i\n")
end
# node coordinates
for point in vertices(mesh)
for point in eachvertex(mesh)
coords = ustrip.(to(point))
write(io, "$(join(coords, " "))\n")
end
Expand Down
2 changes: 1 addition & 1 deletion src/extra/obj.jl
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ function objwrite(fname, geotable)
end

open(fname, write=true) do io
for point in vertices(mesh)
for point in eachvertex(mesh)
coords = ustrip.(to(point))
write(io, "v $(join(coords, " "))\n")
end
Expand Down
2 changes: 1 addition & 1 deletion src/extra/off.jl
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@ function offwrite(fname, geotable; color=nothing)
# number of edges must be ignored by passing 0
write(io, "$nverts $nfaces 0\n")

for point in vertices(mesh)
for point in eachvertex(mesh)
coords = ustrip.(to(point))
write(io, "$(join(coords, " "))\n")
end
Expand Down
2 changes: 1 addition & 1 deletion src/extra/ply.jl
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ function plywrite(fname, geotable; kwargs...)
vtable = values(geotable, 0)

# retrive vertices and connectivity
verts = vertices(mesh)
verts = eachvertex(mesh)
connec = elements(topology(mesh))

# create ply dictionary
Expand Down
4 changes: 2 additions & 2 deletions src/extra/stl.jl
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,7 @@ function stlasciiwrite(fname, mesh)
write(io, "facet normal $(frmtcoords(n))\n")
write(io, " outer loop\n")

for point in vertices(triangle)
for point in eachvertex(triangle)
c = ustrip.(to(point))
write(io, " vertex $(frmtcoords(c))\n")
end
Expand Down Expand Up @@ -139,7 +139,7 @@ function stlbinwrite(fname, mesh)
for triangle in elements(mesh)
n = ustrip.(normal(triangle))
foreach(c -> write(io, Float32(c)), n)
for point in vertices(triangle)
for point in eachvertex(triangle)
foreach(c -> write(io, Float32(c)), ustrip.(to(point)))
end
write(io, 0x0000) # empty attribute byte count
Expand Down
4 changes: 2 additions & 2 deletions src/extra/vtkwrite.jl
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ function vtkwrite(fname, geotable)
end

function vtuwrite(fname, mesh::Mesh, etable, vtable)
verts = vertices(mesh)
verts = eachvertex(mesh)
connec = elements(topology(mesh))
points = stack(p -> ustrip.(to(p)), verts)
cells = [VTKBase.MeshCell(_vtktype(pltype(c)), indices(c)) for c in connec]
Expand All @@ -32,7 +32,7 @@ function vtuwrite(fname, mesh::Mesh, etable, vtable)
end

function vtpwrite(fname, mesh::Mesh, etable, vtable)
verts = vertices(mesh)
verts = eachvertex(mesh)
connec = elements(topology(mesh))
points = stack(p -> ustrip.(to(p)), verts)
cells = [VTKBase.MeshCell(PolyData.Polys(), indices(c)) for c in connec]
Expand Down

0 comments on commit 3b72677

Please sign in to comment.