Xpetra  Version of the Day
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Pages
Xpetra_ConfigDefs.hpp
Go to the documentation of this file.
1 // @HEADER
2 //
3 // ***********************************************************************
4 //
5 // Xpetra: A linear algebra interface package
6 // Copyright 2012 Sandia Corporation
7 //
8 // Under the terms of Contract DE-AC04-94AL85000 with Sandia Corporation,
9 // the U.S. Government retains certain rights in this software.
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
39 // Jonathan Hu (jhu@sandia.gov)
40 // Andrey Prokopenko (aprokop@sandia.gov)
41 // Ray Tuminaro (rstumin@sandia.gov)
42 //
43 // ***********************************************************************
44 //
45 // @HEADER
46 #ifndef XPETRA_CONFIGDEFS_HPP
47 #define XPETRA_CONFIGDEFS_HPP
48 
49 #ifndef __cplusplus
50 #define __cplusplus
51 #endif // ifndef __cplusplus
52 
53 /* this section undefines all the things autotools defines for us that we wish it didn't. */
54 
55 #ifdef PACKAGE
56 #undef PACKAGE
57 #endif // ifdef PACKAGE
58 
59 #ifdef PACKAGE_NAME
60 #undef PACKAGE_NAME
61 #endif // ifdef PACKAGE_NAME
62 
63 #ifdef PACKAGE_BUGREPORT
64 #undef PACKAGE_BUGREPORT
65 #endif // ifdef PACKAGE_BUGREPORT
66 
67 #ifdef PACKAGE_STRING
68 #undef PACKAGE_STRING
69 #endif // ifdef PACKAGE_STRING
70 
71 #ifdef PACKAGE_TARNAME
72 #undef PACKAGE_TARNAME
73 #endif // ifdef PACKAGE_TARNAME
74 
75 #ifdef PACKAGE_VERSION
76 #undef PACKAGE_VERSION
77 #endif // ifdef PACKAGE_VERSION
78 
79 #ifdef VERSION
80 #undef VERSION
81 #endif // ifdef VERSION
82 
83 // end of undoing autoconf's work section
84 
85 #include <Xpetra_config.hpp>
86 #include <Teuchos_ConfigDefs.hpp>
87 #include <TpetraCore_config.h>
88 
89 #if defined(HAVE_XPETRA_TPETRA)
90 #include <Tpetra_ConfigDefs.hpp>
91 #endif
92 
94 namespace Xpetra {
95 // Used in all Xpetra code that explicitly must a type (like a loop index)
96 // that is used with the Teuchos::Array[View,RCP] classes.
97 
99 typedef Teuchos_Ordinal Array_size_type;
100 } // namespace Xpetra
101 
102 // these make some of the macros in Xpetra_Util.hpp much easier to describe
103 #ifdef HAVE_XPETRA_THROW_EFFICIENCY_WARNINGS
104 #define XPETRA_THROWS_EFFICIENCY_WARNINGS 1
105 #else
106 #define XPETRA_THROWS_EFFICIENCY_WARNINGS 0
107 #endif
108 
109 #ifdef HAVE_XPETRA_PRINT_EFFICIENCY_WARNINGS
110 #define XPETRA_PRINTS_EFFICIENCY_WARNINGS 1
111 #else
112 #define XPETRA_PRINTS_EFFICIENCY_WARNINGS 0
113 #endif
114 
115 #ifdef HAVE_XPETRA_THROW_ABUSE_WARNINGS
116 #define XPETRA_THROWS_ABUSE_WARNINGS 1
117 #else
118 #define XPETRA_THROWS_ABUSE_WARNINGS 0
119 #endif
120 
121 #ifdef HAVE_XPETRA_PRINT_ABUSE_WARNINGS
122 #define XPETRA_PRINTS_ABUSE_WARNINGS 1
123 #else
124 #define XPETRA_PRINTS_ABUSE_WARNINGS 0
125 #endif
126 
127 #ifdef HAVE_XPETRA_PROFILING
128 #include <string>
129 #include <Teuchos_TimeMonitor.hpp>
130 #define XPETRA_MONITOR(funcName) Teuchos::TimeMonitor(*Teuchos::TimeMonitor::getNewTimer(std::string("Xpetra: ") + funcName));
131 #else
132 #define XPETRA_MONITOR(funcName)
133 #endif
134 
135 // Special macro for exception testing
136 // XPETRA_TEST_FOR_EXCEPTION is only active if Xpetra is configured with Xpetra_ENABLE_DEBUG:BOOL=ON
137 // If you want an exception test both in the release and debug version of Xpetra you still can use directly
138 // TEUCHOS_TEST_FOR_EXCEPTION
139 #ifdef HAVE_XPETRA_DEBUG
140 #define XPETRA_TEST_FOR_EXCEPTION(throw_exception_test, Exception, msg) \
141  TEUCHOS_TEST_FOR_EXCEPTION(throw_exception_test, Exception, msg);
142 #else
143 #define XPETRA_TEST_FOR_EXCEPTION(throw_exception_test, Exception, msg)
144 #endif
145 
146 #include <functional>
147 
148 // mem management
149 #include <Teuchos_ArrayView.hpp>
150 #include <Teuchos_ArrayRCP.hpp>
151 #include <Teuchos_Array.hpp>
152 #include <Teuchos_RCP.hpp>
153 // traits classes
154 #include <Teuchos_OrdinalTraits.hpp>
155 #include <Teuchos_ScalarTraits.hpp>
156 #include <Teuchos_TypeNameTraits.hpp>
157 #include <Teuchos_NullIteratorTraits.hpp>
158 #include <Teuchos_SerializationTraits.hpp>
159 // comm
160 #include <Teuchos_Comm.hpp>
161 #include <Teuchos_CommHelpers.hpp>
162 // misc
163 #include <Teuchos_ParameterList.hpp>
164 
166 namespace Xpetra {
174 typedef size_t global_size_t;
175 
180 };
181 
186 };
187 
192 };
193 
206 // enum CombineMode {
207 // ADD, /*!< Existing values will be summed with new values. */
208 // INSERT, /*!< Insert new values that don't currently exist. */
209 // REPLACE, /*!< Existing values will be replaced with new values. */
210 // };
211 
213  ADD,
216 };
217 
218 // import Teuchos memory management classes into Xpetra
219 using Teuchos::Array;
220 using Teuchos::ArrayRCP;
221 using Teuchos::ArrayView;
222 using Teuchos::Comm;
223 using Teuchos::null;
224 using Teuchos::OrdinalTraits;
225 using Teuchos::RCP;
226 using Teuchos::ScalarTraits;
227 
228 using Teuchos::arcp;
229 using Teuchos::arcp_reinterpret_cast;
230 using Teuchos::av_reinterpret_cast;
231 using Teuchos::outArg;
232 using Teuchos::rcp;
233 using Teuchos::rcpFromRef;
234 using Teuchos::tuple;
235 
236 using Teuchos::typeName;
237 
238 using Teuchos::ParameterList;
239 using Teuchos::parameterList;
240 using Teuchos::sublist;
241 
242 // Xpetra functor objects
243 // inspired by SGI-specific project2nd, project1st
244 template <class Arg1, class Arg2>
245 class firstArg {
246  public:
247  typedef Arg1 first_argument_type;
248  typedef Arg2 second_argument_type;
249  typedef Arg1 result_type;
250  inline Arg1 operator()(const Arg1 &arg1, const Arg2 &arg2) { return arg1; }
251 };
252 
253 template <class Arg1, class Arg2>
254 class secondArg {
255  public:
256  typedef Arg1 first_argument_type;
257  typedef Arg2 second_argument_type;
258  typedef Arg2 result_type;
259  inline Arg2 operator()(const Arg1 &arg1, const Arg2 &arg2) { return arg2; }
260 };
261 
262 } // namespace Xpetra
263 
265 namespace XpetraExamples {
266 }
267 
268 #define XPETRA_ERR_CHECK(arg) \
269  { \
270  int r = arg; \
271  if (r < 0) { \
272  std::cout << "r = " << r << std::endl; \
273  assert(r >= 0); \
274  }; \
275  }; // TODO: throw exceptions
276 
277 // This include file defines macros to avoid warnings under CUDA. See github issue #1133.
278 #include "Teuchos_CompilerCodeTweakMacros.hpp"
279 
280 #endif // XPETRA_CONFIGDEFS_HPP
Arg1 operator()(const Arg1 &arg1, const Arg2 &arg2)
Arg2 operator()(const Arg1 &arg1, const Arg2 &arg2)
size_t global_size_t
Global size_t object.
CombineMode
Xpetra::Combine Mode enumerable type.
Teuchos_Ordinal Array_size_type
Size type for Teuchos Array objects.