Build switches

Back to Building the Pastel library

Pastel provides several build switches to control the code generation. We explain these switches here. Note that these switches are essentially enabled or disabled by the configuration you use to build Pastel.

Global preprocessor switches

In the following we list the global preprocessor switches which should be defined at the level of the build-system, not at the source code level.

PASTEL_ENABLE_PENSURES

ENSUREs are runtime checks used to check preconditions for functions. The triggering of such a check signals the presence of a bug on the user's side. However, some of these checks can cause relatively severe performance degradation, notably when the function is of low complexity. These checks are marked as PENSUREs, for Performance ENSURE. This build switch controls the code generation for PENSUREs. If PASTEL_ENABLE_PENSURES is defined, the tests are generated, otherwise they are not.

PASTEL_DEBUG_MODE

The ASSERTs form another class of runtime checks which are used internally to check invariants in the Pastel library. The triggering of such check always signals a presence of a bug on the part of the implementation. They can possibly interfere with optimization and therefore this switch allows to control whether their code is generated or not. If PASTEL_DEBUG_MODE is defined, the tests are generated, otherwise they are not.

PASTEL_ENABLE_OMP

Pastel uses the OpenMp library for parallelizing some sections of the code, such as all-nearest neighbors searching. The OpenMp library comes with a header file omp.h, which however might not always be available on a given building environment. To solve this problem, Pastel has a redirection file named pastelomp.h, which includes omp.h conditionally based on this build switch. If PASTEL_ENABLE_OMP is defined, then omp.h is included in pastelomp.h, otherwise it is not included.

Global type definitions

Pastel includes some global type definitions in the file mytypes.h, which is included in practically every file in Pastel. In that file there is particularly the definition of real type which you might want to change to either float or double based on your specific requirements. The other types should be chosen such that they meet the obvious requirements (e.g. the size of uint16 is 16 bits). These requirements are checked automatically in pastelsys.cpp in the PastelSys library. Compilation of that file fails if the requirements are not met. In this case you might need to change the types in mytypes.h to proper types.

Files

Conditionally includes omp.h

pastelomp.h

pastelomp.hpp

Environment-specific preprocessor definitions

environment.h

environment.hpp

Typedefs for types used in Pastel

mytypes.h

mytypes.hpp