ug4
Common

common utilities for ug4 More...

Modules

 Common Utilities
 further general utilities
 

Classes

struct  CompileTimeAssertion< bool >
 
struct  CompileTimeAssertion< true >
 
class  ug::DebugID
 
class  ug::DebugIDManager
 
class  ug::LogAssistant
 
class  ug::SoftAbort
 This special error is used to perform a soft-abort e.g. during script execution. More...
 
class  ug::Stopwatch
 Stopwatch class for quickly taking times. More...
 
class  ug::UGError
 Instances of this class or of derived classes are thrown if errors arise. More...
 

Macros

#define ASSERT_EQUAL(s1, s2)   { UG_COND_THROW(s1 != s2, "mismatch: " << UG_TO_STRING(s1) << " = " << s1 << " != " << UG_TO_STRING(s2) << " = " << s2 << "."); }
 
#define ASSERT_EQUAL_3(s1, s2, s3)   { ASSERT_EQUAL(s1, s2); ASSERT_EQUAL(s1, s3); }
 
#define ASSERT_EQUAL_4(s1, s2, s3, s4)   { ASSERT_EQUAL(s1, s2); ASSERT_EQUAL(s1, s3); ASSERT_EQUAL(s1, s4); }
 
#define EXPORT_IMPL
 
#define IF_DEBUG(__debugID__, level)   if(1==0)
 
#define IMPORT_IMPL
 
#define LOG(msg)   UG_LOG(msg)
 
#define PRETTY_FUNCTION   __FUNCTION__
 
#define SAFE_DELETE(a)   {if(a){ delete a; a = NULL;}}
 
#define SAFE_RELEASE(p)   {if(p) { (p)->Release(); (p)=NULL;}}
 
#define STATIC_ASSERT(expr, msg)   UG_STATIC_ASSERT(expr, msg)
 
#define THROW_IF_NOT_EQUAL(s1, s2)   { UG_COND_THROW(s1 != s2, "mismatch: " << UG_TO_STRING(s1) << " = " << s1 << " != " << UG_TO_STRING(s2) << " = " << s2 << "."); }
 
#define THROW_IF_NOT_EQUAL_3(s1, s2, s3)   { THROW_IF_NOT_EQUAL(s1, s2); THROW_IF_NOT_EQUAL(s1, s3); }
 
#define THROW_IF_NOT_EQUAL_4(s1, s2, s3, s4)   { THROW_IF_NOT_EQUAL(s1, s2); THROW_IF_NOT_EQUAL(s1, s3); THROW_IF_NOT_EQUAL(s1, s4); }
 
#define UG_API
 
#define UG_ASSERT(expr, msg)
 
#define UG_CATCH_PRINT(msg)
 
#define UG_CATCH_THROW(msg)
 
#define UG_CATCH_THROW_FUNC()   UG_CATCH_THROW(PRETTY_FUNCTION << "failed. ")
 
#define UG_COND_LOG(cond, msg)   { if (cond) { UG_LOG(msg); } }
 
#define UG_COND_LOGN(cond, msg)   { if (cond) { UG_LOGN(msg); } }
 
#define UG_COND_THROW(cond, msg)   { if(cond) { UG_THROW(msg); } }
 UG_COND_THROW(cond, msg) : performs a UG_THROW(msg) if cond == true. More...
 
#define UG_COND_WARNING(cond, msg)
 
#define UG_DEBUG_BEGIN(__debugID__, level)   { if(1==0) {
 
#define UG_DEBUG_END(__debugID__, level)   }; }
 
#define UG_DLOG(__debugID__, level, msg)   {}
 
#define UG_DLOG_ALL_PROCS(__debugID__, level, msg)   {}
 
#define UG_DLOGN(__debugID__, level, msg)   {}
 
#define UG_ENABLE_WARNINGS
 
#define UG_ERR_LOG(msg)   {ug::GetLogAssistant().error_logger() << msg; VRL_LOG(msg);}
 
#define UG_LOG(msg)   {ug::GetLogAssistant().logger() << msg << std::flush; VRL_LOG(msg);}
 
#define UG_LOG_ALL_PROCS(msg)
 
#define UG_LOGN(msg)   UG_LOG(msg << "\n")
 
#define UG_RESET_DEBUG_LEVELS()   {}
 
#define UG_SET_DEBUG_LEVEL(__debugID__, level)   {}
 
#define UG_SET_DEBUG_LEVELS(level)   {}
 
#define UG_STATIC_ASSERT(expr, msg)
 Checks an expression at compile-time and raises a compile-error if the expression equals 0. More...
 
#define UG_THROW(msg)
 
#define UG_TO_STRING(x)   UG_TO_STRING1(x)
 
#define UG_TO_STRING1(x)   #x
 
#define UG_WARNING(msg)
 
#define VRL_LOG(msg)
 

Typedefs

typedef unsigned char byte
 
typedef ugtypes::int32_t int32
 
typedef ugtypes::int64_t int64
 
typedef double number
 
typedef unsigned int uint
 
typedef ugtypes::uint32_t uint32
 
typedef ugtypes::uint64_t uint64
 

Functions

