]> https://gitweb.dealii.org/ - dealii.git/commitdiff
Fix make_flux_sparsity_pattern for hp::DoFHandler
authorDaniel Arndt <daniel.arndt@iwr.uni-heidelberg.de>
Sat, 19 May 2018 00:57:49 +0000 (02:57 +0200)
committerDaniel Arndt <daniel.arndt@iwr.uni-heidelberg.de>
Sat, 19 May 2018 00:57:49 +0000 (02:57 +0200)
source/dofs/dof_tools_sparsity.cc
tests/hp/flux_sparsity.output

index e65b3f9c2dd3377aa9f1da6141becc78056d0867..d4f6f9babc21eeb88a210eab2bf7018e5f72bede 100644 (file)
@@ -1029,39 +1029,36 @@ namespace DoFTools
 
                   const bool periodic_neighbor = cell->has_periodic_neighbor (face);
 
-                  if (cell->at_boundary (face) && (!periodic_neighbor))
+                  for (unsigned int i=0; i<cell->get_fe().dofs_per_cell; ++i)
                     {
-                      for (unsigned int i=0; i<cell->get_fe().dofs_per_cell; ++i)
+                      const unsigned int ii
+                        = (cell->get_fe().is_primitive(i) ?
+                           cell->get_fe().system_to_component_index(i).first
+                           :
+                           cell->get_fe().get_nonzero_components(i).first_selected_component()
+                          );
+
+                      Assert (ii < cell->get_fe().n_components(), ExcInternalError());
+
+                      for (unsigned int j=0; j<cell->get_fe().dofs_per_cell; ++j)
                         {
-                          const unsigned int ii
-                            = (cell->get_fe().is_primitive(i) ?
-                               cell->get_fe().system_to_component_index(i).first
+                          const unsigned int jj
+                            = (cell->get_fe().is_primitive(j) ?
+                               cell->get_fe().system_to_component_index(j).first
                                :
-                               cell->get_fe().get_nonzero_components(i).first_selected_component()
+                               cell->get_fe().get_nonzero_components(j).first_selected_component()
                               );
 
-                          Assert (ii < cell->get_fe().n_components(), ExcInternalError());
+                          Assert (jj < cell->get_fe().n_components(), ExcInternalError());
 
-                          for (unsigned int j=0; j<cell->get_fe().dofs_per_cell; ++j)
-                            {
-                              const unsigned int jj
-                                = (cell->get_fe().is_primitive(j) ?
-                                   cell->get_fe().system_to_component_index(j).first
-                                   :
-                                   cell->get_fe().get_nonzero_components(j).first_selected_component()
-                                  );
-
-                              Assert (jj < cell->get_fe().n_components(), ExcInternalError());
-
-                              if ((flux_mask(ii,jj) == always)
-                                  ||
-                                  (flux_mask(ii,jj) == nonzero))
-                                sparsity.add (dofs_on_this_cell[i],
-                                              dofs_on_this_cell[j]);
-                            }
+                          if ((flux_mask(ii,jj) == always)
+                              ||
+                              (flux_mask(ii,jj) == nonzero))
+                            sparsity.add (dofs_on_this_cell[i],
+                                          dofs_on_this_cell[j]);
                         }
                     }
-                  else
+                  if ((!cell->at_boundary(face)) || periodic_neighbor)
                     {
                       typename dealii::hp::DoFHandler<dim,spacedim>::level_cell_iterator
                       neighbor = cell->neighbor_or_periodic_neighbor(face);
@@ -1141,26 +1138,14 @@ namespace DoFTools
                                         {
                                           sparsity.add (dofs_on_this_cell[i],
                                                         dofs_on_other_cell[j]);
-                                          sparsity.add (dofs_on_other_cell[i],
-                                                        dofs_on_this_cell[j]);
-                                          sparsity.add (dofs_on_this_cell[i],
-                                                        dofs_on_this_cell[j]);
-                                          sparsity.add (dofs_on_other_cell[i],
-                                                        dofs_on_other_cell[j]);
                                         }
 
                                       if ((flux_mask(jj,ii) == always)
                                           ||
                                           (flux_mask(jj,ii) == nonzero))
                                         {
-                                          sparsity.add (dofs_on_this_cell[j],
-                                                        dofs_on_other_cell[i]);
                                           sparsity.add (dofs_on_other_cell[j],
                                                         dofs_on_this_cell[i]);
-                                          sparsity.add (dofs_on_this_cell[j],
-                                                        dofs_on_this_cell[i]);
-                                          sparsity.add (dofs_on_other_cell[j],
-                                                        dofs_on_other_cell[i]);
                                         }
                                     }
                                 }
