#include <algorithm>
#include <memory>
+#include <optional>
#include <type_traits>
DEAL_II_NAMESPACE_OPEN
Vector<IndexSet::value_type> &out) const;
private:
- bool initialized;
- typename Triangulation<dim, spacedim>::cell_iterator cell;
- const DoFHandler<dim, spacedim> *dof_handler;
- bool level_dof_access;
+ std::optional<typename Triangulation<dim, spacedim>::cell_iterator> cell;
+ const DoFHandler<dim, spacedim> *dof_handler;
+ bool level_dof_access;
};
/**
inline FEValuesBase<dim, spacedim>::CellIteratorContainer::
CellIteratorContainer(
const TriaIterator<DoFCellAccessor<dim, spacedim, lda>> &cell)
- : initialized(true)
- , cell(cell)
+ : cell(cell)
, dof_handler(&cell->get_dof_handler())
, level_dof_access(lda)
{}
template <int dim, int spacedim>
FEValuesBase<dim, spacedim>::CellIteratorContainer::CellIteratorContainer()
- : initialized(false)
- , cell(typename Triangulation<dim, spacedim>::cell_iterator(nullptr, -1, -1))
+ : cell()
, dof_handler(nullptr)
, level_dof_access(false)
{}
template <int dim, int spacedim>
FEValuesBase<dim, spacedim>::CellIteratorContainer::CellIteratorContainer(
const typename Triangulation<dim, spacedim>::cell_iterator &cell)
- : initialized(true)
- , cell(cell)
+ : cell(cell)
, dof_handler(nullptr)
, level_dof_access(false)
{}
bool
FEValuesBase<dim, spacedim>::CellIteratorContainer::is_initialized() const
{
- return initialized;
+ return cell.has_value();
}
{
Assert(is_initialized(), ExcNotReinited());
- return cell;
+ return cell.value();
}
Assert(dof_handler != nullptr, ExcNeedsDoFHandler());
if (level_dof_access)
- DoFCellAccessor<dim, spacedim, true>(&cell->get_triangulation(),
- cell->level(),
- cell->index(),
+ DoFCellAccessor<dim, spacedim, true>(&cell.value()->get_triangulation(),
+ cell.value()->level(),
+ cell.value()->index(),
dof_handler)
.get_interpolated_dof_values(in, out);
else
- DoFCellAccessor<dim, spacedim, false>(&cell->get_triangulation(),
- cell->level(),
- cell->index(),
+ DoFCellAccessor<dim, spacedim, false>(&cell.value()->get_triangulation(),
+ cell.value()->level(),
+ cell.value()->index(),
dof_handler)
.get_interpolated_dof_values(in, out);
}
Assert(level_dof_access == false, ExcNotImplemented());
const DoFCellAccessor<dim, spacedim, false> cell_dofs(
- &cell->get_triangulation(), cell->level(), cell->index(), dof_handler);
+ &cell.value()->get_triangulation(),
+ cell.value()->level(),
+ cell.value()->index(),
+ dof_handler);
std::vector<types::global_dof_index> dof_indices(
cell_dofs.get_fe().n_dofs_per_cell());