17 #ifndef __deal2__table_handler_h
18 #define __deal2__table_handler_h
21 #include <deal.II/base/config.h>
31 #include <boost/variant.hpp>
32 #include <boost/serialization/map.hpp>
33 #include <boost/serialization/string.hpp>
34 #include <boost/serialization/vector.hpp>
35 #include <boost/serialization/split_member.hpp>
38 DEAL_II_NAMESPACE_OPEN
90 void cache_string(
bool scientific,
unsigned int precision)
const;
111 template <
class Archive>
112 void save (Archive &ar,
const unsigned int version)
const;
119 template <
class Archive>
120 void load (Archive &ar,
const unsigned int version);
122 BOOST_SERIALIZATION_SPLIT_MEMBER()
128 typedef boost::variant<int,unsigned int,unsigned long long int,double,std::string>
value_type;
140 friend class ::TableHandler;
328 table_with_separate_column_description,
329 simple_table_with_separate_column_description,
348 template <
typename T>
381 const std::string &superkey);
423 const unsigned int precision);
432 const bool scientific);
443 const std::string &tex_caption);
467 const std::string &tex_supercaption);
479 const std::string &format=
"c");
515 void write_tex (std::ostream &file,
const bool with_header=
true)
const;
522 template <
class Archive>
523 void serialize(Archive &ar,
const unsigned int version);
533 <<
"Column <" << arg1 <<
"> does not exist.");
540 <<
"Supercolumn <" << arg1 <<
"> does not exist.");
547 <<
"Column or supercolumn <" << arg1 <<
"> does not exist.");
553 std::string,
int, std::string,
int,
554 <<
"Column <" << arg1 <<
"> has got " << arg2
555 <<
" rows, but Column <" << arg3 <<
"> has got " << arg4 <<
".");
562 <<
"<" << arg1 <<
"> is not a tex column format. Use l,c,r.");
594 template <
class Archive>
595 void save(Archive &ar,
const unsigned int version)
const;
596 template<
class Archive>
597 void load(Archive &ar,
const unsigned int version);
598 BOOST_SERIALIZATION_SPLIT_MEMBER()
700 unsigned int n_rows()
const;
770 template <
typename T>
777 template <
typename T>
788 return boost::get<T>(
value);
792 Assert(
false,
ExcMessage (
"This TableEntry object does not store a datum of type T"));
799 template <
class Archive>
801 const unsigned int)
const
806 if (
const int *p = boost::get<int>(&
value))
811 else if (
const unsigned int *p = boost::get<unsigned int>(&
value))
816 else if (
const double *p = boost::get<double>(&
value))
821 else if (
const std::string *p = boost::get<std::string>(&
value))
832 template <
class Archive>
883 template <
typename T>
890 std::pair<std::string, Column> new_column(key,
Column(key));
900 for (std::map< std::string, Column >::iterator p =
columns.begin(); p !=
columns.end(); ++p)
901 n = (n >= p->second.entries.size() ? n : p->second.entries.size());
903 while (
columns[key].entries.size()+1 < n)
920 template <
class Archive>
931 template<
class Archive>
933 TableHandler::Column::load(Archive &ar,
const unsigned int version)
935 ar &entries &tex_caption
936 & tex_format &precision
944 template <
class Archive>
957 DEAL_II_NAMESPACE_CLOSE
std::map< std::string, std::string > tex_supercaptions
void set_precision(const std::string &key, const unsigned int precision)
void save(Archive &ar, const unsigned int version) const
void set_tex_supercaption(const std::string &superkey, const std::string &tex_supercaption)
::ExceptionBase & ExcMessage(std::string arg1)
void add_value(const std::string &key, const T value)
void set_tex_caption(const std::string &key, const std::string &tex_caption)
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 save(Archive &ar, const unsigned int version) const
void get_selected_columns(std::vector< std::string > &sel_columns) const
void load(Archive &ar, const unsigned int version)
DeclException4(ExcWrongNumberOfDataEntries, std::string, int, std::string, int,<< "Column <"<< arg1<< "> has got "<< arg2<< " rows, but Column <"<< arg3<< "> has got "<< arg4<< ".")
std::vector< std::string > column_order
void cache_string(bool scientific, unsigned int precision) const
std::string tex_table_caption
const std::string & get_cached_string() const
#define Assert(cond, exc)
void write_tex(std::ostream &file, const bool with_header=true) const
void set_tex_table_label(const std::string &table_label)
DeclException1(ExcColumnNotExistent, std::string,<< "Column <"<< arg1<< "> does not exist.")
boost::variant< int, unsigned int, unsigned long long int, double, std::string > value_type
double get_numeric_value() const
void set_column_order(const std::vector< std::string > &new_order)
unsigned int n_rows() const
void set_scientific(const std::string &key, const bool scientific)
void pad_column_below(const unsigned int length)
TableEntry get_default_constructed_copy() const
void serialize(Archive &ar, const unsigned int version)
std::vector< internal::TableEntry > entries
std::map< std::string, Column > columns
void set_tex_table_caption(const std::string &table_caption)
::ExceptionBase & ExcInternalError()
std::map< std::string, std::vector< std::string > > supercolumns
void write_text(std::ostream &out, const TextOutputFormat format=table_with_headers) const
std::string tex_table_label
void set_auto_fill_mode(const bool state)