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 //                    Jonathan Hu       (jhu@sandia.gov)
00040 //                    Andrey Prokopenko (aprokop@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 // mem management
00134 #include <Teuchos_ArrayView.hpp>
00135 #include <Teuchos_ArrayRCP.hpp>
00136 #include <Teuchos_Array.hpp>
00137 #include <Teuchos_RCP.hpp>
00138 // traits classes
00139 #include <Teuchos_OrdinalTraits.hpp>
00140 #include <Teuchos_ScalarTraits.hpp>
00141 #include <Teuchos_TypeNameTraits.hpp>
00142 #include <Teuchos_NullIteratorTraits.hpp>
00143 #include <Teuchos_SerializationTraits.hpp>
00144 // comm
00145 #include <Teuchos_Comm.hpp>
00146 #include <Teuchos_CommHelpers.hpp>
00147 // misc
00148 #include <Teuchos_ParameterList.hpp>
00149 
00151 namespace Xpetra {
00159   typedef size_t global_size_t;
00160 
00162   enum LocalGlobal {
00163     LocallyReplicated,  
00164     GloballyDistributed 
00165   };
00166 
00168   enum LookupStatus {
00169     AllIDsPresent, 
00170     IDNotPresent   
00171   };
00172 
00174   enum ProfileType {
00175     StaticProfile,  
00176     DynamicProfile  
00177   };
00178 
00180   enum OptimizeOption {
00181     DoOptimizeStorage,   
00182     DoNotOptimizeStorage 
00183   };
00184 
00197   //   enum CombineMode {
00198   //     ADD,    /*!< Existing values will be summed with new values. */
00199   //     INSERT, /*!< Insert new values that don't currently exist. */
00200   //     REPLACE, /*!< Existing values will be replaced with new values. */
00201   //   };
00202 
00203   enum CombineMode {
00204     ADD,    
00205     INSERT, 
00206     ABSMAX  
00207   };
00208 
00209   // import Teuchos memory management classes into Xpetra
00210   using Teuchos::ArrayRCP;
00211   using Teuchos::ArrayView;
00212   using Teuchos::Array;
00213   using Teuchos::OrdinalTraits;
00214   using Teuchos::ScalarTraits;
00215   using Teuchos::RCP;
00216   using Teuchos::Comm;
00217   using Teuchos::null;
00218 
00219   using Teuchos::outArg;
00220   using Teuchos::tuple;
00221   using Teuchos::arcp;
00222   using Teuchos::rcp;
00223   using Teuchos::rcpFromRef;
00224   using Teuchos::av_reinterpret_cast;
00225   using Teuchos::arcp_reinterpret_cast;
00226 
00227   using Teuchos::typeName;
00228 
00229   using Teuchos::ParameterList;
00230   using Teuchos::parameterList;
00231   using Teuchos::sublist;
00232 
00233   // Xpetra functor objects
00234   // inspired by SGI-specific project2nd, project1st
00235   template <class Arg1, class Arg2>
00236   class firstArg : std::binary_function<Arg1,Arg2,Arg1> {
00237   public:
00238     typedef Arg1 first_argument_type;
00239     typedef Arg2 second_argument_type;
00240     typedef Arg1 result_type;
00241     inline Arg1 operator()(const Arg1 &arg1, const Arg2 &arg2) { return arg1;}
00242   };
00243 
00244   template <class Arg1, class Arg2>
00245   class secondArg : std::binary_function<Arg1,Arg2,Arg2> {
00246   public:
00247     typedef Arg1 first_argument_type;
00248     typedef Arg2 second_argument_type;
00249     typedef Arg2 result_type;
00250     inline Arg2 operator()(const Arg1 &arg1, const Arg2 &arg2) { return arg2;}
00251   };
00252 
00253 } // end of Xpetra namespace
00254 
00255 
00257 namespace XpetraExamples {
00258 }
00259 
00260 #define XPETRA_ERR_CHECK(arg) { int r = arg; if (r < 0) { std::cout << "r = " << r << std::endl; assert(r>=0); }; }; // TODO: throw exceptions
00261 
00262 #endif // XPETRA_CONFIGDEFS_HPP
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Defines