Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
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
2 changes: 1 addition & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ jobs:
fail-fast: false
matrix:
version:
- '1.9' # Replace this with the minimum Julia version that your package supports. E.g. if your package requires Julia 1.5 or higher, change this to '1.5'.
- '1.10' # Replace this with the minimum Julia version that your package supports. E.g. if your package requires Julia 1.5 or higher, change this to '1.5'.
- '1' # Leave this line unchanged. '1' will automatically expand to the latest stable 1.x release of Julia.
# - 'nightly'
os:
Expand Down
6 changes: 4 additions & 2 deletions Project.toml
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
name = "SimplexGridFactory"
uuid = "57bfcd06-606e-45d6-baf4-4ba06da0efd5"
authors = ["Juergen Fuhrmann <juergen.fuhrmann@wias-berlin.de>", "Patrick Jaap <patrick.jaap@wias-berlin.de>"]
version = "2.6.1"
authors = ["Juergen Fuhrmann <juergen.fuhrmann@wias-berlin.de>", "Patrick Jaap <patrick.jaap@wias-berlin.de>"]

[deps]
Dates = "ade2ca70-3891-5945-98fb-dc099432e06a"
DocStringExtensions = "ffbed154-4ef7-542d-bbb7-c09d3a79fcae"
ElasticArrays = "fdbdab4c-e67f-52f5-8c3f-e7b388dad3d4"
ExtendableGrids = "cfc395e8-590f-11e8-1f13-43a2532b2fa8"
Expand All @@ -18,6 +19,7 @@ TetGen = "c5d3f3f7-f850-59f6-8a2e-ffc6dc1317ea"
Triangulate = "f7e6ffb2-c36d-4f8f-a77e-16e897189344"

[compat]
Dates = "1.10"
DocStringExtensions = "0.8,0.9"
ElasticArrays = "^1.2"
ExtendableGrids = "1.6"
Expand All @@ -28,4 +30,4 @@ MeshIO = "0.4, 0.5"
Printf = "1.6"
TetGen = "1.5,2"
Triangulate = "2.3.1, 3"
julia = "1.9"
julia = "1.10"
1 change: 1 addition & 0 deletions src/SimplexGridFactory.jl
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ using LinearAlgebra: norm
using ElasticArrays: ElasticArray
import ExtendableGrids
using ExtendableGrids: dim_space, Coordinates, BFaceNodes, BFaceRegions, simplexgrid, BinnedPointList
using Dates: now
using DocStringExtensions: SIGNATURES, TYPEDEF, TYPEDSIGNATURES
using GridVisualize: GridVisualize, GridVisualizer, plot_triangulateio!
using FileIO: load
Expand Down
72 changes: 72 additions & 0 deletions src/tetgen.jl
Original file line number Diff line number Diff line change
Expand Up @@ -151,3 +151,75 @@ function tetgenio(this::SimplexGridBuilder)
regionvolumes = this.regionvolumes
)
end

function writesmesh(file::String, b::SimplexGridBuilder)
return writesmesh(file, tetgenio(b))
end

function writesmesh(io::IO, tio)
shift = 1
npoints = size(tio.pointlist, 2)
dimension = 3
npointboundarymarkers = 0
npointattributes = 0
nfacets = length(tio.facetlist)
nfacetboundarymarkers = length(tio.facetmarkerlist) > 0 ? 1 : 0
nholes = size(tio.holelist, 2)
nregions = size(tio.regionlist, 2)

write(io, @sprintf("# TetGen input file\n"))
write(io, @sprintf("# Created by SimplexGridFactory.jl %s\n", string(now())))
write(io, @sprintf("\n# part 1: node list."))
write(io, @sprintf("\n%ld %d %d %d", npoints, dimension, npointboundarymarkers, npointattributes))
for ipoint in 1:npoints
write(
io, @sprintf(
"\n%ld %.17g %.17g %.17g", ipoint - 1,
tio.pointlist[1, ipoint], tio.pointlist[2, ipoint], tio.pointlist[3, ipoint]
)
)
end
write(io, @sprintf("\n\n# part 2: facet list."))
write(io, @sprintf("\n%ld %d", nfacets, nfacetboundarymarkers))
for ifacet in 1:nfacets
facet = tio.facetlist[ifacet].polygonlist[1]
ncorners = length(facet)
write(io, @sprintf("\n%ld ", ncorners))
for icorner in 1:ncorners
write(io, @sprintf("%ld ", facet[icorner] - 1))
end
if nfacetboundarymarkers > 0
write(io, @sprintf("%ld ", tio.facetmarkerlist[ifacet]))
end
end
write(io, @sprintf("\n\n# part 3: hole list."))
write(io, @sprintf("\n%ld", nholes))
for ihole in 1:nholes
write(
io, @sprintf(
"\n%ld %.17g %.17g %.17g", ihole - 1,
tio.holelist[1, ihole], tio.holelist[2, ihole], tio.holelist[3, ihole]
)
)
end
write(io, @sprintf("\n\n# part 4: region list."))
write(io, @sprintf("\n%ld", nregions))
for iregion in 1:nregions
write(
io, @sprintf(
"\n%ld %.17g %.17g %.17g %f %.17g", iregion - 1,
tio.regionlist[1, iregion], tio.regionlist[2, iregion], tio.regionlist[3, iregion],
tio.regionlist[4, iregion], tio.regionlist[5, iregion]
)
)
end
write(io, "\n")
return
end

function writesmesh(fname::String, tetin)
open(fname, "w") do io
writesmesh(io, tetin)
end
return
end
Loading