Skip to content

Commit eb94b2e

Browse files
committed
Deprecate type piracy for simplexgrid(::Module; ..)
Avoid codepath through this call.
1 parent 5b7bfc5 commit eb94b2e

File tree

5 files changed

+48
-38
lines changed

5 files changed

+48
-38
lines changed

CHANGELOG.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,8 @@
11
# Changes
2+
## v2.3.0 Nov 28, 2024
3+
- Allow for TetGen v1, v2
4+
- Deprecate simplexgrid(Module...)
5+
26
## v2.2.1 Nov 2, 2024
37
- Move repo to WIAS-PDELib org
48

examples/examples2d.jl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -124,7 +124,7 @@ end
124124
#
125125

126126
# ## Direct specification of input arrays
127-
# Of course we can specify the input for Triangle
127+
# We can specify the input for Triangle
128128
# directly. The aim of SimplexBuilder is to avoid
129129
# the tedious and error prone counting connected
130130
# with this approach.

src/simplexgrid.jl

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,7 @@ function ExtendableGrids.simplexgrid(Generator::Module;
2929
regionnumbers = Array{Cint, 1}(undef, 0),
3030
regionvolumes = Array{Cdouble, 1}(undef, 0),
3131
kwargs...)
32+
@warn "ExtendableGrids.simplexgrid(::Module; kwargs...) is deprecated"
3233
if size(points, 1) == 2
3334
tio = triangulateio(Generator; points = points,
3435
bfaces = bfaces,

src/simplexgridbuilder.jl

Lines changed: 14 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -327,21 +327,25 @@ function ExtendableGrids.simplexgrid(builder::SimplexGridBuilder; kwargs...)
327327
facets[1, i] = builder.facets[i][1]
328328
facets[2, i] = builder.facets[i][2]
329329
end
330+
make_tio=triangulateio
331+
generator_type=TriangulateType
330332
else
331333
facets = builder.facets
334+
make_tio= tetgenio
335+
generator_type=TetGenType
332336
end
333337

334338
options = blendoptions!(copy(builder.options); kwargs...)
335-
336-
ExtendableGrids.simplexgrid(builder.Generator;
337-
points = builder.pointlist.points,
338-
bfaces = facets,
339-
bfaceregions = builder.facetregions,
340-
regionpoints = builder.regionpoints,
341-
regionnumbers = builder.regionnumbers,
342-
regionvolumes = builder.regionvolumes,
343-
Generator = builder.Generator,
344-
options...)
339+
340+
tio = make_tio(builder.Generator;
341+
points = builder.pointlist.points,
342+
bfaces = facets,
343+
bfaceregions = builder.facetregions,
344+
regionpoints = builder.regionpoints,
345+
regionnumbers = builder.regionnumbers,
346+
regionvolumes = builder.regionvolumes)
347+
348+
ExtendableGrids.simplexgrid(generator_type, builder.Generator, tio; options...)
345349
end
346350

347351
"""

test/runtests.jl

Lines changed: 28 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -105,13 +105,14 @@ end
105105

106106
@testset "Simplexgrid (arrays 2d)" begin
107107
function test_simplesquare(; kwargs...)
108-
grid = simplexgrid(Triangulate;
109-
points = [0 0; 0 1; 1 1; 1 0]',
110-
bfaces = [1 2; 2 3; 3 4; 4 1]',
111-
bfaceregions = [1, 2, 3, 4],
112-
regionpoints = [0.5 0.5;]',
113-
regionnumbers = [1],
114-
regionvolumes = [0.01], kwargs...)
108+
tio= SimplexGridFactory.triangulateio(Triangulate,
109+
points = [0 0; 0 1; 1 1; 1 0]',
110+
bfaces = [1 2; 2 3; 3 4; 4 1]',
111+
bfaceregions = [1, 2, 3, 4],
112+
regionpoints = [0.5 0.5;]',
113+
regionnumbers = [1],
114+
regionvolumes = [0.01])
115+
grid = simplexgrid(SimplexGridFactory.TriangulateType,Triangulate, tio; kwargs...)
115116
end
116117

117118
@test testgrid(test_simplesquare(), (89, 144, 32))
@@ -183,27 +184,27 @@ end
183184

184185
@testset "Simplexgrid (arrays 3d)" begin
185186
function test_simplecube(; kwargs...)
186-
grid = simplexgrid(TetGen;
187-
points = [0 0 0;
188-
1 0 0;
189-
1 1 0;
190-
0 1 0;
191-
0 0 1;
192-
1 0 1;
193-
1 1 1;
194-
0 1 1]', bfaces = [1 2 3 4;
195-
5 6 7 8;
196-
1 2 6 5;
197-
2 3 7 6;
198-
3 4 8 7;
199-
4 1 5 8]',
200-
bfaceregions = [i for i = 1:6],
201-
regionpoints = [0.5 0.5 0.5]',
202-
regionnumbers = [1],
203-
regionvolumes = [0.01],
204-
kwargs...)
187+
tio= SimplexGridFactory.tetgenio(TetGen,
188+
points = [0 0 0;
189+
1 0 0;
190+
1 1 0;
191+
0 1 0;
192+
0 0 1;
193+
1 0 1;
194+
1 1 1;
195+
0 1 1]', bfaces = [1 2 3 4;
196+
5 6 7 8;
197+
1 2 6 5;
198+
2 3 7 6;
199+
3 4 8 7;
200+
4 1 5 8]',
201+
bfaceregions = [i for i = 1:6],
202+
regionpoints = [0.5 0.5 0.5]',
203+
regionnumbers = [1],
204+
regionvolumes = [0.01])
205+
grid = simplexgrid(SimplexGridFactory.TetGenType,TetGen, tio; kwargs...)
205206
end
206-
207+
207208
@test testgrid(test_simplecube(), (109, 286, 198))
208209
@test testgrid(test_simplecube(; flags = "pAaqQD"), (109, 286, 198))
209210
@test testgrid(test_simplecube(; maxvolume = 0.05), (50, 68, 96))

0 commit comments

Comments
 (0)