* ownership), we store the cast result in a std::unique_ptr to indicate
* that InternalData owns the object.
*/
- InternalData ( std::unique_ptr<typename FESystem<dim,spacedim>::InternalData> fesystem_data);
+ InternalData (std::unique_ptr<typename FESystem<dim,spacedim>::InternalData> fesystem_data);
/**
* Give read-access to the pointer to a @p InternalData of the @p
*/
template <int dim_1>
std::unique_ptr<typename FiniteElement<dim,spacedim>::InternalDataBase>
- setup_data (std::unique_ptr<typename FiniteElement<dim,spacedim>::InternalDataBase> &&fes_data,
+ setup_data (std::unique_ptr<typename FESystem<dim,spacedim>::InternalData> fes_data,
const UpdateFlags flags,
const Quadrature<dim_1> &quadrature) const;
template <int dim, int spacedim>
template <int dim_1>
std::unique_ptr<typename FiniteElement<dim,spacedim>::InternalDataBase>
-FE_Enriched<dim,spacedim>::setup_data (std::unique_ptr<typename FiniteElement<dim,spacedim>::InternalDataBase> &&fes_data,
+FE_Enriched<dim,spacedim>::setup_data (std::unique_ptr<typename FESystem<dim,spacedim>::InternalData> fes_data,
const UpdateFlags flags,
const Quadrature<dim_1> &quadrature) const
{
- Assert ((dynamic_cast<typename FESystem<dim,spacedim>::InternalData *> (fes_data.get()) != nullptr),
- ExcInternalError());
-
// Pass ownership of the FiniteElement::InternalDataBase object
// that fes_data points to, to the new InternalData object.
- typename FESystem<dim,spacedim>::InternalData *data_fesystem =
- static_cast<typename FESystem<dim,spacedim>::InternalData *> (fes_data.release());
- auto data = std_cxx14::make_unique<InternalData>(std::unique_ptr<typename FESystem<dim,spacedim>::InternalData>(data_fesystem));
+ auto update_each_flags = fes_data->update_each;
+ auto data = std_cxx14::make_unique<InternalData>(std::move(fes_data));
// copy update_each from FESystem data:
- data->update_each = data_fesystem->update_each;
+ data->update_each = update_each_flags;
// resize cache array according to requested flags
data->enrichment.resize(this->n_base_elements());
const Quadrature<dim-1> &quadrature,
internal::FEValuesImplementation::FiniteElementRelatedData< dim, spacedim > &output_data) const
{
- return setup_data(std::unique_ptr<typename FiniteElement<dim,spacedim>::InternalDataBase>(fe_system->get_face_data(update_flags,mapping,quadrature,output_data)),
+ auto data = fe_system->get_face_data(update_flags,mapping,quadrature,output_data);
+ return setup_data(Utilities::dynamic_unique_cast<typename FESystem<dim,spacedim>::InternalData>(std::move(data)),
update_flags,
quadrature);
}
const Quadrature<dim-1> &quadrature,
dealii::internal::FEValuesImplementation::FiniteElementRelatedData<dim, spacedim> &output_data) const
{
- return setup_data(std::unique_ptr<typename FiniteElement<dim,spacedim>::InternalDataBase>(fe_system->get_subface_data(update_flags,mapping,quadrature,output_data)),
+ auto data = fe_system->get_subface_data(update_flags,mapping,quadrature,output_data);
+ return setup_data(Utilities::dynamic_unique_cast<typename FESystem<dim,spacedim>::InternalData>(std::move(data)),
update_flags,
quadrature);
}
const Quadrature<dim> &quadrature,
internal::FEValuesImplementation::FiniteElementRelatedData< dim, spacedim > &output_data) const
{
- return setup_data(std::unique_ptr<typename FiniteElement<dim,spacedim>::InternalDataBase>(fe_system->get_data(flags,mapping,quadrature,output_data)),
+ auto data = fe_system->get_data(flags,mapping,quadrature,output_data);
+ return setup_data(Utilities::dynamic_unique_cast<typename FESystem<dim,spacedim>::InternalData>(std::move(data)),
flags,
quadrature);
}
// wait for the task above to finish and use returned value
data->mapping_qp_data = Utilities::dynamic_unique_cast<typename MappingQGeneric<dim,spacedim>::InternalData>
(std::move(do_get_data.return_value()));
-
return std::move(data);
}
MappingQGeneric<1,1>::
transform_real_to_unit_cell_internal
(const Triangulation<1,1>::cell_iterator &cell,
- const Point<1> &p,
- const Point<1> &initial_p_unit) const
+ const Point<1> &p,
+ const Point<1> &initial_p_unit) const
{
const int dim = 1;
const int spacedim = 1;
UpdateFlags update_flags = update_quadrature_points | update_jacobians;
if (spacedim>dim)
update_flags |= update_jacobian_grads;
- std::unique_ptr<InternalData> mdata (dynamic_cast<InternalData *>(get_data(update_flags,
- point_quadrature).release()));
+ auto mdata = Utilities::dynamic_unique_cast<InternalData>(get_data(update_flags,
+ point_quadrature));
mdata->mapping_support_points = this->compute_mapping_support_points (cell);
MappingQGeneric<2, 2>::
transform_real_to_unit_cell_internal
(const Triangulation<2, 2>::cell_iterator &cell,
- const Point<2> &p,
- const Point<2> &initial_p_unit) const
+ const Point<2> &p,
+ const Point<2> &initial_p_unit) const
{
const int dim = 2;
const int spacedim = 2;
UpdateFlags update_flags = update_quadrature_points | update_jacobians;
if (spacedim>dim)
update_flags |= update_jacobian_grads;
- std::unique_ptr<InternalData> mdata (dynamic_cast<InternalData *>(get_data(update_flags,
- point_quadrature).release()));
+ auto mdata = Utilities::dynamic_unique_cast<InternalData>(get_data(update_flags,
+ point_quadrature));
mdata->mapping_support_points = this->compute_mapping_support_points (cell);
UpdateFlags update_flags = update_quadrature_points | update_jacobians;
if (spacedim>dim)
update_flags |= update_jacobian_grads;
- std::unique_ptr<InternalData> mdata (dynamic_cast<InternalData *>(get_data(update_flags,
- point_quadrature).release()));
+ auto mdata = Utilities::dynamic_unique_cast<InternalData>(get_data(update_flags,
+ point_quadrature));
mdata->mapping_support_points = this->compute_mapping_support_points (cell);
UpdateFlags update_flags = update_quadrature_points | update_jacobians;
if (spacedim>dim)
update_flags |= update_jacobian_grads;
- std::unique_ptr<InternalData> mdata (dynamic_cast<InternalData *>(get_data(update_flags,
- point_quadrature).release()));
+ auto mdata = Utilities::dynamic_unique_cast<InternalData>(get_data(update_flags,
+ point_quadrature));
mdata->mapping_support_points = this->compute_mapping_support_points (cell);
UpdateFlags update_flags = update_quadrature_points | update_jacobians;
if (spacedim>dim)
update_flags |= update_jacobian_grads;
- std::unique_ptr<InternalData> mdata (dynamic_cast<InternalData *>(get_data(update_flags,
- point_quadrature).release()));
+ auto mdata = Utilities::dynamic_unique_cast<InternalData>(get_data(update_flags,
+ point_quadrature));
mdata->mapping_support_points = this->compute_mapping_support_points (cell);