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 #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 #include <Kokkos_DefaultNode.hpp>
65 
66 namespace Zoltan2{
67 
68 // Default local ordinal
69 typedef int default_lno_t;
70 
71 // Default global ordinal
72 typedef int default_gno_t;
73 
74 // Default scalar type (for weights, coordinates)
75 typedef double default_scalar_t;
76 
77 // Default part number type.
78 typedef int default_part_t; // Restrictions in MPI interface will make it
79  // somewhat difficult to change default_part_t to
80  // long long, since we use part_t for ranks
81  // and we sometimes broadcast arrays whose
82  // size has type part_t.
83 
84 // Until Kokkos node types are supported, use default
85 typedef Tpetra::Map<>::node_type default_node_t;
86 
128 template <typename scalar=double, typename lno=int, typename gno=int>
130 };
131 
166 template <typename User>
167 struct InputTraits {
168 
171  typedef default_scalar_t scalar_t;
172 
176  typedef default_lno_t lno_t;
177 
181  typedef default_gno_t gno_t;
182 
185  typedef default_part_t part_t;
186 
190  typedef default_node_t node_t;
191 
194  static inline std::string name() {return "InputAdapter";}
195 };
196 
197 #ifndef DOXYGEN_SHOULD_SKIP_THIS
198 
199 template <typename Scalar,
200  typename LNO,
201  typename GNO>
202 struct InputTraits<BasicUserTypes<Scalar, LNO, GNO> >
203 {
204  typedef Scalar scalar_t;
205  typedef LNO lno_t;
206  typedef GNO gno_t;
209  static inline std::string name() {return "BasicUserTypes";}
210 };
211 
212 template <typename Scalar,
213  typename LocalOrdinal,
214  typename GlobalOrdinal,
215  typename Node>
216 struct InputTraits<Xpetra::CrsMatrix<Scalar,LocalOrdinal,GlobalOrdinal,Node> >
217 {
218  typedef Scalar scalar_t;
219  typedef LocalOrdinal lno_t;
220  typedef GlobalOrdinal gno_t;
222  typedef Node node_t;
223  static inline std::string name() {return "Xpetra::CrsMatrix";}
224 };
225 
226 template <typename Scalar,
227  typename LocalOrdinal,
228  typename GlobalOrdinal,
229  typename Node>
230 struct InputTraits<Tpetra::CrsMatrix<Scalar,LocalOrdinal,GlobalOrdinal,Node> >
231 {
232  typedef Scalar scalar_t;
233  typedef LocalOrdinal lno_t;
234  typedef GlobalOrdinal gno_t;
236  typedef Node node_t;
237  static inline std::string name() {return "Tpetra::CrsMatrix";}
238 };
239 
240 template < >
241 struct InputTraits<Epetra_CrsMatrix>
242 {
243  typedef double scalar_t;
244  typedef int lno_t;
245  typedef int gno_t;
248  static inline std::string name() {return "Epetra_CrsMatrix";}
249 };
250 
251 template <typename Scalar,
252  typename LocalOrdinal,
253  typename GlobalOrdinal,
254  typename Node>
255 struct InputTraits<Xpetra::RowMatrix<Scalar,LocalOrdinal,GlobalOrdinal,Node> >
256 {
257  typedef Scalar scalar_t;
258  typedef LocalOrdinal lno_t;
259  typedef GlobalOrdinal gno_t;
261  typedef Node node_t;
262  static inline std::string name() {return "Xpetra::RowMatrix";}
263 };
264 
265 template <typename Scalar,
266  typename LocalOrdinal,
267  typename GlobalOrdinal,
268  typename Node>
269 struct InputTraits<Tpetra::RowMatrix<Scalar,LocalOrdinal,GlobalOrdinal,Node> >
270 {
271  typedef Scalar scalar_t;
272  typedef LocalOrdinal lno_t;
273  typedef GlobalOrdinal gno_t;
275  typedef Node node_t;
276  static inline std::string name() {return "Tpetra::RowMatrix";}
277 };
278 
279 template <typename LocalOrdinal,
280  typename GlobalOrdinal,
281  typename Node>
282 struct InputTraits<Xpetra::CrsGraph<LocalOrdinal,GlobalOrdinal,Node> >
283 {
284  typedef default_scalar_t scalar_t;
285  typedef LocalOrdinal lno_t;
286  typedef GlobalOrdinal gno_t;
288  typedef Node node_t;
289  static inline std::string name() {return "Xpetra::CrsGraph";}
290 };
291 
292 template <typename LocalOrdinal,
293  typename GlobalOrdinal,
294  typename Node>
295 struct InputTraits<Tpetra::CrsGraph<LocalOrdinal,GlobalOrdinal,Node> >
296 {
297  typedef default_scalar_t scalar_t;
298  typedef LocalOrdinal lno_t;
299  typedef GlobalOrdinal gno_t;
301  typedef Node node_t;
302  static inline std::string name() {return "Tpetra::CrsGraph";}
303 };
304 
305 template < >
306 struct InputTraits<Epetra_CrsGraph>
307 {
308  typedef double scalar_t;
309  typedef int lno_t;
310  typedef int gno_t;
313  static inline std::string name() {return "Epetra_CrsGraph";}
314 };
315 
316 template <typename Scalar,
317  typename LocalOrdinal,
318  typename GlobalOrdinal,
319  typename Node>
320 struct InputTraits<Xpetra::Vector<Scalar,LocalOrdinal,GlobalOrdinal,Node> >
321 {
322  typedef Scalar scalar_t;
323  typedef LocalOrdinal lno_t;
324  typedef GlobalOrdinal gno_t;
326  typedef Node node_t;
327  static inline std::string name() {return "Xpetra::Vector";}
328 };
329 
333 template <typename Scalar,
334  typename LocalOrdinal,
335  typename GlobalOrdinal,
336  typename Node>
337 struct InputTraits<Tpetra::Vector<Scalar,LocalOrdinal,GlobalOrdinal,Node> >
338 {
339  typedef Scalar scalar_t;
340  typedef LocalOrdinal lno_t;
341  typedef GlobalOrdinal gno_t;
343  typedef Node node_t;
344  static inline std::string name() {return "Tpetra::Vector";}
345 };
346 
347 template < >
348 struct InputTraits<Epetra_Vector>
349 {
350  typedef double scalar_t;
351  typedef int lno_t;
352  typedef int gno_t;
355  static inline std::string name() {return "Epetra_Vector";}
356 };
357 
358 template <typename Scalar,
359  typename LocalOrdinal,
360  typename GlobalOrdinal,
361  typename Node>
362 struct InputTraits<Xpetra::MultiVector<Scalar,LocalOrdinal,GlobalOrdinal,Node> >
363 {
364  typedef Scalar scalar_t;
365  typedef LocalOrdinal lno_t;
366  typedef GlobalOrdinal gno_t;
368  typedef Node node_t;
369  static inline std::string name() {return "Xpetra::MultiVector";}
370 };
371 
372 template <typename Scalar,
373  typename LocalOrdinal,
374  typename GlobalOrdinal,
375  typename Node>
376 struct InputTraits<Tpetra::MultiVector<Scalar,LocalOrdinal,GlobalOrdinal,Node> >
377 {
378  typedef Scalar scalar_t;
379  typedef LocalOrdinal lno_t;
380  typedef GlobalOrdinal gno_t;
382  typedef Node node_t;
383  static inline std::string name() {return "Tpetra::MultiVector";}
384 };
385 
386 template < >
387 struct InputTraits<Epetra_MultiVector>
388 {
389  typedef double scalar_t;
390  typedef int lno_t;
391  typedef int gno_t;
394  static inline std::string name() {return "Epetra_MultiVector";}
395 };
396 
397 #endif // DOXYGEN_SHOULD_SKIP_THIS
398 
399 
400 } // namespace Zoltan2
401 #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.