Xpetra Version of the Day
Loading...
Searching...
No Matches
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>
51#include <TpetraCore_config.h>
52
53#include <Tpetra_ConfigDefs.hpp>
54
56namespace Xpetra {
57// Used in all Xpetra code that explicitly must a type (like a loop index)
58// that is used with the Teuchos::Array[View,RCP] classes.
59
61typedef Teuchos_Ordinal Array_size_type;
62} // namespace Xpetra
63
64// these make some of the macros in Xpetra_Util.hpp much easier to describe
65#ifdef HAVE_XPETRA_THROW_EFFICIENCY_WARNINGS
66#define XPETRA_THROWS_EFFICIENCY_WARNINGS 1
67#else
68#define XPETRA_THROWS_EFFICIENCY_WARNINGS 0
69#endif
70
71#ifdef HAVE_XPETRA_PRINT_EFFICIENCY_WARNINGS
72#define XPETRA_PRINTS_EFFICIENCY_WARNINGS 1
73#else
74#define XPETRA_PRINTS_EFFICIENCY_WARNINGS 0
75#endif
76
77#ifdef HAVE_XPETRA_THROW_ABUSE_WARNINGS
78#define XPETRA_THROWS_ABUSE_WARNINGS 1
79#else
80#define XPETRA_THROWS_ABUSE_WARNINGS 0
81#endif
82
83#ifdef HAVE_XPETRA_PRINT_ABUSE_WARNINGS
84#define XPETRA_PRINTS_ABUSE_WARNINGS 1
85#else
86#define XPETRA_PRINTS_ABUSE_WARNINGS 0
87#endif
88
89#ifdef HAVE_XPETRA_PROFILING
90#include <string>
92#define XPETRA_MONITOR(funcName) Teuchos::TimeMonitor(*Teuchos::TimeMonitor::getNewTimer(std::string("Xpetra: ") + funcName));
93#else
94#define XPETRA_MONITOR(funcName)
95#endif
96
97// Special macro for exception testing
98// XPETRA_TEST_FOR_EXCEPTION is only active if Xpetra is configured with Xpetra_ENABLE_DEBUG:BOOL=ON
99// If you want an exception test both in the release and debug version of Xpetra you still can use directly
100// TEUCHOS_TEST_FOR_EXCEPTION
101#ifdef HAVE_XPETRA_DEBUG
102#define XPETRA_TEST_FOR_EXCEPTION(throw_exception_test, Exception, msg) \
103 TEUCHOS_TEST_FOR_EXCEPTION(throw_exception_test, Exception, msg);
104#else
105#define XPETRA_TEST_FOR_EXCEPTION(throw_exception_test, Exception, msg)
106#endif
107
108#include <functional>
109
110// mem management
111#include <Teuchos_ArrayView.hpp>
112#include <Teuchos_ArrayRCP.hpp>
113#include <Teuchos_Array.hpp>
114#include <Teuchos_RCP.hpp>
115// traits classes
119#include <Teuchos_NullIteratorTraits.hpp>
121// comm
122#include <Teuchos_Comm.hpp>
123#include <Teuchos_CommHelpers.hpp>
124// misc
126
128namespace Xpetra {
136typedef size_t global_size_t;
137
143
149
155
168// enum CombineMode {
169// ADD, /*!< Existing values will be summed with new values. */
170// INSERT, /*!< Insert new values that don't currently exist. */
171// REPLACE, /*!< Existing values will be replaced with new values. */
172// };
173
179
180// import Teuchos memory management classes into Xpetra
181using Teuchos::Array;
184using Teuchos::Comm;
185using Teuchos::null;
187using Teuchos::RCP;
189
190using Teuchos::arcp;
191using Teuchos::arcp_reinterpret_cast;
192using Teuchos::av_reinterpret_cast;
193using Teuchos::outArg;
194using Teuchos::rcp;
195using Teuchos::rcpFromRef;
196using Teuchos::tuple;
197
199
201using Teuchos::parameterList;
202using Teuchos::sublist;
203
204// Xpetra functor objects
205// inspired by SGI-specific project2nd, project1st
206template <class Arg1, class Arg2>
207class firstArg {
208 public:
211 typedef Arg1 result_type;
212 inline Arg1 operator()(const Arg1 &arg1, const Arg2 &arg2) { return arg1; }
213};
214
215template <class Arg1, class Arg2>
217 public:
220 typedef Arg2 result_type;
221 inline Arg2 operator()(const Arg1 &arg1, const Arg2 &arg2) { return arg2; }
222};
223
224} // namespace Xpetra
225
227namespace XpetraExamples {
228}
229
230#define XPETRA_ERR_CHECK(arg) \
231 { \
232 int r = arg; \
233 if (r < 0) { \
234 std::cout << "r = " << r << std::endl; \
235 assert(r >= 0); \
236 }; \
237 }; // TODO: throw exceptions
238
239// This include file defines macros to avoid warnings under CUDA. See github issue #1133.
240#include "Teuchos_CompilerCodeTweakMacros.hpp"
241
242#endif // XPETRA_CONFIGDEFS_HPP
Arg1 operator()(const Arg1 &arg1, const Arg2 &arg2)
Arg2 operator()(const Arg1 &arg1, const Arg2 &arg2)
std::string typeName(const T &t)
TEUCHOS_DEPRECATED RCP< T > rcp(T *p, Dealloc_T dealloc, bool owns_mem)
Namespace for Xpetra example classes and methods.
size_t global_size_t
Global size_t object.
Teuchos_Ordinal Array_size_type
Size type for Teuchos Array objects.
CombineMode
Xpetra::Combine Mode enumerable type.