libMesh::MacroFunctions Namespace Reference

Functions

void here (const char *file, int line, const char *date, const char *time)
 
void stop (const char *file, int line, const char *date, const char *time)
 
void report_error (const char *file, int line, const char *date, const char *time)
 

Function Documentation

void libMesh::MacroFunctions::here ( const char *  file,
int  line,
const char *  date,
const char *  time 
)

Definition at line 36 of file libmesh_common.C.

References libMesh::err, and libMesh::global_processor_id().

Referenced by report_error(), and stop().

37 {
38  libMesh::err << "[" << static_cast<std::size_t>(libMesh::global_processor_id()) << "] "
39  << file
40  << ", line " << line
41  << ", compiled " << date
42  << " at " << time
43  << std::endl;
44 }
OStreamProxy err(std::cerr)
processor_id_type global_processor_id()
Definition: libmesh_base.h:114
void libMesh::MacroFunctions::report_error ( const char *  file,
int  line,
const char *  date,
const char *  time 
)

Definition at line 64 of file libmesh_common.C.

References libMesh::err, libMesh::global_n_processors(), here(), libMesh::on_command_line(), libMesh::print_trace(), and libMesh::write_traceout().

65 {
66  // It is possible to have an error *inside* report_error; e.g. from
67  // print_trace. We don't want to infinitely recurse.
68  static bool reporting_error = false;
69  if (reporting_error)
70  {
71  // I heard you like error reporting, so we put an error report
72  // in report_error() so you can report errors from the report.
73  libMesh::err << "libMesh encountered an error while attempting to report_error." << std::endl;
74  return;
75  }
76  reporting_error = true;
77 
78  if (libMesh::global_n_processors() == 1 ||
79  // Note: support both 'underscore' and 'dash' flavors of the option
80  libMesh::on_command_line("--print_trace") ||
81  libMesh::on_command_line("--print-trace"))
83  else
85  libMesh::MacroFunctions::here(file, line, date, time);
86 
87  reporting_error = false;
88 }
processor_id_type global_n_processors()
Definition: libmesh_base.h:104
void write_traceout()
Definition: print_trace.C:233
void print_trace(std::ostream &out_stream)
Definition: print_trace.C:196
OStreamProxy err(std::cerr)
bool on_command_line(const std::string &arg)
Definition: libmesh.C:914
void here(const char *file, int line, const char *date, const char *time)
void libMesh::MacroFunctions::stop ( const char *  file,
int  line,
const char *  date,
const char *  time 
)

Definition at line 48 of file libmesh_common.C.

References libMesh::global_n_processors(), here(), and libMesh::out.

Referenced by libMesh::PetscMatrix< T >::row_start(), and libMesh::PetscMatrix< T >::row_stop().

49 {
51  {
52  libMesh::MacroFunctions::here(file, line, date, time);
53 #ifdef LIBMESH_HAVE_CSIGNAL
54  libMesh::out << "Stopping process " << getpid() << "..." << std::endl;
55  std::raise(SIGSTOP);
56  libMesh::out << "Continuing process " << getpid() << "..." << std::endl;
57 #else
58  libMesh::out << "WARNING: libmesh_stop() does not work without the <csignal> header file!" << std::endl;
59 #endif
60  }
61 }
processor_id_type global_n_processors()
Definition: libmesh_base.h:104
void here(const char *file, int line, const char *date, const char *time)
OStreamProxy out(std::cout)