refactor(topology): Update 3D element reference_coordinates to SVector of Vec

Hexahedron changes:
- Hex8: tuple of tuples → SVector of Vec{3,Float64} (8 corners)
- Added Hex20: SVector with 8 corners + 12 edge midpoints
- Added Hex27: SVector with 8 corners + 12 edge midpoints + 6 face centers + 1 volume center

Pyramid changes:
- Pyr5: tuple of tuples → SVector of Vec{3,Float64} (4 base corners + 1 apex)

Wedge changes:
- Wedge6: tuple of tuples → SVector of Vec{3,Float64} (2 triangular faces)
- Added Wedge15: SVector with 6 corners + 9 edge midpoints
This commit is contained in:
Jukka Aho
2025-11-21 00:32:06 +02:00
parent 342990ce55
commit 7e3f9bddc1
3 changed files with 80 additions and 11 deletions
+45 -5
View File
@@ -21,11 +21,51 @@ nnodes(::Hexahedron{N}) where {N} = N
dim(::Hexahedron{N}) where {N} = 3
function reference_coordinates(::Hexahedron{8})
return (
(-1.0, -1.0, -1.0), (1.0, -1.0, -1.0),
(1.0, 1.0, -1.0), (-1.0, 1.0, -1.0),
(-1.0, -1.0, 1.0), (1.0, -1.0, 1.0),
(1.0, 1.0, 1.0), (-1.0, 1.0, 1.0)
return SVector(
Vec{3,Float64}((-1.0, -1.0, -1.0)), Vec{3,Float64}((1.0, -1.0, -1.0)),
Vec{3,Float64}((1.0, 1.0, -1.0)), Vec{3,Float64}((-1.0, 1.0, -1.0)),
Vec{3,Float64}((-1.0, -1.0, 1.0)), Vec{3,Float64}((1.0, -1.0, 1.0)),
Vec{3,Float64}((1.0, 1.0, 1.0)), Vec{3,Float64}((-1.0, 1.0, 1.0))
)
end
function reference_coordinates(::Hexahedron{20})
return SVector(
# 8 corner nodes
Vec{3,Float64}((-1.0, -1.0, -1.0)), Vec{3,Float64}((1.0, -1.0, -1.0)),
Vec{3,Float64}((1.0, 1.0, -1.0)), Vec{3,Float64}((-1.0, 1.0, -1.0)),
Vec{3,Float64}((-1.0, -1.0, 1.0)), Vec{3,Float64}((1.0, -1.0, 1.0)),
Vec{3,Float64}((1.0, 1.0, 1.0)), Vec{3,Float64}((-1.0, 1.0, 1.0)),
# 12 edge midpoint nodes
Vec{3,Float64}((0.0, -1.0, -1.0)), Vec{3,Float64}((1.0, 0.0, -1.0)),
Vec{3,Float64}((0.0, 1.0, -1.0)), Vec{3,Float64}((-1.0, 0.0, -1.0)),
Vec{3,Float64}((0.0, -1.0, 1.0)), Vec{3,Float64}((1.0, 0.0, 1.0)),
Vec{3,Float64}((0.0, 1.0, 1.0)), Vec{3,Float64}((-1.0, 0.0, 1.0)),
Vec{3,Float64}((-1.0, -1.0, 0.0)), Vec{3,Float64}((1.0, -1.0, 0.0)),
Vec{3,Float64}((1.0, 1.0, 0.0)), Vec{3,Float64}((-1.0, 1.0, 0.0))
)
end
function reference_coordinates(::Hexahedron{27})
return SVector(
# 8 corner nodes
Vec{3,Float64}((-1.0, -1.0, -1.0)), Vec{3,Float64}((1.0, -1.0, -1.0)),
Vec{3,Float64}((1.0, 1.0, -1.0)), Vec{3,Float64}((-1.0, 1.0, -1.0)),
Vec{3,Float64}((-1.0, -1.0, 1.0)), Vec{3,Float64}((1.0, -1.0, 1.0)),
Vec{3,Float64}((1.0, 1.0, 1.0)), Vec{3,Float64}((-1.0, 1.0, 1.0)),
# 12 edge midpoint nodes
Vec{3,Float64}((0.0, -1.0, -1.0)), Vec{3,Float64}((1.0, 0.0, -1.0)),
Vec{3,Float64}((0.0, 1.0, -1.0)), Vec{3,Float64}((-1.0, 0.0, -1.0)),
Vec{3,Float64}((0.0, -1.0, 1.0)), Vec{3,Float64}((1.0, 0.0, 1.0)),
Vec{3,Float64}((0.0, 1.0, 1.0)), Vec{3,Float64}((-1.0, 0.0, 1.0)),
Vec{3,Float64}((-1.0, -1.0, 0.0)), Vec{3,Float64}((1.0, -1.0, 0.0)),
Vec{3,Float64}((1.0, 1.0, 0.0)), Vec{3,Float64}((-1.0, 1.0, 0.0)),
# 6 face center nodes
Vec{3,Float64}((0.0, 0.0, -1.0)), Vec{3,Float64}((0.0, 0.0, 1.0)),
Vec{3,Float64}((0.0, -1.0, 0.0)), Vec{3,Float64}((0.0, 1.0, 0.0)),
Vec{3,Float64}((-1.0, 0.0, 0.0)), Vec{3,Float64}((1.0, 0.0, 0.0)),
# 1 volume center node
Vec{3,Float64}((0.0, 0.0, 0.0))
)
end
+6 -3
View File
@@ -18,9 +18,12 @@ nnodes(::Pyramid{N}) where {N} = N
dim(::Pyramid{N}) where {N} = 3
function reference_coordinates(::Pyramid{5})
return (
(-1.0, -1.0, 0.0), (1.0, -1.0, 0.0), (1.0, 1.0, 0.0), (-1.0, 1.0, 0.0),
(0.0, 0.0, 1.0)
return SVector(
Vec{3,Float64}((-1.0, -1.0, 0.0)),
Vec{3,Float64}((1.0, -1.0, 0.0)),
Vec{3,Float64}((1.0, 1.0, 0.0)),
Vec{3,Float64}((-1.0, 1.0, 0.0)),
Vec{3,Float64}((0.0, 0.0, 1.0))
)
end
+29 -3
View File
@@ -19,9 +19,35 @@ nnodes(::Wedge{N}) where {N} = N
dim(::Wedge{N}) where {N} = 3
function reference_coordinates(::Wedge{6})
return (
(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)
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))
)
end
function reference_coordinates(::Wedge{15})
return SVector(
# 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)),
# 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))
)
end