virtual
void
post_refinement_notification (const Triangulation<dim> &tria);
+
+ /**
+ * At the end of a call to
+ * copy_triangulation() the
+ * Triangulation class calls this
+ * method on all objects derived from
+ * this class and registered with the
+ * original Triangulation @p old_tria
+ * so that they might subscribe to the
+ * copied one @p new_tria as well, if
+ * that is desired. By default this
+ * method does nothing, a different
+ * behavior has to be implemented in
+ * derived classes.
+ */
+ virtual
+ void
+ copy_notification (const Triangulation<dim> &old_tria,
+ const Triangulation<dim> &new_tria);
};
/**
* disable or extend the
* functionality of this
* function.
+ *
+ * Note, that the list of
+ * RefinementListeners is not
+ * copied. However, each
+ * RefinementListener is notified of the
+ * copy operation through the
+ * RefinementListener::copy_notification()
+ * function, so it might subscribe to the
+ * new Triangulation as well, if that is
+ * desired.
*/
virtual void copy_triangulation (const Triangulation<dim> &old_tria);
vertices = old_tria.vertices;
vertices_used = old_tria.vertices_used;
smooth_grid = old_tria.smooth_grid;
- // do a shallow copy of the list of
- // RefinementListeners
- refinement_listeners = old_tria.refinement_listeners;
faces = new internal::Triangulation::TriaFaces<dim>(*old_tria.faces);
number_cache = old_tria.number_cache;
+ // inform RefinementListeners of old_tria of
+ // the copy operation
+ typename std::list<RefinementListener *>::iterator ref_listener =
+ old_tria.refinement_listeners.begin (),
+ end_listener = old_tria.refinement_listeners.end ();
+ for (; ref_listener != end_listener; ++ref_listener)
+ (*ref_listener)->copy_notification (old_tria, *this);
+
// note that we need not copy the
// subscriptor!
}
+template<int dim>
+void Triangulation<dim>::
+RefinementListener::copy_notification (const Triangulation<dim> &,
+ const Triangulation<dim> &)
+{}
+
+
+
template<int dim>
void
Triangulation<dim>::add_refinement_listener (RefinementListener &listener) const
<h3>deal.II</h3>
<ol>
+ <li> <p>Extended: the function
+ <code>Triangulation::copy_triangulation</code>
+ copies all members of a triangulation except for the list of
+ <code>RefinementListener</code>s. In most cases this is exactly the
+ intended behavior. However, if a RefinementListener should be copied to
+ the new triangulation, e.g. if a Persistent Triangulation is created from
+ an ordinary one, it can do so now through implementing the new
+ function <code>RefinementListener::copy_notification</code>.
+ <br>
+ (Tobias Leicht 2007/06/05)
+ </p>
+
<li> <p>New: the function
<code>DoFTools::make_sparsity_pattern</code>
now takes an optional constraint matrix argument that can be used to