MGIS 3.1.0
Loading...
Searching...
No Matches
mgis Namespace Reference

the namespace mgis encloses all the MGIS project. More...

Classes

struct  AbstractErrorHandler
 base class for error handlers This class shall be used as arguments to checkPreconditions methods More...
struct  ContextInitializer
 class that can be used to initialize a context, in particular in a constexpr function. More...
struct  Context
 a class used to pass an execution context to most methods of MGIS and gather information (error, logs, profiling). More...
struct  ContractViolationHandler
 a class used to report a contract violation More...
struct  PreconditionsCheck
struct  PreconditionsChecker
struct  Cste
struct  ErrorBacktrace
 a structure to keep trace of error messages. More...
struct  InvalidResult
 a class convertible to many values used as invalid result. More...
struct  LibrariesManager
 structure in charge of handling libraries and querying MGIS' meta-data More...
struct  ProfilingSection
struct  ProfilingData
struct  ThreadedTaskResultBase
 non-template base class of the ThreadedTaskResult class More...
struct  ThreadedTaskResult
 a class standing for the result of a taks More...
struct  ThreadedTaskResult< void >
 Partial specialisation for non-returning tasks. More...
struct  ThreadPool
 structure handling a fixed-size pool of threads More...
struct  OptionalReference
 a class that may contain a reference to a class More...

Typedefs

using size_type = mgis_size_type
 a simple alias to the the default indexing type used by mgis
using real = mgis_real
 alias to the numeric type used
using TerminateHandler = void (*)(std::string_view)
 brief a simple alias
using ExceptionHandler = void (*)()
 a simple alias
template<typename F, typename... ArgumentsTypes>
using invoke_result_t
 a simple alias

Enumerations

enum struct  OutputStreamColors {
  BLACK , RED , GREEN , YELLOW ,
  BLUE , PURPLE , LIGHTBLUE , WHITE ,
  RESET
}
 list of available colors for output stream More...
enum struct  StorageMode { LOCAL_STORAGE , EXTERNAL_STORAGE }
 storage option for a non uniform material property or non uniform external state variable. More...
enum  VerbosityLevel {
  verboseQuiet = -1 , verboseLevel0 = 0 , verboseLevel1 = 1 , verboseLevel2 = 2 ,
  verboseLevel3 = 3 , verboseDebug = 4 , verboseFull = 5
}
 list the possible values for the logging facilities provided by the Context class

Functions

MGIS_EXPORT void setTerminateHandler (const TerminateHandler) MGIS_NOEXCEPT
 specify a new terminate handler
MGIS_NORETURN MGIS_EXPORT void terminate (std::string_view)
 call the terminate handler
MGIS_NORETURN MGIS_EXPORT void abort (std::string_view)
 call the terminate handler
template<typename Type, typename... Args>
requires ( is_check_preconditions_callable<Type, Args...>)
constexpr void check_preconditions (Args &&...args)
MGIS_VISIBILITY_EXPORT mfront::MFrontDatabase & getDatabase () MGIS_NOEXCEPT
MGIS_EXPORT MGIS_NODISCARD InvalidResult registerExceptionInErrorBacktrace (ErrorBacktrace &) MGIS_NOEXCEPT
 a custom Lippincott-like function that extract error messages from an exception
MGIS_EXPORT MGIS_NODISCARD InvalidResult registerExceptionInErrorBacktraceWithoutSourceLocation (ErrorBacktrace &) MGIS_NOEXCEPT
 a custom Lippincott-like function that extract error messages from an exception
constexpr bool isInvalid (const InvalidResult &) MGIS_NOEXCEPT
constexpr bool isInvalid (const bool) MGIS_NOEXCEPT
template<typename T>
constexpr bool isInvalid (const std::optional< T > &) MGIS_NOEXCEPT
template<typename T>
constexpr bool isInvalid (T *const) MGIS_NOEXCEPT
template<typename T>
constexpr bool isInvalid (const std::unique_ptr< T > &) MGIS_NOEXCEPT
template<typename T>
constexpr bool isInvalid (const std::shared_ptr< T > &) MGIS_NOEXCEPT
constexpr bool areInvalid (const auto &...) MGIS_NOEXCEPT
constexpr bool isValid (const auto &) MGIS_NOEXCEPT
constexpr bool areValid (const auto &...) MGIS_NOEXCEPT
constexpr bool areInvalid (const auto &...o) MGIS_NOEXCEPT
constexpr bool areValid (const auto &...o) MGIS_NOEXCEPT
MGIS_EXPORT MGIS_NODISCARD std::ostream & getDefaultLogStream () MGIS_NOEXCEPT
MGIS_EXPORT MGIS_NODISCARD std::pair< bool, std::string > setDefaultLogStream (std::string_view) MGIS_NOEXCEPT
 set the default log stream as a file.
