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 <Kokkos_ConfigDefs.hpp>
88 
90 namespace Xpetra {
91  // Used in all Xpetra code that explicitly must a type (like a loop index)
92  // that is used with the Teuchos::Array[View,RCP] classes.
93 
95  typedef Teuchos_Ordinal Array_size_type;
96 }
97 
98 // these make some of the macros in Xpetra_Util.hpp much easier to describe
99 #ifdef HAVE_XPETRA_THROW_EFFICIENCY_WARNINGS
100 #define XPETRA_THROWS_EFFICIENCY_WARNINGS 1
101 #else
102 #define XPETRA_THROWS_EFFICIENCY_WARNINGS 0
103 #endif
104 
105 #ifdef HAVE_XPETRA_PRINT_EFFICIENCY_WARNINGS
106 #define XPETRA_PRINTS_EFFICIENCY_WARNINGS 1
107 #else
108 #define XPETRA_PRINTS_EFFICIENCY_WARNINGS 0
109 #endif
110 
111 #ifdef HAVE_XPETRA_THROW_ABUSE_WARNINGS
112 #define XPETRA_THROWS_ABUSE_WARNINGS 1
113 #else
114 #define XPETRA_THROWS_ABUSE_WARNINGS 0
115 #endif
116 
117 #ifdef HAVE_XPETRA_PRINT_ABUSE_WARNINGS
118 #define XPETRA_PRINTS_ABUSE_WARNINGS 1
119 #else
120 #define XPETRA_PRINTS_ABUSE_WARNINGS 0
121 #endif
122 
123 #ifdef HAVE_XPETRA_PROFILING
124 #include <string>
125 #include <Teuchos_TimeMonitor.hpp>
126 #define XPETRA_MONITOR(funcName) Teuchos::TimeMonitor(*Teuchos::TimeMonitor::getNewTimer(std::string("Xpetra: ") + funcName));
127 #else
128 #define XPETRA_MONITOR(funcName)
129 #endif
130 
131 #include <functional>
132 
133 // mem management
134 #include <Teuchos_ArrayView.hpp>
135 #include <Teuchos_ArrayRCP.hpp>
136 #include <Teuchos_Array.hpp>
137 #include <Teuchos_RCP.hpp>
138 // traits classes
139 #include <Teuchos_OrdinalTraits.hpp>
140 #include <Teuchos_ScalarTraits.hpp>
142 #include <Teuchos_NullIteratorTraits.hpp>
144 // comm
145 #include <Teuchos_Comm.hpp>
146 #include <Teuchos_CommHelpers.hpp>
147 // misc
148 #include <Teuchos_ParameterList.hpp>
149 
151 namespace Xpetra {
159  typedef size_t global_size_t;
160 
162  enum LocalGlobal {
165  };
166 
171  };
172 
174  enum ProfileType {
177  };
178 
183  };
184 
197  // enum CombineMode {
198  // ADD, /*!< Existing values will be summed with new values. */
199  // INSERT, /*!< Insert new values that don't currently exist. */
200  // REPLACE, /*!< Existing values will be replaced with new values. */
201  // };
202 
203  enum CombineMode {
204  ADD,
207  };
208 
209  // import Teuchos memory management classes into Xpetra
210  using Teuchos::ArrayRCP;
211  using Teuchos::ArrayView;
212  using Teuchos::Array;
214  using Teuchos::ScalarTraits;
215  using Teuchos::RCP;
216  using Teuchos::Comm;
217  using Teuchos::null;
218 
219  using Teuchos::outArg;
220  using Teuchos::tuple;
221  using Teuchos::arcp;
222  using Teuchos::rcp;
223  using Teuchos::rcpFromRef;
224  using Teuchos::av_reinterpret_cast;
225  using Teuchos::arcp_reinterpret_cast;
226 
227  using Teuchos::typeName;
228 
230  using Teuchos::parameterList;
231  using Teuchos::sublist;
232 
233  // Xpetra functor objects
234  // inspired by SGI-specific project2nd, project1st
235  template <class Arg1, class Arg2>
236  class firstArg : std::binary_function<Arg1,Arg2,Arg1> {
237  public:
238  typedef Arg1 first_argument_type;
239  typedef Arg2 second_argument_type;
240  typedef Arg1 result_type;
241  inline Arg1 operator()(const Arg1 &arg1, const Arg2 &arg2) { return arg1;}
242  };
243 
244  template <class Arg1, class Arg2>
245  class secondArg : std::binary_function<Arg1,Arg2,Arg2> {
246  public:
247  typedef Arg1 first_argument_type;
248  typedef Arg2 second_argument_type;
249  typedef Arg2 result_type;
250  inline Arg2 operator()(const Arg1 &arg1, const Arg2 &arg2) { return arg2;}
251  };
252 
253 } // end of Xpetra namespace
254 
255 
257 namespace XpetraExamples {
258 }
259 
260 #define XPETRA_ERR_CHECK(arg) { int r = arg; if (r < 0) { std::cout << "r = " << r << std::endl; assert(r>=0); }; }; // TODO: throw exceptions
261 
262 #endif // XPETRA_CONFIGDEFS_HPP
Arg1 operator()(const Arg1 &arg1, const Arg2 &arg2)
Namespace for Xpetra example classes and methods.
Arg2 operator()(const Arg1 &arg1, const Arg2 &arg2)
Xpetra namespace
TEUCHOS_DEPRECATED RCP< T > rcp(T *p, Dealloc_T dealloc, bool owns_mem)
size_t global_size_t
Global size_t object.
CombineMode
Xpetra::Combine Mode enumerable type.
std::string typeName(const T &t)
Teuchos_Ordinal Array_size_type
Size type for Teuchos Array objects.