mirror of
https://github.com/JuliaFEM/JuliaFEM.jl.git
synced 2026-09-20 01:59:59 +00:00
refactor(topology): Rename Tet4 to Tetrahedron, remove hardcoded node count
- Changed struct name from Tet4 to Tetrahedron - Removed nnodes() method (node count now determined by basis) - Updated all function signatures to use Tetrahedron - Added Tet4 as backwards compatibility alias - Added note explaining basis determines node count (P1=4, P2=10 nodes)
This commit is contained in:
+18
-12
@@ -2,9 +2,9 @@
|
||||
# License is MIT: see https://github.com/JuliaFEM/JuliaFEM.jl/blob/master/LICENSE
|
||||
|
||||
"""
|
||||
Tet4 <: AbstractTopology
|
||||
Tetrahedron <: AbstractTopology
|
||||
|
||||
4-node linear tetrahedral element.
|
||||
Tetrahedral element topology (3D simplex).
|
||||
|
||||
Reference element in 3D parametric space with vertices at (0,0,0), (1,0,0), (0,1,0), (0,0,1).
|
||||
|
||||
@@ -25,22 +25,28 @@ N1-----|-----N3
|
||||
N2
|
||||
```
|
||||
|
||||
**Note:** Node count determined by basis function degree:
|
||||
- Lagrange{Tetrahedron, 1}: 4 nodes (P1)
|
||||
- Lagrange{Tetrahedron, 2}: 10 nodes (P2)
|
||||
|
||||
**Zero allocation:** All functions return compile-time sized tuples.
|
||||
"""
|
||||
struct Tet4 <: AbstractTopology end
|
||||
struct Tetrahedron <: AbstractTopology end
|
||||
|
||||
nnodes(::Tet4) = 4
|
||||
dim(::Tet4) = 3
|
||||
dim(::Tetrahedron) = 3
|
||||
|
||||
# Backwards compatibility alias
|
||||
const Tet4 = Tetrahedron
|
||||
|
||||
"""
|
||||
reference_coordinates(::Tet4) -> NTuple{4, NTuple{3, Float64}}
|
||||
reference_coordinates(::Tetrahedron) -> NTuple{4, NTuple{3, Float64}}
|
||||
|
||||
Reference coordinates for 4-node tetrahedron:
|
||||
Reference coordinates for tetrahedron vertices:
|
||||
(0,0,0), (1,0,0), (0,1,0), (0,0,1).
|
||||
|
||||
**Zero allocation:** Returns tuple of tuples (stack allocated).
|
||||
"""
|
||||
reference_coordinates(::Tet4) = (
|
||||
reference_coordinates(::Tetrahedron) = (
|
||||
(0.0, 0.0, 0.0), # N1
|
||||
(1.0, 0.0, 0.0), # N2
|
||||
(0.0, 1.0, 0.0), # N3
|
||||
@@ -48,25 +54,25 @@ reference_coordinates(::Tet4) = (
|
||||
)
|
||||
|
||||
"""
|
||||
edges(::Tet4) -> NTuple{6, Tuple{Int, Int}}
|
||||
edges(::Tetrahedron) -> NTuple{6, Tuple{Int, Int}}
|
||||
|
||||
Edge connectivity for tetrahedron (6 edges).
|
||||
|
||||
**Zero allocation:** Returns tuple of tuples (stack allocated).
|
||||
"""
|
||||
edges(::Tet4) = (
|
||||
edges(::Tetrahedron) = (
|
||||
(1, 2), (2, 3), (3, 1), # Base triangle
|
||||
(1, 4), (2, 4), (3, 4), # Edges to apex
|
||||
)
|
||||
|
||||
"""
|
||||
faces(::Tet4) -> NTuple{4, NTuple{3, Int}}
|
||||
faces(::Tetrahedron) -> NTuple{4, NTuple{3, Int}}
|
||||
|
||||
Face connectivity for tetrahedron (4 triangular faces).
|
||||
|
||||
**Zero allocation:** Returns tuple of tuples (stack allocated).
|
||||
"""
|
||||
faces(::Tet4) = (
|
||||
faces(::Tetrahedron) = (
|
||||
(1, 3, 2), # Base
|
||||
(1, 2, 4), # Front
|
||||
(2, 3, 4), # Right
|
||||
|
||||
Reference in New Issue
Block a user