Commit Graph

1479 Commits

Author SHA1 Message Date
Jukka Aho 0b2195c7c2 refactor(quadrature): Rename glpyr.jl → gl_pyramids.jl with modern API
- Deleted: src/quadrature/glpyr.jl (45 lines, old zip-based API)
- Created: src/quadrature/gl_pyramids.jl (86 lines, modern type-based API)

Key improvements:
- Two pyramid rule variants: GaussLegendre{2}() (default) and GaussLegendre{2,:B}()
- QuadraturePoint{3} with Vec{3} coordinates (not tuples)
- SVector return type (zero allocation)
- Comprehensive documentation explaining pyramid singularity at apex
- Inline functions for performance
- Legacy Val{:GLPYR5} compatibility maintained

Technical details:
- Default variant: 4 base points + 1 elevated, non-uniform weights
- Variant B: 5 points with uniform weights (a = 2/15)
- Both exact for degree 1 polynomials
- Pyramid: quad base at z=0, apex at (0,0,1)

Net: +41 lines (added extensive documentation and modern types)
2025-11-21 00:37:54 +02:00
Jukka Aho 9f242df9db refactor(quadrature): Replace FEMQuad module with streamlined api.jl
- 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)
2025-11-21 00:37:27 +02:00
Jukka Aho e0d81543f6 refactor(basis): Rename and rewrite lagrange_* files to basis_* with new API
Deleted files:
- src/basis/lagrange_generated.jl (451 lines) - Old generated basis implementations
- src/basis/lagrange_generator.jl (904 lines) - Old generator with complex dispatch

New files:
- src/basis/basis_generated.jl (461 lines) - New generated implementations using get_basis_functions/derivatives API
- src/basis/basis_generator.jl (622 lines) - Simplified generator with VandermondeBasisDescription

Key changes:
- Generator: Simplified from 904 → 622 lines, removed complex dispatch logic
- Generated: New API using get_basis_functions(topology, Lagrange{P}, xi) instead of eval_basis!(Lagrange{T,P}, xi)
- Return types: NTuple → SVector for type stability and StaticArrays compatibility
- Numerical filtering: Added round_coefficient for clean fractions (1/2, 1/3, 1/18, etc.)
- Basis descriptions: Uses VandermondeBasisDescription for element metadata

Net result: 1355 lines removed, 1083 lines added (272 line reduction with cleaner design)
2025-11-21 00:35:33 +02:00
Jukka Aho c4d732a060 refactor(basis): Consolidate abstract.jl and basis_api.jl into single api.jl
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)
2025-11-21 00:34:40 +02:00
Jukka Aho 447edd5694 chore: Update Manifest.toml with JuliaFormatter dependencies
Machine-generated lockfile update for:
- Added JuliaFormatter v2.2.0 and its dependencies
- Added CommonMark v0.9.1 (required by JuliaFormatter)
- Added JuliaSyntax v0.4.10 (required by JuliaFormatter)
2025-11-21 00:32:41 +02:00
Jukka Aho 1f97dc4314 deps: Add JuliaFormatter as project dependency
- Added JuliaFormatter = 98e50ef6-434e-11e9-1051-2b60c6c9e899
- Added version constraint: JuliaFormatter = 2.2.0
2025-11-21 00:32:20 +02:00
Jukka Aho 7e3f9bddc1 refactor(topology): Update 3D element reference_coordinates to SVector of Vec
Hexahedron changes:
- Hex8: tuple of tuples → SVector of Vec{3,Float64} (8 corners)
- Added Hex20: SVector with 8 corners + 12 edge midpoints
- Added Hex27: SVector with 8 corners + 12 edge midpoints + 6 face centers + 1 volume center

Pyramid changes:
- Pyr5: tuple of tuples → SVector of Vec{3,Float64} (4 base corners + 1 apex)

