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>
155 template <
int dim,
int spacedim>
160 template <
int dim,
int spacedim>
166 fe.n_dofs_per_cell(),
177 template <
int dim,
int spacedim>
182 :
FEValues(mapping, fe, q[0], update_flags)
189 template <
int dim,
int spacedim>
195 fe.n_dofs_per_cell(),
206 template <
int dim,
int spacedim>
217 template <
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>>
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>();
271 template <
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};
298 template <
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};
330 template <
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);
364 template <
int dim,
int spacedim>
376 template <
int dim,
int spacedim>
378 const unsigned int dofs_per_cell,
387 hp::QCollection<dim - 1>(quadrature))
392 template <
int dim,
int spacedim>
394 const unsigned int dofs_per_cell,
399 :
FEValuesBase<dim, spacedim>(quadrature.max_n_quadrature_points(),
405 , quadrature(quadrature)
414 template <
int dim,
int spacedim>
415 const std::vector<Tensor<1, spacedim>> &
420 "update_boundary_forms")));
421 return this->mapping_output.boundary_forms;
426 template <
int dim,
int spacedim>
437 template <
int dim,
int spacedim>
442 template <
int dim,
int spacedim>
447 template <
int dim,
int spacedim>
455 hp::QCollection<dim - 1>(quadrature),
461 template <
int dim,
int spacedim>
478 template <
int dim,
int spacedim>
484 hp::QCollection<dim - 1>(quadrature),
490 template <
int dim,
int spacedim>
496 fe.n_dofs_per_cell(),
507 template <
int dim,
int spacedim>
511 const UpdateFlags flags = this->compute_update_flags(update_flags);
515 this->mapping_output.initialize(this->max_n_quadrature_points, flags);
516 this->finite_element_output.initialize(this->max_n_quadrature_points,
523 std::unique_ptr<typename FiniteElement<dim, spacedim>::InternalDataBase> (
532 std::unique_ptr<typename Mapping<dim, spacedim>::InternalDataBase> (
539 std::unique_ptr<typename FiniteElement<dim, spacedim>::InternalDataBase>>
545 this->finite_element_output);
547 std::unique_ptr<typename Mapping<dim, spacedim>::InternalDataBase>>
555 this->update_flags = flags;
558 this->fe_data = std::move(fe_get_data.return_value());
560 this->mapping_data = std::move(mapping_get_data.return_value());
563 std::make_unique<typename Mapping<dim, spacedim>::InternalDataBase>();
568 template <
int dim,
int spacedim>
573 const unsigned int face_no)
579 cell->get_dof_handler().get_fe(cell->active_fe_index())),
584 this->maybe_invalidate_previous_present_cell(cell);
585 this->present_cell = {cell};
595 template <
int dim,
int spacedim>
602 const auto face_n = cell->face_iterator_to_index(face);
608 template <
int dim,
int spacedim>
612 const unsigned int face_no)
616 this->maybe_invalidate_previous_present_cell(cell);
617 this->present_cell = {cell};
627 template <
int dim,
int spacedim>
633 const auto face_n = cell->face_iterator_to_index(face);
639 template <
int dim,
int spacedim>
643 this->present_face_no = face_no;
648 this->present_face_index = cell->face_index(face_no);
652 this->get_mapping().fill_fe_face_values(this->present_cell,
656 this->mapping_output);
659 this->get_fe().fill_fe_face_values(this->present_cell,
664 this->mapping_output,
666 this->finite_element_output);
668 const_cast<unsigned int &
>(this->n_quadrature_points) =
669 this->quadrature[this->quadrature.size() == 1 ? 0 : face_no].size();
676 template <
int dim,
int spacedim>
681 template <
int dim,
int spacedim>
686 template <
int dim,
int spacedim>
703 template <
int dim,
int spacedim>
716 template <
int dim,
int spacedim>
722 fe.n_dofs_per_cell(),
733 template <
int dim,
int spacedim>
745 template <
int dim,
int spacedim>
749 const UpdateFlags flags = this->compute_update_flags(update_flags);
753 this->mapping_output.initialize(this->max_n_quadrature_points, flags);
754 this->finite_element_output.initialize(this->max_n_quadrature_points,
762 std::unique_ptr<typename FiniteElement<dim, spacedim>::InternalDataBase>>
769 this->finite_element_output);
771 std::unique_ptr<typename Mapping<dim, spacedim>::InternalDataBase>>
778 this->quadrature[0]);
780 this->update_flags = flags;
783 this->fe_data = std::move(fe_get_data.return_value());
785 this->mapping_data = std::move(mapping_get_data.return_value());
788 std::make_unique<typename Mapping<dim, spacedim>::InternalDataBase>();
793 template <
int dim,
int spacedim>
798 const unsigned int face_no,
799 const unsigned int subface_no)
805 cell->get_dof_handler().get_fe(cell->active_fe_index())),
812 Assert(cell->face(face_no)->has_children() ||
817 Assert(!cell->face(face_no)->has_children() ||
818 subface_no < cell->face(face_no)->n_active_descendants(),
821 cell->face(face_no)->n_active_descendants()));
822 Assert(cell->has_children() ==
false,
823 ExcMessage(
"You can't use subface data for cells that are "
824 "already refined. Iterate over their children "
825 "instead in these cases."));
827 this->maybe_invalidate_previous_present_cell(cell);
828 this->present_cell = {cell};
833 do_reinit(face_no, subface_no);
838 template <
int dim,
int spacedim>
847 cell->face_iterator_to_index(face),
848 face->child_iterator_to_index(subface));
853 template <
int dim,
int spacedim>
857 const unsigned int face_no,
858 const unsigned int subface_no)
866 (cell->has_periodic_neighbor(face_no) ?
867 cell->periodic_neighbor(face_no)
868 ->face(cell->periodic_neighbor_face_no(face_no))
870 cell->face(face_no)->n_children()));
872 this->maybe_invalidate_previous_present_cell(cell);
873 this->present_cell = {cell};
878 do_reinit(face_no, subface_no);
883 template <
int dim,
int spacedim>
891 cell->face_iterator_to_index(face),
892 face->child_iterator_to_index(subface));
897 template <
int dim,
int spacedim>
900 const unsigned int subface_no)
902 this->present_face_no = face_no;
908 if (!cell->face(face_no)->has_children())
911 this->present_face_index = cell->face_index(face_no);
913 this->present_face_index = cell->face(face_no)->child_index(subface_no);
919 switch (cell->subface_case(face_no))
924 subface_index = cell->face(face_no)->child_index(subface_no);
928 subface_index = cell->face(face_no)
929 ->child(subface_no / 2)
930 ->child_index(subface_no % 2);
939 cell->face(face_no)->child(0)->child_index(subface_no);
942 subface_index = cell->face(face_no)->child_index(1);
953 subface_index = cell->face(face_no)->child_index(0);
958 cell->face(face_no)->child(1)->child_index(subface_no - 1);
970 this->present_face_index = subface_index;
976 this->get_mapping().fill_fe_subface_values(this->present_cell,
981 this->mapping_output);
984 this->get_fe().fill_fe_subface_values(this->present_cell,
990 this->mapping_output,
992 this->finite_element_output);
998 #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
const hp::QCollection< dim - 1 > quadrature
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)
const SmartPointer< const FiniteElement< dim, spacedim >, FEValuesBase< dim, spacedim > > fe
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
const ComponentMask & get_nonzero_components(const unsigned int i) const
virtual std::unique_ptr< InternalDataBase > get_data(const UpdateFlags update_flags, const Mapping< dim, spacedim > &mapping, const Quadrature< dim > &quadrature, ::internal::FEValuesImplementation::FiniteElementRelatedData< dim, spacedim > &output_data) const =0
unsigned int n_nonzero_components(const unsigned int i) 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