37 #include <boost/container/small_vector.hpp>
41 #include <type_traits>
48 template <
int dim,
int spacedim>
49 inline std::vector<unsigned int>
52 std::vector<unsigned int> shape_function_to_row_table(
61 unsigned int nth_nonzero_component = 0;
66 row + nth_nonzero_component;
67 ++nth_nonzero_component;
72 return shape_function_to_row_table;
80 namespace FEValuesImplementation
82 template <
int dim,
int spacedim>
85 const unsigned int n_quadrature_points,
92 this->shape_function_to_row_table =
97 unsigned int n_nonzero_shape_components = 0;
107 this->shape_values.reinit(n_nonzero_shape_components,
108 n_quadrature_points);
109 this->shape_values.fill(numbers::signaling_nan<double>());
114 this->shape_gradients.reinit(n_nonzero_shape_components,
115 n_quadrature_points);
116 this->shape_gradients.fill(
122 this->shape_hessians.reinit(n_nonzero_shape_components,
123 n_quadrature_points);
124 this->shape_hessians.fill(
130 this->shape_3rd_derivatives.reinit(n_nonzero_shape_components,
131 n_quadrature_points);
132 this->shape_3rd_derivatives.fill(
139 template <
int dim,
int spacedim>
156 template <
int dim,
int spacedim>
161 template <
int dim,
int spacedim>
167 fe.n_dofs_per_cell(),
178 template <
int dim,
int spacedim>
183 :
FEValues(mapping, fe, q[0], update_flags)
190 template <
int dim,
int spacedim>
196 fe.n_dofs_per_cell(),
207 template <
int dim,
int spacedim>
218 template <
int dim,
int spacedim>
224 if (dim != spacedim - 1)
226 ExcMessage(
"You can only pass the 'update_normal_vectors' "
227 "flag to FEFaceValues or FESubfaceValues objects, "
228 "but not to an FEValues object unless the "
229 "triangulation it refers to is embedded in a higher "
230 "dimensional space."));
232 const UpdateFlags flags = this->compute_update_flags(update_flags);
236 this->mapping_output.initialize(this->max_n_quadrature_points, flags);
237 this->finite_element_output.initialize(this->max_n_quadrature_points,
244 std::unique_ptr<typename FiniteElement<dim, spacedim>::InternalDataBase>>
246 return this->fe->get_data(flags,
249 this->finite_element_output);
253 std::unique_ptr<typename Mapping<dim, spacedim>::InternalDataBase>>
257 [&]() {
return this->mapping->get_data(flags, quadrature); });
259 this->update_flags = flags;
262 this->fe_data = std::move(fe_get_data.return_value());
264 this->mapping_data = std::move(mapping_get_data.return_value());
267 std::make_unique<typename Mapping<dim, spacedim>::InternalDataBase>();
272 template <
int dim,
int spacedim>
278 Assert(this->get_mapping().is_compatible_with(cell->reference_cell()),
280 "You are trying to call FEValues::reinit() with a cell of type " +
281 cell->reference_cell().to_string() +
282 " with a Mapping that is not compatible with it."));
286 this->maybe_invalidate_previous_present_cell(cell);
287 this->check_cell_similarity(cell);
289 this->present_cell = {cell};
299 template <
int dim,
int spacedim>
312 Assert(this->get_mapping().is_compatible_with(cell->reference_cell()),
314 "You are trying to call FEValues::reinit() with a cell of type " +
315 cell->reference_cell().to_string() +
316 " with a Mapping that is not compatible with it."));
318 this->maybe_invalidate_previous_present_cell(cell);
319 this->check_cell_similarity(cell);
321 this->present_cell = {cell};
331 template <
int dim,
int spacedim>
341 this->cell_similarity =
342 this->get_mapping().fill_fe_values(this->present_cell,
343 this->cell_similarity,
346 this->mapping_output);
353 this->get_fe().fill_fe_values(this->present_cell,
354 this->cell_similarity,
358 this->mapping_output,
360 this->finite_element_output);
365 template <
int dim,
int spacedim>
377 template <
int dim,
int spacedim>
379 const unsigned int dofs_per_cell,
388 hp::QCollection<dim - 1>(quadrature))
393 template <
int dim,
int spacedim>
395 const unsigned int dofs_per_cell,
400 :
FEValuesBase<dim, spacedim>(quadrature.max_n_quadrature_points(),
406 , quadrature(quadrature)
415 template <
int dim,
int spacedim>
416 const std::vector<Tensor<1, spacedim>> &
421 "update_boundary_forms")));
422 return this->mapping_output.boundary_forms;
427 template <
int dim,
int spacedim>
440 template <
int dim,
int spacedim>
445 template <
int dim,
int spacedim>
450 template <
int dim,
int spacedim>
458 hp::QCollection<dim - 1>(quadrature),
464 template <
int dim,
int spacedim>
476 initialize(update_flags);
481 template <
int dim,
int spacedim>
487 hp::QCollection<dim - 1>(quadrature),
493 template <
int dim,
int spacedim>
499 fe.n_dofs_per_cell(),
505 initialize(update_flags);
510 template <
int dim,
int spacedim>
514 const UpdateFlags flags = this->compute_update_flags(update_flags);
518 this->mapping_output.initialize(this->max_n_quadrature_points, flags);
519 this->finite_element_output.initialize(this->max_n_quadrature_points,
526 std::unique_ptr<typename FiniteElement<dim, spacedim>::InternalDataBase> (
535 std::unique_ptr<typename Mapping<dim, spacedim>::InternalDataBase> (
542 std::unique_ptr<typename FiniteElement<dim, spacedim>::InternalDataBase>>
548 this->finite_element_output);
550 std::unique_ptr<typename Mapping<dim, spacedim>::InternalDataBase>>
558 this->update_flags = flags;
561 this->fe_data = std::move(fe_get_data.return_value());
563 this->mapping_data = std::move(mapping_get_data.return_value());
566 std::make_unique<typename Mapping<dim, spacedim>::InternalDataBase>();
571 template <
int dim,
int spacedim>
576 const unsigned int face_no)
582 cell->get_dof_handler().get_fe(cell->active_fe_index())),
587 this->maybe_invalidate_previous_present_cell(cell);
588 this->present_cell = {cell};
598 template <
int dim,
int spacedim>
605 const auto face_n = cell->face_iterator_to_index(face);
611 template <
int dim,
int spacedim>
615 const unsigned int face_no)
619 this->maybe_invalidate_previous_present_cell(cell);
620 this->present_cell = {cell};
630 template <
int dim,
int spacedim>
636 const auto face_n = cell->face_iterator_to_index(face);
642 template <
int dim,
int spacedim>
646 this->present_face_no = face_no;
651 this->present_face_index = cell->face_index(face_no);
655 this->get_mapping().fill_fe_face_values(this->present_cell,
659 this->mapping_output);
662 this->get_fe().fill_fe_face_values(this->present_cell,
667 this->mapping_output,
669 this->finite_element_output);
671 const_cast<unsigned int &
>(this->n_quadrature_points) =
672 this->quadrature[this->quadrature.
size() == 1 ? 0 : face_no].
size();
679 template <
int dim,
int spacedim>
684 template <
int dim,
int spacedim>
689 template <
int dim,
int spacedim>
701 initialize(update_flags);
706 template <
int dim,
int spacedim>
719 template <
int dim,
int spacedim>
725 fe.n_dofs_per_cell(),
731 initialize(update_flags);
736 template <
int dim,
int spacedim>
748 template <
int dim,
int spacedim>
752 const UpdateFlags flags = this->compute_update_flags(update_flags);
756 this->mapping_output.initialize(this->max_n_quadrature_points, flags);
757 this->finite_element_output.initialize(this->max_n_quadrature_points,
765 std::unique_ptr<typename FiniteElement<dim, spacedim>::InternalDataBase>>
772 this->finite_element_output);
774 std::unique_ptr<typename Mapping<dim, spacedim>::InternalDataBase>>
781 this->quadrature[0]);
783 this->update_flags = flags;
786 this->fe_data = std::move(fe_get_data.return_value());
788 this->mapping_data = std::move(mapping_get_data.return_value());
791 std::make_unique<typename Mapping<dim, spacedim>::InternalDataBase>();
796 template <
int dim,
int spacedim>
801 const unsigned int face_no,
802 const unsigned int subface_no)
808 cell->get_dof_handler().get_fe(cell->active_fe_index())),
815 Assert(cell->face(face_no)->has_children() ||
820 Assert(!cell->face(face_no)->has_children() ||
821 subface_no < cell->face(face_no)->n_active_descendants(),
824 cell->face(face_no)->n_active_descendants()));
825 Assert(cell->has_children() ==
false,
826 ExcMessage(
"You can't use subface data for cells that are "
827 "already refined. Iterate over their children "
828 "instead in these cases."));
830 this->maybe_invalidate_previous_present_cell(cell);
831 this->present_cell = {cell};
836 do_reinit(face_no, subface_no);
841 template <
int dim,
int spacedim>
850 cell->face_iterator_to_index(face),
851 face->child_iterator_to_index(subface));
856 template <
int dim,
int spacedim>
860 const unsigned int face_no,
861 const unsigned int subface_no)
869 (cell->has_periodic_neighbor(face_no) ?
870 cell->periodic_neighbor(face_no)
871 ->face(cell->periodic_neighbor_face_no(face_no))
873 cell->face(face_no)->n_children()));
875 this->maybe_invalidate_previous_present_cell(cell);
876 this->present_cell = {cell};
881 do_reinit(face_no, subface_no);
886 template <
int dim,
int spacedim>
894 cell->face_iterator_to_index(face),
895 face->child_iterator_to_index(subface));
900 template <
int dim,
int spacedim>
903 const unsigned int subface_no)
905 this->present_face_no = face_no;
911 if (!cell->face(face_no)->has_children())
914 this->present_face_index = cell->face_index(face_no);
916 this->present_face_index = cell->face(face_no)->child_index(subface_no);
922 switch (cell->subface_case(face_no))
927 subface_index = cell->face(face_no)->child_index(subface_no);
931 subface_index = cell->face(face_no)
932 ->child(subface_no / 2)
933 ->child_index(subface_no % 2);
942 cell->face(face_no)->child(0)->child_index(subface_no);
945 subface_index = cell->face(face_no)->child_index(1);
956 subface_index = cell->face(face_no)->child_index(0);
961 cell->face(face_no)->child(1)->child_index(subface_no - 1);
973 this->present_face_index = subface_index;
979 this->get_mapping().fill_fe_subface_values(this->present_cell,
984 this->mapping_output);
987 this->get_fe().fill_fe_subface_values(this->present_cell,
993 this->mapping_output,
995 this->finite_element_output);
1001 #include "fe_values.inst"
const std::vector< Tensor< 1, spacedim > > & get_boundary_forms() const
FEFaceValuesBase(const unsigned int dofs_per_cell, const UpdateFlags update_flags, const Mapping< dim, spacedim > &mapping, const FiniteElement< dim, spacedim > &fe, const Quadrature< dim - 1 > &quadrature)
std::size_t memory_consumption() const
void reinit(const TriaIterator< DoFCellAccessor< dim, spacedim, level_dof_access >> &cell, const unsigned int face_no)
void initialize(const UpdateFlags update_flags)
void do_reinit(const unsigned int face_no)
FEFaceValues(const Mapping< dim, spacedim > &mapping, const FiniteElement< dim, spacedim > &fe, const Quadrature< dim - 1 > &quadrature, const UpdateFlags update_flags)
FESubfaceValues(const Mapping< dim, spacedim > &mapping, const FiniteElement< dim, spacedim > &fe, const Quadrature< dim - 1 > &face_quadrature, const UpdateFlags update_flags)
void reinit(const TriaIterator< DoFCellAccessor< dim, spacedim, level_dof_access >> &cell, const unsigned int face_no, const unsigned int subface_no)
void initialize(const UpdateFlags update_flags)
void do_reinit(const unsigned int face_no, const unsigned int subface_no)
FEValues(const Mapping< dim, spacedim > &mapping, const FiniteElement< dim, spacedim > &fe, const Quadrature< dim > &quadrature, const UpdateFlags update_flags)
void reinit(const TriaIterator< DoFCellAccessor< dim, spacedim, level_dof_access >> &cell)
void initialize(const UpdateFlags update_flags)
std::size_t memory_consumption() const
unsigned int n_dofs_per_cell() const
unsigned int n_components() const
ReferenceCell reference_cell() const
const ComponentMask & get_nonzero_components(const unsigned int i) const
unsigned int n_nonzero_components(const unsigned int i) const
unsigned int n_faces() const
unsigned int size() const
#define DEAL_II_NAMESPACE_OPEN
#define DEAL_II_NAMESPACE_CLOSE
static ::ExceptionBase & ExcInternalError()
#define Assert(cond, exc)
#define AssertDimension(dim1, dim2)
#define AssertIndexRange(index, range)
static ::ExceptionBase & ExcIndexRange(std::size_t arg1, std::size_t arg2, std::size_t arg3)
static ::ExceptionBase & ExcMessage(std::string arg1)
@ 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.
@ update_default
No update.
@ update_boundary_forms
Outer normal vector, not normalized.
Task< RT > new_task(const std::function< RT()> &function)
const Mapping< dim, spacedim > & get_default_linear_mapping(const Triangulation< dim, spacedim > &triangulation)
void reference_cell(Triangulation< dim, spacedim > &tria, const ReferenceCell &reference_cell)
std::enable_if_t< std::is_fundamental_v< T >, std::size_t > memory_consumption(const T &t)
void reinit(MatrixBlock< MatrixType > &v, const BlockSparsityPattern &p)
std::vector< unsigned int > make_shape_function_to_row_table(const FiniteElement< dim, spacedim > &fe)
static const unsigned int invalid_unsigned_int