<h3>Specific improvements</h3>
<ol>
+<li> New: TableHandler TextOutputFormat::simple_table_with_separate_column_description
+that skips aligning the columns for increased performance.
+<br>
+(Timo Heister, 2012/09/10)
+
<li> Fixed: The Clang C++ compiler had some trouble dealing with obtaining
the return value of a Threads::Task object, due to a compiler bug in
dealing with friend declarations. This is now fixed.
* 2 13 a
* 1 0 ""
* @endcode
+ * - <code>simple_table_with_separate_column_description</code>: This format
+ * is very similar to <code>table_with_separate_column_description</code>,
+ * but it skips aligning the columns with additional white space. This
+ * increases the performance o fwrite_text() for large tables. Example output:
+ * @code
+ * # 1: key1
+ * # 2: key2
+ * # 3: key3
+ * 0 0 ""
+ * 1 0 ""
+ * 2 13 a
+ * 1 0 ""
+ * @endcode
+ *
**/
enum TextOutputFormat
{
table_with_headers,
- table_with_separate_column_description
+ table_with_separate_column_description,
+ simple_table_with_separate_column_description,
};
/**
const unsigned int nrows = n_rows();
const unsigned int n_cols = sel_columns.size();
+ // handle the simple format separately first
+ if (format==simple_table_with_separate_column_description)
+ {
+ // write the captions
+ for (unsigned int j=0; j<column_order.size(); ++j)
+ {
+ const std::string & key = column_order[j];
+ out << "# " << j+1 << ": " << key << '\n';
+ }
+
+ // cache the columns
+ std::vector<const Column*> cols;
+ for (unsigned int j=0; j<n_cols; ++j)
+ {
+ std::string key=sel_columns[j];
+ const std::map<std::string, Column>::const_iterator
+ col_iter=columns.find(key);
+ Assert(col_iter!=columns.end(), ExcInternalError());
+ cols.push_back(&(col_iter->second));
+ }
+
+ // write the body
+ for (unsigned int i=0; i<nrows; ++i)
+ {
+ for (unsigned int j=0; j<n_cols; ++j)
+ {
+ const Column &column=*(cols[j]);
+
+ out << std::setprecision(column.precision);
+
+ if (column.scientific)
+ out.setf(std::ios::scientific, std::ios::floatfield);
+ else
+ out.setf(std::ios::fixed, std::ios::floatfield);
+
+ // write "" instead of an empty string
+ const std::string * val = boost::get<std::string>(&(column.entries[i].value));
+ if (val!=NULL && val->length()==0)
+ out << "\"\"";
+ else
+ out << column.entries[i].value;
+
+ out << ' ';
+ }
+ out << '\n';
+ }
+
+ out << std::flush;
+ return;
+ }
+
// first compute the widths of each
// entry of the table, in order to
- // have a nicer alignement
+ // have a nicer alignment
Table<2,unsigned int> entry_widths (nrows, n_cols);
for (unsigned int i=0; i<nrows; ++i)
for (unsigned int j=0; j<n_cols; ++j)
}
}
if (format == table_with_headers)
- out << std::endl;
+ out << '\n';
for (unsigned int i=0; i<nrows; ++i)
{