MGIS_EXPORT void setDefaultLogStream (std::ostream &) MGIS_NOEXCEPT
 set the default log stream from an exisiting output stream
MGIS_EXPORT void setDefaultLogStream (std::shared_ptr< std::ostream >) MGIS_NOEXCEPT
 set the default log stream from an exisiting output stream
MGIS_EXPORT void resetDefaultLogStream () MGIS_NOEXCEPT
 reset the default log stream
MGIS_EXPORT void disableDefaultLogStream () MGIS_NOEXCEPT
 disable the default log stream
MGIS_EXPORT void setStreamColor (std::ostream &, const OutputStreamColors) MGIS_NOEXCEPT
 change the color of the output for warnings for red
MGIS_EXPORT void resetStreamColor (std::ostream &) MGIS_NOEXCEPT
 reset the color of the output
template<typename... Args>
void warning (std::ostream &, Args &&...) MGIS_NOEXCEPT
 print a warning message
template<typename... Args>
void debug (std::ostream &, Args &&...) MGIS_NOEXCEPT
 print message for debugging
MGIS_EXPORT void setErrorColor (std::ostream &) MGIS_NOEXCEPT
MGIS_EXPORT void setWarningColor (std::ostream &) MGIS_NOEXCEPT
template<typename... Args>
void warning (std::ostream &os, Args &&...args) MGIS_NOEXCEPT
template<typename... Args>
void debug (std::ostream &os, Args &&...args) MGIS_NOEXCEPT
MGIS_EXPORT void setExceptionHandler (ExceptionHandler)
 set an exception handler
MGIS_EXPORT ExceptionHandler getExceptionHandler ()
 return a registred exception handler, nullptr if none were registred.
template<typename Exception = std::runtime_error>
MGIS_VISIBILITY_LOCAL void raise ()
 a small wrapper used to build the exception outside the throw statement. As most exception's classes constructors may throw, this avoids undefined behaviour as reported by the cert-err60-cpp warning of clang-tidy (thrown exception type is not nothrow copy constructible).
template<typename Exception = std::runtime_error, typename... Args>
MGIS_VISIBILITY_LOCAL void raise (Args &&...)
 a small wrapper used to build the exception outside the throw statement. As most exception's classes constructors may throw, this avoids undefined behaviour as reported by the cert-err60-cpp warning of clang-tidy (thrown exception type is not nothrow copy constructible).
template<typename Exception = std::runtime_error>
MGIS_VISIBILITY_LOCAL void raise_if (const bool)
 raise an exception if the first argument is true.
template<typename Exception = std::runtime_error, typename... Args>
MGIS_VISIBILITY_LOCAL void raise_if (const bool, Args &&...)
 raise an exception if the first argument is true.
template<typename Exception>
void raise ()
 a small wrapper used to build the exception outside the throw statement. As most exception's classes constructors may throw, this avoids undefined behaviour as reported by the cert-err60-cpp warning of clang-tidy (thrown exception type is not nothrow copy constructible).
template<typename Exception, typename... Args>
void raise (Args &&... a)
template<typename Exception>
void raise_if (const bool c)
 raise an exception if the first argument is true.
template<typename Exception, typename... Args>
void raise_if (const bool c, Args &&... a)
template<typename Type, typename... ArgumentsTypes>
requires ::mgis::internals::is_constructible<Type, ArgumentsTypes...>
std::optional< Type > construct (Context &, ArgumentsTypes &&...) MGIS_NOEXCEPT
 try to build an object of the given type.
template<typename Type, typename... ArgumentsTypes>
requires ::mgis::internals::is_constructible<Type, ArgumentsTypes...>
std::unique_ptr< Type > make_unique (Context &, ArgumentsTypes &&...) MGIS_NOEXCEPT
 try to build a unique pointer holding the given type.