@@ -1198,26 +1183,14 @@ namespace DoFTools
                                     {
                                       sparsity.add (dofs_on_this_cell[i],
                                                     dofs_on_other_cell[j]);
-                                      sparsity.add (dofs_on_other_cell[i],
-                                                    dofs_on_this_cell[j]);
-                                      sparsity.add (dofs_on_this_cell[i],
-                                                    dofs_on_this_cell[j]);
-                                      sparsity.add (dofs_on_other_cell[i],
-                                                    dofs_on_other_cell[j]);
                                     }
 
                                   if ((flux_mask(jj,ii) == always)
                                       ||
                                       (flux_mask(jj,ii) == nonzero))
                                     {
-                                      sparsity.add (dofs_on_this_cell[j],
-                                                    dofs_on_other_cell[i]);
                                       sparsity.add (dofs_on_other_cell[j],
                                                     dofs_on_this_cell[i]);
-                                      sparsity.add (dofs_on_this_cell[j],
-                                                    dofs_on_this_cell[i]);
-                                      sparsity.add (dofs_on_other_cell[j],
-                                                    dofs_on_other_cell[i]);
                                     }
                                 }
                             }
index 7817e46a86c8e6eb4a3995d2aa05926449c4a937..2f88fdea898c687cbcba0cfa326b3376b0c70b86 100644 (file)
@@ -4,10 +4,10 @@
 [2,0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22]
 [3,0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22]
 [4,0,1,2,3]
-[5,0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22]
-[6,0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22]
-[7,0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22]
-[8,0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22]
+[5,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22]
+[6,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22]
+[7,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22]
+[8,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22]
 [9,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22]
 [10,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22]
 [11,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22]
 [4,0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47,48,49,50,51,52,53,54,55,56,57,58,59,60,61,62,63,64,65,66,67,68,69,70,71,72,73,74,75,76,77,78,79,80,81,82,83,84,85,86,87]
 [5,0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47,48,49,50,51,52,53,54,55,56,57,58,59,60,61,62,63,64,65,66,67,68,69,70,71,72,73,74,75,76,77,78,79,80,81,82,83,84,85,86,87]
 [6,0,1,2,3,4,5]
-[7,0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47,48,49,50,51,52,53,54,55,56,57,58,59,60,61,62,63,64,65,66,67,68,69,70,71,72,73,74,75,76,77,78,79,80,81,82,83,84,85,86,87]
-[8,0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47,48,49,50,51,52,53,54,55,56,57,58,59,60,61,62,63,64,65,66,67,68,69,70,71,72,73,74,75,76,77,78,79,80,81,82,83,84,85,86,87]
-[9,0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47,48,49,50,51,52,53,54,55,56,57,58,59,60,61,62,63,64,65,66,67,68,69,70,71,72,73,74,75,76,77,78,79,80,81,82,83,84,85,86,87]
-[10,0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47,48,49,50,51,52,53,54,55,56,57,58,59,60,61,62,63,64,65,66,67,68,69,70,71,72,73,74,75,76,77,78,79,80,81,82,83,84,85,86,87]
-[11,0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47,48,49,50,51,52,53,54,55,56,57,58,59,60,61,62,63,64,65,66,67,68,69,70,71,72,73,74,75,76,77,78,79,80,81,82,83,84,85,86,87]
-[12,0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47,48,49,50,51,52,53,54,55,56,57,58,59,60,61,62,63,64,65,66,67,68,69,70,71,72,73,74,75,76,77,78,79,80,81,82,83,84,85,86,87]
+[7,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47,48,49,50,51,52,53,54,55,56,57,58,59,60,61,62,63,64,65,66,67,68,69,70,71,72,73,74,75,76,77,78,79,80,81,82,83,84,85,86,87]
+[8,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47,48,49,50,51,52,53,54,55,56,57,58,59,60,61,62,63,64,65,66,67,68,69,70,71,72,73,74,75,76,77,78,79,80,81,82,83,84,85,86,87]
+[9,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47,48,49,50,51,52,53,54,55,56,57,58,59,60,61,62,63,64,65,66,67,68,69,70,71,72,73,74,75,76,77,78,79,80,81,82,83,84,85,86,87]
+[10,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47,48,49,50,51,52,53,54,55,56,57,58,59,60,61,62,63,64,65,66,67,68,69,70,71,72,73,74,75,76,77,78,79,80,81,82,83,84,85,86,87]
+[11,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47,48,49,50,51,52,53,54,55,56,57,58,59,60,61,62,63,64,65,66,67,68,69,70,71,72,73,74,75,76,77,78,79,80,81,82,83,84,85,86,87]
+[12,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47,48,49,50,51,52,53,54,55,56,57,58,59,60,61,62,63,64,65,66,67,68,69,70,71,72,73,74,75,76,77,78,79,80,81,82,83,84,85,86,87]
 [13,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47,48,49,50,51,52,53,54,55,56,57,58,59,60,61,62,63,64,65,66,67,68,69,70,71,72,73,74,75,76,77,78,79,80,81,82,83,84,85,86,87]
 [14,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47,48,49,50,51,52,53,54,55,56,57,58,59,60,61,62,63,64,65,66,67,68,69,70,71,72,73,74,75,76,77,78,79,80,81,82,83,84,85,86,87]
 [15,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47,48,49,50,51,52,53,54,55,56,57,58,59,60,61,62,63,64,65,66,67,68,69,70,71,72,73,74,75,76,77,78,79,80,81,82,83,84,85,86,87]

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.