Zoltan2 Version of the Day
Zoltan2_InputTraits.hpp
Go to the documentation of this file.
00001 // @HEADER
00002 //
00003 // ***********************************************************************
00004 //
00005 //   Zoltan2: A package of combinatorial algorithms for scientific computing
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 Karen Devine      (kddevin@sandia.gov)
00039 //                    Erik Boman        (egboman@sandia.gov)
00040 //                    Siva Rajamanickam (srajama@sandia.gov)
00041 //
00042 // ***********************************************************************
00043 //
00044 // @HEADER
00045 
00050 #ifndef ZOLTAN2_INPUTTRAITS_HPP
00051 #define ZOLTAN2_INPUTTRAITS_HPP
00052 
00053 #include <Zoltan2_Standards.hpp>
00054 
00055 #include <Tpetra_CrsMatrix.hpp>
00056 #include <Tpetra_RowMatrix.hpp>
00057 #include <Tpetra_CrsGraph.hpp>
00058 #include <Epetra_CrsMatrix.h>
00059 #include <Epetra_CrsGraph.h>
00060 #include <Xpetra_CrsMatrix.hpp>
00061 #include <Xpetra_RowMatrix.hpp>
00062 #include <Xpetra_TpetraRowMatrix.hpp>
00063 #include <Xpetra_CrsGraph.hpp>
00064 
00065 namespace Zoltan2{
00066 
00067 typedef int default_lno_t;
00068 
00069 #ifdef HAVE_ZOLTAN2_INST_FLOAT_INT_LONG
00070 typedef float default_scalar_t;
00071 typedef long default_gno_t;
00072 #else
00073  #ifdef HAVE_ZOLTAN2_INST_DOUBLE_INT_LONG
00074  typedef double default_scalar_t;
00075  typedef long default_gno_t;
00076  #else
00077   #ifdef HAVE_ZOLTAN2_INST_FLOAT_INT_INT
00078   typedef float default_scalar_t;
00079   typedef int default_gno_t;
00080   #else
00081    #ifdef HAVE_ZOLTAN2_INST_DOUBLE_INT_INT
00082    typedef double default_scalar_t;
00083    typedef int default_gno_t;
00084    #else
00085    typedef double default_scalar_t;
00086    typedef int default_gno_t;
00087    #endif
00088   #endif
00089  #endif
00090 #endif
00091 
00134 template <typename scalar, typename gid, typename lno, typename gno>
00135 class BasicUserTypes{
00136 };
00137 
00172 template <typename User>
00173 struct InputTraits {
00174 
00177   typedef default_scalar_t scalar_t;
00178 
00182   typedef default_lno_t lno_t;
00183 
00187   typedef default_gno_t gno_t;
00188 
00195   typedef default_gno_t gid_t;
00196 
00200   typedef Kokkos::DefaultNode::DefaultNodeType node_t;
00201 
00204   static inline string name() {return "InputAdapter";}
00205 };
00206 
00207 #ifndef DOXYGEN_SHOULD_SKIP_THIS
00208 
00209 template <typename Scalar,
00210           typename GID,
00211           typename LNO,
00212           typename GNO>
00213 struct InputTraits<BasicUserTypes<Scalar, GID, LNO, GNO> >
00214 {
00215   typedef Scalar        scalar_t;
00216   typedef LNO lno_t;
00217   typedef GNO gno_t;
00218   typedef GID gid_t;
00219   typedef Zoltan2::default_node_t node_t;
00220   static inline string name() {return "BasicUserTypes";}
00221 };
00222 
00223 template <typename Scalar,
00224           typename LocalOrdinal,
00225           typename GlobalOrdinal,
00226           typename Node>
00227 struct InputTraits<Xpetra::CrsMatrix<Scalar,LocalOrdinal,GlobalOrdinal,Node> >
00228 {
00229   typedef Scalar        scalar_t;
00230   typedef LocalOrdinal  lno_t;
00231   typedef GlobalOrdinal gno_t;
00232   typedef GlobalOrdinal gid_t;
00233   typedef Node          node_t;
00234   static inline string name() {return "Xpetra::CrsMatrix";}
00235 };
00236 
00237 template <typename Scalar,
00238           typename LocalOrdinal,
00239           typename GlobalOrdinal,
00240           typename Node>
00241 struct InputTraits<Tpetra::CrsMatrix<Scalar,LocalOrdinal,GlobalOrdinal,Node> >
00242 {
00243   typedef Scalar        scalar_t;
00244   typedef LocalOrdinal  lno_t;
00245   typedef GlobalOrdinal gno_t;
00246   typedef GlobalOrdinal gid_t;
00247   typedef Node          node_t;
00248   static inline string name() {return "Tpetra::CrsMatrix";}
00249 };
00250 
00251 template < >
00252 struct InputTraits<Epetra_CrsMatrix>
00253 {
00254   typedef double scalar_t;
00255   typedef int lno_t;
00256   typedef int gno_t;
00257   typedef int gid_t;
00258   typedef Kokkos::DefaultNode::DefaultNodeType node_t;
00259   static inline string name() {return "Epetra_CrsMatrix";}
00260 };
00261 
00262 template <typename Scalar,
00263           typename LocalOrdinal,
00264           typename GlobalOrdinal,
00265           typename Node>
00266 struct InputTraits<Xpetra::RowMatrix<Scalar,LocalOrdinal,GlobalOrdinal,Node> >
00267 {
00268   typedef Scalar        scalar_t;
00269   typedef LocalOrdinal  lno_t;
00270   typedef GlobalOrdinal gno_t;
00271   typedef GlobalOrdinal gid_t;
00272   typedef Node          node_t;
00273   static inline string name() {return "Xpetra::RowMatrix";}
00274 };
00275 
00276 template <typename Scalar,
00277           typename LocalOrdinal,
00278           typename GlobalOrdinal,
00279           typename Node>
00280 struct InputTraits<Tpetra::RowMatrix<Scalar,LocalOrdinal,GlobalOrdinal,Node> >
00281 {
00282   typedef Scalar        scalar_t;
00283   typedef LocalOrdinal  lno_t;
00284   typedef GlobalOrdinal gno_t;
00285   typedef GlobalOrdinal gid_t;
00286   typedef Node          node_t;
00287   static inline string name() {return "Tpetra::RowMatrix";}
00288 };
00289 
00290 template <typename LocalOrdinal,
00291           typename GlobalOrdinal,
00292           typename Node>
00293 struct InputTraits<Xpetra::CrsGraph<LocalOrdinal,GlobalOrdinal,Node> >
00294 {
00295   typedef default_scalar_t scalar_t;
00296   typedef LocalOrdinal  lno_t;
00297   typedef GlobalOrdinal gno_t;
00298   typedef GlobalOrdinal gid_t;
00299   typedef Node          node_t;
00300   static inline string name() {return "Xpetra::CrsGraph";}
00301 };
00302 
00303 template <typename LocalOrdinal,
00304           typename GlobalOrdinal,
00305           typename Node>
00306 struct InputTraits<Tpetra::CrsGraph<LocalOrdinal,GlobalOrdinal,Node> >
00307 {
00308   typedef default_scalar_t scalar_t;
00309   typedef LocalOrdinal  lno_t;
00310   typedef GlobalOrdinal gno_t;
00311   typedef GlobalOrdinal gid_t;
00312   typedef Node          node_t;
00313   static inline string name() {return "Tpetra::CrsGraph";}
00314 };
00315 
00316 template < >
00317 struct InputTraits<Epetra_CrsGraph>
00318 {
00319   typedef double scalar_t;
00320   typedef int   lno_t;
00321   typedef int   gno_t;
00322   typedef int   gid_t;
00323   typedef Kokkos::DefaultNode::DefaultNodeType node_t;
00324   static inline string name() {return "Epetra_CrsGraph";}
00325 };
00326 
00327 template <typename Scalar,
00328           typename LocalOrdinal,
00329           typename GlobalOrdinal,
00330           typename Node>
00331 struct InputTraits<Xpetra::Vector<Scalar,LocalOrdinal,GlobalOrdinal,Node> >
00332 {
00333   typedef Scalar        scalar_t;
00334   typedef LocalOrdinal  lno_t;
00335   typedef GlobalOrdinal gno_t;
00336   typedef GlobalOrdinal gid_t;
00337   typedef Node          node_t;
00338   static inline string name() {return "Xpetra::Vector";}
00339 };
00340 
00344 template <typename Scalar,
00345           typename LocalOrdinal,
00346           typename GlobalOrdinal,
00347           typename Node>
00348 struct InputTraits<Tpetra::Vector<Scalar,LocalOrdinal,GlobalOrdinal,Node> >
00349 {
00350   typedef Scalar        scalar_t;
00351   typedef LocalOrdinal  lno_t;
00352   typedef GlobalOrdinal gno_t;
00353   typedef GlobalOrdinal gid_t;
00354   typedef Node          node_t;
00355   static inline string name() {return "Tpetra::Vector";}
00356 };
00357 
00358 template < >
00359 struct InputTraits<Epetra_Vector>
00360 {
00361   typedef double scalar_t;
00362   typedef int   lno_t;
00363   typedef int   gno_t;
00364   typedef int   gid_t;
00365   typedef Kokkos::DefaultNode::DefaultNodeType node_t;
00366   static inline string name() {return "Epetra_Vector";}
00367 };
00368 
00369 template <typename Scalar,
00370           typename LocalOrdinal,
00371           typename GlobalOrdinal,
00372           typename Node>
00373 struct InputTraits<Xpetra::MultiVector<Scalar,LocalOrdinal,GlobalOrdinal,Node> >
00374 {
00375   typedef Scalar        scalar_t;
00376   typedef LocalOrdinal  lno_t;
00377   typedef GlobalOrdinal gno_t;
00378   typedef GlobalOrdinal gid_t;
00379   typedef Node          node_t;
00380   static inline string name() {return "Xpetra::MultiVector";}
00381 };
00382 
00383 template <typename Scalar,
00384           typename LocalOrdinal,
00385           typename GlobalOrdinal,
00386           typename Node>
00387 struct InputTraits<Tpetra::MultiVector<Scalar,LocalOrdinal,GlobalOrdinal,Node> >
00388 {
00389   typedef Scalar        scalar_t;
00390   typedef LocalOrdinal  lno_t;
00391   typedef GlobalOrdinal gno_t;
00392   typedef GlobalOrdinal gid_t;
00393   typedef Node          node_t;
00394   static inline string name() {return "Tpetra::MultiVector";}
00395 };
00396 
00397 template < >
00398 struct InputTraits<Epetra_MultiVector>
00399 {
00400   typedef double scalar_t;
00401   typedef int   lno_t;
00402   typedef int   gno_t;
00403   typedef int   gid_t;
00404   typedef Kokkos::DefaultNode::DefaultNodeType node_t;
00405   static inline string name() {return "Epetra_MultiVector";}
00406 };
00407 
00408 #endif // DOXYGEN_SHOULD_SKIP_THIS
00409 
00410 
00411 }  // namespace Zoltan2
00412 #endif // ZOLTAN2_INPUTTRAITS_HPP