]> https://gitweb.dealii.org/ - dealii.git/commitdiff
Use constructor argument
authorMaximilian Bergbauer <maximilian.bergbauer@tum.de>
Tue, 3 Dec 2024 14:59:08 +0000 (15:59 +0100)
committerMaximilian Bergbauer <maximilian.bergbauer@tum.de>
Wed, 23 Apr 2025 09:02:47 +0000 (11:02 +0200)
include/deal.II/matrix_free/fe_point_evaluation.h

index 27569a944fc250a709dc6537e666a974868698f9..f916b12527ada92234efe13fe2d30425aa43ffe4 100644 (file)
@@ -1171,11 +1171,19 @@ public:
    * @param first_selected_component For multi-component FiniteElement
    * objects, this parameter allows to select a range of `n_components`
    * components starting from this parameter.
+   *
+   * @param lexicographic_numbering If this class is used together with
+   * FEEvaluation this parameter should be set to 'true' because FEEvaluation
+   * stores the DoF values internally always in lexicographic numbering.
+   * Otherwise, the numbering detected from the FiniteElement passed to this
+   * class will be used (which is lexicographic for e.g. FE_DGQ but hierarchic
+   * for FE_Q).
    */
   FEPointEvaluation(const Mapping<dim, spacedim>       &mapping,
                     const FiniteElement<dim, spacedim> &fe,
                     const UpdateFlags                   update_flags,
-                    const unsigned int first_selected_component = 0);
+                    const unsigned int first_selected_component = 0,
+                    const bool         lexicographic_numbering  = false);
 
   /**
    * Constructor to make the present class able to re-use the geometry
@@ -1192,11 +1200,19 @@ public:
    * @param first_selected_component For multi-component FiniteElement
    * objects, this parameter allows to select a range of `n_components`
    * components starting from this parameter.
+   *
+   * @param lexicographic_numbering If this class is used together with
+   * FEEvaluation this parameter should be set to 'true' because FEEvaluation
+   * stores the DoF values internally always in lexicographic numbering.
+   * Otherwise, the numbering detected from the FiniteElement passed to this
+   * class will be used (which is lexicographic for e.g. FE_DGQ but hierarchic
+   * for FE_Q).
    */
   FEPointEvaluation(
     const NonMatching::MappingInfo<dim, spacedim, Number> &mapping_info,
     const FiniteElement<dim, spacedim>                    &fe,
-    const unsigned int first_selected_component = 0);
+    const unsigned int first_selected_component = 0,
+    const bool         lexicographic_numbering  = false);
 
   /**
    * Set up the mapping information for the given cell, e.g., by computing the
@@ -1411,6 +1427,8 @@ private:
   static constexpr std::size_t stride =
     internal::VectorizedArrayTrait<Number>::stride();
 
+  const bool lexicographic_numbering;
+
   /**
    * Resizes necessary data fields, reads in and renumbers solution values.
    * Interpolates onto face if face path is selected.
@@ -2358,11 +2376,13 @@ template <int n_components_, int dim, int spacedim, typename Number>
 FEPointEvaluation<n_components_, dim, spacedim, Number>::FEPointEvaluation(
   const NonMatching::MappingInfo<dim, spacedim, Number> &mapping_info,
   const FiniteElement<dim, spacedim>                    &fe,
-  const unsigned int first_selected_component)
+  const unsigned int first_selected_component,
+  const bool         lexicographic_numbering)
   : FEPointEvaluationBase<n_components_, dim, spacedim, Number>(
       mapping_info,
       fe,
       first_selected_component)
+  , lexicographic_numbering(lexicographic_numbering || this->renumber.empty())
 {}
 
 
@@ -2372,12 +2392,14 @@ FEPointEvaluation<n_components_, dim, spacedim, Number>::FEPointEvaluation(
   const Mapping<dim, spacedim>       &mapping,
   const FiniteElement<dim, spacedim> &fe,
   const UpdateFlags                   update_flags,
-  const unsigned int                  first_selected_component)
+  const unsigned int                  first_selected_component,
+  const bool                          lexicographic_numbering)
   : FEPointEvaluationBase<n_components_, dim, spacedim, Number>(
       mapping,
       fe,
       update_flags,
       first_selected_component)
+  , lexicographic_numbering(lexicographic_numbering || this->renumber.empty())
 {}
 
 
@@ -2632,7 +2654,7 @@ FEPointEvaluation<n_components_, dim, spacedim, Number>::prepare_evaluate_fast(
       const std::size_t offset =
         (this->component_in_base_element + comp) * dofs_per_comp;
 
-      if ((is_linear && n_components == 1) || this->renumber.empty())
+      if ((is_linear && n_components == 1) || lexicographic_numbering)
         {
           for (unsigned int i = 0; i < dofs_per_comp; ++i)
             ETT::read_value(solution_values[i + offset],
@@ -2934,7 +2956,7 @@ FEPointEvaluation<n_components_, dim, spacedim, Number>::finish_integrate_fast(
       const std::size_t offset =
         (this->component_in_base_element + comp) * dofs_per_comp;
 
-      if (is_linear || this->renumber.empty())
+      if (is_linear || lexicographic_numbering)
         {
           for (unsigned int i = 0; i < dofs_per_comp; ++i)
             if (sum_into_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.