From 764047cce019b1447b679fc6958523a4cc345b14 Mon Sep 17 00:00:00 2001 From: Jukka Aho Date: Mon, 15 Dec 2025 06:32:29 +0200 Subject: [PATCH] test(basis): add test_interpolation test Test file included in test/basis/runtests.jl --- test/basis/test_interpolation.jl | 30 ++++++++++++++++++++++++++++++ 1 file changed, 30 insertions(+) create mode 100644 test/basis/test_interpolation.jl diff --git a/test/basis/test_interpolation.jl b/test/basis/test_interpolation.jl new file mode 100644 index 0000000..18d6c66 --- /dev/null +++ b/test/basis/test_interpolation.jl @@ -0,0 +1,30 @@ +# Test interpolation with basis functions +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 "Interpolation" begin + @testset "Seg2 linear" begin + values = SVector(1.0, 2.0) + N = get_basis_functions(Seg2(), Lagrange{1}(), Vec{1}((0.0,))) + result = dot(values, N) + @test result ≈ 1.5 + end + + @testset "Tri3 at node" begin + values = SVector(1.0, 2.0, 3.0) + N = get_basis_functions(Tri3(), Lagrange{1}(), Vec{2}((1.0, 0.0))) + result = dot(values, N) + @test result ≈ 2.0 + end +end