MueLu Version of the Day
Loading...
Searching...
No Matches
MueLu_NotayAggregationFactory_decl.hpp
Go to the documentation of this file.
1// @HEADER
2//
3// ***********************************************************************
4//
5// MueLu: A package for multigrid based preconditioning
6// Copyright 2012 Sandia Corporation
7//
8// Under the terms of Contract DE-AC04-94AL85000 with Sandia Corporation,
9// the U.S. Government retains certain rights in this software.
10//
11// Redistribution and use in source and binary forms, with or without
12// modification, are permitted provided that the following conditions are
13// met:
14//
15// 1. Redistributions of source code must retain the above copyright
16// notice, this list of conditions and the following disclaimer.
17//
18// 2. Redistributions in binary form must reproduce the above copyright
19// notice, this list of conditions and the following disclaimer in the
20// documentation and/or other materials provided with the distribution.
21//
22// 3. Neither the name of the Corporation nor the names of the
23// contributors may be used to endorse or promote products derived from
24// this software without specific prior written permission.
25//
26// THIS SOFTWARE IS PROVIDED BY SANDIA CORPORATION "AS IS" AND ANY
27// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
28// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
29// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL SANDIA CORPORATION OR THE
30// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
31// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
32// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
33// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
34// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
35// NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
36// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
37//
38// Questions? Contact
39// Jonathan Hu (jhu@sandia.gov)
40// Andrey Prokopenko (aprokop@sandia.gov)
41// Ray Tuminaro (rstumin@sandia.gov)
42//
43// ***********************************************************************
44//
45// @HEADER
46#ifndef MUELU_NOTAYAGGREGATIONFACTORY_DECL_HPP_
47#define MUELU_NOTAYAGGREGATIONFACTORY_DECL_HPP_
48
49#include "MueLu_ConfigDefs.hpp"
50
51
52#include <Xpetra_Map_fwd.hpp>
53#include <Xpetra_Vector_fwd.hpp>
54#include <Xpetra_VectorFactory_fwd.hpp>
55#include <Xpetra_MapFactory_fwd.hpp>
56
57
58#include <Xpetra_Matrix.hpp>
59
60#include "MueLu_GraphBase.hpp"
61#include "MueLu_Exceptions.hpp"
63
65
66#include "MueLu_Level_fwd.hpp"
69
70namespace MueLu {
71
72template<class Scalar = DefaultScalar,
75 class Node = DefaultNode>
77#undef MUELU_NOTAYAGGREGATIONFACTORY_SHORT
79
80public:
82
83 using local_matrix_type = typename Matrix::local_matrix_type;
84 using device_type = typename local_matrix_type::device_type;
85 using execution_space = typename device_type::execution_space;
86 using magnitude_type = typename Teuchos::ScalarTraits<Scalar>::magnitudeType;
87 using impl_scalar_type = typename Kokkos::ArithTraits<Scalar>::val_type;
88 using row_sum_type = typename Kokkos::View<impl_scalar_type*, Kokkos::LayoutLeft, device_type>;
90
91
93
94
97
100
101 RCP<const ParameterList> GetValidParameterList() const;
102
104
106
107
108 // Options shared by all aggregation algorithms
109
111
112
113 void DeclareInput(Level &currentLevel) const;
114
116
118
119
121 void Build(Level &currentLevel) const;
122
124 void BuildInitialAggregates(const Teuchos::ParameterList& params,
125 const RCP<const Matrix>& A,
126 const ArrayView<const LO>& orderingVector,
127 const magnitude_type kappa,
128 Aggregates& aggregates,
129 std::vector<unsigned>& aggStat,
130 LO& numNonAggregatedNodes,
131 LO& numDirichletNodes) const;
132
134 void BuildFurtherAggregates(const Teuchos::ParameterList& params,
135 const RCP<const Matrix>& A,
136 const Teuchos::ArrayView<const LO> & orderingVector,
137 const local_matrix_type& coarseA,
138 const magnitude_type kappa,
139 const row_sum_type& rowSum,
140 std::vector<LO>& localAggStat,
141 Array<LO>& localVertex2AggID,
142 LO& numLocalAggregates,
143 LO& numNonAggregatedNodes) const;
144
145 void BuildOnRankLocalMatrix(const local_matrix_type& localA,
146 local_matrix_type& onRankA) const;
147
149 void BuildIntermediateProlongator(const LO numRows,
150 const LO numDirichletNodes,
151 const LO numLocalAggregates,
152 const ArrayView<const LO>& localVertex2AggID,
153 local_matrix_type& intermediateP) const;
154
156 void BuildCoarseLocalMatrix(const local_matrix_type& intermediateP,
157 local_matrix_type& coarseA) const;
158
160 void localSpGEMM(const local_matrix_type& A,
161 const local_matrix_type& B,
162 const std::string matrixLabel,
163 local_matrix_type& C) const;
164
165
167
168private:
169}; // class NotayAggregationFactory
170
171}
172
173#define MUELU_NOTAYAGGREGATIONFACTORY_SHORT
174#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.
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 Matrix::local_matrix_type local_matrix_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.
KokkosClassic::DefaultNode::DefaultNodeType DefaultNode
Tpetra::Details::DefaultTypes::scalar_type DefaultScalar