From 1b05aed003a7009074a0351619c6d17b4fd02e47 Mon Sep 17 00:00:00 2001 From: heister Date: Sun, 16 Sep 2012 16:21:18 +0000 Subject: [PATCH] consistent output of super-columns in TableHandler::write_text() git-svn-id: https://svn.dealii.org/trunk@26405 0785d39b-7218-0410-832d-ea1e28bc413d --- deal.II/doc/news/changes.h | 5 ++ deal.II/source/base/table_handler.cc | 119 ++++++++++++++++++--------- 2 files changed, 86 insertions(+), 38 deletions(-) diff --git a/deal.II/doc/news/changes.h b/deal.II/doc/news/changes.h index 1be62f78c9..ae1c0a599b 100644 --- a/deal.II/doc/news/changes.h +++ b/deal.II/doc/news/changes.h @@ -53,6 +53,11 @@ DoFHandler, in particular removal of specializations.

Specific improvements

    +
  1. Fixed: output of super-columns in TableHandler::write_text() +was inconsistent. This is now fixed. +
    +(Timo Heister, 2012/09/16) +
  2. Changed: Due to incompatibilties with some hdf5 packages installed from repositories we disable auto-detection of hdf5. Use --with-hdf if you need it.
    diff --git a/deal.II/source/base/table_handler.cc b/deal.II/source/base/table_handler.cc index 0c5fc8490e..674651b356 100644 --- a/deal.II/source/base/table_handler.cc +++ b/deal.II/source/base/table_handler.cc @@ -345,9 +345,9 @@ void TableHandler::write_text(std::ostream &out, if (format==simple_table_with_separate_column_description) { // write the captions - for (unsigned int j=0; jsecond)); - switch (format) - { - case table_with_headers: - column_widths[j] = std::max(col_iter->second.max_length, static_cast(key.length())); - break; - default: - column_widths[j] = col_iter->second.max_length; - } + column_widths[j] = col_iter->second.max_length; } - // write the captions - for (unsigned int j=0; j >::const_iterator + super_iter=supercolumns.find(key); + if (super_iter!=supercolumns.end()) + { + const unsigned int n_subcolumns=super_iter->second.size(); + for (unsigned int k=0; k::const_iterator + col_iter=columns.find(super_iter->second[k]); + Assert(col_iter!=columns.end(), ExcInternalError()); + + width += col_iter->second.max_length; + } + width += n_subcolumns - 1; // separators between subcolumns + } + else + { + const std::map::const_iterator + col_iter=columns.find(key); + + width = col_iter->second.max_length; + } + } + + // header is longer than the column(s) under it + if (width >::const_iterator + super_iter=supercolumns.find(key); + if (super_iter!=supercolumns.end()) + colname = super_iter->second.back(); + else + colname = key; + + // find column and change output width + for (unsigned int i=0;i