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]"
91#define OOMPH_ERROR(msg) \
92 throw OomphLibError(msg, OOMPH_CURRENT_FUNCTION, OOMPH_EXCEPTION_LOCATION);
95#define OOMPH_WARNING(msg) \
96 OomphLibWarning(msg, OOMPH_CURRENT_FUNCTION, OOMPH_EXCEPTION_LOCATION);
106 namespace Global_timings
124 namespace TerminateHelper
257 Stream_pt = stream_pt;
301 Stream_pt = stream_pt;
379 namespace Global_output_stream
382 extern std::ofstream* Outfile;
396 namespace Global_unsigned
414 namespace Global_string_for_annotation
418 extern std::string
string(
const unsigned&
i);
422 extern std::vector<std::string>
String;
461 if ((*Output_modifier_pt)(*Stream_pt))
479 return f(*Stream_pt);
485 return Output_modifier_pt;
A small nullstream class that throws away everything sent to it.
Nullstream()
Constructor sets the buffer sizes to zero, suppressing all output.
This class is a wrapper to a stream and an output modifier that is used to control the "info" output ...
std::ostream * Stream_pt
Pointer to the output stream – defaults to std::cout.
std::ostream *& stream_pt()
Access function for the stream pointer.
std::ostream & operator<<(std::ostream &(*f)(std::ostream &))
Overload insertor to handle stream modifiers.
OutputModifier *& output_modifier_pt()
Access function for the output modifier pointer.
OomphInfo()
Set default values for the output stream (cout) and modifier (no modification)
OutputModifier * Output_modifier_pt
Pointer to the output modifier object – defaults to no modification.
std::ostream & operator<<(_Tp argument)
Overload the << operator, writing output to the stream addressed by Stream_pt and calling the functio...
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.
===================================================================== A Base class for oomph-lib run-...
~OomphLibException()
The destructor cannot throw an exception (C++ STL standard)
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...
===================================================================== A class for handling oomph-lib ...
~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.
A base class that contains a single virtual member function: The () operator that may be used to modi...
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...
TAdvectionDiffusionReactionElement<NREAGENT,DIM,NNODE_1D> elements are isoparametric triangular DIM-d...
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.
DRAIG: Change all instances of (SPATIAL_DIM) to (DIM-1).
Nullstream oomph_nullstream
Single (global) instantiation of the 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...