Xpetra Version of the Day
Loading...
Searching...
No Matches
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>
87#include <TpetraCore_config.h>
88
89#if defined(HAVE_XPETRA_TPETRA)
90 #include <Tpetra_ConfigDefs.hpp>
91#endif
92
94namespace 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}
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>
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
157#include <Teuchos_NullIteratorTraits.hpp>
159// comm
160#include <Teuchos_Comm.hpp>
161#include <Teuchos_CommHelpers.hpp>
162// misc
164
166namespace 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
215 ABSMAX
216 };
217
218 // import Teuchos memory management classes into Xpetra
219 using Teuchos::ArrayRCP;
220 using Teuchos::ArrayView;
221 using Teuchos::Array;
224 using Teuchos::RCP;
225 using Teuchos::Comm;
226 using Teuchos::null;
227
228 using Teuchos::outArg;
229 using Teuchos::tuple;
230 using Teuchos::arcp;
231 using Teuchos::rcp;
232 using Teuchos::rcpFromRef;
233 using Teuchos::av_reinterpret_cast;
234 using Teuchos::arcp_reinterpret_cast;
235
236 using Teuchos::typeName;
237
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 : std::binary_function<Arg1,Arg2,Arg1> {
246 public:
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 : std::binary_function<Arg1,Arg2,Arg2> {
255 public:
258 typedef Arg2 result_type;
259 inline Arg2 operator()(const Arg1 &arg1, const Arg2 &arg2) { return arg2;}
260 };
261
262} // end of Xpetra namespace
263
264
266namespace XpetraExamples {
267}
268
269#define XPETRA_ERR_CHECK(arg) { int r = arg; if (r < 0) { std::cout << "r = " << r << std::endl; assert(r>=0); }; }; // TODO: throw exceptions
270
271// This include file defines macros to avoid warnings under CUDA. See github issue #1133.
272#include "Teuchos_CompilerCodeTweakMacros.hpp"
273
274#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.
Xpetra namespace
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.