const std::set<types::subdomain_id> &
level_ghost_owners() const;
- /**
- * Return partitioner for the global indices of the cells on the active
- * level of the triangulation, which is returned by the function
- * CellAccessor::global_active_cell_index().
- */
const std::weak_ptr<const Utilities::MPI::Partitioner>
- global_active_cell_index_partitioner() const;
+ global_active_cell_index_partitioner() const override;
- /**
- * Return partitioner for the global indices of the cells on the given @p
- * level of the triangulation, which is returned by the function
- * CellAccessor::global_level_cell_index().
- */
const std::weak_ptr<const Utilities::MPI::Partitioner>
- global_level_cell_index_partitioner(const unsigned int level) const;
+ global_level_cell_index_partitioner(
+ const unsigned int level) const override;
/**
* @copydoc dealii::Triangulation::get_boundary_ids()
#include <deal.II/base/geometry_info.h>
#include <deal.II/base/iterator_range.h>
+#include <deal.II/base/partitioner.h>
#include <deal.II/base/point.h>
#include <deal.II/base/smartpointer.h>
#include <deal.II/base/subscriptor.h>
*/
std::vector<unsigned int> n_active_lines_level;
+ /**
+ * Partitioner for the global active cell indices.
+ */
+ std::shared_ptr<const Utilities::MPI::Partitioner>
+ active_cell_index_partitioner;
+
+ /**
+ * Partitioner for the global level cell indices for each level.
+ */
+ std::vector<std::shared_ptr<const Utilities::MPI::Partitioner>>
+ level_cell_index_partitioners;
+
/**
* Constructor. Set values to zero by default.
*/
virtual MPI_Comm
get_communicator() const;
+ /**
+ * Return the partitioner for the global indices of the cells on the active
+ * level of the triangulation, which is returned by the function
+ * CellAccessor::global_active_cell_index().
+ */
+ virtual const std::weak_ptr<const Utilities::MPI::Partitioner>
+ global_active_cell_index_partitioner() const;
+
+ /**
+ * Return the partitioner for the global indices of the cells on the given @p
+ * level of the triangulation, which is returned by the function
+ * CellAccessor::global_level_cell_index().
+ */
+ virtual const std::weak_ptr<const Utilities::MPI::Partitioner>
+ global_level_cell_index_partitioner(const unsigned int level) const;
+
/**
* Set the mesh smoothing to @p mesh_smoothing. This overrides the
* MeshSmoothing given to the constructor. It is allowed to call this
*/
template <int dim, int spacedim>
static void
- compute_number_cache(
+ compute_number_cache_dim(
const Triangulation<dim, spacedim> & triangulation,
const unsigned int level_objects,
internal::TriangulationImplementation::NumberCache<1> &number_cache)
*/
template <int dim, int spacedim>
static void
- compute_number_cache(
+ compute_number_cache_dim(
const Triangulation<dim, spacedim> & triangulation,
const unsigned int level_objects,
internal::TriangulationImplementation::NumberCache<2> &number_cache)
void (*)(const Triangulation<dim, spacedim> &,
const unsigned int,
internal::TriangulationImplementation::NumberCache<1> &)>(
- &compute_number_cache<dim, spacedim>),
+ &compute_number_cache_dim<dim, spacedim>),
triangulation,
level_objects,
static_cast<internal::TriangulationImplementation::NumberCache<1> &>(
*/
template <int dim, int spacedim>
static void
- compute_number_cache(
+ compute_number_cache_dim(
const Triangulation<dim, spacedim> & triangulation,
const unsigned int level_objects,
internal::TriangulationImplementation::NumberCache<3> &number_cache)
void (*)(const Triangulation<dim, spacedim> &,
const unsigned int,
internal::TriangulationImplementation::NumberCache<2> &)>(
- &compute_number_cache<dim, spacedim>),
+ &compute_number_cache_dim<dim, spacedim>),
triangulation,
level_objects,
static_cast<internal::TriangulationImplementation::NumberCache<2> &>(
}
+ template <int dim, int spacedim>
+ static void
+ compute_number_cache(
+ const Triangulation<dim, spacedim> & triangulation,
+ const unsigned int level_objects,
+ internal::TriangulationImplementation::NumberCache<dim> &number_cache)
+ {
+ compute_number_cache_dim(triangulation, level_objects, number_cache);
+
+ number_cache.active_cell_index_partitioner =
+ std::make_shared<const Utilities::MPI::Partitioner>(
+ triangulation.n_active_cells());
+
+ number_cache.level_cell_index_partitioners.resize(
+ triangulation.n_levels());
+ for (unsigned int level = 0; level < triangulation.n_levels(); ++level)
+ number_cache.level_cell_index_partitioners[level] =
+ std::make_shared<const Utilities::MPI::Partitioner>(
+ triangulation.n_cells(level));
+ }
+
template <int spacedim>
static void
+template <int dim, int spacedim>
+const std::weak_ptr<const Utilities::MPI::Partitioner>
+Triangulation<dim, spacedim>::global_active_cell_index_partitioner() const
+{
+ return number_cache.active_cell_index_partitioner;
+}
+
+
+
+template <int dim, int spacedim>
+const std::weak_ptr<const Utilities::MPI::Partitioner>
+Triangulation<dim, spacedim>::global_level_cell_index_partitioner(
+ const unsigned int level) const
+{
+ AssertIndexRange(level, this->n_levels());
+
+ return number_cache.level_cell_index_partitioners[level];
+}
+
+
+
template <int dim, int spacedim>
void
Triangulation<dim, spacedim>::set_mesh_smoothing(