16 #ifndef dealii_fe_values_views_h
17 #define dealii_fe_values_views_h
32 #include <type_traits>
39 template <
int dim,
int spacedim = dim>
49 template <
int dim,
typename NumberType =
double>
58 template <
typename NumberType>
70 template <
typename NumberType>
82 template <
typename NumberType>
125 template <
int dim,
int spacedim = dim>
163 template <
typename Number>
172 template <
typename Number>
182 template <
typename Number>
192 template <
typename Number>
202 template <
typename Number>
290 value(const
unsigned int shape_function, const
unsigned int q_point) const;
304 const
unsigned int q_point) const;
318 const
unsigned int q_point) const;
332 const
unsigned int q_point) const;
351 template <typename Number>
390 template <class InputVector>
393 const InputVector &dof_values,
414 template <typename Number>
426 template <class InputVector>
429 const InputVector &dof_values,
450 template <typename Number>
462 template <class InputVector>
465 const InputVector &dof_values,
488 template <typename Number>
500 template <class InputVector>
503 const InputVector &dof_values,
526 template <typename Number>
539 template <class InputVector>
542 const InputVector &dof_values,
545 &third_derivatives) const;
597 template <
int dim,
int spacedim = dim>
643 using curl_type = typename ::internal::CurlType<spacedim>::type;
665 template <
typename Number>
674 template <
typename Number>
684 template <
typename Number>
694 template <
typename Number>
704 template <
typename Number>
714 template <
typename Number>
723 template <
typename Number>
733 template <
typename Number>
790 const unsigned int first_vector_component);
840 value(
const unsigned int shape_function,
const unsigned int q_point)
const;
857 const unsigned int q_point)
const;
876 const unsigned int q_point)
const;
890 const unsigned int q_point)
const;
913 curl(
const unsigned int shape_function,
const unsigned int q_point)
const;
927 const unsigned int q_point)
const;
941 const unsigned int q_point)
const;
960 template <
typename Number>
999 template <
class InputVector>
1002 const InputVector &dof_values,
1023 template <
typename Number>
1035 template <
class InputVector>
1038 const InputVector &dof_values,
1065 template <
typename Number>
1067 get_function_symmetric_gradients(
1070 &symmetric_gradients)
const;
1078 template <
class InputVector>
1080 get_function_symmetric_gradients_from_local_dof_values(
1081 const InputVector &dof_values,
1084 &symmetric_gradients)
const;
1104 template <
typename Number>
1106 get_function_divergences(
1116 template <
class InputVector>
1118 get_function_divergences_from_local_dof_values(
1119 const InputVector &dof_values,
1121 &divergences)
const;
1141 template <
typename Number>
1152 template <
class InputVector>
1154 get_function_curls_from_local_dof_values(
1155 const InputVector &dof_values,
1176 template <
typename Number>
1188 template <
class InputVector>
1191 const InputVector &dof_values,
1213 template <
typename Number>
1225 template <
class InputVector>
1228 const InputVector &dof_values,
1250 template <
typename Number>
1263 template <
class InputVector>
1266 const InputVector &dof_values,
1269 &third_derivatives)
const;
1290 template <
int rank,
int dim,
int spacedim = dim>
1315 template <
int dim,
int spacedim>
1344 template <
typename Number>
1353 template <
typename Number>
1362 struct ShapeFunctionData
1372 bool is_nonzero_shape_function_component
1373 [value_type::n_independent_components];
1384 unsigned int row_index[value_type::n_independent_components];
1417 const unsigned int first_tensor_component);
1462 value(const
unsigned int shape_function, const
unsigned int q_point) const;
1478 divergence(const
unsigned int shape_function,
1479 const
unsigned int q_point) const;
1498 template <typename Number>
1537 template <class InputVector>
1540 const InputVector &dof_values,
1565 template <typename Number>
1567 get_function_divergences(
1577 template <class InputVector>
1579 get_function_divergences_from_local_dof_values(
1580 const InputVector &dof_values,
1582 &divergences) const;
1594 unsigned int first_tensor_component;
1603 template <
int rank,
int dim,
int spacedim = dim>
1624 template <
int dim,
int spacedim>
1651 template <
typename Number>
1660 template <
typename Number>
1670 template <
typename Number>
1679 struct ShapeFunctionData
1689 bool is_nonzero_shape_function_component
1690 [value_type::n_independent_components];
1701 unsigned int row_index[value_type::n_independent_components];
1751 const unsigned int first_tensor_component);
1784 value(
const unsigned int shape_function,
const unsigned int q_point)
const;
1801 const unsigned int q_point)
const;
1818 const unsigned int q_point)
const;
1837 template <
typename Number>
1876 template <
class InputVector>
1879 const InputVector &dof_values,
1904 template <
typename Number>
1906 get_function_divergences(
1916 template <
class InputVector>
1918 get_function_divergences_from_local_dof_values(
1919 const InputVector &dof_values,
1921 &divergences)
const;
1939 template <
typename Number>
1951 template <
class InputVector>
1954 const InputVector &dof_values,
1987 template <
int dim,
int spacedim,
typename Extractor>
1998 template <
int dim,
int spacedim>
2001 using type = typename ::FEValuesViews::Scalar<dim, spacedim>;
2011 template <
int dim,
int spacedim>
2014 using type = typename ::FEValuesViews::Vector<dim, spacedim>;
2024 template <
int dim,
int spacedim,
int rank>
2027 using type = typename ::FEValuesViews::Tensor<rank, dim, spacedim>;
2037 template <
int dim,
int spacedim,
int rank>
2041 typename ::FEValuesViews::SymmetricTensor<rank, dim, spacedim>;
2051 template <
int dim,
int spacedim>
2058 std::vector<Lazy<::FEValuesViews::Scalar<dim, spacedim>>>
scalars;
2059 std::vector<Lazy<::FEValuesViews::Vector<dim, spacedim>>>
vectors;
2063 std::vector<Lazy<::FEValuesViews::Tensor<2, dim, spacedim>>>
2080 template <
int dim,
int spacedim,
typename Extractor>
2081 using View = typename ::internal::FEValuesViews::
2082 ViewType<dim, spacedim, Extractor>::type;
2091 template <
int dim,
int spacedim>
2094 const unsigned int q_point)
const
2100 "update_values"))));
2106 return fe_values->finite_element_output.shape_values(
2114 template <
int dim,
int spacedim>
2117 const unsigned int q_point)
const
2122 "update_gradients")));
2137 template <
int dim,
int spacedim>
2140 const unsigned int q_point)
const
2145 "update_hessians")));
2159 template <
int dim,
int spacedim>
2162 const unsigned int q_point)
const
2167 "update_3rd_derivatives")));
2182 template <
int dim,
int spacedim>
2185 const unsigned int q_point)
const
2201 .single_nonzero_component_index] =
2202 fe_values->finite_element_output.shape_values(snc, q_point);
2203 return return_value;
2208 for (
unsigned int d = 0;
d < dim; ++
d)
2210 .is_nonzero_shape_function_component[
d])
2211 return_value[
d] =
fe_values->finite_element_output.shape_values(
2214 return return_value;
2220 template <
int dim,
int spacedim>
2223 const unsigned int q_point)
const
2228 "update_gradients")));
2239 .single_nonzero_component_index] =
2240 fe_values->finite_element_output.shape_gradients[snc][q_point];
2241 return return_value;
2246 for (
unsigned int d = 0;
d < dim; ++
d)
2248 .is_nonzero_shape_function_component[
d])
2250 fe_values->finite_element_output.shape_gradients
2253 return return_value;
2259 template <
int dim,
int spacedim>
2262 const unsigned int q_point)
const
2268 "update_gradients")));
2274 return divergence_type();
2278 .single_nonzero_component_index];
2281 divergence_type return_value = 0;
2282 for (
unsigned int d = 0;
d < dim; ++
d)
2284 .is_nonzero_shape_function_component[
d])
2286 fe_values->finite_element_output.shape_gradients
2289 return return_value;
2295 template <
int dim,
int spacedim>
2298 const unsigned int q_point)
const
2305 "update_gradients")));
2320 "Computing the curl in 1d is not a useful operation"));
2328 curl_type return_value;
2332 .single_nonzero_component_index == 0)
2335 .shape_gradients[snc][q_point][1];
2337 return_value[0] =
fe_values->finite_element_output
2338 .shape_gradients[snc][q_point][0];
2340 return return_value;
2345 curl_type return_value;
2347 return_value[0] = 0.0;
2350 .is_nonzero_shape_function_component[0])
2354 .row_index[0]][q_point][1];
2357 .is_nonzero_shape_function_component[1])
2361 .row_index[1]][q_point][0];
2363 return return_value;
2371 curl_type return_value;
2374 .single_nonzero_component_index)
2378 return_value[0] = 0;
2379 return_value[1] =
fe_values->finite_element_output
2380 .shape_gradients[snc][q_point][2];
2383 .shape_gradients[snc][q_point][1];
2384 return return_value;
2391 .shape_gradients[snc][q_point][2];
2392 return_value[1] = 0;
2393 return_value[2] =
fe_values->finite_element_output
2394 .shape_gradients[snc][q_point][0];
2395 return return_value;
2400 return_value[0] =
fe_values->finite_element_output
2401 .shape_gradients[snc][q_point][1];
2404 .shape_gradients[snc][q_point][0];
2405 return_value[2] = 0;
2406 return return_value;
2413 curl_type return_value;
2415 for (
unsigned int i = 0; i < dim; ++i)
2416 return_value[i] = 0.0;
2419 .is_nonzero_shape_function_component[0])
2424 .row_index[0]][q_point][2];
2428 .row_index[0]][q_point][1];
2432 .is_nonzero_shape_function_component[1])
2437 .row_index[1]][q_point][2];
2441 .row_index[1]][q_point][0];
2445 .is_nonzero_shape_function_component[2])
2450 .row_index[2]][q_point][1];
2454 .row_index[2]][q_point][0];
2457 return return_value;
2468 template <
int dim,
int spacedim>
2471 const unsigned int q_point)
const
2477 "update_hessians")));
2488 .single_nonzero_component_index] =
2489 fe_values->finite_element_output.shape_hessians[snc][q_point];
2490 return return_value;
2495 for (
unsigned int d = 0;
d < dim; ++
d)
2497 .is_nonzero_shape_function_component[
d])
2499 fe_values->finite_element_output.shape_hessians
2502 return return_value;
2508 template <
int dim,
int spacedim>
2511 const unsigned int q_point)
const
2517 "update_3rd_derivatives")));
2528 .single_nonzero_component_index] =
2529 fe_values->finite_element_output.shape_3rd_derivatives[snc][q_point];
2530 return return_value;
2535 for (
unsigned int d = 0;
d < dim; ++
d)
2537 .is_nonzero_shape_function_component[
d])
2539 fe_values->finite_element_output.shape_3rd_derivatives
2542 return return_value;
2554 inline ::SymmetricTensor<2, 1>
2555 symmetrize_single_row(
const unsigned int n, const ::Tensor<1, 1> &t)
2565 inline ::SymmetricTensor<2, 2>
2566 symmetrize_single_row(
const unsigned int n, const ::Tensor<1, 2> &t)
2572 return {{t[0], 0, t[1] / 2}};
2576 return {{0, t[1], t[0] / 2}};
2588 inline ::SymmetricTensor<2, 3>
2589 symmetrize_single_row(
const unsigned int n, const ::Tensor<1, 3> &t)
2595 return {{t[0], 0, 0, t[1] / 2, t[2] / 2, 0}};
2599 return {{0, t[1], 0, t[0] / 2, 0, t[2] / 2}};
2603 return {{0, 0, t[2], 0, t[0] / 2, t[1] / 2}};
2616 template <
int dim,
int spacedim>
2619 const unsigned int q_point)
const
2624 "update_gradients")));
2630 return symmetric_gradient_type();
2632 return internal::symmetrize_single_row(
2634 fe_values->finite_element_output.shape_gradients[snc][q_point]);
2638 for (
unsigned int d = 0;
d < dim; ++
d)
2640 .is_nonzero_shape_function_component[
d])
2642 fe_values->finite_element_output.shape_gradients
2651 template <
int dim,
int spacedim>
2654 const unsigned int q_point)
const
2674 const unsigned int comp =
2676 return_value[value_type::unrolled_to_component_indices(comp)] =
2677 fe_values->finite_element_output.shape_values(snc, q_point);
2678 return return_value;
2683 for (
unsigned int d = 0;
d < value_type::n_independent_components; ++
d)
2685 .is_nonzero_shape_function_component[
d])
2686 return_value[value_type::unrolled_to_component_indices(
d)] =
2687 fe_values->finite_element_output.shape_values(
2689 return return_value;
2695 template <
int dim,
int spacedim>
2698 const unsigned int shape_function,
2699 const unsigned int q_point)
const
2704 "update_gradients")));
2712 return divergence_type();
2735 const unsigned int comp =
2737 const unsigned int ii =
2738 value_type::unrolled_to_component_indices(comp)[0];
2739 const unsigned int jj =
2740 value_type::unrolled_to_component_indices(comp)[1];
2753 const ::Tensor<1, spacedim> &phi_grad =
2754 fe_values->finite_element_output.shape_gradients[snc][q_point];
2756 divergence_type return_value;
2757 return_value[ii] = phi_grad[jj];
2760 return_value[jj] = phi_grad[ii];
2762 return return_value;
2767 divergence_type return_value;
2768 return return_value;
2774 template <
int dim,
int spacedim>
2777 const unsigned int q_point)
const
2797 const unsigned int comp =
2801 return_value[indices] =
2802 fe_values->finite_element_output.shape_values(snc, q_point);
2803 return return_value;
2808 for (
unsigned int d = 0;
d < dim * dim; ++
d)
2810 .is_nonzero_shape_function_component[
d])
2814 return_value[indices] =
2815 fe_values->finite_element_output.shape_values(
2818 return return_value;
2824 template <
int dim,
int spacedim>
2827 const unsigned int q_point)
const
2832 "update_gradients")));
2840 return divergence_type();
2854 const unsigned int comp =
2858 const unsigned int ii = indices[0];
2859 const unsigned int jj = indices[1];
2861 const ::Tensor<1, spacedim> &phi_grad =
2862 fe_values->finite_element_output.shape_gradients[snc][q_point];
2864 divergence_type return_value;
2866 return_value[ii] = phi_grad[jj];
2868 return return_value;
2873 divergence_type return_value;
2874 return return_value;
2880 template <
int dim,
int spacedim>
2883 const unsigned int q_point)
const
2888 "update_gradients")));
2910 const unsigned int comp =
2914 const unsigned int ii = indices[0];
2915 const unsigned int jj = indices[1];
2917 const ::Tensor<1, spacedim> &phi_grad =
2918 fe_values->finite_element_output.shape_gradients[snc][q_point];
2921 return_value[ii][jj] = phi_grad;
2923 return return_value;
2929 return return_value;
typename ProductType< Number, hessian_type >::type solution_hessian_type
value_type value(const unsigned int shape_function, const unsigned int q_point) const
void get_function_values_from_local_dof_values(const InputVector &dof_values, std::vector< solution_value_type< typename InputVector::value_type >> &values) const
void get_function_gradients_from_local_dof_values(const InputVector &dof_values, std::vector< solution_gradient_type< typename InputVector::value_type >> &gradients) const
gradient_type gradient(const unsigned int shape_function, const unsigned int q_point) const
std::vector< ShapeFunctionData > shape_function_data
::Tensor< 1, spacedim > gradient_type
typename ProductType< Number, value_type >::type solution_laplacian_type
void get_function_third_derivatives(const ReadVector< Number > &fe_function, std::vector< solution_third_derivative_type< Number >> &third_derivatives) const
third_derivative_type third_derivative(const unsigned int shape_function, const unsigned int q_point) const
void get_function_gradients(const ReadVector< Number > &fe_function, std::vector< solution_gradient_type< Number >> &gradients) const
typename ProductType< Number, third_derivative_type >::type solution_third_derivative_type
typename ProductType< Number, value_type >::type solution_value_type
::Tensor< 2, spacedim > hessian_type
typename ProductType< Number, gradient_type >::type solution_gradient_type
void get_function_laplacians(const ReadVector< Number > &fe_function, std::vector< solution_laplacian_type< Number >> &laplacians) const
void get_function_hessians_from_local_dof_values(const InputVector &dof_values, std::vector< solution_hessian_type< typename InputVector::value_type >> &hessians) const
Scalar & operator=(const Scalar< dim, spacedim > &)=delete
SmartPointer< const FEValuesBase< dim, spacedim > > fe_values
void get_function_values(const ReadVector< Number > &fe_function, std::vector< solution_value_type< Number >> &values) const
Scalar(Scalar< dim, spacedim > &&)=default
void get_function_hessians(const ReadVector< Number > &fe_function, std::vector< solution_hessian_type< Number >> &hessians) const
void get_function_laplacians_from_local_dof_values(const InputVector &dof_values, std::vector< solution_laplacian_type< typename InputVector::value_type >> &laplacians) const
Scalar(const Scalar< dim, spacedim > &)=delete
hessian_type hessian(const unsigned int shape_function, const unsigned int q_point) const
Scalar & operator=(Scalar< dim, spacedim > &&) noexcept=default
void get_function_third_derivatives_from_local_dof_values(const InputVector &dof_values, std::vector< solution_third_derivative_type< typename InputVector::value_type >> &third_derivatives) const
::Tensor< 3, spacedim > third_derivative_type
SymmetricTensor(const SymmetricTensor< 2, dim, spacedim > &)=delete
SymmetricTensor(SymmetricTensor< 2, dim, spacedim > &&)=default
SymmetricTensor & operator=(const SymmetricTensor< 2, dim, spacedim > &)=delete
SymmetricTensor & operator=(SymmetricTensor< 2, dim, spacedim > &&) noexcept=default
typename ProductType< Number, value_type >::type solution_value_type
typename ProductType< Number, divergence_type >::type solution_divergence_type
typename ProductType< Number, value_type >::type solution_value_type
typename ProductType< Number, divergence_type >::type solution_divergence_type
typename ProductType< Number, gradient_type >::type solution_gradient_type
divergence_type divergence(const unsigned int shape_function, const unsigned int q_point) const
unsigned int first_tensor_component
Tensor(const Tensor< 2, dim, spacedim > &)=delete
SmartPointer< const FEValuesBase< dim, spacedim > > fe_values
value_type value(const unsigned int shape_function, const unsigned int q_point) const
gradient_type gradient(const unsigned int shape_function, const unsigned int q_point) const
Tensor(Tensor< 2, dim, spacedim > &&)=default
std::vector< ShapeFunctionData > shape_function_data
Tensor & operator=(const Tensor< 2, dim, spacedim > &)=delete
Tensor & operator=(Tensor< 2, dim, spacedim > &&)=default
Vector & operator=(Vector< dim, spacedim > &&)=default
typename ProductType< Number, third_derivative_type >::type solution_third_derivative_type
typename ProductType< Number, divergence_type >::type solution_divergence_type
Vector(const Vector< dim, spacedim > &)=delete
unsigned int first_vector_component
hessian_type hessian(const unsigned int shape_function, const unsigned int q_point) const
typename ProductType< Number, hessian_type >::type solution_hessian_type
Vector & operator=(const Vector< dim, spacedim > &)=delete
typename ProductType< Number, symmetric_gradient_type >::type solution_symmetric_gradient_type
gradient_type gradient(const unsigned int shape_function, const unsigned int q_point) const
divergence_type divergence(const unsigned int shape_function, const unsigned int q_point) const
third_derivative_type third_derivative(const unsigned int shape_function, const unsigned int q_point) const
typename ProductType< Number, gradient_type >::type solution_gradient_type
typename ProductType< Number, value_type >::type solution_value_type
symmetric_gradient_type symmetric_gradient(const unsigned int shape_function, const unsigned int q_point) const
Vector(Vector< dim, spacedim > &&)=default
typename ::internal::CurlType< spacedim >::type curl_type
typename ProductType< Number, curl_type >::type solution_curl_type
std::vector< ShapeFunctionData > shape_function_data
value_type value(const unsigned int shape_function, const unsigned int q_point) const
curl_type curl(const unsigned int shape_function, const unsigned int q_point) const
typename ProductType< Number, value_type >::type solution_laplacian_type
SmartPointer< const FEValuesBase< dim, spacedim > > fe_values
static constexpr TableIndices< rank_ > unrolled_to_component_indices(const unsigned int i)
typename Tensor< rank_ - 1, dim, Number >::tensor_type value_type
#define DEAL_II_NAMESPACE_OPEN
#define DEAL_II_NAMESPACE_CLOSE
static ::ExceptionBase & ExcInternalError()
#define Assert(cond, exc)
static ::ExceptionBase & ExcNotImplemented()
#define AssertIndexRange(index, range)
static ::ExceptionBase & ExcMessage(std::string arg1)
@ update_hessians
Second derivatives of shape functions.
@ update_values
Shape function values.
@ update_3rd_derivatives
Third derivatives of shape functions.
@ update_gradients
Shape function gradients.
typename ::internal::FEValuesViews::ViewType< dim, spacedim, Extractor >::type View
SymmetricTensor< 2, dim, Number > d(const Tensor< 2, dim, Number > &F, const Tensor< 2, dim, Number > &dF_dt)
bool is_nonzero_shape_function_component
int single_nonzero_component
unsigned int single_nonzero_component_index
unsigned int single_nonzero_component_index
int single_nonzero_component
int single_nonzero_component
unsigned int single_nonzero_component_index
typename internal::ProductTypeImpl< std::decay_t< T >, std::decay_t< U > >::type type
std::vector< Lazy<::FEValuesViews::Vector< dim, spacedim > > > vectors
std::vector< Lazy<::FEValuesViews::SymmetricTensor< 2, dim, spacedim > > > symmetric_second_order_tensors
std::vector< Lazy<::FEValuesViews::Tensor< 2, dim, spacedim > > > second_order_tensors
std::vector< Lazy<::FEValuesViews::Scalar< dim, spacedim > > > scalars
constexpr DEAL_II_HOST SymmetricTensor< 2, dim, Number > symmetrize(const Tensor< 2, dim, Number > &t)