13 const std::string& pps_typename,
14 const std::vector<const PostProcessor*>& pp_list,
15 const Event& event)
const
17 if (pp_list.empty())
return;
18 std::stringstream outstr;
20 typedef std::pair<std::string, std::string> PPNameAndVal;
21 std::vector<PPNameAndVal> scalar_ppnames_and_vals;
22 for (
const auto& pp : pp_list)
24 const auto& value = pp->GetValue();
25 const auto value_str = pp->ConvertValueToString(value);
27 scalar_ppnames_and_vals.emplace_back(pp->Name(), value_str);
30 if (not scalar_ppnames_and_vals.empty())
38 <<
" post-processors latest values at event \""
39 <<
event.Name() <<
"\"\n"
40 << outstr.str() <<
"\n";
46 const std::vector<std::pair<std::string, std::string>>&
47 scalar_ppnames_and_vals,
50 std::stringstream outstr;
51 const size_t num_pps = scalar_ppnames_and_vals.size();
53 std::vector<size_t> col_sizes;
54 col_sizes.reserve(scalar_ppnames_and_vals.size());
55 for (
const auto& [name, valstring] : scalar_ppnames_and_vals)
56 col_sizes.push_back(std::max(name.size(), valstring.size()));
58 std::stringstream header1, header2, header3, body, footer;
59 for (
size_t p = 0; p < num_pps; ++p)
61 const size_t col_size = std::max(col_sizes[p],
size_t(15));
62 const auto& [ppname, ppval] = scalar_ppnames_and_vals[p];
63 const auto ppname2 = ppname + std::string(col_size - ppname.size(),
' ');
64 const auto ppval2 = std::string(col_size - ppval.size(),
' ') + ppval;
65 for (
size_t c = 0; c < (col_size + 3); ++c)
83 else if (c < (col_size + 2) and c != 1)
105 outstr << header1.str() <<
"\n";
106 outstr << header2.str() <<
"\n";
107 outstr << header3.str() <<
"\n";
108 outstr << body.str() <<
"\n";
109 outstr << footer.str() <<
"\n";
116 const std::vector<std::pair<std::string, std::string>>&
117 scalar_ppnames_and_vals,
120 std::stringstream outstr;
122 const size_t num_pps = scalar_ppnames_and_vals.size();
124 size_t max_colsize_name = scalar_ppnames_and_vals.front().first.size();
125 size_t max_colsize_val = scalar_ppnames_and_vals.front().second.size();
126 for (
const auto& [name, valstring] : scalar_ppnames_and_vals)
128 max_colsize_name = std::max(max_colsize_name, name.size() + 8);
129 max_colsize_val = std::max(max_colsize_val, valstring.size());
131 constexpr size_t min_col_size = 15;
132 max_colsize_name = std::max(max_colsize_name, min_col_size + 5);
133 max_colsize_val = std::max(max_colsize_val, min_col_size);
135 const std::string hline =
"*-" + std::string(max_colsize_name,
'-') +
"-*-" +
136 std::string(max_colsize_val,
'-') +
"-*";
137 const std::string name_header =
138 "| Post-Processor Name" + std::string(max_colsize_name - 19,
' ') +
139 " | Value" + std::string(max_colsize_val - 5,
' ') +
" |";
141 outstr << hline <<
"\n";
142 outstr << name_header <<
"\n";
143 outstr << hline <<
"\n";
144 for (
size_t p = 0; p < num_pps; ++p)
146 const auto& [name, val] = scalar_ppnames_and_vals[p];
147 outstr <<
"| " << name <<
"(latest)"
148 << std::string(max_colsize_name - name.size() - 8,
' ');
149 outstr <<
" | " << std::string(max_colsize_val - val.size(),
' ') << val
152 outstr << hline <<
"\n";
LogStream Log(LOG_LVL level=LOG_0)
ScalarPPTableFormat scalar_pp_table_format_
static std::string PrintPPsVertical(const std::vector< std::pair< std::string, std::string > > &scalar_ppnames_and_vals, int event_code)
void PrintPPsLatestValuesOnly(const std::string &pps_typename, const std::vector< const PostProcessor * > &pp_list, const Event &event) const
static std::string PrintPPsHorizontal(const std::vector< std::pair< std::string, std::string > > &scalar_ppnames_and_vals, int)