Reference documentation for deal.II version 9.6.0
\(\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
scratch_data.h
Go to the documentation of this file.
1// ------------------------------------------------------------------------
2//
3// SPDX-License-Identifier: LGPL-2.1-or-later
4// Copyright (C) 2019 - 2024 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_meshworker_scratch_data_h
16#define dealii_meshworker_scratch_data_h
17
18#include <deal.II/base/config.h>
19
21
23
26
30
31#include <boost/any.hpp>
32
33#include <algorithm>
34#include <vector>
35
37
38namespace MeshWorker
39{
208 template <int dim, int spacedim = dim>
210 {
211 public:
234 const Quadrature<dim> &quadrature,
235 const UpdateFlags &update_flags,
238
258 const Quadrature<dim> &quadrature,
259 const UpdateFlags &update_flags,
260 const UpdateFlags &neighbor_update_flags,
264
279 const Quadrature<dim> &quadrature,
280 const UpdateFlags &update_flags,
283
300 const Quadrature<dim> &quadrature,
301 const UpdateFlags &update_flags,
302 const UpdateFlags &neighbor_update_flags,
306
333
359
378
401
406
420 reinit(
422
432 const unsigned int face_no);
433
446 const unsigned int face_no,
447 const unsigned int subface_no);
448
465 const unsigned int face_no,
467 &cell_neighbor,
468 const unsigned int face_no_neighbor);
469
486 const unsigned int face_no,
487 const unsigned int sub_face_no,
489 &cell_neighbor,
490 const unsigned int face_no_neighbor,
491 const unsigned int sub_face_no_neighbor);
492
504 get_current_fe_values() const;
505
511
515 const std::vector<Point<spacedim>> &
516 get_quadrature_points() const;
517
521 const std::vector<double> &
522 get_JxW_values() const;
523
527 const std::vector<Tensor<1, spacedim>> &
528 get_normal_vectors() const;
529
534 const std::vector<types::global_dof_index> &
535 get_local_dof_indices() const;
536
541 unsigned int
542 n_dofs_per_cell() const;
543
544 // CurrentCellMethods
545
561
572 const unsigned int face_no);
573
587 const unsigned int face_no,
588 const unsigned int subface_no);
589
603
607 const std::vector<double> &
609
613 const std::vector<Tensor<1, spacedim>> &
615
620 const std::vector<types::global_dof_index> &
622
627 unsigned int
629
630 // NeighborCellMethods
631
635 // hpCellMethods
636
655 &neighbor_cell,
656 const unsigned int face_no);
657
679 &neighbor_cell,
680 const unsigned int face_no,
681 const unsigned int subface_no);
682
702 &neighbor_cell,
703 const unsigned int face_no);
704
727 &neighbor_cell,
728 const unsigned int face_no,
729 const unsigned int subface_no);
730
731 // hpCellMethods
732
740
746 const GeneralDataStorage &
748
753 get_mapping() const;
754
759 get_fe() const;
760
764 const Quadrature<dim> &
765 get_cell_quadrature() const;
766
770 const Quadrature<dim - 1> &
771 get_face_quadrature() const;
772
778
783 get_fe_collection() const;
784
790
794 const hp::QCollection<dim - 1> &
796
801 bool
802 has_hp_capabilities() const;
803
808 get_cell_update_flags() const;
809
815
820 get_face_update_flags() const;
821
827
831 // CurrentCellEvaluation
832
862 template <typename VectorType, typename Number = double>
863 void
864 extract_local_dof_values(const std::string &global_vector_name,
865 const VectorType &input_vector,
866 const Number dummy = Number(0));
867
876 template <typename Number = double>
877 const std::vector<Number> &
878 get_local_dof_values(const std::string &global_vector_name,
879 Number dummy = Number(0)) const;
880
902 template <typename Extractor, typename Number = double>
903 const std::vector<typename FEValuesViews::View<dim, spacedim, Extractor>::
904 template solution_value_type<Number>> &
905 get_values(const std::string &global_vector_name,
906 const Extractor &variable,
907 const Number dummy = Number(0));
908
930 template <typename Extractor, typename Number = double>
931 const std::vector<typename FEValuesViews::View<dim, spacedim, Extractor>::
932 template solution_gradient_type<Number>> &
933 get_gradients(const std::string &global_vector_name,
934 const Extractor &variable,
935 const Number dummy = Number(0));
936
959 template <typename Extractor, typename Number = double>
960 const std::vector<typename FEValuesViews::View<dim, spacedim, Extractor>::
961 template solution_symmetric_gradient_type<Number>> &
962 get_symmetric_gradients(const std::string &global_vector_name,
963 const Extractor &variable,
964 const Number dummy = Number(0));
965
987 template <typename Extractor, typename Number = double>
988 const std::vector<typename FEValuesViews::View<dim, spacedim, Extractor>::
989 template solution_divergence_type<Number>> &
990 get_divergences(const std::string &global_vector_name,
991 const Extractor &variable,
992 const Number dummy = Number(0));
993
1015 template <typename Extractor, typename Number = double>
1016 const std::vector<typename FEValuesViews::View<dim, spacedim, Extractor>::
1017 template solution_curl_type<Number>> &
1018 get_curls(const std::string &global_vector_name,
1019 const Extractor &variable,
1020 const Number dummy = Number(0));
1021
1043 template <typename Extractor, typename Number = double>
1044 const std::vector<typename FEValuesViews::View<dim, spacedim, Extractor>::
1045 template solution_hessian_type<Number>> &
1046 get_hessians(const std::string &global_vector_name,
1047 const Extractor &variable,
1048 const Number dummy = Number(0));
1049
1071 template <typename Extractor, typename Number = double>
1072 const std::vector<typename FEValuesViews::View<dim, spacedim, Extractor>::
1073 template solution_laplacian_type<Number>> &
1074 get_laplacians(const std::string &global_vector_name,
1075 const Extractor &variable,
1076 const Number dummy = Number(0));
1077
1099 template <typename Extractor, typename Number = double>
1100 const std::vector<typename FEValuesViews::View<dim, spacedim, Extractor>::
1101 template solution_third_derivative_type<Number>> &
1102 get_third_derivatives(const std::string &global_vector_name,
1103 const Extractor &variable,
1104 const Number dummy = Number(0));
1105
1106 // CurrentCellEvaluation
1107
1111 // CurrentInterfaceJumpEvaluation
1112
1135 template <typename Extractor, typename Number = double>
1136 const std::vector<
1138 template solution_value_type<Number>> &
1139 get_jumps_in_values(const std::string &global_vector_name,
1140 const Extractor &variable,
1141 const Number dummy = Number(0));
1142
1165 template <typename Extractor, typename Number = double>
1166 const std::vector<
1168 template solution_gradient_type<Number>> &
1169 get_jumps_in_gradients(const std::string &global_vector_name,
1170 const Extractor &variable,
1171 const Number dummy = Number(0));
1172
1195 template <typename Extractor, typename Number = double>
1196 const std::vector<
1198 template solution_hessian_type<Number>> &
1199 get_jumps_in_hessians(const std::string &global_vector_name,
1200 const Extractor &variable,
1201 const Number dummy = Number(0));
1202
1225 template <typename Extractor, typename Number = double>
1226 const std::vector<
1228 template solution_third_derivative_type<Number>> &
1229 get_jumps_in_third_derivatives(const std::string &global_vector_name,
1230 const Extractor &variable,
1231 const Number dummy = Number(0));
1232
1233 // CurrentInterfaceJumpEvaluation
1234
1238 // CurrentInterfaceAverageEvaluation
1239
1262 template <typename Extractor, typename Number = double>
1263 const std::vector<
1265 template solution_value_type<Number>> &
1266 get_averages_of_values(const std::string &global_vector_name,
1267 const Extractor &variable,
1268 const Number dummy = Number(0));
1269
1292 template <typename Extractor, typename Number = double>
1293 const std::vector<
1295 template solution_gradient_type<Number>> &
1296 get_averages_of_gradients(const std::string &global_vector_name,
1297 const Extractor &variable,
1298 const Number dummy = Number(0));
1299
1322 template <typename Extractor, typename Number = double>
1323 const std::vector<
1325 template solution_hessian_type<Number>> &
1326 get_averages_of_hessians(const std::string &global_vector_name,
1327 const Extractor &variable,
1328 const Number dummy = Number(0));
1329
1330 // CurrentInterfaceAverageEvaluation
1331
1332 private:
1337 template <typename Extractor, typename Number = double>
1338 std::string
1339 get_unique_name(const std::string &global_vector_name,
1340 const Extractor &variable,
1341 const std::string &object_type,
1342 const unsigned int size,
1343 const Number &exemplar_number) const;
1344
1348 template <typename Number = double>
1349 std::string
1350 get_unique_dofs_name(const std::string &global_vector_name,
1351 const unsigned int size,
1352 const Number &exemplar_number) const;
1353
1357 // non-hp data
1358
1364
1370
1376
1382
1386 std::unique_ptr<FEValues<dim, spacedim>> fe_values;
1387
1391 std::unique_ptr<FEFaceValues<dim, spacedim>> fe_face_values;
1392
1396 std::unique_ptr<FESubfaceValues<dim, spacedim>> fe_subface_values;
1397
1401 std::unique_ptr<FEValues<dim, spacedim>> neighbor_fe_values;
1402
1406 std::unique_ptr<FEFaceValues<dim, spacedim>> neighbor_fe_face_values;
1407
1411 std::unique_ptr<FESubfaceValues<dim, spacedim>> neighbor_fe_subface_values;
1412
1416 // The FEInterfaceValues class supports initialization with hp objects
1417 // as well.
1418 std::unique_ptr<FEInterfaceValues<dim, spacedim>> interface_fe_values;
1419
1420 // non-hp data
1421
1425 // hp data
1426
1432
1438
1444
1450
1456
1460 std::unique_ptr<hp::FEValues<dim, spacedim>> hp_fe_values;
1461
1465 std::unique_ptr<hp::FEFaceValues<dim, spacedim>> hp_fe_face_values;
1466
1470 std::unique_ptr<hp::FESubfaceValues<dim, spacedim>> hp_fe_subface_values;
1471
1475 std::unique_ptr<hp::FEValues<dim, spacedim>> neighbor_hp_fe_values;
1476
1480 std::unique_ptr<hp::FEFaceValues<dim, spacedim>> neighbor_hp_fe_face_values;
1481
1485 std::unique_ptr<hp::FESubfaceValues<dim, spacedim>>
1487
1495 "The current function doesn't make sense when used with a "
1496 "ScratchData object with hp-capabilities.");
1497
1505 "The current function doesn't make sense when used with a "
1506 "ScratchData object without hp-capabilities.");
1507
1508 // hp data
1509
1514
1519
1525
1531
1535 std::vector<types::global_dof_index> local_dof_indices;
1536
1540 std::vector<types::global_dof_index> neighbor_dof_indices;
1541
1546
1551
1557
1563 };
1564
1565#ifndef DOXYGEN
1566 template <int dim, int spacedim>
1567 template <typename Extractor, typename Number>
1568 std::string
1570 const std::string &global_vector_name,
1571 const Extractor &variable,
1572 const std::string &object_type,
1573 const unsigned int size,
1574 const Number &exemplar_number) const
1575 {
1576 return global_vector_name + "_" + variable.get_name() + "_" + object_type +
1577 "_" + Utilities::int_to_string(size) + "_" +
1578 Utilities::type_to_string(exemplar_number);
1579 }
1580
1581
1582
1583 template <int dim, int spacedim>
1584 template <typename Number>
1585 std::string
1587 const std::string &global_vector_name,
1588 const unsigned int size,
1589 const Number &exemplar_number) const
1590 {
1591 return global_vector_name + "_independent_local_dofs_" +
1592 Utilities::int_to_string(size) + "_" +
1593 Utilities::type_to_string(exemplar_number);
1594 }
1595
1596
1597
1598 template <int dim, int spacedim>
1599 template <typename VectorType, typename Number>
1600 void
1602 const std::string &global_vector_name,
1603 const VectorType &input_vector,
1604 const Number dummy)
1605 {
1606 const unsigned int n_dofs = local_dof_indices.size();
1607
1608 const std::string name =
1609 get_unique_dofs_name(global_vector_name, n_dofs, dummy);
1610
1611 auto &independent_local_dofs =
1612 internal_data_storage
1613 .template get_or_add_object_with_name<std::vector<Number>>(name,
1614 n_dofs);
1615
1616 AssertDimension(independent_local_dofs.size(), n_dofs);
1617
1619 for (unsigned int i = 0; i < n_dofs; ++i)
1621 input_vector(local_dof_indices[i]),
1622 i,
1623 n_dofs,
1624 independent_local_dofs[i]);
1625 else
1626 for (unsigned int i = 0; i < n_dofs; ++i)
1627 independent_local_dofs[i] = input_vector(local_dof_indices[i]);
1628 }
1629
1630
1631
1632 template <int dim, int spacedim>
1633 template <typename Number>
1634 const std::vector<Number> &
1636 const std::string &global_vector_name,
1637 Number dummy) const
1638 {
1639 const unsigned int n_dofs = local_dof_indices.size();
1640
1641 const std::string dofs_name =
1642 get_unique_dofs_name(global_vector_name, n_dofs, dummy);
1643
1644 Assert(
1645 internal_data_storage.stores_object_with_name(dofs_name),
1646 ExcMessage(
1647 "You did not call yet extract_local_dof_values with the right types!"));
1648
1649 return internal_data_storage
1650 .template get_object_with_name<std::vector<Number>>(dofs_name);
1651 }
1652
1653
1654
1655 template <int dim, int spacedim>
1656 template <typename Extractor, typename Number>
1657 const std::vector<typename FEValuesViews::View<dim, spacedim, Extractor>::
1658 template solution_value_type<Number>> &
1659 ScratchData<dim, spacedim>::get_values(const std::string &global_vector_name,
1660 const Extractor &variable,
1661 const Number dummy)
1662 {
1663 const std::vector<Number> &independent_local_dofs =
1664 get_local_dof_values(global_vector_name, dummy);
1665
1666 const FEValuesBase<dim, spacedim> &fev = get_current_fe_values();
1667
1668 const unsigned int n_q_points = fev.n_quadrature_points;
1669
1670 const std::string name = get_unique_name(
1671 global_vector_name, variable, "_values_q", n_q_points, dummy);
1672
1673 // Now build the return type
1674 using RetType =
1675 std::vector<typename FEValuesViews::View<dim, spacedim, Extractor>::
1676 template solution_value_type<Number>>;
1677
1678 RetType &ret =
1679 internal_data_storage.template get_or_add_object_with_name<RetType>(
1680 name, n_q_points);
1681
1682 AssertDimension(ret.size(), n_q_points);
1683
1684 fev[variable].get_function_values_from_local_dof_values(
1685 independent_local_dofs, ret);
1686 return ret;
1687 }
1688
1689
1690
1691 template <int dim, int spacedim>
1692 template <typename Extractor, typename Number>
1693 const std::vector<typename FEValuesViews::View<dim, spacedim, Extractor>::
1694 template solution_gradient_type<Number>> &
1696 const std::string &global_vector_name,
1697 const Extractor &variable,
1698 const Number dummy)
1699 {
1700 const std::vector<Number> &independent_local_dofs =
1701 get_local_dof_values(global_vector_name, dummy);
1702
1703 const FEValuesBase<dim, spacedim> &fev = get_current_fe_values();
1704
1705 const unsigned int n_q_points = fev.n_quadrature_points;
1706
1707 const std::string name = get_unique_name(
1708 global_vector_name, variable, "_gradients_q", n_q_points, dummy);
1709
1710 // Now build the return type
1711 using RetType =
1712 std::vector<typename FEValuesViews::View<dim, spacedim, Extractor>::
1713 template solution_gradient_type<Number>>;
1714
1715 RetType &ret =
1716 internal_data_storage.template get_or_add_object_with_name<RetType>(
1717 name, n_q_points);
1718
1719 AssertDimension(ret.size(), n_q_points);
1720
1721 fev[variable].get_function_gradients_from_local_dof_values(
1722 independent_local_dofs, ret);
1723 return ret;
1724 }
1725
1726
1727
1728 template <int dim, int spacedim>
1729 template <typename Extractor, typename Number>
1730 const std::vector<typename FEValuesViews::View<dim, spacedim, Extractor>::
1731 template solution_hessian_type<Number>> &
1733 const std::string &global_vector_name,
1734 const Extractor &variable,
1735 const Number dummy)
1736 {
1737 const std::vector<Number> &independent_local_dofs =
1738 get_local_dof_values(global_vector_name, dummy);
1739
1740 const FEValuesBase<dim, spacedim> &fev = get_current_fe_values();
1741
1742 const unsigned int n_q_points = fev.n_quadrature_points;
1743
1744 const std::string name = get_unique_name(
1745 global_vector_name, variable, "_hessians_q", n_q_points, dummy);
1746
1747 // Now build the return type
1748 using RetType =
1749 std::vector<typename FEValuesViews::View<dim, spacedim, Extractor>::
1750 template solution_hessian_type<Number>>;
1751
1752 RetType &ret =
1753 internal_data_storage.template get_or_add_object_with_name<RetType>(
1754 name, n_q_points);
1755
1756
1757 AssertDimension(ret.size(), n_q_points);
1758
1759 fev[variable].get_function_hessians_from_local_dof_values(
1760 independent_local_dofs, ret);
1761 return ret;
1762 }
1763
1764
1765
1766 template <int dim, int spacedim>
1767 template <typename Extractor, typename Number>
1768 const std::vector<typename FEValuesViews::View<dim, spacedim, Extractor>::
1769 template solution_laplacian_type<Number>> &
1771 const std::string &global_vector_name,
1772 const Extractor &variable,
1773 const Number dummy)
1774 {
1775 const std::vector<Number> &independent_local_dofs =
1776 get_local_dof_values(global_vector_name, dummy);
1777
1778 const FEValuesBase<dim, spacedim> &fev = get_current_fe_values();
1779
1780 const unsigned int n_q_points = fev.n_quadrature_points;
1781
1782 const std::string name = get_unique_name(
1783 global_vector_name, variable, "_laplacians_q", n_q_points, dummy);
1784
1785 // Now build the return type
1786 using RetType =
1787 std::vector<typename FEValuesViews::View<dim, spacedim, Extractor>::
1788 template solution_laplacian_type<Number>>;
1789
1790 RetType &ret =
1791 internal_data_storage.template get_or_add_object_with_name<RetType>(
1792 name, n_q_points);
1793
1794
1795 AssertDimension(ret.size(), n_q_points);
1796
1797 fev[variable].get_function_laplacians_from_local_dof_values(
1798 independent_local_dofs, ret);
1799 return ret;
1800 }
1801
1802
1803
1804 template <int dim, int spacedim>
1805 template <typename Extractor, typename Number>
1806 const std::vector<typename FEValuesViews::View<dim, spacedim, Extractor>::
1807 template solution_third_derivative_type<Number>> &
1809 const std::string &global_vector_name,
1810 const Extractor &variable,
1811 const Number dummy)
1812 {
1813 const std::vector<Number> &independent_local_dofs =
1814 get_local_dof_values(global_vector_name, dummy);
1815
1816 const FEValuesBase<dim, spacedim> &fev = get_current_fe_values();
1817
1818 const unsigned int n_q_points = fev.n_quadrature_points;
1819
1820 const std::string name = get_unique_name(
1821 global_vector_name, variable, "_third_derivatives_q", n_q_points, dummy);
1822
1823 // Now build the return type
1824 using RetType =
1825 std::vector<typename FEValuesViews::View<dim, spacedim, Extractor>::
1826 template solution_third_derivative_type<Number>>;
1827
1828 RetType &ret =
1829 internal_data_storage.template get_or_add_object_with_name<RetType>(
1830 name, n_q_points);
1831
1832
1833 AssertDimension(ret.size(), n_q_points);
1834
1835 fev[variable].get_function_third_derivatives_from_local_dof_values(
1836 independent_local_dofs, ret);
1837 return ret;
1838 }
1839
1840
1841
1842 template <int dim, int spacedim>
1843 template <typename Extractor, typename Number>
1844 const std::vector<typename FEValuesViews::View<dim, spacedim, Extractor>::
1845 template solution_symmetric_gradient_type<Number>> &
1847 const std::string &global_vector_name,
1848 const Extractor &variable,
1849 const Number dummy)
1850 {
1851 const std::vector<Number> &independent_local_dofs =
1852 get_local_dof_values(global_vector_name, dummy);
1853
1854 const FEValuesBase<dim, spacedim> &fev = get_current_fe_values();
1855
1856 const unsigned int n_q_points = fev.n_quadrature_points;
1857
1858 const std::string name = get_unique_name(
1859 global_vector_name, variable, "_symmetric_gradient_q", n_q_points, dummy);
1860
1861
1862 // Now build the return type
1863 using RetType =
1864 std::vector<typename FEValuesViews::View<dim, spacedim, Extractor>::
1865 template solution_symmetric_gradient_type<Number>>;
1866
1867 RetType &ret =
1868 internal_data_storage.template get_or_add_object_with_name<RetType>(
1869 name, n_q_points);
1870
1871
1872 AssertDimension(ret.size(), n_q_points);
1873
1874 fev[variable].get_function_symmetric_gradients_from_local_dof_values(
1875 independent_local_dofs, ret);
1876 return ret;
1877 }
1878
1879
1880 template <int dim, int spacedim>
1881 template <typename Extractor, typename Number>
1882 const std::vector<typename FEValuesViews::View<dim, spacedim, Extractor>::
1883 template solution_divergence_type<Number>> &
1885 const std::string &global_vector_name,
1886 const Extractor &variable,
1887 const Number dummy)
1888 {
1889 const std::vector<Number> &independent_local_dofs =
1890 get_local_dof_values(global_vector_name, dummy);
1891
1892 const FEValuesBase<dim, spacedim> &fev = get_current_fe_values();
1893
1894 const unsigned int n_q_points = fev.n_quadrature_points;
1895
1896 const std::string name = get_unique_name(
1897 global_vector_name, variable, "_divergence_q", n_q_points, dummy);
1898
1899 // Now build the return type
1900 using RetType =
1901 std::vector<typename FEValuesViews::View<dim, spacedim, Extractor>::
1902 template solution_divergence_type<Number>>;
1903
1904 RetType &ret =
1905 internal_data_storage.template get_or_add_object_with_name<RetType>(
1906 name, n_q_points);
1907
1908
1909 AssertDimension(ret.size(), n_q_points);
1910
1911 fev[variable].get_function_divergences_from_local_dof_values(
1912 independent_local_dofs, ret);
1913 return ret;
1914 }
1915
1916
1917
1918 template <int dim, int spacedim>
1919 template <typename Extractor, typename Number>
1920 const std::vector<typename FEValuesViews::View<dim, spacedim, Extractor>::
1921 template solution_curl_type<Number>> &
1922 ScratchData<dim, spacedim>::get_curls(const std::string &global_vector_name,
1923 const Extractor &variable,
1924 const Number dummy)
1925 {
1926 const std::vector<Number> &independent_local_dofs =
1927 get_local_dof_values(global_vector_name, dummy);
1928
1929 const FEValuesBase<dim, spacedim> &fev = get_current_fe_values();
1930
1931 const unsigned int n_q_points = fev.n_quadrature_points;
1932
1933 const std::string name = get_unique_name(
1934 global_vector_name, variable, "_curl_q", n_q_points, dummy);
1935
1936 // Now build the return type
1937 using RetType =
1938 std::vector<typename FEValuesViews::View<dim, spacedim, Extractor>::
1939 template solution_curl_type<Number>>;
1940
1941 RetType &ret =
1942 internal_data_storage.template get_or_add_object_with_name<RetType>(
1943 name, n_q_points);
1944
1945 AssertDimension(ret.size(), n_q_points);
1946
1947 fev[variable].get_function_curls_from_local_dof_values(
1948 independent_local_dofs, ret);
1949 return ret;
1950 }
1951
1952
1953
1954 template <int dim, int spacedim>
1955 template <typename Extractor, typename Number>
1956 const std::vector<typename FEInterfaceViews::View<dim, spacedim, Extractor>::
1957 template solution_value_type<Number>> &
1959 const std::string &global_vector_name,
1960 const Extractor &variable,
1961 const Number dummy)
1962 {
1963 const std::vector<Number> &independent_local_dofs =
1964 get_local_dof_values(global_vector_name, dummy);
1965
1967 get_current_interface_fe_values();
1968
1969 AssertDimension(independent_local_dofs.size(),
1971
1972 const unsigned int n_q_points = feiv.n_quadrature_points;
1973
1974 const std::string name = get_unique_name(
1975 global_vector_name, variable, "_jump_values_q", n_q_points, dummy);
1976
1977 // Now build the return type
1978 using RetType =
1979 std::vector<typename FEValuesViews::View<dim, spacedim, Extractor>::
1980 template solution_value_type<Number>>;
1981
1982 RetType &ret =
1983 internal_data_storage.template get_or_add_object_with_name<RetType>(
1984 name, n_q_points);
1985
1986 AssertDimension(ret.size(), n_q_points);
1987
1988 feiv[variable].get_jump_in_function_values_from_local_dof_values(
1989 independent_local_dofs, ret);
1990 return ret;
1991 }
1992
1993
1994
1995 template <int dim, int spacedim>
1996 template <typename Extractor, typename Number>
1997 const std::vector<typename FEInterfaceViews::View<dim, spacedim, Extractor>::
1998 template solution_gradient_type<Number>> &
2000 const std::string &global_vector_name,
2001 const Extractor &variable,
2002 const Number dummy)
2003 {
2004 const std::vector<Number> &independent_local_dofs =
2005 get_local_dof_values(global_vector_name, dummy);
2006
2008 get_current_interface_fe_values();
2009
2010 AssertDimension(independent_local_dofs.size(),
2012
2013 const unsigned int n_q_points = feiv.n_quadrature_points;
2014
2015 const std::string name = get_unique_name(
2016 global_vector_name, variable, "_jump_gradients_q", n_q_points, dummy);
2017
2018 // Now build the return type
2019 using RetType =
2020 std::vector<typename FEValuesViews::View<dim, spacedim, Extractor>::
2021 template solution_gradient_type<Number>>;
2022
2023 RetType &ret =
2024 internal_data_storage.template get_or_add_object_with_name<RetType>(
2025 name, n_q_points);
2026
2027 AssertDimension(ret.size(), n_q_points);
2028
2029 feiv[variable].get_jump_in_function_gradients_from_local_dof_values(
2030 independent_local_dofs, ret);
2031 return ret;
2032 }
2033
2034
2035
2036 template <int dim, int spacedim>
2037 template <typename Extractor, typename Number>
2038 const std::vector<typename FEInterfaceViews::View<dim, spacedim, Extractor>::
2039 template solution_hessian_type<Number>> &
2041 const std::string &global_vector_name,
2042 const Extractor &variable,
2043 const Number dummy)
2044 {
2045 const std::vector<Number> &independent_local_dofs =
2046 get_local_dof_values(global_vector_name, dummy);
2047
2049 get_current_interface_fe_values();
2050
2051 AssertDimension(independent_local_dofs.size(),
2053
2054 const unsigned int n_q_points = feiv.n_quadrature_points;
2055
2056 const std::string name = get_unique_name(
2057 global_vector_name, variable, "_jump_hessians_q", n_q_points, dummy);
2058
2059 // Now build the return type
2060 using RetType =
2061 std::vector<typename FEValuesViews::View<dim, spacedim, Extractor>::
2062 template solution_hessian_type<Number>>;
2063
2064 RetType &ret =
2065 internal_data_storage.template get_or_add_object_with_name<RetType>(
2066 name, n_q_points);
2067
2068 AssertDimension(ret.size(), n_q_points);
2069
2070 feiv[variable].get_jump_in_function_hessians_from_local_dof_values(
2071 independent_local_dofs, ret);
2072 return ret;
2073 }
2074
2075
2076
2077 template <int dim, int spacedim>
2078 template <typename Extractor, typename Number>
2079 const std::vector<typename FEInterfaceViews::View<dim, spacedim, Extractor>::
2080 template solution_third_derivative_type<Number>> &
2082 const std::string &global_vector_name,
2083 const Extractor &variable,
2084 const Number dummy)
2085 {
2086 const std::vector<Number> &independent_local_dofs =
2087 get_local_dof_values(global_vector_name, dummy);
2088
2090 get_current_interface_fe_values();
2091
2092 AssertDimension(independent_local_dofs.size(),
2094
2095 const unsigned int n_q_points = feiv.n_quadrature_points;
2096
2097 const std::string name = get_unique_name(global_vector_name,
2098 variable,
2099 "_jump_third_derivatives_q",
2100 n_q_points,
2101 dummy);
2102
2103 // Now build the return type
2104 using RetType =
2105 std::vector<typename FEValuesViews::View<dim, spacedim, Extractor>::
2106 template solution_third_derivative_type<Number>>;
2107
2108 RetType &ret =
2109 internal_data_storage.template get_or_add_object_with_name<RetType>(
2110 name, n_q_points);
2111
2112 AssertDimension(ret.size(), n_q_points);
2113
2114 feiv[variable].get_jump_in_function_third_derivatives_from_local_dof_values(
2115 independent_local_dofs, ret);
2116 return ret;
2117 }
2118
2119
2120
2121 template <int dim, int spacedim>
2122 template <typename Extractor, typename Number>
2123 const std::vector<typename FEInterfaceViews::View<dim, spacedim, Extractor>::
2124 template solution_value_type<Number>> &
2126 const std::string &global_vector_name,
2127 const Extractor &variable,
2128 const Number dummy)
2129 {
2130 const std::vector<Number> &independent_local_dofs =
2131 get_local_dof_values(global_vector_name, dummy);
2132
2134 get_current_interface_fe_values();
2135
2136 AssertDimension(independent_local_dofs.size(),
2138
2139 const unsigned int n_q_points = feiv.n_quadrature_points;
2140
2141 const std::string name = get_unique_name(
2142 global_vector_name, variable, "_average_values_q", n_q_points, dummy);
2143
2144 // Now build the return type
2145 using RetType =
2146 std::vector<typename FEValuesViews::View<dim, spacedim, Extractor>::
2147 template solution_value_type<Number>>;
2148
2149 RetType &ret =
2150 internal_data_storage.template get_or_add_object_with_name<RetType>(
2151 name, n_q_points);
2152
2153 AssertDimension(ret.size(), n_q_points);
2154
2155 feiv[variable].get_average_of_function_values_from_local_dof_values(
2156 independent_local_dofs, ret);
2157 return ret;
2158 }
2159
2160
2161
2162 template <int dim, int spacedim>
2163 template <typename Extractor, typename Number>
2164 const std::vector<typename FEInterfaceViews::View<dim, spacedim, Extractor>::
2165 template solution_gradient_type<Number>> &
2167 const std::string &global_vector_name,
2168 const Extractor &variable,
2169 const Number dummy)
2170 {
2171 const std::vector<Number> &independent_local_dofs =
2172 get_local_dof_values(global_vector_name, dummy);
2173
2175 get_current_interface_fe_values();
2176
2177 AssertDimension(independent_local_dofs.size(),
2179
2180 const unsigned int n_q_points = feiv.n_quadrature_points;
2181
2182 const std::string name = get_unique_name(
2183 global_vector_name, variable, "_average_gradients_q", n_q_points, dummy);
2184
2185 // Now build the return type
2186 using RetType =
2187 std::vector<typename FEValuesViews::View<dim, spacedim, Extractor>::
2188 template solution_gradient_type<Number>>;
2189
2190 RetType &ret =
2191 internal_data_storage.template get_or_add_object_with_name<RetType>(
2192 name, n_q_points);
2193
2194 AssertDimension(ret.size(), n_q_points);
2195
2196 feiv[variable].get_average_of_function_gradients_from_local_dof_values(
2197 independent_local_dofs, ret);
2198 return ret;
2199 }
2200
2201
2202
2203 template <int dim, int spacedim>
2204 template <typename Extractor, typename Number>
2205 const std::vector<typename FEInterfaceViews::View<dim, spacedim, Extractor>::
2206 template solution_hessian_type<Number>> &
2208 const std::string &global_vector_name,
2209 const Extractor &variable,
2210 const Number dummy)
2211 {
2212 const std::vector<Number> &independent_local_dofs =
2213 get_local_dof_values(global_vector_name, dummy);
2214
2216 get_current_interface_fe_values();
2217
2218 AssertDimension(independent_local_dofs.size(),
2220
2221 const unsigned int n_q_points = feiv.n_quadrature_points;
2222
2223 const std::string name = get_unique_name(
2224 global_vector_name, variable, "_average_hessians_q", n_q_points, dummy);
2225
2226 // Now build the return type
2227 using RetType =
2228 std::vector<typename FEValuesViews::View<dim, spacedim, Extractor>::
2229 template solution_hessian_type<Number>>;
2230
2231 RetType &ret =
2232 internal_data_storage.template get_or_add_object_with_name<RetType>(
2233 name, n_q_points);
2234
2235 AssertDimension(ret.size(), n_q_points);
2236
2237 feiv[variable].get_average_of_function_hessians_from_local_dof_values(
2238 independent_local_dofs, ret);
2239 return ret;
2240 }
2241
2242
2243#endif
2244
2245} // namespace MeshWorker
2246
2248
2249#endif
const unsigned int n_quadrature_points
unsigned n_current_interface_dofs() const
const unsigned int n_quadrature_points
Abstract base class for mapping classes.
Definition mapping.h:318
GeneralDataStorage user_data_storage
hp::QCollection< dim - 1 > face_quadrature_collection
const std::vector< typename FEInterfaceViews::View< dim, spacedim, Extractor >::template solution_gradient_type< Number > > & get_jumps_in_gradients(const std::string &global_vector_name, const Extractor &variable, const Number dummy=Number(0))
bool has_hp_capabilities() const
const hp::MappingCollection< dim, spacedim > & get_mapping_collection() const
const std::vector< typename FEValuesViews::View< dim, spacedim, Extractor >::template solution_value_type< Number > > & get_values(const std::string &global_vector_name, const Extractor &variable, const Number dummy=Number(0))
const FEValuesBase< dim, spacedim > & get_current_fe_values() const
GeneralDataStorage & get_general_data_storage()
const Quadrature< dim - 1 > & get_face_quadrature() const
std::string get_unique_name(const std::string &global_vector_name, const Extractor &variable, const std::string &object_type, const unsigned int size, const Number &exemplar_number) const
const std::vector< typename FEInterfaceViews::View< dim, spacedim, Extractor >::template solution_value_type< Number > > & get_jumps_in_values(const std::string &global_vector_name, const Extractor &variable, const Number dummy=Number(0))
const std::vector< typename FEValuesViews::View< dim, spacedim, Extractor >::template solution_divergence_type< Number > > & get_divergences(const std::string &global_vector_name, const Extractor &variable, const Number dummy=Number(0))
const std::vector< Tensor< 1, spacedim > > & get_neighbor_normal_vectors()
unsigned int n_dofs_per_cell() const
std::unique_ptr< hp::FESubfaceValues< dim, spacedim > > hp_fe_subface_values
unsigned int n_neighbor_dofs_per_cell() const
std::unique_ptr< FEValues< dim, spacedim > > neighbor_fe_values
std::unique_ptr< FEFaceValues< dim, spacedim > > fe_face_values
std::string get_unique_dofs_name(const std::string &global_vector_name, const unsigned int size, const Number &exemplar_number) const
void extract_local_dof_values(const std::string &global_vector_name, const VectorType &input_vector, const Number dummy=Number(0))
std::unique_ptr< FEValues< dim, spacedim > > fe_values
const std::vector< double > & get_JxW_values() const
const Mapping< dim, spacedim > & get_mapping() const
std::unique_ptr< FEInterfaceValues< dim, spacedim > > interface_fe_values
const std::vector< double > & get_neighbor_JxW_values() const
Quadrature< dim > cell_quadrature
const std::vector< typename FEInterfaceViews::View< dim, spacedim, Extractor >::template solution_value_type< Number > > & get_averages_of_values(const std::string &global_vector_name, const Extractor &variable, const Number dummy=Number(0))
const FiniteElement< dim, spacedim > & get_fe() const
SmartPointer< const hp::FECollection< dim, spacedim > > fe_collection
std::unique_ptr< FEFaceValues< dim, spacedim > > neighbor_fe_face_values
const std::vector< typename FEInterfaceViews::View< dim, spacedim, Extractor >::template solution_gradient_type< Number > > & get_averages_of_gradients(const std::string &global_vector_name, const Extractor &variable, const Number dummy=Number(0))
const hp::QCollection< dim > & get_cell_quadrature_collection() const
std::vector< types::global_dof_index > neighbor_dof_indices
SmartPointer< const FiniteElement< dim, spacedim > > fe
const std::vector< types::global_dof_index > & get_neighbor_dof_indices() const
UpdateFlags get_face_update_flags() const
const std::vector< typename FEInterfaceViews::View< dim, spacedim, Extractor >::template solution_hessian_type< Number > > & get_jumps_in_hessians(const std::string &global_vector_name, const Extractor &variable, const Number dummy=Number(0))
const std::vector< typename FEValuesViews::View< dim, spacedim, Extractor >::template solution_laplacian_type< Number > > & get_laplacians(const std::string &global_vector_name, const Extractor &variable, const Number dummy=Number(0))
std::unique_ptr< hp::FEValues< dim, spacedim > > hp_fe_values
SmartPointer< const hp::MappingCollection< dim, spacedim > > mapping_collection
UpdateFlags neighbor_cell_update_flags
const std::vector< typename FEValuesViews::View< dim, spacedim, Extractor >::template solution_third_derivative_type< Number > > & get_third_derivatives(const std::string &global_vector_name, const Extractor &variable, const Number dummy=Number(0))
UpdateFlags get_neighbor_cell_update_flags() const
const hp::FECollection< dim, spacedim > & get_fe_collection() const
const std::vector< Tensor< 1, spacedim > > & get_normal_vectors() const
const std::vector< typename FEValuesViews::View< dim, spacedim, Extractor >::template solution_curl_type< Number > > & get_curls(const std::string &global_vector_name, const Extractor &variable, const Number dummy=Number(0))
const FEValues< dim, spacedim > & reinit_neighbor(const typename DoFHandler< dim, spacedim >::active_cell_iterator &cell)
std::unique_ptr< hp::FEFaceValues< dim, spacedim > > neighbor_hp_fe_face_values
const std::vector< typename FEValuesViews::View< dim, spacedim, Extractor >::template solution_hessian_type< Number > > & get_hessians(const std::string &global_vector_name, const Extractor &variable, const Number dummy=Number(0))
std::vector< types::global_dof_index > local_dof_indices
SmartPointer< const Mapping< dim, spacedim > > mapping
const std::vector< typename FEInterfaceViews::View< dim, spacedim, Extractor >::template solution_third_derivative_type< Number > > & get_jumps_in_third_derivatives(const std::string &global_vector_name, const Extractor &variable, const Number dummy=Number(0))
SmartPointer< const FEValuesBase< dim, spacedim > > current_fe_values
const std::vector< Number > & get_local_dof_values(const std::string &global_vector_name, Number dummy=Number(0)) const
const std::vector< Point< spacedim > > & get_quadrature_points() const
std::unique_ptr< hp::FEValues< dim, spacedim > > neighbor_hp_fe_values
const FEValuesBase< dim, spacedim > & get_current_neighbor_fe_values() const
const std::vector< types::global_dof_index > & get_local_dof_indices() const
SmartPointer< const FEValuesBase< dim, spacedim > > current_neighbor_fe_values
const std::vector< typename FEValuesViews::View< dim, spacedim, Extractor >::template solution_symmetric_gradient_type< Number > > & get_symmetric_gradients(const std::string &global_vector_name, const Extractor &variable, const Number dummy=Number(0))
Quadrature< dim - 1 > face_quadrature
const std::vector< typename FEInterfaceViews::View< dim, spacedim, Extractor >::template solution_hessian_type< Number > > & get_averages_of_hessians(const std::string &global_vector_name, const Extractor &variable, const Number dummy=Number(0))
const FEInterfaceValues< dim, spacedim > & get_current_interface_fe_values() const
hp::QCollection< dim > cell_quadrature_collection
UpdateFlags get_cell_update_flags() const
const std::vector< typename FEValuesViews::View< dim, spacedim, Extractor >::template solution_gradient_type< Number > > & get_gradients(const std::string &global_vector_name, const Extractor &variable, const Number dummy=Number(0))
UpdateFlags neighbor_face_update_flags
const Quadrature< dim > & get_cell_quadrature() const
const hp::QCollection< dim - 1 > & get_face_quadrature_collection() const
ScratchData(const Mapping< dim, spacedim > &mapping, const FiniteElement< dim, spacedim > &fe, const Quadrature< dim > &quadrature, const UpdateFlags &update_flags, const Quadrature< dim - 1 > &face_quadrature=Quadrature< dim - 1 >(), const UpdateFlags &face_update_flags=update_default)
std::unique_ptr< FESubfaceValues< dim, spacedim > > neighbor_fe_subface_values
const FEValues< dim, spacedim > & reinit(const typename DoFHandler< dim, spacedim >::active_cell_iterator &cell)
std::unique_ptr< hp::FESubfaceValues< dim, spacedim > > neighbor_hp_fe_subface_values
std::unique_ptr< FESubfaceValues< dim, spacedim > > fe_subface_values
GeneralDataStorage internal_data_storage
UpdateFlags get_neighbor_face_update_flags() const
std::unique_ptr< hp::FEFaceValues< dim, spacedim > > hp_fe_face_values
#define DEAL_II_NAMESPACE_OPEN
Definition config.h:503
#define DEAL_II_NAMESPACE_CLOSE
Definition config.h:504
#define Assert(cond, exc)
#define AssertDimension(dim1, dim2)
static ::ExceptionBase & ExcOnlyAvailableWithoutHP()
#define DeclExceptionMsg(Exception, defaulttext)
Definition exceptions.h:494
static ::ExceptionBase & ExcMessage(std::string arg1)
static ::ExceptionBase & ExcOnlyAvailableWithHP()
typename ActiveSelector::active_cell_iterator active_cell_iterator
UpdateFlags
@ update_default
No update.
typename ::internal::FEInterfaceViews:: ViewType< dim, spacedim, Extractor >::type View
std::string type_to_string(const T &t)
Definition utilities.h:1023
std::string int_to_string(const unsigned int value, const unsigned int digits=numbers::invalid_unsigned_int)
Definition utilities.cc:470