From 09db3ff4c6c2e7e5ce363996fa773aaea4aa1fe5 Mon Sep 17 00:00:00 2001 From: James Percival Date: Tue, 18 Oct 2016 19:50:11 +0100 Subject: [PATCH] Fix unittests. --- femtools/Supermesh.F90 | 4 ++++ femtools/tests/test_intersection_finder_completeness.F90 | 4 ++++ femtools/tests/test_intersection_finder_completeness_3d.F90 | 4 ++++ femtools/tests/test_quad_supermesh.F90 | 4 ++++ femtools/tests/test_tet_intersector.F90 | 4 +++- femtools/tests/test_unify_meshes.F90 | 5 +++++ 6 files changed, 24 insertions(+), 1 deletion(-) diff --git a/femtools/Supermesh.F90 b/femtools/Supermesh.F90 index 0c3a690880..bbaa21d870 100644 --- a/femtools/Supermesh.F90 +++ b/femtools/Supermesh.F90 @@ -290,6 +290,10 @@ subroutine construct_supermesh(new_positions, ele_B, old_positions, map_BA, supe assert(continuity(intersection(j)) < 0) else intersection(j) = intersect_elements(old_positions, ele_A, pos_B, supermesh_shape) + if (.not. has_references(intersection(j))) then + llnode => llnode%next + cycle + end if assert(continuity(intersection(j)) < 0) end if diff --git a/femtools/tests/test_intersection_finder_completeness.F90 b/femtools/tests/test_intersection_finder_completeness.F90 index 18b5809c89..b2859f22d8 100644 --- a/femtools/tests/test_intersection_finder_completeness.F90 +++ b/femtools/tests/test_intersection_finder_completeness.F90 @@ -38,6 +38,10 @@ subroutine test_intersection_finder_completeness do while(associated(llnode)) ele_A = llnode%value intersection = intersect_elements(positionsA, ele_A, ele_val(positionsB, ele_B), ele_shape(positionsB, ele_B)) + if (.not. has_references(intersection)) then + llnode => llnode%next + cycle + end if do ele_C=1,ele_count(intersection) call transform_to_physical(intersection, ele_C, detwei=detwei) vols_C = vols_C + sum(detwei) diff --git a/femtools/tests/test_intersection_finder_completeness_3d.F90 b/femtools/tests/test_intersection_finder_completeness_3d.F90 index 6a6d863860..e0cd29c3a5 100644 --- a/femtools/tests/test_intersection_finder_completeness_3d.F90 +++ b/femtools/tests/test_intersection_finder_completeness_3d.F90 @@ -41,6 +41,10 @@ subroutine test_intersection_finder_completeness_3d do while(associated(llnode)) ele_A = llnode%value intersection = intersect_elements(positionsA, ele_A, ele_val(positionsB, ele_B), ele_shape(positionsB, ele_B)) + if (.not. has_references(intersection)) then + llnode => llnode%next + cycle + end if do ele_C=1,ele_count(intersection) call transform_to_physical(intersection, ele_C, detwei=detwei) vols_C = vols_C + sum(detwei) diff --git a/femtools/tests/test_quad_supermesh.F90 b/femtools/tests/test_quad_supermesh.F90 index 3b28c8dcc6..3cd961ea0c 100644 --- a/femtools/tests/test_quad_supermesh.F90 +++ b/femtools/tests/test_quad_supermesh.F90 @@ -59,6 +59,10 @@ subroutine test_quad_supermesh do while(associated(llnode)) ele_A = llnode%value intersection = intersect_elements(positionsA, ele_A, ele_val(positionsB, ele_B), supermesh_shape) + if (.not. has_references(intersection)) then + llnode => llnode%next + cycle + end if #define DUMP_SUPERMESH_INTERSECTIONS #ifdef DUMP_SUPERMESH_INTERSECTIONS if (ele_count(intersection) /= 0) then diff --git a/femtools/tests/test_tet_intersector.F90 b/femtools/tests/test_tet_intersector.F90 index 33aaca3da6..3a775a86aa 100644 --- a/femtools/tests/test_tet_intersector.F90 +++ b/femtools/tests/test_tet_intersector.F90 @@ -47,7 +47,9 @@ subroutine test_tet_intersector fail = (vol_libwm .fne. vol_fort) call report_test("[tet_intersector volumes]", fail, .false., "Should give the same volumes of intersection") - call deallocate(libwm) + if (has_references(libwm)) then + call deallocate(libwm) + end if if (stat == 0) then call deallocate(fort) end if diff --git a/femtools/tests/test_unify_meshes.F90 b/femtools/tests/test_unify_meshes.F90 index f6d8ffc043..feb37c98cd 100644 --- a/femtools/tests/test_unify_meshes.F90 +++ b/femtools/tests/test_unify_meshes.F90 @@ -64,6 +64,11 @@ subroutine test_unify_meshes do while(associated(llnode)) ele_A = llnode%value intersection = intersect_elements(positionsA, ele_A, ele_val(positionsB, ele_B), supermesh_shape) + if (.not. has_references(intersection)) then + llnode => llnode%next + cycle + end if + call unify_meshes_quadratic(accum_positions, intersection, accum_positions_tmp) call deallocate(accum_positions) accum_positions = accum_positions_tmp