16 #ifndef dealii_table_handler_h 17 #define dealii_table_handler_h 25 #include <boost/serialization/map.hpp> 26 #include <boost/serialization/split_member.hpp> 27 #include <boost/serialization/string.hpp> 28 #include <boost/serialization/vector.hpp> 29 #include <boost/variant.hpp> 98 cache_string(
bool scientific,
unsigned int precision)
const;
120 template <
class Archive>
122 save(Archive &ar,
const unsigned int version)
const;
128 template <
class Archive>
130 load(Archive &ar,
const unsigned int version);
137 template <
class Archive>
139 serialize(Archive &archive,
const unsigned int version);
143 BOOST_SERIALIZATION_SPLIT_MEMBER()
151 boost::variant<int, unsigned int, std::uint64_t, double, std::string>;
163 friend class ::TableHandler;
403 declare_column(
const std::string &key);
411 template <
typename T>
413 add_value(
const std::string &key,
const T value);
436 set_auto_fill_mode(
const bool state);
451 add_column_to_supercolumn(
const std::string &key,
452 const std::string &superkey);
471 set_column_order(
const std::vector<std::string> &new_order);
479 set_precision(
const std::string &key,
const unsigned int precision);
486 set_scientific(
const std::string &key,
const bool scientific);
494 set_tex_caption(
const std::string &key,
const std::string &tex_caption);
500 set_tex_table_caption(
const std::string &table_caption);
506 set_tex_table_label(
const std::string &table_label);
514 set_tex_supercaption(
const std::string &superkey,
515 const std::string &tex_supercaption);
524 set_tex_format(
const std::string &key,
const std::string &format =
"c");
538 write_text(std::ostream & out,
549 write_tex(std::ostream &file,
const bool with_header =
true)
const;
570 template <
class Archive>
572 serialize(Archive &ar,
const unsigned int version);
584 <<
"Column <" << arg1 <<
"> does not exist.");
591 <<
"Supercolumn <" << arg1 <<
"> does not exist.");
598 <<
"Column or supercolumn <" << arg1 <<
"> does not exist.");
608 <<
"Column <" << arg1 <<
"> has " << arg2
609 <<
" rows, but Column <" << arg3 <<
"> has " << arg4
617 <<
"<" << arg1 <<
"> is not a tex column format. Use " 618 <<
"'l', 'c', or 'r' to indicate left, centered, or " 619 <<
"right aligned text.");
636 Column(
const std::string &tex_caption);
643 pad_column_below(
const unsigned int length);
649 template <
class Archive>
651 save(Archive &ar,
const unsigned int version)
const;
657 template <
class Archive>
659 load(Archive &ar,
const unsigned int version);
666 template <
class Archive>
668 serialize(Archive &archive,
const unsigned int version);
672 BOOST_SERIALIZATION_SPLIT_MEMBER()
742 get_selected_columns(std::vector<std::string> &sel_columns)
const;
766 mutable std::map<std::string, Column>
columns;
805 template <
typename T>
811 template <
typename T>
823 return boost::get<T>(
value);
829 "This TableEntry object does not store a datum of type T"));
836 template <
class Archive>
843 if (
const int *p = boost::get<int>(&
value))
848 else if (
const unsigned int *p = boost::get<unsigned int>(&
value))
853 else if (
const double *p = boost::get<double>(&
value))
858 else if (
const std::string *p = boost::get<std::string>(&
value))
863 else if (
const std::uint64_t *p = boost::get<std::uint64_t>(&
value))
874 template <
class Archive>
935 template <
typename T>
940 if (columns.find(key) == columns.end())
943 if (auto_fill_mode ==
true)
947 unsigned int max_col_length = 0;
948 for (
const auto &column : columns)
951 static_cast<unsigned int>(column.second.entries.size()));
953 while (columns[key].entries.size() + 1 < max_col_length)
957 entry.
cache_string(columns[key].scientific, columns[key].precision);
958 columns[key].max_length =
960 static_cast<unsigned int>(
968 entry.
cache_string(columns[key].scientific, columns[key].precision);
969 columns[key].max_length =
976 template <
class Archive>
980 ar &entries &tex_caption &tex_format &precision &scientific &flag &max_length;
985 template <
class Archive>
989 ar &entries &tex_caption &tex_format &precision &scientific &flag &max_length;
994 template <
class Archive>
998 ar &column_order &columns &supercolumns &tex_supercaptions &tex_table_caption
999 &tex_table_label &auto_fill_mode;
std::map< std::string, std::string > tex_supercaptions
void save(Archive &ar, const unsigned int version) const
void serialize(Archive &archive, const unsigned int version)
std::map< std::string, Column > columns
void add_value(const std::string &key, const T value)
const std::string & get_cached_string() const
void cache_string(bool scientific, unsigned int precision) const
#define DEAL_II_DISABLE_EXTRA_DIAGNOSTICS
void load(Archive &ar, const unsigned int version)
std::vector< std::string > column_order
static ::ExceptionBase & ExcMessage(std::string arg1)
std::string tex_table_caption
double get_numeric_value() const
TableEntry get_default_constructed_copy() const
#define DeclException1(Exception1, type1, outsequence)
#define Assert(cond, exc)
void save(Archive &ar, const unsigned int version) const
#define DEAL_II_NAMESPACE_CLOSE
boost::variant< int, unsigned int, std::uint64_t, double, std::string > value_type
#define DEAL_II_ENABLE_EXTRA_DIAGNOSTICS
#define DEAL_II_NAMESPACE_OPEN
#define DeclException4(Exception4, type1, type2, type3, type4, outsequence)
void serialize(Archive &ar, const unsigned int version)
std::vector< internal::TableEntry > entries
std::map< std::string, std::vector< std::string > > supercolumns
T max(const T &t, const MPI_Comm &mpi_communicator)
std::string tex_table_label
static ::ExceptionBase & ExcInternalError()
void load(Archive &ar, const unsigned int version)