]> https://gitweb.dealii.org/ - dealii.git/commitdiff
Also for general case 16078/head
authorMaximilian Bergbauer <maximilian.bergbauer@tum.de>
Mon, 2 Oct 2023 14:29:47 +0000 (16:29 +0200)
committerMaximilian Bergbauer <maximilian.bergbauer@tum.de>
Mon, 2 Oct 2023 14:29:47 +0000 (16:29 +0200)
include/deal.II/matrix_free/fe_evaluation.h

index f378ae4b87232c32d7870cbc7117f2839ad531f6..51cccf098a7525e07cc7f4184430b90f21c1b686 100644 (file)
@@ -7595,20 +7595,25 @@ FEEvaluation<dim,
     }
   else
     {
-      if (this->mapping_data->jacobians[0].size() > 0)
+      if (this_jacobian_data.size() != this->n_quadrature_points)
         this_jacobian_data.resize_fast(this->n_quadrature_points);
 
-      if (this->mapping_data->JxW_values.size() > 0)
+      if (this_J_value_data.size() != this->n_quadrature_points)
         this_J_value_data.resize_fast(this->n_quadrature_points);
 
-      if (this->mapping_data->jacobian_gradients[0].size() > 0)
-        this_jacobian_gradients_data.resize_fast(this->n_quadrature_points);
+      const auto &update_flags_cells =
+        this->matrix_free->get_mapping_info().update_flags_cells;
 
-      if (this->mapping_data->jacobian_gradients_non_inverse[0].size() > 0)
-        this_jacobian_gradients_non_inverse_data.resize_fast(
-          this->n_quadrature_points);
+      if (update_flags_cells & update_jacobian_grads &&
+          this_jacobian_gradients_data.size() != this->n_quadrature_points)
+        {
+          this_jacobian_gradients_data.resize_fast(this->n_quadrature_points);
+          this_jacobian_gradients_non_inverse_data.resize_fast(
+            this->n_quadrature_points);
+        }
 
-      if (this->mapping_data->quadrature_points.size() > 0)
+      if (update_flags_cells & update_quadrature_points &&
+          this_quadrature_points_data.size() != this->n_quadrature_points)
         this_quadrature_points_data.resize_fast(this->n_quadrature_points);
     }
 
@@ -7690,34 +7695,35 @@ FEEvaluation<dim,
                   0 :
                   q;
 
-              if (this->mapping_data->JxW_values.size() > 0)
-                this_J_value_data[q][v] =
-                  this->mapping_data->JxW_values[offsets + q_src][lane];
-
-              if (this->mapping_data->jacobians[0].size() > 0)
-                for (unsigned int i = 0; i < dim; ++i)
-                  for (unsigned int j = 0; j < dim; ++j)
-                    this_jacobian_data[q][i][j][v] =
-                      this->mapping_data
-                        ->jacobians[0][offsets + q_src][i][j][lane];
-
-              if (this->mapping_data->jacobian_gradients[0].size() > 0)
-                for (unsigned int i = 0; i < dim * (dim + 1) / 2; ++i)
-                  for (unsigned int j = 0; j < dim; ++j)
-                    this_jacobian_gradients_data[q][i][j][v] =
-                      this->mapping_data
-                        ->jacobian_gradients[0][offsets + q_src][i][j][lane];
-
-              if (this->mapping_data->jacobian_gradients_non_inverse[0].size() >
-                  0)
-                for (unsigned int i = 0; i < dim * (dim + 1) / 2; ++i)
-                  for (unsigned int j = 0; j < dim; ++j)
-                    this_jacobian_gradients_non_inverse_data[q][i][j][v] =
-                      this->mapping_data
-                        ->jacobian_gradients_non_inverse[0][offsets + q_src][i]
-                                                        [j][lane];
-
-              if (this->mapping_data->quadrature_points.size() > 0)
+              this_J_value_data[q][v] =
+                this->mapping_data->JxW_values[offsets + q_src][lane];
+
+              for (unsigned int i = 0; i < dim; ++i)
+                for (unsigned int j = 0; j < dim; ++j)
+                  this_jacobian_data[q][i][j][v] =
+                    this->mapping_data
+                      ->jacobians[0][offsets + q_src][i][j][lane];
+
+              const auto &update_flags_cells =
+                this->matrix_free->get_mapping_info().update_flags_cells;
+
+              if (update_flags_cells & update_jacobian_grads)
+                {
+                  for (unsigned int i = 0; i < dim * (dim + 1) / 2; ++i)
+                    for (unsigned int j = 0; j < dim; ++j)
+                      this_jacobian_gradients_data[q][i][j][v] =
+                        this->mapping_data
+                          ->jacobian_gradients[0][offsets + q_src][i][j][lane];
+
+                  for (unsigned int i = 0; i < dim * (dim + 1) / 2; ++i)
+                    for (unsigned int j = 0; j < dim; ++j)
+                      this_jacobian_gradients_non_inverse_data[q][i][j][v] =
+                        this->mapping_data
+                          ->jacobian_gradients_non_inverse[0][offsets + q_src]
+                                                          [i][j][lane];
+                }
+
+              if (update_flags_cells & update_quadrature_points)
                 {
                   if (cell_type <=
                       internal::MatrixFreeFunctions::GeometryType::affine)

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.