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 #include "MueLu_ConfigDefs.hpp"
50 
51 #include <Xpetra_Map_fwd.hpp>
52 #include <Xpetra_Vector_fwd.hpp>
53 
54 #include <Xpetra_Matrix_fwd.hpp>
55 
56 #include "MueLu_LWGraph_fwd.hpp"
57 #include "MueLu_Exceptions.hpp"
59 
61 
62 #include "MueLu_Level_fwd.hpp"
63 #include "MueLu_Aggregates_fwd.hpp"
64 #include "MueLu_Utilities_fwd.hpp"
65 
66 namespace MueLu {
67 
68 template <class Scalar = DefaultScalar,
71  class Node = DefaultNode>
73 #undef MUELU_NOTAYAGGREGATIONFACTORY_SHORT
74 #include "MueLu_UseShortNames.hpp"
75 
76  public:
78 
79  using local_matrix_type = typename Matrix::local_matrix_type;
80  using device_type = typename local_matrix_type::device_type;
81  using execution_space = typename device_type::execution_space;
83  using impl_scalar_type = typename Kokkos::ArithTraits<Scalar>::val_type;
84  using row_sum_type = typename Kokkos::View<impl_scalar_type*, Kokkos::LayoutLeft, device_type>;
86 
88 
89 
92 
95 
97 
99 
101 
102 
103  // Options shared by all aggregation algorithms
104 
106 
107 
108  void DeclareInput(Level& currentLevel) const;
109 
111 
113 
114 
116  void Build(Level& currentLevel) const;
117 
120  const RCP<const Matrix>& A,
121  const ArrayView<const LO>& orderingVector,
122  const magnitude_type kappa,
123  Aggregates& aggregates,
124  std::vector<unsigned>& aggStat,
125  LO& numNonAggregatedNodes,
126  LO& numDirichletNodes) const;
127 
130  const RCP<const Matrix>& A,
131  const Teuchos::ArrayView<const LO>& orderingVector,
132  const local_matrix_type& coarseA,
133  const magnitude_type kappa,
134  const row_sum_type& rowSum,
135  std::vector<LO>& localAggStat,
136  Array<LO>& localVertex2AggID,
137  LO& numLocalAggregates,
138  LO& numNonAggregatedNodes) const;
139 
140  void BuildOnRankLocalMatrix(const local_matrix_type& localA,
141  local_matrix_type& onRankA) const;
142 
144  void BuildIntermediateProlongator(const LO numRows,
145  const LO numDirichletNodes,
146  const LO numLocalAggregates,
147  const ArrayView<const LO>& localVertex2AggID,
148  local_matrix_type& intermediateP) const;
149 
151  void BuildCoarseLocalMatrix(const local_matrix_type& intermediateP,
152  local_matrix_type& coarseA) const;
153 
155  void localSpGEMM(const local_matrix_type& A,
156  const local_matrix_type& B,
157  const std::string matrixLabel,
158  local_matrix_type& C) const;
159 
161 
162  private:
163 }; // class NotayAggregationFactory
164 
165 } // namespace MueLu
166 
167 #define MUELU_NOTAYAGGREGATIONFACTORY_SHORT
168 #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
void Build(Level &currentLevel) const
Build aggregates.
typename Kokkos::ArithTraits< Scalar >::val_type impl_scalar_type
Tpetra::KokkosClassic::DefaultNode::DefaultNodeType DefaultNode
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
LocalOrdinal LO
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
Tpetra::Details::DefaultTypes::scalar_type DefaultScalar
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