From: Wolfgang Bangerth Date: Wed, 26 Sep 2018 22:05:29 +0000 (-0600) Subject: Sort the active_fe_index values on faces. X-Git-Tag: v9.1.0-rc1~671^2~1 X-Git-Url: https://gitweb.dealii.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=4d18d5821a5797eee3a4e4b959be9b1e76ad18c6;p=dealii.git Sort the active_fe_index values on faces. --- diff --git a/source/hp/dof_handler.cc b/source/hp/dof_handler.cc index 582b581890..b8575df0fb 100644 --- a/source/hp/dof_handler.cc +++ b/source/hp/dof_handler.cc @@ -556,9 +556,31 @@ namespace internal next_free_face_slot; // Store the two indices we will have to deal with. + // We sort these so that it does not matter which of + // the cells adjacent to this face we visit first. In + // sequential computations, this does not matter + // because the order in which we visit these cells is + // deterministic and always the same. But in parallel + // computations, we can get into trouble because two + // processors visit the cells in different order + // (because the mesh creation history on the two + // processors is different), and in that case it can + // happen that the order of active_fe_index values for + // a given face is different on the two processes, + // even though they agree on which two values need to + // be stored. Since the DoF unification on faces + // takes into account the order of the + // active_fe_indices, this leads to quite subtle bugs. + // We could fix this in the place where we do the DoF + // unification on cells, but it is better to just make + // sure that every process stores the exact same + // information (and in the same order) on each face. unsigned int active_fe_indices[2] = { cell->active_fe_index(), cell->neighbor(face)->active_fe_index()}; + if (active_fe_indices[1] < active_fe_indices[0]) + std::swap(active_fe_indices[0], + active_fe_indices[1]); // Set first slot for this face to // active_fe_index of this face