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
55
56#include <Xpetra_Matrix_fwd.hpp>
57
59#include "MueLu_Exceptions.hpp"
61
63
64#include "MueLu_Level_fwd.hpp"
67
68namespace MueLu {
69
70template<class Scalar = DefaultScalar,
73 class Node = DefaultNode>
75#undef MUELU_NOTAYAGGREGATIONFACTORY_SHORT
77
78public:
80
81 using local_matrix_type = typename Matrix::local_matrix_type;
82 using device_type = typename local_matrix_type::device_type;
83 using execution_space = typename device_type::execution_space;
84 using magnitude_type = typename Teuchos::ScalarTraits<Scalar>::magnitudeType;
85 using impl_scalar_type = typename Kokkos::ArithTraits<Scalar>::val_type;
86 using row_sum_type = typename Kokkos::View<impl_scalar_type*, Kokkos::LayoutLeft, device_type>;
88
89
91
92
95
98
99 RCP<const ParameterList> GetValidParameterList() const;
100
102
104
105
106 // Options shared by all aggregation algorithms
107
109
110
111 void DeclareInput(Level &currentLevel) const;
112
114
116
117
119 void Build(Level &currentLevel) const;
120
122 void BuildInitialAggregates(const Teuchos::ParameterList& params,
123 const RCP<const Matrix>& A,
124 const ArrayView<const LO>& orderingVector,
125 const magnitude_type kappa,
126 Aggregates& aggregates,
127 std::vector<unsigned>& aggStat,
128 LO& numNonAggregatedNodes,
129 LO& numDirichletNodes) const;
130
132 void BuildFurtherAggregates(const Teuchos::ParameterList& params,
133 const RCP<const Matrix>& A,
134 const Teuchos::ArrayView<const LO> & orderingVector,
135 const local_matrix_type& coarseA,
136 const magnitude_type kappa,
137 const row_sum_type& rowSum,
138 std::vector<LO>& localAggStat,
139 Array<LO>& localVertex2AggID,
140 LO& numLocalAggregates,
141 LO& numNonAggregatedNodes) const;
142
143 void BuildOnRankLocalMatrix(const local_matrix_type& localA,
144 local_matrix_type& onRankA) const;
145
147 void BuildIntermediateProlongator(const LO numRows,
148 const LO numDirichletNodes,
149 const LO numLocalAggregates,
150 const ArrayView<const LO>& localVertex2AggID,
151 local_matrix_type& intermediateP) const;
152
154 void BuildCoarseLocalMatrix(const local_matrix_type& intermediateP,
155 local_matrix_type& coarseA) const;
156
158 void localSpGEMM(const local_matrix_type& A,
159 const local_matrix_type& B,
160 const std::string matrixLabel,
161 local_matrix_type& C) const;
162
163
165
166private:
167}; // class NotayAggregationFactory
168
169}
170
171#define MUELU_NOTAYAGGREGATIONFACTORY_SHORT
172#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.
Namespace for MueLu classes and methods.
Tpetra::KokkosClassic::DefaultNode::DefaultNodeType DefaultNode
Tpetra::Details::DefaultTypes::scalar_type DefaultScalar