Reference documentation for deal.II version Git a0b41b6d0f 2020-02-26 20:08:13 -0600
\(\newcommand{\vcentcolon}{\mathrel{\mathop{:}}}\) \(\newcommand{\dealcoloneq}{\vcentcolon\mathrel{\mkern-1.2mu}=}\) \(\newcommand{\jump}[1]{\left[\!\left[ #1 \right]\!\right]}\) \(\newcommand{\average}[1]{\left\{\!\left\{ #1 \right\}\!\right\}}\)
dof_tools.h
1 // ---------------------------------------------------------------------
2 //
3 // Copyright (C) 1999 - 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_dof_tools_h
17 #define dealii_dof_tools_h
18 
19 
20 #include <deal.II/base/config.h>
21 
22 #include <deal.II/base/exceptions.h>
23 #include <deal.II/base/index_set.h>
24 #include <deal.II/base/point.h>
25 
26 #include <deal.II/dofs/dof_handler.h>
27 
28 #include <deal.II/fe/component_mask.h>
29 
30 #include <deal.II/hp/dof_handler.h>
31 
32 #include <deal.II/lac/affine_constraints.h>
33 
34 #include <map>
35 #include <ostream>
36 #include <set>
37 #include <vector>
38 
39 
40 DEAL_II_NAMESPACE_OPEN
41 
42 // Forward declarations
43 #ifndef DOXYGEN
44 class BlockMask;
45 template <int dim, typename RangeNumberType>
46 class Function;
47 template <int dim, int spacedim>
48 class FiniteElement;
49 namespace hp
50 {
51  template <int dim, int spacedim>
52  class MappingCollection;
53  template <int dim, int spacedim>
54  class FECollection;
55 } // namespace hp
56 template <class MeshType>
57 class InterGridMap;
58 template <int dim, int spacedim>
59 class Mapping;
60 class SparsityPattern;
61 template <int dim, class T>
62 class Table;
63 template <typename Number>
64 class Vector;
65 
66 namespace GridTools
67 {
68  template <typename CellIterator>
69  struct PeriodicFacePair;
70 }
71 
72 namespace DoFTools
73 {
74  namespace internal
75  {
76  /*
77  * Default value of the face_has_flux_coupling parameter of
78  * make_flux_sparsity_pattern. Defined here (instead of using a default
79  * lambda in the parameter list) to avoid a bug in gcc where the same lambda
80  * gets defined multiple times.
81  */
82  template <typename DoFHandlerType>
83  inline bool
84  always_couple_on_faces(
85  const typename DoFHandlerType::active_cell_iterator &,
86  const unsigned int)
87  {
88  return true;
89  }
90  } // namespace internal
91 } // namespace DoFTools
92 
93 #endif
94 
214 namespace DoFTools
215 {
227  enum Coupling
228  {
232  none,
245  };
246 
261  template <int dim, int spacedim>
262  void
264  const Table<2, Coupling> &table_by_component,
265  std::vector<Table<2, Coupling>> &tables_by_block);
266 
276  template <int dim, int spacedim>
277  void
279  const Table<2, Coupling> &table_by_component,
280  std::vector<Table<2, Coupling>> &tables_by_block);
281 
287  template <int dim, int spacedim>
291  const Table<2, Coupling> & component_couplings);
292 
300  template <int dim, int spacedim>
301  std::vector<Table<2, Coupling>>
304  const Table<2, Coupling> & component_couplings);
323  template <int dim, int spacedim>
324  DEAL_II_DEPRECATED unsigned int
326 
334  template <int dim, int spacedim>
335  DEAL_II_DEPRECATED unsigned int
337 
338 
349  template <int dim, int spacedim>
350  DEAL_II_DEPRECATED unsigned int
352 
363  template <int dim, int spacedim>
364  DEAL_II_DEPRECATED unsigned int
366 
377  template <int dim, int spacedim>
378  DEAL_II_DEPRECATED unsigned int
380 
391  template <int dim, int spacedim>
392  DEAL_II_DEPRECATED unsigned int
394 
406  template <int dim, int spacedim>
407  DEAL_II_DEPRECATED unsigned int
409 
421  template <int dim, int spacedim>
422  DEAL_II_DEPRECATED unsigned int
424 
436  template <int dim, int spacedim>
437  DEAL_II_DEPRECATED bool
439 
451  template <int dim, int spacedim>
452  DEAL_II_DEPRECATED bool
454 
580  template <typename DoFHandlerType,
581  typename SparsityPatternType,
582  typename number = double>
583  void
585  const DoFHandlerType & dof_handler,
586  SparsityPatternType & sparsity_pattern,
588  const bool keep_constrained_dofs = true,
590 
656  template <typename DoFHandlerType,
657  typename SparsityPatternType,
658  typename number = double>
659  void
661  const DoFHandlerType & dof_handler,
662  const Table<2, Coupling> & coupling,
663  SparsityPatternType & sparsity_pattern,
665  const bool keep_constrained_dofs = true,
667 
688  template <typename DoFHandlerType, typename SparsityPatternType>
689  void
690  make_sparsity_pattern(const DoFHandlerType &dof_row,
691  const DoFHandlerType &dof_col,
692  SparsityPatternType & sparsity);
693 
739  template <typename DoFHandlerType, typename SparsityPatternType>
740  void
741  make_flux_sparsity_pattern(const DoFHandlerType &dof_handler,
742  SparsityPatternType & sparsity_pattern);
743 
752  template <typename DoFHandlerType,
753  typename SparsityPatternType,
754  typename number>
755  void
757  const DoFHandlerType & dof_handler,
758  SparsityPatternType & sparsity_pattern,
759  const AffineConstraints<number> &constraints,
760  const bool keep_constrained_dofs = true,
762 
763 
783  template <typename DoFHandlerType, typename SparsityPatternType>
784  void
786  const DoFHandlerType & dof,
787  SparsityPatternType & sparsity,
788  const Table<2, Coupling> &cell_integrals_mask,
789  const Table<2, Coupling> &face_integrals_mask,
791 
792 
819  template <typename DoFHandlerType,
820  typename SparsityPatternType,
821  typename number>
822  void
824  const DoFHandlerType & dof,
825  SparsityPatternType & sparsity,
826  const AffineConstraints<number> &constraints,
827  const bool keep_constrained_dofs,
828  const Table<2, Coupling> & couplings,
829  const Table<2, Coupling> & face_couplings,
830  const types::subdomain_id subdomain_id,
831  const std::function<
832  bool(const typename DoFHandlerType::active_cell_iterator &,
833  const unsigned int)> &face_has_flux_coupling =
834  &internal::always_couple_on_faces<DoFHandlerType>);
835 
845  template <typename DoFHandlerType, typename SparsityPatternType>
846  void
848  const DoFHandlerType & dof,
849  const std::vector<types::global_dof_index> &dof_to_boundary_mapping,
850  SparsityPatternType & sparsity_pattern);
851 
869  template <typename DoFHandlerType,
870  typename SparsityPatternType,
871  typename number>
872  void
874  const DoFHandlerType &dof,
875  const std::map<types::boundary_id,
877  & boundary_ids,
878  const std::vector<types::global_dof_index> &dof_to_boundary_mapping,
879  SparsityPatternType & sparsity);
880 
931  template <typename DoFHandlerType, typename number>
932  void
933  make_hanging_node_constraints(const DoFHandlerType & dof_handler,
934  AffineConstraints<number> &constraints);
935 
1003  template <int dim, int spacedim>
1004  void
1006  const DoFHandler<dim, spacedim> & coarse_grid,
1007  const unsigned int coarse_component,
1008  const DoFHandler<dim, spacedim> & fine_grid,
1009  const unsigned int fine_component,
1010  const InterGridMap<DoFHandler<dim, spacedim>> &coarse_to_fine_grid_map,
1011  AffineConstraints<double> & constraints);
1012 
1013 
1030  template <int dim, int spacedim>
1031  void
1033  const DoFHandler<dim, spacedim> & coarse_grid,
1034  const unsigned int coarse_component,
1035  const DoFHandler<dim, spacedim> & fine_grid,
1036  const unsigned int fine_component,
1037  const InterGridMap<DoFHandler<dim, spacedim>> &coarse_to_fine_grid_map,
1038  std::vector<std::map<types::global_dof_index, float>>
1039  &transfer_representation);
1040 
1217  template <typename FaceIterator, typename number>
1218  void
1220  const FaceIterator & face_1,
1221  const typename identity<FaceIterator>::type &face_2,
1222  AffineConstraints<number> & constraints,
1223  const ComponentMask & component_mask = ComponentMask(),
1224  const bool face_orientation = true,
1225  const bool face_flip = false,
1226  const bool face_rotation = false,
1227  const FullMatrix<double> & matrix = FullMatrix<double>(),
1228  const std::vector<unsigned int> &first_vector_components =
1229  std::vector<unsigned int>(),
1230  const number periodicity_factor = 1.);
1231 
1232 
1233 
1255  template <typename DoFHandlerType, typename number>
1256  void
1258  const std::vector<
1260  & periodic_faces,
1261  AffineConstraints<number> & constraints,
1262  const ComponentMask & component_mask = ComponentMask(),
1263  const std::vector<unsigned int> &first_vector_components =
1264  std::vector<unsigned int>(),
1265  const number periodicity_factor = 1.);
1266 
1267 
1268 
1300  template <typename DoFHandlerType, typename number>
1301  void
1303  const DoFHandlerType & dof_handler,
1304  const types::boundary_id b_id1,
1305  const types::boundary_id b_id2,
1306  const unsigned int direction,
1307  AffineConstraints<number> &constraints,
1308  const ComponentMask & component_mask = ComponentMask(),
1309  const number periodicity_factor = 1.);
1310 
1311 
1312 
1338  template <typename DoFHandlerType, typename number>
1339  void
1341  const DoFHandlerType & dof_handler,
1342  const types::boundary_id b_id,
1343  const unsigned int direction,
1344  AffineConstraints<number> &constraints,
1345  const ComponentMask & component_mask = ComponentMask(),
1346  const number periodicity_factor = 1.);
1347 
1375  template <int dim, int spacedim>
1376  DEAL_II_DEPRECATED void
1378  std::vector<bool> & selected_dofs);
1379 
1384  template <int dim, int spacedim>
1385  IndexSet
1387 
1430  template <typename DoFHandlerType>
1431  DEAL_II_DEPRECATED void
1432  extract_dofs(const DoFHandlerType &dof_handler,
1433  const ComponentMask & component_mask,
1434  std::vector<bool> & selected_dofs);
1435 
1468  template <typename DoFHandlerType>
1469  IndexSet
1470  extract_dofs(const DoFHandlerType &dof_handler,
1471  const ComponentMask & component_mask);
1472 
1503  template <typename DoFHandlerType>
1504  DEAL_II_DEPRECATED void
1505  extract_dofs(const DoFHandlerType &dof_handler,
1506  const BlockMask & block_mask,
1507  std::vector<bool> & selected_dofs);
1508 
1532  template <typename DoFHandlerType>
1533  IndexSet
1534  extract_dofs(const DoFHandlerType &dof_handler, const BlockMask &block_mask);
1535 
1540  template <typename DoFHandlerType>
1541  void
1542  extract_level_dofs(const unsigned int level,
1543  const DoFHandlerType &dof,
1544  const ComponentMask & component_mask,
1545  std::vector<bool> & selected_dofs);
1546 
1551  template <typename DoFHandlerType>
1552  void
1553  extract_level_dofs(const unsigned int level,
1554  const DoFHandlerType &dof,
1555  const BlockMask & component_mask,
1556  std::vector<bool> & selected_dofs);
1557 
1610  template <typename DoFHandlerType>
1611  void
1612  extract_boundary_dofs(const DoFHandlerType & dof_handler,
1613  const ComponentMask & component_mask,
1614  std::vector<bool> & selected_dofs,
1615  const std::set<types::boundary_id> &boundary_ids =
1616  std::set<types::boundary_id>());
1617 
1648  template <typename DoFHandlerType>
1649  void
1650  extract_boundary_dofs(const DoFHandlerType & dof_handler,
1651  const ComponentMask & component_mask,
1652  IndexSet & selected_dofs,
1653  const std::set<types::boundary_id> &boundary_ids =
1654  std::set<types::boundary_id>());
1655 
1672  template <typename DoFHandlerType>
1673  void
1675  const DoFHandlerType & dof_handler,
1676  const ComponentMask & component_mask,
1677  std::vector<bool> & selected_dofs,
1678  const std::set<types::boundary_id> &boundary_ids =
1679  std::set<types::boundary_id>());
1680 
1708  template <typename DoFHandlerType, typename number = double>
1709  IndexSet
1711  const DoFHandlerType &dof_handler,
1712  const std::function<
1713  bool(const typename DoFHandlerType::active_cell_iterator &)> &predicate,
1714  const AffineConstraints<number> &constraints = AffineConstraints<number>());
1715 
1749  template <typename DoFHandlerType>
1750  void
1751  extract_constant_modes(const DoFHandlerType & dof_handler,
1752  const ComponentMask & component_mask,
1753  std::vector<std::vector<bool>> &constant_modes);
1755 
1769  template <typename DoFHandlerType>
1770  void
1771  extract_subdomain_dofs(const DoFHandlerType & dof_handler,
1772  const types::subdomain_id subdomain_id,
1773  std::vector<bool> & selected_dofs);
1774 
1775 
1785  template <typename DoFHandlerType>
1786  DEAL_II_DEPRECATED void
1787  extract_locally_owned_dofs(const DoFHandlerType &dof_handler,
1788  IndexSet & dof_set);
1789 
1790 
1805  template <typename DoFHandlerType>
1806  void
1807  extract_locally_active_dofs(const DoFHandlerType &dof_handler,
1808  IndexSet & dof_set);
1809 
1819  template <typename DoFHandlerType>
1820  void
1821  extract_locally_relevant_dofs(const DoFHandlerType &dof_handler,
1822  IndexSet & dof_set);
1823 
1824 
1836  template <typename DoFHandlerType>
1837  std::vector<IndexSet>
1839  const DoFHandlerType &dof_handler,
1840  const ComponentMask & components = ComponentMask());
1841 
1857  template <typename DoFHandlerType>
1858  std::vector<IndexSet>
1859  locally_owned_dofs_per_subdomain(const DoFHandlerType &dof_handler);
1860 
1877  template <typename DoFHandlerType>
1878  std::vector<IndexSet>
1879  locally_relevant_dofs_per_subdomain(const DoFHandlerType &dof_handler);
1880 
1881 
1886  template <typename DoFHandlerType>
1887  void
1888  extract_locally_relevant_level_dofs(const DoFHandlerType &dof_handler,
1889  const unsigned int level,
1890  IndexSet & dof_set);
1891 
1892 
1923  template <typename DoFHandlerType>
1924  void
1925  get_subdomain_association(const DoFHandlerType & dof_handler,
1926  std::vector<types::subdomain_id> &subdomain);
1927 
1953  template <typename DoFHandlerType>
1954  unsigned int
1955  count_dofs_with_subdomain_association(const DoFHandlerType & dof_handler,
1956  const types::subdomain_id subdomain);
1957 
1977  template <typename DoFHandlerType>
1978  void
1980  const DoFHandlerType & dof_handler,
1981  const types::subdomain_id subdomain,
1982  std::vector<unsigned int> &n_dofs_on_subdomain);
1983 
2005  template <typename DoFHandlerType>
2006  IndexSet
2007  dof_indices_with_subdomain_association(const DoFHandlerType & dof_handler,
2008  const types::subdomain_id subdomain);
2009  // @}
2019 
2071  template <typename DoFHandlerType>
2072  std::vector<types::global_dof_index>
2074  const std::vector<typename DoFHandlerType::active_cell_iterator> &patch);
2075 
2096  template <int dim, int spacedim>
2097  void
2098  make_cell_patches(SparsityPattern & block_list,
2099  const DoFHandler<dim, spacedim> &dof_handler,
2100  const unsigned int level,
2101  const std::vector<bool> & selected_dofs = {},
2102  const types::global_dof_index offset = 0);
2103 
2155  template <typename DoFHandlerType>
2156  std::vector<unsigned int>
2157  make_vertex_patches(SparsityPattern & block_list,
2158  const DoFHandlerType &dof_handler,
2159  const unsigned int level,
2160  const bool interior_dofs_only,
2161  const bool boundary_patches = false,
2162  const bool level_boundary_patches = false,
2163  const bool single_cell_patches = false,
2164  const bool invert_vertex_mapping = false);
2165 
2180  template <typename DoFHandlerType>
2181  std::vector<unsigned int>
2182  make_vertex_patches(SparsityPattern & block_list,
2183  const DoFHandlerType &dof_handler,
2184  const unsigned int level,
2185  const BlockMask & exclude_boundary_dofs = BlockMask(),
2186  const bool boundary_patches = false,
2187  const bool level_boundary_patches = false,
2188  const bool single_cell_patches = false,
2189  const bool invert_vertex_mapping = false);
2190 
2228  template <typename DoFHandlerType>
2229  void
2230  make_child_patches(SparsityPattern & block_list,
2231  const DoFHandlerType &dof_handler,
2232  const unsigned int level,
2233  const bool interior_dofs_only,
2234  const bool boundary_dofs = false);
2235 
2255  template <typename DoFHandlerType>
2256  void
2257  make_single_patch(SparsityPattern & block_list,
2258  const DoFHandlerType &dof_handler,
2259  const unsigned int level,
2260  const bool interior_dofs_only = false);
2261 
2304  template <typename DoFHandlerType>
2305  std::vector<types::global_dof_index>
2307  const DoFHandlerType & dof_handler,
2308  const bool vector_valued_once = false,
2309  const std::vector<unsigned int> &target_component = {});
2310 
2315  template <typename DoFHandlerType>
2316  DEAL_II_DEPRECATED void
2318  const DoFHandlerType & dof_handler,
2319  std::vector<types::global_dof_index> &dofs_per_component,
2320  const bool vector_valued_once = false,
2321  const std::vector<unsigned int> & target_component = {});
2322 
2339  template <typename DoFHandlerType>
2340  std::vector<types::global_dof_index>
2341  count_dofs_per_fe_block(const DoFHandlerType & dof,
2342  const std::vector<unsigned int> &target_block =
2343  std::vector<unsigned int>());
2344 
2349  template <typename DoFHandlerType>
2350  DEAL_II_DEPRECATED void
2351  count_dofs_per_block(const DoFHandlerType & dof,
2352  std::vector<types::global_dof_index> &dofs_per_block,
2353  const std::vector<unsigned int> & target_block =
2354  std::vector<unsigned int>());
2355 
2366  template <typename DoFHandlerType>
2367  void
2368  get_active_fe_indices(const DoFHandlerType & dof_handler,
2369  std::vector<unsigned int> &active_fe_indices);
2370 
2405  template <typename DoFHandlerType>
2406  unsigned int
2408  const std::vector<typename DoFHandlerType::active_cell_iterator> &patch);
2409 
2432  template <typename DoFHandlerType>
2433  void
2434  map_dof_to_boundary_indices(const DoFHandlerType & dof_handler,
2435  std::vector<types::global_dof_index> &mapping);
2436 
2447  template <typename DoFHandlerType>
2448  void
2449  map_dof_to_boundary_indices(const DoFHandlerType & dof_handler,
2450  const std::set<types::boundary_id> &boundary_ids,
2451  std::vector<types::global_dof_index> &mapping);
2452 
2481  template <int dim, int spacedim>
2482  void
2484  const DoFHandler<dim, spacedim> &dof_handler,
2485  std::vector<Point<spacedim>> & support_points,
2486  const ComponentMask &mask = ComponentMask());
2487 
2491  template <int dim, int spacedim>
2492  void
2494  const ::hp::MappingCollection<dim, spacedim> &mapping,
2495  const hp::DoFHandler<dim, spacedim> & dof_handler,
2496  std::vector<Point<spacedim>> & support_points,
2497  const ComponentMask & mask = ComponentMask());
2498 
2529  template <int dim, int spacedim>
2530  void
2532  const Mapping<dim, spacedim> & mapping,
2533  const DoFHandler<dim, spacedim> & dof_handler,
2534  std::map<types::global_dof_index, Point<spacedim>> &support_points,
2535  const ComponentMask & mask = ComponentMask());
2536 
2540  template <int dim, int spacedim>
2541  void
2543  const ::hp::MappingCollection<dim, spacedim> &mapping,
2544  const hp::DoFHandler<dim, spacedim> & dof_handler,
2545  std::map<types::global_dof_index, Point<spacedim>> &support_points,
2546  const ComponentMask & mask = ComponentMask());
2547 
2548 
2569  template <typename DoFHandlerType, class Comp>
2570  void
2573  & mapping,
2574  const DoFHandlerType &dof_handler,
2577  Comp> & point_to_index_map);
2615  template <typename DoFHandlerType, typename Number>
2616  void
2617  distribute_cell_to_dof_vector(const DoFHandlerType &dof_handler,
2618  const Vector<Number> &cell_data,
2619  Vector<double> & dof_data,
2620  const unsigned int component = 0);
2621 
2622 
2699  template <int spacedim>
2700  void
2702  std::ostream & out,
2703  const std::map<types::global_dof_index, Point<spacedim>> &support_points);
2704 
2705 
2746  template <int dim,
2747  int spacedim,
2748  template <int, int> class DoFHandlerType,
2749  typename number>
2750  void
2752  const DoFHandlerType<dim, spacedim> &dof,
2753  const types::boundary_id boundary_id,
2754  AffineConstraints<number> & zero_boundary_constraints,
2755  const ComponentMask & component_mask = ComponentMask());
2756 
2767  template <int dim,
2768  int spacedim,
2769  template <int, int> class DoFHandlerType,
2770  typename number>
2771  void
2773  const DoFHandlerType<dim, spacedim> &dof,
2774  AffineConstraints<number> & zero_boundary_constraints,
2775  const ComponentMask & component_mask = ComponentMask());
2776 
2821 } // namespace DoFTools
2822 
2823 
2824 
2825 /* ------------------------- inline functions -------------- */
2826 
2827 #ifndef DOXYGEN
2828 
2829 namespace DoFTools
2830 {
2836  inline Coupling
2837  operator|=(Coupling &c1, const Coupling c2)
2838  {
2839  if (c2 == always)
2840  c1 = always;
2841  else if (c1 != always && c2 == nonzero)
2842  return c1 = nonzero;
2843  return c1;
2844  }
2845 
2846 
2852  inline Coupling
2853  operator|(const Coupling c1, const Coupling c2)
2854  {
2855  if (c1 == always || c2 == always)
2856  return always;
2857  if (c1 == nonzero || c2 == nonzero)
2858  return nonzero;
2859  return none;
2860  }
2861 
2862 
2863  // ---------------------- inline and template functions --------------------
2864 
2865  template <int dim, int spacedim>
2866  inline unsigned int
2868  {
2869  return dh.get_fe().dofs_per_cell;
2870  }
2871 
2872 
2873  template <int dim, int spacedim>
2874  inline unsigned int
2876  {
2877  return dh.get_fe().dofs_per_face;
2878  }
2879 
2880 
2881  template <int dim, int spacedim>
2882  inline unsigned int
2884  {
2885  return dh.get_fe().dofs_per_vertex;
2886  }
2887 
2888 
2889  template <int dim, int spacedim>
2890  inline unsigned int
2892  {
2893  return dh.get_fe().n_components();
2894  }
2895 
2896 
2897 
2898  template <int dim, int spacedim>
2899  inline bool
2901  {
2902  return dh.get_fe().is_primitive();
2903  }
2904 
2905 
2906  template <int dim, int spacedim>
2907  inline unsigned int
2909  {
2910  return dh.get_fe_collection().max_dofs_per_cell();
2911  }
2912 
2913 
2914  template <int dim, int spacedim>
2915  inline unsigned int
2917  {
2918  return dh.get_fe_collection().max_dofs_per_face();
2919  }
2920 
2921 
2922  template <int dim, int spacedim>
2923  inline unsigned int
2925  {
2926  return dh.get_fe_collection().max_dofs_per_vertex();
2927  }
2928 
2929 
2930  template <int dim, int spacedim>
2931  inline unsigned int
2933  {
2934  return dh.get_fe(0).n_components();
2935  }
2936 
2937 
2938  template <int dim, int spacedim>
2939  inline bool
2941  {
2942  return dh.get_fe(0).is_primitive();
2943  }
2944 
2945 
2946  template <typename DoFHandlerType, class Comp>
2947  void
2950  & mapping,
2951  const DoFHandlerType &dof_handler,
2954  Comp> & point_to_index_map)
2955  {
2956  // let the checking of arguments be
2957  // done by the function first
2958  // called
2959  std::vector<Point<DoFHandlerType::space_dimension>> support_points(
2960  dof_handler.n_dofs());
2961  map_dofs_to_support_points(mapping, dof_handler, support_points);
2962  // now copy over the results of the
2963  // previous function into the
2964  // output arg
2965  point_to_index_map.clear();
2966  for (types::global_dof_index i = 0; i < dof_handler.n_dofs(); ++i)
2967  point_to_index_map[support_points[i]] = i;
2968  }
2969 } // namespace DoFTools
2970 
2971 #endif
2972 
2973 DEAL_II_NAMESPACE_CLOSE
2974 
2975 #endif
void write_gnuplot_dof_support_point_info(std::ostream &out, const std::map< types::global_dof_index, Point< spacedim >> &support_points)
Definition: dof_tools.cc:2410
void make_child_patches(SparsityPattern &block_list, const DoFHandlerType &dof_handler, const unsigned int level, const bool interior_dofs_only, const bool boundary_dofs=false)
Definition: dof_tools.cc:2605
unsigned int max_dofs_per_vertex(const DoFHandler< dim, spacedim > &dh)
std::vector< IndexSet > locally_owned_dofs_per_subdomain(const DoFHandlerType &dof_handler)
Definition: dof_tools.cc:1377
const types::subdomain_id invalid_subdomain_id
Definition: types.h:279
static ::ExceptionBase & ExcGridsDontMatch()
void map_dofs_to_support_points(const Mapping< dim, spacedim > &mapping, const DoFHandler< dim, spacedim > &dof_handler, std::vector< Point< spacedim >> &support_points, const ComponentMask &mask=ComponentMask())
Definition: dof_tools.cc:2320
void make_cell_patches(SparsityPattern &block_list, const DoFHandler< dim, spacedim > &dof_handler, const unsigned int level, const std::vector< bool > &selected_dofs={}, const types::global_dof_index offset=0)
Definition: dof_tools.cc:2512
void get_subdomain_association(const DoFHandlerType &dof_handler, std::vector< types::subdomain_id > &subdomain)
Definition: dof_tools.cc:1552
std::vector< types::global_dof_index > get_dofs_on_patch(const std::vector< typename DoFHandlerType::active_cell_iterator > &patch)
Definition: dof_tools.cc:2885
const hp::FECollection< dim, spacedim > & get_fe() const
void map_support_points_to_dofs(const Mapping< DoFHandlerType::dimension, DoFHandlerType::space_dimension > &mapping, const DoFHandlerType &dof_handler, std::map< Point< DoFHandlerType::space_dimension >, types::global_dof_index, Comp > &point_to_index_map)
std::vector< types::global_dof_index > count_dofs_per_fe_block(const DoFHandlerType &dof, const std::vector< unsigned int > &target_block=std::vector< unsigned int >())
Definition: dof_tools.cc:2026
bool fe_is_primitive(const DoFHandler< dim, spacedim > &dh)
static ::ExceptionBase & ExcFiniteElementsDontMatch()
void make_zero_boundary_constraints(const DoFHandlerType< dim, spacedim > &dof, AffineConstraints< number > &zero_boundary_constraints, const ComponentMask &component_mask=ComponentMask())
void extract_dofs(const DoFHandlerType &dof_handler, const ComponentMask &component_mask, std::vector< bool > &selected_dofs)
Definition: dof_tools.cc:397
void make_flux_sparsity_pattern(const DoFHandlerType &dof, SparsityPatternType &sparsity, const AffineConstraints< number > &constraints, const bool keep_constrained_dofs, const Table< 2, Coupling > &couplings, const Table< 2, Coupling > &face_couplings, const types::subdomain_id subdomain_id, const std::function< bool(const typename DoFHandlerType::active_cell_iterator &, const unsigned int)> &face_has_flux_coupling=&internal::always_couple_on_faces< DoFHandlerType >)
unsigned int count_dofs_with_subdomain_association(const DoFHandlerType &dof_handler, const types::subdomain_id subdomain)
Definition: dof_tools.cc:1651
const FiniteElement< dim, spacedim > & get_fe(const unsigned int index=0) const
void map_dof_to_boundary_indices(const DoFHandlerType &dof_handler, std::vector< types::global_dof_index > &mapping)
Definition: dof_tools.cc:2121
Table< 2, Coupling > dof_couplings_from_component_couplings(const FiniteElement< dim, spacedim > &fe, const Table< 2, Coupling > &component_couplings)
void extract_locally_relevant_level_dofs(const DoFHandlerType &dof_handler, const unsigned int level, IndexSet &dof_set)
Definition: dof_tools.cc:1225
void make_hanging_node_constraints(const DoFHandlerType &dof_handler, AffineConstraints< number > &constraints)
void make_periodicity_constraints(const FaceIterator &face_1, const typename identity< FaceIterator >::type &face_2, AffineConstraints< number > &constraints, const ComponentMask &component_mask=ComponentMask(), const bool face_orientation=true, const bool face_flip=false, const bool face_rotation=false, const FullMatrix< double > &matrix=FullMatrix< double >(), const std::vector< unsigned int > &first_vector_components=std::vector< unsigned int >(), const number periodicity_factor=1.)
LinearAlgebra::distributed::Vector< Number > Vector
IndexSet dof_indices_with_subdomain_association(const DoFHandlerType &dof_handler, const types::subdomain_id subdomain)
Definition: dof_tools.cc:1667
void make_sparsity_pattern(const DoFHandlerType &dof_row, const DoFHandlerType &dof_col, SparsityPatternType &sparsity)
UpdateFlags operator|(const UpdateFlags f1, const UpdateFlags f2)
unsigned int max_dofs_per_face(const DoFHandler< dim, spacedim > &dh)
unsigned int subdomain_id
Definition: types.h:43
void convert_couplings_to_blocks(const hp::DoFHandler< dim, spacedim > &dof_handler, const Table< 2, Coupling > &table_by_component, std::vector< Table< 2, Coupling >> &tables_by_block)
Definition: dof_tools.cc:2481
static ::ExceptionBase & ExcGridNotCoarser()
void count_dofs_per_component(const DoFHandlerType &dof_handler, std::vector< types::global_dof_index > &dofs_per_component, const bool vector_valued_once=false, const std::vector< unsigned int > &target_component={})
Definition: dof_tools.cc:1906
void extract_locally_owned_dofs(const DoFHandlerType &dof_handler, IndexSet &dof_set)
Definition: dof_tools.cc:1136
Abstract base class for mapping classes.
Definition: mapping.h:302
unsigned int max_dofs_per_cell(const DoFHandler< dim, spacedim > &dh)
#define DeclException0(Exception0)
Definition: exceptions.h:473
void compute_intergrid_transfer_representation(const DoFHandler< dim, spacedim > &coarse_grid, const unsigned int coarse_component, const DoFHandler< dim, spacedim > &fine_grid, const unsigned int fine_component, const InterGridMap< DoFHandler< dim, spacedim >> &coarse_to_fine_grid_map, std::vector< std::map< types::global_dof_index, float >> &transfer_representation)
void extract_locally_relevant_dofs(const DoFHandlerType &dof_handler, IndexSet &dof_set)
Definition: dof_tools.cc:1183
void extract_boundary_dofs(const DoFHandlerType &dof_handler, const ComponentMask &component_mask, std::vector< bool > &selected_dofs, const std::set< types::boundary_id > &boundary_ids=std::set< types::boundary_id >())
Definition: dof_tools.cc:637
void extract_hanging_node_dofs(const DoFHandler< dim, spacedim > &dof_handler, std::vector< bool > &selected_dofs)
Definition: dof_tools.cc:1077
void extract_dofs_with_support_on_boundary(const DoFHandlerType &dof_handler, const ComponentMask &component_mask, std::vector< bool > &selected_dofs, const std::set< types::boundary_id > &boundary_ids=std::set< types::boundary_id >())
Definition: dof_tools.cc:776
std::vector< types::global_dof_index > count_dofs_per_fe_component(const DoFHandlerType &dof_handler, const bool vector_valued_once=false, const std::vector< unsigned int > &target_component={})
Definition: dof_tools.cc:1920
std::vector< unsigned int > make_vertex_patches(SparsityPattern &block_list, const DoFHandlerType &dof_handler, const unsigned int level, const bool interior_dofs_only, const bool boundary_patches=false, const bool level_boundary_patches=false, const bool single_cell_patches=false, const bool invert_vertex_mapping=false)
Definition: dof_tools.cc:2677
const hp::FECollection< dim, spacedim > & get_fe_collection() const
Definition: hp.h:117
unsigned int global_dof_index
Definition: types.h:89
UpdateFlags & operator|=(UpdateFlags &f1, const UpdateFlags f2)
void extract_constant_modes(const DoFHandlerType &dof_handler, const ComponentMask &component_mask, std::vector< std::vector< bool >> &constant_modes)
Definition: dof_tools.cc:1274
std::vector< IndexSet > locally_relevant_dofs_per_subdomain(const DoFHandlerType &dof_handler)
Definition: dof_tools.cc:1477
void extract_locally_active_dofs(const DoFHandlerType &dof_handler, IndexSet &dof_set)
Definition: dof_tools.cc:1148
std::vector< IndexSet > locally_owned_dofs_per_component(const DoFHandlerType &dof_handler, const ComponentMask &components=ComponentMask())
Definition: dof_tools.cc:532
void extract_subdomain_dofs(const DoFHandlerType &dof_handler, const types::subdomain_id subdomain_id, std::vector< bool > &selected_dofs)
Definition: dof_tools.cc:1103
void count_dofs_per_block(const DoFHandlerType &dof, std::vector< types::global_dof_index > &dofs_per_block, const std::vector< unsigned int > &target_block=std::vector< unsigned int >())
Definition: dof_tools.cc:2015
void make_boundary_sparsity_pattern(const DoFHandlerType &dof, const std::map< types::boundary_id, const Function< DoFHandlerType::space_dimension, number > *> &boundary_ids, const std::vector< types::global_dof_index > &dof_to_boundary_mapping, SparsityPatternType &sparsity)
unsigned int count_dofs_on_patch(const std::vector< typename DoFHandlerType::active_cell_iterator > &patch)
Definition: dof_tools.cc:2856
static ::ExceptionBase & ExcInvalidBoundaryIndicator()
Definition: table.h:699
void extract_level_dofs(const unsigned int level, const DoFHandlerType &dof, const ComponentMask &component_mask, std::vector< bool > &selected_dofs)
Definition: dof_tools.cc:566
void compute_intergrid_constraints(const DoFHandler< dim, spacedim > &coarse_grid, const unsigned int coarse_component, const DoFHandler< dim, spacedim > &fine_grid, const unsigned int fine_component, const InterGridMap< DoFHandler< dim, spacedim >> &coarse_to_fine_grid_map, AffineConstraints< double > &constraints)
unsigned int n_components(const DoFHandler< dim, spacedim > &dh)
void get_active_fe_indices(const DoFHandlerType &dof_handler, std::vector< unsigned int > &active_fe_indices)
Definition: dof_tools.cc:1362
void distribute_cell_to_dof_vector(const DoFHandlerType &dof_handler, const Vector< Number > &cell_data, Vector< double > &dof_data, const unsigned int component=0)
Definition: dof_tools.cc:312
unsigned int boundary_id
Definition: types.h:125
static ::ExceptionBase & ExcNoFESelected()
IndexSet extract_dofs_with_support_contained_within(const DoFHandlerType &dof_handler, const std::function< bool(const typename DoFHandlerType::active_cell_iterator &)> &predicate, const AffineConstraints< number > &constraints=AffineConstraints< number >())
Definition: dof_tools.cc:863
void make_single_patch(SparsityPattern &block_list, const DoFHandlerType &dof_handler, const unsigned int level, const bool interior_dofs_only=false)
Definition: dof_tools.cc:2558