From: hartmann Date: Mon, 3 Jan 2000 17:09:44 +0000 (+0000) Subject: add flag for scientific or fixed point notation X-Git-Url: https://gitweb.dealii.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=b7cc373fc55a31a57db54a7b00c184ff947768ec;p=dealii-svn.git add flag for scientific or fixed point notation git-svn-id: https://svn.dealii.org/trunk@2156 0785d39b-7218-0410-832d-ea1e28bc413d --- diff --git a/deal.II/base/include/base/table_handler.h b/deal.II/base/include/base/table_handler.h index cf3fc1a742..ac7af6fbf8 100644 --- a/deal.II/base/include/base/table_handler.h +++ b/deal.II/base/include/base/table_handler.h @@ -226,6 +226,14 @@ class TableHandler void set_precision (const string &key, const unsigned int precision); + /** + * Sets the #scientific_flag#. True means + * scientific, false means fixed point + * notation. + */ + void set_scientific (const string &key, + bool scientific); + /** * Sets the caption of the column #key# * for tex output. You may want to chose @@ -366,6 +374,12 @@ class TableHandler */ unsigned int precision; + /** + * #scientific#=false means fixed + * point notation. + */ + bool scientific; + /** * Flag that may be used by derived * classes for arbitrary purposes. diff --git a/deal.II/base/source/table_handler.cc b/deal.II/base/source/table_handler.cc index 3d5f3aebce..fbf8b694f8 100644 --- a/deal.II/base/source/table_handler.cc +++ b/deal.II/base/source/table_handler.cc @@ -5,6 +5,7 @@ #include +#include #include @@ -53,6 +54,7 @@ TableHandler::Column::Column(const string &tex_caption): tex_caption(tex_caption), tex_format("c"), precision(4), + scientific(0), flag(0) {} @@ -61,6 +63,7 @@ TableHandler::Column::Column(): tex_caption(), tex_format("c"), precision(4), + scientific(0), flag(0) {} @@ -192,6 +195,15 @@ void TableHandler::set_precision (const string &key, +void TableHandler::set_scientific (const string &key, + bool scientific) +{ + Assert(columns.count(key), ExcColumnNotExistent(key)); + columns[key].scientific=scientific; +} + + + void TableHandler::write_text(ostream &out) const { vector sel_columns; @@ -235,6 +247,11 @@ void TableHandler::write_text(ostream &out) const const Column &column=col_iter->second; out << setprecision(column.precision); + + if (col_iter->second.scientific) + out.setf(ios::scientific, ios::floatfield); + else + out.setf(ios::fixed, ios::floatfield); column.entries[i]->write_tex(out); if (jsecond; out << setprecision(column.precision); + + if (col_iter->second.scientific) + out.setf(ios::scientific, ios::floatfield); + else + out.setf(ios::fixed, ios::floatfield); + column.entries[i]->write_tex(out); if (j