Wedge changes:
- Wedge6: tuple of tuples → SVector of Vec{3,Float64} (2 triangular faces)
- Added Wedge15: SVector with 6 corners + 9 edge midpoints
2025-11-21 00:32:06 +02:00
Jukka Aho 342990ce55 refactor(topology): Update Tetrahedron reference_coordinates to SVector of Vec
- Changed Tet4 and Tet10 return types in docstrings: NTuple → SVector{N, Vec{3,Float64}}
- Changed implementations: tuple of tuples → SVector of Vec{3,Float64}
- Updated reference_coordinates for Tet4 (4 nodes) and Tet10 (10 nodes)
2025-11-21 00:31:28 +02:00
Jukka Aho fa02393718 refactor(topology): Update Quadrilateral reference_coordinates to SVector of Vec
- Changed Quad4: tuple of tuples → SVector of Vec{2,Float64}
- Added Quad8: SVector with 4 corners + 4 edge midpoints
- Added Quad9: SVector with 4 corners + 4 edge midpoints + 1 center node
- All return SVector(Vec{2}(...), ...) format with comments
2025-11-21 00:31:09 +02:00
Jukka Aho 0926a7cdbe refactor(topology): Update Triangle reference_coordinates to SVector of Vec
- Changed Triangle{3,6,7,10} return types in docstrings: NTuple → SVector{N, Vec{2,Float64}}
- Changed all implementations: tuple of tuples → SVector of Vec{2,Float64}
- Updated reference_coordinates for Tri3, Tri6, Tri7, Tri10 (4 functions)
2025-11-21 00:30:52 +02:00
Jukka Aho a1d97bb1ef refactor(topology): Update Segment reference_coordinates to SVector of Vec
- 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
2025-11-21 00:30:39 +02:00
Jukka Aho 4bf7d2ef22 docs(topology): Update API documentation for new coordinate types
- 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.
2025-11-21 00:30:12 +02:00
Jukka Aho 15e9d71275 docs(quadrature): Add deprecation notices to old integration API
- 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
2025-11-21 00:29:48 +02:00
Jukka Aho 3983e19bff refactor(quadrature): Reorganize quadrature file includes
- Added include 'quadrature/api.jl' for core API types
- Renamed includes: 'glquad.jl' → 'gl_tensor_product.jl', 'gltri.jl' → 'gl_triangles.jl', 'gltet.jl' → 'gl_tetrahedra.jl', 'glwed.jl' → 'gl_wedges.jl', 'glpyr.jl' → 'gl_pyramids.jl'
- Updated comments to clarify topology coverage (segments, quadrilaterals, hexahedra now explicit in tensor product comment)
2025-11-21 00:29:25 +02:00
Jukka Aho 3736374976 refactor(includes): Update basis and quadrature module includes
Basis module changes:
- Changed include from 'basis/abstract.jl' to 'basis/api.jl'
- Removed include 'basis/basis_api.jl' (merged into api.jl)
- Renamed includes: 'lagrange_generator.jl' → 'basis_generator.jl', 'lagrange_generated.jl' → 'basis_generated.jl'
- Simplified export comments (removed 'OLD API' / 'NEW API' labels)
- Consolidated exports: removed duplicate 'nnodes', 'get_reference_element_coordinates', 'AbstractPlateBasis', 'DKT', 'dof_types'

Quadrature module changes:
- Added include 'quadrature/api.jl' (new core API)
- Renamed includes: 'gltet.jl' → 'gl_tetrahedra.jl', 'gltri.jl' → 'gl_triangles.jl', 'glwed.jl' → 'gl_wedges.jl', 'glpyr.jl' → 'gl_pyramids.jl', 'glquad.jl' → 'gl_tensor_product.jl'
- Added exports: AbstractQuadratureRule, GaussLegendre, GaussLobatto, QuadraturePoint, default_quadrature

