1 /*
2 // @HEADER
3 // ***********************************************************************
4 //
5 //                    Teuchos: Common Tools Package
6 //                 Copyright (2004) Sandia Corporation
7 //
8 // Under terms of Contract DE-AC04-94AL85000, there is a non-exclusive
9 // license for use of this work by or on behalf of the U.S. Government.
10 //
11 // Redistribution and use in source and binary forms, with or without
12 // modification, are permitted provided that the following conditions are
13 // met:
14 //
15 // 1. Redistributions of source code must retain the above copyright
16 // notice, this list of conditions and the following disclaimer.
17 //
18 // 2. Redistributions in binary form must reproduce the above copyright
19 // notice, this list of conditions and the following disclaimer in the
20 // documentation and/or other materials provided with the distribution.
21 //
22 // 3. Neither the name of the Corporation nor the names of the
23 // contributors may be used to endorse or promote products derived from
24 // this software without specific prior written permission.
25 //
26 // THIS SOFTWARE IS PROVIDED BY SANDIA CORPORATION "AS IS" AND ANY
27 // EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
28 // IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
29 // PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL SANDIA CORPORATION OR THE
30 // CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
31 // EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
32 // PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
33 // PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
34 // LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
35 // NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
36 // SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
37 //
38 // Questions? Contact Michael A. Heroux (maherou@sandia.gov)
39 //
40 // ***********************************************************************
41 // @HEADER
42 */
43 
44 #ifndef TEUCHOS_CONFIGDEFS_HPP
45 #define TEUCHOS_CONFIGDEFS_HPP
46 
47 /*! \file Teuchos_ConfigDefs.hpp
48     \brief Teuchos header file which uses auto-configuration information
49 	to include necessary C++ headers.
50 */
51 
52 #include "Teuchos_config.h"
53 
54 #ifdef HAVE_TEUCHOS_DEBUG
55 #  define TEUCHOS_DEBUG
56 #  define HAVE_TEUCHOS_ARRAY_BOUNDSCHECK
57 #endif
58 
59 #ifdef __cplusplus
60 
61 #if defined(_MSC_VER) || defined(__APPLE__)
62 #  define TEUCHOS_NO_ZERO_ITERATOR_CONVERSION
63 #endif
64 
65 #if defined(__IBMC__) || defined(__IBMCPP__)
66 #  ifndef TEMPLATE_FRIENDS_NOT_SUPPORTED
67 #    define TEMPLATE_FRIENDS_NOT_SUPPORTED
68 #  endif
69 #  ifndef TEUCHOS_PRIVIATE_DELETE_NOT_SUPPORTED
70 #    define TEUCHOS_PRIVIATE_DELETE_NOT_SUPPORTED
71 #  endif
72 #endif
73 
74 /* Deprecated */
75 #ifndef HAVE_COMPLEX
76 #  define HAVE_COMPLEX
77 #endif
78 
79 #include <cstdio>
80 #include <cstdarg>
81 #include <cerrno>
82 #include <climits>
83 #include <cstdlib>
84 #include <string>
85 #include <cstring>
86 #include <cmath>
87 #include <iostream>
88 #include <iomanip>
89 #include <fstream>
90 #include <sstream>
91 #include <stdexcept>
92 #include <cassert>
93 #include <complex>
94 #include <map>
95 #include <vector>
96 #include <deque>
97 #include <algorithm>
98 #include <numeric>
99 #include <list>
100 #include <set>
101 #include <typeinfo>
102 #include <limits>
103 #include <memory>
104 #include <cstddef>
105 
106 /* Avoid duplicating instantiation provided by IBM XL C++ runtime library. */
107 #if defined(__IBMCPP__)
108 # pragma do_not_instantiate std::fpos<mbstate_t>
109 #endif
110 
111 namespace Teuchos { class DummyDummyClass; }
112 // Above, is used for a dumb reason (see
113 // Teuchs_StandardMemberCompositionMacros.hpp).
114 
115 const double Teuchos_MinDouble = 1.0E-100;
116 const double Teuchos_MaxDouble = 1.0E+100;
117 const double Teuchos_Overflow = 1.79E308; // Used to test if equilibration should be done.
118 const double Teuchos_Underflow = 2.23E-308;
119 
120 // 2007/06/29: These are hacks for std::ostringstream that should be removed
121 // now what we assume that a faily complete standard C++ library is available.
122 
123 #define TEUCHOS_OSTRINGSTREAM_GET_C_STR(OSS) (OSS).str().c_str()
124 typedef std::ostringstream TeuchosOStringStream;
125 
126 #else /* __cplusplus */
127 
128 #include <stddef.h>
129 
130 #endif /* __cplusplus */
131 
132 /* Delete any previous definition of TEUCHOS_NO_ERROR_REPORTS */
133 
134 #ifdef TEUCHOS_CHK_ERR
135 #undef TEUCHOS_CHK_ERR
136 #endif
137 #ifdef TEUCHOS_CHK_PTR
138 #undef TEUCHOS_CHK_PTR
139 #endif
140 #ifdef TEUCHOS_CHK_REF
141 #undef TEUCHOS_CHK_REF
142 #endif
143 
144 /* The integral type that is used for the largest ordinal values on this
145  * machine.
146  *
147  * On a 32 bit machine, ptrdiff_t will be an unsighed 32 bit integer and on a
148  * 64 bit machine it will be an unsigned 64 bit integer.  Just what I want!
149 */
150 typedef TEUCHOS_ORDINAL_TYPE Teuchos_Ordinal;
151 
152 #ifdef __cplusplus
153 namespace Teuchos { typedef Teuchos_Ordinal Ordinal; }
154 #endif /* __cplusplus */
155 
156 /* Deprecated (use Teuchos_Ordinal) */
157 typedef Teuchos_Ordinal Teuchos_Index;
158 
159 /* Make error report silent by defining TEUCHOS_NO_ERROR_REPORTS */
160 
161 #define TEUCHOS_CHK_ERR(a) { if (a != 0)  return(a);}
162 #define TEUCHOS_CHK_PTR(a) { return(a);}
163 #define TEUCHOS_CHK_REF(a) { return(a);}
164 
165 #ifdef __cplusplus
166 const int Teuchos_DefaultTracebackMode = 1; /* Default value for traceback behavior */
167 #endif /* __cplusplus */
168 
169 /* Define some macros */
170 #define TEUCHOS_MAX(x,y) (( (x) > (y) ) ? (x)  : (y) )     /* max function  */
171 #define TEUCHOS_MIN(x,y) (( (x) < (y) ) ? (x)  : (y) )     /* min function  */
172 #define TEUCHOS_SGN(x)   (( (x) < 0.0 ) ? -1.0 : 1.0 )     /* sign function */
173 
174 #ifndef HAVE_FORTRAN_SUPPORT
175 #  ifndef FORTRAN_DISABLED
176 #    define FORTRAN_DISABLED
177 #  endif
178 #endif
179 
180 #include "Teuchos_DLLExportMacro.h"
181 
182 #endif /* TEUCHOS_CONFIGDEFS_HPP */
183