* it is no longer necessary.
*/
virtual
- InternalDataBase *
+ std::unique_ptr<InternalDataBase>
get_data (const UpdateFlags update_flags,
const Mapping<dim,spacedim> &mapping,
const Quadrature<dim> &quadrature,
* it is no longer necessary.
*/
virtual
- InternalDataBase *
+ std::unique_ptr<InternalDataBase>
get_face_data (const UpdateFlags update_flags,
const Mapping<dim,spacedim> &mapping,
const Quadrature<dim-1> &quadrature,
* it is no longer necessary.
*/
virtual
- InternalDataBase *
+ std::unique_ptr<InternalDataBase>
get_subface_data (const UpdateFlags update_flags,
const Mapping<dim,spacedim> &mapping,
const Quadrature<dim-1> &quadrature,
* cell.
*/
virtual
- typename FiniteElement<dim,spacedim>::InternalDataBase *
+ std::unique_ptr<typename FiniteElement<dim,spacedim>::InternalDataBase>
get_data (const UpdateFlags update_flags,
const Mapping<dim,spacedim> &mapping,
const Quadrature<dim> &quadrature,
* enrichment functions at each quadrature point depending on @p flags.
*/
template <int dim_1>
- typename FiniteElement<dim,spacedim>::InternalDataBase *
+ std::unique_ptr<typename FiniteElement<dim,spacedim>::InternalDataBase>
setup_data (std::unique_ptr<typename FiniteElement<dim,spacedim>::InternalDataBase> &&fes_data,
const UpdateFlags flags,
const Quadrature<dim_1> &quadrature) const;
* (FEValues) then has to assume ownership (which includes destruction when it is no
* more needed).
*/
- virtual typename FiniteElement<dim,spacedim>::InternalDataBase *
+ virtual std::unique_ptr<typename FiniteElement<dim,spacedim>::InternalDataBase>
get_data (const UpdateFlags flags,
const Mapping<dim,spacedim> &mapping,
const Quadrature<dim> &quadrature,
dealii::internal::FEValuesImplementation::FiniteElementRelatedData< dim, spacedim > &output_data) const;
- virtual typename FiniteElement<dim,spacedim>::InternalDataBase *
+ virtual std::unique_ptr<typename FiniteElement<dim,spacedim>::InternalDataBase>
get_face_data (const UpdateFlags update_flags,
const Mapping<dim,spacedim> &mapping,
const Quadrature<dim-1> &quadrature,
dealii::internal::FEValuesImplementation::FiniteElementRelatedData< dim, spacedim > &output_data) const;
- virtual typename FiniteElement<dim,spacedim>::InternalDataBase *
+ virtual std::unique_ptr<typename FiniteElement<dim,spacedim>::InternalDataBase>
get_subface_data (const UpdateFlags update_flags,
const Mapping<dim,spacedim> &mapping,
const Quadrature<dim-1> &quadrature,
virtual
- typename FiniteElement<1,spacedim>::InternalDataBase *
+ std::unique_ptr<typename FiniteElement<1,spacedim>::InternalDataBase>
get_data (const UpdateFlags /*update_flags*/,
const Mapping<1,spacedim> &/*mapping*/,
const Quadrature<1> &/*quadrature*/,
dealii::internal::FEValuesImplementation::FiniteElementRelatedData<1, spacedim> &/*output_data*/) const
{
- return new typename FiniteElement<1, spacedim>::InternalDataBase;
+ return std_cxx14::make_unique<typename FiniteElement<1, spacedim>::InternalDataBase>();
}
- typename FiniteElement<1,spacedim>::InternalDataBase *
+ std::unique_ptr<typename FiniteElement<1,spacedim>::InternalDataBase>
get_face_data(const UpdateFlags update_flags,
const Mapping<1,spacedim> &/*mapping*/,
const Quadrature<0> &quadrature,
dealii::internal::FEValuesImplementation::FiniteElementRelatedData<1, spacedim> &/*output_data*/) const
{
// generate a new data object and initialize some fields
- typename FiniteElement<1,spacedim>::InternalDataBase *data =
- new typename FiniteElement<1,spacedim>::InternalDataBase;
+ auto data = std_cxx14::make_unique<typename FiniteElement<1,spacedim>::InternalDataBase>();
data->update_each = requires_update_flags(update_flags);
const unsigned int n_q_points = quadrature.size();
Assert(false, ExcNotImplemented());
}
- return data;
+ return std::move(data);
}
- typename FiniteElement<1,spacedim>::InternalDataBase *
+ std::unique_ptr<typename FiniteElement<1,spacedim>::InternalDataBase>
get_subface_data(const UpdateFlags update_flags,
const Mapping<1,spacedim> &mapping,
const Quadrature<0> &quadrature,
* no meaningful data exists for this element.
*/
virtual
- typename FiniteElement<dim,spacedim>::InternalDataBase *
+ std::unique_ptr<typename FiniteElement<dim,spacedim>::InternalDataBase>
get_data (const UpdateFlags update_flags,
const Mapping<dim,spacedim> &mapping,
const Quadrature<dim> &quadrature,
* It returns an empty variable type of @ InternalDataBase and updates @ update_flags,
* and computes trivially zero Hessian for each cell if it is needed.
*/
- virtual FiniteElement<2,2>::InternalDataBase *
+ virtual
+ std::unique_ptr<FiniteElement<2,2>::InternalDataBase>
get_data (const UpdateFlags update_flags,
const Mapping<2,2> &,
const Quadrature<2> &quadrature,
dealii::internal::FEValuesImplementation::FiniteElementRelatedData<2,2> &output_data) const;
- virtual FiniteElement<2,2>::InternalDataBase *
+ virtual
+ std::unique_ptr<FiniteElement<2,2>::InternalDataBase>
get_face_data (const UpdateFlags update_flags,
const Mapping<2,2> &,
const Quadrature<1> &quadrature,
dealii::internal::FEValuesImplementation::FiniteElementRelatedData<2,2> &output_data) const;
- virtual FiniteElement<2,2>::InternalDataBase *
+ virtual
+ std::unique_ptr<FiniteElement<2,2>::InternalDataBase>
get_subface_data (const UpdateFlags update_flags,
const Mapping<2,2> &,
const Quadrature<1> &quadrature,
#include <deal.II/fe/fe.h>
#include <deal.II/base/quadrature.h>
+#include <deal.II/base/std_cxx14/memory.h>
DEAL_II_NAMESPACE_OPEN
virtual
- typename FiniteElement<dim,spacedim>::InternalDataBase *
+ std::unique_ptr<typename FiniteElement<dim,spacedim>::InternalDataBase>
get_data(const UpdateFlags update_flags,
const Mapping<dim,spacedim> &/*mapping*/,
const Quadrature<dim> &quadrature,
{
// generate a new data object and
// initialize some fields
- InternalData *data = new InternalData;
+ auto data = std_cxx14::make_unique<InternalData>();
data->update_each = requires_update_flags(update_flags);
const unsigned int n_q_points = quadrature.size();
for (unsigned int k=0; k<this->dofs_per_cell; ++k)
data->shape_3rd_derivatives[k][i] = third_derivatives[k];
}
- return data;
+ return std::move(data);
}
virtual
#include <deal.II/base/qprojector.h>
+#include <deal.II/base/std_cxx14/memory.h>
#include <deal.II/fe/fe.h>
virtual
- typename FiniteElement<dim,spacedim>::InternalDataBase *
+ std::unique_ptr<typename FiniteElement<dim,spacedim>::InternalDataBase>
get_data (const UpdateFlags /*update_flags*/,
const Mapping<dim,spacedim> &/*mapping*/,
const Quadrature<dim> &/*quadrature*/,
dealii::internal::FEValuesImplementation::FiniteElementRelatedData<dim, spacedim> &/*output_data*/) const
{
- InternalData *data = new InternalData;
- return data;
+ return std_cxx14::make_unique<InternalData>();
}
- typename FiniteElement<dim,spacedim>::InternalDataBase *
+ std::unique_ptr<typename FiniteElement<dim,spacedim>::InternalDataBase>
get_face_data(const UpdateFlags update_flags,
const Mapping<dim,spacedim> &/*mapping*/,
const Quadrature<dim-1> &quadrature,
{
// generate a new data object and
// initialize some fields
- InternalData *data = new InternalData;
+ auto data = std_cxx14::make_unique<InternalData>();
data->update_each = requires_update_flags(update_flags);
const unsigned int n_q_points = quadrature.size();
Assert(false, ExcNotImplemented());
}
- return data;
+ return std::move(data);
}
- typename FiniteElement<dim,spacedim>::InternalDataBase *
+ std::unique_ptr<typename FiniteElement<dim,spacedim>::InternalDataBase>
get_subface_data(const UpdateFlags update_flags,
const Mapping<dim,spacedim> &mapping,
const Quadrature<dim-1> &quadrature,
#include <deal.II/fe/fe.h>
#include <deal.II/base/derivative_form.h>
#include <deal.II/base/quadrature.h>
+#include <deal.II/base/std_cxx14/memory.h>
#include <deal.II/base/thread_management.h>
/* NOTE: The following function has its definition inlined into the class declaration
because we otherwise run into a compiler error with MS Visual Studio. */
virtual
- typename FiniteElement<dim,spacedim>::InternalDataBase *
+ std::unique_ptr<typename FiniteElement<dim,spacedim>::InternalDataBase>
get_data(const UpdateFlags update_flags,
const Mapping<dim,spacedim> &/*mapping*/,
const Quadrature<dim> &quadrature,
{
// generate a new data object and
// initialize some fields
- InternalData *data = new InternalData;
+ auto data = std_cxx14::make_unique<InternalData>();
data->update_each = requires_update_flags(update_flags);
const unsigned int n_q_points = quadrature.size();
}
}
- return data;
+ return std::move(data);
}
virtual
protected:
- virtual typename FiniteElement<dim,spacedim>::InternalDataBase *
+ virtual
+ std::unique_ptr<typename FiniteElement<dim,spacedim>::InternalDataBase>
get_data (const UpdateFlags update_flags,
const Mapping<dim,spacedim> &mapping,
const Quadrature<dim> &quadrature,
dealii::internal::FEValuesImplementation::FiniteElementRelatedData<dim, spacedim> &output_data) const;
virtual
- typename FiniteElement<dim,spacedim>::InternalDataBase *
+ std::unique_ptr<typename FiniteElement<dim,spacedim>::InternalDataBase>
get_face_data (const UpdateFlags update_flags,
const Mapping<dim,spacedim> &mapping,
const Quadrature<dim-1> &quadrature,
dealii::internal::FEValuesImplementation::FiniteElementRelatedData<dim, spacedim> &output_data) const;
virtual
- typename FiniteElement<dim,spacedim>::InternalDataBase *
+ std::unique_ptr<typename FiniteElement<dim,spacedim>::InternalDataBase>
get_subface_data (const UpdateFlags update_flags,
const Mapping<dim,spacedim> &mapping,
const Quadrature<dim-1> &quadrature,
* base_noth base element.
*/
void set_fe_data(const unsigned int base_no,
- typename FiniteElement<dim,spacedim>::InternalDataBase *);
+ std::unique_ptr<typename FiniteElement<dim,spacedim>::InternalDataBase>);
/**
* Give read-access to the pointer to a @p InternalData of the @p
* necessarily the same, we only need as many of these objects as there
* are base elements, irrespective of their multiplicity.
*/
- typename std::vector<typename FiniteElement<dim,spacedim>::InternalDataBase *> base_fe_datas;
+ typename std::vector<std::unique_ptr<typename FiniteElement<dim,spacedim>::InternalDataBase > > base_fe_datas;
/**
* A collection of objects to which the base elements will write their
/*------------------------------- FiniteElement ----------------------*/
template <int dim, int spacedim>
-typename FiniteElement<dim,spacedim>::InternalDataBase *
+std::unique_ptr<typename FiniteElement<dim,spacedim>::InternalDataBase>
FiniteElement<dim,spacedim>::get_face_data (const UpdateFlags flags,
const Mapping<dim,spacedim> &mapping,
const Quadrature<dim-1> &quadrature,
template <int dim, int spacedim>
-typename FiniteElement<dim,spacedim>::InternalDataBase *
+std::unique_ptr<typename FiniteElement<dim,spacedim>::InternalDataBase>
FiniteElement<dim,spacedim>::get_subface_data (const UpdateFlags flags,
const Mapping<dim,spacedim> &mapping,
const Quadrature<dim-1> &quadrature,
//---------------------------------------------------------------------------
template <int dim, int spacedim>
-typename FiniteElement<dim,spacedim>::InternalDataBase *
+std::unique_ptr<typename FiniteElement<dim,spacedim>::InternalDataBase>
FE_DGPNonparametric<dim,spacedim>::
get_data (const UpdateFlags update_flags,
const Mapping<dim,spacedim> &,
dealii::internal::FEValuesImplementation::FiniteElementRelatedData<dim, spacedim> &/*output_data*/) const
{
// generate a new data object
- typename FiniteElement<dim,spacedim>::InternalDataBase *data
- = new typename FiniteElement<dim,spacedim>::InternalDataBase;
+ auto data = std_cxx14::make_unique<typename FiniteElement<dim,spacedim>::InternalDataBase>();
data->update_each = requires_update_flags(update_flags);
// other than that, there is nothing we can add here as discussed
// in the general documentation of this class
- return data;
+ return std::move(data);
}
template <int dim, int spacedim>
template <int dim_1>
-typename FiniteElement<dim,spacedim>::InternalDataBase *
+std::unique_ptr<typename FiniteElement<dim,spacedim>::InternalDataBase>
FE_Enriched<dim,spacedim>::setup_data (std::unique_ptr<typename FiniteElement<dim,spacedim>::InternalDataBase> &&fes_data,
const UpdateFlags flags,
const Quadrature<dim_1> &quadrature) const
// 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());
- InternalData *data = new InternalData(std::unique_ptr<typename FESystem<dim,spacedim>::InternalData>(data_fesystem));
+ auto data = std_cxx14::make_unique<InternalData>(std::unique_ptr<typename FESystem<dim,spacedim>::InternalData>(data_fesystem));
// copy update_each from FESystem data:
data->update_each = data_fesystem->update_each;
}
}
- return data;
+ return std::move(data);
}
template <int dim, int spacedim>
-typename FiniteElement<dim,spacedim>::InternalDataBase *
+std::unique_ptr<typename FiniteElement<dim,spacedim>::InternalDataBase>
FE_Enriched<dim,spacedim>::get_face_data (const UpdateFlags update_flags,
const Mapping<dim,spacedim> &mapping,
const Quadrature<dim-1> &quadrature,
template <int dim, int spacedim>
-typename FiniteElement<dim,spacedim>::InternalDataBase *
+std::unique_ptr<typename FiniteElement<dim,spacedim>::InternalDataBase>
FE_Enriched<dim,spacedim>::get_subface_data (const UpdateFlags update_flags,
const Mapping<dim,spacedim> &mapping,
const Quadrature<dim-1> &quadrature,
template <int dim, int spacedim>
-typename FiniteElement<dim,spacedim>::InternalDataBase *
+std::unique_ptr<typename FiniteElement<dim,spacedim>::InternalDataBase>
FE_Enriched<dim,spacedim>::get_data (const UpdateFlags flags,
const Mapping<dim,spacedim> &mapping,
const Quadrature<dim> &quadrature,
template <int dim, int spacedim>
-typename FiniteElement<dim,spacedim>::InternalDataBase *
+std::unique_ptr<typename FiniteElement<dim,spacedim>::InternalDataBase>
FE_Nothing<dim,spacedim>::get_data (const UpdateFlags /*update_flags*/,
const Mapping<dim,spacedim> &/*mapping*/,
const Quadrature<dim> &/*quadrature*/,
// Create a default data object. Normally we would then
// need to resize things to hold the appropriate numbers
// of dofs, but in this case all data fields are empty.
- typename FiniteElement<dim,spacedim>::InternalDataBase *data
- = new typename FiniteElement<dim,spacedim>::InternalDataBase();
- return data;
+ return std_cxx14::make_unique<typename FiniteElement<dim,spacedim>::InternalDataBase>();
}
-FiniteElement<2,2>::InternalDataBase *
+std::unique_ptr<FiniteElement<2,2>::InternalDataBase>
FE_P1NC::get_data (const UpdateFlags update_flags,
const Mapping<2,2> &,
const Quadrature<2> &quadrature,
dealii::internal::FEValuesImplementation::FiniteElementRelatedData<2,2> &output_data) const
{
- FiniteElement<2,2>::InternalDataBase *data = new FiniteElement<2,2>::InternalDataBase;
+ auto data = std_cxx14::make_unique<FiniteElement<2,2>::InternalDataBase>();
data->update_each = requires_update_flags(update_flags);
-FiniteElement<2,2>::InternalDataBase *
+std::unique_ptr<FiniteElement<2,2>::InternalDataBase>
FE_P1NC::get_face_data (const UpdateFlags update_flags,
const Mapping<2,2> &,
const Quadrature<1> &quadrature,
dealii::internal::FEValuesImplementation::FiniteElementRelatedData<2,2> &output_data) const
{
- FiniteElement<2,2>::InternalDataBase *data = new FiniteElement<2,2>::InternalDataBase;
+ auto data = std_cxx14::make_unique<FiniteElement<2,2>::InternalDataBase>();
data->update_each = requires_update_flags(update_flags);
-FiniteElement<2,2>::InternalDataBase *
+std::unique_ptr<FiniteElement<2,2>::InternalDataBase>
FE_P1NC::get_subface_data (const UpdateFlags update_flags,
const Mapping<2,2> &,
const Quadrature<1> &quadrature,
dealii::internal::FEValuesImplementation::FiniteElementRelatedData<2,2> &output_data) const
{
- FiniteElement<2,2>::InternalDataBase *data = new FiniteElement<2,2>::InternalDataBase;
+ auto data = std_cxx14::make_unique<FiniteElement<2,2>::InternalDataBase>();
data->update_each = requires_update_flags(update_flags);
{
// delete pointers and set them to zero to avoid inadvertent use
for (unsigned int i=0; i<base_fe_datas.size(); ++i)
- if (base_fe_datas[i])
- {
- delete base_fe_datas[i];
- base_fe_datas[i] = nullptr;
- }
+ base_fe_datas[i].reset();
}
void
FESystem<dim,spacedim>::
InternalData::set_fe_data (const unsigned int base_no,
- typename FiniteElement<dim,spacedim>::InternalDataBase *ptr)
+ std::unique_ptr<typename FiniteElement<dim,spacedim>::InternalDataBase> ptr)
{
Assert(base_no<base_fe_datas.size(),
ExcIndexRange(base_no,0,base_fe_datas.size()));
- base_fe_datas[base_no]=ptr;
+ base_fe_datas[base_no]=std::move(ptr);
}
template <int dim, int spacedim>
-typename FiniteElement<dim,spacedim>::InternalDataBase *
+std::unique_ptr<typename FiniteElement<dim,spacedim>::InternalDataBase>
FESystem<dim,spacedim>::
get_data (const UpdateFlags flags,
const Mapping<dim,spacedim> &mapping,
// and so the current object's update_each flag needs to be
// correct in case the current FESystem is a base element for another,
// higher-level FESystem itself.
- InternalData *data = new InternalData(this->n_base_elements());
+ auto data = std_cxx14::make_unique<InternalData>(this->n_base_elements());
data->update_each = requires_update_flags(flags);
// get data objects from each of the base elements and store
// out of the base output object into the system output object,
// but we can't because we can't know what the elements already
// copied and/or will want to update on every cell
- typename FiniteElement<dim,spacedim>::InternalDataBase *base_fe_data =
+ auto base_fe_data =
base_element(base_no).get_data (flags, mapping, quadrature,
base_fe_output_object);
- data->set_fe_data(base_no, base_fe_data);
+ data->set_fe_data(base_no, std::move(base_fe_data));
}
- return data;
+ return std::move(data);
}
// The following function is a clone of get_data, with the exception
// that get_face_data of the base elements is called.
template <int dim, int spacedim>
-typename FiniteElement<dim,spacedim>::InternalDataBase *
+std::unique_ptr<typename FiniteElement<dim,spacedim>::InternalDataBase>
FESystem<dim,spacedim>::
get_face_data (const UpdateFlags flags,
const Mapping<dim,spacedim> &mapping,
// and so the current object's update_each flag needs to be
// correct in case the current FESystem is a base element for another,
// higher-level FESystem itself.
- InternalData *data = new InternalData(this->n_base_elements());
+ auto data = std_cxx14::make_unique<InternalData>(this->n_base_elements());
data->update_each = requires_update_flags(flags);
// get data objects from each of the base elements and store
// out of the base output object into the system output object,
// but we can't because we can't know what the elements already
// copied and/or will want to update on every cell
- typename FiniteElement<dim,spacedim>::InternalDataBase *base_fe_data =
+ auto base_fe_data =
base_element(base_no).get_face_data (flags, mapping, quadrature,
base_fe_output_object);
- data->set_fe_data(base_no, base_fe_data);
+ data->set_fe_data(base_no, std::move(base_fe_data));
}
- return data;
+ return std::move(data);
}
// that get_subface_data of the base elements is called.
template <int dim, int spacedim>
-typename FiniteElement<dim,spacedim>::InternalDataBase *
+std::unique_ptr<typename FiniteElement<dim,spacedim>::InternalDataBase>
FESystem<dim,spacedim>::
get_subface_data (const UpdateFlags flags,
const Mapping<dim,spacedim> &mapping,
// and so the current object's update_each flag needs to be
// correct in case the current FESystem is a base element for another,
// higher-level FESystem itself.
- InternalData *data = new InternalData(this->n_base_elements());
+ auto data = std_cxx14::make_unique<InternalData>(this->n_base_elements());
data->update_each = requires_update_flags(flags);
// get data objects from each of the base elements and store
// out of the base output object into the system output object,
// but we can't because we can't know what the elements already
// copied and/or will want to update on every cell
- typename FiniteElement<dim,spacedim>::InternalDataBase *base_fe_data =
+ auto base_fe_data =
base_element(base_no).get_subface_data (flags, mapping, quadrature,
base_fe_output_object);
- data->set_fe_data(base_no, base_fe_data);
+ data->set_fe_data(base_no, std::move(base_fe_data));
}
- return data;
+ return std::move(data);
}
// then get objects into which the FE and the Mapping can store
// intermediate data used across calls to reinit. we can do this in parallel
- Threads::Task<typename FiniteElement<dim,spacedim>::InternalDataBase *>
+ Threads::Task<std::unique_ptr<typename FiniteElement<dim,spacedim>::InternalDataBase> >
fe_get_data = Threads::new_task (&FiniteElement<dim,spacedim>::get_data,
*this->fe,
flags,
*this->mapping,
quadrature,
this->finite_element_output);
- Threads::Task<typename Mapping<dim,spacedim>::InternalDataBase *>
+ Threads::Task<typename Mapping<dim,spacedim>::InternalDataBase * >
mapping_get_data;
if (flags & update_mapping)
mapping_get_data = Threads::new_task (&Mapping<dim,spacedim>::get_data,
this->update_flags = flags;
// then collect answers from the two task above
- this->fe_data.reset (fe_get_data.return_value());
+ this->fe_data = std::move(fe_get_data.return_value());
if (flags & update_mapping)
this->mapping_data.reset (mapping_get_data.return_value());
else
// then get objects into which the FE and the Mapping can store
// intermediate data used across calls to reinit. this can be done in parallel
- Threads::Task<typename FiniteElement<dim,spacedim>::InternalDataBase *>
+ Threads::Task<std::unique_ptr<typename FiniteElement<dim,spacedim>::InternalDataBase> >
fe_get_data = Threads::new_task (&FiniteElement<dim,spacedim>::get_face_data,
*this->fe,
flags,
this->update_flags = flags;
// then collect answers from the two task above
- this->fe_data.reset (fe_get_data.return_value());
+ this->fe_data = std::move(fe_get_data.return_value());
if (flags & update_mapping)
this->mapping_data.reset (mapping_get_data.return_value());
else
// then get objects into which the FE and the Mapping can store
// intermediate data used across calls to reinit. this can be done
// in parallel
- Threads::Task<typename FiniteElement<dim,spacedim>::InternalDataBase *>
+ Threads::Task<std::unique_ptr<typename FiniteElement<dim,spacedim>::InternalDataBase> >
fe_get_data = Threads::new_task (&FiniteElement<dim,spacedim>::get_subface_data,
*this->fe,
flags,
this->update_flags = flags;
// then collect answers from the two task above
- this->fe_data.reset (fe_get_data.return_value());
+ this->fe_data = std::move(fe_get_data.return_value());
if (flags & update_mapping)
this->mapping_data.reset (mapping_get_data.return_value());
else