Classes | Namespaces | Functions | Variables
oomph_utilities.h File Reference

Go to the source code of this file.

Classes

class  oomph::AbsCmp< T >
 Function-type-object to perform absolute comparison of objects. Apparently this inlines better. More...
 
class  oomph::Timer
 Timer. More...
 
class  oomph::DocLinearSolverInfo
 Collection of data structures for storing information about linear solves. Currently only contains storage for the iteration counts and the linear solver time. More...
 
class  oomph::DocInfo
 Information for documentation of results: Directory and file number to enable output in the form RESLT/filename11.dat, say. Documentation can be switched on and off. More...
 
struct  oomph::CommandLineArgs::ArgInfo< T >
 Structure to store information on a command line argument. More...
 
class  oomph::MPIOutputModifier
 MPI output modifier: Precedes every output by specification of the processor ID. Output can be restricted to a single processor. More...
 
class  oomph::MPI_Helpers
 MPI_Helpers class contains static helper methods to support MPI within oomph-lib. The methods init(...) and finalize() initialize and finalize MPI in oomph-lib and manage the oomph-libs global communicator communicator_pt(). NOTE: This class encapsulates static helper methods and instances of it CANNOT be instantiated. More...
 
class  oomph::SolutionFunctorBase
 Function base class for exact solutions/initial conditions/boundary conditions. This is needed so that we can have solutions that depend on problem parameters with resorting to global variables. More...
 
class  oomph::SolutionFunctor
 Function class for a simple function with no external parameters (just stores a function pointer, only needed for compatability). More...
 

Namespaces

namespace  oomph
 DRAIG: Change all instances of (SPATIAL_DIM) to (DIM-1).
 
namespace  oomph::ANSIEscapeCode
 Contains an enumeration of the ANSI escape codes used for colouring text (when piped to the command line). Adapted from the guide on: https://stackoverflow.com/questions/2616906/how-do-i-output- coloured-text-to-a-linux-terminal?utm_medium=organic&utm_source= google_rich_qa&utm_campaign=google_rich_qa Here, \033 is the ESC character, ASCII 27. It is followed by [, then zero or more numbers separated by ;, and finally the letter m. The numbers describe the colour and format to switch to from that point onwards.
 
namespace  oomph::DebugHelpers
 Namespace for debugging helpers. Currently only contains a function to prett-ify file name and line numbers (in red) to use when debugging. Makes it easy to identify where a std::cout statement was called.
 
namespace  oomph::SecondInvariantHelper
 Helper namespace containing function that computes second invariant of tensor.
 
namespace  oomph::BrokenCopy
 Namespace for error messages for broken copy constructors and assignment operators.
 
namespace  oomph::MathematicalConstants
 Namespace for mathematical constants.
 
namespace  oomph::StringConversion
 Conversion functions for easily making strings (e.g. for filenames - to avoid stack smashing problems with cstrings and long filenames).
 
namespace  oomph::TypeNames
 
namespace  oomph::CumulativeTimings
 Namespace for global (cumulative) timings.
 
namespace  oomph::CommandLineArgs
 Namespace for command line arguments.
 
namespace  oomph::ObsoleteCode
 Namespace for flagging up obsolete parts of the code.
 
namespace  oomph::TecplotNames
 Namespace for tecplot stuff.
 
namespace  oomph::LeakCheckNames
 Namespace for leak check: Keep a running count of all instantiated objects – add your own if you want to...
 
namespace  oomph::PauseFlags
 Namespace for pause() command.
 
namespace  oomph::TimingHelpers
 Helper for recording execution time.
 
namespace  oomph::MemoryUsage
 Namespace with helper functions to assess total memory usage on the fly using system() – details are very machine specific! This just provides the overall machinery with default settings for our own (linux machines). Uses the system command to spawn a command that computes the total memory usage on the machine where this is called. [Disclaimer: works on my machine(s) – no guarantees for any other platform; linux or not. MH].
 

Functions

void oomph::ANSIEscapeCode::set_text_effect (std::string text_effect)
 Function to change text effect. NOTE: This assumes the user knows what they're doing/assigning; no error checking done here...
 
