16 #ifndef dealii_hp_dof_handler_h 17 #define dealii_hp_dof_handler_h 47 template <
int dim,
int spacedim>
54 template <
int dim,
int spacedim,
typename VectorType>
61 namespace DoFHandlerImplementation
63 struct Implementation;
67 template <
int dim,
int spacedim>
69 struct Implementation;
77 namespace DoFHandlerImplementation
79 struct Implementation;
86 namespace DoFAccessorImplementation
88 struct Implementation;
91 namespace DoFCellAccessorImplementation
93 struct Implementation;
202 template <
int dim,
int spacedim = dim>
206 Iterators<DoFHandler<dim, spacedim>,
false>;
208 Iterators<DoFHandler<dim, spacedim>,
true>;
351 static const unsigned int dimension = dim;
356 static const unsigned int space_dimension = spacedim;
361 static const bool is_hp_dof_handler =
true;
468 set_active_fe_indices(
const std::vector<unsigned int> &active_fe_indices);
539 renumber_dofs(
const std::vector<types::global_dof_index> &new_numbers);
559 max_couplings_between_dofs()
const;
574 max_couplings_between_boundary_dofs()
const;
603 begin_active(
const unsigned int level = 0)
const;
617 end(
const unsigned int level)
const;
625 end_active(
const unsigned int level)
const;
642 cell_iterators()
const;
685 active_cell_iterators()
const;
703 cell_iterators_on_level(
const unsigned int level)
const;
721 active_cell_iterators_on_level(
const unsigned int level)
const;
763 n_dofs(
const unsigned int level)
const;
770 n_boundary_dofs()
const;
782 template <
typename number>
786 &boundary_ids)
const;
794 n_boundary_dofs(
const std::set<types::boundary_id> &boundary_ids)
const;
814 n_locally_owned_dofs()
const;
822 locally_owned_dofs()
const;
838 locally_owned_dofs_per_processor()
const;
857 n_locally_owned_dofs_per_processor()
const;
866 locally_owned_mg_dofs(
const unsigned int level)
const;
883 locally_owned_mg_dofs_per_processor(
const unsigned int level)
const;
890 get_fe(
const unsigned int index)
const;
897 get_fe_collection()
const;
904 get_triangulation()
const;
934 prepare_for_serialization_of_active_fe_indices();
952 deserialize_active_fe_indices();
958 template <
class Archive>
960 save(Archive &ar,
const unsigned int version)
const;
966 template <
class Archive>
968 load(Archive &ar,
const unsigned int version);
975 template <
class Archive>
977 serialize(Archive &archive,
const unsigned int version);
981 BOOST_SERIALIZATION_SPLIT_MEMBER()
1001 <<
"The matrix has the wrong dimension " << arg1);
1011 <<
"The given list of new dof indices is not consecutive: " 1012 <<
"the index " << arg1 <<
" does not exist.");
1019 <<
"The mesh contains a cell with an active_fe_index of " 1020 << arg1 <<
", but the finite element collection only has " 1021 << arg2 <<
" elements");
1027 <<
"The given level " << arg1
1028 <<
" is not in the valid range!");
1038 <<
"You tried to do something on level " << arg1
1039 <<
", but this level is empty.");
1057 std::unique_ptr<::internal::DoFHandlerImplementation::Policy::
1058 PolicyBase<dim, spacedim>>
1066 setup_policy_and_listeners();
1074 template <
int structdim>
1076 get_dof_index(
const unsigned int obj_level,
1077 const unsigned int obj_index,
1078 const unsigned int fe_index,
1079 const unsigned int local_index)
const;
1081 template <
int structdim>
1083 set_dof_index(
const unsigned int obj_level,
1084 const unsigned int obj_index,
1085 const unsigned int fe_index,
1086 const unsigned int local_index,
1097 create_active_fe_table();
1108 pre_refinement_action();
1118 post_refinement_action();
1130 pre_active_fe_index_transfer();
1141 pre_distributed_active_fe_index_transfer();
1152 post_active_fe_index_transfer();
1163 post_distributed_active_fe_index_transfer();
1174 post_distributed_serialization_of_active_fe_indices();
1180 std::vector<std::unique_ptr<::internal::hp::DoFLevel>>
levels;
1186 std::unique_ptr<::internal::hp::DoFIndicesOnFaces<dim>>
faces;
1202 std::vector<::internal::DoFHandlerImplementation::NumberCache>
1245 std::map<const cell_iterator, const unsigned int>
1258 std::map<const cell_iterator, const unsigned int>
1274 parallel::distributed::
1275 CellDataTransfer<dim, spacedim, std::vector<unsigned int>>>
1292 template <
int,
class,
bool>
1293 friend class ::DoFAccessor;
1294 template <
class,
bool>
1295 friend class ::DoFCellAccessor;
1296 friend struct ::internal::DoFAccessorImplementation::Implementation;
1297 friend struct ::internal::DoFCellAccessorImplementation::
1303 friend class ::internal::hp::DoFIndicesOnFacesOrEdges;
1304 friend struct ::internal::hp::DoFHandlerImplementation::
1306 friend struct ::internal::DoFHandlerImplementation::Policy::
1319 template <
int dim,
int spacedim>
1320 template <
typename number>
1324 &boundary_ids)
const 1328 std::set<types::boundary_id> boundary_ids_only;
1331 p = boundary_ids.begin();
1332 p != boundary_ids.end();
1334 boundary_ids_only.insert(p->first);
1337 return n_boundary_dofs(boundary_ids_only);
1353 template <
typename number>
1383 template <
int dim,
int spacedim>
1386 PolicyBase<dim, spacedim> &policy);
1392 template <
int dim,
int spacedim>
1393 template <
class Archive>
1398 ar &vertex_dof_offsets;
1400 ar &mg_number_cache;
1405 const unsigned int n_levels = levels.size();
1407 for (
unsigned int i = 0; i < n_levels; ++i)
1413 bool faces_is_nullptr = (faces.get() ==
nullptr);
1414 ar & faces_is_nullptr;
1415 if (!faces_is_nullptr)
1421 const unsigned int n_cells = tria->n_cells();
1424 ar &n_cells &policy_name;
1429 template <
int dim,
int spacedim>
1430 template <
class Archive>
1435 ar &vertex_dof_offsets;
1437 ar &mg_number_cache;
1451 levels.resize(size);
1452 for (
unsigned int i = 0; i < size; ++i)
1454 std::unique_ptr<::internal::hp::DoFLevel>
level;
1456 levels[i] = std::move(level);
1460 bool faces_is_nullptr =
true;
1461 ar & faces_is_nullptr;
1462 if (!faces_is_nullptr)
1468 std::string policy_name;
1470 ar &n_cells &policy_name;
1473 n_cells == tria->n_cells(),
1475 "The object being loaded into does not match the triangulation " 1476 "that has been stored previously."));
1479 "The policy currently associated with this DoFHandler (" +
1481 ") does not match the one that was associated with the " 1482 "DoFHandler previously stored (" +
1483 policy_name +
")."));
1486 template <
int dim,
int spacedim>
1490 return number_cache.n_global_dofs;
1495 template <
int dim,
int spacedim>
1505 template <
int dim,
int spacedim>
1509 return number_cache.n_locally_owned_dofs;
1514 template <
int dim,
int spacedim>
1518 return number_cache.locally_owned_dofs;
1523 template <
int dim,
int spacedim>
1524 const std::vector<types::global_dof_index> &
1527 if (number_cache.n_locally_owned_dofs_per_processor.empty() &&
1528 number_cache.n_global_dofs > 0)
1534 &this->get_triangulation()));
1538 comm = MPI_COMM_SELF;
1542 .n_locally_owned_dofs_per_processor =
1545 return number_cache.n_locally_owned_dofs_per_processor;
1550 template <
int dim,
int spacedim>
1551 const std::vector<IndexSet> &
1554 if (number_cache.locally_owned_dofs_per_processor.empty() &&
1555 number_cache.n_global_dofs > 0)
1561 &this->get_triangulation()));
1565 comm = MPI_COMM_SELF;
1569 .locally_owned_dofs_per_processor =
1572 return number_cache.locally_owned_dofs_per_processor;
1577 template <
int dim,
int spacedim>
1580 const unsigned int level)
const 1584 Assert(level < this->get_triangulation().n_global_levels(),
1585 ExcMessage(
"The given level index exceeds the number of levels " 1586 "present in the triangulation"));
1587 return mg_number_cache[0].locally_owned_dofs;
1592 template <
int dim,
int spacedim>
1593 const std::vector<IndexSet> &
1595 const unsigned int level)
const 1597 Assert(level < this->get_triangulation().n_global_levels(),
1598 ExcMessage(
"The given level index exceeds the number of levels " 1599 "present in the triangulation"));
1601 mg_number_cache.size() == this->get_triangulation().n_global_levels(),
1603 "The level dofs are not set up properly! Did you call distribute_mg_dofs()?"));
1604 if (mg_number_cache[level].locally_owned_dofs_per_processor.empty() &&
1605 mg_number_cache[
level].n_global_dofs > 0)
1611 &this->get_triangulation()));
1615 comm = MPI_COMM_SELF;
1618 mg_number_cache[
level])
1619 .locally_owned_dofs_per_processor =
1620 mg_number_cache[level].get_locally_owned_dofs_per_processor(comm);
1627 template <
int dim,
int spacedim>
1631 Assert(fe_collection.size() > 0,
1632 ExcMessage(
"No finite element collection is associated with " 1633 "this DoFHandler"));
1634 return fe_collection[number];
1639 template <
int dim,
int spacedim>
1643 Assert(fe_collection.size() > 0,
1644 ExcMessage(
"No finite element collection is associated with " 1645 "this DoFHandler"));
1646 return fe_collection;
1651 template <
int dim,
int spacedim>
1656 ExcMessage(
"This DoFHandler object has not been associated " 1657 "with a triangulation."));
const Triangulation< dim, spacedim > & get_triangulation() const
static const unsigned int invalid_unsigned_int
typename ActiveSelector::face_iterator face_iterator
#define DeclException2(Exception2, type1, type2, outsequence)
std::vector< unsigned int > active_fe_indices
std::vector<::internal::DoFHandlerImplementation::NumberCache > mg_number_cache
::internal::DoFHandlerImplementation::NumberCache number_cache
std::vector< std::unique_ptr<::internal::hp::DoFLevel > > levels
std::map< const cell_iterator, const unsigned int > refined_cells_fe_index
std::unique_ptr<::internal::hp::DoFIndicesOnFaces< dim > > faces
const std::vector< IndexSet > & locally_owned_mg_dofs_per_processor(const unsigned int level) const
std::map< const cell_iterator, const unsigned int > coarsened_cells_fe_index
typename ActiveSelector::CellAccessor cell_accessor
#define AssertThrow(cond, exc)
std::unique_ptr< ActiveFEIndexTransfer > active_fe_index_transfer
std::vector< boost::signals2::connection > tria_listeners
typename LevelSelector::cell_iterator level_cell_iterator
std::unique_ptr< parallel::distributed::CellDataTransfer< dim, spacedim, std::vector< unsigned int > > > cell_data_transfer
static ::ExceptionBase & ExcFacesHaveNoLevel()
const FiniteElement< dim, spacedim > & get_fe(const unsigned int index=0) const
SmartPointer< const Triangulation< dim, spacedim >, DoFHandler< dim, spacedim > > tria
std::unique_ptr<::internal::DoFHandlerImplementation::Policy::PolicyBase< dim, spacedim > > policy
typename ActiveSelector::active_cell_iterator active_cell_iterator
types::global_dof_index n_locally_owned_dofs() const
const std::vector< types::global_dof_index > & n_locally_owned_dofs_per_processor() const
static ::ExceptionBase & ExcMessage(std::string arg1)
typename ActiveSelector::active_quad_iterator active_quad_iterator
typename ActiveSelector::quad_iterator quad_iterator
typename ActiveSelector::cell_iterator cell_iterator
#define DeclException1(Exception1, type1, outsequence)
typename ActiveSelector::active_line_iterator active_line_iterator
#define Assert(cond, exc)
std::vector< types::global_dof_index > get_n_locally_owned_dofs_per_processor(const MPI_Comm mpi_communicator) const
#define DeclException0(Exception0)
types::global_dof_index n_boundary_dofs() const
#define DEAL_II_NAMESPACE_CLOSE
typename LevelSelector::face_iterator level_face_iterator
types::global_dof_index n_dofs() const
VectorType::value_type * end(VectorType &V)
const hp::FECollection< dim, spacedim > & get_fe_collection() const
const IndexSet & locally_owned_mg_dofs(const unsigned int level) const
typename LevelSelector::CellAccessor level_cell_accessor
unsigned int n_cells(const internal::TriangulationImplementation::NumberCache< 1 > &c)
virtual const MPI_Comm & get_communicator() const
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)
const std::vector< IndexSet > & locally_owned_dofs_per_processor() const
typename ActiveSelector::active_face_iterator active_face_iterator
hp::FECollection< dim, spacedim > fe_collection
#define DEAL_II_NAMESPACE_OPEN
VectorType::value_type * begin(VectorType &V)
void load(Archive &ar, const unsigned int version)
std::vector< IndexSet > locally_owned_dofs_per_processor
static ::ExceptionBase & ExcInvalidBoundaryIndicator()
static ::ExceptionBase & ExcNotImplemented()
TrilinosWrappers::types::int_type global_index(const Epetra_BlockMap &map, const ::types::global_dof_index i)
std::map< const cell_iterator, const unsigned int > persisting_cells_fe_index
const types::global_dof_index invalid_dof_index
std::vector< types::global_dof_index > vertex_dofs
const IndexSet & locally_owned_dofs() const
#define DEAL_II_DEPRECATED
typename LevelSelector::FaceAccessor level_face_accessor
static ::ExceptionBase & ExcNoFESelected()
std::vector< unsigned int > vertex_dof_offsets
typename ActiveSelector::FaceAccessor face_accessor
void save(Archive &ar, const unsigned int version) const
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
typename ActiveSelector::line_iterator line_iterator
typename ActiveSelector::hex_iterator hex_iterator