std::string ug::ConvertNumber (uint64_t size, unsigned int width, unsigned int numDisplayedDigits)
 returns number 'size' in a more human readable format (using IEC binary prefixes) More...
 
std::string ug::ConvertNumberSI (uint64_t size, unsigned int width, unsigned int numDisplayedDigits)
 returns number 'size' in a more human readable format (using SI prefixes) More...
 
bool ug::DebugIDManager::debug_id_registered (const char *debugIDname) const
 returns true if there is a DebugID with name debugIDname More...
 
 ug::DebugID::DebugID (const char *str)
 registers the DebugID at DebugIDManager More...
 
 ug::DebugID::DebugID (uint32 hash)
 
template<class Key , class T , class TIStream >
void ug::Deserialize (TIStream &buf, std::map< Key, T > &m)
 deserializes data from a binary stream into a map More...
 
template<class T1 , class T2 , class TIStream >
void ug::Deserialize (TIStream &buf, std::pair< T1, T2 > &v)
 
template<class T , class TIStream >
void ug::Deserialize (TIStream &buf, std::set< T > &myset)
 deserializes data from a binary stream into a set More...
 
template<class TIStream >
void ug::Deserialize (TIStream &buf, std::string &str)
 deserializes data from a binary stream into a string More...
 
template<class TIStream >
void ug::Deserialize (TIStream &buf, std::vector< bool > &vec)
 
template<class TIStream >
void ug::Deserialize (TIStream &buf, std::vector< bool >::reference boolRef)
 deserializes data from a binary stream into a vector<bool> More...
 
template<class T , class TIStream >
void ug::Deserialize (TIStream &buf, std::vector< T > &vec)
 deserializes data from a binary stream into a vector More...
 
template<class TIStream >
void ug::Deserialize (TIStream &buf, Variant &v)
 deserializes data from a binary stream into a variant More...
 
template<typename T , class TIStream >
ug::Deserialize (TIStream &stream)
 method returning value directly More...
 
template<class TStream , class T >
void ug::Deserialize (TStream &buf, const T &valOut)
 Catch errors with wrong const identifiers in valOut. More...
 
template<class TStream , class T >
void ug::Deserialize (TStream &buf, T &valOut)
 
DebugID ug::DebugIDManager::get_debug_id (const char *debugID) const
 
int ug::DebugID::get_debug_level () const
 returns the debug level via GetDebugIDManager. More...
 
int ug::DebugIDManager::get_debug_level (const char *debugID) const
 returns the debug level of debugID, -1 if not found More...
 
int ug::DebugIDManager::get_debug_level (const DebugID &debugID) const
 returns the debug level of debugID, -1 if not found More...
 
int ug::DebugIDManager::get_debug_level (uint32 debugIDhash) const
 returns the debug level of debugIDhash, -1 if not found More...
 
DebugID ug::DebugIDManager::get_or_create_debug_id (const char *debugID)
 
std::string ug::DebugIDManager::get_registered_debug_IDs () const
 returns a string describing all registered debugIDs. More...
 
const std::vector< std::string > & ug::DebugIDManager::get_registered_debug_IDs_arr () const
 
DebugIDManagerug::GetDebugIDManager ()
 
LogAssistantug::GetLogAssistant ()
 
static DebugIDManagerug::DebugIDManager::instance ()
 returns a reference to the single instance of LogAssistant More...
 
bool ug::DebugIDManager::register_debug_id (const char *debugID)
 
template<class TIStream >
void ug::Serialize (TIStream &buf, const std::vector< bool > &vec)
 
template<class Key , class T , class TOStream >
void ug::Serialize (TOStream &buf, const std::map< Key, T > &m)
 writes data from a map to a binary stream More...
 
template<class T1 , class T2 , class TOStream >
void ug::Serialize (TOStream &buf, const std::pair< T1, T2 > &v)
 
template<class T , class TOStream >
void ug::Serialize (TOStream &buf, const std::set< T > &m)
 writes data from a set to a binary stream More...
 
template<class TOStream >
void ug::Serialize (TOStream &buf, const std::string &str)
 Writes a string to a binary stream. More...
 
template<class TOStream >
void ug::Serialize (TOStream &buf, const std::vector< bool >::reference &boolRef)
 
template<class T , class TOStream >
void ug::Serialize (TOStream &buf, const std::vector< T > &vec)
 writes data in a vector to a binary stream More...
 
template<class TOStream >
void ug::Serialize (TOStream &buf, const Variant &v)
 serializes a variant More...
 
template<class TStream , class T >
void ug::Serialize (TStream &buf, const T &val)
 
bool ug::DebugIDManager::set_debug_level (const char *debugID, int level)
 sets the debug level of debugID if registered to 'level' More...
 
bool ug::DebugIDManager::set_debug_level (DebugID &debugID, int level)
 sets the debug level of debugID if registered to 'level' More...
 
bool ug::DebugID::set_debug_level (int level)
 sets the debug level via GetDebugIDManager. More...
 
bool ug::DebugIDManager::set_debug_level (uint32 debugIDhash, int level)
 sets the debug level of debugIDhash if registered to 'level' More...
 
