This required a number of adjustments in places where we used the fact that we used covariant
return types all over the place. We can't do this any more, and so in a number of places
we have to convert things by hand back to the (known) derived type.
* the returned object, knowing its real (derived) type.
*/
virtual
- InternalDataBase *
+ std::unique_ptr<InternalDataBase>
get_data (const UpdateFlags update_flags,
const Quadrature<dim> &quadrature) const = 0;
* the returned object, knowing its real (derived) type.
*/
virtual
- InternalDataBase *
+ std::unique_ptr<InternalDataBase>
get_face_data (const UpdateFlags update_flags,
const Quadrature<dim-1> &quadrature) const = 0;
* the returned object, knowing its real (derived) type.
*/
virtual
- InternalDataBase *
+ std::unique_ptr<InternalDataBase>
get_subface_data (const UpdateFlags update_flags,
const Quadrature<dim-1> &quadrature) const = 0;
// documentation can be found in Mapping::get_data()
virtual
- typename Mapping<dim, spacedim>::InternalDataBase *
+ std::unique_ptr<typename Mapping<dim,spacedim>::InternalDataBase>
get_data (const UpdateFlags,
const Quadrature<dim> &quadrature) const override;
// documentation can be found in Mapping::get_face_data()
virtual
- typename Mapping<dim, spacedim>::InternalDataBase *
+ std::unique_ptr<typename Mapping<dim,spacedim>::InternalDataBase>
get_face_data (const UpdateFlags flags,
const Quadrature<dim-1>& quadrature) const override;
// documentation can be found in Mapping::get_subface_data()
virtual
- typename Mapping<dim, spacedim>::InternalDataBase *
+ std::unique_ptr<typename Mapping<dim,spacedim>::InternalDataBase>
get_subface_data (const UpdateFlags flags,
const Quadrature<dim-1>& quadrature) const override;
// documentation can be found in Mapping::get_data()
virtual
- InternalData *
+ std::unique_ptr<typename Mapping<dim,spacedim>::InternalDataBase>
get_data (const UpdateFlags,
const Quadrature<dim> &quadrature) const override;
// documentation can be found in Mapping::get_face_data()
virtual
- typename Mapping<dim,spacedim>::InternalDataBase *
+ std::unique_ptr<typename Mapping<dim,spacedim>::InternalDataBase>
get_face_data (const UpdateFlags flags,
const Quadrature<dim-1>& quadrature) const override;
// documentation can be found in Mapping::get_subface_data()
virtual
- typename Mapping<dim,spacedim>::InternalDataBase *
+ std::unique_ptr<typename Mapping<dim,spacedim>::InternalDataBase>
get_subface_data (const UpdateFlags flags,
const Quadrature<dim-1>& quadrature) const override;
// documentation can be found in Mapping::get_data()
virtual
- InternalData *
+ std::unique_ptr<typename Mapping<dim,spacedim>::InternalDataBase>
get_data (const UpdateFlags,
const Quadrature<dim> &quadrature) const override;
// documentation can be found in Mapping::get_face_data()
virtual
- InternalData *
+ std::unique_ptr<typename Mapping<dim,spacedim>::InternalDataBase>
get_face_data (const UpdateFlags flags,
const Quadrature<dim-1>& quadrature) const override;
// documentation can be found in Mapping::get_subface_data()
virtual
- InternalData *
+ std::unique_ptr<typename Mapping<dim,spacedim>::InternalDataBase>
get_subface_data (const UpdateFlags flags,
const Quadrature<dim-1>& quadrature) const override;
// documentation can be found in Mapping::get_data()
virtual
- InternalData *
+ std::unique_ptr<typename Mapping<dim,spacedim>::InternalDataBase>
get_data (const UpdateFlags,
const Quadrature<dim> &quadrature) const override;
// documentation can be found in Mapping::get_face_data()
virtual
- InternalData *
+ std::unique_ptr<typename Mapping<dim,spacedim>::InternalDataBase>
get_face_data (const UpdateFlags flags,
const Quadrature<dim-1>& quadrature) const override;
// documentation can be found in Mapping::get_subface_data()
virtual
- InternalData *
+ std::unique_ptr<typename Mapping<dim,spacedim>::InternalDataBase>
get_subface_data (const UpdateFlags flags,
const Quadrature<dim-1>& quadrature) const override;
// documentation can be found in Mapping::get_data()
virtual
- InternalData *
+ std::unique_ptr<typename Mapping<dim,spacedim>::InternalDataBase>
get_data (const UpdateFlags,
const Quadrature<dim> &quadrature) const override;
// documentation can be found in Mapping::get_face_data()
virtual
- InternalData *
+ std::unique_ptr<typename Mapping<dim,spacedim>::InternalDataBase>
get_face_data (const UpdateFlags flags,
const Quadrature<dim-1>& quadrature) const override;
// documentation can be found in Mapping::get_subface_data()
virtual
- InternalData *
+ std::unique_ptr<typename Mapping<dim,spacedim>::InternalDataBase>
get_subface_data (const UpdateFlags flags,
const Quadrature<dim-1>& quadrature) const override;
*this->mapping,
quadrature,
this->finite_element_output);
- Threads::Task<typename Mapping<dim,spacedim>::InternalDataBase * >
- mapping_get_data;
+ Threads::Task<std::unique_ptr<typename Mapping<dim,spacedim>::InternalDataBase>>
+ mapping_get_data;
if (flags & update_mapping)
mapping_get_data = Threads::new_task (&Mapping<dim,spacedim>::get_data,
*this->mapping,
// then collect answers from the two task above
this->fe_data = std::move(fe_get_data.return_value());
if (flags & update_mapping)
- this->mapping_data.reset (mapping_get_data.return_value());
+ this->mapping_data = std::move(mapping_get_data.return_value());
else
this->mapping_data = std_cxx14::make_unique<typename Mapping<dim,spacedim>::InternalDataBase> ();
}
*this->mapping,
this->quadrature,
this->finite_element_output);
- Threads::Task<typename Mapping<dim,spacedim>::InternalDataBase *>
- mapping_get_data;
+ Threads::Task<std::unique_ptr<typename Mapping<dim,spacedim>::InternalDataBase>>
+ mapping_get_data;
if (flags & update_mapping)
mapping_get_data = Threads::new_task (&Mapping<dim,spacedim>::get_face_data,
*this->mapping,
// then collect answers from the two task above
this->fe_data = std::move(fe_get_data.return_value());
if (flags & update_mapping)
- this->mapping_data.reset (mapping_get_data.return_value());
+ this->mapping_data = std::move(mapping_get_data.return_value());
else
this->mapping_data = std_cxx14::make_unique<typename Mapping<dim,spacedim>::InternalDataBase> ();
}
*this->mapping,
this->quadrature,
this->finite_element_output);
- Threads::Task<typename Mapping<dim,spacedim>::InternalDataBase *>
- mapping_get_data;
+ Threads::Task<std::unique_ptr<typename Mapping<dim,spacedim>::InternalDataBase>>
+ mapping_get_data;
if (flags & update_mapping)
mapping_get_data = Threads::new_task (&Mapping<dim,spacedim>::get_subface_data,
*this->mapping,
// then collect answers from the two task above
this->fe_data = std::move(fe_get_data.return_value());
if (flags & update_mapping)
- this->mapping_data.reset (mapping_get_data.return_value());
+ this->mapping_data = std::move(mapping_get_data.return_value());
else
this->mapping_data = std_cxx14::make_unique<typename Mapping<dim,spacedim>::InternalDataBase> ();
}
template <int dim, int spacedim>
-typename Mapping<dim, spacedim>::InternalDataBase *
+std::unique_ptr<typename Mapping<dim, spacedim>::InternalDataBase>
MappingCartesian<dim, spacedim>::get_data (const UpdateFlags update_flags,
const Quadrature<dim> &q) const
{
- InternalData *data = new InternalData (q);
+ auto data = std_cxx14::make_unique<InternalData> (q);
// store the flags in the internal data object so we can access them
// in fill_fe_*_values(). use the transitive hull of the required
// flags
data->update_each = requires_update_flags(update_flags);
- return data;
+ return std::move(data);
}
template <int dim, int spacedim>
-typename Mapping<dim, spacedim>::InternalDataBase *
+std::unique_ptr<typename Mapping<dim, spacedim>::InternalDataBase>
MappingCartesian<dim, spacedim>::get_face_data (const UpdateFlags update_flags,
const Quadrature<dim-1>& quadrature) const
{
- InternalData *data
- = new InternalData (QProjector<dim>::project_to_all_faces(quadrature));
+ auto data = std_cxx14::make_unique<InternalData> (QProjector<dim>::project_to_all_faces(quadrature));
// verify that we have computed the transitive hull of the required
// flags and that FEValues has faithfully passed them on to us
// in fill_fe_*_values()
data->update_each = update_flags;
- return data;
+ return std::move(data);
}
template <int dim, int spacedim>
-typename Mapping<dim, spacedim>::InternalDataBase *
+std::unique_ptr<typename Mapping<dim, spacedim>::InternalDataBase>
MappingCartesian<dim, spacedim>::get_subface_data (const UpdateFlags update_flags,
const Quadrature<dim-1> &quadrature) const
{
- InternalData *data
- = new InternalData (QProjector<dim>::project_to_all_subfaces(quadrature));
+ auto data = std_cxx14::make_unique<InternalData> (QProjector<dim>::project_to_all_subfaces(quadrature));
// verify that we have computed the transitive hull of the required
// flags and that FEValues has faithfully passed them on to us
// in fill_fe_*_values()
data->update_each = update_flags;
- return data;
+ return std::move(data);
}
template <int dim, int spacedim, typename VectorType, typename DoFHandlerType>
typename
-MappingFEField<dim,spacedim,VectorType,DoFHandlerType>::InternalData *
+std::unique_ptr<typename Mapping<dim,spacedim>::InternalDataBase>
MappingFEField<dim,spacedim,VectorType,DoFHandlerType>::get_data (const UpdateFlags update_flags,
const Quadrature<dim> &quadrature) const
{
- InternalData *data = new InternalData(euler_dof_handler->get_fe(), fe_mask);
+ auto data = std_cxx14::make_unique<InternalData>(euler_dof_handler->get_fe(), fe_mask);
this->compute_data (update_flags, quadrature,
quadrature.size(), *data);
- return data;
+ return std::move(data);
}
template <int dim, int spacedim, typename VectorType, typename DoFHandlerType>
-typename Mapping<dim,spacedim>::InternalDataBase *
+std::unique_ptr<typename Mapping<dim,spacedim>::InternalDataBase>
MappingFEField<dim,spacedim,VectorType,DoFHandlerType>::get_face_data
(const UpdateFlags update_flags,
const Quadrature<dim-1> &quadrature) const
{
- InternalData *data = new InternalData(euler_dof_handler->get_fe(), fe_mask);
+ auto data = std_cxx14::make_unique<InternalData>(euler_dof_handler->get_fe(), fe_mask);
const Quadrature<dim> q (QProjector<dim>::project_to_all_faces(quadrature));
this->compute_face_data (update_flags, q,
quadrature.size(), *data);
- return data;
+ return std::move(data);
}
template <int dim, int spacedim, typename VectorType, typename DoFHandlerType>
-typename Mapping<dim,spacedim>::InternalDataBase *
+std::unique_ptr<typename Mapping<dim,spacedim>::InternalDataBase>
MappingFEField<dim,spacedim,VectorType,DoFHandlerType>::get_subface_data
(const UpdateFlags update_flags,
const Quadrature<dim-1> &quadrature) const
{
- InternalData *data = new InternalData(euler_dof_handler->get_fe(), fe_mask);
+ auto data = std_cxx14::make_unique<InternalData>(euler_dof_handler->get_fe(), fe_mask);
const Quadrature<dim> q (QProjector<dim>::project_to_all_subfaces(quadrature));
this->compute_face_data (update_flags, q,
quadrature.size(), *data);
- return data;
+ return std::move(data);
}
// the right size and transformation shape values already computed at point
// p.
const Quadrature<dim> point_quadrature(p);
- std::unique_ptr<InternalData> mdata (get_data(update_quadrature_points | update_jacobians,
- point_quadrature));
+ std::unique_ptr<typename Mapping<dim,spacedim>::InternalDataBase>
+ mdata (get_data(update_quadrature_points | update_jacobians,
+ point_quadrature));
+ Assert (dynamic_cast<InternalData *>(mdata.get()) != nullptr,
+ ExcInternalError());
- update_internal_dofs(cell, *mdata);
+ update_internal_dofs(cell,
+ dynamic_cast<InternalData &>(*mdata));
- return do_transform_unit_to_real_cell(*mdata);
+ return do_transform_unit_to_real_cell(dynamic_cast<InternalData &>(*mdata));
}
UpdateFlags update_flags = update_quadrature_points | update_jacobians;
if (spacedim>dim)
update_flags |= update_jacobian_grads;
- std::unique_ptr<InternalData>
+ std::unique_ptr<typename Mapping<dim,spacedim>::InternalDataBase>
mdata (get_data(update_flags,point_quadrature));
+ Assert (dynamic_cast<InternalData *>(mdata.get()) != nullptr,
+ ExcInternalError());
- update_internal_dofs(cell, *mdata);
+ update_internal_dofs(cell, dynamic_cast<InternalData &>(*mdata));
- return do_transform_real_to_unit_cell(cell, p, initial_p_unit, *mdata);
+ return do_transform_real_to_unit_cell(cell, p, initial_p_unit,
+ dynamic_cast<InternalData &>(*mdata));
}
template <int dim, int spacedim>
-typename MappingManifold<dim,spacedim>::InternalData *
+std::unique_ptr<typename Mapping<dim,spacedim>::InternalDataBase>
MappingManifold<dim,spacedim>::get_data (const UpdateFlags update_flags,
const Quadrature<dim> &q) const
{
- InternalData *data = new InternalData();
+ auto data = std_cxx14::make_unique<InternalData>();
data->initialize (this->requires_update_flags(update_flags), q, q.size());
- return data;
+ return std::move(data);
}
template <int dim, int spacedim>
-typename MappingManifold<dim,spacedim>::InternalData *
+std::unique_ptr<typename Mapping<dim,spacedim>::InternalDataBase>
MappingManifold<dim,spacedim>::get_face_data (const UpdateFlags update_flags,
const Quadrature<dim-1> &quadrature) const
{
- InternalData *data = new InternalData();
+ auto data = std_cxx14::make_unique<InternalData>();
data->initialize_face (this->requires_update_flags(update_flags),
QProjector<dim>::project_to_all_faces(quadrature),
quadrature.size());
- return data;
+ return std::move(data);
}
template <int dim, int spacedim>
-typename MappingManifold<dim,spacedim>::InternalData *
+std::unique_ptr<typename Mapping<dim,spacedim>::InternalDataBase>
MappingManifold<dim,spacedim>::get_subface_data (const UpdateFlags update_flags,
const Quadrature<dim-1>& quadrature) const
{
- InternalData *data = new InternalData();
+ auto data = std_cxx14::make_unique<InternalData>();
data->initialize_face (this->requires_update_flags(update_flags),
QProjector<dim>::project_to_all_subfaces(quadrature),
quadrature.size());
- return data;
+ return std::move(data);
}
template <int dim, int spacedim>
-typename MappingQ<dim,spacedim>::InternalData *
+std::unique_ptr<typename Mapping<dim,spacedim>::InternalDataBase>
MappingQ<dim,spacedim>::get_data (const UpdateFlags update_flags,
const Quadrature<dim> &quadrature) const
{
- InternalData *data = new InternalData;
+ auto data = std_cxx14::make_unique<InternalData>();
// build the Q1 and Qp internal data objects in parallel
- Threads::Task<typename MappingQGeneric<dim,spacedim>::InternalData *>
- do_get_data = Threads::new_task (&MappingQGeneric<dim,spacedim>::get_data,
- *qp_mapping,
- update_flags,
- quadrature);
+ Threads::Task<std::unique_ptr<typename Mapping<dim,spacedim>::InternalDataBase>>
+ do_get_data = Threads::new_task (&MappingQGeneric<dim,spacedim>::get_data,
+ *qp_mapping,
+ update_flags,
+ quadrature);
if (!use_mapping_q_on_all_cells)
- data->mapping_q1_data.reset (q1_mapping->get_data (update_flags, quadrature));
+ data->mapping_q1_data.reset (dynamic_cast<typename MappingQGeneric<dim,spacedim>::InternalData *>
+ (q1_mapping->get_data (update_flags, quadrature).release()));
// wait for the task above to finish and use returned value
- data->mapping_qp_data.reset (do_get_data.return_value());
- return data;
+ data->mapping_qp_data.reset (dynamic_cast<typename MappingQGeneric<dim,spacedim>::InternalData *>
+ (do_get_data.return_value().release()));
+ return std::move(data);
}
template <int dim, int spacedim>
-typename MappingQ<dim,spacedim>::InternalData *
+std::unique_ptr<typename Mapping<dim,spacedim>::InternalDataBase>
MappingQ<dim,spacedim>::get_face_data (const UpdateFlags update_flags,
const Quadrature<dim-1>& quadrature) const
{
- InternalData *data = new InternalData;
+ auto data = std_cxx14::make_unique<InternalData>();
// build the Q1 and Qp internal data objects in parallel
- Threads::Task<typename MappingQGeneric<dim,spacedim>::InternalData *>
- do_get_data = Threads::new_task (&MappingQGeneric<dim,spacedim>::get_face_data,
- *qp_mapping,
- update_flags,
- quadrature);
+ Threads::Task<std::unique_ptr<typename Mapping<dim,spacedim>::InternalDataBase>>
+ do_get_data = Threads::new_task (&MappingQGeneric<dim,spacedim>::get_face_data,
+ *qp_mapping,
+ update_flags,
+ quadrature);
if (!use_mapping_q_on_all_cells)
- data->mapping_q1_data.reset (q1_mapping->get_face_data (update_flags, quadrature));
+ data->mapping_q1_data.reset (dynamic_cast<typename MappingQGeneric<dim,spacedim>::InternalData *>
+ (q1_mapping->get_face_data (update_flags, quadrature).release()));
// wait for the task above to finish and use returned value
- data->mapping_qp_data.reset (do_get_data.return_value());
- return data;
+ data->mapping_qp_data.reset (dynamic_cast<typename MappingQGeneric<dim,spacedim>::InternalData *>
+ (do_get_data.return_value().release()));
+ return std::move(data);
}
template <int dim, int spacedim>
-typename MappingQ<dim,spacedim>::InternalData *
+std::unique_ptr<typename Mapping<dim,spacedim>::InternalDataBase>
MappingQ<dim,spacedim>::get_subface_data (const UpdateFlags update_flags,
const Quadrature<dim-1>& quadrature) const
{
- InternalData *data = new InternalData;
+ auto data = std_cxx14::make_unique<InternalData>();
// build the Q1 and Qp internal data objects in parallel
- Threads::Task<typename MappingQGeneric<dim,spacedim>::InternalData *>
- do_get_data = Threads::new_task (&MappingQGeneric<dim,spacedim>::get_subface_data,
- *qp_mapping,
- update_flags,
- quadrature);
+ Threads::Task<std::unique_ptr<typename Mapping<dim,spacedim>::InternalDataBase>>
+ do_get_data = Threads::new_task (&MappingQGeneric<dim,spacedim>::get_subface_data,
+ *qp_mapping,
+ update_flags,
+ quadrature);
if (!use_mapping_q_on_all_cells)
- data->mapping_q1_data.reset (q1_mapping->get_subface_data (update_flags, quadrature));
+ data->mapping_q1_data.reset (dynamic_cast<typename MappingQGeneric<dim,spacedim>::InternalData *>
+ (q1_mapping->get_subface_data (update_flags, quadrature).release()));
// wait for the task above to finish and use returned value
- data->mapping_qp_data.reset (do_get_data.return_value());
- return data;
+ data->mapping_qp_data.reset (dynamic_cast<typename MappingQGeneric<dim,spacedim>::InternalData *>
+ (do_get_data.return_value().release()));
+ return std::move(data);
}
UpdateFlags update_flags = update_quadrature_points | update_jacobians;
if (spacedim>dim)
update_flags |= update_jacobian_grads;
- std::unique_ptr<InternalData> mdata (get_data(update_flags,
- point_quadrature));
+ std::unique_ptr<InternalData> mdata (dynamic_cast<InternalData *>(get_data(update_flags,
+ point_quadrature).release()));
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 (get_data(update_flags,
- point_quadrature));
+ std::unique_ptr<InternalData> mdata (dynamic_cast<InternalData *>(get_data(update_flags,
+ point_quadrature).release()));
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 (get_data(update_flags,
- point_quadrature));
+ std::unique_ptr<InternalData> mdata (dynamic_cast<InternalData *>(get_data(update_flags,
+ point_quadrature).release()));
mdata->mapping_support_points = this->compute_mapping_support_points (cell);
return internal::MappingQGenericImplementation::do_transform_real_to_unit_cell_internal<3>(cell, p, initial_p_unit, *mdata);
}
+
+
template <>
Point<1>
MappingQGeneric<1, 2>::
UpdateFlags update_flags = update_quadrature_points | update_jacobians;
if (spacedim>dim)
update_flags |= update_jacobian_grads;
- std::unique_ptr<InternalData> mdata (get_data(update_flags,
- point_quadrature));
+ std::unique_ptr<InternalData> mdata (dynamic_cast<InternalData *>(get_data(update_flags,
+ point_quadrature).release()));
mdata->mapping_support_points = this->compute_mapping_support_points (cell);
return internal::MappingQGenericImplementation::do_transform_real_to_unit_cell_internal_codim1<1>(cell, p, initial_p_unit, *mdata);
}
+
+
template <>
Point<2>
MappingQGeneric<2, 3>::
UpdateFlags update_flags = update_quadrature_points | update_jacobians;
if (spacedim>dim)
update_flags |= update_jacobian_grads;
- std::unique_ptr<InternalData> mdata (get_data(update_flags,
- point_quadrature));
+ std::unique_ptr<InternalData> mdata (dynamic_cast<InternalData *>(get_data(update_flags,
+ point_quadrature).release()));
mdata->mapping_support_points = this->compute_mapping_support_points (cell);
template <int dim, int spacedim>
-typename MappingQGeneric<dim,spacedim>::InternalData *
+std::unique_ptr<typename Mapping<dim,spacedim>::InternalDataBase>
MappingQGeneric<dim,spacedim>::get_data (const UpdateFlags update_flags,
const Quadrature<dim> &q) const
{
- InternalData *data = new InternalData(polynomial_degree);
+ auto data = std_cxx14::make_unique<InternalData>(polynomial_degree);
data->initialize (this->requires_update_flags(update_flags), q, q.size());
- return data;
+ return std::move(data);
}
template <int dim, int spacedim>
-typename MappingQGeneric<dim,spacedim>::InternalData *
+std::unique_ptr<typename Mapping<dim,spacedim>::InternalDataBase>
MappingQGeneric<dim,spacedim>::get_face_data (const UpdateFlags update_flags,
const Quadrature<dim-1> &quadrature) const
{
- InternalData *data = new InternalData(polynomial_degree);
+ auto data = std_cxx14::make_unique<InternalData>(polynomial_degree);
data->initialize_face (this->requires_update_flags(update_flags),
QProjector<dim>::project_to_all_faces(quadrature),
quadrature.size());
- return data;
+ return std::move(data);
}
template <int dim, int spacedim>
-typename MappingQGeneric<dim,spacedim>::InternalData *
+std::unique_ptr<typename Mapping<dim,spacedim>::InternalDataBase>
MappingQGeneric<dim,spacedim>::get_subface_data (const UpdateFlags update_flags,
const Quadrature<dim-1>& quadrature) const
{
- InternalData *data = new InternalData(polynomial_degree);
+ auto data = std_cxx14::make_unique<InternalData>(polynomial_degree);
data->initialize_face (this->requires_update_flags(update_flags),
QProjector<dim>::project_to_all_subfaces(quadrature),
quadrature.size());
- return data;
+ return std::move(data);
}