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

Last change on this file since 354 was 354, checked in by kulshres, 8 years ago

Move all external headers into a separate directory

This let's us get rid of the symlink adolc that was previously required
for building and created problems sometimes
This also adjusts all Makefiles for examples to make external builds
possible.

Signed-off-by: Kshitij Kulshreshtha <kshitij@…>

  • Property svn:keywords set to Author Date Id Revision
File size: 3.5 KB
Line 
1/*----------------------------------------------------------------------------
2 ADOL-C -- Automatic Differentiation by Overloading in C++
3 File:     common.h
4 Revision: $Id: common.h 354 2012-10-01 11:32:26Z 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/*--------------------------------------------------------------------------*/
20/* standard includes */
21#if !defined(__cplusplus)
22#   include <stdlib.h>
23#   include <stdio.h>
24#else
25#   include <cstdlib>
26#   include <cstdio>
27    using namespace std;
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 dependend 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 "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 "malloc.h"
71#           define realloc rpl_realloc
72#       endif /* ADOLC_NO_REALLOC */
73
74#   endif /* HAVE_CONFIG_H */
75#endif /* ADOLC_INTERNAL */
76
77/*--------------------------------------------------------------------------*/
78/* developer and user parameters */
79#include <adolc/dvlparms.h>
80#include <adolc/usrparms.h>
81
82/*--------------------------------------------------------------------------*/
83/* windows dll exports/imports */
84#if defined(ADOLC_DLL)
85#       define ADOLC_DLL_EXPORT __declspec(dllexport)
86#else
87#       define ADOLC_DLL_EXPORT
88#endif
89
90/*--------------------------------------------------------------------------*/
91/* further helpful macros */
92#if defined(__cplusplus)
93#  define BEGIN_C_DECLS extern "C" {
94#  define END_C_DECLS   }
95#else
96#  define BEGIN_C_DECLS
97#  define END_C_DECLS
98#endif
99
100#define MAXDEC(a,b) do { register revreal __r = (b); if ( __r > (a) ) (a) = __r; } while (0)
101#define MAXDECI(a,b) do { register int __r = (b); if ( __r > (a) ) (a) = __r; } while (0)
102#define MINDECR(a,b) do { register revreal __r = (b); if ( __r < (a) ) (a) = __r; } while (0)
103#define MINDEC(a,b) do { register int __r = (b); if ( __r < (a) ) (a) = __r; } while (0)
104
105#define MAX_ADOLC(a,b) ( (a)<(b)? (b):(a) )
106#define MIN_ADOLC(a,b) ( (a)>(b)? (b):(a) )
107
108/*--------------------------------------------------------------------------*/
109#endif
110
Note: See TracBrowser for help on using the repository browser.