refactor(topology): Remove old per-variant topology files

Remove individual topology files replaced by parametric variants.

Deleted files (16 total):
- Hexahedra: hex8.jl, hex20.jl, hex27.jl → hexahedra.jl with Hexahedron{N}
- Segments: seg2.jl, seg3.jl → segments.jl with Segment{N}
- Quadrilaterals: quad4.jl, quad8.jl, quad9.jl → quadrilaterals.jl with Quadrilateral{N}
- Triangles: tri3.jl, tri6.jl, tri7.jl → triangles.jl with Triangle{N}
- Tetrahedra: tet4.jl, tet10.jl → tetrahedra.jl with Tetrahedron{N}
- Pyramids: pyr5.jl → pyramids.jl with Pyramid{N}
- Wedges: wedge6.jl, wedge15.jl → wedges.jl with Wedge{N}

Each topology type now handles all node count variants via type parameter {N}.
Implements ADR-002 (November 13, 2025): node count from mesh connectivity.
This commit is contained in:
Jukka Aho
2025-11-15 05:34:51 +02:00
parent f980186fb6
commit 81440d7265
16 changed files with 0 additions and 1343 deletions
-92
View File
@@ -1,92 +0,0 @@
# This file is a part of JuliaFEM.
# License is MIT: see https://github.com/JuliaFEM/JuliaFEM.jl/blob/master/LICENSE
"""
Hex20 <: AbstractTopology
20-node biquadratic hexahedral element.
Reference element in 3D parametric space [-1, 1]³ with corner and edge nodes
(Serendipity family - no face or volume interior nodes).
# Node numbering
```
N8---N20---N7
/| /|
N16| N15|
/ N12 / N11
N5---N17-N6 |
| N4-|--N19--N3
N13 / N14 /
| N9 | N10
|/ |/
N1---N18-N2
```
**Zero allocation:** All functions return compile-time sized tuples.
"""
struct Hex20 <: AbstractTopology end
nnodes(::Hex20) = 20
dim(::Hex20) = 3
"""
reference_coordinates(::Hex20) -> NTuple{20, NTuple{3, Float64}}
Reference coordinates for 20-node hexahedron (Serendipity):
- Corner nodes (8): vertices of [-1,1]³
- Edge nodes (12): midpoints of 12 edges
**Zero allocation:** Returns tuple of tuples (stack allocated).
"""
reference_coordinates(::Hex20) = (
(-1.0, -1.0, -1.0), # N1
(1.0, -1.0, -1.0), # N2
(1.0, 1.0, -1.0), # N3
(-1.0, 1.0, -1.0), # N4
(-1.0, -1.0, 1.0), # N5
(1.0, -1.0, 1.0), # N6
(1.0, 1.0, 1.0), # N7
(-1.0, 1.0, 1.0), # N8
(0.0, -1.0, -1.0), # N9 (edge 1-2)
(1.0, 0.0, -1.0), # N10 (edge 2-3)
(0.0, 1.0, -1.0), # N11 (edge 3-4)
(-1.0, 0.0, -1.0), # N12 (edge 4-1)
(-1.0, -1.0, 0.0), # N13 (edge 1-5)
(1.0, -1.0, 0.0), # N14 (edge 2-6)
(1.0, 1.0, 0.0), # N15 (edge 3-7)
(-1.0, 1.0, 0.0), # N16 (edge 4-8)
(0.0, -1.0, 1.0), # N17 (edge 5-6)
(1.0, 0.0, 1.0), # N18 (edge 6-7)
(0.0, 1.0, 1.0), # N19 (edge 7-8)
(-1.0, 0.0, 1.0), # N20 (edge 8-5)
)
"""
edges(::Hex20) -> NTuple{12, Tuple{Int, Int}}
Edge connectivity for hexahedron (corner nodes only).
**Zero allocation:** Returns tuple of tuples (stack allocated).
"""
edges(::Hex20) = (
(1, 2), (2, 3), (3, 4), (4, 1), # Bottom face
(5, 6), (6, 7), (7, 8), (8, 5), # Top face
(1, 5), (2, 6), (3, 7), (4, 8), # Vertical edges
)
"""
faces(::Hex20) -> NTuple{6, NTuple{4, Int}}
Face connectivity for hexahedron (corner nodes of 6 quadrilateral faces).
**Zero allocation:** Returns tuple of tuples (stack allocated).
"""
faces(::Hex20) = (
(1, 4, 3, 2), # Bottom (-z)
(5, 6, 7, 8), # Top (+z)
(1, 2, 6, 5), # Front (-y)
(3, 4, 8, 7), # Back (+y)
(2, 3, 7, 6), # Right (+x)
(1, 5, 8, 4), # Left (-x)
)
-101
View File
@@ -1,101 +0,0 @@
# This file is a part of JuliaFEM.
# License is MIT: see https://github.com/JuliaFEM/JuliaFEM.jl/blob/master/LICENSE
"""
Hex27 <: AbstractTopology
27-node quadratic hexahedral element.
Reference element in 3D parametric space [-1, 1]³ with corner, edge, face,
and volume center nodes.
# Node numbering
```
N8---N20---N7
/| /|
N16| N26 N15|
/ N12 / N11
N5---N17-N6 |
|N25|N27|N23 N3
N13 N4-N24-N19/
| /N21 | N10
|N9 N14/
N1---N18-N2
```
**Zero allocation:** All functions return compile-time sized tuples.
"""
struct Hex27 <: AbstractTopology end
nnodes(::Hex27) = 27
dim(::Hex27) = 3
"""
reference_coordinates(::Hex27) -> NTuple{27, NTuple{3, Float64}}
Reference coordinates for 27-node hexahedron:
- Corner nodes (8): vertices of [-1,1]³
- Edge nodes (12): midpoints of 12 edges
- Face nodes (6): centers of 6 faces
- Volume node (1): center (0,0,0)
**Zero allocation:** Returns tuple of tuples (stack allocated).
"""
reference_coordinates(::Hex27) = (
(-1.0, -1.0, -1.0), # N1
(1.0, -1.0, -1.0), # N2
(1.0, 1.0, -1.0), # N3
(-1.0, 1.0, -1.0), # N4
(-1.0, -1.0, 1.0), # N5
(1.0, -1.0, 1.0), # N6
(1.0, 1.0, 1.0), # N7
(-1.0, 1.0, 1.0), # N8
(0.0, -1.0, -1.0), # N9 (edge 1-2)
(1.0, 0.0, -1.0), # N10 (edge 2-3)
(0.0, 1.0, -1.0), # N11 (edge 3-4)
(-1.0, 0.0, -1.0), # N12 (edge 4-1)
(-1.0, -1.0, 0.0), # N13 (edge 1-5)
(1.0, -1.0, 0.0), # N14 (edge 2-6)
(1.0, 1.0, 0.0), # N15 (edge 3-7)
(-1.0, 1.0, 0.0), # N16 (edge 4-8)
(0.0, -1.0, 1.0), # N17 (edge 5-6)
(1.0, 0.0, 1.0), # N18 (edge 6-7)
(0.0, 1.0, 1.0), # N19 (edge 7-8)
(-1.0, 0.0, 1.0), # N20 (edge 8-5)
(0.0, 0.0, -1.0), # N21 (face center -z)
(0.0, -1.0, 0.0), # N22 (face center -y)
(1.0, 0.0, 0.0), # N23 (face center +x)
(0.0, 1.0, 0.0), # N24 (face center +y)
(-1.0, 0.0, 0.0), # N25 (face center -x)
(0.0, 0.0, 1.0), # N26 (face center +z)
(0.0, 0.0, 0.0), # N27 (volume center)
)
"""
edges(::Hex27) -> NTuple{12, Tuple{Int, Int}}
Edge connectivity for hexahedron (corner nodes only).
**Zero allocation:** Returns tuple of tuples (stack allocated).
"""
edges(::Hex27) = (
(1, 2), (2, 3), (3, 4), (4, 1), # Bottom face
(5, 6), (6, 7), (7, 8), (8, 5), # Top face
(1, 5), (2, 6), (3, 7), (4, 8), # Vertical edges
)
"""
faces(::Hex27) -> NTuple{6, NTuple{4, Int}}
Face connectivity for hexahedron (corner nodes of 6 quadrilateral faces).
**Zero allocation:** Returns tuple of tuples (stack allocated).
"""
faces(::Hex27) = (
(1, 4, 3, 2), # Bottom (-z)
(5, 6, 7, 8), # Top (+z)
(1, 2, 6, 5), # Front (-y)
(3, 4, 8, 7), # Back (+y)
(2, 3, 7, 6), # Right (+x)
(1, 5, 8, 4), # Left (-x)
)
-91
View File
@@ -1,91 +0,0 @@
# This file is a part of JuliaFEM.
# License is MIT: see https://github.com/JuliaFEM/JuliaFEM.jl/blob/master/LICENSE
"""
Hexahedron <: AbstractTopology
Hexahedral element topology (3D tensor product).
Reference element in 3D parametric space [-1, 1]³.
# Node numbering
```
N8-------N7
/| /|
/ | / |
N5-------N6 |
| N4----|--N3
| / | /
|/ |/
N1-------N2
```
**Note:** Node count determined by basis function degree:
- Lagrange{Hexahedron, 1}: 8 nodes (Q1)
- Lagrange{Hexahedron, 2}: 27 nodes (Q2)
**Zero allocation:** All functions return compile-time sized tuples.
"""
struct Hexahedron <: AbstractTopology end
dim(::Hexahedron) = 3
# Backwards compatibility alias
const Hex8 = Hexahedron
"""
nnodes(::Hexahedron) -> Int
Number of corner nodes for a hexahedron element (8).
**Note:** In the new architecture, actual node count depends on basis degree.
This returns the number of corner nodes for backwards compatibility.
"""
nnodes(::Hexahedron) = 8
"""
reference_coordinates(::Hexahedron) -> NTuple{8, NTuple{3, Float64}}
Reference coordinates for hexahedron vertices in [-1,1]³.
**Zero allocation:** Returns tuple of tuples (stack allocated).
"""
reference_coordinates(::Hexahedron) = (
(-1.0, -1.0, -1.0), # N1
(1.0, -1.0, -1.0), # N2
(1.0, 1.0, -1.0), # N3
(-1.0, 1.0, -1.0), # N4
(-1.0, -1.0, 1.0), # N5
(1.0, -1.0, 1.0), # N6
(1.0, 1.0, 1.0), # N7
(-1.0, 1.0, 1.0), # N8
)
"""
edges(::Hexahedron) -> NTuple{12, Tuple{Int, Int}}
Edge connectivity for hexahedron (12 edges).
**Zero allocation:** Returns tuple of tuples (stack allocated).
"""
edges(::Hexahedron) = (
(1, 2), (2, 3), (3, 4), (4, 1), # Bottom face
(5, 6), (6, 7), (7, 8), (8, 5), # Top face
(1, 5), (2, 6), (3, 7), (4, 8), # Vertical edges
)
"""
faces(::Hexahedron) -> NTuple{6, NTuple{4, Int}}
Face connectivity for hexahedron (6 quadrilateral faces).
**Zero allocation:** Returns tuple of tuples (stack allocated).
"""
faces(::Hexahedron) = (
(1, 4, 3, 2), # Bottom (-z)
(5, 6, 7, 8), # Top (+z)
(1, 2, 6, 5), # Front (-y)
(3, 4, 8, 7), # Back (+y)
(2, 3, 7, 6), # Right (+x)
(1, 5, 8, 4), # Left (-x)
)
-88
View File
@@ -1,88 +0,0 @@
# This file is a part of JuliaFEM.
# License is MIT: see https://github.com/JuliaFEM/JuliaFEM.jl/blob/master/LICENSE
"""
Pyramid <: AbstractTopology
Pyramid element topology (3D mixed).
Reference element in 3D parametric space with square base at z=-1
and apex at (0,0,1).
# Node numbering
```
N5
/\\
/ \\
/ \\
/ \\
/ \\
N4--------N3
| |
| |
N1--------N2
```
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 Pyramid <: AbstractTopology end
dim(::Pyramid) = 3
# Backwards compatibility alias
const Pyr5 = Pyramid
"""
reference_coordinates(::Pyramid) -> NTuple{5, NTuple{3, Float64}}
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(::Pyramid) = (
(-1.0, -1.0, -1.0), # N1
(1.0, -1.0, -1.0), # N2
(1.0, 1.0, -1.0), # N3
(-1.0, 1.0, -1.0), # N4
(0.0, 0.0, 1.0), # N5 (apex)
)
"""
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(::Pyramid) = (
(1, 2), (2, 3), (3, 4), (4, 1), # Base
(1, 5), (2, 5), (3, 5), (4, 5), # Edges to apex
)
"""
faces(::Pyramid) -> NTuple{5, Tuple{Vararg{Int}}}
Face connectivity for pyramid:
- 1 quadrilateral base
- 4 triangular faces
**Zero allocation:** Returns tuple of tuples (stack allocated).
"""
faces(::Pyramid) = (
(1, 4, 3, 2), # Base (quad)
(1, 2, 5), # Triangle
(2, 3, 5), # Triangle
(3, 4, 5), # Triangle
(4, 1, 5), # Triangle
)
-122
View File
@@ -1,122 +0,0 @@
# This file is a part of JuliaFEM.
# License is MIT: see https://github.com/JuliaFEM/JuliaFEM.jl/blob/master/LICENSE.md
"""
Quadrilateral <: AbstractTopology
Quadrilateral element topology in 2D (reference element geometry).
**Important:** This type defines ONLY the geometric shape. Node count is determined
by the interpolation scheme (basis functions):
- `Lagrange{Quadrilateral, 1}` → 4 nodes (Q1, bilinear)
- `Serendipity{Quadrilateral, 2}` → 8 nodes (Q2, no center node)
- `Lagrange{Quadrilateral, 2}` → 9 nodes (Q2, full tensor product)
- `Lagrange{Quadrilateral, 3}` → 16 nodes (Q3, cubic)
# Reference Element
```
η
^
|
4 | 3
+-----+
| |
| + | --> ξ
| |
+-----+
1 2
```
# Standard Node Positions
For `Lagrange{Quadrilateral, 1}` (Q1, 4 nodes):
1. (-1, -1) - Bottom-left
2. ( 1, -1) - Bottom-right
3. ( 1, 1) - Top-right
4. (-1, 1) - Top-left
For higher-order bases, additional nodes are added on edges, faces, and interior.
# Topology Properties
- Dimension: 2
- Edges: 4
- Faces: 1 (the element itself in 2D)
# Typical Usage
```julia
julia> topology = Quadrilateral()
julia> dim(topology)
2
julia> basis = Lagrange{Quadrilateral, 1}()
julia> nnodes(basis) # Node count comes from BASIS, not topology
4
```
See also: [`AbstractTopology`](@ref), [`Triangle`](@ref), [`Lagrange`](@ref), [`Serendipity`](@ref)
"""
struct Quadrilateral <: AbstractTopology end
dim(::Quadrilateral) = 2
"""
reference_coordinates(::Quadrilateral)
Get standard reference node positions for Quadrilateral (4 corners in parametric space).
These are the Q1 (bilinear) node positions by default.
"""
function reference_coordinates(::Quadrilateral)
return (
(-1.0, -1.0), # Node 1: Bottom-left
(1.0, -1.0), # Node 2: Bottom-right
(1.0, 1.0), # Node 3: Top-right
(-1.0, 1.0), # Node 4: Top-left
)
end
function edges(::Quadrilateral)
return (
(1, 2), # Edge 1: Bottom
(2, 3), # Edge 2: Right
(3, 4), # Edge 3: Top
(4, 1), # Edge 4: Left
)
end
# For 2D elements, faces are the element itself
faces(::Quadrilateral) = ((1, 2, 3, 4),)
# ============================================================================
# Deprecated aliases (for backwards compatibility)
# ============================================================================
"""
Quad4
**DEPRECATED:** Use `Quadrilateral` + `Lagrange{Quadrilateral, 1}` instead.
The old `Quad4` type conflated topology (quadrilateral) with node count (4).
In the new architecture:
- Topology defines geometric shape only
- Basis functions determine node count
Migration:
```julia
# Old (deprecated)
element = Element(Quad4, (1,2,3,4))
# New (correct)
element = Element(Quadrilateral(), Lagrange{Quadrilateral, 1}(), Gauss{2}(), (1,2,3,4))
```
"""
const Quad4 = Quadrilateral
"""
nnodes(::Quadrilateral) -> Int
Number of corner nodes for a quadrilateral element (4).
**Note:** In the new architecture, actual node count depends on basis degree.
This returns the number of corner nodes for backwards compatibility.
"""
nnodes(::Quadrilateral) = 4
# Note: Quad4 is deprecated. Use Quadrilateral with parametric Lagrange basis instead.
-64
View File
@@ -1,64 +0,0 @@
# This file is a part of JuliaFEM.
# License is MIT: see https://github.com/JuliaFEM/JuliaFEM.jl/blob/master/LICENSE
"""
Quad8 <: AbstractTopology
8-node quadratic quadrilateral element (Serendipity).
Reference element in 2D parametric space [-1, 1]² with corner and edge nodes
but no center node (Serendipity family).
# Node numbering
```
N4----N7----N3
| |
N8 N6
| |
N1----N5----N2
```
**Zero allocation:** All functions return compile-time sized tuples.
"""
struct Quad8 <: AbstractTopology end
nnodes(::Quad8) = 8
dim(::Quad8) = 2
"""
reference_coordinates(::Quad8) -> NTuple{8, NTuple{2, Float64}}
Reference coordinates for 8-node quadrilateral (Serendipity):
- Corner nodes: (-1,-1), (1,-1), (1,1), (-1,1)
- Edge nodes: (0,-1), (1,0), (0,1), (-1,0)
**Zero allocation:** Returns tuple of tuples (stack allocated).
"""
reference_coordinates(::Quad8) = (
(-1.0, -1.0), # N1
(1.0, -1.0), # N2
(1.0, 1.0), # N3
(-1.0, 1.0), # N4
(0.0, -1.0), # N5
(1.0, 0.0), # N6
(0.0, 1.0), # N7
(-1.0, 0.0), # N8
)
"""
edges(::Quad8) -> NTuple{4, Tuple{Int, Int}}
Edge connectivity for quadrilateral (corner nodes only).
**Zero allocation:** Returns tuple of tuples (stack allocated).
"""
edges(::Quad8) = ((1, 2), (2, 3), (3, 4), (4, 1))
"""
faces(::Quad8) -> NTuple{1, NTuple{8, Int}}
Face connectivity (all nodes) for 2D element.
**Zero allocation:** Returns tuple of tuples (stack allocated).
"""
faces(::Quad8) = ((1, 2, 3, 4, 5, 6, 7, 8),)
-65
View File
@@ -1,65 +0,0 @@
# This file is a part of JuliaFEM.
# License is MIT: see https://github.com/JuliaFEM/JuliaFEM.jl/blob/master/LICENSE
"""
Quad9 <: AbstractTopology
9-node quadratic quadrilateral element.
Reference element in 2D parametric space [-1, 1]² with corner, edge, and center nodes.
# Node numbering
```
N4----N7----N3
| |
N8 N9 N6
| |
N1----N5----N2
```
**Zero allocation:** All functions return compile-time sized tuples.
"""
struct Quad9 <: AbstractTopology end
nnodes(::Quad9) = 9
dim(::Quad9) = 2
"""
reference_coordinates(::Quad9) -> NTuple{9, NTuple{2, Float64}}
Reference coordinates for 9-node quadrilateral:
- Corner nodes: (-1,-1), (1,-1), (1,1), (-1,1)
- Edge nodes: (0,-1), (1,0), (0,1), (-1,0)
- Center node: (0,0)
**Zero allocation:** Returns tuple of tuples (stack allocated).
"""
reference_coordinates(::Quad9) = (
(-1.0, -1.0), # N1
(1.0, -1.0), # N2
(1.0, 1.0), # N3
(-1.0, 1.0), # N4
(0.0, -1.0), # N5
(1.0, 0.0), # N6
(0.0, 1.0), # N7
(-1.0, 0.0), # N8
(0.0, 0.0), # N9 (center)
)
"""
edges(::Quad9) -> NTuple{4, Tuple{Int, Int}}
Edge connectivity for quadrilateral (corner nodes only).
**Zero allocation:** Returns tuple of tuples (stack allocated).
"""
edges(::Quad9) = ((1, 2), (2, 3), (3, 4), (4, 1))
"""
faces(::Quad9) -> NTuple{1, NTuple{9, Int}}
Face connectivity (all nodes) for 2D element.
**Zero allocation:** Returns tuple of tuples (stack allocated).
"""
faces(::Quad9) = ((1, 2, 3, 4, 5, 6, 7, 8, 9),)
-65
View File
@@ -1,65 +0,0 @@
# This file is a part of JuliaFEM.
# License is MIT: see https://github.com/JuliaFEM/JuliaFEM.jl/blob/master/LICENSE
"""
Segment <: AbstractTopology
Linear segment/line element topology (1D).
Reference element in 1D parametric space [-1, 1].
# Node numbering
```
N1 -------- N2
-1 +1
```
**Note:** Node count determined by basis function degree:
- Lagrange{Segment, 1}: 2 nodes (linear)
- Lagrange{Segment, 2}: 3 nodes (quadratic)
**Zero allocation:** All functions return compile-time sized tuples.
"""
struct Segment <: AbstractTopology end
dim(::Segment) = 1
# Backwards compatibility alias
const Seg2 = Segment
"""
nnodes(::Segment) -> Int
Number of corner nodes for a segment element (2).
**Note:** In the new architecture, actual node count depends on basis degree.
This returns the number of corner nodes for backwards compatibility.
"""
nnodes(::Segment) = 2
"""
reference_coordinates(::Segment) -> NTuple{2, NTuple{1, Float64}}
Reference coordinates for segment endpoints: (-1.0,) and (1.0,).
**Zero allocation:** Returns tuple of tuples (stack allocated).
"""
reference_coordinates(::Segment) = ((-1.0,), (1.0,))
"""
edges(::Segment) -> NTuple{1, Tuple{Int, Int}}
Edge connectivity for segment (the segment itself).
**Zero allocation:** Returns tuple of tuples (stack allocated).
"""
edges(::Segment) = ((1, 2),)
"""
faces(::Segment) -> NTuple{0, Tuple{}}
Faces for 1D element (none in 1D).
**Zero allocation:** Returns empty tuple (stack allocated).
"""
faces(::Segment) = ()
-49
View File
@@ -1,49 +0,0 @@
# This file is a part of JuliaFEM.
# License is MIT: see https://github.com/JuliaFEM/JuliaFEM.jl/blob/master/LICENSE
"""
Seg3 <: AbstractTopology
3-node quadratic segment/line element.
Reference element in 1D parametric space [-1, 1] with midpoint node.
# Node numbering
```
N1 ---- N3 ---- N2
-1 0 +1
```
**Zero allocation:** All functions return compile-time sized tuples.
"""
struct Seg3 <: AbstractTopology end
nnodes(::Seg3) = 3
dim(::Seg3) = 1
"""
reference_coordinates(::Seg3) -> NTuple{3, NTuple{1, Float64}}
Reference coordinates for 3-node segment: (-1.0,), (1.0,), (0.0,).
**Zero allocation:** Returns tuple of tuples (stack allocated).
"""
reference_coordinates(::Seg3) = ((-1.0,), (1.0,), (0.0,))
"""
edges(::Seg3) -> NTuple{1, Tuple{Int, Int}}
Edge connectivity for segment (the segment itself, corner nodes only).
**Zero allocation:** Returns tuple of tuples (stack allocated).
"""
edges(::Seg3) = ((1, 2),)
"""
faces(::Seg3) -> NTuple{0, Tuple{}}
Faces for 1D element (none in 1D).
**Zero allocation:** Returns empty tuple (stack allocated).
"""
faces(::Seg3) = ()
-82
View File
@@ -1,82 +0,0 @@
# This file is a part of JuliaFEM.
# License is MIT: see https://github.com/JuliaFEM/JuliaFEM.jl/blob/master/LICENSE
"""
Tet10 <: AbstractTopology
10-node quadratic tetrahedral element.
Reference element in 3D parametric space with corner nodes at vertices
and midpoint nodes on each edge.
# Node numbering
```
N4
/|\\
N8 | N10
/ N9 \\
/ | \\
/ | \\
N1-N5--N7----N3
\\ | /
\\ | /
\\ N6 /
\\ | /
\\|/
N2
```
**Zero allocation:** All functions return compile-time sized tuples.
"""
struct Tet10 <: AbstractTopology end
nnodes(::Tet10) = 10
dim(::Tet10) = 3
"""
reference_coordinates(::Tet10) -> NTuple{10, NTuple{3, Float64}}
Reference coordinates for 10-node tetrahedron:
- Corner nodes: (0,0,0), (1,0,0), (0,1,0), (0,0,1)
- Edge nodes: midpoints of all 6 edges
**Zero allocation:** Returns tuple of tuples (stack allocated).
"""
reference_coordinates(::Tet10) = (
(0.0, 0.0, 0.0), # N1
(1.0, 0.0, 0.0), # N2
(0.0, 1.0, 0.0), # N3
(0.0, 0.0, 1.0), # N4
(0.5, 0.0, 0.0), # N5 (edge 1-2)
(0.5, 0.5, 0.0), # N6 (edge 2-3)
(0.0, 0.5, 0.0), # N7 (edge 3-1)
(0.0, 0.0, 0.5), # N8 (edge 1-4)
(0.5, 0.0, 0.5), # N9 (edge 2-4)
(0.0, 0.5, 0.5), # N10 (edge 3-4)
)
"""
edges(::Tet10) -> NTuple{6, Tuple{Int, Int}}
Edge connectivity for tetrahedron (corner nodes only).
**Zero allocation:** Returns tuple of tuples (stack allocated).
"""
edges(::Tet10) = (
(1, 2), (2, 3), (3, 1), # Base triangle
(1, 4), (2, 4), (3, 4), # Edges to apex
)
"""
faces(::Tet10) -> NTuple{4, NTuple{3, Int}}
Face connectivity for tetrahedron (corner nodes of 4 triangular faces).
**Zero allocation:** Returns tuple of tuples (stack allocated).
"""
faces(::Tet10) = (
(1, 3, 2), # Base
(1, 2, 4), # Front
(2, 3, 4), # Right
(3, 1, 4), # Left
)
-90
View File
@@ -1,90 +0,0 @@
# This file is a part of JuliaFEM.
# License is MIT: see https://github.com/JuliaFEM/JuliaFEM.jl/blob/master/LICENSE
"""
Tetrahedron <: AbstractTopology
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).
# Node numbering
```
N4
/|\\
/ | \\
/ | \\
/ | \\
/ | \\
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 Tetrahedron <: AbstractTopology end
dim(::Tetrahedron) = 3
# Backwards compatibility alias
const Tet4 = Tetrahedron
"""
nnodes(::Tetrahedron) -> Int
Number of corner nodes for a tetrahedron element (4).
**Note:** In the new architecture, actual node count depends on basis degree.
This returns the number of corner nodes for backwards compatibility.
"""
nnodes(::Tetrahedron) = 4
"""
reference_coordinates(::Tetrahedron) -> NTuple{4, NTuple{3, Float64}}
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(::Tetrahedron) = (
(0.0, 0.0, 0.0), # N1
(1.0, 0.0, 0.0), # N2
(0.0, 1.0, 0.0), # N3
(0.0, 0.0, 1.0), # N4
)
"""
edges(::Tetrahedron) -> NTuple{6, Tuple{Int, Int}}
Edge connectivity for tetrahedron (6 edges).
**Zero allocation:** Returns tuple of tuples (stack allocated).
"""
edges(::Tetrahedron) = (
(1, 2), (2, 3), (3, 1), # Base triangle
(1, 4), (2, 4), (3, 4), # Edges to apex
)
"""
faces(::Tetrahedron) -> NTuple{4, NTuple{3, Int}}
Face connectivity for tetrahedron (4 triangular faces).
**Zero allocation:** Returns tuple of tuples (stack allocated).
"""
faces(::Tetrahedron) = (
(1, 3, 2), # Base
(1, 2, 4), # Front
(2, 3, 4), # Right
(3, 1, 4), # Left
)
-118
View File
@@ -1,118 +0,0 @@
# This file is a part of JuliaFEM.
# License is MIT: see https://github.com/JuliaFEM/JuliaFEM.jl/blob/master/LICENSE.md
"""
Triangle <: AbstractTopology
Triangular element topology in 2D (reference element geometry).
**Important:** This type defines ONLY the geometric shape. Node count is determined
by the interpolation scheme (basis functions):
- `Lagrange{Triangle, 1}` → 3 nodes (P1, linear)
- `Lagrange{Triangle, 2}` → 6 nodes (P2, quadratic)
- `Lagrange{Triangle, 3}` → 10 nodes (P3, cubic)
- `Nedelec{Triangle, 1}` → 3 nodes, but DOFs on edges
# Reference Element
```
η
^
|
(0,1)
| \\
| \\
| \\
+---------> ξ
(0,0) (1,0)
```
# Standard Node Positions
For `Lagrange{Triangle, 1}` (P1, 3 nodes):
1. (0, 0) - Origin
2. (1, 0) - Along ξ-axis
3. (0, 1) - Along η-axis
For higher-order bases, additional nodes are added on edges and interior.
# Topology Properties
- Dimension: 2
- Edges: 3
- Faces: 1 (the element itself in 2D)
# Typical Usage
```julia
julia> topology = Triangle()
julia> dim(topology)
2
julia> basis = Lagrange{Triangle, 1}()
julia> nnodes(basis) # Node count comes from BASIS, not topology
3
```
See also: [`AbstractTopology`](@ref), [`Quadrilateral`](@ref), [`Lagrange`](@ref)
"""
struct Triangle <: AbstractTopology end
dim(::Triangle) = 2
"""
reference_coordinates(::Triangle)
Get standard reference node positions for Triangle (3 vertices in parametric space).
These are the P1 (linear) node positions by default.
"""
function reference_coordinates(::Triangle)
return (
(0.0, 0.0), # Node 1: Origin
(1.0, 0.0), # Node 2: Along ξ-axis
(0.0, 1.0), # Node 3: Along η-axis
)
end
function edges(::Triangle)
return (
(1, 2), # Edge 1: Bottom
(2, 3), # Edge 2: Right (hypotenuse)
(3, 1), # Edge 3: Left
)
end
# For 2D elements, faces are the element itself
faces(::Triangle) = ((1, 2, 3),)
# ============================================================================
# Deprecated aliases (for backwards compatibility)
# ============================================================================
"""
Tri3
**DEPRECATED:** Use `Triangle` + `Lagrange{Triangle, 1}` instead.
The old `Tri3` type conflated topology (triangle) with node count (3).
In the new architecture:
- Topology defines geometric shape only
- Basis functions determine node count
Migration:
```julia
# Old (deprecated)
element = Element(Tri3, (1,2,3))
# New (correct)
element = Element(Triangle(), Lagrange{Triangle, 1}(), Gauss{2}(), (1,2,3))
```
"""
const Tri3 = Triangle
# Note: Tri3 is deprecated. Use Triangle with parametric Lagrange basis instead.
"""
nnodes(::Triangle) -> Int
Number of corner nodes for a triangle element (3).
**Note:** In the new architecture, actual node count depends on basis degree.
This returns the number of corner nodes for backwards compatibility.
"""
nnodes(::Triangle) = 3
-64
View File
@@ -1,64 +0,0 @@
# This file is a part of JuliaFEM.
# License is MIT: see https://github.com/JuliaFEM/JuliaFEM.jl/blob/master/LICENSE
"""
Tri6 <: AbstractTopology
6-node quadratic triangle element.
Reference element in 2D parametric space with vertices at (0,0), (1,0), (0,1)
and midpoint nodes on each edge.
# Node numbering
```
N3
|\\
| \\
N6 N5
| \\
| \\
N1--N4--N2
```
**Zero allocation:** All functions return compile-time sized tuples.
"""
struct Tri6 <: AbstractTopology end
nnodes(::Tri6) = 6
dim(::Tri6) = 2
"""
reference_coordinates(::Tri6) -> NTuple{6, NTuple{2, Float64}}
Reference coordinates for 6-node triangle:
- Corner nodes: (0,0), (1,0), (0,1)
- Edge nodes: (0.5,0), (0.5,0.5), (0,0.5)
**Zero allocation:** Returns tuple of tuples (stack allocated).
"""
reference_coordinates(::Tri6) = (
(0.0, 0.0), # N1
(1.0, 0.0), # N2
(0.0, 1.0), # N3
(0.5, 0.0), # N4
(0.5, 0.5), # N5
(0.0, 0.5), # N6
)
"""
edges(::Tri6) -> NTuple{3, Tuple{Int, Int}}
Edge connectivity for triangle (corner nodes only).
**Zero allocation:** Returns tuple of tuples (stack allocated).
"""
edges(::Tri6) = ((1, 2), (2, 3), (3, 1))
"""
faces(::Tri6) -> NTuple{1, NTuple{6, Int}}
Face connectivity (all nodes) for 2D element.
**Zero allocation:** Returns tuple of tuples (stack allocated).
"""
faces(::Tri6) = ((1, 2, 3, 4, 5, 6),)
-66
View File
@@ -1,66 +0,0 @@
# This file is a part of JuliaFEM.
# License is MIT: see https://github.com/JuliaFEM/JuliaFEM.jl/blob/master/LICENSE
"""
Tri7 <: AbstractTopology
7-node quadratic triangle element with center node.
Reference element in 2D parametric space with vertices at (0,0), (1,0), (0,1),
midpoint nodes on each edge, and center node.
# Node numbering
```
N3
|\\
| \\
N6 N7 N5
| \\
| \\
N1--N4--N2
```
**Zero allocation:** All functions return compile-time sized tuples.
"""
struct Tri7 <: AbstractTopology end
nnodes(::Tri7) = 7
dim(::Tri7) = 2
"""
reference_coordinates(::Tri7) -> NTuple{7, NTuple{2, Float64}}
Reference coordinates for 7-node triangle:
- Corner nodes: (0,0), (1,0), (0,1)
- Edge nodes: (0.5,0), (0.5,0.5), (0,0.5)
- Center node: (1/3, 1/3)
**Zero allocation:** Returns tuple of tuples (stack allocated).
"""
reference_coordinates(::Tri7) = (
(0.0, 0.0), # N1
(1.0, 0.0), # N2
(0.0, 1.0), # N3
(0.5, 0.0), # N4
(0.5, 0.5), # N5
(0.0, 0.5), # N6
(1 / 3, 1 / 3), # N7 (center)
)
"""
edges(::Tri7) -> NTuple{3, Tuple{Int, Int}}
Edge connectivity for triangle (corner nodes only).
**Zero allocation:** Returns tuple of tuples (stack allocated).
"""
edges(::Tri7) = ((1, 2), (2, 3), (3, 1))
"""
faces(::Tri7) -> NTuple{1, NTuple{7, Int}}
Face connectivity (all nodes) for 2D element.
**Zero allocation:** Returns tuple of tuples (stack allocated).
"""
faces(::Tri7) = ((1, 2, 3, 4, 5, 6, 7),)
-94
View File
@@ -1,94 +0,0 @@
# This file is a part of JuliaFEM.
# License is MIT: see https://github.com/JuliaFEM/JuliaFEM.jl/blob/master/LICENSE
"""
Wedge15 <: AbstractTopology
15-node quadratic prismatic/wedge element.
Reference element in 3D with triangular cross-section in (u,v) plane
extruded along w direction, with edge and mid-plane nodes.
# Node numbering
```
N6
/\\
N12 N11
/ \\
N4-N10-N5
| |
N15 N14
| |
N3 |
|\\ |
N9 N8 |
| \\ N13
| \\ |
| \\ |
| \\|
N1--N7--N2
```
**Zero allocation:** All functions return compile-time sized tuples.
"""
struct Wedge15 <: AbstractTopology end
nnodes(::Wedge15) = 15
dim(::Wedge15) = 3
"""
reference_coordinates(::Wedge15) -> NTuple{15, NTuple{3, Float64}}
Reference coordinates for 15-node wedge:
- Corner nodes (6): bottom and top triangles
- Edge nodes (9): 3 on bottom, 3 on top, 3 on vertical edges
**Zero allocation:** Returns tuple of tuples (stack allocated).
"""
reference_coordinates(::Wedge15) = (
(0.0, 0.0, -1.0), # N1
(1.0, 0.0, -1.0), # N2
(0.0, 1.0, -1.0), # N3
(0.0, 0.0, 1.0), # N4
(1.0, 0.0, 1.0), # N5
(0.0, 1.0, 1.0), # N6
(0.5, 0.0, -1.0), # N7 (edge 1-2, bottom)
(0.5, 0.5, -1.0), # N8 (edge 2-3, bottom)
(0.0, 0.5, -1.0), # N9 (edge 3-1, bottom)
(0.5, 0.0, 1.0), # N10 (edge 4-5, top)
(0.5, 0.5, 1.0), # N11 (edge 5-6, top)
(0.0, 0.5, 1.0), # N12 (edge 6-4, top)
(0.0, 0.0, 0.0), # N13 (edge 1-4, vertical)
(1.0, 0.0, 0.0), # N14 (edge 2-5, vertical)
(0.0, 1.0, 0.0), # N15 (edge 3-6, vertical)
)
"""
edges(::Wedge15) -> NTuple{9, Tuple{Int, Int}}
Edge connectivity for wedge (corner nodes only).
**Zero allocation:** Returns tuple of tuples (stack allocated).
"""
edges(::Wedge15) = (
(1, 2), (2, 3), (3, 1), # Bottom triangle
(4, 5), (5, 6), (6, 4), # Top triangle
(1, 4), (2, 5), (3, 6), # Vertical edges
)
"""
faces(::Wedge15) -> NTuple{5, Tuple{Vararg{Int}}}
Face connectivity for wedge (corner nodes only):
- 2 triangular faces
- 3 quadrilateral faces
**Zero allocation:** Returns tuple of tuples (stack allocated).
"""
faces(::Wedge15) = (
(1, 3, 2), # Bottom triangle
(4, 5, 6), # Top triangle
(1, 2, 5, 4), # Side quad
(2, 3, 6, 5), # Side quad
(3, 1, 4, 6), # Side quad
)
-92
View File
@@ -1,92 +0,0 @@
# This file is a part of JuliaFEM.
# License is MIT: see https://github.com/JuliaFEM/JuliaFEM.jl/blob/master/LICENSE
"""
Wedge <: AbstractTopology
Wedge/prism element topology (3D triangular extrusion).
Reference element in 3D with triangular cross-section in (u,v) plane
extruded along w direction from -1 to +1.
# Node numbering
```
N6
/\\
/ \\
/ \\
N4----N5
| |
| |
N3 |
|\\ |
| \\ |
| \\ |
| \\ |
| \\ |
| \\|
N1-----N2
```
Triangle base at w=-1, triangle top at w=+1.
**Note:** Node count determined by basis function degree:
- Lagrange{Wedge, 1}: 6 nodes (P1)
- Lagrange{Wedge, 2}: 15 nodes (P2)
**Zero allocation:** All functions return compile-time sized tuples.
"""
struct Wedge <: AbstractTopology end
dim(::Wedge) = 3
# Backwards compatibility alias
const Wedge6 = Wedge
"""
reference_coordinates(::Wedge) -> NTuple{6, NTuple{3, Float64}}
Reference coordinates for wedge vertices:
- Bottom triangle (w=-1): (0,0,-1), (1,0,-1), (0,1,-1)
- Top triangle (w=+1): (0,0,+1), (1,0,+1), (0,1,+1)
**Zero allocation:** Returns tuple of tuples (stack allocated).
"""
reference_coordinates(::Wedge) = (
(0.0, 0.0, -1.0), # N1
(1.0, 0.0, -1.0), # N2
(0.0, 1.0, -1.0), # N3
(0.0, 0.0, 1.0), # N4
(1.0, 0.0, 1.0), # N5
(0.0, 1.0, 1.0), # N6
)
"""
edges(::Wedge) -> NTuple{9, Tuple{Int, Int}}
Edge connectivity for wedge (3 bottom + 3 top + 3 vertical = 9 edges).
**Zero allocation:** Returns tuple of tuples (stack allocated).
"""
edges(::Wedge) = (
(1, 2), (2, 3), (3, 1), # Bottom triangle
(4, 5), (5, 6), (6, 4), # Top triangle
(1, 4), (2, 5), (3, 6), # Vertical edges
)
"""
faces(::Wedge) -> NTuple{5, Tuple{Vararg{Int}}}
Face connectivity for wedge:
- 2 triangular faces (top and bottom)
- 3 quadrilateral faces (sides)
**Zero allocation:** Returns tuple of tuples (stack allocated).
"""
faces(::Wedge) = (
(1, 3, 2), # Bottom triangle
(4, 5, 6), # Top triangle
(1, 2, 5, 4), # Side quad
(2, 3, 6, 5), # Side quad
(3, 1, 4, 6), # Side quad
)