]> https://gitweb.dealii.org/ - dealii.git/commitdiff
Enable FE_Nothing in MatrixFree 11038/head
authorBruno Turcksin <bruno.turcksin@gmail.com>
Mon, 12 Oct 2020 19:02:53 +0000 (19:02 +0000)
committerBruno Turcksin <bruno.turcksin@gmail.com>
Sun, 25 Oct 2020 01:48:58 +0000 (01:48 +0000)
include/deal.II/matrix_free/matrix_free.templates.h
include/deal.II/matrix_free/shape_info.templates.h
source/matrix_free/task_info.cc
tests/matrix_free/matrix_vector_hp.cc

index b6152e00769ea22d52d8d0850a807de727e57e09..d458ba7164f9d0451a8a3ba413f38d275c4577cc 100644 (file)
@@ -975,9 +975,12 @@ namespace internal
       {
         const bool strict_categories =
           cell_vectorization_categories_strict || hp_functionality_enabled;
-        unsigned int dofs_per_cell = 0;
+        // Use max dofs per cell in create_blocks_serial. This is necessary
+        // to use FE_Nothing.
+        unsigned int max_dofs_per_cell = 0;
         for (const auto &info : dof_info)
-          dofs_per_cell = std::max(dofs_per_cell, info.dofs_per_cell[0]);
+          for (const auto &dofs : info.dofs_per_cell)
+            max_dofs_per_cell = std::max(max_dofs_per_cell, dofs);
 
         // Detect cells with the same parent to make sure they get scheduled
         // together in the loop, which increases data locality.
@@ -1004,7 +1007,7 @@ namespace internal
               ++position;
             }
         task_info.create_blocks_serial(subdomain_boundary_cells,
-                                       dofs_per_cell,
+                                       max_dofs_per_cell,
                                        hp_functionality_enabled,
                                        dof_info[0].cell_active_fe_index,
                                        strict_categories,
index 41a90beb54b82ac4313e396a691acea53ad88bd6..eba58543dc2d3bc831a83fd4a1a7c00feb8032b9 100644 (file)
@@ -104,6 +104,9 @@ namespace internal
       univariate_shape_data.fe_degree     = fe->degree;
       univariate_shape_data.n_q_points_1d = quad.size();
 
+      if ((fe->n_dofs_per_cell() == 0) || (quad.size() == 0))
+        return;
+
       // grant write access to common univariate shape data
       auto &shape_values    = univariate_shape_data.shape_values;
       auto &shape_gradients = univariate_shape_data.shape_gradients;
index c071c9dc7612ee13714ea5f4cfd6e4efc6142e40..d011319df256a0abb9bbbfb1167ec24b17e9f9a7 100644 (file)
@@ -784,6 +784,7 @@ namespace internal
       std::vector<unsigned int> &      renumbering,
       std::vector<unsigned char> &     incompletely_filled_vectorization)
     {
+      Assert(dofs_per_cell > 0, ExcInternalError());
       // This function is decomposed into several steps to determine a good
       // ordering that satisfies the following constraints:
       // a. Only cells belonging to the same category (or next higher if the
index f0499f39c938215b1edadc7b0f26c8d58f64fb5c..4a5635cffee84a149eaf8385be57303aa16777db 100644 (file)
@@ -142,6 +142,9 @@ test()
   hp::QCollection<dim>  quadrature_collection;
   hp::QCollection<1>    quadrature_collection_mf;
 
+  fe_collection.push_back(FE_Nothing<dim>());
+  quadrature_collection.push_back(QGauss<dim>(1));
+  quadrature_collection_mf.push_back(QGauss<1>(1));
   for (unsigned int deg = 1; deg <= max_degree; ++deg)
     {
       fe_collection.push_back(FE_Q<dim>(QGaussLobatto<1>(deg + 1)));
@@ -158,8 +161,13 @@ test()
     for (; cell != endc; ++cell)
       {
         const unsigned int fe_index = Testing::rand() % max_degree;
-        cell->set_active_fe_index(fe_index);
+        cell->set_active_fe_index(fe_index + 1);
       }
+    // We cannot set random cells to FE_Nothing. We get the following error
+    // The violated condition was: dominating_fe.n_dofs_per_face(face) <=
+    // subface_fe.n_dofs_per_face(face)
+    cell = dof.begin_active();
+    cell->set_active_fe_index(0);
   }
 
   // setup DoFs

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.