]> https://gitweb.dealii.org/ - dealii.git/commitdiff
Add hp support for interfaces to ScratchData
authorJean-Paul Pelteret <jppelteret@gmail.com>
Tue, 20 Dec 2022 20:29:40 +0000 (21:29 +0100)
committerJean-Paul Pelteret <jppelteret@gmail.com>
Thu, 29 Dec 2022 07:40:15 +0000 (08:40 +0100)
include/deal.II/meshworker/scratch_data.h
source/meshworker/scratch_data.cc

index 345fff7d6f0637e95e5ee903a9d87b96de2653e7..ee2d98b17d090f9a9b05de8aaae6ec3903895ca5 100644 (file)
@@ -1405,6 +1405,8 @@ namespace MeshWorker
     /**
      * Interface values on facets.
      */
+    // The FEInterfaceValues class supports initialization with hp objects
+    // as well.
     std::unique_ptr<FEInterfaceValues<dim, spacedim>> interface_fe_values;
 
     /** @} */ // non-hp data
index 293560834686ad3160a66de9a03a685765914287..434307edad4c9480445833990af59ecfd8c0b01b 100644 (file)
@@ -450,26 +450,48 @@ namespace MeshWorker
           interface_fe_values =
             std::make_unique<FEInterfaceValues<dim, spacedim>>(
               *mapping, *fe, face_quadrature, face_update_flags);
+
         interface_fe_values->reinit(cell,
                                     face_no,
                                     sub_face_no,
                                     cell_neighbor,
                                     face_no_neighbor,
                                     sub_face_no_neighbor);
-
-        current_fe_values = &interface_fe_values->get_fe_face_values(0);
-        current_neighbor_fe_values =
-          &interface_fe_values->get_fe_face_values(1);
-
-        cell_neighbor->get_dof_indices(neighbor_dof_indices);
-        local_dof_indices = interface_fe_values->get_interface_dof_indices();
-        return *interface_fe_values;
       }
     else
       {
-        AssertThrow(false, ExcOnlyAvailableWithoutHP());
-        return *interface_fe_values;
+        if (!interface_fe_values)
+          interface_fe_values =
+            std::make_unique<FEInterfaceValues<dim, spacedim>>(
+              *mapping_collection,
+              *fe_collection,
+              face_quadrature_collection,
+              face_update_flags);
+
+        // When we want to ensure some agreement between the cell face and
+        // its neighbor on the quadrature order and mapping to use on this
+        // face, then we defer to the dominance of one FE over another. This
+        // should ensure that the optimal integration order and mapping
+        // order are selected for this situation.
+        const unsigned int dominated_fe_index =
+          fe_collection->find_dominated_fe(
+            {cell->active_fe_index(), cell_neighbor->active_fe_index()});
+
+        interface_fe_values->reinit(cell,
+                                    face_no,
+                                    sub_face_no,
+                                    cell_neighbor,
+                                    face_no_neighbor,
+                                    sub_face_no_neighbor,
+                                    dominated_fe_index,
+                                    dominated_fe_index);
       }
+
+    current_fe_values          = &interface_fe_values->get_fe_face_values(0);
+    current_neighbor_fe_values = &interface_fe_values->get_fe_face_values(1);
+
+    local_dof_indices = interface_fe_values->get_interface_dof_indices();
+    return *interface_fe_values;
   }
 
 

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.