Zoltan 2 Version 0.5
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_CrsGraph.hpp>
00057 #include <Epetra_CrsMatrix.h>
00058 #include <Epetra_CrsGraph.h>
00059 #include <Xpetra_CrsMatrix.hpp>
00060 #include <Xpetra_CrsGraph.hpp>
00061 
00062 namespace Zoltan2{
00063 
00064 typedef int default_lno_t;
00065 
00066 #ifdef HAVE_ZOLTAN2_INST_FLOAT_INT_LONG
00067 typedef float default_scalar_t;
00068 typedef long default_gno_t;
00069 #else
00070  #ifdef HAVE_ZOLTAN2_INST_DOUBLE_INT_LONG
00071  typedef double default_scalar_t;
00072  typedef long default_gno_t;
00073  #else
00074   #ifdef HAVE_ZOLTAN2_INST_FLOAT_INT_INT
00075   typedef float default_scalar_t;
00076   typedef int default_gno_t;
00077   #else
00078    #ifdef HAVE_ZOLTAN2_INST_DOUBLE_INT_INT
00079    typedef double default_scalar_t;
00080    typedef int default_gno_t;
00081    #else
00082    typedef double default_scalar_t;
00083    typedef int default_gno_t;
00084    #endif
00085   #endif
00086  #endif
00087 #endif
00088 
00131 template <typename scalar, typename gid, typename lno, typename gno>
00132 class BasicUserTypes{
00133 };
00134 
00167 template <typename User>
00168 struct InputTraits {
00169 
00172   typedef default_scalar_t scalar_t;
00173 
00177   typedef default_lno_t lno_t;
00178 
00182   typedef default_gno_t gno_t;
00183 
00190   typedef default_gno_t gid_t;
00191 
00195   typedef Kokkos::DefaultNode::DefaultNodeType node_t;
00196 
00199   static inline string name() {return "InputAdapter";}
00200 };
00201 
00202 #ifndef DOXYGEN_SHOULD_SKIP_THIS
00203 
00204 template <typename Scalar,
00205           typename GID,
00206           typename LNO,
00207           typename GNO>
00208 struct InputTraits<BasicUserTypes<Scalar, GID, LNO, GNO> >
00209 {
00210   typedef Scalar        scalar_t;
00211   typedef LNO lno_t;
00212   typedef GNO gno_t;
00213   typedef GID gid_t;
00214   typedef Zoltan2::default_node_t node_t;
00215   static inline string name() {return "BasicUserTypes";}
00216 };
00217 
00218 template <typename Scalar,
00219           typename LocalOrdinal,
00220           typename GlobalOrdinal,
00221           typename Node>
00222 struct InputTraits<Xpetra::CrsMatrix<Scalar,LocalOrdinal,GlobalOrdinal,Node> >
00223 {
00224   typedef Scalar        scalar_t;
00225   typedef LocalOrdinal  lno_t;
00226   typedef GlobalOrdinal gno_t;
00227   typedef GlobalOrdinal gid_t;
00228   typedef Node          node_t;
00229   static inline string name() {return "Xpetra::CrsMatrix";}
00230 };
00231 
00232 template <typename Scalar,
00233           typename LocalOrdinal,
00234           typename GlobalOrdinal,
00235           typename Node>
00236 struct InputTraits<Tpetra::CrsMatrix<Scalar,LocalOrdinal,GlobalOrdinal,Node> >
00237 {
00238   typedef Scalar        scalar_t;
00239   typedef LocalOrdinal  lno_t;
00240   typedef GlobalOrdinal gno_t;
00241   typedef GlobalOrdinal gid_t;
00242   typedef Node          node_t;
00243   static inline string name() {return "Tpetra::CrsMatrix";}
00244 };
00245 
00246 template < >
00247 struct InputTraits<Epetra_CrsMatrix>
00248 {
00249   typedef double scalar_t;
00250   typedef int lno_t;
00251   typedef int gno_t;
00252   typedef int gid_t;
00253   typedef Kokkos::DefaultNode::DefaultNodeType node_t;
00254   static inline string name() {return "Epetra_CrsMatrix";}
00255 };
00256 
00257 template <typename LocalOrdinal,
00258           typename GlobalOrdinal,
00259           typename Node>
00260 struct InputTraits<Xpetra::CrsGraph<LocalOrdinal,GlobalOrdinal,Node> >
00261 {
00262   typedef default_scalar_t scalar_t;
00263   typedef LocalOrdinal  lno_t;
00264   typedef GlobalOrdinal gno_t;
00265   typedef GlobalOrdinal gid_t;
00266   typedef Node          node_t;
00267   static inline string name() {return "Xpetra::CrsGraph";}
00268 };
00269 
00270 template <typename LocalOrdinal,
00271           typename GlobalOrdinal,
00272           typename Node>
00273 struct InputTraits<Tpetra::CrsGraph<LocalOrdinal,GlobalOrdinal,Node> >
00274 {
00275   typedef default_scalar_t scalar_t;
00276   typedef LocalOrdinal  lno_t;
00277   typedef GlobalOrdinal gno_t;
00278   typedef GlobalOrdinal gid_t;
00279   typedef Node          node_t;
00280   static inline string name() {return "Tpetra::CrsGraph";}
00281 };
00282 
00283 template < >
00284 struct InputTraits<Epetra_CrsGraph>
00285 {
00286   typedef double scalar_t;
00287   typedef int   lno_t;
00288   typedef int   gno_t;
00289   typedef int   gid_t;
00290   typedef Kokkos::DefaultNode::DefaultNodeType node_t;
00291   static inline string name() {return "Epetra_CrsGraph";}
00292 };
00293 
00294 template <typename Scalar,
00295           typename LocalOrdinal,
00296           typename GlobalOrdinal,
00297           typename Node>
00298 struct InputTraits<Xpetra::Vector<Scalar,LocalOrdinal,GlobalOrdinal,Node> >
00299 {
00300   typedef Scalar        scalar_t;
00301   typedef LocalOrdinal  lno_t;
00302   typedef GlobalOrdinal gno_t;
00303   typedef GlobalOrdinal gid_t;
00304   typedef Node          node_t;
00305   static inline string name() {return "Xpetra::Vector";}
00306 };
00307 
00311 template <typename Scalar,
00312           typename LocalOrdinal,
00313           typename GlobalOrdinal,
00314           typename Node>
00315 struct InputTraits<Tpetra::Vector<Scalar,LocalOrdinal,GlobalOrdinal,Node> >
00316 {
00317   typedef Scalar        scalar_t;
00318   typedef LocalOrdinal  lno_t;
00319   typedef GlobalOrdinal gno_t;
00320   typedef GlobalOrdinal gid_t;
00321   typedef Node          node_t;
00322   static inline string name() {return "Tpetra::Vector";}
00323 };
00324 
00325 template < >
00326 struct InputTraits<Epetra_Vector>
00327 {
00328   typedef double scalar_t;
00329   typedef int   lno_t;
00330   typedef int   gno_t;
00331   typedef int   gid_t;
00332   typedef Kokkos::DefaultNode::DefaultNodeType node_t;
00333   static inline string name() {return "Epetra_Vector";}
00334 };
00335 
00336 template <typename Scalar,
00337           typename LocalOrdinal,
00338           typename GlobalOrdinal,
00339           typename Node>
00340 struct InputTraits<Xpetra::MultiVector<Scalar,LocalOrdinal,GlobalOrdinal,Node> >
00341 {
00342   typedef Scalar        scalar_t;
00343   typedef LocalOrdinal  lno_t;
00344   typedef GlobalOrdinal gno_t;
00345   typedef GlobalOrdinal gid_t;
00346   typedef Node          node_t;
00347   static inline string name() {return "Xpetra::MultiVector";}
00348 };
00349 
00350 template <typename Scalar,
00351           typename LocalOrdinal,
00352           typename GlobalOrdinal,
00353           typename Node>
00354 struct InputTraits<Tpetra::MultiVector<Scalar,LocalOrdinal,GlobalOrdinal,Node> >
00355 {
00356   typedef Scalar        scalar_t;
00357   typedef LocalOrdinal  lno_t;
00358   typedef GlobalOrdinal gno_t;
00359   typedef GlobalOrdinal gid_t;
00360   typedef Node          node_t;
00361   static inline string name() {return "Tpetra::MultiVector";}
00362 };
00363 
00364 template < >
00365 struct InputTraits<Epetra_MultiVector>
00366 {
00367   typedef double scalar_t;
00368   typedef int   lno_t;
00369   typedef int   gno_t;
00370   typedef int   gid_t;
00371   typedef Kokkos::DefaultNode::DefaultNodeType node_t;
00372   static inline string name() {return "Epetra_MultiVector";}
00373 };
00374 
00375 #endif // DOXYGEN_SHOULD_SKIP_THIS
00376 
00377 
00378 }  // namespace Zoltan2
00379 #endif // ZOLTAN2_INPUTTRAITS_HPP