Zoltan2  Version of the Day
Zoltan2_TestHelpers.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 
49 #ifndef ZOLTAN2_TESTHELPERS_HPP
50 #define ZOLTAN2_TESTHELPERS_HPP
51 
52 #include <Zoltan2_Util.hpp>
53 #include <iostream>
54 
55 typedef Kokkos::DefaultNode::DefaultNodeType node_t;
56 
57 // The path to the directory of test data
58 
59 #define STR_VALUE(path) #path
60 #define PATH_NAME(path) STR_VALUE(path)
61 
62 #ifdef Z2_DATA_DIR
63  std::string testDataFilePath(PATH_NAME(Z2_DATA_DIR));
64 #else
65  std::string testDataFilePath(".");
66 #endif
67 
68 // The path to the Zoltan1 test directory. We use
69 // some of their data for testing.
70 
71 #ifdef Z1_TEST_DIR
72  std::string zoltanTestDirectory(PATH_NAME(Z1_TEST_DIR));
73 #else
74  std::string zoltanTestDirectory(".");
75 #endif
76 
77 //
78 // If Tpetra is compiled with explicit instantiation,
79 // then we will use these types in our tests.
80 //
81 // Epetra uses int, int, double data types. If we
82 // are using these data types, then we can test
83 // cases of Epetra user input.
84 //
85 
86 
87 #if defined HAVE_ZOLTAN2_INST_FLOAT_INT_LONG
88 
89 typedef int lno_t;
90 typedef long gno_t;
91 typedef float scalar_t;
92 
93 #elif defined HAVE_ZOLTAN2_INST_DOUBLE_INT_LONG
94 
95 typedef int lno_t;
96 typedef long gno_t;
97 typedef double scalar_t;
98 
99 #elif defined HAVE_ZOLTAN2_INST_FLOAT_INT_INT
100 
101 typedef int lno_t;
102 typedef int gno_t;
103 typedef float scalar_t;
104 
105 #elif defined HAVE_ZOLTAN2_INST_DOUBLE_INT_INT
106 
107 typedef int lno_t;
108 typedef int gno_t;
109 typedef double scalar_t;
110 #define HAVE_EPETRA_DATA_TYPES
111 
112 #else
113 
114 typedef int lno_t;
115 typedef int gno_t;
116 typedef double scalar_t;
117 #define HAVE_EPETRA_DATA_TYPES
118 
119 #endif
120 
121 #define MEMORY_CHECK(iPrint, msg) \
122  if (iPrint){ \
123  long kb = Zoltan2::getProcessKilobytes(); \
124  std::cout.width(10); \
125  std::cout.fill('*'); \
126  std::cout << kb << " KB, " << msg << std::endl; \
127  std::cout.width(0); \
128  std::cout.fill(' '); \
129  }
130 
131 #include <ErrorHandlingForTests.hpp>
132 #include <UserInputForTests.hpp>
133 #include <PrintData.hpp>
134 
135 #endif
Generate input for testing purposes.
#define PATH_NAME(path)
double scalar_t
A gathering of useful namespace methods.
std::string zoltanTestDirectory(".")
Kokkos::DefaultNode::DefaultNodeType node_t
std::string testDataFilePath(".")