33 #ifdef DEAL_II_WITH_MPI
38 template <
int dim,
int spacedim>
41 const typename ::Triangulation<dim, spacedim>::MeshSmoothing
43 const bool allow_artificial_cells,
49 , allow_artificial_cells(allow_artificial_cells)
51 const auto partition_settings =
55 (void)partition_settings;
61 ExcMessage(
"Settings must contain exactly one type of the active "
62 "cell partitioning scheme."));
66 ExcMessage(
"construct_multigrid_hierarchy requires "
67 "allow_artificial_cells to be set to true."));
72 template <
int dim,
int spacedim>
81 template <
int dim,
int spacedim>
88 const unsigned int max_active_cells =
93 "A parallel::shared::Triangulation needs to be refined in the same "
94 "way on all processors, but the participating processors don't "
95 "agree on the number of active cells."));
98 auto partition_settings = (partition_zoltan | partition_metis |
99 partition_zorder | partition_custom_signal) &
101 if (partition_settings == partition_auto)
102 # ifdef DEAL_II_TRILINOS_WITH_ZOLTAN
103 partition_settings = partition_zoltan;
104 # elif defined DEAL_II_WITH_METIS
105 partition_settings = partition_metis;
107 partition_settings = partition_zorder;
110 if (partition_settings == partition_zoltan)
112 # ifndef DEAL_II_TRILINOS_WITH_ZOLTAN
115 "Choosing 'partition_zoltan' requires the library "
116 "to be compiled with support for Zoltan! "
117 "Instead, you might use 'partition_auto' to select "
118 "a partitioning algorithm that is supported "
119 "by your current configuration."));
125 else if (partition_settings == partition_metis)
127 # ifndef DEAL_II_WITH_METIS
130 "Choosing 'partition_metis' requires the library "
131 "to be compiled with support for METIS! "
132 "Instead, you might use 'partition_auto' to select "
133 "a partitioning algorithm that is supported "
134 "by your current configuration."));
141 else if (partition_settings == partition_zorder)
145 else if (partition_settings == partition_custom_signal)
157 !(settings & partition_custom_signal))
165 cell = this->begin_active(),
168 if (allow_artificial_cells)
180 active_halo_layer_vector =
183 std::set<typename parallel::shared::Triangulation<dim, spacedim>::
184 active_cell_iterator>
185 active_halo_layer(active_halo_layer_vector.begin(),
186 active_halo_layer_vector.end());
188 for (
unsigned int index = 0; cell != endc; cell++, index++)
191 true_subdomain_ids_of_cells[index] = cell->subdomain_id();
193 if (cell->is_locally_owned() ==
false &&
194 active_halo_layer.find(cell) == active_halo_layer.end())
201 true_level_subdomain_ids_of_cells.resize(this->n_levels());
207 for (
unsigned int lvl = 0; lvl < this->n_levels(); ++lvl)
209 true_level_subdomain_ids_of_cells[lvl].resize(
215 level_halo_layer_vector =
217 *
this, predicate, lvl);
220 level_halo_layer(level_halo_layer_vector.begin(),
221 level_halo_layer_vector.end());
224 cell_iterator cell = this->
begin(lvl),
225 endc = this->
end(lvl);
226 for (
unsigned int index = 0; cell != endc; cell++, index++)
230 true_level_subdomain_ids_of_cells[lvl][index] =
231 cell->level_subdomain_id();
240 if (cell->is_active() &&
241 cell->subdomain_id() !=
246 if (cell->has_children())
248 bool keep_cell =
false;
249 for (
unsigned int c = 0;
250 c < GeometryInfo<dim>::max_children_per_cell;
252 if (cell->child(c)->level_subdomain_id() ==
264 if (!cell->is_locally_owned_on_level() &&
265 level_halo_layer.find(cell) != level_halo_layer.
end())
269 cell->set_level_subdomain_id(
278 for (
unsigned int index = 0; cell != endc; cell++, index++)
279 true_subdomain_ids_of_cells[index] = cell->subdomain_id();
285 unsigned int n_my_cells = 0;
288 cell = this->begin_active(),
290 for (; cell != endc; ++cell)
291 if (cell->is_locally_owned())
294 const unsigned int total_cells =
297 ExcMessage(
"Not all cells are assigned to a processor."));
304 unsigned int n_my_cells = 0;
306 cell = this->
begin(),
308 for (; cell != endc; ++cell)
309 if (cell->is_locally_owned_on_level())
312 const unsigned int total_cells =
315 ExcMessage(
"Not all cells are assigned to a processor."));
322 template <
int dim,
int spacedim>
326 return allow_artificial_cells;
331 template <
int dim,
int spacedim>
332 const std::vector<types::subdomain_id> &
335 return true_subdomain_ids_of_cells;
340 template <
int dim,
int spacedim>
341 const std::vector<types::subdomain_id> &
343 const unsigned int level)
const
345 Assert(
level < true_level_subdomain_ids_of_cells.size(),
347 Assert(true_level_subdomain_ids_of_cells[
level].size() ==
350 return true_level_subdomain_ids_of_cells[
level];
355 template <
int dim,
int spacedim>
361 this->update_number_cache();
366 template <
int dim,
int spacedim>
379 const typename ::Triangulation<dim, spacedim>::DistortedCellList
387 this->update_number_cache();
392 template <
int dim,
int spacedim>
398 (void)construction_data;
405 template <
int dim,
int spacedim>
408 const ::Triangulation<dim, spacedim> &other_tria)
412 const ::parallel::distributed::Triangulation<dim, spacedim> *
>(
413 &other_tria) ==
nullptr),
415 "Cannot use this function on parallel::distributed::Triangulation."));
420 this->update_number_cache();
431 template <
int dim,
int spacedim>
439 template <
int dim,
int spacedim>
446 template <
int dim,
int spacedim>
447 const std::vector<unsigned int> &
451 return true_subdomain_ids_of_cells;
456 template <
int dim,
int spacedim>
457 const std::vector<unsigned int> &
459 const unsigned int)
const
462 return true_level_subdomain_ids_of_cells;
472 #include "shared_tria.inst"