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> 69 using Teuchos::DefaultComm;
72 const RCP<
const Comm<int> > &comm)
74 int rank = comm->getRank();
75 int fail = 0, gfail = 0;
77 std::bitset<Zoltan2::NUM_MODEL_FLAGS> modelFlags = 0;
84 typedef Tpetra::CrsMatrix<zscalar_t, zlno_t, zgno_t>
tcrsMatrix_t;
93 zlno_t nLocalIds = M->getNodeNumRows();
94 zgno_t nGlobalIds = M->getGlobalNumRows();
96 ArrayView<const zgno_t>
idList = M->getRowMap()->getNodeElementList();
107 RCP<const adapter_t> ia = Teuchos::rcp(
new adapter_t(M));
110 RCP<const base_adapter_t> base_ia =
115 base_ia, env, comm, modelFlags);
117 catch (std::exception &e){
118 std::cerr << rank <<
") " << e.what() << std::endl;
130 std::cerr << rank <<
") getLocalNumIdentifiers " 132 << nLocalIds << std::endl;
137 std::cerr << rank <<
") getGlobalNumIdentifiers " 139 << nGlobalIds << std::endl;
148 ArrayView<const zgno_t> gids;
149 ArrayView<input_t> wgts;
153 if (!
fail && gids.size() != nLocalIds) {
154 std::cerr << rank <<
") getIdentifierList IDs " 155 << gids.size() <<
" " 156 << nLocalIds << std::endl;
160 if (!
fail && wgts.size() != 0) {
161 std::cerr << rank <<
") getIdentifierList Weights " 162 << wgts.size() <<
" " 167 for (
zlno_t i=0; !
fail && i < nLocalIds; i++){
168 std::set<zgno_t>::iterator next = idSet.find(gids[i]);
169 if (next == idSet.end()) {
170 std::cerr << rank <<
") getIdentifierList gid not found " 171 << gids[i] << std::endl;
185 int main(
int argc,
char *argv[])
187 Teuchos::GlobalMPISession session(&argc, &argv);
188 Teuchos::RCP<const Teuchos::Comm<int> > comm =
189 Teuchos::DefaultComm<int>::getComm();
191 int rank = comm->getRank();
193 string fname(
"simple");
201 if (rank==0) std::cout <<
"PASS" << std::endl;
Zoltan2::BaseAdapter< userTypes_t > base_adapter_t
Tpetra::CrsMatrix< zscalar_t, zlno_t, zgno_t, znode_t > tcrsMatrix_t
int main(int argc, char *argv[])
int globalFail(const RCP< const Comm< int > > &comm, int fail)
MatrixAdapter defines the adapter interface for matrices.
size_t getLocalNumIdentifiers() const
Provides access for Zoltan2 to Xpetra::CrsMatrix data.
global_size_t getGlobalNumIdentifiers() const
common code used by tests
size_t getIdentifierList(ArrayView< const gno_t > &Ids, ArrayView< input_t > &wgts) const
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.
void printFailureCode(const RCP< const Comm< int > > &comm, int fail)
BaseAdapter defines methods required by all Adapters.
IdentifierModel defines the interface for all identifier models.
std::string testDataFilePath(".")