14 #ifndef ZOLTAN2_INPUTTRAITS_HPP
15 #define ZOLTAN2_INPUTTRAITS_HPP
19 #include <Tpetra_CrsMatrix.hpp>
20 #include <Tpetra_RowMatrix.hpp>
21 #include <Tpetra_CrsGraph.hpp>
22 #include <Tpetra_RowGraph.hpp>
24 #ifdef HAVE_ZOLTAN2_EPETRA
25 #include <Epetra_CrsMatrix.h>
26 #include <Epetra_CrsGraph.h>
29 #include <Xpetra_CrsMatrix.hpp>
30 #include <Xpetra_RowMatrix.hpp>
31 #include <Xpetra_TpetraRowMatrix.hpp>
32 #include <Xpetra_CrsGraph.hpp>
37 typedef ::Tpetra::Details::DefaultTypes::local_ordinal_type
default_lno_t;
40 typedef ::Tpetra::Details::DefaultTypes::global_ordinal_type
default_gno_t;
141 template <
typename User>
173 static inline std::string
name() {
return "InputAdapter";}
176 #ifndef DOXYGEN_SHOULD_SKIP_THIS
179 typedef SSIZE_T ssize_t;
184 #define Z2_ISSAME(s,type) (std::is_same< s, type >::value)
186 #define Z2_STYPES(s) ( Z2_ISSAME(s,float) || \
187 Z2_ISSAME(s,double) || Z2_ISSAME(s,int) || Z2_ISSAME(s,long) || \
188 Z2_ISSAME(s,long long) || Z2_ISSAME(s, int64_t) || Z2_ISSAME(s, int32_t))
190 #define Z2_LTYPES(l) ( Z2_ISSAME(l,int) || \
191 Z2_ISSAME(l,long) || Z2_ISSAME(l,long long) || Z2_ISSAME(l,ssize_t) )
193 #define Z2_GTYPES(g) ( Z2_ISSAME(g,int) || Z2_ISSAME(g,long) || \
194 Z2_ISSAME(g,long long) || Z2_ISSAME(g,ssize_t) || \
195 Z2_ISSAME(g,unsigned int) || Z2_ISSAME(g,unsigned long) || \
196 Z2_ISSAME(g,unsigned long long) || Z2_ISSAME(g,size_t) )
198 #define Z2_SERROR "Invalid scalar type. It must be float, double, int, long, long long, int32_t, or int64_t."
200 #define Z2_LERROR "Invalid local ordinal type. It must be int, long, " \
201 "long long, or ssize_t."
203 #define Z2_GERROR "Invalid global ordinal type. It must be int, long, " \
204 "long long, ssize_t, unsigned int, unsigned long long, size_t."
206 #ifdef Z2_INVERT_STATIC_ASSERT_FOR_UNIT_TESTING
207 #define Z2_STATIC_ASSERT_TYPES static_assert( ( !Z2_STYPES(scalar_t) || \
208 !Z2_LTYPES(lno_t) || !Z2_GTYPES(gno_t) ), \
209 "Inverted unit test for InputTraits was supposed to fail but did not." );
211 #define Z2_STATIC_ASSERT_TYPES static_assert( Z2_STYPES(scalar_t), \
212 Z2_SERROR ); static_assert( Z2_LTYPES(lno_t), Z2_LERROR ); \
213 static_assert( Z2_GTYPES(gno_t), Z2_GERROR );
216 template <
typename Scalar,
217 typename LocalOrdinal,
218 typename GlobalOrdinal,
220 struct InputTraits<BasicUserTypes<Scalar, LocalOrdinal, GlobalOrdinal,
Node> >
223 typedef LocalOrdinal
lno_t;
224 typedef GlobalOrdinal
gno_t;
228 static inline std::string
name() {
return "BasicUserTypes";}
230 Z2_STATIC_ASSERT_TYPES
233 template <
typename Scalar,
234 typename LocalOrdinal,
235 typename GlobalOrdinal,
237 struct InputTraits<Xpetra::CrsMatrix<Scalar,LocalOrdinal,GlobalOrdinal,Node> >
240 typedef LocalOrdinal
lno_t;
241 typedef GlobalOrdinal
gno_t;
245 static inline std::string
name() {
return "Xpetra::CrsMatrix";}
247 Z2_STATIC_ASSERT_TYPES
250 template <
typename Scalar,
251 typename LocalOrdinal,
252 typename GlobalOrdinal,
254 struct InputTraits<Tpetra::CrsMatrix<Scalar,LocalOrdinal,GlobalOrdinal,Node> >
257 typedef LocalOrdinal
lno_t;
258 typedef GlobalOrdinal
gno_t;
262 static inline std::string
name() {
return "Tpetra::CrsMatrix";}
264 Z2_STATIC_ASSERT_TYPES
267 #ifdef HAVE_ZOLTAN2_EPETRA
269 struct InputTraits<Epetra_CrsMatrix>
277 static inline std::string
name() {
return "Epetra_CrsMatrix";}
281 template <
typename Scalar,
282 typename LocalOrdinal,
283 typename GlobalOrdinal,
285 struct InputTraits<Xpetra::RowMatrix<Scalar,LocalOrdinal,GlobalOrdinal,Node> >
288 typedef LocalOrdinal
lno_t;
289 typedef GlobalOrdinal
gno_t;
293 static inline std::string
name() {
return "Xpetra::RowMatrix";}
295 Z2_STATIC_ASSERT_TYPES
298 template <
typename Scalar,
299 typename LocalOrdinal,
300 typename GlobalOrdinal,
302 struct InputTraits<Tpetra::RowMatrix<Scalar,LocalOrdinal,GlobalOrdinal,Node> >
305 typedef LocalOrdinal
lno_t;
306 typedef GlobalOrdinal
gno_t;
310 static inline std::string
name() {
return "Tpetra::RowMatrix";}
312 Z2_STATIC_ASSERT_TYPES
315 template <
typename LocalOrdinal,
316 typename GlobalOrdinal,
318 struct InputTraits<Tpetra::RowGraph<LocalOrdinal,GlobalOrdinal,Node> >
321 typedef LocalOrdinal
lno_t;
322 typedef GlobalOrdinal
gno_t;
326 static inline std::string
name() {
return "Tpetra::RowGraph";}
329 template <
typename LocalOrdinal,
330 typename GlobalOrdinal,
332 struct InputTraits<Xpetra::CrsGraph<LocalOrdinal,GlobalOrdinal,Node> >
335 typedef LocalOrdinal
lno_t;
336 typedef GlobalOrdinal
gno_t;
340 static inline std::string
name() {
return "Xpetra::CrsGraph";}
342 Z2_STATIC_ASSERT_TYPES
345 template <
typename LocalOrdinal,
346 typename GlobalOrdinal,
348 struct InputTraits<Tpetra::CrsGraph<LocalOrdinal,GlobalOrdinal,Node> >
351 typedef LocalOrdinal
lno_t;
352 typedef GlobalOrdinal
gno_t;
356 static inline std::string
name() {
return "Tpetra::CrsGraph";}
358 Z2_STATIC_ASSERT_TYPES
361 #ifdef HAVE_ZOLTAN2_EPETRA
363 struct InputTraits<Epetra_CrsGraph>
371 static inline std::string
name() {
return "Epetra_CrsGraph";}
375 template <
typename Scalar,
376 typename LocalOrdinal,
377 typename GlobalOrdinal,
379 struct InputTraits<Xpetra::
Vector<Scalar,LocalOrdinal,GlobalOrdinal,Node> >
382 typedef LocalOrdinal
lno_t;
383 typedef GlobalOrdinal
gno_t;
387 static inline std::string
name() {
return "Xpetra::Vector";}
389 Z2_STATIC_ASSERT_TYPES
395 template <
typename Scalar,
396 typename LocalOrdinal,
397 typename GlobalOrdinal,
399 struct InputTraits<Tpetra::
Vector<Scalar,LocalOrdinal,GlobalOrdinal,Node> >
402 typedef LocalOrdinal
lno_t;
403 typedef GlobalOrdinal
gno_t;
407 static inline std::string
name() {
return "Tpetra::Vector";}
409 Z2_STATIC_ASSERT_TYPES
412 #ifdef HAVE_ZOLTAN2_EPETRA
414 struct InputTraits<Epetra_Vector>
422 static inline std::string
name() {
return "Epetra_Vector";}
426 template <
typename Scalar,
427 typename LocalOrdinal,
428 typename GlobalOrdinal,
430 struct InputTraits<Xpetra::MultiVector<Scalar,LocalOrdinal,GlobalOrdinal,Node> >
433 typedef LocalOrdinal
lno_t;
434 typedef GlobalOrdinal
gno_t;
438 static inline std::string
name() {
return "Xpetra::MultiVector";}
440 Z2_STATIC_ASSERT_TYPES
443 template <
typename Scalar,
444 typename LocalOrdinal,
445 typename GlobalOrdinal,
447 struct InputTraits<Tpetra::MultiVector<Scalar,LocalOrdinal,GlobalOrdinal,Node> >
450 typedef LocalOrdinal
lno_t;
451 typedef GlobalOrdinal
gno_t;
455 static inline std::string
name() {
return "Tpetra::MultiVector";}
457 Z2_STATIC_ASSERT_TYPES
460 #ifdef HAVE_ZOLTAN2_EPETRA
462 struct InputTraits<Epetra_MultiVector>
470 static inline std::string
name() {
return "Epetra_MultiVector";}
474 #endif // DOXYGEN_SHOULD_SKIP_THIS
478 #endif // ZOLTAN2_INPUTTRAITS_HPP
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::Vector< z2TestScalar, z2TestLO, z2TestGO > Vector
::Tpetra::Details::DefaultTypes::scalar_type default_scalar_t
Gathering definitions used in software development.
::Tpetra::Details::DefaultTypes::node_type default_node_t