refactor(topology): Rename Pyr5 to Pyramid, remove hardcoded node count

- Changed struct name from Pyr5 to Pyramid
- Removed nnodes() method (node count now determined by basis)
- Updated all function signatures to use Pyramid
- Added Pyr5 as backwards compatibility alias
- Added note explaining basis determines node count (P1=5, P2=13, P3=29)
This commit is contained in:
Jukka Aho
2025-11-09 09:28:17 +02:00
parent 835aac9962
commit ca7c8a4c75
+19 -12
View File
@@ -2,9 +2,9 @@
# License is MIT: see https://github.com/JuliaFEM/JuliaFEM.jl/blob/master/LICENSE
"""
Pyr5 <: AbstractTopology
Pyramid <: AbstractTopology
5-node linear pyramid element.
Pyramid element topology (3D mixed).
Reference element in 3D parametric space with square base at z=-1
and apex at (0,0,1).
@@ -27,23 +27,30 @@ Base nodes in [-1,1]² at z=-1, apex at (0,0,1).
**Note:** This uses Code Aster convention (from lagrange_pyramids.jl).
**Node count:** Determined by basis function degree:
- Lagrange{Pyramid, 1}: 5 nodes
- Lagrange{Pyramid, 2}: 13 nodes
- Lagrange{Pyramid, 3}: 29 nodes
**Zero allocation:** All functions return compile-time sized tuples.
"""
struct Pyr5 <: AbstractTopology end
struct Pyramid <: AbstractTopology end
nnodes(::Pyr5) = 5
dim(::Pyr5) = 3
dim(::Pyramid) = 3
# Backwards compatibility alias
const Pyr5 = Pyramid
"""
reference_coordinates(::Pyr5) -> NTuple{5, NTuple{3, Float64}}
reference_coordinates(::Pyramid) -> NTuple{5, NTuple{3, Float64}}
Reference coordinates for 5-node pyramid (Code Aster convention):
Reference coordinates for pyramid (Code Aster convention):
- Base nodes: (-1,-1,-1), (1,-1,-1), (1,1,-1), (-1,1,-1)
- Apex: (0,0,1)
**Zero allocation:** Returns tuple of tuples (stack allocated).
"""
reference_coordinates(::Pyr5) = (
reference_coordinates(::Pyramid) = (
(-1.0, -1.0, -1.0), # N1
(1.0, -1.0, -1.0), # N2
(1.0, 1.0, -1.0), # N3
@@ -52,19 +59,19 @@ reference_coordinates(::Pyr5) = (
)
"""
edges(::Pyr5) -> NTuple{8, Tuple{Int, Int}}
edges(::Pyramid) -> NTuple{8, Tuple{Int, Int}}
Edge connectivity for pyramid (4 base edges + 4 edges to apex = 8 edges).
**Zero allocation:** Returns tuple of tuples (stack allocated).
"""
edges(::Pyr5) = (
edges(::Pyramid) = (
(1, 2), (2, 3), (3, 4), (4, 1), # Base
(1, 5), (2, 5), (3, 5), (4, 5), # Edges to apex
)
"""
faces(::Pyr5) -> NTuple{5, Tuple{Vararg{Int}}}
faces(::Pyramid) -> NTuple{5, Tuple{Vararg{Int}}}
Face connectivity for pyramid:
- 1 quadrilateral base
@@ -72,7 +79,7 @@ Face connectivity for pyramid:
**Zero allocation:** Returns tuple of tuples (stack allocated).
"""
faces(::Pyr5) = (
faces(::Pyramid) = (
(1, 4, 3, 2), # Base (quad)
(1, 2, 5), # Triangle
(2, 3, 5), # Triangle