std::string oomph::DebugHelpers::debug_string (const std::string &filename, const int &line_number, const std::string &message, const bool &shorten, const bool &start_on_new_line)
 Return the concaternation of the initials of the input file name and line number. The make_new_line flag indicates whether the string starts with a "\n", i.e. a new line.
 
double oomph::SecondInvariantHelper::second_invariant (const DenseMatrix< double > &tensor)
 Compute second invariant of tensor.
 
void oomph::BrokenCopy::broken_assign (const std::string &class_name)
 Issue error message and terminate execution.
 
void oomph::BrokenCopy::broken_copy (const std::string &class_name)
 Issue error message and terminate execution.
 
const std::complex< doubleoomph::MathematicalConstants::I (0.0, 1.0)
 The imaginary unit.
 
template<class T >
std::string oomph::StringConversion::to_string (T object, unsigned float_precision=8)
 Conversion function that should work for anything with operator<< defined (at least all basic types).
 
std::string oomph::StringConversion::to_lower (const std::string &input)
 Convert a string to lower case (outputs a copy).
 
std::string oomph::StringConversion::to_upper (const std::string &input)
 Convert a string to upper case (outputs a copy).
 
void oomph::StringConversion::split_string (const std::string &s, char delim, Vector< std::string > &elems)
 Split a string, s, into a vector of strings where ever there is an instance of delimiter (i.e. is delimiter is " " will give a list of words). Note that mutliple delimiters in a row will give empty strings.
 
Vector< std::string > oomph::StringConversion::split_string (const std::string &s, char delim)
 Split a string, s, into a vector of strings where ever there is an instance of delimiter (i.e. is delimiter is " " will give a list of words). Note that mutliple delimiters in a row will give empty strings. Return by value.
 
template<class T >
std::string oomph::TypeNames::get_type_name (T &obj)
 Get the type name of an object. Only for use in debugging, do not write real code using this function as it is implementation dependant!
 
template<class T >
std::string oomph::TypeNames::get_type_name (T *obj)
 Get the type name of an object from a pointer to the object (we usually want the type of the object itself not the pointer because the type of the pointer may be a base class). Only for use in debugging, do not write real code using this function as it is implementation dependant!
 
void oomph::CumulativeTimings::start (const unsigned &i)
 (Re-)start i-th timer
 
void oomph::CumulativeTimings::halt (const unsigned &i)
 Halt i-th timer.
 
void oomph::CumulativeTimings::reset (const unsigned &i)
 Reset i-th timer.
 
void oomph::CumulativeTimings::reset ()
 Reset all timers.
 
double oomph::CumulativeTimings::cumulative_time (const unsigned &i)
 Report time accumulated by i-th timer.
 
void oomph::CumulativeTimings::set_ntimers (const unsigned &ntimers)
 Set number of timings that can be recorded in parallel.
 
template<class Target , class Source >
Target oomph::checked_dynamic_cast (Source *x)
 Runtime checked dynamic cast. This is the safe but slightly slower cast. Use it in any of these cases:
 
template<class Target , class Source >
Target oomph::checked_static_cast (Source *x)
 Checked static cast. Only use this cast if ALL of these are true:
 
void oomph::CommandLineArgs::setup (int argc, char **argv)
 Set values.
 
void oomph::CommandLineArgs::output ()
 Doc the command line arguments.
 
void oomph::CommandLineArgs::specify_command_line_flag (const std::string &command_line_flag, const std::string &doc)
 Specify possible argument-free command line flag.
 
void oomph::CommandLineArgs::specify_command_line_flag (const std::string &command_line_flag, double *arg_pt, const std::string &doc)
 Specify possible command line flag that specifies a double, accessed via pointer.
 
void oomph::CommandLineArgs::specify_command_line_flag (const std::string &command_line_flag, int *arg_pt, const std::string &doc)
 Specify possible command line flag that specifies an int, accessed via pointer.
 
void oomph::CommandLineArgs::specify_command_line_flag (const std::string &command_line_flag, unsigned *arg_pt, const std::string &doc)
 Specify possible command line flag that specifies an unsigned, accessed via pointer.
 
void oomph::CommandLineArgs::specify_command_line_flag (const std::string &command_line_flag, std::string *arg_pt, const std::string &doc)
 Specify possible command line flag that specifies a string, accessed via pointer.
 
