void DoFHandler<dim, spacedim>::distribute_dofs(
const hp::FECollection<dim, spacedim> &ff)
{
- Assert(
- this->tria != nullptr,
- ExcMessage(
- "You need to set the Triangulation in the DoFHandler using reinit() or "
- "in the constructor before you can distribute DoFs."));
+ Assert(this->tria != nullptr,
+ ExcMessage(
+ "You need to set the Triangulation in the DoFHandler using reinit() "
+ "or in the constructor before you can distribute DoFs."));
Assert(this->tria->n_levels() > 0,
ExcMessage("The Triangulation you are using is empty!"));
+
+ // verify size of provided FE collection
Assert(ff.size() > 0, ExcMessage("The given hp::FECollection is empty!"));
+ Assert((ff.size() <= std::numeric_limits<types::fe_index>::max()) &&
+ (ff.size() != numbers::invalid_fe_index),
+ ExcMessage("The given hp::FECollection contains more finite elements "
+ "than the DoFHandler can cover with active FE indices."));
+ #ifdef DEBUG
+ // make sure that the provided FE collection is large enough to
+ // cover all FE indices presently in use on the mesh
+ if ((hp_cell_active_fe_indices.size() > 0) &&
+ (hp_cell_future_fe_indices.size() > 0))
+ {
+ Assert(hp_capability_enabled, ExcInternalError());
+
+ for (const auto &cell :
+ this->active_cell_iterators() | IteratorFilters::LocallyOwnedCell())
+ {
+ Assert(cell->active_fe_index() < ff.size(),
+ ExcInvalidFEIndex(cell->active_fe_index(), ff.size()));
+ Assert(cell->future_fe_index() < ff.size(),
+ ExcInvalidFEIndex(cell->future_fe_index(), ff.size()));
+ }
+ }
+ #endif
+
//
// register the new finite element collection
//