From 4886cef85a3ba8155d5bb35e9d899c1e7b19aceb Mon Sep 17 00:00:00 2001 From: Jukka Aho Date: Mon, 15 Dec 2025 10:25:57 +0200 Subject: [PATCH] test(mesh): add mesh coloring test New 20-line test file for mesh coloring: - Tests that create_coloring produces valid graph coloring - Validates that elements in same color don't share nodes - Uses Abaqus mesh file (cube_tet4.inp) for testing Essential for parallel element assembly where elements sharing nodes must be processed in different colors to avoid race conditions. --- test/mesh/test_coloring.jl | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) create mode 100644 test/mesh/test_coloring.jl diff --git a/test/mesh/test_coloring.jl b/test/mesh/test_coloring.jl new file mode 100644 index 0000000..5e43966 --- /dev/null +++ b/test/mesh/test_coloring.jl @@ -0,0 +1,20 @@ +using JuliaFEM, LinearAlgebra, Test + +datadir = first(splitext(basename(@__FILE__))) + +@testset "Test that mesh coloring provides a good coloring" + fn = joinpath(datadir, "cube_tet4.inp") + mesh = JuliaFEM.Mesh(open(parse_abaqus, fn)) + + coloring = JuliaFEM.create_coloring(mesh) + for colors in coloring + for ele_i in colors + for ele_j in colors + if ele_i == ele_j + continue + end + @test intersect(Set(mesh.elements[ele_i]), Set(mesh.elements[ele_j])) |> isempty + end + end + end +end \ No newline at end of file