*/
void clear_despite_subscriptions ();
+ /**
+ * For all cells, set the active cell indices so that active cells know
+ * the how many-th active cell they are, and all other cells have an invalid
+ * value. This function is called after mesh creation, refinement, and
+ * serialization.
+ */
+ void reset_active_cell_indices ();
+
/**
* Refine all cells on all levels which were previously flagged for
* refinement.
{
for (unsigned int l=0; l<levels.size(); ++l)
levels[l]->active_cell_indices.resize (levels[l]->refine_flags.size());
-
- unsigned int active_cell_index = 0;
- for (cell_iterator cell=begin(); cell!=end(); ++cell)
- if (cell->has_children())
- cell->set_active_cell_index (numbers::invalid_unsigned_int);
- else
- {
- cell->set_active_cell_index (active_cell_index);
- ++active_cell_index;
- }
-
- Assert (active_cell_index == n_active_cells(), ExcInternalError());
+ reset_active_cell_indices ();
}
}
+
template <int dim, int spacedim>
void
Triangulation<dim,spacedim>::
// active_cell_indices of all cells
internal::Triangulation::Implementation
::compute_number_cache (*this, levels.size(), number_cache);
- {
- unsigned int active_cell_index = 0;
- for (cell_iterator cell=begin(); cell!=end(); ++cell)
- if (cell->has_children())
- cell->set_active_cell_index (numbers::invalid_unsigned_int);
- else
- {
- cell->set_active_cell_index (active_cell_index);
- ++active_cell_index;
- }
-
- Assert (active_cell_index == n_active_cells(), ExcInternalError());
- }
+ reset_active_cell_indices ();
// now verify that there are indeed no distorted cells. as per the
// documentation of this class, we first collect all distorted cells
// finally build up neighbor connectivity information, and set
// active cell indices
update_neighbors(*this);
- {
- unsigned int active_cell_index = 0;
- for (cell_iterator cell=begin(); cell!=end(); ++cell)
- if (cell->has_children())
- cell->set_active_cell_index (numbers::invalid_unsigned_int);
- else
- {
- cell->set_active_cell_index (active_cell_index);
- ++active_cell_index;
- }
-
- Assert (active_cell_index == n_active_cells(), ExcInternalError());
- }
+ reset_active_cell_indices ();
// Inform all listeners about end of refinement.
signals.post_refinement();
}
+
+template <int dim, int spacedim>
+void
+Triangulation<dim,spacedim>::reset_active_cell_indices ()
+{
+ unsigned int active_cell_index = 0;
+ for (raw_cell_iterator cell=begin_raw(); cell!=end(); ++cell)
+ if ((cell->used() == false) || cell->has_children())
+ cell->set_active_cell_index (numbers::invalid_unsigned_int);
+ else
+ {
+ cell->set_active_cell_index (active_cell_index);
+ ++active_cell_index;
+ }
+
+ Assert (active_cell_index == n_active_cells(), ExcInternalError());
+}
+
+
+
template<int dim, int spacedim>
void
Triangulation<dim, spacedim>::clear_despite_subscriptions()