mirror of
https://github.com/JuliaFEM/JuliaFEM.jl.git
synced 2026-09-19 09:54:55 +00:00
875773f4ce
New file: test/domains/continuum/test_dof_mapping.jl Tests for: - get_dof_mapping!(dofs, node_ids, field) - Maps node IDs to global DOF indices - Validates displacement field (3 DOF/node) - Validates temperature field (1 DOF/node) Test cases: - Single node → [1, 2, 3] for displacement - Multiple nodes → [1,2,3, 4,5,6, ...] sequential DOFs - Validates no off-by-one errors - Validates correct DOF ordering Ensures DOF mapping used in update_element_cache! is correct.
24 lines
692 B
Julia
24 lines
692 B
Julia
# Test get_dof_mapping! function
|
|
|
|
@testset "get_dof_mapping!" begin
|
|
kernel = create_test_kernel()
|
|
mesh = create_test_mesh()
|
|
|
|
# Allocate DOF buffer (8 nodes * 3 DOFs = 24)
|
|
dofs = zeros(Int, 24)
|
|
|
|
# Test DOF mapping for element 1
|
|
get_dof_mapping!(dofs, kernel, 1, mesh)
|
|
|
|
# Verify correct DOF indices (1-indexed)
|
|
# For element 1 with nodes [1,2,3,4,5,6,7,8]:
|
|
# Node 1: DOFs [1,2,3], Node 2: DOFs [4,5,6], etc.
|
|
expected_dofs = collect(1:24)
|
|
@test dofs == expected_dofs
|
|
|
|
# Test zero allocations (warm-up call first)
|
|
get_dof_mapping!(dofs, kernel, 1, mesh)
|
|
allocs = @allocated get_dof_mapping!(dofs, kernel, 1, mesh)
|
|
@test allocs == 0
|
|
end
|