Add quantity type extraction trait for field types and optimize DOF
mapping function for zero-allocation performance.
- Add quantity_type trait function for field types
- Implement quantity_type for Displacement, Temperature, DisplacementRotation
- Add @inline to get_dof_mapping! for better inlining
- Optimize get_dof_mapping! loop to use indexed access instead of iterator
- Avoid iterator allocation in DOF mapping computation
Update JuliaFEM.jl to reflect major architectural changes: DOF system,
material workspace API, and microkernel architecture.
- Add DOF system includes (dofs.jl, dof_manager.jl, dof_connectivity.jl)
- Add material state variables and traits includes
- Add GlobalMaterialCache API exports
- Add DOF-based assembler includes and exports
- Add microkernel and formulation exports (evaluate, field_type_for_dispatch)
- Update MaterialStateCache → AssemblyMaterialWorkspace exports
- Add LocalField and strain extraction exports
- Add element interpolation and DOF extraction includes
- Update readers → io directory includes
- Remove/comment legacy includes (boundary_conditions.jl, assemble_v2.jl, etc.)
- Add DOF system exports (DOFSet, @DOFSet, DOFManager, etc.)
- Add element accessor exports (element_id, element_dofs, field_dof_range)
- Update physics exports (Elasticity, Thermal, required_field_type)
- Add material state variable exports (PlasticStrain, Backstress, etc.)
- Comment out contact problems (uses old Element API)
- Update documentation comments for new architecture
Major architectural refactoring: replace old field-based element system
with modern DOF-based design following Ciarlet's finite element triple.
- Redesign Element from Element{N,NIP,F,B} to Element{K,P,S,N}
- Replace connectivity with dof_indices (flat tuple of global DOF indices)
- Remove all old field system (sfields, dfields, fields, update_field!, etc.)
- Remove old constructors and compatibility shims
- Add compile-time DOF computation via @generated ndofs(K, S)
- Add field_dof_range for compile-time local DOF range computation
- Add local_to_global_map for type-stable DOF mapping
- Add topology_type, basis_type, dof_type query functions
- Add element_id, element_dofs, n_element_dofs, nnodes accessors
- Remove 593 lines of legacy code (963 → 370 lines)
- Simplify API: elements now store DOF indices, not node connectivity
- Support multi-field elements via DOFSet specifications
- Zero-allocation design with compile-time type information
Major refactoring: migrate material cache updates to new workspace API
and add support for GlobalMaterialCache alongside legacy API.
- Change all material_cache to material_workspace parameter names
- Remove M<:AbstractMaterialState type constraints from functions
- Change state handling from EmptyState() to NamedTuple()
- Change material_cache.σ/𝔻/states to material_workspace.fields/states
- Add new overloads for GlobalMaterialCache API (NEW API)
- Add zero-allocation optimizations using getfield and pre-allocated NamedTuples
- Add backward compatibility handling for legacy state types
- Update all function signatures and docstrings
- Add imports for GlobalMaterialCache and helper functions
- Add StatelessConstantTangent overload with pre-allocated NamedTuples
- Add StatelessStrainDependent and StatefulStrainDependent overloads for GlobalMaterialCache
- Keep legacy API overloads for Matrix{<:AbstractMaterialState}
Optimize update_geometry_cache! to eliminate iterator allocations and
update to use coords field.
- Add @inline to update_geometry_cache! for better inlining
- Change enumerate loop to indexed loop to avoid iterator allocation
- Add @inbounds annotation for bounds-check elimination
- Change ip.ξ to ip.coords to use new QuadraturePoint API
Optimize update_element_cache! to eliminate iterator and view allocations.
- Add @inline to update_element_cache! for better inlining
- Change enumerate loop to indexed loop to avoid iterator allocation
- Add @inbounds annotations for bounds-check elimination
- Remove @view allocation by passing array directly to get_dof_mapping!
Refactor continuum kernel to add atomic scalar computation and microkernel
interface while maintaining backward compatibility.
- Add compute_stiffness_value for atomic scalar K[k,l][α,β] computation
- Add compute_stiffness_block for D×D block building using atomic kernel
- Refactor compute_block_at_point to use compute_stiffness_block internally
- Add evaluate function for microkernel interface with field coupling dispatch
- Add basevec import for unit vector construction
- Add conditional imports for evaluate and get_tangent
- Update documentation to reflect new atomic operation structure
Major refactoring: replace material state cache with compositional
workspace using NamedTuple fields for better flexibility and zero-allocation.
- Rename MaterialStateCache to AssemblyMaterialWorkspace
- Change from M<:AbstractMaterialState to FieldType, StateType parameters
- Use AoS pattern: fields::Vector{FieldType} instead of separate σ, 𝔻 vectors
- Add zero-allocation field access via @generated functions
- Add extract_tangent! for type-stable zero-allocation tangent extraction
- Add get_tangent_vector, get_stress_vector helper functions
- Add @field_vector macro for compile-time field access
- Add get_stress, get_tangent, get_field accessor functions
- Update reset! to use create_zero_field and create_zero_state
- Update create_material_cache to use trait system for type inference
- Add backward compatibility alias create_assembly_workspace
- Add extensive documentation for zero-allocation usage patterns
Update kernel interface to use new material workspace API and improve
zero-allocation performance.
- Change ip.ξ to ip.coords in compute_element_stiffness!
- Add @inline to get_dof_mapping! for better inlining
- Optimize get_dof_mapping! to use indexed access instead of iteration
- Remove compute_node_contribution! function (unused)
- Update docstrings to use material_workspace instead of material_cache
- Update compute_all_blocks! example to use get_tangent_vector
- Add FIXME comment about removing B matrix computation functions
Update geometry cache to use coords field from QuadraturePoint
instead of deprecated ξ field.
- Change ip.ξ to ip.coords in create_geometry_cache function
- Update both gradient computation and detJ*w computation
Remove unused NodeCache code and simplify integration points call in
element cache creation.
- Remove NodeCache struct and create_node_cache function
- Simplify integration_points call to use auto-selected quadrature
- Remove integration_scheme parameter from create_element_cache
Refactor element-based COO assembler to use new material workspace API
and add support for GlobalMaterialCache alongside legacy API.
- Add new assemble_element! overload using GlobalMaterialCache (NEW API)
- Add new assemble! overload using GlobalMaterialCache (NEW API)
- Update legacy assemble_element! to use material_workspace and
𝔻_vec_buffer parameter
- Update legacy assemble! to use material_workspace and 𝔻_vec_buffer
- Change counter from Ref{Int} to Int for zero-allocation access
- Use extract_tangent! with pre-allocated buffer for zero-allocation
tangent extraction
- Add imports for GlobalMaterialCache and tangent extraction functions
- Update all function signatures and docstrings to reflect new API
Refactor COOCache to use AssemblyMaterialWorkspace and improve
zero-allocation performance.
- Add FieldType and StateType type parameters to COOCache struct
- Change material_cache to material_workspace field name
- Change counter from Ref{Int} to Int for zero-allocation access
- Add 𝔻_vec_buffer for pre-allocated tangent vector extraction
- Update constructor to infer FieldType and StateType from workspace
- Update reset! and extract_system to use direct counter access
- Add Tensors import and AssemblyMaterialWorkspace import
Add new DOF-by-DOF assembler and refactor material state cache type
parameters for better flexibility.
- Add DOFBasedCOOAssembler struct with comprehensive documentation
- Change AbstractMaterialStateCache from M<:AbstractMaterialState to
FieldType, StateType parameters
- Update material cache docstring to reflect new type structure
- Clarify purpose as per-element workspace vs persistent storage
Remove include statement for topology.jl which was deleted after
its content was moved to topology/api.jl.
- Remove include("topology/topology.jl") line
Major cleanup of quadrature module: simplify docstrings to minimal
code-focused style, remove all legacy symbol-based API, and fix Vec
constructor syntax throughout.
Documentation simplification:
- Remove all examples from docstrings
- Simplify file-level docstrings to one-line descriptions
- Remove verbose explanations, accuracy details, references, and
"See also" sections
- Keep only essential information about types and functions
Legacy code removal:
- Remove all legacy symbol-based API (Val{:GLTRI*}, Val{:GLTET*},
Val{:GLPYR*}, Val{:GLWED*}, Val{:GLSEG*}, Val{:GLQUAD*},
Val{:GLHEX*})
- Remove get_order() functions for legacy symbols
- Remove _legacy_tensor_product helper function
- Remove legacy symbol generation code from gl_tensor_product.jl
gauss.jl refactoring:
- Remove old Gauss{N} type and AbstractIntegration hierarchy
- Remove get_rule_name() function and all rule name mappings
(hundreds of lines for segments, triangles, quads, tets, hexes,
wedges, pyramids)
- Remove IntegrationPointNEW alias
- Replace with simple integration_points() function using new API
- Change npoints() signature to take only topology parameter
api.jl improvements:
- Uncomment and fix _infer_basis_order implementations
- Add proper type constraints (<:) for all topology types
- Add Triangle{10} case for cubic triangles
- Add _quadrature_topology_type mapping functions for all topologies
- Enable topology-only dispatch for default_quadrature
Vec constructor fixes:
- Fix all Vec{D} constructor calls to use tuple syntax
- Change Vec{2}(x, y) to Vec{2}((x, y))
- Change Vec{3}(x, y, z) to Vec{3}((x, y, z))
- Applied consistently across all quadrature rule files
Consolidate topology module by merging topology.jl into api.jl and
significantly simplify documentation across all topology files. Remove
verbose docstrings, examples, and design notes in favor of minimal,
code-focused documentation.
Major changes:
- Merge topology.jl into api.jl (delete topology.jl)
- Simplify docstrings in api.jl, triangles.jl, and tetrahedra.jl
- Remove verbose documentation from type aliases and functions
- Remove topology type parameter from entity types (Vertex, Edge, Face, Cell)
- Update all entity constructors to remove topology parameter
- Add entities dispatcher and helper functions to api.jl
File changes:
- api.jl: Simplified AbstractTopology docstring, added topological entities
and helpers from topology.jl, added entities dispatcher
- triangles.jl: Removed verbose documentation
- tetrahedra.jl: Removed verbose documentation
- hexahedra.jl, pyramids.jl, quadrilaterals.jl, segments.jl, wedges.jl:
Updated entity constructors to remove topology type parameter
- topology.jl: Deleted (content moved to api.jl)
Documentation philosophy:
- Keep docstrings minimal and code-focused
- Remove examples unless function use is unclear
- Move comprehensive documentation to website/docs, not in code
- Maintain essential type information and interface requirements
Add extensive documentation for the basis module covering:
1. Architecture and design philosophy
- Separation of topology and basis
- Zero-cost abstraction principles
- SVector return types and dual-vector design
2. API overview and usage examples
- get_basis_functions() and get_basis_derivatives()
- nbasis() for compile-time basis function count
- Integration with topology and quadrature modules
3. Code generation system
- Vandermonde approach explained
- Symbolic differentiation and simplification
- Why offline generation vs runtime symbolic math
4. Extension guide
- Adding higher-order elements (step-by-step)
- Hierarchical and specialized bases
- When to use generator vs direct implementation
5. Performance characteristics
- Benchmarks: 100-1000× speedup over v0.5.1
- Zero allocations, subnanosecond evaluations
- Scaling with element order
6. Advanced topics
- Numerical precision and ill-conditioned Vandermonde
- Jacobian and physical derivatives
- Partition of unity and reproduction
- Integration accuracy requirements
Total: ~1800 lines of documentation with complete examples,
mathematical foundations, and practical guidance.
Extend basis_generator.jl to automatically emit nbasis() functions alongside
get_basis_functions() and get_basis_derivatives():
1. Add canonical_type_name() helper to convert type aliases to full forms
(Quad9 → Quadrilateral{9}, Tri3 → Triangle{3})
2. Generate @inline nbasis(::Topology, ::Basis) = N for each basis family
This provides zero-cost compile-time basis function count
3. Use instance-based dispatch (::Triangle{3}, not ::Type{Triangle{3}})
for consistency with get_basis_* functions
4. Enhanced pretty-printer to handle both function definitions and simple
assignments, properly unwrapping begin...end blocks
Generated code now uses canonical topology names throughout, avoiding
historical type aliases for better clarity and API consistency.
Add zero-cost nbasis(topology, basis) -> Int function that returns the number
of basis functions at compile time. This is essential for validating Ciarlet
triplet (K, P, Σ) consistency and enables type-stable pre-allocations.
Key features:
- Zero-cost: compiles to single constant return (ret i64 N)
- Instance-based dispatch: nbasis(Triangle{3}(), Lagrange{1}())
- Comprehensive documentation with compile-time verification examples
- Replaces removed ndofs() function with clearer semantics
The function is generated automatically by basis_generator.jl alongside
basis function implementations, ensuring consistency.
- Deleted: src/quadrature/FEMQuad.jl (48 lines, old module wrapper)
- Created: src/quadrature/api.jl (365 lines, comprehensive quadrature API)
Key improvements:
- AbstractQuadratureRule type hierarchy (GaussLegendre, GaussLobatto)
- QuadraturePoint{D,T} struct with Vec{D} coordinates and Float64 weight
- Zero-allocation get_quadrature_points() returning SVector
- Multi-level default_quadrature() dispatch (4 levels: order → topology+order → topology+basis → topology only)
- Comprehensive documentation with examples and performance notes
- Integration with Tensors.jl (Vec) and StaticArrays (SVector)
Replaced:
- Old Val{:symbol} dispatch → Modern type parameters
- Old integrate_1d/2d/3d functions → Removed (not used in codebase)
- Module wrapper → Direct include (quadrature rules now in separate files)
Net: +317 lines (FEMQuad was minimal wrapper, api.jl is complete interface)
Deleted files:
- src/basis/abstract.jl (374 lines) - Old abstract type definitions
- src/basis/basis_api.jl (210 lines) - Old API documentation
New file:
- src/basis/api.jl (164 lines) - Consolidated basis API
Changes:
- Merged AbstractBasis type definition from abstract.jl
- Merged basis evaluation API (get_basis_functions, get_basis_derivatives) from basis_api.jl
- Added AbstractBasisDescription and VandermondeBasisDescription types
- Removed old Lagrange{T,P} (topology in type parameter) - now Lagrange{P} only
- Removed old nnodes formulas (now live in topology module)
- Simplified to clean separation: topology passed separately, not in basis type
- Kept deprecation stubs for eval_basis! and eval_dbasis! for backward compatibility
Net result: 584 lines removed, 164 lines added (420 line reduction)
- Changed Segment{2}: tuple of tuples → SVector of Vec{1,Float64}
- Changed Segment{3}: tuple of tuples → SVector of Vec{1,Float64}
- Both now return SVector(Vec{1}(...), Vec{1}(...), ...) format
- 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.