MueLu  Version of the Day
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
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 
50 #include <Xpetra_Map_fwd.hpp>
51 #include <Xpetra_Vector_fwd.hpp>
52 #include <Xpetra_VectorFactory_fwd.hpp>
53 #include <Xpetra_MapFactory_fwd.hpp>
54 
55 
56 #include <Xpetra_Matrix.hpp>
57 
58 #include "MueLu_ConfigDefs.hpp"
59 #include "MueLu_GraphBase.hpp"
60 #include "MueLu_Exceptions.hpp"
62 
64 
65 #include "MueLu_Level_fwd.hpp"
66 #include "MueLu_Aggregates_fwd.hpp"
67 #include "MueLu_Utilities_fwd.hpp"
68 
69 namespace MueLu {
70 
71 template<class Scalar = DefaultScalar,
74  class Node = DefaultNode>
76 #undef MUELU_NOTAYAGGREGATIONFACTORY_SHORT
77 #include "MueLu_UseShortNames.hpp"
78 
79 public:
81 
82  using local_matrix_type = typename Matrix::local_matrix_type;
83  using device_type = typename local_matrix_type::device_type;
84  using execution_space = typename device_type::execution_space;
86  using impl_scalar_type = typename Kokkos::ArithTraits<Scalar>::val_type;
89 
90 
92 
93 
96 
99 
101 
103 
105 
106 
107  // Options shared by all aggregation algorithms
108 
110 
111 
112  void DeclareInput(Level &currentLevel) const;
113 
115 
117 
118 
120  void Build(Level &currentLevel) const;
121 
124  const RCP<const Matrix>& A,
125  const ArrayView<const LO>& orderingVector,
126  const magnitude_type kappa,
127  Aggregates& aggregates,
128  std::vector<unsigned>& aggStat,
129  LO& numNonAggregatedNodes,
130  LO& numDirichletNodes) const;
131 
134  const RCP<const Matrix>& A,
135  const Teuchos::ArrayView<const LO> & orderingVector,
136  const local_matrix_type& coarseA,
137  const magnitude_type kappa,
138  const row_sum_type& rowSum,
139  std::vector<LO>& localAggStat,
140  Array<LO>& localVertex2AggID,
141  LO& numLocalAggregates,
142  LO& numNonAggregatedNodes) const;
143 
144  void BuildOnRankLocalMatrix(const local_matrix_type& localA,
145  local_matrix_type& onRankA) const;
146 
148  void BuildIntermediateProlongator(const LO numRows,
149  const LO numDirichletNodes,
150  const LO numLocalAggregates,
151  const ArrayView<const LO>& localVertex2AggID,
152  local_matrix_type& intermediateP) const;
153 
155  void BuildCoarseLocalMatrix(const local_matrix_type& intermediateP,
156  local_matrix_type& coarseA) const;
157 
159  void localSpGEMM(const local_matrix_type& A,
160  const local_matrix_type& B,
161  const std::string matrixLabel,
162  local_matrix_type& C) const;
163 
164 
166 
167 private:
168 }; // class NotayAggregationFactory
169 
170 }
171 
172 #define MUELU_NOTAYAGGREGATIONFACTORY_SHORT
173 #endif /* MUELU_NOTAYAGGREGATIONFACTORY_DECL_HPP_ */
RCP< const ParameterList > GetValidParameterList() const
Return a const parameter list of valid parameters that setParameterList() will accept.
MueLu::DefaultLocalOrdinal LocalOrdinal
KokkosClassic::DefaultNode::DefaultNodeType DefaultNode
void Build(Level &currentLevel) const
Build aggregates.
typename Kokkos::ArithTraits< Scalar >::val_type impl_scalar_type
Container class for aggregation information.
typename Matrix::local_matrix_type local_matrix_type
typename Teuchos::ScalarTraits< Scalar >::magnitudeType magnitude_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.
typename local_matrix_type::device_type device_type
void DeclareInput(Level &currentLevel) const
Input.
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.
MueLu::DefaultNode Node
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.
void BuildCoarseLocalMatrix(const local_matrix_type &intermediateP, local_matrix_type &coarseA) const
Implementation of a local Galerkin projection called inside BuildFurtherAggregates.
MueLu::DefaultScalar Scalar
MueLu::DefaultGlobalOrdinal GlobalOrdinal
Class that holds all level-specific information.
Definition: MueLu_Level.hpp:99
typename device_type::execution_space execution_space
void BuildOnRankLocalMatrix(const local_matrix_type &localA, local_matrix_type &onRankA) const
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&#39; spgemm that takes in CrsMatrix.
Base class for factories that use one level (currentLevel).
typename Kokkos::View< impl_scalar_type *, Kokkos::LayoutLeft, device_type > row_sum_type