]> https://gitweb.dealii.org/ - dealii.git/commitdiff
address comments
authorJiaqi Zhang <jiaqi2@clemson.edu>
Wed, 13 Apr 2022 14:32:22 +0000 (10:32 -0400)
committerJiaqi Zhang <jiaqi2@clemson.edu>
Wed, 13 Apr 2022 14:32:22 +0000 (10:32 -0400)
include/deal.II/fe/fe_interface_values.h
tests/feinterface/fe_interface_values_10.cc

index 543a8c8a4477367e616c3d4c3888d7d317da5199..3dd232ff742260d59f37cef28803421a14e683b0 100644 (file)
@@ -2844,16 +2844,8 @@ FEInterfaceValues<dim, spacedim>::get_jump_in_function_values(
 {
   AssertDimension(values.size(), n_quadrature_points);
 
-  std::vector<typename InputVector::value_type> values_0(n_quadrature_points);
-  std::vector<typename InputVector::value_type> values_1(n_quadrature_points);
-
-  get_fe_face_values(0).get_function_values(fe_function, values_0);
-  get_fe_face_values(1).get_function_values(fe_function, values_1);
-
-  for (unsigned int q = 0; q < n_quadrature_points; ++q)
-    {
-      values[q] = values_0[q] - values_1[q];
-    }
+  const FEValuesExtractors::Scalar scalar(0);
+  this->operator[](scalar).get_jump_in_function_values(fe_function, values);
 }
 
 
@@ -2868,18 +2860,9 @@ FEInterfaceValues<dim, spacedim>::get_jump_in_function_gradients(
 {
   AssertDimension(gradients.size(), n_quadrature_points);
 
-  std::vector<Tensor<1, spacedim, typename InputVector::value_type>>
-    gradients_0(n_quadrature_points);
-  std::vector<Tensor<1, spacedim, typename InputVector::value_type>>
-    gradients_1(n_quadrature_points);
-
-  get_fe_face_values(0).get_function_gradients(fe_function, gradients_0);
-  get_fe_face_values(1).get_function_gradients(fe_function, gradients_1);
-
-  for (unsigned int q = 0; q < n_quadrature_points; ++q)
-    {
-      gradients[q] = gradients_0[q] - gradients_1[q];
-    }
+  const FEValuesExtractors::Scalar scalar(0);
+  this->operator[](scalar).get_jump_in_function_gradients(fe_function,
+                                                          gradients);
 }
 
 
@@ -2894,18 +2877,8 @@ FEInterfaceValues<dim, spacedim>::get_jump_in_function_hessians(
 {
   AssertDimension(hessians.size(), n_quadrature_points);
 
-  std::vector<Tensor<2, spacedim, typename InputVector::value_type>> hessians_0(
-    n_quadrature_points);
-  std::vector<Tensor<2, spacedim, typename InputVector::value_type>> hessians_1(
-    n_quadrature_points);
-
-  get_fe_face_values(0).get_function_hessians(fe_function, hessians_0);
-  get_fe_face_values(1).get_function_hessians(fe_function, hessians_1);
-
-  for (unsigned int q = 0; q < n_quadrature_points; ++q)
-    {
-      hessians[q] = (hessians_0[q] - hessians_1[q]);
-    }
+  const FEValuesExtractors::Scalar scalar(0);
+  this->operator[](scalar).get_jump_in_function_hessians(fe_function, hessians);
 }
 
 
@@ -2920,20 +2893,9 @@ FEInterfaceValues<dim, spacedim>::get_jump_in_function_third_derivatives(
 {
   AssertDimension(third_derivatives.size(), n_quadrature_points);
 
-  std::vector<Tensor<3, spacedim, typename InputVector::value_type>>
-    third_derivatives_0(n_quadrature_points);
-  std::vector<Tensor<3, spacedim, typename InputVector::value_type>>
-    third_derivatives_1(n_quadrature_points);
-
-  get_fe_face_values(0).get_function_third_derivatives(fe_function,
-                                                       third_derivatives_0);
-  get_fe_face_values(1).get_function_third_derivatives(fe_function,
-                                                       third_derivatives_1);
-
-  for (unsigned int q = 0; q < n_quadrature_points; ++q)
-    {
-      third_derivatives[q] = (third_derivatives_0[q] - third_derivatives_1[q]);
-    }
+  const FEValuesExtractors::Scalar scalar(0);
+  this->operator[](scalar).get_jump_in_function_third_derivatives(
+    fe_function, third_derivatives);
 }
 
 
@@ -2947,16 +2909,8 @@ FEInterfaceValues<dim, spacedim>::get_average_of_function_values(
 {
   AssertDimension(values.size(), n_quadrature_points);
 
-  std::vector<typename InputVector::value_type> values_0(n_quadrature_points);
-  std::vector<typename InputVector::value_type> values_1(n_quadrature_points);
-
-  get_fe_face_values(0).get_function_values(fe_function, values_0);
-  get_fe_face_values(1).get_function_values(fe_function, values_1);
-
-  for (unsigned int q = 0; q < n_quadrature_points; ++q)
-    {
-      values[q] = (values_0[q] + values_1[q]) * 0.5;
-    }
+  const FEValuesExtractors::Scalar scalar(0);
+  this->operator[](scalar).get_average_of_function_values(fe_function, values);
 }
 
 
@@ -2971,18 +2925,9 @@ FEInterfaceValues<dim, spacedim>::get_average_of_function_gradients(
 {
   AssertDimension(gradients.size(), n_quadrature_points);
 
-  std::vector<Tensor<1, spacedim, typename InputVector::value_type>>
-    gradients_0(n_quadrature_points);
-  std::vector<Tensor<1, spacedim, typename InputVector::value_type>>
-    gradients_1(n_quadrature_points);
-
-  get_fe_face_values(0).get_function_gradients(fe_function, gradients_0);
-  get_fe_face_values(1).get_function_gradients(fe_function, gradients_1);
-
-  for (unsigned int q = 0; q < n_quadrature_points; ++q)
-    {
-      gradients[q] = (gradients_0[q] + gradients_1[q]) * 0.5;
-    }
+  const FEValuesExtractors::Scalar scalar(0);
+  this->operator[](scalar).get_average_of_function_gradients(fe_function,
+                                                             gradients);
 }
 
 
@@ -2997,18 +2942,9 @@ FEInterfaceValues<dim, spacedim>::get_average_of_function_hessians(
 {
   AssertDimension(hessians.size(), n_quadrature_points);
 
-  std::vector<Tensor<2, spacedim, typename InputVector::value_type>> hessians_0(
-    n_quadrature_points);
-  std::vector<Tensor<2, spacedim, typename InputVector::value_type>> hessians_1(
-    n_quadrature_points);
-
-  get_fe_face_values(0).get_function_hessians(fe_function, hessians_0);
-  get_fe_face_values(1).get_function_hessians(fe_function, hessians_1);
-
-  for (unsigned int q = 0; q < n_quadrature_points; ++q)
-    {
-      hessians[q] = (hessians_0[q] + hessians_1[q]) * 0.5;
-    }
+  const FEValuesExtractors::Scalar scalar(0);
+  this->operator[](scalar).get_average_of_function_hessians(fe_function,
+                                                            hessians);
 }
 
 
index a41c770636ccbf6e4fd0fdca36dcddd6a152a493..49bfccb7519917e8031747132609c15bc4004042 100644 (file)
@@ -161,7 +161,7 @@ test()
   std::vector<Tensor<3, dim>> average_of_3rd_derivatives(n_face_q_points);
   std::vector<Tensor<3, dim>> exact_average_of_3rd_derivatives(n_face_q_points);
 
-  const double tol = 1e-11;
+  const double tol = 1e-15;
 
   typename DoFHandler<dim>::active_cell_iterator cell =
     dof_handler.begin_active();
@@ -244,15 +244,13 @@ main(int argc, char **argv)
 {
   initlog();
 
-  Utilities::MPI::MPI_InitFinalize mpi_initialization(
-    argc, argv, testing_max_num_threads());
-
   deallog.push("Test jump in function values");
   {
     test_jump_function();
   }
   deallog.pop();
   deallog << "OK" << std::endl;
+
   deallog.push("Test all functions");
   {
     test();

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.