10 #ifndef MUELU_VECTORDROPPINGDISTANCELAPLACIAN_DEF_HPP
11 #define MUELU_VECTORDROPPINGDISTANCELAPLACIAN_DEF_HPP
17 template <
class Scalar,
class LocalOrdinal,
class GlobalOrdinal,
class Node, Misc::StrengthMeasure SoC>
28 const std::string& droppingMethod,
30 const bool aggregationMayCreateDirichlet,
31 const bool symmetrizeDroppedGraph,
32 const bool useBlocking,
33 const std::string& distanceLaplacianMetric,
39 auto coords = level.template Get<Teuchos::RCP<doubleMultiVector>>(
"Coordinates", factory.
GetFactory(
"Coordinates").get());
40 if (distanceLaplacianMetric ==
"unweighted") {
42 runDroppingFunctors_on_dlap_inner(A, mergedA, blkPartSize, rowTranslation, colTranslation, results, filtered_rowptr, graph_rowptr, nnz, boundaryNodes, droppingMethod, threshold, aggregationMayCreateDirichlet, symmetrizeDroppedGraph, useBlocking, dist2, level, factory);
43 }
else if (distanceLaplacianMetric ==
"weighted") {
44 auto k_dlap_weights_host = Kokkos::View<double*, Kokkos::HostSpace, Kokkos::MemoryTraits<Kokkos::Unmanaged>>(&dlap_weights[0], dlap_weights.
size());
45 auto k_dlap_weights = Kokkos::View<double*>(
"dlap_weights", k_dlap_weights_host.extent(0));
46 Kokkos::deep_copy(k_dlap_weights, k_dlap_weights_host);
48 runDroppingFunctors_on_dlap_inner(A, mergedA, blkPartSize, rowTranslation, colTranslation, results, filtered_rowptr, graph_rowptr, nnz, boundaryNodes, droppingMethod, threshold, aggregationMayCreateDirichlet, symmetrizeDroppedGraph, useBlocking, dist2, level, factory);
49 }
else if (distanceLaplacianMetric ==
"block weighted") {
50 auto k_dlap_weights_host = Kokkos::View<double*, Kokkos::HostSpace, Kokkos::MemoryTraits<Kokkos::Unmanaged>>(&dlap_weights[0], dlap_weights.
size());
51 auto k_dlap_weights = Kokkos::View<double*>(
"dlap_weights", k_dlap_weights_host.extent(0));
52 Kokkos::deep_copy(k_dlap_weights, k_dlap_weights_host);
54 runDroppingFunctors_on_dlap_inner(A, mergedA, blkPartSize, rowTranslation, colTranslation, results, filtered_rowptr, graph_rowptr, nnz, boundaryNodes, droppingMethod, threshold, aggregationMayCreateDirichlet, symmetrizeDroppedGraph, useBlocking, dist2, level, factory);
55 }
else if (distanceLaplacianMetric ==
"material") {
56 auto material = level.template Get<Teuchos::RCP<Xpetra::MultiVector<Scalar, LocalOrdinal, GlobalOrdinal, Node>>>(
"Material", factory.
GetFactory(
"Material").get());
59 auto spatialDim = coords->getNumVectors();
60 if (material->getNumVectors() == 1) {
61 factory.
GetOStream(
Runtime0) <<
"material scalar mean = " << material->getVector(0)->meanValue() << std::endl;
66 material->meanValue(means());
68 ss <<
"material tensor mean =" << std::endl;
70 for (
size_t i = 0; i < spatialDim; ++i) {
72 for (
size_t j = 0; j < spatialDim; ++j) {
73 ss << means[k] <<
" ";
83 if (material->getNumVectors() == 1) {
85 runDroppingFunctors_on_dlap_inner(A, mergedA, blkPartSize, rowTranslation, colTranslation, results, filtered_rowptr, graph_rowptr, nnz, boundaryNodes, droppingMethod, threshold, aggregationMayCreateDirichlet, symmetrizeDroppedGraph, useBlocking, dist2, level, factory);
88 runDroppingFunctors_on_dlap_inner(A, mergedA, blkPartSize, rowTranslation, colTranslation, results, filtered_rowptr, graph_rowptr, nnz, boundaryNodes, droppingMethod, threshold, aggregationMayCreateDirichlet, symmetrizeDroppedGraph, useBlocking, dist2, level, factory);
94 #define MUELU_ETI_GROUP(SC, LO, GO, NO) \
95 MUELU_ETI_SLGN_SoC(MueLu::VectorDroppingDistanceLaplacian, SC, LO, GO, NO)
MueLu::DefaultLocalOrdinal LocalOrdinal
Teuchos::FancyOStream & GetOStream(MsgType type, int thisProcRankOnly=0) const
Get an output stream for outputting the input message type.
typename Teuchos::ScalarTraits< Scalar >::magnitudeType magnitudeType
#define TEUCHOS_TEST_FOR_EXCEPTION(throw_exception_test, Exception, msg)
One-liner description of what is happening.
Kokkos::View< DecisionType *, memory_space > results_view
Class that holds all level-specific information.
bool IsPrint(MsgType type, int thisProcRankOnly=-1) const
Find out whether we need to print out information for a specific message type.
typename local_graph_type::row_map_type::non_const_type rowptr_type
Kokkos::pair< LocalOrdinal, LocalOrdinal > nnz_count_type
static void runDroppingFunctors_on_dlap(matrix_type &A, matrix_type &mergedA, LocalOrdinal blkPartSize, block_indices_view_type &rowTranslation, block_indices_view_type &colTranslation, results_view &results, rowptr_type &filtered_rowptr, rowptr_type &graph_rowptr, nnz_count_type &nnz, boundary_nodes_type &boundaryNodes, const std::string &droppingMethod, const magnitudeType threshold, const bool aggregationMayCreateDirichlet, const bool symmetrizeDroppedGraph, const bool useBlocking, const std::string &distanceLaplacianMetric, Teuchos::Array< double > &dlap_weights, LocalOrdinal interleaved_blocksize, Level &level, const Factory &factory)
Computes the weighted distance Laplacian.
Computes the weighted distance Laplacian.
Computes the unscaled distance Laplacian.
Exception throws to report errors in the internal logical of the program.
typename Kokkos::View< LocalOrdinal *, typename Node::device_type > block_indices_view_type
const RCP< const FactoryBase > GetFactory(const std::string &varName) const
Default implementation of FactoryAcceptor::GetFactory()
typename MueLu::LWGraph_kokkos< LocalOrdinal, GlobalOrdinal, Node >::boundary_nodes_type boundary_nodes_type