Zoltan2
Loading...
Searching...
No Matches
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
14
15#include <Teuchos_DefaultComm.hpp>
16#include <Teuchos_ParameterList.hpp>
17
18// Test for issue #2010: no IDs provided to partitioner
19
20int 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 globalFail(const Comm< int > &comm, int fail)
Defines the BasicIdentifierAdapter class.
Defines the PartitioningProblem class.
Defines the PartitioningSolution class.
common code used by tests
Tpetra::Map ::local_ordinal_type zlno_t
int main()
This class represents a collection of global Identifiers and their associated weights,...
A simple class that can be the User template argument for an InputAdapter.
PartitioningProblem sets up partitioning problems for the user.
const PartitioningSolution< Adapter > & getSolution()
Get the solution to the problem.
void solve(bool updateInputData=true)
Direct the problem to create a solution.
A PartitioningSolution is a solution to a partitioning problem.
size_t getActualGlobalNumberOfParts() const
Returns the actual global number of parts provided in setParts().
static const std::string fail