Jukka Aho
|
757e288bf2
|
feat(assemblers): Add GeometryCache with zero-allocation updates
New file: src/assemblers/geometry_cache.jl (239 lines)
Features:
- GeometryCache for mutable geometry data
- ImmutableGeometryCache for read-only views
- Stores shape function gradients (∇N_data)
- Stores Jacobian determinants with quadrature weights (detJ_w)
- update_geometry_cache! with manual tuple unrolling
Critical optimization:
- Manual tuple construction instead of ntuple with closure
- Eliminates 112 bytes allocation per element
- Key to achieving zero allocations (1300 → 0 allocs)
Code pattern (line ~193):
X_tuple = (mesh.nodes[nodes[1]], mesh.nodes[nodes[2]], ...)
# NOT: X_tuple = ntuple(i -> mesh.nodes[nodes[i]], N)
# Closure captures variables → heap allocation!
Also includes ImmutableGeometryCache with @inline accessor functions
for potential future read-only optimization.
|
2025-11-20 16:56:38 +02:00 |
|