16 #ifndef dealii__logstream_h 17 #define dealii__logstream_h 19 #include <deal.II/base/config.h> 20 #include <deal.II/base/exceptions.h> 21 #include <deal.II/base/smartpointer.h> 22 #include <deal.II/base/std_cxx11/shared_ptr.h> 23 #include <deal.II/base/thread_local_storage.h> 31 #ifdef DEAL_II_HAVE_SYS_TIMES_H 32 # include <sys/times.h> 36 int tms_utime, tms_stime, tms_cutime, tms_cstime;
41 DEAL_II_NAMESPACE_OPEN
140 Prefix(
const std::string &text);
146 Prefix(
const std::string &text,
178 void attach (std::ostream &o,
179 const bool print_job_id =
true);
199 void test_mode (
bool on=
true);
205 std::ostream &get_console ();
211 std::ostream &get_file_stream ();
217 bool has_file ()
const;
230 const std::string &get_prefix ()
const;
240 void push (
const std::string &text);
259 unsigned int depth_console (
const unsigned int n);
269 unsigned int depth_file (
const unsigned int n);
278 bool log_execution_time (
const bool flag);
293 bool log_time_differences (
const bool flag);
305 bool log_thread_id (
const bool flag);
326 void threshold_double(
const double t);
332 void threshold_float(
const float t);
340 std::streamsize precision (
const std::streamsize prec);
348 std::streamsize width (
const std::streamsize wide);
356 std::ios::fmtflags flags(
const std::ios::fmtflags f);
399 std::size_t memory_consumption ()
const;
417 std::stack<std::string> &get_prefixes()
const;
512 struct tms reference_tms;
530 void print_line_head ();
536 std::ostringstream &get_stream();
558 template <
typename T>
580 if (outstreams.get().get() == 0)
582 outstreams.get().reset (
new std::ostringstream);
583 outstreams.get()->setf(std::ios::showpoint | std::ios::left);
587 return *outstreams.get();
597 std::ostringstream &stream = get_stream();
604 else if (std::fabs(t) < double_threshold)
607 stream << t*(1.+offset);
618 std::ostringstream &stream = get_stream();
624 if (! (t<=0) && !(t>=0))
626 else if (std::fabs(t) < float_threshold)
629 stream << t*(1.+offset);
668 DEAL_II_NAMESPACE_CLOSE
Threads::ThreadLocalStorage< std_cxx11::shared_ptr< std::ostringstream > > outstreams
A class that provides a separate storage location on each thread that accesses the object...
Threads::ThreadLocalStorage< std::stack< std::string > > prefixes
bool is_finite(const double x)
std::streambuf * old_cerr
LogStream & operator<<(const double t)
#define DeclException0(Exception0)
Prefix(const std::string &text)
double reference_time_val
std::ostringstream & get_stream()
StreamType & operator<<(StreamType &s, UpdateFlags u)