template<typename BaseType, typename Type, typename... ArgumentsTypes>
requires std::is_base_of_v<BaseType, Type> && ::mgis::internals::is_constructible<Type, ArgumentsTypes...>
std::unique_ptr< BaseType > make_unique_as (Context &, ArgumentsTypes &&...) MGIS_NOEXCEPT
 try to build a unique pointer of a base type holding the given type.
template<typename Type, typename... ArgumentsTypes>
requires ::mgis::internals::is_constructible<Type, ArgumentsTypes...>
std::shared_ptr< Type > make_shared (Context &, ArgumentsTypes &&...) MGIS_NOEXCEPT
 try to build a shared pointer holding the given type.
template<typename BaseType, typename Type, typename... ArgumentsTypes>
requires std::is_base_of_v<BaseType, Type> && ::mgis::internals::is_constructible<Type, ArgumentsTypes...>
std::shared_ptr< BaseType > make_shared_as (Context &, ArgumentsTypes &&...) MGIS_NOEXCEPT
 try to build a shared pointer of a base type holding the given type.
template<typename Type, typename... ArgumentsTypes>
requires ::mgis::internals::is_constructible<Type, ArgumentsTypes...>
std::optional< Type > construct (Context &ctx, ArgumentsTypes &&...args) MGIS_NOEXCEPT
template<typename Type, typename... ArgumentsTypes>
requires ::mgis::internals::is_constructible<Type, ArgumentsTypes...>
std::unique_ptr< Type > make_unique (Context &ctx, ArgumentsTypes &&...args) MGIS_NOEXCEPT
template<typename BaseType, typename Type, typename... ArgumentsTypes>
requires std::is_base_of_v<BaseType, Type> && ::mgis::internals::is_constructible<Type, ArgumentsTypes...>
std::unique_ptr< BaseType > make_unique_as (Context &ctx, ArgumentsTypes &&...args) MGIS_NOEXCEPT
template<typename Type, typename... ArgumentsTypes>
requires ::mgis::internals::is_constructible<Type, ArgumentsTypes...>
std::shared_ptr< Type > make_shared (Context &ctx, ArgumentsTypes &&...args) MGIS_NOEXCEPT
template<typename BaseType, typename Type, typename... ArgumentsTypes>
requires std::is_base_of_v<BaseType, Type> && ::mgis::internals::is_constructible<Type, ArgumentsTypes...>
std::shared_ptr< BaseType > make_shared_as (Context &ctx, ArgumentsTypes &&...args) MGIS_NOEXCEPT
template<typename F, typename... ArgumentsTypes>
invoke_result_t< F, ArgumentsTypes... > invoke (Context &, F &&, ArgumentsTypes &&...) MGIS_NOEXCEPT
 invoke the given callable object param[inout] ctx: execution context
template<typename F, typename... ArgumentsTypes>
invoke_result_t< F, ArgumentsTypes... > invokeCheckErrno (Context &, F &&, ArgumentsTypes &&...) MGIS_NOEXCEPT
template<typename F, typename... ArgumentsTypes>
invoke_result_t< F, ArgumentsTypes... > invokeCheckErrno (Context &ctx, F &&f, ArgumentsTypes &&...args) MGIS_NOEXCEPT
template<typename F, typename... ArgumentsTypes>
invoke_result_t< F, ArgumentsTypes... > invoke (Context &ctx, F &&f, ArgumentsTypes &&...args) MGIS_NOEXCEPT
template<typename ValueType>
void swap (OptionalReference< ValueType > &p1, OptionalReference< ValueType > &p2) MGIS_NOEXCEPT
template<typename ValueType>
constexpr OptionalReference< ValueType > make_optional_reference (ValueType &p) MGIS_NOEXCEPT
template<typename ValueType>
constexpr OptionalReference< ValueType > make_optional_reference (ValueType *p) MGIS_NOEXCEPT
template<typename ValueType1, typename ValueType2>
constexpr bool operator== (OptionalReference< ValueType1 > p1, OptionalReference< ValueType2 > p2)
template<typename ValueType1, typename ValueType2>
constexpr bool operator!= (OptionalReference< ValueType1 > p1, OptionalReference< ValueType2 > p2)
template<typename ValueType>
constexpr bool operator== (OptionalReference< ValueType > p, std::nullptr_t) MGIS_NOEXCEPT
template<typename ValueType>
constexpr bool operator== (std::nullptr_t, OptionalReference< ValueType > p) MGIS_NOEXCEPT
template<typename ValueType>
constexpr bool operator!= (OptionalReference< ValueType > p, std::nullptr_t) MGIS_NOEXCEPT
template<typename ValueType>
constexpr bool operator!= (std::nullptr_t, OptionalReference< ValueType > p) MGIS_NOEXCEPT
template<typename ValueType>
constexpr bool isInvalid (const OptionalReference< ValueType > &p) MGIS_NOEXCEPT
MGIS_EXPORT VerbosityLevel & getDefaultVerbosityLevel () MGIS_NOEXCEPT
MGIS_EXPORT void setDefaultVerbosityLevel (const VerbosityLevel) MGIS_NOEXCEPT
 change the default level of verbosity
