TEUCHOS_UNIT_TEST_TEMPLATE_4_DECL(CoalesceDropFactory_kokkos, ClassicBlockWithFiltering, Scalar, LocalOrdinal, GlobalOrdinal, Node) { # include "MueLu_UseShortNames.hpp" MUELU_TESTING_SET_OSTREAM; MUELU_TESTING_LIMIT_SCOPE(Scalar,GlobalOrdinal,NO); out << "version: " << MueLu::Version() << std::endl; RCP<const Teuchos::Comm<int> > comm = Parameters::getDefaultComm(); Xpetra::UnderlyingLib lib = TestHelpers_kokkos::Parameters::getLib(); Level fineLevel; TestHelpers_kokkos::TestFactory<SC,LO,GO,NO>::createSingleLevelHierarchy(fineLevel); auto dofMap = MapFactory::Build(lib, 3*comm->getSize(), 0, comm); auto mtx = TestHelpers_kokkos::TestFactory<SC,LO,GO,NO>::BuildTridiag(dofMap, 2.0, -1.0, 0.00001); mtx->SetFixedBlockSize(3, 0); fineLevel.Set("A", mtx); CoalesceDropFactory_kokkos dropFact = CoalesceDropFactory_kokkos(); dropFact.SetParameter("aggregation: drop tol", Teuchos::ParameterEntry(1.0)); fineLevel.Request("Graph", &dropFact); fineLevel.Request("DofsPerNode", &dropFact); fineLevel.Request("Filtering", &dropFact); dropFact.Build(fineLevel); auto graph = fineLevel.Get<RCP<LWGraph_kokkos> >("Graph", &dropFact); auto myDofsPerNode = fineLevel.Get<LO> ("DofsPerNode", &dropFact); auto filtering = fineLevel.Get<bool> ("Filtering", &dropFact); TEST_EQUALITY(as<int>(myDofsPerNode) == 3, true); TEST_EQUALITY(filtering, true); TEST_EQUALITY(as<int>(graph->GetDomainMap()->getGlobalNumElements()) == comm->getSize(), true); TEST_EQUALITY(graph->getNeighborVertices(0).size(), 1); auto myImportMap = graph->GetImportMap(); // < note that the ImportMap is built from the column map of the matrix A WITHOUT dropping! auto myDomainMap = graph->GetDomainMap(); TEST_EQUALITY(myImportMap->getMaxAllGlobalIndex(), comm->getSize()-1); TEST_EQUALITY(myImportMap->getMinAllGlobalIndex(), 0); TEST_EQUALITY(myImportMap->getMinLocalIndex(), 0); TEST_EQUALITY(myImportMap->getGlobalNumElements(), as<size_t>(comm->getSize()+2*(comm->getSize()-1))); if (comm->getSize() > 1) { size_t numLocalRowMapElts = graph->GetNodeNumVertices(); size_t numLocalImportElts = myImportMap->getNodeNumElements(); if (comm->getRank() == 0 || comm->getRank() == comm->getSize()-1) { TEST_EQUALITY(numLocalImportElts, numLocalRowMapElts+1); } else { TEST_EQUALITY(numLocalImportElts, numLocalRowMapElts+2); } } TEST_EQUALITY(myDomainMap->getMaxAllGlobalIndex(), comm->getSize()-1); TEST_EQUALITY(myDomainMap->getMinAllGlobalIndex(), 0); TEST_EQUALITY(myDomainMap->getMaxLocalIndex(), 0); TEST_EQUALITY(myDomainMap->getMinLocalIndex(), 0); TEST_EQUALITY(myDomainMap->getGlobalNumElements(), as<size_t>(comm->getSize())); TEST_EQUALITY(myDomainMap->getNodeNumElements(), 1); }
//! Return number of graph edges KOKKOS_INLINE_FUNCTION size_type GetNodeNumEdges() const { return graph_.row_map(GetNodeNumVertices()); }