deal.II version GIT relicensing-2165-gc91f007519 2024-11-20 01:40:00+00:00
\(\newcommand{\dealvcentcolon}{\mathrel{\mathop{:}}}\) \(\newcommand{\dealcoloneq}{\dealvcentcolon\mathrel{\mkern-1.2mu}=}\) \(\newcommand{\jump}[1]{\left[\!\left[ #1 \right]\!\right]}\) \(\newcommand{\average}[1]{\left\{\!\left\{ #1 \right\}\!\right\}}\)
Loading...
Searching...
No Matches
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
// 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
// NeighborCellMethods
631
// 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
// 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
// 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
// CurrentCellEvaluation
1107
// 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
// CurrentInterfaceJumpEvaluation
1234
// 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
// 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
// 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
// non-hp data
1421
// hp data
1426
1433
1439
1445
1451
1457
1461 std::unique_ptr<hp::FEValues<dim, spacedim>> hp_fe_values;
1462
1466 std::unique_ptr<hp::FEFaceValues<dim, spacedim>> hp_fe_face_values;
1467
1471 std::unique_ptr<hp::FESubfaceValues<dim, spacedim>> hp_fe_subface_values;
1472
1476 std::unique_ptr<hp::FEValues<dim, spacedim>> neighbor_hp_fe_values;
1477
1481 std::unique_ptr<hp::FEFaceValues<dim, spacedim>> neighbor_hp_fe_face_values;
1482
1486 std::unique_ptr<hp::FESubfaceValues<dim, spacedim>>
1488
1496 "The current function doesn't make sense when used with a "
1497 "ScratchData object with hp-capabilities.");
1498
1506 "The current function doesn't make sense when used with a "
1507 "ScratchData object without hp-capabilities.");
1508
// hp data
1510
1515
1520
1526
1532
1536 std::vector<types::global_dof_index> local_dof_indices;
1537
1541 std::vector<types::global_dof_index> neighbor_dof_indices;
1542
1547
1552
1558
1565 };
1566
1567#ifndef DOXYGEN
1568 template <int dim, int spacedim>
1569 template <typename Extractor, typename Number>
1570 std::string
1572 const std::string &global_vector_name,
1573 const Extractor &variable,
1574 const std::string &object_type,
1575 const unsigned int size,
1576 const Number &exemplar_number) const
1577 {
1578 return global_vector_name + "_" + variable.get_name() + "_" + object_type +
1579 "_" + Utilities::int_to_string(size) + "_" +
1580 Utilities::type_to_string(exemplar_number);
1581 }
1582
1583
1584
1585 template <int dim, int spacedim>
1586 template <typename Number>
1587 std::string
1589 const std::string &global_vector_name,
1590 const unsigned int size,
1591 const Number &exemplar_number) const
1592 {
1593 return global_vector_name + "_independent_local_dofs_" +
1595 Utilities::type_to_string(exemplar_number);
1596 }
1597
1598
1599
1600 template <int dim, int spacedim>
1601 template <typename VectorType, typename Number>
1602 void
1604 const std::string &global_vector_name,
1605 const VectorType &input_vector,
1606 const Number dummy)
1607 {
1608 const unsigned int n_dofs = local_dof_indices.size();
1609
1610 const std::string name =
1611 get_unique_dofs_name(global_vector_name, n_dofs, dummy);
1612
1613 auto &independent_local_dofs =
1614 internal_data_storage
1615 .template get_or_add_object_with_name<std::vector<Number>>(name,
1616 n_dofs);
1617
1618 AssertDimension(independent_local_dofs.size(), n_dofs);
1619
1621 for (unsigned int i = 0; i < n_dofs; ++i)
1623 input_vector(local_dof_indices[i]),
1624 i,
1625 n_dofs,
1626 independent_local_dofs[i]);
1627 else
1628 for (unsigned int i = 0; i < n_dofs; ++i)
1629 independent_local_dofs[i] = input_vector(local_dof_indices[i]);
1630 }
1631
1632
1633
1634 template <int dim, int spacedim>
1635 template <typename Number>
1636 const std::vector<Number> &
1638 const std::string &global_vector_name,
1639 Number dummy) const
1640 {
1641 const unsigned int n_dofs = local_dof_indices.size();
1642
1643 const std::string dofs_name =
1644 get_unique_dofs_name(global_vector_name, n_dofs, dummy);
1645
1646 Assert(
1647 internal_data_storage.stores_object_with_name(dofs_name),
1648 ExcMessage(
1649 "You did not call yet extract_local_dof_values with the right types!"));
1650
1651 return internal_data_storage
1652 .template get_object_with_name<std::vector<Number>>(dofs_name);
1653 }
1654
1655
1656
1657 template <int dim, int spacedim>
1658 template <typename Extractor, typename Number>
1659 const std::vector<typename FEValuesViews::View<dim, spacedim, Extractor>::
1660 template solution_value_type<Number>> &
1661 ScratchData<dim, spacedim>::get_values(const std::string &global_vector_name,
1662 const Extractor &variable,
1663 const Number dummy)
1664 {
1665 const std::vector<Number> &independent_local_dofs =
1666 get_local_dof_values(global_vector_name, dummy);
1667
1668 const FEValuesBase<dim, spacedim> &fev = get_current_fe_values();
1669
1670 const unsigned int n_q_points = fev.n_quadrature_points;
1671
1672 const std::string name = get_unique_name(
1673 global_vector_name, variable, "_values_q", n_q_points, dummy);
1674
1675 // Now build the return type
1676 using RetType =
1677 std::vector<typename FEValuesViews::View<dim, spacedim, Extractor>::
1678 template solution_value_type<Number>>;
1679
1680 RetType &ret =
1681 internal_data_storage.template get_or_add_object_with_name<RetType>(
1682 name, n_q_points);
1683
1684 AssertDimension(ret.size(), n_q_points);
1685
1686 fev[variable].get_function_values_from_local_dof_values(
1687 independent_local_dofs, ret);
1688 return ret;
1689 }
1690
1691
1692
1693 template <int dim, int spacedim>
1694 template <typename Extractor, typename Number>
1695 const std::vector<typename FEValuesViews::View<dim, spacedim, Extractor>::
1696 template solution_gradient_type<Number>> &
1698 const std::string &global_vector_name,
1699 const Extractor &variable,
1700 const Number dummy)
1701 {
1702 const std::vector<Number> &independent_local_dofs =
1703 get_local_dof_values(global_vector_name, dummy);
1704
1705 const FEValuesBase<dim, spacedim> &fev = get_current_fe_values();
1706
1707 const unsigned int n_q_points = fev.n_quadrature_points;
1708
1709 const std::string name = get_unique_name(
1710 global_vector_name, variable, "_gradients_q", n_q_points, dummy);
1711
1712 // Now build the return type
1713 using RetType =
1714 std::vector<typename FEValuesViews::View<dim, spacedim, Extractor>::
1715 template solution_gradient_type<Number>>;
1716
1717 RetType &ret =
1718 internal_data_storage.template get_or_add_object_with_name<RetType>(
1719 name, n_q_points);
1720
1721 AssertDimension(ret.size(), n_q_points);
1722
1723 fev[variable].get_function_gradients_from_local_dof_values(
1724 independent_local_dofs, ret);
1725 return ret;
1726 }
1727
1728
1729
1730 template <int dim, int spacedim>
1731 template <typename Extractor, typename Number>
1732 const std::vector<typename FEValuesViews::View<dim, spacedim, Extractor>::
1733 template solution_hessian_type<Number>> &
1735 const std::string &global_vector_name,
1736 const Extractor &variable,
1737 const Number dummy)
1738 {
1739 const std::vector<Number> &independent_local_dofs =
1740 get_local_dof_values(global_vector_name, dummy);
1741
1742 const FEValuesBase<dim, spacedim> &fev = get_current_fe_values();
1743
1744 const unsigned int n_q_points = fev.n_quadrature_points;
1745
1746 const std::string name = get_unique_name(
1747 global_vector_name, variable, "_hessians_q", n_q_points, dummy);
1748
1749 // Now build the return type
1750 using RetType =
1751 std::vector<typename FEValuesViews::View<dim, spacedim, Extractor>::
1752 template solution_hessian_type<Number>>;
1753
1754 RetType &ret =
1755 internal_data_storage.template get_or_add_object_with_name<RetType>(
1756 name, n_q_points);
1757
1758
1759 AssertDimension(ret.size(), n_q_points);
1760
1761 fev[variable].get_function_hessians_from_local_dof_values(
1762 independent_local_dofs, ret);
1763 return ret;
1764 }
1765
1766
1767
1768 template <int dim, int spacedim>
1769 template <typename Extractor, typename Number>
1770 const std::vector<typename FEValuesViews::View<dim, spacedim, Extractor>::
1771 template solution_laplacian_type<Number>> &
1773 const std::string &global_vector_name,
1774 const Extractor &variable,
1775 const Number dummy)
1776 {
1777 const std::vector<Number> &independent_local_dofs =
1778 get_local_dof_values(global_vector_name, dummy);
1779
1780 const FEValuesBase<dim, spacedim> &fev = get_current_fe_values();
1781
1782 const unsigned int n_q_points = fev.n_quadrature_points;
1783
1784 const std::string name = get_unique_name(
1785 global_vector_name, variable, "_laplacians_q", n_q_points, dummy);
1786
1787 // Now build the return type
1788 using RetType =
1789 std::vector<typename FEValuesViews::View<dim, spacedim, Extractor>::
1790 template solution_laplacian_type<Number>>;
1791
1792 RetType &ret =
1793 internal_data_storage.template get_or_add_object_with_name<RetType>(
1794 name, n_q_points);
1795
1796
1797 AssertDimension(ret.size(), n_q_points);
1798
1799 fev[variable].get_function_laplacians_from_local_dof_values(
1800 independent_local_dofs, ret);
1801 return ret;
1802 }
1803
1804
1805
1806 template <int dim, int spacedim>
1807 template <typename Extractor, typename Number>
1808 const std::vector<typename FEValuesViews::View<dim, spacedim, Extractor>::
1809 template solution_third_derivative_type<Number>> &
1811 const std::string &global_vector_name,
1812 const Extractor &variable,
1813 const Number dummy)
1814 {
1815 const std::vector<Number> &independent_local_dofs =
1816 get_local_dof_values(global_vector_name, dummy);
1817
1818 const FEValuesBase<dim, spacedim> &fev = get_current_fe_values();
1819
1820 const unsigned int n_q_points = fev.n_quadrature_points;
1821
1822 const std::string name = get_unique_name(
1823 global_vector_name, variable, "_third_derivatives_q", n_q_points, dummy);
1824
1825 // Now build the return type
1826 using RetType =
1827 std::vector<typename FEValuesViews::View<dim, spacedim, Extractor>::
1828 template solution_third_derivative_type<Number>>;
1829
1830 RetType &ret =
1831 internal_data_storage.template get_or_add_object_with_name<RetType>(
1832 name, n_q_points);
1833
1834
1835 AssertDimension(ret.size(), n_q_points);
1836
1837 fev[variable].get_function_third_derivatives_from_local_dof_values(
1838 independent_local_dofs, ret);
1839 return ret;
1840 }
1841
1842
1843
1844 template <int dim, int spacedim>
1845 template <typename Extractor, typename Number>
1846 const std::vector<typename FEValuesViews::View<dim, spacedim, Extractor>::
1847 template solution_symmetric_gradient_type<Number>> &
1849 const std::string &global_vector_name,
1850 const Extractor &variable,
1851 const Number dummy)
1852 {
1853 const std::vector<Number> &independent_local_dofs =
1854 get_local_dof_values(global_vector_name, dummy);
1855
1856 const FEValuesBase<dim, spacedim> &fev = get_current_fe_values();
1857
1858 const unsigned int n_q_points = fev.n_quadrature_points;
1859
1860 const std::string name = get_unique_name(
1861 global_vector_name, variable, "_symmetric_gradient_q", n_q_points, dummy);
1862
1863
1864 // Now build the return type
1865 using RetType =
1866 std::vector<typename FEValuesViews::View<dim, spacedim, Extractor>::
1867 template solution_symmetric_gradient_type<Number>>;
1868
1869 RetType &ret =
1870 internal_data_storage.template get_or_add_object_with_name<RetType>(
1871 name, n_q_points);
1872
1873
1874 AssertDimension(ret.size(), n_q_points);
1875
1876 fev[variable].get_function_symmetric_gradients_from_local_dof_values(
1877 independent_local_dofs, ret);
1878 return ret;
1879 }
1880
1881
1882 template <int dim, int spacedim>
1883 template <typename Extractor, typename Number>
1884 const std::vector<typename FEValuesViews::View<dim, spacedim, Extractor>::
1885 template solution_divergence_type<Number>> &
1887 const std::string &global_vector_name,
1888 const Extractor &variable,
1889 const Number dummy)
1890 {
1891 const std::vector<Number> &independent_local_dofs =
1892 get_local_dof_values(global_vector_name, dummy);
1893
1894 const FEValuesBase<dim, spacedim> &fev = get_current_fe_values();
1895
1896 const unsigned int n_q_points = fev.n_quadrature_points;
1897
1898 const std::string name = get_unique_name(
1899 global_vector_name, variable, "_divergence_q", n_q_points, dummy);
1900
1901 // Now build the return type
1902 using RetType =
1903 std::vector<typename FEValuesViews::View<dim, spacedim, Extractor>::
1904 template solution_divergence_type<Number>>;
1905
1906 RetType &ret =
1907 internal_data_storage.template get_or_add_object_with_name<RetType>(
1908 name, n_q_points);
1909
1910
1911 AssertDimension(ret.size(), n_q_points);
1912
1913 fev[variable].get_function_divergences_from_local_dof_values(
1914 independent_local_dofs, ret);
1915 return ret;
1916 }
1917
1918
1919
1920 template <int dim, int spacedim>
1921 template <typename Extractor, typename Number>
1922 const std::vector<typename FEValuesViews::View<dim, spacedim, Extractor>::
1923 template solution_curl_type<Number>> &
1924 ScratchData<dim, spacedim>::get_curls(const std::string &global_vector_name,
1925 const Extractor &variable,
1926 const Number dummy)
1927 {
1928 const std::vector<Number> &independent_local_dofs =
1929 get_local_dof_values(global_vector_name, dummy);
1930
1931 const FEValuesBase<dim, spacedim> &fev = get_current_fe_values();
1932
1933 const unsigned int n_q_points = fev.n_quadrature_points;
1934
1935 const std::string name = get_unique_name(
1936 global_vector_name, variable, "_curl_q", n_q_points, dummy);
1937
1938 // Now build the return type
1939 using RetType =
1940 std::vector<typename FEValuesViews::View<dim, spacedim, Extractor>::
1941 template solution_curl_type<Number>>;
1942
1943 RetType &ret =
1944 internal_data_storage.template get_or_add_object_with_name<RetType>(
1945 name, n_q_points);
1946
1947 AssertDimension(ret.size(), n_q_points);
1948
1949 fev[variable].get_function_curls_from_local_dof_values(
1950 independent_local_dofs, ret);
1951 return ret;
1952 }
1953
1954
1955
1956 template <int dim, int spacedim>
1957 template <typename Extractor, typename Number>
1958 const std::vector<typename FEInterfaceViews::View<dim, spacedim, Extractor>::
1959 template solution_value_type<Number>> &
1961 const std::string &global_vector_name,
1962 const Extractor &variable,
1963 const Number dummy)
1964 {
1965 const std::vector<Number> &independent_local_dofs =
1966 get_local_dof_values(global_vector_name, dummy);
1967
1969 get_current_interface_fe_values();
1970
1971 AssertDimension(independent_local_dofs.size(),
1973
1974 const unsigned int n_q_points = feiv.n_quadrature_points;
1975
1976 const std::string name = get_unique_name(
1977 global_vector_name, variable, "_jump_values_q", n_q_points, dummy);
1978
1979 // Now build the return type
1980 using RetType =
1981 std::vector<typename FEValuesViews::View<dim, spacedim, Extractor>::
1982 template solution_value_type<Number>>;
1983
1984 RetType &ret =
1985 internal_data_storage.template get_or_add_object_with_name<RetType>(
1986 name, n_q_points);
1987
1988 AssertDimension(ret.size(), n_q_points);
1989
1990 feiv[variable].get_jump_in_function_values_from_local_dof_values(
1991 independent_local_dofs, ret);
1992 return ret;
1993 }
1994
1995
1996
1997 template <int dim, int spacedim>
1998 template <typename Extractor, typename Number>
1999 const std::vector<typename FEInterfaceViews::View<dim, spacedim, Extractor>::
2000 template solution_gradient_type<Number>> &
2002 const std::string &global_vector_name,
2003 const Extractor &variable,
2004 const Number dummy)
2005 {
2006 const std::vector<Number> &independent_local_dofs =
2007 get_local_dof_values(global_vector_name, dummy);
2008
2010 get_current_interface_fe_values();
2011
2012 AssertDimension(independent_local_dofs.size(),
2014
2015 const unsigned int n_q_points = feiv.n_quadrature_points;
2016
2017 const std::string name = get_unique_name(
2018 global_vector_name, variable, "_jump_gradients_q", n_q_points, dummy);
2019
2020 // Now build the return type
2021 using RetType =
2022 std::vector<typename FEValuesViews::View<dim, spacedim, Extractor>::
2023 template solution_gradient_type<Number>>;
2024
2025 RetType &ret =
2026 internal_data_storage.template get_or_add_object_with_name<RetType>(
2027 name, n_q_points);
2028
2029 AssertDimension(ret.size(), n_q_points);
2030
2031 feiv[variable].get_jump_in_function_gradients_from_local_dof_values(
2032 independent_local_dofs, ret);
2033 return ret;
2034 }
2035
2036
2037
2038 template <int dim, int spacedim>
2039 template <typename Extractor, typename Number>
2040 const std::vector<typename FEInterfaceViews::View<dim, spacedim, Extractor>::
2041 template solution_hessian_type<Number>> &
2043 const std::string &global_vector_name,
2044 const Extractor &variable,
2045 const Number dummy)
2046 {
2047 const std::vector<Number> &independent_local_dofs =
2048 get_local_dof_values(global_vector_name, dummy);
2049
2051 get_current_interface_fe_values();
2052
2053 AssertDimension(independent_local_dofs.size(),
2055
2056 const unsigned int n_q_points = feiv.n_quadrature_points;
2057
2058 const std::string name = get_unique_name(
2059 global_vector_name, variable, "_jump_hessians_q", n_q_points, dummy);
2060
2061 // Now build the return type
2062 using RetType =
2063 std::vector<typename FEValuesViews::View<dim, spacedim, Extractor>::
2064 template solution_hessian_type<Number>>;
2065
2066 RetType &ret =
2067 internal_data_storage.template get_or_add_object_with_name<RetType>(
2068 name, n_q_points);
2069
2070 AssertDimension(ret.size(), n_q_points);
2071
2072 feiv[variable].get_jump_in_function_hessians_from_local_dof_values(
2073 independent_local_dofs, ret);
2074 return ret;
2075 }
2076
2077
2078
2079 template <int dim, int spacedim>
2080 template <typename Extractor, typename Number>
2081 const std::vector<typename FEInterfaceViews::View<dim, spacedim, Extractor>::
2082 template solution_third_derivative_type<Number>> &
2084 const std::string &global_vector_name,
2085 const Extractor &variable,
2086 const Number dummy)
2087 {
2088 const std::vector<Number> &independent_local_dofs =
2089 get_local_dof_values(global_vector_name, dummy);
2090
2092 get_current_interface_fe_values();
2093
2094 AssertDimension(independent_local_dofs.size(),
2096
2097 const unsigned int n_q_points = feiv.n_quadrature_points;
2098
2099 const std::string name = get_unique_name(global_vector_name,
2100 variable,
2101 "_jump_third_derivatives_q",
2102 n_q_points,
2103 dummy);
2104
2105 // Now build the return type
2106 using RetType =
2107 std::vector<typename FEValuesViews::View<dim, spacedim, Extractor>::
2108 template solution_third_derivative_type<Number>>;
2109
2110 RetType &ret =
2111 internal_data_storage.template get_or_add_object_with_name<RetType>(
2112 name, n_q_points);
2113
2114 AssertDimension(ret.size(), n_q_points);
2115
2116 feiv[variable].get_jump_in_function_third_derivatives_from_local_dof_values(
2117 independent_local_dofs, ret);
2118 return ret;
2119 }
2120
2121
2122
2123 template <int dim, int spacedim>
2124 template <typename Extractor, typename Number>
2125 const std::vector<typename FEInterfaceViews::View<dim, spacedim, Extractor>::
2126 template solution_value_type<Number>> &
2128 const std::string &global_vector_name,
2129 const Extractor &variable,
2130 const Number dummy)
2131 {
2132 const std::vector<Number> &independent_local_dofs =
2133 get_local_dof_values(global_vector_name, dummy);
2134
2136 get_current_interface_fe_values();
2137
2138 AssertDimension(independent_local_dofs.size(),
2140
2141 const unsigned int n_q_points = feiv.n_quadrature_points;
2142
2143 const std::string name = get_unique_name(
2144 global_vector_name, variable, "_average_values_q", n_q_points, dummy);
2145
2146 // Now build the return type
2147 using RetType =
2148 std::vector<typename FEValuesViews::View<dim, spacedim, Extractor>::
2149 template solution_value_type<Number>>;
2150
2151 RetType &ret =
2152 internal_data_storage.template get_or_add_object_with_name<RetType>(
2153 name, n_q_points);
2154
2155 AssertDimension(ret.size(), n_q_points);
2156
2157 feiv[variable].get_average_of_function_values_from_local_dof_values(
2158 independent_local_dofs, ret);
2159 return ret;
2160 }
2161
2162
2163
2164 template <int dim, int spacedim>
2165 template <typename Extractor, typename Number>
2166 const std::vector<typename FEInterfaceViews::View<dim, spacedim, Extractor>::
2167 template solution_gradient_type<Number>> &
2169 const std::string &global_vector_name,
2170 const Extractor &variable,
2171 const Number dummy)
2172 {
2173 const std::vector<Number> &independent_local_dofs =
2174 get_local_dof_values(global_vector_name, dummy);
2175
2177 get_current_interface_fe_values();
2178
2179 AssertDimension(independent_local_dofs.size(),
2181
2182 const unsigned int n_q_points = feiv.n_quadrature_points;
2183
2184 const std::string name = get_unique_name(
2185 global_vector_name, variable, "_average_gradients_q", n_q_points, dummy);
2186
2187 // Now build the return type
2188 using RetType =
2189 std::vector<typename FEValuesViews::View<dim, spacedim, Extractor>::
2190 template solution_gradient_type<Number>>;
2191
2192 RetType &ret =
2193 internal_data_storage.template get_or_add_object_with_name<RetType>(
2194 name, n_q_points);
2195
2196 AssertDimension(ret.size(), n_q_points);
2197
2198 feiv[variable].get_average_of_function_gradients_from_local_dof_values(
2199 independent_local_dofs, ret);
2200 return ret;
2201 }
2202
2203
2204
2205 template <int dim, int spacedim>
2206 template <typename Extractor, typename Number>
2207 const std::vector<typename FEInterfaceViews::View<dim, spacedim, Extractor>::
2208 template solution_hessian_type<Number>> &
2210 const std::string &global_vector_name,
2211 const Extractor &variable,
2212 const Number dummy)
2213 {
2214 const std::vector<Number> &independent_local_dofs =
2215 get_local_dof_values(global_vector_name, dummy);
2216
2218 get_current_interface_fe_values();
2219
2220 AssertDimension(independent_local_dofs.size(),
2222
2223 const unsigned int n_q_points = feiv.n_quadrature_points;
2224
2225 const std::string name = get_unique_name(
2226 global_vector_name, variable, "_average_hessians_q", n_q_points, dummy);
2227
2228 // Now build the return type
2229 using RetType =
2230 std::vector<typename FEValuesViews::View<dim, spacedim, Extractor>::
2231 template solution_hessian_type<Number>>;
2232
2233 RetType &ret =
2234 internal_data_storage.template get_or_add_object_with_name<RetType>(
2235 name, n_q_points);
2236
2237 AssertDimension(ret.size(), n_q_points);
2238
2239 feiv[variable].get_average_of_function_hessians_from_local_dof_values(
2240 independent_local_dofs, ret);
2241 return ret;
2242 }
2243
2244
2245#endif
2246
2247} // namespace MeshWorker
2248
2250
2251#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
ObserverPointer< const Mapping< dim, spacedim > > mapping
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))
ObserverPointer< const hp::FECollection< dim, spacedim > > fe_collection
const FiniteElement< dim, spacedim > & get_fe() const
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
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
ObserverPointer< const FEValuesBase< dim, spacedim > > current_fe_values
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
ObserverPointer< const FiniteElement< dim, spacedim > > fe
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
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))
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
ObserverPointer< const FEValuesBase< dim, spacedim > > current_neighbor_fe_values
const FEValuesBase< dim, spacedim > & get_current_neighbor_fe_values() const
const std::vector< types::global_dof_index > & get_local_dof_indices() const
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
ObserverPointer< const hp::MappingCollection< dim, spacedim > > mapping_collection
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:498
#define DEAL_II_NAMESPACE_CLOSE
Definition config.h:499
#define Assert(cond, exc)
#define AssertDimension(dim1, dim2)
static ::ExceptionBase & ExcOnlyAvailableWithoutHP()
#define DeclExceptionMsg(Exception, defaulttext)
Definition exceptions.h:489
static ::ExceptionBase & ExcMessage(std::string arg1)
static ::ExceptionBase & ExcOnlyAvailableWithHP()
typename ActiveSelector::active_cell_iterator active_cell_iterator
UpdateFlags
@ update_default
No update.
std::size_t size
Definition mpi.cc:734
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