MGIS_EXPORT bool setDefaultVerbosityLevel (Context &, std::string_view) MGIS_NOEXCEPT
 change the default level of verbosity
MGIS_EXPORT std::optional< VerbosityLevel > convertToVerbosityLevel (Context &, std::string_view) MGIS_NOEXCEPT

Variables

constexpr auto unsafe = attributes::UnsafeAttribute{}
constexpr auto throwing = attributes::ThrowingAttribute<true>{}
constexpr auto not_throwing = attributes::ThrowingAttribute<false>{}
constexpr auto aborting = attributes::AbortingAttribute<true>{}
constexpr size_type dynamic_extent
 a constant whose role is similar to std::dynamic_extent
template<typename Type, typename... Args>
constexpr auto is_check_preconditions_callable
constexpr auto no_precondition_check = PreconditionsCheck<false>{}
constexpr auto preconditions_check = PreconditionsCheck<true>{}

Detailed Description

the namespace mgis encloses all the MGIS project.

Typedef Documentation

◆ invoke_result_t

template<typename F, typename... ArgumentsTypes>
using mgis::invoke_result_t
Initial value:
std::conditional_t<
std::is_void_v<std::invoke_result_t<F, ArgumentsTypes...>>,
bool,
std::optional<std::invoke_result_t<F, ArgumentsTypes...>>>

a simple alias

Enumeration Type Documentation

◆ OutputStreamColors

enum struct mgis::OutputStreamColors
strong

list of available colors for output stream

Note
this only works on the terminal

◆ StorageMode

enum struct mgis::StorageMode
strong

storage option for a non uniform material property or non uniform external state variable.

Enumerator
LOCAL_STORAGE 

use std::vector to store the data

EXTERNAL_STORAGE 

use std::span to store the data

Function Documentation

◆ abort()

MGIS_NORETURN MGIS_EXPORT void mgis::abort ( std::string_view )

call the terminate handler

Parameters
[in]msgmessage
Note
this function is simply an alias to terminate

◆ areInvalid()

bool mgis::areInvalid ( const auto & ...)
nodiscardconstexpr
Returns
if one of the given objects is invalid
Parameters
[in]oobjects tested

◆ areValid()

bool mgis::areValid ( const auto & ...)
nodiscardconstexpr
Returns
if all the given objects are valid
Parameters
[in]oobjects tested

◆ construct()

template<typename Type, typename... ArgumentsTypes>
requires ::mgis::internals::is_constructible<Type, ArgumentsTypes...>
std::optional< Type > mgis::construct ( Context & ,
ArgumentsTypes && ... )
nodiscard

try to build an object of the given type.

The constructor of the object may throw. In this case, the exception thrown is catched and the information hold by the exception is added to the list of registered error messages.

Template Parameters
Typetype to build.
ArgumentsTypestypes of the arguments passed to the constructor.
Parameters
[in,out]ctxexecution context
[in]argsarguments passed to the constructor

◆ convertToVerbosityLevel()

MGIS_EXPORT std::optional< VerbosityLevel > mgis::convertToVerbosityLevel ( Context & ,
std::string_view  )
nodiscard
Returns
the level of verbosity associated with the given string
Parameters
[in]ctxexecution context
[in]lstring representation of the verbose level

