All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Defines
Xpetra_ConfigDefs.hpp
Go to the documentation of this file.
00001 // @HEADER
00002 //
00003 // ***********************************************************************
00004 //
00005 //             Xpetra: A linear algebra interface package
00006 //                  Copyright 2012 Sandia Corporation
00007 //
00008 // Under the terms of Contract DE-AC04-94AL85000 with Sandia Corporation,
00009 // the U.S. Government retains certain rights in this software.
00010 //
00011 // Redistribution and use in source and binary forms, with or without
00012 // modification, are permitted provided that the following conditions are
00013 // met:
00014 //
00015 // 1. Redistributions of source code must retain the above copyright
00016 // notice, this list of conditions and the following disclaimer.
00017 //
00018 // 2. Redistributions in binary form must reproduce the above copyright
00019 // notice, this list of conditions and the following disclaimer in the
00020 // documentation and/or other materials provided with the distribution.
00021 //
00022 // 3. Neither the name of the Corporation nor the names of the
00023 // contributors may be used to endorse or promote products derived from
00024 // this software without specific prior written permission.
00025 //
00026 // THIS SOFTWARE IS PROVIDED BY SANDIA CORPORATION "AS IS" AND ANY
00027 // EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
00028 // IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
00029 // PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL SANDIA CORPORATION OR THE
00030 // CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
00031 // EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
00032 // PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
00033 // PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
00034 // LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
00035 // NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
00036 // SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
00037 //
00038 // Questions? Contact
00039 //                    Jeremie Gaidamour (jngaida@sandia.gov)
00040 //                    Jonathan Hu       (jhu@sandia.gov)
00041 //                    Ray Tuminaro      (rstumin@sandia.gov)
00042 //
00043 // ***********************************************************************
00044 //
00045 // @HEADER
00046 #ifndef XPETRA_CONFIGDEFS_HPP
00047 #define XPETRA_CONFIGDEFS_HPP
00048 
00049 #ifndef __cplusplus
00050 #define __cplusplus
00051 #endif // ifndef __cplusplus
00052 
00053 /* this section undefines all the things autotools defines for us that we wish it didn't. */
00054 
00055 #ifdef PACKAGE
00056 #undef PACKAGE
00057 #endif // ifdef PACKAGE
00058 
00059 #ifdef PACKAGE_NAME
00060 #undef PACKAGE_NAME
00061 #endif // ifdef PACKAGE_NAME
00062 
00063 #ifdef PACKAGE_BUGREPORT
00064 #undef PACKAGE_BUGREPORT
00065 #endif // ifdef PACKAGE_BUGREPORT
00066 
00067 #ifdef PACKAGE_STRING
00068 #undef PACKAGE_STRING
00069 #endif // ifdef PACKAGE_STRING
00070 
00071 #ifdef PACKAGE_TARNAME
00072 #undef PACKAGE_TARNAME
00073 #endif // ifdef PACKAGE_TARNAME
00074 
00075 #ifdef PACKAGE_VERSION
00076 #undef PACKAGE_VERSION
00077 #endif // ifdef PACKAGE_VERSION
00078 
00079 #ifdef VERSION
00080 #undef VERSION
00081 #endif // ifdef VERSION
00082 
00083 // end of undoing autoconf's work section
00084 
00085 #include <Xpetra_config.hpp>
00086 #include <Teuchos_ConfigDefs.hpp>
00087 #include <Kokkos_ConfigDefs.hpp>
00088 
00090 namespace Xpetra { 
00091   // Used in all Xpetra code that explicitly must a type (like a loop index)
00092   // that is used with the Teuchos::Array[View,RCP] classes.
00093 
00095   typedef Teuchos_Ordinal Array_size_type; 
00096 }
00097 
00098 // these make some of the macros in Xpetra_Util.hpp much easier to describe
00099 #ifdef HAVE_XPETRA_THROW_EFFICIENCY_WARNINGS
00100 #define XPETRA_THROWS_EFFICIENCY_WARNINGS 1
00101 #else
00102 #define XPETRA_THROWS_EFFICIENCY_WARNINGS 0
00103 #endif
00104 
00105 #ifdef HAVE_XPETRA_PRINT_EFFICIENCY_WARNINGS
00106 #define XPETRA_PRINTS_EFFICIENCY_WARNINGS 1
00107 #else
00108 #define XPETRA_PRINTS_EFFICIENCY_WARNINGS 0
00109 #endif
00110 
00111 #ifdef HAVE_XPETRA_THROW_ABUSE_WARNINGS
00112 #define XPETRA_THROWS_ABUSE_WARNINGS 1
00113 #else
00114 #define XPETRA_THROWS_ABUSE_WARNINGS 0
00115 #endif
00116 
00117 #ifdef HAVE_XPETRA_PRINT_ABUSE_WARNINGS
00118 #define XPETRA_PRINTS_ABUSE_WARNINGS 1
00119 #else
00120 #define XPETRA_PRINTS_ABUSE_WARNINGS 0
00121 #endif
00122 
00123 #ifdef HAVE_XPETRA_PROFILING
00124 #include <string>
00125 #include <Teuchos_TimeMonitor.hpp>
00126 #define XPETRA_MONITOR(funcName) Teuchos::TimeMonitor(*Teuchos::TimeMonitor::getNewTimer(std::string("Xpetra: ") + funcName));
00127 #else
00128 #define XPETRA_MONITOR(funcName)
00129 #endif
00130 
00131 #include <functional>
00132 
00133 #ifndef __CUDACC__
00134 // mem management
00135 #include <Teuchos_ArrayView.hpp>
00136 #include <Teuchos_ArrayRCP.hpp>
00137 #include <Teuchos_Array.hpp>
00138 #include <Teuchos_RCP.hpp>
00139 // traits classes
00140 #include <Teuchos_OrdinalTraits.hpp>
00141 #include <Teuchos_ScalarTraits.hpp>
00142 #include <Teuchos_TypeNameTraits.hpp>
00143 #include <Teuchos_NullIteratorTraits.hpp>
00144 #include <Teuchos_SerializationTraits.hpp>
00145 // comm
00146 #include <Teuchos_Comm.hpp>
00147 #include <Teuchos_CommHelpers.hpp>
00148 // misc
00149 #include <Teuchos_ParameterList.hpp>
00150 #endif
00151 
00153 namespace Xpetra {
00161   typedef size_t global_size_t;
00162 
00164   enum LocalGlobal {
00165     LocallyReplicated,  
00166     GloballyDistributed 
00167   };
00168 
00170   enum LookupStatus {
00171     AllIDsPresent, 
00172     IDNotPresent   
00173   };
00174 
00176   enum ProfileType {
00177     StaticProfile,  
00178     DynamicProfile  
00179   };
00180 
00182   enum OptimizeOption {
00183     DoOptimizeStorage,   
00184     DoNotOptimizeStorage 
00185   };
00186 
00199   //   enum CombineMode {
00200   //     ADD,    /*!< Existing values will be summed with new values. */
00201   //     INSERT, /*!< Insert new values that don't currently exist. */
00202   //     REPLACE, /*!< Existing values will be replaced with new values. */
00203   //   };
00204 
00205   enum CombineMode {
00206     ADD,    
00207     INSERT, 
00208     ABSMAX  
00209   };
00210  
00211   // import Teuchos memory management classes into Xpetra
00212 #ifndef __CUDACC__
00213   using Teuchos::ArrayRCP;
00214   using Teuchos::ArrayView;
00215   using Teuchos::Array;
00216   using Teuchos::OrdinalTraits;
00217   using Teuchos::ScalarTraits;
00218   using Teuchos::RCP;
00219   using Teuchos::Comm;
00220   using Teuchos::null;
00221 
00222   using Teuchos::outArg;
00223   using Teuchos::tuple;
00224   using Teuchos::arcp;
00225   using Teuchos::rcp;
00226   using Teuchos::rcpFromRef;
00227   using Teuchos::av_reinterpret_cast;
00228   using Teuchos::arcp_reinterpret_cast;
00229 
00230   using Teuchos::typeName;
00231 
00232   using Teuchos::ParameterList;
00233   using Teuchos::parameterList;
00234   using Teuchos::sublist;
00235 #endif
00236 
00237   // Xpetra functor objects
00238   // inspired by SGI-specific project2nd, project1st
00239   template <class Arg1, class Arg2>
00240   class firstArg : std::binary_function<Arg1,Arg2,Arg1> {
00241   public:
00242     typedef Arg1 first_argument_type;
00243     typedef Arg2 second_argument_type;
00244     typedef Arg1 result_type;
00245     inline Arg1 operator()(const Arg1 &arg1, const Arg2 &arg2) { return arg1;}
00246   };
00247 
00248   template <class Arg1, class Arg2>
00249   class secondArg : std::binary_function<Arg1,Arg2,Arg2> {
00250   public:
00251     typedef Arg1 first_argument_type;
00252     typedef Arg2 second_argument_type;
00253     typedef Arg2 result_type;
00254     inline Arg2 operator()(const Arg1 &arg1, const Arg2 &arg2) { return arg2;}
00255   };
00256 
00257 } // end of Xpetra namespace
00258 
00259 
00261 namespace XpetraExamples {
00262 }
00263 
00264 #define XPETRA_ERR_CHECK(arg) { int r = arg; if (r < 0) { std::cout << "r = " << r << std::endl; assert(r>=0); }; }; // TODO: throw exceptions
00265 
00266 #endif // XPETRA_CONFIGDEFS_HPP
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Defines