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 // Xpetra: A linear algebra interface package
4 //
5 // Copyright 2012 NTESS and the Xpetra contributors.
6 // SPDX-License-Identifier: BSD-3-Clause
7 // *****************************************************************************
8 // @HEADER
9 
10 #ifndef XPETRA_CONFIGDEFS_HPP
11 #define XPETRA_CONFIGDEFS_HPP
12 
13 #ifndef __cplusplus
14 #define __cplusplus
15 #endif // ifndef __cplusplus
16 
17 /* this section undefines all the things autotools defines for us that we wish it didn't. */
18 
19 #ifdef PACKAGE
20 #undef PACKAGE
21 #endif // ifdef PACKAGE
22 
23 #ifdef PACKAGE_NAME
24 #undef PACKAGE_NAME
25 #endif // ifdef PACKAGE_NAME
26 
27 #ifdef PACKAGE_BUGREPORT
28 #undef PACKAGE_BUGREPORT
29 #endif // ifdef PACKAGE_BUGREPORT
30 
31 #ifdef PACKAGE_STRING
32 #undef PACKAGE_STRING
33 #endif // ifdef PACKAGE_STRING
34 
35 #ifdef PACKAGE_TARNAME
36 #undef PACKAGE_TARNAME
37 #endif // ifdef PACKAGE_TARNAME
38 
39 #ifdef PACKAGE_VERSION
40 #undef PACKAGE_VERSION
41 #endif // ifdef PACKAGE_VERSION
42 
43 #ifdef VERSION
44 #undef VERSION
45 #endif // ifdef VERSION
46 
47 // end of undoing autoconf's work section
48 
49 #include <Xpetra_config.hpp>
50 #include <Teuchos_ConfigDefs.hpp>
51 #include <TpetraCore_config.h>
52 
53 #if defined(HAVE_XPETRA_TPETRA)
54 #include <Tpetra_ConfigDefs.hpp>
55 #endif
56 
58 namespace Xpetra {
59 // Used in all Xpetra code that explicitly must a type (like a loop index)
60 // that is used with the Teuchos::Array[View,RCP] classes.
61 
63 typedef Teuchos_Ordinal Array_size_type;
64 } // namespace Xpetra
65 
66 // these make some of the macros in Xpetra_Util.hpp much easier to describe
67 #ifdef HAVE_XPETRA_THROW_EFFICIENCY_WARNINGS
68 #define XPETRA_THROWS_EFFICIENCY_WARNINGS 1
69 #else
70 #define XPETRA_THROWS_EFFICIENCY_WARNINGS 0
71 #endif
72 
73 #ifdef HAVE_XPETRA_PRINT_EFFICIENCY_WARNINGS
74 #define XPETRA_PRINTS_EFFICIENCY_WARNINGS 1
75 #else
76 #define XPETRA_PRINTS_EFFICIENCY_WARNINGS 0
77 #endif
78 
79 #ifdef HAVE_XPETRA_THROW_ABUSE_WARNINGS
80 #define XPETRA_THROWS_ABUSE_WARNINGS 1
81 #else
82 #define XPETRA_THROWS_ABUSE_WARNINGS 0
83 #endif
84 
85 #ifdef HAVE_XPETRA_PRINT_ABUSE_WARNINGS
86 #define XPETRA_PRINTS_ABUSE_WARNINGS 1
87 #else
88 #define XPETRA_PRINTS_ABUSE_WARNINGS 0
89 #endif
90 
91 #ifdef HAVE_XPETRA_PROFILING
92 #include <string>
93 #include <Teuchos_TimeMonitor.hpp>
94 #define XPETRA_MONITOR(funcName) Teuchos::TimeMonitor(*Teuchos::TimeMonitor::getNewTimer(std::string("Xpetra: ") + funcName));
95 #else
96 #define XPETRA_MONITOR(funcName)
97 #endif
98 
99 // Special macro for exception testing
100 // XPETRA_TEST_FOR_EXCEPTION is only active if Xpetra is configured with Xpetra_ENABLE_DEBUG:BOOL=ON
101 // If you want an exception test both in the release and debug version of Xpetra you still can use directly
102 // TEUCHOS_TEST_FOR_EXCEPTION
103 #ifdef HAVE_XPETRA_DEBUG
104 #define XPETRA_TEST_FOR_EXCEPTION(throw_exception_test, Exception, msg) \
105  TEUCHOS_TEST_FOR_EXCEPTION(throw_exception_test, Exception, msg);
106 #else
107 #define XPETRA_TEST_FOR_EXCEPTION(throw_exception_test, Exception, msg)
108 #endif
109 
110 #include <functional>
111 
112 // mem management
113 #include <Teuchos_ArrayView.hpp>
114 #include <Teuchos_ArrayRCP.hpp>
115 #include <Teuchos_Array.hpp>
116 #include <Teuchos_RCP.hpp>
117 // traits classes
118 #include <Teuchos_OrdinalTraits.hpp>
119 #include <Teuchos_ScalarTraits.hpp>
120 #include <Teuchos_TypeNameTraits.hpp>
121 #include <Teuchos_NullIteratorTraits.hpp>
122 #include <Teuchos_SerializationTraits.hpp>
123 // comm
124 #include <Teuchos_Comm.hpp>
125 #include <Teuchos_CommHelpers.hpp>
126 // misc
127 #include <Teuchos_ParameterList.hpp>
128 
130 namespace Xpetra {
138 typedef size_t global_size_t;
139 
144 };
145 
150 };
151 
156 };
157 
170 // enum CombineMode {
171 // ADD, /*!< Existing values will be summed with new values. */
172 // INSERT, /*!< Insert new values that don't currently exist. */
173 // REPLACE, /*!< Existing values will be replaced with new values. */
174 // };
175 
177  ADD,
180 };
181 
182 // import Teuchos memory management classes into Xpetra
183 using Teuchos::Array;
184 using Teuchos::ArrayRCP;
185 using Teuchos::ArrayView;
186 using Teuchos::Comm;
187 using Teuchos::null;
188 using Teuchos::OrdinalTraits;
189 using Teuchos::RCP;
190 using Teuchos::ScalarTraits;
191 
192 using Teuchos::arcp;
193 using Teuchos::arcp_reinterpret_cast;
194 using Teuchos::av_reinterpret_cast;
195 using Teuchos::outArg;
196 using Teuchos::rcp;
197 using Teuchos::rcpFromRef;
198 using Teuchos::tuple;
199 
200 using Teuchos::typeName;
201 
202 using Teuchos::ParameterList;
203 using Teuchos::parameterList;
204 using Teuchos::sublist;
205 
206 // Xpetra functor objects
207 // inspired by SGI-specific project2nd, project1st
208 template <class Arg1, class Arg2>
209 class firstArg {
210  public:
211  typedef Arg1 first_argument_type;
212  typedef Arg2 second_argument_type;
213  typedef Arg1 result_type;
214  inline Arg1 operator()(const Arg1 &arg1, const Arg2 &arg2) { return arg1; }
215 };
216 
217 template <class Arg1, class Arg2>
218 class secondArg {
219  public:
220  typedef Arg1 first_argument_type;
221  typedef Arg2 second_argument_type;
222  typedef Arg2 result_type;
223  inline Arg2 operator()(const Arg1 &arg1, const Arg2 &arg2) { return arg2; }
224 };
225 
226 } // namespace Xpetra
227 
229 namespace XpetraExamples {
230 }
231 
232 #define XPETRA_ERR_CHECK(arg) \
233  { \
234  int r = arg; \
235  if (r < 0) { \
236  std::cout << "r = " << r << std::endl; \
237  assert(r >= 0); \
238  }; \
239  }; // TODO: throw exceptions
240 
241 // This include file defines macros to avoid warnings under CUDA. See github issue #1133.
242 #include "Teuchos_CompilerCodeTweakMacros.hpp"
243 
244 #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.