Reference documentation for deal.II version 9.5.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// Copyright (C) 2019 - 2022 by the deal.II authors
4//
5// This file is part of the deal.II library.
6//
7// The deal.II library is free software; you can use it, redistribute
8// it, and/or modify it under the terms of the GNU Lesser General
9// Public License as published by the Free Software Foundation; either
10// version 2.1 of the License, or (at your option) any later version.
11// The full text of the license can be found in the file LICENSE.md at
12// the top level directory of deal.II.
13//
14// ---------------------------------------------------------------------
15
16#ifndef dealii_meshworker_scratch_data_h
17#define dealii_meshworker_scratch_data_h
18
19#include <deal.II/base/config.h>
20
22
24
27
31
32#include <boost/any.hpp>
33
34#include <algorithm>
35#include <vector>
36
38
39namespace MeshWorker
40{
221 template <int dim, int spacedim = dim>
223 {
224 public:
247 const Quadrature<dim> & quadrature,
248 const UpdateFlags & update_flags,
251
271 const Quadrature<dim> & quadrature,
272 const UpdateFlags & update_flags,
273 const UpdateFlags & neighbor_update_flags,
277
292 const Quadrature<dim> & quadrature,
293 const UpdateFlags & update_flags,
296
313 const Quadrature<dim> & quadrature,
314 const UpdateFlags & update_flags,
315 const UpdateFlags & neighbor_update_flags,
319
346
372
391
414
419
433 reinit(
435
445 const unsigned int face_no);
446
459 const unsigned int face_no,
460 const unsigned int subface_no);
461
478 const unsigned int face_no,
480 & cell_neighbor,
481 const unsigned int face_no_neighbor);
482
499 const unsigned int face_no,
500 const unsigned int sub_face_no,
502 & cell_neighbor,
503 const unsigned int face_no_neighbor,
504 const unsigned int sub_face_no_neighbor);
505
517 get_current_fe_values() const;
518
524
528 const std::vector<Point<spacedim>> &
529 get_quadrature_points() const;
530
534 const std::vector<double> &
535 get_JxW_values() const;
536
540 const std::vector<Tensor<1, spacedim>> &
541 get_normal_vectors() const;
542
547 const std::vector<types::global_dof_index> &
548 get_local_dof_indices() const;
549
554 unsigned int
555 n_dofs_per_cell() const;
556 // CurrentCellMethods
558
574
585 const unsigned int face_no);
586
600 const unsigned int face_no,
601 const unsigned int subface_no);
602
616
620 const std::vector<double> &
622
626 const std::vector<Tensor<1, spacedim>> &
628
633 const std::vector<types::global_dof_index> &
635
640 unsigned int
642 // NeighborCellMethods
644 // hpCellMethods
649
668 & neighbor_cell,
669 const unsigned int face_no);
670
692 & neighbor_cell,
693 const unsigned int face_no,
694 const unsigned int subface_no);
695
715 & neighbor_cell,
716 const unsigned int face_no);
717
740 & neighbor_cell,
741 const unsigned int face_no,
742 const unsigned int subface_no);
743 // hpCellMethods
745
753
759 const GeneralDataStorage &
761
766 get_mapping() const;
767
772 get_fe() const;
773
777 const Quadrature<dim> &
778 get_cell_quadrature() const;
779
783 const Quadrature<dim - 1> &
784 get_face_quadrature() const;
785
791
796 get_fe_collection() const;
797
803
807 const hp::QCollection<dim - 1> &
809
814 bool
815 has_hp_capabilities() const;
816
821 get_cell_update_flags() const;
822
828
833 get_face_update_flags() const;
834
840 // CurrentCellEvaluation
845
875 template <typename VectorType, typename Number = double>
876 void
877 extract_local_dof_values(const std::string &global_vector_name,
878 const VectorType & input_vector,
879 const Number dummy = Number(0));
880
889 template <typename Number = double>
890 const std::vector<Number> &
891 get_local_dof_values(const std::string &global_vector_name,
892 Number dummy = Number(0)) const;
893
915 template <typename Extractor, typename Number = double>
916 const std::vector<typename FEValuesViews::View<dim, spacedim, Extractor>::
917 template solution_value_type<Number>> &
918 get_values(const std::string &global_vector_name,
919 const Extractor & variable,
920 const Number dummy = Number(0));
921
943 template <typename Extractor, typename Number = double>
944 const std::vector<typename FEValuesViews::View<dim, spacedim, Extractor>::
945 template solution_gradient_type<Number>> &
946 get_gradients(const std::string &global_vector_name,
947 const Extractor & variable,
948 const Number dummy = Number(0));
949
972 template <typename Extractor, typename Number = double>
973 const std::vector<typename FEValuesViews::View<dim, spacedim, Extractor>::
974 template solution_symmetric_gradient_type<Number>> &
975 get_symmetric_gradients(const std::string &global_vector_name,
976 const Extractor & variable,
977 const Number dummy = Number(0));
978
1000 template <typename Extractor, typename Number = double>
1001 const std::vector<typename FEValuesViews::View<dim, spacedim, Extractor>::
1002 template solution_divergence_type<Number>> &
1003 get_divergences(const std::string &global_vector_name,
1004 const Extractor & variable,
1005 const Number dummy = Number(0));
1006
1028 template <typename Extractor, typename Number = double>
1029 const std::vector<typename FEValuesViews::View<dim, spacedim, Extractor>::
1030 template solution_curl_type<Number>> &
1031 get_curls(const std::string &global_vector_name,
1032 const Extractor & variable,
1033 const Number dummy = Number(0));
1034
1056 template <typename Extractor, typename Number = double>
1057 const std::vector<typename FEValuesViews::View<dim, spacedim, Extractor>::
1058 template solution_hessian_type<Number>> &
1059 get_hessians(const std::string &global_vector_name,
1060 const Extractor & variable,
1061 const Number dummy = Number(0));
1062
1084 template <typename Extractor, typename Number = double>
1085 const std::vector<typename FEValuesViews::View<dim, spacedim, Extractor>::
1086 template solution_laplacian_type<Number>> &
1087 get_laplacians(const std::string &global_vector_name,
1088 const Extractor & variable,
1089 const Number dummy = Number(0));
1090
1112 template <typename Extractor, typename Number = double>
1113 const std::vector<typename FEValuesViews::View<dim, spacedim, Extractor>::
1114 template solution_third_derivative_type<Number>> &
1115 get_third_derivatives(const std::string &global_vector_name,
1116 const Extractor & variable,
1117 const Number dummy = Number(0));
1118 // CurrentCellEvaluation
1120 // CurrentInterfaceJumpEvaluation
1125
1148 template <typename Extractor, typename Number = double>
1149 const std::vector<
1151 template solution_value_type<Number>> &
1152 get_jumps_in_values(const std::string &global_vector_name,
1153 const Extractor & variable,
1154 const Number dummy = Number(0));
1155
1178 template <typename Extractor, typename Number = double>
1179 const std::vector<
1181 template solution_gradient_type<Number>> &
1182 get_jumps_in_gradients(const std::string &global_vector_name,
1183 const Extractor & variable,
1184 const Number dummy = Number(0));
1185
1208 template <typename Extractor, typename Number = double>
1209 const std::vector<
1211 template solution_hessian_type<Number>> &
1212 get_jumps_in_hessians(const std::string &global_vector_name,
1213 const Extractor & variable,
1214 const Number dummy = Number(0));
1215
1238 template <typename Extractor, typename Number = double>
1239 const std::vector<
1241 template solution_third_derivative_type<Number>> &
1242 get_jumps_in_third_derivatives(const std::string &global_vector_name,
1243 const Extractor & variable,
1244 const Number dummy = Number(0));
1245 // CurrentInterfaceJumpEvaluation
1247 // CurrentInterfaceAverageEvaluation
1252
1275 template <typename Extractor, typename Number = double>
1276 const std::vector<
1278 template solution_value_type<Number>> &
1279 get_averages_of_values(const std::string &global_vector_name,
1280 const Extractor & variable,
1281 const Number dummy = Number(0));
1282
1305 template <typename Extractor, typename Number = double>
1306 const std::vector<
1308 template solution_gradient_type<Number>> &
1309 get_averages_of_gradients(const std::string &global_vector_name,
1310 const Extractor & variable,
1311 const Number dummy = Number(0));
1312
1335 template <typename Extractor, typename Number = double>
1336 const std::vector<
1338 template solution_hessian_type<Number>> &
1339 get_averages_of_hessians(const std::string &global_vector_name,
1340 const Extractor & variable,
1341 const Number dummy = Number(0));
1342 // CurrentInterfaceAverageEvaluation
1344
1345 private:
1350 template <typename Extractor, typename Number = double>
1351 std::string
1352 get_unique_name(const std::string &global_vector_name,
1353 const Extractor & variable,
1354 const std::string &object_type,
1355 const unsigned int size,
1356 const Number & exemplar_number) const;
1357
1361 template <typename Number = double>
1362 std::string
1363 get_unique_dofs_name(const std::string &global_vector_name,
1364 const unsigned int size,
1365 const Number & exemplar_number) const;
1366 // non-hp data
1371
1377
1383
1389
1395
1399 std::unique_ptr<FEValues<dim, spacedim>> fe_values;
1400
1404 std::unique_ptr<FEFaceValues<dim, spacedim>> fe_face_values;
1405
1409 std::unique_ptr<FESubfaceValues<dim, spacedim>> fe_subface_values;
1410
1414 std::unique_ptr<FEValues<dim, spacedim>> neighbor_fe_values;
1415
1419 std::unique_ptr<FEFaceValues<dim, spacedim>> neighbor_fe_face_values;
1420
1424 std::unique_ptr<FESubfaceValues<dim, spacedim>> neighbor_fe_subface_values;
1425
1429 // The FEInterfaceValues class supports initialization with hp objects
1430 // as well.
1431 std::unique_ptr<FEInterfaceValues<dim, spacedim>> interface_fe_values;
1432 // non-hp data
1434 // hp data
1439
1445
1451
1457
1463
1469
1473 std::unique_ptr<hp::FEValues<dim, spacedim>> hp_fe_values;
1474
1478 std::unique_ptr<hp::FEFaceValues<dim, spacedim>> hp_fe_face_values;
1479
1483 std::unique_ptr<hp::FESubfaceValues<dim, spacedim>> hp_fe_subface_values;
1484
1488 std::unique_ptr<hp::FEValues<dim, spacedim>> neighbor_hp_fe_values;
1489
1493 std::unique_ptr<hp::FEFaceValues<dim, spacedim>> neighbor_hp_fe_face_values;
1494
1498 std::unique_ptr<hp::FESubfaceValues<dim, spacedim>>
1500
1508 "The current function doesn't make sense when used with a "
1509 "ScratchData object with hp-capabilities.");
1510
1518 "The current function doesn't make sense when used with a "
1519 "ScratchData object without hp-capabilities.");
1520 // hp data
1522
1527
1532
1538
1544
1548 std::vector<types::global_dof_index> local_dof_indices;
1549
1553 std::vector<types::global_dof_index> neighbor_dof_indices;
1554
1559
1564
1570
1576 };
1577
1578#ifndef DOXYGEN
1579 template <int dim, int spacedim>
1580 template <typename Extractor, typename Number>
1581 std::string
1583 const std::string &global_vector_name,
1584 const Extractor & variable,
1585 const std::string &object_type,
1586 const unsigned int size,
1587 const Number & exemplar_number) const
1588 {
1589 return global_vector_name + "_" + variable.get_name() + "_" + object_type +
1590 "_" + Utilities::int_to_string(size) + "_" +
1591 Utilities::type_to_string(exemplar_number);
1592 }
1593
1594
1595
1596 template <int dim, int spacedim>
1597 template <typename Number>
1598 std::string
1600 const std::string &global_vector_name,
1601 const unsigned int size,
1602 const Number & exemplar_number) const
1603 {
1604 return global_vector_name + "_independent_local_dofs_" +
1605 Utilities::int_to_string(size) + "_" +
1606 Utilities::type_to_string(exemplar_number);
1607 }
1608
1609
1610
1611 template <int dim, int spacedim>
1612 template <typename VectorType, typename Number>
1613 void
1615 const std::string &global_vector_name,
1616 const VectorType & input_vector,
1617 const Number dummy)
1618 {
1619 const unsigned int n_dofs = local_dof_indices.size();
1620
1621 const std::string name =
1622 get_unique_dofs_name(global_vector_name, n_dofs, dummy);
1623
1624 auto &independent_local_dofs =
1625 internal_data_storage
1626 .template get_or_add_object_with_name<std::vector<Number>>(name,
1627 n_dofs);
1628
1629 AssertDimension(independent_local_dofs.size(), n_dofs);
1630
1632 for (unsigned int i = 0; i < n_dofs; ++i)
1634 input_vector(local_dof_indices[i]),
1635 i,
1636 n_dofs,
1637 independent_local_dofs[i]);
1638 else
1639 for (unsigned int i = 0; i < n_dofs; ++i)
1640 independent_local_dofs[i] = input_vector(local_dof_indices[i]);
1641 }
1642
1643
1644
1645 template <int dim, int spacedim>
1646 template <typename Number>
1647 const std::vector<Number> &
1649 const std::string &global_vector_name,
1650 Number dummy) const
1651 {
1652 const unsigned int n_dofs = local_dof_indices.size();
1653
1654 const std::string dofs_name =
1655 get_unique_dofs_name(global_vector_name, n_dofs, dummy);
1656
1657 Assert(
1658 internal_data_storage.stores_object_with_name(dofs_name),
1659 ExcMessage(
1660 "You did not call yet extract_local_dof_values with the right types!"));
1661
1662 return internal_data_storage
1663 .template get_object_with_name<std::vector<Number>>(dofs_name);
1664 }
1665
1666
1667
1668 template <int dim, int spacedim>
1669 template <typename Extractor, typename Number>
1670 const std::vector<typename FEValuesViews::View<dim, spacedim, Extractor>::
1671 template solution_value_type<Number>> &
1672 ScratchData<dim, spacedim>::get_values(const std::string &global_vector_name,
1673 const Extractor & variable,
1674 const Number dummy)
1675 {
1676 const std::vector<Number> &independent_local_dofs =
1677 get_local_dof_values(global_vector_name, dummy);
1678
1679 const FEValuesBase<dim, spacedim> &fev = get_current_fe_values();
1680
1681 const unsigned int n_q_points = fev.n_quadrature_points;
1682
1683 const std::string name = get_unique_name(
1684 global_vector_name, variable, "_values_q", n_q_points, dummy);
1685
1686 // Now build the return type
1687 using RetType =
1688 std::vector<typename FEValuesViews::View<dim, spacedim, Extractor>::
1689 template solution_value_type<Number>>;
1690
1691 RetType &ret =
1692 internal_data_storage.template get_or_add_object_with_name<RetType>(
1693 name, n_q_points);
1694
1695 AssertDimension(ret.size(), n_q_points);
1696
1697 fev[variable].get_function_values_from_local_dof_values(
1698 independent_local_dofs, ret);
1699 return ret;
1700 }
1701
1702
1703
1704 template <int dim, int spacedim>
1705 template <typename Extractor, typename Number>
1706 const std::vector<typename FEValuesViews::View<dim, spacedim, Extractor>::
1707 template solution_gradient_type<Number>> &
1709 const std::string &global_vector_name,
1710 const Extractor & variable,
1711 const Number dummy)
1712 {
1713 const std::vector<Number> &independent_local_dofs =
1714 get_local_dof_values(global_vector_name, dummy);
1715
1716 const FEValuesBase<dim, spacedim> &fev = get_current_fe_values();
1717
1718 const unsigned int n_q_points = fev.n_quadrature_points;
1719
1720 const std::string name = get_unique_name(
1721 global_vector_name, variable, "_gradients_q", n_q_points, dummy);
1722
1723 // Now build the return type
1724 using RetType =
1725 std::vector<typename FEValuesViews::View<dim, spacedim, Extractor>::
1726 template solution_gradient_type<Number>>;
1727
1728 RetType &ret =
1729 internal_data_storage.template get_or_add_object_with_name<RetType>(
1730 name, n_q_points);
1731
1732 AssertDimension(ret.size(), n_q_points);
1733
1734 fev[variable].get_function_gradients_from_local_dof_values(
1735 independent_local_dofs, ret);
1736 return ret;
1737 }
1738
1739
1740
1741 template <int dim, int spacedim>
1742 template <typename Extractor, typename Number>
1743 const std::vector<typename FEValuesViews::View<dim, spacedim, Extractor>::
1744 template solution_hessian_type<Number>> &
1746 const std::string &global_vector_name,
1747 const Extractor & variable,
1748 const Number dummy)
1749 {
1750 const std::vector<Number> &independent_local_dofs =
1751 get_local_dof_values(global_vector_name, dummy);
1752
1753 const FEValuesBase<dim, spacedim> &fev = get_current_fe_values();
1754
1755 const unsigned int n_q_points = fev.n_quadrature_points;
1756
1757 const std::string name = get_unique_name(
1758 global_vector_name, variable, "_hessians_q", n_q_points, dummy);
1759
1760 // Now build the return type
1761 using RetType =
1762 std::vector<typename FEValuesViews::View<dim, spacedim, Extractor>::
1763 template solution_hessian_type<Number>>;
1764
1765 RetType &ret =
1766 internal_data_storage.template get_or_add_object_with_name<RetType>(
1767 name, n_q_points);
1768
1769
1770 AssertDimension(ret.size(), n_q_points);
1771
1772 fev[variable].get_function_hessians_from_local_dof_values(
1773 independent_local_dofs, ret);
1774 return ret;
1775 }
1776
1777
1778
1779 template <int dim, int spacedim>
1780 template <typename Extractor, typename Number>
1781 const std::vector<typename FEValuesViews::View<dim, spacedim, Extractor>::
1782 template solution_laplacian_type<Number>> &
1784 const std::string &global_vector_name,
1785 const Extractor & variable,
1786 const Number dummy)
1787 {
1788 const std::vector<Number> &independent_local_dofs =
1789 get_local_dof_values(global_vector_name, dummy);
1790
1791 const FEValuesBase<dim, spacedim> &fev = get_current_fe_values();
1792
1793 const unsigned int n_q_points = fev.n_quadrature_points;
1794
1795 const std::string name = get_unique_name(
1796 global_vector_name, variable, "_laplacians_q", n_q_points, dummy);
1797
1798 // Now build the return type
1799 using RetType =
1800 std::vector<typename FEValuesViews::View<dim, spacedim, Extractor>::
1801 template solution_laplacian_type<Number>>;
1802
1803 RetType &ret =
1804 internal_data_storage.template get_or_add_object_with_name<RetType>(
1805 name, n_q_points);
1806
1807
1808 AssertDimension(ret.size(), n_q_points);
1809
1810 fev[variable].get_function_laplacians_from_local_dof_values(
1811 independent_local_dofs, ret);
1812 return ret;
1813 }
1814
1815
1816
1817 template <int dim, int spacedim>
1818 template <typename Extractor, typename Number>
1819 const std::vector<typename FEValuesViews::View<dim, spacedim, Extractor>::
1820 template solution_third_derivative_type<Number>> &
1822 const std::string &global_vector_name,
1823 const Extractor & variable,
1824 const Number dummy)
1825 {
1826 const std::vector<Number> &independent_local_dofs =
1827 get_local_dof_values(global_vector_name, dummy);
1828
1829 const FEValuesBase<dim, spacedim> &fev = get_current_fe_values();
1830
1831 const unsigned int n_q_points = fev.n_quadrature_points;
1832
1833 const std::string name = get_unique_name(
1834 global_vector_name, variable, "_third_derivatives_q", n_q_points, dummy);
1835
1836 // Now build the return type
1837 using RetType =
1838 std::vector<typename FEValuesViews::View<dim, spacedim, Extractor>::
1839 template solution_third_derivative_type<Number>>;
1840
1841 RetType &ret =
1842 internal_data_storage.template get_or_add_object_with_name<RetType>(
1843 name, n_q_points);
1844
1845
1846 AssertDimension(ret.size(), n_q_points);
1847
1848 fev[variable].get_function_third_derivatives_from_local_dof_values(
1849 independent_local_dofs, ret);
1850 return ret;
1851 }
1852
1853
1854
1855 template <int dim, int spacedim>
1856 template <typename Extractor, typename Number>
1857 const std::vector<typename FEValuesViews::View<dim, spacedim, Extractor>::
1858 template solution_symmetric_gradient_type<Number>> &
1860 const std::string &global_vector_name,
1861 const Extractor & variable,
1862 const Number dummy)
1863 {
1864 const std::vector<Number> &independent_local_dofs =
1865 get_local_dof_values(global_vector_name, dummy);
1866
1867 const FEValuesBase<dim, spacedim> &fev = get_current_fe_values();
1868
1869 const unsigned int n_q_points = fev.n_quadrature_points;
1870
1871 const std::string name = get_unique_name(
1872 global_vector_name, variable, "_symmetric_gradient_q", n_q_points, dummy);
1873
1874
1875 // Now build the return type
1876 using RetType =
1877 std::vector<typename FEValuesViews::View<dim, spacedim, Extractor>::
1878 template solution_symmetric_gradient_type<Number>>;
1879
1880 RetType &ret =
1881 internal_data_storage.template get_or_add_object_with_name<RetType>(
1882 name, n_q_points);
1883
1884
1885 AssertDimension(ret.size(), n_q_points);
1886
1887 fev[variable].get_function_symmetric_gradients_from_local_dof_values(
1888 independent_local_dofs, ret);
1889 return ret;
1890 }
1891
1892
1893 template <int dim, int spacedim>
1894 template <typename Extractor, typename Number>
1895 const std::vector<typename FEValuesViews::View<dim, spacedim, Extractor>::
1896 template solution_divergence_type<Number>> &
1898 const std::string &global_vector_name,
1899 const Extractor & variable,
1900 const Number dummy)
1901 {
1902 const std::vector<Number> &independent_local_dofs =
1903 get_local_dof_values(global_vector_name, dummy);
1904
1905 const FEValuesBase<dim, spacedim> &fev = get_current_fe_values();
1906
1907 const unsigned int n_q_points = fev.n_quadrature_points;
1908
1909 const std::string name = get_unique_name(
1910 global_vector_name, variable, "_divergence_q", n_q_points, dummy);
1911
1912 // Now build the return type
1913 using RetType =
1914 std::vector<typename FEValuesViews::View<dim, spacedim, Extractor>::
1915 template solution_divergence_type<Number>>;
1916
1917 RetType &ret =
1918 internal_data_storage.template get_or_add_object_with_name<RetType>(
1919 name, n_q_points);
1920
1921
1922 AssertDimension(ret.size(), n_q_points);
1923
1924 fev[variable].get_function_divergences_from_local_dof_values(
1925 independent_local_dofs, ret);
1926 return ret;
1927 }
1928
1929
1930
1931 template <int dim, int spacedim>
1932 template <typename Extractor, typename Number>
1933 const std::vector<typename FEValuesViews::View<dim, spacedim, Extractor>::
1934 template solution_curl_type<Number>> &
1935 ScratchData<dim, spacedim>::get_curls(const std::string &global_vector_name,
1936 const Extractor & variable,
1937 const Number dummy)
1938 {
1939 const std::vector<Number> &independent_local_dofs =
1940 get_local_dof_values(global_vector_name, dummy);
1941
1942 const FEValuesBase<dim, spacedim> &fev = get_current_fe_values();
1943
1944 const unsigned int n_q_points = fev.n_quadrature_points;
1945
1946 const std::string name = get_unique_name(
1947 global_vector_name, variable, "_curl_q", n_q_points, dummy);
1948
1949 // Now build the return type
1950 using RetType =
1951 std::vector<typename FEValuesViews::View<dim, spacedim, Extractor>::
1952 template solution_curl_type<Number>>;
1953
1954 RetType &ret =
1955 internal_data_storage.template get_or_add_object_with_name<RetType>(
1956 name, n_q_points);
1957
1958 AssertDimension(ret.size(), n_q_points);
1959
1960 fev[variable].get_function_curls_from_local_dof_values(
1961 independent_local_dofs, ret);
1962 return ret;
1963 }
1964
1965
1966
1967 template <int dim, int spacedim>
1968 template <typename Extractor, typename Number>
1969 const std::vector<typename FEInterfaceViews::View<dim, spacedim, Extractor>::
1970 template solution_value_type<Number>> &
1972 const std::string &global_vector_name,
1973 const Extractor & variable,
1974 const Number dummy)
1975 {
1976 const std::vector<Number> &independent_local_dofs =
1977 get_local_dof_values(global_vector_name, dummy);
1978
1980 get_current_interface_fe_values();
1981
1982 AssertDimension(independent_local_dofs.size(),
1984
1985 const unsigned int n_q_points = feiv.n_quadrature_points;
1986
1987 const std::string name = get_unique_name(
1988 global_vector_name, variable, "_jump_values_q", n_q_points, dummy);
1989
1990 // Now build the return type
1991 using RetType =
1992 std::vector<typename FEValuesViews::View<dim, spacedim, Extractor>::
1993 template solution_value_type<Number>>;
1994
1995 RetType &ret =
1996 internal_data_storage.template get_or_add_object_with_name<RetType>(
1997 name, n_q_points);
1998
1999 AssertDimension(ret.size(), n_q_points);
2000
2001 feiv[variable].get_jump_in_function_values_from_local_dof_values(
2002 independent_local_dofs, ret);
2003 return ret;
2004 }
2005
2006
2007
2008 template <int dim, int spacedim>
2009 template <typename Extractor, typename Number>
2010 const std::vector<typename FEInterfaceViews::View<dim, spacedim, Extractor>::
2011 template solution_gradient_type<Number>> &
2013 const std::string &global_vector_name,
2014 const Extractor & variable,
2015 const Number dummy)
2016 {
2017 const std::vector<Number> &independent_local_dofs =
2018 get_local_dof_values(global_vector_name, dummy);
2019
2021 get_current_interface_fe_values();
2022
2023 AssertDimension(independent_local_dofs.size(),
2025
2026 const unsigned int n_q_points = feiv.n_quadrature_points;
2027
2028 const std::string name = get_unique_name(
2029 global_vector_name, variable, "_jump_gradients_q", n_q_points, dummy);
2030
2031 // Now build the return type
2032 using RetType =
2033 std::vector<typename FEValuesViews::View<dim, spacedim, Extractor>::
2034 template solution_gradient_type<Number>>;
2035
2036 RetType &ret =
2037 internal_data_storage.template get_or_add_object_with_name<RetType>(
2038 name, n_q_points);
2039
2040 AssertDimension(ret.size(), n_q_points);
2041
2042 feiv[variable].get_jump_in_function_gradients_from_local_dof_values(
2043 independent_local_dofs, ret);
2044 return ret;
2045 }
2046
2047
2048
2049 template <int dim, int spacedim>
2050 template <typename Extractor, typename Number>
2051 const std::vector<typename FEInterfaceViews::View<dim, spacedim, Extractor>::
2052 template solution_hessian_type<Number>> &
2054 const std::string &global_vector_name,
2055 const Extractor & variable,
2056 const Number dummy)
2057 {
2058 const std::vector<Number> &independent_local_dofs =
2059 get_local_dof_values(global_vector_name, dummy);
2060
2062 get_current_interface_fe_values();
2063
2064 AssertDimension(independent_local_dofs.size(),
2066
2067 const unsigned int n_q_points = feiv.n_quadrature_points;
2068
2069 const std::string name = get_unique_name(
2070 global_vector_name, variable, "_jump_hessians_q", n_q_points, dummy);
2071
2072 // Now build the return type
2073 using RetType =
2074 std::vector<typename FEValuesViews::View<dim, spacedim, Extractor>::
2075 template solution_hessian_type<Number>>;
2076
2077 RetType &ret =
2078 internal_data_storage.template get_or_add_object_with_name<RetType>(
2079 name, n_q_points);
2080
2081 AssertDimension(ret.size(), n_q_points);
2082
2083 feiv[variable].get_jump_in_function_hessians_from_local_dof_values(
2084 independent_local_dofs, ret);
2085 return ret;
2086 }
2087
2088
2089
2090 template <int dim, int spacedim>
2091 template <typename Extractor, typename Number>
2092 const std::vector<typename FEInterfaceViews::View<dim, spacedim, Extractor>::
2093 template solution_third_derivative_type<Number>> &
2095 const std::string &global_vector_name,
2096 const Extractor & variable,
2097 const Number dummy)
2098 {
2099 const std::vector<Number> &independent_local_dofs =
2100 get_local_dof_values(global_vector_name, dummy);
2101
2103 get_current_interface_fe_values();
2104
2105 AssertDimension(independent_local_dofs.size(),
2107
2108 const unsigned int n_q_points = feiv.n_quadrature_points;
2109
2110 const std::string name = get_unique_name(global_vector_name,
2111 variable,
2112 "_jump_third_derivatives_q",
2113 n_q_points,
2114 dummy);
2115
2116 // Now build the return type
2117 using RetType =
2118 std::vector<typename FEValuesViews::View<dim, spacedim, Extractor>::
2119 template solution_third_derivative_type<Number>>;
2120
2121 RetType &ret =
2122 internal_data_storage.template get_or_add_object_with_name<RetType>(
2123 name, n_q_points);
2124
2125 AssertDimension(ret.size(), n_q_points);
2126
2127 feiv[variable].get_jump_in_function_third_derivatives_from_local_dof_values(
2128 independent_local_dofs, ret);
2129 return ret;
2130 }
2131
2132
2133
2134 template <int dim, int spacedim>
2135 template <typename Extractor, typename Number>
2136 const std::vector<typename FEInterfaceViews::View<dim, spacedim, Extractor>::
2137 template solution_value_type<Number>> &
2139 const std::string &global_vector_name,
2140 const Extractor & variable,
2141 const Number dummy)
2142 {
2143 const std::vector<Number> &independent_local_dofs =
2144 get_local_dof_values(global_vector_name, dummy);
2145
2147 get_current_interface_fe_values();
2148
2149 AssertDimension(independent_local_dofs.size(),
2151
2152 const unsigned int n_q_points = feiv.n_quadrature_points;
2153
2154 const std::string name = get_unique_name(
2155 global_vector_name, variable, "_average_values_q", n_q_points, dummy);
2156
2157 // Now build the return type
2158 using RetType =
2159 std::vector<typename FEValuesViews::View<dim, spacedim, Extractor>::
2160 template solution_value_type<Number>>;
2161
2162 RetType &ret =
2163 internal_data_storage.template get_or_add_object_with_name<RetType>(
2164 name, n_q_points);
2165
2166 AssertDimension(ret.size(), n_q_points);
2167
2168 feiv[variable].get_average_of_function_values_from_local_dof_values(
2169 independent_local_dofs, ret);
2170 return ret;
2171 }
2172
2173
2174
2175 template <int dim, int spacedim>
2176 template <typename Extractor, typename Number>
2177 const std::vector<typename FEInterfaceViews::View<dim, spacedim, Extractor>::
2178 template solution_gradient_type<Number>> &
2180 const std::string &global_vector_name,
2181 const Extractor & variable,
2182 const Number dummy)
2183 {
2184 const std::vector<Number> &independent_local_dofs =
2185 get_local_dof_values(global_vector_name, dummy);
2186
2188 get_current_interface_fe_values();
2189
2190 AssertDimension(independent_local_dofs.size(),
2192
2193 const unsigned int n_q_points = feiv.n_quadrature_points;
2194
2195 const std::string name = get_unique_name(
2196 global_vector_name, variable, "_average_gradients_q", n_q_points, dummy);
2197
2198 // Now build the return type
2199 using RetType =
2200 std::vector<typename FEValuesViews::View<dim, spacedim, Extractor>::
2201 template solution_gradient_type<Number>>;
2202
2203 RetType &ret =
2204 internal_data_storage.template get_or_add_object_with_name<RetType>(
2205 name, n_q_points);
2206
2207 AssertDimension(ret.size(), n_q_points);
2208
2209 feiv[variable].get_average_of_function_gradients_from_local_dof_values(
2210 independent_local_dofs, ret);
2211 return ret;
2212 }
2213
2214
2215
2216 template <int dim, int spacedim>
2217 template <typename Extractor, typename Number>
2218 const std::vector<typename FEInterfaceViews::View<dim, spacedim, Extractor>::
2219 template solution_hessian_type<Number>> &
2221 const std::string &global_vector_name,
2222 const Extractor & variable,
2223 const Number dummy)
2224 {
2225 const std::vector<Number> &independent_local_dofs =
2226 get_local_dof_values(global_vector_name, dummy);
2227
2229 get_current_interface_fe_values();
2230
2231 AssertDimension(independent_local_dofs.size(),
2233
2234 const unsigned int n_q_points = feiv.n_quadrature_points;
2235
2236 const std::string name = get_unique_name(
2237 global_vector_name, variable, "_average_hessians_q", n_q_points, dummy);
2238
2239 // Now build the return type
2240 using RetType =
2241 std::vector<typename FEValuesViews::View<dim, spacedim, Extractor>::
2242 template solution_hessian_type<Number>>;
2243
2244 RetType &ret =
2245 internal_data_storage.template get_or_add_object_with_name<RetType>(
2246 name, n_q_points);
2247
2248 AssertDimension(ret.size(), n_q_points);
2249
2250 feiv[variable].get_average_of_function_hessians_from_local_dof_values(
2251 independent_local_dofs, ret);
2252 return ret;
2253 }
2254
2255
2256#endif
2257
2258} // namespace MeshWorker
2259
2261
2262#endif
const unsigned int n_quadrature_points
unsigned n_current_interface_dofs() const
const unsigned int n_quadrature_points
Definition fe_values.h:2433
Abstract base class for mapping classes.
Definition mapping.h:317
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:472
#define DEAL_II_NAMESPACE_CLOSE
Definition config.h:473
#define Assert(cond, exc)
#define AssertDimension(dim1, dim2)
static ::ExceptionBase & ExcOnlyAvailableWithoutHP()
#define DeclExceptionMsg(Exception, defaulttext)
Definition exceptions.h:488
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:1007
std::string int_to_string(const unsigned int value, const unsigned int digits=numbers::invalid_unsigned_int)
Definition utilities.cc:471