MFEM
v4.7.0
Finite element discretization library
Loading...
Searching...
No Matches
config
config.hpp
Go to the documentation of this file.
1
// Copyright (c) 2010-2024, Lawrence Livermore National Security, LLC. Produced
2
// at the Lawrence Livermore National Laboratory. All Rights reserved. See files
3
// LICENSE and NOTICE for details. LLNL-CODE-806117.
4
//
5
// This file is part of the MFEM library. For more information and source code
6
// availability visit https://mfem.org.
7
//
8
// MFEM is free software; you can redistribute it and/or modify it under the
9
// terms of the BSD-3 license. We welcome feedback and contributions, see file
10
// CONTRIBUTING.md for details.
11
12
13
// Support out-of-source builds: if MFEM_CONFIG_FILE is defined, include it.
14
//
15
// Otherwise, use the local file: _config.hpp.
16
17
#ifndef MFEM_CONFIG_HPP
18
#define MFEM_CONFIG_HPP
19
20
#ifdef MFEM_CONFIG_FILE
21
#include MFEM_CONFIG_FILE
22
#else
23
#include "_config.hpp"
24
#endif
25
26
namespace
mfem
27
{
28
29
#if (defined(MFEM_USE_CUDA) && defined(__CUDACC__)) || \
30
(defined(MFEM_USE_HIP) && defined(__HIPCC__))
31
#define MFEM_HOST_DEVICE __host__ __device__
32
#else
33
#define MFEM_HOST_DEVICE
34
#endif
35
36
// MFEM precision configuration
37
38
#if defined MFEM_USE_SINGLE && defined MFEM_USE_DOUBLE
39
#error "DOUBLE and SINGLE precision cannot both be specified"
40
#endif
41
42
#ifdef MFEM_USE_SINGLE
43
typedef
float
real_t
;
44
#elif defined MFEM_USE_DOUBLE
45
typedef
double
real_t
;
46
#else
47
#error "Either DOUBLE or SINGLE precision must be specified"
48
#endif
49
50
MFEM_HOST_DEVICE
51
constexpr
real_t
operator
""
_r(
long
double
v)
52
{
53
return
static_cast<
real_t
>
(v);
54
}
55
56
MFEM_HOST_DEVICE
57
constexpr
real_t
operator
""
_r(
unsigned
long
long
v)
58
{
59
return
static_cast<
real_t
>
(v);
60
}
61
62
}
// namespace mfem
63
64
// Return value for main function in examples that should be skipped by testing
65
// in some case. This return value prevents failures in testing.
66
#define MFEM_SKIP_RETURN_VALUE 242
67
68
// Request a global object to be instantiated for each thread in its TLS.
69
#define MFEM_THREAD_LOCAL thread_local
70
71
// MFEM_DEPRECATED macro to mark obsolete functions and methods
72
// see https://stackoverflow.com/questions/295120/c-mark-as-deprecated
73
#if defined(__GNUC__) || defined(__clang__)
74
#define MFEM_DEPRECATED __attribute__((deprecated))
75
#elif defined(_MSC_VER)
76
#define MFEM_DEPRECATED __declspec(deprecated)
77
#else
78
#pragma message("WARNING: You need to implement MFEM_DEPRECATED for this compiler")
79
#define MFEM_DEPRECATED
80
#endif
81
82
// Common configuration macros
83
84
#if (__GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 7)) || defined(__clang__)
85
#define MFEM_HAVE_GCC_PRAGMA_DIAGNOSTIC
86
#endif
87
88
// Windows specific options
89
#if defined(_WIN32) && !defined(_USE_MATH_DEFINES)
90
// Macro needed to get defines like M_PI from <cmath>. (Visual Studio C++ only?)
91
#define _USE_MATH_DEFINES
92
#endif
93
// Macro MFEM_EXPORT: this macro is used when declaring exported global
94
// variables and static class variables in public header files, e.g.:
95
// extern MFEM_EXPORT Geometry Geometries;
96
// static MFEM_EXPORT Device device_singleton;
97
// In cases where a class contains multiple static variables, instead of marking
98
// all such variables with MFEM_EXPORT, one can mark the class with MFEM_EXPORT,
99
// e.g.:
100
// class MFEM_EXPORT MemoryManager ...
101
// Note: MFEM's GitHub CI includes a shared MSVC build that will fail if a
102
// variable that needs MFEM_EXPORT does not have it. However, builds with
103
// optional external libraries are not tested and may require separate checks to
104
// determine the necessity of MFEM_EXPORT.
105
#if defined(_MSC_VER) && defined(MFEM_SHARED_BUILD)
106
#ifdef mfem_EXPORTS
107
#define MFEM_EXPORT __declspec(dllexport)
108
#else
109
#define MFEM_EXPORT __declspec(dllimport)
110
#endif
111
#else
112
#define MFEM_EXPORT
113
#endif
114
// On Cygwin the option -std=c++11 prevents the definition of M_PI. Defining
115
// the following macro allows us to get M_PI and some needed functions, e.g.
116
// posix_memalign(), strdup(), strerror_r().
117
#ifdef __CYGWIN__
118
#define _XOPEN_SOURCE 600
119
#endif
120
121
// Check dependencies:
122
123
// Define MFEM_MPI_REAL_T to be the appropriate MPI real type
124
#ifdef MFEM_USE_MPI
125
#ifdef MFEM_USE_SINGLE
126
#define MFEM_MPI_REAL_T MPI_FLOAT
127
#elif defined MFEM_USE_DOUBLE
128
#define MFEM_MPI_REAL_T MPI_DOUBLE
129
#endif
130
#endif
131
132
// Options that require MPI
133
#ifndef MFEM_USE_MPI
134
#ifdef MFEM_USE_SUPERLU
135
#error Building with SuperLU_DIST (MFEM_USE_SUPERLU=YES) requires MPI (MFEM_USE_MPI=YES)
136
#endif
137
#ifdef MFEM_USE_MUMPS
138
#error Building with MUMPS (MFEM_USE_MUMPS=YES) requires MPI (MFEM_USE_MPI=YES)
139
#endif
140
#ifdef MFEM_USE_STRUMPACK
141
#error Building with STRUMPACK (MFEM_USE_STRUMPACK=YES) requires MPI (MFEM_USE_MPI=YES)
142
#endif
143
#ifdef MFEM_USE_MKL_CPARDISO
144
#error Building with MKL CPARDISO (MFEM_USE_MKL_CPARDISO=YES) requires MPI (MFEM_USE_MPI=YES)
145
#endif
146
#ifdef MFEM_USE_PETSC
147
#error Building with PETSc (MFEM_USE_PETSC=YES) requires MPI (MFEM_USE_MPI=YES)
148
#endif
149
#ifdef MFEM_USE_SLEPC
150
#error Building with SLEPc (MFEM_USE_SLEPC=YES) requires MPI (MFEM_USE_MPI=YES)
151
#endif
152
#ifdef MFEM_USE_PUMI
153
#error Building with PUMI (MFEM_USE_PUMI=YES) requires MPI (MFEM_USE_MPI=YES)
154
#endif
155
#endif
// MFEM_USE_MPI not defined
156
157
#endif
// MFEM_CONFIG_HPP
mfem
Definition
CodeDocumentation.dox:1
mfem::real_t
float real_t
Definition
config.hpp:43
1.11.0