bool ug::DebugIDManager::set_debug_levels (int lev)
 sets the debug level of all registered debugIDs to 'lev' More...
 
UG_API void ug_assert_failed ()
 Checks an expression at runtime and raises a runtime-error if the expression equals 0. More...
 
void ug_throw_error ()
 called whenever UG_THROW or UG_THROW_REGISTRY_ERROR is called. More...
 

Variables

DebugID ug::APP
 
DebugID ug::LIB_ALG_AMG
 
DebugID ug::LIB_ALG_LINEAR_OPERATOR
 
DebugID ug::LIB_ALG_LINEAR_SOLVER
 
DebugID ug::LIB_ALG_MATRIX
 
DebugID ug::LIB_ALG_VECTOR
 
DebugID ug::LIB_DISC
 
DebugID ug::LIB_DISC_ASSEMBLE
 
DebugID ug::LIB_DISC_D3F
 
DebugID ug::LIB_DISC_DISCRETE_FUNCTION
 
DebugID ug::LIB_DISC_LINKER
 
DebugID ug::LIB_DISC_MULTIGRID
 
DebugID ug::LIB_DISC_NEWTON
 
DebugID ug::LIB_DISC_OPERATOR_INVERSE
 
DebugID ug::LIB_DISC_OUTPUT
 
DebugID ug::LIB_DISC_TRANSFER
 
DebugID ug::LIB_GRID
 
DebugID ug::LIB_GRID_REFINER
 
DebugID ug::LIB_PCL
 
std::vector< std::string > ug::DebugIDManager::m_dbgLevelIdentifiers
 
std::map< uint32, int > ug::DebugIDManager::m_dbgLevels
 
uint32 ug::DebugID::m_hash
 
DebugID ug::MAIN
 
static std::string ug::UG_AUTHORS ="Sebastian Reiter, Martin Rupp, Andreas Vogel, et al."
 
static std::string ug::UG_BINARY_LICENSE
 
const uint64 ug::UNIT_EXA = UNIT_PETA * 1024ll
 
const uint64 ug::UNIT_EXA_SI = UNIT_PETA_SI * 1000ll
 
const uint64 ug::UNIT_GIGA = UNIT_MEGA * 1024
 
const uint64 ug::UNIT_GIGA_SI = UNIT_MEGA_SI * 1000
 
const uint64 ug::UNIT_KILO = 1024
 
const uint64 ug::UNIT_KILO_SI = 1000
 
const uint64 ug::UNIT_MEGA = UNIT_KILO * 1024
 
const uint64 ug::UNIT_MEGA_SI = UNIT_KILO_SI * 1000
 
const uint64 ug::UNIT_PETA = UNIT_TERA * 1024ll
 
const uint64 ug::UNIT_PETA_SI = UNIT_TERA_SI * 1000ll
 
const uint64 ug::UNIT_TERA = UNIT_GIGA * 1024ll
 
const uint64 ug::UNIT_TERA_SI = UNIT_GIGA_SI * 1000ll
 

Friends

class ug::DebugID::DebugIDManager
 

Detailed Description

common utilities for ug4

Macro Definition Documentation

◆ ASSERT_EQUAL

#define ASSERT_EQUAL (   s1,
  s2 
)    { UG_COND_THROW(s1 != s2, "mismatch: " << UG_TO_STRING(s1) << " = " << s1 << " != " << UG_TO_STRING(s2) << " = " << s2 << "."); }

◆ ASSERT_EQUAL_3

#define ASSERT_EQUAL_3 (   s1,
  s2,
  s3 
)    { ASSERT_EQUAL(s1, s2); ASSERT_EQUAL(s1, s3); }

◆ ASSERT_EQUAL_4

#define ASSERT_EQUAL_4 (   s1,
  s2,
  s3,
  s4 
)    { ASSERT_EQUAL(s1, s2); ASSERT_EQUAL(s1, s3); ASSERT_EQUAL(s1, s4); }

◆ EXPORT_IMPL

#define EXPORT_IMPL

◆ IF_DEBUG

#define IF_DEBUG (   __debugID__,
  level 
)    if(1==0)

◆ IMPORT_IMPL

#define IMPORT_IMPL

◆ LOG

#define LOG (   msg)    UG_LOG(msg)

◆ PRETTY_FUNCTION

#define PRETTY_FUNCTION   __FUNCTION__

◆ SAFE_DELETE

#define SAFE_DELETE (   a)    {if(a){ delete a; a = NULL;}}

◆ SAFE_RELEASE

#define SAFE_RELEASE (   p)    {if(p) { (p)->Release(); (p)=NULL;}}

◆ STATIC_ASSERT

#define STATIC_ASSERT (   expr,
  msg 
)    UG_STATIC_ASSERT(expr, msg)

◆ THROW_IF_NOT_EQUAL

#define THROW_IF_NOT_EQUAL (   s1,
  s2 
)    { UG_COND_THROW(s1 != s2, "mismatch: " << UG_TO_STRING(s1) << " = " << s1 << " != " << UG_TO_STRING(s2) << " = " << s2 << "."); }

◆ THROW_IF_NOT_EQUAL_3

