34#include <boost/container/small_vector.hpp>
46 template <
int dim,
int spacedim>
47 std::vector<unsigned int>
50 std::vector<unsigned int> shape_function_to_row_table(
59 unsigned int nth_nonzero_component = 0;
64 row + nth_nonzero_component;
65 ++nth_nonzero_component;
70 return shape_function_to_row_table;
77 template <
typename Number,
typename T =
void>
92 template <
typename Number>
95 std::enable_if_t<Differentiation::AD::is_ad_number<Number>::value>>
98 value(
const Number & )
109template <
int dim,
int spacedim>
117template <
int dim,
int spacedim>
125template <
int dim,
int spacedim>
133template <
int dim,
int spacedim>
137 return cell.has_value();
142template <
int dim,
int spacedim>
148 auto convert = [](
const auto &
cell) {
152 switch (
cell.value().index())
155 return convert(std::get<0>(
cell.value()));
157 return convert(std::get<1>(
cell.value()));
159 return convert(std::get<2>(
cell.value()));
168template <
int dim,
int spacedim>
174 switch (
cell.value().index())
177 return std::get<1>(
cell.value())->get_dof_handler().n_dofs();
179 return std::get<2>(
cell.value())->get_dof_handler().n_dofs();
188template <
int dim,
int spacedim>
189template <
typename Number>
197 switch (
cell.value().index())
200 std::get<1>(
cell.value())->get_interpolated_dof_values(in, out);
204 std::get<2>(cell.value())->get_interpolated_dof_values(in, out);
208 Assert(
false, ExcNeedsDoFHandler());
218template <
int dim,
int spacedim>
222 const UpdateFlags flags,
229 ,
fe(&
fe, typeid(*this).name())
235 ExcMessage(
"There is nothing useful you can do with an FEValues "
236 "object when using a quadrature formula with zero "
237 "quadrature points!"));
243template <
int dim,
int spacedim>
251template <
int dim,
int spacedim>
270 template <
typename Number,
typename Number2>
273 const ::Table<2, double> &shape_values,
274 std::vector<Number> &values)
278 const unsigned int n_quadrature_points = values.size();
281 std::fill_n(values.begin(),
292 for (
unsigned int shape_func = 0; shape_func <
dofs_per_cell; ++shape_func)
294 const Number2
value = dof_values[shape_func];
302 const double *shape_value_ptr = &shape_values(shape_func, 0);
303 for (
unsigned int point = 0; point < n_quadrature_points; ++point)
304 values[point] +=
value * (*shape_value_ptr++);
310 template <
int dim,
int spacedim,
typename VectorType>
314 const ::Table<2, double> &shape_values,
316 const std::vector<unsigned int> &shape_function_to_row_table,
318 const bool quadrature_points_fastest =
false,
319 const unsigned int component_multiple = 1)
321 using Number =
typename VectorType::value_type;
323 for (
unsigned int i = 0; i < values.size(); ++i)
324 std::fill_n(values[i].
begin(),
326 typename VectorType::value_type());
334 const unsigned int n_quadrature_points =
335 quadrature_points_fastest ? values[0].size() : values.size();
339 const unsigned result_components = n_components * component_multiple;
340 (void)result_components;
341 if (quadrature_points_fastest)
344 for (
unsigned int i = 0; i < values.size(); ++i)
350 for (
unsigned int i = 0; i < values.size(); ++i)
357 for (
unsigned int mc = 0; mc < component_multiple; ++mc)
358 for (
unsigned int shape_func = 0; shape_func <
dofs_per_cell;
365 if (::internal::CheckForZero<Number>::value(
value) ==
true)
370 const unsigned int comp =
373 const unsigned int row =
374 shape_function_to_row_table[shape_func * n_components + comp];
376 const double *shape_value_ptr = &shape_values(row, 0);
378 if (quadrature_points_fastest)
380 VectorType &values_comp = values[comp];
381 for (
unsigned int point = 0; point < n_quadrature_points;
383 values_comp[point] +=
value * (*shape_value_ptr++);
386 for (
unsigned int point = 0; point < n_quadrature_points;
388 values[point][comp] +=
value * (*shape_value_ptr++);
391 for (
unsigned int c = 0; c < n_components; ++c)
396 const unsigned int row =
397 shape_function_to_row_table[shape_func * n_components + c];
399 const double *shape_value_ptr = &shape_values(row, 0);
400 const unsigned int comp = c + mc * n_components;
402 if (quadrature_points_fastest)
404 VectorType &values_comp = values[comp];
405 for (
unsigned int point = 0; point < n_quadrature_points;
407 values_comp[point] +=
value * (*shape_value_ptr++);
410 for (
unsigned int point = 0; point < n_quadrature_points;
412 values[point][comp] +=
value * (*shape_value_ptr++);
421 template <
int order,
int spacedim,
typename Number>
428 const unsigned int dofs_per_cell = shape_derivatives.size()[0];
429 const unsigned int n_quadrature_points = derivatives.size();
432 std::fill_n(derivatives.begin(),
443 for (
unsigned int shape_func = 0; shape_func <
dofs_per_cell; ++shape_func)
445 const Number &
value = dof_values[shape_func];
449 if (::internal::CheckForZero<Number>::value(
value) ==
true)
453 &shape_derivatives[shape_func][0];
454 for (
unsigned int point = 0; point < n_quadrature_points; ++point)
455 derivatives[point] +=
value * (*shape_derivative_ptr++);
461 template <
int order,
int dim,
int spacedim,
typename Number>
467 const std::vector<unsigned int> &shape_function_to_row_table,
469 const bool quadrature_points_fastest =
false,
470 const unsigned int component_multiple = 1)
473 for (
unsigned int i = 0; i < derivatives.size(); ++i)
474 std::fill_n(derivatives[i].
begin(),
475 derivatives[i].size(),
485 const unsigned int n_quadrature_points =
486 quadrature_points_fastest ? derivatives[0].size() : derivatives.size();
487 const unsigned int n_components =
fe.n_components();
490 const unsigned result_components = n_components * component_multiple;
491 (void)result_components;
492 if (quadrature_points_fastest)
495 for (
unsigned int i = 0; i < derivatives.size(); ++i)
501 for (
unsigned int i = 0; i < derivatives.size(); ++i)
508 for (
unsigned int mc = 0; mc < component_multiple; ++mc)
509 for (
unsigned int shape_func = 0; shape_func <
dofs_per_cell;
516 if (::internal::CheckForZero<Number>::value(
value) ==
true)
519 if (
fe.is_primitive(shape_func))
521 const unsigned int comp =
522 fe.system_to_component_index(shape_func).first +
524 const unsigned int row =
525 shape_function_to_row_table[shape_func * n_components + comp];
528 &shape_derivatives[row][0];
530 if (quadrature_points_fastest)
533 derivatives[comp][point] +=
value * (*shape_derivative_ptr++);
537 derivatives[point][comp] +=
value * (*shape_derivative_ptr++);
540 for (
unsigned int c = 0; c < n_components; ++c)
542 if (
fe.get_nonzero_components(shape_func)[c] ==
false)
545 const unsigned int row =
546 shape_function_to_row_table[shape_func * n_components + c];
549 &shape_derivatives[row][0];
550 const unsigned int comp = c + mc * n_components;
552 if (quadrature_points_fastest)
555 derivatives[comp][point] +=
556 value * (*shape_derivative_ptr++);
560 derivatives[point][comp] +=
561 value * (*shape_derivative_ptr++);
568 template <
int spacedim,
typename Number,
typename Number2>
573 std::vector<Number> &laplacians)
576 const unsigned int n_quadrature_points = laplacians.size();
579 std::fill_n(laplacians.begin(),
586 for (
unsigned int shape_func = 0; shape_func <
dofs_per_cell; ++shape_func)
588 const Number2
value = dof_values[shape_func];
597 &shape_hessians[shape_func][0];
599 laplacians[point] +=
value *
trace(*shape_hessian_ptr++);
605 template <
int dim,
int spacedim,
typename VectorType,
typename Number>
611 const std::vector<unsigned int> &shape_function_to_row_table,
612 std::vector<VectorType> &laplacians,
613 const bool quadrature_points_fastest =
false,
614 const unsigned int component_multiple = 1)
617 for (
unsigned int i = 0; i < laplacians.size(); ++i)
618 std::fill_n(laplacians[i].
begin(),
619 laplacians[i].size(),
620 typename VectorType::value_type());
630 const unsigned int n_components =
fe.n_components();
633 const unsigned result_components = n_components * component_multiple;
634 (void)result_components;
635 if (quadrature_points_fastest)
638 for (
unsigned int i = 0; i < laplacians.size(); ++i)
644 for (
unsigned int i = 0; i < laplacians.size(); ++i)
651 for (
unsigned int mc = 0; mc < component_multiple; ++mc)
652 for (
unsigned int shape_func = 0; shape_func <
dofs_per_cell;
659 if (::internal::CheckForZero<Number>::value(
value) ==
true)
662 if (
fe.is_primitive(shape_func))
664 const unsigned int comp =
665 fe.system_to_component_index(shape_func).first +
667 const unsigned int row =
668 shape_function_to_row_table[shape_func * n_components + comp];
671 &shape_hessians[row][0];
672 if (quadrature_points_fastest)
674 VectorType &laplacians_comp = laplacians[comp];
677 laplacians_comp[point] +=
683 laplacians[point][comp] +=
687 for (
unsigned int c = 0; c < n_components; ++c)
692 const unsigned int row =
693 shape_function_to_row_table[shape_func * n_components + c];
696 &shape_hessians[row][0];
697 const unsigned int comp = c + mc * n_components;
699 if (quadrature_points_fastest)
701 VectorType &laplacians_comp = laplacians[comp];
704 laplacians_comp[point] +=
708 for (
unsigned int point = 0; point < n_quadrature_points;
710 laplacians[point][comp] +=
719template <
int dim,
int spacedim>
720template <
typename Number>
724 std::vector<Number> &values)
const
733 boost::container::small_vector<Number, 200> dof_values(
dofs_per_cell);
735 present_cell.get_interpolated_dof_values(fe_function, view);
743template <
int dim,
int spacedim>
744template <
typename Number>
749 std::vector<Number> &values)
const
756 boost::container::small_vector<Number, 200> dof_values(
dofs_per_cell);
766template <
int dim,
int spacedim>
767template <
typename Number>
780 boost::container::small_vector<Number, 200> dof_values(
dofs_per_cell);
782 present_cell.get_interpolated_dof_values(fe_function, view);
787 this->finite_element_output.shape_function_to_row_table,
793template <
int dim,
int spacedim>
794template <
typename Number>
808 boost::container::small_vector<Number, 200> dof_values(
dofs_per_cell);
815 this->finite_element_output.shape_function_to_row_table,
823template <
int dim,
int spacedim>
824template <
typename Number>
830 const bool quadrature_points_fastest)
const
840 boost::container::small_vector<Number, 200> dof_values(
dofs_per_cell);
847 this->finite_element_output.shape_function_to_row_table,
849 quadrature_points_fastest,
855template <
int dim,
int spacedim>
856template <
typename Number>
869 boost::container::small_vector<Number, 200> dof_values(
dofs_per_cell);
871 present_cell.get_interpolated_dof_values(fe_function, view);
879template <
int dim,
int spacedim>
880template <
typename Number>
892 boost::container::small_vector<Number, 200> dof_values(
dofs_per_cell);
902template <
int dim,
int spacedim>
903template <
typename Number>
915 boost::container::small_vector<Number, 200> dof_values(
dofs_per_cell);
917 present_cell.get_interpolated_dof_values(fe_function, view);
922 this->finite_element_output.shape_function_to_row_table,
928template <
int dim,
int spacedim>
929template <
typename Number>
935 const bool quadrature_points_fastest)
const
944 boost::container::small_vector<Number, 200> dof_values(
dofs_per_cell);
951 this->finite_element_output.shape_function_to_row_table,
953 quadrature_points_fastest,
959template <
int dim,
int spacedim>
960template <
typename Number>
973 boost::container::small_vector<Number, 200> dof_values(
dofs_per_cell);
975 present_cell.get_interpolated_dof_values(fe_function, view);
983template <
int dim,
int spacedim>
984template <
typename Number>
996 boost::container::small_vector<Number, 200> dof_values(
dofs_per_cell);
1006template <
int dim,
int spacedim>
1007template <
typename Number>
1012 const bool quadrature_points_fastest)
const
1020 boost::container::small_vector<Number, 200> dof_values(
dofs_per_cell);
1022 present_cell.get_interpolated_dof_values(fe_function, view);
1027 this->finite_element_output.shape_function_to_row_table,
1029 quadrature_points_fastest);
1034template <
int dim,
int spacedim>
1035template <
typename Number>
1041 const bool quadrature_points_fastest)
const
1048 boost::container::small_vector<Number, 200> dof_values(indices.
size());
1055 this->finite_element_output.shape_function_to_row_table,
1057 quadrature_points_fastest,
1063template <
int dim,
int spacedim>
1064template <
typename Number>
1068 std::vector<Number> &laplacians)
const
1077 boost::container::small_vector<Number, 200> dof_values(
dofs_per_cell);
1079 present_cell.get_interpolated_dof_values(fe_function, view);
1087template <
int dim,
int spacedim>
1088template <
typename Number>
1093 std::vector<Number> &laplacians)
const
1100 boost::container::small_vector<Number, 200> dof_values(
dofs_per_cell);
1110template <
int dim,
int spacedim>
1111template <
typename Number>
1123 boost::container::small_vector<Number, 200> dof_values(
dofs_per_cell);
1125 present_cell.get_interpolated_dof_values(fe_function, view);
1130 this->finite_element_output.shape_function_to_row_table,
1136template <
int dim,
int spacedim>
1137template <
typename Number>
1151 boost::container::small_vector<Number, 200> dof_values(indices.
size());
1158 this->finite_element_output.shape_function_to_row_table,
1166template <
int dim,
int spacedim>
1167template <
typename Number>
1172 std::vector<std::vector<Number>> &laplacians,
1173 const bool quadrature_points_fastest)
const
1180 boost::container::small_vector<Number, 200> dof_values(indices.
size());
1187 this->finite_element_output.shape_function_to_row_table,
1189 quadrature_points_fastest,
1195template <
int dim,
int spacedim>
1196template <
typename Number>
1209 boost::container::small_vector<Number, 200> dof_values(
dofs_per_cell);
1211 present_cell.get_interpolated_dof_values(fe_function, view);
1218template <
int dim,
int spacedim>
1219template <
typename Number>
1231 boost::container::small_vector<Number, 200> dof_values(
dofs_per_cell);
1240template <
int dim,
int spacedim>
1241template <
typename Number>
1246 const bool quadrature_points_fastest)
const
1254 boost::container::small_vector<Number, 200> dof_values(
dofs_per_cell);
1256 present_cell.get_interpolated_dof_values(fe_function, view);
1261 this->finite_element_output.shape_function_to_row_table,
1263 quadrature_points_fastest);
1268template <
int dim,
int spacedim>
1269template <
typename Number>
1275 const bool quadrature_points_fastest)
const
1282 boost::container::small_vector<Number, 200> dof_values(indices.
size());
1289 this->finite_element_output.shape_function_to_row_table,
1291 quadrature_points_fastest,
1297template <
int dim,
int spacedim>
1306template <
int dim,
int spacedim>
1307const std::vector<Tensor<1, spacedim>> &
1312 "update_normal_vectors")));
1319template <
int dim,
int spacedim>
1340template <
int dim,
int spacedim>
1352 flags |=
mapping->requires_update_flags(flags);
1359template <
int dim,
int spacedim>
1372template <
int dim,
int spacedim>
1379 const auto stored_cell =
1392 Assert(!stored_cell->get_triangulation()
1393 .global_active_cell_index_partitioner()
1411 tria_listener_any_change =
1413 [
this]() { this->invalidate_present_cell(); });
1419template <
int dim,
int spacedim>
1460template <
int dim,
int spacedim>
1469template <
int dim,
int spacedim>
1474template <
int dim,
int spacedim>
1480#include "fe/fe_values_base.inst"
ArrayView< std::remove_reference_t< typename std::iterator_traits< Iterator >::reference >, MemorySpaceType > make_array_view(const Iterator begin, const Iterator end)
bool direction_flag() const
typename LevelSelector::cell_iterator level_cell_iterator
types::global_dof_index n_dofs_for_dof_handler() const
void get_interpolated_dof_values(const ReadVector< Number > &in, ArrayView< Number > out) const
CellIteratorWrapper()=default
std::optional< std::variant< typename Triangulation< dim, spacedim >::cell_iterator, typename DoFHandler< dim, spacedim >::cell_iterator, typename DoFHandler< dim, spacedim >::level_cell_iterator > > cell
bool is_initialized() const
static constexpr unsigned int dimension
CellSimilarity::Similarity cell_similarity
::internal::FEValuesViews::Cache< dim, spacedim > fe_values_views_cache
Triangulation< dim, spacedim >::cell_iterator get_cell() const
static constexpr unsigned int space_dimension
void get_function_values(const ReadVector< Number > &fe_function, std::vector< Number > &values) const
FEValuesBase(const unsigned int n_q_points, const unsigned int dofs_per_cell, const UpdateFlags update_flags, const Mapping< dim, spacedim > &mapping, const FiniteElement< dim, spacedim > &fe)
boost::signals2::connection tria_listener_any_change
internal::FEValuesImplementation::MappingRelatedData< dim, spacedim > mapping_output
virtual ~FEValuesBase() override
const unsigned int dofs_per_cell
void check_cell_similarity(const typename Triangulation< dim, spacedim >::cell_iterator &cell)
CellIteratorWrapper present_cell
void get_function_hessians(const ReadVector< Number > &fe_function, std::vector< Tensor< 2, spacedim, Number > > &hessians) const
void always_allow_check_for_cell_similarity(const bool allow)
void get_function_laplacians(const ReadVector< Number > &fe_function, std::vector< Number > &laplacians) const
friend class FEValuesViews::Tensor
const unsigned int n_quadrature_points
CellSimilarity::Similarity get_cell_similarity() const
const std::vector< Tensor< 1, spacedim > > & get_normal_vectors() const
std::size_t memory_consumption() const
void get_function_third_derivatives(const ReadVector< Number > &fe_function, std::vector< Tensor< 3, spacedim, Number > > &third_derivatives) const
UpdateFlags compute_update_flags(const UpdateFlags update_flags) const
std::unique_ptr< typename Mapping< dim, spacedim >::InternalDataBase > mapping_data
void get_function_gradients(const ReadVector< Number > &fe_function, std::vector< Tensor< 1, spacedim, Number > > &gradients) const
void invalidate_present_cell()
friend class FEValuesViews::Vector
const ObserverPointer< const Mapping< dim, spacedim >, FEValuesBase< dim, spacedim > > mapping
bool check_for_cell_similarity_allowed
::internal::FEValuesImplementation::FiniteElementRelatedData< dim, spacedim > finite_element_output
const ObserverPointer< const FiniteElement< dim, spacedim >, FEValuesBase< dim, spacedim > > fe
std::unique_ptr< typename FiniteElement< dim, spacedim >::InternalDataBase > fe_data
void maybe_invalidate_previous_present_cell(const typename Triangulation< dim, spacedim >::cell_iterator &cell)
const unsigned int max_n_quadrature_points
unsigned int n_dofs_per_cell() const
unsigned int n_components() const
const ComponentMask & get_nonzero_components(const unsigned int i) const
bool is_primitive() const
std::pair< unsigned int, unsigned int > system_to_component_index(const unsigned int index) const
unsigned int n_nonzero_components(const unsigned int i) const
Abstract base class for mapping classes.
virtual void extract_subvector_to(const ArrayView< const types::global_dof_index > &indices, const ArrayView< Number > &elements) const =0
virtual size_type size() const =0
const Triangulation< dim, spacedim > & get_triangulation() const
bool is_translation_of(const TriaIterator< TriaAccessor< structdim, dim, spacedim > > &o) const
virtual std::weak_ptr< const Utilities::MPI::Partitioner > global_active_cell_index_partitioner() const
Triangulation< dim, spacedim > & get_triangulation()
#define DEAL_II_NAMESPACE_OPEN
#define DEAL_II_NAMESPACE_CLOSE
#define DEAL_II_ASSERT_UNREACHABLE()
static ::ExceptionBase & ExcAccessToUninitializedField(std::string arg1)
static ::ExceptionBase & ExcNotMultiple(int arg1, int arg2)
#define Assert(cond, exc)
static ::ExceptionBase & ExcNotReinited()
static ::ExceptionBase & ExcNeedsDoFHandler()
#define AssertDimension(dim1, dim2)
static ::ExceptionBase & ExcInternalError()
static ::ExceptionBase & ExcMessage(std::string arg1)
typename ActiveSelector::cell_iterator cell_iterator
TriaIterator< CellAccessor< dim, spacedim > > cell_iterator
const bool IsBlockVector< VectorType >::value
@ update_hessians
Second derivatives of shape functions.
@ update_values
Shape function values.
@ update_normal_vectors
Normal vectors.
@ update_3rd_derivatives
Third derivatives of shape functions.
@ update_gradients
Shape function gradients.
std::enable_if_t< std::is_fundamental_v< T >, std::size_t > memory_consumption(const T &t)
* * * RotationFunction< dim, Number >::RotationFunction Number(dim)
void do_function_laplacians(const ArrayView< Number2 > &dof_values, const ::Table< 2, Tensor< 2, spacedim > > &shape_hessians, std::vector< Number > &laplacians)
void do_function_derivatives(const ArrayView< Number > &dof_values, const ::Table< 2, Tensor< order, spacedim > > &shape_derivatives, std::vector< Tensor< order, spacedim, Number > > &derivatives)
std::vector< unsigned int > make_shape_function_to_row_table(const FiniteElement< dim, spacedim > &fe)
void do_function_values(const ArrayView< Number2 > &dof_values, const ::Table< 2, double > &shape_values, std::vector< Number > &values)
constexpr types::global_dof_index invalid_dof_index
constexpr unsigned int invalid_unsigned_int
unsigned int global_dof_index
* const unsigned int dofs_per_cell
* const unsigned int n_q_points
static constexpr const T & value(const T &t)
constexpr Number trace(const SymmetricTensor< 2, dim2, Number > &)