15#ifndef dealii_table_handler_h
16#define dealii_table_handler_h
23#include <boost/serialization/map.hpp>
24#include <boost/serialization/split_member.hpp>
25#include <boost/serialization/string.hpp>
26#include <boost/serialization/vector.hpp>
95 cache_string(
bool scientific,
unsigned int precision)
const;
118 template <
class Archive>
120 save(Archive &ar,
const unsigned int version)
const;
127 template <
class Archive>
129 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 std::variant<int, unsigned int, std::uint64_t, double, std::string>;
163 friend class ::TableHandler;
410 template <
typename T>
412 add_value(
const std::string &key,
const T value);
451 const std::string &superkey);
478 set_precision(
const std::string &key,
const unsigned int precision);
493 set_tex_caption(
const std::string &key,
const std::string &tex_caption);
514 const std::string &tex_supercaption);
523 set_tex_format(
const std::string &key,
const std::string &format =
"c");
548 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.");
650 template <
class Archive>
652 save(Archive &ar,
const unsigned int version)
const;
659 template <
class Archive>
661 load(Archive &ar,
const unsigned int version);
669 template <
class Archive>
671 serialize(Archive &archive,
const unsigned int version);
675 BOOST_SERIALIZATION_SPLIT_MEMBER()
769 mutable std::map<std::string, Column>
columns;
808 template <
typename T>
814 template <
typename T>
826 return std::get<T>(
value);
832 "This TableEntry object does not store a datum of type T"));
839 template <
class Archive>
846 if (std::holds_alternative<int>(
value))
848 const int p = std::get<int>(
value);
852 else if (std::holds_alternative<unsigned int>(
value))
854 const unsigned int p = std::get<unsigned int>(
value);
858 else if (std::holds_alternative<double>(
value))
860 const double p = std::get<double>(
value);
864 else if (std::holds_alternative<std::string>(
value))
866 const std::string p = std::get<std::string>(
value);
870 else if (std::holds_alternative<std::uint64_t>(
value))
872 const std::uint64_t p = std::get<std::uint64_t>(
value);
882 template <
class Archive>
955 unsigned int max_col_length = 0;
956 for (
const auto &column :
columns)
959 static_cast<unsigned int>(column.second.entries.size()));
961 while (
columns[key].entries.size() + 1 < max_col_length)
968 static_cast<unsigned int>(
984template <
class Archive>
993template <
class Archive>
997 ar &entries &tex_caption &tex_format &precision &scientific &flag &max_length;
1002template <
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 & ExcColumnOrSuperColumnNotExistent(std::string arg1)
#define DeclException1(Exception1, type1, outsequence)
static ::ExceptionBase & ExcMessage(std::string arg1)
#define DEAL_II_ASSERT_UNREACHABLE()
::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
std::variant< int, unsigned int, std::uint64_t, double, std::string > value_type
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