HOM3 logo

High-Order Multiphysics Multiscale Methods

Development

How to contribute

You can learn everything you need to know about git here: the very basics, git branching, and how to write git commit messages. New code should include unit-test and pass all test in debug and release as well as conform to the style guide (still WIP).

Conventions

Testing

Utilities

All utilities are included with src/global.hpp and are located in src/misc.

Debugging

DBG("this is printed if ENABLE_DBG_ == 1 for the current file");
DBG_ON("this is always printed");
DBGV_ON((var)(f())(3)); // prints: "var : value | function() : value | 3 : 3"

Deprecated: For "long" functions (i.e. not one liners), we also have a trace back system that is used with the TRACE_IN/TRACE_OUT macros:

int fun(int a) {
TRACE_IN((a)); // pass the parameters to trace in
/*
do stuff
int b = ...;
*/
TRACE_OUT((b)); // you have to call a TRACE_OUT; before every return statement.
return b;
}

By enabling debug for a module with ENABLE_DBG_ == 1 you'll get the entry and exit points of every function in that module as well as the input parameters and return values of every function call.

Note: the above functionality is deprecated but hasn't been completely removed yet. To generate traces the preferred method is to use the instrumentation utilities with -finstrument-functions (GCC only, clang has a bug here).

Defensive programming

Check pre-conditions, post-conditions, invariants:

ASSERT(condition, message); // perform checks in debug mode
ASSERT([&]() -> bool { /* executes in debug mode */ }(), message);

Error handling

TERMINATE(message); // exits the program

There is also basic support for exceptions:

error::exception(message); // throws run-time error

For the moment there just hasn't been any exceptional behavior to handle. Most of the time if an error occurs there is absolutely nothing that we can do about it so hard errors (using TERMINATE) have been the preferred way of dealing with these situations.

Memory

Math

Input/Output

Ranges

Distributed computing

Interfaces

Traits

Return type deduction

Performance