Zoltan2  Version of the Day
Zoltan2_InputTraits.hpp
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 
50 #ifndef ZOLTAN2_INPUTTRAITS_HPP
51 #define ZOLTAN2_INPUTTRAITS_HPP
52 
53 #include <Zoltan2_Standards.hpp>
54 
55 #include <Tpetra_CrsMatrix.hpp>
56 #include <Tpetra_RowMatrix.hpp>
57 #include <Tpetra_CrsGraph.hpp>
58 #include <Epetra_CrsMatrix.h>
59 #include <Epetra_CrsGraph.h>
60 #include <Xpetra_CrsMatrix.hpp>
61 #include <Xpetra_RowMatrix.hpp>
62 #include <Xpetra_TpetraRowMatrix.hpp>
63 #include <Xpetra_CrsGraph.hpp>
64 
65 namespace Zoltan2{
66 
67 typedef int default_lno_t;
68 
69 #ifdef HAVE_ZOLTAN2_INST_FLOAT_INT_LONG
70 typedef float default_scalar_t;
71 typedef long default_gno_t;
72 #else
73  #ifdef HAVE_ZOLTAN2_INST_DOUBLE_INT_LONG
74  typedef double default_scalar_t;
75  typedef long default_gno_t;
76  #else
77  #ifdef HAVE_ZOLTAN2_INST_FLOAT_INT_INT
78  typedef float default_scalar_t;
79  typedef int default_gno_t;
80  #else
81  #ifdef HAVE_ZOLTAN2_INST_DOUBLE_INT_INT
82  typedef double default_scalar_t;
83  typedef int default_gno_t;
84  #else
85  typedef double default_scalar_t;
86  typedef int default_gno_t;
87  #endif
88  #endif
89  #endif
90 #endif
91 
134 template <typename scalar, typename gid, typename lno, typename gno>
136 };
137 
172 template <typename User>
173 struct InputTraits {
174 
178 
183 
188 
196 
200  typedef Kokkos::DefaultNode::DefaultNodeType node_t;
201 
204  static inline string name() {return "InputAdapter";}
205 };
206 
207 #ifndef DOXYGEN_SHOULD_SKIP_THIS
208 
209 template <typename Scalar,
210  typename GID,
211  typename LNO,
212  typename GNO>
213 struct InputTraits<BasicUserTypes<Scalar, GID, LNO, GNO> >
214 {
215  typedef Scalar scalar_t;
216  typedef LNO lno_t;
217  typedef GNO gno_t;
218  typedef GID gid_t;
220  static inline string name() {return "BasicUserTypes";}
221 };
222 
223 template <typename Scalar,
224  typename LocalOrdinal,
225  typename GlobalOrdinal,
226  typename Node>
227 struct InputTraits<Xpetra::CrsMatrix<Scalar,LocalOrdinal,GlobalOrdinal,Node> >
228 {
229  typedef Scalar scalar_t;
230  typedef LocalOrdinal lno_t;
231  typedef GlobalOrdinal gno_t;
232  typedef GlobalOrdinal gid_t;
233  typedef Node node_t;
234  static inline string name() {return "Xpetra::CrsMatrix";}
235 };
236 
237 template <typename Scalar,
238  typename LocalOrdinal,
239  typename GlobalOrdinal,
240  typename Node>
241 struct InputTraits<Tpetra::CrsMatrix<Scalar,LocalOrdinal,GlobalOrdinal,Node> >
242 {
243  typedef Scalar scalar_t;
244  typedef LocalOrdinal lno_t;
245  typedef GlobalOrdinal gno_t;
246  typedef GlobalOrdinal gid_t;
247  typedef Node node_t;
248  static inline string name() {return "Tpetra::CrsMatrix";}
249 };
250 
251 template < >
252 struct InputTraits<Epetra_CrsMatrix>
253 {
254  typedef double scalar_t;
255  typedef int lno_t;
256  typedef int gno_t;
257  typedef int gid_t;
258  typedef Kokkos::DefaultNode::DefaultNodeType node_t;
259  static inline string name() {return "Epetra_CrsMatrix";}
260 };
261 
262 template <typename Scalar,
263  typename LocalOrdinal,
264  typename GlobalOrdinal,
265  typename Node>
266 struct InputTraits<Xpetra::RowMatrix<Scalar,LocalOrdinal,GlobalOrdinal,Node> >
267 {
268  typedef Scalar scalar_t;
269  typedef LocalOrdinal lno_t;
270  typedef GlobalOrdinal gno_t;
271  typedef GlobalOrdinal gid_t;
272  typedef Node node_t;
273  static inline string name() {return "Xpetra::RowMatrix";}
274 };
275 
276 template <typename Scalar,
277  typename LocalOrdinal,
278  typename GlobalOrdinal,
279  typename Node>
280 struct InputTraits<Tpetra::RowMatrix<Scalar,LocalOrdinal,GlobalOrdinal,Node> >
281 {
282  typedef Scalar scalar_t;
283  typedef LocalOrdinal lno_t;
284  typedef GlobalOrdinal gno_t;
285  typedef GlobalOrdinal gid_t;
286  typedef Node node_t;
287  static inline string name() {return "Tpetra::RowMatrix";}
288 };
289 
290 template <typename LocalOrdinal,
291  typename GlobalOrdinal,
292  typename Node>
293 struct InputTraits<Xpetra::CrsGraph<LocalOrdinal,GlobalOrdinal,Node> >
294 {
295  typedef default_scalar_t scalar_t;
296  typedef LocalOrdinal lno_t;
297  typedef GlobalOrdinal gno_t;
298  typedef GlobalOrdinal gid_t;
299  typedef Node node_t;
300  static inline string name() {return "Xpetra::CrsGraph";}
301 };
302 
303 template <typename LocalOrdinal,
304  typename GlobalOrdinal,
305  typename Node>
306 struct InputTraits<Tpetra::CrsGraph<LocalOrdinal,GlobalOrdinal,Node> >
307 {
308  typedef default_scalar_t scalar_t;
309  typedef LocalOrdinal lno_t;
310  typedef GlobalOrdinal gno_t;
311  typedef GlobalOrdinal gid_t;
312  typedef Node node_t;
313  static inline string name() {return "Tpetra::CrsGraph";}
314 };
315 
316 template < >
317 struct InputTraits<Epetra_CrsGraph>
318 {
319  typedef double scalar_t;
320  typedef int lno_t;
321  typedef int gno_t;
322  typedef int gid_t;
323  typedef Kokkos::DefaultNode::DefaultNodeType node_t;
324  static inline string name() {return "Epetra_CrsGraph";}
325 };
326 
327 template <typename Scalar,
328  typename LocalOrdinal,
329  typename GlobalOrdinal,
330  typename Node>
331 struct InputTraits<Xpetra::Vector<Scalar,LocalOrdinal,GlobalOrdinal,Node> >
332 {
333  typedef Scalar scalar_t;
334  typedef LocalOrdinal lno_t;
335  typedef GlobalOrdinal gno_t;
336  typedef GlobalOrdinal gid_t;
337  typedef Node node_t;
338  static inline string name() {return "Xpetra::Vector";}
339 };
340 
344 template <typename Scalar,
345  typename LocalOrdinal,
346  typename GlobalOrdinal,
347  typename Node>
348 struct InputTraits<Tpetra::Vector<Scalar,LocalOrdinal,GlobalOrdinal,Node> >
349 {
350  typedef Scalar scalar_t;
351  typedef LocalOrdinal lno_t;
352  typedef GlobalOrdinal gno_t;
353  typedef GlobalOrdinal gid_t;
354  typedef Node node_t;
355  static inline string name() {return "Tpetra::Vector";}
356 };
357 
358 template < >
359 struct InputTraits<Epetra_Vector>
360 {
361  typedef double scalar_t;
362  typedef int lno_t;
363  typedef int gno_t;
364  typedef int gid_t;
365  typedef Kokkos::DefaultNode::DefaultNodeType node_t;
366  static inline string name() {return "Epetra_Vector";}
367 };
368 
369 template <typename Scalar,
370  typename LocalOrdinal,
371  typename GlobalOrdinal,
372  typename Node>
373 struct InputTraits<Xpetra::MultiVector<Scalar,LocalOrdinal,GlobalOrdinal,Node> >
374 {
375  typedef Scalar scalar_t;
376  typedef LocalOrdinal lno_t;
377  typedef GlobalOrdinal gno_t;
378  typedef GlobalOrdinal gid_t;
379  typedef Node node_t;
380  static inline string name() {return "Xpetra::MultiVector";}
381 };
382 
383 template <typename Scalar,
384  typename LocalOrdinal,
385  typename GlobalOrdinal,
386  typename Node>
387 struct InputTraits<Tpetra::MultiVector<Scalar,LocalOrdinal,GlobalOrdinal,Node> >
388 {
389  typedef Scalar scalar_t;
390  typedef LocalOrdinal lno_t;
391  typedef GlobalOrdinal gno_t;
392  typedef GlobalOrdinal gid_t;
393  typedef Node node_t;
394  static inline string name() {return "Tpetra::MultiVector";}
395 };
396 
397 template < >
398 struct InputTraits<Epetra_MultiVector>
399 {
400  typedef double scalar_t;
401  typedef int lno_t;
402  typedef int gno_t;
403  typedef int gid_t;
404  typedef Kokkos::DefaultNode::DefaultNodeType node_t;
405  static inline string name() {return "Epetra_MultiVector";}
406 };
407 
408 #endif // DOXYGEN_SHOULD_SKIP_THIS
409 
410 
411 } // namespace Zoltan2
412 #endif // ZOLTAN2_INPUTTRAITS_HPP
A simple class that can be the User template argument for an InputAdapter.
static string name()
The name of the user's input object.
The traits required of User input classes or structures.
default_lno_t lno_t
The ordinal type (e.g., int, long, int64_t) that represents local counts and local indices...
default_gno_t gid_t
The data type that the user uses for global Identifiers.
default_gno_t gno_t
The ordinal type (e.g., int, long, int64_t) that can represent global counts and identifiers.
double default_scalar_t
Gathering definitions used in software development.
Kokkos::DefaultNode::DefaultNodeType node_t
The Kokkos node type. This is only meaningful for users of Tpetra objects.
default_scalar_t scalar_t
The data type for weights and coordinates.
Kokkos::DefaultNode::DefaultNodeType default_node_t