12#ifndef agglomeration_handler_h
13#define agglomeration_handler_h
62template <
int dim,
int spacedim>
87 template <
int dim,
int spacedim>
117 mutable std::set<std::pair<types::global_cell_index, unsigned int>>
121 mutable std::set<std::pair<CellId, unsigned int>>
135 std::pair<types::global_cell_index, unsigned int>,
144 mutable std::map<std::pair<CellId, unsigned int>,
CellId>
158 std::pair<CellId, CellId>,
160 std::pair<typename Triangulation<dim, spacedim>::active_cell_iterator,
171template <
int dim,
int spacedim = dim>
258 const UpdateFlags &flags = UpdateFlags::update_default,
260 const UpdateFlags &face_flags = UpdateFlags::update_default);
268 template <
typename SparsityPatternType,
typename Number =
double>
271 SparsityPatternType &sparsity_pattern,
273 const bool keep_constrained_dofs =
true,
307 inline const std::vector<BoundingBox<dim>> &
322 inline decltype(
auto)
328 template <
typename CellIterator>
336 inline const std::vector<
361 template <
class StreamType>
365 for (
const auto &cell :
tria->active_cell_iterators())
366 out <<
"Cell with index: " << cell->active_cell_index()
367 <<
" has associated value: "
407 const unsigned int face_index)
const;
414 std::pair<const FEValuesBase<dim, spacedim> &,
418 const unsigned int local_in,
419 const unsigned int local_outside)
const;
445 const unsigned int f)
const;
450 inline
types::global_dof_index
460 inline const
std::vector<typename
Triangulation<dim>::active_face_iterator> &
462 const typename
Triangulation<dim>::active_cell_iterator &cell);
512 mutable
std::map<
types::subdomain_id,
521 inline const typename
DoFHandler<dim, spacedim>::active_cell_iterator
527 template <typename RtreeType>
537 const
std::unique_ptr<
GridTools::Cache<dim, spacedim>> &cache_tria);
542 const typename
Triangulation<dim, spacedim>::active_cell_iterator
607 const unsigned int face_number,
609 &agglo_isv_ptr)
const;
616 template <
typename CellIterator>
663 std::vector<typename Triangulation<dim>::active_face_iterator>>
673 std::vector<BoundingBox<spacedim>>
bboxes;
679 mutable std::map<types::subdomain_id, std::map<CellId, unsigned int>>
682 mutable std::map<types::subdomain_id, std::map<CellId, unsigned int>>
687 mutable std::map<types::subdomain_id, std::map<CellId, CellId>>
690 mutable std::map<types::subdomain_id, std::map<CellId, CellId>>
699 std::map<CellId, std::map<unsigned int, CellId>>>
703 std::map<CellId, std::map<unsigned int, CellId>>>
708 std::map<CellId, std::map<unsigned int, bool>>>
712 std::map<CellId, std::map<unsigned int, bool>>>
716 mutable std::map<types::subdomain_id, std::map<CellId, BoundingBox<dim>>>
719 mutable std::map<types::subdomain_id, std::map<CellId, BoundingBox<dim>>>
724 std::map<CellId, std::vector<types::global_dof_index>>>
728 std::map<CellId, std::vector<types::global_dof_index>>>
734 std::map<std::pair<CellId, unsigned int>, std::vector<Point<spacedim>>>>
740 std::map<std::pair<CellId, unsigned int>, std::vector<double>>>
746 std::map<std::pair<CellId, unsigned int>, std::vector<Tensor<1, spacedim>>>>
752 std::map<std::pair<CellId, unsigned int>, std::vector<std::vector<double>>>>
756 std::map<std::pair<CellId, unsigned int>,
757 std::vector<std::vector<Tensor<1, spacedim>>>>>
774 std::unique_ptr<FiniteElement<dim>>
fe;
798 mutable std::unique_ptr<NonMatching::FEImmersedSurfaceValues<spacedim>>
801 mutable std::unique_ptr<NonMatching::FEImmersedSurfaceValues<spacedim>>
804 mutable std::unique_ptr<NonMatching::FEImmersedSurfaceValues<spacedim>>
828 std::vector<typename Triangulation<dim, spacedim>::active_cell_iterator>>
835 std::vector<typename Triangulation<dim>::active_cell_iterator>
858 std::vector<typename Triangulation<dim, spacedim>::active_cell_iterator>
871 std::map<std::pair<types::global_cell_index, types::global_cell_index>,
872 std::vector<types::global_cell_index>>
881template <
int dim,
int spacedim>
890template <
int dim,
int spacedim>
899template <
int dim,
int spacedim>
908template <
int dim,
int spacedim>
916template <
int dim,
int spacedim>
917inline const std::vector<BoundingBox<dim>> &
925template <
int dim,
int spacedim>
935template <
int dim,
int spacedim>
944template <
int dim,
int spacedim>
953template <
int dim,
int spacedim>
954inline std::vector<typename Triangulation<dim, spacedim>::active_cell_iterator>
961 agglomeration.push_back(master_cell);
962 return agglomeration;
967template <
int dim,
int spacedim>
976template <
int dim,
int spacedim>
977inline const std::vector<
987template <
int dim,
int spacedim>
988template <
typename CellIterator>
991 const CellIterator &cell)
const
1002template <
int dim,
int spacedim>
1003template <
typename CellIterator>
1006 const CellIterator &cell)
const
1013template <
int dim,
int spacedim>
1017 const unsigned int face_index)
const
1020 ExcMessage(
"This function should not be called for a slave cell."));
1028template <
int dim,
int spacedim>
1032 return fe->n_dofs_per_cell();
1037template <
int dim,
int spacedim>
1046template <
int dim,
int spacedim>
1047inline const std::vector<typename Triangulation<dim>::active_face_iterator> &
1056template <
int dim,
int spacedim>
1066template <
int dim,
int spacedim>
1073 return cell->global_active_cell_index();
1080template <
int dim,
int spacedim>
1096template <
int dim,
int spacedim>
1105template <
int dim,
int spacedim>
1116template <
int dim,
int spacedim>
1121 ExcMessage(
"No agglomeration has been performed."));
1127template <
int dim,
int spacedim>
1132 ExcMessage(
"No agglomeration has been performed."));
1138template <
int dim,
int spacedim>
1143 ExcMessage(
"No agglomeration has been performed."));
1149template <
int dim,
int spacedim>
1154 ExcMessage(
"No agglomeration has been performed."));
1160template <
int dim,
int spacedim>
1165 ExcMessage(
"No agglomeration has been performed."));
1171template <
int dim,
int spacedim>
1181template <
int dim,
int spacedim>
1182template <
typename RtreeType>
unsigned int n_dofs_per_cell() const noexcept
AgglomerationHandler()=default
types::global_cell_index cell_to_polytope_index(const typename Triangulation< dim, spacedim >::active_cell_iterator &cell) const
std::map< types::subdomain_id, std::map< CellId, unsigned int > > local_n_faces
agglomeration_iterator end() const
const DoFHandler< dim, spacedim > & get_dof_handler() const
std::unique_ptr< GridTools::Cache< dim, spacedim > > cached_tria
boost::signals2::connection tria_listener
const std::vector< typename Triangulation< dim, spacedim >::active_cell_iterator > & get_slaves_of_idx(types::global_cell_index idx) const
agglomeration_iterator last()
LinearAlgebra::distributed::Vector< float > master_slave_relationships
types::global_cell_index get_master_idx_of_cell(const typename Triangulation< dim, spacedim >::active_cell_iterator &cell) const
std::map< types::subdomain_id, std::map< std::pair< CellId, unsigned int >, std::vector< Tensor< 1, spacedim > > > > local_normals
const FEValues< dim, spacedim > & reinit(const AgglomerationIterator< dim, spacedim > &polytope) const
std::map< types::subdomain_id, std::map< CellId, CellId > > recv_cell_ids_neigh_cell
FE_Nothing< dim, spacedim > dummy_fe
MeshWorker::ScratchData< dim, spacedim > ScratchData
std::unique_ptr< NonMatching::FEImmersedSurfaceValues< spacedim > > agglomerated_isv_bdary
bool is_slave_cell(const CellIterator &cell) const
LinearAlgebra::distributed::Vector< double > euler_vector
std::map< types::subdomain_id, std::map< CellId, std::map< unsigned int, bool > > > local_bdary_info
std::map< types::subdomain_id, std::map< std::pair< CellId, unsigned int >, std::vector< std::vector< double > > > > local_values
std::unique_ptr< NonMatching::FEImmersedSurfaceValues< spacedim > > agglomerated_isv
std::unique_ptr< ScratchData > standard_scratch
Quadrature< dim > agglomeration_quad
std::map< types::subdomain_id, std::map< std::pair< CellId, unsigned int >, std::vector< double > > > recv_jxws
std::map< types::subdomain_id, std::map< std::pair< CellId, unsigned int >, std::vector< Tensor< 1, spacedim > > > > recv_normals
Quadrature< dim - 1 > agglomeration_face_quad
std::unique_ptr< FEValues< dim, spacedim > > no_values
const DoFHandler< dim, spacedim >::active_cell_iterator polytope_to_dh_iterator(const types::global_cell_index polytope_index) const
std::map< types::subdomain_id, std::map< CellId, unsigned int > > recv_n_faces
std::vector< BoundingBox< spacedim > > bboxes
void exchange_interface_values()
SmartPointer< const Triangulation< dim, spacedim > > tria
unsigned int present_extraction_level
types::global_dof_index n_dofs() const noexcept
std::map< types::subdomain_id, std::map< CellId, BoundingBox< dim > > > recv_ghosted_bbox
bool are_cells_agglomerated(const typename Triangulation< dim, spacedim >::active_cell_iterator &cell, const typename Triangulation< dim, spacedim >::active_cell_iterator &other_cell) const
unsigned int n_agglomerations
Quadrature< dim > agglomerated_quadrature(const AgglomerationContainer &cells, const typename Triangulation< dim, spacedim >::active_cell_iterator &master_cell) const
AgglomerationIterator< dim, spacedim > agglomeration_iterator
std::map< const typename Triangulation< dim, spacedim >::active_cell_iterator, std::vector< typename Triangulation< dim >::active_face_iterator > > polygon_boundary
agglomeration_iterator begin() const
std::unordered_map< types::global_cell_index, std::vector< typename Triangulation< dim, spacedim >::active_cell_iterator > > master2slaves
std::vector< typename Triangulation< dim >::active_cell_iterator > master_disconnected
void create_bounding_box(const AgglomerationContainer &polytope)
std::map< types::global_cell_index, types::global_cell_index > master2polygon
DoFHandler< dim, spacedim > output_dh
typename AgglomerationIterator< dim, spacedim >::AgglomerationContainer AgglomerationContainer
std::map< std::pair< types::global_cell_index, types::global_cell_index >, std::vector< types::global_cell_index > > parent_child_info
std::map< types::subdomain_id, std::map< std::pair< CellId, unsigned int >, std::vector< Point< spacedim > > > > recv_qpoints
std::pair< const FEValuesBase< dim, spacedim > &, const FEValuesBase< dim, spacedim > & > reinit_interface(const AgglomerationIterator< dim, spacedim > &polytope_in, const AgglomerationIterator< dim, spacedim > &neigh_polytope, const unsigned int local_in, const unsigned int local_outside) const
AgglomerationHandler(const GridTools::Cache< dim, spacedim > &cached_tria)
const MPI_Comm communicator
std::map< types::subdomain_id, std::map< CellId, std::vector< types::global_dof_index > > > recv_ghost_dofs
void setup_connectivity_of_agglomeration()
std::map< types::subdomain_id, std::map< std::pair< CellId, unsigned int >, std::vector< std::vector< Tensor< 1, spacedim > > > > > recv_gradients
const Triangulation< dim, spacedim > & get_triangulation() const
void create_agglomeration_sparsity_pattern(SparsityPatternType &sparsity_pattern, const AffineConstraints< Number > &constraints=AffineConstraints< Number >(), const bool keep_constrained_dofs=true, const types::subdomain_id subdomain_id=numbers::invalid_subdomain_id)
const Mapping< dim > & get_mapping() const
unsigned int n_agglomerates() const
const std::vector< typename Triangulation< dim >::active_face_iterator > & polytope_boundary(const typename Triangulation< dim >::active_cell_iterator &cell)
void setup_ghost_polytopes()
std::map< types::global_cell_index, typename Triangulation< dim, spacedim >::active_cell_iterator > master_slave_relationships_iterators
const std::vector< BoundingBox< dim > > & get_local_bboxes() const
const LinearAlgebra::distributed::Vector< float > & get_relationships() const
std::vector< typename Triangulation< dim, spacedim >::active_cell_iterator > get_agglomerate(const typename Triangulation< dim, spacedim >::active_cell_iterator &master_cell) const
unsigned int n_agglomerated_faces_per_cell(const typename Triangulation< dim, spacedim >::active_cell_iterator &cell) const
const UpdateFlags internal_agglomeration_face_flags
std::map< types::subdomain_id, std::map< std::pair< CellId, unsigned int >, std::vector< std::vector< Tensor< 1, spacedim > > > > > local_gradients
void distribute_agglomerated_dofs(const FiniteElement< dim > &fe_space)
std::vector< types::global_cell_index > number_of_agglomerated_faces
const UpdateFlags internal_agglomeration_flags
std::map< types::subdomain_id, std::map< CellId, std::map< unsigned int, bool > > > recv_bdary_info
void connect_to_tria_signals()
const FiniteElement< dim, spacedim > & get_fe() const
std::unique_ptr< FEFaceValues< dim, spacedim > > no_face_values
const FEValuesBase< dim, spacedim > & reinit_master(const typename DoFHandler< dim, spacedim >::active_cell_iterator &cell, const unsigned int face_number, std::unique_ptr< NonMatching::FEImmersedSurfaceValues< spacedim > > &agglo_isv_ptr) const
std::map< types::subdomain_id, std::map< CellId, std::vector< types::global_dof_index > > > local_ghost_dofs
std::vector< typename Triangulation< dim, spacedim >::active_cell_iterator > master_cells_container
friend class AgglomerationIterator
std::map< types::subdomain_id, std::map< std::pair< CellId, unsigned int >, std::vector< std::vector< double > > > > recv_values
void connect_hierarchy(const CellsAgglomerator< dim, RtreeType > &agglomerator)
bool at_boundary(const typename DoFHandler< dim, spacedim >::active_cell_iterator &cell, const unsigned int f) const
friend class AgglomerationAccessor
bool is_master_cell(const CellIterator &cell) const
IteratorRange< agglomeration_iterator > polytope_iterators() const
decltype(auto) get_interface() const
void initialize_agglomeration_data(const std::unique_ptr< GridTools::Cache< dim, spacedim > > &cache_tria)
void print_agglomeration(StreamType &out)
agglomeration_iterator define_agglomerate(const AgglomerationContainer &cells)
std::map< types::subdomain_id, std::map< std::pair< CellId, unsigned int >, std::vector< double > > > local_jxws
void initialize_fe_values(const Quadrature< dim > &cell_quadrature=QGauss< dim >(1), const UpdateFlags &flags=UpdateFlags::update_default, const Quadrature< dim - 1 > &face_quadrature=QGauss< dim - 1 >(1), const UpdateFlags &face_flags=UpdateFlags::update_default)
agglomeration_iterator end()
std::map< types::subdomain_id, std::map< std::pair< CellId, unsigned int >, std::vector< Point< spacedim > > > > local_qpoints
std::unique_ptr< NonMatching::FEImmersedSurfaceValues< spacedim > > agglomerated_isv_neigh
void define_agglomerate_with_check(const AgglomerationContainer &cells)
const MappingBox< dim > & get_agglomeration_mapping() const
std::unique_ptr< ScratchData > agglomerated_scratch
UpdateFlags agglomeration_face_flags
hp::FECollection< dim, spacedim > fe_collection
std::map< types::subdomain_id, std::map< CellId, BoundingBox< dim > > > local_ghosted_bbox
DoFHandler< dim, spacedim > agglo_dh
void initialize_hp_structure()
Triangulation< dim, spacedim >::active_cell_iterator & is_slave_cell_of(const typename Triangulation< dim, spacedim >::active_cell_iterator &cell)
std::unique_ptr< MappingBox< dim > > box_mapping
agglomeration_iterator begin()
std::unique_ptr< FiniteElement< dim > > fe
void update_agglomerate(AgglomerationContainer &polytope, const typename Triangulation< dim, spacedim >::active_cell_iterator &master_cell)
double get_mesh_size() const
UpdateFlags agglomeration_flags
std::map< types::subdomain_id, std::map< CellId, std::map< unsigned int, CellId > > > recv_ghosted_master_id
SmartPointer< const Mapping< dim, spacedim > > mapping
std::map< types::subdomain_id, std::map< CellId, CellId > > local_cell_ids_neigh_cell
internal::PolytopeCache< dim, spacedim > polytope_cache
std::map< types::subdomain_id, std::map< CellId, std::map< unsigned int, CellId > > > local_ghosted_master_id
typename AgglomerationAccessor< dim, spacedim >::AgglomerationContainer AgglomerationContainer
const unsigned int extraction_level
std::map< std::pair< types::global_cell_index, types::global_cell_index >, std::vector< types::global_cell_index > > parent_node_to_children_nodes
std::map< std::pair< types::global_cell_index, unsigned int >, std::pair< bool, typename Triangulation< dim, spacedim >::active_cell_iterator > > cell_face_at_boundary
std::map< std::pair< CellId, unsigned int >, CellId > ghosted_master_id
std::set< std::pair< types::global_cell_index, unsigned int > > visited_cell_and_faces
std::set< std::pair< CellId, unsigned int > > visited_cell_and_faces_id
std::map< std::pair< CellId, CellId >, std::vector< std::pair< typename Triangulation< dim, spacedim >::active_cell_iterator, unsigned int > > > interface
EnableObserverPointer Subscriptor
#define Assert(cond, exc)
constexpr types::subdomain_id invalid_subdomain_id
unsigned int global_dof_index
unsigned int subdomain_id
unsigned int global_cell_index
ObserverPointer< T, P > SmartPointer