16 #ifndef dealii_dof_handler_h
17 #define dealii_dof_handler_h
39 #include <boost/serialization/split_member.hpp>
50 template <
int dim,
int spacedim>
52 template <
int dim,
int spacedim>
58 namespace DoFHandlerImplementation
60 struct Implementation;
64 template <
int dim,
int spacedim>
66 struct Implementation;
70 namespace DoFAccessorImplementation
72 struct Implementation;
75 namespace DoFCellAccessorImplementation
77 struct Implementation;
82 namespace DoFHandlerImplementation
84 struct Implementation;
93 template <
int dim,
int spacedim,
typename VectorType>
315 template <
int dim,
int spacedim = dim>
512 static constexpr
unsigned int dimension = dim;
517 static constexpr
unsigned int space_dimension = spacedim;
625 std::vector<types::fe_index>
674 std::vector<types::fe_index>
840 const std::vector<types::global_dof_index> &new_numbers);
1154 template <
typename number>
1158 &boundary_ids)
const;
1301 template <
class Archive>
1303 save(Archive &ar,
const unsigned int version)
const;
1310 template <
class Archive>
1312 load(Archive &ar,
const unsigned int version);
1320 template <
class Archive>
1326 BOOST_SERIALIZATION_SPLIT_MEMBER()
1344 <<
"The given level " << arg1
1345 <<
" is not in the valid range!");
1352 <<
"The given list of new dof indices is not consecutive: "
1353 <<
"the index " << arg1 <<
" does not exist.");
1360 <<
"The mesh contains a cell with an active FE index of "
1361 << arg1 <<
", but the finite element collection only has "
1362 << arg2 <<
" elements");
1369 "The current function doesn't make sense when used with a "
1370 "DoFHandler without hp-capabilities.");
1377 "The current function has not yet been implemented for a "
1378 "DoFHandler with hp-capabilities.");
1401 init(
const unsigned int coarsest_level,
1402 const unsigned int finest_level,
1403 const unsigned int dofs_per_vertex);
1423 const unsigned int dof_number,
1424 const unsigned int dofs_per_vertex);
1446 std::unique_ptr<types::global_dof_index[]>
indices;
1461 std::map<const cell_iterator, const types::fe_index>
1474 std::map<const cell_iterator, const types::fe_index>
1490 parallel::distributed::
1491 CellDataTransfer<dim, spacedim, std::vector<types::fe_index>>>
1523 std::unique_ptr<::internal::DoFHandlerImplementation::Policy::
1524 PolicyBase<dim, spacedim>>
1539 std::vector<::internal::DoFHandlerImplementation::NumberCache>
1547 mutable std::vector<std::array<std::vector<types::global_dof_index>, dim + 1>>
1558 mutable std::vector<std::array<std::vector<offset_type>, dim + 1>>
1566 mutable std::array<std::vector<types::fe_index>, dim + 1>
1596 std::unique_ptr<::internal::DoFHandlerImplementation::DoFLevel<dim>>>
1602 std::unique_ptr<::internal::DoFHandlerImplementation::DoFFaces<dim>>
1724 template <
int,
int,
int,
bool>
1725 friend class ::DoFAccessor;
1726 template <
int,
int,
bool>
1727 friend class ::DoFCellAccessor;
1728 friend struct ::internal::DoFAccessorImplementation::Implementation;
1729 friend struct ::internal::DoFCellAccessorImplementation::Implementation;
1733 friend struct ::internal::DoFHandlerImplementation::Implementation;
1734 friend struct ::internal::hp::DoFHandlerImplementation::Implementation;
1735 friend struct ::internal::DoFHandlerImplementation::Policy::
1740 #ifndef DEAL_II_MSVC
1741 static_assert(dim <= spacedim,
1742 "The dimension <dim> of a DoFHandler must be less than or "
1743 "equal to the space dimension <spacedim> in which it lives.");
1751 namespace DoFHandlerImplementation
1764 template <
int dim,
int spacedim>
1792 template <
int dim,
int spacedim = dim>
1802 "No FiniteElement has been found in your FECollection that is "
1803 "dominated by all children of a cell you are trying to coarsen!");
1814 template <
int dim,
int spacedim>
1823 template <
int dim,
int spacedim>
1832 template <
int dim,
int spacedim>
1841 template <
int dim,
int spacedim>
1850 template <
int dim,
int spacedim>
1857 "n_dofs(level) can only be called after distribute_mg_dofs()"));
1864 template <
int dim,
int spacedim>
1873 template <
int dim,
int spacedim>
1882 template <
int dim,
int spacedim>
1885 const unsigned int level)
const
1888 ExcMessage(
"The given level index exceeds the number of levels "
1889 "present in the triangulation"));
1891 mg_number_cache.size() == this->get_triangulation().n_global_levels(),
1893 "The level dofs are not set up properly! Did you call distribute_mg_dofs()?"));
1899 template <
int dim,
int spacedim>
1905 ExcMessage(
"No finite element collection is associated with "
1906 "this DoFHandler"));
1912 template <
int dim,
int spacedim>
1922 template <
int dim,
int spacedim>
1928 ExcMessage(
"This DoFHandler object has not been associated "
1929 "with a triangulation."));
1935 template <
int dim,
int spacedim>
1940 ExcMessage(
"This DoFHandler object has not been associated "
1941 "with a triangulation."));
1947 template <
int dim,
int spacedim>
1958 template <
int dim,
int spacedim>
1960 template <
typename number>
1963 &boundary_ids)
const
1970 std::set<types::boundary_id> boundary_ids_only;
1973 boundary_ids.begin();
1974 p != boundary_ids.end();
1976 boundary_ids_only.insert(p->first);
1993 template <
int dim,
int spacedim>
1996 PolicyBase<dim, spacedim> &policy);
2001 template <
int dim,
int spacedim>
2003 template <
class Archive>
2025 std::string policy_name =
2045 ar &
n_cells &fe_name &policy_name;
2051 template <
int dim,
int spacedim>
2053 template <
class Archive>
2074 std::string policy_name;
2081 "The object being loaded into does not match the triangulation "
2082 "that has been stored previously."));
2085 ExcMessage(
"The policy currently associated with this DoFHandler (" +
2087 ") does not match the one that was associated with the "
2088 "DoFHandler previously stored (" +
2089 policy_name +
")."));
2106 std::string fe_name;
2107 std::string policy_name;
2109 ar &
n_cells &fe_name &policy_name;
2114 "The object being loaded into does not match the triangulation "
2115 "that has been stored previously."));
2117 fe_name == this->
get_fe(0).get_name(),
2119 "The finite element associated with this DoFHandler does not match "
2120 "the one that was associated with the DoFHandler previously stored."));
2123 "The policy currently associated with this DoFHandler (" +
2125 ") does not match the one that was associated with the "
2126 "DoFHandler previously stored (" +
2127 policy_name +
")."));
2133 template <
int dim,
int spacedim>
2137 const unsigned int level,
2138 const unsigned int dof_number,
2139 const unsigned int dofs_per_vertex)
2142 ExcInvalidLevel(
level));
2143 return indices[dofs_per_vertex * (
level - coarsest_level) + dof_number];
A small class collecting the different BlockIndices involved in global, multilevel and local computat...
types::global_dof_index & access_index(const unsigned int level, const unsigned int dof_number, const unsigned int dofs_per_vertex)
unsigned int coarsest_level
void init(const unsigned int coarsest_level, const unsigned int finest_level, const unsigned int dofs_per_vertex)
unsigned int get_finest_level() const
std::unique_ptr< types::global_dof_index[]> indices
unsigned int finest_level
unsigned int get_coarsest_level() const
cell_iterator end() const
void pre_distributed_transfer_action()
void post_transfer_action()
virtual std::size_t memory_consumption() const
unsigned int max_couplings_between_dofs() const
std::vector< std::unique_ptr<::internal::DoFHandlerImplementation::DoFLevel< dim > > > mg_levels
std::vector< types::fe_index > get_active_fe_indices() const
std::unique_ptr< ActiveFEIndexTransfer > active_fe_index_transfer
hp::FECollection< dim, spacedim > fe_collection
void create_active_fe_table()
std::vector< std::vector< types::fe_index > > hp_cell_future_fe_indices
SmartPointer< const Triangulation< dim, spacedim >, DoFHandler< dim, spacedim > > tria
void save(Archive &ar, const unsigned int version) const
void set_active_fe_indices(const std::vector< unsigned int > &active_fe_indices)
BlockInfo block_info_object
bool has_active_dofs() const
std::vector< boost::signals2::connection > tria_listeners_for_transfer
level_cell_iterator end_mg() const
void renumber_dofs(const std::vector< types::global_dof_index > &new_numbers)
std::vector< types::fe_index > get_future_fe_indices() const
void renumber_dofs(const unsigned int level, const std::vector< types::global_dof_index > &new_numbers)
level_cell_iterator begin_mg(const unsigned int level=0) const
void distribute_dofs(const FiniteElement< dim, spacedim > &fe)
types::global_dof_index n_boundary_dofs() const
DoFHandler(const Triangulation< dim, spacedim > &tria)
void connect_to_triangulation_signals()
std::vector< std::vector< types::fe_index > > hp_cell_active_fe_indices
std::vector< MGVertexDoFs > mg_vertex_dofs
std::vector< boost::signals2::connection > tria_listeners
void post_distributed_transfer_action()
std::vector< std::array< std::vector< types::global_dof_index >, dim+1 > > object_dof_indices
typename LevelSelector::CellAccessor level_cell_accessor
const BlockInfo & block_info() const
const Triangulation< dim, spacedim > & get_triangulation() const
void pre_transfer_action()
void reinit(const Triangulation< dim, spacedim > &tria)
std::vector< std::array< std::vector< offset_type >, dim+1 > > object_dof_ptr
std::unique_ptr<::internal::DoFHandlerImplementation::DoFFaces< dim > > mg_faces
void serialize(Archive &archive, const unsigned int version)
types::fe_index active_fe_index_type
DoFHandler(const DoFHandler &)=delete
active_cell_iterator begin_active(const unsigned int level=0) const
void distribute_mg_dofs()
active_cell_iterator end_active(const unsigned int level) const
bool hp_capability_enabled
bool has_hp_capabilities() const
void initialize_local_block_info()
types::global_dof_index n_dofs() const
void update_active_fe_table()
level_cell_iterator end_mg(const unsigned int level) const
cell_iterator end(const unsigned int level) const
typename LevelSelector::cell_iterator level_cell_iterator
void prepare_for_serialization_of_active_fe_indices()
std::vector<::internal::DoFHandlerImplementation::NumberCache > mg_number_cache
void load(Archive &ar, const unsigned int version)
DoFHandler & operator=(const DoFHandler &)=delete
const IndexSet & locally_owned_mg_dofs(const unsigned int level) const
const FiniteElement< dim, spacedim > & get_fe(const types::fe_index index=0) const
typename LevelSelector::face_iterator level_face_iterator
cell_iterator begin(const unsigned int level=0) const
std::array< std::vector< offset_type >, dim+1 > hp_object_fe_ptr
MPI_Comm get_communicator() const
const IndexSet & locally_owned_dofs() const
void get_active_fe_indices(std::vector< unsigned int > &active_fe_indices) const
void distribute_dofs(const hp::FECollection< dim, spacedim > &fe)
types::global_dof_index n_boundary_dofs(const std::map< types::boundary_id, const Function< spacedim, number > * > &boundary_ids) const
bool has_level_dofs() const
std::unique_ptr<::internal::DoFHandlerImplementation::Policy::PolicyBase< dim, spacedim > > policy
typename LevelSelector::FaceAccessor level_face_accessor
types::global_dof_index n_dofs(const unsigned int level) const
std::array< std::vector< types::fe_index >, dim+1 > hp_object_fe_indices
const hp::FECollection< dim, spacedim > & get_fe_collection() const
void set_active_fe_indices(const std::vector< types::fe_index > &active_fe_indices)
unsigned int max_couplings_between_boundary_dofs() const
types::global_dof_index n_locally_owned_dofs() const
void deserialize_active_fe_indices()
types::global_dof_index n_boundary_dofs(const std::set< types::boundary_id > &boundary_ids) const
::internal::DoFHandlerImplementation::NumberCache number_cache
void set_future_fe_indices(const std::vector< types::fe_index > &future_fe_indices)
virtual ~DoFHandler() override
virtual std::string get_name() const =0
virtual MPI_Comm get_communicator() const
unsigned int n_cells() const
unsigned int size() const
#define DEAL_II_DEPRECATED
#define DEAL_II_NAMESPACE_OPEN
#define DEAL_II_CXX20_REQUIRES(condition)
#define DEAL_II_NAMESPACE_CLOSE
IteratorRange< active_cell_iterator > active_cell_iterators_on_level(const unsigned int level) const
IteratorRange< cell_iterator > cell_iterators_on_level(const unsigned int level) const
IteratorRange< active_cell_iterator > active_cell_iterators() const
IteratorRange< level_cell_iterator > mg_cell_iterators() const
IteratorRange< cell_iterator > cell_iterators() const
IteratorRange< level_cell_iterator > mg_cell_iterators_on_level(const unsigned int level) const
#define DeclException0(Exception0)
static ::ExceptionBase & ExcInvalidLevel(int arg1)
#define Assert(cond, exc)
static ::ExceptionBase & ExcNotImplementedWithHP()
#define DeclException2(Exception2, type1, type2, outsequence)
static ::ExceptionBase & ExcNoFESelected()
#define DeclExceptionMsg(Exception, defaulttext)
static ::ExceptionBase & ExcNoDominatedFiniteElementOnChildren()
#define DeclException1(Exception1, type1, outsequence)
static ::ExceptionBase & ExcMessage(std::string arg1)
static ::ExceptionBase & ExcInvalidBoundaryIndicator()
#define AssertThrow(cond, exc)
typename ActiveSelector::FaceAccessor face_accessor
typename ActiveSelector::cell_iterator cell_iterator
typename ActiveSelector::line_iterator line_iterator
typename ActiveSelector::face_iterator face_iterator
typename ActiveSelector::active_line_iterator active_line_iterator
typename ActiveSelector::active_cell_iterator active_cell_iterator
typename ActiveSelector::CellAccessor cell_accessor
typename ActiveSelector::quad_iterator quad_iterator
typename ActiveSelector::active_hex_iterator active_hex_iterator
typename ActiveSelector::active_quad_iterator active_quad_iterator
typename ActiveSelector::hex_iterator hex_iterator
typename ActiveSelector::active_face_iterator active_face_iterator
unsigned int n_cells(const internal::TriangulationImplementation::NumberCache< 1 > &c)
unsigned int dominated_future_fe_on_children(const typename DoFHandler< dim, spacedim >::cell_iterator &parent)
void communicate_future_fe_indices(DoFHandler< dim, spacedim > &dof_handler)
std::string policy_to_string(const ::internal::DoFHandlerImplementation::Policy::PolicyBase< dim, spacedim > &policy)
const types::fe_index invalid_fe_index
unsigned int global_dof_index
unsigned short int fe_index
std::map< const cell_iterator, const types::fe_index > refined_cells_fe_index
std::map< const cell_iterator, const types::fe_index > persisting_cells_fe_index
std::vector< types::fe_index > active_fe_indices
std::map< const cell_iterator, const types::fe_index > coarsened_cells_fe_index
std::unique_ptr< parallel::distributed::CellDataTransfer< dim, spacedim, std::vector< types::fe_index > > > cell_data_transfer
types::global_dof_index n_global_dofs
IndexSet locally_owned_dofs
types::global_dof_index n_locally_owned_dofs
const ::Triangulation< dim, spacedim > & tria