@@ -350,6 +350,8 @@ void find_nodal_neighbors_helper(const dof_id_type global_id,
350350 }
351351 }
352352
353+ const auto elem_order = Elem ::type_to_default_order_map [elem -> type ()];
354+
353355 // Index of the current edge
354356 unsigned current_edge = 0 ;
355357
@@ -373,18 +375,23 @@ void find_nodal_neighbors_helper(const dof_id_type global_id,
373375
374376 // Find another node in this element on this edge
375377 for (unsigned other_node_this_edge = 0 ; other_node_this_edge != n_nodes ; other_node_this_edge ++ )
376- if ( (elem -> is_node_on_edge (other_node_this_edge , current_edge )) && // On the current edge
377- (elem -> node_id (other_node_this_edge ) != global_id )) // But not the original node
378- {
379- // We've found a nodal neighbor! Save a pointer to it..
380- node_to_save = elem -> node_ptr (other_node_this_edge );
381- break ;
382- }
383-
384- // Make sure we found something
385- libmesh_assert (node_to_save != nullptr );
386-
387- neighbor_set .insert (node_to_save );
378+ {
379+ const bool both_vertices = elem -> is_vertex (local_node_number ) &&
380+ elem -> is_vertex (other_node_this_edge );
381+ if ( elem -> is_node_on_edge (other_node_this_edge , current_edge ) && // On the current edge
382+ elem -> node_id (other_node_this_edge ) != global_id && // But not the original node
383+ // vertex nodes on the same edge of higher order elements are not nodal neighbors
384+ (elem_order == 1 || !both_vertices ))
385+ {
386+ // We've found a nodal neighbor! Save a pointer to it..
387+ node_to_save = elem -> node_ptr (other_node_this_edge );
388+
389+ // Make sure we found something
390+ libmesh_assert (node_to_save != nullptr );
391+
392+ neighbor_set .insert (node_to_save );
393+ }
394+ }
388395 }
389396
390397 // Keep looking for edges, node may be on more than one edge
0 commit comments