From: Wolfgang Bangerth Date: Sun, 11 Jul 1999 21:15:27 +0000 (+0000) Subject: Cosmetic changes. X-Git-Tag: v8.0.0~21761 X-Git-Url: https://gitweb.dealii.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=c93595a2124936c9fbab927bb5cfee2c1043d038;p=dealii.git Cosmetic changes. git-svn-id: https://svn.dealii.org/trunk@1568 0785d39b-7218-0410-832d-ea1e28bc413d --- diff --git a/deal.II/base/include/base/convergence_table.h b/deal.II/base/include/base/convergence_table.h index c01373b62d..7a7ceffd71 100644 --- a/deal.II/base/include/base/convergence_table.h +++ b/deal.II/base/include/base/convergence_table.h @@ -10,21 +10,21 @@ /** * 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 not standard 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 diff --git a/deal.II/base/include/base/table_handler.h b/deal.II/base/include/base/table_handler.h index 27ccb2ef3e..2ca890170a 100644 --- a/deal.II/base/include/base/table_handler.h +++ b/deal.II/base/include/base/table_handler.h @@ -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# with not common value - * type overload the output function. - * This class is not to be used by the user. + * a #TableEntry# 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 - 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 &new_order); + void set_column_order (const vector &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# class + * for actual values, which is only + * a wrapper for #T#, but is derived + * from #TableEntryBase#. + */ vector 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 &sel_columns) const; + void get_selected_columns (vector &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 > supercolumns; diff --git a/deal.II/base/source/convergence_table.cc b/deal.II/base/source/convergence_table.cc index fdcca355fe..6c33d498c9 100644 --- a/deal.II/base/source/convergence_table.cc +++ b/deal.II/base/source/convergence_table.cc @@ -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 -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 &new_order) +void TableHandler::set_column_order (const vector &new_order) { for (unsigned int j=0; j &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 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 &sel_columns) const } + +// explicit instantiations template class TableEntry; template class TableEntry; template class TableEntry; diff --git a/deal.II/deal.II/source/numerics/vectors.cc b/deal.II/deal.II/source/numerics/vectors.cc index 5bcdaeb20e..8b5874a6c6 100644 --- a/deal.II/deal.II/source/numerics/vectors.cc +++ b/deal.II/deal.II/source/numerics/vectors.cc @@ -598,9 +598,9 @@ VectorTools::interpolate_boundary_values (const DoFHandler &dof, for (unsigned int i=0; i + const pair 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; }