16 #ifndef dealii_table_handler_h 17 #define dealii_table_handler_h 20 #include <deal.II/base/config.h> 22 #include <deal.II/base/exceptions.h> 24 #include <boost/serialization/map.hpp> 25 #include <boost/serialization/split_member.hpp> 26 #include <boost/serialization/string.hpp> 27 #include <boost/serialization/vector.hpp> 28 #include <boost/variant.hpp> 37 DEAL_II_NAMESPACE_OPEN
93 cache_string(
bool scientific,
unsigned int precision)
const;
115 template <
class Archive>
117 save(Archive &ar,
const unsigned int version)
const;
123 template <
class Archive>
125 load(Archive &ar,
const unsigned int version);
127 BOOST_SERIALIZATION_SPLIT_MEMBER()
134 variant<int, unsigned int, unsigned long long int, double, std::string>;
146 friend class ::TableHandler;
380 declare_column(
const std::string &key);
388 template <
typename T>
390 add_value(
const std::string &key,
const T
value);
413 set_auto_fill_mode(
const bool state);
428 add_column_to_supercolumn(
const std::string &key,
429 const std::string &superkey);
448 set_column_order(
const std::vector<std::string> &new_order);
456 set_precision(
const std::string &key,
const unsigned int precision);
463 set_scientific(
const std::string &key,
const bool scientific);
471 set_tex_caption(
const std::string &key,
const std::string &tex_caption);
477 set_tex_table_caption(
const std::string &table_caption);
483 set_tex_table_label(
const std::string &table_label);
491 set_tex_supercaption(
const std::string &superkey,
492 const std::string &tex_supercaption);
501 set_tex_format(
const std::string &key,
const std::string &format =
"c");
515 write_text(std::ostream & out,
526 write_tex(std::ostream &file,
const bool with_header =
true)
const;
547 template <
class Archive>
549 serialize(Archive &ar,
const unsigned int version);
561 <<
"Column <" << arg1 <<
"> does not exist.");
568 <<
"Supercolumn <" << arg1 <<
"> does not exist.");
575 <<
"Column or supercolumn <" << arg1 <<
"> does not exist.");
585 <<
"Column <" << arg1 <<
"> has " << arg2
586 <<
" rows, but Column <" << arg3 <<
"> has " << arg4
594 <<
"<" << arg1 <<
"> is not a tex column format. Use " 595 <<
"'l', 'c', or 'r' to indicate left, centered, or " 596 <<
"right aligned text.");
613 Column(
const std::string &tex_caption);
620 pad_column_below(
const unsigned int length);
626 template <
class Archive>
628 save(Archive &ar,
const unsigned int version)
const;
629 template <
class Archive>
631 load(Archive &ar,
const unsigned int version);
632 BOOST_SERIALIZATION_SPLIT_MEMBER()
701 get_selected_columns(std::vector<std::string> &sel_columns)
const;
725 mutable std::map<std::string, Column>
columns;
764 template <
typename T>
770 template <
typename T>
782 return boost::get<T>(
value);
788 "This TableEntry object does not store a datum of type T"));
795 template <
class Archive>
802 if (
const int *p = boost::get<int>(&
value))
807 else if (
const unsigned int *p = boost::get<unsigned int>(&
value))
812 else if (
const double *p = boost::get<double>(&
value))
817 else if (
const std::string *p = boost::get<std::string>(&
value))
822 else if (
const unsigned long long int *p =
823 boost::get<unsigned long long int>(&
value))
834 template <
class Archive>
881 unsigned long long int val;
895 template <
typename T>
900 if (columns.find(key) == columns.end())
903 if (auto_fill_mode ==
true)
907 unsigned int max_col_length = 0;
908 for (std::map<std::string, Column>::iterator p = columns.begin();
912 std::max(max_col_length,
913 static_cast<unsigned int>(p->second.entries.size()));
915 while (columns[key].entries.size() + 1 < max_col_length)
919 entry.
cache_string(columns[key].scientific, columns[key].precision);
920 columns[key].max_length =
921 std::max(columns[key].max_length,
922 static_cast<unsigned int>(
930 entry.
cache_string(columns[key].scientific, columns[key].precision);
931 columns[key].max_length =
932 std::max(columns[key].max_length,
938 template <
class Archive>
942 ar &entries &tex_caption &tex_format &precision &scientific &flag &max_length;
947 template <
class Archive>
949 TableHandler::Column::load(Archive &ar,
const unsigned int )
951 ar &entries &tex_caption &tex_format &precision &scientific &flag &max_length;
956 template <
class Archive>
960 ar &column_order &columns &supercolumns &tex_supercaptions &tex_table_caption
961 &tex_table_label &auto_fill_mode;
965 DEAL_II_NAMESPACE_CLOSE
std::map< std::string, std::string > tex_supercaptions
boost::variant< int, unsigned int, unsigned long long int, double, std::string > value_type
void save(Archive &ar, const unsigned int version) const
std::map< std::string, Column > columns
void add_value(const std::string &key, const T value)
void save(Archive &ar, const unsigned int version) const
void load(Archive &ar, const unsigned int version)
std::vector< std::string > column_order
void cache_string(bool scientific, unsigned int precision) const
static::ExceptionBase & ExcMessage(std::string arg1)
std::string tex_table_caption
#define DeclException1(Exception1, type1, outsequence)
#define Assert(cond, exc)
const std::string & get_cached_string() const
double get_numeric_value() const
#define DeclException4(Exception4, type1, type2, type3, type4, outsequence)
TableEntry get_default_constructed_copy() const
void serialize(Archive &ar, const unsigned int version)
std::vector< internal::TableEntry > entries
std::map< std::string, std::vector< std::string > > supercolumns
std::string tex_table_label
static::ExceptionBase & ExcInternalError()