]> https://gitweb.dealii.org/ - dealii-svn.git/commitdiff
Add some small functionality and doc.
authorwolf <wolf@0785d39b-7218-0410-832d-ea1e28bc413d>
Wed, 11 Aug 1999 16:39:44 +0000 (16:39 +0000)
committerwolf <wolf@0785d39b-7218-0410-832d-ea1e28bc413d>
Wed, 11 Aug 1999 16:39:44 +0000 (16:39 +0000)
git-svn-id: https://svn.dealii.org/trunk@1681 0785d39b-7218-0410-832d-ea1e28bc413d

deal.II/deal.II/include/numerics/data_out.h
deal.II/deal.II/source/numerics/data_out.cc

index b0ea534c60f460d202d0beb0bf87134ee7071071..b3366ea63dd48371ecffe1215d7239f7b5760e97 100644 (file)
@@ -349,6 +349,27 @@ class DataOut_DoFData : public DataOutInterface<dim>
  * class's documentation has an example of using nodal data to generate
  * output.
  *
+ *
+ * \subsection{Extensions}
+ *
+ * By default, this class produces patches for all active cells. Sometimes,
+ * this is not what you want, maybe because they are simply too many (and too
+ * small to be seen individually) or because you only want to see a certain
+ * region of the domain, or for some other reason.
+ *
+ * For this, internally the #build_patches# function does not generate
+ * the sequence of cells to be converted into patches itself, but relies
+ * on the two functions #first_cell# and #next_cell#. By default, they
+ * return the first active cell, and the next active cell, respectively.
+ * Since they are #virtual# functions, you may overload them to select other
+ * cells for output. If cells are not active, interpolated values are taken
+ * for output instead of the exact values on active cells.
+ *
+ * The two functions are not constant, so you may store information within
+ * your derived class about the last accessed cell. This is useful if the
+ * information of the last cell which was accessed is not sufficient to
+ * determine the next one.
+ *
  * @author Wolfgang Bangerth, 1999
  */
 template <int dim>
@@ -356,14 +377,47 @@ class DataOut : public DataOut_DoFData<dim>
 {
   public:
                                     /**
-                                     * This is the central and only function of
+                                     * This is the central function of
                                      * this class since it builds the list of
                                      * patches to be written by the low-level
                                      * functions of the base class. See the
                                      * general documentation of this class
                                      * for further information.
                                      */
-    virtual void build_patches (const unsigned int n_subdivisions = 1);    
+    virtual void build_patches (const unsigned int n_subdivisions = 1);
+
+                                    /**
+                                     * Return the first cell which we
+                                     * want output for. The default
+                                     * implementation returns the first
+                                     * active cell, but you might want
+                                     * to return other cells in a derived
+                                     * class.
+                                     */
+    virtual typename DoFHandler<dim>::cell_iterator
+    first_cell ();
+    
+                                    /**
+                                     * Return the next cell after #cell# which
+                                     * we want output for.
+                                     * If there are no more cells,
+                                     * #dofs->end()# shall be returned.
+                                     *
+                                     * The default
+                                     * implementation returns the next
+                                     * active cell, but you might want
+                                     * to return other cells in a derived
+                                     * class. Note that the default
+                                     * implementation assumes that
+                                     * the given #cell# is active, which
+                                     * is guaranteed as long as #first_cell#
+                                     * is also used from the default
+                                     * implementation. Overloading only one
+                                     * of the two functions might not be
+                                     * a good idea.
+                                     */
+    virtual typename DoFHandler<dim>::cell_iterator
+    next_cell (const typename DoFHandler<dim>::cell_iterator &cell);
 };
 
 
index 9986c8ed6ddcc674cdaf100bfe528cafcf49f746..875305b13dd08c2050ab372ad68d1538a5869588 100644 (file)
@@ -169,8 +169,9 @@ void DataOut<dim>::build_patches (const unsigned int n_subdivisions)
                                   // create patches of and make sure
                                   // there is enough memory for that
   unsigned int n_patches = 0;
-  for (DoFHandler<dim>::active_cell_iterator cell=dofs->begin_active();
-       cell != dofs->end(); ++cell)
+  for (DoFHandler<dim>::active_cell_iterator cell=first_cell();
+       cell != dofs->end();
+       cell = next_cell(cell))
     ++n_patches;
 
 
@@ -245,9 +246,32 @@ void DataOut<dim>::build_patches (const unsigned int n_subdivisions)
 
 
 
+template <int dim>
+typename DoFHandler<dim>::cell_iterator
+DataOut<dim>::first_cell () 
+{
+  return dofs->begin_active ();
+};
+
+
+
+template <int dim>
+typename DoFHandler<dim>::cell_iterator
+DataOut<dim>::next_cell (const typename DoFHandler<dim>::cell_iterator &cell) 
+{
+                                  // convert the iterator to an
+                                  // active_iterator and advance
+                                  // this to the next active cell
+  typename DoFHandler<dim>::active_cell_iterator active_cell = cell;
+  ++active_cell;
+  return active_cell;
+};
 
 
 
 // explicit instantiations
 template class DataOut_DoFData<deal_II_dimension>;
 template class DataOut<deal_II_dimension>;
+
+
+

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.