#define THROW_IF_NOT_EQUAL_3 (   s1,
  s2,
  s3 
)    { THROW_IF_NOT_EQUAL(s1, s2); THROW_IF_NOT_EQUAL(s1, s3); }

◆ THROW_IF_NOT_EQUAL_4

#define THROW_IF_NOT_EQUAL_4 (   s1,
  s2,
  s3,
  s4 
)    { THROW_IF_NOT_EQUAL(s1, s2); THROW_IF_NOT_EQUAL(s1, s3); THROW_IF_NOT_EQUAL(s1, s4); }

◆ UG_API

#define UG_API

◆ UG_ASSERT

#define UG_ASSERT (   expr,
  msg 
)
Value:
{if(!(expr)) \
{ \
UG_LOG_ALL_PROCS( "\n UG_ASSERT failed:\n"\
" Condition: " << UG_TO_STRING(expr) << "\n"\
" Description: " << msg << "\n"\
" File: " << __FILE__ << "\n"\
" Line: " << __LINE__ << "\n\n"); \
ug_assert_failed(); \
UG_LOG_ALL_PROCS( "\n UG_ASSERT failed:\n"\
" Condition: " << UG_TO_STRING(expr) << "\n"\
" Description: " << msg << "\n"\
" File: " << __FILE__ << "\n"\
" Line: " << __LINE__ << "\n\n"); \
assert(expr);\
}}
#define UG_TO_STRING(x)
Definition: assert.h:44

◆ UG_CATCH_PRINT

#define UG_CATCH_PRINT (   msg)
Value:
catch (ug::UGError& err)\
{\
std::stringstream __ss;\
__ss << msg;\
err.push_msg(__ss.str(), __FILE__, __LINE__);\
UG_LOG(err.get_stacktrace());\
}\
catch (const std::exception& ex)\
{\
std::stringstream __ss;\
__ss << msg;\
ug::UGError err(__ss.str(), ex, __FILE__, __LINE__);\
UG_LOG(err.get_stacktrace());\
}
Instances of this class or of derived classes are thrown if errors arise.
Definition: error.h:104
std::string get_stacktrace() const
Definition: error.h:151
parameterString ex
Executes the specified script.
Definition: command_line_util.lua:350

◆ UG_CATCH_THROW

#define UG_CATCH_THROW (   msg)
Value:
catch(ug::UGError& err){std::stringstream __ss; __ss << msg;\
err.push_msg(__ss.str(),__FILE__,__LINE__); throw(err);} \
catch(const std::exception& ex) { std::stringstream __ss; __ss << msg;\
throw ug::UGError(__ss.str(), ex,__FILE__,__LINE__); }

◆ UG_CATCH_THROW_FUNC

#define UG_CATCH_THROW_FUNC ( )    UG_CATCH_THROW(PRETTY_FUNCTION << "failed. ")

◆ UG_COND_LOG

#define UG_COND_LOG (   cond,
  msg 
)    { if (cond) { UG_LOG(msg); } }

◆ UG_COND_LOGN

#define UG_COND_LOGN (   cond,
  msg 
)    { if (cond) { UG_LOGN(msg); } }

◆ UG_COND_THROW

#define UG_COND_THROW (   cond,
  msg 
)    { if(cond) { UG_THROW(msg); } }

UG_COND_THROW(cond, msg) : performs a UG_THROW(msg) if cond == true.

◆ UG_COND_WARNING

#define UG_COND_WARNING (   cond,
  msg 
)
Value:
{ if (cond) {ug::GetLogAssistant().logger() << "UG_WARNING in "\
<< __FILE__ << " at line " << __LINE__ << ": " \
<< msg << std::flush;} }
std::ostream & logger()
returns the normal output stream
Definition: log_impl.h:51
LogAssistant & GetLogAssistant()
Definition: log_impl.h:69

◆ UG_DEBUG_BEGIN

#define UG_DEBUG_BEGIN (   __debugID__,
  level 
)    { if(1==0) {

◆ UG_DEBUG_END

#define UG_DEBUG_END (   __debugID__,
  level 
)    }; }

◆ UG_DLOG

#define UG_DLOG (   __debugID__,
  level,
  msg 
)    {}

◆ UG_DLOG_ALL_PROCS

#define UG_DLOG_ALL_PROCS (   __debugID__,
  level,
  msg 
)    {}

◆ UG_DLOGN

#define UG_DLOGN (   __debugID__,
  level,
  msg 
)    {}

◆ UG_ENABLE_WARNINGS

#define UG_ENABLE_WARNINGS

◆ UG_ERR_LOG

#define UG_ERR_LOG (   msg)    {ug::GetLogAssistant().error_logger() << msg; VRL_LOG(msg);}

UG_ERR_LOG(msg) prints msg to LogAssistant::error_logger(). Those messages are not immediately flushed. Instead they can be flushed to the standard logger using LogAssistant::flush_error_log

◆ UG_LOG

#define UG_LOG (   msg)    {ug::GetLogAssistant().logger() << msg << std::flush; VRL_LOG(msg);}

◆ UG_LOG_ALL_PROCS

