* FiniteElement, only this one object is returned wrapped in a
* hp::FECollection.
*/
- hp::FECollection<dim,spacedim> get_fe_collection () const;
+ const hp::FECollection<dim,spacedim> &get_fe_collection () const;
/**
* Return a constant reference to the triangulation underlying this object.
SmartPointer<const FiniteElement<dim,spacedim>,DoFHandler<dim,spacedim> >
selected_fe;
+ /**
+ * Store a pointer to a hp::FECollection object containing the (one)
+ * FiniteElement this object is initialized with.
+ */
+ std::unique_ptr<const hp::FECollection<dim,spacedim> > fe_collection;
+
/**
* An object that describes how degrees of freedom should be distributed and
* renumbered.
template <int dim, int spacedim>
inline
-hp::FECollection<dim,spacedim>
+const hp::FECollection<dim,spacedim> &
DoFHandler<dim,spacedim>::get_fe_collection () const
{
- Assert(selected_fe!=nullptr,
- ExcMessage("You are trying to access the DoFHandler's FiniteElement object before it has been initialized."));
- return hp::FECollection<dim,spacedim>(*selected_fe);
+ Assert(fe_collection != nullptr,
+ ExcMessage("You are trying to access the DoFHandler's FECollection object before it has been initialized."));
+ return *fe_collection;
}
#include <deal.II/fe/fe.h>
#include <deal.II/distributed/shared_tria.h>
#include <deal.II/distributed/tria.h>
+#include <deal.II/base/std_cxx14/memory.h>
#include <set>
#include <algorithm>
:
tria(&tria, typeid(*this).name()),
selected_fe(nullptr, typeid(*this).name()),
+ fe_collection(nullptr),
faces(nullptr),
mg_faces (nullptr)
{
DoFHandler<dim,spacedim>::DoFHandler ()
:
tria(nullptr, typeid(*this).name()),
- selected_fe(nullptr, typeid(*this).name())
+ selected_fe(nullptr, typeid(*this).name()),
+ fe_collection(nullptr)
{}
{
std::size_t mem = (MemoryConsumption::memory_consumption (tria) +
MemoryConsumption::memory_consumption (selected_fe) +
+ MemoryConsumption::memory_consumption (fe_collection) +
MemoryConsumption::memory_consumption (block_info_object) +
MemoryConsumption::memory_consumption (levels) +
MemoryConsumption::memory_consumption (*faces) +
void DoFHandler<dim,spacedim>::distribute_dofs (const FiniteElement<dim,spacedim> &ff)
{
selected_fe = &ff;
+ fe_collection = std_cxx14::make_unique<hp::FECollection<dim, spacedim>>(ff);
// delete all levels and set them
// up newly. note that we still
{
// release lock to old fe
selected_fe = nullptr;
+ fe_collection.release();
// release memory
clear_space ();