From 2f972c11063afffb390d7e7003c54dfc085836a9 Mon Sep 17 00:00:00 2001 From: Jukka Aho Date: Mon, 15 Dec 2025 06:32:21 +0200 Subject: [PATCH] test(basis): add partition of unity test New 31-line test for partition of unity property: - Tests that sum of basis functions equals 1.0 - Covers Seg2, Tri3, Quad4 elements - Included in test/basis/runtests.jl - Validates fundamental basis function property Ensures basis functions satisfy partition of unity requirement. --- test/basis/test_partition_of_unity.jl | 31 +++++++++++++++++++++++++++ 1 file changed, 31 insertions(+) create mode 100644 test/basis/test_partition_of_unity.jl diff --git a/test/basis/test_partition_of_unity.jl b/test/basis/test_partition_of_unity.jl new file mode 100644 index 0000000..2e7367e --- /dev/null +++ b/test/basis/test_partition_of_unity.jl @@ -0,0 +1,31 @@ +# Test partition of unity property: sum(N) = 1 +using Test +using StaticArrays, Tensors + +include("../../src/topology/api.jl") +include("../../src/topology/segments.jl") +include("../../src/topology/triangles.jl") +include("../../src/topology/quadrilaterals.jl") +include("../../src/topology/tetrahedra.jl") +include("../../src/topology/hexahedra.jl") +include("../../src/topology/pyramids.jl") +include("../../src/topology/wedges.jl") +include("../../src/basis/api.jl") +include("../../src/basis/basis_generated.jl") + +@testset "Partition of Unity" begin + @testset "Seg2" begin + N = get_basis_functions(Seg2(), Lagrange{1}(), Vec{1}((0.3,))) + @test sum(N) ≈ 1.0 + end + + @testset "Tri3" begin + N = get_basis_functions(Tri3(), Lagrange{1}(), Vec{2}((0.4, 0.3))) + @test sum(N) ≈ 1.0 + end + + @testset "Quad4" begin + N = get_basis_functions(Quad4(), Lagrange{1}(), Vec{2}((0.5, -0.5))) + @test sum(N) ≈ 1.0 + end +end