#define UG_LOG_ALL_PROCS (   msg)
Value:
int op = la.get_output_process(); la.set_output_process(-1);\
la.logger() << "[Proc " << std::setw(3) << la.get_process_rank() << "]: "\
<< msg << std::flush; VRL_LOG(msg); la.set_output_process(op);}
Definition: log.h:97
int get_output_process()
returns the rank of the current output-process or -1 if all procs perform output.
Definition: log_impl.h:63
void set_output_process(int procRank)
sets the output-process in a parallel environment. Default is 0.
Definition: log.cpp:249
int get_process_rank()
returns the process rank of the underlying process (same as pcl::ProcRank)
Definition: log.cpp:290
#define VRL_LOG(msg)
Definition: log.h:364

◆ UG_LOGN

#define UG_LOGN (   msg)    UG_LOG(msg << "\n")

◆ UG_RESET_DEBUG_LEVELS

#define UG_RESET_DEBUG_LEVELS ( )    {}

◆ UG_SET_DEBUG_LEVEL

#define UG_SET_DEBUG_LEVEL (   __debugID__,
  level 
)    {}

◆ UG_SET_DEBUG_LEVELS

#define UG_SET_DEBUG_LEVELS (   level)    {}

◆ UG_STATIC_ASSERT

#define UG_STATIC_ASSERT (   expr,
  msg 
)
Value:
{CompileTimeAssertion<expr ? true : false> UG_STATIC_ASSERT_ERROR_##msg;\
UG_STATIC_ASSERT_ERROR_##msg.do_assert();}
Definition: static_assert.h:42

Checks an expression at compile-time and raises a compile-error if the expression equals 0.

UG_STATIC_ASSERT is only active if NDEBUG is not defined.

Parameters
expran arbitrary expression that can be converted to bool.
msgthis message will be part of the error-message that the compiler prints to the screen. Only intended to help the user to identify the error-source. The format of the message has to adhere to the rules that apply for class-names or variable-names.

(bad) example: UG_STATIC_ASSERT(sizeof(int) == 4, size_of_int_has_to_be_4);

◆ UG_THROW

#define UG_THROW (   msg)
Value:
{ug_throw_error(); std::stringstream __ss; __ss << msg; \
throw(ug::UGError(__ss.str(),__FILE__,__LINE__));}
void ug_throw_error()
called whenever UG_THROW or UG_THROW_REGISTRY_ERROR is called.
Definition: assert.cpp:164

◆ UG_TO_STRING

#define UG_TO_STRING (   x)    UG_TO_STRING1(x)

◆ UG_TO_STRING1

#define UG_TO_STRING1 (   x)    #x

◆ UG_WARNING

#define UG_WARNING (   msg)
Value:
{ug::GetLogAssistant().logger() << "UG_WARNING in "\
<< __FILE__ << " at line " << __LINE__ << ": " \
<< msg << std::flush;}

◆ VRL_LOG

#define VRL_LOG (   msg)

UG_LOG(msg) - prints a message to the normal output stream

Typedef Documentation

◆ byte

typedef unsigned char byte

◆ int32

typedef ugtypes::int32_t int32

◆ int64

typedef ugtypes::int64_t int64

◆ number

typedef double number

◆ uint

typedef unsigned int uint

◆ uint32

typedef ugtypes::uint32_t uint32

◆ uint64

typedef ugtypes::uint64_t uint64

Function Documentation

◆ ConvertNumber()

std::string ug::ConvertNumber ( uint64_t  size,
unsigned int  width,
unsigned int  numDisplayedDigits 
)
inline

returns number 'size' in a more human readable format (using IEC binary prefixes)

References ug::GetNumberOfDigits(), ug::UNIT_EXA, ug::UNIT_GIGA, ug::UNIT_KILO, ug::UNIT_MEGA, ug::UNIT_PETA, and ug::UNIT_TERA.

Referenced by ug::PrintDoFCount().

◆ ConvertNumberSI()

std::string ug::ConvertNumberSI ( uint64_t  size,
unsigned int  width,
unsigned int  numDisplayedDigits 
)
inline

returns number 'size' in a more human readable format (using SI prefixes)

References ug::GetNumberOfDigits(), ug::UNIT_EXA_SI, ug::UNIT_GIGA_SI, ug::UNIT_KILO_SI, ug::UNIT_MEGA_SI, ug::UNIT_PETA_SI, and ug::UNIT_TERA_SI.

◆ debug_id_registered()

bool ug::DebugIDManager::debug_id_registered ( const char *  debugIDname) const
inline

returns true if there is a DebugID with name debugIDname

References ug::crc32(), and ug::DebugIDManager::m_dbgLevels.

Referenced by ug::DebugIDManager::get_or_create_debug_id(), and ug::DebugIDManager::register_debug_id().

◆ DebugID() [1/2]

ug::DebugID::DebugID ( const char *  str)

registers the DebugID at DebugIDManager

register the debug id. NOTE: this function is called in the initialization of variables of type DebugID, which are mostly global variables. Be absolutely sure we are safe here, i.e. we are not using other things which might not be initialized (like Log).

References ug::crc32(), ug::GetDebugIDManager(), ug::DebugID::m_hash, and ug::DebugIDManager::register_debug_id().

◆ DebugID() [2/2]

ug::DebugID::DebugID ( uint32  hash)
inline

References ug::DebugID::m_hash.

◆ Deserialize() [1/11]

template<class Key , class T , class TIStream >
void ug::Deserialize ( TIStream &  buf,
std::map< Key, T > &  m 
)

deserializes data from a binary stream into a map

References ug::Deserialize().

◆ Deserialize() [2/11]

template<class T1 , class T2 , class TIStream >
void ug::Deserialize ( TIStream &  buf,
std::pair< T1, T2 > &  v 
)

References ug::Deserialize().

◆ Deserialize() [3/11]

template<class T , class TIStream >
void ug::Deserialize ( TIStream &  buf,
std::set< T > &  myset 
)

deserializes data from a binary stream into a set

◆ Deserialize() [4/11]

template<class TIStream >
void ug::Deserialize ( TIStream &  buf,
std::string &  str 
)

deserializes data from a binary stream into a string

◆ Deserialize() [5/11]

template<class TIStream >
void ug::Deserialize ( TIStream &  buf,
std::vector< bool > &  vec 
)

◆ Deserialize() [6/11]

template<class TIStream >
void ug::Deserialize ( TIStream &  buf,
std::vector< bool >::reference  boolRef 
)
inline

deserializes data from a binary stream into a vector<bool>

◆ Deserialize() [7/11]

template<class T , class TIStream >
void ug::Deserialize ( TIStream &  buf,
std::vector< T > &  vec 
)

deserializes data from a binary stream into a vector

References ug::Deserialize().

◆ Deserialize() [8/11]

template<class TIStream >
void ug::Deserialize ( TIStream &  buf,
Variant v 
)

deserializes data from a binary stream into a variant

Note that pointers can't be serialized in a meaningful way. We thus simply do not serialize them. During deserialization pointers will be set to NULL.

References UG_THROW, ug::Variant::VT_BOOL, ug::Variant::VT_CSTRING, ug::Variant::VT_DOUBLE, ug::Variant::VT_FLOAT, ug::Variant::VT_INT, ug::Variant::VT_INVALID, ug::Variant::VT_POINTER, and ug::Variant::VT_STDSTRING.

◆ Deserialize() [9/11]

template<typename T , class TIStream >
T ug::Deserialize ( TIStream &  stream)

method returning value directly

References ug::Deserialize().

◆ Deserialize() [10/11]

template<class TStream , class T >
void ug::Deserialize ( TStream &  buf,
const T &  valOut 
)

Catch errors with wrong const identifiers in valOut.

This method isn't implemented on purpose!

◆ Deserialize() [11/11]

template<class TStream , class T >
void ug::Deserialize ( TStream &  buf,
T &  valOut 
)

◆ get_debug_id()

DebugID ug::DebugIDManager::get_debug_id ( const char *  debugID) const
inline

References ug::crc32().

◆ get_debug_level() [1/4]

int ug::DebugID::get_debug_level ( ) const
inline

returns the debug level via GetDebugIDManager.

References ug::DebugIDManager::get_debug_level(), and ug::GetDebugIDManager().

◆ get_debug_level() [2/4]

int ug::DebugIDManager::get_debug_level ( const char *  debugID) const
inline

returns the debug level of debugID, -1 if not found

References ug::crc32(), and ug::DebugIDManager::get_debug_level().

◆ get_debug_level() [3/4]

int ug::DebugIDManager::get_debug_level ( const DebugID debugID) const
inline

returns the debug level of debugID, -1 if not found

References ug::DebugIDManager::get_debug_level(), and ug::DebugID::m_hash.

◆ get_debug_level() [4/4]

int ug::DebugIDManager::get_debug_level ( uint32  debugIDhash) const
inlineprivate

◆ get_or_create_debug_id()

DebugID ug::DebugIDManager::get_or_create_debug_id ( const char *  debugID)
inline

◆ get_registered_debug_IDs()

std::string ug::DebugIDManager::get_registered_debug_IDs ( ) const
inline

returns a string describing all registered debugIDs.

References ug::DebugIDManager::get_debug_level(), and ug::DebugIDManager::m_dbgLevelIdentifiers.

Referenced by ug::LogAssistant::get_registered_debug_IDs().

◆ get_registered_debug_IDs_arr()

const std::vector<std::string>& ug::DebugIDManager::get_registered_debug_IDs_arr ( ) const
inline

◆ GetDebugIDManager()

◆ GetLogAssistant()

◆ instance()

DebugIDManager & ug::DebugIDManager::instance ( )
static

returns a reference to the single instance of LogAssistant

Referenced by ug::GetDebugIDManager().

◆ register_debug_id()

bool ug::DebugIDManager::register_debug_id ( const char *  debugID)

register the debug id. NOTE: this function is called in the initialization of global variables of type DebugID. Be absolutely sure we are safe here, i.e. we are not using other things which might not be initialized (like Log).

References ug::crc32(), ug::DebugIDManager::debug_id_registered(), ug::DebugIDManager::m_dbgLevelIdentifiers, ug::DebugIDManager::m_dbgLevels, and UG_THROW.

Referenced by ug::DebugID::DebugID(), and ug::DebugIDManager::get_or_create_debug_id().

◆ Serialize() [1/9]

template<class TIStream >
void ug::Serialize ( TIStream &  buf,
const std::vector< bool > &  vec 
)

◆ Serialize() [2/9]

template<class Key , class T , class TOStream >
void ug::Serialize ( TOStream &  buf,
const std::map< Key, T > &  m 
)

writes data from a map to a binary stream

This template method is used in ug when it comes to writing data from a map into a binary stream. In its default implementation, it first writes the size of the map and then serializes the entries.

References ug::Serialize().

◆ Serialize() [3/9]

template<class T1 , class T2 , class TOStream >
void ug::Serialize ( TOStream &  buf,
const std::pair< T1, T2 > &  v 
)

References ug::Serialize().

◆ Serialize() [4/9]

template<class T , class TOStream >
void ug::Serialize ( TOStream &  buf,
const std::set< T > &  m 
)

writes data from a set to a binary stream

This template method is used in ug when it comes to writing data from a map into a binary stream. In its default implementation, it first writes the size of the map and then serializes the entries.

◆ Serialize() [5/9]

template<class TOStream >
void ug::Serialize ( TOStream &  buf,
const std::string &  str 
)

Writes a string to a binary stream.

First the length of the string is written, then its content.

References ug::Serialize().

◆ Serialize() [6/9]

template<class TOStream >
void ug::Serialize ( TOStream &  buf,
const std::vector< bool >::reference &  boolRef 
)
inline

This method is used in ug when it comes to writing data from a vector<bool> into a binary stream. This function is to avoid surprises with vector<bool> because of vector<bool>::reference. Note: You could also define Serialize(., vector<bool>::reference)

◆ Serialize() [7/9]

template<class T , class TOStream >
void ug::Serialize ( TOStream &  buf,
const std::vector< T > &  vec 
)

writes data in a vector to a binary stream

This template method is used in ug when it comes to writing data from a vector into a binary stream. In its default implementation, it first writes the size of the vector and then serializes the entries.

References ug::Serialize().

◆ Serialize() [8/9]

template<class TOStream >
void ug::Serialize ( TOStream &  buf,
const Variant v 
)

serializes a variant

Note that pointers can't be serialized in a meaningful way. We thus simply do not serialize them. During deserialization pointers will be set to NULL.

Note that c-strings (const char*) are converted to std::strings before serialization. This means that they will be deserialized as std::string

References ug::Serialize(), ug::Variant::to_bool(), ug::Variant::to_c_string(), ug::Variant::to_double(), ug::Variant::to_float(), ug::Variant::to_int(), ug::Variant::to_std_string(), ug::Variant::type(), UG_THROW, ug::Variant::VT_BOOL, ug::Variant::VT_CSTRING, ug::Variant::VT_DOUBLE, ug::Variant::VT_FLOAT, ug::Variant::VT_INT, ug::Variant::VT_INVALID, ug::Variant::VT_POINTER, and ug::Variant::VT_STDSTRING.

◆ Serialize() [9/9]

template<class TStream , class T >
void ug::Serialize ( TStream &  buf,
const T &  val 
)

◆ set_debug_level() [1/4]

bool ug::DebugIDManager::set_debug_level ( const char *  debugID,
int  level 
)

sets the debug level of debugID if registered to 'level'

References ug::crc32(), ug::DebugIDManager::m_dbgLevelIdentifiers, name, ug::DebugIDManager::set_debug_level(), UG_LOG, and ug::WildcardMatch().

◆ set_debug_level() [2/4]

bool ug::DebugIDManager::set_debug_level ( DebugID debugID,
int  level 
)
inline

sets the debug level of debugID if registered to 'level'

References ug::DebugID::m_hash, and ug::DebugIDManager::set_debug_level().

◆ set_debug_level() [3/4]

bool ug::DebugID::set_debug_level ( int  level)
inline

sets the debug level via GetDebugIDManager.

References ug::GetDebugIDManager(), and ug::DebugIDManager::set_debug_level().

◆ set_debug_level() [4/4]

bool ug::DebugIDManager::set_debug_level ( uint32  debugIDhash,
int  level 
)
inlineprivate

◆ set_debug_levels()

bool ug::DebugIDManager::set_debug_levels ( int  lev)

sets the debug level of all registered debugIDs to 'lev'

References ug::DebugIDManager::m_dbgLevels.

Referenced by ug::LogAssistant::set_debug_levels().

◆ ug_assert_failed()

UG_API void ug_assert_failed ( )

Checks an expression at runtime and raises a runtime-error if the expression equals 0.

UG_ASSERT is only active if NDEBUG is not defined.

Parameters
expran arbitrary expression that can be converted to bool.
msgthis message will be part of the error-message. Intended to give more information about the checked condition and possible errors.

example: UG_ASSERT( num_dof >= 0, "Number of Degrees of Freedom can not be negative");

output: UG_ASSERT failed: Condition: num_dof >= 0 Description: Number of Degrees of Freedom can not be negative File: debug.cpp Line: 130

Checks an expression at runtime and raises a runtime-error if the expression equals 0.

References pcl::Abort(), ug_assert_or_error(), and ug_backtrace().

◆ ug_throw_error()

void ug_throw_error ( )

called whenever UG_THROW or UG_THROW_REGISTRY_ERROR is called.

References ug_assert_or_error().

Variable Documentation

◆ APP

DebugID ug::APP("APP")

◆ LIB_ALG_AMG

◆ LIB_ALG_LINEAR_OPERATOR

DebugID ug::LIB_ALG_LINEAR_OPERATOR("LIB_ALG_LINEAR_OPERATOR")

◆ LIB_ALG_LINEAR_SOLVER

DebugID ug::LIB_ALG_LINEAR_SOLVER("LIB_ALG_LINEAR_SOLVER")

◆ LIB_ALG_MATRIX

◆ LIB_ALG_VECTOR

DebugID ug::LIB_ALG_VECTOR("LIB_ALG_VECTOR")

◆ LIB_DISC

DebugID ug::LIB_DISC("LIB_DISC")

◆ LIB_DISC_ASSEMBLE

DebugID ug::LIB_DISC_ASSEMBLE("LIB_DISC_ASSEMBLE")

◆ LIB_DISC_D3F

DebugID ug::LIB_DISC_D3F("LIB_DISC_D3F")

◆ LIB_DISC_DISCRETE_FUNCTION

DebugID ug::LIB_DISC_DISCRETE_FUNCTION("LIB_DISC_DISCRETE_FUNCTION")

◆ LIB_DISC_LINKER

DebugID ug::LIB_DISC_LINKER("LIB_DISC_LINKER")

◆ LIB_DISC_MULTIGRID

◆ LIB_DISC_NEWTON

DebugID ug::LIB_DISC_NEWTON("LIB_DISC_NEWTON")

◆ LIB_DISC_OPERATOR_INVERSE

DebugID ug::LIB_DISC_OPERATOR_INVERSE("LIB_DISC_OPERATOR_INVERSE")

◆ LIB_DISC_OUTPUT

DebugID ug::LIB_DISC_OUTPUT("LIB_DISC_OUTPUT")

◆ LIB_DISC_TRANSFER

DebugID ug::LIB_DISC_TRANSFER("LIB_DISC_TRANSFER")

◆ LIB_GRID

◆ LIB_GRID_REFINER

DebugID ug::LIB_GRID_REFINER("LIB_GRID_REFINER")

◆ LIB_PCL

◆ m_dbgLevelIdentifiers

◆ m_dbgLevels

◆ m_hash

◆ MAIN

DebugID ug::MAIN("MAIN")

Referenced by ug::InitPaths().

◆ UG_AUTHORS

std::string ug::UG_AUTHORS ="Sebastian Reiter, Martin Rupp, Andreas Vogel, et al."
static

Names of the UG Core developer team, seperated by ','.

Referenced by Java_edu_gcsc_vrl_ug_UG__1getAuthors().

◆ UG_BINARY_LICENSE

std::string ug::UG_BINARY_LICENSE
static

License for binary usage.

Referenced by Java_edu_gcsc_vrl_ug_UG__1getBinaryLicense().

◆ UNIT_EXA

const uint64 ug::UNIT_EXA = UNIT_PETA * 1024ll

Referenced by ug::ConvertNumber().

◆ UNIT_EXA_SI

const uint64 ug::UNIT_EXA_SI = UNIT_PETA_SI * 1000ll

Referenced by ug::ConvertNumberSI().

◆ UNIT_GIGA

const uint64 ug::UNIT_GIGA = UNIT_MEGA * 1024

Referenced by ug::ConvertNumber().

◆ UNIT_GIGA_SI

const uint64 ug::UNIT_GIGA_SI = UNIT_MEGA_SI * 1000

Referenced by ug::ConvertNumberSI().

◆ UNIT_KILO

const uint64 ug::UNIT_KILO = 1024

Referenced by ug::ConvertNumber().

◆ UNIT_KILO_SI

const uint64 ug::UNIT_KILO_SI = 1000

Referenced by ug::ConvertNumberSI().

◆ UNIT_MEGA

const uint64 ug::UNIT_MEGA = UNIT_KILO * 1024

Referenced by ug::ConvertNumber().

◆ UNIT_MEGA_SI

const uint64 ug::UNIT_MEGA_SI = UNIT_KILO_SI * 1000

Referenced by ug::ConvertNumberSI().

◆ UNIT_PETA

const uint64 ug::UNIT_PETA = UNIT_TERA * 1024ll

Referenced by ug::ConvertNumber().

◆ UNIT_PETA_SI

const uint64 ug::UNIT_PETA_SI = UNIT_TERA_SI * 1000ll

Referenced by ug::ConvertNumberSI().

◆ UNIT_TERA

const uint64 ug::UNIT_TERA = UNIT_GIGA * 1024ll

Referenced by ug::ConvertNumber().

◆ UNIT_TERA_SI

const uint64 ug::UNIT_TERA_SI = UNIT_GIGA_SI * 1000ll

Referenced by ug::ConvertNumberSI().

Friends

◆ DebugIDManager

friend class DebugIDManager
friend