32 #ifndef OOMPH_DEFINITIONS_HEADER
33 #define OOMPH_DEFINITIONS_HEADER
37 #include <oomph-lib-config.h>
51 #define OOMPH_MAKE_STRING(x) #x
57 #define OOMPH_TO_STRING(x) OOMPH_MAKE_STRING(x)
61 #define OOMPH_EXCEPTION_LOCATION __FILE__ ":" OOMPH_TO_STRING(__LINE__)
65 #if defined(__GNUC__) || (defined(__MWERKS__) && (__MWERKS__ >= 0x3000)) || \
66 (defined(__ICC) && (__ICC >= 600)) || defined(__ghs__)
67 #define OOMPH_CURRENT_FUNCTION __PRETTY_FUNCTION__
69 #elif defined(__DMC__) && (__DMC__ >= 0x810)
70 #define OOMPH_CURRENT_FUNCTION __PRETTY_FUNCTION__
72 #elif defined(__FUNCSIG__)
73 #define OOMPH_CURRENT_FUNCTION __FUNCSIG__
75 #elif (defined(__INTEL_COMPILER) && (__INTEL_COMPILER >= 600)) || \
76 (defined(__IBMCPP__) && (__IBMCPP__ >= 500))
77 #define OOMPH_CURRENT_FUNCTION __FUNCTION__
79 #elif defined(__BORLANDC__) && (__BORLANDC__ >= 0x550)
80 #define OOMPH_CURRENT_FUNCTION __FUNC__
82 #elif defined(__STDC_VERSION__) && (__STDC_VERSION__ >= 199901)
83 #define OOMPH_CURRENT_FUNCTION __func__
86 #define OOMPH_CURRENT_FUNCTION "[Unknown function -- unrecognised compiler]"
99 namespace Global_timings
117 namespace TerminateHelper
196 const char* location,
198 std::ostream& exception_stream,
199 const unsigned& output_width,
200 bool list_trace_back);
235 const char* location)
250 Stream_pt = stream_pt;
257 Output_width = output_width;
279 const char* location)
294 Stream_pt = stream_pt;
301 Output_width = output_width;
372 namespace Global_output_stream
389 namespace Global_unsigned
407 namespace Global_string_for_annotation
415 extern std::vector<std::string>
String;
454 if ((*Output_modifier_pt)(*Stream_pt))
456 *Stream_pt << argument;
472 return f(*Stream_pt);
478 return Output_modifier_pt;
///////////////////////////////////////////////////////////////////// ///////////////////////////////...
Nullstream()
Constructor sets the buffer sizes to zero, suppressing all output.
///////////////////////////////////////////////////////////////////// ///////////////////////////////...
std::ostream & operator<<(std::ostream &(*f)(std::ostream &))
Overload insertor to handle stream modifiers.
std::ostream * Stream_pt
Pointer to the output stream – defaults to std::cout.
OomphInfo()
Set default values for the output stream (cout) and modifier (no modification)
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()
Access function for the stream pointer.
OutputModifier * Output_modifier_pt
Pointer to the output modifier object – defaults to no modification.
OutputModifier *& output_modifier_pt()
Access function for the output modifier pointer.
An OomphLibError object which should be thrown when an run-time error is encountered....
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...
static unsigned Output_width
Width in characters of the output report.
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 std::ostream * Stream_pt
Output stream that is used to write the errors.
static void set_output_width(const unsigned &output_width)
Static member function used to specify the width (in characters) of the error stream.
//////////////////////////////////////////////////////////////////// ////////////////////////////////...
~OomphLibException()
The destructor cannot throw an exception (C++ STL standard)
OomphLibException(const std::string &error_description, const std::string &function_name, const char *location, const std::string &exception_type, std::ostream &exception_stream, const unsigned &output_width, bool list_trace_back)
Constructor takes the error description, function name and a location string provided by the OOMPH_EX...
void disable_error_message()
Suppress issueing of the error message in destructor (useful if error is caught successfully!...
std::stringstream * Exception_stringstream_pt
String stream that records the error message.
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...
//////////////////////////////////////////////////////////////////// ////////////////////////////////...
~OomphLibQuietException()
The destructor cannot throw an exception (C++ STL standard)
OomphLibQuietException()
Constructor.
An OomphLibWarning object which should be created as a temporary object to issue a warning....
static void set_output_width(const unsigned &output_width)
Static member function used to specify the width (in characters) of the error stream.
static unsigned Output_width
Width of output.
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...
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.
///////////////////////////////////////////////////////////////////// ///////////////////////////////...
virtual ~OutputModifier()
Empty virtual destructor.
OutputModifier()
Empty constructor.
virtual bool operator()(std::ostream &stream)
Function that will be called before output from an OomphOutput object. It returns a bool (true in thi...
std::ofstream * Outfile
Output stream.
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...
std::string string(const unsigned &i)
Return the i-th string or "" if the relevant string hasn't been defined.
bool Doc_comprehensive_timings
Global boolean to switch on comprehensive timing – can probably be declared const false when developm...
unsigned Number
The unsigned.
void clean_up_memory()
Clean up function that deletes anything dynamically allocated in this namespace.
void suppress_exception_error_messages()
Flush string stream of error messages (call when error has been caught)
void setup()
Setup terminate helper.
void spawn_errors_from_uncaught_errors()
Function to spawn messages from uncaught errors.
std::stringstream * Exception_stringstream_pt
String stream that records the error message.
std::ostream * Error_message_stream_pt
Stream to output error messages.
//////////////////////////////////////////////////////////////////// ////////////////////////////////...
Nullstream oomph_nullstream
///////////////////////////////////////////////////////////////////////// ///////////////////////////...
OutputModifier default_output_modifier
Single global instatiation of the default output modifier.
OomphInfo oomph_info
Single (global) instantiation of the OomphInfo object – this is used throughout the library as a "rep...