FEAT 3
Finite Element Analysis Toolbox
Loading...
Searching...
No Matches
base_header.hpp
Go to the documentation of this file.
1// FEAT3: Finite Element Analysis Toolbox, Version 3
2// Copyright (C) 2010 by Stefan Turek & the FEAT group
3// FEAT3 is released under the GNU General Public License version 3,
4// see the file 'copyright.txt' in the top level directory for details.
5
6#pragma once
7
16// Include FEAT configuration header.
17#ifndef FEAT_NO_CONFIG
18# include <feat_config.hpp>
19#endif
20
21// Make sure the DOXYGEN macro is not defined at compile-time;
22// it is reserved for doxygen's preprocessor.
23#ifdef DOXYGEN
24# error The DOXYGEN macro must not be defined at compile-time
25#else
26# define DOXY(x)
27#endif
28
30// Activate DEBUG macro if the build system tells us to do so.
31#if defined(FEAT_DEBUG_MODE) && !defined(DEBUG)
32# define DEBUG 1
33#endif
34
35// macro used by compiler detection headers to build compiler version string
36#ifndef FEAT_STRINGIFY
37#define FEAT_STRINGIFY_HELPER(x) #x
38#define FEAT_STRINGIFY(x) FEAT_STRINGIFY_HELPER(x)
39#endif
41
42// include compiler detection headers
43#include <kernel/util/compiler_intel_oneapi.hpp> // Intel(R) OneAPI C/C++ compiler // Needs to be included before classic intel and llvm and gnu compilers
44#include <kernel/util/compiler_intel.hpp> // Intel(R) C/C++ compiler
45#include <kernel/util/compiler_clang.hpp> // Clang/LLVM Compiler.
46#include <kernel/util/compiler_cray.hpp> // Cray C++ Compiler.
47#include <kernel/util/compiler_microsoft.hpp> // Microsoft(R) (Visual) C/C++ compiler
48// The GNU compiler must be the last one in this list, because other compilers (e.g. Intel and Clang)
49// also define the __GNUC__ macro used to identify the GNU C/C++ compiler, thus leading to incorrect
50// compiler detection.
51#include <kernel/util/compiler_gnu.hpp> // GNU C/C++ compiler
52
53// hide the following block from doxygen
55
56// If the compiler does not support a 'noinline' specifier, we'll define it as an empty macro.
57#ifndef NOINLINE
58#define NOINLINE
59#endif
60
61// If the compiler does not support a 'force-inline' specifier, we'll define it as a simple inline.
62#ifndef FORCE_INLINE
63#define FORCE_INLINE inline
64#endif
65
66// If the compiler does not support a loop vectorization specifier, we'll define it as an empty macro.
67#ifndef FEAT_PRAGMA_IVDEP
68#define FEAT_PRAGMA_IVDEP
69#endif
70
71// If the compiler does not support disabling/restoring warnings, we'll define the corresponding
72// macros as empty.
73#ifndef FEAT_DISABLE_WARNINGS
74#define FEAT_DISABLE_WARNINGS
75#endif
76#ifndef FEAT_RESTORE_WARNINGS
77#define FEAT_RESTORE_WARNINGS
78#endif
79
80// Unless the compiler detection header explicitly defined 'FEAT_PRAGMA_OMP', we define it as an OpenMP
81// pragma here, if the FEAT_HAVE_OMP define is set, otherwise we will define it as an empty macro.
82#ifndef FEAT_PRAGMA_OMP
83#ifdef FEAT_HAVE_OMP
84#define FEAT_PRAGMA_OMP_HELPER(x) _Pragma(#x)
85#define FEAT_PRAGMA_OMP(x) FEAT_PRAGMA_OMP_HELPER(omp x)
86#else
87#define FEAT_PRAGMA_OMP(x)
88#endif
89#endif
90
91// If we use the quadmath library, we can use this macro to define 128-bit floating point constants.
92#ifdef FEAT_HAVE_QUADMATH
93# define FEAT_F128C(x) x##Q
94#else
95# define FEAT_F128C(x) x
96#endif
97
99// end of block hidden from doxygen
100
101// include integer definition header from C/C++ standard library
102#include <cstdint>
103
107namespace FEAT
108{
110 static constexpr int version_major = 3;
112 static constexpr int version_minor = 2025;
114 static constexpr int version_patch = 10;
115
119#ifdef FEAT_INDEX_U32
120 typedef std::uint32_t Index;
121#else
122 typedef std::uint64_t Index;
123#endif
124
128 typedef double Real;
129} // namespace FEAT
130
131// define macros for nvcc
132// generally these macros have to be prepended to any function or method that could be (implicitly) used by a cuda kernel
133// since we do not always compile with nvcc directly (only cuda kernels themselves), we have to define the nvcc macros so
134// we do not get a compilation error
135#ifdef __NVCC__
138#define CUDA_HOST __host__
140#define CUDA_DEVICE __device__
142#define CUDA_HOST_DEVICE __host__ __device__
143#else
144#define CUDA_HOST
145#define CUDA_DEVICE
146#define CUDA_HOST_DEVICE
147#endif
Compiler detection header for Clang C++ compiler.
Compiler detection header for Cray C++ compiler.
Compiler detection header for GNU C++ compiler.
Compiler detection header for Intel C++ compiler.
Compiler detection header for Microsoft Visual C++ compiler.
FEAT namespace.
Definition: adjactor.hpp:12
double Real
Real data type.
static constexpr int version_major
FEAT major version number.
static constexpr int version_patch
FEAT patch version number.
static constexpr int version_minor
FEAT minor version number.
std::uint64_t Index
Index data type.