]> https://gitweb.dealii.org/ - dealii-svn.git/commitdiff
Cosmetic changes.
authorwolf <wolf@0785d39b-7218-0410-832d-ea1e28bc413d>
Sun, 11 Jul 1999 21:15:27 +0000 (21:15 +0000)
committerwolf <wolf@0785d39b-7218-0410-832d-ea1e28bc413d>
Sun, 11 Jul 1999 21:15:27 +0000 (21:15 +0000)
git-svn-id: https://svn.dealii.org/trunk@1568 0785d39b-7218-0410-832d-ea1e28bc413d

deal.II/base/include/base/convergence_table.h
deal.II/base/include/base/table_handler.h
deal.II/base/source/convergence_table.cc
deal.II/base/source/table_handler.cc
deal.II/deal.II/source/numerics/vectors.cc

index c01373b62d387c1eeb8858002a8ab8551b2aab76..7a7ceffd71cbb129746cb1040f43ff5f89a9aeb6 100644 (file)
 
 /**
  * The #ConvergenceTable# class is an application to the #TableHandler# class and
- * stores some convergence data as residuals of the cg-method, or some evaluated
- * $L^2$-errors of discrete solutions, etc,
- * and evaluates convergence rates or orders.
- * The already implemented #RateMode# is #ConvergenceTable::standard#, 
+ * stores some convergence data, such as residuals of the cg-method, or some evaluated
+ * $L^2$-errors of discrete solutions, etc, and evaluates convergence rates or orders.
+ *
+ * The already implemented #RateMode#s are #ConvergenceTable::standard#, 
  * where the convergence rate is the quotient of two following rows, and 
  * #ConvergenceTable::standard_order#, that evaluates the order of convergence.
  * These standard evaluations are useful for global refinement, for local refinement
  * this may not be a appropriate method, as the convergence rates should be
  * set in relation to the number of cells or the number of DoFs. The
- * implementations of these nostandard methods is left to the fantasy of a
+ * implementations of these non-standard methods is left to the fantasy of a
  * fanatic user.
  *
  * \subsection{Usage}
  * The number of cells and the number of DoFs are added to the table by
- * calling #add_run(unsigned int ncells, unsigned int ndofs#. The
+ * calling #add_run(unsigned int ncells, unsigned int ndofs)#. The
  * data is added by #add_value(...)# of the base class #TableHandler#.
  * Before the output of the table the function #evaluate_convergence_rates#
  * may be (also multiply) called. 
@@ -40,16 +40,17 @@ class ConvergenceTable: public TableHandler
                                      */
     ConvergenceTable();
     