◆ debug()

template<typename... Args>
void mgis::debug ( std::ostream & ,
Args && ... )

print message for debugging

Template Parameters
Argstypes of the arguments
Parameters
[in]argsstreamed object

◆ disableDefaultLogStream()

MGIS_EXPORT void mgis::disableDefaultLogStream ( )

disable the default log stream

Note
logging is disable by creating a no-op output stream

◆ getDatabase()

MGIS_VISIBILITY_EXPORT mfront::MFrontDatabase & mgis::getDatabase ( )
Returns
a global instance of a MFrontDatabase

◆ getDefaultLogStream()

MGIS_EXPORT MGIS_NODISCARD std::ostream & mgis::getDefaultLogStream ( )
Returns
the default log stream
Note
by default, std::cout is returned

◆ getDefaultVerbosityLevel()

MGIS_EXPORT VerbosityLevel & mgis::getDefaultVerbosityLevel ( )
nodiscard
Returns
the current default value of the verbosity level

◆ invoke()

template<typename F, typename... ArgumentsTypes>
invoke_result_t< F, ArgumentsTypes... > mgis::invoke ( Context & ,
F && ,
ArgumentsTypes && ... )

invoke the given callable object param[inout] ctx: execution context

Parameters
[in]Fcallable object
[in]argsarguments
Warning
If the function invoked has optional arguments (with default values), all the optional arguments must be provided, else the code will not compile with an obscure error message
Note
a version check the errno value while the other don't (names are self descriptive)

◆ isInvalid() [1/6]

bool mgis::isInvalid ( const bool b)
nodiscardconstexpr
Returns
if the given boolean is true
Parameters
[in]bvalue

◆ isInvalid() [2/6]

bool mgis::isInvalid ( const InvalidResult & )
nodiscardconstexpr
Returns
false
Parameters
[in]vvalue

◆ isInvalid() [3/6]

template<typename T>
bool mgis::isInvalid ( const std::optional< T > & o)
nodiscardconstexpr
Returns
if the given optional is invalid (does not contain an object)
Parameters
[in]ooptional value

◆ isInvalid() [4/6]

template<typename T>
bool mgis::isInvalid ( const std::shared_ptr< T > & p)
nodiscardconstexpr
Returns
if the given std::shared_ptr is invalid (i.e. is empty)
Parameters
[in]ppointer

◆ isInvalid() [5/6]

template<typename T>
bool mgis::isInvalid ( const std::unique_ptr< T > & p)
nodiscardconstexpr
Returns
if the given std::unique_ptr is invalid (i.e. is empty)
Parameters
[in]ppointer

◆ isInvalid() [6/6]

template<typename T>
bool mgis::isInvalid ( T * const ptr)
nodiscardconstexpr
Returns
if the given pointer is null (i.e. is empty)
Parameters
[in]ppointer

◆ isValid()

bool mgis::isValid ( const auto & o)
nodiscardconstexpr
Returns
if the given object is valid
Parameters
[in]oobject tested

◆ make_shared()

template<typename Type, typename... ArgumentsTypes>
requires ::mgis::internals::is_constructible<Type, ArgumentsTypes...>
std::shared_ptr< Type > mgis::make_shared ( Context & ,
ArgumentsTypes && ... )
nodiscard

try to build a shared pointer holding the given type.

The constructor of the object may throw. In this case, the exception thrown is catched and the information hold by the exception is added to the list of registered error messages.

Template Parameters
Typetype to build.
ArgumentsTypestypes of the arguments passed to the constructor.
Parameters
[in,out]ctxexecution context
[in]argsarguments passed to the constructor

◆ make_shared_as()

template<typename BaseType, typename Type, typename... ArgumentsTypes>
requires std::is_base_of_v<BaseType, Type> && ::mgis::internals::is_constructible<Type, ArgumentsTypes...>
std::shared_ptr< BaseType > mgis::make_shared_as ( Context & ,
ArgumentsTypes && ... )
nodiscard

try to build a shared pointer of a base type holding the given type.

The constructor of the object may throw. In this case, the exception thrown is catched and the information hold by the exception is added to the list of registered error messages.

