Reference documentation for deal.II version Git 31af17f30d 2020-12-04 11:18:37 -0500
\(\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\}}\)
dof_handler.h
Go to the documentation of this file.
1 // ---------------------------------------------------------------------
2 //
3 // Copyright (C) 1998 - 2020 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_handler_h
17 #define dealii_dof_handler_h
18 
19 
20 
21 #include <deal.II/base/config.h>
22 
24 #include <deal.II/base/function.h>
25 #include <deal.II/base/index_set.h>
28 
30 
33 #include <deal.II/dofs/dof_faces.h>
37 
39 
40 #include <boost/serialization/split_member.hpp>
41 
42 #include <map>
43 #include <memory>
44 #include <set>
45 #include <vector>
46 
48 
49 // Forward declarations
50 #ifndef DOXYGEN
51 template <int dim, int spacedim>
52 class FiniteElement;
53 template <int dim, int spacedim>
54 class Triangulation;
55 
56 namespace internal
57 {
58  namespace DoFHandlerImplementation
59  {
60  struct Implementation;
61 
62  namespace Policy
63  {
64  template <int dim, int spacedim>
65  class PolicyBase;
66  struct Implementation;
67  } // namespace Policy
68  } // namespace DoFHandlerImplementation
69 
70  namespace DoFAccessorImplementation
71  {
72  struct Implementation;
73  }
74 
75  namespace DoFCellAccessorImplementation
76  {
77  struct Implementation;
78  }
79 
80  namespace hp
81  {
82  namespace DoFHandlerImplementation
83  {
84  struct Implementation;
85  }
86  } // namespace hp
87 } // namespace internal
88 
89 namespace parallel
90 {
91  namespace distributed
92  {
93  template <int dim, int spacedim, typename VectorType>
94  class CellDataTransfer;
95  }
96 } // namespace parallel
97 #endif
98 
313 template <int dim, int spacedim = dim>
314 class DoFHandler : public Subscriptor
315 {
316  using ActiveSelector =
318  using LevelSelector =
320 
321 public:
334  using cell_accessor = typename ActiveSelector::CellAccessor;
335 
348  using face_accessor = typename ActiveSelector::FaceAccessor;
349 
357  using line_iterator = typename ActiveSelector::line_iterator;
358 
372  using active_line_iterator = typename ActiveSelector::active_line_iterator;
373 
381  using quad_iterator = typename ActiveSelector::quad_iterator;
382 
396  using active_quad_iterator = typename ActiveSelector::active_quad_iterator;
397 
405  using hex_iterator = typename ActiveSelector::hex_iterator;
406 
416  using active_hex_iterator = typename ActiveSelector::active_hex_iterator;
417 
438  using active_cell_iterator = typename ActiveSelector::active_cell_iterator;
439 
466  using cell_iterator = typename ActiveSelector::cell_iterator;
467 
484  using face_iterator = typename ActiveSelector::face_iterator;
485 
497  using active_face_iterator = typename ActiveSelector::active_face_iterator;
498 
499  using level_cell_accessor = typename LevelSelector::CellAccessor;
500  using level_face_accessor = typename LevelSelector::FaceAccessor;
501 
502  using level_cell_iterator = typename LevelSelector::cell_iterator;
503  using level_face_iterator = typename LevelSelector::face_iterator;
504 
505 
509  static const unsigned int dimension = dim;
510 
514  static const unsigned int space_dimension = spacedim;
515 
519  static const unsigned int default_fe_index = 0;
520 
524  static const unsigned int invalid_fe_index = numbers::invalid_unsigned_int;
525 
529  using active_fe_index_type = unsigned short int;
530 
534  using offset_type = unsigned int;
535 
540  static const active_fe_index_type invalid_active_fe_index =
541  static_cast<active_fe_index_type>(-1);
542 
547  DoFHandler();
548 
553 
560  DoFHandler(const DoFHandler &) = delete;
561 
565  virtual ~DoFHandler() override;
566 
573  DoFHandler &
574  operator=(const DoFHandler &) = delete;
575 
583  void
584  initialize(const Triangulation<dim, spacedim> &tria,
585  const FiniteElement<dim, spacedim> &fe);
586 
593  void
594  initialize(const Triangulation<dim, spacedim> & tria,
596 
621  void
622  set_fe(const FiniteElement<dim, spacedim> &fe);
623 
630  void
631  set_fe(const hp::FECollection<dim, spacedim> &fe);
632 
637  void
638  set_active_fe_indices(const std::vector<unsigned int> &active_fe_indices);
639 
645  void
646  get_active_fe_indices(std::vector<unsigned int> &active_fe_indices) const;
647 
655  void
657 
687  void
688  distribute_dofs(const FiniteElement<dim, spacedim> &fe);
689 
693  void
694  distribute_dofs(const hp::FECollection<dim, spacedim> &fe);
695 
701  void
702  distribute_mg_dofs();
703 
707  bool
708  has_hp_capabilities() const;
709 
715  bool
716  has_level_dofs() const;
717 
732  bool
733  has_active_dofs() const;
734 
741  void
742  initialize_local_block_info();
743 
747  void
748  clear();
749 
802  void
803  renumber_dofs(const std::vector<types::global_dof_index> &new_numbers);
804 
809  void
810  renumber_dofs(const unsigned int level,
811  const std::vector<types::global_dof_index> &new_numbers);
812 
841  unsigned int
842  max_couplings_between_dofs() const;
843 
856  unsigned int
857  max_couplings_between_boundary_dofs() const;
858 
859  /*--------------------------------------*/
860 
865  /*
866  * @{
867  */
868 
873  begin(const unsigned int level = 0) const;
874 
892  begin_active(const unsigned int level = 0) const;
893 
899  end() const;
900 
906  end(const unsigned int level) const;
907 
914  end_active(const unsigned int level) const;
915 
921  begin_mg(const unsigned int level = 0) const;
922 
928  end_mg(const unsigned int level) const;
929 
935  end_mg() const;
936 
952  cell_iterators() const;
953 
995  active_cell_iterators() const;
996 
1009  mg_cell_iterators() const;
1010 
1027  cell_iterators_on_level(const unsigned int level) const;
1028 
1045  active_cell_iterators_on_level(const unsigned int level) const;
1046 
1063  mg_cell_iterators_on_level(const unsigned int level) const;
1064 
1065  /*
1066  * @}
1067  */
1068 
1069 
1070  /*---------------------------------------*/
1071 
1072 
1097  n_dofs() const;
1098 
1107  n_dofs(const unsigned int level) const;
1108 
1114  n_boundary_dofs() const;
1115 
1127  template <typename number>
1129  n_boundary_dofs(
1130  const std::map<types::boundary_id, const Function<spacedim, number> *>
1131  &boundary_ids) const;
1132 
1138  n_boundary_dofs(const std::set<types::boundary_id> &boundary_ids) const;
1139 
1155  const BlockInfo &
1156  block_info() const;
1157 
1178  n_locally_owned_dofs() const;
1179 
1185  const IndexSet &
1186  locally_owned_dofs() const;
1187 
1192  const IndexSet &
1193  locally_owned_mg_dofs(const unsigned int level) const;
1194 
1208  DEAL_II_DEPRECATED const std::vector<IndexSet> &
1209  locally_owned_dofs_per_processor() const;
1210 
1227  DEAL_II_DEPRECATED const std::vector<types::global_dof_index> &
1228  n_locally_owned_dofs_per_processor() const;
1229 
1244  DEAL_II_DEPRECATED const std::vector<IndexSet> &
1245  locally_owned_mg_dofs_per_processor(const unsigned int level) const;
1246 
1253  get_fe(const unsigned int index = 0) const;
1254 
1262  get_fe_collection() const;
1263 
1268  get_triangulation() const;
1269 
1286  void
1287  prepare_for_serialization_of_active_fe_indices();
1288 
1304  void
1305  deserialize_active_fe_indices();
1306 
1315  virtual std::size_t
1316  memory_consumption() const;
1317 
1322  template <class Archive>
1323  void
1324  save(Archive &ar, const unsigned int version) const;
1325 
1330  template <class Archive>
1331  void
1332  load(Archive &ar, const unsigned int version);
1333 
1334 #ifdef DOXYGEN
1335 
1339  template <class Archive>
1340  void
1341  serialize(Archive &archive, const unsigned int version);
1342 #else
1343  // This macro defines the serialize() method that is compatible with
1344  // the templated save() and load() method that have been implemented.
1345  BOOST_SERIALIZATION_SPLIT_MEMBER()
1346 #endif
1347 
1361  DeclException1(ExcInvalidLevel,
1362  int,
1363  << "The given level " << arg1
1364  << " is not in the valid range!");
1369  DeclException1(ExcNewNumbersNotConsecutive,
1371  << "The given list of new dof indices is not consecutive: "
1372  << "the index " << arg1 << " does not exist.");
1376  DeclException2(ExcInvalidFEIndex,
1377  int,
1378  int,
1379  << "The mesh contains a cell with an active_fe_index of "
1380  << arg1 << ", but the finite element collection only has "
1381  << arg2 << " elements");
1382 
1387  DeclExceptionMsg(ExcNotAvailableWithoutHP,
1388  "The current function doesn't make sense when used with a "
1389  "DoFHandler without hp capabilities.");
1390 
1395  DeclExceptionMsg(ExcNotImplementedWithHP,
1396  "The current function has not yet been implemented for a "
1397  "DoFHandler with hp capabilities.");
1398 
1399 private:
1407  {
1408  public:
1412  MGVertexDoFs();
1413 
1419  void
1420  init(const unsigned int coarsest_level,
1421  const unsigned int finest_level,
1422  const unsigned int dofs_per_vertex);
1423 
1427  unsigned int
1428  get_coarsest_level() const;
1429 
1433  unsigned int
1434  get_finest_level() const;
1435 
1441  get_index(const unsigned int level,
1442  const unsigned int dof_number,
1443  const unsigned int dofs_per_vertex) const;
1444 
1449  void
1450  set_index(const unsigned int level,
1451  const unsigned int dof_number,
1452  const unsigned int dofs_per_vertex,
1453  const types::global_dof_index index);
1454 
1455  private:
1459  unsigned int coarsest_level;
1460 
1464  unsigned int finest_level;
1465 
1475  std::unique_ptr<types::global_dof_index[]> indices;
1476  };
1477 
1485  {
1490  std::map<const cell_iterator, const unsigned int> persisting_cells_fe_index;
1491 
1496  std::map<const cell_iterator, const unsigned int> refined_cells_fe_index;
1497 
1502  std::map<const cell_iterator, const unsigned int> coarsened_cells_fe_index;
1503 
1509  std::vector<unsigned int> active_fe_indices;
1510 
1516  std::unique_ptr<
1517  parallel::distributed::
1518  CellDataTransfer<dim, spacedim, std::vector<unsigned int>>>
1520  };
1521 
1526 
1532 
1538 
1545 
1550  std::unique_ptr<::internal::DoFHandlerImplementation::Policy::
1551  PolicyBase<dim, spacedim>>
1553 
1562 
1566  std::vector<::internal::DoFHandlerImplementation::NumberCache>
1568 
1574  mutable std::vector<std::vector<types::global_dof_index>>
1576 
1581  mutable std::vector<std::vector<offset_type>> cell_dof_cache_ptr;
1582 
1588  mutable std::vector<std::array<std::vector<types::global_dof_index>, dim + 1>>
1590 
1599  mutable std::vector<std::array<std::vector<offset_type>, dim + 1>>
1601 
1607  mutable std::array<std::vector<active_fe_index_type>, dim + 1>
1609 
1613  mutable std::array<std::vector<offset_type>, dim + 1> hp_object_fe_ptr;
1614 
1619  mutable std::vector<std::vector<active_fe_index_type>>
1621 
1626  mutable std::vector<std::vector<active_fe_index_type>>
1628 
1633  std::vector<MGVertexDoFs> mg_vertex_dofs;
1634 
1638  std::vector<
1639  std::unique_ptr<::internal::DoFHandlerImplementation::DoFLevel<dim>>>
1641 
1645  std::unique_ptr<::internal::DoFHandlerImplementation::DoFFaces<dim>>
1647 
1652  std::unique_ptr<ActiveFEIndexTransfer> active_fe_index_transfer;
1653 
1658  std::vector<boost::signals2::connection> tria_listeners;
1659 
1663  void
1664  clear_space();
1665 
1669  void
1670  clear_mg_space();
1671 
1675  template <int structdim>
1677  get_dof_index(const unsigned int obj_level,
1678  const unsigned int obj_index,
1679  const unsigned int fe_index,
1680  const unsigned int local_index) const;
1681 
1685  template <int structdim>
1686  void
1687  set_dof_index(const unsigned int obj_level,
1688  const unsigned int obj_index,
1689  const unsigned int fe_index,
1690  const unsigned int local_index,
1692 
1696  void
1697  setup_policy();
1698 
1703  void
1704  connect_to_triangulation_signals();
1705 
1717  void
1718  create_active_fe_table();
1719 
1732  void
1733  update_active_fe_table();
1734 
1744  void
1745  pre_transfer_action();
1746 
1755  void
1756  post_transfer_action();
1757 
1766  void
1767  pre_distributed_transfer_action();
1768 
1777  void
1778  post_distributed_transfer_action();
1779 
1780 
1781  // Make accessor objects friends.
1782  template <int, int, int, bool>
1783  friend class ::DoFAccessor;
1784  template <int, int, bool>
1785  friend class ::DoFCellAccessor;
1786  friend struct ::internal::DoFAccessorImplementation::Implementation;
1787  friend struct ::internal::DoFCellAccessorImplementation::Implementation;
1788 
1789  // Likewise for DoFLevel objects since they need to access the vertex dofs
1790  // in the functions that set and retrieve vertex dof indices.
1791  friend struct ::internal::DoFHandlerImplementation::Implementation;
1792  friend struct ::internal::hp::DoFHandlerImplementation::Implementation;
1793  friend struct ::internal::DoFHandlerImplementation::Policy::
1794  Implementation;
1795 
1796  // explicitly check for sensible template arguments, but not on windows
1797  // because MSVC creates bogus warnings during normal compilation
1798 #ifndef DEAL_II_MSVC
1799  static_assert(dim <= spacedim,
1800  "The dimension <dim> of a DoFHandler must be less than or "
1801  "equal to the space dimension <spacedim> in which it lives.");
1802 #endif
1803 };
1804 
1805 #ifndef DOXYGEN
1806 
1807 /* ----------------------- Inline functions ----------------------------------
1808  */
1809 
1810 
1811 template <int dim, int spacedim>
1812 inline bool
1814 {
1815  return hp_capability_enabled;
1816 }
1817 
1818 
1819 
1820 template <int dim, int spacedim>
1821 inline bool
1823 {
1824  return mg_number_cache.size() > 0;
1825 }
1826 
1827 
1828 
1829 template <int dim, int spacedim>
1830 inline bool
1832 {
1833  return number_cache.n_global_dofs > 0;
1834 }
1835 
1836 
1837 
1838 template <int dim, int spacedim>
1841 {
1842  return number_cache.n_global_dofs;
1843 }
1844 
1845 
1846 
1847 template <int dim, int spacedim>
1849 DoFHandler<dim, spacedim>::n_dofs(const unsigned int level) const
1850 {
1851  Assert(has_level_dofs(),
1852  ExcMessage(
1853  "n_dofs(level) can only be called after distribute_mg_dofs()"));
1854  Assert(level < mg_number_cache.size(), ExcInvalidLevel(level));
1855  return mg_number_cache[level].n_global_dofs;
1856 }
1857 
1858 
1859 
1860 template <int dim, int spacedim>
1863 {
1864  return number_cache.n_locally_owned_dofs;
1865 }
1866 
1867 
1868 
1869 template <int dim, int spacedim>
1870 const IndexSet &
1872 {
1873  return number_cache.locally_owned_dofs;
1874 }
1875 
1876 
1877 
1878 template <int dim, int spacedim>
1879 const IndexSet &
1880 DoFHandler<dim, spacedim>::locally_owned_mg_dofs(const unsigned int level) const
1881 {
1882  Assert(level < this->get_triangulation().n_global_levels(),
1883  ExcMessage("The given level index exceeds the number of levels "
1884  "present in the triangulation"));
1885  Assert(
1886  mg_number_cache.size() == this->get_triangulation().n_global_levels(),
1887  ExcMessage(
1888  "The level dofs are not set up properly! Did you call distribute_mg_dofs()?"));
1889  return mg_number_cache[level].locally_owned_dofs;
1890 }
1891 
1892 
1893 
1894 template <int dim, int spacedim>
1895 const std::vector<types::global_dof_index> &
1897 {
1898  if (number_cache.n_locally_owned_dofs_per_processor.empty() &&
1899  number_cache.n_global_dofs > 0)
1900  {
1901  MPI_Comm comm;
1902 
1904  (dynamic_cast<const parallel::TriangulationBase<dim, spacedim> *>(
1905  &this->get_triangulation()));
1906  if (tr != nullptr)
1907  comm = tr->get_communicator();
1908  else
1909  comm = MPI_COMM_SELF;
1910 
1912  number_cache)
1913  .n_locally_owned_dofs_per_processor =
1914  number_cache.get_n_locally_owned_dofs_per_processor(comm);
1915  }
1916  return number_cache.n_locally_owned_dofs_per_processor;
1917 }
1918 
1919 
1920 
1921 template <int dim, int spacedim>
1922 const std::vector<IndexSet> &
1924 {
1925  if (number_cache.locally_owned_dofs_per_processor.empty() &&
1926  number_cache.n_global_dofs > 0)
1927  {
1928  MPI_Comm comm;
1929 
1931  (dynamic_cast<const parallel::TriangulationBase<dim, spacedim> *>(
1932  &this->get_triangulation()));
1933  if (tr != nullptr)
1934  comm = tr->get_communicator();
1935  else
1936  comm = MPI_COMM_SELF;
1937 
1939  number_cache)
1940  .locally_owned_dofs_per_processor =
1941  number_cache.get_locally_owned_dofs_per_processor(comm);
1942  }
1943  return number_cache.locally_owned_dofs_per_processor;
1944 }
1945 
1946 
1947 
1948 template <int dim, int spacedim>
1949 const std::vector<IndexSet> &
1951  const unsigned int level) const
1952 {
1953  Assert(level < this->get_triangulation().n_global_levels(),
1954  ExcMessage("The given level index exceeds the number of levels "
1955  "present in the triangulation"));
1956  Assert(
1957  mg_number_cache.size() == this->get_triangulation().n_global_levels(),
1958  ExcMessage(
1959  "The level dofs are not set up properly! Did you call distribute_mg_dofs()?"));
1960  if (mg_number_cache[level].locally_owned_dofs_per_processor.empty() &&
1961  mg_number_cache[level].n_global_dofs > 0)
1962  {
1963  MPI_Comm comm;
1964 
1966  (dynamic_cast<const parallel::TriangulationBase<dim, spacedim> *>(
1967  &this->get_triangulation()));
1968  if (tr != nullptr)
1969  comm = tr->get_communicator();
1970  else
1971  comm = MPI_COMM_SELF;
1972 
1974  mg_number_cache[level])
1975  .locally_owned_dofs_per_processor =
1976  mg_number_cache[level].get_locally_owned_dofs_per_processor(comm);
1977  }
1978  return mg_number_cache[level].locally_owned_dofs_per_processor;
1979 }
1980 
1981 
1982 
1983 template <int dim, int spacedim>
1984 inline const FiniteElement<dim, spacedim> &
1985 DoFHandler<dim, spacedim>::get_fe(const unsigned int number) const
1986 {
1987  Assert(fe_collection.size() > 0,
1988  ExcMessage("No finite element collection is associated with "
1989  "this DoFHandler"));
1990  return fe_collection[number];
1991 }
1992 
1993 
1994 
1995 template <int dim, int spacedim>
1996 inline const hp::FECollection<dim, spacedim> &
1998 {
1999  Assert(fe_collection.size() > 0,
2000  ExcMessage("No finite element collection is associated with "
2001  "this DoFHandler"));
2002  return fe_collection;
2003 }
2004 
2005 
2006 
2007 template <int dim, int spacedim>
2008 inline const Triangulation<dim, spacedim> &
2010 {
2011  Assert(tria != nullptr,
2012  ExcMessage("This DoFHandler object has not been associated "
2013  "with a triangulation."));
2014  return *tria;
2015 }
2016 
2017 
2018 
2019 template <int dim, int spacedim>
2020 inline const BlockInfo &
2022 {
2023  Assert(this->hp_capability_enabled == false, ExcNotImplementedWithHP());
2024 
2025  return block_info_object;
2026 }
2027 
2028 
2029 
2030 template <int dim, int spacedim>
2031 template <typename number>
2034  const std::map<types::boundary_id, const Function<spacedim, number> *>
2035  &boundary_ids) const
2036 {
2037  Assert(!(dim == 2 && spacedim == 3) || this->hp_capability_enabled == false,
2038  ExcNotImplementedWithHP());
2039 
2040  // extract the set of boundary ids and forget about the function object
2041  // pointers
2042  std::set<types::boundary_id> boundary_ids_only;
2043  for (typename std::map<types::boundary_id,
2044  const Function<spacedim, number> *>::const_iterator p =
2045  boundary_ids.begin();
2046  p != boundary_ids.end();
2047  ++p)
2048  boundary_ids_only.insert(p->first);
2049 
2050  // then just hand everything over to the other function that does the work
2051  return n_boundary_dofs(boundary_ids_only);
2052 }
2053 
2054 
2055 
2056 namespace internal
2057 {
2065  template <int dim, int spacedim>
2066  std::string
2067  policy_to_string(const ::internal::DoFHandlerImplementation::Policy::
2068  PolicyBase<dim, spacedim> &policy);
2069 } // namespace internal
2070 
2071 
2072 
2073 template <int dim, int spacedim>
2074 template <class Archive>
2075 void
2076 DoFHandler<dim, spacedim>::save(Archive &ar, const unsigned int) const
2077 {
2078  if (this->hp_capability_enabled)
2079  {
2080  ar & this->object_dof_indices;
2081  ar & this->object_dof_ptr;
2082 
2083  ar & this->cell_dof_cache_indices;
2084  ar & this->cell_dof_cache_ptr;
2085 
2086  ar & this->hp_cell_active_fe_indices;
2087  ar & this->hp_cell_future_fe_indices;
2088 
2089  ar &hp_object_fe_ptr;
2090  ar &hp_object_fe_indices;
2091 
2092  ar &number_cache;
2093 
2094  ar &mg_number_cache;
2095 
2096  // write out the number of triangulation cells and later check during
2097  // loading that this number is indeed correct; same with something that
2098  // identifies the policy
2099  const unsigned int n_cells = this->tria->n_cells();
2100  std::string policy_name =
2101  ::internal::policy_to_string(*this->policy);
2102 
2103  ar &n_cells &policy_name;
2104  }
2105  else
2106  {
2107  ar & this->block_info_object;
2108  ar &number_cache;
2109 
2110  ar & this->object_dof_indices;
2111  ar & this->object_dof_ptr;
2112 
2113  ar & this->cell_dof_cache_indices;
2114  ar & this->cell_dof_cache_ptr;
2115 
2116  // write out the number of triangulation cells and later check during
2117  // loading that this number is indeed correct; same with something that
2118  // identifies the FE and the policy
2119  unsigned int n_cells = this->tria->n_cells();
2120  std::string fe_name = this->get_fe(0).get_name();
2121  std::string policy_name = internal::policy_to_string(*this->policy);
2122 
2123  ar &n_cells &fe_name &policy_name;
2124  }
2125 }
2126 
2127 
2128 
2129 template <int dim, int spacedim>
2130 template <class Archive>
2131 void
2132 DoFHandler<dim, spacedim>::load(Archive &ar, const unsigned int)
2133 {
2134  if (this->hp_capability_enabled)
2135  {
2136  ar & this->object_dof_indices;
2137  ar & this->object_dof_ptr;
2138 
2139  ar & this->cell_dof_cache_indices;
2140  ar & this->cell_dof_cache_ptr;
2141 
2142  ar & this->hp_cell_active_fe_indices;
2143  ar & this->hp_cell_future_fe_indices;
2144 
2145  ar &hp_object_fe_ptr;
2146  ar &hp_object_fe_indices;
2147 
2148  ar &number_cache;
2149 
2150  ar &mg_number_cache;
2151 
2152  // these are the checks that correspond to the last block in the save()
2153  // function
2154  unsigned int n_cells;
2155  std::string policy_name;
2156 
2157  ar &n_cells &policy_name;
2158 
2159  AssertThrow(
2160  n_cells == this->tria->n_cells(),
2161  ExcMessage(
2162  "The object being loaded into does not match the triangulation "
2163  "that has been stored previously."));
2164  AssertThrow(
2165  policy_name == ::internal::policy_to_string(*this->policy),
2166  ExcMessage("The policy currently associated with this DoFHandler (" +
2167  ::internal::policy_to_string(*this->policy) +
2168  ") does not match the one that was associated with the "
2169  "DoFHandler previously stored (" +
2170  policy_name + ")."));
2171  }
2172  else
2173  {
2174  ar & this->block_info_object;
2175  ar &number_cache;
2176 
2177  object_dof_indices.clear();
2178 
2179  object_dof_ptr.clear();
2180 
2181  ar & this->object_dof_indices;
2182  ar & this->object_dof_ptr;
2183 
2184  ar & this->cell_dof_cache_indices;
2185  ar & this->cell_dof_cache_ptr;
2186 
2187  // these are the checks that correspond to the last block in the save()
2188  // function
2189  unsigned int n_cells;
2190  std::string fe_name;
2191  std::string policy_name;
2192 
2193  ar &n_cells &fe_name &policy_name;
2194 
2195  AssertThrow(
2196  n_cells == this->tria->n_cells(),
2197  ExcMessage(
2198  "The object being loaded into does not match the triangulation "
2199  "that has been stored previously."));
2200  AssertThrow(
2201  fe_name == this->get_fe(0).get_name(),
2202  ExcMessage(
2203  "The finite element associated with this DoFHandler does not match "
2204  "the one that was associated with the DoFHandler previously stored."));
2205  AssertThrow(policy_name == internal::policy_to_string(*this->policy),
2206  ExcMessage(
2207  "The policy currently associated with this DoFHandler (" +
2208  internal::policy_to_string(*this->policy) +
2209  ") does not match the one that was associated with the "
2210  "DoFHandler previously stored (" +
2211  policy_name + ")."));
2212  }
2213 }
2214 
2215 
2216 
2217 template <int dim, int spacedim>
2220  const unsigned int level,
2221  const unsigned int dof_number,
2222  const unsigned int dofs_per_vertex) const
2223 {
2224  Assert((level >= coarsest_level) && (level <= finest_level),
2225  ExcInvalidLevel(level));
2226  return indices[dofs_per_vertex * (level - coarsest_level) + dof_number];
2227 }
2228 
2229 
2230 
2231 template <int dim, int spacedim>
2232 inline void
2234  const unsigned int level,
2235  const unsigned int dof_number,
2236  const unsigned int dofs_per_vertex,
2237  const types::global_dof_index index)
2238 {
2239  Assert((level >= coarsest_level) && (level <= finest_level),
2240  ExcInvalidLevel(level));
2241  indices[dofs_per_vertex * (level - coarsest_level) + dof_number] = index;
2242 }
2243 
2244 
2245 #endif // DOXYGEN
2246 
2248 
2249 #endif
std::vector< types::global_dof_index > get_n_locally_owned_dofs_per_processor(const MPI_Comm &mpi_communicator) const
Definition: number_cache.cc:87
std::vector< MGVertexDoFs > mg_vertex_dofs
Definition: dof_handler.h:1633
static const unsigned int invalid_unsigned_int
Definition: types.h:196
void reinit(MatrixBlock< MatrixType > &v, const BlockSparsityPattern &p)
Definition: matrix_block.h:618
typename ActiveSelector::FaceAccessor face_accessor
Definition: dof_handler.h:348
std::array< std::vector< offset_type >, dim+1 > hp_object_fe_ptr
Definition: dof_handler.h:1613
#define DeclException2(Exception2, type1, type2, outsequence)
Definition: exceptions.h:538
typename LevelSelector::face_iterator level_face_iterator
Definition: dof_handler.h:503
std::map< const cell_iterator, const unsigned int > coarsened_cells_fe_index
Definition: dof_handler.h:1502
typename ActiveSelector::quad_iterator quad_iterator
Definition: dof_handler.h:381
unsigned short int active_fe_index_type
Definition: dof_handler.h:529
::internal::DoFHandlerImplementation::NumberCache number_cache
Definition: dof_handler.h:1561
std::vector< std::array< std::vector< offset_type >, dim+1 > > object_dof_ptr
Definition: dof_handler.h:1600
typename ActiveSelector::CellAccessor cell_accessor
Definition: dof_handler.h:334
#define AssertThrow(cond, exc)
Definition: exceptions.h:1576
std::vector< std::unique_ptr<::internal::DoFHandlerImplementation::DoFLevel< dim > > > mg_levels
Definition: dof_handler.h:1640
void save(Archive &ar, const unsigned int version) const
std::vector< std::vector< active_fe_index_type > > hp_cell_future_fe_indices
Definition: dof_handler.h:1627
typename ActiveSelector::face_iterator face_iterator
Definition: dof_handler.h:484
typename ActiveSelector::active_face_iterator active_face_iterator
Definition: dof_handler.h:497
const hp::FECollection< dim, spacedim > & get_fe_collection() const
const FiniteElement< dim, spacedim > & get_fe(const unsigned int index=0) const
std::vector< std::vector< types::global_dof_index > > cell_dof_cache_indices
Definition: dof_handler.h:1575
std::map< const cell_iterator, const unsigned int > refined_cells_fe_index
Definition: dof_handler.h:1496
BlockInfo block_info_object
Definition: dof_handler.h:1525
static ::ExceptionBase & ExcMessage(std::string arg1)
std::map< const cell_iterator, const unsigned int > persisting_cells_fe_index
Definition: dof_handler.h:1490
#define DeclException1(Exception1, type1, outsequence)
Definition: exceptions.h:515
typename LevelSelector::CellAccessor level_cell_accessor
Definition: dof_handler.h:499
typename ActiveSelector::hex_iterator hex_iterator
Definition: dof_handler.h:405
std::vector<::internal::DoFHandlerImplementation::NumberCache > mg_number_cache
Definition: dof_handler.h:1567
bool has_active_dofs() const
#define Assert(cond, exc)
Definition: exceptions.h:1466
hp::FECollection< dim, spacedim > fe_collection
Definition: dof_handler.h:1544
std::vector< IndexSet > get_locally_owned_dofs_per_processor(const MPI_Comm &mpi_communicator) const
types::global_dof_index n_dofs() const
std::unique_ptr< ActiveFEIndexTransfer > active_fe_index_transfer
Definition: dof_handler.h:1652
std::vector< std::array< std::vector< types::global_dof_index >, dim+1 > > object_dof_indices
Definition: dof_handler.h:1589
#define DeclExceptionMsg(Exception, defaulttext)
Definition: exceptions.h:493
std::unique_ptr<::internal::DoFHandlerImplementation::DoFFaces< dim > > mg_faces
Definition: dof_handler.h:1646
#define DeclException0(Exception0)
Definition: exceptions.h:470
#define DEAL_II_NAMESPACE_CLOSE
Definition: config.h:372
unsigned int level
Definition: grid_out.cc:4343
SmartPointer< const Triangulation< dim, spacedim >, DoFHandler< dim, spacedim > > tria
Definition: dof_handler.h:1537
VectorType::value_type * end(VectorType &V)
typename LevelSelector::cell_iterator level_cell_iterator
Definition: dof_handler.h:502
void load(Archive &ar, const unsigned int version)
std::unique_ptr<::internal::DoFHandlerImplementation::Policy::PolicyBase< dim, spacedim > > policy
Definition: dof_handler.h:1552
void set_index(const unsigned int level, const unsigned int dof_number, const unsigned int dofs_per_vertex, const types::global_dof_index index)
std::unique_ptr< parallel::distributed::CellDataTransfer< dim, spacedim, std::vector< unsigned int > > > cell_data_transfer
Definition: dof_handler.h:1519
Definition: hp.h:117
std::vector< std::vector< active_fe_index_type > > hp_cell_active_fe_indices
Definition: dof_handler.h:1620
unsigned int n_cells(const internal::TriangulationImplementation::NumberCache< 1 > &c)
Definition: tria.cc:11979
virtual const MPI_Comm & get_communicator() const
Definition: tria_base.cc:139
typename LevelSelector::FaceAccessor level_face_accessor
Definition: dof_handler.h:500
std::vector< unsigned int > active_fe_indices
Definition: dof_handler.h:1509
std::array< std::vector< active_fe_index_type >, dim+1 > hp_object_fe_indices
Definition: dof_handler.h:1608
const IndexSet & locally_owned_dofs() const
typename ActiveSelector::active_line_iterator active_line_iterator
Definition: dof_handler.h:372
std::unique_ptr< types::global_dof_index[]> indices
Definition: dof_handler.h:1475
std::string policy_to_string(const ::internal::DoFHandlerImplementation::Policy::PolicyBase< dim, spacedim > &policy)
Definition: dof_handler.cc:49
bool has_hp_capabilities() const
*braid_SplitCommworld & comm
typename ActiveSelector::line_iterator line_iterator
Definition: dof_handler.h:357
const Triangulation< dim, spacedim > & get_triangulation() const
unsigned int coarsest_level
Definition: dof_handler.h:1459
#define DEAL_II_NAMESPACE_OPEN
Definition: config.h:371
VectorType::value_type * begin(VectorType &V)
const std::vector< IndexSet > & locally_owned_dofs_per_processor() const
types::global_dof_index get_index(const unsigned int level, const unsigned int dof_number, const unsigned int dofs_per_vertex) const
types::global_dof_index n_boundary_dofs() const
void get_active_fe_indices(const DoFHandler< dim, spacedim > &dof_handler, std::vector< unsigned int > &active_fe_indices)
Definition: dof_tools.cc:1363
std::vector< IndexSet > locally_owned_dofs_per_processor
Definition: number_cache.h:180
A small class collecting the different BlockIndices involved in global, multilevel and local computat...
Definition: block_info.h:93
static ::ExceptionBase & ExcInvalidBoundaryIndicator()
TrilinosWrappers::types::int_type global_index(const Epetra_BlockMap &map, const ::types::global_dof_index i)
typename ActiveSelector::cell_iterator cell_iterator
Definition: dof_handler.h:466
const std::vector< types::global_dof_index > & n_locally_owned_dofs_per_processor() const
const IndexSet & locally_owned_mg_dofs(const unsigned int level) const
typename ActiveSelector::active_cell_iterator active_cell_iterator
Definition: dof_handler.h:438
std::vector< boost::signals2::connection > tria_listeners
Definition: dof_handler.h:1658
bool has_level_dofs() const
#define DEAL_II_DEPRECATED
Definition: config.h:152
const BlockInfo & block_info() const
static ::ExceptionBase & ExcNoFESelected()
bool hp_capability_enabled
Definition: dof_handler.h:1531
const std::vector< IndexSet > & locally_owned_mg_dofs_per_processor(const unsigned int level) const
typename ActiveSelector::active_quad_iterator active_quad_iterator
Definition: dof_handler.h:396
types::global_dof_index n_locally_owned_dofs() const
std::vector< std::vector< offset_type > > cell_dof_cache_ptr
Definition: dof_handler.h:1581
std::enable_if< std::is_fundamental< T >::value, std::size_t >::type memory_consumption(const T &t)
typename ActiveSelector::active_hex_iterator active_hex_iterator
Definition: dof_handler.h:416