From: Daniel Arndt Date: Sat, 19 May 2018 00:57:49 +0000 (+0200) Subject: Fix make_flux_sparsity_pattern for hp::DoFHandler X-Git-Tag: v9.1.0-rc1~1124^2~2 X-Git-Url: https://gitweb.dealii.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=110c71930a35911675ffa2f8ed89293244d3f8ea;p=dealii.git Fix make_flux_sparsity_pattern for hp::DoFHandler --- diff --git a/source/dofs/dof_tools_sparsity.cc b/source/dofs/dof_tools_sparsity.cc index e65b3f9c2d..d4f6f9babc 100644 --- a/source/dofs/dof_tools_sparsity.cc +++ b/source/dofs/dof_tools_sparsity.cc @@ -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; iget_fe().dofs_per_cell; ++i) { - for (unsigned int i=0; iget_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; jget_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; jget_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::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]); } } } diff --git a/tests/hp/flux_sparsity.output b/tests/hp/flux_sparsity.output index 7817e46a86..2f88fdea89 100644 --- a/tests/hp/flux_sparsity.output +++ b/tests/hp/flux_sparsity.output @@ -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] @@ -29,12 +29,12 @@ [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]