bool oomph::CommandLineArgs::command_line_flag_has_been_set (const std::string &flag)
 Check if command line flag has been set (value will have been assigned directly).
 
void oomph::CommandLineArgs::doc_all_flags (std::ostream &outstream)
 Document the values of all flags (specified or not).
 
void oomph::CommandLineArgs::doc_specified_flags ()
 Document specified command line flags.
 
void oomph::CommandLineArgs::doc_available_flags ()
 Document available command line flags.
 
void oomph::CommandLineArgs::check_arg_index (const int &argc, const int &arg_index)
 Helper function to check if command line index is legal.
 
void oomph::CommandLineArgs::parse_and_assign (int argc, char *argv[], const bool &throw_on_unrecognised_args)
 Parse command line, check for recognised flags and assign associated values.
 
void oomph::CommandLineArgs::parse_and_assign (const bool &throw_on_unrecognised_args)
 Parse previously specified command line, check for recognised flags and assign associated values.
 
void oomph::ObsoleteCode::obsolete ()
 Output warning message.
 
void oomph::ObsoleteCode::obsolete (const std::string &message)
 Ouput a warning message with a string argument.
 
void oomph::TecplotNames::setup ()
 Setup namespace.
 
void oomph::LeakCheckNames::reset ()
 
void oomph::LeakCheckNames::doc ()
 
void oomph::pause (std::string message)
 Pause and display message.
 
double oomph::TimingHelpers::timer ()
 returns the time in seconds after some point in past
 
std::string oomph::TimingHelpers::convert_secs_to_formatted_string (const double &time_in_sec)
 Returns a nicely formatted string from an input time in seconds; the format depends on the size of time, e.g.: 86510 will be printed as 1d 1m:50 3710 will be printed as 1h:01:50 700 will be printed as 11m:40 59 will be printed as 59s.
 
void oomph::MemoryUsage::empty_my_memory_usage_file ()
 Function to empty file that records my memory usage in file whose name is specified by My_memory_usage_filename.
 
void oomph::MemoryUsage::doc_my_memory_usage (const std::string &prefix_string)
 Doc my memory usage, prepended by string (which allows identification from where the function is called, say) that records memory usage in file whose name is specified by My_memory_usage_filename. Data is appended to that file; wipe it with empty_my_memory_usage_file(). Note: This requires getpid() which is defined in unistd.h so if you don't have that we won't build that function!
 
void oomph::MemoryUsage::empty_total_memory_usage_file ()
 Function to empty file that records total memory usage in file whose name is specified by Total_memory_usage_filename.
 
void oomph::MemoryUsage::doc_total_memory_usage (const std::string &prefix_string)
 Doc total memory usage, prepended by string (which allows identification from where the function is called, say) that records memory usage in file whose name is specified by Total_memory_usage_filename. Data is appended to that file; wipe it with empty_memory_usage_file().
 
void oomph::MemoryUsage::empty_memory_usage_files ()
 Function to empty file that records total and local memory usage in appropriate files.
 
void oomph::MemoryUsage::doc_memory_usage (const std::string &prefix_string)
 Doc total and local memory usage, prepended by string (which allows identification from where the function is called, say). NOTE: Local memory usage only works if we have unistd.h header.
 
void oomph::MemoryUsage::empty_top_file ()
 Function to empty file that records continuous output from top in file whose name is specified by Top_output_filename.
 
void oomph::MemoryUsage::run_continous_top (const std::string &comment)
 Start running top continuously and output (append) into file specified by Top_output_filename. Wipe that file with empty_top_file() if you wish. Note that this is again quite Linux specific and unlikely to work on other operating systems. Insert optional comment into output file before starting.
 
void oomph::MemoryUsage::stop_continous_top (const std::string &comment)
 Stop running top continuously. Note that this is again quite Linux specific and unlikely to work on other operating systems. Insert optional comment into output file before stopping.
 
void oomph::MemoryUsage::insert_comment_to_continous_top (const std::string &comment)
 Insert comment into running continuous top output.
 

Variables

const double oomph::MathematicalConstants::Pi = 3.1415926535897932384626433832795028841971693993751
 50 digits from maple
 
long oomph::LeakCheckNames::AlgebraicNodeNodeUpdateInfo_build