Template Parameters
BaseTypebase type used to store the build object.
Typetype to build.
ArgumentsTypestypes of the arguments passed to the constructor.
Parameters
[in,out]ctxexecution context
[in]argsarguments passed to the constructor

◆ make_unique()

template<typename Type, typename... ArgumentsTypes>
requires ::mgis::internals::is_constructible<Type, ArgumentsTypes...>
std::unique_ptr< Type > mgis::make_unique ( Context & ,
ArgumentsTypes && ... )
nodiscard

try to build a unique pointer holding the given type.

The constructor of the object may throw. In this case, the exception thrown is catched and the information hold by the exception is added to the list of registered error messages.

Template Parameters
BaseTypebase type used to store the build object.
Typetype to build.
ArgumentsTypestypes of the arguments passed to the constructor.
Parameters
[in,out]ctxexecution context
[in]argsarguments passed to the constructor

◆ make_unique_as()

template<typename BaseType, typename Type, typename... ArgumentsTypes>
requires std::is_base_of_v<BaseType, Type> && ::mgis::internals::is_constructible<Type, ArgumentsTypes...>
std::unique_ptr< BaseType > mgis::make_unique_as ( Context & ,
ArgumentsTypes && ... )
nodiscard

try to build a unique pointer of a base type holding the given type.

The constructor of the object may throw. In this case, the exception thrown is catched and the information hold by the exception is added to the list of registered error messages.

Template Parameters
BaseTypebase type used to store the build object.
Typetype to build.
ArgumentsTypestypes of the arguments passed to the constructor.
Parameters
[in,out]ctxexecution context
[in]argsarguments passed to the constructor

◆ raise() [1/3]

template<typename Exception = std::runtime_error>
MGIS_VISIBILITY_LOCAL void mgis::raise ( )
inline

a small wrapper used to build the exception outside the throw statement. As most exception's classes constructors may throw, this avoids undefined behaviour as reported by the cert-err60-cpp warning of clang-tidy (thrown exception type is not nothrow copy constructible).

Template Parameters
Exceptiontype of the exception to be thrown.

◆ raise() [2/3]

template<typename Exception>
void mgis::raise ( )
inline

a small wrapper used to build the exception outside the throw statement. As most exception's classes constructors may throw, this avoids undefined behaviour as reported by the cert-err60-cpp warning of clang-tidy (thrown exception type is not nothrow copy constructible).

Template Parameters
Exceptiontype of the exception to be thrown.

◆ raise() [3/3]

template<typename Exception = std::runtime_error, typename... Args>
MGIS_VISIBILITY_LOCAL void mgis::raise ( Args && ...)
inline

a small wrapper used to build the exception outside the throw statement. As most exception's classes constructors may throw, this avoids undefined behaviour as reported by the cert-err60-cpp warning of clang-tidy (thrown exception type is not nothrow copy constructible).

Template Parameters
Exceptiontype of the exception to be thrown.
Argstype of the arguments passed to the exception' constructor.
Parameters
[in]aarguments passed to the exception' constructor.

◆ raise_if() [1/3]

template<typename Exception>
void mgis::raise_if ( const bool c)
inline

raise an exception if the first argument is true.

Template Parameters
Exceptiontype of the exception to be thrown.
Parameters
[in]bcondition to be checked. If true, an exception is thrown.

◆ raise_if() [2/3]

template<typename Exception = std::runtime_error>
MGIS_VISIBILITY_LOCAL void mgis::raise_if ( const bool c)
inline

raise an exception if the first argument is true.

Template Parameters
Exceptiontype of the exception to be thrown.
Parameters
[in]bcondition to be checked. If true, an exception is thrown.

◆ raise_if() [3/3]

template<typename Exception = std::runtime_error, typename... Args>
MGIS_VISIBILITY_LOCAL void mgis::raise_if ( const bool ,
Args && ... )
inline

raise an exception if the first argument is true.

Template Parameters
Exceptiontype of the exception to be thrown.
Argstype of the arguments passed to the exception' constructor.
Parameters
[in]bcondition to be checked. If true, an exception is thrown.
[in]aarguments passed to the exception' constructor.

◆ registerExceptionInErrorBacktrace()

MGIS_EXPORT MGIS_NODISCARD InvalidResult mgis::registerExceptionInErrorBacktrace ( ErrorBacktrace & )

