Updated over 9 years ago by Knödlseder Jürgen
This page summarizes guidelines for the GammaLib development. We recommend that you follow these guidelines as closely as possible during your GammaLib developments.
GammaLib makes extensive use of mathematical functions, such as sin
, cos
, pow
, log10
, etc. Care has to be taken when using these functions, as improper usage may quickly lead to considerable speed penalties. Before you continue, you may learn about this by checking the Computation Benchmarks that were performed on various platforms.
pow
for integer exponents. Multiplications are always faster than pow
calls.pow
and exp
when possible. For example, pow(b, 0.5*(log_b(x) + log_b(y)))
can be written as sqrt(x*y)
, which is considerably faster.GammaLib makes use of OpenMP in various places. This imposes some thread save programming. Code sections that should not be executed in parallel, such as reading and writing from files, should be enclosed in a protective statement:
#pragma omp critical
{
const_cast<GCTAObservation*>(this)->load(m_eventfile);
}
This section provides links to C++ coding guidelines: