MueLu Version of the Day
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#ifdef HAVE_MUELU_KOKKOS_REFACTOR
51
52
53#include <Xpetra_Map_fwd.hpp>
54#include <Xpetra_Vector_fwd.hpp>
55#include <Xpetra_VectorFactory_fwd.hpp>
56#include <Xpetra_MapFactory_fwd.hpp>
57
58
59#include <Xpetra_Matrix.hpp>
60
61#include "MueLu_GraphBase.hpp"
62#include "MueLu_Exceptions.hpp"
64
66
67#include "MueLu_Level_fwd.hpp"
70
71namespace MueLu {
72
73template<class Scalar = DefaultScalar,
76 class Node = DefaultNode>
77class NotayAggregationFactory : public SingleLevelFactoryBase {
78#undef MUELU_NOTAYAGGREGATIONFACTORY_SHORT
80
81public:
83
84 using local_matrix_type = typename Matrix::local_matrix_type;
85 using device_type = typename local_matrix_type::device_type;
86 using execution_space = typename device_type::execution_space;
87 using magnitude_type = typename Teuchos::ScalarTraits<Scalar>::magnitudeType;
88 using impl_scalar_type = typename Kokkos::ArithTraits<Scalar>::val_type;
91
92
94
95
97 NotayAggregationFactory() { };
98
100 virtual ~NotayAggregationFactory() { }
101
102 RCP<const ParameterList> GetValidParameterList() const;
103
105
107
108
109 // Options shared by all aggregation algorithms
110
112
113
114 void DeclareInput(Level &currentLevel) const;
115
117
119
120
122 void Build(Level &currentLevel) const;
123
125 void BuildInitialAggregates(const Teuchos::ParameterList& params,
126 const RCP<const Matrix>& A,
127 const ArrayView<const LO>& orderingVector,
128 const magnitude_type kappa,
129 Aggregates& aggregates,
130 std::vector<unsigned>& aggStat,
131 LO& numNonAggregatedNodes,
132 LO& numDirichletNodes) const;
133
135 void BuildFurtherAggregates(const Teuchos::ParameterList& params,
136 const RCP<const Matrix>& A,
137 const Teuchos::ArrayView<const LO> & orderingVector,
138 const local_matrix_type& coarseA,
139 const magnitude_type kappa,
140 const row_sum_type& rowSum,
141 std::vector<LO>& localAggStat,
142 Array<LO>& localVertex2AggID,
143 LO& numLocalAggregates,
144 LO& numNonAggregatedNodes) const;
145
146 void BuildOnRankLocalMatrix(const local_matrix_type& localA,
147 local_matrix_type& onRankA) const;
148
150 void BuildIntermediateProlongator(const LO numRows,
151 const LO numDirichletNodes,
152 const LO numLocalAggregates,
153 const ArrayView<const LO>& localVertex2AggID,
154 local_matrix_type& intermediateP) const;
155
157 void BuildCoarseLocalMatrix(const local_matrix_type& intermediateP,
158 local_matrix_type& coarseA) const;
159
161 void localSpGEMM(const local_matrix_type& A,
162 const local_matrix_type& B,
163 const std::string matrixLabel,
164 local_matrix_type& C) const;
165
166
168
169private:
170}; // class NotayAggregationFactory
171
172}
173
174#define MUELU_NOTAYAGGREGATIONFACTORY_SHORT
175#endif //ifdef HAVE_MUELU_KOKKOS_REFACTOR
176#endif /* MUELU_NOTAYAGGREGATIONFACTORY_DECL_HPP_ */
MueLu::DefaultLocalOrdinal LocalOrdinal
MueLu::DefaultScalar Scalar
MueLu::DefaultGlobalOrdinal GlobalOrdinal
MueLu::DefaultNode Node
Namespace for MueLu classes and methods.
KokkosClassic::DefaultNode::DefaultNodeType DefaultNode