36#include <boost/container/small_vector.hpp>
47 template <
int dim,
int spacedim>
48 inline std::vector<unsigned int>
51 std::vector<unsigned int> shape_function_to_row_table(
60 unsigned int nth_nonzero_component = 0;
65 row + nth_nonzero_component;
66 ++nth_nonzero_component;
71 return shape_function_to_row_table;
79 namespace FEValuesImplementation
81 template <
int dim,
int spacedim>
84 const unsigned int n_quadrature_points,
91 this->shape_function_to_row_table =
96 unsigned int n_nonzero_shape_components = 0;
106 this->shape_values.reinit(n_nonzero_shape_components,
107 n_quadrature_points);
113 this->shape_gradients.reinit(n_nonzero_shape_components,
114 n_quadrature_points);
115 this->shape_gradients.fill(
121 this->shape_hessians.reinit(n_nonzero_shape_components,
122 n_quadrature_points);
123 this->shape_hessians.fill(
129 this->shape_3rd_derivatives.reinit(n_nonzero_shape_components,
130 n_quadrature_points);
131 this->shape_3rd_derivatives.fill(
138 template <
int dim,
int spacedim>
155template <
int dim,
int spacedim>
160template <
int dim,
int spacedim>
166 fe.n_dofs_per_cell(),
177template <
int dim,
int spacedim>
182 :
FEValues(mapping, fe, q[0], update_flags)
189template <
int dim,
int spacedim>
195 fe.n_dofs_per_cell(),
206template <
int dim,
int spacedim>
217template <
int dim,
int spacedim>
223 if (dim != spacedim - 1)
225 ExcMessage(
"You can only pass the 'update_normal_vectors' "
226 "flag to FEFaceValues or FESubfaceValues objects, "
227 "but not to an FEValues object unless the "
228 "triangulation it refers to is embedded in a higher "
229 "dimensional space."));
231 const UpdateFlags flags = this->compute_update_flags(update_flags);
235 this->mapping_output.initialize(this->max_n_quadrature_points, flags);
236 this->finite_element_output.initialize(this->max_n_quadrature_points,
243 std::unique_ptr<typename FiniteElement<dim, spacedim>::InternalDataBase>>
245 return this->fe->get_data(flags,
248 this->finite_element_output);
252 std::unique_ptr<typename Mapping<dim, spacedim>::InternalDataBase>>
256 [&]() {
return this->mapping->get_data(flags, quadrature); });
258 this->update_flags = flags;
261 this->fe_data = std::move(fe_get_data.return_value());
263 this->mapping_data = std::move(mapping_get_data.return_value());
266 std::make_unique<typename Mapping<dim, spacedim>::InternalDataBase>();
271template <
int dim,
int spacedim>
277 Assert(this->get_mapping().is_compatible_with(cell->reference_cell()),
279 "You are trying to call FEValues::reinit() with a cell of type " +
280 cell->reference_cell().to_string() +
281 " with a Mapping that is not compatible with it."));
285 this->maybe_invalidate_previous_present_cell(cell);
286 this->check_cell_similarity(cell);
288 this->present_cell = {cell};
298template <
int dim,
int spacedim>
311 Assert(this->get_mapping().is_compatible_with(cell->reference_cell()),
313 "You are trying to call FEValues::reinit() with a cell of type " +
314 cell->reference_cell().to_string() +
315 " with a Mapping that is not compatible with it."));
317 this->maybe_invalidate_previous_present_cell(cell);
318 this->check_cell_similarity(cell);
320 this->present_cell = {cell};
330template <
int dim,
int spacedim>
340 this->cell_similarity =
341 this->get_mapping().fill_fe_values(this->present_cell,
342 this->cell_similarity,
345 this->mapping_output);
352 this->get_fe().fill_fe_values(this->present_cell,
353 this->cell_similarity,
357 this->mapping_output,
359 this->finite_element_output);
364template <
int dim,
int spacedim>
376template <
int dim,
int spacedim>
378 const unsigned int dofs_per_cell,
387 hp::QCollection<dim - 1>(quadrature))
392template <
int dim,
int spacedim>
394 const unsigned int dofs_per_cell,
399 :
FEValuesBase<dim, spacedim>(quadrature.max_n_quadrature_points(),
404 , present_face_index(
numbers::invalid_unsigned_int)
405 , quadrature(quadrature)
414template <
int dim,
int spacedim>
415const std::vector<Tensor<1, spacedim>> &
420 "update_boundary_forms")));
421 return this->mapping_output.boundary_forms;
426template <
int dim,
int spacedim>
439template <
int dim,
int spacedim>
444template <
int dim,
int spacedim>
449template <
int dim,
int spacedim>
457 hp::QCollection<dim - 1>(quadrature),
463template <
int dim,
int spacedim>
480template <
int dim,
int spacedim>
486 hp::QCollection<dim - 1>(quadrature),
492template <
int dim,
int spacedim>
498 fe.n_dofs_per_cell(),
509template <
int dim,
int spacedim>
513 const UpdateFlags flags = this->compute_update_flags(update_flags);
517 this->mapping_output.initialize(this->max_n_quadrature_points, flags);
518 this->finite_element_output.initialize(this->max_n_quadrature_points,
525 std::unique_ptr<typename FiniteElement<dim, spacedim>::InternalDataBase> (
534 std::unique_ptr<typename Mapping<dim, spacedim>::InternalDataBase> (
541 std::unique_ptr<typename FiniteElement<dim, spacedim>::InternalDataBase>>
547 this->finite_element_output);
549 std::unique_ptr<typename Mapping<dim, spacedim>::InternalDataBase>>
557 this->update_flags = flags;
560 this->fe_data = std::move(fe_get_data.return_value());
562 this->mapping_data = std::move(mapping_get_data.return_value());
565 std::make_unique<typename Mapping<dim, spacedim>::InternalDataBase>();
570template <
int dim,
int spacedim>
575 const unsigned int face_no)
581 cell->get_dof_handler().get_fe(cell->active_fe_index())),
586 this->maybe_invalidate_previous_present_cell(cell);
587 this->present_cell = {cell};
597template <
int dim,
int spacedim>
604 const auto face_n = cell->face_iterator_to_index(face);
610template <
int dim,
int spacedim>
614 const unsigned int face_no)
618 this->maybe_invalidate_previous_present_cell(cell);
619 this->present_cell = {cell};
629template <
int dim,
int spacedim>
635 const auto face_n = cell->face_iterator_to_index(face);
641template <
int dim,
int spacedim>
645 this->present_face_no = face_no;
650 this->present_face_index = cell->face_index(face_no);
654 this->get_mapping().fill_fe_face_values(this->present_cell,
658 this->mapping_output);
661 this->get_fe().fill_fe_face_values(this->present_cell,
666 this->mapping_output,
668 this->finite_element_output);
670 const_cast<unsigned int &
>(this->n_quadrature_points) =
671 this->quadrature[this->quadrature.
size() == 1 ? 0 : face_no].
size();
678template <
int dim,
int spacedim>
683template <
int dim,
int spacedim>
688template <
int dim,
int spacedim>
705template <
int dim,
int spacedim>
718template <
int dim,
int spacedim>
724 fe.n_dofs_per_cell(),
735template <
int dim,
int spacedim>
747template <
int dim,
int spacedim>
751 const UpdateFlags flags = this->compute_update_flags(update_flags);
755 this->mapping_output.initialize(this->max_n_quadrature_points, flags);
756 this->finite_element_output.initialize(this->max_n_quadrature_points,
764 std::unique_ptr<typename FiniteElement<dim, spacedim>::InternalDataBase>>
771 this->finite_element_output);
773 std::unique_ptr<typename Mapping<dim, spacedim>::InternalDataBase>>
780 this->quadrature[0]);
782 this->update_flags = flags;
785 this->fe_data = std::move(fe_get_data.return_value());
787 this->mapping_data = std::move(mapping_get_data.return_value());
790 std::make_unique<typename Mapping<dim, spacedim>::InternalDataBase>();
795template <
int dim,
int spacedim>
800 const unsigned int face_no,
801 const unsigned int subface_no)
807 cell->get_dof_handler().get_fe(cell->active_fe_index())),
814 Assert(cell->face(face_no)->has_children() ||
819 Assert(!cell->face(face_no)->has_children() ||
820 subface_no < cell->face(face_no)->n_active_descendants(),
823 cell->face(face_no)->n_active_descendants()));
824 Assert(cell->has_children() ==
false,
825 ExcMessage(
"You can't use subface data for cells that are "
826 "already refined. Iterate over their children "
827 "instead in these cases."));
829 this->maybe_invalidate_previous_present_cell(cell);
830 this->present_cell = {cell};
835 do_reinit(face_no, subface_no);
840template <
int dim,
int spacedim>
849 cell->face_iterator_to_index(face),
850 face->child_iterator_to_index(subface));
855template <
int dim,
int spacedim>
859 const unsigned int face_no,
860 const unsigned int subface_no)
868 (cell->has_periodic_neighbor(face_no) ?
869 cell->periodic_neighbor(face_no)
870 ->face(cell->periodic_neighbor_face_no(face_no))
872 cell->face(face_no)->n_children()));
874 this->maybe_invalidate_previous_present_cell(cell);
875 this->present_cell = {cell};
880 do_reinit(face_no, subface_no);
885template <
int dim,
int spacedim>
893 cell->face_iterator_to_index(face),
894 face->child_iterator_to_index(subface));
899template <
int dim,
int spacedim>
902 const unsigned int subface_no)
904 this->present_face_no = face_no;
910 if (!cell->face(face_no)->has_children())
913 this->present_face_index = cell->face_index(face_no);
915 this->present_face_index = cell->face(face_no)->child_index(subface_no);
921 switch (cell->subface_case(face_no))
926 subface_index = cell->face(face_no)->child_index(subface_no);
930 subface_index = cell->face(face_no)
931 ->child(subface_no / 2)
932 ->child_index(subface_no % 2);
941 cell->face(face_no)->child(0)->child_index(subface_no);
944 subface_index = cell->face(face_no)->child_index(1);
955 subface_index = cell->face(face_no)->child_index(0);
960 cell->face(face_no)->child(1)->child_index(subface_no - 1);
972 this->present_face_index = subface_index;
978 this->get_mapping().fill_fe_subface_values(this->present_cell,
983 this->mapping_output);
986 this->get_fe().fill_fe_subface_values(this->present_cell,
992 this->mapping_output,
994 this->finite_element_output);
1000#include "fe_values.inst"
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
const std::vector< Tensor< 1, spacedim > > & get_boundary_forms() const
void initialize(const UpdateFlags update_flags)
void reinit(const TriaIterator< DoFCellAccessor< dim, spacedim, level_dof_access > > &cell, const unsigned int face_no)
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 initialize(const UpdateFlags update_flags)
void reinit(const TriaIterator< DoFCellAccessor< dim, spacedim, level_dof_access > > &cell)
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
Abstract base class for mapping classes.
unsigned int n_faces() const
unsigned int size() const
#define DEAL_II_NAMESPACE_OPEN
#define DEAL_II_NAMESPACE_CLOSE
#define Assert(cond, exc)
#define AssertDimension(dim1, dim2)
#define AssertIndexRange(index, range)
static ::ExceptionBase & ExcInternalError()
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)
#define DEAL_II_ASSERT_UNREACHABLE()
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