Skip to content

Commit 5301b91

Browse files
committed
Fix distributed test failures in internal-boundary
- Ensure boundary ID is added to a locally owned elem - Select valid left-bottom elem with neighbor for internal side
1 parent 71680c0 commit 5301b91

File tree

1 file changed

+21
-18
lines changed

1 file changed

+21
-18
lines changed

tests/mesh/boundary_info.C

Lines changed: 21 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -1127,30 +1127,33 @@ public:
11271127

11281128
BoundaryInfo & bi = mesh.get_boundary_info();
11291129

1130-
// Select an element on the left side of the interior boundary
1131-
// (average x-coordinate < 0.5).
1132-
Elem * left_elem = nullptr;
1130+
const unsigned int internal_side = 1; // east side for left elems
1131+
const boundary_id_type BID = 7;
1132+
1133+
mesh.prepare_for_use();
1134+
1135+
Elem * left_bottom_elem = nullptr;
11331136
for (auto & elem : mesh.active_element_ptr_range())
1134-
{
1135-
if (elem->vertex_average()(0) < 0.5)
11361137
{
1137-
left_elem = elem;
1138-
break;
1139-
}
1140-
}
1138+
if (elem->processor_id() != mesh.processor_id())
1139+
continue;
11411140

1142-
CPPUNIT_ASSERT(left_elem);
1143-
unsigned int internal_side = 1;
1144-
CPPUNIT_ASSERT(left_elem->neighbor_ptr(internal_side) != nullptr);
1141+
const Point c = elem->vertex_average();
1142+
if (c(0) < 0.5 && c(1) < 0.5 && elem->neighbor_ptr(internal_side) != nullptr)
1143+
{
1144+
left_bottom_elem = elem;
1145+
break;
1146+
}
1147+
}
11451148

1146-
// Assign a custom boundary ID on this internal side.
1147-
boundary_id_type BID = 7;
1148-
bi.add_side(left_elem, internal_side, BID);
11491149

1150-
mesh.prepare_for_use();
1150+
if (left_bottom_elem)
1151+
{
1152+
bi.add_side(left_bottom_elem, internal_side, BID);
11511153

1152-
unsigned int found_side = bi.side_with_boundary_id(left_elem, BID);
1153-
CPPUNIT_ASSERT_EQUAL(internal_side, found_side);
1154+
const unsigned int found_side = bi.side_with_boundary_id(left_bottom_elem, BID);
1155+
CPPUNIT_ASSERT_EQUAL(internal_side, found_side);
1156+
}
11541157
}
11551158

11561159

0 commit comments

Comments
 (0)