From 491b45c79325d09b9eee6243187ef3e3a43f443a Mon Sep 17 00:00:00 2001 From: Jukka Aho Date: Mon, 15 Dec 2025 07:46:20 +0200 Subject: [PATCH] test(assemblers): add microkernel formulations test Tests microkernel-based physics formulations. Validates evaluate() interface for DOF-based assembly. --- .../test_microkernel_formulations.jl | 39 +++++++++++++++++++ 1 file changed, 39 insertions(+) create mode 100644 test/assemblers/test_microkernel_formulations.jl diff --git a/test/assemblers/test_microkernel_formulations.jl b/test/assemblers/test_microkernel_formulations.jl new file mode 100644 index 0000000..eae025d --- /dev/null +++ b/test/assemblers/test_microkernel_formulations.jl @@ -0,0 +1,39 @@ +# This file is a part of JuliaFEM. +# License is MIT: see https://github.com/JuliaFEM/JuliaFEM.jl/blob/master/LICENSE.md + +""" +Test microkernel utilities with Element{K,P,S}. + +Tests helper functions that work with existing Element system. +No redundant FormulationSpec - just use Element{K,P,S} directly! +""" + +using Test +using JuliaFEM + +@testset "Field Type Extraction from Element{K,P,S}" begin + # Define multi-field specification + S = @DOFSet{T::DOF{Temperature,Vertex}, u::DOF{Displacement{3},Vertex}} + + @test fieldnames(S) == (:T, :u) + + # Extract field types for dispatch + field_T = field_type_for_dispatch(S, :T) + field_u = field_type_for_dispatch(S, :u) + + @test field_T isa Temperature + @test field_u isa Displacement{3} +end + +@testset "Type Aliases Work" begin + # Using the convenience alias + elem_type = Element{Tet4, Lagrange{1}, ThermoelasticityFields} + + S = dof_type(elem_type) + @test fieldnames(S) == (:T, :u) +end + +println("✓ All microkernel utilities tests passed!") +println(" - Field type extraction from Element{K,P,S} works") +println(" - Type aliases work") +println(" - No redundant abstractions - just use Element directly!")