50 #ifndef ZOLTAN2_INPUTTRAITS_HPP
51 #define ZOLTAN2_INPUTTRAITS_HPP
55 #include <Tpetra_CrsMatrix.hpp>
56 #include <Tpetra_RowMatrix.hpp>
57 #include <Tpetra_CrsGraph.hpp>
58 #include <Tpetra_RowGraph.hpp>
60 #ifdef HAVE_ZOLTAN2_EPETRA
61 #include <Epetra_CrsMatrix.h>
62 #include <Epetra_CrsGraph.h>
65 #include <Xpetra_CrsMatrix.hpp>
66 #include <Xpetra_RowMatrix.hpp>
67 #include <Xpetra_TpetraRowMatrix.hpp>
68 #include <Xpetra_CrsGraph.hpp>
73 typedef ::Tpetra::Details::DefaultTypes::local_ordinal_type
default_lno_t;
76 typedef ::Tpetra::Details::DefaultTypes::global_ordinal_type
default_gno_t;
176 template <
typename User>
208 static inline std::string
name() {
return "InputAdapter";}
211 #ifndef DOXYGEN_SHOULD_SKIP_THIS
215 #define Z2_ISSAME(s,type) (std::is_same< s, type >::value)
217 #define Z2_STYPES(s) ( Z2_ISSAME(s,float) || \
218 Z2_ISSAME(s,double) || Z2_ISSAME(s,int) )
220 #define Z2_LTYPES(l) ( Z2_ISSAME(l,int) || \
221 Z2_ISSAME(l,long) || Z2_ISSAME(l,long long) || Z2_ISSAME(l,ssize_t) )
223 #define Z2_GTYPES(g) ( Z2_ISSAME(g,int) || Z2_ISSAME(g,long) || \
224 Z2_ISSAME(g,long long) || Z2_ISSAME(g,ssize_t) || \
225 Z2_ISSAME(g,unsigned int) || Z2_ISSAME(g,unsigned long) || \
226 Z2_ISSAME(g,unsigned long long) || Z2_ISSAME(g,size_t) )
228 #define Z2_SERROR "Invalid scalar type. It must be float, double, or int."
230 #define Z2_LERROR "Invalid local ordinal type. It must be int, long, " \
231 "long long, or ssize_t."
233 #define Z2_GERROR "Invalid global ordinal type. It must be int, long, " \
234 "long long, ssize_t, unsigned int, unsigned long long, size_t."
236 #ifdef Z2_INVERT_STATIC_ASSERT_FOR_UNIT_TESTING
237 #define Z2_STATIC_ASSERT_TYPES static_assert( ( !Z2_STYPES(scalar_t) || \
238 !Z2_LTYPES(lno_t) || !Z2_GTYPES(gno_t) ), \
239 "Inverted unit test for InputTraits was supposed to fail but did not." );
241 #define Z2_STATIC_ASSERT_TYPES static_assert( Z2_STYPES(scalar_t), \
242 Z2_SERROR ); static_assert( Z2_LTYPES(lno_t), Z2_LERROR ); \
243 static_assert( Z2_GTYPES(gno_t), Z2_GERROR );
246 template <
typename Scalar,
247 typename LocalOrdinal,
248 typename GlobalOrdinal>
249 struct InputTraits<BasicUserTypes<Scalar, LocalOrdinal, GlobalOrdinal> >
252 typedef LocalOrdinal
lno_t;
253 typedef GlobalOrdinal
gno_t;
257 static inline std::string
name() {
return "BasicUserTypes";}
259 Z2_STATIC_ASSERT_TYPES
262 template <
typename Scalar,
263 typename LocalOrdinal,
264 typename GlobalOrdinal,
266 struct InputTraits<Xpetra::CrsMatrix<Scalar,LocalOrdinal,GlobalOrdinal,Node> >
269 typedef LocalOrdinal
lno_t;
270 typedef GlobalOrdinal
gno_t;
274 static inline std::string
name() {
return "Xpetra::CrsMatrix";}
276 Z2_STATIC_ASSERT_TYPES
279 template <
typename Scalar,
280 typename LocalOrdinal,
281 typename GlobalOrdinal,
283 struct InputTraits<Tpetra::CrsMatrix<Scalar,LocalOrdinal,GlobalOrdinal,Node> >
286 typedef LocalOrdinal
lno_t;
287 typedef GlobalOrdinal
gno_t;
291 static inline std::string
name() {
return "Tpetra::CrsMatrix";}
293 Z2_STATIC_ASSERT_TYPES
296 #ifdef HAVE_ZOLTAN2_EPETRA
298 struct InputTraits<Epetra_CrsMatrix>
306 static inline std::string
name() {
return "Epetra_CrsMatrix";}
310 template <
typename Scalar,
311 typename LocalOrdinal,
312 typename GlobalOrdinal,
314 struct InputTraits<Xpetra::RowMatrix<Scalar,LocalOrdinal,GlobalOrdinal,Node> >
317 typedef LocalOrdinal
lno_t;
318 typedef GlobalOrdinal
gno_t;
322 static inline std::string
name() {
return "Xpetra::RowMatrix";}
324 Z2_STATIC_ASSERT_TYPES
327 template <
typename Scalar,
328 typename LocalOrdinal,
329 typename GlobalOrdinal,
331 struct InputTraits<Tpetra::RowMatrix<Scalar,LocalOrdinal,GlobalOrdinal,Node> >
334 typedef LocalOrdinal
lno_t;
335 typedef GlobalOrdinal
gno_t;
339 static inline std::string
name() {
return "Tpetra::RowMatrix";}
341 Z2_STATIC_ASSERT_TYPES
344 template <
typename LocalOrdinal,
345 typename GlobalOrdinal,
347 struct InputTraits<Tpetra::RowGraph<LocalOrdinal,GlobalOrdinal,Node> >
350 typedef LocalOrdinal
lno_t;
351 typedef GlobalOrdinal
gno_t;
355 static inline std::string
name() {
return "Tpetra::RowGraph";}
358 template <
typename LocalOrdinal,
359 typename GlobalOrdinal,
361 struct InputTraits<Xpetra::CrsGraph<LocalOrdinal,GlobalOrdinal,Node> >
364 typedef LocalOrdinal
lno_t;
365 typedef GlobalOrdinal
gno_t;
369 static inline std::string
name() {
return "Xpetra::CrsGraph";}
371 Z2_STATIC_ASSERT_TYPES
374 template <
typename LocalOrdinal,
375 typename GlobalOrdinal,
377 struct InputTraits<Tpetra::CrsGraph<LocalOrdinal,GlobalOrdinal,Node> >
380 typedef LocalOrdinal
lno_t;
381 typedef GlobalOrdinal
gno_t;
385 static inline std::string
name() {
return "Tpetra::CrsGraph";}
387 Z2_STATIC_ASSERT_TYPES
390 #ifdef HAVE_ZOLTAN2_EPETRA
392 struct InputTraits<Epetra_CrsGraph>
400 static inline std::string
name() {
return "Epetra_CrsGraph";}
404 template <
typename Scalar,
405 typename LocalOrdinal,
406 typename GlobalOrdinal,
408 struct InputTraits<Xpetra::
Vector<Scalar,LocalOrdinal,GlobalOrdinal,Node> >
411 typedef LocalOrdinal
lno_t;
412 typedef GlobalOrdinal
gno_t;
416 static inline std::string
name() {
return "Xpetra::Vector";}
418 Z2_STATIC_ASSERT_TYPES
424 template <
typename Scalar,
425 typename LocalOrdinal,
426 typename GlobalOrdinal,
428 struct InputTraits<Tpetra::
Vector<Scalar,LocalOrdinal,GlobalOrdinal,Node> >
431 typedef LocalOrdinal
lno_t;
432 typedef GlobalOrdinal
gno_t;
436 static inline std::string
name() {
return "Tpetra::Vector";}
438 Z2_STATIC_ASSERT_TYPES
441 #ifdef HAVE_ZOLTAN2_EPETRA
443 struct InputTraits<Epetra_Vector>
451 static inline std::string
name() {
return "Epetra_Vector";}
455 template <
typename Scalar,
456 typename LocalOrdinal,
457 typename GlobalOrdinal,
459 struct InputTraits<Xpetra::MultiVector<Scalar,LocalOrdinal,GlobalOrdinal,Node> >
462 typedef LocalOrdinal
lno_t;
463 typedef GlobalOrdinal
gno_t;
467 static inline std::string
name() {
return "Xpetra::MultiVector";}
469 Z2_STATIC_ASSERT_TYPES
472 template <
typename Scalar,
473 typename LocalOrdinal,
474 typename GlobalOrdinal,
476 struct InputTraits<Tpetra::MultiVector<Scalar,LocalOrdinal,GlobalOrdinal,Node> >
479 typedef LocalOrdinal
lno_t;
480 typedef GlobalOrdinal
gno_t;
484 static inline std::string
name() {
return "Tpetra::MultiVector";}
486 Z2_STATIC_ASSERT_TYPES
489 #ifdef HAVE_ZOLTAN2_EPETRA
491 struct InputTraits<Epetra_MultiVector>
499 static inline std::string
name() {
return "Epetra_MultiVector";}
503 #endif // DOXYGEN_SHOULD_SKIP_THIS
507 #endif // ZOLTAN2_INPUTTRAITS_HPP
Tpetra::Vector< z2TestScalar, z2TestLO, z2TestGO > Vector
A simple class that can be the User template argument for an InputAdapter.
::Tpetra::Details::DefaultTypes::global_ordinal_type default_gno_t
::Tpetra::Details::DefaultTypes::local_ordinal_type default_lno_t
::Tpetra::Details::DefaultTypes::scalar_type default_scalar_t
Gathering definitions used in software development.
::Tpetra::Details::DefaultTypes::node_type default_node_t