Zoltan2
Toggle main menu visibility
Loading...
Searching...
No Matches
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
#include <Tpetra_Map.hpp>
56
typedef
Tpetra::Map<>::node_type
znode_t
;
57
58
// The path to the directory of test data
59
60
#define STR_VALUE(path) #path
61
#define PATH_NAME(path) STR_VALUE(path)
62
63
#ifdef Z2_DATA_DIR
64
std::string
testDataFilePath
(
PATH_NAME
(Z2_DATA_DIR));
65
#else
66
std::string
testDataFilePath
(
"."
);
67
#endif
68
69
// The path to the Zoltan1 test directory. We use
70
// some of their data for testing.
71
72
#ifdef Z1_TEST_DIR
73
std::string
zoltanTestDirectory
(
PATH_NAME
(Z1_TEST_DIR));
74
#else
75
std::string
zoltanTestDirectory
(
"."
);
76
#endif
77
79
//
80
// If Tpetra is compiled with explicit instantiation,
81
// we have to choose data types that are compiled into Tpetra.
82
//
83
// Epetra uses (scalar/lno/gno) == (double/int/int) data types. If we
84
// are using these data types, we can test Epetra user input.
85
86
// TODO: KDD 8/13/14
87
// Global definitions of types gno_t, lno_t, zgid_t and
88
// scalar_t can cause bugs in the code. If a class fails to define these
89
// types, but this file is included before the class file, the types
90
// from Zoltan2_TestHelpers.hpp will be used in the class. Compilation in
91
// user programs (without Zoltan2_TestHelpers.hpp) would then fail. An
92
// example of this bug was in the GeometricGenerator class, which used
93
// scalar_t without defining it.
94
// In this "fix," I changed gno_t, lno_t, zgid_t, scalar_t, and node_t to
95
// zgno_t, zlno_t, zzgid_t, zscalar_t and znode_t in Zoltan2_TestHelpers.hpp.
96
// This change is not the best fix; a better fix would remove the global
97
// definitions, but that would require more work. (An even better change
98
// would use the Teuchos test framework to cycle through various options,
99
// but that would require even more work and should be delayed until we
100
// revamp the testing.)
101
102
#include <TpetraCore_config.h>
103
104
typedef
int
zpart_t
;
// added this for consistency but needs further discussion
105
106
typedef
Tpetra::Map<>::local_ordinal_type
zlno_t
;
107
typedef
Tpetra::Map<>::global_ordinal_type
zgno_t
;
108
109
#ifdef HAVE_TPETRA_DOUBLE
110
typedef
double
zscalar_t
;
111
# define HAVE_EPETRA_SCALAR_TYPE
112
#else
113
typedef
float
zscalar_t
;
114
#endif
115
116
#if defined HAVE_TPETRA_INT_INT
117
# if defined HAVE_EPETRA_SCALAR_TYPE
118
# define HAVE_EPETRA_DATA_TYPES
119
# endif
120
#endif
121
122
#ifndef HAVE_ZOLTAN2_EPETRA
123
# undef HAVE_EPETRA_SCALAR_TYPE
124
# undef HAVE_EPETRA_DATA_TYPES
125
#endif
126
128
129
#define MEMORY_CHECK(iPrint, msg) \
130
if (iPrint){ \
131
long kb = Zoltan2::getProcessKilobytes(); \
132
std::cout.width(10); \
133
std::cout.fill('*'); \
134
std::cout << kb << " KB, " << msg << std::endl; \
135
std::cout.width(0); \
136
std::cout.fill(' '); \
137
}
138
139
#include <
ErrorHandlingForTests.hpp
>
140
#include <
UserInputForTests.hpp
>
141
#include <
PrintData.hpp
>
142
143
#endif
ErrorHandlingForTests.hpp
PrintData.hpp
UserInputForTests.hpp
Generate input for testing purposes.
zscalar_t
float zscalar_t
Definition
Zoltan2_TestHelpers.hpp:113
zoltanTestDirectory
std::string zoltanTestDirectory(".")
zlno_t
Tpetra::Map ::local_ordinal_type zlno_t
Definition
Zoltan2_TestHelpers.hpp:106
testDataFilePath
std::string testDataFilePath(".")
zpart_t
int zpart_t
Definition
Zoltan2_TestHelpers.hpp:104
zgno_t
Tpetra::Map ::global_ordinal_type zgno_t
Definition
Zoltan2_TestHelpers.hpp:107
znode_t
Tpetra::Map ::node_type znode_t
Definition
Zoltan2_TestHelpers.hpp:56
PATH_NAME
#define PATH_NAME(path)
Definition
Zoltan2_TestHelpers.hpp:61
Zoltan2_Util.hpp
A gathering of useful namespace methods.
test
core
helpers
Zoltan2_TestHelpers.hpp
Generated by
1.17.0