typename Triangulation<dim, spacedim>::active_cell_iterator>> &
get_locally_owned_cell_bounding_boxes_rtree() const;
+
+ /** Returns the vector of set of integer containing the subdomain id
+ * to which each vertex is connected to. This feature is used extensively
+ * in the particle_handler to detect on which processors ghost particles
+ * must be built
+ */
+ const std::vector<std::set<unsigned int>> &
+ get_vertex_to_neighbor_subdomain() const;
+
/**
* Return a reference to the stored triangulation.
*/
typename Triangulation<dim, spacedim>::active_cell_iterator>>
locally_owned_cell_bounding_boxes_rtree;
+
+ /**
+ * Store an std::vector of std::set of integer containing the id of all
+ * subdomain to which a vertex is connected to
+ */
+ mutable std::vector<std::set<unsigned int>> vertex_to_neighbor_subdomain;
+
/**
* Storage for the status of the triangulation signal.
*/
*/
update_locally_owned_cell_bounding_boxes_rtree = 0x080,
+ /**
+ * Update vertex to neighbhor subdomain
+ */
+ update_vertex_to_neighbor_subdomain = 0x100,
+
/**
* Update all objects.
*/
*
* @ref CacheUpdateFlags
*/
- inline CacheUpdateFlags operator&(const CacheUpdateFlags f1,
- const CacheUpdateFlags f2)
+ inline CacheUpdateFlags
+ operator&(const CacheUpdateFlags f1, const CacheUpdateFlags f2)
{
return static_cast<CacheUpdateFlags>(static_cast<unsigned int>(f1) &
static_cast<unsigned int>(f2));
return covering_rtree[level];
}
+ template <int dim, int spacedim>
+ const std::vector<std::set<unsigned int>> &
+ Cache<dim, spacedim>::get_vertex_to_neighbor_subdomain() const
+ {
+ if (update_flags & update_vertex_to_neighbor_subdomain)
+ {
+ vertex_to_neighbor_subdomain.clear();
+ vertex_to_neighbor_subdomain.resize(tria->n_vertices());
+ for (const auto &cell : tria->active_cell_iterators())
+ {
+ if (cell->is_ghost())
+ for (const unsigned int v : GeometryInfo<dim>::vertex_indices())
+ vertex_to_neighbor_subdomain[cell->vertex_index(v)].insert(
+ cell->subdomain_id());
+ }
+ }
+ return vertex_to_neighbor_subdomain;
+ }
+
#include "grid_tools_cache.inst"
} // namespace GridTools
static_cast<typename std::vector<particle_iterator>::size_type>(
particles.size() * 0.25));
- std::vector<std::set<unsigned int>> vertex_to_neighbor_subdomain(
- triangulation->n_vertices());
-
- for (const auto &cell : triangulation->active_cell_iterators())
- {
- if (cell->is_ghost())
- for (const unsigned int v : GeometryInfo<dim>::vertex_indices())
- vertex_to_neighbor_subdomain[cell->vertex_index(v)].insert(
- cell->subdomain_id());
- }
+ const std::vector<std::set<unsigned int>> vertex_to_neighbor_subdomain =
+ triangulation_cache->get_vertex_to_neighbor_subdomain();
for (const auto &cell : triangulation->active_cell_iterators())
{
switch (status)
{
- case parallel::distributed::Triangulation<dim, spacedim>::CELL_PERSIST:
- {
+ case parallel::distributed::Triangulation<dim,
+ spacedim>::CELL_PERSIST: {
auto position_hint = particles.end();
for (const auto &particle : loaded_particles_on_cell)
{
}
break;
- case parallel::distributed::Triangulation<dim, spacedim>::CELL_COARSEN:
- {
+ case parallel::distributed::Triangulation<dim,
+ spacedim>::CELL_COARSEN: {
typename std::multimap<internal::LevelInd,
Particle<dim, spacedim>>::iterator
position_hint = particles.end();
}
break;
- case parallel::distributed::Triangulation<dim, spacedim>::CELL_REFINE:
- {
+ case parallel::distributed::Triangulation<dim,
+ spacedim>::CELL_REFINE: {
std::vector<
typename std::multimap<internal::LevelInd,
Particle<dim, spacedim>>::iterator>