GeneralDefine.h
Go to the documentation of this file.
1 //Copyright (c) 2013-2023, The MercuryDPM Developers Team. All rights reserved.
2 //For the list of developers, see <http://www.MercuryDPM.org/Team>.
3 //
4 //Redistribution and use in source and binary forms, with or without
5 //modification, are permitted provided that the following conditions are met:
6 // * Redistributions of source code must retain the above copyright
7 // notice, this list of conditions and the following disclaimer.
8 // * Redistributions in binary form must reproduce the above copyright
9 // notice, this list of conditions and the following disclaimer in the
10 // documentation and/or other materials provided with the distribution.
11 // * Neither the name MercuryDPM nor the
12 // names of its contributors may be used to endorse or promote products
13 // derived from this software without specific prior written permission.
14 //
15 //THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
16 //ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
17 //WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
18 //DISCLAIMED. IN NO EVENT SHALL THE MERCURYDPM DEVELOPERS TEAM BE LIABLE FOR ANY
19 //DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
20 //(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
21 //LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
22 //ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
23 //(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
24 //SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
25 
26 #ifndef GENERALDEFINE_H
27 #define GENERALDEFINE_H
28 
29 #include <limits>
30 
31 #ifdef HIGH_PRECISION
32 typedef long double Mdouble;
33 #else
34 typedef double Mdouble;
35 #endif
36 
37 #define MERCURYDPM_DEPRECATED [[deprecated]]
38 
39 #define UNUSED __attribute__ ((__unused__))
40 
41 namespace constants
42 {
43  const Mdouble NaN = std::numeric_limits<Mdouble>::quiet_NaN();
44  const Mdouble inf = std::numeric_limits<Mdouble>::infinity();
45  const int intMax = std::numeric_limits<int>::max();
46  const unsigned unsignedMax = std::numeric_limits<unsigned>::max();
47 }
48 
49 //The number of digits are important for MAX_PROC, not the actual number. It is used to determine unique communication tags
50 //IMPORTANT: Always take a value 10^a where a is a natural number above 0
51 #define MAX_PROC 1000
52 
58 #ifdef MERCURYDPM_USE_MPI
59 #define NUMBER_OF_PROCESSORS static_cast<unsigned>(MPIContainer::Instance().getNumberOfProcessors())
60 #define PROCESSOR_ID MPIContainer::Instance().getProcessorID()
61 #else
62 #define NUMBER_OF_PROCESSORS 1
63 #define PROCESSOR_ID 0
64 #endif
65 
66 #ifdef MERCURYDPM_USE_OMP
67 #define OMP_THREAD_NUM omp_get_thread_num()
68 #else
69 #define OMP_THREAD_NUM 0
70 #endif
71 
77 {
78  XAXIS = 0, YAXIS = 1, ZAXIS = 2
79 };
80 
81 
82 #endif
Direction
An enum that indicates the direction in Cartesian coordinates.
Definition: GeneralDefine.h:77
@ YAXIS
Definition: GeneralDefine.h:78
@ XAXIS
Definition: GeneralDefine.h:78
@ ZAXIS
Definition: GeneralDefine.h:78
double Mdouble
Definition: GeneralDefine.h:34
Definition: GeneralDefine.h:42
const Mdouble NaN
Definition: GeneralDefine.h:43
const unsigned unsignedMax
Definition: GeneralDefine.h:46
const Mdouble inf
Definition: GeneralDefine.h:44
const int intMax
Definition: GeneralDefine.h:45