FGlobal.hpp 2.74 KB
Newer Older
1
// ===================================================================================
2 3 4 5 6 7 8 9 10 11 12 13 14
// Copyright ScalFmm 2011 INRIA, Olivier Coulaud, Bérenger Bramas, Matthias Messner
// olivier.coulaud@inria.fr, berenger.bramas@inria.fr
// This software is a computer program whose purpose is to compute the FMM.
//
// This software is governed by the CeCILL-C and LGPL licenses and
// abiding by the rules of distribution of free software.  
// 
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
// GNU General Public and CeCILL-C Licenses for more details.
// "http://www.cecill.info". 
// "http://www.gnu.org/licenses".
15
// ===================================================================================
16 17 18
#ifndef FGLOBAL_HPP
#define FGLOBAL_HPP

19
#include "ScalFmmConfig.h"
20 21 22 23 24 25 26 27 28 29 30

///////////////////////////////////////////////////////
// Memory profiling
///////////////////////////////////////////////////////

#include "FMemStats.h"

///////////////////////////////////////////////////////
// Stdlib
///////////////////////////////////////////////////////

31
#include <cstdlib>
32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47

///////////////////////////////////////////////////////
// Operating System
///////////////////////////////////////////////////////

#if defined(_WIN32) || defined(ming)
    #define WINDOWS
#else
    #define POSIX
#endif


///////////////////////////////////////////////////////
// Types
///////////////////////////////////////////////////////

48
#ifdef ScalFMM_USE_DOUBLE_PRECISION
49 50 51 52
    typedef double FReal;
#else
    typedef float FReal;
#endif
53 54

typedef long long FSize;
55 56 57 58 59

///////////////////////////////////////////////////////
// Restrict
///////////////////////////////////////////////////////

60 61
static const int MaxTreeHeight = 20;

62 63 64 65 66 67 68 69

///////////////////////////////////////////////////////
// Morton index
///////////////////////////////////////////////////////

typedef long long MortonIndex;


70 71 72 73
///////////////////////////////////////////////////////
// Restrict
///////////////////////////////////////////////////////

74 75 76 77 78 79
#ifdef WINDOWS
    #define FRestrict __restrict
#else
    #define FRestrict __restrict__
#endif

80 81 82 83 84
///////////////////////////////////////////////////////
// Prefetch
///////////////////////////////////////////////////////

#ifdef __GNUC__
85
    #define Prefetch_Read(X)  __builtin_prefetch(X)
86 87 88
    #define Prefetch_Write(X) __builtin_prefetch(X,1,1)
#else
    #ifdef __INTEL_COMPILER
89
        #define Prefetch_Read(X)  _mm_prefetch(X,_MM_HINT_T0)
90 91 92 93 94 95 96 97
        #define Prefetch_Write(X) _mm_prefetch(X,_MM_HINT_T0)
    #else
        #warning compiler is not defined
        #define Prefetch_Read(X)
        #define Prefetch_Write(X)
    #endif
#endif

98 99
#endif //FGLOBAL_HPP