a custom Lippincott-like function that extract error messages from an exception

Parameters
[out]eerror back trace handler

◆ registerExceptionInErrorBacktraceWithoutSourceLocation()

MGIS_EXPORT MGIS_NODISCARD InvalidResult mgis::registerExceptionInErrorBacktraceWithoutSourceLocation ( ErrorBacktrace & )

a custom Lippincott-like function that extract error messages from an exception

Parameters
[out]eerror back trace handler

◆ resetStreamColor()

MGIS_EXPORT void mgis::resetStreamColor ( std::ostream & )

reset the color of the output

Parameters
[out]outoutput stream
[in]lverbosity level

◆ setDefaultLogStream() [1/3]

MGIS_EXPORT void mgis::setDefaultLogStream ( std::ostream & )

set the default log stream from an exisiting output stream

Parameters
[in,out]osoutput stream
Note
the user is responsible for ensuring that the given object is alive

◆ setDefaultLogStream() [2/3]

MGIS_EXPORT void mgis::setDefaultLogStream ( std::shared_ptr< std::ostream > )

set the default log stream from an exisiting output stream

Parameters
[in,out]osoutput stream
Note
if the given pointer is null, resetDefaultLogStream is called

◆ setDefaultLogStream() [3/3]

MGIS_EXPORT MGIS_NODISCARD std::pair< bool, std::string > mgis::setDefaultLogStream ( std::string_view )

set the default log stream as a file.

Returns
a pair whose firt term indicates if the operation was successful. In case of failure, the second term contains if an error message.
Parameters
[in]nfile name
Note
In parallel, each process shall have its own output file or call disableDefaultLogStream except on the root process

◆ setDefaultVerbosityLevel() [1/2]

MGIS_EXPORT void mgis::setDefaultVerbosityLevel ( const VerbosityLevel )

change the default level of verbosity

Parameters
[in]lthe new verbose level

◆ setDefaultVerbosityLevel() [2/2]

MGIS_EXPORT bool mgis::setDefaultVerbosityLevel ( Context & ,
std::string_view  )

change the default level of verbosity

Parameters
[in]ctxexecution context
[in]lthe new verbose level

◆ setExceptionHandler()

MGIS_EXPORT void mgis::setExceptionHandler ( ExceptionHandler )

set an exception handler

Parameters
[in]hexception handler
void handler() {
try {
throw;
} catch (std::exception& e) {
std::cerr << e.what() << '\n';
} catch (...) {
std::cerr << "unknown exception thrown";
}
std::abort();
} // end of handler
mgis::raise<std::logic_error>("something went wrong");
MGIS_VISIBILITY_LOCAL void raise()
a small wrapper used to build the exception outside the throw statement. As most exception's classes ...
Definition Raise.ixx:23
MGIS_EXPORT void setExceptionHandler(ExceptionHandler)
set an exception handler

◆ setStreamColor()

MGIS_EXPORT void mgis::setStreamColor ( std::ostream & ,
const OutputStreamColors  )

change the color of the output for warnings for red

Parameters
[out]outoutput stream
[in]ccolor
Note
this only works on the terminal

◆ setTerminateHandler()

MGIS_EXPORT void mgis::setTerminateHandler ( const TerminateHandler )

specify a new terminate handler

Parameters
[in]hhandler

◆ terminate()

MGIS_NORETURN MGIS_EXPORT void mgis::terminate ( std::string_view )

call the terminate handler

Parameters
[in]msgmessage

◆ warning()

template<typename... Args>
void mgis::warning ( std::ostream & ,
Args && ... )

print a warning message

Template Parameters
Argstypes of the arguments
Parameters
[in]argsstreamed object

Variable Documentation

◆ dynamic_extent

size_type mgis::dynamic_extent
inlineconstexpr
Initial value:
=
std::numeric_limits<size_type>::max()

a constant whose role is similar to std::dynamic_extent

◆ is_check_preconditions_callable

template<typename Type, typename... Args>
auto mgis::is_check_preconditions_callable
inlineconstexpr
Initial value:
=
requires(ContractViolationHandler &e, Args... rargs) {
{ Type::checkPreconditions(e, rargs...) } -> std::same_as<bool>;
}
a class used to report a contract violation
Definition Contract.hxx:31