deal.II version GIT relicensing-6809-ge913b9bb34 2026-09-25 17:20:01+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.h
Go to the documentation of this file.
1// -----------------------------------------------------------------------------
2//
3// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception OR LGPL-2.1-or-later
4// Copyright (C) 1998 - 2025 by the deal.II authors
5//
6// This file is part of the deal.II library.
7//
8// Detailed license information governing the source code and contributions
9// can be found in LICENSE.md and CONTRIBUTING.md at the top level directory.
10//
11// -----------------------------------------------------------------------------
12
13#ifndef dealii_fe_h
14#define dealii_fe_h
15
16#include <deal.II/base/config.h>
17
20#include <deal.II/fe/fe_data.h>
23#include <deal.II/fe/mapping.h>
25
27#include <deal.II/lac/vector.h>
28
29#include <memory>
30
31
33
34// Forward declarations:
35#ifndef DOXYGEN
36template <int dim, int spacedim>
37class FEValuesBase;
38template <int dim, int spacedim>
39class FEValues;
40template <int dim, int spacedim>
41class FEFaceValues;
42template <int dim, int spacedim>
43class FESubfaceValues;
44namespace NonMatching
45{
46 template <int dim>
47 class FEImmersedSurfaceValues;
48}
49template <int dim, int spacedim>
50class FESystem;
51#endif
52
651template <int dim, int spacedim = dim>
653 public FiniteElementData<dim>
654{
655public:
659 static constexpr unsigned int space_dimension = spacedim;
660
686 {
687 public:
693
697 virtual ~InternalDataBase() = default;
698
703
719
723 virtual std::size_t
725 };
726
727public:
771 const std::vector<bool> &restriction_is_additive_flags,
772 const std::vector<ComponentMask> &nonzero_components);
773
778
783
788 virtual ~FiniteElement() override = default;
789
798 std::pair<std::unique_ptr<FiniteElement<dim, spacedim>>, unsigned int>
799 operator^(const unsigned int multiplicity) const;
800
812 virtual std::unique_ptr<FiniteElement<dim, spacedim>>
813 clone() const = 0;
814
825 virtual std::string
826 get_name() const = 0;
827
853 virtual double
854 shape_value(const unsigned int i, const Point<dim> &p) const;
855
862 virtual double
863 shape_value_component(const unsigned int i,
864 const Point<dim> &p,
865 const unsigned int component) const;
866
888 virtual Tensor<1, dim>
889 shape_grad(const unsigned int i, const Point<dim> &p) const;
890
897 virtual Tensor<1, dim>
898 shape_grad_component(const unsigned int i,
899 const Point<dim> &p,
900 const unsigned int component) const;
901
923 virtual Tensor<2, dim>
924 shape_grad_grad(const unsigned int i, const Point<dim> &p) const;
925
932 virtual Tensor<2, dim>
933 shape_grad_grad_component(const unsigned int i,
934 const Point<dim> &p,
935 const unsigned int component) const;
936
958 virtual Tensor<3, dim>
959 shape_3rd_derivative(const unsigned int i, const Point<dim> &p) const;
960
968 virtual Tensor<3, dim>
969 shape_3rd_derivative_component(const unsigned int i,
970 const Point<dim> &p,
971 const unsigned int component) const;
972
994 virtual Tensor<4, dim>
995 shape_4th_derivative(const unsigned int i, const Point<dim> &p) const;
996
1004 virtual Tensor<4, dim>
1006 const Point<dim> &p,
1007 const unsigned int component) const;
1018 virtual bool
1019 has_support_on_face(const unsigned int shape_index,
1020 const unsigned int face_index) const;
1021
1058 virtual const FullMatrix<double> &
1059 get_restriction_matrix(const unsigned int child,
1060 const RefinementCase<dim> &refinement_case =
1062
1092 virtual const FullMatrix<double> &
1093 get_prolongation_matrix(const unsigned int child,
1094 const RefinementCase<dim> &refinement_case =
1096
1118 bool
1120
1136 bool
1138
1160 bool
1162
1178 bool
1180
1181
1190 bool
1191 restriction_is_additive(const unsigned int index) const;
1192
1204 const FullMatrix<double> &
1205 constraints(const ::internal::SubfaceCase<dim> &subface_case =
1207
1223 bool
1225 const ::internal::SubfaceCase<dim> &subface_case =
1227
1228
1250 virtual bool
1252
1253
1265 virtual void
1267 FullMatrix<double> &matrix) const;
1287 virtual void
1289 FullMatrix<double> &matrix,
1290 const unsigned int face_no = 0) const;
1291
1292
1304 virtual void
1306 const unsigned int subface,
1307 FullMatrix<double> &matrix,
1308 const unsigned int face_no = 0) const;
1332 virtual std::vector<std::pair<unsigned int, unsigned int>>
1334
1339 virtual std::vector<std::pair<unsigned int, unsigned int>>
1341
1350 virtual std::vector<std::pair<unsigned int, unsigned int>>
1352 const unsigned int face_no = 0) const;
1353
1371 const unsigned int codim = 0) const;
1372
1405 virtual bool
1407
1412 bool
1414
1450 std::pair<unsigned int, unsigned int>
1451 system_to_component_index(const unsigned int index) const;
1452
1462 unsigned int
1463 component_to_system_index(const unsigned int component,
1464 const unsigned int index) const;
1465
1475 std::pair<unsigned int, unsigned int>
1476 face_system_to_component_index(const unsigned int index,
1477 const unsigned int face_no = 0) const;
1478
1485 unsigned int
1487 const unsigned int index,
1488 const unsigned int face_no,
1489 const types::geometric_orientation combined_orientation) const;
1490
1539 virtual unsigned int
1540 face_to_cell_index(const unsigned int face_dof_index,
1541 const unsigned int face,
1542 const types::geometric_orientation combined_orientation =
1544
1554 unsigned int
1556 const unsigned int index,
1557 const types::geometric_orientation combined_orientation) const;
1558
1575 const ComponentMask &
1576 get_nonzero_components(const unsigned int i) const;
1577
1588 unsigned int
1589 n_nonzero_components(const unsigned int i) const;
1590
1599 bool
1601
1612 bool
1613 is_primitive(const unsigned int i) const;
1614
1631 virtual const Table<2, bool> &
1633
1645 unsigned int
1647
1652 virtual const FiniteElement<dim, spacedim> &
1653 base_element(const unsigned int index) const;
1654
1661 unsigned int
1662 element_multiplicity(const unsigned int index) const;
1663
1758 get_sub_fe(const ComponentMask &mask) const;
1759
1768 virtual const FiniteElement<dim, spacedim> &
1769 get_sub_fe(const unsigned int first_component,
1770 const unsigned int n_selected_components) const;
1771
1794 std::pair<std::pair<unsigned int, unsigned int>, unsigned int>
1795 system_to_base_index(const unsigned int index) const;
1796
1805 std::pair<std::pair<unsigned int, unsigned int>, unsigned int>
1806 face_system_to_base_index(const unsigned int index,
1807 const unsigned int face_no = 0) const;
1808
1814 first_block_of_base(const unsigned int b) const;
1815
1828 std::pair<unsigned int, unsigned int>
1829 component_to_base_index(const unsigned int component) const;
1830
1831
1836 std::pair<unsigned int, unsigned int>
1837 block_to_base_index(const unsigned int block) const;
1838
1842 std::pair<unsigned int, types::global_dof_index>
1843 system_to_block_index(const unsigned int component) const;
1844
1848 unsigned int
1849 component_to_block_index(const unsigned int component) const;
1850
1866 bool
1867 shape_function_belongs_to(const unsigned int shape_function,
1868 const FEValuesExtractors::Scalar &component) const;
1869
1885 bool
1886 shape_function_belongs_to(const unsigned int shape_function,
1888
1889
1905 bool
1907 const unsigned int shape_function,
1909
1910
1921 bool
1923 const unsigned int shape_function,
1946
1961
1977 const FEValuesExtractors::SymmetricTensor<2> &sym_tensor) const;
1978
1995
2016 BlockMask
2018
2035 BlockMask
2037
2055 BlockMask
2057
2080 BlockMask
2082
2098 virtual std::pair<Table<2, bool>, std::vector<unsigned int>>
2100
2138 const std::vector<Point<dim>> &
2140
2167 bool
2169
2182 virtual Point<dim>
2183 unit_support_point(const unsigned int index) const;
2184
2211 const std::vector<Point<dim - 1>> &
2212 get_unit_face_support_points(const unsigned int face_no = 0) const;
2213
2225 bool
2226 has_face_support_points(const unsigned int face_no = 0) const;
2227
2232 virtual Point<dim - 1>
2233 unit_face_support_point(const unsigned int index,
2234 const unsigned int face_no = 0) const;
2235
2263 const std::vector<Point<dim>> &
2265
2280 bool
2282
2329 get_associated_geometry_primitive(const unsigned int cell_dof_index) const;
2330
2331
2409 virtual void
2411 const std::vector<Vector<double>> &support_point_values,
2412 std::vector<double> &nodal_values) const;
2413
2424 virtual std::size_t
2426
2433 int,
2434 << "The shape function with index " << arg1
2435 << " is not primitive, i.e. it is vector-valued and "
2436 << "has more than one non-zero vector component. This "
2437 << "function cannot be called for these shape functions. "
2438 << "Maybe you want to use the same function with the "
2439 << "_component suffix?");
2453 "You are trying to access the values or derivatives of shape functions "
2454 "on the reference cell of an element that does not define its shape "
2455 "functions through mapping from the reference cell. Consequently, "
2456 "you cannot ask for shape function values or derivatives on the "
2457 "reference cell.");
2458
2466 "You are trying to access the support points of a finite "
2467 "element that either has no support points at all, or for "
2468 "which the corresponding tables have not been implemented.");
2469
2477 "You are trying to access the matrices that describe how "
2478 "to embed a finite element function on one cell into the "
2479 "finite element space on one of its children (i.e., the "
2480 "'embedding' or 'prolongation' matrices). However, the "
2481 "current finite element can either not define this sort of "
2482 "operation, or it has not yet been implemented.");
2483
2492 "You are trying to access the matrices that describe how "
2493 "to restrict a finite element function from the children "
2494 "of one cell to the finite element space defined on their "
2495 "parent (i.e., the 'restriction' or 'projection' matrices). "
2496 "However, the current finite element can either not define "
2497 "this sort of operation, or it has not yet been "
2498 "implemented.");
2499
2505 int,
2506 int,
2507 << "The interface matrix has a size of " << arg1 << 'x' << arg2
2508 << ", which is not reasonable for the current element "
2509 "in the present dimension.");
2515
2516protected:
2530 void
2532 const bool isotropic_restriction_only = false,
2533 const bool isotropic_prolongation_only = false);
2534
2547 std::vector<std::vector<FullMatrix<double>>> restriction;
2548
2561 std::vector<std::vector<FullMatrix<double>>> prolongation;
2562
2574
2585 std::vector<Point<dim>> unit_support_points;
2586
2592 std::vector<std::vector<Point<dim - 1>>> unit_face_support_points;
2593
2598 std::vector<Point<dim>> generalized_support_points;
2599
2604 std::vector<std::vector<Point<dim - 1>>> generalized_face_support_points;
2605
2622
2635
2639 std::vector<std::pair<unsigned int, unsigned int>> system_to_component_table;
2640
2650 std::vector<std::vector<std::pair<unsigned int, unsigned int>>>
2652
2669 std::vector<std::pair<std::pair<unsigned int, unsigned int>, unsigned int>>
2671
2675 std::vector<
2676 std::vector<std::pair<std::pair<unsigned int, unsigned int>, unsigned int>>>
2678
2684
2705 std::vector<std::pair<std::pair<unsigned int, unsigned int>, unsigned int>>
2707
2713 const std::vector<bool> restriction_is_additive_flags;
2714
2722 const std::vector<ComponentMask> nonzero_components;
2723
2731 const std::vector<unsigned int> n_nonzero_components_table;
2732
2739
2747
2762
2768 static std::vector<unsigned int>
2770 const std::vector<ComponentMask> &nonzero_components);
2771
2792 virtual UpdateFlags
2793 requires_update_flags(const UpdateFlags update_flags) const = 0;
2794
2872 virtual std::unique_ptr<InternalDataBase>
2873 get_data(const UpdateFlags update_flags,
2874 const Mapping<dim, spacedim> &mapping,
2875 const Quadrature<dim> &quadrature,
2876 ::internal::FEValuesImplementation::
2877 FiniteElementRelatedData<dim, spacedim> &output_data) const = 0;
2878
2921 virtual std::unique_ptr<InternalDataBase>
2922 get_face_data(const UpdateFlags update_flags,
2923 const Mapping<dim, spacedim> &mapping,
2924 const hp::QCollection<dim - 1> &quadrature,
2925 ::internal::FEValuesImplementation::
2926 FiniteElementRelatedData<dim, spacedim> &output_data) const;
2927
2931 virtual std::unique_ptr<InternalDataBase>
2933 const UpdateFlags update_flags,
2934 const Mapping<dim, spacedim> &mapping,
2935 const Quadrature<dim - 1> &quadrature,
2937 &output_data) const;
2938
2982 virtual std::unique_ptr<InternalDataBase>
2984 const UpdateFlags update_flags,
2985 const Mapping<dim, spacedim> &mapping,
2986 const Quadrature<dim - 1> &quadrature,
2988 spacedim>
2989 &output_data) const;
2990
3071 virtual void
3074 const CellSimilarity::Similarity cell_similarity,
3075 const Quadrature<dim> &quadrature,
3076 const Mapping<dim, spacedim> &mapping,
3077 const typename Mapping<dim, spacedim>::InternalDataBase &mapping_internal,
3079 &mapping_data,
3080 const InternalDataBase &fe_internal,
3082 spacedim>
3083 &output_data) const = 0;
3084
3127 virtual void
3130 const unsigned int face_no,
3131 const hp::QCollection<dim - 1> &quadrature,
3132 const Mapping<dim, spacedim> &mapping,
3133 const typename Mapping<dim, spacedim>::InternalDataBase &mapping_internal,
3135 &mapping_data,
3136 const InternalDataBase &fe_internal,
3138 spacedim>
3139 &output_data) const;
3140
3144 virtual void
3147 const unsigned int face_no,
3148 const Quadrature<dim - 1> &quadrature,
3149 const Mapping<dim, spacedim> &mapping,
3150 const typename Mapping<dim, spacedim>::InternalDataBase &mapping_internal,
3152 &mapping_data,
3153 const InternalDataBase &fe_internal,
3155 &output_data) const;
3156
3202 virtual void
3205 const unsigned int face_no,
3206 const unsigned int sub_no,
3207 const Quadrature<dim - 1> &quadrature,
3208 const Mapping<dim, spacedim> &mapping,
3209 const typename Mapping<dim, spacedim>::InternalDataBase &mapping_internal,
3211 &mapping_data,
3212 const InternalDataBase &fe_internal,
3214 spacedim>
3215 &output_data) const = 0;
3216
3217 friend class InternalDataBase;
3218 friend class FEValuesBase<dim, spacedim>;
3219 friend class FEValues<dim, spacedim>;
3220 friend class FEFaceValues<dim, spacedim>;
3221 friend class FESubfaceValues<dim, spacedim>;
3222 friend class NonMatching::FEImmersedSurfaceValues<dim>;
3223 friend class FESystem<dim, spacedim>;
3224
3225 // explicitly check for sensible template arguments, but not on windows
3226 // because MSVC creates bogus warnings during normal compilation
3227#ifndef DEAL_II_MSVC
3228 static_assert(dim <= spacedim,
3229 "The dimension <dim> of a FiniteElement must be less than or "
3230 "equal to the space dimension <spacedim> in which it lives.");
3231#endif
3232};
3233
3234
3235//----------------------------------------------------------------------//
3236#ifndef DOXYGEN
3237
3238template <int dim, int spacedim>
3239inline std::pair<unsigned int, unsigned int>
3241 const unsigned int index) const
3242{
3244 Assert(is_primitive(index),
3246 index)));
3247 return system_to_component_table[index];
3248}
3249
3250
3251
3252template <int dim, int spacedim>
3253inline unsigned int
3255{
3256 return base_to_block_indices.size();
3257}
3258
3259
3260
3261template <int dim, int spacedim>
3262inline unsigned int
3264 const unsigned int index) const
3265{
3266 return static_cast<unsigned int>(base_to_block_indices.block_size(index));
3267}
3268
3269
3270
3271template <int dim, int spacedim>
3272inline unsigned int
3274 const unsigned int component,
3275 const unsigned int index) const
3276{
3277 AssertIndexRange(component, this->n_components());
3278 const std::vector<std::pair<unsigned int, unsigned int>>::const_iterator it =
3279 std::find(system_to_component_table.begin(),
3281 std::pair<unsigned int, unsigned int>(component, index));
3282
3284 ExcMessage("You are asking for the number of the shape function "
3285 "within a system element that corresponds to vector "
3286 "component " +
3287 Utilities::int_to_string(component) +
3288 " and within this to "
3289 "index " +
3291 ". But no such "
3292 "shape function exists."));
3293 return std::distance(system_to_component_table.begin(), it);
3294}
3295
3296
3297
3298template <int dim, int spacedim>
3299inline std::pair<unsigned int, unsigned int>
3301 const unsigned int index,
3302 const unsigned int face_no) const
3303{
3305 index,
3306 face_system_to_component_table[this->n_unique_faces() == 1 ? 0 : face_no]
3307 .size());
3308
3309 // in debug mode, check whether the
3310 // function is primitive, since
3311 // otherwise the result may have no
3312 // meaning
3313 //
3314 // since the primitivity tables are
3315 // all geared towards cell dof
3316 // indices, rather than face dof
3317 // indices, we have to work a
3318 // little bit...
3319 //
3320 // in 1d, the face index is equal
3321 // to the cell index
3322 Assert(is_primitive(this->face_to_cell_index(index, face_no)),
3324 index)));
3325
3327 0 :
3328 face_no][index];
3329}
3330
3331
3332
3333template <int dim, int spacedim>
3334inline unsigned int
3336 const unsigned int index,
3337 const types::geometric_orientation combined_orientation) const
3338{
3339 Assert(combined_orientation == numbers::default_geometric_orientation ||
3340 combined_orientation == numbers::reverse_line_orientation,
3342
3343 AssertIndexRange(index, this->n_dofs_per_line());
3344 Assert(adjust_line_dof_index_for_line_orientation_table.size() ==
3345 this->n_dofs_per_line(),
3347 if (combined_orientation == numbers::default_geometric_orientation)
3348 return index;
3349 else
3351}
3352
3353
3354
3355template <int dim, int spacedim>
3356inline unsigned int
3358 const unsigned int index,
3359 const unsigned int face,
3360 const types::geometric_orientation combined_orientation) const
3361{
3362 // general template for 1d and 2d: not
3363 // implemented. in fact, the function
3364 // shouldn't even be called unless we are
3365 // in 3d, so throw an internal error
3366 Assert(dim == 3, ExcInternalError());
3367 if (dim < 3)
3368 return index;
3369
3370 // adjust dofs on 3d faces if the face is
3371 // flipped. note that we query a table that
3372 // derived elements need to have set up
3373 // front. the exception are discontinuous
3374 // elements for which there should be no
3375 // face dofs anyway (i.e. dofs_per_quad==0
3376 // in 3d), so we don't need the table, but
3377 // the function should also not have been
3378 // called
3379 AssertIndexRange(index, this->n_dofs_per_quad(face));
3380 const auto table_n = this->n_unique_2d_subobjects() == 1 ? 0 : face;
3381 Assert(
3383 (this->reference_cell().n_face_orientations(face)) *
3384 this->n_dofs_per_quad(face),
3387 index, combined_orientation);
3388}
3389
3390
3391
3392template <int dim, int spacedim>
3393inline std::pair<std::pair<unsigned int, unsigned int>, unsigned int>
3395 const unsigned int index) const
3396{
3399}
3400
3401
3402
3403template <int dim, int spacedim>
3404inline std::pair<std::pair<unsigned int, unsigned int>, unsigned int>
3406 const unsigned int index,
3407 const unsigned int face_no) const
3408{
3410 index,
3411 face_system_to_base_table[this->n_unique_faces() == 1 ? 0 : face_no]
3412 .size());
3413 return face_system_to_base_table[this->n_unique_faces() == 1 ? 0 : face_no]
3414 [index];
3415}
3416
3417
3418
3419template <int dim, int spacedim>
3422 const unsigned int index) const
3423{
3424 return base_to_block_indices.block_start(index);
3425}
3426
3427
3428
3429template <int dim, int spacedim>
3430inline std::pair<unsigned int, unsigned int>
3432 const unsigned int index) const
3433{
3435
3436 return component_to_base_table[index].first;
3437}
3438
3439
3440
3441template <int dim, int spacedim>
3442inline std::pair<unsigned int, unsigned int>
3444 const unsigned int index) const
3445{
3447}
3448
3449
3450
3451template <int dim, int spacedim>
3452inline std::pair<unsigned int, types::global_dof_index>
3454 const unsigned int index) const
3455{
3456 AssertIndexRange(index, this->n_dofs_per_cell());
3457 // The block is computed simply as
3458 // first block of this base plus
3459 // the index within the base blocks
3460 return std::pair<unsigned int, types::global_dof_index>(
3462 system_to_base_table[index].first.second,
3463 system_to_base_table[index].second);
3464}
3465
3466
3467
3468template <int dim, int spacedim>
3469inline bool
3471 const unsigned int shape_function,
3472 const FEValuesExtractors::Scalar &component) const
3473{
3474 AssertIndexRange(shape_function, this->n_dofs_per_cell());
3475 AssertIndexRange(component.component, this->n_components());
3476
3477 if (is_primitive(shape_function))
3478 return (system_to_component_table[shape_function].first ==
3480 else
3481 return nonzero_components[shape_function][component.component];
3482}
3483
3484
3485
3486template <int dim, int spacedim>
3487inline bool
3489 const unsigned int shape_function,
3491{
3492 AssertIndexRange(shape_function, this->n_dofs_per_cell());
3493 AssertIndexRange(components.first_vector_component, this->n_components());
3494 AssertIndexRange(components.first_vector_component + dim,
3495 this->n_components() + 1);
3496
3497 if (is_primitive(shape_function))
3498 return ((system_to_component_table[shape_function].first >=
3499 components.first_vector_component) &&
3500 (system_to_component_table[shape_function].first <
3501 components.first_vector_component + dim));
3502 else
3503 // Return whether there is overlap between the nonzero components
3504 // of the current shape function and the selected components of
3505 // the extractor:
3506 {
3507 for (unsigned int i = components.first_vector_component;
3508 i < components.first_vector_component + dim;
3509 ++i)
3510 if (nonzero_components[shape_function][i])
3511 return true;
3512 return false;
3513 }
3514}
3515
3516
3517
3518template <int dim, int spacedim>
3519inline bool
3521 const unsigned int shape_function,
3523{
3524 AssertIndexRange(shape_function, this->n_dofs_per_cell());
3525 AssertIndexRange(components.first_tensor_component, this->n_components());
3526 AssertIndexRange(components.first_tensor_component + dim,
3527 this->n_components() + 1);
3528
3529 if (is_primitive(shape_function))
3530 return ((system_to_component_table[shape_function].first >=
3531 components.first_tensor_component) &&
3532 (system_to_component_table[shape_function].first <
3533 components.first_tensor_component +
3535 else
3536 // Return whether there is overlap between the nonzero components
3537 // of the current shape function and the selected components of
3538 // the extractor:
3539 {
3540 for (unsigned int i = components.first_tensor_component;
3541 i < components.first_tensor_component +
3543 ++i)
3544 if (nonzero_components[shape_function][i])
3545 return true;
3546 return false;
3547 }
3548}
3549
3550
3551
3552template <int dim, int spacedim>
3553inline bool
3555 const unsigned int shape_function,
3557{
3558 AssertIndexRange(shape_function, this->n_dofs_per_cell());
3559 AssertIndexRange(components.first_tensor_component, this->n_components());
3560 AssertIndexRange(components.first_tensor_component + dim,
3561 this->n_components() + 1);
3562
3563 if (is_primitive(shape_function))
3564 return ((system_to_component_table[shape_function].first >=
3565 components.first_tensor_component) &&
3566 (system_to_component_table[shape_function].first <
3567 components.first_tensor_component +
3569 else
3570 // Return whether there is overlap between the nonzero components
3571 // of the current shape function and the selected components of
3572 // the extractor:
3573 {
3574 for (unsigned int i = components.first_tensor_component;
3575 i < components.first_tensor_component +
3577 ++i)
3578 if (nonzero_components[shape_function][i])
3579 return true;
3580 return false;
3581 }
3582}
3583
3584
3585
3586template <int dim, int spacedim>
3587inline bool
3589 const unsigned int index) const
3590{
3591 AssertIndexRange(index, this->n_dofs_per_cell());
3592 return restriction_is_additive_flags[index];
3593}
3594
3595
3596
3597template <int dim, int spacedim>
3598inline const ComponentMask &
3600{
3602 return nonzero_components[i];
3603}
3604
3605
3606
3607template <int dim, int spacedim>
3608inline unsigned int
3610{
3612 return n_nonzero_components_table[i];
3613}
3614
3615
3616
3617template <int dim, int spacedim>
3618inline bool
3620{
3621 return cached_primitivity;
3622}
3623
3624
3625
3626template <int dim, int spacedim>
3627inline bool
3628FiniteElement<dim, spacedim>::is_primitive(const unsigned int i) const
3629{
3631
3632 // return primitivity of a shape
3633 // function by checking whether it
3634 // has more than one non-zero
3635 // component or not. we could cache
3636 // this value in an array of bools,
3637 // but accessing a bit-vector (as
3638 // std::vector<bool> is) is
3639 // probably more expensive than
3640 // just comparing against 1
3641 //
3642 // for good measure, short circuit the test
3643 // if the entire FE is primitive
3644 return (is_primitive() || (n_nonzero_components_table[i] == 1));
3645}
3646
3647
3648
3649template <int dim, int spacedim>
3650inline const Table<2, bool> &
3652{
3654}
3655
3656
3657
3658template <int dim, int spacedim>
3659inline GeometryPrimitive
3661 const unsigned int cell_dof_index) const
3662{
3663 AssertIndexRange(cell_dof_index, this->n_dofs_per_cell());
3664
3665 // just go through the usual cases, taking into account how DoFs
3666 // are enumerated on the reference cell
3667 if (cell_dof_index < this->get_first_line_index())
3669 else if (cell_dof_index < this->get_first_quad_index(0))
3671 else if (cell_dof_index < this->get_first_hex_index())
3673 else
3675}
3676
3677#endif
3678
3680
3681#endif
size_type block_size(const unsigned int i) const
unsigned int size() const
size_type block_start(const unsigned int i) const
std::pair< unsigned int, size_type > global_to_local(const size_type i) const
virtual unsigned int face_to_cell_index(const unsigned int face_dof_index, const unsigned int face, const types::geometric_orientation combined_orientation=numbers::default_geometric_orientation) const override
unsigned int get_first_line_index() const
const unsigned int components
Definition fe_data.h:444
unsigned int n_dofs_per_cell() const
unsigned int n_dofs_per_line() const
unsigned int get_first_quad_index(const unsigned int quad_no=0) const
unsigned int n_components() const
unsigned int n_unique_2d_subobjects() const
unsigned int n_unique_faces() const
unsigned int n_dofs_per_quad(unsigned int face_no=0) const
ReferenceCell< dim > reference_cell() const
unsigned int get_first_hex_index() const
virtual ~InternalDataBase()=default
InternalDataBase(const InternalDataBase &)=delete
virtual std::size_t memory_consumption() const
bool constraints_are_implemented(const ::internal::SubfaceCase< dim > &subface_case=::internal::SubfaceCase< dim >::case_isotropic) const
bool shape_function_belongs_to(const unsigned int shape_function, const FEValuesExtractors::Vector &components) const
std::pair< unsigned int, types::global_dof_index > system_to_block_index(const unsigned int component) const
bool isotropic_prolongation_is_implemented() const
virtual std::string get_name() const =0
virtual Point< dim > unit_support_point(const unsigned int index) const
virtual FiniteElementDomination::Domination compare_for_domination(const FiniteElement< dim, spacedim > &fe_other, const unsigned int codim=0) const
const std::vector< unsigned int > n_nonzero_components_table
Definition fe.h:2731
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
virtual const FullMatrix< double > & get_restriction_matrix(const unsigned int child, const RefinementCase< dim > &refinement_case=RefinementCase< dim >::isotropic_refinement) const
const ComponentMask & get_nonzero_components(const unsigned int i) const
virtual void fill_fe_values(const typename Triangulation< dim, spacedim >::cell_iterator &cell, const CellSimilarity::Similarity cell_similarity, const Quadrature< dim > &quadrature, const Mapping< dim, spacedim > &mapping, const typename Mapping< dim, spacedim >::InternalDataBase &mapping_internal, const internal::FEValuesImplementation::MappingRelatedData< dim, spacedim > &mapping_data, const InternalDataBase &fe_internal, ::internal::FEValuesImplementation::FiniteElementRelatedData< dim, spacedim > &output_data) const =0
std::vector< std::vector< Point< dim - 1 > > > unit_face_support_points
Definition fe.h:2592
bool prolongation_is_implemented() const
virtual std::pair< Table< 2, bool >, std::vector< unsigned int > > get_constant_modes() const
virtual const FiniteElement< dim, spacedim > & base_element(const unsigned int index) const
ComponentMask component_mask(const BlockMask &block_mask) const
virtual Tensor< 1, dim > shape_grad(const unsigned int i, const Point< dim > &p) const
ComponentMask component_mask(const FEValuesExtractors::SymmetricTensor< 2 > &sym_tensor) const
virtual std::unique_ptr< InternalDataBase > get_face_data(const UpdateFlags update_flags, const Mapping< dim, spacedim > &mapping, const hp::QCollection< dim - 1 > &quadrature, ::internal::FEValuesImplementation::FiniteElementRelatedData< dim, spacedim > &output_data) const
std::pair< unsigned int, unsigned int > component_to_base_index(const unsigned int component) const
virtual Point< dim - 1 > unit_face_support_point(const unsigned int index, const unsigned int face_no=0) const
bool is_primitive(const unsigned int i) const
static std::vector< unsigned int > compute_n_nonzero_components(const std::vector< ComponentMask > &nonzero_components)
virtual std::unique_ptr< InternalDataBase > get_subface_data(const UpdateFlags update_flags, const Mapping< dim, spacedim > &mapping, const Quadrature< dim - 1 > &quadrature, ::internal::FEValuesImplementation::FiniteElementRelatedData< dim, spacedim > &output_data) const
bool shape_function_belongs_to(const unsigned int shape_function, const FEValuesExtractors::Scalar &component) const
bool has_face_support_points(const unsigned int face_no=0) const
const bool cached_primitivity
Definition fe.h:2738
virtual const FiniteElement< dim, spacedim > & get_sub_fe(const unsigned int first_component, const unsigned int n_selected_components) const
virtual std::vector< std::pair< unsigned int, unsigned int > > hp_quad_dof_identities(const FiniteElement< dim, spacedim > &fe_other, const unsigned int face_no=0) const
ComponentMask component_mask(const FEValuesExtractors::Scalar &scalar) const
bool operator!=(const FiniteElement< dim, spacedim > &) const
ComponentMask component_mask(const FEValuesExtractors::Vector &vector) const
bool has_support_points() const
std::vector< std::vector< FullMatrix< double > > > restriction
Definition fe.h:2547
bool has_generalized_support_points() const
virtual std::unique_ptr< FiniteElement< dim, spacedim > > clone() const =0
virtual Tensor< 2, dim > shape_grad_grad(const unsigned int i, const Point< dim > &p) const
std::vector< Table< 2, int > > adjust_quad_dof_index_for_face_orientation_table
Definition fe.h:2621
virtual bool operator==(const FiniteElement< dim, spacedim > &fe) const
bool shape_function_belongs_to(const unsigned int shape_function, const FEValuesExtractors::SymmetricTensor< 2 > &components) const
const std::vector< Point< dim > > & get_unit_support_points() const
virtual void fill_fe_face_values(const typename Triangulation< dim, spacedim >::cell_iterator &cell, const unsigned int face_no, const hp::QCollection< dim - 1 > &quadrature, const Mapping< dim, spacedim > &mapping, const typename Mapping< dim, spacedim >::InternalDataBase &mapping_internal, const internal::FEValuesImplementation::MappingRelatedData< dim, spacedim > &mapping_data, const InternalDataBase &fe_internal, ::internal::FEValuesImplementation::FiniteElementRelatedData< dim, spacedim > &output_data) const
static constexpr unsigned int space_dimension
Definition fe.h:659
BlockIndices base_to_block_indices
Definition fe.h:2683
bool is_primitive() const
void reinit_restriction_and_prolongation_matrices(const bool isotropic_restriction_only=false, const bool isotropic_prolongation_only=false)
const std::vector< Point< dim - 1 > > & get_unit_face_support_points(const unsigned int face_no=0) const
bool isotropic_restriction_is_implemented() const
std::vector< std::vector< Point< dim - 1 > > > generalized_face_support_points
Definition fe.h:2604
std::pair< unsigned int, unsigned int > block_to_base_index(const unsigned int block) const
std::vector< int > adjust_line_dof_index_for_line_orientation_table
Definition fe.h:2634
virtual bool has_support_on_face(const unsigned int shape_index, const unsigned int face_index) const
bool restriction_is_additive(const unsigned int index) const
virtual void fill_fe_subface_values(const typename Triangulation< dim, spacedim >::cell_iterator &cell, const unsigned int face_no, const unsigned int sub_no, const Quadrature< dim - 1 > &quadrature, const Mapping< dim, spacedim > &mapping, const typename Mapping< dim, spacedim >::InternalDataBase &mapping_internal, const internal::FEValuesImplementation::MappingRelatedData< dim, spacedim > &mapping_data, const InternalDataBase &fe_internal, ::internal::FEValuesImplementation::FiniteElementRelatedData< dim, spacedim > &output_data) const =0
const FiniteElement< dim, spacedim > & get_sub_fe(const ComponentMask &mask) const
virtual Tensor< 4, dim > shape_4th_derivative_component(const unsigned int i, const Point< dim > &p, const unsigned int component) const
virtual double shape_value_component(const unsigned int i, const Point< dim > &p, const unsigned int component) const
unsigned int adjust_quad_dof_index_for_face_orientation(const unsigned int index, const unsigned int face_no, const types::geometric_orientation combined_orientation) const
FiniteElement(const FiniteElement< dim, spacedim > &)=default
virtual void get_subface_interpolation_matrix(const FiniteElement< dim, spacedim > &source, const unsigned int subface, FullMatrix< double > &matrix, const unsigned int face_no=0) const
unsigned int component_to_block_index(const unsigned int component) const
BlockMask block_mask(const FEValuesExtractors::Scalar &scalar) const
virtual UpdateFlags requires_update_flags(const UpdateFlags update_flags) const =0
virtual void get_interpolation_matrix(const FiniteElement< dim, spacedim > &source, FullMatrix< double > &matrix) const
virtual Tensor< 3, dim > shape_3rd_derivative(const unsigned int i, const Point< dim > &p) const
std::pair< unsigned int, unsigned int > system_to_component_index(const unsigned int index) const
std::vector< std::pair< std::pair< unsigned int, unsigned int >, unsigned int > > system_to_base_table
Definition fe.h:2670
virtual std::vector< std::pair< unsigned int, unsigned int > > hp_line_dof_identities(const FiniteElement< dim, spacedim > &fe_other) const
virtual void convert_generalized_support_point_values_to_dof_values(const std::vector< Vector< double > > &support_point_values, std::vector< double > &nodal_values) const
FiniteElement(const FiniteElementData< dim > &fe_data, const std::vector< bool > &restriction_is_additive_flags, const std::vector< ComponentMask > &nonzero_components)
BlockMask block_mask(const FEValuesExtractors::Vector &vector) const
BlockMask block_mask(const ComponentMask &component_mask) const
bool shape_function_belongs_to(const unsigned int shape_function, const FEValuesExtractors::Tensor< 2 > &components) const
std::pair< std::pair< unsigned int, unsigned int >, unsigned int > system_to_base_index(const unsigned int index) const
std::vector< std::pair< unsigned int, unsigned int > > system_to_component_table
Definition fe.h:2639
std::pair< std::pair< unsigned int, unsigned int >, unsigned int > face_system_to_base_index(const unsigned int index, const unsigned int face_no=0) const
virtual Tensor< 3, dim > shape_3rd_derivative_component(const unsigned int i, const Point< dim > &p, const unsigned int component) const
const FullMatrix< double > & constraints(const ::internal::SubfaceCase< dim > &subface_case=::internal::SubfaceCase< dim >::case_isotropic) const
unsigned int element_multiplicity(const unsigned int index) const
std::pair< std::unique_ptr< FiniteElement< dim, spacedim > >, unsigned int > operator^(const unsigned int multiplicity) const
unsigned int adjust_line_dof_index_for_line_orientation(const unsigned int index, const types::geometric_orientation combined_orientation) const
const std::vector< bool > restriction_is_additive_flags
Definition fe.h:2713
virtual ~FiniteElement() override=default
virtual unsigned int face_to_cell_index(const unsigned int face_dof_index, const unsigned int face, const types::geometric_orientation combined_orientation=numbers::default_geometric_orientation) const
std::vector< std::pair< std::pair< unsigned int, unsigned int >, unsigned int > > component_to_base_table
Definition fe.h:2706
TableIndices< 2 > interface_constraints_size() const
std::vector< std::vector< std::pair< std::pair< unsigned int, unsigned int >, unsigned int > > > face_system_to_base_table
Definition fe.h:2677
std::vector< Point< dim > > unit_support_points
Definition fe.h:2585
virtual Tensor< 1, dim > shape_grad_component(const unsigned int i, const Point< dim > &p, const unsigned int component) const
bool restriction_is_implemented() const
virtual std::unique_ptr< InternalDataBase > get_face_data(const UpdateFlags update_flags, const Mapping< dim, spacedim > &mapping, const Quadrature< dim - 1 > &quadrature, internal::FEValuesImplementation::FiniteElementRelatedData< dim, spacedim > &output_data) const
std::vector< std::vector< std::pair< unsigned int, unsigned int > > > face_system_to_component_table
Definition fe.h:2651
virtual void fill_fe_face_values(const typename Triangulation< dim, spacedim >::cell_iterator &cell, const unsigned int face_no, const Quadrature< dim - 1 > &quadrature, const Mapping< dim, spacedim > &mapping, const typename Mapping< dim, spacedim >::InternalDataBase &mapping_internal, const internal::FEValuesImplementation::MappingRelatedData< dim, spacedim > &mapping_data, const InternalDataBase &fe_internal, internal::FEValuesImplementation::FiniteElementRelatedData< dim, spacedim > &output_data) const
FiniteElement(FiniteElement< dim, spacedim > &&)=default
unsigned int n_nonzero_components(const unsigned int i) const
FullMatrix< double > interface_constraints
Definition fe.h:2573
const std::vector< Point< dim > > & get_generalized_support_points() const
BlockMask block_mask(const FEValuesExtractors::SymmetricTensor< 2 > &sym_tensor) const
unsigned int n_base_elements() const
virtual Tensor< 2, dim > shape_grad_grad_component(const unsigned int i, const Point< dim > &p, const unsigned int component) const
virtual const FullMatrix< double > & get_prolongation_matrix(const unsigned int child, const RefinementCase< dim > &refinement_case=RefinementCase< dim >::isotropic_refinement) const
Table< 2, bool > local_dof_sparsity_pattern
Definition fe.h:2746
virtual double shape_value(const unsigned int i, const Point< dim > &p) const
virtual void get_face_interpolation_matrix(const FiniteElement< dim, spacedim > &source, FullMatrix< double > &matrix, const unsigned int face_no=0) const
virtual const Table< 2, bool > & get_local_dof_sparsity_pattern() const
virtual std::size_t memory_consumption() const
virtual Tensor< 4, dim > shape_4th_derivative(const unsigned int i, const Point< dim > &p) const
GeometryPrimitive get_associated_geometry_primitive(const unsigned int cell_dof_index) const
std::vector< Point< dim > > generalized_support_points
Definition fe.h:2598
unsigned int component_to_system_index(const unsigned int component, const unsigned int index) const
const std::vector< ComponentMask > nonzero_components
Definition fe.h:2722
virtual std::vector< std::pair< unsigned int, unsigned int > > hp_vertex_dof_identities(const FiniteElement< dim, spacedim > &fe_other) const
std::pair< unsigned int, unsigned int > face_system_to_component_index(const unsigned int index, const unsigned int face_no=0) const
virtual bool hp_constraints_are_implemented() const
std::vector< std::vector< FullMatrix< double > > > prolongation
Definition fe.h:2561
types::global_dof_index first_block_of_base(const unsigned int b) const
Abstract base class for mapping classes.
Definition mapping.h:318
Definition point.h:111
#define DEAL_II_NAMESPACE_OPEN
Definition config.h:38
#define DEAL_II_NAMESPACE_CLOSE
Definition config.h:39
Point< 2 > first
Definition grid_out.cc:4639
#define DeclException0(Exception0)
static ::ExceptionBase & ExcShapeFunctionNotPrimitive(int arg1)
#define Assert(cond, exc)
static ::ExceptionBase & ExcWrongInterfaceMatrixSize(int arg1, int arg2)
#define DeclException2(Exception2, type1, type2, outsequence)
static ::ExceptionBase & ExcUnitShapeValuesDoNotExist()
static ::ExceptionBase & ExcProjectionVoid()
#define AssertIndexRange(index, range)
#define DeclExceptionMsg(Exception, defaulttext)
static ::ExceptionBase & ExcFENotPrimitive()
static ::ExceptionBase & ExcInternalError()
static ::ExceptionBase & ExcEmbeddingVoid()
#define DeclException1(Exception1, type1, outsequence)
static ::ExceptionBase & ExcInterpolationNotImplemented()
static ::ExceptionBase & ExcMessage(std::string arg1)
static ::ExceptionBase & ExcFEHasNoSupportPoints()
UpdateFlags
std::size_t size
Definition mpi.cc:733
*  *  *  ScaleZFunction< dim, Number, components >::ScaleZFunction *  component(component)
std::string int_to_string(const unsigned int value, const unsigned int digits=numbers::invalid_unsigned_int)
Definition utilities.cc:464
constexpr types::geometric_orientation reverse_line_orientation
Definition types.h:355
constexpr types::geometric_orientation default_geometric_orientation
Definition types.h:342
std::uint8_t geometric_orientation
Definition types.h:38