Reference documentation for deal.II version GIT relicensing-437-g81ec864850 2024-04-19 07:30:02+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
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 - 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_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{
220 template <int dim, int spacedim = dim>
222 {
223 public:
246 const Quadrature<dim> &quadrature,
247 const UpdateFlags &update_flags,
250
270 const Quadrature<dim> &quadrature,
271 const UpdateFlags &update_flags,
272 const UpdateFlags &neighbor_update_flags,
276
291 const Quadrature<dim> &quadrature,
292 const UpdateFlags &update_flags,
295
312 const Quadrature<dim> &quadrature,
313 const UpdateFlags &update_flags,
314 const UpdateFlags &neighbor_update_flags,
318
345
371
390
413
418
432 reinit(
434
444 const unsigned int face_no);
445
458 const unsigned int face_no,
459 const unsigned int subface_no);
460
477 const unsigned int face_no,
479 &cell_neighbor,
480 const unsigned int face_no_neighbor);
481
498 const unsigned int face_no,
499 const unsigned int sub_face_no,
501 &cell_neighbor,
502 const unsigned int face_no_neighbor,
503 const unsigned int sub_face_no_neighbor);
504
516 get_current_fe_values() const;
517
523
527 const std::vector<Point<spacedim>> &
528 get_quadrature_points() const;
529
533 const std::vector<double> &
534 get_JxW_values() const;
535
539 const std::vector<Tensor<1, spacedim>> &
540 get_normal_vectors() const;
541
546 const std::vector<types::global_dof_index> &
547 get_local_dof_indices() const;
548
553 unsigned int
554 n_dofs_per_cell() const;
555
// CurrentCellMethods
557
573
584 const unsigned int face_no);
585
599 const unsigned int face_no,
600 const unsigned int subface_no);
601
615
619 const std::vector<double> &
621
625 const std::vector<Tensor<1, spacedim>> &
627
632 const std::vector<types::global_dof_index> &
634
639 unsigned int
641
// NeighborCellMethods
643
// hpCellMethods
648
667 &neighbor_cell,
668 const unsigned int face_no);
669
691 &neighbor_cell,
692 const unsigned int face_no,
693 const unsigned int subface_no);
694
714 &neighbor_cell,
715 const unsigned int face_no);
716
739 &neighbor_cell,
740 const unsigned int face_no,
741 const unsigned int subface_no);
742
// hpCellMethods
744
752
758 const GeneralDataStorage &
760
765 get_mapping() const;
766
771 get_fe() const;
772
776 const Quadrature<dim> &
777 get_cell_quadrature() const;
778
782 const Quadrature<dim - 1> &
783 get_face_quadrature() const;
784
790
795 get_fe_collection() const;
796
802
806 const hp::QCollection<dim - 1> &
808
813 bool
814 has_hp_capabilities() const;
815
820 get_cell_update_flags() const;
821
827
832 get_face_update_flags() const;
833
839
// CurrentCellEvaluation
844
874 template <typename VectorType, typename Number = double>
875 void
876 extract_local_dof_values(const std::string &global_vector_name,
877 const VectorType &input_vector,
878 const Number dummy = Number(0));
879
888 template <typename Number = double>
889 const std::vector<Number> &
890 get_local_dof_values(const std::string &global_vector_name,
891 Number dummy = Number(0)) const;
892
914 template <typename Extractor, typename Number = double>
915 const std::vector<typename FEValuesViews::View<dim, spacedim, Extractor>::
916 template solution_value_type<Number>> &
917 get_values(const std::string &global_vector_name,
918 const Extractor &variable,
919 const Number dummy = Number(0));
920
942 template <typename Extractor, typename Number = double>
943 const std::vector<typename FEValuesViews::View<dim, spacedim, Extractor>::
944 template solution_gradient_type<Number>> &
945 get_gradients(const std::string &global_vector_name,
946 const Extractor &variable,
947 const Number dummy = Number(0));
948
971 template <typename Extractor, typename Number = double>
972 const std::vector<typename FEValuesViews::View<dim, spacedim, Extractor>::
973 template solution_symmetric_gradient_type<Number>> &
974 get_symmetric_gradients(const std::string &global_vector_name,
975 const Extractor &variable,
976 const Number dummy = Number(0));
977
999 template <typename Extractor, typename Number = double>
1000 const std::vector<typename FEValuesViews::View<dim, spacedim, Extractor>::
1001 template solution_divergence_type<Number>> &
1002 get_divergences(const std::string &global_vector_name,
1003 const Extractor &variable,
1004 const Number dummy = Number(0));
1005
1027 template <typename Extractor, typename Number = double>
1028 const std::vector<typename FEValuesViews::View<dim, spacedim, Extractor>::
1029 template solution_curl_type<Number>> &
1030 get_curls(const std::string &global_vector_name,
1031 const Extractor &variable,
1032 const Number dummy = Number(0));
1033
1055 template <typename Extractor, typename Number = double>
1056 const std::vector<typename FEValuesViews::View<dim, spacedim, Extractor>::
1057 template solution_hessian_type<Number>> &
1058 get_hessians(const std::string &global_vector_name,
1059 const Extractor &variable,
1060 const Number dummy = Number(0));
1061
1083 template <typename Extractor, typename Number = double>
1084 const std::vector<typename FEValuesViews::View<dim, spacedim, Extractor>::
1085 template solution_laplacian_type<Number>> &
1086 get_laplacians(const std::string &global_vector_name,
1087 const Extractor &variable,
1088 const Number dummy = Number(0));
1089
1111 template <typename Extractor, typename Number = double>
1112 const std::vector<typename FEValuesViews::View<dim, spacedim, Extractor>::
1113 template solution_third_derivative_type<Number>> &
1114 get_third_derivatives(const std::string &global_vector_name,
1115 const Extractor &variable,
1116 const Number dummy = Number(0));
1117
// CurrentCellEvaluation
1119
// CurrentInterfaceJumpEvaluation
1124
1147 template <typename Extractor, typename Number = double>
1148 const std::vector<
1150 template solution_value_type<Number>> &
1151 get_jumps_in_values(const std::string &global_vector_name,
1152 const Extractor &variable,
1153 const Number dummy = Number(0));
1154
1177 template <typename Extractor, typename Number = double>
1178 const std::vector<
1180 template solution_gradient_type<Number>> &
1181 get_jumps_in_gradients(const std::string &global_vector_name,
1182 const Extractor &variable,
1183 const Number dummy = Number(0));
1184
1207 template <typename Extractor, typename Number = double>
1208 const std::vector<
1210 template solution_hessian_type<Number>> &
1211 get_jumps_in_hessians(const std::string &global_vector_name,
1212 const Extractor &variable,
1213 const Number dummy = Number(0));
1214
1237 template <typename Extractor, typename Number = double>
1238 const std::vector<
1240 template solution_third_derivative_type<Number>> &
1241 get_jumps_in_third_derivatives(const std::string &global_vector_name,
1242 const Extractor &variable,
1243 const Number dummy = Number(0));
1244
// CurrentInterfaceJumpEvaluation
1246
// CurrentInterfaceAverageEvaluation
1251
1274 template <typename Extractor, typename Number = double>
1275 const std::vector<
1277 template solution_value_type<Number>> &
1278 get_averages_of_values(const std::string &global_vector_name,
1279 const Extractor &variable,
1280 const Number dummy = Number(0));
1281
1304 template <typename Extractor, typename Number = double>
1305 const std::vector<
1307 template solution_gradient_type<Number>> &
1308 get_averages_of_gradients(const std::string &global_vector_name,
1309 const Extractor &variable,
1310 const Number dummy = Number(0));
1311
1334 template <typename Extractor, typename Number = double>
1335 const std::vector<
1337 template solution_hessian_type<Number>> &
1338 get_averages_of_hessians(const std::string &global_vector_name,
1339 const Extractor &variable,
1340 const Number dummy = Number(0));
1341
// CurrentInterfaceAverageEvaluation
1343
1344 private:
1349 template <typename Extractor, typename Number = double>
1350 std::string
1351 get_unique_name(const std::string &global_vector_name,
1352 const Extractor &variable,
1353 const std::string &object_type,
1354 const unsigned int size,
1355 const Number &exemplar_number) const;
1356
1360 template <typename Number = double>
1361 std::string
1362 get_unique_dofs_name(const std::string &global_vector_name,
1363 const unsigned int size,
1364 const Number &exemplar_number) const;
1365
// non-hp data
1370
1376
1382
1388
1394
1398 std::unique_ptr<FEValues<dim, spacedim>> fe_values;
1399
1403 std::unique_ptr<FEFaceValues<dim, spacedim>> fe_face_values;
1404
1408 std::unique_ptr<FESubfaceValues<dim, spacedim>> fe_subface_values;
1409
1413 std::unique_ptr<FEValues<dim, spacedim>> neighbor_fe_values;
1414
1418 std::unique_ptr<FEFaceValues<dim, spacedim>> neighbor_fe_face_values;
1419
1423 std::unique_ptr<FESubfaceValues<dim, spacedim>> neighbor_fe_subface_values;
1424
1428 // The FEInterfaceValues class supports initialization with hp objects
1429 // as well.
1430 std::unique_ptr<FEInterfaceValues<dim, spacedim>> interface_fe_values;
1431
// non-hp data
1433
// hp data
1438
1444
1450
1456
1462
1468
1472 std::unique_ptr<hp::FEValues<dim, spacedim>> hp_fe_values;
1473
1477 std::unique_ptr<hp::FEFaceValues<dim, spacedim>> hp_fe_face_values;
1478
1482 std::unique_ptr<hp::FESubfaceValues<dim, spacedim>> hp_fe_subface_values;
1483
1487 std::unique_ptr<hp::FEValues<dim, spacedim>> neighbor_hp_fe_values;
1488
1492 std::unique_ptr<hp::FEFaceValues<dim, spacedim>> neighbor_hp_fe_face_values;
1493
1497 std::unique_ptr<hp::FESubfaceValues<dim, spacedim>>
1499
1507 "The current function doesn't make sense when used with a "
1508 "ScratchData object with hp-capabilities.");
1509
1517 "The current function doesn't make sense when used with a "
1518 "ScratchData object without hp-capabilities.");
1519
// hp data
1521
1526
1531
1537
1543
1547 std::vector<types::global_dof_index> local_dof_indices;
1548
1552 std::vector<types::global_dof_index> neighbor_dof_indices;
1553
1558
1563
1569
1575 };
1576
1577#ifndef DOXYGEN
1578 template <int dim, int spacedim>
1579 template <typename Extractor, typename Number>
1580 std::string
1582 const std::string &global_vector_name,
1583 const Extractor &variable,
1584 const std::string &object_type,
1585 const unsigned int size,
1586 const Number &exemplar_number) const
1587 {
1588 return global_vector_name + "_" + variable.get_name() + "_" + object_type +
1589 "_" + Utilities::int_to_string(size) + "_" +
1590 Utilities::type_to_string(exemplar_number);
1591 }
1592
1593
1594
1595 template <int dim, int spacedim>
1596 template <typename Number>
1597 std::string
1599 const std::string &global_vector_name,
1600 const unsigned int size,
1601 const Number &exemplar_number) const
1602 {
1603 return global_vector_name + "_independent_local_dofs_" +
1604 Utilities::int_to_string(size) + "_" +
1605 Utilities::type_to_string(exemplar_number);
1606 }
1607
1608
1609
1610 template <int dim, int spacedim>
1611 template <typename VectorType, typename Number>
1612 void
1614 const std::string &global_vector_name,
1615 const VectorType &input_vector,
1616 const Number dummy)
1617 {
1618 const unsigned int n_dofs = local_dof_indices.size();
1619
1620 const std::string name =
1621 get_unique_dofs_name(global_vector_name, n_dofs, dummy);
1622
1623 auto &independent_local_dofs =
1624 internal_data_storage
1625 .template get_or_add_object_with_name<std::vector<Number>>(name,
1626 n_dofs);
1627
1628 AssertDimension(independent_local_dofs.size(), n_dofs);
1629
1631 for (unsigned int i = 0; i < n_dofs; ++i)
1633 input_vector(local_dof_indices[i]),
1634 i,
1635 n_dofs,
1636 independent_local_dofs[i]);
1637 else
1638 for (unsigned int i = 0; i < n_dofs; ++i)
1639 independent_local_dofs[i] = input_vector(local_dof_indices[i]);
1640 }
1641
1642
1643
1644 template <int dim, int spacedim>
1645 template <typename Number>
1646 const std::vector<Number> &
1648 const std::string &global_vector_name,
1649 Number dummy) const
1650 {
1651 const unsigned int n_dofs = local_dof_indices.size();
1652
1653 const std::string dofs_name =
1654 get_unique_dofs_name(global_vector_name, n_dofs, dummy);
1655
1656 Assert(
1657 internal_data_storage.stores_object_with_name(dofs_name),
1658 ExcMessage(
1659 "You did not call yet extract_local_dof_values with the right types!"));
1660
1661 return internal_data_storage
1662 .template get_object_with_name<std::vector<Number>>(dofs_name);
1663 }
1664
1665
1666
1667 template <int dim, int spacedim>
1668 template <typename Extractor, typename Number>
1669 const std::vector<typename FEValuesViews::View<dim, spacedim, Extractor>::
1670 template solution_value_type<Number>> &
1671 ScratchData<dim, spacedim>::get_values(const std::string &global_vector_name,
1672 const Extractor &variable,
1673 const Number dummy)
1674 {
1675 const std::vector<Number> &independent_local_dofs =
1676 get_local_dof_values(global_vector_name, dummy);
1677
1678 const FEValuesBase<dim, spacedim> &fev = get_current_fe_values();
1679
1680 const unsigned int n_q_points = fev.n_quadrature_points;
1681
1682 const std::string name = get_unique_name(
1683 global_vector_name, variable, "_values_q", n_q_points, dummy);
1684
1685 // Now build the return type
1686 using RetType =
1687 std::vector<typename FEValuesViews::View<dim, spacedim, Extractor>::
1688 template solution_value_type<Number>>;
1689
1690 RetType &ret =
1691 internal_data_storage.template get_or_add_object_with_name<RetType>(
1692 name, n_q_points);
1693
1694 AssertDimension(ret.size(), n_q_points);
1695
1696 fev[variable].get_function_values_from_local_dof_values(
1697 independent_local_dofs, ret);
1698 return ret;
1699 }
1700
1701
1702
1703 template <int dim, int spacedim>
1704 template <typename Extractor, typename Number>
1705 const std::vector<typename FEValuesViews::View<dim, spacedim, Extractor>::
1706 template solution_gradient_type<Number>> &
1708 const std::string &global_vector_name,
1709 const Extractor &variable,
1710 const Number dummy)
1711 {
1712 const std::vector<Number> &independent_local_dofs =
1713 get_local_dof_values(global_vector_name, dummy);
1714
1715 const FEValuesBase<dim, spacedim> &fev = get_current_fe_values();
1716
1717 const unsigned int n_q_points = fev.n_quadrature_points;
1718
1719 const std::string name = get_unique_name(
1720 global_vector_name, variable, "_gradients_q", n_q_points, dummy);
1721
1722 // Now build the return type
1723 using RetType =
1724 std::vector<typename FEValuesViews::View<dim, spacedim, Extractor>::
1725 template solution_gradient_type<Number>>;
1726
1727 RetType &ret =
1728 internal_data_storage.template get_or_add_object_with_name<RetType>(
1729 name, n_q_points);
1730
1731 AssertDimension(ret.size(), n_q_points);
1732
1733 fev[variable].get_function_gradients_from_local_dof_values(
1734 independent_local_dofs, ret);
1735 return ret;
1736 }
1737
1738
1739
1740 template <int dim, int spacedim>
1741 template <typename Extractor, typename Number>
1742 const std::vector<typename FEValuesViews::View<dim, spacedim, Extractor>::
1743 template solution_hessian_type<Number>> &
1745 const std::string &global_vector_name,
1746 const Extractor &variable,
1747 const Number dummy)
1748 {
1749 const std::vector<Number> &independent_local_dofs =
1750 get_local_dof_values(global_vector_name, dummy);
1751
1752 const FEValuesBase<dim, spacedim> &fev = get_current_fe_values();
1753
1754 const unsigned int n_q_points = fev.n_quadrature_points;
1755
1756 const std::string name = get_unique_name(
1757 global_vector_name, variable, "_hessians_q", n_q_points, dummy);
1758
1759 // Now build the return type
1760 using RetType =
1761 std::vector<typename FEValuesViews::View<dim, spacedim, Extractor>::
1762 template solution_hessian_type<Number>>;
1763
1764 RetType &ret =
1765 internal_data_storage.template get_or_add_object_with_name<RetType>(
1766 name, n_q_points);
1767
1768
1769 AssertDimension(ret.size(), n_q_points);
1770
1771 fev[variable].get_function_hessians_from_local_dof_values(
1772 independent_local_dofs, ret);
1773 return ret;
1774 }
1775
1776
1777
1778 template <int dim, int spacedim>
1779 template <typename Extractor, typename Number>
1780 const std::vector<typename FEValuesViews::View<dim, spacedim, Extractor>::
1781 template solution_laplacian_type<Number>> &
1783 const std::string &global_vector_name,
1784 const Extractor &variable,
1785 const Number dummy)
1786 {
1787 const std::vector<Number> &independent_local_dofs =
1788 get_local_dof_values(global_vector_name, dummy);
1789
1790 const FEValuesBase<dim, spacedim> &fev = get_current_fe_values();
1791
1792 const unsigned int n_q_points = fev.n_quadrature_points;
1793
1794 const std::string name = get_unique_name(
1795 global_vector_name, variable, "_laplacians_q", n_q_points, dummy);
1796
1797 // Now build the return type
1798 using RetType =
1799 std::vector<typename FEValuesViews::View<dim, spacedim, Extractor>::
1800 template solution_laplacian_type<Number>>;
1801
1802 RetType &ret =
1803 internal_data_storage.template get_or_add_object_with_name<RetType>(
1804 name, n_q_points);
1805
1806
1807 AssertDimension(ret.size(), n_q_points);
1808
1809 fev[variable].get_function_laplacians_from_local_dof_values(
1810 independent_local_dofs, ret);
1811 return ret;
1812 }
1813
1814
1815
1816 template <int dim, int spacedim>
1817 template <typename Extractor, typename Number>
1818 const std::vector<typename FEValuesViews::View<dim, spacedim, Extractor>::
1819 template solution_third_derivative_type<Number>> &
1821 const std::string &global_vector_name,
1822 const Extractor &variable,
1823 const Number dummy)
1824 {
1825 const std::vector<Number> &independent_local_dofs =
1826 get_local_dof_values(global_vector_name, dummy);
1827
1828 const FEValuesBase<dim, spacedim> &fev = get_current_fe_values();
1829
1830 const unsigned int n_q_points = fev.n_quadrature_points;
1831
1832 const std::string name = get_unique_name(
1833 global_vector_name, variable, "_third_derivatives_q", n_q_points, dummy);
1834
1835 // Now build the return type
1836 using RetType =
1837 std::vector<typename FEValuesViews::View<dim, spacedim, Extractor>::
1838 template solution_third_derivative_type<Number>>;
1839
1840 RetType &ret =
1841 internal_data_storage.template get_or_add_object_with_name<RetType>(
1842 name, n_q_points);
1843
1844
1845 AssertDimension(ret.size(), n_q_points);
1846
1847 fev[variable].get_function_third_derivatives_from_local_dof_values(
1848 independent_local_dofs, ret);
1849 return ret;
1850 }
1851
1852
1853
1854 template <int dim, int spacedim>
1855 template <typename Extractor, typename Number>
1856 const std::vector<typename FEValuesViews::View<dim, spacedim, Extractor>::
1857 template solution_symmetric_gradient_type<Number>> &
1859 const std::string &global_vector_name,
1860 const Extractor &variable,
1861 const Number dummy)
1862 {
1863 const std::vector<Number> &independent_local_dofs =
1864 get_local_dof_values(global_vector_name, dummy);
1865
1866 const FEValuesBase<dim, spacedim> &fev = get_current_fe_values();
1867
1868 const unsigned int n_q_points = fev.n_quadrature_points;
1869
1870 const std::string name = get_unique_name(
1871 global_vector_name, variable, "_symmetric_gradient_q", n_q_points, dummy);
1872
1873
1874 // Now build the return type
1875 using RetType =
1876 std::vector<typename FEValuesViews::View<dim, spacedim, Extractor>::
1877 template solution_symmetric_gradient_type<Number>>;
1878
1879 RetType &ret =
1880 internal_data_storage.template get_or_add_object_with_name<RetType>(
1881 name, n_q_points);
1882
1883
1884 AssertDimension(ret.size(), n_q_points);
1885
1886 fev[variable].get_function_symmetric_gradients_from_local_dof_values(
1887 independent_local_dofs, ret);
1888 return ret;
1889 }
1890
1891
1892 template <int dim, int spacedim>
1893 template <typename Extractor, typename Number>
1894 const std::vector<typename FEValuesViews::View<dim, spacedim, Extractor>::
1895 template solution_divergence_type<Number>> &
1897 const std::string &global_vector_name,
1898 const Extractor &variable,
1899 const Number dummy)
1900 {
1901 const std::vector<Number> &independent_local_dofs =
1902 get_local_dof_values(global_vector_name, dummy);
1903
1904 const FEValuesBase<dim, spacedim> &fev = get_current_fe_values();
1905
1906 const unsigned int n_q_points = fev.n_quadrature_points;
1907
1908 const std::string name = get_unique_name(
1909 global_vector_name, variable, "_divergence_q", n_q_points, dummy);
1910
1911 // Now build the return type
1912 using RetType =
1913 std::vector<typename FEValuesViews::View<dim, spacedim, Extractor>::
1914 template solution_divergence_type<Number>>;
1915
1916 RetType &ret =
1917 internal_data_storage.template get_or_add_object_with_name<RetType>(
1918 name, n_q_points);
1919
1920
1921 AssertDimension(ret.size(), n_q_points);
1922
1923 fev[variable].get_function_divergences_from_local_dof_values(
1924 independent_local_dofs, ret);
1925 return ret;
1926 }
1927
1928
1929
1930 template <int dim, int spacedim>
1931 template <typename Extractor, typename Number>
1932 const std::vector<typename FEValuesViews::View<dim, spacedim, Extractor>::
1933 template solution_curl_type<Number>> &
1934 ScratchData<dim, spacedim>::get_curls(const std::string &global_vector_name,
1935 const Extractor &variable,
1936 const Number dummy)
1937 {
1938 const std::vector<Number> &independent_local_dofs =
1939 get_local_dof_values(global_vector_name, dummy);
1940
1941 const FEValuesBase<dim, spacedim> &fev = get_current_fe_values();
1942
1943 const unsigned int n_q_points = fev.n_quadrature_points;
1944
1945 const std::string name = get_unique_name(
1946 global_vector_name, variable, "_curl_q", n_q_points, dummy);
1947
1948 // Now build the return type
1949 using RetType =
1950 std::vector<typename FEValuesViews::View<dim, spacedim, Extractor>::
1951 template solution_curl_type<Number>>;
1952
1953 RetType &ret =
1954 internal_data_storage.template get_or_add_object_with_name<RetType>(
1955 name, n_q_points);
1956
1957 AssertDimension(ret.size(), n_q_points);
1958
1959 fev[variable].get_function_curls_from_local_dof_values(
1960 independent_local_dofs, ret);
1961 return ret;
1962 }
1963
1964
1965
1966 template <int dim, int spacedim>
1967 template <typename Extractor, typename Number>
1968 const std::vector<typename FEInterfaceViews::View<dim, spacedim, Extractor>::
1969 template solution_value_type<Number>> &
1971 const std::string &global_vector_name,
1972 const Extractor &variable,
1973 const Number dummy)
1974 {
1975 const std::vector<Number> &independent_local_dofs =
1976 get_local_dof_values(global_vector_name, dummy);
1977
1979 get_current_interface_fe_values();
1980
1981 AssertDimension(independent_local_dofs.size(),
1983
1984 const unsigned int n_q_points = feiv.n_quadrature_points;
1985
1986 const std::string name = get_unique_name(
1987 global_vector_name, variable, "_jump_values_q", n_q_points, dummy);
1988
1989 // Now build the return type
1990 using RetType =
1991 std::vector<typename FEValuesViews::View<dim, spacedim, Extractor>::
1992 template solution_value_type<Number>>;
1993
1994 RetType &ret =
1995 internal_data_storage.template get_or_add_object_with_name<RetType>(
1996 name, n_q_points);
1997
1998 AssertDimension(ret.size(), n_q_points);
1999
2000 feiv[variable].get_jump_in_function_values_from_local_dof_values(
2001 independent_local_dofs, ret);
2002 return ret;
2003 }
2004
2005
2006
2007 template <int dim, int spacedim>
2008 template <typename Extractor, typename Number>
2009 const std::vector<typename FEInterfaceViews::View<dim, spacedim, Extractor>::
2010 template solution_gradient_type<Number>> &
2012 const std::string &global_vector_name,
2013 const Extractor &variable,
2014 const Number dummy)
2015 {
2016 const std::vector<Number> &independent_local_dofs =
2017 get_local_dof_values(global_vector_name, dummy);
2018
2020 get_current_interface_fe_values();
2021
2022 AssertDimension(independent_local_dofs.size(),
2024
2025 const unsigned int n_q_points = feiv.n_quadrature_points;
2026
2027 const std::string name = get_unique_name(
2028 global_vector_name, variable, "_jump_gradients_q", n_q_points, dummy);
2029
2030 // Now build the return type
2031 using RetType =
2032 std::vector<typename FEValuesViews::View<dim, spacedim, Extractor>::
2033 template solution_gradient_type<Number>>;
2034
2035 RetType &ret =
2036 internal_data_storage.template get_or_add_object_with_name<RetType>(
2037 name, n_q_points);
2038
2039 AssertDimension(ret.size(), n_q_points);
2040
2041 feiv[variable].get_jump_in_function_gradients_from_local_dof_values(
2042 independent_local_dofs, ret);
2043 return ret;
2044 }
2045
2046
2047
2048 template <int dim, int spacedim>
2049 template <typename Extractor, typename Number>
2050 const std::vector<typename FEInterfaceViews::View<dim, spacedim, Extractor>::
2051 template solution_hessian_type<Number>> &
2053 const std::string &global_vector_name,
2054 const Extractor &variable,
2055 const Number dummy)
2056 {
2057 const std::vector<Number> &independent_local_dofs =
2058 get_local_dof_values(global_vector_name, dummy);
2059
2061 get_current_interface_fe_values();
2062
2063 AssertDimension(independent_local_dofs.size(),
2065
2066 const unsigned int n_q_points = feiv.n_quadrature_points;
2067
2068 const std::string name = get_unique_name(
2069 global_vector_name, variable, "_jump_hessians_q", n_q_points, dummy);
2070
2071 // Now build the return type
2072 using RetType =
2073 std::vector<typename FEValuesViews::View<dim, spacedim, Extractor>::
2074 template solution_hessian_type<Number>>;
2075
2076 RetType &ret =
2077 internal_data_storage.template get_or_add_object_with_name<RetType>(
2078 name, n_q_points);
2079
2080 AssertDimension(ret.size(), n_q_points);
2081
2082 feiv[variable].get_jump_in_function_hessians_from_local_dof_values(
2083 independent_local_dofs, ret);
2084 return ret;
2085 }
2086
2087
2088
2089 template <int dim, int spacedim>
2090 template <typename Extractor, typename Number>
2091 const std::vector<typename FEInterfaceViews::View<dim, spacedim, Extractor>::
2092 template solution_third_derivative_type<Number>> &
2094 const std::string &global_vector_name,
2095 const Extractor &variable,
2096 const Number dummy)
2097 {
2098 const std::vector<Number> &independent_local_dofs =
2099 get_local_dof_values(global_vector_name, dummy);
2100
2102 get_current_interface_fe_values();
2103
2104 AssertDimension(independent_local_dofs.size(),
2106
2107 const unsigned int n_q_points = feiv.n_quadrature_points;
2108
2109 const std::string name = get_unique_name(global_vector_name,
2110 variable,
2111 "_jump_third_derivatives_q",
2112 n_q_points,
2113 dummy);
2114
2115 // Now build the return type
2116 using RetType =
2117 std::vector<typename FEValuesViews::View<dim, spacedim, Extractor>::
2118 template solution_third_derivative_type<Number>>;
2119
2120 RetType &ret =
2121 internal_data_storage.template get_or_add_object_with_name<RetType>(
2122 name, n_q_points);
2123
2124 AssertDimension(ret.size(), n_q_points);
2125
2126 feiv[variable].get_jump_in_function_third_derivatives_from_local_dof_values(
2127 independent_local_dofs, ret);
2128 return ret;
2129 }
2130
2131
2132
2133 template <int dim, int spacedim>
2134 template <typename Extractor, typename Number>
2135 const std::vector<typename FEInterfaceViews::View<dim, spacedim, Extractor>::
2136 template solution_value_type<Number>> &
2138 const std::string &global_vector_name,
2139 const Extractor &variable,
2140 const Number dummy)
2141 {
2142 const std::vector<Number> &independent_local_dofs =
2143 get_local_dof_values(global_vector_name, dummy);
2144
2146 get_current_interface_fe_values();
2147
2148 AssertDimension(independent_local_dofs.size(),
2150
2151 const unsigned int n_q_points = feiv.n_quadrature_points;
2152
2153 const std::string name = get_unique_name(
2154 global_vector_name, variable, "_average_values_q", n_q_points, dummy);
2155
2156 // Now build the return type
2157 using RetType =
2158 std::vector<typename FEValuesViews::View<dim, spacedim, Extractor>::
2159 template solution_value_type<Number>>;
2160
2161 RetType &ret =
2162 internal_data_storage.template get_or_add_object_with_name<RetType>(
2163 name, n_q_points);
2164
2165 AssertDimension(ret.size(), n_q_points);
2166
2167 feiv[variable].get_average_of_function_values_from_local_dof_values(
2168 independent_local_dofs, ret);
2169 return ret;
2170 }
2171
2172
2173
2174 template <int dim, int spacedim>
2175 template <typename Extractor, typename Number>
2176 const std::vector<typename FEInterfaceViews::View<dim, spacedim, Extractor>::
2177 template solution_gradient_type<Number>> &
2179 const std::string &global_vector_name,
2180 const Extractor &variable,
2181 const Number dummy)
2182 {
2183 const std::vector<Number> &independent_local_dofs =
2184 get_local_dof_values(global_vector_name, dummy);
2185
2187 get_current_interface_fe_values();
2188
2189 AssertDimension(independent_local_dofs.size(),
2191
2192 const unsigned int n_q_points = feiv.n_quadrature_points;
2193
2194 const std::string name = get_unique_name(
2195 global_vector_name, variable, "_average_gradients_q", n_q_points, dummy);
2196
2197 // Now build the return type
2198 using RetType =
2199 std::vector<typename FEValuesViews::View<dim, spacedim, Extractor>::
2200 template solution_gradient_type<Number>>;
2201
2202 RetType &ret =
2203 internal_data_storage.template get_or_add_object_with_name<RetType>(
2204 name, n_q_points);
2205
2206 AssertDimension(ret.size(), n_q_points);
2207
2208 feiv[variable].get_average_of_function_gradients_from_local_dof_values(
2209 independent_local_dofs, ret);
2210 return ret;
2211 }
2212
2213
2214
2215 template <int dim, int spacedim>
2216 template <typename Extractor, typename Number>
2217 const std::vector<typename FEInterfaceViews::View<dim, spacedim, Extractor>::
2218 template solution_hessian_type<Number>> &
2220 const std::string &global_vector_name,
2221 const Extractor &variable,
2222 const Number dummy)
2223 {
2224 const std::vector<Number> &independent_local_dofs =
2225 get_local_dof_values(global_vector_name, dummy);
2226
2228 get_current_interface_fe_values();
2229
2230 AssertDimension(independent_local_dofs.size(),
2232
2233 const unsigned int n_q_points = feiv.n_quadrature_points;
2234
2235 const std::string name = get_unique_name(
2236 global_vector_name, variable, "_average_hessians_q", n_q_points, dummy);
2237
2238 // Now build the return type
2239 using RetType =
2240 std::vector<typename FEValuesViews::View<dim, spacedim, Extractor>::
2241 template solution_hessian_type<Number>>;
2242
2243 RetType &ret =
2244 internal_data_storage.template get_or_add_object_with_name<RetType>(
2245 name, n_q_points);
2246
2247 AssertDimension(ret.size(), n_q_points);
2248
2249 feiv[variable].get_average_of_function_hessians_from_local_dof_values(
2250 independent_local_dofs, ret);
2251 return ret;
2252 }
2253
2254
2255#endif
2256
2257} // namespace MeshWorker
2258
2260
2261#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
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:502
#define DEAL_II_NAMESPACE_CLOSE
Definition config.h:503
#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