Zoltan2
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Pages
fix2010.cpp
Go to the documentation of this file.
1 // @HEADER
2 // *****************************************************************************
3 // Zoltan2: A package of combinatorial algorithms for scientific computing
4 //
5 // Copyright 2012 NTESS and the Zoltan2 contributors.
6 // SPDX-License-Identifier: BSD-3-Clause
7 // *****************************************************************************
8 // @HEADER
9 
13 #include <Zoltan2_TestHelpers.hpp>
14 
15 #include <Teuchos_DefaultComm.hpp>
16 #include <Teuchos_ParameterList.hpp>
17 
18 // Test for issue #2010: no IDs provided to partitioner
19 
20 int main(int narg, char **arg)
21 {
22  Tpetra::ScopeGuard tscope(&narg, &arg);
23  Teuchos::RCP<const Teuchos::Comm<int> > comm = Tpetra::getDefaultComm();
24 
25  int fail=0, gfail=0;
26 
27  int rank = comm->getRank();
28 
29  zlno_t numMyIdentifiers = 0; // no IDs provided
30 
33 
34  adapter_t *adapter = new adapter_t(numMyIdentifiers, NULL);
35 
36  Teuchos::ParameterList params("test parameters");
37  params.set("num_global_parts", 4);
38  params.set("algorithm", "block");
39  params.set("partitioning_approach", "partition");
40 
41  Zoltan2::PartitioningProblem<adapter_t> problem(adapter, &params);
42 
43  problem.solve();
44 
46 
47  if (solution.getActualGlobalNumberOfParts() != 0)
48  fail = true;
49 
50  gfail = globalFail(*comm, fail);
51 
52  if (gfail){
53  if (rank==0)
54  std::cout << "FAIL GlobalNumberOfParts = "
55  << solution.getActualGlobalNumberOfParts() << std:: endl;
56  return 1;
57  }
58 
59  if (rank==0)
60  std::cout << "PASS" << std:: endl;
61 
62  return 0;
63 }
int main(int narg, char **arg)
Definition: coloring1.cpp:164
Defines the PartitioningSolution class.
common code used by tests
This class represents a collection of global Identifiers and their associated weights, if any.
A PartitioningSolution is a solution to a partitioning problem.
Tpetra::Map::local_ordinal_type zlno_t
static const std::string fail
Defines the BasicIdentifierAdapter class.
int globalFail(const Comm< int > &comm, int fail)
const PartitioningSolution< Adapter > & getSolution()
Get the solution to the problem.
PartitioningProblem sets up partitioning problems for the user.
Defines the PartitioningProblem class.
size_t getActualGlobalNumberOfParts() const
Returns the actual global number of parts provided in setParts().
void solve(bool updateInputData=true)
Direct the problem to create a solution.