Skip to content

Commit 64e4597

Browse files
committed
Fix code base on Roy's feedback
(a) Revert periodic BC source file (b) Fix indentation in UnstructuredMesh::find_neighbors and wrap tests (c) involving solve() in DisconnectedNeighborTest with #ifdef LIBMESH_HAVE_SOLVER guards to ensure correct conditional compilation.
1 parent 1ad8ef8 commit 64e4597

File tree

3 files changed

+12
-6
lines changed

3 files changed

+12
-6
lines changed

src/base/periodic_boundaries.C

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -80,7 +80,6 @@ const Elem * PeriodicBoundaries::neighbor(boundary_id_type boundary_id,
8080
const MeshBase & mesh = point_locator.get_mesh();
8181
for(const Elem * elem_it : candidate_elements)
8282
{
83-
8483
std::vector<unsigned int> neigh_sides =
8584
mesh.get_boundary_info().sides_with_boundary_id(elem_it, b->pairedboundary);
8685

@@ -106,13 +105,14 @@ const Elem * PeriodicBoundaries::neighbor(boundary_id_type boundary_id,
106105
// either we're on a ghosted element with a remote periodic neighbor
107106
// or we're on a mesh with an inconsistent periodic boundary.
108107
libmesh_error_msg_if(mesh.is_serial() ||
109-
(e->processor_id() == mesh.processor_id()),
110-
"Periodic boundary neighbor not found");
108+
(e->processor_id() == mesh.processor_id()),
109+
"Periodic boundary neighbor not found");
111110

112111
if (neigh_side)
113112
*neigh_side = libMesh::invalid_uint;
114113
return remote_elem;
115114
}
115+
116116
} // namespace libMesh
117117

118118

src/mesh/unstructured_mesh.C

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1015,13 +1015,15 @@ void UnstructuredMesh::find_neighbors (const bool reset_remote_elements,
10151015
element->neighbor_ptr(ms) != remote_elem)
10161016
continue;
10171017

1018-
for (const auto & [id, boundary_ptr] : *db)
1018+
for (const auto & [id, boundary_ptr] : *db)
10191019
{
10201020
if (!this->get_boundary_info().has_boundary_id(element, ms, id))
10211021
continue;
10221022

10231023
unsigned int neigh_side;
1024-
const Elem * neigh = db->neighbor(id, *point_locator, element, ms, &neigh_side);
1024+
const Elem * neigh =
1025+
db->neighbor(id, *point_locator, element, ms, &neigh_side);
1026+
10251027
if (neigh && neigh != remote_elem && neigh != element)
10261028
{
10271029
element->set_neighbor(ms, this->elem_ptr(neigh->id()));

tests/systems/disconnected_neighbor_test.C

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -168,11 +168,14 @@ void assemble_temperature_jump(EquationSystems &es,
168168
class DisconnectedNeighborTest : public CppUnit::TestCase {
169169
public:
170170
LIBMESH_CPPUNIT_TEST_SUITE( DisconnectedNeighborTest );
171+
#ifdef LIBMESH_HAVE_SOLVER
171172
CPPUNIT_TEST( testTempJump );
173+
#endif
172174
CPPUNIT_TEST_SUITE_END();
173175

174176
private:
175177

178+
#ifdef LIBMESH_HAVE_SOLVER
176179
void testTempJump()
177180
{
178181
Mesh mesh(*TestCommWorld, 2);
@@ -241,7 +244,7 @@ private:
241244

242245
// This is the key testing step: inform libMesh about the disconnected boundaries
243246
// And, in `prepare_for_use()`, libMesh will set up the disconnected neighbor relationships.
244-
mesh.add_disconnected_boundaries(interface_left_id, interface_right_id);
247+
mesh.add_disconnected_boundaries(interface_left_id, interface_right_id, RealVectorValue(0.0, 0.0, 0.0));
245248

246249
// libMesh shouldn't renumber, or our based-on-initial-id
247250
// assertions later may fail.
@@ -299,6 +302,7 @@ private:
299302
LIBMESH_ASSERT_NUMBERS_EQUAL(exact, approx, 1e-2);
300303
}
301304
}
305+
#endif
302306
};
303307

304308
CPPUNIT_TEST_SUITE_REGISTRATION( DisconnectedNeighborTest );

0 commit comments

Comments
 (0)