From d551cc793be9b2eba8a269ea6b9f8b687531975a Mon Sep 17 00:00:00 2001 From: Petr Krysl Date: Mon, 17 Jun 2024 17:31:47 -0700 Subject: [PATCH] propagate labels of surface elements --- Project.toml | 2 +- README.md | 1 + src/MeshTetrahedronModule.jl | 6 ++++++ test/test_meshing.jl | 1 + 4 files changed, 9 insertions(+), 1 deletion(-) diff --git a/Project.toml b/Project.toml index 01b1b2df..5130aa4b 100644 --- a/Project.toml +++ b/Project.toml @@ -1,7 +1,7 @@ name = "FinEtools" uuid = "91bb5406-6c9a-523d-811d-0644c4229550" authors = ["Petr Krysl "] -version = "8.0.23" +version = "8.0.24" [deps] DataDrop = "aa547a04-dd37-49ab-8e73-656744f8a8fc" diff --git a/README.md b/README.md index 79a79541..bcfc5f96 100644 --- a/README.md +++ b/README.md @@ -25,6 +25,7 @@ The package supports application packages, for instance: ## News +- 06/17/2024: Propagate labels of extruded triangles. - 05/19/2024: Make it possible to have different kinds of degrees of freedom. - 04/19/2024: Replace asserts with errors. - 04/11/2024: Speed up box selection of elements. diff --git a/src/MeshTetrahedronModule.jl b/src/MeshTetrahedronModule.jl index 775963d1..c6f5b528 100644 --- a/src/MeshTetrahedronModule.jl +++ b/src/MeshTetrahedronModule.jl @@ -992,6 +992,7 @@ function _doextrude(fens, fes::FESetT3, nLayers, extrusionh) nn1 = count(fens) # number of nodes in the surface to be extruded nt1 = count(fes) ntets = 3 * nt1 * nLayers # number of tetrahedra to be generated + labels = zeros(Int, ntets) tconn = zeros(Int, ntets, 4) xyz = zeros(eltype(fens.xyz), nn1 * (nLayers + 1), 3) # array of coordinates for each of the nodes in the resulting mesh for j = 1:nn1 @@ -1011,16 +1012,21 @@ function _doextrude(fens, fes::FESetT3, nLayers, extrusionh) # The algorithm traverses triangles one by one and generates three tetrahedra # per triangle. The connectivities of those tetrahedra are: i, j, k = (fes.conn[triangle] .+ (layer - 1) * nn1) + label = fes.label[triangle] N = nn1 tconn[cel, :] = [i, i < j ? j : j + N, i < k ? k : k + N, i + N] + labels[cel] = label cel = cel + 1 tconn[cel, :] = [j, j < k ? k : k + N, j < i ? i : i + N, j + N] + labels[cel] = label cel = cel + 1 tconn[cel, :] = [k, k < i ? i : i + N, k < j ? j : j + N, k + N] + labels[cel] = label cel = cel + 1 end end efes = FESetT4(tconn) + setlabel!(efes, labels) efens = FENodeSet(xyz) return efens, efes end diff --git a/test/test_meshing.jl b/test/test_meshing.jl index 31315209..16316af4 100644 --- a/test/test_meshing.jl +++ b/test/test_meshing.jl @@ -6449,6 +6449,7 @@ function test() @test count(fens) == (nlayers + 1) * count(surfens) # @show fens, fes @test count(fes) == 3 * nlayers * count(surfes) + @test length(findall(x -> x == 3, fes.label)) == count(fes) # @show count(fens) goodnodes = true for i in eachindex(fes)