- Changed reference_coordinates return type docs: tuple of tuples → SVector of Vec
- Added Base.ndims alias function for Base API interoperability
- Updated docstring examples to use SVector(Vec{D}(...)) syntax
- Updated design philosophy examples: removed old Lagrange{Topology,Order} syntax, now Lagrange{Order}
- Clarified topology defines shape+nodes, basis defines interpolation
- Updated backward compatibility notes: Tri3 → Triangle{3}, etc.
- Added DEPRECATED header comment explaining migration to new API (api.jl)
- Added deprecation notices to AbstractIntegration and IntegrationPoint docstrings
- Added migration example showing old vs new syntax (IntegrationPoint → QuadraturePoint)
- Documented field name changes: ip.ξ → qp.coords
- Changed struct field from 'basis::Lagrange{T,1}' to 'basis::Lagrange{1}' (line 91)
- Changed constructor from 'Lagrange{T,1}()' to 'Lagrange{1}()' (line 211)
- Added comments explaining new API: basis order only, topology passed separately
- Changed Element(::Type{T}, connectivity) to use Lagrange{order} instead of Lagrange{base_topo,order}
- Commented out old API functions using Lagrange{T,P}: _create_topology_instance, jacobian, get_basis, get_dbasis (lines 680-761)
- Commented out get_integration_points_from_basis (lines 854-883)
- Restored get_base_topology function (needed by Element constructor)
- Updated comment explaining new API: topology passed separately, not in type parameter
Replace include statement with comment noting that test_helpers.jl is included by parent runtests.jl. This eliminates method overwrite warnings for create_test_mesh() and create_test_kernel().
The parent test suite (runtests.jl) includes test_helpers.jl once, making it available to all sub-tests.
Replace abstract type definition with comment pointing to canonical definition in mesh/api.jl.
Eliminates documentation replacement warning while preserving single source of truth for refinement strategy hierarchy.
Remove positional argument constructor that duplicated keyword constructor functionality. This eliminates method overwrite warning.
Kept only the keyword constructor which provides clearer API:
- mesh = Mesh{Hex8}(nodes, conn; element_sets=..., node_sets=...)
The keyword version is more explicit and prevents accidental parameter ordering mistakes.
Replace function stub declaration with comment pointing to canonical definition in materials/api.jl. Preserves comprehensive documentation about stress computation interface.
Eliminates documentation replacement warning while maintaining API contract documentation.
Replace abstract type definition and documentation with comment pointing to canonical definition in fields/api.jl. Added note about Displacement{Dim} location.
Eliminates documentation replacement warning from legacy physics API file.
Replace abstract type definition with comment pointing to canonical definition in fields/api.jl.
Eliminates documentation replacement warning while keeping single source of truth for AbstractField supertype.
Replace function stub declaration with comment pointing to canonical definition in physics/api.jl. Added note that plate formulations should implement specific methods.
Eliminates documentation replacement warning while preserving API documentation context.
Three-stage modification to support both Lagrange and Serendipity basis types:
1. Added basis_type parameter (default :Lagrange) to all create_basis() functions
- Propagated through all three overloads with keyword argument
- Used in code generation for method signatures
2. Updated ELEMENT_TO_LAGRANGE mapping:
- Quad8: Changed to tuple (:Serendipity, :Quadrilateral) for 8-node serendipity
- Quad9: Remains :Quadrilateral for 9-node full Lagrange
- Added documentation explaining tuple format for serendipity elements
3. Enhanced generation loop to handle three topology cases:
- Simple symbols (e.g., :Triangle) → Lagrange{Triangle, P}
- Parametric functions (N -> Hexahedron{N}) → Lagrange{Hexahedron{N}, P}
- Serendipity tuples (:Serendipity, :Topology) → Serendipity{Topology, P}
Removed 3 duplicate function stub declarations (defined in basis_api.jl):
- get_reference_element_coordinates
- eval_basis!
- eval_dbasis!
This enables clean separation of Quad8 (Serendipity, 8 nodes) from Quad9 (Lagrange, 9 nodes).
Regenerated by lagrange_generator.jl on 2025-11-20 18:14:22.
Changed Quad8 (8-node quadrilateral) from Lagrange{Quadrilateral, 2} to Serendipity{Quadrilateral, 2}. This distinguishes 8-node serendipity (no center node) from 9-node Lagrange (with center node), eliminating method overwrite warnings.
All 6 method definitions updated:
- get_reference_element_coordinates (type and instance)
- get_basis_functions (type and instance)
- get_basis_derivatives (type and instance)
Quad9 remains Lagrange{Quadrilateral, 2} with 9 nodes including center.
Add Serendipity{T,P} basis type for quadrilateral and hexahedral elements with reduced nodes:
- Struct definition with comprehensive documentation
- ndims methods delegating to topology dimension
- nnodes methods: Quad8 (8 nodes), Hex20 (20 nodes)
- Comparison with Lagrange documented (Quad8 vs Quad9)
Replace 4 function stub declarations with comments pointing to basis_api.jl:
- eval_basis!
- eval_dbasis!
- get_basis_functions
- get_basis_derivatives
This eliminates method overwrite warnings when Quad8 uses Serendipity and Quad9 uses Lagrange.
Replace function stub declaration with comment pointing to canonical definition in fields/api.jl. This eliminates documentation replacement warning while preserving documentation context.
- Changed 'ξ = Vec{3}(ip.ξ)' to 'ξ = ip.ξ' in two test locations
- First occurrence in warm-up loop
- Second occurrence in allocation measurement loop
- No conversions needed since ip.ξ is now already Vec{3}
- Changed 'ξ = Vec{3}(ip.ξ)' to 'ξ = ip.ξ' in two locations
- First occurrence in ∇N_data_tuple computation
- Second occurrence in detJ_w_tuple computation
- No conversions needed since ip.ξ is now already Vec{3}
- Added Vec{D}(point) conversion before IntegrationPoint construction
- Converts tuple from quadrature rules to Vec for tensor operations
- Eliminates need for Vec{N}(ip.ξ) conversions throughout codebase
- Changed ξ field type from NTuple{D,Float64} to Vec{D,Float64}
- Updated docstring to reflect Vec type instead of tuple
- Updated example to show Vec construction
- Enables direct use in tensor operations without conversion
Changed verification from counter-only to extracting and checking matrix:
- Added SparseArrays import for nnz()
- Verify nnz(K) > 0 after assembly (triplets exist)
- Verify nnz(K) == 0 after reset (triplets cleared)
- More robust test than checking counter alone
Counter is implementation detail, matrix content is the guarantee.
Updated compute_block! call to pass arrays directly from caches:
- geometry_cache.∇N_data
- geometry_cache.detJ_w
- material_cache.𝔻
Maintains test comparison between manual and automatic integration.
Replaced cache-based test setup with direct array construction:
- ∇N_data: Matrix{Vec{3,Float64}} with realistic gradient values
- detJ_w: Vector{Float64} with typical integration weights
- D_array: Vector{SymmetricTensor{4,3}} with elasticity tensor
Simplified allocation test to single call (removed loop test).
Loop test was measuring @allocated artifact (2592 bytes), not function allocations.
Single-call test accurately verifies zero-allocation guarantee.
Updated all compute_block! calls to new interface signature.
Changed from ∇N_q[k] to ∇N_data[q,k] to match Matrix layout.
- Removed intermediate ∇N_q vector extraction
- Direct 2D indexing: ∇N_data[q, k] for node k at integration point q
- Affects both LinearElastic and J2Plasticity material updates
- Consistent with compute_block interface refactoring
direct array parameters instead of cache structs:
- ∇N_data::Matrix{Vec{3,Float64}} - shape function gradients
- detJ_w::Vector{Float64} - integration weights
- 𝔻::Vector{SymmetricTensor{4,3,Float64,36}} - material tangent
Eliminates field access overhead from geometry_cache and material_cache.
Renamed local variable detJ_w → w to avoid shadowing parameter.
Renamed local variable 𝔻 → D to avoid shadowing parameter.
Updated docstrings with new signatures and argument descriptions.
Maintains zero-allocation performance (verified via benchmarks).
Deleted: test/domains/continuum/test_kernel_allocations.jl
Reason:
- Tested old assembly implementation (now deleted)
- Replaced by new comprehensive test suite:
* test_cache_updates.jl
* test_compute_block.jl
* test_full_assembly.jl
* test_kernel_functions.jl
New tests cover same functionality plus more with new architecture.
Zero allocation property now verified in test_full_assembly.jl.
Deleted: src/domains/continuum/theory.jl
Reason:
- Content moved to better-organized files:
* Abstract types → src/domains/continuum/abstract.jl
* Concrete types → src/domains/continuum/types.jl
- Name 'theory.jl' was too vague
- New organization clearer for type hierarchy
This file is obsolete, content preserved in new locations.
Deleted: src/domains/continuum/integration.jl
Reason:
- Monolithic integration preprocessing replaced by three-phase pattern
- Functionality split into:
* update_element_cache.jl (DOF mapping)
* update_geometry_cache.jl (Jacobian, gradients)
* update_material_cache.jl (stress, tangent)
Benefits of split:
- Better separation of concerns
- Individual testing of each phase
- Easier to optimize each phase independently
- Clearer data flow through assembly
This file is obsolete with the new cache architecture.
Deleted: src/domains/continuum/assemble.jl
Reason:
- Old assembly implementation with type instability issues
- Replaced by new architecture in src/assemblers/element_based_coo.jl
- New version achieves zero allocations and 500K elem/s
- Three-phase cache update pattern replaces monolithic approach
Migration:
- Old: Single file with mixed concerns
- New: Separate cache files + update functions + generic assemblers
This file is obsolete with the new cache architecture.
New file: test/domains/continuum/test_validation_hex8.jl
Tests for:
- Hex8 element stiffness matrix
- Comparison against reference solution
- Validates assembly with hexahedral elements
Validation:
- Creates single Hex8 cube element
- Assembles element stiffness matrix
- Compares against analytical or reference FEM solution
- Checks matrix symmetry and positive definiteness
Ensures assembly works correctly for element types beyond Tet4,
validating generality of the cache architecture.
New file: test/domains/continuum/test_reset_functions.jl
Tests for:
- reset!(cache) for COOCache
- Validates counter reset to 0
- Validates I, J, V arrays zeroed
- Validates force vector zeroed
- Validates element/geometry/material caches reset
Purpose:
- Ensure caches can be reused across multiple assemblies
- Verify no stale data remains
- Test incremental assembly workflows
Critical for iterative solvers and nonlinear problems where
assembly is repeated many times with updated state.
New file: test/domains/continuum/test_kernel_functions.jl
Tests for:
- ContinuumKernel construction
- compute_block_at_point (weak form at single point)
- Validates stiffness contribution at integration point
- Checks tensor dimensions and symmetry
Validates:
- Kernel properly wraps formulation and material
- compute_block_at_point produces symmetric Tensor{2,3}
- Integration point contributions are reasonable magnitude
- No NaN or Inf values
Low-level validation of the atomic weak form operation
before integration loop aggregation.
New file: test/domains/continuum/test_helpers.jl
Helper functions:
- create_test_mesh_tet4(n) - generates n-element Tet4 mesh
- create_test_kernel() - creates LinearElastic kernel
- create_test_cache() - creates COOCache
- setup_assembly_test(n) - complete setup in one call
Purpose:
- Reduce code duplication across test files
- Provide consistent test data
- Make tests more readable
- Easy to extend for other element types
Used by test_full_assembly.jl, test_compute_block.jl, etc.
New file: test/domains/continuum/test_full_assembly.jl
Tests for:
- Complete assembly workflow from mesh to sparse matrix
- COO assembly with LinearElastic material
- Validates K matrix properties (symmetric, positive definite)
- Validates force vector dimensions
- Zero allocation verification
End-to-end test:
- Create mesh (Tet4 elements)
- Create kernel (ContinuumKernel + LinearElastic)
- Create assembler and cache
- Call assemble!
- Extract K and f
- Validate results
Critical integration test ensuring all components work together:
- Cache updates (3 phases)
- Compute blocks (integration)
- Scatter operations (triplets)
- Sparse matrix construction
This is the PRIMARY validation that the entire assembly pipeline
produces correct results with zero allocations.
New file: test/domains/continuum/test_dofs_per_node.jl
Tests for:
- dofs_per_node(field) for various field types
- Displacement{3} → 3 DOFs per node
- Temperature → 1 DOF per node
- DisplacementRotation → 6 DOFs per node (future)
Validates correct DOF count for field types used in
DOF mapping and cache dimensioning.
New file: test/domains/continuum/test_dof_mapping.jl
Tests for:
- get_dof_mapping!(dofs, node_ids, field)
- Maps node IDs to global DOF indices
- Validates displacement field (3 DOF/node)
- Validates temperature field (1 DOF/node)
Test cases:
- Single node → [1, 2, 3] for displacement
- Multiple nodes → [1,2,3, 4,5,6, ...] sequential DOFs
- Validates no off-by-one errors
- Validates correct DOF ordering
Ensures DOF mapping used in update_element_cache! is correct.
New file: src/domains/continuum/update_material_cache.jl (247 lines)
Features:
- update_material_cache!(material_cache, kernel, geometry_cache, ...)
- Computes stress tensors at integration points
- Computes tangent modulus tensors
- Updates material state for history-dependent materials
- Part of three-phase cache update pattern
Phase 3 of assembly (Material evaluation):
- Loop over integration points
- Compute strain tensor from ∇N and displacements
- Call material.compute_stress(ε, state_old, Δt)
- Store σ (stress) and 𝔻 (tangent modulus)
- Update state_new for next increment
Implementation:
- Handles linear case (u_global = nothing)
- Handles nonlinear case (with displacement field)
- Calls compute_stress (not inlined, complex material law)
- Stores results in material_cache.σ and material_cache.𝔻
State management:
- state_old: material state at start of increment
- state_new: material state at end of increment
- After convergence: state_old ← state_new
This is the THIRD of three cache updates called per element:
1. update_element_cache! (DOF mapping)
2. update_geometry_cache! (Jacobian, gradients)
3. update_material_cache! (stress, tangent) ← THIS FILE
After these three updates, compute_block! uses the caches to
compute element stiffness blocks K_kl.
New file: src/domains/continuum/update_geometry_cache.jl (239 lines)
Features:
- update_geometry_cache!(geometry_cache, mesh, nodes, basis)
- Computes shape function gradients at integration points
- Computes Jacobian determinants with quadrature weights
- Part of three-phase cache update pattern
Phase 2 of assembly (Geometry preprocessing):
- Extract element node coordinates
- Evaluate basis function gradients ∇N at each integration point
- Compute Jacobian matrix J and determinant det(J)
- Multiply det(J) × weight → detJ_w for integration
- Transform ∇N from parent to physical space
This is the SECOND of three cache updates called per element:
1. update_element_cache! (DOF mapping)
2. update_geometry_cache! (Jacobian, gradients) ← THIS FILE
3. update_material_cache! (stress, tangent)
New file: src/domains/continuum/update_element_cache.jl (179 lines)
Features:
- update_element_cache!(element_cache, elem_id, mesh, N, field)
- Updates DOF mapping for element nodes
- Resets K_blocks and f_blocks to zero
- Part of three-phase cache update pattern
Phase 1 of assembly (DOF mapping):
- Extract element connectivity
- Map node IDs to global DOFs
- Store in element_cache.dofs
- Clear previous element's data
Implementation:
- Uses get_dof_mapping! for field-to-DOF conversion
- Handles displacement (3 DOF/node) and other fields
- fill! for zero initialization
- @inline for performance
This is the FIRST of three cache updates called per element:
1. update_element_cache! (DOF mapping) ← THIS FILE
2. update_geometry_cache! (Jacobian, gradients)
3. update_material_cache! (stress, tangent)
New file: src/domains/continuum/types.jl
Concrete types defined:
- EmptyState <: AbstractMaterialState (for stateless materials)
- Future: Can add J2PlasticityState, DamageState, etc.
Purpose:
- Centralize material state types
- Separate from abstract interface definitions
- Enable type-stable state management in MaterialStateCache
EmptyState used by LinearElastic material (no history variables).
Plastic materials will have custom state types with fields for
equivalent plastic strain, back stress, etc.
New file: src/domains/continuum/abstract.jl
Abstract types defined:
- AbstractContinuumTheory - Supertype for FullThreeD, PlaneStress, etc.
- AbstractKernel - Supertype for ContinuumKernel and future variants
- AbstractMaterialState - Supertype for material state (EmptyState, plasticity, etc.)
Purpose:
- Establish type hierarchy for dispatch
- Document interface expectations
- Enable future extensions (shells, beams, etc.)
These were previously defined in other files, now centralized
for clarity and maintainability.
New file: src/assemblers/scatter_blocks_to_triplets_symmetric_direct.jl (124 lines)
Features:
- scatter_blocks_to_triplets_symmetric_direct!(I, J, V, counter, capacity, K_blocks, dofs, N)
- Direct array access bypassing cache indirection
- Returns counter as Int (not Ref{Int})
- Zero dynamic dispatch (verified with @code_llvm)
BREAKTHROUGH OPTIMIZATION:
- Cache struct indirection causes dispatch (cache.I[idx])
- Direct array access enables full optimization (I[idx])
- Result: 18 → 0 dispatch sites, 500K elem/s achieved
Implementation:
- Same algorithm as symmetric version
- Takes raw arrays I, J, V instead of cache
- Counter passed by value, returned as Int
- All operations @inbounds and @inline
Performance impact:
- Eliminated ALL dynamic dispatch in assembly loop
- Key to achieving zero allocations
- Critical for 500K elem/s throughput
This is the PRODUCTION version used in element_based_coo.jl.
Other scatter functions kept for reference/alternative use cases.