const types::global_dof_index invalid_size_type =
static_cast<types::global_dof_index>(-1);
+ /**
+ * An invalid value for active and future fe indices.
+ */
+ const types::fe_index invalid_fe_index = static_cast<types::fe_index>(-1);
+
/**
* An invalid value for indices of degrees of freedom.
*/
* <code>cell-@>active_fe_index</code> as last argument.
*/
void
- get_dof_indices(std::vector<types::global_dof_index> &dof_indices,
- const unsigned int fe_index =
- DoFHandler<dim, spacedim>::invalid_fe_index) const;
+ get_dof_indices(
+ std::vector<types::global_dof_index> &dof_indices,
+ const unsigned int fe_index = numbers::invalid_fe_index) const;
/**
* Return the global multilevel indices of the degrees of freedom that live
* level this line lives on.
*/
void
- get_mg_dof_indices(const int level,
- std::vector<types::global_dof_index> &dof_indices,
- const unsigned int fe_index =
- DoFHandler<dim, spacedim>::invalid_fe_index) const;
+ get_mg_dof_indices(
+ const int level,
+ std::vector<types::global_dof_index> &dof_indices,
+ const unsigned int fe_index = numbers::invalid_fe_index) const;
/**
* Set the level DoF indices that are returned by get_mg_dof_indices.
*/
void
- set_mg_dof_indices(
- const int level,
- const std::vector<types::global_dof_index> &dof_indices,
- const unsigned int fe_index = DoFHandler<dim, spacedim>::invalid_fe_index);
+ set_mg_dof_indices(const int level,
+ const std::vector<types::global_dof_index> &dof_indices,
+ const unsigned int fe_index = numbers::invalid_fe_index);
/**
* Global DoF index of the <i>i</i> degree associated with the @p vertexth
* this is interpreted as equal to `cell->active_fe_index()`.
*/
types::global_dof_index
- vertex_dof_index(const unsigned int vertex,
- const unsigned int i,
- const unsigned int fe_index =
- DoFHandler<dim, spacedim>::invalid_fe_index) const;
+ vertex_dof_index(
+ const unsigned int vertex,
+ const unsigned int i,
+ const unsigned int fe_index = numbers::invalid_fe_index) const;
/**
* Return the global DoF index of the <code>i</code>th degree of freedom
* see vertex_dof_index().
*/
types::global_dof_index
- mg_vertex_dof_index(const int level,
- const unsigned int vertex,
- const unsigned int i,
- const unsigned int fe_index =
- DoFHandler<dim, spacedim>::invalid_fe_index) const;
+ mg_vertex_dof_index(
+ const int level,
+ const unsigned int vertex,
+ const unsigned int i,
+ const unsigned int fe_index = numbers::invalid_fe_index) const;
/**
* Index of the <i>i</i>th degree of freedom of this object.
*/
types::global_dof_index
dof_index(const unsigned int i,
- const unsigned int fe_index =
- DoFHandler<dim, spacedim>::invalid_fe_index) const;
+ const unsigned int fe_index = numbers::invalid_fe_index) const;
/**
* Return the dof_index on the given level. Also see dof_index.
void
set_dof_index(const unsigned int i,
const types::global_dof_index index,
- const unsigned int fe_index =
- DoFHandler<dim, spacedim>::invalid_fe_index) const;
+ const unsigned int fe_index = numbers::invalid_fe_index) const;
void
set_mg_dof_index(const int level,
const types::global_dof_index index) const;
void
- set_mg_vertex_dof_index(const int level,
- const unsigned int vertex,
- const unsigned int i,
- const types::global_dof_index index,
- const unsigned int fe_index =
- DoFHandler<dim, spacedim>::invalid_fe_index) const;
+ set_mg_vertex_dof_index(
+ const int level,
+ const unsigned int vertex,
+ const unsigned int i,
+ const types::global_dof_index index,
+ const unsigned int fe_index = numbers::invalid_fe_index) const;
// Iterator classes need to be friends because they need to access
// operator== and operator!=.
void
set_dof_index(const unsigned int i,
const types::global_dof_index index,
- const unsigned int fe_index =
- DoFHandler<dim, spacedim>::invalid_fe_index) const;
+ const unsigned int fe_index = numbers::invalid_fe_index) const;
};
{
/**
* Convert an FE index that might contain the right value but also
- * invalid_fe_index to a right value if needed/possible.
+ * numbers::invalid_fe_index to a right value if needed/possible.
*/
template <int structdim, int dim, int spacedim, bool level_dof_access>
unsigned int
// No hp enabled, and the argument is at its default value -> we
// can translate to the default active fe index
Assert(
- (fe_index == DoFHandler<dim, spacedim>::invalid_fe_index) ||
+ (fe_index == numbers::invalid_fe_index) ||
(fe_index == DoFHandler<dim, spacedim>::default_fe_index),
ExcMessage(
"It is not possible to specify a FE index if no hp support is used!"));
// we are on a cell (rather than a face/edge/vertex), then we know
// that there is only one active fe index on this cell and we can
// use that:
- if ((dim == structdim) &&
- (fe_index == DoFHandler<dim, spacedim>::invalid_fe_index))
+ if ((dim == structdim) && (fe_index == numbers::invalid_fe_index))
{
AssertDimension(cell.n_active_fe_indices(), 1);
return cell.nth_active_fe_index(0);
}
- Assert((fe_index != DoFHandler<dim, spacedim>::invalid_fe_index),
+ Assert((fe_index != numbers::invalid_fe_index),
ExcMessage(
"You need to specify a FE index if hp support is used!"));
{
const unsigned int fe_index =
(((this->dof_handler->hp_capability_enabled == false) &&
- (fe_index_ == DoFHandler<dim, spacedim>::invalid_fe_index)) ?
+ (fe_index_ == numbers::invalid_fe_index)) ?
// No hp enabled, and the argument is at its default value -> we
// can translate to the default active fe index
DoFHandler<dim, spacedim>::default_fe_index :
// we are on a cell (rather than a face/edge/vertex), then we know
// that there is only one active fe index on this cell and we can
// use that:
- ((dim == structdim) &&
- (fe_index_ == DoFHandler<dim, spacedim>::invalid_fe_index) ?
+ ((dim == structdim) && (fe_index_ == numbers::invalid_fe_index) ?
this->nth_active_fe_index(0) :
fe_index_));
Assert(static_cast<unsigned int>(accessor.level()) <
accessor.dof_handler->hp_cell_future_fe_indices.size(),
ExcMessage("DoFHandler not initialized"));
+ Assert(i != numbers::invalid_fe_index,
+ ExcMessage("Invalid finite element index."));
accessor.dof_handler
->hp_cell_active_fe_indices[accessor.level()]
Assert(static_cast<unsigned int>(accessor.level()) <
accessor.dof_handler->hp_cell_future_fe_indices.size(),
ExcMessage("DoFHandler not initialized"));
+ Assert(i != numbers::invalid_fe_index,
+ ExcMessage("Invalid finite element index."));
accessor.dof_handler
->hp_cell_future_fe_indices[accessor.level()]
return accessor.dof_handler
->hp_cell_future_fe_indices[accessor.level()]
[accessor.present_index] !=
- DoFHandler<dim, spacedim>::invalid_active_fe_index;
+ numbers::invalid_fe_index;
}
accessor.dof_handler
->hp_cell_future_fe_indices[accessor.level()]
[accessor.present_index] =
- DoFHandler<dim, spacedim>::invalid_active_fe_index;
+ numbers::invalid_fe_index;
}
};
} // namespace DoFCellAccessorImplementation
/**
* Invalid index of the finite element to be used on a given cell.
+ *
+ * @deprecated Use numbers::invalid_fe_index instead.
*/
- static const unsigned int invalid_fe_index = numbers::invalid_unsigned_int;
+ static const unsigned int invalid_fe_index DEAL_II_DEPRECATED =
+ numbers::invalid_fe_index;
/**
* The type in which we store the active FE index.
/**
* Invalid active FE index which will be used as a default value to determine
* whether a future FE index has been set or not.
+ *
+ * @deprecated Use numbers::invalid_fe_index instead.
*/
- static const types::fe_index invalid_active_fe_index =
- static_cast<types::fe_index>(-1);
+ static const types::fe_index invalid_active_fe_index DEAL_II_DEPRECATED =
+ numbers::invalid_fe_index;
/**
* Standard constructor, not initializing any data. After constructing an
/**
* Go through the triangulation and return a vector of active FE indices of
- * all locally relevant cells.
+ * all locally relevant cells. Artificial cells will have the value
+ * numbers::invalid_fe_index assigned.
*/
std::vector<unsigned int>
get_active_fe_indices() const;
/**
* Go through the triangulation and set the future FE indices of all
* locally owned cells to the values given in @p future_fe_indices.
- * Cells corresponding to invalid_active_fe_index will be skipped.
+ * Cells corresponding to numbers::invalid_fe_index will be skipped.
*/
void
set_future_fe_indices(const std::vector<unsigned int> &future_fe_indices);
/**
* Go through the triangulation and return a vector of future FE indices of
* all locally owned cells. If no future FE index has been set on a cell,
- * its value will be invalid_active_fe_index.
+ * its value will be numbers::invalid_fe_index.
*/
std::vector<unsigned int>
get_future_fe_indices() const;
{
const unsigned int fe_index =
(this->dof_handler->hp_capability_enabled == false &&
- fe_index_ == DoFHandler<dim, spacedim>::invalid_fe_index) ?
+ fe_index_ == numbers::invalid_fe_index) ?
DoFHandler<dim, spacedim>::default_fe_index :
fe_index_;
// active cells, you either don't specify an fe_index,
// or that you specify the correct one
(fe_index == this->active_fe_index()) ||
- (fe_index == DoFHandler<dim, spacedim>::invalid_fe_index))
+ (fe_index == numbers::invalid_fe_index))
this->get_dof_values(values, interpolated_values);
else
{
// space to this cell's (unknown) FE space unless an explicit
// fe_index is given
Assert((this->dof_handler->hp_capability_enabled == false) ||
- (fe_index != DoFHandler<dim, spacedim>::invalid_fe_index),
+ (fe_index != numbers::invalid_fe_index),
ExcMessage(
"You cannot call this function on non-active cells "
"of DoFHandler objects unless you provide an explicit "
{
const unsigned int fe_index =
(cell.get_dof_handler().has_hp_capabilities() == false &&
- fe_index_ == DoFHandler<dim, spacedim>::invalid_fe_index) ?
+ fe_index_ == numbers::invalid_fe_index) ?
DoFHandler<dim, spacedim>::default_fe_index :
fe_index_;
// active cells, you either don't specify an fe_index,
// or that you specify the correct one
(fe_index == cell.active_fe_index()) ||
- (fe_index == DoFHandler<dim, spacedim>::invalid_fe_index))
+ (fe_index == numbers::invalid_fe_index))
// simply set the values on this cell
processor(cell, local_values, values);
else
// otherwise distribute them to the children
{
Assert((cell.get_dof_handler().has_hp_capabilities() == false) ||
- (fe_index != DoFHandler<dim, spacedim>::invalid_fe_index),
+ (fe_index != numbers::invalid_fe_index),
ExcMessage(
"You cannot call this function on non-active cells "
"of DoFHandler objects unless you provide an explicit "
const unsigned int DoFHandler<dim, spacedim>::default_fe_index;
-template <int dim, int spacedim>
-const types::fe_index DoFHandler<dim, spacedim>::invalid_active_fe_index;
-
-
namespace internal
{
template <int dim, int spacedim>
DoFHandler<dim, spacedim>::get_active_fe_indices() const
{
std::vector<unsigned int> active_fe_indices(
- this->get_triangulation().n_active_cells(), invalid_active_fe_index);
+ this->get_triangulation().n_active_cells(), numbers::invalid_fe_index);
// we could try to extract the values directly, since they are
// stored as protected data of this object, but for simplicity we
// tests which we would have to duplicate ourselves otherwise
for (const auto &cell : this->active_cell_iterators())
if (cell->is_locally_owned() &&
- future_fe_indices[cell->active_cell_index()] != invalid_active_fe_index)
+ future_fe_indices[cell->active_cell_index()] !=
+ numbers::invalid_fe_index)
cell->set_future_fe_index(future_fe_indices[cell->active_cell_index()]);
}
DoFHandler<dim, spacedim>::get_future_fe_indices() const
{
std::vector<unsigned int> future_fe_indices(
- this->get_triangulation().n_active_cells(), invalid_active_fe_index);
+ this->get_triangulation().n_active_cells(), numbers::invalid_fe_index);
// we could try to extract the values directly, since they are
// stored as protected data of this object, but for simplicity we
this->hp_cell_active_fe_indices[level].resize(
this->tria->n_raw_cells(level), 0);
this->hp_cell_future_fe_indices[level].resize(
- this->tria->n_raw_cells(level), invalid_active_fe_index);
+ this->tria->n_raw_cells(level), numbers::invalid_fe_index);
}
else
{
// We have used future FE indices to update all active FE indices
// before refinement happened, thus we are safe to clear them now.
this->hp_cell_future_fe_indices[i].assign(this->tria->n_raw_cells(i),
- invalid_active_fe_index);
+ numbers::invalid_fe_index);
}
}
ExcMessage("All elements inside a collection need to have the "
"same number of vector components!"));
+ Assert(this->size() <= std::numeric_limits<types::fe_index>::max() &&
+ this->size() != numbers::invalid_fe_index,
+ ExcMessage(
+ "You reached the maximum possible number of finite elements."));
+
Collection<FiniteElement<dim, spacedim>>::push_back(new_fe.clone());
}