18#if defined(__GNUC__) || defined(__clang__)
19#define MALLARD_PRINTF(fmt, args) __attribute__((format(printf, fmt, args)))
21#define MALLARD_PRINTF(fmt, args)
27using Items = std::vector<std::pair<std::string, std::string>>;
97std::
string si(
double value);
99std::
string real(
double value);
KOKKOS_INLINE_FUNCTION rtype dot(const rtype *a, const rtype *b)
Compute the dot product of two arrays.
Definition common_math.h:32
#define MALLARD_PRINTF(fmt, args)
Definition log.h:21
std::string real(double v)
Compact real: "%.6g".
Definition log.cpp:200
void event(uint64_t step, double t, std::string_view kind, std::string_view text)
One-line event during the run (e.g. a file written), led by the step and time so it lines up with the...
Definition log.cpp:145
std::string count(uint64_t n)
1234567 -> "1,234,567".
Definition log.cpp:167
std::vector< std::pair< std::string, std::string > > Items
Key-value lines of a setup section, in display order.
Definition log.h:27
std::string format(const char *fmt,...)
printf-style formatting into a std::string.
Definition log.cpp:74
void error(std::string_view message)
Error on stderr from the calling rank, prefixed with the rank in parallel runs.
Definition log.cpp:160
bool color_stdout()
Whether to color stdout (stderr): a terminal, NO_COLOR unset and not under an MPI launcher,...
Definition log.cpp:87
void line(std::string_view text)
Prints a line on stdout from rank 0.
Definition log.cpp:101
void items(const Items &list)
Definition log.cpp:124
void begin_phase(std::string_view name)
Starts a line naming a setup phase; end_phase() completes it with the elapsed time....
Definition log.cpp:128
void end_phase(double seconds)
Definition log.cpp:137
constexpr int WIDTH
Width of section rules and the target maximum line width.
Definition log.h:30
bool color_stderr()
Definition log.cpp:92
void warning(std::string_view message)
Warning on stderr from rank 0, for conditions every rank sees alike.
Definition log.cpp:153
void section(std::string_view title, std::string_view right)
Section heading, e.g. "== Mesh ===...=== 0.12 s".
Definition log.cpp:107
constexpr int KEY_WIDTH
Column at which the values of key-value lines start.
Definition log.h:32
std::string si(double v)
Value with an SI suffix and 3 significant digits: "16.3M", "1.20k".
Definition log.cpp:189
std::string duration(double s)
Wall-clock duration: "850 us", "12.3 ms", "4.56 s", "12m 03s", "2h 05m".
Definition log.cpp:178
std::string style(std::string_view text, Style s)
Wraps text in an ANSI style when stdout gets color, else returns it unchanged.
Definition log.cpp:97
void item(std::string_view key, std::string_view value)
Aligned " key value" line under a section.
Definition log.cpp:117