Reference documentation for deal.II version Git f0919993dd 2020-09-21 18:25:06 -0600
\(\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 
218 template <int dim, int spacedim = dim>
219 class DoFHandler : public Subscriptor
220 {
221  using ActiveSelector =
223  using LevelSelector =
225 
226 public:
239  using cell_accessor = typename ActiveSelector::CellAccessor;
240 
253  using face_accessor = typename ActiveSelector::FaceAccessor;
254 
262  using line_iterator = typename ActiveSelector::line_iterator;
263 
277  using active_line_iterator = typename ActiveSelector::active_line_iterator;
278 
286  using quad_iterator = typename ActiveSelector::quad_iterator;
287 
301  using active_quad_iterator = typename ActiveSelector::active_quad_iterator;
302 
310  using hex_iterator = typename ActiveSelector::hex_iterator;
311 
321  using active_hex_iterator = typename ActiveSelector::active_hex_iterator;
322 
343  using active_cell_iterator = typename ActiveSelector::active_cell_iterator;
344 
371  using cell_iterator = typename ActiveSelector::cell_iterator;
372 
389  using face_iterator = typename ActiveSelector::face_iterator;
390 
402  using active_face_iterator = typename ActiveSelector::active_face_iterator;
403 
404  using level_cell_accessor = typename LevelSelector::CellAccessor;
405  using level_face_accessor = typename LevelSelector::FaceAccessor;
406 
407  using level_cell_iterator = typename LevelSelector::cell_iterator;
408  using level_face_iterator = typename LevelSelector::face_iterator;
409 
410 
414  static const unsigned int dimension = dim;
415 
419  static const unsigned int space_dimension = spacedim;
420 
426 
430  static const unsigned int default_fe_index = 0;
431 
435  static const unsigned int invalid_fe_index = numbers::invalid_unsigned_int;
436 
440  using active_fe_index_type = unsigned short int;
441 
445  using offset_type = unsigned int;
446 
451  static const active_fe_index_type invalid_active_fe_index =
452  static_cast<active_fe_index_type>(-1);
453 
459  DoFHandler(const bool hp_capability_enabled = false);
460 
465  const bool hp_capability_enabled = false);
466 
473  DoFHandler(const DoFHandler &) = delete;
474 
478  virtual ~DoFHandler() override;
479 
486  DoFHandler &
487  operator=(const DoFHandler &) = delete;
488 
493  void
494  initialize(const Triangulation<dim, spacedim> &tria,
495  const FiniteElement<dim, spacedim> &fe);
496 
500  void
501  initialize(const Triangulation<dim, spacedim> & tria,
503 
525  void
526  set_fe(const FiniteElement<dim, spacedim> &fe);
527 
531  void
532  set_fe(const hp::FECollection<dim, spacedim> &fe);
533 
538  void
539  set_active_fe_indices(const std::vector<unsigned int> &active_fe_indices);
540 
546  void
547  get_active_fe_indices(std::vector<unsigned int> &active_fe_indices) const;
548 
578  void
579  distribute_dofs(const FiniteElement<dim, spacedim> &fe);
580 
584  void
585  distribute_dofs(const hp::FECollection<dim, spacedim> &fe);
586 
592  void
593  distribute_mg_dofs();
594 
600  bool
601  has_level_dofs() const;
602 
617  bool
618  has_active_dofs() const;
619 
626  void
627  initialize_local_block_info();
628 
632  void
633  clear();
634 
687  void
688  renumber_dofs(const std::vector<types::global_dof_index> &new_numbers);
689 
694  void
695  renumber_dofs(const unsigned int level,
696  const std::vector<types::global_dof_index> &new_numbers);
697 
726  unsigned int
727  max_couplings_between_dofs() const;
728 
741  unsigned int
742  max_couplings_between_boundary_dofs() const;
743 
744  /*--------------------------------------*/
745 
750  /*
751  * @{
752  */
753 
758  begin(const unsigned int level = 0) const;
759 
777  begin_active(const unsigned int level = 0) const;
778 
784  end() const;
785 
791  end(const unsigned int level) const;
792 
799  end_active(const unsigned int level) const;
800 
806  begin_mg(const unsigned int level = 0) const;
807 
813  end_mg(const unsigned int level) const;
814 
820  end_mg() const;
821 
837  cell_iterators() const;
838 
880  active_cell_iterators() const;
881 
894  mg_cell_iterators() const;
895 
912  cell_iterators_on_level(const unsigned int level) const;
913 
930  active_cell_iterators_on_level(const unsigned int level) const;
931 
948  mg_cell_iterators_on_level(const unsigned int level) const;
949 
950  /*
951  * @}
952  */
953 
954 
955  /*---------------------------------------*/
956 
957 
982  n_dofs() const;
983 
992  n_dofs(const unsigned int level) const;
993 
999  n_boundary_dofs() const;
1000 
1012  template <typename number>
1014  n_boundary_dofs(
1015  const std::map<types::boundary_id, const Function<spacedim, number> *>
1016  &boundary_ids) const;
1017 
1023  n_boundary_dofs(const std::set<types::boundary_id> &boundary_ids) const;
1024 
1040  const BlockInfo &
1041  block_info() const;
1042 
1063  n_locally_owned_dofs() const;
1064 
1070  const IndexSet &
1071  locally_owned_dofs() const;
1072 
1077  const IndexSet &
1078  locally_owned_mg_dofs(const unsigned int level) const;
1079 
1092  DEAL_II_DEPRECATED const std::vector<IndexSet> &
1093  locally_owned_dofs_per_processor() const;
1094 
1111  DEAL_II_DEPRECATED const std::vector<types::global_dof_index> &
1112  n_locally_owned_dofs_per_processor() const;
1113 
1128  DEAL_II_DEPRECATED const std::vector<IndexSet> &
1129  locally_owned_mg_dofs_per_processor(const unsigned int level) const;
1130 
1137  get_fe(const unsigned int index = 0) const;
1138 
1146  get_fe_collection() const;
1147 
1152  get_triangulation() const;
1153 
1170  void
1171  prepare_for_serialization_of_active_fe_indices();
1172 
1188  void
1189  deserialize_active_fe_indices();
1190 
1199  virtual std::size_t
1200  memory_consumption() const;
1201 
1206  template <class Archive>
1207  void
1208  save(Archive &ar, const unsigned int version) const;
1209 
1214  template <class Archive>
1215  void
1216  load(Archive &ar, const unsigned int version);
1217 
1218 #ifdef DOXYGEN
1219 
1223  template <class Archive>
1224  void
1225  serialize(Archive &archive, const unsigned int version);
1226 #else
1227  // This macro defines the serialize() method that is compatible with
1228  // the templated save() and load() method that have been implemented.
1229  BOOST_SERIALIZATION_SPLIT_MEMBER()
1230 #endif
1231 
1245  DeclException1(ExcInvalidLevel,
1246  int,
1247  << "The given level " << arg1
1248  << " is not in the valid range!");
1253  DeclException1(ExcNewNumbersNotConsecutive,
1255  << "The given list of new dof indices is not consecutive: "
1256  << "the index " << arg1 << " does not exist.");
1260  DeclException2(ExcInvalidFEIndex,
1261  int,
1262  int,
1263  << "The mesh contains a cell with an active_fe_index of "
1264  << arg1 << ", but the finite element collection only has "
1265  << arg2 << " elements");
1266 
1271  DeclExceptionMsg(ExcNotAvailableWithoutHP,
1272  "The current function doesn't make sense when used with a "
1273  "DoFHandler without hp capabilities.");
1274 
1279  DeclExceptionMsg(ExcNotImplementedWithHP,
1280  "The current function has not yet been implemented for a "
1281  "DoFHandler with hp capabilities.");
1282 
1283 private:
1291  {
1292  public:
1296  MGVertexDoFs();
1297 
1303  void
1304  init(const unsigned int coarsest_level,
1305  const unsigned int finest_level,
1306  const unsigned int dofs_per_vertex);
1307 
1311  unsigned int
1312  get_coarsest_level() const;
1313 
1317  unsigned int
1318  get_finest_level() const;
1319 
1325  get_index(const unsigned int level,
1326  const unsigned int dof_number,
1327  const unsigned int dofs_per_vertex) const;
1328 
1333  void
1334  set_index(const unsigned int level,
1335  const unsigned int dof_number,
1336  const unsigned int dofs_per_vertex,
1337  const types::global_dof_index index);
1338 
1339  private:
1343  unsigned int coarsest_level;
1344 
1348  unsigned int finest_level;
1349 
1359  std::unique_ptr<types::global_dof_index[]> indices;
1360  };
1361 
1369  {
1374  std::map<const cell_iterator, const unsigned int> persisting_cells_fe_index;
1375 
1380  std::map<const cell_iterator, const unsigned int> refined_cells_fe_index;
1381 
1386  std::map<const cell_iterator, const unsigned int> coarsened_cells_fe_index;
1387 
1393  std::vector<unsigned int> active_fe_indices;
1394 
1400  std::unique_ptr<
1401  parallel::distributed::
1402  CellDataTransfer<dim, spacedim, std::vector<unsigned int>>>
1404  };
1405 
1410 
1416 
1423 
1428  std::unique_ptr<::internal::DoFHandlerImplementation::Policy::
1429  PolicyBase<dim, spacedim>>
1431 
1440 
1444  std::vector<::internal::DoFHandlerImplementation::NumberCache>
1446 
1452  mutable std::vector<std::vector<types::global_dof_index>>
1454 
1459  mutable std::vector<std::vector<offset_type>> cell_dof_cache_ptr;
1460 
1466  mutable std::vector<std::array<std::vector<types::global_dof_index>, dim + 1>>
1468 
1477  mutable std::vector<std::array<std::vector<offset_type>, dim + 1>>
1479 
1485  mutable std::array<std::vector<active_fe_index_type>, dim + 1>
1487 
1491  mutable std::array<std::vector<offset_type>, dim + 1> hp_object_fe_ptr;
1492 
1497  mutable std::vector<std::vector<active_fe_index_type>>
1499 
1504  mutable std::vector<std::vector<active_fe_index_type>>
1506 
1511  std::vector<MGVertexDoFs> mg_vertex_dofs;
1512 
1516  std::vector<
1517  std::unique_ptr<::internal::DoFHandlerImplementation::DoFLevel<dim>>>
1519 
1523  std::unique_ptr<::internal::DoFHandlerImplementation::DoFFaces<dim>>
1525 
1530  std::unique_ptr<ActiveFEIndexTransfer> active_fe_index_transfer;
1531 
1536  std::vector<boost::signals2::connection> tria_listeners;
1537 
1541  void
1542  clear_space();
1543 
1547  void
1548  clear_mg_space();
1549 
1553  template <int structdim>
1555  get_dof_index(const unsigned int obj_level,
1556  const unsigned int obj_index,
1557  const unsigned int fe_index,
1558  const unsigned int local_index) const;
1559 
1563  template <int structdim>
1564  void
1565  set_dof_index(const unsigned int obj_level,
1566  const unsigned int obj_index,
1567  const unsigned int fe_index,
1568  const unsigned int local_index,
1570 
1574  void
1575  setup_policy();
1576 
1580  void
1581  setup_policy_and_listeners();
1582 
1590  void
1591  create_active_fe_table();
1592 
1601  void
1602  pre_refinement_action();
1603 
1611  void
1612  post_refinement_action();
1613 
1623  void
1624  pre_active_fe_index_transfer();
1625 
1634  void
1635  pre_distributed_active_fe_index_transfer();
1636 
1645  void
1646  post_active_fe_index_transfer();
1647 
1656  void
1657  post_distributed_active_fe_index_transfer();
1658 
1667  void
1668  post_distributed_serialization_of_active_fe_indices();
1669 
1670 
1671  // Make accessor objects friends.
1672  template <int, int, int, bool>
1673  friend class ::DoFAccessor;
1674  template <int, int, bool>
1675  friend class ::DoFCellAccessor;
1676  friend struct ::internal::DoFAccessorImplementation::Implementation;
1677  friend struct ::internal::DoFCellAccessorImplementation::Implementation;
1678 
1679  // Likewise for DoFLevel objects since they need to access the vertex dofs
1680  // in the functions that set and retrieve vertex dof indices.
1681  friend struct ::internal::DoFHandlerImplementation::Implementation;
1682  friend struct ::internal::hp::DoFHandlerImplementation::Implementation;
1683  friend struct ::internal::DoFHandlerImplementation::Policy::
1684  Implementation;
1685 
1686  // explicitly check for sensible template arguments, but not on windows
1687  // because MSVC creates bogus warnings during normal compilation
1688 #ifndef DEAL_II_MSVC
1689  static_assert(dim <= spacedim,
1690  "The dimension <dim> of a DoFHandler must be less than or "
1691  "equal to the space dimension <spacedim> in which it lives.");
1692 #endif
1693 };
1694 
1695 #ifndef DOXYGEN
1696 
1697 /* ----------------------- Inline functions ----------------------------------
1698  */
1699 
1700 
1701 template <int dim, int spacedim>
1702 inline bool
1704 {
1705  return mg_number_cache.size() > 0;
1706 }
1707 
1708 
1709 
1710 template <int dim, int spacedim>
1711 inline bool
1713 {
1714  return number_cache.n_global_dofs > 0;
1715 }
1716 
1717 
1718 
1719 template <int dim, int spacedim>
1722 {
1723  return number_cache.n_global_dofs;
1724 }
1725 
1726 
1727 
1728 template <int dim, int spacedim>
1730 DoFHandler<dim, spacedim>::n_dofs(const unsigned int level) const
1731 {
1732  Assert(has_level_dofs(),
1733  ExcMessage(
1734  "n_dofs(level) can only be called after distribute_mg_dofs()"));
1735  Assert(level < mg_number_cache.size(), ExcInvalidLevel(level));
1736  return mg_number_cache[level].n_global_dofs;
1737 }
1738 
1739 
1740 
1741 template <int dim, int spacedim>
1744 {
1745  return number_cache.n_locally_owned_dofs;
1746 }
1747 
1748 
1749 
1750 template <int dim, int spacedim>
1751 const IndexSet &
1753 {
1754  return number_cache.locally_owned_dofs;
1755 }
1756 
1757 
1758 
1759 template <int dim, int spacedim>
1760 const IndexSet &
1761 DoFHandler<dim, spacedim>::locally_owned_mg_dofs(const unsigned int level) const
1762 {
1763  Assert(level < this->get_triangulation().n_global_levels(),
1764  ExcMessage("The given level index exceeds the number of levels "
1765  "present in the triangulation"));
1766  Assert(
1767  mg_number_cache.size() == this->get_triangulation().n_global_levels(),
1768  ExcMessage(
1769  "The level dofs are not set up properly! Did you call distribute_mg_dofs()?"));
1770  return mg_number_cache[level].locally_owned_dofs;
1771 }
1772 
1773 
1774 
1775 template <int dim, int spacedim>
1776 const std::vector<types::global_dof_index> &
1778 {
1779  if (number_cache.n_locally_owned_dofs_per_processor.empty() &&
1780  number_cache.n_global_dofs > 0)
1781  {
1782  MPI_Comm comm;
1783 
1785  (dynamic_cast<const parallel::TriangulationBase<dim, spacedim> *>(
1786  &this->get_triangulation()));
1787  if (tr != nullptr)
1788  comm = tr->get_communicator();
1789  else
1790  comm = MPI_COMM_SELF;
1791 
1793  number_cache)
1794  .n_locally_owned_dofs_per_processor =
1795  number_cache.get_n_locally_owned_dofs_per_processor(comm);
1796  }
1797  return number_cache.n_locally_owned_dofs_per_processor;
1798 }
1799 
1800 
1801 
1802 template <int dim, int spacedim>
1803 const std::vector<IndexSet> &
1805 {
1806  if (number_cache.locally_owned_dofs_per_processor.empty() &&
1807  number_cache.n_global_dofs > 0)
1808  {
1809  MPI_Comm comm;
1810 
1812  (dynamic_cast<const parallel::TriangulationBase<dim, spacedim> *>(
1813  &this->get_triangulation()));
1814  if (tr != nullptr)
1815  comm = tr->get_communicator();
1816  else
1817  comm = MPI_COMM_SELF;
1818 
1820  number_cache)
1821  .locally_owned_dofs_per_processor =
1822  number_cache.get_locally_owned_dofs_per_processor(comm);
1823  }
1824  return number_cache.locally_owned_dofs_per_processor;
1825 }
1826 
1827 
1828 
1829 template <int dim, int spacedim>
1830 const std::vector<IndexSet> &
1832  const unsigned int level) const
1833 {
1834  Assert(level < this->get_triangulation().n_global_levels(),
1835  ExcMessage("The given level index exceeds the number of levels "
1836  "present in the triangulation"));
1837  Assert(
1838  mg_number_cache.size() == this->get_triangulation().n_global_levels(),
1839  ExcMessage(
1840  "The level dofs are not set up properly! Did you call distribute_mg_dofs()?"));
1841  if (mg_number_cache[level].locally_owned_dofs_per_processor.empty() &&
1842  mg_number_cache[level].n_global_dofs > 0)
1843  {
1844  MPI_Comm comm;
1845 
1847  (dynamic_cast<const parallel::TriangulationBase<dim, spacedim> *>(
1848  &this->get_triangulation()));
1849  if (tr != nullptr)
1850  comm = tr->get_communicator();
1851  else
1852  comm = MPI_COMM_SELF;
1853 
1855  mg_number_cache[level])
1856  .locally_owned_dofs_per_processor =
1857  mg_number_cache[level].get_locally_owned_dofs_per_processor(comm);
1858  }
1859  return mg_number_cache[level].locally_owned_dofs_per_processor;
1860 }
1861 
1862 
1863 
1864 template <int dim, int spacedim>
1865 inline const FiniteElement<dim, spacedim> &
1866 DoFHandler<dim, spacedim>::get_fe(const unsigned int number) const
1867 {
1868  Assert(fe_collection.size() > 0,
1869  ExcMessage("No finite element collection is associated with "
1870  "this DoFHandler"));
1871  return fe_collection[number];
1872 }
1873 
1874 
1875 
1876 template <int dim, int spacedim>
1877 inline const hp::FECollection<dim, spacedim> &
1879 {
1880  Assert(fe_collection.size() > 0,
1881  ExcMessage("No finite element collection is associated with "
1882  "this DoFHandler"));
1883  return fe_collection;
1884 }
1885 
1886 
1887 
1888 template <int dim, int spacedim>
1889 inline const Triangulation<dim, spacedim> &
1891 {
1892  Assert(tria != nullptr,
1893  ExcMessage("This DoFHandler object has not been associated "
1894  "with a triangulation."));
1895  return *tria;
1896 }
1897 
1898 
1899 
1900 template <int dim, int spacedim>
1901 inline const BlockInfo &
1903 {
1904  Assert(this->hp_capability_enabled == false, ExcNotImplementedWithHP());
1905 
1906  return block_info_object;
1907 }
1908 
1909 
1910 
1911 template <int dim, int spacedim>
1912 template <typename number>
1915  const std::map<types::boundary_id, const Function<spacedim, number> *>
1916  &boundary_ids) const
1917 {
1918  Assert(!(dim == 2 && spacedim == 3) || this->hp_capability_enabled == false,
1919  ExcNotImplementedWithHP());
1920 
1921  // extract the set of boundary ids and forget about the function object
1922  // pointers
1923  std::set<types::boundary_id> boundary_ids_only;
1924  for (typename std::map<types::boundary_id,
1925  const Function<spacedim, number> *>::const_iterator p =
1926  boundary_ids.begin();
1927  p != boundary_ids.end();
1928  ++p)
1929  boundary_ids_only.insert(p->first);
1930 
1931  // then just hand everything over to the other function that does the work
1932  return n_boundary_dofs(boundary_ids_only);
1933 }
1934 
1935 
1936 
1937 namespace internal
1938 {
1946  template <int dim, int spacedim>
1947  std::string
1948  policy_to_string(const ::internal::DoFHandlerImplementation::Policy::
1949  PolicyBase<dim, spacedim> &policy);
1950 } // namespace internal
1951 
1952 
1953 
1954 template <int dim, int spacedim>
1955 template <class Archive>
1956 void
1957 DoFHandler<dim, spacedim>::save(Archive &ar, const unsigned int) const
1958 {
1959  if (this->hp_capability_enabled)
1960  {
1961  ar & this->object_dof_indices;
1962  ar & this->object_dof_ptr;
1963 
1964  ar & this->cell_dof_cache_indices;
1965  ar & this->cell_dof_cache_ptr;
1966 
1967  ar & this->hp_cell_active_fe_indices;
1968  ar & this->hp_cell_future_fe_indices;
1969 
1970  ar &hp_object_fe_ptr;
1971  ar &hp_object_fe_indices;
1972 
1973  ar &number_cache;
1974 
1975  ar &mg_number_cache;
1976 
1977  // write out the number of triangulation cells and later check during
1978  // loading that this number is indeed correct; same with something that
1979  // identifies the policy
1980  const unsigned int n_cells = this->tria->n_cells();
1981  std::string policy_name =
1982  ::internal::policy_to_string(*this->policy);
1983 
1984  ar &n_cells &policy_name;
1985  }
1986  else
1987  {
1988  ar & this->block_info_object;
1989  ar &number_cache;
1990 
1991  ar & this->object_dof_indices;
1992  ar & this->object_dof_ptr;
1993 
1994  ar & this->cell_dof_cache_indices;
1995  ar & this->cell_dof_cache_ptr;
1996 
1997  // write out the number of triangulation cells and later check during
1998  // loading that this number is indeed correct; same with something that
1999  // identifies the FE and the policy
2000  unsigned int n_cells = this->tria->n_cells();
2001  std::string fe_name = this->get_fe(0).get_name();
2002  std::string policy_name = internal::policy_to_string(*this->policy);
2003 
2004  ar &n_cells &fe_name &policy_name;
2005  }
2006 }
2007 
2008 
2009 
2010 template <int dim, int spacedim>
2011 template <class Archive>
2012 void
2013 DoFHandler<dim, spacedim>::load(Archive &ar, const unsigned int)
2014 {
2015  if (this->hp_capability_enabled)
2016  {
2017  ar & this->object_dof_indices;
2018  ar & this->object_dof_ptr;
2019 
2020  ar & this->cell_dof_cache_indices;
2021  ar & this->cell_dof_cache_ptr;
2022 
2023  ar & this->hp_cell_active_fe_indices;
2024  ar & this->hp_cell_future_fe_indices;
2025 
2026  ar &hp_object_fe_ptr;
2027  ar &hp_object_fe_indices;
2028 
2029  ar &number_cache;
2030 
2031  ar &mg_number_cache;
2032 
2033  // these are the checks that correspond to the last block in the save()
2034  // function
2035  unsigned int n_cells;
2036  std::string policy_name;
2037 
2038  ar &n_cells &policy_name;
2039 
2040  AssertThrow(
2041  n_cells == this->tria->n_cells(),
2042  ExcMessage(
2043  "The object being loaded into does not match the triangulation "
2044  "that has been stored previously."));
2045  AssertThrow(
2046  policy_name == ::internal::policy_to_string(*this->policy),
2047  ExcMessage("The policy currently associated with this DoFHandler (" +
2048  ::internal::policy_to_string(*this->policy) +
2049  ") does not match the one that was associated with the "
2050  "DoFHandler previously stored (" +
2051  policy_name + ")."));
2052  }
2053  else
2054  {
2055  ar & this->block_info_object;
2056  ar &number_cache;
2057 
2058  object_dof_indices.clear();
2059 
2060  object_dof_ptr.clear();
2061 
2062  ar & this->object_dof_indices;
2063  ar & this->object_dof_ptr;
2064 
2065  ar & this->cell_dof_cache_indices;
2066  ar & this->cell_dof_cache_ptr;
2067 
2068  // these are the checks that correspond to the last block in the save()
2069  // function
2070  unsigned int n_cells;
2071  std::string fe_name;
2072  std::string policy_name;
2073 
2074  ar &n_cells &fe_name &policy_name;
2075 
2076  AssertThrow(
2077  n_cells == this->tria->n_cells(),
2078  ExcMessage(
2079  "The object being loaded into does not match the triangulation "
2080  "that has been stored previously."));
2081  AssertThrow(
2082  fe_name == this->get_fe(0).get_name(),
2083  ExcMessage(
2084  "The finite element associated with this DoFHandler does not match "
2085  "the one that was associated with the DoFHandler previously stored."));
2086  AssertThrow(policy_name == internal::policy_to_string(*this->policy),
2087  ExcMessage(
2088  "The policy currently associated with this DoFHandler (" +
2089  internal::policy_to_string(*this->policy) +
2090  ") does not match the one that was associated with the "
2091  "DoFHandler previously stored (" +
2092  policy_name + ")."));
2093  }
2094 }
2095 
2096 
2097 
2098 template <int dim, int spacedim>
2101  const unsigned int level,
2102  const unsigned int dof_number,
2103  const unsigned int dofs_per_vertex) const
2104 {
2105  Assert((level >= coarsest_level) && (level <= finest_level),
2106  ExcInvalidLevel(level));
2107  return indices[dofs_per_vertex * (level - coarsest_level) + dof_number];
2108 }
2109 
2110 
2111 
2112 template <int dim, int spacedim>
2113 inline void
2115  const unsigned int level,
2116  const unsigned int dof_number,
2117  const unsigned int dofs_per_vertex,
2118  const types::global_dof_index index)
2119 {
2120  Assert((level >= coarsest_level) && (level <= finest_level),
2121  ExcInvalidLevel(level));
2122  indices[dofs_per_vertex * (level - coarsest_level) + dof_number] = index;
2123 }
2124 
2125 
2126 #endif // DOXYGEN
2127 
2129 
2130 #endif
const bool hp_capability_enabled
Definition: dof_handler.h:425
std::vector< MGVertexDoFs > mg_vertex_dofs
Definition: dof_handler.h:1511
const Triangulation< dim, spacedim > & get_triangulation() const
static const unsigned int invalid_unsigned_int
Definition: types.h:196
typename ActiveSelector::FaceAccessor face_accessor
Definition: dof_handler.h:253
std::array< std::vector< offset_type >, dim+1 > hp_object_fe_ptr
Definition: dof_handler.h:1491
#define DeclException2(Exception2, type1, type2, outsequence)
Definition: exceptions.h:538
typename LevelSelector::face_iterator level_face_iterator
Definition: dof_handler.h:408
std::map< const cell_iterator, const unsigned int > coarsened_cells_fe_index
Definition: dof_handler.h:1386
typename ActiveSelector::quad_iterator quad_iterator
Definition: dof_handler.h:286
unsigned short int active_fe_index_type
Definition: dof_handler.h:440
const BlockInfo & block_info() const
::internal::DoFHandlerImplementation::NumberCache number_cache
Definition: dof_handler.h:1439
std::vector< std::array< std::vector< offset_type >, dim+1 > > object_dof_ptr
Definition: dof_handler.h:1478
const std::vector< IndexSet > & locally_owned_mg_dofs_per_processor(const unsigned int level) const
typename ActiveSelector::CellAccessor cell_accessor
Definition: dof_handler.h:239
#define AssertThrow(cond, exc)
Definition: exceptions.h:1521
std::vector< std::unique_ptr<::internal::DoFHandlerImplementation::DoFLevel< dim > > > mg_levels
Definition: dof_handler.h:1518
const FiniteElement< dim, spacedim > & get_fe(const unsigned int index=0) const
std::vector< std::vector< active_fe_index_type > > hp_cell_future_fe_indices
Definition: dof_handler.h:1505
typename ActiveSelector::face_iterator face_iterator
Definition: dof_handler.h:389
typename ActiveSelector::active_face_iterator active_face_iterator
Definition: dof_handler.h:402
std::vector< std::vector< types::global_dof_index > > cell_dof_cache_indices
Definition: dof_handler.h:1453
std::map< const cell_iterator, const unsigned int > refined_cells_fe_index
Definition: dof_handler.h:1380
types::global_dof_index n_locally_owned_dofs() const
BlockInfo block_info_object
Definition: dof_handler.h:1409
const std::vector< types::global_dof_index > & n_locally_owned_dofs_per_processor() const
static ::ExceptionBase & ExcMessage(std::string arg1)
std::map< const cell_iterator, const unsigned int > persisting_cells_fe_index
Definition: dof_handler.h:1374
#define DeclException1(Exception1, type1, outsequence)
Definition: exceptions.h:515
typename LevelSelector::CellAccessor level_cell_accessor
Definition: dof_handler.h:404
typename ActiveSelector::hex_iterator hex_iterator
Definition: dof_handler.h:310
std::vector<::internal::DoFHandlerImplementation::NumberCache > mg_number_cache
Definition: dof_handler.h:1445
bool has_active_dofs() const
#define Assert(cond, exc)
Definition: exceptions.h:1411
hp::FECollection< dim, spacedim > fe_collection
Definition: dof_handler.h:1422
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::unique_ptr< ActiveFEIndexTransfer > active_fe_index_transfer
Definition: dof_handler.h:1530
std::vector< std::array< std::vector< types::global_dof_index >, dim+1 > > object_dof_indices
Definition: dof_handler.h:1467
#define DeclExceptionMsg(Exception, defaulttext)
Definition: exceptions.h:493
std::unique_ptr<::internal::DoFHandlerImplementation::DoFFaces< dim > > mg_faces
Definition: dof_handler.h:1524
#define DeclException0(Exception0)
Definition: exceptions.h:470
types::global_dof_index n_boundary_dofs() const
#define DEAL_II_NAMESPACE_CLOSE
Definition: config.h:363
unsigned int level
Definition: grid_out.cc:4338
SmartPointer< const Triangulation< dim, spacedim >, DoFHandler< dim, spacedim > > tria
Definition: dof_handler.h:1415
types::global_dof_index n_dofs() const
VectorType::value_type * end(VectorType &V)
typename LevelSelector::cell_iterator level_cell_iterator
Definition: dof_handler.h:407
std::unique_ptr<::internal::DoFHandlerImplementation::Policy::PolicyBase< dim, spacedim > > policy
Definition: dof_handler.h:1430
const hp::FECollection< dim, spacedim > & get_fe_collection() const
const IndexSet & locally_owned_mg_dofs(const unsigned int level) const
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:1403
Definition: hp.h:117
std::vector< std::vector< active_fe_index_type > > hp_cell_active_fe_indices
Definition: dof_handler.h:1498
unsigned int n_cells(const internal::TriangulationImplementation::NumberCache< 1 > &c)
Definition: tria.cc:11744
virtual const MPI_Comm & get_communicator() const
Definition: tria_base.cc:138
typename LevelSelector::FaceAccessor level_face_accessor
Definition: dof_handler.h:405
std::vector< unsigned int > active_fe_indices
Definition: dof_handler.h:1393
std::array< std::vector< active_fe_index_type >, dim+1 > hp_object_fe_indices
Definition: dof_handler.h:1486
typename ActiveSelector::active_line_iterator active_line_iterator
Definition: dof_handler.h:277
std::unique_ptr< types::global_dof_index[]> indices
Definition: dof_handler.h:1359
std::vector< IndexSet > get_locally_owned_dofs_per_processor(const MPI_Comm mpi_communicator) const
std::string policy_to_string(const ::internal::DoFHandlerImplementation::Policy::PolicyBase< dim, spacedim > &policy)
Definition: dof_handler.cc:49
*braid_SplitCommworld & comm
const std::vector< IndexSet > & locally_owned_dofs_per_processor() const
typename ActiveSelector::line_iterator line_iterator
Definition: dof_handler.h:262
unsigned int coarsest_level
Definition: dof_handler.h:1343
#define DEAL_II_NAMESPACE_OPEN
Definition: config.h:362
VectorType::value_type * begin(VectorType &V)
types::global_dof_index get_index(const unsigned int level, const unsigned int dof_number, const unsigned int dofs_per_vertex) const
void load(Archive &ar, const unsigned int version)
void get_active_fe_indices(const DoFHandler< dim, spacedim > &dof_handler, std::vector< unsigned int > &active_fe_indices)
Definition: dof_tools.cc:1327
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:371
typename ActiveSelector::active_cell_iterator active_cell_iterator
Definition: dof_handler.h:343
std::vector< boost::signals2::connection > tria_listeners
Definition: dof_handler.h:1536
const IndexSet & locally_owned_dofs() const
bool has_level_dofs() const
#define DEAL_II_DEPRECATED
Definition: config.h:152
static ::ExceptionBase & ExcNoFESelected()
typename ActiveSelector::active_quad_iterator active_quad_iterator
Definition: dof_handler.h:301
void save(Archive &ar, const unsigned int version) const
std::vector< std::vector< offset_type > > cell_dof_cache_ptr
Definition: dof_handler.h:1459
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:321