36 #ifndef OOMPH_DEFINITIONS_HEADER 37 #define OOMPH_DEFINITIONS_HEADER 41 #include <oomph-lib-config.h> 56 #define OOMPH_MAKE_STRING(x) #x 62 #define OOMPH_TO_STRING(x) OOMPH_MAKE_STRING(x) 66 #define OOMPH_EXCEPTION_LOCATION __FILE__ ":" OOMPH_TO_STRING(__LINE__) 70 #if defined(__GNUC__) || (defined(__MWERKS__) && (__MWERKS__ >= 0x3000)) || (defined(__ICC) && (__ICC >= 600)) || defined(__ghs__) 71 # define OOMPH_CURRENT_FUNCTION __PRETTY_FUNCTION__ 73 #elif defined(__DMC__) && (__DMC__ >= 0x810) 74 # define OOMPH_CURRENT_FUNCTION __PRETTY_FUNCTION__ 76 #elif defined(__FUNCSIG__) 77 # define OOMPH_CURRENT_FUNCTION __FUNCSIG__ 79 #elif (defined(__INTEL_COMPILER) && (__INTEL_COMPILER >= 600)) || (defined(__IBMCPP__) && (__IBMCPP__ >= 500)) 80 # define OOMPH_CURRENT_FUNCTION __FUNCTION__ 82 #elif defined(__BORLANDC__) && (__BORLANDC__ >= 0x550) 83 # define OOMPH_CURRENT_FUNCTION __FUNC__ 85 #elif defined(__STDC_VERSION__) && (__STDC_VERSION__ >= 199901) 86 # define OOMPH_CURRENT_FUNCTION __func__ 89 # define OOMPH_CURRENT_FUNCTION "[Unknown function -- unrecognised compiler]" 102 namespace Global_timings
120 namespace TerminateHelper
183 Suppress_error_message=
true;
199 const char *location,
201 std::ostream &exception_stream,
202 const unsigned &output_width,
203 bool list_trace_back);
240 const char *location) :
242 *Stream_pt,Output_width,true)
248 {Stream_pt = stream_pt;}
253 {Output_width = output_width;}
276 const char* location) :
279 "WARNING",*Stream_pt,Output_width,false) { }
284 {Stream_pt = stream_pt;}
289 {Output_width = output_width;}
371 namespace Global_output_stream
389 namespace Global_unsigned
408 namespace Global_string_for_annotation
417 extern std::vector<std::string>
String;
449 Output_modifier_pt(&default_output_modifier) {}
459 if((*Output_modifier_pt)(*Stream_pt))
461 *Stream_pt << argument;
474 return f(*Stream_pt);
static void set_output_width(const unsigned &output_width)
Static member function used to specify the width (in characters) of the error stream.
std::ostream * Exception_stream_pt
Exception stream to which we write message in destructor.
bool Suppress_error_message
Boolean to suppress issuing of the error message in destructor (useful if error is caught successfull...
Nullstream oomph_nullstream
Single (global) instantiation of the Nullstream.
void spawn_errors_from_uncaught_errors()
Function to spawn messages from uncaught errors.
OomphLibError(const std::string &error_description, const std::string &function_name, const char *location)
Constructor requires the error description and the function in which the error occured and the locati...
std::vector< std::string > String
Storage for strings that may be used for global annotations. This is global data and you use it at yo...
void disable_error_message()
Suppress issueing of the error message in destructor (useful if error is caught successfully!) ...
A small nullstream class that throws away everything sent to it.
static std::ostream * Stream_pt
Output stream that is used to write the errors.
static void set_stream_pt(std::ostream *const &stream_pt)
Static member function used to specify the error stream, which must be passed as a pointer because st...
static void set_output_width(const unsigned &output_width)
Static member function used to specify the width (in characters) of the error stream.
OutputModifier default_output_modifier
Single global instatiation of the default output modifier.
bool Doc_comprehensive_timings
Global boolean to switch on comprehensive timing – can probably be declared const false when develop...
~OomphLibQuietException()
The destructor cannot throw an exception (C++ STL standard)
std::stringstream * Exception_stringstream_pt
String stream that records the error message.
unsigned Number
The unsigned.
virtual bool operator()(std::ostream &stream)
Function that will be called before output from an OomphOutput object. It returns a bool (true in thi...
void setup()
Setup terminate helper.
static std::ostream * Stream_pt
Output stream that is used to write the errors.
Nullstream()
Constructor sets the buffer sizes to zero, suppressing all output.
static unsigned Output_width
Width of output.
std::ostream *& stream_pt()
Access function for the stream pointer.
std::ofstream * Outfile
Output stream.
OomphInfo()
Set default values for the output stream (cout) and modifier (no modification)
static unsigned Output_width
Width in characters of the output report.
void suppress_exception_error_messages()
Flush string stream of error messages (call when error has been caught)
static void set_stream_pt(std::ostream *const &stream_pt)
Static member function used to specify the error stream, which must be passed as a pointer because st...
std::ostream * Error_message_stream_pt
Stream to output error messages.
std::stringstream * Exception_stringstream_pt
String stream that records the error message.
OutputModifier *& output_modifier_pt()
Access function for the output modifier pointer.
std::ostream & operator<<(_Tp argument)
Overload the << operator, writing output to the stream addressed by Stream_pt and calling the functio...
std::ostream * Stream_pt
Pointer to the output stream – defaults to std::cout.
OomphLibWarning(const std::string &warning_description, const std::string &function_name, const char *location)
Constructor requires the warning description and the function in which the warning occurred...
std::string string(const unsigned &i)
Return the i-th string or "" if the relevant string hasn't been defined.
OutputModifier * Output_modifier_pt
Pointer to the output modifier object – defaults to no modification.
OutputModifier()
Empty constructor.
virtual ~OutputModifier()
Empty virtual destructor.
std::ostream & operator<<(std::ostream &(*f)(std::ostream &))
Overload insertor to handle stream modifiers.