* according to the given distribution
* method.
*
- * A copy of the transferred finite
- * element is stored.
+ * A pointer of the transferred finite
+ * element is stored. Therefore, the
+ * lifetime of the finite element object
+ * shall be longer than that of this
+ * object. If you don't want this
+ * behaviour, you may want to call
+ * the #clear# member function which also
+ * releases the lock of this object to the
+ * finite element.
*
* This function uses the user flags of the
* triangulation object, so make sure you
*/
virtual void distribute_dofs (const FiniteElement<dim> &);
+ /**
+ * Clear all data of this object and
+ * especially delete the lock this object
+ * has to the finite element used the last
+ * time when #distribute_dofs# was called.
+ */
+ virtual void clear ();
+
/**
* Renumber the degrees of freedom according
* to the given scheme, eventually using
*/
void reserve_space ();
+ /**
+ * Free all used memory.
+ */
+ void clear_space ();
+
/**
* Distribute dofs on the given cell,
* with new dofs starting with index
+template <int dim>
+void DoFHandler<dim>::clear () {
+ // release lock to old fe
+ selected_fe = 0;
+
+ // release memory
+ clear_space ();
+};
+
+
+
+
#if deal_II_dimension == 1
template <>
// newly, since vectors are
// troublesome if you want to change
// their size
- for (unsigned int i=0; i<levels.size(); ++i)
- delete levels[i];
- levels.resize (0);
-
+ clear_space ();
+
vertex_dofs = vector<int>(tria->vertices.size()*
selected_fe->dofs_per_vertex,
-1);
};
};
+
#endif
// newly, since vectors are
// troublesome if you want to change
// their size
- for (unsigned int i=0; i<levels.size(); ++i)
- delete levels[i];
- levels.resize (0);
-
+ clear_space ();
+
vertex_dofs = vector<int>(tria->vertices.size()*
selected_fe->dofs_per_vertex,
-1);
#endif
+template <int dim>
+void DoFHandler<dim>::clear_space () {
+ for (unsigned int i=0; i<levels.size(); ++i)
+ delete levels[i];
+ levels.resize (0);
+};
+
+
/*-------------- Explicit Instantiations -------------------------------*/
template class DoFHandler<deal_II_dimension>;