Other:
- Added 'using StaticArrays: SVector' import for topology nodes
2025-11-21 00:29:01 +02:00
Jukka Aho b1ad3f7c51 fix(assemblers): Update create_element_cache to new Lagrange{P} API
- Changed basis instantiation from 'Lagrange{TopologyType,1}()' to 'Lagrange{1}()' (line 123)
- Added comment explaining new API: basis order only, topology passed separately
2025-11-21 00:28:23 +02:00
Jukka Aho 5c015536a2 fix(assembly): Update AssemblyCacheFerrite to new Lagrange{P} API
- 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
2025-11-21 00:28:05 +02:00
Jukka Aho 39b90b210e refactor(elements): Migrate Element constructor to new Lagrange{P} API
- 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
2025-11-21 00:27:49 +02:00
Jukka Aho 16b652a13e test(continuum): Remove duplicate test_helpers.jl include
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.
2025-11-20 18:24:58 +02:00
Jukka Aho 46be40bb4a refactor(mesh): Remove duplicate AbstractRefineStrategy definition
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.
2025-11-20 18:24:38 +02:00
Jukka Aho 3d3a2bd338 refactor(mesh): Remove duplicate Mesh constructor
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.
2025-11-20 18:24:13 +02:00
Jukka Aho 3f5e913e32 refactor(materials): Remove duplicate compute_stress stub
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.
2025-11-20 18:23:54 +02:00
Jukka Aho d43f89d954 refactor(legacy): Remove duplicate AbstractField definition
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.
2025-11-20 18:23:35 +02:00
Jukka Aho 9eb8634ed9 refactor(fields): Remove duplicate AbstractField definition
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.
2025-11-20 18:22:59 +02:00
Jukka Aho 4521d27731 refactor(plates): Remove duplicate assemble! stub
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.
2025-11-20 18:22:39 +02:00
Jukka Aho 95aac8a2d5 refactor(basis): Add Serendipity support to basis generator
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).
2025-11-20 18:22:20 +02:00
Jukka Aho bd66cbf689 chore(basis): Regenerate basis functions with Serendipity for Quad8
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.
2025-11-20 18:21:51 +02:00
Jukka Aho 2452735cf6 feat(basis): Add Serendipity basis type and remove duplicate function stubs
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.
2025-11-20 18:21:15 +02:00
Jukka Aho f9b949b929 refactor(assemblers): Remove duplicate dofs_per_node stub
Replace function stub declaration with comment pointing to canonical definition in fields/api.jl. This eliminates documentation replacement warning while preserving documentation context.
2025-11-20 18:20:51 +02:00
Jukka Aho c8b118b8b2 test(domains): Remove Vec{3} conversions in stiffness block allocation test
- 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}
2025-11-20 17:57:06 +02:00
Jukka Aho 4766cfe65e refactor(domains): Remove Vec{3} conversion in assemble_v2
- Changed 'ξ = Vec{3}(ip.ξ)' to 'ξ = ip.ξ' in compute_element_stiffness!
- No conversion needed since ip.ξ is now already Vec{3}
2025-11-20 17:56:48 +02:00
Jukka Aho 531d5cc208 refactor(assemblers): Remove Vec{3} conversions in geometry cache
- 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}
2025-11-20 17:56:28 +02:00
Jukka Aho 414de67114 refactor(backend): Remove Vec{3} conversion in CPU backend
- Changed 'ξ = Vec{3}(ip.ξ)' to 'ξ = ip.ξ' in compute_element_stiffness
- No conversion needed since ip.ξ is now already Vec{3}
2025-11-20 17:56:08 +02:00
Jukka Aho 9148ef223b refactor(domains): Remove Vec{3} conversion in update_geometry_cache
- Changed 'ξ = Vec{3}(ip.ξ)' to 'ξ = ip.ξ'
- No conversion needed since ip.ξ is now already Vec{3}
2025-11-20 17:55:23 +02:00
Jukka Aho 49f55ca12a refactor(quadrature): Convert tuple to Vec when constructing IntegrationPoint
- 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
2025-11-20 17:55:06 +02:00
Jukka Aho 400e9c7c85 refactor(quadrature): Change IntegrationPoint ξ field from NTuple to Vec
- 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
2025-11-20 17:54:46 +02:00
Jukka Aho 2bbc9805cb test: Improve reset! test to verify via matrix extraction
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.
2025-11-20 17:43:38 +02:00
Jukka Aho 706cee4962 test: Update compute_block! call in kernel_functions test
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.
2025-11-20 17:43:14 +02:00
Jukka Aho 13993f196f test: Simplify compute_block! test to verify zero allocations
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.
2025-11-20 17:42:55 +02:00
Jukka Aho bf165cc54b refactor(continuum): Fix shape function gradient indexing in material updates
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
2025-11-20 17:42:30 +02:00
Jukka Aho f4262571a9 refactor(assemblers): Update compute_block! call site in element_based_coo
Updated compute_block! call to pass arrays directly from caches:
- geometry_cache.∇N_data
- geometry_cache.detJ_w
- material_cache.𝔻

Removed commented counter write-back line, added explanatory comment.
Maintains symmetric assembly optimization (upper triangle only).
2025-11-20 17:41:58 +02:00
Jukka Aho 11ef128672 refactor(assemblers): Pass arrays directly to compute_block functions
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).
2025-11-20 17:41:39 +02:00
Jukka Aho 05a6f0bd39 test(continuum): Remove obsolete test_kernel_allocations.jl
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.
2025-11-20 16:56:43 +02:00
Jukka Aho 37f103421f refactor(continuum): Remove theory.jl (types moved to abstract.jl and types.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.
2025-11-20 16:56:42 +02:00
Jukka Aho a05a7c99b9 refactor(continuum): Remove integration.jl (split into three update functions)
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.
2025-11-20 16:56:42 +02:00
Jukka Aho cb96612a97 refactor(continuum): Remove old assemble.jl (replaced by element_based_coo.jl)
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.
2025-11-20 16:56:42 +02:00
Jukka Aho 678be8011c test(continuum): Add Hex8 element validation against reference
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.
2025-11-20 16:56:42 +02:00
Jukka Aho 064820713f test(continuum): Add tests for cache reset functions
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.
2025-11-20 16:56:42 +02:00
Jukka Aho 1d98e29f2b test(continuum): Add tests for kernel computation functions
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.
2025-11-20 16:56:41 +02:00
Jukka Aho aac5641ed4 test(continuum): Add utility functions for test setup
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.
2025-11-20 16:56:41 +02:00