70 const RCP<
const Comm<int> > &comm,
71 bool nodeZeroHasAll,
bool printInfo)
73 int fail = 0, gfail = 0;
76 std::cout <<
"Test: " << fname << std::endl;
77 std::cout <<
"Num Weights: " << nWeights;
78 std::cout <<
" proc 0 has all: " << nodeZeroHasAll;
79 std::cout << std::endl;
86 typedef Tpetra::MultiVector<zscalar_t, zlno_t, zgno_t, znode_t> mv_t;
88 RCP<UserInputForTests> uinput;
93 catch(std::exception &e){
102 coords = uinput->getUICoordinates();
104 catch(std::exception &e){
110 int coordDim = coords->getNumVectors();
114 const zscalar_t *x=NULL, *y=NULL, *z=NULL;
116 x = coords->getData(0).getRawPtr();
118 y = coords->getData(1).getRawPtr();
120 z = coords->getData(2).getRawPtr();
125 int nLocalIds = coords->getLocalLength();
126 ArrayView<const zgno_t> idList = coords->getMap()->getLocalElementList();
130 if (comm->getRank() > 0){
135 nGlobalIds = nLocalIds;
137 Teuchos::broadcast<int, int>(*comm, 0, &nGlobalIds);
140 nGlobalIds = coords->getGlobalLength();
143 Array<ArrayRCP<const zscalar_t> > coordWeights(nWeights);
146 for (
int wdim=0; wdim < nWeights; wdim++){
148 for (
int i=0; i < nLocalIds; i++){
149 w[i] = ((i%2) + 1) + wdim;
151 coordWeights[wdim] = Teuchos::arcp(w, 0, nLocalIds);
167 ia = rcp(
new ia_t(nLocalIds, idList.getRawPtr(), x, y, z));
169 catch(std::exception &e){
174 std::vector<const zscalar_t *> values,
weights;
175 std::vector<int> valueStrides, weightStrides;
182 for (
int wdim=0; wdim < nWeights; wdim++){
183 weights.push_back(coordWeights[wdim].getRawPtr());
187 ia = rcp(
new ia_t(nLocalIds, idList.getRawPtr(),
188 values, valueStrides,
weights, weightStrides));
190 catch(std::exception &e){
195 RCP<const base_ia_t> base_ia = Teuchos::rcp_dynamic_cast<const base_ia_t>(ia);
204 typedef std::bitset<Zoltan2::NUM_MODEL_FLAGS> modelFlags_t;
206 modelFlags_t modelFlags;
213 model = rcp(
new model_t(base_ia, env, comm, modelFlags));
215 catch (std::exception &e){
223 if (model->getCoordinateDim() != coordDim)
226 if (!
fail && model->getLocalNumCoordinates() !=
size_t(nLocalIds))
229 if (!
fail && model->getGlobalNumCoordinates() !=
size_t(nGlobalIds))
232 if (!
fail && model->getNumWeightsPerCoordinate() != nWeights)
240 ArrayView<const zgno_t> gids;
241 ArrayView<input_t> xyz;
242 ArrayView<input_t> wgts;
244 model->getCoordinates(gids, xyz, wgts);
246 if (!
fail && gids.size() != nLocalIds)
249 for (
int i=0; !
fail && i < nLocalIds; i++){
250 if (gids[i] != idList[i])
254 if (!
fail && wgts.size() != nWeights)
259 for (
int dim=0; !
fail && dim < coordDim; dim++){
260 for (
int i=0; !
fail && i < nLocalIds; i++){
261 if (xyz[dim][i] != vals[dim][i])
266 for (
int wdim=0; !
fail && wdim < nWeights; wdim++){
267 for (
int i=0; !
fail && i < nLocalIds; i++){
268 if (wgts[wdim][i] != coordWeights[wdim][i])
282 Kokkos::View<const zgno_t *, typename znode_t::device_type> gidsKokkos;
284 Kokkos::View<zscalar_t **, Kokkos::LayoutLeft, typename znode_t::device_type> xyzKokkos;
285 Kokkos::View<zscalar_t **, typename znode_t::device_type> wgtsKokkos;
287 model->getCoordinatesKokkos(gidsKokkos, xyzKokkos, wgtsKokkos);
289 if (!
fail && gidsKokkos.extent(0) !=
static_cast<size_t>(nLocalIds))
292 auto gidsKokkos_host = Kokkos::create_mirror_view(gidsKokkos);
293 Kokkos::deep_copy(gidsKokkos_host, gidsKokkos);
295 for (
int i=0; !
fail && i < nLocalIds; i++){
296 if (gidsKokkos_host(i) != idList[i])
300 if (!
fail && wgtsKokkos.extent(1) !=
static_cast<size_t>(nWeights))
303 auto xyzKokkos_host = Kokkos::create_mirror_view(xyzKokkos);
304 Kokkos::deep_copy(xyzKokkos_host, xyzKokkos);
306 for (
int dim=0; !
fail && dim < coordDim; dim++){
307 for (
int i=0; !
fail && i < nLocalIds; i++){
308 if (xyzKokkos_host(i, dim) != vals[dim][i])
313 auto wgtsKokkos_host = Kokkos::create_mirror_view(wgtsKokkos);
314 Kokkos::deep_copy(wgtsKokkos_host, wgtsKokkos);
316 for (
int wdim=0; !
fail && wdim < nWeights; wdim++){
317 for (
int i=0; !
fail && i < nLocalIds; i++){
318 if (wgtsKokkos_host(i, wdim) != coordWeights[wdim][i])