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

◆ here()

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

Definition at line 41 of file libmesh_common.C.

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

Referenced by report_error(), and stop().

42 {
43  libMesh::err << "[" << static_cast<std::size_t>(libMesh::global_processor_id()) << "] "
44  << file
45  << ", line " << line
46  << ", compiled " << date
47  << " at " << time
48  << std::endl;
49 }
OStreamProxy err(std::cerr)
processor_id_type global_processor_id()
Definition: libmesh_base.h:85

◆ report_error()

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

Definition at line 69 of file libmesh_common.C.

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

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

◆ stop()

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

Definition at line 53 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().

54 {
56  {
57  libMesh::MacroFunctions::here(file, line, date, time);
58 #if defined(LIBMESH_HAVE_CSIGNAL) && defined(SIGSTOP)
59  libMesh::out << "Stopping process " << getpid() << "..." << std::endl;
60  std::raise(SIGSTOP);
61  libMesh::out << "Continuing process " << getpid() << "..." << std::endl;
62 #else
63  libMesh::out << "WARNING: libmesh_stop() does not work; no operating system support." << std::endl;
64 #endif
65  }
66 }
processor_id_type global_n_processors()
Definition: libmesh_base.h:75
void here(const char *file, int line, const char *date, const char *time)
OStreamProxy out(std::cout)