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#if defined(HAVE_XPETRA_TPETRA)
54#include <Tpetra_ConfigDefs.hpp>
55#endif
56
58namespace 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
63typedef 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>
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
121#include <Teuchos_NullIteratorTraits.hpp>
123// comm
124#include <Teuchos_Comm.hpp>
125#include <Teuchos_CommHelpers.hpp>
126// misc
128
130namespace Xpetra {
138typedef size_t global_size_t;
139
145
151
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
181
182// import Teuchos memory management classes into Xpetra
183using Teuchos::Array;
186using Teuchos::Comm;
187using Teuchos::null;
189using Teuchos::RCP;
191
192using Teuchos::arcp;
193using Teuchos::arcp_reinterpret_cast;
194using Teuchos::av_reinterpret_cast;
195using Teuchos::outArg;
196using Teuchos::rcp;
197using Teuchos::rcpFromRef;
198using Teuchos::tuple;
199
201
203using Teuchos::parameterList;
204using Teuchos::sublist;
205
206// Xpetra functor objects
207// inspired by SGI-specific project2nd, project1st
208template <class Arg1, class Arg2>
209class firstArg {
210 public:
213 typedef Arg1 result_type;
214 inline Arg1 operator()(const Arg1 &arg1, const Arg2 &arg2) { return arg1; }
215};
216
217template <class Arg1, class Arg2>
219 public:
222 typedef Arg2 result_type;
223 inline Arg2 operator()(const Arg1 &arg1, const Arg2 &arg2) { return arg2; }
224};
225
226} // namespace Xpetra
227
229namespace 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)
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.