Zoltan2
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 typedef int default_part_t;  // Default part number type.
00070                              // Restrictions in MPI interface will make it
00071                              // somewhat difficult to change default_part_t to
00072                              // long long, since we use part_t for ranks
00073                              // and we sometimes broadcast arrays whose
00074                              // size has type part_t.
00075 
00076 #ifdef HAVE_ZOLTAN2_INST_FLOAT_INT_LONG
00077 typedef float default_scalar_t;
00078 typedef long default_gno_t;
00079 #else
00080  #ifdef HAVE_ZOLTAN2_INST_DOUBLE_INT_LONG
00081  typedef double default_scalar_t;
00082  typedef long default_gno_t;
00083  #else
00084   #ifdef HAVE_ZOLTAN2_INST_FLOAT_INT_INT
00085   typedef float default_scalar_t;
00086   typedef int default_gno_t;
00087   #else
00088    #ifdef HAVE_ZOLTAN2_INST_DOUBLE_INT_INT
00089    typedef double default_scalar_t;
00090    typedef int default_gno_t;
00091    #else
00092    typedef double default_scalar_t;
00093    typedef int default_gno_t;
00094    #endif
00095   #endif
00096  #endif
00097 #endif
00098 
00141 template <typename scalar, typename gid, typename lno, typename gno>
00142 class BasicUserTypes{
00143 };
00144 
00179 template <typename User>
00180 struct InputTraits {
00181 
00184   typedef default_scalar_t scalar_t;
00185 
00189   typedef default_lno_t lno_t;
00190 
00194   typedef default_gno_t gno_t;
00195 
00202   typedef default_gno_t gid_t;
00203 
00206   typedef default_part_t part_t;
00207 
00211   typedef KokkosClassic::DefaultNode::DefaultNodeType node_t;
00212 
00215   static inline std::string name() {return "InputAdapter";}
00216 };
00217 
00218 #ifndef DOXYGEN_SHOULD_SKIP_THIS
00219 
00220 template <typename Scalar,
00221           typename GID,
00222           typename LNO,
00223           typename GNO>
00224 struct InputTraits<BasicUserTypes<Scalar, GID, LNO, GNO> >
00225 {
00226   typedef Scalar        scalar_t;
00227   typedef LNO lno_t;
00228   typedef GNO gno_t;
00229   typedef GID gid_t;
00230   typedef Zoltan2::default_part_t  part_t;
00231   typedef Zoltan2::default_node_t node_t;
00232   static inline std::string name() {return "BasicUserTypes";}
00233 };
00234 
00235 template <typename Scalar,
00236           typename LocalOrdinal,
00237           typename GlobalOrdinal,
00238           typename Node>
00239 struct InputTraits<Xpetra::CrsMatrix<Scalar,LocalOrdinal,GlobalOrdinal,Node> >
00240 {
00241   typedef Scalar        scalar_t;
00242   typedef LocalOrdinal  lno_t;
00243   typedef GlobalOrdinal gno_t;
00244   typedef GlobalOrdinal gid_t;
00245   typedef Zoltan2::default_part_t  part_t;
00246   typedef Node          node_t;
00247   static inline std::string name() {return "Xpetra::CrsMatrix";}
00248 };
00249 
00250 template <typename Scalar,
00251           typename LocalOrdinal,
00252           typename GlobalOrdinal,
00253           typename Node>
00254 struct InputTraits<Tpetra::CrsMatrix<Scalar,LocalOrdinal,GlobalOrdinal,Node> >
00255 {
00256   typedef Scalar        scalar_t;
00257   typedef LocalOrdinal  lno_t;
00258   typedef GlobalOrdinal gno_t;
00259   typedef GlobalOrdinal gid_t;
00260   typedef Zoltan2::default_part_t  part_t;
00261   typedef Node          node_t;
00262   static inline std::string name() {return "Tpetra::CrsMatrix";}
00263 };
00264 
00265 template < >
00266 struct InputTraits<Epetra_CrsMatrix>
00267 {
00268   typedef double scalar_t;
00269   typedef int lno_t;
00270   typedef int gno_t;
00271   typedef int gid_t;
00272   typedef Zoltan2::default_part_t  part_t;
00273   typedef KokkosClassic::DefaultNode::DefaultNodeType node_t;
00274   static inline std::string name() {return "Epetra_CrsMatrix";}
00275 };
00276 
00277 template <typename Scalar,
00278           typename LocalOrdinal,
00279           typename GlobalOrdinal,
00280           typename Node>
00281 struct InputTraits<Xpetra::RowMatrix<Scalar,LocalOrdinal,GlobalOrdinal,Node> >
00282 {
00283   typedef Scalar        scalar_t;
00284   typedef LocalOrdinal  lno_t;
00285   typedef GlobalOrdinal gno_t;
00286   typedef GlobalOrdinal gid_t;
00287   typedef Zoltan2::default_part_t  part_t;
00288   typedef Node          node_t;
00289   static inline std::string name() {return "Xpetra::RowMatrix";}
00290 };
00291 
00292 template <typename Scalar,
00293           typename LocalOrdinal,
00294           typename GlobalOrdinal,
00295           typename Node>
00296 struct InputTraits<Tpetra::RowMatrix<Scalar,LocalOrdinal,GlobalOrdinal,Node> >
00297 {
00298   typedef Scalar        scalar_t;
00299   typedef LocalOrdinal  lno_t;
00300   typedef GlobalOrdinal gno_t;
00301   typedef GlobalOrdinal gid_t;
00302   typedef Zoltan2::default_part_t  part_t;
00303   typedef Node          node_t;
00304   static inline std::string name() {return "Tpetra::RowMatrix";}
00305 };
00306 
00307 template <typename LocalOrdinal,
00308           typename GlobalOrdinal,
00309           typename Node>
00310 struct InputTraits<Xpetra::CrsGraph<LocalOrdinal,GlobalOrdinal,Node> >
00311 {
00312   typedef default_scalar_t scalar_t;
00313   typedef LocalOrdinal  lno_t;
00314   typedef GlobalOrdinal gno_t;
00315   typedef GlobalOrdinal gid_t;
00316   typedef Zoltan2::default_part_t  part_t;
00317   typedef Node          node_t;
00318   static inline std::string name() {return "Xpetra::CrsGraph";}
00319 };
00320 
00321 template <typename LocalOrdinal,
00322           typename GlobalOrdinal,
00323           typename Node>
00324 struct InputTraits<Tpetra::CrsGraph<LocalOrdinal,GlobalOrdinal,Node> >
00325 {
00326   typedef default_scalar_t scalar_t;
00327   typedef LocalOrdinal  lno_t;
00328   typedef GlobalOrdinal gno_t;
00329   typedef GlobalOrdinal gid_t;
00330   typedef Zoltan2::default_part_t  part_t;
00331   typedef Node          node_t;
00332   static inline std::string name() {return "Tpetra::CrsGraph";}
00333 };
00334 
00335 template < >
00336 struct InputTraits<Epetra_CrsGraph>
00337 {
00338   typedef double scalar_t;
00339   typedef int   lno_t;
00340   typedef int   gno_t;
00341   typedef int   gid_t;
00342   typedef Zoltan2::default_part_t  part_t;
00343   typedef KokkosClassic::DefaultNode::DefaultNodeType node_t;
00344   static inline std::string name() {return "Epetra_CrsGraph";}
00345 };
00346 
00347 template <typename Scalar,
00348           typename LocalOrdinal,
00349           typename GlobalOrdinal,
00350           typename Node>
00351 struct InputTraits<Xpetra::Vector<Scalar,LocalOrdinal,GlobalOrdinal,Node> >
00352 {
00353   typedef Scalar        scalar_t;
00354   typedef LocalOrdinal  lno_t;
00355   typedef GlobalOrdinal gno_t;
00356   typedef GlobalOrdinal gid_t;
00357   typedef Zoltan2::default_part_t  part_t;
00358   typedef Node          node_t;
00359   static inline std::string name() {return "Xpetra::Vector";}
00360 };
00361 
00365 template <typename Scalar,
00366           typename LocalOrdinal,
00367           typename GlobalOrdinal,
00368           typename Node>
00369 struct InputTraits<Tpetra::Vector<Scalar,LocalOrdinal,GlobalOrdinal,Node> >
00370 {
00371   typedef Scalar        scalar_t;
00372   typedef LocalOrdinal  lno_t;
00373   typedef GlobalOrdinal gno_t;
00374   typedef GlobalOrdinal gid_t;
00375   typedef Zoltan2::default_part_t  part_t;
00376   typedef Node          node_t;
00377   static inline std::string name() {return "Tpetra::Vector";}
00378 };
00379 
00380 template < >
00381 struct InputTraits<Epetra_Vector>
00382 {
00383   typedef double scalar_t;
00384   typedef int   lno_t;
00385   typedef int   gno_t;
00386   typedef int   gid_t;
00387   typedef Zoltan2::default_part_t  part_t;
00388   typedef KokkosClassic::DefaultNode::DefaultNodeType node_t;
00389   static inline std::string name() {return "Epetra_Vector";}
00390 };
00391 
00392 template <typename Scalar,
00393           typename LocalOrdinal,
00394           typename GlobalOrdinal,
00395           typename Node>
00396 struct InputTraits<Xpetra::MultiVector<Scalar,LocalOrdinal,GlobalOrdinal,Node> >
00397 {
00398   typedef Scalar        scalar_t;
00399   typedef LocalOrdinal  lno_t;
00400   typedef GlobalOrdinal gno_t;
00401   typedef GlobalOrdinal gid_t;
00402   typedef Zoltan2::default_part_t  part_t;
00403   typedef Node          node_t;
00404   static inline std::string name() {return "Xpetra::MultiVector";}
00405 };
00406 
00407 template <typename Scalar,
00408           typename LocalOrdinal,
00409           typename GlobalOrdinal,
00410           typename Node>
00411 struct InputTraits<Tpetra::MultiVector<Scalar,LocalOrdinal,GlobalOrdinal,Node> >
00412 {
00413   typedef Scalar        scalar_t;
00414   typedef LocalOrdinal  lno_t;
00415   typedef GlobalOrdinal gno_t;
00416   typedef GlobalOrdinal gid_t;
00417   typedef Zoltan2::default_part_t  part_t;
00418   typedef Node          node_t;
00419   static inline std::string name() {return "Tpetra::MultiVector";}
00420 };
00421 
00422 template < >
00423 struct InputTraits<Epetra_MultiVector>
00424 {
00425   typedef double scalar_t;
00426   typedef int   lno_t;
00427   typedef int   gno_t;
00428   typedef int   gid_t;
00429   typedef Zoltan2::default_part_t  part_t;
00430   typedef KokkosClassic::DefaultNode::DefaultNodeType node_t;
00431   static inline std::string name() {return "Epetra_MultiVector";}
00432 };
00433 
00434 #endif // DOXYGEN_SHOULD_SKIP_THIS
00435 
00436 
00437 }  // namespace Zoltan2
00438 #endif // ZOLTAN2_INPUTTRAITS_HPP