Zoltan2
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 
59 #ifdef HAVE_ZOLTAN2_EPETRA
60 #include <Epetra_CrsMatrix.h>
61 #include <Epetra_CrsGraph.h>
62 #endif
63 
64 #include <Xpetra_CrsMatrix.hpp>
65 #include <Xpetra_RowMatrix.hpp>
66 #include <Xpetra_TpetraRowMatrix.hpp>
67 #include <Xpetra_CrsGraph.hpp>
68 #include <Kokkos_DefaultNode.hpp>
69 
70 namespace Zoltan2{
71 
72 // Default local ordinal
73 typedef int default_lno_t;
74 
75 // Default global ordinal
76 typedef int default_gno_t;
77 
78 // Default scalar type (for weights, coordinates)
79 typedef double default_scalar_t;
80 
81 // Default part number type.
82 typedef int default_part_t; // Restrictions in MPI interface will make it
83  // somewhat difficult to change default_part_t to
84  // long long, since we use part_t for ranks
85  // and we sometimes broadcast arrays whose
86  // size has type part_t.
87  // part_t must be a signed data type.
88 
89 // Until Kokkos node types are supported, use default
90 typedef Tpetra::Map<>::node_type default_node_t;
91 
133 template <typename scalar=double, typename lno=int, typename gno=int>
135 };
136 
171 template <typename User>
172 struct InputTraits {
173 
176  typedef default_scalar_t scalar_t;
177 
181  typedef default_lno_t lno_t;
182 
186  typedef default_gno_t gno_t;
187 
190  typedef default_part_t part_t;
191 
195  typedef default_node_t node_t;
196 
199  static inline std::string name() {return "InputAdapter";}
200 };
201 
202 #ifndef DOXYGEN_SHOULD_SKIP_THIS
203 
204 template <typename Scalar,
205  typename LNO,
206  typename GNO>
207 struct InputTraits<BasicUserTypes<Scalar, LNO, GNO> >
208 {
209  typedef Scalar scalar_t;
210  typedef LNO lno_t;
211  typedef GNO gno_t;
214  static inline std::string name() {return "BasicUserTypes";}
215 };
216 
217 template <typename Scalar,
218  typename LocalOrdinal,
219  typename GlobalOrdinal,
220  typename Node>
221 struct InputTraits<Xpetra::CrsMatrix<Scalar,LocalOrdinal,GlobalOrdinal,Node> >
222 {
223  typedef Scalar scalar_t;
224  typedef LocalOrdinal lno_t;
225  typedef GlobalOrdinal gno_t;
227  typedef Node node_t;
228  static inline std::string name() {return "Xpetra::CrsMatrix";}
229 };
230 
231 template <typename Scalar,
232  typename LocalOrdinal,
233  typename GlobalOrdinal,
234  typename Node>
235 struct InputTraits<Tpetra::CrsMatrix<Scalar,LocalOrdinal,GlobalOrdinal,Node> >
236 {
237  typedef Scalar scalar_t;
238  typedef LocalOrdinal lno_t;
239  typedef GlobalOrdinal gno_t;
241  typedef Node node_t;
242  static inline std::string name() {return "Tpetra::CrsMatrix";}
243 };
244 
245 #ifdef HAVE_ZOLTAN2_EPETRA
246 template < >
247 struct InputTraits<Epetra_CrsMatrix>
248 {
249  typedef double scalar_t;
250  typedef int lno_t;
251  typedef int gno_t;
254  static inline std::string name() {return "Epetra_CrsMatrix";}
255 };
256 #endif
257 
258 template <typename Scalar,
259  typename LocalOrdinal,
260  typename GlobalOrdinal,
261  typename Node>
262 struct InputTraits<Xpetra::RowMatrix<Scalar,LocalOrdinal,GlobalOrdinal,Node> >
263 {
264  typedef Scalar scalar_t;
265  typedef LocalOrdinal lno_t;
266  typedef GlobalOrdinal gno_t;
268  typedef Node node_t;
269  static inline std::string name() {return "Xpetra::RowMatrix";}
270 };
271 
272 template <typename Scalar,
273  typename LocalOrdinal,
274  typename GlobalOrdinal,
275  typename Node>
276 struct InputTraits<Tpetra::RowMatrix<Scalar,LocalOrdinal,GlobalOrdinal,Node> >
277 {
278  typedef Scalar scalar_t;
279  typedef LocalOrdinal lno_t;
280  typedef GlobalOrdinal gno_t;
282  typedef Node node_t;
283  static inline std::string name() {return "Tpetra::RowMatrix";}
284 };
285 
286 template <typename LocalOrdinal,
287  typename GlobalOrdinal,
288  typename Node>
289 struct InputTraits<Xpetra::CrsGraph<LocalOrdinal,GlobalOrdinal,Node> >
290 {
291  typedef default_scalar_t scalar_t;
292  typedef LocalOrdinal lno_t;
293  typedef GlobalOrdinal gno_t;
295  typedef Node node_t;
296  static inline std::string name() {return "Xpetra::CrsGraph";}
297 };
298 
299 template <typename LocalOrdinal,
300  typename GlobalOrdinal,
301  typename Node>
302 struct InputTraits<Tpetra::CrsGraph<LocalOrdinal,GlobalOrdinal,Node> >
303 {
304  typedef default_scalar_t scalar_t;
305  typedef LocalOrdinal lno_t;
306  typedef GlobalOrdinal gno_t;
308  typedef Node node_t;
309  static inline std::string name() {return "Tpetra::CrsGraph";}
310 };
311 
312 #ifdef HAVE_ZOLTAN2_EPETRA
313 template < >
314 struct InputTraits<Epetra_CrsGraph>
315 {
316  typedef double scalar_t;
317  typedef int lno_t;
318  typedef int gno_t;
321  static inline std::string name() {return "Epetra_CrsGraph";}
322 };
323 #endif
324 
325 template <typename Scalar,
326  typename LocalOrdinal,
327  typename GlobalOrdinal,
328  typename Node>
329 struct InputTraits<Xpetra::Vector<Scalar,LocalOrdinal,GlobalOrdinal,Node> >
330 {
331  typedef Scalar scalar_t;
332  typedef LocalOrdinal lno_t;
333  typedef GlobalOrdinal gno_t;
335  typedef Node node_t;
336  static inline std::string name() {return "Xpetra::Vector";}
337 };
338 
342 template <typename Scalar,
343  typename LocalOrdinal,
344  typename GlobalOrdinal,
345  typename Node>
346 struct InputTraits<Tpetra::Vector<Scalar,LocalOrdinal,GlobalOrdinal,Node> >
347 {
348  typedef Scalar scalar_t;
349  typedef LocalOrdinal lno_t;
350  typedef GlobalOrdinal gno_t;
352  typedef Node node_t;
353  static inline std::string name() {return "Tpetra::Vector";}
354 };
355 
356 #ifdef HAVE_ZOLTAN2_EPETRA
357 template < >
358 struct InputTraits<Epetra_Vector>
359 {
360  typedef double scalar_t;
361  typedef int lno_t;
362  typedef int gno_t;
365  static inline std::string name() {return "Epetra_Vector";}
366 };
367 #endif
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;
379  typedef Node node_t;
380  static inline std::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;
393  typedef Node node_t;
394  static inline std::string name() {return "Tpetra::MultiVector";}
395 };
396 
397 #ifdef HAVE_ZOLTAN2_EPETRA
398 template < >
399 struct InputTraits<Epetra_MultiVector>
400 {
401  typedef double scalar_t;
402  typedef int lno_t;
403  typedef int gno_t;
406  static inline std::string name() {return "Epetra_MultiVector";}
407 };
408 #endif
409 
410 #endif // DOXYGEN_SHOULD_SKIP_THIS
411 
412 
413 } // namespace Zoltan2
414 #endif // ZOLTAN2_INPUTTRAITS_HPP
Tpetra::Map::node_type default_node_t
default_part_t part_t
The data type to represent part numbers.
A simple class that can be the User template argument for an InputAdapter.
The traits required of User input classes or structures.
static std::string name()
The name of the user&#39;s input object.
default_lno_t lno_t
The ordinal type (e.g., int, long, int64_t) that represents local counts and local indices...
default_gno_t gno_t
The ordinal type (e.g., int, long, int64_t) that can represent global counts and identifiers.
default_node_t node_t
The Kokkos node type. This is only meaningful for users of Tpetra objects.
double default_scalar_t
Tpetra::Vector< z2TestScalar, z2TestLO, z2TestGO > Vector
Gathering definitions used in software development.
Vector::node_type Node
default_scalar_t scalar_t
The data type for weights and coordinates.