]> https://gitweb.dealii.org/ - dealii.git/commitdiff
Sort the active_fe_index values on faces.
authorWolfgang Bangerth <bangerth@colostate.edu>
Wed, 26 Sep 2018 22:05:29 +0000 (16:05 -0600)
committerWolfgang Bangerth <bangerth@colostate.edu>
Thu, 27 Sep 2018 13:04:30 +0000 (07:04 -0600)
source/hp/dof_handler.cc

index 582b58189068b5e24243bf0b3d2e1d35a1b493d1..b8575df0fbeb41b5d1c12333acf062a0626ab7cb 100644 (file)
@@ -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

In the beginning the Universe was created. This has made a lot of people very angry and has been widely regarded as a bad move.

Douglas Adams


Typeset in Trocchi and Trocchi Bold Sans Serif.