source: trunk/ADOL-C/include/adolc/internal/common.h @ 708

Last change on this file since 708 was 634, checked in by kulshres, 4 years ago

whitespace change

  • Property svn:keywords set to Author Date Id Revision
File size: 3.8 KB
Line 
1/*----------------------------------------------------------------------------
2 ADOL-C -- Automatic Differentiation by Overloading in C++
3 File:     common.h
4 Revision: $Id: common.h 634 2015-08-20 15:30:43Z kulshres $
5 Contents: Common (global) ADOL-C header 
6 
7 Copyright (c) Andrea Walther, Andreas Griewank, Andreas Kowarz,
8               Hristo Mitev, Sebastian Schlenkrich, Jean Utke, Olaf Vogel
9 
10 This file is part of ADOL-C. This software is provided as open source.
11 Any use, reproduction, or distribution of the software constitutes
12 recipient's acceptance of the terms of the accompanying license file.
13 
14----------------------------------------------------------------------------*/
15
16#if !defined(ADOLC_COMMON_H)
17#define ADOLC_COMMON_H 1
18
19#include <stdint.h>
20/*--------------------------------------------------------------------------*/
21/* standard includes */
22#if !defined(__cplusplus)
23#   include <stdlib.h>
24#   include <stdio.h>
25#else
26#   include <cstdlib>
27#   include <cstdio>
28#endif
29
30/*--------------------------------------------------------------------------*/
31/* type definitions */
32    typedef unsigned int uint;
33
34/*--------------------------------------------------------------------------*/
35/* OpenMP includes */
36#if defined(_OPENMP)
37#include <omp.h>
38#endif
39
40/*--------------------------------------------------------------------------*/
41/* system dependent configuration */
42#if defined(ADOLC_INTERNAL)
43#   if HAVE_CONFIG_H
44#       include "config.h"
45
46/*      malloc/calloc/realloc replacments */
47#       undef ADOLC_NO_MALLOC
48#       undef ADOLC_NO_REALLOC
49#       if !defined(HAVE_MALLOC)
50#           define ADOLC_NO_MALLOC 1
51#       else
52#           if (HAVE_MALLOC == 0)
53#               define ADOLC_NO_MALLOC 1
54#           endif /* HAVE_MALLOC == 0 */
55#       endif /* HAVE_MALLOC */
56#       if !defined(HAVE_REALLOC)
57#           define ADOLC_NO_REALLOC 1
58#       else
59#           if (HAVE_REALLOC == 0)
60#               define ADOLC_NO_REALLOC 1
61#           endif /* HAVE_REALLOC == 0 */
62#       endif /* HAVE_REALLOC */
63
64#       if defined(ADOLC_NO_MALLOC)
65#           include "rpl_malloc.h"
66#           define malloc rpl_malloc
67#           define calloc rpl_calloc
68#       endif /* ADOLC_NO_MALLOC */
69#       if defined(ADOLC_NO_REALLOC)
70#           include "rpl_malloc.h"
71#           define realloc rpl_realloc
72#       endif /* ADOLC_NO_REALLOC */
73
74#       ifndef HAVE_TRUNC
75#           define trunc(x) ( (x<0) ? ceil(x) : floor(x) )
76#       endif
77
78#   endif /* HAVE_CONFIG_H */
79#endif /* ADOLC_INTERNAL */
80
81/*--------------------------------------------------------------------------*/
82/* user parameters and settings */
83#include <adolc/internal/usrparms.h>
84#include <adolc/internal/adolc_settings.h>
85
86/*--------------------------------------------------------------------------*/
87/* windows dll exports/imports */
88#if defined(ADOLC_DLL)
89#   define ADOLC_DLL_EXPORT __declspec(dllexport)
90#   define ADOLC_DLL_EXPIMP __declspec(dllexport)
91#elif defined(_MSC_VER)
92#   define ADOLC_DLL_EXPORT
93#   define ADOLC_DLL_EXPIMP __declspec(dllimport)
94#else
95#   define ADOLC_DLL_EXPORT
96#   define ADOLC_DLL_EXPIMP
97#endif
98
99/*--------------------------------------------------------------------------*/
100/* further helpful macros */
101#if defined(__cplusplus)
102#  define BEGIN_C_DECLS extern "C" {
103#  define END_C_DECLS   }
104#else
105#  define BEGIN_C_DECLS
106#  define END_C_DECLS
107#endif
108
109#define MAXDEC(a,b) do { revreal __r = (b); if ( __r > (a) ) (a) = __r; } while (0)
110#define MAXDECI(a,b) do { int __r = (b); if ( __r > (a) ) (a) = __r; } while (0)
111#define MINDECR(a,b) do { revreal __r = (b); if ( __r < (a) ) (a) = __r; } while (0)
112#define MINDEC(a,b) do { int __r = (b); if ( __r < (a) ) (a) = __r; } while (0)
113
114#define MAX_ADOLC(a,b) ( (a)<(b)? (b):(a) )
115#define MIN_ADOLC(a,b) ( (a)>(b)? (b):(a) )
116
117/*--------------------------------------------------------------------------*/
118#endif
119
Note: See TracBrowser for help on using the repository browser.