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>
96 cache_string(
bool scientific,
unsigned int precision)
const;
119 template <
class Archive>
121 save(Archive &ar,
const unsigned int version)
const;
128 template <
class Archive>
130 load(Archive &ar,
const unsigned int version);
138 template <
class Archive>
140 serialize(Archive &archive,
const unsigned int version);
144 BOOST_SERIALIZATION_SPLIT_MEMBER()
152 std_cxx17::variant<int, unsigned int, std::uint64_t, double, std::string>;
164 friend class ::TableHandler;
411 template <
typename T>
413 add_value(
const std::string &key,
const T value);
452 const std::string &superkey);
479 set_precision(
const std::string &key,
const unsigned int precision);
494 set_tex_caption(
const std::string &key,
const std::string &tex_caption);
515 const std::string &tex_supercaption);
524 set_tex_format(
const std::string &key,
const std::string &format =
"c");
549 write_tex(std::ostream &file,
const bool with_header =
true)
const;
571 template <
class Archive>
573 serialize(Archive &ar,
const unsigned int version);
585 <<
"Column <" << arg1 <<
"> does not exist.");
592 <<
"Supercolumn <" << arg1 <<
"> does not exist.");
599 <<
"Column or supercolumn <" << arg1 <<
"> does not exist.");
609 <<
"Column <" << arg1 <<
"> has " << arg2
610 <<
" rows, but Column <" << arg3 <<
"> has " << arg4
618 <<
'<' << arg1 <<
"> is not a tex column format. Use "
619 <<
"'l', 'c', or 'r' to indicate left, centered, or "
620 <<
"right aligned text.");
651 template <
class Archive>
653 save(Archive &ar,
const unsigned int version)
const;
660 template <
class Archive>
662 load(Archive &ar,
const unsigned int version);
670 template <
class Archive>
672 serialize(Archive &archive,
const unsigned int version);
676 BOOST_SERIALIZATION_SPLIT_MEMBER()
770 mutable std::map<std::string, Column>
columns;
809 template <
typename T>
815 template <
typename T>
827 return std_cxx17::get<T>(
value);
833 "This TableEntry object does not store a datum of type T"));
840 template <
class Archive>
847 if (std_cxx17::holds_alternative<int>(
value))
849 const int p = std_cxx17::get<int>(
value);
853 else if (std_cxx17::holds_alternative<unsigned int>(
value))
855 const unsigned int p = std_cxx17::get<unsigned int>(
value);
859 else if (std_cxx17::holds_alternative<double>(
value))
861 const double p = std_cxx17::get<double>(
value);
865 else if (std_cxx17::holds_alternative<std::string>(
value))
867 const std::string p = std_cxx17::get<std::string>(
value);
871 else if (std_cxx17::holds_alternative<std::uint64_t>(
value))
873 const std::uint64_t p = std_cxx17::get<std::uint64_t>(
value);
883 template <
class Archive>
956 unsigned int max_col_length = 0;
957 for (
const auto &column :
columns)
960 static_cast<unsigned int>(column.second.entries.size()));
962 while (
columns[key].entries.size() + 1 < max_col_length)
969 static_cast<unsigned int>(
985template <
class Archive>
994template <
class Archive>
998 ar &entries &tex_caption &tex_format &precision &scientific &flag &max_length;
1003template <
class Archive>
void set_tex_format(const std::string &key, const std::string &format="c")
void set_tex_table_caption(const std::string &table_caption)
void set_tex_supercaption(const std::string &superkey, const std::string &tex_supercaption)
void serialize(Archive &ar, const unsigned int version)
void declare_column(const std::string &key)
void write_text(std::ostream &out, const TextOutputFormat format=table_with_headers) const
void set_auto_fill_mode(const bool state)
void add_value(const std::string &key, const T value)
unsigned int n_rows() const
void get_selected_columns(std::vector< std::string > &sel_columns) const
std::map< std::string, std::vector< std::string > > supercolumns
@ simple_table_with_separate_column_description
@ table_with_separate_column_description
std::map< std::string, std::string > tex_supercaptions
std::string tex_table_label
std::string tex_table_caption
void write_tex(std::ostream &file, const bool with_header=true) const
void add_column_to_supercolumn(const std::string &key, const std::string &superkey)
void set_column_order(const std::vector< std::string > &new_order)
void set_tex_caption(const std::string &key, const std::string &tex_caption)
void set_scientific(const std::string &key, const bool scientific)
std::vector< std::string > column_order
void set_tex_table_label(const std::string &table_label)
void set_precision(const std::string &key, const unsigned int precision)
std::map< std::string, Column > columns
#define DEAL_II_NAMESPACE_OPEN
#define DEAL_II_NAMESPACE_CLOSE
static ::ExceptionBase & ExcSuperColumnNotExistent(std::string arg1)
static ::ExceptionBase & ExcWrongNumberOfDataEntries(std::string arg1, int arg2, std::string arg3, int arg4)
static ::ExceptionBase & ExcColumnNotExistent(std::string arg1)
#define DeclException4(Exception4, type1, type2, type3, type4, outsequence)
#define Assert(cond, exc)
static ::ExceptionBase & ExcUndefinedTexFormat(std::string arg1)
static ::ExceptionBase & ExcInternalError()
static ::ExceptionBase & ExcColumnOrSuperColumnNotExistent(std::string arg1)
#define DeclException1(Exception1, type1, outsequence)
static ::ExceptionBase & ExcMessage(std::string arg1)
::VectorizedArray< Number, width > max(const ::VectorizedArray< Number, width > &, const ::VectorizedArray< Number, width > &)
void pad_column_below(const unsigned int length)
void serialize(Archive &archive, const unsigned int version)
void save(Archive &ar, const unsigned int version) const
void load(Archive &ar, const unsigned int version)
std::vector< internal::TableEntry > entries
void serialize(Archive &archive, const unsigned int version)
TableEntry get_default_constructed_copy() const
void load(Archive &ar, const unsigned int version)
void save(Archive &ar, const unsigned int version) const
const std::string & get_cached_string() const
double get_numeric_value() const
void cache_string(bool scientific, unsigned int precision) const
std_cxx17::variant< int, unsigned int, std::uint64_t, double, std::string > value_type