Zoltan2
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Pages
InputTraitsGood.cpp
Go to the documentation of this file.
1 // @HEADER
2 // *****************************************************************************
3 // Zoltan2: A package of combinatorial algorithms for scientific computing
4 //
5 // Copyright 2012 NTESS and the Zoltan2 contributors.
6 // SPDX-License-Identifier: BSD-3-Clause
7 // *****************************************************************************
8 // @HEADER
9 
10 //
11 // Test for Zoltan2::InputTraitsGood
12 
13 #include <Zoltan2_InputTraits.hpp>
14 
16 
17 #define BEGIN_CHECK if( InputTraits<
18 #define END_CHECK >::name() == "unused string" ) \
19  { std::cout << "Unused - Just make sure it compiles." << std::endl; }
20 
21 int main(int argc, char *argv[])
22 {
23  // scalar ordinal (first slot) must be float, double, int or long long
24  // this validates they all work
31 
32  // local ordinal (second slot) must always be signed
33  // this validates they all work
40 
41  // global ordinal (third slot) must be int, long, long long, ssize_t,
42  // unsigned int, unsigned long, unsigned long long, size_t
55 
56  // we also want to make sure that user typedefs will work just fine
57  // lots of redundancy here to make sure std::is_same is working as we think
58  typedef signed int user_int_t;
59  typedef unsigned int user_unsigned_int_t;
60  typedef float user_float_t;
61  typedef double user_double_t;
62  typedef int32_t user_int32_t;
63  typedef uint32_t user_uint32_t;
64  typedef int64_t user_int64_t;
65  typedef uint64_t user_uint64_t;
66  typedef signed long user_long_t;
67  typedef signed long long user_long_long_t;
68  typedef unsigned long user_unsigned_long_t;
69  typedef unsigned long long user_unsigned_long_long_t;
70  typedef size_t user_size_t;
71  typedef ssize_t user_ssize_t;
72 
73  // scalar ordinal (first slot) must be float, double, or int
80 
81  // local ordinal (second slot) must always be signed
88 
89  // global ordinal (third slot) must be int, long, long long, ssize_t,
90  // unsigned int, unsigned long, unsigned long long, size_t
103 
104  // this section takes each specific type and validates a few combinations
105  // note that some types may pass only two template parameters, not three,
106  // so it can be scalar + local + global or it can be just local + global.
107 
108  // validate Zoltan2::BasicUserTypes
115 
116  // validate Xpetra::CrsMatrix
117  BEGIN_CHECK Xpetra::CrsMatrix<double, signed int, long long> END_CHECK
118  BEGIN_CHECK Xpetra::CrsMatrix<double, int, long long> END_CHECK
119  BEGIN_CHECK Xpetra::CrsMatrix<float, signed long, unsigned int> END_CHECK
120  BEGIN_CHECK Xpetra::CrsMatrix<float, signed long long, long> END_CHECK
121  BEGIN_CHECK Xpetra::CrsMatrix<double, ssize_t, unsigned int> END_CHECK
122 
123  // validate Tpetra::CrsMatrix
124  BEGIN_CHECK Tpetra::CrsMatrix<double, signed int, long long> END_CHECK
125  BEGIN_CHECK Tpetra::CrsMatrix<double, int, long long> END_CHECK
126  BEGIN_CHECK Tpetra::CrsMatrix<float, signed long, unsigned int> END_CHECK
127  BEGIN_CHECK Tpetra::CrsMatrix<float, signed long long, long> END_CHECK
128  BEGIN_CHECK Tpetra::CrsMatrix<double, ssize_t, unsigned int> END_CHECK
129 
130  // validate Xpetra::RowMatrix
131  BEGIN_CHECK Xpetra::RowMatrix<double, signed int, long long> END_CHECK
132  BEGIN_CHECK Xpetra::RowMatrix<double, int, long long> END_CHECK
133  BEGIN_CHECK Xpetra::RowMatrix<float, signed long, unsigned int> END_CHECK
134  BEGIN_CHECK Xpetra::RowMatrix<float, signed long long, long> END_CHECK
135  BEGIN_CHECK Xpetra::RowMatrix<double, ssize_t, unsigned int> END_CHECK
136 
137  // validate Tpetra::RowMatrix
138  BEGIN_CHECK Tpetra::RowMatrix<double, signed int, long long> END_CHECK
139  BEGIN_CHECK Tpetra::RowMatrix<double, int, long long> END_CHECK
140  BEGIN_CHECK Tpetra::RowMatrix<float, signed long, unsigned int> END_CHECK
141  BEGIN_CHECK Tpetra::RowMatrix<float, signed long long, long> END_CHECK
142  BEGIN_CHECK Tpetra::RowMatrix<double, ssize_t, unsigned int> END_CHECK
143 
144  // validate Xpetra::Vector
145  BEGIN_CHECK Xpetra::Vector<double, signed int, long long> END_CHECK
146  BEGIN_CHECK Xpetra::Vector<double, int, long long> END_CHECK
147  BEGIN_CHECK Xpetra::Vector<float, signed long, unsigned int> END_CHECK
148  BEGIN_CHECK Xpetra::Vector<float, signed long long, long> END_CHECK
149  BEGIN_CHECK Xpetra::Vector<double, ssize_t, unsigned int> END_CHECK
150 
151  // validate Tpetra::RowMatrix
152  BEGIN_CHECK Tpetra::RowMatrix<double, signed int, long long> END_CHECK
153  BEGIN_CHECK Tpetra::RowMatrix<double, int, long long> END_CHECK
154  BEGIN_CHECK Tpetra::RowMatrix<float, signed long, unsigned int> END_CHECK
155  BEGIN_CHECK Tpetra::RowMatrix<float, signed long long, long> END_CHECK
156  BEGIN_CHECK Tpetra::RowMatrix<double, ssize_t, unsigned int> END_CHECK
157 
158  // validate Xpetra::MultiVector
159  BEGIN_CHECK Xpetra::MultiVector<double, signed int, long long> END_CHECK
160  BEGIN_CHECK Xpetra::MultiVector<double, int, long long> END_CHECK
161  BEGIN_CHECK Xpetra::MultiVector<float, signed long, unsigned int> END_CHECK
162  BEGIN_CHECK Xpetra::MultiVector<float, signed long long, long> END_CHECK
163  BEGIN_CHECK Xpetra::MultiVector<double, ssize_t, unsigned int> END_CHECK
164 
165  // validate Tpetra::MultiVector
166  BEGIN_CHECK Tpetra::MultiVector<double, signed int, long long> END_CHECK
167  BEGIN_CHECK Tpetra::MultiVector<double, int, long long> END_CHECK
168  BEGIN_CHECK Tpetra::MultiVector<float, signed long, unsigned int> END_CHECK
169  BEGIN_CHECK Tpetra::MultiVector<float, signed long long, long> END_CHECK
170  BEGIN_CHECK Tpetra::MultiVector<double, ssize_t, unsigned int> END_CHECK
171 
172  // validate Xpetra::CrsGraph
173  BEGIN_CHECK Xpetra::CrsGraph<signed int, long long> END_CHECK
174  BEGIN_CHECK Xpetra::CrsGraph<int, long long> END_CHECK
175  BEGIN_CHECK Xpetra::CrsGraph<signed long, unsigned int> END_CHECK
176  BEGIN_CHECK Xpetra::CrsGraph<signed long long, long> END_CHECK
177  BEGIN_CHECK Xpetra::CrsGraph<ssize_t, unsigned int> END_CHECK
178 
179  // validate Tpetra::CrsGraph
180  BEGIN_CHECK Tpetra::CrsGraph<signed int, long long> END_CHECK
181  BEGIN_CHECK Tpetra::CrsGraph<int, long long> END_CHECK
182  BEGIN_CHECK Tpetra::CrsGraph<signed long, unsigned int> END_CHECK
183  BEGIN_CHECK Tpetra::CrsGraph<signed long long, long> END_CHECK
184  BEGIN_CHECK Tpetra::CrsGraph<ssize_t, unsigned int> END_CHECK
185 
186  // set the PASS keyword
187  std::cout << "Validated InputTraits - The test PASSED "
188  "because it compiled" << std::endl;
189  return 0;
190 }
191 
A simple class that can be the User template argument for an InputAdapter.
int main(int narg, char **arg)
Definition: coloring1.cpp:164
#define BEGIN_CHECK
#define END_CHECK
The traits required of User input classes or structures.
Traits for application input objects.