14#ifndef agglomeration_accessor_h
15#define agglomeration_accessor_h
41template <
int dim,
int spacedim = dim>
49 std::vector<typename Triangulation<dim, spacedim>::active_cell_iterator>;
101 const std::vector<typename Triangulation<dim>::active_face_iterator> &
178 inline const std::vector<types::global_cell_index> &
303template <
int dim,
int spacedim>
308 unsigned int n_neighbors = 0;
309 for (
const auto &f : cell->face_indices())
311 const auto &neighboring_cell = cell->neighbor(f);
312 if ((cell->face(f)->at_boundary()) ||
313 (neighboring_cell->is_active() &&
314 !
handler->are_cells_agglomerated(cell, neighboring_cell)))
324template <
int dim,
int spacedim>
329 ExcMessage(
"You cannot pass a slave cell."));
335template <
int dim,
int spacedim>
346 const unsigned int sender_rank =
master_cell->subdomain_id();
348 const CellId &master_id_ghosted_neighbor =
349 handler->recv_ghosted_master_id.at(sender_rank)
357 master_id_ghosted_neighbor,
378 handler->polytope_cache.cell_face_at_boundary.at({polytope_index, f})
382 if (neigh->is_locally_owned())
410 const CellId &master_id_neighbor =
415 return {neigh, master_id_neighbor,
handler};
426template <
int dim,
int spacedim>
429 const unsigned int f)
const
434 const auto &neigh_polytope =
440 unsigned int n_faces_agglomerated_neighbor;
443 if (neigh_polytope->is_locally_owned())
445 n_faces_agglomerated_neighbor = neigh_polytope->n_faces();
453 const CellId &master_id_neighbor = neigh_polytope->id();
456 const unsigned int sender_rank = neigh_polytope->subdomain_id();
460 n_faces_agglomerated_neighbor =
461 handler->recv_n_faces.at(sender_rank).at(master_id_neighbor);
466 for (
unsigned int f_out = 0; f_out < n_faces_agglomerated_neighbor;
471 if (neigh_polytope->neighbor(f_out)->id() ==
present_id)
485template <
int dim,
int spacedim>
491template <
int dim,
int spacedim>
497 if (&(*
handler->master_cells_container.end()) == std::addressof(cell))
515template <
int dim,
int spacedim>
518 const CellId &master_cell_id,
521 Assert(neigh_cell->is_ghost(), ExcInternalError());
534template <
int dim,
int spacedim>
537 std::vector<types::global_dof_index> &dof_indices)
const
539 Assert(dof_indices.size() > 0,
541 "The vector of DoFs indices must be already properly resized."));
547 master_cell_dh->get_dof_indices(dof_indices);
551 const std::vector<types::global_dof_index> &recv_dof_indices =
554 std::copy(recv_dof_indices.cbegin(),
555 recv_dof_indices.cend(),
556 dof_indices.begin());
562template <
int dim,
int spacedim>
568 return agglomeration;
573template <
int dim,
int spacedim>
574inline const std::vector<typename Triangulation<dim>::active_face_iterator> &
582template <
int dim,
int spacedim>
587 ExcMessage(
"The present function cannot be called for slave cells."));
592 const auto &bdary_pts =
594 return (bdary_pts.second - bdary_pts.first).norm();
605template <
int dim,
int spacedim>
617template <
int dim,
int spacedim>
622 ExcMessage(
"The present function cannot be called for slave cells."));
636template <
int dim,
int spacedim>
644 if (present_index < handler->master_cells_container.size())
654template <
int dim,
int spacedim>
665template <
int dim,
int spacedim>
673template <
int dim,
int spacedim>
678 return !(*
this == other);
683template <
int dim,
int spacedim>
692template <
int dim,
int spacedim>
698 return master_cell->as_dof_handler_iterator(dof_handler);
703template <
int dim,
int spacedim>
713template <
int dim,
int spacedim>
723template <
int dim,
int spacedim>
728 unsigned int n_neighbors = 0;
729 for (
const auto &cell : agglomeration)
736template <
int dim,
int spacedim>
742 const unsigned int sender_rank =
master_cell->subdomain_id();
765 "This function should not be called for a slave cell."));
770 return handler->at_boundary(cell_dh, f);
776template <
int dim,
int spacedim>
785template <
int dim,
int spacedim>
794template <
int dim,
int spacedim>
801template <
int dim,
int spacedim>
802inline const std::vector<types::global_cell_index> &
805 Assert(!
handler->parent_child_info.empty(), ExcInternalError());
806 return handler->parent_child_info.at(
810template <
int dim,
int spacedim>
815 master_cell_as_dof_handler_iterator =
817 return master_cell_as_dof_handler_iterator->
get_fe();
820template <
int dim,
int spacedim>
826 ExcMessage(
"The present function cannot be called for slave cells."));
828 master_cell_as_dof_handler_iterator =
830 master_cell_as_dof_handler_iterator->set_active_fe_index(
index);
833template <
int dim,
int spacedim>
838 master_cell_as_dof_handler_iterator =
840 return master_cell_as_dof_handler_iterator->active_fe_index();
const FiniteElement< dim, spacedim > & get_fe(const types::fe_index index=0) const
unsigned int n_agglomerated_faces() const
AgglomerationContainer get_agglomerate() const
types::global_cell_index index() const
~AgglomerationAccessor()=default
std::vector< typename Triangulation< dim, spacedim >::active_cell_iterator > AgglomerationContainer
unsigned int n_agglomerated_faces_per_cell(const typename Triangulation< dim, spacedim >::active_cell_iterator &cell) const
void set_active_fe_index(const types::fe_index index) const
unsigned int n_background_cells() const
unsigned int neighbor_of_agglomerated_neighbor(const unsigned int f) const
AgglomerationAccessor(const typename Triangulation< dim, spacedim >::active_cell_iterator &master_cell, const AgglomerationHandler< dim, spacedim > *ah)
const std::vector< typename Triangulation< dim >::active_face_iterator > & polytope_boundary() const
bool is_locally_owned() const
const AgglomerationIterator< dim, spacedim > neighbor(const unsigned int f) const
bool at_boundary(const unsigned int f) const
const BoundingBox< dim > & get_bounding_box() const
friend class AgglomerationIterator
const std::vector< types::global_cell_index > & children() const
bool operator!=(const AgglomerationAccessor< dim, spacedim > &other) const
types::global_cell_index present_index
bool operator==(const AgglomerationAccessor< dim, spacedim > &other) const
const FiniteElement< dim, spacedim > & get_fe() const
AgglomerationHandler< dim, spacedim > * handler
DoFHandler< dim, spacedim >::active_cell_iterator as_dof_handler_iterator(const DoFHandler< dim, spacedim > &dof_handler) const
void get_dof_indices(std::vector< types::global_dof_index > &) const
types::subdomain_id subdomain_id() const
AgglomerationAccessor(const typename Triangulation< dim, spacedim >::active_cell_iterator &cell, const CellId &cell_id, const AgglomerationHandler< dim, spacedim > *ah)
types::fe_index active_fe_index() const
const AgglomerationContainer & get_slaves() const
types::subdomain_id present_subdomain_id
Triangulation< dim, spacedim >::active_cell_iterator master_cell
unsigned int n_faces() const
typename AgglomerationAccessor< dim, spacedim >::AgglomerationContainer AgglomerationContainer
#define Assert(cond, exc)
#define AssertThrow(cond, exc)
constexpr unsigned int invalid_unsigned_int
constexpr types::subdomain_id invalid_subdomain_id
unsigned int subdomain_id
unsigned short int fe_index
unsigned int global_cell_index