From: Wolfgang Bangerth Date: Thu, 10 Dec 2015 12:48:48 +0000 (-0600) Subject: Introduce a function Triangulation::get_tria(). X-Git-Tag: v8.4.0-rc2~165^2~6 X-Git-Url: https://gitweb.dealii.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=52eb1f97577d7e69667a035b4f4687bd316c6626;p=dealii.git Introduce a function Triangulation::get_tria(). This allows to treat DoFHandlers and Triangulations in a more generic way. --- diff --git a/include/deal.II/grid/tria.h b/include/deal.II/grid/tria.h index 115af08038..47b209ff87 100644 --- a/include/deal.II/grid/tria.h +++ b/include/deal.II/grid/tria.h @@ -1425,6 +1425,7 @@ public: typedef typename IteratorSelector::hex_iterator hex_iterator; typedef typename IteratorSelector::active_hex_iterator active_hex_iterator; + /** * A structure that is used as an exception object by the * create_triangulation() function to indicate which cells among the coarse @@ -2811,6 +2812,25 @@ public: */ virtual types::subdomain_id locally_owned_subdomain () const; + /** + * Return a reference to the current object. + * + * This doesn't seem to be very useful but allows to write code that + * can access the underlying triangulation for anything that satisfies + * the @ref GlossMeshAsAContainer "Mesh as a container" concept (which + * may not only be a triangulation, but also a DoFHandler, for example). + */ + Triangulation & + get_tria (); + + /** + * Return a reference to the current object. This is the const-version + * of the previous function. + */ + const Triangulation & + get_tria () const; + + /* * @} */ diff --git a/source/grid/tria.cc b/source/grid/tria.cc index 0dc87a5423..01a5d7a822 100644 --- a/source/grid/tria.cc +++ b/source/grid/tria.cc @@ -11573,6 +11573,24 @@ Triangulation::locally_owned_subdomain () const +template +Triangulation & +Triangulation::get_tria () +{ + return *this; +} + + + +template +const Triangulation & +Triangulation::get_tria () const +{ + return *this; +} + + + template void Triangulation::execute_coarsening_and_refinement ()