16 #ifndef dealii_table_handler_h 17 #define dealii_table_handler_h 20 #include <deal.II/base/config.h> 21 #include <deal.II/base/exceptions.h> 30 #include <boost/variant.hpp> 31 #include <boost/serialization/map.hpp> 32 #include <boost/serialization/string.hpp> 33 #include <boost/serialization/vector.hpp> 34 #include <boost/serialization/split_member.hpp> 37 DEAL_II_NAMESPACE_OPEN
90 void cache_string(
bool scientific,
unsigned int precision)
const;
110 template <
class Archive>
111 void save (Archive &ar,
const unsigned int version)
const;
117 template <
class Archive>
118 void load (Archive &ar,
const unsigned int version);
120 BOOST_SERIALIZATION_SPLIT_MEMBER()
126 typedef boost::variant<int,unsigned int,unsigned long long int,double,std::string>
value_type;
138 friend class ::TableHandler;
379 template <
typename T>
417 const std::string &superkey);
443 const unsigned int precision);
450 const bool scientific);
458 const std::string &tex_caption);
476 const std::string &tex_supercaption);
485 const std::string &format=
"c");
508 void write_tex (std::ostream &file,
const bool with_header=
true)
const;
527 template <
class Archive>
528 void serialize(Archive &ar,
const unsigned int version);
540 <<
"Column <" << arg1 <<
"> does not exist.");
547 <<
"Supercolumn <" << arg1 <<
"> does not exist.");
554 <<
"Column or supercolumn <" << arg1 <<
"> does not exist.");
560 std::string,
int, std::string,
int,
561 <<
"Column <" << arg1 <<
"> has " << arg2
562 <<
" rows, but Column <" << arg3 <<
"> has " << arg4 <<
" rows.");
569 <<
"<" << arg1 <<
"> is not a tex column format. Use " 570 <<
"'l', 'c', or 'r' to indicate left, centered, or " 571 <<
"right aligned text.");
601 template <
class Archive>
602 void save(Archive &ar,
const unsigned int version)
const;
603 template <
class Archive>
604 void load(Archive &ar,
const unsigned int version);
605 BOOST_SERIALIZATION_SPLIT_MEMBER()
679 unsigned int n_rows()
const;
734 template <
typename T>
741 template <
typename T>
752 return boost::get<T>(
value);
756 Assert(
false,
ExcMessage (
"This TableEntry object does not store a datum of type T"));
763 template <
class Archive>
765 const unsigned int)
const 770 if (
const int *p = boost::get<int>(&
value))
775 else if (
const unsigned int *p = boost::get<unsigned int>(&
value))
780 else if (
const double *p = boost::get<double>(&
value))
785 else if (
const std::string *p = boost::get<std::string>(&
value))
790 else if (
const unsigned long long int *p = boost::get<unsigned long long int>(&
value))
801 template <
class Archive>
848 unsigned long long int val;
862 template <
typename T>
874 unsigned int max_col_length = 0;
875 for (std::map< std::string, Column >::iterator p =
columns.begin(); p !=
columns.end(); ++p)
876 max_col_length = std::max(max_col_length,
877 static_cast<unsigned int>(p->second.entries.size()));
879 while (
columns[key].entries.size()+1 < max_col_length)
898 template <
class Archive>
911 template <
class Archive>
913 TableHandler::Column::load(Archive &ar,
const unsigned int )
915 ar &entries &tex_caption
916 & tex_format &precision
924 template <
class Archive>
937 DEAL_II_NAMESPACE_CLOSE
std::map< std::string, std::string > tex_supercaptions
void set_precision(const std::string &key, const unsigned int precision)
void declare_column(const std::string &key)
void save(Archive &ar, const unsigned int version) const
void set_tex_supercaption(const std::string &superkey, const std::string &tex_supercaption)
static ::ExceptionBase & ExcColumnOrSuperColumnNotExistent(std::string arg1)
void add_value(const std::string &key, const T value)
const std::string & get_cached_string() const
void set_tex_caption(const std::string &key, const std::string &tex_caption)
void cache_string(bool scientific, unsigned int precision) const
void add_column_to_supercolumn(const std::string &key, const std::string &superkey)
void set_tex_format(const std::string &key, const std::string &format="c")
void get_selected_columns(std::vector< std::string > &sel_columns) const
static ::ExceptionBase & ExcSuperColumnNotExistent(std::string arg1)
static ::ExceptionBase & ExcWrongNumberOfDataEntries(std::string arg1, int arg2, std::string arg3, int arg4)
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)
void write_text(std::ostream &out, const TextOutputFormat format=table_with_headers) const
#define Assert(cond, exc)
void save(Archive &ar, const unsigned int version) const
void set_tex_table_label(const std::string &table_label)
void write_tex(std::ostream &file, const bool with_header=true) const
boost::variant< int, unsigned int, unsigned long long int, double, std::string > value_type
static ::ExceptionBase & ExcUndefinedTexFormat(std::string arg1)
void set_column_order(const std::vector< std::string > &new_order)
void set_scientific(const std::string &key, const bool scientific)
void pad_column_below(const unsigned int length)
#define DeclException4(Exception4, type1, type2, type3, type4, outsequence)
static ::ExceptionBase & ExcColumnNotExistent(std::string arg1)
void serialize(Archive &ar, const unsigned int version)
std::vector< internal::TableEntry > entries
std::map< std::string, Column > columns
unsigned int n_rows() const
void set_tex_table_caption(const std::string &table_caption)
std::map< std::string, std::vector< std::string > > supercolumns
std::string tex_table_label
static ::ExceptionBase & ExcInternalError()
void set_auto_fill_mode(const bool state)