58 #include <Teuchos_Comm.hpp>
59 #include <Teuchos_DefaultComm.hpp>
60 #include <Teuchos_ArrayView.hpp>
61 #include <Teuchos_OrdinalTraits.hpp>
63 #include <Tpetra_CrsMatrix.hpp>
70 const RCP<
const Comm<int> > &comm)
72 int rank = comm->getRank();
73 int fail = 0, gfail = 0;
75 std::bitset<Zoltan2::NUM_MODEL_FLAGS> modelFlags = 0;
82 typedef Tpetra::CrsMatrix<zscalar_t, zlno_t, zgno_t>
tcrsMatrix_t;
91 zlno_t nLocalIds = M->getNodeNumRows();
92 zgno_t nGlobalIds = M->getGlobalNumRows();
94 ArrayView<const zgno_t>
idList = M->getRowMap()->getNodeElementList();
95 std::set<zgno_t> idSet(idList.begin(), idList.end());
105 RCP<const adapter_t> ia = Teuchos::rcp(
new adapter_t(M));
108 RCP<const base_adapter_t> base_ia =
109 Teuchos::rcp_dynamic_cast<
const base_adapter_t>(ia);
113 base_ia, env, comm, modelFlags);
115 catch (std::exception &e){
116 std::cerr << rank <<
") " << e.what() << std::endl;
128 std::cerr << rank <<
") getLocalNumIdentifiers "
130 << nLocalIds << std::endl;
135 std::cerr << rank <<
") getGlobalNumIdentifiers "
137 << nGlobalIds << std::endl;
146 ArrayView<const zgno_t> gids;
147 ArrayView<input_t> wgts;
151 if (!fail && gids.size() != nLocalIds) {
152 std::cerr << rank <<
") getIdentifierList IDs "
153 << gids.size() <<
" "
154 << nLocalIds << std::endl;
158 if (!fail && wgts.size() != 0) {
159 std::cerr << rank <<
") getIdentifierList Weights "
160 << wgts.size() <<
" "
165 for (
zlno_t i=0; !fail && i < nLocalIds; i++){
166 std::set<zgno_t>::iterator next = idSet.find(gids[i]);
167 if (next == idSet.end()) {
168 std::cerr << rank <<
") getIdentifierList gid not found "
169 << gids[i] << std::endl;
183 int main(
int narg,
char *arg[])
185 Tpetra::ScopeGuard tscope(&narg, &arg);
186 Teuchos::RCP<const Teuchos::Comm<int> > comm = Tpetra::getDefaultComm();
188 int rank = comm->getRank();
190 string fname(
"simple");
198 if (rank==0) std::cout <<
"PASS" << std::endl;
void printFailureCode(const Comm< int > &comm, int fail)
Zoltan2::BaseAdapter< userTypes_t > base_adapter_t
Tpetra::CrsMatrix< zscalar_t, zlno_t, zgno_t, znode_t > tcrsMatrix_t
MatrixAdapter defines the adapter interface for matrices.
Provides access for Zoltan2 to Xpetra::CrsMatrix data.
int main(int narg, char *arg[])
common code used by tests
list idList
Match up parameters to validators.
Defines the XpetraCrsMatrixAdapter class.
Defines the IdentifierModel interface.
void testIdentifierModel(std::string fname, zgno_t xdim, zgno_t ydim, zgno_t zdim, const RCP< const Comm< int > > &comm)
The StridedData class manages lists of weights or coordinates.
The user parameters, debug, timing and memory profiling output objects, and error checking methods...
static const std::string fail
Defines the BasicIdentifierAdapter class.
int globalFail(const Comm< int > &comm, int fail)
size_t getLocalNumIdentifiers() const
IdentifierModel defines the interface for all identifier models.
global_size_t getGlobalNumIdentifiers() const
size_t getIdentifierList(ArrayView< const gno_t > &Ids, ArrayView< input_t > &wgts) const
std::string testDataFilePath(".")