deal.II version GIT relicensing-2233-g9bd70d8389 2024-12-08 16:10:00+00:00
\(\newcommand{\dealvcentcolon}{\mathrel{\mathop{:}}}\) \(\newcommand{\dealcoloneq}{\dealvcentcolon\mathrel{\mkern-1.2mu}=}\) \(\newcommand{\jump}[1]{\left[\!\left[ #1 \right]\!\right]}\) \(\newcommand{\average}[1]{\left\{\!\left\{ #1 \right\}\!\right\}}\)
Loading...
Searching...
No Matches
fe_values.h
Go to the documentation of this file.
1// ------------------------------------------------------------------------
2//
3// SPDX-License-Identifier: LGPL-2.1-or-later
4// Copyright (C) 1998 - 2023 by the deal.II authors
5//
6// This file is part of the deal.II library.
7//
8// Part of the source code is dual licensed under Apache-2.0 WITH
9// LLVM-exception OR LGPL-2.1-or-later. Detailed license information
10// governing the source code and code contributions can be found in
11// LICENSE.md and CONTRIBUTING.md at the top level directory of deal.II.
12//
13// ------------------------------------------------------------------------
14
15#ifndef dealii_fe_values_h
16#define dealii_fe_values_h
17
18
19#include <deal.II/base/config.h>
20
24#include <deal.II/base/point.h>
28
31
32#include <deal.II/fe/fe.h>
36#include <deal.II/fe/mapping.h>
38
39#include <deal.II/grid/tria.h>
41
43
45
46#include <algorithm>
47#include <memory>
48#include <type_traits>
49
51
61template <int dim, int spacedim = dim>
62class FEValues : public FEValuesBase<dim, spacedim>
63{
64public:
69 static constexpr unsigned int integral_dimension = dim;
70
79
90
99
109
116 template <bool level_dof_access>
117 void
120
134 void
136
141 const Quadrature<dim> &
143
148 std::size_t
150
167
168private:
173
177 void
179
186 void
188};
189
190
200template <int dim, int spacedim = dim>
201class FEFaceValuesBase : public FEValuesBase<dim, spacedim>
202{
203public:
208 static constexpr unsigned int integral_dimension = dim - 1;
209
221 FEFaceValuesBase(const unsigned int dofs_per_cell,
226
233 FEFaceValuesBase(const unsigned int dofs_per_cell,
238
246 const Tensor<1, spacedim> &
247 boundary_form(const unsigned int q_point) const;
248
255 const std::vector<Tensor<1, spacedim>> &
257
262 unsigned int
264
269 unsigned int
271
276 const Quadrature<dim - 1> &
278
283 std::size_t
285
286protected:
291 unsigned int present_face_no;
292
297 unsigned int present_face_index;
298
303};
304
305
306
320template <int dim, int spacedim = dim>
321class FEFaceValues : public FEFaceValuesBase<dim, spacedim>
322{
323public:
328 static constexpr unsigned int dimension = dim;
329
330 static constexpr unsigned int space_dimension = spacedim;
331
336 static constexpr unsigned int integral_dimension = dim - 1;
337
346
357
366
376
381 template <bool level_dof_access>
382 void
385 const unsigned int face_no);
386
393 template <bool level_dof_access>
394 void
398
412 void
414 const unsigned int face_no);
415
416 /*
417 * Reinitialize the gradients, Jacobi determinants, etc for the given face
418 * on a given cell of type "iterator into a Triangulation object", and the
419 * given finite element. Since iterators into a triangulation alone only
420 * convey information about the geometry of a cell, but not about degrees of
421 * freedom possibly associated with this cell, you will not be able to call
422 * some functions of this class if they need information about degrees of
423 * freedom. These functions are, above all, the
424 * <tt>get_function_value/gradients/hessians/third_derivatives</tt>
425 * functions. If you want to call these functions, you have to call the @p
426 * reinit variants that take iterators into DoFHandler or other DoF handler
427 * type objects.
428 *
429 * @note @p face must be one of @p cell's face iterators.
430 */
431 void
434
451
452private:
456 void
458
465 void
466 do_reinit(const unsigned int face_no);
467};
468
469
486template <int dim, int spacedim = dim>
487class FESubfaceValues : public FEFaceValuesBase<dim, spacedim>
488{
489public:
493 static constexpr unsigned int dimension = dim;
494
498 static constexpr unsigned int space_dimension = spacedim;
499
504 static constexpr unsigned int integral_dimension = dim - 1;
505
512 const Quadrature<dim - 1> &face_quadrature,
514
523 const hp::QCollection<dim - 1> &face_quadrature,
525
532 const Quadrature<dim - 1> &face_quadrature,
534
542 const hp::QCollection<dim - 1> &face_quadrature,
544
551 template <bool level_dof_access>
552 void
555 const unsigned int face_no,
556 const unsigned int subface_no);
557
562 template <bool level_dof_access>
563 void
567 const typename Triangulation<dim, spacedim>::face_iterator &subface);
568
582 void
584 const unsigned int face_no,
585 const unsigned int subface_no);
586
606 void
609 const typename Triangulation<dim, spacedim>::face_iterator &subface);
610
627
634
641
642private:
646 void
648
655 void
656 do_reinit(const unsigned int face_no, const unsigned int subface_no);
657};
658
659
660#ifndef DOXYGEN
661
662
663/*--------------------- Inline functions: FEValues --------------------------*/
664
665
666template <int dim, int spacedim>
667inline const Quadrature<dim> &
669{
670 return quadrature;
671}
672
673
674
675template <int dim, int spacedim>
676inline const FEValues<dim, spacedim> &
678{
679 return *this;
680}
681
682
683/*---------------------- Inline functions: FEFaceValuesBase -----------------*/
684
685
686template <int dim, int spacedim>
687inline unsigned int
689{
690 return present_face_no;
691}
692
693
694template <int dim, int spacedim>
695inline unsigned int
697{
698 return present_face_index;
699}
700
701
702/*----------------------- Inline functions: FE*FaceValues -------------------*/
703
704template <int dim, int spacedim>
705inline const Quadrature<dim - 1> &
707{
708 return quadrature[quadrature.size() == 1 ? 0 : present_face_no];
709}
710
711
712
713template <int dim, int spacedim>
714inline const FEFaceValues<dim, spacedim> &
716{
717 return *this;
718}
719
720
721
722template <int dim, int spacedim>
725{
726 return *this;
727}
728
729
730
731template <int dim, int spacedim>
732inline const Tensor<1, spacedim> &
733FEFaceValuesBase<dim, spacedim>::boundary_form(const unsigned int q_point) const
734{
735 AssertIndexRange(q_point, this->mapping_output.boundary_forms.size());
736 Assert(this->update_flags & update_boundary_forms,
738 "update_boundary_forms")));
739
740 return this->mapping_output.boundary_forms[q_point];
741}
742
743#endif // DOXYGEN
744
746
747#endif
const Tensor< 1, spacedim > & boundary_form(const unsigned int q_point) const
static constexpr unsigned int integral_dimension
Definition fe_values.h:208
const Quadrature< dim - 1 > & get_quadrature() const
unsigned int get_face_index() const
unsigned int present_face_no
Definition fe_values.h:291
FEFaceValuesBase(const unsigned int dofs_per_cell, const UpdateFlags update_flags, const Mapping< dim, spacedim > &mapping, const FiniteElement< dim, spacedim > &fe, const hp::QCollection< dim - 1 > &quadrature)
unsigned int present_face_index
Definition fe_values.h:297
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
unsigned int get_face_number() const
const hp::QCollection< dim - 1 > quadrature
Definition fe_values.h:302
void reinit(const TriaIterator< DoFCellAccessor< dim, spacedim, level_dof_access > > &cell, const typename Triangulation< dim, spacedim >::face_iterator &face)
const FEFaceValues< dim, spacedim > & get_present_fe_values() const
FEFaceValues(const FiniteElement< dim, spacedim > &fe, const Quadrature< dim - 1 > &quadrature, const UpdateFlags update_flags)
void initialize(const UpdateFlags update_flags)
void reinit(const typename Triangulation< dim, spacedim >::cell_iterator &cell, const unsigned int face_no)
static constexpr unsigned int integral_dimension
Definition fe_values.h:336
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)
static constexpr unsigned int space_dimension
Definition fe_values.h:330
static constexpr unsigned int dimension
Definition fe_values.h:328
FEFaceValues(const Mapping< dim, spacedim > &mapping, const FiniteElement< dim, spacedim > &fe, const hp::QCollection< dim - 1 > &quadrature, const UpdateFlags update_flags)
FEFaceValues(const FiniteElement< dim, spacedim > &fe, const hp::QCollection< dim - 1 > &quadrature, const UpdateFlags update_flags)
void reinit(const typename Triangulation< dim, spacedim >::cell_iterator &cell, const typename Triangulation< dim, spacedim >::face_iterator &face)
FESubfaceValues(const Mapping< dim, spacedim > &mapping, const FiniteElement< dim, spacedim > &fe, const Quadrature< dim - 1 > &face_quadrature, const UpdateFlags update_flags)
void reinit(const typename Triangulation< dim, spacedim >::cell_iterator &cell, const unsigned int face_no, const unsigned int subface_no)
static constexpr unsigned int space_dimension
Definition fe_values.h:498
void reinit(const TriaIterator< DoFCellAccessor< dim, spacedim, level_dof_access > > &cell, const unsigned int face_no, const unsigned int subface_no)
static constexpr unsigned int integral_dimension
Definition fe_values.h:504
void initialize(const UpdateFlags update_flags)
static constexpr unsigned int dimension
Definition fe_values.h:493
const FESubfaceValues< dim, spacedim > & get_present_fe_values() const
FESubfaceValues(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 typename Triangulation< dim, spacedim >::face_iterator &face, const typename Triangulation< dim, spacedim >::face_iterator &subface)
void do_reinit(const unsigned int face_no, const unsigned int subface_no)
FESubfaceValues(const FiniteElement< dim, spacedim > &fe, const hp::QCollection< dim - 1 > &face_quadrature, const UpdateFlags update_flags)
FESubfaceValues(const Mapping< dim, spacedim > &mapping, const FiniteElement< dim, spacedim > &fe, const hp::QCollection< dim - 1 > &face_quadrature, const UpdateFlags update_flags)
void reinit(const typename Triangulation< dim, spacedim >::cell_iterator &cell, const typename Triangulation< dim, spacedim >::face_iterator &face, const typename Triangulation< dim, spacedim >::face_iterator &subface)
const unsigned int dofs_per_cell
UpdateFlags update_flags
const ObserverPointer< const Mapping< dim, spacedim >, FEValuesBase< dim, spacedim > > mapping
const ObserverPointer< 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 do_reinit()
const Quadrature< dim > & get_quadrature() const
const Quadrature< dim > quadrature
Definition fe_values.h:172
FEValues(const FiniteElement< dim, spacedim > &fe, const hp::QCollection< dim > &quadrature, const UpdateFlags update_flags)
const FEValues< dim, spacedim > & get_present_fe_values() const
FEValues(const Mapping< dim, spacedim > &mapping, const FiniteElement< dim, spacedim > &fe, const hp::QCollection< dim > &quadrature, const UpdateFlags update_flags)
FEValues(const FiniteElement< dim, spacedim > &fe, const Quadrature< dim > &quadrature, const UpdateFlags update_flags)
void initialize(const UpdateFlags update_flags)
void reinit(const typename Triangulation< dim, spacedim >::cell_iterator &cell)
static constexpr unsigned int integral_dimension
Definition fe_values.h:69
void reinit(const TriaIterator< DoFCellAccessor< dim, spacedim, level_dof_access > > &cell)
std::size_t memory_consumption() const
Abstract base class for mapping classes.
Definition mapping.h:318
#define DEAL_II_NAMESPACE_OPEN
Definition config.h:498
#define DEAL_II_NAMESPACE_CLOSE
Definition config.h:499
#define DeclException0(Exception0)
Definition exceptions.h:466
static ::ExceptionBase & ExcFaceHasNoSubfaces()
static ::ExceptionBase & ExcReinitCalledWithBoundaryFace()
#define Assert(cond, exc)
#define AssertIndexRange(index, range)
UpdateFlags
@ update_boundary_forms
Outer normal vector, not normalized.