17#ifndef dealii_matrix_free_fe_evaluation_h
18#define dealii_matrix_free_fe_evaluation_h
93 typename VectorizedArrayType>
143 template <
typename VectorType>
146 const unsigned int first_index = 0,
147 const std::bitset<VectorizedArrayType::size()> &mask =
148 std::bitset<VectorizedArrayType::size()>().flip());
178 template <
typename VectorType>
181 const unsigned int first_index = 0,
182 const std::bitset<VectorizedArrayType::size()> &mask =
183 std::bitset<VectorizedArrayType::size()>().flip());
216 template <
typename VectorType>
220 const unsigned int first_index = 0,
221 const std::bitset<VectorizedArrayType::size()> &mask =
222 std::bitset<VectorizedArrayType::size()>().flip())
const;
262 template <
typename VectorType>
265 const unsigned int first_index = 0,
266 const std::bitset<VectorizedArrayType::size()> &mask =
267 std::bitset<VectorizedArrayType::size()>().flip())
const;
272 template <
typename VectorType>
276 const unsigned int first_index = 0,
277 const std::bitset<VectorizedArrayType::size()> &mask =
278 std::bitset<VectorizedArrayType::size()>().flip())
const;
413 const unsigned int q_point);
501 Tensor<1, (dim == 2 ? 1 : dim), VectorizedArrayType>
521 const unsigned int q_point);
542 const unsigned int q_point);
558 const unsigned int q_point);
600 const unsigned int dof_no,
603 const unsigned int fe_degree,
604 const unsigned int n_q_points,
608 const unsigned int face_type);
682 template <
typename VectorType,
typename VectorOperation>
686 const std::array<VectorType *, n_components_> &vectors,
689 n_components_> & vectors_sm,
690 const std::bitset<VectorizedArrayType::size()> &mask,
691 const bool apply_constraints =
true)
const;
700 template <
typename VectorType,
typename VectorOperation>
704 const std::array<VectorType *, n_components_> &vectors,
707 n_components_> & vectors_sm,
708 const std::bitset<VectorizedArrayType::size()> &mask)
const;
717 template <
typename VectorType,
typename VectorOperation>
721 const std::array<VectorType *, n_components_> &vectors)
const;
767 std::is_same<Number, typename VectorizedArrayType::value_type>::value,
768 "Type of Number and of VectorizedArrayType do not match.");
790 const unsigned int dof_no,
793 const unsigned int fe_degree,
794 const unsigned int n_q_points,
834template <
int dim,
typename Number,
bool is_face,
typename VectorizedArrayType>
839 std::is_same<Number, typename VectorizedArrayType::value_type>::value,
840 "Type of Number and of VectorizedArrayType do not match.");
880 const unsigned int q_point);
905 const unsigned int q_point);
947 const unsigned int dof_no,
950 const unsigned int fe_degree,
951 const unsigned int n_q_points,
992template <
int dim,
typename Number,
bool is_face,
typename VectorizedArrayType>
997 std::is_same<Number, typename VectorizedArrayType::value_type>::value,
998 "Type of Number and of VectorizedArrayType do not match.");
1041 Tensor<1, (dim == 2 ? 1 : dim), VectorizedArrayType>
1061 const unsigned int q_point);
1080 const unsigned int q_point);
1092 const unsigned int q_point);
1105 const unsigned int q_point);
1113 const unsigned int q_point);
1125 const unsigned int dof_no,
1128 const unsigned int dofs_per_cell,
1129 const unsigned int n_q_points,
1168template <
typename Number,
bool is_face,
typename VectorizedArrayType>
1173 std::is_same<Number, typename VectorizedArrayType::value_type>::value,
1174 "Type of Number and of VectorizedArrayType do not match.");
1250 const unsigned int q_point);
1257 const unsigned int q_point);
1264 const unsigned int q_point);
1306 const unsigned int dof_no,
1309 const unsigned int fe_degree,
1310 const unsigned int n_q_points,
1910 typename VectorizedArrayType>
1915 VectorizedArrayType>
1918 std::is_same<Number, typename VectorizedArrayType::value_type>::value,
1919 "Type of Number and of VectorizedArrayType do not match.");
2041 const unsigned int dof_no = 0,
2042 const unsigned int quad_no = 0,
2055 const std::pair<unsigned int, unsigned int> & range,
2056 const unsigned int dof_no = 0,
2057 const unsigned int quad_no = 0,
2167 template <
bool level_dof_access>
2189 const unsigned int given_n_q_points_1d);
2209 const bool evaluate_gradients,
2210 const bool evaluate_hessians =
false);
2234 const bool evaluate_values,
2235 const bool evaluate_gradients,
2236 const bool evaluate_hessians =
false);
2251 template <
typename VectorType>
2259 template <
typename VectorType>
2262 const bool evaluate_values,
2263 const bool evaluate_gradients,
2264 const bool evaluate_hessians =
false);
2283 integrate(
const bool integrate_values,
const bool integrate_gradients);
2298 VectorizedArrayType * values_array,
2299 const bool sum_into_values =
false);
2306 const bool integrate_gradients,
2307 VectorizedArrayType *values_array);
2322 template <
typename VectorType>
2325 VectorType & output_vector);
2330 template <
typename VectorType>
2333 const bool integrate_gradients,
2334 VectorType &output_vector);
2418 int n_q_points_1d = fe_degree + 1,
2419 int n_components_ = 1,
2420 typename Number = double,
2426 VectorizedArrayType>
2429 std::is_same<Number, typename VectorizedArrayType::value_type>::value,
2430 "Type of Number and of VectorizedArrayType do not match.");
2569 const unsigned int dof_no = 0,
2570 const unsigned int quad_no = 0,
2585 const std::pair<unsigned int, unsigned int> & range,
2587 const unsigned int dof_no = 0,
2588 const unsigned int quad_no = 0,
2602 reinit(
const unsigned int face_batch_number);
2612 reinit(
const unsigned int cell_batch_number,
const unsigned int face_number);
2619 const unsigned int given_n_q_points_1d);
2638 evaluate(
const bool evaluate_values,
const bool evaluate_gradients);
2661 const bool evaluate_values,
2662 const bool evaluate_gradients);
2675 template <
typename VectorType>
2683 template <
typename VectorType>
2686 const bool evaluate_values,
2687 const bool evaluate_gradients);
2705 integrate(
const bool integrate_values,
const bool integrate_gradients);
2717 VectorizedArrayType * values_array);
2724 const bool integrate_gradients,
2725 VectorizedArrayType *values_array);
2738 template <
typename VectorType>
2741 VectorType & output_vector);
2746 template <
typename VectorType>
2749 const bool integrate_gradients,
2750 VectorType &output_vector);
2812 namespace MatrixFreeFunctions
2816 template <
int dim,
int degree>
2825 template <
int degree>
2828 static constexpr unsigned int value = degree + 1;
2844 template <
bool is_face,
2847 typename VectorizedArrayType>
2850 extract_initialization_data(
2852 const unsigned int dof_no,
2853 const unsigned int first_selected_component,
2854 const unsigned int quad_no,
2855 const unsigned int fe_degree,
2856 const unsigned int n_q_points,
2857 const unsigned int active_fe_index_given,
2858 const unsigned int active_quad_index_given,
2859 const unsigned int face_type)
2862 InitializationData init_data;
2866 &internal::MatrixFreeFunctions::
2867 MappingInfoCellsOrFaces<dim, Number, is_face, VectorizedArrayType>::get(
2875 active_fe_index_given :
2880 active_quad_index_given :
2911 typename VectorizedArrayType>
2916 VectorizedArrayType>::
2919 const unsigned int dof_no,
2920 const unsigned int first_selected_component,
2921 const unsigned int quad_no,
2922 const unsigned int fe_degree,
2923 const unsigned int n_q_points,
2924 const bool is_interior_face,
2925 const unsigned int active_fe_index,
2926 const unsigned int active_quad_index,
2927 const unsigned int face_type)
2929 internal::extract_initialization_data<is_face>(matrix_free,
2931 first_selected_component,
2940 first_selected_component)
2941 , scratch_data_array(matrix_free.acquire_scratch_data())
2942 , matrix_free(&matrix_free)
2944 this->set_data_pointers(scratch_data_array, n_components_);
2946 this->dof_info->start_components.back() == 1 ||
2947 static_cast<int>(n_components_) <=
2949 this->dof_info->start_components
2950 [this->dof_info->component_to_base_index[first_selected_component] +
2952 first_selected_component,
2954 "You tried to construct a vector-valued evaluator with " +
2955 std::to_string(n_components) +
2956 " components. However, "
2957 "the current base element has only " +
2959 this->dof_info->start_components
2960 [this->dof_info->component_to_base_index[first_selected_component] +
2962 first_selected_component) +
2963 " components left when starting from local element index " +
2965 first_selected_component -
2966 this->dof_info->start_components
2967 [this->dof_info->component_to_base_index[first_selected_component]]) +
2968 " (global index " + std::to_string(first_selected_component) +
")"));
2980 typename VectorizedArrayType>
2985 VectorizedArrayType>::
2991 const unsigned int first_selected_component,
2995 other->mapped_geometry->get_quadrature() == quadrature ?
2996 other->mapped_geometry :
2998 MappingDataOnTheFly<dim, VectorizedArrayType>>(
3003 first_selected_component)
3004 , scratch_data_array(new
AlignedVector<VectorizedArrayType>())
3005 , matrix_free(nullptr)
3007 const unsigned int base_element_number =
3011 first_selected_component >=
3013 ExcMessage(
"The underlying element must at least contain as many "
3014 "components as requested by this class"));
3015 (void)base_element_number;
3020 Quadrature<(is_face ? dim - 1 : dim)>(quadrature),
3022 fe.component_to_base_index(first_selected_component).
first);
3024 this->set_data_pointers(scratch_data_array, n_components_);
3033 typename VectorizedArrayType>
3038 VectorizedArrayType>::
3043 VectorizedArrayType> &other)
3045 , scratch_data_array(other.matrix_free == nullptr ?
3047 other.matrix_free->acquire_scratch_data())
3048 , matrix_free(other.matrix_free)
3050 if (other.matrix_free ==
nullptr)
3058 this->mapped_geometry =
3059 std::make_shared<internal::MatrixFreeFunctions::
3060 MappingDataOnTheFly<dim, VectorizedArrayType>>(
3064 this->mapping_data = &this->mapped_geometry->get_data_storage();
3068 this->mapped_geometry->get_data_storage().jacobians[0].begin();
3070 this->mapped_geometry->get_data_storage().JxW_values.begin();
3071 this->jacobian_gradients =
3072 this->mapped_geometry->get_data_storage().jacobian_gradients[0].begin();
3073 this->jacobian_gradients_non_inverse =
3074 this->mapped_geometry->get_data_storage()
3075 .jacobian_gradients_non_inverse[0]
3078 this->mapped_geometry->get_data_storage().quadrature_points.begin();
3081 this->set_data_pointers(scratch_data_array, n_components_);
3090 typename VectorizedArrayType>
3095 VectorizedArrayType> &
3101 VectorizedArrayType> &other)
3104 if (matrix_free ==
nullptr)
3107 delete scratch_data_array;
3116 matrix_free = other.matrix_free;
3118 if (other.matrix_free ==
nullptr)
3127 this->mapped_geometry =
3128 std::make_shared<internal::MatrixFreeFunctions::
3129 MappingDataOnTheFly<dim, VectorizedArrayType>>(
3134 this->mapping_data = &this->mapped_geometry->get_data_storage();
3136 this->mapped_geometry->get_data_storage().jacobians[0].begin();
3138 this->mapped_geometry->get_data_storage().JxW_values.begin();
3139 this->jacobian_gradients =
3140 this->mapped_geometry->get_data_storage().jacobian_gradients[0].begin();
3141 this->jacobian_gradients_non_inverse =
3142 this->mapped_geometry->get_data_storage()
3143 .jacobian_gradients_non_inverse[0]
3146 this->mapped_geometry->get_data_storage().quadrature_points.begin();
3153 this->set_data_pointers(scratch_data_array, n_components_);
3164 typename VectorizedArrayType>
3169 VectorizedArrayType>::~FEEvaluationBase()
3171 if (matrix_free !=
nullptr)
3182 delete scratch_data_array;
3193 typename VectorizedArrayType>
3198 Assert(matrix_free !=
nullptr,
3200 "FEEvaluation was not initialized with a MatrixFree object!"));
3201 return *matrix_free;
3210 template <
typename VectorType,
bool>
3211 struct ConstBlockVectorSelector;
3213 template <
typename VectorType>
3214 struct ConstBlockVectorSelector<VectorType, true>
3216 using BaseVectorType =
const typename VectorType::BlockType;
3219 template <
typename VectorType>
3220 struct ConstBlockVectorSelector<VectorType, false>
3222 using BaseVectorType =
typename VectorType::BlockType;
3228 template <
typename VectorType,
bool>
3229 struct BlockVectorSelector;
3231 template <
typename VectorType>
3232 struct BlockVectorSelector<VectorType, true>
3234 using BaseVectorType =
typename ConstBlockVectorSelector<
3236 std::is_const<VectorType>::value>::BaseVectorType;
3238 static BaseVectorType *
3239 get_vector_component(VectorType &vec,
const unsigned int component)
3242 return &vec.block(component);
3246 template <
typename VectorType>
3247 struct BlockVectorSelector<VectorType, false>
3249 using BaseVectorType = VectorType;
3251 static BaseVectorType *
3252 get_vector_component(VectorType &vec,
const unsigned int component)
3271 template <
typename VectorType>
3272 struct BlockVectorSelector<
std::vector<VectorType>, false>
3274 using BaseVectorType = VectorType;
3276 static BaseVectorType *
3277 get_vector_component(std::vector<VectorType> &vec,
3278 const unsigned int component)
3281 return &vec[component];
3285 template <
typename VectorType>
3286 struct BlockVectorSelector<const
std::vector<VectorType>, false>
3288 using BaseVectorType =
const VectorType;
3290 static const BaseVectorType *
3291 get_vector_component(
const std::vector<VectorType> &vec,
3292 const unsigned int component)
3295 return &vec[component];
3299 template <
typename VectorType>
3300 struct BlockVectorSelector<
std::vector<VectorType *>, false>
3302 using BaseVectorType = VectorType;
3304 static BaseVectorType *
3305 get_vector_component(std::vector<VectorType *> &vec,
3306 const unsigned int component)
3309 return vec[component];
3313 template <
typename VectorType>
3314 struct BlockVectorSelector<const
std::vector<VectorType *>, false>
3316 using BaseVectorType =
const VectorType;
3318 static const BaseVectorType *
3319 get_vector_component(
const std::vector<VectorType *> &vec,
3320 const unsigned int component)
3323 return vec[component];
3334 typename VectorizedArrayType>
3335template <
typename VectorType,
typename VectorOperation>
3340 const std::array<VectorType *, n_components_> &src,
3343 n_components_> & src_sm,
3344 const std::bitset<VectorizedArrayType::size()> &
mask,
3345 const bool apply_constraints)
const
3350 if (this->matrix_free ==
nullptr)
3352 read_write_operation_global(operation, src);
3359 if (this->n_fe_components == 1)
3360 for (
unsigned int comp = 0; comp < n_components; ++comp)
3362 Assert(src[comp] !=
nullptr,
3363 ExcMessage(
"The finite element underlying this FEEvaluation "
3364 "object is scalar, but you requested " +
3365 std::to_string(n_components) +
3366 " components via the template argument in "
3367 "FEEvaluation. In that case, you must pass an "
3368 "std::vector<VectorType> or a BlockVector to " +
3369 "read_dof_values and distribute_local_to_global."));
3389 bool is_contiguous =
true;
3391 if (is_face && !this->interior_face &&
3392 (this->dof_access_index ==
3395 const std::array<
unsigned int, VectorizedArrayType::size()> &cells =
3396 this->get_cell_ids();
3397 const unsigned int n_filled_lanes =
3402 for (
unsigned int v = 0; v < n_filled_lanes; ++v)
3403 if (
mask[v] ==
true &&
3406 [cells[v] / VectorizedArrayType::size()] <
3409 is_contiguous = false;
3413 this->dof_access_index :
3414 internal::MatrixFreeFunctions::DoFInfo::dof_access_cell]
3415 [this->cell] <
internal::MatrixFreeFunctions::DoFInfo::
3416 IndexStorageVariants::contiguous)
3418 is_contiguous =
false;
3423 read_write_operation_contiguous(operation, src, src_sm,
mask);
3430 constexpr unsigned int n_lanes = VectorizedArrayType::size();
3432 std::array<
unsigned int, VectorizedArrayType::size()> cells =
3433 this->get_cell_ids();
3435 const bool masking_is_active =
mask.count() < n_lanes;
3436 if (masking_is_active)
3437 for (
unsigned int v = 0; v < n_lanes; ++v)
3438 if (
mask[v] ==
false)
3441 bool has_hn_constraints =
false;
3443 if (is_face ==
false)
3449 [this->first_selected_component])
3450 for (
unsigned int v = 0; v < n_lanes; ++v)
3455 has_hn_constraints = true;
3458 std::integral_constant<
bool,
3459 internal::is_vectorizable<VectorType, Number>::value>
3462 const bool use_vectorized_path = !(masking_is_active || has_hn_constraints);
3464 const std::size_t dofs_per_component = this->data->dofs_per_component_on_cell;
3465 std::array<VectorizedArrayType *, n_components> values_dofs;
3466 for (
unsigned int c = 0; c < n_components; ++c)
3467 values_dofs[c] =
const_cast<VectorizedArrayType *
>(this->values_dofs) +
3468 c * dofs_per_component;
3472 [is_face ? this->dof_access_index :
3473 internal::MatrixFreeFunctions::DoFInfo::dof_access_cell]
3474 [this->cell] ==
internal::MatrixFreeFunctions::DoFInfo::
3475 IndexStorageVariants::interleaved &&
3476 use_vectorized_path)
3478 const unsigned int *dof_indices =
3480 dof_info.
row_starts[this->cell * this->n_fe_components * n_lanes]
3484 [this->first_selected_component] *
3486 if (n_components == 1 || this->n_fe_components == 1)
3487 for (
unsigned int i = 0; i < dofs_per_component;
3488 ++i, dof_indices += n_lanes)
3489 for (
unsigned int comp = 0; comp < n_components; ++comp)
3490 operation.process_dof_gather(dof_indices,
3493 values_dofs[comp][i],
3496 for (
unsigned int comp = 0; comp < n_components; ++comp)
3497 for (
unsigned int i = 0; i < dofs_per_component;
3498 ++i, dof_indices += n_lanes)
3499 operation.process_dof_gather(
3500 dof_indices, *src[0], 0, values_dofs[comp][i], vector_selector);
3506 std::array<const unsigned int *, n_lanes> dof_indices;
3507 dof_indices.fill(
nullptr);
3512 bool has_constraints =
false;
3513 const unsigned int n_components_read =
3514 this->n_fe_components > 1 ? n_components : 1;
3518 for (
unsigned int v = 0; v < n_lanes; ++v)
3524 const std::pair<unsigned int, unsigned int> *my_index_start =
3525 &dof_info.
row_starts[cells[v] * this->n_fe_components +
3526 this->first_selected_component];
3531 if (my_index_start[n_components_read].
second !=
3532 my_index_start[0].
second)
3533 has_constraints =
true;
3536 dof_info.
dof_indices.data() + my_index_start[0].first;
3541 for (
unsigned int v = 0; v < n_lanes; ++v)
3546 const std::pair<unsigned int, unsigned int> *my_index_start =
3547 &dof_info.
row_starts[cells[v] * this->n_fe_components +
3548 this->first_selected_component];
3549 if (my_index_start[n_components_read].
second !=
3550 my_index_start[0].
second)
3551 has_constraints =
true;
3558 dof_info.hanging_node_constraint_masks_comp
3559 [this->active_fe_index][this->first_selected_component])
3560 has_hn_constraints = true;
3563 my_index_start[0].
first ||
3566 my_index_start[0].
first,
3569 dof_info.
dof_indices.data() + my_index_start[0].first;
3573 if (std::count_if(cells.begin(), cells.end(), [](
const auto i) {
3574 return i != numbers::invalid_unsigned_int;
3576 for (
unsigned int comp = 0; comp < n_components; ++comp)
3577 for (
unsigned int i = 0; i < dofs_per_component; ++i)
3578 operation.process_empty(values_dofs[comp][i]);
3582 if (!has_constraints && apply_constraints)
3584 if (n_components == 1 || this->n_fe_components == 1)
3586 for (
unsigned int v = 0; v < n_lanes; ++v)
3591 for (
unsigned int i = 0; i < dofs_per_component; ++i)
3592 for (
unsigned int comp = 0; comp < n_components; ++comp)
3593 operation.process_dof(dof_indices[v][i],
3595 values_dofs[comp][i][v]);
3600 for (
unsigned int comp = 0; comp < n_components; ++comp)
3601 for (
unsigned int v = 0; v < n_lanes; ++v)
3606 for (
unsigned int i = 0; i < dofs_per_component; ++i)
3607 operation.process_dof(
3608 dof_indices[v][comp * dofs_per_component + i],
3610 values_dofs[comp][i][v]);
3622 for (
unsigned int v = 0; v < n_lanes; ++v)
3628 const unsigned int cell_dof_index =
3629 cell_index * this->n_fe_components + this->first_selected_component;
3630 const unsigned int n_components_read =
3631 this->n_fe_components > 1 ? n_components : 1;
3632 unsigned int index_indicators =
3634 unsigned int next_index_indicators =
3635 dof_info.
row_starts[cell_dof_index + 1].second;
3639 if (apply_constraints ==
false &&
3640 (dof_info.
row_starts[cell_dof_index].second !=
3641 dof_info.
row_starts[cell_dof_index + n_components_read].second ||
3647 dof_info.hanging_node_constraint_masks_comp
3648 [this->active_fe_index][this->first_selected_component])))
3657 [this->first_selected_component] +
3659 next_index_indicators = index_indicators;
3662 if (n_components == 1 || this->n_fe_components == 1)
3664 unsigned int ind_local = 0;
3665 for (; index_indicators != next_index_indicators; ++index_indicators)
3667 const std::pair<unsigned short, unsigned short> indicator =
3670 for (
unsigned int j = 0; j < indicator.first; ++j)
3671 for (
unsigned int comp = 0; comp < n_components; ++comp)
3672 operation.process_dof(dof_indices[v][j],
3674 values_dofs[comp][ind_local + j][v]);
3676 ind_local += indicator.first;
3677 dof_indices[v] += indicator.first;
3681 Number
value[n_components];
3682 for (
unsigned int comp = 0; comp < n_components; ++comp)
3683 operation.pre_constraints(values_dofs[comp][ind_local][v],
3686 const Number *data_val =
3688 const Number *end_pool =
3690 for (; data_val != end_pool; ++data_val, ++dof_indices[v])
3691 for (
unsigned int comp = 0; comp < n_components; ++comp)
3692 operation.process_constraint(*dof_indices[v],
3697 for (
unsigned int comp = 0; comp < n_components; ++comp)
3698 operation.post_constraints(
value[comp],
3699 values_dofs[comp][ind_local][v]);
3705 for (; ind_local < dofs_per_component; ++dof_indices[v], ++ind_local)
3706 for (
unsigned int comp = 0; comp < n_components; ++comp)
3707 operation.process_dof(*dof_indices[v],
3709 values_dofs[comp][ind_local][v]);
3718 for (
unsigned int comp = 0; comp < n_components; ++comp)
3720 unsigned int ind_local = 0;
3723 for (; index_indicators != next_index_indicators;
3726 const std::pair<unsigned short, unsigned short> indicator =
3730 for (
unsigned int j = 0; j < indicator.first; ++j)
3731 operation.process_dof(dof_indices[v][j],
3733 values_dofs[comp][ind_local + j][v]);
3734 ind_local += indicator.first;
3735 dof_indices[v] += indicator.first;
3740 operation.pre_constraints(values_dofs[comp][ind_local][v],
3743 const Number *data_val =
3745 const Number *end_pool =
3748 for (; data_val != end_pool; ++data_val, ++dof_indices[v])
3749 operation.process_constraint(*dof_indices[v],
3754 operation.post_constraints(
value,
3755 values_dofs[comp][ind_local][v]);
3762 for (; ind_local < dofs_per_component;
3763 ++dof_indices[v], ++ind_local)
3766 operation.process_dof(*dof_indices[v],
3768 values_dofs[comp][ind_local][v]);
3771 if (apply_constraints ==
true && comp + 1 < n_components)
3772 next_index_indicators =
3773 dof_info.
row_starts[cell_dof_index + comp + 2].second;
3785 typename VectorizedArrayType>
3786template <
typename VectorType,
typename VectorOperation>
3791 const std::array<VectorType *, n_components_> &src)
const
3795 const std::size_t dofs_per_component = this->data->dofs_per_component_on_cell;
3796 unsigned int index = this->first_selected_component * dofs_per_component;
3797 for (
unsigned int comp = 0; comp < n_components; ++comp)
3799 for (
unsigned int i = 0; i < dofs_per_component; ++i, ++
index)
3801 operation.process_empty(
3802 this->values_dofs[comp * dofs_per_component + i]);
3803 operation.process_dof_global(
3804 local_dof_indices[this->data->lexicographic_numbering[
index]],
3806 this->values_dofs[comp * dofs_per_component + i][0]);
3817 typename VectorizedArrayType>
3818template <
typename VectorType,
typename VectorOperation>
3823 const std::array<VectorType *, n_components_> &src,
3826 n_components_> & vectors_sm,
3827 const std::bitset<VectorizedArrayType::size()> &
mask)
const
3836 std::integral_constant<
bool,
3837 internal::is_vectorizable<VectorType, Number>::value>
3840 is_face ? this->dof_access_index :
3842 const unsigned int n_lanes =
mask.count();
3845 const std::vector<unsigned int> & dof_indices_cont =
3848 const std::size_t dofs_per_component = this->data->dofs_per_component_on_cell;
3849 std::array<VectorizedArrayType *, n_components> values_dofs;
3850 for (
unsigned int c = 0; c < n_components; ++c)
3851 values_dofs[c] =
const_cast<VectorizedArrayType *
>(this->values_dofs) +
3852 c * dofs_per_component;
3860 interleaved_contiguous &&
3861 n_lanes == VectorizedArrayType::size()) &&
3863 this->dof_access_index ==
3864 internal::MatrixFreeFunctions::DoFInfo::dof_access_cell &&
3865 this->is_interior_face() == false) &&
3866 !(!is_face && !this->is_interior_face()))
3868 const unsigned int dof_index =
3869 dof_indices_cont[this->cell * VectorizedArrayType::size()] +
3872 [this->first_selected_component] *
3873 VectorizedArrayType::size();
3874 if (n_components == 1 || this->n_fe_components == 1)
3875 for (
unsigned int comp = 0; comp < n_components; ++comp)
3876 operation.process_dofs_vectorized(dofs_per_component,
3882 operation.process_dofs_vectorized(dofs_per_component * n_components,
3890 const std::array<
unsigned int, VectorizedArrayType::size()> &cells =
3891 this->get_cell_or_face_ids();
3895 const unsigned int n_filled_lanes =
3899 (this->dof_access_index ==
3901 this->is_interior_face() ==
false) ||
3902 (!is_face && !this->is_interior_face());
3904 if (vectors_sm[0] !=
nullptr)
3906 const auto compute_vector_ptrs = [&](
const unsigned int comp) {
3907 std::array<
typename VectorType::value_type *,
3908 VectorizedArrayType::size()>
3911 const auto upper_bound =
3912 std::min<unsigned int>(n_filled_lanes, VectorizedArrayType::size());
3913 for (
unsigned int v = 0; v < upper_bound; ++v)
3915 if (
mask[v] ==
false)
3917 vector_ptrs[v] =
nullptr;
3937 vector_ptrs[v] =
const_cast<typename VectorType::value_type *
>(
3938 vectors_sm[comp]->operator[](temp.first).data() + temp.second +
3940 [this->active_fe_index][this->first_selected_component]);
3942 vector_ptrs[v] =
nullptr;
3944 for (
unsigned int v = n_filled_lanes; v < VectorizedArrayType::size();
3946 vector_ptrs[v] =
nullptr;
3951 if (n_filled_lanes == VectorizedArrayType::size() &&
3952 n_lanes == VectorizedArrayType::size() && !is_ecl)
3954 if (n_components == 1 || this->n_fe_components == 1)
3956 for (
unsigned int comp = 0; comp < n_components; ++comp)
3958 auto vector_ptrs = compute_vector_ptrs(comp);
3959 operation.process_dofs_vectorized_transpose(
3968 auto vector_ptrs = compute_vector_ptrs(0);
3969 operation.process_dofs_vectorized_transpose(dofs_per_component *
3977 for (
unsigned int comp = 0; comp < n_components; ++comp)
3979 auto vector_ptrs = compute_vector_ptrs(
3980 (n_components == 1 || this->n_fe_components == 1) ? comp : 0);
3982 for (
unsigned int i = 0; i < dofs_per_component; ++i)
3983 operation.process_empty(values_dofs[comp][i]);
3985 if (n_components == 1 || this->n_fe_components == 1)
3987 for (
unsigned int v = 0; v < n_filled_lanes; ++v)
3988 if (
mask[v] ==
true)
3989 for (
unsigned int i = 0; i < dofs_per_component; ++i)
3990 operation.process_dof(vector_ptrs[v][i],
3991 values_dofs[comp][i][v]);
3995 for (
unsigned int v = 0; v < n_filled_lanes; ++v)
3996 if (
mask[v] ==
true)
3997 for (
unsigned int i = 0; i < dofs_per_component; ++i)
3998 operation.process_dof(
3999 vector_ptrs[v][i + comp * dofs_per_component],
4000 values_dofs[comp][i][v]);
4006 unsigned int dof_indices[VectorizedArrayType::size()];
4008 for (
unsigned int v = 0; v < n_filled_lanes; ++v)
4012 if (
mask[v] ==
true)
4014 dof_indices_cont[cells[v]] +
4017 [this->first_selected_component] *
4023 for (
unsigned int v = n_filled_lanes; v < VectorizedArrayType::size(); ++v)
4028 if (n_filled_lanes == VectorizedArrayType::size() &&
4029 n_lanes == VectorizedArrayType::size() && !is_ecl)
4035 if (n_components == 1 || this->n_fe_components == 1)
4036 for (
unsigned int comp = 0; comp < n_components; ++comp)
4037 operation.process_dofs_vectorized_transpose(dofs_per_component,
4043 operation.process_dofs_vectorized_transpose(dofs_per_component *
4052 interleaved_contiguous_strided)
4054 if (n_components == 1 || this->n_fe_components == 1)
4055 for (
unsigned int i = 0; i < dofs_per_component; ++i)
4057 for (
unsigned int comp = 0; comp < n_components; ++comp)
4058 operation.process_dof_gather(dof_indices,
4060 i * VectorizedArrayType::size(),
4061 values_dofs[comp][i],
4065 for (
unsigned int comp = 0; comp < n_components; ++comp)
4066 for (
unsigned int i = 0; i < dofs_per_component; ++i)
4068 operation.process_dof_gather(dof_indices,
4070 (comp * dofs_per_component + i) *
4071 VectorizedArrayType::size(),
4072 values_dofs[comp][i],
4080 IndexStorageVariants::interleaved_contiguous_mixed_strides,
4082 const unsigned int *offsets =
4084 [ind][VectorizedArrayType::size() * this->cell];
4085 if (n_components == 1 || this->n_fe_components == 1)
4086 for (
unsigned int i = 0; i < dofs_per_component; ++i)
4088 for (
unsigned int comp = 0; comp < n_components; ++comp)
4089 operation.process_dof_gather(dof_indices,
4092 values_dofs[comp][i],
4095 for (
unsigned int v = 0; v < VectorizedArrayType::size(); ++v)
4096 dof_indices[v] += offsets[v];
4099 for (
unsigned int comp = 0; comp < n_components; ++comp)
4100 for (
unsigned int i = 0; i < dofs_per_component; ++i)
4102 operation.process_dof_gather(dof_indices,
4105 values_dofs[comp][i],
4108 for (
unsigned int v = 0; v < VectorizedArrayType::size(); ++v)
4109 dof_indices[v] += offsets[v];
4114 for (
unsigned int comp = 0; comp < n_components; ++comp)
4116 for (
unsigned int i = 0; i < dofs_per_component; ++i)
4117 operation.process_empty(values_dofs[comp][i]);
4122 if (n_components == 1 || this->n_fe_components == 1)
4124 for (
unsigned int v = 0; v < n_filled_lanes; ++v)
4125 if (
mask[v] ==
true)
4126 for (
unsigned int i = 0; i < dofs_per_component; ++i)
4127 operation.process_dof(dof_indices[v] + i,
4129 values_dofs[comp][i][v]);
4133 for (
unsigned int v = 0; v < n_filled_lanes; ++v)
4134 if (
mask[v] ==
true)
4135 for (
unsigned int i = 0; i < dofs_per_component; ++i)
4136 operation.process_dof(dof_indices[v] + i +
4137 comp * dofs_per_component,
4139 values_dofs[comp][i][v]);
4144 const unsigned int *offsets =
4146 [ind][VectorizedArrayType::size() * this->cell];
4147 for (
unsigned int v = 0; v < n_filled_lanes; ++v)
4149 if (n_components == 1 || this->n_fe_components == 1)
4150 for (
unsigned int v = 0; v < n_filled_lanes; ++v)
4152 if (
mask[v] ==
true)
4153 for (
unsigned int i = 0; i < dofs_per_component; ++i)
4154 operation.process_dof(dof_indices[v] + i * offsets[v],
4156 values_dofs[comp][i][v]);
4160 for (
unsigned int v = 0; v < n_filled_lanes; ++v)
4161 if (
mask[v] ==
true)
4162 for (
unsigned int i = 0; i < dofs_per_component; ++i)
4163 operation.process_dof(dof_indices[v] +
4164 (i + comp * dofs_per_component) *
4167 values_dofs[comp][i][v]);
4177 typename VectorType,
4178 std::enable_if_t<!IsBlockVector<VectorType>::value, VectorType> * =
nullptr>
4179 decltype(std::declval<VectorType>().begin())
4180 get_beginning(VectorType &vec)
4187 typename VectorType,
4188 std::enable_if_t<IsBlockVector<VectorType>::value, VectorType> * =
nullptr>
4189 typename VectorType::value_type *
4190 get_beginning(VectorType &)
4195 template <
typename VectorType,
4196 std::enable_if_t<has_shared_vector_data<VectorType>, VectorType> * =
4198 const std::vector<ArrayView<const typename VectorType::value_type>> *
4199 get_shared_vector_data(VectorType * vec,
4200 const bool is_valid_mode_for_sm,
4201 const unsigned int active_fe_index,
4205 if (is_valid_mode_for_sm &&
4208 active_fe_index == 0)
4209 return &vec->shared_vector_data();
4214 template <
typename VectorType,
4215 std::enable_if_t<!has_shared_vector_data<VectorType>, VectorType>
4217 const std::vector<ArrayView<const typename VectorType::value_type>> *
4218 get_shared_vector_data(VectorType *,
4226 template <
int n_components,
typename VectorType>
4228 std::array<
typename internal::BlockVectorSelector<
4233 const std::vector<
ArrayView<
const typename internal::BlockVectorSelector<
4237 get_vector_data(VectorType & src,
4238 const unsigned int first_index,
4239 const bool is_valid_mode_for_sm,
4240 const unsigned int active_fe_index,
4246 std::array<
typename internal::BlockVectorSelector<
4252 ArrayView<
const typename internal::BlockVectorSelector<
4258 for (
unsigned int d = 0;
d < n_components; ++
d)
4259 src_data.first[d] = internal::BlockVectorSelector<
4265 for (
unsigned int d = 0;
d < n_components; ++
d)
4266 src_data.second[d] = get_shared_vector_data(
4267 const_cast<typename internal::BlockVectorSelector<
4268 typename std::remove_const<VectorType>::type,
4270 BaseVectorType *>(src_data.
first[
d]),
4271 is_valid_mode_for_sm,
4285 typename VectorizedArrayType>
4290 if (this->dof_info ==
nullptr ||
4292 this->dof_info->hanging_node_constraint_masks_comp.size() == 0 ||
4293 this->dof_info->hanging_node_constraint_masks_comp
4294 [this->active_fe_index][this->first_selected_component] ==
false)
4297 constexpr unsigned int n_lanes = VectorizedArrayType::size();
4298 std::array<internal::MatrixFreeFunctions::compressed_constraint_kind, n_lanes>
4301 bool hn_available =
false;
4303 const std::array<
unsigned int, VectorizedArrayType::size()> &cells =
4304 this->get_cell_ids();
4306 for (
unsigned int v = 0; v < n_lanes; ++v)
4318 constraint_mask[v] =
mask;
4324 if (hn_available ==
false)
4329 this->data->data.front().fe_degree,
4330 this->get_shape_info(),
4342 typename VectorizedArrayType>
4343template <
typename VectorType>
4347 const unsigned int first_index,
4348 const std::bitset<VectorizedArrayType::size()> &
mask)
4350 const auto src_data = internal::get_vector_data<n_components_>(
4353 this->dof_access_index ==
4355 this->active_fe_index,
4359 read_write_operation(reader, src_data.first, src_data.second,
mask,
true);
4361 apply_hanging_node_constraints(
false);
4364 this->dof_values_initialized =
true;
4374 typename VectorizedArrayType>
4375template <
typename VectorType>
4379 const unsigned int first_index,
4380 const std::bitset<VectorizedArrayType::size()> &
mask)
4382 const auto src_data = internal::get_vector_data<n_components_>(
4385 this->dof_access_index ==
4387 this->active_fe_index,
4391 read_write_operation(reader, src_data.first, src_data.second,
mask,
false);
4394 this->dof_values_initialized =
true;
4404 typename VectorizedArrayType>
4405template <
typename VectorType>
4410 const unsigned int first_index,
4411 const std::bitset<VectorizedArrayType::size()> &
mask)
const
4414 Assert(this->dof_values_initialized ==
true,
4418 apply_hanging_node_constraints(
true);
4420 const auto dst_data = internal::get_vector_data<n_components_>(
4423 this->dof_access_index ==
4425 this->active_fe_index,
4430 read_write_operation(distributor, dst_data.first, dst_data.second,
mask);
4439 typename VectorizedArrayType>
4440template <
typename VectorType>
4444 const unsigned int first_index,
4445 const std::bitset<VectorizedArrayType::size()> &
mask)
const
4448 Assert(this->dof_values_initialized ==
true,
4452 const auto dst_data = internal::get_vector_data<n_components_>(
4455 this->dof_access_index ==
4457 this->active_fe_index,
4461 read_write_operation(setter, dst_data.first, dst_data.second,
mask);
4470 typename VectorizedArrayType>
4471template <
typename VectorType>
4476 const unsigned int first_index,
4477 const std::bitset<VectorizedArrayType::size()> &
mask)
const
4480 Assert(this->dof_values_initialized ==
true,
4484 const auto dst_data = internal::get_vector_data<n_components_>(
4487 this->dof_access_index ==
4489 this->active_fe_index,
4493 read_write_operation(setter, dst_data.first, dst_data.second,
mask,
false);
4506 typename VectorizedArrayType>
4512 const std::size_t dofs = this->data->dofs_per_component_on_cell;
4514 for (
unsigned int comp = 0; comp < n_components; ++comp)
4515 return_value[comp] = this->values_dofs[comp * dofs + dof];
4516 return return_value;
4525 typename VectorizedArrayType>
4528 get_value(
const unsigned int q_point)
const
4531 Assert(this->values_quad_initialized ==
true,
4536 const std::size_t nqp = this->n_quadrature_points;
4538 for (
unsigned int comp = 0; comp < n_components; ++comp)
4539 return_value[comp] = this->values_quad[comp * nqp + q_point];
4540 return return_value;
4549 typename VectorizedArrayType>
4556 Assert(this->gradients_quad_initialized ==
true,
4561 Assert(this->jacobian !=
nullptr,
4563 "update_gradients"));
4564 const std::size_t nqp = this->n_quadrature_points;
4570 for (
unsigned int d = 0;
d < dim; ++
d)
4571 for (
unsigned int comp = 0; comp < n_components; ++comp)
4573 this->gradients_quad[(comp * dim + d) * nqp + q_point] *
4574 this->jacobian[0][
d][
d];
4583 for (
unsigned int comp = 0; comp < n_components; ++comp)
4584 for (
unsigned int d = 0;
d < dim; ++
d)
4587 jac[
d][0] * this->gradients_quad[(comp * dim) * nqp + q_point];
4588 for (
unsigned int e = 1;
e < dim; ++
e)
4589 grad_out[comp][d] +=
4591 this->gradients_quad[(comp * dim + e) * nqp + q_point];
4603 typename VectorizedArrayType>
4610 Assert(this->gradients_quad_initialized ==
true,
4614 Assert(this->normal_x_jacobian !=
nullptr,
4616 "update_gradients"));
4618 const std::size_t nqp = this->n_quadrature_points;
4622 for (
unsigned int comp = 0; comp < n_components; ++comp)
4624 this->gradients_quad[(comp * dim + dim - 1) * nqp + q_point] *
4625 (this->normal_x_jacobian[0][dim - 1]);
4628 const std::size_t
index =
4630 for (
unsigned int comp = 0; comp < n_components; ++comp)
4632 grad_out[comp] = this->gradients_quad[comp * dim * nqp + q_point] *
4633 this->normal_x_jacobian[
index][0];
4634 for (
unsigned int d = 1;
d < dim; ++
d)
4636 this->gradients_quad[(comp * dim + d) * nqp + q_point] *
4637 this->normal_x_jacobian[
index][
d];
4649 template <
typename VectorizedArrayType>
4652 const VectorizedArrayType *
const hessians,
4654 VectorizedArrayType (&tmp)[1][1])
4656 tmp[0][0] = jac[0][0] *
hessians[0];
4659 template <
typename VectorizedArrayType>
4662 const VectorizedArrayType *
const hessians,
4663 const unsigned int nqp,
4664 VectorizedArrayType (&tmp)[2][2])
4666 for (
unsigned int d = 0;
d < 2; ++
d)
4674 template <
typename VectorizedArrayType>
4677 const VectorizedArrayType *
const hessians,
4678 const unsigned int nqp,
4679 VectorizedArrayType (&tmp)[3][3])
4681 for (
unsigned int d = 0;
d < 3; ++
d)
4702 typename VectorizedArrayType>
4708 Assert(this->hessians_quad_initialized ==
true,
4713 Assert(this->jacobian !=
nullptr,
4723 const std::size_t nqp = this->n_quadrature_points;
4724 constexpr unsigned int hdim = (dim * (dim + 1)) / 2;
4729 for (
unsigned int comp = 0; comp < n_components; ++comp)
4731 for (
unsigned int d = 0;
d < dim; ++
d)
4732 hessian_out[comp][d][d] =
4733 this->hessians_quad[(comp * hdim + d) * nqp + q_point] *
4734 (jac[
d][
d] * jac[
d][
d]);
4740 hessian_out[comp][0][1] =
4741 this->hessians_quad[(comp * hdim + 2) * nqp + q_point] *
4742 (jac[0][0] * jac[1][1]);
4745 hessian_out[comp][0][1] =
4746 this->hessians_quad[(comp * hdim + 3) * nqp + q_point] *
4747 (jac[0][0] * jac[1][1]);
4748 hessian_out[comp][0][2] =
4749 this->hessians_quad[(comp * hdim + 4) * nqp + q_point] *
4750 (jac[0][0] * jac[2][2]);
4751 hessian_out[comp][1][2] =
4752 this->hessians_quad[(comp * hdim + 5) * nqp + q_point] *
4753 (jac[1][1] * jac[2][2]);
4758 for (
unsigned int d = 0;
d < dim; ++
d)
4759 for (
unsigned int e = d + 1;
e < dim; ++
e)
4760 hessian_out[comp][e][d] = hessian_out[comp][d][e];
4766 for (
unsigned int comp = 0; comp < n_components; ++comp)
4768 VectorizedArrayType tmp[dim][dim];
4769 internal::hessian_unit_times_jac(
4770 jac, this->hessians_quad + comp * hdim * nqp + q_point, nqp, tmp);
4773 for (
unsigned int d = 0;
d < dim; ++
d)
4774 for (
unsigned int e = d;
e < dim; ++
e)
4776 hessian_out[comp][
d][
e] = jac[
d][0] * tmp[0][
e];
4777 for (
unsigned int f = 1; f < dim; ++f)
4778 hessian_out[comp][d][e] += jac[d][f] * tmp[f][e];
4785 for (
unsigned int d = 0;
d < dim; ++
d)
4786 for (
unsigned int e = d + 1;
e < dim; ++
e)
4787 hessian_out[comp][e][d] = hessian_out[comp][d][e];
4793 const auto &jac_grad = this->jacobian_gradients[q_point];
4794 for (
unsigned int comp = 0; comp < n_components; ++comp)
4796 VectorizedArrayType tmp[dim][dim];
4797 internal::hessian_unit_times_jac(
4798 jac, this->hessians_quad + comp * hdim * nqp + q_point, nqp, tmp);
4801 for (
unsigned int d = 0;
d < dim; ++
d)
4802 for (
unsigned int e = d;
e < dim; ++
e)
4804 hessian_out[comp][
d][
e] = jac[
d][0] * tmp[0][
e];
4805 for (
unsigned int f = 1; f < dim; ++f)
4806 hessian_out[comp][d][e] += jac[d][f] * tmp[f][e];
4810 for (
unsigned int d = 0;
d < dim; ++
d)
4811 for (
unsigned int e = 0;
e < dim; ++
e)
4812 hessian_out[comp][d][d] +=
4814 this->gradients_quad[(comp * dim + e) * nqp + q_point];
4817 for (
unsigned int d = 0, count = dim;
d < dim; ++
d)
4818 for (
unsigned int e = d + 1;
e < dim; ++
e, ++count)
4819 for (
unsigned int f = 0; f < dim; ++f)
4820 hessian_out[comp][d][e] +=
4821 jac_grad[count][f] *
4822 this->gradients_quad[(comp * dim + f) * nqp + q_point];
4825 for (
unsigned int d = 0;
d < dim; ++
d)
4826 for (
unsigned int e = d + 1;
e < dim; ++
e)
4827 hessian_out[comp][e][d] = hessian_out[comp][d][e];
4839 typename VectorizedArrayType>
4846 Assert(this->hessians_quad_initialized ==
true,
4857 const std::size_t nqp = this->n_quadrature_points;
4858 constexpr unsigned int hdim = (dim * (dim + 1)) / 2;
4864 for (
unsigned int comp = 0; comp < n_components; ++comp)
4865 for (
unsigned int d = 0;
d < dim; ++
d)
4866 hessian_out[comp][d] =
4867 this->hessians_quad[(comp * hdim + d) * nqp + q_point] *
4868 (jac[
d][
d] * jac[
d][
d]);
4873 for (
unsigned int comp = 0; comp < n_components; ++comp)
4877 VectorizedArrayType tmp[dim][dim];
4878 internal::hessian_unit_times_jac(
4879 jac, this->hessians_quad + comp * hdim * nqp + q_point, nqp, tmp);
4883 for (
unsigned int d = 0;
d < dim; ++
d)
4885 hessian_out[comp][
d] = jac[
d][0] * tmp[0][
d];
4886 for (
unsigned int f = 1; f < dim; ++f)
4887 hessian_out[comp][d] += jac[d][f] * tmp[f][d];
4894 const auto &jac_grad = this->jacobian_gradients[q_point];
4895 for (
unsigned int comp = 0; comp < n_components; ++comp)
4899 VectorizedArrayType tmp[dim][dim];
4900 internal::hessian_unit_times_jac(
4901 jac, this->hessians_quad + comp * hdim * nqp + q_point, nqp, tmp);
4905 for (
unsigned int d = 0;
d < dim; ++
d)
4907 hessian_out[comp][
d] = jac[
d][0] * tmp[0][
d];
4908 for (
unsigned int f = 1; f < dim; ++f)
4909 hessian_out[comp][d] += jac[d][f] * tmp[f][d];
4912 for (
unsigned int d = 0;
d < dim; ++
d)
4913 for (
unsigned int e = 0;
e < dim; ++
e)
4914 hessian_out[comp][d] +=
4916 this->gradients_quad[(comp * dim + e) * nqp + q_point];
4928 typename VectorizedArrayType>
4935 Assert(this->hessians_quad_initialized ==
true,
4941 const auto hess_diag = get_hessian_diagonal(q_point);
4942 for (
unsigned int comp = 0; comp < n_components; ++comp)
4944 laplacian_out[comp] = hess_diag[comp][0];
4945 for (
unsigned int d = 1;
d < dim; ++
d)
4946 laplacian_out[comp] += hess_diag[comp][d];
4948 return laplacian_out;
4957 typename VectorizedArrayType>
4961 const unsigned int dof)
4964 this->dof_values_initialized =
true;
4966 const std::size_t dofs = this->data->dofs_per_component_on_cell;
4968 for (
unsigned int comp = 0; comp < n_components; ++comp)
4969 this->values_dofs[comp * dofs + dof] = val_in[comp];
4978 typename VectorizedArrayType>
4982 const unsigned int q_point)
4988 Assert(this->J_value !=
nullptr,
4992 this->values_quad_submitted =
true;
4995 const std::size_t nqp = this->n_quadrature_points;
4998 const VectorizedArrayType JxW =
4999 this->J_value[0] * this->quadrature_weights[q_point];
5000 for (
unsigned int comp = 0; comp < n_components; ++comp)
5001 this->values_quad[comp * nqp + q_point] = val_in[comp] * JxW;
5005 const VectorizedArrayType JxW = this->J_value[q_point];
5006 for (
unsigned int comp = 0; comp < n_components; ++comp)
5007 this->values_quad[comp * nqp + q_point] = val_in[comp] * JxW;
5017 typename VectorizedArrayType>
5022 const unsigned int q_point)
5028 Assert(this->J_value !=
nullptr,
5030 "update_gradients"));
5031 Assert(this->jacobian !=
nullptr,
5033 "update_gradients"));
5035 this->gradients_quad_submitted =
true;
5038 const std::size_t nqp = this->n_quadrature_points;
5041 const VectorizedArrayType JxW =
5042 this->J_value[0] * this->quadrature_weights[q_point];
5043 std::array<VectorizedArrayType, dim> jac;
5044 for (
unsigned int d = 0;
d < dim; ++
d)
5045 jac[d] = this->jacobian[0][d][d];
5046 for (
unsigned int d = 0;
d < dim; ++
d)
5048 const VectorizedArrayType factor = jac[
d] * JxW;
5049 for (
unsigned int comp = 0; comp < n_components; ++comp)
5050 this->gradients_quad[(comp * dim + d) * nqp + q_point] =
5051 grad_in[comp][
d] * factor;
5058 this->jacobian[q_point] :
5060 const VectorizedArrayType JxW =
5062 this->J_value[q_point] :
5063 this->J_value[0] * this->quadrature_weights[q_point];
5064 for (
unsigned int comp = 0; comp < n_components; ++comp)
5065 for (
unsigned int d = 0;
d < dim; ++
d)
5067 VectorizedArrayType new_val = jac[0][
d] * grad_in[comp][0];
5068 for (
unsigned int e = 1;
e < dim; ++
e)
5069 new_val += (jac[e][d] * grad_in[comp][e]);
5070 this->gradients_quad[(comp * dim +
d) * nqp + q_point] =
5082 typename VectorizedArrayType>
5087 const unsigned int q_point)
5090 Assert(this->normal_x_jacobian !=
nullptr,
5092 "update_gradients"));
5094 this->gradients_quad_submitted =
true;
5097 const std::size_t nqp = this->n_quadrature_points;
5100 const VectorizedArrayType JxW_jac = this->J_value[0] *
5101 this->quadrature_weights[q_point] *
5102 this->normal_x_jacobian[0][dim - 1];
5103 for (
unsigned int comp = 0; comp < n_components; ++comp)
5105 for (
unsigned int d = 0;
d < dim - 1; ++
d)
5106 this->gradients_quad[(comp * dim + d) * nqp + q_point] =
5107 VectorizedArrayType();
5108 this->gradients_quad[(comp * dim + dim - 1) * nqp + q_point] =
5109 grad_in[comp] * JxW_jac;
5114 const unsigned int index =
5117 this->normal_x_jacobian[
index];
5118 const VectorizedArrayType JxW =
5120 this->J_value[
index] * this->quadrature_weights[q_point] :
5121 this->J_value[
index];
5122 for (
unsigned int comp = 0; comp < n_components; ++comp)
5124 for (
unsigned int d = 0;
d < dim; ++
d)
5125 this->gradients_quad[(comp * dim + d) * nqp + q_point] =
5126 (grad_in[comp] * JxW) * jac[d];
5137 typename VectorizedArrayType>
5143 const unsigned int q_point)
5149 Assert(this->J_value !=
nullptr,
5151 "update_hessians"));
5152 Assert(this->jacobian !=
nullptr,
5154 "update_hessians"));
5156 this->hessians_quad_submitted =
true;
5160 const std::size_t nqp = this->n_quadrature_points;
5161 constexpr unsigned int hdim = (dim * (dim + 1)) / 2;
5164 const VectorizedArrayType JxW =
5165 this->J_value[0] * this->quadrature_weights[q_point];
5168 for (
unsigned int d = 0;
d < dim; ++
d)
5170 const auto jac_d = this->jacobian[0][
d][
d];
5171 const VectorizedArrayType factor = jac_d * jac_d * JxW;
5172 for (
unsigned int comp = 0; comp < n_components; ++comp)
5173 this->hessians_quad[(comp * hdim + d) * nqp + q_point] =
5174 hessian_in[comp][
d][
d] * factor;
5178 for (
unsigned int d = 1, off_dia = dim;
d < dim; ++
d)
5179 for (
unsigned int e = 0;
e <
d; ++
e, ++off_dia)
5181 const auto jac_d = this->jacobian[0][
d][
d];
5182 const auto jac_e = this->jacobian[0][
e][
e];
5183 const VectorizedArrayType factor = jac_d * jac_e * JxW;
5184 for (
unsigned int comp = 0; comp < n_components; ++comp)
5185 this->hessians_quad[(comp * hdim + off_dia) * nqp + q_point] =
5186 (hessian_in[comp][
d][
e] + hessian_in[comp][
e][
d]) * factor;
5193 const VectorizedArrayType JxW =
5194 this->J_value[0] * this->quadrature_weights[q_point];
5195 for (
unsigned int comp = 0; comp < n_components; ++comp)
5198 VectorizedArrayType tmp[dim][dim];
5199 for (
unsigned int i = 0; i < dim; ++i)
5200 for (
unsigned int j = 0; j < dim; ++j)
5202 tmp[i][j] = hessian_in[comp][i][0] * jac[0][j];
5203 for (
unsigned int k = 1; k < dim; ++k)
5204 tmp[i][j] += hessian_in[comp][i][k] * jac[k][j];
5208 VectorizedArrayType tmp2[dim][dim];
5209 for (
unsigned int i = 0; i < dim; ++i)
5210 for (
unsigned int j = 0; j < dim; ++j)
5212 tmp2[i][j] = jac[0][i] * tmp[0][j];
5213 for (
unsigned int k = 1; k < dim; ++k)
5214 tmp2[i][j] += jac[k][i] * tmp[k][j];
5218 for (
unsigned int d = 0;
d < dim; ++
d)
5219 this->hessians_quad[(comp * hdim + d) * nqp + q_point] =
5223 for (
unsigned int d = 0, off_diag = dim;
d < dim; ++
d)
5224 for (
unsigned int e = d + 1;
e < dim; ++
e, ++off_diag)
5225 this->hessians_quad[(comp * hdim + off_diag) * nqp + q_point] =
5226 (tmp2[
d][
e] + tmp2[
e][
d]) * JxW;
5232 const VectorizedArrayType JxW = this->J_value[q_point];
5233 const auto &jac_grad = this->jacobian_gradients[q_point];
5234 for (
unsigned int comp = 0; comp < n_components; ++comp)
5237 VectorizedArrayType tmp[dim][dim];
5238 for (
unsigned int i = 0; i < dim; ++i)
5239 for (
unsigned int j = 0; j < dim; ++j)
5241 tmp[i][j] = hessian_in[comp][i][0] * jac[0][j];
5242 for (
unsigned int k = 1; k < dim; ++k)
5243 tmp[i][j] += hessian_in[comp][i][k] * jac[k][j];
5247 VectorizedArrayType tmp2[dim][dim];
5248 for (
unsigned int i = 0; i < dim; ++i)
5249 for (
unsigned int j = 0; j < dim; ++j)
5251 tmp2[i][j] = jac[0][i] * tmp[0][j];
5252 for (
unsigned int k = 1; k < dim; ++k)
5253 tmp2[i][j] += jac[k][i] * tmp[k][j];
5257 for (
unsigned int d = 0;
d < dim; ++
d)
5258 this->hessians_quad[(comp * hdim + d) * nqp + q_point] =
5262 for (
unsigned int d = 0, off_diag = dim;
d < dim; ++
d)
5263 for (
unsigned int e = d + 1;
e < dim; ++
e, ++off_diag)
5264 this->hessians_quad[(comp * hdim + off_diag) * nqp + q_point] =
5265 (tmp2[
d][
e] + tmp2[
e][
d]) * JxW;
5268 for (
unsigned int d = 0;
d < dim; ++
d)
5270 VectorizedArrayType
sum = 0;
5271 for (
unsigned int e = 0;
e < dim; ++
e)
5272 sum += hessian_in[comp][e][e] * jac_grad[e][d];
5273 for (
unsigned int e = 0, count = dim;
e < dim; ++
e)
5274 for (
unsigned int f = e + 1; f < dim; ++f, ++count)
5275 sum += (hessian_in[comp][e][f] + hessian_in[comp][f][e]) *
5277 this->gradients_from_hessians_quad[(comp * dim +
d) * nqp +
5278 q_point] = sum * JxW;
5290 typename VectorizedArrayType>
5297 Assert(this->values_quad_submitted ==
true,
5302 const std::size_t nqp = this->n_quadrature_points;
5303 for (
unsigned int q = 0; q < nqp; ++q)
5304 for (
unsigned int comp = 0; comp < n_components; ++comp)
5305 return_value[comp] += this->values_quad[comp * nqp + q];
5306 return (return_value);
5318 typename VectorizedArrayType>
5323 VectorizedArrayType>::
5326 const unsigned int dof_no,
5327 const unsigned int first_selected_component,
5328 const unsigned int quad_no,
5329 const unsigned int fe_degree,
5330 const unsigned int n_q_points,
5331 const bool is_interior_face,
5332 const unsigned int active_fe_index,
5333 const unsigned int active_quad_index,
5334 const unsigned int face_type)
5335 :
FEEvaluationBase<dim, n_components_, Number, is_face, VectorizedArrayType>(
5338 first_selected_component,
5354 typename VectorizedArrayType>
5359 VectorizedArrayType>::
5365 const unsigned int first_selected_component,
5367 :
FEEvaluationBase<dim, n_components_, Number, is_face, VectorizedArrayType>(
5372 first_selected_component,
5382 typename VectorizedArrayType>
5387 VectorizedArrayType>::
5392 VectorizedArrayType> &other)
5393 :
FEEvaluationBase<dim, n_components_, Number, is_face, VectorizedArrayType>(
5403 typename VectorizedArrayType>
5408 VectorizedArrayType> &
5414 VectorizedArrayType> &other)
5420 VectorizedArrayType>::operator=(other);
5429template <
int dim,
typename Number,
bool is_face,
typename VectorizedArrayType>
5433 const unsigned int dof_no,
5434 const unsigned int first_selected_component,
5435 const unsigned int quad_no,
5436 const unsigned int fe_degree,
5437 const unsigned int n_q_points,
5438 const bool is_interior_face,
5439 const unsigned int active_fe_index,
5440 const unsigned int active_quad_index,
5441 const unsigned int face_type)
5445 first_selected_component,
5457template <
int dim,
typename Number,
bool is_face,
typename VectorizedArrayType>
5464 const unsigned int first_selected_component,
5471 first_selected_component,
5477template <
int dim,
typename Number,
bool is_face,
typename VectorizedArrayType>
5487template <
int dim,
typename Number,
bool is_face,
typename VectorizedArrayType>
5493 ->
FEEvaluationBase<dim, 1, Number, is_face, VectorizedArrayType>::operator=(
5500template <
int dim,
typename Number,
bool is_face,
typename VectorizedArrayType>
5503 const unsigned int dof)
const
5506 return this->values_dofs[dof];
5511template <
int dim,
typename Number,
bool is_face,
typename VectorizedArrayType>
5514 const unsigned int q_point)
const
5517 Assert(this->values_quad_initialized ==
true,
5521 return this->values_quad[q_point];
5526template <
int dim,
typename Number,
bool is_face,
typename VectorizedArrayType>
5531 return BaseClass::get_normal_derivative(q_point)[0];
5536template <
int dim,
typename Number,
bool is_face,
typename VectorizedArrayType>
5539 const unsigned int q_point)
const
5545 Assert(this->gradients_quad_initialized ==
true,
5550 Assert(this->jacobian !=
nullptr,
5552 "update_gradients"));
5556 const std::size_t nqp = this->n_quadrature_points;
5559 for (
unsigned int d = 0;
d < dim; ++
d)
5561 this->gradients_quad[d * nqp + q_point] * this->jacobian[0][d][d];
5570 for (
unsigned int d = 0;
d < dim; ++
d)
5572 grad_out[
d] = jac[
d][0] * this->gradients_quad[q_point];
5573 for (
unsigned int e = 1;
e < dim; ++
e)
5574 grad_out[d] += jac[d][e] * this->gradients_quad[e * nqp + q_point];
5582template <
int dim,
typename Number,
bool is_face,
typename VectorizedArrayType>
5585 const unsigned int q_point)
const
5587 return BaseClass::get_hessian(q_point)[0];
5592template <
int dim,
typename Number,
bool is_face,
typename VectorizedArrayType>
5597 return BaseClass::get_hessian_diagonal(q_point)[0];
5602template <
int dim,
typename Number,
bool is_face,
typename VectorizedArrayType>
5603inline VectorizedArrayType
5605 const unsigned int q_point)
const
5607 return BaseClass::get_laplacian(q_point)[0];
5612template <
int dim,
typename Number,
bool is_face,
typename VectorizedArrayType>
5618 this->dof_values_initialized =
true;
5621 this->values_dofs[dof] = val_in;
5626template <
int dim,
typename Number,
bool is_face,
typename VectorizedArrayType>
5629 const VectorizedArrayType val_in,
5630 const unsigned int q_point)
5636 Assert(this->J_value !=
nullptr,
5640 this->values_quad_submitted =
true;
5645 const VectorizedArrayType JxW =
5646 this->J_value[0] * this->quadrature_weights[q_point];
5647 this->values_quad[q_point] = val_in * JxW;
5651 this->values_quad[q_point] = val_in * this->J_value[q_point];
5657template <
int dim,
typename Number,
bool is_face,
typename VectorizedArrayType>
5661 const unsigned int q_point)
5663 submit_value(val_in[0], q_point);
5668template <
int dim,
typename Number,
bool is_face,
typename VectorizedArrayType>
5672 const unsigned int q_point)
5676 BaseClass::submit_normal_derivative(grad, q_point);
5681template <
int dim,
typename Number,
bool is_face,
typename VectorizedArrayType>
5685 const unsigned int q_point)
5691 Assert(this->J_value !=
nullptr,
5693 "update_gradients"));
5694 Assert(this->jacobian !=
nullptr,
5696 "update_gradients"));
5698 this->gradients_quad_submitted =
true;
5701 const std::size_t nqp = this->n_quadrature_points;
5704 const VectorizedArrayType JxW =
5705 this->J_value[0] * this->quadrature_weights[q_point];
5709 std::array<VectorizedArrayType, dim> jac;
5710 for (
unsigned int d = 0;
d < dim; ++
d)
5711 jac[d] = this->jacobian[0][d][d];
5713 for (
unsigned int d = 0;
d < dim; ++
d)
5714 this->gradients_quad[d * nqp + q_point] = grad_in[d] * jac[d] * JxW;
5721 this->jacobian[q_point] :
5723 const VectorizedArrayType JxW =
5725 this->J_value[q_point] :
5726 this->J_value[0] * this->quadrature_weights[q_point];
5727 for (
unsigned int d = 0;
d < dim; ++
d)
5729 VectorizedArrayType new_val = jac[0][
d] * grad_in[0];
5730 for (
unsigned int e = 1;
e < dim; ++
e)
5731 new_val += jac[e][d] * grad_in[e];
5732 this->gradients_quad[
d * nqp + q_point] = new_val * JxW;
5739template <
int dim,
typename Number,
bool is_face,
typename VectorizedArrayType>
5743 const unsigned int q_point)
5747 BaseClass::submit_hessian(
hessian, q_point);
5752template <
int dim,
typename Number,
bool is_face,
typename VectorizedArrayType>
5753inline VectorizedArrayType
5757 return BaseClass::integrate_value()[0];
5765template <
int dim,
typename Number,
bool is_face,
typename VectorizedArrayType>
5769 const unsigned int dof_no,
5770 const unsigned int first_selected_component,
5771 const unsigned int quad_no,
5772 const unsigned int fe_degree,
5773 const unsigned int n_q_points,
5774 const bool is_interior_face,
5775 const unsigned int active_fe_index,
5776 const unsigned int active_quad_index,
5777 const unsigned int face_type)
5781 first_selected_component,
5793template <
int dim,
typename Number,
bool is_face,
typename VectorizedArrayType>
5800 const unsigned int first_selected_component,
5807 first_selected_component,
5813template <
int dim,
typename Number,
bool is_face,
typename VectorizedArrayType>
5823template <
int dim,
typename Number,
bool is_face,
typename VectorizedArrayType>
5835template <
int dim,
typename Number,
bool is_face,
typename VectorizedArrayType>
5838 const unsigned int q_point)
const
5840 if (this->data->element_type ==
5845 Assert(this->values_quad_initialized ==
true,
5850 Assert(this->J_value !=
nullptr,
5853 const std::size_t nqp = this->n_quadrature_points;
5861 const VectorizedArrayType inv_det =
5862 (dim == 2) ? this->jacobian[0][0][0] * this->jacobian[0][1][1] :
5863 this->jacobian[0][0][0] * this->jacobian[0][1][1] *
5864 this->jacobian[0][2][2];
5867 for (
unsigned int comp = 0; comp < n_components; ++comp)
5868 value_out[comp] = this->values_quad[comp * nqp + q_point] *
5869 jac[comp][comp] * inv_det;
5876 this->jacobian[q_point] :
5884 const VectorizedArrayType inv_det =
5885 (is_face && dim == 2 && this->get_face_no() < 2) ?
5889 for (
unsigned int comp = 0; comp < n_components; ++comp)
5892 this->values_quad[q_point] * jac[comp][0] * inv_det;
5893 for (
unsigned int e = 1;
e < dim; ++
e)
5895 this->values_quad[e * nqp + q_point] * jac[comp][e] * inv_det;
5903 return BaseClass::get_value(q_point);
5907template <
int dim,
typename Number,
bool is_face,
typename VectorizedArrayType>
5912 if (this->data->element_type ==
5917 Assert(this->gradients_quad_initialized ==
true,
5922 Assert(this->jacobian !=
nullptr,
5924 "update_gradients"));
5925 const std::size_t nqp = this->n_quadrature_points;
5935 const VectorizedArrayType inv_det =
5936 (dim == 2) ? this->jacobian[0][0][0] * this->jacobian[0][1][1] :
5937 this->jacobian[0][0][0] * this->jacobian[0][1][1] *
5938 this->jacobian[0][2][2];
5941 for (
unsigned int d = 0;
d < dim; ++
d)
5942 for (
unsigned int comp = 0; comp < n_components; ++comp)
5944 this->gradients_quad[(comp * dim + d) * nqp + q_point] *
5945 inv_t_jac[
d][
d] * jac[comp][comp] * inv_det;
5955 const VectorizedArrayType inv_det =
5956 (is_face && dim == 2 && this->get_face_no() < 2) ?
5960 VectorizedArrayType tmp;
5962 for (
unsigned int comp = 0; comp < n_components; ++comp)
5963 for (
unsigned int d = 0;
d < dim; ++
d)
5966 for (
unsigned int f = 0; f < dim; ++f)
5967 for (
unsigned int e = 0;
e < dim; ++
e)
5968 tmp += jac[comp][f] * inv_t_jac[d][e] * inv_det *
5969 this->gradients_quad[(f * dim + e) * nqp + q_point];
5971 grad_out[comp][
d] = tmp;
5982 Assert(this->jacobian_gradients_non_inverse !=
nullptr,
5984 "update_hessians"));
5986 const auto &jac_grad = this->jacobian_gradients_non_inverse[q_point];
5988 this->jacobian[q_point];
5992 const VectorizedArrayType inv_det =
5993 (is_face && dim == 2 && this->get_face_no() < 2) ?
5997 VectorizedArrayType tmp;
5999 for (
unsigned int comp = 0; comp < n_components; ++comp)
6000 for (
unsigned int d = 0;
d < dim; ++
d)
6003 for (
unsigned int f = 0; f < dim; ++f)
6004 for (
unsigned int e = 0;
e < dim; ++
e)
6005 tmp += t_jac[f][comp] * inv_t_jac[d][e] *
6006 this->gradients_quad[(f * dim + e) * nqp + q_point];
6008 grad_out[comp][
d] = tmp * inv_det;
6017 for (
unsigned int i = 0; i < dim; ++i)
6018 for (
unsigned int j = 0; j < dim; ++j)
6020 tmp = jac_grad[0][i] * inv_t_jac[j][0] *
6021 this->values_quad[q_point];
6022 for (
unsigned int f = 1; f < dim; ++f)
6023 tmp += jac_grad[f][i] * inv_t_jac[j][f] *
6024 this->values_quad[f * nqp + q_point];
6026 grad_out[i][j] += tmp * inv_det;
6029 for (
unsigned int i = 0; i < dim; ++i)
6030 for (
unsigned int j = 0; j < dim; ++j)
6033 for (
unsigned int f = 0; f < dim; ++f)
6034 for (
unsigned int n = 0; n < dim; ++n)
6035 for (
unsigned int m = 0; m < dim; ++m)
6036 tmp += inv_t_jac[m][f] * jac_grad[f][m] *
6037 inv_t_jac[j][f] * t_jac[n][i] *
6038 this->values_quad[n * nqp + q_point];
6039 grad_out[i][j] -= tmp * inv_det;
6048 for (
unsigned int i = 0; i < dim; ++i)
6049 for (
unsigned int j = 0; j < dim; ++j)
6052 for (
unsigned int r = 0, f = dim; r < dim; ++r)
6053 for (
unsigned int k = r + 1; k < dim; ++k, ++f)
6055 tmp += jac_grad[f][i] *
6057 this->values_quad[r * nqp + q_point] +
6059 this->values_quad[k * nqp + q_point]);
6060 for (
unsigned int n = 0; n < dim; ++n)
6061 for (
unsigned int m = 0; m < dim; ++m)
6062 tmp -= jac_grad[f][m] * t_jac[n][i] *
6063 this->values_quad[n * nqp + q_point] *
6064 (inv_t_jac[m][k] * inv_t_jac[j][r] +
6065 inv_t_jac[m][r] * inv_t_jac[j][k]);
6067 grad_out[i][j] += tmp * inv_det;
6075 return BaseClass::get_gradient(q_point);
6081template <
int dim,
typename Number,
bool is_face,
typename VectorizedArrayType>
6087 Assert(this->gradients_quad_initialized ==
true,
6091 Assert(this->jacobian !=
nullptr,
6093 "update_gradients"));
6095 VectorizedArrayType divergence;
6096 const std::size_t nqp = this->n_quadrature_points;
6098 if (this->data->element_type ==
6105 const VectorizedArrayType inv_det =
6106 (dim == 2) ? this->jacobian[0][0][0] * this->jacobian[0][1][1] :
6107 this->jacobian[0][0][0] * this->jacobian[0][1][1] *
6108 this->jacobian[0][2][2];
6111 divergence = this->gradients_quad[q_point] * inv_det;
6112 for (
unsigned int d = 1;
d < dim; ++
d)
6114 this->gradients_quad[(dim * d + d) * nqp + q_point] * inv_det;
6120 const VectorizedArrayType inv_det =
6122 this->jacobian[this->cell_type >
6126 Number((is_face && dim == 2 && this->get_face_no() < 2) ? -1 : 1);
6129 divergence = this->gradients_quad[q_point] * inv_det;
6130 for (
unsigned int d = 1;
d < dim; ++
d)
6132 this->gradients_quad[(dim * d + d) * nqp + q_point] * inv_det;
6141 divergence = this->gradients_quad[q_point] * this->jacobian[0][0][0];
6142 for (
unsigned int d = 1;
d < dim; ++
d)
6143 divergence += this->gradients_quad[(dim * d + d) * nqp + q_point] *
6144 this->jacobian[0][
d][
d];
6151 this->jacobian[q_point] :
6153 divergence = jac[0][0] * this->gradients_quad[q_point];
6154 for (
unsigned int e = 1;
e < dim; ++
e)
6155 divergence += jac[0][e] * this->gradients_quad[e * nqp + q_point];
6156 for (
unsigned int d = 1;
d < dim; ++
d)
6157 for (
unsigned int e = 0;
e < dim; ++
e)
6159 jac[d][e] * this->gradients_quad[(d * dim + e) * nqp + q_point];
6167template <
int dim,
typename Number,
bool is_face,
typename VectorizedArrayType>
6173 const auto grad = get_gradient(q_point);
6174 VectorizedArrayType symmetrized[(dim * dim + dim) / 2];
6175 VectorizedArrayType half = Number(0.5);
6176 for (
unsigned int d = 0;
d < dim; ++
d)
6177 symmetrized[d] = grad[d][d];
6183 symmetrized[2] = grad[0][1] + grad[1][0];
6184 symmetrized[2] *= half;
6187 symmetrized[3] = grad[0][1] + grad[1][0];
6188 symmetrized[3] *= half;
6189 symmetrized[4] = grad[0][2] + grad[2][0];
6190 symmetrized[4] *= half;
6191 symmetrized[5] = grad[1][2] + grad[2][1];
6192 symmetrized[5] *= half;
6202template <
int dim,
typename Number,
bool is_face,
typename VectorizedArrayType>
6204 Tensor<1, (dim == 2 ? 1 : dim), VectorizedArrayType>
6206 const unsigned int q_point)
const
6210 Tensor<1, (dim == 2 ? 1 : dim), VectorizedArrayType> curl;
6216 "Computing the curl in 1d is not a useful operation"));
6219 curl[0] = grad[1][0] - grad[0][1];
6222 curl[0] = grad[2][1] - grad[1][2];
6223 curl[1] = grad[0][2] - grad[2][0];
6224 curl[2] = grad[1][0] - grad[0][1];
6234template <
int dim,
typename Number,
bool is_face,
typename VectorizedArrayType>
6239 return BaseClass::get_hessian_diagonal(q_point);
6244template <
int dim,
typename Number,
bool is_face,
typename VectorizedArrayType>
6247 const unsigned int q_point)
const
6250 Assert(this->hessians_quad_initialized ==
true,
6254 return BaseClass::get_hessian(q_point);
6258template <
int dim,
typename Number,
bool is_face,
typename VectorizedArrayType>
6262 const unsigned int q_point)
6264 if (this->data->element_type ==
6269 Assert(this->J_value !=
nullptr,
6274 this->values_quad_submitted =
true;
6277 const std::size_t nqp = this->n_quadrature_points;
6282 const VectorizedArrayType weight = this->quadrature_weights[q_point];
6284 for (
unsigned int comp = 0; comp < n_components; ++comp)
6285 this->values_quad[comp * nqp + q_point] =
6286 val_in[comp] * weight * jac[comp][comp];
6293 this->jacobian[q_point] :
6302 const VectorizedArrayType fac =
6304 this->quadrature_weights[q_point] :
6306 this->J_value[q_point] :
6307 this->J_value[0] * this->quadrature_weights[q_point]) *
6308 ((dim == 2 && this->get_face_no() < 2) ?
6313 for (
unsigned int comp = 0; comp < n_components; ++comp)
6315 this->values_quad[comp * nqp + q_point] =
6316 val_in[0] * jac[0][comp] * fac;
6317 for (
unsigned int e = 1;
e < dim; ++
e)
6318 this->values_quad[comp * nqp + q_point] +=
6319 val_in[e] * jac[e][comp] * fac;
6326 BaseClass::submit_value(val_in, q_point);
6330template <
int dim,
typename Number,
bool is_face,
typename VectorizedArrayType>
6334 const unsigned int q_point)
6336 if (this->data->element_type ==
6345 Assert(this->J_value !=
nullptr,
6347 "update_gradients"));
6348 Assert(this->jacobian !=
nullptr,
6350 "update_gradients"));
6352 this->gradients_quad_submitted =
true;
6355 const std::size_t nqp = this->n_quadrature_points;
6363 const VectorizedArrayType weight = this->quadrature_weights[q_point];
6364 for (
unsigned int d = 0;
d < dim; ++
d)
6365 for (
unsigned int comp = 0; comp < n_components; ++comp)
6366 this->gradients_quad[(comp * dim + d) * nqp + q_point] =
6367 grad_in[comp][
d] * inv_t_jac[
d][
d] * jac[comp][comp] * weight;
6378 const VectorizedArrayType fac =
6379 (!is_face) ? this->quadrature_weights[q_point] :
6380 this->J_value[0] * this->quadrature_weights[q_point] *
6381 ((dim == 2 && this->get_face_no() < 2) ?
6386 for (
unsigned int comp = 0; comp < n_components; ++comp)
6387 for (
unsigned int d = 0;
d < dim; ++
d)
6389 VectorizedArrayType tmp = 0;
6390 for (
unsigned int f = 0; f < dim; ++f)
6391 for (
unsigned int e = 0;
e < dim; ++
e)
6392 tmp += jac[f][comp] * inv_t_jac[e][d] * grad_in[f][e];
6394 this->gradients_quad[(comp * dim +
d) * nqp + q_point] =
6402 const auto &jac_grad = this->jacobian_gradients_non_inverse[q_point];
6404 this->jacobian[q_point];
6409 const VectorizedArrayType fac =
6411 this->quadrature_weights[q_point] :
6412 this->J_value[q_point] * ((dim == 2 && this->get_face_no() < 2) ?
6416 VectorizedArrayType tmp;
6418 for (
unsigned int comp = 0; comp < n_components; ++comp)
6419 for (
unsigned int d = 0;
d < dim; ++
d)
6422 for (
unsigned int f = 0; f < dim; ++f)
6423 for (
unsigned int e = 0;
e < dim; ++
e)
6424 tmp += t_jac[comp][f] * inv_t_jac[e][d] * grad_in[f][e];
6426 this->gradients_quad[(comp * dim +
d) * nqp + q_point] =
6436 for (
unsigned int f = 0; f < dim; ++f)
6439 for (
unsigned int i = 0; i < dim; ++i)
6440 for (
unsigned int j = 0; j < dim; ++j)
6442 tmp += inv_t_jac[j][f] * jac_grad[f][i] * grad_in[i][j];
6443 for (
unsigned int m = 0; m < dim; ++m)
6444 for (
unsigned int k = 0; k < dim; ++k)
6445 tmp -= inv_t_jac[m][k] * jac_grad[k][m] *
6446 inv_t_jac[j][k] * t_jac[f][i] * grad_in[i][j];
6448 this->values_from_gradients_quad[f * nqp + q_point] = tmp * fac;
6456 for (
unsigned int r = 0, f = dim; r < dim; ++r)
6457 for (
unsigned int k = r + 1; k < dim; ++k, ++f)
6459 tmp = jac_grad[f][0] * inv_t_jac[0][k] * grad_in[0][0];
6460 for (
unsigned int j = 1; j < dim; ++j)
6461 tmp += jac_grad[f][0] * inv_t_jac[j][k] * grad_in[0][j];
6462 for (
unsigned int i = 1; i < dim; ++i)
6463 for (
unsigned int j = 0; j < dim; ++j)
6464 tmp += jac_grad[f][i] * inv_t_jac[j][k] * grad_in[i][j];
6465 this->values_from_gradients_quad[r * nqp + q_point] +=
6468 tmp = jac_grad[f][0] * inv_t_jac[0][r] * grad_in[0][0];
6469 for (
unsigned int j = 1; j < dim; ++j)
6470 tmp += jac_grad[f][0] * inv_t_jac[j][r] * grad_in[0][j];
6471 for (
unsigned int i = 1; i < dim; ++i)
6472 for (
unsigned int j = 0; j < dim; ++j)
6473 tmp += jac_grad[f][i] * inv_t_jac[j][r] * grad_in[i][j];
6474 this->values_from_gradients_quad[k * nqp + q_point] +=
6479 for (
unsigned int n = 0; n < dim; ++n)
6482 for (
unsigned int r = 0, f = dim; r < dim; ++r)
6483 for (
unsigned int k = r + 1; k < dim; ++k, ++f)
6484 for (
unsigned int i = 0; i < dim; ++i)
6485 for (
unsigned int j = 0; j < dim; ++j)
6486 for (
unsigned int m = 0; m < dim; ++m)
6487 tmp += jac_grad[f][m] * t_jac[n][i] * grad_in[i][j] *
6488 (inv_t_jac[m][k] * inv_t_jac[j][r] +
6489 inv_t_jac[m][r] * inv_t_jac[j][k]);
6491 this->values_from_gradients_quad[n * nqp + q_point] -=
6499 BaseClass::submit_gradient(grad_in, q_point);
6505template <
int dim,
typename Number,
bool is_face,
typename VectorizedArrayType>
6510 const unsigned int q_point)
6512 if (this->data->element_type ==
6522 BaseClass::submit_gradient(grad_in, q_point);
6528template <
int dim,
typename Number,
bool is_face,
typename VectorizedArrayType>
6532 const unsigned int q_point)
6538 Assert(this->J_value !=
nullptr,
6540 "update_gradients"));
6541 Assert(this->jacobian !=
nullptr,
6543 "update_gradients"));
6545 this->gradients_quad_submitted =
true;
6548 const std::size_t nqp = this->n_quadrature_points;
6549 if (this->data->element_type ==
6556 const VectorizedArrayType fac =
6558 this->quadrature_weights[q_point] * div_in :
6560 this->J_value[q_point] :
6561 this->J_value[0] * this->quadrature_weights[q_point]) *
6564 this->jacobian[this->cell_type >
6568 Number((dim == 2 && this->get_face_no() < 2) ? -1 : 1);
6570 for (
unsigned int d = 0;
d < dim; ++
d)
6572 this->gradients_quad[(dim *
d +
d) * nqp + q_point] = fac;
6573 for (
unsigned int e = d + 1;
e < dim; ++
e)
6575 this->gradients_quad[(dim *
d +
e) * nqp + q_point] =
6576 VectorizedArrayType();
6577 this->gradients_quad[(dim *
e +
d) * nqp + q_point] =
6578 VectorizedArrayType();
6581 this->divergence_is_requested =
true;
6588 const VectorizedArrayType fac =
6589 this->J_value[0] * this->quadrature_weights[q_point] * div_in;
6590 for (
unsigned int d = 0;
d < dim; ++
d)
6592 this->gradients_quad[(
d * dim +
d) * nqp + q_point] =
6593 (fac * this->jacobian[0][d][d]);
6594 for (
unsigned int e = d + 1;
e < dim; ++
e)
6596 this->gradients_quad[(
d * dim +
e) * nqp + q_point] =
6597 VectorizedArrayType();
6598 this->gradients_quad[(
e * dim +
d) * nqp + q_point] =
6599 VectorizedArrayType();
6607 this->jacobian[q_point] :
6609 const VectorizedArrayType fac =
6611 this->J_value[q_point] :
6612 this->J_value[0] * this->quadrature_weights[q_point]) *
6614 for (
unsigned int d = 0;
d < dim; ++
d)
6616 for (
unsigned int e = 0;
e < dim; ++
e)
6617 this->gradients_quad[(d * dim + e) * nqp + q_point] =
6626template <
int dim,
typename Number,
bool is_face,
typename VectorizedArrayType>
6631 const unsigned int q_point)
6634 this->data->element_type !=
6645 Assert(this->J_value !=
nullptr,
6647 "update_gradients"));
6648 Assert(this->jacobian !=
nullptr,
6650 "update_gradients"));
6652 this->gradients_quad_submitted =
true;
6655 const std::size_t nqp = this->n_quadrature_points;
6658 const VectorizedArrayType JxW =
6659 this->J_value[0] * this->quadrature_weights[q_point];
6660 for (
unsigned int d = 0;
d < dim; ++
d)
6661 this->gradients_quad[(d * dim + d) * nqp + q_point] =
6663 for (
unsigned int e = 0, counter = dim;
e < dim; ++
e)
6664 for (
unsigned int d = e + 1;
d < dim; ++
d, ++counter)
6666 const VectorizedArrayType
value =
6668 this->gradients_quad[(
e * dim +
d) * nqp + q_point] =
6669 value * this->jacobian[0][d][d];
6670 this->gradients_quad[(
d * dim +
e) * nqp + q_point] =
6671 value * this->jacobian[0][e][e];
6677 const VectorizedArrayType JxW =
6679 this->J_value[q_point] :
6680 this->J_value[0] * this->quadrature_weights[q_point];
6683 this->jacobian[q_point] :
6685 VectorizedArrayType weighted[dim][dim];
6686 for (
unsigned int i = 0; i < dim; ++i)
6688 for (
unsigned int i = 0, counter = dim; i < dim; ++i)
6689 for (
unsigned int j = i + 1; j < dim; ++j, ++counter)
6691 const VectorizedArrayType
value =
6693 weighted[i][j] =
value;
6694 weighted[j][i] =
value;
6696 for (
unsigned int comp = 0; comp < dim; ++comp)
6697 for (
unsigned int d = 0;
d < dim; ++
d)
6699 VectorizedArrayType new_val = jac[0][
d] * weighted[comp][0];
6700 for (
unsigned int e = 1;
e < dim; ++
e)
6701 new_val += jac[e][d] * weighted[comp][e];
6702 this->gradients_quad[(comp * dim +
d) * nqp + q_point] = new_val;
6709template <
int dim,
typename Number,
bool is_face,
typename VectorizedArrayType>
6713 const unsigned int q_point)
6721 "Testing by the curl in 1d is not a useful operation"));
6724 grad[1][0] = curl[0];
6725 grad[0][1] = -curl[0];
6728 grad[2][1] = curl[0];
6729 grad[1][2] = -curl[0];
6730 grad[0][2] = curl[1];
6731 grad[2][0] = -curl[1];
6732 grad[1][0] = curl[2];
6733 grad[0][1] = -curl[2];
6738 submit_gradient(grad, q_point);
6745template <
typename Number,
bool is_face,
typename VectorizedArrayType>
6749 const unsigned int dof_no,
6750 const unsigned int first_selected_component,
6751 const unsigned int quad_no,
6752 const unsigned int fe_degree,
6753 const unsigned int n_q_points,
6754 const bool is_interior_face,
6755 const unsigned int active_fe_index,
6756 const unsigned int active_quad_index,
6757 const unsigned int face_type)
6761 first_selected_component,
6773template <
typename Number,
bool is_face,
typename VectorizedArrayType>
6780 const unsigned int first_selected_component,
6787 first_selected_component,
6793template <
typename Number,
bool is_face,
typename VectorizedArrayType>
6802template <
typename Number,
bool is_face,
typename VectorizedArrayType>
6814template <
typename Number,
bool is_face,
typename VectorizedArrayType>
6817 const unsigned int dof)
const
6820 return this->values_dofs[dof];
6825template <
typename Number,
bool is_face,
typename VectorizedArrayType>
6828 const unsigned int q_point)
const
6831 Assert(this->values_quad_initialized ==
true,
6835 return this->values_quad[q_point];
6840template <
typename Number,
bool is_face,
typename VectorizedArrayType>
6843 const unsigned int q_point)
const
6849 Assert(this->gradients_quad_initialized ==
true,
6856 this->jacobian[q_point] :
6860 grad_out[0] = jac[0][0] * this->gradients_quad[q_point];
6867template <
typename Number,
bool is_face,
typename VectorizedArrayType>
6870 const unsigned int q_point)
const
6872 return get_gradient(q_point)[0];
6877template <
typename Number,
bool is_face,
typename VectorizedArrayType>
6882 return BaseClass::get_normal_derivative(q_point)[0];
6887template <
typename Number,
bool is_face,
typename VectorizedArrayType>
6890 const unsigned int q_point)
const
6892 return BaseClass::get_hessian(q_point)[0];
6897template <
typename Number,
bool is_face,
typename VectorizedArrayType>
6902 return BaseClass::get_hessian_diagonal(q_point)[0];
6907template <
typename Number,
bool is_face,
typename VectorizedArrayType>
6910 const unsigned int q_point)
const
6912 return BaseClass::get_laplacian(q_point)[0];
6917template <
typename Number,
bool is_face,
typename VectorizedArrayType>
6923 this->dof_values_initialized =
true;
6926 this->values_dofs[dof] = val_in;
6931template <
typename Number,
bool is_face,
typename VectorizedArrayType>
6934 const VectorizedArrayType val_in,
6935 const unsigned int q_point)
6942 this->values_quad_submitted =
true;
6947 const VectorizedArrayType JxW = this->J_value[q_point];
6948 this->values_quad[q_point] = val_in * JxW;
6952 const VectorizedArrayType JxW =
6953 this->J_value[0] * this->quadrature_weights[q_point];
6954 this->values_quad[q_point] = val_in * JxW;
6960template <
typename Number,
bool is_face,
typename VectorizedArrayType>
6964 const unsigned int q_point)
6966 submit_value(val_in[0], q_point);
6971template <
typename Number,
bool is_face,
typename VectorizedArrayType>
6975 const unsigned int q_point)
6977 submit_gradient(grad_in[0], q_point);
6982template <
typename Number,
bool is_face,
typename VectorizedArrayType>
6985 const VectorizedArrayType grad_in,
6986 const unsigned int q_point)
6993 this->gradients_quad_submitted =
true;
6998 this->jacobian[q_point] :
7000 const VectorizedArrayType JxW =
7002 this->J_value[q_point] :
7003 this->J_value[0] * this->quadrature_weights[q_point];
7005 this->gradients_quad[q_point] = jac[0][0] * grad_in * JxW;
7010template <
typename Number,
bool is_face,
typename VectorizedArrayType>
7014 const unsigned int q_point)
7016 submit_gradient(grad_in[0][0], q_point);
7021template <
typename Number,
bool is_face,
typename VectorizedArrayType>
7025 const unsigned int q_point)
7029 BaseClass::submit_normal_derivative(grad, q_point);
7034template <
typename Number,
bool is_face,
typename VectorizedArrayType>
7038 const unsigned int q_point)
7040 BaseClass::submit_normal_derivative(grad_in, q_point);
7044template <
typename Number,
bool is_face,
typename VectorizedArrayType>
7048 const unsigned int q_point)
7052 BaseClass::submit_hessian(
hessian, q_point);
7056template <
typename Number,
bool is_face,
typename VectorizedArrayType>
7057inline VectorizedArrayType
7061 return BaseClass::integrate_value()[0];
7074 typename VectorizedArrayType>
7080 VectorizedArrayType>::
7082 const unsigned int fe_no,
7083 const unsigned int quad_no,
7084 const unsigned int first_selected_component,
7085 const unsigned int active_fe_index,
7086 const unsigned int active_quad_index)
7087 : BaseClass(matrix_free,
7089 first_selected_component,
7096 , dofs_per_component(this->data->dofs_per_component_on_cell)
7097 , dofs_per_cell(this->data->dofs_per_component_on_cell * n_components_)
7098 , n_q_points(this->data->n_q_points)
7100 check_template_arguments(fe_no, 0);
7110 typename VectorizedArrayType>
7116 VectorizedArrayType>::
7118 const std::pair<unsigned int, unsigned int> & range,
7119 const unsigned int dof_no,
7120 const unsigned int quad_no,
7121 const unsigned int first_selected_component)
7125 first_selected_component,
7126 matrix_free.get_cell_active_fe_index(range))
7136 typename VectorizedArrayType>
7142 VectorizedArrayType>::
7147 const unsigned int first_selected_component)
7148 : BaseClass(mapping,
7152 first_selected_component,
7154 , dofs_per_component(this->data->dofs_per_component_on_cell)
7155 , dofs_per_cell(this->data->dofs_per_component_on_cell * n_components_)
7156 , n_q_points(this->data->n_q_points)
7168 typename VectorizedArrayType>
7174 VectorizedArrayType>::
7178 const unsigned int first_selected_component)
7183 first_selected_component,
7185 , dofs_per_component(this->data->dofs_per_component_on_cell)
7186 , dofs_per_cell(this->data->dofs_per_component_on_cell * n_components_)
7187 , n_q_points(this->data->n_q_points)
7199 typename VectorizedArrayType>
7205 VectorizedArrayType>::
7208 const unsigned int first_selected_component)
7209 : BaseClass(other.mapped_geometry->get_fe_values().get_mapping(),
7211 other.mapped_geometry->get_quadrature(),
7212 other.mapped_geometry->get_fe_values().get_update_flags(),
7213 first_selected_component,
7215 , dofs_per_component(this->data->dofs_per_component_on_cell)
7216 , dofs_per_cell(this->data->dofs_per_component_on_cell * n_components_)
7217 , n_q_points(this->data->n_q_points)
7229 typename VectorizedArrayType>
7238 , dofs_per_component(this->data->dofs_per_component_on_cell)
7239 , dofs_per_cell(this->data->dofs_per_component_on_cell * n_components_)
7240 , n_q_points(this->data->n_q_points)
7252 typename VectorizedArrayType>
7258 VectorizedArrayType> &
7264 VectorizedArrayType>::operator=(
const FEEvaluation &other)
7266 BaseClass::operator=(other);
7278 typename VectorizedArrayType>
7285 VectorizedArrayType>::
7286 check_template_arguments(
const unsigned int dof_no,
7287 const unsigned int first_selected_component)
7290 (void)first_selected_component;
7293 this->data->dofs_per_component_on_cell > 0,
7295 "There is nothing useful you can do with an FEEvaluation object with "
7296 "FE_Nothing, i.e., without DoFs! If you have passed to "
7297 "MatrixFree::reinit() a collection of finite elements also containing "
7298 "FE_Nothing, please check - before creating FEEvaluation - the category "
7299 "of the current range by calling either "
7300 "MatrixFree::get_cell_range_category(range) or "
7301 "MatrixFree::get_face_range_category(range). The returned category "
7302 "is the index of the active FE, which you can use to exclude "
7309 static_cast<unsigned int>(fe_degree) !=
7310 this->data->data.front().fe_degree) ||
7311 n_q_points != this->n_quadrature_points)
7313 std::string message =
7314 "-------------------------------------------------------\n";
7315 message +=
"Illegal arguments in constructor/wrong template arguments!\n";
7316 message +=
" Called --> FEEvaluation<dim,";
7320 message +=
",Number>(data";
7336 if (
static_cast<unsigned int>(fe_degree) ==
7337 this->data->data.front().fe_degree)
7339 proposed_dof_comp = dof_no;
7340 proposed_fe_comp = first_selected_component;
7343 for (
unsigned int no = 0; no < this->matrix_free->
n_components();
7345 for (
unsigned int nf = 0;
7348 if (this->matrix_free
7349 ->get_shape_info(no, 0, nf, this->active_fe_index, 0)
7351 .fe_degree ==
static_cast<unsigned int>(fe_degree))
7353 proposed_dof_comp = no;
7354 proposed_fe_comp = nf;
7358 this->mapping_data->descriptor[this->active_quad_index]
7360 proposed_quad_comp = this->quad_no;
7362 for (
unsigned int no = 0;
7367 .descriptor[this->active_quad_index]
7368 .n_q_points == n_q_points)
7370 proposed_quad_comp = no;
7377 if (proposed_dof_comp != first_selected_component)
7378 message +=
"Wrong vector component selection:\n";
7380 message +=
"Wrong quadrature formula selection:\n";
7381 message +=
" Did you mean FEEvaluation<dim,";
7385 message +=
",Number>(data";
7394 std::string correct_pos;
7395 if (proposed_dof_comp != dof_no)
7396 correct_pos =
" ^ ";
7399 if (proposed_quad_comp != this->quad_no)
7400 correct_pos +=
" ^ ";
7403 if (proposed_fe_comp != first_selected_component)
7404 correct_pos +=
" ^\n";
7406 correct_pos +=
" \n";
7412 const unsigned int proposed_n_q_points_1d =
static_cast<unsigned int>(
7413 std::pow(1.001 * this->n_quadrature_points, 1. / dim));
7414 message +=
"Wrong template arguments:\n";
7415 message +=
" Did you mean FEEvaluation<dim,";
7420 message +=
",Number>(data";
7428 std::string correct_pos;
7429 if (this->data->data.front().fe_degree !=
7430 static_cast<unsigned int>(fe_degree))
7434 if (proposed_n_q_points_1d != n_q_points_1d)
7435 correct_pos +=
" ^\n";
7437 correct_pos +=
" \n";
7438 message +=
" " + correct_pos;
7440 Assert(
static_cast<unsigned int>(fe_degree) ==
7441 this->data->data.front().fe_degree &&
7442 n_q_points == this->n_quadrature_points,
7448 this->mapping_data->descriptor[this->active_quad_index].n_q_points);
7459 typename VectorizedArrayType>
7468 Assert(this->matrix_free !=
nullptr,
7469 ExcMessage(
"FEEvaluation was initialized without a matrix-free object."
7470 " Integer indexing is not possible."));
7478 const unsigned int offsets =
7479 this->mapping_data->data_index_offsets[
cell_index];
7480 this->jacobian = &this->mapping_data->jacobians[0][offsets];
7481 this->J_value = &this->mapping_data->JxW_values[offsets];
7482 if (!this->mapping_data->jacobian_gradients[0].empty())
7484 this->jacobian_gradients =
7485 this->mapping_data->jacobian_gradients[0].data() + offsets;
7486 this->jacobian_gradients_non_inverse =
7487 this->mapping_data->jacobian_gradients_non_inverse[0].data() + offsets;
7491 VectorizedArrayType::size())
7494 for (
unsigned int i = 0; i < VectorizedArrayType::size(); ++i)
7495 this->cell_ids[i] =
cell_index * VectorizedArrayType::size() + i;
7502 this->cell_ids[i] =
cell_index * VectorizedArrayType::size() + i;
7503 for (; i < VectorizedArrayType::size(); ++i)
7507 if (this->mapping_data->quadrature_points.empty() ==
false)
7508 this->quadrature_points =
7509 &this->mapping_data->quadrature_points
7510 [this->mapping_data->quadrature_point_offsets[this->cell]];
7513 this->is_reinitialized =
true;
7514 this->dof_values_initialized =
false;
7515 this->values_quad_initialized =
false;
7516 this->gradients_quad_initialized =
false;
7517 this->hessians_quad_initialized =
false;
7528 typename VectorizedArrayType>
7535 VectorizedArrayType>
::
7536 reinit(
const std::array<
unsigned int, VectorizedArrayType::size()> &cell_ids)
7542 this->cell_ids = cell_ids;
7547 for (
unsigned int v = 0; v < VectorizedArrayType::size(); ++v)
7561 if (this->mapped_geometry ==
nullptr)
7562 this->mapped_geometry =
7563 std::make_shared<internal::MatrixFreeFunctions::
7564 MappingDataOnTheFly<dim, VectorizedArrayType>>();
7566 auto &mapping_storage = this->mapped_geometry->get_data_storage();
7568 auto &this_jacobian_data = mapping_storage.jacobians[0];
7569 auto &this_J_value_data = mapping_storage.JxW_values;
7570 auto &this_jacobian_gradients_data = mapping_storage.jacobian_gradients[0];
7571 auto &this_jacobian_gradients_non_inverse_data =
7572 mapping_storage.jacobian_gradients_non_inverse[0];
7573 auto &this_quadrature_points_data = mapping_storage.quadrature_points;
7577 if (this->mapping_data->jacobians[0].size() > 0)
7578 this_jacobian_data.resize_fast(2);
7580 if (this->mapping_data->JxW_values.size() > 0)
7581 this_J_value_data.resize_fast(1);
7583 if (this->mapping_data->jacobian_gradients[0].size() > 0)
7584 this_jacobian_gradients_data.resize_fast(1);
7586 if (this->mapping_data->jacobian_gradients_non_inverse[0].size() > 0)
7587 this_jacobian_gradients_non_inverse_data.resize_fast(1);
7589 if (this->mapping_data->quadrature_points.size() > 0)
7590 this_quadrature_points_data.resize_fast(1);
7594 if (this->mapping_data->jacobians[0].size() > 0)
7595 this_jacobian_data.resize_fast(this->n_quadrature_points);
7597 if (this->mapping_data->JxW_values.size() > 0)
7598 this_J_value_data.resize_fast(this->n_quadrature_points);
7600 if (this->mapping_data->jacobian_gradients[0].size() > 0)
7601 this_jacobian_gradients_data.resize_fast(this->n_quadrature_points);
7603 if (this->mapping_data->jacobian_gradients_non_inverse[0].size() > 0)
7604 this_jacobian_gradients_non_inverse_data.resize_fast(
7605 this->n_quadrature_points);
7607 if (this->mapping_data->quadrature_points.size() > 0)
7608 this_quadrature_points_data.resize_fast(this->n_quadrature_points);
7612 this->jacobian = this_jacobian_data.data();
7613 this->J_value = this_J_value_data.data();
7614 this->jacobian_gradients = this_jacobian_gradients_data.data();
7615 this->jacobian_gradients_non_inverse =
7616 this_jacobian_gradients_non_inverse_data.data();
7620 for (
unsigned int v = 0; v < VectorizedArrayType::size(); ++v)
7627 const unsigned int cell_batch_index =
7629 const unsigned int offsets =
7630 this->mapping_data->data_index_offsets[cell_batch_index];
7631 const unsigned int lane =
cell_index % VectorizedArrayType::size();
7633 if (this->cell_type <=
7637 const unsigned int q = 0;
7639 if (this->mapping_data->JxW_values.size() > 0)
7640 this_J_value_data[q][v] =
7641 this->mapping_data->JxW_values[offsets + q][lane];
7643 if (this->mapping_data->jacobians[0].size() > 0)
7644 for (
unsigned int q = 0; q < 2; ++q)
7645 for (
unsigned int i = 0; i < dim; ++i)
7646 for (
unsigned int j = 0; j < dim; ++j)
7647 this_jacobian_data[q][i][j][v] =
7648 this->mapping_data->jacobians[0][offsets + q][i][j][lane];
7650 if (this->mapping_data->jacobian_gradients[0].size() > 0)
7651 for (
unsigned int i = 0; i < dim * (dim + 1) / 2; ++i)
7652 for (
unsigned int j = 0; j < dim; ++j)
7653 this_jacobian_gradients_data[q][i][j][v] =
7655 ->jacobian_gradients[0][offsets + q][i][j][lane];
7657 if (this->mapping_data->jacobian_gradients_non_inverse[0].size() > 0)
7658 for (
unsigned int i = 0; i < dim * (dim + 1) / 2; ++i)
7659 for (
unsigned int j = 0; j < dim; ++j)
7660 this_jacobian_gradients_non_inverse_data[q][i][j][v] =
7662 ->jacobian_gradients_non_inverse[0][offsets + q][i][j]
7665 if (this->mapping_data->quadrature_points.size() > 0)
7666 for (
unsigned int i = 0; i < dim; ++i)
7667 this_quadrature_points_data[q][i][v] =
7668 this->mapping_data->quadrature_points
7670 ->quadrature_point_offsets[cell_batch_index] +
7676 const auto cell_type =
7680 for (
unsigned int q = 0; q < this->n_quadrature_points; ++q)
7682 const unsigned int q_src =
7688 if (this->mapping_data->JxW_values.size() > 0)
7689 this_J_value_data[q][v] =
7690 this->mapping_data->JxW_values[offsets + q_src][lane];
7692 if (this->mapping_data->jacobians[0].size() > 0)
7693 for (
unsigned int i = 0; i < dim; ++i)
7694 for (
unsigned int j = 0; j < dim; ++j)
7695 this_jacobian_data[q][i][j][v] =
7697 ->jacobians[0][offsets + q_src][i][j][lane];
7699 if (this->mapping_data->jacobian_gradients[0].size() > 0)
7700 for (
unsigned int i = 0; i < dim * (dim + 1) / 2; ++i)
7701 for (
unsigned int j = 0; j < dim; ++j)
7702 this_jacobian_gradients_data[q][i][j][v] =
7704 ->jacobian_gradients[0][offsets + q_src][i][j][lane];
7706 if (this->mapping_data->jacobian_gradients_non_inverse[0].size() >
7708 for (
unsigned int i = 0; i < dim * (dim + 1) / 2; ++i)
7709 for (
unsigned int j = 0; j < dim; ++j)
7710 this_jacobian_gradients_non_inverse_data[q][i][j][v] =
7712 ->jacobian_gradients_non_inverse[0][offsets + q_src][i]
7715 if (this->mapping_data->quadrature_points.size() > 0)
7724 this->mapping_data->quadrature_points
7726 ->quadrature_point_offsets[cell_batch_index] +
7730 this->mapping_data->jacobians[0][offsets + 1];
7732 for (
unsigned int d = 0;
d < dim; ++
d)
7735 static_cast<Number
>(
7736 this->descriptor->quadrature.point(q)[
d]);
7738 for (
unsigned int d = 0;
d < dim; ++
d)
7739 for (
unsigned int e = 0;
e < dim; ++
e)
7742 static_cast<Number
>(
7743 this->descriptor->quadrature.point(q)[
e]);
7745 for (
unsigned int i = 0; i < dim; ++i)
7746 this_quadrature_points_data[q][i][v] = point[i][lane];
7751 for (
unsigned int i = 0; i < dim; ++i)
7752 this_quadrature_points_data[q][i][v] =
7753 this->mapping_data->quadrature_points
7755 ->quadrature_point_offsets[cell_batch_index] +
7764 this->is_reinitialized =
true;
7765 this->dof_values_initialized =
false;
7766 this->values_quad_initialized =
false;
7767 this->gradients_quad_initialized =
false;
7768 this->hessians_quad_initialized =
false;
7779 typename VectorizedArrayType>
7780template <
bool level_dof_access>
7787 VectorizedArrayType>
::
7790 Assert(this->matrix_free ==
nullptr,
7791 ExcMessage(
"Cannot use initialization from cell iterator if "
7792 "initialized from MatrixFree object. Use variant for "
7793 "on the fly computation with arguments as for FEValues "
7796 this->mapped_geometry->reinit(
7798 this->local_dof_indices.resize(cell->get_fe().n_dofs_per_cell());
7799 if (level_dof_access)
7800 cell->get_mg_dof_indices(this->local_dof_indices);
7802 cell->get_dof_indices(this->local_dof_indices);
7805 this->is_reinitialized =
true;
7816 typename VectorizedArrayType>
7823 VectorizedArrayType>
::
7826 Assert(this->matrix_free == 0,
7827 ExcMessage(
"Cannot use initialization from cell iterator if "
7828 "initialized from MatrixFree object. Use variant for "
7829 "on the fly computation with arguments as for FEValues "
7832 this->mapped_geometry->reinit(cell);
7835 this->is_reinitialized =
true;
7846 typename VectorizedArrayType>
7853 VectorizedArrayType>::evaluate(
const bool evaluate_values,
7854 const bool evaluate_gradients,
7855 const bool evaluate_hessians)
7858 Assert(this->dof_values_initialized ==
true,
7861 evaluate(this->values_dofs,
7873 typename VectorizedArrayType>
7880 VectorizedArrayType>::
7884 Assert(this->dof_values_initialized ==
true,
7887 evaluate(this->values_dofs, evaluation_flags);
7897 typename VectorizedArrayType>
7904 VectorizedArrayType>::evaluate(
const VectorizedArrayType
7906 const bool evaluate_values,
7907 const bool evaluate_gradients,
7908 const bool evaluate_hessians)
7917 evaluate(values_array, flag);
7927 typename VectorizedArrayType>
7934 VectorizedArrayType>::
7935 evaluate(
const VectorizedArrayType * values_array,
7938 const bool hessians_on_general_cells =
7942 if (hessians_on_general_cells)
7945 if (this->data->element_type ==
7954 evaluate(n_components, evaluation_flag_actual, values_array, *
this);
7960 evaluation_flag_actual,
7961 const_cast<VectorizedArrayType *
>(values_array),
7967 this->values_quad_initialized =
true;
7969 this->gradients_quad_initialized =
true;
7971 this->hessians_quad_initialized =
true;
7982 typename VectorizedArrayType>
7983template <
typename VectorType>
7991 VectorizedArrayType>::gather_evaluate(
const VectorType &input_vector,
7992 const bool evaluate_values,
7993 const bool evaluate_gradients,
7994 const bool evaluate_hessians)
8003 gather_evaluate(input_vector, flag);
8012 template <
typename Number,
8013 typename VectorizedArrayType,
8014 typename VectorType,
8015 typename EvaluatorType,
8016 std::enable_if_t<internal::has_begin<VectorType> &&
8018 VectorType> * =
nullptr>
8019 VectorizedArrayType *
8020 check_vector_access_inplace(
const EvaluatorType &fe_eval, VectorType &vector)
8026 const unsigned int cell = fe_eval.get_cell_or_face_batch_id();
8027 const auto & dof_info = fe_eval.get_dof_info();
8034 if (std::is_same<typename VectorType::value_type, Number>::value &&
8038 interleaved_contiguous &&
8039 reinterpret_cast<
std::size_t>(
8041 dof_info.dof_indices_contiguous
8042 [
internal::MatrixFreeFunctions::DoFInfo::dof_access_cell]
8043 [cell * VectorizedArrayType::size()]) %
8044 sizeof(VectorizedArrayType) ==
8047 return reinterpret_cast<VectorizedArrayType *
>(
8051 [cell * VectorizedArrayType::size()] +
8053 [fe_eval.get_active_fe_index()]
8054 [fe_eval.get_first_selected_component()] *
8055 VectorizedArrayType::size());
8064 template <
typename Number,
8065 typename VectorizedArrayType,
8066 typename VectorType,
8067 typename EvaluatorType,
8068 std::enable_if_t<!internal::has_begin<VectorType> ||
8070 VectorType> * =
nullptr>
8071 VectorizedArrayType *
8072 check_vector_access_inplace(
const EvaluatorType &, VectorType &)
8085 typename VectorizedArrayType>
8086template <
typename VectorType>
8093 VectorizedArrayType>::
8094 gather_evaluate(
const VectorType & input_vector,
8097 const VectorizedArrayType *src_ptr =
8098 internal::check_vector_access_inplace<Number, const VectorizedArrayType>(
8099 *
this, input_vector);
8100 if (src_ptr !=
nullptr)
8101 evaluate(src_ptr, evaluation_flag);
8104 this->read_dof_values(input_vector);
8105 evaluate(this->begin_dof_values(), evaluation_flag);
8116 typename VectorizedArrayType>
8123 VectorizedArrayType>::integrate(
const bool integrate_values,
8124 const bool integrate_gradients)
8126 integrate(integrate_values, integrate_gradients, this->values_dofs);
8129 this->dof_values_initialized =
true;
8140 typename VectorizedArrayType>
8147 VectorizedArrayType>::
8150 integrate(integration_flag, this->values_dofs);
8153 this->dof_values_initialized =
true;
8164 typename VectorizedArrayType>
8171 VectorizedArrayType>::integrate(
const bool integrate_values,
8172 const bool integrate_gradients,
8173 VectorizedArrayType *values_array)
8179 integrate(flag, values_array);
8189 typename VectorizedArrayType>
8196 VectorizedArrayType>::
8198 VectorizedArrayType * values_array,
8199 const bool sum_into_values_array)
8203 Assert(this->values_quad_submitted ==
true,
8206 Assert(this->gradients_quad_submitted ==
true,
8209 Assert(this->hessians_quad_submitted ==
true,
8212 Assert(this->matrix_free !=
nullptr ||
8213 this->mapped_geometry->is_initialized(),
8219 ExcMessage(
"Only EvaluationFlags::values, EvaluationFlags::gradients, and "
8220 "EvaluationFlags::hessians are supported."));
8226 unsigned int size = n_components * dim * n_q_points;
8229 for (
unsigned int i = 0; i < size; ++i)
8230 this->gradients_quad[i] += this->gradients_from_hessians_quad[i];
8234 for (
unsigned int i = 0; i < size; ++i)
8235 this->gradients_quad[i] = this->gradients_from_hessians_quad[i];
8240 if (this->data->element_type ==
8244 this->divergence_is_requested ==
false)
8246 unsigned int size = n_components * n_q_points;
8249 for (
unsigned int i = 0; i < size; ++i)
8250 this->values_quad[i] += this->values_from_gradients_quad[i];
8254 for (
unsigned int i = 0; i < size; ++i)
8255 this->values_quad[i] = this->values_from_gradients_quad[i];
8264 integration_flag_actual,
8267 sum_into_values_array);
8273 integration_flag_actual,
8276 sum_into_values_array);
8280 this->dof_values_initialized =
true;
8291 typename VectorizedArrayType>
8292template <
typename VectorType>
8300 VectorizedArrayType>::integrate_scatter(
const bool integrate_values,
8301 const bool integrate_gradients,
8302 VectorType &destination)
8309 integrate_scatter(flag, destination);
8319 typename VectorizedArrayType>
8320template <
typename VectorType>
8327 VectorizedArrayType>::
8329 VectorType & destination)
8331 VectorizedArrayType *dst_ptr =
8332 internal::check_vector_access_inplace<Number, VectorizedArrayType>(
8333 *
this, destination);
8334 if (dst_ptr !=
nullptr)
8335 integrate(integration_flag, dst_ptr,
true);
8338 integrate(integration_flag, this->begin_dof_values());
8339 this->distribute_local_to_global(destination);
8350 typename VectorizedArrayType>
8357 VectorizedArrayType>::dof_indices()
const
8359 return {0U, dofs_per_cell};
8373 typename VectorizedArrayType>
8379 VectorizedArrayType>::
8382 const bool is_interior_face,
8383 const unsigned int dof_no,
8384 const unsigned int quad_no,
8385 const unsigned int first_selected_component,
8386 const unsigned int active_fe_index,
8387 const unsigned int active_quad_index,
8388 const unsigned int face_type)
8389 : BaseClass(matrix_free,
8391 first_selected_component,
8399 , dofs_per_component(this->data->dofs_per_component_on_cell)
8400 , dofs_per_cell(this->data->dofs_per_component_on_cell * n_components_)
8401 , n_q_points(this->n_quadrature_points)
8411 typename VectorizedArrayType>
8417 VectorizedArrayType>::
8420 const std::pair<unsigned int, unsigned int> & range,
8421 const bool is_interior_face,
8422 const unsigned int dof_no,
8423 const unsigned int quad_no,
8424 const unsigned int first_selected_component)
8429 first_selected_component,
8430 matrix_free.get_face_active_fe_index(range,
8432 numbers::invalid_unsigned_int,
8433 matrix_free.get_face_info(range.
first).face_type)
8443 typename VectorizedArrayType>
8450 VectorizedArrayType>
::reinit(
const unsigned int face_index)
8452 Assert(this->mapped_geometry ==
nullptr,
8453 ExcMessage(
"FEEvaluation was initialized without a matrix-free object."
8454 " Integer indexing is not possible"));
8455 if (this->mapped_geometry !=
nullptr)
8458 this->cell = face_index;
8459 this->dof_access_index =
8460 this->is_interior_face() ?
8468 this->matrix_free->get_task_info().boundary_partition_data.back())
8469 Assert(this->is_interior_face(),
8471 "Boundary faces do not have a neighbor. When looping over "
8472 "boundary faces use FEFaceEvaluation with the parameter "
8473 "is_interior_face set to true. "));
8475 this->reinit_face(this->matrix_free->
get_face_info(face_index));
8480 this->face_ids[i] = face_index * VectorizedArrayType::size() + i;
8481 for (; i < VectorizedArrayType::size(); ++i)
8484 this->cell_type = this->matrix_free->
get_mapping_info().face_type[face_index];
8485 const unsigned int offsets =
8486 this->mapping_data->data_index_offsets[face_index];
8487 this->J_value = &this->mapping_data->JxW_values[offsets];
8488 this->normal_vectors = &this->mapping_data->normal_vectors[offsets];
8490 &this->mapping_data->jacobians[!this->is_interior_face()][offsets];
8491 this->normal_x_jacobian =
8493 ->normals_times_jacobians[!this->is_interior_face()][offsets];
8494 this->jacobian_gradients =
8495 this->mapping_data->jacobian_gradients[!this->is_interior_face()].data() +
8497 this->jacobian_gradients_non_inverse =
8499 ->jacobian_gradients_non_inverse[!this->is_interior_face()]
8503 if (this->mapping_data->quadrature_point_offsets.empty() ==
false)
8506 this->mapping_data->quadrature_point_offsets.size());
8508 this->mapping_data->quadrature_points.data() +
8509 this->mapping_data->quadrature_point_offsets[this->cell];
8513 this->is_reinitialized =
true;
8514 this->dof_values_initialized =
false;
8515 this->values_quad_initialized =
false;
8516 this->gradients_quad_initialized =
false;
8517 this->hessians_quad_initialized =
false;
8528 typename VectorizedArrayType>
8536 const unsigned int face_number)
8542 "You must set MatrixFree::AdditionalData::mapping_update_flags_faces_by_cells to use the present reinit method."));
8546 Assert(this->mapped_geometry ==
nullptr,
8547 ExcMessage(
"FEEvaluation was initialized without a matrix-free object."
8548 " Integer indexing is not possible"));
8549 if (this->mapped_geometry !=
nullptr)
8554 .faces_by_cells_type[
cell_index][face_number];
8557 this->dof_access_index =
8560 constexpr unsigned int n_lanes = VectorizedArrayType::size();
8562 if (this->is_interior_face() ==
false)
8567 for (
unsigned int i = 0; i < n_lanes; ++i)
8570 const unsigned int cell_this =
cell_index * n_lanes + i;
8572 unsigned int face_index =
8577 this->face_ids[i] = face_index;
8582 this->face_numbers[i] =
static_cast<std::uint8_t
>(-1);
8583 this->face_orientations[i] =
static_cast<std::uint8_t
>(-1);
8590 auto cell_m = faces.cells_interior[face_index % n_lanes];
8591 auto cell_p = faces.cells_exterior[face_index % n_lanes];
8593 const bool face_identifies_as_interior = cell_m != cell_this;
8595 Assert(cell_m == cell_this || cell_p == cell_this,
8599 if (face_identifies_as_interior)
8601 this->cell_ids[i] = cell_m;
8602 this->face_numbers[i] = faces.interior_face_no;
8606 this->cell_ids[i] = cell_p;
8607 this->face_numbers[i] = faces.exterior_face_no;
8610 const bool orientation_interior_face = faces.face_orientation >= 8;
8611 unsigned int face_orientation = faces.face_orientation % 8;
8612 if (face_identifies_as_interior != orientation_interior_face)
8614 constexpr std::array<std::uint8_t, 8> table{
8615 {0, 1, 2, 3, 6, 5, 4, 7}};
8616 face_orientation = table[face_orientation];
8618 this->face_orientations[i] = face_orientation;
8623 this->face_orientations[0] = 0;
8624 this->face_numbers[0] = face_number;
8625 for (
unsigned int i = 0; i < n_lanes; ++i)
8626 this->cell_ids[i] =
cell_index * n_lanes + i;
8627 for (
unsigned int i = 0; i < n_lanes; ++i)
8634 const unsigned int offsets =
8636 .face_data_by_cells[this->quad_no]
8641 .face_data_by_cells[this->quad_no]
8642 .JxW_values.size());
8644 .face_data_by_cells[this->quad_no]
8645 .JxW_values[offsets];
8647 .face_data_by_cells[this->quad_no]
8648 .normal_vectors[offsets];
8650 .face_data_by_cells[this->quad_no]
8651 .jacobians[!this->is_interior_face()][offsets];
8652 this->normal_x_jacobian =
8654 .face_data_by_cells[this->quad_no]
8655 .normals_times_jacobians[!this->is_interior_face()][offsets];
8656 this->jacobian_gradients =
8657 this->mapping_data->jacobian_gradients[!this->is_interior_face()].data() +
8659 this->jacobian_gradients_non_inverse =
8661 ->jacobian_gradients_non_inverse[!this->is_interior_face()]
8666 .face_data_by_cells[this->quad_no]
8667 .quadrature_point_offsets.empty() ==
false)
8669 const unsigned int index =
8673 .face_data_by_cells[this->quad_no]
8674 .quadrature_point_offsets.size());
8676 .face_data_by_cells[this->quad_no]
8677 .quadrature_points.data() +
8679 .face_data_by_cells[this->quad_no]
8680 .quadrature_point_offsets[
index];
8684 this->is_reinitialized =
true;
8685 this->dof_values_initialized =
false;
8686 this->values_quad_initialized =
false;
8687 this->gradients_quad_initialized =
false;
8688 this->hessians_quad_initialized =
false;
8699 typename VectorizedArrayType>
8706 VectorizedArrayType>::evaluate(
const bool evaluate_values,
8707 const bool evaluate_gradients)
8713 evaluate(this->values_dofs, evaluate_values, evaluate_gradients);
8723 typename VectorizedArrayType>
8730 VectorizedArrayType>::
8737 evaluate(this->values_dofs, evaluation_flag);
8747 typename VectorizedArrayType>
8754 VectorizedArrayType>::evaluate(
const VectorizedArrayType
8756 const bool evaluate_values,
8757 const bool evaluate_gradients)
8764 evaluate(values_array, flag);
8774 typename VectorizedArrayType>
8781 VectorizedArrayType>::
8782 evaluate(
const VectorizedArrayType * values_array,
8785 Assert((evaluation_flag &
8788 ExcMessage(
"Only EvaluationFlags::values, EvaluationFlags::gradients, "
8789 "and EvaluationFlags::hessians are supported."));
8791 const bool hessians_on_general_cells =
8795 if (hessians_on_general_cells)
8798 if (this->data->element_type ==
8806 template run<fe_degree, n_q_points_1d>(n_components,
8807 evaluation_flag_actual,
8812 n_components, evaluation_flag_actual, values_array, *
this);
8816 this->values_quad_initialized =
true;
8818 this->gradients_quad_initialized =
true;
8820 this->hessians_quad_initialized =
true;
8831 typename VectorizedArrayType>
8838 VectorizedArrayType>::
8841 integrate(integration_flag, this->values_dofs);
8844 this->dof_values_initialized =
true;
8855 typename VectorizedArrayType>
8862 VectorizedArrayType>::integrate(
const bool integrate_values,
8863 const bool integrate_gradients)
8865 integrate(integrate_values, integrate_gradients, this->values_dofs);
8868 this->dof_values_initialized =
true;
8879 typename VectorizedArrayType>
8886 VectorizedArrayType>::integrate(
const bool integrate_values,
8887 const bool integrate_gradients,
8896 integrate(flag, values_array);
8906 typename VectorizedArrayType>
8913 VectorizedArrayType>::
8915 VectorizedArrayType * values_array)
8917 Assert((integration_flag &
8920 ExcMessage(
"Only EvaluationFlags::values, EvaluationFlags::gradients, "
8921 "and EvaluationFlags::hessians are supported."));
8927 unsigned int size = n_components * dim * n_q_points;
8930 for (
unsigned int i = 0; i < size; ++i)
8931 this->gradients_quad[i] += this->gradients_from_hessians_quad[i];
8935 for (
unsigned int i = 0; i < size; ++i)
8936 this->gradients_quad[i] = this->gradients_from_hessians_quad[i];
8941 if (this->data->element_type ==
8945 this->divergence_is_requested ==
false)
8947 unsigned int size = n_components * n_q_points;
8950 for (
unsigned int i = 0; i < size; ++i)
8951 this->values_quad[i] += this->values_from_gradients_quad[i];
8955 for (
unsigned int i = 0; i < size; ++i)
8956 this->values_quad[i] = this->values_from_gradients_quad[i];
8963 template run<fe_degree, n_q_points_1d>(n_components,
8964 integration_flag_actual,
8969 n_components, integration_flag_actual, values_array, *
this);
8979 typename VectorizedArrayType>
8980template <
typename VectorType>
8988 VectorizedArrayType>::gather_evaluate(
const VectorType &input_vector,
8989 const bool evaluate_values,
8990 const bool evaluate_gradients)
8997 gather_evaluate(input_vector, flag);
9007 typename VectorizedArrayType>
9008template <
typename VectorType>
9015 VectorizedArrayType>::
9016 gather_evaluate(
const VectorType & input_vector,
9019 Assert((evaluation_flag &
9022 ExcMessage(
"Only EvaluationFlags::values, EvaluationFlags::gradients, "
9023 "and EvaluationFlags::hessians are supported."));
9025 const auto shared_vector_data = internal::get_shared_vector_data(
9027 this->dof_access_index ==
9029 this->active_fe_index,
9032 if (this->data->data.front().fe_degree > 0 &&
9033 fast_evaluation_supported(this->data->data.front().fe_degree,
9034 this->data->data.front().n_q_points_1d) &&
9037 typename VectorType::value_type,
9038 VectorizedArrayType>::
9039 supports(evaluation_flag,
9041 internal::get_beginning<typename VectorType::value_type>(
9043 this->dof_info->index_storage_variants[this->dof_access_index]
9050 typename VectorType::value_type,
9051 VectorizedArrayType>::template
run<fe_degree,
9055 internal::get_beginning<typename VectorType::value_type>(
9064 typename VectorType::value_type,
9065 VectorizedArrayType>::evaluate(n_components,
9067 internal::get_beginning<
9068 typename VectorType::value_type>(
9076 this->read_dof_values(input_vector);
9077 this->evaluate(evaluation_flag);
9082 this->values_quad_initialized =
true;
9084 this->gradients_quad_initialized =
true;
9086 this->hessians_quad_initialized =
true;
9097 typename VectorizedArrayType>
9098template <
typename VectorType>
9106 VectorizedArrayType>::integrate_scatter(
const bool integrate_values,
9107 const bool integrate_gradients,
9108 VectorType &destination)
9115 integrate_scatter(flag, destination);
9125 typename VectorizedArrayType>
9126template <
typename VectorType>
9133 VectorizedArrayType>::
9135 VectorType & destination)
9137 Assert((this->dof_access_index ==
9139 this->is_interior_face() ==
false) ==
false,
9142 const auto shared_vector_data = internal::get_shared_vector_data(
9144 this->dof_access_index ==
9146 this->active_fe_index,
9149 if (this->data->data.front().fe_degree > 0 &&
9150 fast_evaluation_supported(this->data->data.front().fe_degree,
9151 this->data->data.front().n_q_points_1d) &&
9154 typename VectorType::value_type,
9155 VectorizedArrayType>::
9156 supports(integration_flag,
9158 internal::get_beginning<typename VectorType::value_type>(
9160 this->dof_info->index_storage_variants[this->dof_access_index]
9167 typename VectorType::value_type,
9168 VectorizedArrayType>::template
run<fe_degree,
9172 internal::get_beginning<typename VectorType::value_type>(
9181 typename VectorType::value_type,
9182 VectorizedArrayType>::integrate(n_components,
9184 internal::get_beginning<
9185 typename VectorType::value_type>(
9193 integrate(integration_flag);
9194 this->distribute_local_to_global(destination);
9205 typename VectorizedArrayType>
9212 VectorizedArrayType>::dof_indices()
const
9214 return {0U, dofs_per_cell};
9224 typename VectorizedArrayType>
9231 VectorizedArrayType>::
9232 fast_evaluation_supported(
const unsigned int given_degree,
9233 const unsigned int given_n_q_points_1d)
9235 return fe_degree == -1 ?
9248 typename VectorizedArrayType>
9255 VectorizedArrayType>::
9256 fast_evaluation_supported(
const unsigned int given_degree,
9257 const unsigned int given_n_q_points_1d)
9259 return fe_degree == -1 ?
9272 typename VectorizedArrayType>
9279 VectorizedArrayType>::at_boundary()
const
9281 Assert(this->dof_access_index !=
9285 if (this->is_interior_face() ==
false)
9290 this->matrix_free->n_boundary_face_batches()))
9303 typename VectorizedArrayType>
9310 VectorizedArrayType>::boundary_id()
const
9312 Assert(this->dof_access_index !=
FEEvaluationAccess(const FEEvaluationAccess &other)
hessian_type get_hessian(unsigned int q_point) const
value_type get_value(const unsigned int q_point) const
value_type integrate_value() const
void submit_normal_derivative(const value_type grad_in, const unsigned int q_point)
value_type get_laplacian(const unsigned int q_point) const
void submit_value(const gradient_type val_in, const unsigned int q_point)
value_type get_normal_derivative(const unsigned int q_point) const
void submit_normal_derivative(const gradient_type grad_in, const unsigned int q_point)
gradient_type get_hessian_diagonal(const unsigned int q_point) const
void submit_dof_value(const value_type val_in, const unsigned int dof)
void submit_gradient(const value_type grad_in, const unsigned int q_point)
void submit_hessian(const hessian_type hessian_in, const unsigned int q_point)
gradient_type get_gradient(const unsigned int q_point) const
FEEvaluationAccess & operator=(const FEEvaluationAccess &other)
VectorizedArrayType value_type
void submit_gradient(const Tensor< 2, 1, VectorizedArrayType > grad_in, const unsigned int q_point)
FEEvaluationAccess(const Mapping< 1 > &mapping, const FiniteElement< 1 > &fe, const Quadrature< 1 > &quadrature, const UpdateFlags update_flags, const unsigned int first_selected_component, const FEEvaluationData< 1, VectorizedArrayType, is_face > *other)
value_type get_divergence(const unsigned int q_point) const
value_type get_dof_value(const unsigned int dof) const
FEEvaluationAccess(const MatrixFree< 1, Number, VectorizedArrayType > &matrix_free, const unsigned int dof_no, const unsigned int first_selected_component, const unsigned int quad_no, const unsigned int fe_degree, const unsigned int n_q_points, const bool is_interior_face=true, const unsigned int active_fe_index=numbers::invalid_unsigned_int, const unsigned int active_quad_index=numbers::invalid_unsigned_int, const unsigned int face_type=numbers::invalid_unsigned_int)
void submit_gradient(const gradient_type grad_in, const unsigned int q_point)
void submit_value(const value_type val_in, const unsigned int q_point)
value_type get_value(const unsigned int q_point) const
void submit_dof_value(const value_type val_in, const unsigned int dof)
value_type get_dof_value(const unsigned int dof) const
gradient_type get_hessian_diagonal(const unsigned int q_point) const
void submit_normal_derivative(const value_type grad_in, const unsigned int q_point)
void submit_value(const Tensor< 1, 1, VectorizedArrayType > val_in, const unsigned int q_point)
FEEvaluationAccess(const FEEvaluationAccess &other)
FEEvaluationAccess(const MatrixFree< dim, Number, VectorizedArrayType > &matrix_free, const unsigned int dof_no, const unsigned int first_selected_component, const unsigned int quad_no, const unsigned int fe_degree, const unsigned int n_q_points, const bool is_interior_face=true, const unsigned int active_fe_index=numbers::invalid_unsigned_int, const unsigned int active_quad_index=numbers::invalid_unsigned_int, const unsigned int face_type=numbers::invalid_unsigned_int)
value_type get_laplacian(const unsigned int q_point) const
hessian_type get_hessian(unsigned int q_point) const
FEEvaluationAccess(const Mapping< dim > &mapping, const FiniteElement< dim > &fe, const Quadrature< 1 > &quadrature, const UpdateFlags update_flags, const unsigned int first_selected_component, const FEEvaluationData< dim, VectorizedArrayType, is_face > *other)
VectorizedArrayType value_type
FEEvaluationAccess & operator=(const FEEvaluationAccess &other)
value_type get_normal_derivative(const unsigned int q_point) const
value_type integrate_value() const
void submit_value(const value_type val_in, const unsigned int q_point)
void submit_gradient(const gradient_type grad_in, const unsigned int q_point)
void submit_hessian(const hessian_type hessian_in, const unsigned int q_point)
gradient_type get_gradient(const unsigned int q_point) const
FEEvaluationAccess(const MatrixFree< dim, Number, VectorizedArrayType > &matrix_free, const unsigned int dof_no, const unsigned int first_selected_component, const unsigned int quad_no, const unsigned int dofs_per_cell, const unsigned int n_q_points, const bool is_interior_face=true, const unsigned int active_fe_index=numbers::invalid_unsigned_int, const unsigned int active_quad_index=numbers::invalid_unsigned_int, const unsigned int face_type=numbers::invalid_unsigned_int)
FEEvaluationAccess(const Mapping< dim > &mapping, const FiniteElement< dim > &fe, const Quadrature< 1 > &quadrature, const UpdateFlags update_flags, const unsigned int first_selected_component, const FEEvaluationData< dim, VectorizedArrayType, is_face > *other)
FEEvaluationAccess(const FEEvaluationAccess &other)
void submit_gradient(const gradient_type grad_in, const unsigned int q_point)
value_type get_value(const unsigned int q_point) const
FEEvaluationAccess & operator=(const FEEvaluationAccess &other)
Tensor< 3, dim, VectorizedArrayType > get_hessian(const unsigned int q_point) const
VectorizedArrayType get_divergence(const unsigned int q_point) const
Tensor< 1,(dim==2 ? 1 :dim), VectorizedArrayType > get_curl(const unsigned int q_point) const
void submit_curl(const Tensor< 1, dim==2 ? 1 :dim, VectorizedArrayType > curl_in, const unsigned int q_point)
gradient_type get_gradient(const unsigned int q_point) const
void submit_gradient(const Tensor< 1, dim, Tensor< 1, dim, VectorizedArrayType > > grad_in, const unsigned int q_point)
gradient_type get_hessian_diagonal(const unsigned int q_point) const
void submit_divergence(const VectorizedArrayType div_in, const unsigned int q_point)
void submit_value(const Tensor< 1, dim, VectorizedArrayType > val_in, const unsigned int q_point)
SymmetricTensor< 2, dim, VectorizedArrayType > get_symmetric_gradient(const unsigned int q_point) const
void submit_symmetric_gradient(const SymmetricTensor< 2, dim, VectorizedArrayType > grad_in, const unsigned int q_point)
Tensor< 1, n_components_, VectorizedArrayType > value_type
FEEvaluationAccess(const Mapping< dim > &mapping, const FiniteElement< dim > &fe, const Quadrature< 1 > &quadrature, const UpdateFlags update_flags, const unsigned int first_selected_component, const FEEvaluationData< dim, VectorizedArrayType, is_face > *other)
static constexpr unsigned int dimension
Tensor< 1, n_components_, Tensor< 1, dim, VectorizedArrayType > > gradient_type
FEEvaluationAccess(const MatrixFree< dim, Number, VectorizedArrayType > &matrix_free, const unsigned int dof_no, const unsigned int first_selected_component, const unsigned int quad_no, const unsigned int fe_degree, const unsigned int n_q_points, const bool is_interior_face=true, const unsigned int active_fe_index=numbers::invalid_unsigned_int, const unsigned int active_quad_index=numbers::invalid_unsigned_int, const unsigned int face_type=numbers::invalid_unsigned_int)
FEEvaluationAccess(const FEEvaluationAccess &other)
FEEvaluationAccess & operator=(const FEEvaluationAccess &other)
static constexpr unsigned int n_components
value_type get_dof_value(const unsigned int dof) const
Tensor< 1, n_components_, Tensor< 2, dim, VectorizedArrayType > > get_hessian(const unsigned int q_point) const
void read_write_operation_global(const VectorOperation &operation, const std::array< VectorType *, n_components_ > &vectors) const
void read_dof_values_plain(const VectorType &src, const unsigned int first_index=0, const std::bitset< VectorizedArrayType::size()> &mask=std::bitset< VectorizedArrayType::size()>().flip())
value_type get_laplacian(const unsigned int q_point) const
AlignedVector< VectorizedArrayType > * scratch_data_array
gradient_type get_gradient(const unsigned int q_point) const
void distribute_local_to_global(VectorType &dst, const unsigned int first_index=0, const std::bitset< VectorizedArrayType::size()> &mask=std::bitset< VectorizedArrayType::size()>().flip()) const
static constexpr unsigned int dimension
void submit_gradient(const gradient_type grad_in, const unsigned int q_point)
void submit_value(const value_type val_in, const unsigned int q_point)
Tensor< 1,(dim==2 ? 1 :dim), VectorizedArrayType > get_curl(const unsigned int q_point) const
void submit_dof_value(const value_type val_in, const unsigned int dof)
std::vector< types::global_dof_index > local_dof_indices
void set_dof_values(VectorType &dst, const unsigned int first_index=0, const std::bitset< VectorizedArrayType::size()> &mask=std::bitset< VectorizedArrayType::size()>().flip()) const
void submit_symmetric_gradient(const SymmetricTensor< 2, dim, VectorizedArrayType > grad_in, const unsigned int q_point)
VectorizedArrayType get_divergence(const unsigned int q_point) const
FEEvaluationBase(const Mapping< dim > &mapping, const FiniteElement< dim > &fe, const Quadrature< 1 > &quadrature, const UpdateFlags update_flags, const unsigned int first_selected_component, const FEEvaluationData< dim, VectorizedArrayType, is_face > *other)
FEEvaluationBase & operator=(const FEEvaluationBase &other)
void read_dof_values(const VectorType &src, const unsigned int first_index=0, const std::bitset< VectorizedArrayType::size()> &mask=std::bitset< VectorizedArrayType::size()>().flip())
void submit_divergence(const VectorizedArrayType div_in, const unsigned int q_point)
static constexpr unsigned int n_components
gradient_type get_hessian_diagonal(const unsigned int q_point) const
void read_write_operation(const VectorOperation &operation, const std::array< VectorType *, n_components_ > &vectors, const std::array< const std::vector< ArrayView< const typename VectorType::value_type > > *, n_components_ > &vectors_sm, const std::bitset< VectorizedArrayType::size()> &mask, const bool apply_constraints=true) const
const MatrixFree< dim, Number, VectorizedArrayType > & get_matrix_free() const
void apply_hanging_node_constraints(const bool transpose) const
FEEvaluationBase(const MatrixFree< dim, Number, VectorizedArrayType > &matrix_free, const unsigned int dof_no, const unsigned int first_selected_component, const unsigned int quad_no, const unsigned int fe_degree, const unsigned int n_q_points, const bool is_interior_face, const unsigned int active_fe_index, const unsigned int active_quad_index, const unsigned int face_type)
void submit_normal_derivative(const value_type grad_in, const unsigned int q_point)
void read_write_operation_contiguous(const VectorOperation &operation, const std::array< VectorType *, n_components_ > &vectors, const std::array< const std::vector< ArrayView< const typename VectorType::value_type > > *, n_components_ > &vectors_sm, const std::bitset< VectorizedArrayType::size()> &mask) const
value_type integrate_value() const
FEEvaluationBase(const FEEvaluationBase &other)
void submit_hessian(const hessian_type hessian_in, const unsigned int q_point)
SymmetricTensor< 2, dim, VectorizedArrayType > get_symmetric_gradient(const unsigned int q_point) const
const MatrixFree< dim, Number, VectorizedArrayType > * matrix_free
value_type get_normal_derivative(const unsigned int q_point) const
value_type get_value(const unsigned int q_point) const
void submit_curl(const Tensor< 1, dim==2 ? 1 :dim, VectorizedArrayType > curl_in, const unsigned int q_point)
void set_dof_values_plain(VectorType &dst, const unsigned int first_index=0, const std::bitset< VectorizedArrayType::size()> &mask=std::bitset< VectorizedArrayType::size()>().flip()) const
const unsigned int quad_no
const MappingInfoStorageType::QuadratureDescriptor * descriptor
const MappingInfoStorageType * mapping_data
const ShapeInfoType * data
std::shared_ptr< internal::MatrixFreeFunctions::MappingDataOnTheFly< dim, Number > > mapped_geometry
const unsigned int active_fe_index
std::array< unsigned int, n_lanes > cell_ids
const unsigned int active_quad_index
bool is_interior_face() const
FEEvaluationData & operator=(const FEEvaluationData &other)
const unsigned int first_selected_component
void integrate_scatter(const bool integrate_values, const bool integrate_gradients, VectorType &output_vector)
FEEvaluation(const MatrixFree< dim, Number, VectorizedArrayType > &matrix_free, const std::pair< unsigned int, unsigned int > &range, const unsigned int dof_no=0, const unsigned int quad_no=0, const unsigned int first_selected_component=0)
const unsigned int dofs_per_component
std_cxx20::ranges::iota_view< unsigned int, unsigned int > dof_indices() const
FEEvaluation(const Mapping< dim > &mapping, const FiniteElement< dim > &fe, const Quadrature< 1 > &quadrature, const UpdateFlags update_flags, const unsigned int first_selected_component=0)
const unsigned int n_q_points
void integrate(const bool integrate_values, const bool integrate_gradients)
void reinit(const std::array< unsigned int, VectorizedArrayType::size()> &cell_ids)
FEEvaluation(const FiniteElement< dim > &fe, const Quadrature< 1 > &quadrature, const UpdateFlags update_flags, const unsigned int first_selected_component=0)
void reinit(const typename Triangulation< dim >::cell_iterator &cell)
static bool fast_evaluation_supported(const unsigned int given_degree, const unsigned int given_n_q_points_1d)
void integrate_scatter(const EvaluationFlags::EvaluationFlags integration_flag, VectorType &output_vector)
void reinit(const unsigned int cell_batch_index)
FEEvaluation(const FiniteElement< dim > &fe, const FEEvaluationData< dim, VectorizedArrayType, false > &other, const unsigned int first_selected_component=0)
void reinit(const TriaIterator< DoFCellAccessor< dim, dim, level_dof_access > > &cell)
void evaluate(const bool evaluate_values, const bool evaluate_gradients, const bool evaluate_hessians=false)
void evaluate(const EvaluationFlags::EvaluationFlags evaluation_flag)
static constexpr unsigned int tensor_dofs_per_cell
void evaluate(const VectorizedArrayType *values_array, const EvaluationFlags::EvaluationFlags evaluation_flag)
typename BaseClass::gradient_type gradient_type
void integrate(const EvaluationFlags::EvaluationFlags integration_flag, VectorizedArrayType *values_array, const bool sum_into_values=false)
static constexpr unsigned int dimension
void gather_evaluate(const VectorType &input_vector, const EvaluationFlags::EvaluationFlags evaluation_flag)
const unsigned int dofs_per_cell
static constexpr unsigned int static_dofs_per_cell
void gather_evaluate(const VectorType &input_vector, const bool evaluate_values, const bool evaluate_gradients, const bool evaluate_hessians=false)
typename BaseClass::value_type value_type
FEEvaluation & operator=(const FEEvaluation &other)
void integrate(const EvaluationFlags::EvaluationFlags integration_flag)
static constexpr unsigned int n_components
void evaluate(const VectorizedArrayType *values_array, const bool evaluate_values, const bool evaluate_gradients, const bool evaluate_hessians=false)
FEEvaluation(const MatrixFree< dim, Number, VectorizedArrayType > &matrix_free, const unsigned int dof_no=0, const unsigned int quad_no=0, const unsigned int first_selected_component=0, const unsigned int active_fe_index=numbers::invalid_unsigned_int, const unsigned int active_quad_index=numbers::invalid_unsigned_int)
static constexpr unsigned int static_n_q_points
FEEvaluation(const FEEvaluation &other)
void integrate(const bool integrate_values, const bool integrate_gradients, VectorizedArrayType *values_array)
void check_template_arguments(const unsigned int fe_no, const unsigned int first_selected_component)
static constexpr unsigned int static_dofs_per_component
typename BaseClass::value_type value_type
std_cxx20::ranges::iota_view< unsigned int, unsigned int > dof_indices() const
void integrate_scatter(const EvaluationFlags::EvaluationFlags integration_flag, VectorType &output_vector)
static constexpr unsigned int static_n_q_points_cell
static constexpr unsigned int tensor_dofs_per_cell
const unsigned int dofs_per_component
void reinit(const unsigned int face_batch_number)
const unsigned int n_q_points
void gather_evaluate(const VectorType &input_vector, const EvaluationFlags::EvaluationFlags evaluation_flag)
void reinit(const unsigned int cell_batch_number, const unsigned int face_number)
static bool fast_evaluation_supported(const unsigned int given_degree, const unsigned int given_n_q_points_1d)
void evaluate(const VectorizedArrayType *values_array, const EvaluationFlags::EvaluationFlags evaluation_flag)
const unsigned int dofs_per_cell
static constexpr unsigned int n_components
void gather_evaluate(const VectorType &input_vector, const bool evaluate_values, const bool evaluate_gradients)
void integrate(const bool integrate_values, const bool integrate_gradients, VectorizedArrayType *values_array)
void evaluate(const VectorizedArrayType *values_array, const bool evaluate_values, const bool evaluate_gradients)
void evaluate(const EvaluationFlags::EvaluationFlags evaluation_flag)
void evaluate(const bool evaluate_values, const bool evaluate_gradients)
FEFaceEvaluation(const MatrixFree< dim, Number, VectorizedArrayType > &matrix_free, const std::pair< unsigned int, unsigned int > &range, const bool is_interior_face=true, const unsigned int dof_no=0, const unsigned int quad_no=0, const unsigned int first_selected_component=0)
void integrate(const EvaluationFlags::EvaluationFlags integration_flag)
void integrate(const EvaluationFlags::EvaluationFlags integration_flag, VectorizedArrayType *values_array)
static constexpr unsigned int static_dofs_per_component
static constexpr unsigned int static_n_q_points
FEFaceEvaluation(const MatrixFree< dim, Number, VectorizedArrayType > &matrix_free, const bool is_interior_face=true, const unsigned int dof_no=0, const unsigned int quad_no=0, const unsigned int first_selected_component=0, const unsigned int active_fe_index=numbers::invalid_unsigned_int, const unsigned int active_quad_index=numbers::invalid_unsigned_int, const unsigned int face_type=numbers::invalid_unsigned_int)
static constexpr unsigned int dimension
typename BaseClass::gradient_type gradient_type
types::boundary_id boundary_id() const
void integrate_scatter(const bool integrate_values, const bool integrate_gradients, VectorType &output_vector)
static constexpr unsigned int static_dofs_per_cell
void integrate(const bool integrate_values, const bool integrate_gradients)
std::pair< unsigned int, unsigned int > component_to_base_index(const unsigned int component) const
unsigned int element_multiplicity(const unsigned int index) const
Abstract base class for mapping classes.
const internal::MatrixFreeFunctions::TaskInfo & get_task_info() const
const internal::MatrixFreeFunctions::ShapeInfo< VectorizedArrayType > & get_shape_info(const unsigned int dof_handler_index_component=0, const unsigned int quad_index=0, const unsigned int fe_base_element=0, const unsigned int hp_active_fe_index=0, const unsigned int hp_active_quad_index=0) const
types::boundary_id get_boundary_id(const unsigned int face_batch_index) const
const Table< 3, unsigned int > & get_cell_and_face_to_plain_faces() const
unsigned int n_inner_face_batches() const
unsigned int n_active_entries_per_cell_batch(const unsigned int cell_batch_index) const
const internal::MatrixFreeFunctions::FaceToCellTopology< VectorizedArrayType::size()> & get_face_info(const unsigned int face_batch_index) const
const internal::MatrixFreeFunctions::DoFInfo & get_dof_info(const unsigned int dof_handler_index_component=0) const
AlignedVector< VectorizedArrayType > * acquire_scratch_data() const
const Number * constraint_pool_begin(const unsigned int pool_index) const
void release_scratch_data(const AlignedVector< VectorizedArrayType > *memory) const
const internal::MatrixFreeFunctions::MappingInfo< dim, Number, VectorizedArrayType > & get_mapping_info() const
bool indices_initialized() const
const Number * constraint_pool_end(const unsigned int pool_index) const
unsigned int n_components() const
unsigned int n_active_entries_per_face_batch(const unsigned int face_batch_index) const
unsigned int n_base_elements(const unsigned int dof_handler_index) const
DEAL_II_HOST constexpr const Number & access_raw_entry(const unsigned int unrolled_index) const
#define DEAL_II_ALWAYS_INLINE
#define DEAL_II_OPENMP_SIMD_PRAGMA
#define DEAL_II_DEPRECATED
#define DEAL_II_NAMESPACE_OPEN
#define DEAL_II_NAMESPACE_CLOSE
static ::ExceptionBase & ExcNotImplemented()
#define Assert(cond, exc)
#define AssertDimension(dim1, dim2)
#define AssertIndexRange(index, range)
static ::ExceptionBase & ExcInternalError()
static ::ExceptionBase & ExcAccessToUninitializedField()
static ::ExceptionBase & ExcIndexRange(std::size_t arg1, std::size_t arg2, std::size_t arg3)
static ::ExceptionBase & ExcNotInitialized()
static ::ExceptionBase & ExcMatrixFreeAccessToUninitializedMappingField(std::string arg1)
static ::ExceptionBase & ExcMessage(std::string arg1)
#define AssertThrow(cond, exc)
The namespace for the EvaluationFlags enum.
EvaluationFlags
The EvaluationFlags enum.
Point< spacedim > point(const gp_Pnt &p, const double tolerance=1e-10)
void quadrature_points(const Triangulation< dim, spacedim > &triangulation, const Quadrature< dim > &quadrature, const std::vector< std::vector< BoundingBox< spacedim > > > &global_bounding_boxes, ParticleHandler< dim, spacedim > &particle_handler, const Mapping< dim, spacedim > &mapping=(ReferenceCells::get_hypercube< dim >() .template get_default_linear_mapping< dim, spacedim >()), const std::vector< std::vector< double > > &properties={})
SymmetricTensor< 2, dim, Number > e(const Tensor< 2, dim, Number > &F)
SymmetricTensor< 2, dim, Number > d(const Tensor< 2, dim, Number > &F, const Tensor< 2, dim, Number > &dF_dt)
VectorType::value_type * begin(VectorType &V)
T sum(const T &t, const MPI_Comm mpi_communicator)
constexpr T pow(const T base, const int iexp)
std::string int_to_string(const unsigned int value, const unsigned int digits=numbers::invalid_unsigned_int)
void run(const Iterator &begin, const std_cxx20::type_identity_t< Iterator > &end, Worker worker, Copier copier, const ScratchData &sample_scratch_data, const CopyData &sample_copy_data, const unsigned int queue_length, const unsigned int chunk_size)
constexpr compressed_constraint_kind unconstrained_compressed_constraint_kind
void check_vector_compatibility(const VectorType &vec, const MatrixFree< dim, Number, VectorizedArrayType > &matrix_free, const internal::MatrixFreeFunctions::DoFInfo &dof_info)
void reinit(MatrixBlock< MatrixType > &v, const BlockSparsityPattern &p)
const types::boundary_id internal_face_boundary_id
static const unsigned int invalid_unsigned_int
boost::integer_range< IncrementableType > iota_view
::VectorizedArray< Number, width > max(const ::VectorizedArray< Number, width > &, const ::VectorizedArray< Number, width > &)
::VectorizedArray< Number, width > pow(const ::VectorizedArray< Number, width > &, const Number p)
static void integrate(const unsigned int n_components, const EvaluationFlags::EvaluationFlags integration_flag, Number *values_dofs, FEEvaluationData< dim, Number, false > &eval, const bool sum_into_values_array=false)
static void evaluate(const unsigned int n_components, const EvaluationFlags::EvaluationFlags evaluation_flag, const Number *values_dofs, FEEvaluationData< dim, Number, false > &eval)
static bool fast_evaluation_supported(const unsigned int given_degree, const unsigned int n_q_points_1d)
static void evaluate(const unsigned int n_components, const EvaluationFlags::EvaluationFlags evaluation_flag, const Number *values_dofs, FEEvaluationData< dim, Number, false > &fe_eval)
static void integrate(const unsigned int n_components, const EvaluationFlags::EvaluationFlags integration_flag, Number *values_dofs, FEEvaluationData< dim, Number, false > &fe_eval, const bool sum_into_values_array)
static void apply(const unsigned int n_components, const unsigned int fe_degree, const MatrixFreeFunctions::ShapeInfo< VectorizedArrayType > &shape_info, const bool transpose, const std::array< MatrixFreeFunctions::compressed_constraint_kind, VectorizedArrayType::size()> &c_mask, VectorizedArrayType *values)
static void evaluate(const unsigned int n_components, const EvaluationFlags::EvaluationFlags evaluation_flag, const Number *values_dofs, FEEvaluationData< dim, Number, true > &fe_eval)
static bool fast_evaluation_supported(const unsigned int given_degree, const unsigned int n_q_points_1d)
static void integrate(const unsigned int n_components, const EvaluationFlags::EvaluationFlags integration_flag, Number *values_dofs, FEEvaluationData< dim, Number, true > &fe_eval)
static constexpr unsigned int value
@ dof_access_face_exterior
@ dof_access_face_interior
std::vector< std::pair< unsigned short, unsigned short > > constraint_indicator
std::vector< std::pair< unsigned int, unsigned int > > row_starts
std::vector< std::vector< unsigned int > > component_dof_indices_offset
std::vector< std::vector< bool > > hanging_node_constraint_masks_comp
unsigned int fe_index_from_degree(const unsigned int first_selected_component, const unsigned int fe_degree) const
std::vector< unsigned int > dof_indices
std::vector< compressed_constraint_kind > hanging_node_constraint_masks
std::array< std::vector< unsigned int >, 3 > dof_indices_interleave_strides
std::array< std::vector< std::pair< unsigned int, unsigned int > >, 3 > dof_indices_contiguous_sm
std::vector< unsigned int > row_starts_plain_indices
std::vector< unsigned int > component_to_base_index
std::array< std::vector< unsigned int >, 3 > dof_indices_contiguous
std::vector< unsigned int > plain_dof_indices
std::array< std::vector< unsigned char >, 3 > n_vectorization_lanes_filled
std::vector< unsigned int > dof_indices_interleaved
std::array< std::vector< IndexStorageVariants >, 3 > index_storage_variants
std::vector< QuadratureDescriptor > descriptor
unsigned int quad_index_from_n_q_points(const unsigned int n_q_points) const
std::vector< unsigned int > face_partition_data
DEAL_II_HOST constexpr Number determinant(const SymmetricTensor< 2, dim, Number > &)
DEAL_II_HOST constexpr SymmetricTensor< 2, dim, Number > invert(const SymmetricTensor< 2, dim, Number > &)