mirror of
https://github.com/JuliaFEM/JuliaFEM.jl.git
synced 2026-09-17 09:12:09 +00:00
refactor(topology): Modernize wedge topology implementation
- Apply Vec constructor broadcasting to both Wedge6 and Wedge15
- Convert edges() to return SVector of typed Edge{T} entities (9 edges)
- Convert faces() to return SVector of typed Face{T} entities (5 faces: 2 triangles + 3 quads)
- Add vertices() returning six Vertex{T} instances
- Add cells() returning single Cell{T} instance
- Add entity count methods: nvertices(), nedges(), nfaces()
- Clean syntax with consistent formatting
This commit is contained in:
+45
-30
@@ -19,54 +19,69 @@ nnodes(::Wedge{N}) where {N} = N
|
||||
dim(::Wedge{N}) where {N} = 3
|
||||
|
||||
function reference_coordinates(::Wedge{6})
|
||||
return SVector(
|
||||
Vec{3,Float64}((0.0, 0.0, -1.0)),
|
||||
Vec{3,Float64}((1.0, 0.0, -1.0)),
|
||||
Vec{3,Float64}((0.0, 1.0, -1.0)),
|
||||
Vec{3,Float64}((0.0, 0.0, 1.0)),
|
||||
Vec{3,Float64}((1.0, 0.0, 1.0)),
|
||||
Vec{3,Float64}((0.0, 1.0, 1.0))
|
||||
)
|
||||
return SVector(Vec{3,Float64}.((
|
||||
(0.0, 0.0, -1.0),
|
||||
(1.0, 0.0, -1.0),
|
||||
(0.0, 1.0, -1.0),
|
||||
(0.0, 0.0, 1.0),
|
||||
(1.0, 0.0, 1.0),
|
||||
(0.0, 1.0, 1.0)
|
||||
)))
|
||||
end
|
||||
|
||||
function reference_coordinates(::Wedge{15})
|
||||
return SVector(
|
||||
return SVector(Vec{3,Float64}.((
|
||||
# 6 corner nodes
|
||||
Vec{3,Float64}((0.0, 0.0, -1.0)),
|
||||
Vec{3,Float64}((1.0, 0.0, -1.0)),
|
||||
Vec{3,Float64}((0.0, 1.0, -1.0)),
|
||||
Vec{3,Float64}((0.0, 0.0, 1.0)),
|
||||
Vec{3,Float64}((1.0, 0.0, 1.0)),
|
||||
Vec{3,Float64}((0.0, 1.0, 1.0)),
|
||||
(0.0, 0.0, -1.0),
|
||||
(1.0, 0.0, -1.0),
|
||||
(0.0, 1.0, -1.0),
|
||||
(0.0, 0.0, 1.0),
|
||||
(1.0, 0.0, 1.0),
|
||||
(0.0, 1.0, 1.0),
|
||||
# 9 edge midpoint nodes
|
||||
Vec{3,Float64}((0.5, 0.0, -1.0)), # Bottom triangle edges
|
||||
Vec{3,Float64}((0.5, 0.5, -1.0)),
|
||||
Vec{3,Float64}((0.0, 0.5, -1.0)),
|
||||
Vec{3,Float64}((0.5, 0.0, 1.0)), # Top triangle edges
|
||||
Vec{3,Float64}((0.5, 0.5, 1.0)),
|
||||
Vec{3,Float64}((0.0, 0.5, 1.0)),
|
||||
Vec{3,Float64}((0.0, 0.0, 0.0)), # Vertical edges
|
||||
Vec{3,Float64}((1.0, 0.0, 0.0)),
|
||||
Vec{3,Float64}((0.0, 1.0, 0.0))
|
||||
)
|
||||
(0.5, 0.0, -1.0), # Bottom triangle edges
|
||||
(0.5, 0.5, -1.0),
|
||||
(0.0, 0.5, -1.0),
|
||||
(0.5, 0.0, 1.0), # Top triangle edges
|
||||
(0.5, 0.5, 1.0),
|
||||
(0.0, 0.5, 1.0),
|
||||
(0.0, 0.0, 0.0), # Vertical edges
|
||||
(1.0, 0.0, 0.0),
|
||||
(0.0, 1.0, 0.0)
|
||||
)))
|
||||
end
|
||||
|
||||
function edges(::Wedge{N}) where {N}
|
||||
return (
|
||||
function edges(::T) where {T<:Wedge}
|
||||
return SVector(Edge{T}.((
|
||||
(1, 2), (2, 3), (3, 1), # Bottom triangle
|
||||
(4, 5), (5, 6), (6, 4), # Top triangle
|
||||
(1, 4), (2, 5), (3, 6) # Vertical edges
|
||||
)
|
||||
)))
|
||||
end
|
||||
|
||||
function faces(::Wedge{N}) where {N}
|
||||
return (
|
||||
function faces(::T) where {T<:Wedge}
|
||||
return SVector(Face{T}.((
|
||||
(1, 3, 2), # Bottom triangle
|
||||
(4, 5, 6), # Top triangle
|
||||
(1, 2, 5, 4), # Quad face 1
|
||||
(2, 3, 6, 5), # Quad face 2
|
||||
(3, 1, 4, 6) # Quad face 3
|
||||
)))
|
||||
end
|
||||
|
||||
function vertices(::T) where {T<:Wedge}
|
||||
return SVector(
|
||||
Vertex{T}(), Vertex{T}(), Vertex{T}(),
|
||||
Vertex{T}(), Vertex{T}(), Vertex{T}()
|
||||
)
|
||||
end
|
||||
|
||||
function cells(::T) where {T<:Wedge}
|
||||
return SVector(Cell{T}())
|
||||
end
|
||||
|
||||
nvertices(::Wedge) = 6
|
||||
nedges(::Wedge) = 9
|
||||
nfaces(::Wedge) = 5
|
||||
|
||||
export Wedge6, Wedge15
|
||||
|
||||
Reference in New Issue
Block a user