]> https://gitweb.dealii.org/ - dealii.git/commitdiff
Introduce a function Triangulation::get_tria().
authorWolfgang Bangerth <bangerth@math.tamu.edu>
Thu, 10 Dec 2015 12:48:48 +0000 (06:48 -0600)
committerWolfgang Bangerth <bangerth@math.tamu.edu>
Thu, 10 Dec 2015 12:48:48 +0000 (06:48 -0600)
This allows to treat DoFHandlers and Triangulations in a more generic way.

include/deal.II/grid/tria.h
source/grid/tria.cc

index 115af08038e59047056c9b47ba736105da95352d..47b209ff87029f4d99fb5a6c6d7deb0f5120c06c 100644 (file)
@@ -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<dim,spacedim> &
+  get_tria ();
+
+  /**
+   * Return a reference to the current object. This is the const-version
+   * of the previous function.
+   */
+  const Triangulation<dim,spacedim> &
+  get_tria () const;
+
+
   /*
    * @}
    */
index 0dc87a542381560f6d09ce7051bb0127587b7a3f..01a5d7a8221612ca53c7b0692ccbb50aae4f1f21 100644 (file)
@@ -11573,6 +11573,24 @@ Triangulation<dim,spacedim>::locally_owned_subdomain () const
 
 
 
+template <int dim, int spacedim>
+Triangulation<dim,spacedim> &
+Triangulation<dim,spacedim>::get_tria ()
+{
+  return *this;
+}
+
+
+
+template <int dim, int spacedim>
+const Triangulation<dim,spacedim> &
+Triangulation<dim,spacedim>::get_tria () const
+{
+  return *this;
+}
+
+
+
 template <int dim, int spacedim>
 void
 Triangulation<dim, spacedim>::execute_coarsening_and_refinement ()

In the beginning the Universe was created. This has made a lot of people very angry and has been widely regarded as a bad move.

Douglas Adams


Typeset in Trocchi and Trocchi Bold Sans Serif.