https://mooseframework.inl.gov
Loading...
Searching...
No Matches
Namespaces | Functions | Variables
FormattedTable.C File Reference

Go to the source code of this file.

Namespaces

namespace  gnuplot
 

Functions

template<>
void dataStore (std::ostream &stream, FormattedTable &table, void *context)
 
template<>
void dataLoad (std::istream &stream, FormattedTable &table, void *context)
 
template<>
void dataStore (std::ostream &stream, std::shared_ptr< TableValueBase > &value_base, void *context)
 
template<>
void dataLoad (std::istream &stream, std::shared_ptr< TableValueBase > &value_base, void *context)
 
std::ostream & operator<< (std::ostream &os, const TableValueBase &value)
 

Variables

const unsigned short DEFAULT_CSV_PRECISION = 14
 
const std::string DEFAULT_CSV_DELIMITER = ","
 
const std::string gnuplot::before_terminal = "set terminal "
 
const std::string gnuplot::before_ext = "\nset output 'all"
 
const std::string gnuplot::after_ext
 

Function Documentation

◆ dataLoad() [1/2]

template<>
void dataLoad ( std::istream &  stream,
FormattedTable table,
void *  context 
)

Definition at line 39 of file FormattedTable.C.

40{
41 loadHelper(stream, table._data, context);
42 loadHelper(stream, table._align_widths, context);
43 loadHelper(stream, table._column_names, context);
44 loadHelper(stream, table._output_row_index, context);
45 loadHelper(stream, table._headers_output, context);
46}
void loadHelper(std::istream &stream, P &data, void *context)
Scalar helper routine.
Definition DataIO.h:1081
bool _headers_output
Keeps track of whether the header has been output.
std::size_t _output_row_index
Keeps track of the index indicating which vector elements have been output.
std::map< std::string, unsigned int > _align_widths
Alignment widths (only used if asked to print aligned to CSV output)
std::vector< std::pair< Real, std::map< std::string, std::shared_ptr< TableValueBase > > > > _data
Data structure for the console table: The first part of the pair tracks the independent variable (nor...
std::vector< std::string > _column_names
The set of column names updated when data is inserted through the setter methods.

Referenced by dataLoad(), and TableValue< T >::load().

◆ dataLoad() [2/2]

template<>
void dataLoad ( std::istream &  stream,
std::shared_ptr< TableValueBase > &  value_base,
void *  context 
)

Definition at line 57 of file FormattedTable.C.

58{
59 std::string type;
60 dataLoad(stream, type, context);
61 if (type == typeid(bool).name())
62 TableValue<bool>::load(stream, value_base, context);
63
64 else if (type == typeid(unsigned short int).name())
65 TableValue<unsigned short int>::load(stream, value_base, context);
66
67 else if (type == typeid(unsigned int).name())
68 TableValue<unsigned int>::load(stream, value_base, context);
69
70 else if (type == typeid(unsigned long int).name())
71 TableValue<unsigned long int>::load(stream, value_base, context);
72
73 else if (type == typeid(unsigned long long int).name())
74 TableValue<unsigned long long int>::load(stream, value_base, context);
75
76 else if (type == typeid(short int).name())
77 TableValue<short int>::load(stream, value_base, context);
78
79 else if (type == typeid(int).name())
80 TableValue<int>::load(stream, value_base, context);
81
82 else if (type == typeid(long int).name())
83 TableValue<long int>::load(stream, value_base, context);
84
85 else if (type == typeid(long long int).name())
86 TableValue<long long int>::load(stream, value_base, context);
87
88 else if (type == typeid(float).name())
89 TableValue<float>::load(stream, value_base, context);
90
91 else if (type == typeid(double).name())
92 TableValue<double>::load(stream, value_base, context);
93
94 else if (type == typeid(long double).name())
95 TableValue<long double>::load(stream, value_base, context);
96
97 else if (type == typeid(char).name())
98 TableValue<char>::load(stream, value_base, context);
99
100 else if (type == typeid(char *).name())
101 TableValue<char *>::load(stream, value_base, context);
102
103 else if (type == typeid(std::string).name())
104 TableValue<std::string>::load(stream, value_base, context);
105
106 else
107 mooseError("Unsupported table value type ", demangle(type.c_str()));
108}
void dataLoad(std::istream &stream, FormattedTable &table, void *context)
void mooseError(Args &&... args)
Emit an error message with the given stringified, concatenated args and terminate the application.
Definition MooseError.h:311
static void load(std::istream &stream, std::shared_ptr< TableValueBase > &value_base, void *context)
std::string name(const ElemQuality q)
std::string demangle(const char *name)

◆ dataStore() [1/2]

template<>
void dataStore ( std::ostream &  stream,
FormattedTable table,
void *  context 
)

Definition at line 27 of file FormattedTable.C.

28{
29 table.fillEmptyValues();
30 storeHelper(stream, table._data, context);
31 storeHelper(stream, table._align_widths, context);
32 storeHelper(stream, table._column_names, context);
33 storeHelper(stream, table._output_row_index, context);
34 storeHelper(stream, table._headers_output, context);
35}
void storeHelper(std::ostream &stream, P &data, void *context)
Scalar helper routine.
Definition DataIO.h:989
void fillEmptyValues(unsigned int last_n_entries=0)
Fill any values that are not defined (usually when there are mismatched column lengths)

Referenced by TableValue< T >::store().

◆ dataStore() [2/2]

template<>
void dataStore ( std::ostream &  stream,
std::shared_ptr< TableValueBase > &  value_base,
void *  context 
)

Definition at line 50 of file FormattedTable.C.

51{
52 value_base->store(stream, context);
53}

◆ operator<<()

std::ostream & operator<< ( std::ostream &  os,
const TableValueBase value 
)

Definition at line 628 of file FormattedTable.C.

630{
631 value.print(os);
632 return os;
633}
Real value(unsigned n, unsigned alpha, unsigned beta, Real x)

Variable Documentation

◆ DEFAULT_CSV_DELIMITER

const std::string DEFAULT_CSV_DELIMITER = ","

Definition at line 23 of file FormattedTable.C.

◆ DEFAULT_CSV_PRECISION

const unsigned short DEFAULT_CSV_PRECISION = 14

Definition at line 22 of file FormattedTable.C.