Zoltan2
Loading...
Searching...
No Matches
InputTraitsGood.cpp
Go to the documentation of this file.
1// @HEADER
2//
3// ***********************************************************************
4//
5// Zoltan2: A package of combinatorial algorithms for scientific computing
6// Copyright 2012 Sandia Corporation
7//
8// Under the terms of Contract DE-AC04-94AL85000 with Sandia Corporation,
9// the U.S. Government retains certain rights in this software.
10//
11// Redistribution and use in source and binary forms, with or without
12// modification, are permitted provided that the following conditions are
13// met:
14//
15// 1. Redistributions of source code must retain the above copyright
16// notice, this list of conditions and the following disclaimer.
17//
18// 2. Redistributions in binary form must reproduce the above copyright
19// notice, this list of conditions and the following disclaimer in the
20// documentation and/or other materials provided with the distribution.
21//
22// 3. Neither the name of the Corporation nor the names of the
23// contributors may be used to endorse or promote products derived from
24// this software without specific prior written permission.
25//
26// THIS SOFTWARE IS PROVIDED BY SANDIA CORPORATION "AS IS" AND ANY
27// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
28// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
29// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL SANDIA CORPORATION OR THE
30// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
31// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
32// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
33// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
34// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
35// NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
36// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
37//
38// Questions? Contact Karen Devine (kddevin@sandia.gov)
39// Erik Boman (egboman@sandia.gov)
40// Siva Rajamanickam (srajama@sandia.gov)
41//
42// ***********************************************************************
43//
44// @HEADER
45//
46// Test for Zoltan2::InputTraitsGood
47
49
51
52#define BEGIN_CHECK if( InputTraits<
53#define END_CHECK >::name() == "unused string" ) \
54 { std::cout << "Unused - Just make sure it compiles." << std::endl; }
55
56int main(int argc, char *argv[])
57{
58 // scalar ordinal (first slot) must be float, double, int or long long
59 // this validates they all work
66
67 // local ordinal (second slot) must always be signed
68 // this validates they all work
75
76 // global ordinal (third slot) must be int, long, long long, ssize_t,
77 // unsigned int, unsigned long, unsigned long long, size_t
90
91 // we also want to make sure that user typedefs will work just fine
92 // lots of redundancy here to make sure std::is_same is working as we think
93 typedef signed int user_int_t;
94 typedef unsigned int user_unsigned_int_t;
95 typedef float user_float_t;
96 typedef double user_double_t;
97 typedef int32_t user_int32_t;
98 typedef uint32_t user_uint32_t;
99 typedef int64_t user_int64_t;
100 typedef uint64_t user_uint64_t;
101 typedef signed long user_long_t;
102 typedef signed long long user_long_long_t;
103 typedef unsigned long user_unsigned_long_t;
104 typedef unsigned long long user_unsigned_long_long_t;
105 typedef size_t user_size_t;
106 typedef ssize_t user_ssize_t;
107
108 // scalar ordinal (first slot) must be float, double, or int
115
116 // local ordinal (second slot) must always be signed
123
124 // global ordinal (third slot) must be int, long, long long, ssize_t,
125 // unsigned int, unsigned long, unsigned long long, size_t
138
139 // this section takes each specific type and validates a few combinations
140 // note that some types may pass only two template parameters, not three,
141 // so it can be scalar + local + global or it can be just local + global.
142
143 // validate Zoltan2::BasicUserTypes
150
151 // validate Xpetra::CrsMatrix
152 BEGIN_CHECK Xpetra::CrsMatrix<double, signed int, long long> END_CHECK
153 BEGIN_CHECK Xpetra::CrsMatrix<double, int, long long> END_CHECK
154 BEGIN_CHECK Xpetra::CrsMatrix<float, signed long, unsigned int> END_CHECK
155 BEGIN_CHECK Xpetra::CrsMatrix<float, signed long long, long> END_CHECK
156 BEGIN_CHECK Xpetra::CrsMatrix<double, ssize_t, unsigned int> END_CHECK
157
158 // validate Tpetra::CrsMatrix
159 BEGIN_CHECK Tpetra::CrsMatrix<double, signed int, long long> END_CHECK
160 BEGIN_CHECK Tpetra::CrsMatrix<double, int, long long> END_CHECK
161 BEGIN_CHECK Tpetra::CrsMatrix<float, signed long, unsigned int> END_CHECK
162 BEGIN_CHECK Tpetra::CrsMatrix<float, signed long long, long> END_CHECK
163 BEGIN_CHECK Tpetra::CrsMatrix<double, ssize_t, unsigned int> END_CHECK
164
165 // validate Xpetra::RowMatrix
166 BEGIN_CHECK Xpetra::RowMatrix<double, signed int, long long> END_CHECK
167 BEGIN_CHECK Xpetra::RowMatrix<double, int, long long> END_CHECK
168 BEGIN_CHECK Xpetra::RowMatrix<float, signed long, unsigned int> END_CHECK
169 BEGIN_CHECK Xpetra::RowMatrix<float, signed long long, long> END_CHECK
170 BEGIN_CHECK Xpetra::RowMatrix<double, ssize_t, unsigned int> END_CHECK
171
172 // validate Tpetra::RowMatrix
173 BEGIN_CHECK Tpetra::RowMatrix<double, signed int, long long> END_CHECK
174 BEGIN_CHECK Tpetra::RowMatrix<double, int, long long> END_CHECK
175 BEGIN_CHECK Tpetra::RowMatrix<float, signed long, unsigned int> END_CHECK
176 BEGIN_CHECK Tpetra::RowMatrix<float, signed long long, long> END_CHECK
177 BEGIN_CHECK Tpetra::RowMatrix<double, ssize_t, unsigned int> END_CHECK
178
179 // validate Xpetra::Vector
180 BEGIN_CHECK Xpetra::Vector<double, signed int, long long> END_CHECK
181 BEGIN_CHECK Xpetra::Vector<double, int, long long> END_CHECK
182 BEGIN_CHECK Xpetra::Vector<float, signed long, unsigned int> END_CHECK
183 BEGIN_CHECK Xpetra::Vector<float, signed long long, long> END_CHECK
184 BEGIN_CHECK Xpetra::Vector<double, ssize_t, unsigned int> END_CHECK
185
186 // validate Tpetra::RowMatrix
187 BEGIN_CHECK Tpetra::RowMatrix<double, signed int, long long> END_CHECK
188 BEGIN_CHECK Tpetra::RowMatrix<double, int, long long> END_CHECK
189 BEGIN_CHECK Tpetra::RowMatrix<float, signed long, unsigned int> END_CHECK
190 BEGIN_CHECK Tpetra::RowMatrix<float, signed long long, long> END_CHECK
191 BEGIN_CHECK Tpetra::RowMatrix<double, ssize_t, unsigned int> END_CHECK
192
193 // validate Xpetra::MultiVector
194 BEGIN_CHECK Xpetra::MultiVector<double, signed int, long long> END_CHECK
195 BEGIN_CHECK Xpetra::MultiVector<double, int, long long> END_CHECK
196 BEGIN_CHECK Xpetra::MultiVector<float, signed long, unsigned int> END_CHECK
197 BEGIN_CHECK Xpetra::MultiVector<float, signed long long, long> END_CHECK
198 BEGIN_CHECK Xpetra::MultiVector<double, ssize_t, unsigned int> END_CHECK
199
200 // validate Tpetra::MultiVector
201 BEGIN_CHECK Tpetra::MultiVector<double, signed int, long long> END_CHECK
202 BEGIN_CHECK Tpetra::MultiVector<double, int, long long> END_CHECK
203 BEGIN_CHECK Tpetra::MultiVector<float, signed long, unsigned int> END_CHECK
204 BEGIN_CHECK Tpetra::MultiVector<float, signed long long, long> END_CHECK
205 BEGIN_CHECK Tpetra::MultiVector<double, ssize_t, unsigned int> END_CHECK
206
207 // validate Xpetra::CrsGraph
208 BEGIN_CHECK Xpetra::CrsGraph<signed int, long long> END_CHECK
209 BEGIN_CHECK Xpetra::CrsGraph<int, long long> END_CHECK
210 BEGIN_CHECK Xpetra::CrsGraph<signed long, unsigned int> END_CHECK
211 BEGIN_CHECK Xpetra::CrsGraph<signed long long, long> END_CHECK
212 BEGIN_CHECK Xpetra::CrsGraph<ssize_t, unsigned int> END_CHECK
213
214 // validate Tpetra::CrsGraph
215 BEGIN_CHECK Tpetra::CrsGraph<signed int, long long> END_CHECK
216 BEGIN_CHECK Tpetra::CrsGraph<int, long long> END_CHECK
217 BEGIN_CHECK Tpetra::CrsGraph<signed long, unsigned int> END_CHECK
218 BEGIN_CHECK Tpetra::CrsGraph<signed long long, long> END_CHECK
219 BEGIN_CHECK Tpetra::CrsGraph<ssize_t, unsigned int> END_CHECK
220
221 // set the PASS keyword
222 std::cout << "Validated InputTraits - The test PASSED "
223 "because it compiled" << std::endl;
224 return 0;
225}
226
#define END_CHECK
#define BEGIN_CHECK
Traits for application input objects.
int main()
A simple class that can be the User template argument for an InputAdapter.
The traits required of User input classes or structures.