-    enum RateMode
-    {
+    enum RateMode {
          none, standard, standard_order, n_cells, n_dofs
     };
+
                                     /**
                                      * Adds the basic information
                                      * (number of cells, number of DoFs)
                                      * of a new run.
                                      */
-    void add_run(unsigned int ncells, unsigned int ndofs);
+    void add_run (unsigned int ncells, 
+                 unsigned int ndofs);
 
                                     /**
                                      * Evaluates the convergence rates of the
@@ -57,7 +58,8 @@ class ConvergenceTable: public TableHandler
                                      * merges the rate column and this column
                                      * to a supercolumn.
                                      */
-    void evaluate_convergence_rates(const string &key, const RateMode conv_rate);
+    void evaluate_convergence_rates (const string &key, 
+                                    const RateMode conv_rate);
 
                                     /**
                                      * Evaluate the convergence rates of
index 27ccb2ef3eb46cfbf7ba2de1dcb48945d88f4fe4..2ca890170a9abb220a0b8a858a9d8746ccda6a31 100644 (file)
@@ -48,11 +48,11 @@ class TableEntryBase
 
 
 /**
- * A #TableEntry# stores the value of an table entry.
+ * A #TableEntry# stores the value of a table entry.
  * The value type of this table entry is arbitrary. For
- * a #TableEntry<typename value_type># with not common value
- * type overload the output function.
- * This class is not to be used by the user.
+ * a #TableEntry<typename value_type># with a non-common value
+ * type you may want to specialize the output functions in order
+ * to get nicer output. This class is not to be used by the user.
  *
  * For more detail see the #TableHandler# class.
  *
@@ -95,32 +95,38 @@ class TableEntry : public TableEntryBase
     const value_type val;
 };
 
+
+
+
 /**
  * The #TableHandler# stores #TableEntries# of arbitrary value type and 
- * writes the table as text or in tex format to a tex file. The value type
- * actually may vary from column to column as from row to row. 
+ * writes the table as text or in tex format to an output stream. The value
+ * type actually may vary from column to column and from row to row. 
  *
  * \subsection{Usage}
  *
- * The most important function is the template function 
+ * The most important function is the templatized function 
  * #add_value(const string &key, const value_type value)#, that adds a column
  * with the name #key# to the table if this column does not yet exist and adds the 
- * value of #value_type# (e.g. unsigned int, double, string, ...) to this column.
+ * value of #value_type# (e.g. #unsigned int#, #double#, #string#, ...) to this column.
  * After the table is complete there are different possibilities of output, e.g.
  * into a tex file with #write_tex(ofstream &file)# or as text with 
- * #write_text (ostream &out)#. Two (or more) columns may be merged into a
- * 'supercolumn' by twice (or multiple) calling #add_column_to_supercolumn(...)#,
- * see there. Additionally there is a function to set for each column 
- * the precision of the output of numbers, and there are several functions to
- * prescribe the format and the captions the columns are written with in tex mode.
+ * #write_text (ostream &out)#. 
+ *
+ * Two (or more) columns may be merged into a "supercolumn" by twice
+ * (or multiple) calling #add_column_to_supercolumn(...)#, see
+ * there. Additionally there is a function to set for each column the
+ * precision of the output of numbers, and there are several functions
+ * to prescribe the format and the captions the columns are written
+ * with in tex mode.
  *
  * \subsection{Example}
  * This is a simple example demonstrating the usage of this class. The first column
- * includes the numbers i=1..n, the second 1^2...n^2, the third sqrt(1)...sqrt(n),
+ * includes the numbers #i=1..n#, the second $1^2$...$n^2$, the third $sqrt(1)...sqrt(n)$,
  * where the second and third columns are merged into one supercolumn 
- * with the superkey `squares and roots'. Additionally the first column is
- * aligned to the right (the default was `centered') and the precision of
- * the square roots are given to be 6 (instead of 4 as default).
+ * with the superkey #squares and roots#. Additionally the first column is
+ * aligned to the right (the default was #centered#) and the precision of
+ * the square roots are set to be 6 (instead of 4 as default).
  *
  * \begin{verbatim}
  * TableHandler table();
@@ -163,55 +169,66 @@ class TableHandler
                                      * to the column.
                                      */
     template <typename value_type>
-    void add_value(const string &key, const value_type value);
+    void add_value (const string     &key,
+                   const value_type  value);
     
                                     /**
                                      * Creates a sypercolumn (if not yet
                                      * existent) and includes column to it.
                                      * The keys of the column and the supercolumn
-                                     * are key and superkey respectively.
-                                     * To merge two columns c1 and c2 to
-                                     * a supercolumn sc, hence call
+                                     * are #key# and #superkey#, respectively.
+                                     * To merge two columns #c1# and #c2# to
+                                     * a supercolumn #sc# hence call
                                      * #add_column_to_supercolumn(c1,sc)# and
                                      * #add_column_to_supercolumn(c2,sc)#.
                                      *
                                      * Concerning the order of the columns,
                                      * the supercolumn replaces the first
                                      * column that is added to the supercolumn.
-                                     * Within the supercolumn the order
+                                     * Within the supercolumn
                                      * the order of output follows the order
                                      * the columns are added to the supercolumn.
                                      */
-    void add_column_to_supercolumn(const string &key, const string &superkey);
+    void add_column_to_supercolumn (const string &key,
+                                   const string &superkey);
 
                                     /**
                                      * Change the order of columns and
                                      * supercolumns in the table.
                                      */
-    void set_column_order(const vector<string> &new_order);
+    void set_column_order (const vector<string> &new_order);
     
                                     /**
                                      * Sets the output format of a column.
                                      */
-    void set_precision(const string &key, const unsigned int precision);
+    void set_precision (const string &key,
+                       const unsigned int precision);
 
                                     /**
                                      * Sets the caption of the column #key#
-                                     * for tex output.
+                                     * for tex output. You may want to chose
+                                     * this different from #key#, if it 
+                                     * contains formulas or similar constructs.
                                      */
-    void set_tex_caption(const string &key, const string &tex_caption);
+    void set_tex_caption (const string &key,
+                         const string &tex_caption);
 
                                     /**
                                      * Sets the caption the the supercolumn
-                                     * #superkey# for tex output.
+                                     * #superkey# for tex output. You may want
+                                     * to chose this different from #superkey#,
+                                     * if it contains formulas or similar
+                                     * constructs.
                                      */
-    void set_tex_supercaption(const string &superkey, const string &tex_supercaption);
+    void set_tex_supercaption (const string &superkey,
+                              const string &tex_supercaption);
 
                                     /**
                                      * Sets the tex output format of a column.
-                                     * e.g. "c", "r", "l".
+                                     * e.g. #c#, #r#, #l#, or #p{3cm}#.
                                      */
-    void set_tex_format(const string &key, const string &format);
+    void set_tex_format (const string &key,
+                        const string &format);
 
                                     /**
                                      * Write table as formatted text, e.g.
@@ -262,11 +279,15 @@ class TableHandler
 
   protected:
 
-
+                                    /**
+                                     * Structure encapsulating all the data
+                                     * that is needed to describe one column
+                                     * of a table.
+                                     */
     struct Column
     {
                                         /**
-                                         * Constructor needed by stl_map.h
+                                         * Constructor needed by STL maps.
                                          */
        Column();
 
@@ -280,6 +301,15 @@ class TableHandler
                                          */
        ~Column();
        
+                                        /**
+                                         * List of entries within this column.
+                                         * They may actually be of very 
+                                         * different type, since we use the
+                                         * templated #TableEntry<T># class
+                                         * for actual values, which is only
+                                         * a wrapper for #T#, but is derived
+                                         * from #TableEntryBase#.
+                                         */
        vector<TableEntryBase *> entries;
        
                                         /**
@@ -306,13 +336,14 @@ class TableHandler
 
                                         /**
                                          * Double or float entries are written with
-                                         * this (by the user set) precision.
+                                         * this precision (set by the user).
                                          * The default is 4.
                                          */
        unsigned int precision;
 
                                         /**
-                                         * Flag that may be used by derived classes.
+                                         * Flag that may be used by derived 
+                                         * classes for arbitrary purposes.
                                          */
        unsigned int flag;
     };
@@ -320,13 +351,14 @@ class TableHandler
                                     /**
                                      * Help function that gives a vector of
                                      * the keys of all columns that are mentioned
-                                     * in column_order, where each supercolumn key
+                                     * in #column_order#, where each supercolumn key
                                      * is replaced by its subcolumn keys.
                                      *
                                      * This function implicitly checks the
-                                     * consistency of the data.
+                                     * consistency of the data. The result is
+                                     * returned in #sel_columns#.
                                      */
-    void get_selected_columns(vector<string> &sel_columns) const;
+    void get_selected_columns (vector<string> &sel_columns) const;
     
                                     /**
                                      * Builtin function, that checks if
@@ -338,8 +370,8 @@ class TableHandler
 
                                     /**
                                      * Stores the column and 
-                                     * supercolumn keys in the user wanted
-                                     * order.
+                                     * supercolumn keys in the order desired
+                                     * by the user.
                                      * By default this is the order of
                                      * adding the columns. This order may be
                                      * changed by #set_column_order(...)#.
@@ -357,6 +389,11 @@ class TableHandler
                                      * the keys of its subcolumns in the right order.
                                      * It is allowed that a supercolumn has got
                                      * the same key as a column.
+                                     *
+                                     * Note that we do not use a #multimap#
+                                     * here since the order of column
+                                     * keys for each supercolumn key is
+                                     * relevant.
                                      */
     map<string, vector<string> > supercolumns;
 
index fdcca355fe818944e334081ee37a74160133eae6..6c33d498c9ae41ba35d68e183f70a12086f6cb85 100644 (file)
@@ -8,10 +8,12 @@
 
 ConvergenceTable::ConvergenceTable():
                n_cells_string("n cells"),
-               n_dofs_string("n dofs")   {}
+               n_dofs_string("n dofs")   
+{}
 
 
-void ConvergenceTable::add_run(unsigned int ncells, unsigned int ndofs)
+void ConvergenceTable::add_run (unsigned int ncells,
+                               unsigned int ndofs)
 {
   add_value(n_cells_string, ncells);
   add_value(n_dofs_string, ndofs);
@@ -43,12 +45,16 @@ void ConvergenceTable::evaluate_convergence_rates(const string &key,
     {
       case standard:
            rate_key+="s";
+                                            // no value availble for the
+                                            // first row
            add_value(rate_key, string("-"));
            for (unsigned int i=1; i<n; ++i)
              add_value(rate_key, values[i-1]/values[i]);
            break;
       case standard_order:
            rate_key+="so";
+                                            // no value availble for the
+                                            // first row
            add_value(rate_key, string("-"));
            for (unsigned int i=1; i<n; ++i)
              add_value(rate_key, log(values[i-1]/values[i])/log(2));
index d3793491b455bf480b9caf9f0c9143f09fd16538..2b8cea75ead0448369787d7bc55f54be1478d540 100644 (file)
@@ -53,20 +53,24 @@ TableHandler::Column::Column(const string &tex_caption):
                tex_caption(tex_caption),
                tex_format("c"),
                precision(4),
-               flag(0)  {}
+               flag(0)  
+{}
 
 
 TableHandler::Column::Column():
                tex_caption(),
                tex_format("c"),
                precision(4),
-               flag(0)  {}
+               flag(0)  
+{}
+
 
 
 TableHandler::Column::~Column()
 {
   for (unsigned int i=0; i<entries.size(); ++i)
     delete entries[i];
+  entries.clear();
 }
 
 /*---------------------------------------------------------------------*/
@@ -77,7 +81,8 @@ TableHandler::TableHandler()
 
 
 template <typename number>
-void TableHandler::add_value(const string &key, number value)
+void TableHandler::add_value (const string &key, 
+                             const number value)
 {
   if (!columns.count(key))
     {
@@ -95,7 +100,8 @@ void TableHandler::add_value(const string &key, number value)
 
 
 
-void TableHandler::add_column_to_supercolumn(const string &key, const string &superkey)
+void TableHandler::add_column_to_supercolumn (const string &key,
+                                             const string &superkey)
 {
   Assert(columns.count(key), ExcColumnNotExistent(key));
 
@@ -139,7 +145,7 @@ void TableHandler::add_column_to_supercolumn(const string &key, const string &su
 
 
 
-void TableHandler::set_column_order(const vector<string> &new_order)
+void TableHandler::set_column_order (const vector<string> &new_order)
 {
   for (unsigned int j=0; j<new_order.size(); ++j)
     Assert(supercolumns.count(new_order[j]) || columns.count(new_order[j]),
@@ -149,14 +155,16 @@ void TableHandler::set_column_order(const vector<string> &new_order)
 }
 
 
-void TableHandler::set_tex_caption(const string &key, const string &tex_caption)
+void TableHandler::set_tex_caption (const string &key, 
+                                   const string &tex_caption)
 {
   Assert(columns.count(key), ExcColumnNotExistent(key));
   columns[key].tex_caption=tex_caption;
 }
 
 
-void TableHandler::set_tex_supercaption(const string &superkey, const string &tex_supercaption)
+void TableHandler::set_tex_supercaption (const string &superkey,
+                                        const string &tex_supercaption)
 {
   Assert(supercolumns.count(superkey), ExcSuperColumnNotExistent(superkey));
   Assert(tex_supercaptions.count(superkey), ExcInternalError());
@@ -164,7 +172,8 @@ void TableHandler::set_tex_supercaption(const string &superkey, const string &te
 }
 
 
-void TableHandler::set_tex_format(const string &key, const string &tex_format)
+void TableHandler::set_tex_format (const string &key,
+                                  const string &tex_format)
 {
   Assert(columns.count(key), ExcColumnNotExistent(key));
   Assert(tex_format=="l" || tex_format=="c" || tex_format=="r",
@@ -172,12 +181,17 @@ void TableHandler::set_tex_format(const string &key, const string &tex_format)
   columns[key].tex_format=tex_format;
 }
 
-void TableHandler::set_precision(const string &key, unsigned int precision)
+
+
+void TableHandler::set_precision (const string &key,
+                                 unsigned int precision)
 {
   Assert(columns.count(key), ExcColumnNotExistent(key));
   columns[key].precision=precision;
 }
 
+
+
 void TableHandler::write_text(ostream &out) const
 {
   vector<string> sel_columns;
@@ -348,8 +362,10 @@ unsigned int TableHandler::check_n_rows() const
   string first_name=col_iter->first;
 
   for (++col_iter; col_iter!=columns.end(); ++col_iter)
-    Assert(col_iter->second.entries.size()==n, ExcWrongNumberOfDataEntries(
-      col_iter->first, col_iter->second.entries.size(), first_name, n));
+    Assert(col_iter->second.entries.size()==n, 
+          ExcWrongNumberOfDataEntries(col_iter->first, 
+                                      col_iter->second.entries.size(), 
+                                      first_name, n));
 
   return n;
 }
@@ -387,6 +403,8 @@ void TableHandler::get_selected_columns(vector<string> &sel_columns) const
 }
 
 
+
+// explicit instantiations
 template class TableEntry<double>;
 template class TableEntry<float>;
 template class TableEntry<int>;
index 5bcdaeb20e3172fd9cb9fb35b9b9cdbc6fe517c3..8b5874a6c6642b86540117cc9d180e4e62c64bfa 100644 (file)
@@ -598,9 +598,9 @@ VectorTools<dim>::interpolate_boundary_values (const DoFHandler<dim> &dof,
 
        for (unsigned int i=0; i<face_dofs.size(); ++i)
          {
-           pair<unsigned int, unsigned int>
+           const pair<unsigned int, unsigned int>
              index = fe.face_system_to_component_index(i);
-           double s = dof_values[i](index.first);
+           const double s = dof_values[i](index.first);
            if (s != HUGE_VAL)
              boundary_values[face_dofs[i]] = s;
          }

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.