Geophysical Inversion and Modelling Library v1.5.4
Loading...
Searching...
No Matches
platform.h
1/******************************************************************************
2 * Copyright (C) 2006-2024 by the GIMLi development team *
3 * Carsten Rücker carsten@resistivity.net *
4 * *
5 * Licensed under the Apache License, Version 2.0 (the "License"); *
6 * you may not use this file except in compliance with the License. *
7 * You may obtain a copy of the License at *
8 * *
9 * http://www.apache.org/licenses/LICENSE-2.0 *
10 * *
11 * Unless required by applicable law or agreed to in writing, software *
12 * distributed under the License is distributed on an "AS IS" BASIS, *
13 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. *
14 * See the License for the specific language governing permissions and *
15 * limitations under the License. *
16 * *
17 ******************************************************************************/
18
19#ifndef _GIMLI_PLATFORM__H
20#define _GIMLI_PLATFORM__H
21
22#if defined(WINDOWS) || defined(_WIN32) || defined(WIN32)
23 //#error checkme
24
25 #define PATHSEPARATOR "\\"
26
27 #define WIN32_LEAN_AND_MEAN
28 #define BOOST_USE_WINDOWS_H
29 //#define BOOST_PLAT_WINDOWS_RUNTIME
30 #ifndef DLLEXPORT
31 #if defined(DLL_EXPORT) || defined(gimli_EXPORTS)
32 //* We are building this library
33 //#warning (GIMLI We are building this library)
34 #define DLLEXPORT __declspec(dllexport)
35 #else
36 //* We are using this library
37 //#warning (GIMLI We are using this library)
38 #define DLLEXPORT __declspec(dllimport)
39 #endif
40 #endif
41
42 // Don't let win32api windef.h define min and max as macros
43 // if included after c++config.h.
44 #ifndef NOMINMAX
45 #define NOMINMAX
46 #endif
47
48 #include <stddef.h>
49
50 #ifndef PYGIMLI_CAST
51 #include <windows.h>
52 #endif
53
54 #undef near
55 #undef far
56
57#else /* ELSE NO WINDOWS */
58 #define PATHSEPARATOR "/"
59 #define DLLEXPORT
60#endif /* NO WINDOWS */
61
65
66#include <cmath>
67
68namespace GIMLI{
69
71DLLEXPORT long numberOfCPU();
72
74DLLEXPORT int schedGetCPU();
75
76// Microsoft Visual C++ 10 does not provide some C99 functions
77#if defined(_MSC_VER)
78template< typename T > T rint( T x ){ return std::floor(x + 0.5); }
79template< typename T > inline bool isinf(T value){
80 return value >= std::numeric_limits<T>::min() &&
81 value <= std::numeric_limits<T>::max();}
82template< typename T > inline bool isnan(T value){return (value) != (value);}
83#elif defined(_WIN32) // mingw
84template< typename T > inline bool isinf(T value){return std::isinf(value);}
85template< typename T > inline bool isnan(T value){return std::isnan(value);}
86#else
87template< typename T > inline bool isinf(T value){return std::isinf(value);}
88template< typename T > inline bool isnan(T value){return std::isnan(value);}
89#endif
90
91
92}
93
94#if defined ( __APPLE__ ) || ( defined (__SVR4) && defined (__sun) )
95// #include <ieeefp.h>
96// inline int isinf( double x ){ return !finite(x) && x==x; }
97 // /*
98#include <unistd.h>
99#include <sys/types.h>
100
101// Apple (OS X) and Sun systems declare getopt in unistd.h,
102// other systems (Linux) use getopt.h
103// */
104// #if defined ( __APPLE__ ) || ( defined (__SVR4) && defined (__sun) )
105// #include <unistd.h>
106// struct option {
107// # if defined __STDC__ && __STDC__
108// const char *name;
109// # else
110// char *name;
111// # endif
112// /* has_arg can't be an enum because some compilers complain about
113// type mismatches in all the code that assumes it is an int. */
114// int has_arg;
115// int *flag;
116// int val;
117// };
118// #else
119
120#endif
121
122#endif // _GIMLI_PLATFORM__H
GIMLi main namespace for the Geophyiscal Inversion and Modelling Library.
Definition baseentity.h:24
int schedGetCPU()
Definition platform.cpp:66
long numberOfCPU()
Definition platform.cpp:33
RVector x(const R3Vector &rv)
Definition pos.cpp:107