diff --git a/CHANGELOG.md b/CHANGELOG.md index f986e18..e564ec5 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,4 +1,8 @@ # Changes +## v2.3.0 Nov 28, 2024 +- Allow for TetGen v1, v2 +- Deprecate simplexgrid(Module...) + ## v2.2.1 Nov 2, 2024 - Move repo to WIAS-PDELib org diff --git a/Project.toml b/Project.toml index 356ea08..9c5c3cb 100644 --- a/Project.toml +++ b/Project.toml @@ -1,7 +1,7 @@ name = "SimplexGridFactory" uuid = "57bfcd06-606e-45d6-baf4-4ba06da0efd5" authors = ["Juergen Fuhrmann "] -version = "2.2.1" +version = "2.3.0" [deps] DocStringExtensions = "ffbed154-4ef7-542d-bbb7-c09d3a79fcae" @@ -24,6 +24,6 @@ FileIO = "1" LinearAlgebra = "1.9" MeshIO = "0.4" Printf = "1.6" -TetGen = "1.5" +TetGen = "1.5,2" Triangulate = "2.3.1" julia = "1.9" diff --git a/examples/examples2d.jl b/examples/examples2d.jl index b7c778e..611a0b7 100644 --- a/examples/examples2d.jl +++ b/examples/examples2d.jl @@ -124,7 +124,7 @@ end # # ## Direct specification of input arrays -# Of course we can specify the input for Triangle +# We can specify the input for Triangle # directly. The aim of SimplexBuilder is to avoid # the tedious and error prone counting connected # with this approach. diff --git a/src/simplexgrid.jl b/src/simplexgrid.jl index f4107e2..77035d9 100644 --- a/src/simplexgrid.jl +++ b/src/simplexgrid.jl @@ -29,6 +29,7 @@ function ExtendableGrids.simplexgrid(Generator::Module; regionnumbers = Array{Cint, 1}(undef, 0), regionvolumes = Array{Cdouble, 1}(undef, 0), kwargs...) + @warn "ExtendableGrids.simplexgrid(::Module; kwargs...) is deprecated" if size(points, 1) == 2 tio = triangulateio(Generator; points = points, bfaces = bfaces, diff --git a/src/simplexgridbuilder.jl b/src/simplexgridbuilder.jl index 6c105a6..7899aac 100644 --- a/src/simplexgridbuilder.jl +++ b/src/simplexgridbuilder.jl @@ -327,21 +327,25 @@ function ExtendableGrids.simplexgrid(builder::SimplexGridBuilder; kwargs...) facets[1, i] = builder.facets[i][1] facets[2, i] = builder.facets[i][2] end + make_tio=triangulateio + generator_type=TriangulateType else facets = builder.facets + make_tio= tetgenio + generator_type=TetGenType end options = blendoptions!(copy(builder.options); kwargs...) - - ExtendableGrids.simplexgrid(builder.Generator; - points = builder.pointlist.points, - bfaces = facets, - bfaceregions = builder.facetregions, - regionpoints = builder.regionpoints, - regionnumbers = builder.regionnumbers, - regionvolumes = builder.regionvolumes, - Generator = builder.Generator, - options...) + + tio = make_tio(builder.Generator; + points = builder.pointlist.points, + bfaces = facets, + bfaceregions = builder.facetregions, + regionpoints = builder.regionpoints, + regionnumbers = builder.regionnumbers, + regionvolumes = builder.regionvolumes) + + ExtendableGrids.simplexgrid(generator_type, builder.Generator, tio; options...) end """ diff --git a/test/runtests.jl b/test/runtests.jl index 898da79..6ae40f5 100644 --- a/test/runtests.jl +++ b/test/runtests.jl @@ -105,13 +105,14 @@ end @testset "Simplexgrid (arrays 2d)" begin function test_simplesquare(; kwargs...) - grid = simplexgrid(Triangulate; - points = [0 0; 0 1; 1 1; 1 0]', - bfaces = [1 2; 2 3; 3 4; 4 1]', - bfaceregions = [1, 2, 3, 4], - regionpoints = [0.5 0.5;]', - regionnumbers = [1], - regionvolumes = [0.01], kwargs...) + tio= SimplexGridFactory.triangulateio(Triangulate, + points = [0 0; 0 1; 1 1; 1 0]', + bfaces = [1 2; 2 3; 3 4; 4 1]', + bfaceregions = [1, 2, 3, 4], + regionpoints = [0.5 0.5;]', + regionnumbers = [1], + regionvolumes = [0.01]) + grid = simplexgrid(SimplexGridFactory.TriangulateType,Triangulate, tio; kwargs...) end @test testgrid(test_simplesquare(), (89, 144, 32)) @@ -183,27 +184,27 @@ end @testset "Simplexgrid (arrays 3d)" begin function test_simplecube(; kwargs...) - grid = simplexgrid(TetGen; - points = [0 0 0; - 1 0 0; - 1 1 0; - 0 1 0; - 0 0 1; - 1 0 1; - 1 1 1; - 0 1 1]', bfaces = [1 2 3 4; - 5 6 7 8; - 1 2 6 5; - 2 3 7 6; - 3 4 8 7; - 4 1 5 8]', - bfaceregions = [i for i = 1:6], - regionpoints = [0.5 0.5 0.5]', - regionnumbers = [1], - regionvolumes = [0.01], - kwargs...) + tio= SimplexGridFactory.tetgenio(TetGen, + points = [0 0 0; + 1 0 0; + 1 1 0; + 0 1 0; + 0 0 1; + 1 0 1; + 1 1 1; + 0 1 1]', bfaces = [1 2 3 4; + 5 6 7 8; + 1 2 6 5; + 2 3 7 6; + 3 4 8 7; + 4 1 5 8]', + bfaceregions = [i for i = 1:6], + regionpoints = [0.5 0.5 0.5]', + regionnumbers = [1], + regionvolumes = [0.01]) + grid = simplexgrid(SimplexGridFactory.TetGenType,TetGen, tio; kwargs...) end - + @test testgrid(test_simplecube(), (109, 286, 198)) @test testgrid(test_simplecube(; flags = "pAaqQD"), (109, 286, 198)) @test testgrid(test_simplecube(; maxvolume = 0.05), (50, 68, 96))