MueLu Version of the Day
Loading...
Searching...
No Matches
MueLu_NotayAggregationFactory_decl.hpp
Go to the documentation of this file.
1// @HEADER
2// *****************************************************************************
3// MueLu: A package for multigrid based preconditioning
4//
5// Copyright 2012 NTESS and the MueLu contributors.
6// SPDX-License-Identifier: BSD-3-Clause
7// *****************************************************************************
8// @HEADER
9
10#ifndef MUELU_NOTAYAGGREGATIONFACTORY_DECL_HPP_
11#define MUELU_NOTAYAGGREGATIONFACTORY_DECL_HPP_
12
13#include "MueLu_ConfigDefs.hpp"
14
15#include <Xpetra_Map_fwd.hpp>
16#include <Xpetra_Vector_fwd.hpp>
17
18#include <Xpetra_Matrix_fwd.hpp>
19
20#include "MueLu_LWGraph_fwd.hpp"
22#include "MueLu_Exceptions.hpp"
24
26
27#include "MueLu_Level_fwd.hpp"
30
31namespace MueLu {
32
33template <class Scalar = DefaultScalar,
36 class Node = DefaultNode>
38#undef MUELU_NOTAYAGGREGATIONFACTORY_SHORT
40
41 public:
43
44 using local_matrix_type = typename Matrix::local_matrix_device_type;
45 using device_type = typename local_matrix_type::device_type;
46 using execution_space = typename device_type::execution_space;
47 using magnitude_type = typename Teuchos::ScalarTraits<Scalar>::magnitudeType;
48#if KOKKOS_VERSION >= 40799
49 using impl_scalar_type = typename KokkosKernels::ArithTraits<Scalar>::val_type;
50#else
51 using impl_scalar_type = typename Kokkos::ArithTraits<Scalar>::val_type;
52#endif
53 using row_sum_type = typename Kokkos::View<impl_scalar_type*, Kokkos::LayoutLeft, device_type>;
55
57
58
61
64
65 RCP<const ParameterList> GetValidParameterList() const;
66
68
70
71
72 // Options shared by all aggregation algorithms
73
75
76
77 void DeclareInput(Level& currentLevel) const;
78
80
82
83
85 void Build(Level& currentLevel) const;
86
88 void BuildInitialAggregates(const Teuchos::ParameterList& params,
89 const RCP<const Matrix>& A,
90 const ArrayView<const LO>& orderingVector,
91 const magnitude_type kappa,
92 Aggregates& aggregates,
93 std::vector<unsigned>& aggStat,
94 LO& numNonAggregatedNodes,
95 LO& numDirichletNodes) const;
96
98 void BuildFurtherAggregates(const Teuchos::ParameterList& params,
99 const RCP<const Matrix>& A,
100 const Teuchos::ArrayView<const LO>& orderingVector,
101 const local_matrix_type& coarseA,
102 const magnitude_type kappa,
103 const row_sum_type& rowSum,
104 std::vector<LO>& localAggStat,
105 Array<LO>& localVertex2AggID,
106 LO& numLocalAggregates,
107 LO& numNonAggregatedNodes) const;
108
109 void BuildOnRankLocalMatrix(const local_matrix_type& localA,
110 local_matrix_type& onRankA) const;
111
113 void BuildIntermediateProlongator(const LO numRows,
114 const LO numDirichletNodes,
115 const LO numLocalAggregates,
116 const ArrayView<const LO>& localVertex2AggID,
117 local_matrix_type& intermediateP) const;
118
120 void BuildCoarseLocalMatrix(const local_matrix_type& intermediateP,
121 local_matrix_type& coarseA) const;
122
124 void localSpGEMM(const local_matrix_type& A,
125 const local_matrix_type& B,
126 const std::string matrixLabel,
127 local_matrix_type& C) const;
128
130
131 private:
132}; // class NotayAggregationFactory
133
134} // namespace MueLu
135
136#define MUELU_NOTAYAGGREGATIONFACTORY_SHORT
137#endif /* MUELU_NOTAYAGGREGATIONFACTORY_DECL_HPP_ */
MueLu::DefaultLocalOrdinal LocalOrdinal
MueLu::DefaultScalar Scalar
MueLu::DefaultGlobalOrdinal GlobalOrdinal
MueLu::DefaultNode Node
Container class for aggregation information.
Class that holds all level-specific information.
typename Kokkos::View< impl_scalar_type *, Kokkos::LayoutLeft, device_type > row_sum_type
void BuildInitialAggregates(const Teuchos::ParameterList &params, const RCP< const Matrix > &A, const ArrayView< const LO > &orderingVector, const magnitude_type kappa, Aggregates &aggregates, std::vector< unsigned > &aggStat, LO &numNonAggregatedNodes, LO &numDirichletNodes) const
Initial aggregation phase.
void BuildFurtherAggregates(const Teuchos::ParameterList &params, const RCP< const Matrix > &A, const Teuchos::ArrayView< const LO > &orderingVector, const local_matrix_type &coarseA, const magnitude_type kappa, const row_sum_type &rowSum, std::vector< LO > &localAggStat, Array< LO > &localVertex2AggID, LO &numLocalAggregates, LO &numNonAggregatedNodes) const
Further aggregation phase increases coarsening rate by a factor of ~2 per iteration.
typename Teuchos::ScalarTraits< Scalar >::magnitudeType magnitude_type
void BuildIntermediateProlongator(const LO numRows, const LO numDirichletNodes, const LO numLocalAggregates, const ArrayView< const LO > &localVertex2AggID, local_matrix_type &intermediateP) const
Construction of a local prolongator with values equal to 1.0.
void BuildCoarseLocalMatrix(const local_matrix_type &intermediateP, local_matrix_type &coarseA) const
Implementation of a local Galerkin projection called inside BuildFurtherAggregates.
typename Matrix::local_matrix_device_type local_matrix_type
void BuildOnRankLocalMatrix(const local_matrix_type &localA, local_matrix_type &onRankA) const
typename device_type::execution_space execution_space
typename local_matrix_type::device_type device_type
typename Kokkos::ArithTraits< Scalar >::val_type impl_scalar_type
RCP< const ParameterList > GetValidParameterList() const
Return a const parameter list of valid parameters that setParameterList() will accept.
void DeclareInput(Level &currentLevel) const
Input.
void Build(Level &currentLevel) const
Build aggregates.
void localSpGEMM(const local_matrix_type &A, const local_matrix_type &B, const std::string matrixLabel, local_matrix_type &C) const
Wrapper for kokkos-kernels' spgemm that takes in CrsMatrix.
Base class for factories that use one level (currentLevel).
Namespace for MueLu classes and methods.
Tpetra::KokkosClassic::DefaultNode::DefaultNodeType DefaultNode
Tpetra::Details::DefaultTypes::scalar_type DefaultScalar