Reference documentation for deal.II version Git f44593662d 2019-12-06 10:50:57 -0500
\(\newcommand{\dealcoloneq}{\mathrel{\vcenter{:}}=}\)
vector_tools.h
1 // ---------------------------------------------------------------------
2 //
3 // Copyright (C) 1998 - 2019 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_vector_tools_h
17 #define dealii_vector_tools_h
18 
19 
20 #include <deal.II/base/config.h>
21 
22 #include <deal.II/base/exceptions.h>
23 #include <deal.II/base/function.h>
24 #include <deal.II/base/patterns.h>
25 #include <deal.II/base/point.h>
26 #include <deal.II/base/quadrature_lib.h>
27 
28 #include <deal.II/dofs/deprecated_function_map.h>
29 #include <deal.II/dofs/dof_handler.h>
30 
31 #include <deal.II/hp/dof_handler.h>
32 #include <deal.II/hp/mapping_collection.h>
33 
34 #include <functional>
35 #include <map>
36 #include <set>
37 #include <vector>
38 
39 DEAL_II_NAMESPACE_OPEN
40 
41 // Forward declarations
42 #ifndef DOXYGEN
43 template <int dim, typename RangeNumberType>
44 class Function;
45 template <int dim>
46 class Quadrature;
47 template <int dim>
48 class QGauss;
49 template <int dim, typename number, typename VectorizedArrayType>
50 class MatrixFree;
51 
52 template <typename number>
53 class Vector;
54 template <typename number>
55 class FullMatrix;
56 template <int dim, int spacedim>
57 class Mapping;
58 template <typename gridtype>
59 class InterGridMap;
60 namespace hp
61 {
62  template <int dim>
63  class QCollection;
64 }
65 template <typename number>
66 class AffineConstraints;
67 #endif
68 
69 // TODO: Move documentation of functions to the functions!
70 
336 namespace VectorTools
337 {
363  enum NormType
364  {
390 
406 
424 
442 
459 
476 
497 
515 
532 
551 
569 
585 
586  };
591 
592 
593 
613  template <int dim,
614  int spacedim,
615  typename VectorType,
616  template <int, int> class DoFHandlerType>
617  void
618  interpolate(
619  const Mapping<dim, spacedim> & mapping,
620  const DoFHandlerType<dim, spacedim> & dof,
622  VectorType & vec,
623  const ComponentMask &component_mask = ComponentMask());
624 
629  template <int dim,
630  int spacedim,
631  typename VectorType,
632  template <int, int> class DoFHandlerType>
633  void
634  interpolate(
635  const DoFHandlerType<dim, spacedim> & dof,
637  VectorType & vec,
638  const ComponentMask &component_mask = ComponentMask());
639 
657  template <int dim, class InVector, class OutVector, int spacedim>
658  void
659  interpolate(const DoFHandler<dim, spacedim> &dof_1,
660  const DoFHandler<dim, spacedim> &dof_2,
661  const FullMatrix<double> & transfer,
662  const InVector & data_1,
663  OutVector & data_2);
664 
713  template <int dim,
714  int spacedim,
715  typename VectorType,
716  template <int, int> class DoFHandlerType>
717  void
719  const Mapping<dim, spacedim> & mapping,
720  const DoFHandlerType<dim, spacedim> &dof_handler,
721  const std::map<types::material_id,
723  & function_map,
724  VectorType & dst,
725  const ComponentMask &component_mask = ComponentMask());
726 
751  template <int dim,
752  int spacedim,
753  typename VectorType,
754  template <int, int> class DoFHandlerType>
755  void
756  interpolate_to_different_mesh(const DoFHandlerType<dim, spacedim> &dof1,
757  const VectorType & u1,
758  const DoFHandlerType<dim, spacedim> &dof2,
759  VectorType & u2);
760 
774  template <int dim,
775  int spacedim,
776  typename VectorType,
777  template <int, int> class DoFHandlerType>
778  void
780  const DoFHandlerType<dim, spacedim> & dof1,
781  const VectorType & u1,
782  const DoFHandlerType<dim, spacedim> & dof2,
784  VectorType & u2);
785 
793  template <int dim,
794  int spacedim,
795  typename VectorType,
796  template <int, int> class DoFHandlerType>
797  void
799  const InterGridMap<DoFHandlerType<dim, spacedim>> & intergridmap,
800  const VectorType & u1,
802  VectorType & u2);
803 
884  template <int dim, typename VectorType, int spacedim>
885  void
886  project(const Mapping<dim, spacedim> & mapping,
887  const DoFHandler<dim, spacedim> & dof,
889  const Quadrature<dim> & quadrature,
891  VectorType & vec,
892  const bool enforce_zero_boundary = false,
893  const Quadrature<dim - 1> &q_boundary = (dim > 1 ?
894  QGauss<dim - 1>(2) :
896  const bool project_to_boundary_first = false);
897 
902  template <int dim, typename VectorType, int spacedim>
903  void
906  const Quadrature<dim> & quadrature,
908  VectorType & vec,
909  const bool enforce_zero_boundary = false,
910  const Quadrature<dim - 1> &q_boundary = (dim > 1 ?
911  QGauss<dim - 1>(2) :
913  const bool project_to_boundary_first = false);
914 
919  template <int dim, typename VectorType, int spacedim>
920  void
922  const hp::DoFHandler<dim, spacedim> & dof,
924  const hp::QCollection<dim> & quadrature,
926  VectorType & vec,
927  const bool enforce_zero_boundary = false,
929  dim > 1 ? QGauss<dim - 1>(2) : Quadrature<dim - 1>(0)),
930  const bool project_to_boundary_first = false);
931 
936  template <int dim, typename VectorType, int spacedim>
937  void
940  const hp::QCollection<dim> & quadrature,
942  VectorType & vec,
943  const bool enforce_zero_boundary = false,
945  dim > 1 ? QGauss<dim - 1>(2) : Quadrature<dim - 1>(0)),
946  const bool project_to_boundary_first = false);
947 
972  template <int dim, typename VectorType, int spacedim>
973  void
974  project(const Mapping<dim, spacedim> & mapping,
975  const DoFHandler<dim, spacedim> & dof,
977  const Quadrature<dim> & quadrature,
978  const std::function<typename VectorType::value_type(
980  const unsigned int)> & func,
981  VectorType & vec_result);
982 
1011  template <int dim, typename VectorType>
1012  void
1013  project(
1014  std::shared_ptr<
1015  const MatrixFree<dim,
1016  typename VectorType::value_type,
1019  const unsigned int n_q_points_1d,
1021  const unsigned int,
1022  const unsigned int)> & func,
1023  VectorType & vec_result,
1024  const unsigned int fe_component = 0);
1025 
1030  template <int dim, typename VectorType>
1031  void
1032  project(
1033  std::shared_ptr<
1034  const MatrixFree<dim,
1035  typename VectorType::value_type,
1039  const unsigned int,
1040  const unsigned int)> & func,
1041  VectorType & vec_result,
1042  const unsigned int fe_component = 0);
1043 
1094  template <int dim,
1095  int spacedim,
1096  template <int, int> class DoFHandlerType,
1097  typename number>
1098  void
1100  const Mapping<dim, spacedim> & mapping,
1101  const DoFHandlerType<dim, spacedim> &dof,
1102  const std::map<types::boundary_id, const Function<spacedim, number> *>
1103  & function_map,
1104  std::map<types::global_dof_index, number> &boundary_values,
1105  const ComponentMask &component_mask = ComponentMask());
1106 
1111  template <int dim, int spacedim, typename number>
1112  void
1114  const hp::MappingCollection<dim, spacedim> &mapping,
1115  const hp::DoFHandler<dim, spacedim> & dof,
1116  const std::map<types::boundary_id, const Function<spacedim, number> *>
1117  & function_map,
1118  std::map<types::global_dof_index, number> &boundary_values,
1119  const ComponentMask &component_mask = ComponentMask());
1120 
1130  template <int dim,
1131  int spacedim,
1132  template <int, int> class DoFHandlerType,
1133  typename number>
1134  void
1136  const Mapping<dim, spacedim> & mapping,
1137  const DoFHandlerType<dim, spacedim> & dof,
1138  const types::boundary_id boundary_component,
1139  const Function<spacedim, number> & boundary_function,
1140  std::map<types::global_dof_index, number> &boundary_values,
1141  const ComponentMask &component_mask = ComponentMask());
1142 
1152  template <int dim,
1153  int spacedim,
1154  template <int, int> class DoFHandlerType,
1155  typename number>
1156  void
1158  const DoFHandlerType<dim, spacedim> & dof,
1159  const types::boundary_id boundary_component,
1160  const Function<spacedim, number> & boundary_function,
1161  std::map<types::global_dof_index, number> &boundary_values,
1162  const ComponentMask &component_mask = ComponentMask());
1163 
1164 
1171  template <int dim,
1172  int spacedim,
1173  template <int, int> class DoFHandlerType,
1174  typename number>
1175  void
1177  const DoFHandlerType<dim, spacedim> &dof,
1178  const std::map<types::boundary_id, const Function<spacedim, number> *>
1179  & function_map,
1180  std::map<types::global_dof_index, number> &boundary_values,
1181  const ComponentMask &component_mask = ComponentMask());
1182 
1183 
1245  template <int dim,
1246  int spacedim,
1247  template <int, int> class DoFHandlerType,
1248  typename number>
1249  void
1251  const Mapping<dim, spacedim> & mapping,
1252  const DoFHandlerType<dim, spacedim> &dof,
1253  const std::map<types::boundary_id, const Function<spacedim, number> *>
1254  & function_map,
1255  AffineConstraints<number> &constraints,
1256  const ComponentMask & component_mask = ComponentMask());
1257 
1269  template <int dim,
1270  int spacedim,
1271  template <int, int> class DoFHandlerType,
1272  typename number>
1273  void
1275  const Mapping<dim, spacedim> & mapping,
1276  const DoFHandlerType<dim, spacedim> &dof,
1277  const types::boundary_id boundary_component,
1278  const Function<spacedim, number> & boundary_function,
1279  AffineConstraints<number> & constraints,
1280  const ComponentMask & component_mask = ComponentMask());
1281 
1293  template <int dim,
1294  int spacedim,
1295  template <int, int> class DoFHandlerType,
1296  typename number>
1297  void
1299  const DoFHandlerType<dim, spacedim> &dof,
1300  const types::boundary_id boundary_component,
1301  const Function<spacedim, number> & boundary_function,
1302  AffineConstraints<number> & constraints,
1303  const ComponentMask & component_mask = ComponentMask());
1304 
1305 
1314  template <int dim,
1315  int spacedim,
1316  template <int, int> class DoFHandlerType,
1317  typename number>
1318  void
1320  const DoFHandlerType<dim, spacedim> &dof,
1321  const std::map<types::boundary_id, const Function<spacedim, number> *>
1322  & function_map,
1323  AffineConstraints<number> &constraints,
1324  const ComponentMask & component_mask = ComponentMask());
1325 
1326 
1391  template <int dim, int spacedim, typename number>
1392  void
1394  const Mapping<dim, spacedim> & mapping,
1395  const DoFHandler<dim, spacedim> &dof,
1396  const std::map<types::boundary_id, const Function<spacedim, number> *>
1397  & boundary_functions,
1398  const Quadrature<dim - 1> & q,
1399  std::map<types::global_dof_index, number> &boundary_values,
1400  std::vector<unsigned int> component_mapping = {});
1401 
1406  template <int dim, int spacedim, typename number>
1407  void
1409  const DoFHandler<dim, spacedim> &dof,
1410  const std::map<types::boundary_id, const Function<spacedim, number> *>
1411  & boundary_function,
1412  const Quadrature<dim - 1> & q,
1413  std::map<types::global_dof_index, number> &boundary_values,
1414  std::vector<unsigned int> component_mapping = {});
1415 
1419  template <int dim, int spacedim, typename number>
1420  void
1422  const hp::MappingCollection<dim, spacedim> &mapping,
1423  const hp::DoFHandler<dim, spacedim> & dof,
1424  const std::map<types::boundary_id, const Function<spacedim, number> *>
1425  & boundary_functions,
1426  const hp::QCollection<dim - 1> & q,
1427  std::map<types::global_dof_index, number> &boundary_values,
1428  std::vector<unsigned int> component_mapping = {});
1429 
1434  template <int dim, int spacedim, typename number>
1435  void
1437  const hp::DoFHandler<dim, spacedim> &dof,
1438  const std::map<types::boundary_id, const Function<spacedim, number> *>
1439  & boundary_function,
1440  const hp::QCollection<dim - 1> & q,
1441  std::map<types::global_dof_index, number> &boundary_values,
1442  std::vector<unsigned int> component_mapping = {});
1443 
1482  template <int dim, int spacedim, typename number>
1483  void
1485  const Mapping<dim, spacedim> & mapping,
1486  const DoFHandler<dim, spacedim> &dof,
1487  const std::map<types::boundary_id, const Function<spacedim, number> *>
1488  & boundary_functions,
1489  const Quadrature<dim - 1> &q,
1490  AffineConstraints<number> &constraints,
1491  std::vector<unsigned int> component_mapping = {});
1492 
1499  template <int dim, int spacedim, typename number>
1500  void
1502  const DoFHandler<dim, spacedim> &dof,
1503  const std::map<types::boundary_id, const Function<spacedim, number> *>
1504  & boundary_function,
1505  const Quadrature<dim - 1> &q,
1506  AffineConstraints<number> &constraints,
1507  std::vector<unsigned int> component_mapping = {});
1508 
1509 
1567  template <int dim>
1568  DEAL_II_DEPRECATED void
1570  const DoFHandler<dim> & dof_handler,
1571  const unsigned int first_vector_component,
1572  const Function<dim, double> &boundary_function,
1573  const types::boundary_id boundary_component,
1574  AffineConstraints<double> & constraints,
1575  const Mapping<dim> & mapping = StaticMappingQ1<dim>::mapping);
1576 
1588  template <int dim>
1589  DEAL_II_DEPRECATED void
1591  const hp::DoFHandler<dim> & dof_handler,
1592  const unsigned int first_vector_component,
1593  const Function<dim, double> & boundary_function,
1594  const types::boundary_id boundary_component,
1595  AffineConstraints<double> & constraints,
1596  const hp::MappingCollection<dim, dim> &mapping_collection =
1598 
1694  template <int dim, typename number>
1695  void
1697  const DoFHandler<dim> & dof_handler,
1698  const unsigned int first_vector_component,
1699  const Function<dim, number> &boundary_function,
1700  const types::boundary_id boundary_component,
1701  AffineConstraints<number> & constraints,
1702  const Mapping<dim> & mapping = StaticMappingQ1<dim>::mapping);
1703 
1704 
1711  template <int dim, typename number>
1712  void
1714  const hp::DoFHandler<dim> & dof_handler,
1715  const unsigned int first_vector_component,
1716  const Function<dim, number> & boundary_function,
1717  const types::boundary_id boundary_component,
1718  AffineConstraints<number> & constraints,
1719  const hp::MappingCollection<dim, dim> &mapping_collection =
1721 
1722 
1769  template <int dim>
1770  void
1772  const DoFHandler<dim> & dof_handler,
1773  const unsigned int first_vector_component,
1774  const Function<dim, double> &boundary_function,
1775  const types::boundary_id boundary_component,
1776  AffineConstraints<double> & constraints,
1777  const Mapping<dim> & mapping = StaticMappingQ1<dim>::mapping);
1778 
1787  template <int dim>
1788  void
1790  const hp::DoFHandler<dim> & dof_handler,
1791  const unsigned int first_vector_component,
1792  const Function<dim, double> & boundary_function,
1793  const types::boundary_id boundary_component,
1794  AffineConstraints<double> & constraints,
1795  const hp::MappingCollection<dim, dim> &mapping_collection =
1797 
1798 
2026  template <int dim, int spacedim, template <int, int> class DoFHandlerType>
2027  void
2029  const DoFHandlerType<dim, spacedim> &dof_handler,
2030  const unsigned int first_vector_component,
2031  const std::set<types::boundary_id> & boundary_ids,
2032  const std::map<types::boundary_id, const Function<spacedim> *>
2033  & function_map,
2034  AffineConstraints<double> & constraints,
2036 
2049  template <int dim, int spacedim, template <int, int> class DoFHandlerType>
2050  void
2052  const DoFHandlerType<dim, spacedim> &dof_handler,
2053  const unsigned int first_vector_component,
2054  const std::set<types::boundary_id> & boundary_ids,
2055  AffineConstraints<double> & constraints,
2057 
2074  template <int dim, int spacedim, template <int, int> class DoFHandlerType>
2075  void
2077  const DoFHandlerType<dim, spacedim> &dof_handler,
2078  const unsigned int first_vector_component,
2079  const std::set<types::boundary_id> & boundary_ids,
2080  const std::map<types::boundary_id, const Function<spacedim> *>
2081  & function_map,
2082  AffineConstraints<double> & constraints,
2084 
2093  template <int dim, int spacedim, template <int, int> class DoFHandlerType>
2094  void
2096  const DoFHandlerType<dim, spacedim> &dof_handler,
2097  const unsigned int first_vector_component,
2098  const std::set<types::boundary_id> & boundary_ids,
2099  AffineConstraints<double> & constraints,
2101 
2102 
2104 
2108 
2115  template <int dim, int spacedim, typename VectorType>
2116  void
2118  const Mapping<dim, spacedim> & mapping,
2119  const DoFHandler<dim, spacedim> & dof,
2120  const Quadrature<dim> & q,
2122  VectorType & rhs_vector,
2125 
2130  template <int dim, int spacedim, typename VectorType>
2131  void
2133  const DoFHandler<dim, spacedim> & dof,
2134  const Quadrature<dim> & q,
2136  VectorType & rhs_vector,
2139 
2143  template <int dim, int spacedim, typename VectorType>
2144  void
2146  const hp::MappingCollection<dim, spacedim> & mapping,
2147  const hp::DoFHandler<dim, spacedim> & dof,
2148  const hp::QCollection<dim> & q,
2150  VectorType & rhs_vector,
2153 
2157  template <int dim, int spacedim, typename VectorType>
2158  void
2160  const hp::DoFHandler<dim, spacedim> & dof,
2161  const hp::QCollection<dim> & q,
2163  VectorType & rhs_vector,
2166 
2251  template <int dim, int spacedim>
2252  void
2254  const DoFHandler<dim, spacedim> &dof_handler,
2255  const Point<spacedim> & p,
2256  Vector<double> & rhs_vector);
2257 
2262  template <int dim, int spacedim>
2263  void
2265  const Point<spacedim> & p,
2266  Vector<double> & rhs_vector);
2267 
2271  template <int dim, int spacedim>
2272  void
2274  const hp::MappingCollection<dim, spacedim> &mapping,
2275  const hp::DoFHandler<dim, spacedim> & dof_handler,
2276  const Point<spacedim> & p,
2277  Vector<double> & rhs_vector);
2278 
2285  template <int dim, int spacedim>
2286  void
2288  const Point<spacedim> & p,
2289  Vector<double> & rhs_vector);
2290 
2309  template <int dim, int spacedim>
2310  void
2312  const DoFHandler<dim, spacedim> &dof_handler,
2313  const Point<spacedim> & p,
2314  const Point<dim> & direction,
2315  Vector<double> & rhs_vector);
2316 
2321  template <int dim, int spacedim>
2322  void
2324  const Point<spacedim> & p,
2325  const Point<dim> & direction,
2326  Vector<double> & rhs_vector);
2327 
2331  template <int dim, int spacedim>
2332  void
2334  const hp::MappingCollection<dim, spacedim> &mapping,
2335  const hp::DoFHandler<dim, spacedim> & dof_handler,
2336  const Point<spacedim> & p,
2337  const Point<dim> & direction,
2338  Vector<double> & rhs_vector);
2339 
2346  template <int dim, int spacedim>
2347  void
2349  const Point<spacedim> & p,
2350  const Point<dim> & direction,
2351  Vector<double> & rhs_vector);
2352 
2362  template <int dim, int spacedim, typename VectorType>
2363  void
2365  const Mapping<dim, spacedim> & mapping,
2366  const DoFHandler<dim, spacedim> & dof,
2367  const Quadrature<dim - 1> & q,
2369  VectorType & rhs_vector,
2370  const std::set<types::boundary_id> & boundary_ids =
2371  std::set<types::boundary_id>());
2372 
2380  template <int dim, int spacedim, typename VectorType>
2381  void
2383  const DoFHandler<dim, spacedim> & dof,
2384  const Quadrature<dim - 1> & q,
2386  VectorType & rhs_vector,
2387  const std::set<types::boundary_id> & boundary_ids =
2388  std::set<types::boundary_id>());
2389 
2396  template <int dim, int spacedim, typename VectorType>
2397  void
2399  const hp::MappingCollection<dim, spacedim> & mapping,
2400  const hp::DoFHandler<dim, spacedim> & dof,
2401  const hp::QCollection<dim - 1> & q,
2403  VectorType & rhs_vector,
2404  const std::set<types::boundary_id> & boundary_ids =
2405  std::set<types::boundary_id>());
2406 
2415  template <int dim, int spacedim, typename VectorType>
2416  void
2418  const hp::DoFHandler<dim, spacedim> & dof,
2419  const hp::QCollection<dim - 1> & q,
2421  VectorType & rhs_vector,
2422  const std::set<types::boundary_id> & boundary_ids =
2423  std::set<types::boundary_id>());
2424 
2426 
2430 
2518  template <int dim, class InVector, class OutVector, int spacedim>
2519  void
2521  const Mapping<dim, spacedim> & mapping,
2522  const DoFHandler<dim, spacedim> & dof,
2523  const InVector & fe_function,
2525  OutVector & difference,
2526  const Quadrature<dim> & q,
2527  const NormType & norm,
2528  const Function<spacedim, double> * weight = nullptr,
2529  const double exponent = 2.);
2530 
2535  template <int dim, class InVector, class OutVector, int spacedim>
2536  void
2538  const DoFHandler<dim, spacedim> & dof,
2539  const InVector & fe_function,
2541  OutVector & difference,
2542  const Quadrature<dim> & q,
2543  const NormType & norm,
2544  const Function<spacedim, double> * weight = nullptr,
2545  const double exponent = 2.);
2546 
2550  template <int dim, class InVector, class OutVector, int spacedim>
2551  void
2553  const hp::MappingCollection<dim, spacedim> & mapping,
2554  const hp::DoFHandler<dim, spacedim> & dof,
2555  const InVector & fe_function,
2557  OutVector & difference,
2558  const hp::QCollection<dim> & q,
2559  const NormType & norm,
2560  const Function<spacedim, double> * weight = nullptr,
2561  const double exponent = 2.);
2562 
2567  template <int dim, class InVector, class OutVector, int spacedim>
2568  void
2570  const hp::DoFHandler<dim, spacedim> & dof,
2571  const InVector & fe_function,
2573  OutVector & difference,
2574  const hp::QCollection<dim> & q,
2575  const NormType & norm,
2576  const Function<spacedim, double> * weight = nullptr,
2577  const double exponent = 2.);
2578 
2593  template <int dim, class InVector, class OutVector, int spacedim>
2594  DEAL_II_DEPRECATED typename std::enable_if<
2595  !std::is_same<typename InVector::value_type, double>::value>::type
2597  const DoFHandler<dim, spacedim> & dof,
2598  const InVector & fe_function,
2599  const Function<spacedim, double> &exact_solution,
2600  OutVector & difference,
2601  const Quadrature<dim> & q,
2602  const NormType & norm,
2603  const Function<spacedim, double> *weight = nullptr,
2604  const double exponent = 2.);
2605 
2612  template <int dim, class InVector, class OutVector, int spacedim>
2613  DEAL_II_DEPRECATED typename std::enable_if<
2614  !std::is_same<typename InVector::value_type, double>::value>::type
2616  const InVector & fe_function,
2617  const Function<spacedim, double> &exact_solution,
2618  OutVector & difference,
2619  const Quadrature<dim> & q,
2620  const NormType & norm,
2621  const Function<spacedim, double> *weight = nullptr,
2622  const double exponent = 2.);
2623 
2629  template <int dim, class InVector, class OutVector, int spacedim>
2630  DEAL_II_DEPRECATED typename std::enable_if<
2631  !std::is_same<typename InVector::value_type, double>::value>::type
2633  const hp::DoFHandler<dim, spacedim> & dof,
2634  const InVector & fe_function,
2635  const Function<spacedim, double> &exact_solution,
2636  OutVector & difference,
2637  const hp::QCollection<dim> & q,
2638  const NormType & norm,
2639  const Function<spacedim, double> *weight = nullptr,
2640  const double exponent = 2.);
2641 
2648  template <int dim, class InVector, class OutVector, int spacedim>
2649  DEAL_II_DEPRECATED typename std::enable_if<
2650  !std::is_same<typename InVector::value_type, double>::value>::type
2652  const InVector & fe_function,
2653  const Function<spacedim, double> & exact_solution,
2654  OutVector & difference,
2655  const hp::QCollection<dim> & q,
2656  const NormType & norm,
2657  const Function<spacedim, double> * weight = nullptr,
2658  const double exponent = 2.);
2659 
2685  template <int dim, int spacedim, class InVector>
2686  double
2688  const InVector & cellwise_error,
2689  const NormType & norm,
2690  const double exponent = 2.);
2691 
2704  template <int dim, typename VectorType, int spacedim>
2705  void
2707  const DoFHandler<dim, spacedim> & dof,
2708  const VectorType & fe_function,
2711  const Point<spacedim> & point);
2712 
2725  template <int dim, typename VectorType, int spacedim>
2726  void
2728  const Mapping<dim, spacedim> & mapping,
2729  const DoFHandler<dim, spacedim> & dof,
2730  const VectorType & fe_function,
2733  const Point<spacedim> & point);
2734 
2771  template <int dim, typename VectorType, int spacedim>
2772  void
2774  const VectorType & fe_function,
2775  const Point<spacedim> & point,
2777 
2795  template <int dim, typename VectorType, int spacedim>
2796  void
2798  const VectorType & fe_function,
2799  const Point<spacedim> & point,
2801 
2841  template <int dim, typename VectorType, int spacedim>
2842  typename VectorType::value_type
2844  const VectorType & fe_function,
2845  const Point<spacedim> & point);
2846 
2864  template <int dim, typename VectorType, int spacedim>
2865  typename VectorType::value_type
2867  const VectorType & fe_function,
2868  const Point<spacedim> & point);
2869 
2904  template <int dim, typename VectorType, int spacedim>
2905  void
2906  point_value(const Mapping<dim, spacedim> & mapping,
2907  const DoFHandler<dim, spacedim> & dof,
2908  const VectorType & fe_function,
2909  const Point<spacedim> & point,
2911 
2929  template <int dim, typename VectorType, int spacedim>
2930  void
2932  const hp::DoFHandler<dim, spacedim> & dof,
2933  const VectorType & fe_function,
2934  const Point<spacedim> & point,
2936 
2970  template <int dim, typename VectorType, int spacedim>
2971  typename VectorType::value_type
2972  point_value(const Mapping<dim, spacedim> & mapping,
2973  const DoFHandler<dim, spacedim> &dof,
2974  const VectorType & fe_function,
2975  const Point<spacedim> & point);
2976 
2994  template <int dim, typename VectorType, int spacedim>
2995  typename VectorType::value_type
2997  const hp::DoFHandler<dim, spacedim> & dof,
2998  const VectorType & fe_function,
2999  const Point<spacedim> & point);
3000 
3033  template <int dim, typename VectorType, int spacedim>
3034  void
3036  const DoFHandler<dim, spacedim> &dof,
3037  const VectorType & fe_function,
3038  const Point<spacedim> & point,
3040 
3057  template <int dim, typename VectorType, int spacedim>
3058  void
3060  const hp::DoFHandler<dim, spacedim> &dof,
3061  const VectorType & fe_function,
3062  const Point<spacedim> & point,
3064 
3097  template <int dim, typename VectorType, int spacedim>
3100  const VectorType & fe_function,
3101  const Point<spacedim> & point);
3102 
3119  template <int dim, typename VectorType, int spacedim>
3122  const VectorType & fe_function,
3123  const Point<spacedim> & point);
3124 
3157  template <int dim, typename VectorType, int spacedim>
3158  void
3160  const Mapping<dim, spacedim> & mapping,
3161  const DoFHandler<dim, spacedim> &dof,
3162  const VectorType & fe_function,
3163  const Point<spacedim> & point,
3165 
3182  template <int dim, typename VectorType, int spacedim>
3183  void
3185  const hp::MappingCollection<dim, spacedim> &mapping,
3186  const hp::DoFHandler<dim, spacedim> & dof,
3187  const VectorType & fe_function,
3188  const Point<spacedim> & point,
3190 
3223  template <int dim, typename VectorType, int spacedim>
3225  point_gradient(const Mapping<dim, spacedim> & mapping,
3226  const DoFHandler<dim, spacedim> &dof,
3227  const VectorType & fe_function,
3228  const Point<spacedim> & point);
3229 
3246  template <int dim, typename VectorType, int spacedim>
3249  const hp::DoFHandler<dim, spacedim> & dof,
3250  const VectorType & fe_function,
3251  const Point<spacedim> & point);
3252 
3254 
3258 
3308  template <typename VectorType>
3309  void
3310  subtract_mean_value(VectorType &v, const std::vector<bool> &p_select = {});
3311 
3312 
3336  template <int dim, typename VectorType, int spacedim>
3337  typename VectorType::value_type
3339  const DoFHandler<dim, spacedim> &dof,
3340  const Quadrature<dim> & quadrature,
3341  const VectorType & v,
3342  const unsigned int component);
3343 
3348  template <int dim, typename VectorType, int spacedim>
3349  typename VectorType::value_type
3351  const Quadrature<dim> & quadrature,
3352  const VectorType & v,
3353  const unsigned int component);
3355 
3385  template <int dim,
3386  int spacedim,
3387  template <int, int> class DoFHandlerType,
3388  typename VectorType>
3389  void
3390  get_position_vector(const DoFHandlerType<dim, spacedim> &dh,
3391  VectorType & vector,
3392  const ComponentMask &mask = ComponentMask());
3393 
3395 
3400  "The given point is inside a cell of a "
3401  "parallel::distributed::Triangulation that is not "
3402  "locally owned by this processor.");
3403 } // namespace VectorTools
3404 
3405 
3406 // Make sure we can use NormType with Patterns.
3407 namespace Patterns
3408 {
3409  namespace Tools
3410  {
3411  template <>
3412  struct Convert<VectorTools::NormType, void>
3413  {
3417  static std::unique_ptr<Patterns::PatternBase>
3418  to_pattern()
3419  {
3420  return std_cxx14::make_unique<Patterns::Selection>(
3421  "mean|L1_norm|L2_norm|Lp_norm|"
3422  "Linfty_norm|H1_seminorm|Hdiv_seminorm|"
3423  "H1_norm|W1p_seminorm|W1p_norm|"
3424  "W1infty_seminorm|W1infty_norm");
3425  }
3426 
3427 
3428 
3432  static std::string
3433  to_string(const VectorTools::NormType & s,
3434  const std::unique_ptr<Patterns::PatternBase> &p =
3435  Convert<VectorTools::NormType>::to_pattern())
3436  {
3437  std::string str;
3438  if (s == VectorTools::mean)
3439  str = "mean";
3440  else if (s == VectorTools::L1_norm)
3441  str = "L1_norm";
3442  else if (s == VectorTools::L2_norm)
3443  str = "L2_norm";
3444  else if (s == VectorTools::Lp_norm)
3445  str = "Lp_norm";
3446  else if (s == VectorTools::Linfty_norm)
3447  str = "Linfty_norm";
3448  else if (s == VectorTools::H1_seminorm)
3449  str = "H1_seminorm";
3450  else if (s == VectorTools::Hdiv_seminorm)
3451  str = "Hdiv_seminorm";
3452  else if (s == VectorTools::H1_norm)
3453  str = "H1_norm";
3454  else if (s == VectorTools::W1p_seminorm)
3455  str = "W1p_seminorm";
3456  else if (s == VectorTools::W1infty_seminorm)
3457  str = "W1infty_seminorm";
3458  else if (s == VectorTools::W1infty_norm)
3459  str = "W1infty_norm";
3460  else if (s == VectorTools::W1p_norm)
3461  str = "W1p_norm";
3462  else
3463  {
3464  AssertThrow(false, ExcMessage("Didn't recognize a norm type."));
3465  }
3466  AssertThrow(p->match(str), ExcInternalError());
3467  return str;
3468  }
3469 
3470 
3474  static VectorTools::NormType
3475  to_value(const std::string & str,
3476  const std::unique_ptr<Patterns::PatternBase> &p =
3477  Convert<VectorTools::NormType>::to_pattern())
3478  {
3480  AssertThrow(p->match(str),
3481  ExcMessage(
3482  "String " + str +
3483  " cannot be converted to VectorTools::NormType"));
3484 
3485  if (str == "mean")
3486  norm = VectorTools::mean;
3487  else if (str == "L1_norm")
3488  norm = VectorTools::L1_norm;
3489  else if (str == "L2_norm")
3490  norm = VectorTools::L2_norm;
3491  else if (str == "Lp_norm")
3492  norm = VectorTools::Lp_norm;
3493  else if (str == "Linfty_norm")
3494  norm = VectorTools::Linfty_norm;
3495  else if (str == "H1_seminorm")
3496  norm = VectorTools::H1_seminorm;
3497  else if (str == "Hdiv_seminorm")
3499  else if (str == "H1_norm")
3500  norm = VectorTools::H1_norm;
3501  else if (str == "W1p_seminorm")
3503  else if (str == "W1infty_seminorm")
3505  else if (str == "W1infty_norm")
3507  else if (str == "W1p_norm")
3508  norm = VectorTools::W1p_norm;
3509  else
3510  {
3511  AssertThrow(false, ExcMessage("Didn't recognize a norm type."));
3512  }
3513  return norm;
3514  }
3515  };
3516  } // namespace Tools
3517 } // namespace Patterns
3518 
3519 DEAL_II_NAMESPACE_CLOSE
3520 
3521 #endif
void point_value(const DoFHandler< dim, spacedim > &dof, const VectorType &fe_function, const Point< spacedim > &point, Vector< typename VectorType::value_type > &value)
void point_gradient(const DoFHandler< dim, spacedim > &dof, const VectorType &fe_function, const Point< spacedim > &point, std::vector< Tensor< 1, spacedim, typename VectorType::value_type >> &value)
void compute_normal_flux_constraints(const DoFHandlerType< dim, spacedim > &dof_handler, const unsigned int first_vector_component, const std::set< types::boundary_id > &boundary_ids, AffineConstraints< double > &constraints, const Mapping< dim, spacedim > &mapping=StaticMappingQ1< dim >::mapping)
void interpolate_boundary_values(const DoFHandlerType< dim, spacedim > &dof, const std::map< types::boundary_id, const Function< spacedim, number > *> &function_map, AffineConstraints< number > &constraints, const ComponentMask &component_mask=ComponentMask())
void point_difference(const DoFHandler< dim, spacedim > &dof, const VectorType &fe_function, const Function< spacedim, typename VectorType::value_type > &exact_solution, Vector< typename VectorType::value_type > &difference, const Point< spacedim > &point)
void interpolate_based_on_material_id(const Mapping< dim, spacedim > &mapping, const DoFHandlerType< dim, spacedim > &dof_handler, const std::map< types::material_id, const Function< spacedim, typename VectorType::value_type > *> &function_map, VectorType &dst, const ComponentMask &component_mask=ComponentMask())
void compute_nonzero_tangential_flux_constraints(const DoFHandlerType< dim, spacedim > &dof_handler, const unsigned int first_vector_component, const std::set< types::boundary_id > &boundary_ids, const std::map< types::boundary_id, const Function< spacedim > *> &function_map, AffineConstraints< double > &constraints, const Mapping< dim, spacedim > &mapping=StaticMappingQ1< dim >::mapping)
unsigned int material_id
Definition: types.h:148
void compute_nonzero_normal_flux_constraints(const DoFHandlerType< dim, spacedim > &dof_handler, const unsigned int first_vector_component, const std::set< types::boundary_id > &boundary_ids, const std::map< types::boundary_id, const Function< spacedim > *> &function_map, AffineConstraints< double > &constraints, const Mapping< dim, spacedim > &mapping=StaticMappingQ1< dim >::mapping)
#define AssertThrow(cond, exc)
Definition: exceptions.h:1523
void create_right_hand_side(const Mapping< dim, spacedim > &mapping, const DoFHandler< dim, spacedim > &dof, const Quadrature< dim > &q, const Function< spacedim, typename VectorType::value_type > &rhs, VectorType &rhs_vector, const AffineConstraints< typename VectorType::value_type > &constraints=AffineConstraints< typename VectorType::value_type >())
LinearAlgebra::distributed::Vector< Number > Vector
void project_boundary_values(const DoFHandler< dim, spacedim > &dof, const std::map< types::boundary_id, const Function< spacedim, number > *> &boundary_function, const Quadrature< dim - 1 > &q, AffineConstraints< number > &constraints, std::vector< unsigned int > component_mapping={})
static ::ExceptionBase & ExcMessage(std::string arg1)
void get_position_vector(const DoFHandlerType< dim, spacedim > &dh, VectorType &vector, const ComponentMask &mask=ComponentMask())
Abstract base class for mapping classes.
Definition: mapping.h:302
#define DeclExceptionMsg(Exception, defaulttext)
Definition: exceptions.h:496
static ::ExceptionBase & ExcPointNotAvailableHere()
void create_point_source_vector(const Mapping< dim, spacedim > &mapping, const DoFHandler< dim, spacedim > &dof_handler, const Point< spacedim > &p, Vector< double > &rhs_vector)
VectorType::value_type compute_mean_value(const Mapping< dim, spacedim > &mapping, const DoFHandler< dim, spacedim > &dof, const Quadrature< dim > &quadrature, const VectorType &v, const unsigned int component)
Definition: hp.h:117
void project_boundary_values_curl_conforming_l2(const hp::DoFHandler< dim > &dof_handler, const unsigned int first_vector_component, const Function< dim, number > &boundary_function, const types::boundary_id boundary_component, AffineConstraints< number > &constraints, const hp::MappingCollection< dim, dim > &mapping_collection=hp::StaticMappingQ1< dim >::mapping_collection)
Definition: tensor.h:422
void subtract_mean_value(VectorType &v, const std::vector< bool > &p_select={})
void project_boundary_values_curl_conforming(const hp::DoFHandler< dim > &dof_handler, const unsigned int first_vector_component, const Function< dim, double > &boundary_function, const types::boundary_id boundary_component, AffineConstraints< double > &constraints, const hp::MappingCollection< dim, dim > &mapping_collection=hp::StaticMappingQ1< dim >::mapping_collection)
void compute_no_normal_flux_constraints(const DoFHandlerType< dim, spacedim > &dof_handler, const unsigned int first_vector_component, const std::set< types::boundary_id > &boundary_ids, AffineConstraints< double > &constraints, const Mapping< dim, spacedim > &mapping=StaticMappingQ1< dim >::mapping)
void create_boundary_right_hand_side(const Mapping< dim, spacedim > &mapping, const DoFHandler< dim, spacedim > &dof, const Quadrature< dim - 1 > &q, const Function< spacedim, typename VectorType::value_type > &rhs, VectorType &rhs_vector, const std::set< types::boundary_id > &boundary_ids=std::set< types::boundary_id >())
void project_boundary_values_div_conforming(const hp::DoFHandler< dim > &dof_handler, const unsigned int first_vector_component, const Function< dim, double > &boundary_function, const types::boundary_id boundary_component, AffineConstraints< double > &constraints, const hp::MappingCollection< dim, dim > &mapping_collection=hp::StaticMappingQ1< dim >::mapping_collection)
typename ActiveSelector::active_cell_iterator active_cell_iterator
Definition: dof_handler.h:328
void integrate_difference(const Mapping< dim, spacedim > &mapping, const DoFHandler< dim, spacedim > &dof, const InVector &fe_function, const Function< spacedim, typename InVector::value_type > &exact_solution, OutVector &difference, const Quadrature< dim > &q, const NormType &norm, const Function< spacedim, double > *weight=nullptr, const double exponent=2.)
double compute_global_error(const Triangulation< dim, spacedim > &tria, const InVector &cellwise_error, const NormType &norm, const double exponent=2.)
unsigned int boundary_id
Definition: types.h:125
void project(const Mapping< dim, spacedim > &mapping, const DoFHandler< dim, spacedim > &dof, const AffineConstraints< typename VectorType::value_type > &constraints, const Quadrature< dim > &quadrature, const Function< spacedim, typename VectorType::value_type > &function, VectorType &vec, const bool enforce_zero_boundary=false, const Quadrature< dim - 1 > &q_boundary=(dim > 1 ? QGauss< dim - 1 >(2) :Quadrature< dim - 1 >(0)), const bool project_to_boundary_first=false)
void interpolate_to_different_mesh(const DoFHandlerType< dim, spacedim > &dof1, const VectorType &u1, const DoFHandlerType< dim, spacedim > &dof2, VectorType &u2)
static ::ExceptionBase & ExcInternalError()